nathanbright Posted August 3, 2015 Share Posted August 3, 2015 My version of the Foundation skin (CC6) ignores the count of products to add to the cart when doing so from the category page, in list mode (but it works if the page is in grid mode)This works in the Foundation skin so I suspect there's been a fix since I copied itMy "diff juju" is not working, I cannot figure out where the item count is being read. Can anyone point me in the right direction please? I expect it's somewhere in either the 2.cubecart.js or perhaps an attribute in the css / html. But I can't see it for looking Quote Link to comment Share on other sites More sharing options...
bsmither Posted August 3, 2015 Share Posted August 3, 2015 Amazing no one has caught this.In the Foundation template content.category.php, compare these two ranges of statements. The first is for list view, the second for grid view.Lines 111-120: {elseif $product.ctrl_stock && !$CATALOGUE_MODE} <div class="row collapse"> <div class="small-4 columns"> <input type="text" name="quantity" value="1" class="quantity text-center"> </div> <div class="small-8 columns"> <button type="submit" value="{$LANG.catalogue.add_to_basket}" class="button small postfix">{$LANG.catalogue.add_to_basket}</button> </div> </div> {elseif !$CATALOGUE_MODE} Lines 170-180 {elseif $product.ctrl_stock && !$CATALOGUE_MODE} <div class="row collapse marg-top"> <div class="small-3 columns"> <input type="text" name="quantity" value="1" class="quantity text-center" disabled> </div> <div class="small-9 columns "> <button type="submit" value="{$LANG.catalogue.add_to_basket}" class="button small postfix">{$LANG.catalogue.add_to_basket}</button> <input type="hidden" name="add" value="{$product.product_id}"> </div> </div> {elseif !$CATALOGUE_MODE} Note that there is a missing <input type="hidden" name="add" value="{$product.product_id}"> in the list view statements. Please add it.While you are there, near line 130:Make the change to: <div class="product_grid_view hide"> {* Issue 708 <!-- <form action="{$VAL_SELF}" method="post" class="panel add_to_basket"> --> *} <div data-equalizer-watch> Note that Kurouto's View category code is:<form> <input type="text" name="add[{$product.product_id}][quantity]" value="1" class="quantity" /> <input type="submit" value="{$LANG.catalogue.add_to_basket}" class="button_white" /> </form> --repeat--From a page where the customer sees more than one product (sale items, category, latest products), the implication is that the customer can make changes to the quantity on all products displayed, and click Add to Basket on any of them, and all products will be added to the basket. But that's not the case. Quote Link to comment Share on other sites More sharing options...
havenswift-hosting Posted August 6, 2015 Share Posted August 6, 2015 Brian has opened a git issue for this https://github.com/cubecart/v6/issues/719 Quote Link to comment Share on other sites More sharing options...
Al Brookbanks Posted August 19, 2015 Share Posted August 19, 2015 (edited) I'm sorry but I am not able to reproduce this. I do recall this issue of one very similar some months back which was fixed in version control. I expect OP's code is not latest. Edited August 19, 2015 by Al Brookbanks Quote Link to comment Share on other sites More sharing options...
nathanbright Posted August 19, 2015 Author Share Posted August 19, 2015 Hi Al et alApologies for the "radio silence", I tried bsmithers solution, did not solve my issue, then went on holidayYou are quite right Al, I took a copy of Foundation back in late March (2015). Unfortunately for me there have been significant changes since, so "diff"ing gives me a "snow" of changes. So much so I feel I am unable to reverse them all in (as well as not being able to determine which is the solution to my issue)It feels like that missing ID input field is relevantI appreciate this is effectively an unsupported branch of the Foundation code, but would appreciate if someone could point me at the javascript that reads the quantity field during the add-to-cart action Quote Link to comment Share on other sites More sharing options...
bsmither Posted August 19, 2015 Share Posted August 19, 2015 Generally, there is no specific javascript statement that reads the quantity field. What happens in 2.cubecart.js, near line 339 (function add_to_basket), is that the form's complete set of input elements are 'serialized'. This is a jQuery function that collects the values from all the child <input> elements of the respective form.Thus, if there is no form element for add=product_id, that product will not get added to the cart. Yes, the quantity will get sent to CubeCart, but not the product_id.On the other hand... as opposed to my previous experiments, the unrendered input that has the 'add' key is getting sent properly. Both the rendered section (list or grid) and the unrendered section, all the form elements are within the one form block and all non-disabled elements will get serialized. Quote Link to comment Share on other sites More sharing options...
nathanbright Posted August 20, 2015 Author Share Posted August 20, 2015 Aha, that explains my mystification, serialisedThanks. I'll check again given this new info Quote Link to comment Share on other sites More sharing options...
nathanbright Posted August 25, 2015 Author Share Posted August 25, 2015 Got it. Typically enough, staring me in the faceI doubt this will help anyone but for the sake of completeness. I had this<input type="text" name="add[{$product.product_id}][quantity]" value="1" class="quantity text-center">which should have been this<input type="text" name="quantity" value="1" class="quantity text-center">I.e. it was being serialised fine, just being given the wrong nameThanks for the help, good learning going on here Quote Link to comment Share on other sites More sharing options...
bsmither Posted August 25, 2015 Share Posted August 25, 2015 There was a version of CubeCart a few years back where name="add[{$product.product_id}][quantity]" value="1" is a valid configuration for any page where more than one product was listed -- View Category (includes Sale Items and Search Results) and Latest Products. These also had code that gave only one all-encompassing <form> block - not a separate <form> block for each product panel.The class function Cart->add() has code to determine if $_POST['add'] is an array (multi add to basket) or something else (scalar: single add to basket).However, I suspect your customizations affected how other parts of the <form> data was being interpreted by the class function. Quote Link to comment Share on other sites More sharing options...
nathanbright Posted August 25, 2015 Author Share Posted August 25, 2015 Yep, that makes senseAre there any tools, possibly as part of github, that can be used to see differences between releases of individual files?So for instance to see the changes (if any) in <Foundation skin>/content.category.php between CC version 6.0.1 and 6.0.2 Quote Link to comment Share on other sites More sharing options...
Al Brookbanks Posted August 25, 2015 Share Posted August 25, 2015 http://www.scootersoftware.com/ Quote Link to comment Share on other sites More sharing options...
bsmither Posted August 25, 2015 Share Posted August 25, 2015 Plenty. Some decent file-diff utilities are free, some are not so decent and are not free. And everything in-between. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.