
Originally Posted by
abcisme
I found someone who could help me sort out this issue. Here is the fix to make it show only the default language, which in my case was language ID 1. If your language ID is something else, change language_id=1 to language_id=YOUR_ID
in admin/edit_orders.php
REPLACE:
Code:
$result = $db -> Execute("SELECT products_name, p.products_id, categories_name, ptc.categories_id FROM " . TABLE_PRODUCTS . " p LEFT JOIN " . TABLE_PRODUCTS_DESCRIPTION . " pd ON pd.products_id=p.products_id LEFT JOIN " . TABLE_PRODUCTS_TO_CATEGORIES . " ptc ON ptc.products_id=p.products_id LEFT JOIN " . TABLE_CATEGORIES_DESCRIPTION . " cd ON cd.categories_id=ptc.categories_id ORDER BY categories_name");
WITH:
Code:
$result = $db -> Execute("SELECT products_name, p.products_id, categories_name, ptc.categories_id FROM zen_products p LEFT JOIN zen_products_description pd ON pd.products_id=p.products_id LEFT JOIN zen_products_to_categories ptc ON ptc.products_id=p.products_id LEFT JOIN zen_categories_description cd ON cd.categories_id=ptc.categories_id WHERE pd.language_id=1 ORDER BY categories_name");
THEN REPLACE:
Code:
$result = $db -> Execute("SELECT * FROM " . TABLE_PRODUCTS_ATTRIBUTES . " pa LEFT JOIN " . TABLE_PRODUCTS_OPTIONS . " po ON po.products_options_id=pa.options_id LEFT JOIN " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov ON pov.products_options_values_id=pa.options_values_id WHERE products_id='$add_product_products_id'");
WITH:
Code:
$result = $db -> Execute("SELECT * FROM " . TABLE_PRODUCTS_ATTRIBUTES . " pa LEFT JOIN " . TABLE_PRODUCTS_OPTIONS . " po ON po.products_options_id=pa.options_id LEFT JOIN " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov ON pov.products_options_values_id=pa.options_values_id WHERE products_id='$add_product_products_id' AND pov.language_id=1 AND po.language_id=1");
If the code above works (and I haven't tested it to know if it resolved the issues it was supposed to resolve) I believe that the code below is the better way of going about this.. I haven't tested this and I'll need someone to grade my homework and let me know if I got this right.. It should avoid anyone having to hard code in table names and language IDs. (which the posted code does and is not recommended) I've included the approximate line numbers to make finding things easier..
in YOUR_ADMIN_FOLDER/edit_orders.php
Around line 2267 find:
PHP Code:
// ############################################################################
// Get List of All Products
// ############################################################################
$result = $db -> Execute("SELECT products_name, p.products_id, categories_name, ptc.categories_id FROM " . TABLE_PRODUCTS . " p LEFT JOIN " . TABLE_PRODUCTS_DESCRIPTION . " pd ON pd.products_id=p.products_id LEFT JOIN " . TABLE_PRODUCTS_TO_CATEGORIES . " ptc ON ptc.products_id=p.products_id LEFT JOIN " . TABLE_CATEGORIES_DESCRIPTION . " cd ON cd.categories_id=ptc.categories_id ORDER BY categories_name");
Replace with:
PHP Code:
// ############################################################################
// Get List of All Products
// ############################################################################
$result = $db -> Execute("SELECT products_name, p.products_id, categories_name, ptc.categories_id FROM " . TABLE_PRODUCTS . " p LEFT JOIN " . TABLE_PRODUCTS_DESCRIPTION . " pd ON pd.products_id=p.products_id LEFT JOIN " . TABLE_PRODUCTS_TO_CATEGORIES . " ptc ON ptc.products_id=p.products_id LEFT JOIN " . TABLE_CATEGORIES_DESCRIPTION . " cd ON cd.categories_id=ptc.categories_id where pd.language_id = '" . (int)$_SESSION['languages_id'] . "' ORDER BY categories_name");
Around line 2371 find:
PHP Code:
// Get Options for Products
$result = $db -> Execute("SELECT * FROM " . TABLE_PRODUCTS_ATTRIBUTES . " pa LEFT JOIN " . TABLE_PRODUCTS_OPTIONS . " po ON po.products_options_id=pa.options_id LEFT JOIN " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov ON pov.products_options_values_id=pa.options_values_id WHERE products_id='$add_product_products_id'");
Replace with:
PHP Code:
// Get Options for Products
$result = $db -> Execute("SELECT * FROM " . TABLE_PRODUCTS_ATTRIBUTES . " pa LEFT JOIN " . TABLE_PRODUCTS_OPTIONS . " po ON po.products_options_id=pa.options_id LEFT JOIN " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov ON pov.products_options_values_id=pa.options_values_id WHERE products_id='$add_product_products_id' AND pov.language_id = '" . (int)$_SESSION['languages_id'] . "' AND po.language_id = '" . (int)$_SESSION['languages_id'] . "'");
Bookmarks