Jump to content

[Problem SOLVED] cant select the right attribute.


Recommended Posts

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

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

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

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! :lol:

Link to comment
Share on other sites

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

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

  • 4 years later...
×
×
  • Create New...