rcaresia Posted April 5, 2010 Share Posted April 5, 2010 Hey guys,I´ve got a problem, the user select the attribute and press button buy, then always goes to cart the default attribute.EX: Default is 110v.If user select 220v and click buy, add in chart 110v becouse its default in combination.The system ignores the selection made by user and add only the default.Someone knows how to resolve?thanks! Link to comment Share on other sites More sharing options...
rocky Posted April 6, 2010 Share Posted April 6, 2010 Most likely, there is a Javascript error on your product page that is causing the selected attribute to not be updated. Can you provide a link to your site to check for Javascript errors? Link to comment Share on other sites More sharing options...
rcaresia Posted April 6, 2010 Author Share Posted April 6, 2010 Sure, the url is http://www.brasilmc.com.br . thanks. Link to comment Share on other sites More sharing options...
rocky Posted April 6, 2010 Share Posted April 6, 2010 The following Javascript error is causing the problem: Message: Object expected Line: 62 Char: 5 Code: 0 URI: http://www.brasilmc.com.br/themes/brasilMC/js/product.js I see that you are using Prestashop v1.2.0.8 and your website has been heavily customised. It is barely recognisable as a Prestashop website. Have you copied over code from a different shopping cart?Unfortunately, I don't know how to fix this problem in this specific version of Prestashop. I don't think that version of Prestashop has "v1.1 theme compatibility" mode. I can only suggest that you upgrade to a newer version of Prestashop when you can, since this is likely caused by an old bug that was fixed. Link to comment Share on other sites More sharing options...
rcaresia Posted April 6, 2010 Author Share Posted April 6, 2010 Its a shopping cart from prestashop, its all prestashop but we modified some things becouse client requested hehehe.. but all we have done is prestashop.but the problem is.. if we upgrade we will lost alot of changes... Link to comment Share on other sites More sharing options...
tomerg3 Posted April 6, 2010 Share Posted April 6, 2010 I see the following error now:Error: in_array is not definedSource File: http://www.brasilmc.com.br/themes/brasilMC/js/product.jsLine: 62Line 62 = "if (in_array(combinations[combination]['idsAttributes'][idAttribute], choice))"in_array is a php command, not a javascript one. Link to comment Share on other sites More sharing options...
setgian Posted April 7, 2010 Share Posted April 7, 2010 dude, you've helped us with a BIG problem, thank you very much!for everyone who needs the solution, you should put this function in root/themes/your_theme/js/product.js: function in_array (needle, haystack, argStrict) { var key = '', strict = !!argStrict; if (strict) { for (key in haystack) { if (haystack[key] === needle) { return true; } } } else { for (key in haystack) { if (haystack[key] == needle) { return true; } } } return false; } cheers! Link to comment Share on other sites More sharing options...
rocky Posted April 7, 2010 Share Posted April 7, 2010 I was going to report this as a bug until I realised that in_array is already defined in js/tools.js in my theme directory. I had a look at http://www.brasilmc.com.br/themes/brasilMC/js/tools.js and noticed that it doesn't have this function and the file is completely different to my one. I don't understand why it is different. Here's what's at the bottom of my js/tools.js: //verify if value is in the array function in_array(value, array) { for (var i in array) if (array[i] == value) return true; return false; } Link to comment Share on other sites More sharing options...
setgian Posted April 7, 2010 Share Posted April 7, 2010 Rocky, As rcaresia told you, the shop was customized a lot, the customer requested a lot, I'm pretty sure we were wrong while changing some of these files. Anyways, I really appreciate the help!p.s.: sorry about my english Link to comment Share on other sites More sharing options...
conidig Posted September 1, 2014 Share Posted September 1, 2014 same problem, tried adding the string at the end of the file but nothing changes Link to comment Share on other sites More sharing options...
Recommended Posts