Forums / Bug Reports / [Done 1.3.9] options values manager - duplicate rows if more than one lang installed

[Done 1.3.9] options values manager - duplicate rows if more than one lang installed

Locked

Views: 3,754

Results 1 to 6 of 6
This thread is locked. New replies are disabled.
8 Dec 2006, 3:03 PM
#1
hensema avatar

hensema

New Zenner

Join Date:
May 2006
Location:
the netherlands
Posts:
11
Plugin Contributions:
0

[Done 1.3.9] options values manager - duplicate rows if more than one lang installed

The query on line 646 from admin/options_values_manager.php generates duplicate rows.
Change to 'select distinct... ' to fix.

Patch against 1.3.5:

--- admin/options_values_manager.php    (revision 356)
+++ admin/options_values_manager.php    (revision 357)
@@ -643,7 +643,7 @@
 <?php
     $per_page = MAX_ROW_LISTS_OPTIONS;
 //    $values = "select pov.products_options_values_id, pov.products_options_values_name, pov2po.products_options_id, pov.products_options_values_sort_order from " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov left join " . TABLE_PRODUCTS_OPTIONS_VALUES_TO_PRODUCTS_OPTIONS . " pov2po on pov.products_options_values_id = pov2po.products_options_values_id where pov.language_id = '" . (int)$_SESSION['languages_id'] . "' and pov2po.products_options_values_id !='" . PRODUCTS_OPTIONS_VALUES_TEXT_ID . "' order by LPAD(pov2po.products_options_id,11,'0'), LPAD(pov.products_options_values_sort_order,11,'0'), pov.products_options_values_name";
-    $values = "select pov.products_options_values_id, pov.products_options_values_name, pov2po.products_options_id, pov.products_options_values_sort_order from " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov left join " . TABLE_PRODUCTS_OPTIONS_VALUES_TO_PRODUCTS_OPTIONS . " pov2po on pov.products_options_values_id = pov2po.products_options_values_id     left join " . TABLE_PRODUCTS_OPTIONS . " po on pov2po.products_options_id = po.products_options_id where pov.language_id = '" . (int)$_SESSION['languages_id'] . "' and pov2po.products_options_values_id !='" . PRODUCTS_OPTIONS_VALUES_TEXT_ID . "' order by  po.products_options_name, LPAD(pov.products_options_values_sort_order,11,'0'), pov.products_options_values_name";
+    $values = "select distinct pov.products_options_values_id, pov.products_options_values_name, pov2po.products_options_id, pov.products_options_values_sort_order from " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov left join " . TABLE_PRODUCTS_OPTIONS_VALUES_TO_PRODUCTS_OPTIONS . " pov2po on pov.products_options_values_id = pov2po.products_options_values_id     left join " . TABLE_PRODUCTS_OPTIONS . " po on pov2po.products_options_id = po.products_options_id where pov.language_id = '" . (int)$_SESSION['languages_id'] . "' and pov2po.products_options_values_id !='" . PRODUCTS_OPTIONS_VALUES_TEXT_ID . "' order by  po.products_options_name, LPAD(pov.products_options_values_sort_order,11,'0'), pov.products_options_values_name";
     if (!isset($_GET['value_page'])) {
       $_GET['value_page'] = 1;
     }
8 Dec 2006, 3:23 PM
#2
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: [Done 1.3.9] options values manager - duplicate rows if more than one lang installed

We have had no issues with this ...

What are you doing when you see these duplicate rows?

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

8 Dec 2006, 4:32 PM
#3
hensema avatar

hensema

New Zenner

Join Date:
May 2006
Location:
the netherlands
Posts:
11
Plugin Contributions:
0

Re: [Done 1.3.9] options values manager - duplicate rows if more than one lang installed

I get the duplicate rows when opening the options value manager, when it displays the list of all option values.

The rows are duplicated, but not displayed next to each other. For example option ID 2 could be displayed on page 1 and page 20.

Using this patch we've gone down from 79 to 19 pages of option values.

We've got about 6 option types and 4 languages installed.

18 Jun 2007, 4:55 PM
#4
shirster avatar

shirster

Zen Follower

Join Date:
Sep 2005
Location:
Hong Kong
Posts:
301
Plugin Contributions:
0

Re: [Done 1.3.9] options values manager - duplicate rows if more than one lang installed

I got the same problem on a 1.3.7 install. 2 languages and only 3 products.

Please see the screen cap attached.

Thanks,
Shirley

19 Jun 2007, 11:32 AM
#5
shirster avatar

shirster

Zen Follower

Join Date:
Sep 2005
Location:
Hong Kong
Posts:
301
Plugin Contributions:
0

Re: [Done 1.3.9] options values manager - duplicate rows if more than one lang installed

Does anyone know how to fix this?

Thanks !
Shirley

2 Jul 2007, 6:16 PM
#6
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,515
Plugin Contributions:
176

Re: [Done 1.3.9] options values manager - duplicate rows if more than one lang installed

The proper fix is not to use "distinct" but rather to add this into the "where" clause section: ```
and po.language_id = pov.language_id


v1.3.7:
/admin/options_values_manager.php
line 646 contains:```
    $values = "select pov.products_options_values_id, pov.products_options_values_name, pov2po.products_options_id, pov.products_options_values_sort_order from " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov left join " . TABLE_PRODUCTS_OPTIONS_VALUES_TO_PRODUCTS_OPTIONS . " pov2po on pov.products_options_values_id = pov2po.products_options_values_id     left join " . TABLE_PRODUCTS_OPTIONS . " po on pov2po.products_options_id = po.products_options_id where pov.language_id = '" . (int)$_SESSION['languages_id'] . "' and pov2po.products_options_values_id !='" . PRODUCTS_OPTIONS_VALUES_TEXT_ID . "' order by  po.products_options_name, LPAD(pov.products_options_values_sort_order,11,'0'), pov.products_options_values_name";
```change by adding extra clause as shown:
$values = "select pov.products_options_values_id, pov.products_options_values_name, pov2po.products_options_id, pov.products_options_values_sort_order from " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov left join " . TABLE_PRODUCTS_OPTIONS_VALUES_TO_PRODUCTS_OPTIONS . " pov2po on pov.products_options_values_id = pov2po.products_options_values_id left join " . TABLE_PRODUCTS_OPTIONS . " po on pov2po.products_options_id = po.products_options_id where pov.language_id = '" . (int)$_SESSION['languages_id'] . "'** and po.language_id = pov.language_id **and pov2po.products_options_values_id !='" . PRODUCTS_OPTIONS_VALUES_TEXT_ID . "' order by po.products_options_name, LPAD(pov.products_options_values_sort_order,11,'0'), pov.products_options_values_name";

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.