Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Mutually Exclusive Products


tripp

Recommended Posts

I am implementing a site where certain products can NOT be added to the shopping cart together. If the user tries to add a product and one of the mutually exclusive products is already in the cart, a message will appear informing the user and the item will not be added.

 

Is there something like this already out there? If not, does anybody have any suggestions for how I can do this?

 

 

Thanks,

Chad Arimura

Link to comment
Share on other sites

hmm tricky

 

only thing i can think of right now is somehow setting up a list of product ids that cannot be purchased together. ie products 1 has 2,3,4 in its denied table field. so if 1 is bought, then they try to buy 2,3 or 4 then it looks in the field and says - 2 is in the list so deny.

 

not sure on the code though! sorry. - im not sure how you get a comma seperated list into a table and how you match the comma seperated numbers up to the product being added.

always here to offer some useless advice....

Link to comment
Share on other sites

I think I would start with the X-Sell (or Cross-Sell, I think they're the same) contribution. I know, that's exactly the opposite of what you need - but the system for associating product with each other would already be in place.

 

In case you're not familiar, X-Sell allows you to suggest other products to the customer based on what he's looking at or what's in his cart. For example if the customer is looking at a CD-RW drive, you could show him a spindle of CDs that he might want to buy to go with it. You could modify those queries so that if X is in the cart, Y can't be added and brings up an error message.

 

I'm also a little curious about what you're selling...

Chris Dunning

osCommerce, Contributions Moderator Team

 

Please do not send me PM! I do not read or answer these often. Use the email button instead!

 

I do NOT support contributions other than my own. Emails asking for support on other people's contributions will be ignored. Ask in the forum or contact the contribution author directly.

Link to comment
Share on other sites

I worked on it late last night....

 

I set a flag in the products table (products.products_subscription_item) to 1 for exclusive products. Then when the products are displayed it sets a hidden field to 1 for each of those products.

 

The add to cart button passes this hidden value to the cart->add() method which in turn sets a session variable that says "don't allow any more subscription items into the cart"

 

fyi: we offer subscription cards to a service (1 week, 1 month, 6 months, 1 year) and each of these items passes a value to our payment gateway setting up a recurring transaction. But i wouldn't know how to handle a case where somebody accidently tries to purchase more than one subscription item.

 

Thanks for your help! any other comments are welcome... i'll post the site and possibly some contributions when finished (if any code is salvagable for use by other people ;)

 

Chad

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...