Projekt

Allgemein

GX-Abgewiesen #69219

Von Till Tepelmann vor mehr als 3 Jahren aktualisiert

Wenn die gleichen Optionswerte unterschiedlichen Optionen zugeordnet sind, kann man die Artikel nicht mehr aus dem Warenkorb löschen, da die Ids dann beim Auslesen nicht mehr eindeutig sind. 

 Das kann wie folgt reproduziert werden: 

 1. Artikel anlegen 
 2. Option "Farbe" anlegen 
 3. Option "Metallfarbe" anlegen 
 3. Optionswerte "rot", "grün" "blau" anlegen 
 4. In der Datenbanktabelle die Zuweisung für die Optionswerte so anpassen, dass die gleichen IDs einmal der Option "Farbe" und einmal der Option "Metallfarbe" zugewiesen sind 
 5. Einem Artikel die Farbe mit den Optionen zuweisen 
 6. Einem anderen Artikel die "Metallfarbe" mit den gleichen Optionen zuweisen 
 7. Den Artikel in den Korb legen 
 8. Den Artikel aus dem Korb löschen 

 Erwartetet Ergebnis: 
 Wenn man ein Artikel in den Korb legt, dann sollte der auch wieder gelöscht werden, auch wenn die gleichen Optionswerte einer anderen Option zugeordnet wurden 

 Tatsächliches Ergebnis: 
 Man mann Artikel nicht mehr aus dem Korb löschen, wenn die gleichen Optionswerte unterschiedlichen Optionen zugewiesen sind. 

 Das könnte passieren z.B. wenn man die Optionswerte über eine Wawi in den Shop importiert und die Zuordnung in der Tabelle "products_options_values_to_products_options" dann vornimmt. 

 Da die Werte in der Tabelle products_attributes nicht eindeutig sind mit dieser Zuweisung muss die products_id mit angegben werden im ein eindeutiges Ergebnis zu erhalten. 
 Ein distinct reicht in diesem Fall dann nicht mehr aus. 

 ``` php 
      $optionIdResult = $builder->select('options_id, options_values_id') 
             ->distinct() 
             ->from('products_attributes') 
             ->where('options_values_id IN (' . implode(', ', $valueIds) . ')') 
             ->execute(); 
 ``` 

 If the same option values are assigned to different options, it is no longer possible to delete the products from the shopping cart, because the ids are then no longer unique when read out. 

 This can be reproduced as follows: 

 1. create product 
 2. create option "color 
 3. create option "metal color 
 3. create option values "red", "green" "blue 
 4. adjust the assignment for the option values in the database table so that the same IDs are assigned once to the "color" option and once to the "metal color" option 
 5. assign the color with the options to one product 
 6. assign the "Metal color" with the same options to another product 
 7. put the product into the basket 
 8. delete the product from the basket 

 Expected result: 
 If you put a product in the basket, it should be deleted, even if the same option values were assigned to another option 

 Actual result: 
 You can't delete products from the basket if the same option values are assigned to different options. 

 This could happen e.g. if you import the option values into the db via a ERP and then make the assignment in the table "products_options_values_to_products_options". 

 Since the values in the table products_attributes are not unique with this assignment, the products_id must be specified to get a unique result. 
 A distinct is then no longer sufficient in this case.

Zurück