Jump to content
  • Checkout
  • Login
  • Get in touch


The e-commerce.

assigning a sales rep.


Recommended Posts

I'm wondering if anyone can help with this.

I'm trying to find a way to assign a sales rep code to each customer.


I want to be able to do it manually from the os commerce backend.


Where we can fill in a field with a sales rep code, and it will show up on the purchase orders' and receipts in the system.


This is in order to keep track of what sales reps have brought in what orders.




Thank you!

Link to comment
Share on other sites



Long time no see...let's keep it cordial.


I would create 2 extra tables: reps and customers2reps.



rep_id (autoincrement, INT 11)


PRIMARY (rep_id)





PRIMARY (customer_id, rep_id)


Once you have the reps tables setup and populated it is a trivial matter to create a drop down list in the admin. For tracking and reporting purposes just create a script to pull each order and JOIN with the appropriate reps row.




BTW - Care to show me a preview of Bruce's new site? :)

Link to comment
Share on other sites

Also, if this is for Bruce's site and you want to automate the assignment process a bit (I know he gets a lot of orders daily) then on checkout_process do the following:


Pull the last order from the orders table sorted by timestamp (LIMIT 1) then find the next rep in order. Create or use some "move next" function much like ADODB or PEAR::DB. This will allow you to implement a layer of load balancing. Alternately, you can pull the customers2reps table grouping by rep_id and sort DESC and assign the order to the first rep thereby having another layer of load balancing (the one with the LEAST number of orders will get the assignment).



Link to comment
Share on other sites



Thanks for the reply!


i think you have me confused with a different Ezra. :D

i know there arent too many of us around..


but thanks for the help!. i think that ur instructions are a bit too complicated for me lol.


Heres another idea, i have a mod installed called total b2b, it has a module for "group pricing" if i assign a group per sales rep, and then assign the customer to the sales rep's group, i'm set. The only thing is, how do i display the "group id name" on the purchase orders and invoices. I'm assuming i have to moddify the invoice.php file and include the code to have it display the table. but i'm not sure what that code is or how it would select the customer name out of the table?

Link to comment
Share on other sites


This topic is now archived and is closed to further replies.

  • Create New...