gburton / CE-Phoenix

WE KEPT OSCOMMERCE ALIVE, but now this Repo is defunct, please see the new Repo URL listed below.
https://github.com/CE-PhoenixCart/PhoenixCart
131 stars 202 forks source link

Multiplicated product attributes if more than one store language #981

Closed raiwa closed 4 years ago

raiwa commented 4 years ago

In Admin/products_attributes.php in the Products Attributes table, the popducts attributes get duplicated for each additional store language, Not noticeable if only one store language. The error was introduced in 1.0.6.2 with the query update line 505: good one 1.0.6.1: $attributes = "select pa.* from products_attributes pa left join products_description pd on pa.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' order by pd.products_name"; bad one 1.0.6.2: $attributes = "select pa.* from products_attributes pa left join products_options po on po.products_options_id = pa.options_id left join products_options_values pov on pov.products_options_values_id = pa.options_values_id left join products_description pd on pa.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' order by pd.products_name, po.products_options_name, pov.products_options_values_name";

gburton commented 4 years ago

The new SQL is the one to base a fix on. If you could take a look at fixing this it would be helpful.

ecartz commented 4 years ago
  $attributes = sprintf(<<<'EOSQL'
select pa.*
 from products_attributes pa
   left join products_options po on po.products_options_id = pa.options_id and po.language_id = %1$d
   left join products_options_values pov on pov.products_options_values_id = pa.options_values_id and pov.language_id = %1$d
   left join products_description pd on pa.products_id = pd.products_id and pd.language_id = %1$d
 order by pd.products_name, po.products_options_name, pov.products_options_values_name
EOSQL
    , (int)$languages_id);

Does that fix it while retaining the new behavior? It seems to work in the single language case with the sample products.

gburton commented 4 years ago

It does thank you Matt. I tested on my dual language EN/FR shop. We'll drop that in 1073 as there are a couple of other things to do in the page in 1073.

TY Raiwa for the heads up on the language problem.

raiwa commented 4 years ago

Tested in my 2 language store and it works

gburton commented 4 years ago

TY both