Jump to content

Update from 1.7.3 to 1.7.4.1 : Product variants are not working


New Slang

Recommended Posts

Hello,

 

I just updated Prestashop to 1.7.4.1 and now the product variants are not working as expected. I have a product with 4 different attributes and 35 different combinations. Before the update, only the available variant for each attribute was available. For example when arriving on the page, the first combination was shown and when I changed the first attribute, it refreshed the other attributes only showing the ones compatible with the first one I selected.

Now it looks like all the product variants are there but if I select an attribute that doesn't work with the other attributes, I get an error on the Ajax call and it doesn't work. Here's the error I get :

ContextErrorException
Warning: preg_match() expects parameter 2 to be string, array given

In Validate.php but since it's a generic class, the error comes from controllers/front/ProductController in canonicalRedirection() method. I understand why it wouldn't work since the attributes selected doesn't return any existing product. But I would like to know how to show, in the product variants, only the variant that work with each other. The way it was working before !

I tried to dump the variant infos but there is no way to check if the current variant is available for this selection. Here's an excerpt :

array:4 [
  3 => array:6 [
    "group_name" => "Tailles perlage"
    "name" => "Taille"
    "group_type" => "select"
    "default" => 38
    "attributes" => array:7 [
      38 => array:4 [
        "name" => "1.5 x 15"
        "html_color_code" => ""
        "texture" => ""
        "selected" => true
      ]
      39 => array:4 [
        "name" => "2 x 20"
        "html_color_code" => ""
        "texture" => ""
        "selected" => false
      ]
      40 => array:4 [
        "name" => "2.5 x 23"
        "html_color_code" => ""
        "texture" => ""
        "selected" => false
      ]
      41 => array:4 [
        "name" => "3 x 22"
        "html_color_code" => ""
        "texture" => ""
        "selected" => false
      ]
      42 => array:4 [
        "name" => "3 x 23"
        "html_color_code" => ""
        "texture" => ""
        "selected" => false
      ]
      43 => array:4 [
        "name" => "4 x 26"
        "html_color_code" => ""
        "texture" => ""
        "selected" => false
      ]
      44 => array:4 [
        "name" => "5 x 28"
        "html_color_code" => ""
        "texture" => ""
        "selected" => false
      ]
    ]
    "attributes_quantity" => array:7 [
      38 => -36
      39 => 0
      40 => 0
      41 => -120
      42 => 0
      43 => 0
      44 => 0
    ]
  ]
  4 => array:6 []
  5 => array:6 []
  6 => array:6 []
]

 

Do you know anything about this ? Do I need to override the method that's fetching the list of variants to correct it ? I saw that ProductController.php and Product.php slightly changed between version, especially the way it's fetching combinations. But it doesn't seem to be what's causing the problem.

 

 I'm getting tired of fixing bugs (already must have fixed half a dozen) only to be able to work with a "stable" CMS...

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...