Dataset Question

Hi,
I am setting up a website for our company to help manage our sales team. The company has salespeople who sale our products (wholesale) to retailers. We want those retailers to be able to purchase directly from our website without the help of the salesperson who got the started. However, we need to track those retail sales back to the salesperson.

So, my thought is to create a unique ID for each salesperson and then associate that unique ID to each retail account so that the sales of each retailer can be tracked and totaled based on the salespeople.

My plan is to create a new data collection where this salesperson ID will be assigned. Then, when they sign up a new retail account, we add that salesperson ID to that retailer account. I was thinking that we could also insert that salesperson ID with every purchase made by a retailer too? But I am not sure exactly how that would work with the Wix Store? We are using Square as our payment gateway so that makes things a little more tricky as well.

Does anyone have any thoughts on how maybe it would be best to set this up in Wix? I am very familiar with Visual Studio and MS SQL but I’m new to the Wix dataset architecture.

Thanks!

It looks like you can use reference fields in your database in order to tie together different collections.

You can find more information about it here: https://support.wix.com/en/article/about-reference-fields-in-database-collections

As for adding an ID to every purchase it would depend on how your store is built. If you are using a standard Wix Stores App, then it won’t be possible to add additional fields to your orders collection.

However, if you are using a custom built Store with Pay API, then you can insert a reference to another collection when submitting an order. You can find more information about it here:

https://www.wix.com/corvid/reference/wix-pay.html
https://www.wix.com/corvid/reference/wix-data.html#insertReference