Limit php cart items to 1 seller ID at a time?

84 views Asked by At

I have a fully functional cart, programmed with PHP that uses session cookies. My site will host items from multiple sellers and to avoid getting into PayPal parallel payments (just now) I need to be able to limit each session to items from 1 seller only per checkout. What is the best way to go about this?

I have tried counting seller IDs and running an if statement (if >1) to redirect to a slightly altered cart page requesting items from multiple sellers to be removed in order to continue.

The problem with this approach seems to be with counting the arrays (it will only count 1 id that relates to one particular item in the cart array).

Any suggestions would be greatly appreciated.

2

There are 2 answers

0
Armage On

After your client choose his first item, you may refresh the pages, displaying only the newly allowed items (the ones that are from the same sellers as the first choosen item).

But it seems strange to force the user to do that...

0
PHPkiller On

i know this is old but it can be of help to any one searshing something like this this is something i was working on recently so i came with this idea to group the sellers with their items so you checkout by the seller but they still can add more items this is much more easy to make than to limit it to one seller like how you said