eforer Posted October 23, 2009 Posted October 23, 2009 Hi all, This is my first post and I'm pretty new to osCommerce. I've searched and haven't really found an answer to my question, and after hours of staring at my screen I've come to ask you all fo rhelp. We have our site up and running well with osCommerce right now, but I have an unusual issue. I need to modify my cart so that it displays multiple instances of the same item instead of increasing the quantity. IE, if someone adds two of the same thing to the cart, it displays the item twice and not once with a quantity of 2. Does anyone have any thoughts? Thanks
web-project Posted October 25, 2009 Posted October 25, 2009 We have our site up and running well with osCommerce right now, but I have an unusual issue. I need to modify my cart so that it displays multiple instances of the same item instead of increasing the quantity. IE, if someone adds two of the same thing to the cart, it displays the item twice and not once with a quantity of 2. unless the same item have the different options it simply impossible. Please read this line: Do you want to find all the answers to your questions? click here. As for contribution database it's located here! 8 people out of 10 don't bother to read installation manuals. I can recommend: if you can't read the installation manual, don't bother to install any contribution yourself. Before installing contribution or editing/updating/deleting any files, do the full backup, it will save to you & everyone here on the forum time to fix your issues. Any issues with oscommerce, I am here to help you.
♥kymation Posted October 25, 2009 Posted October 25, 2009 You could probably do this with some changes to the shoppingCart class (catalog/includes/classes/shopping_cart.php.) The add_cart() method will need to be modified to remove the check for an existing product with the same ID. This is on Line 110 of the stock osC 2.2RC2a file. You should probably also set the Product Quantities In Shopping Cart to 1 to keep the customer from increasing the quantity on the shopping cart page. One defect that I can think of is that the Remove function in the cart works by the Product ID, so an attempt to remove one instance of a product will remove all of that product. There may be other issues as well; this is just a quick survey of the problem. Be very certain that you want to do this before starting, as it's likely to be a lot of work to implement properly. Regards Jim See my profile for a list of my addons and ways to get support.
eforer Posted October 25, 2009 Author Posted October 25, 2009 What about passing attributes to the add_cart function? I've tried passing a string, but that didn't seem to effect anything, what is the correct form to pass attribute info in and will doing so make the objects show up individually and not net their quantities?
♥kymation Posted October 25, 2009 Posted October 25, 2009 Attributes are product options (Color, Size, etc.) They need to be passed in a specific format. Nothing that you do there will affect the way the cart adds products. You could add another parameter to this method and use that to control whether the product quantity is incremented or not. You would probably need to add a database field to use as the control. More work, but it could be done. Regards Jim See my profile for a list of my addons and ways to get support.
eforer Posted October 26, 2009 Author Posted October 26, 2009 Attributes are product options (Color, Size, etc.) They need to be passed in a specific format. Nothing that you do there will affect the way the cart adds products. You could add another parameter to this method and use that to control whether the product quantity is incremented or not. You would probably need to add a database field to use as the control. More work, but it could be done. Regards Jim So if each item is the same id, but has different attributes, it will still just increment quantity? The issue I have is I wrote a flash app that allows customers to create their own sets of custom jewelry, and each set has to be listed separately for production purposes for the manufacturer. So if two sets have two of the same Id's, the item gets netted to the first set and appears as part of that set instead of the latter one. I was hoping I could artificially set some attributes (use a session variable that increments and make that an attribute or something) when I call add_cart() to make them show up separately.
eforer Posted October 26, 2009 Author Posted October 26, 2009 Can someone explain how the attributes/product options setup works? What are the relationships with the tables in the DB and what do I pass to add_cart() to make it create an item with "options."
♥kymation Posted October 26, 2009 Posted October 26, 2009 If the attributes are different, the product will be added as a separate product. The attributes are passes in the URL as an added string on the products_id. So I can have http://www.example.com/product_info.php?cPath=4_22&products_id=28{3}8 with one option and http://www.example.com/product_info.php?cPath=4_22&products_id=28{3}9 as a different option. You could set up a sample product with attributes and try this out. There's probably another way to do this, but I can't think of one right now. Regards Jim See my profile for a list of my addons and ways to get support.
Recommended Posts
Archived
This topic is now archived and is closed to further replies.