PDA

View Full Version : Attribute Sets Plus



michael_s
03-24-2009, 06:10 PM
To use this great contribution in a Multilanguage store, make the next steps:

First:

Make the same changes in the files of your language (in my case, spanish):

"/catalog/admin/includes/languages/english.php" --> make the same changes in --> "/catalog/admin/includes/languages/espanol.php"
"/catalog/admin/includes/languages/english/categories.php" --> make the same changes in --> "/catalog/admin/includes/languages/espanol/categories.php"
"/catalog/admin/includes/languages/english/products_attributes.php" --> make the same changes in --> "/catalog/admin/includes/languages/espanol/products_attributes.php"


Second:

COPY also the next files in your language folder (in my case, "spanol" folder):

/catalog/admin/includes/languages/english/products_attributes_sets.php
/catalog/admin/includes/languages/english/products_attributes_sets_edit.php
/catalog/admin/includes/languages/english/images/buttons/button_add_as.gif
/catalog/admin/includes/languages/english/images/buttons/button_create.gif


---------------------------------------------------------------------------------


Well, now we have a problem. If you use Multilanguage you will see the Attributes and the Values of the different languages at the same time when you make new attribute sets. The contribution works but is something uncomfortable. To fix this, make the next changes in the file "/catalog/admin/products_attributes_sets.php":

1a.- Change this:

$options_name_query_sql = "select po.products_options_name, po.products_options_id from " . TABLE_PRODUCTS_OPTIONS . " po where po.products_options_id=".$_POST['products_options_id'];

1b.- To this:

$options_name_query_sql = "select po.products_options_name, po.products_options_id from " . TABLE_PRODUCTS_OPTIONS . " po where po.language_id = '" . (int)$languages_id . "' and po.products_options_id=".$_POST['products_options_id'];

-----------------------------------------------

2a.- Change this:

$attributeSets_query = tep_db_query("select products_options_id, products_options_name from " . TABLE_PRODUCTS_OPTIONS . " order by products_options_name");

2b.- To this:

$attributeSets_query = tep_db_query("select products_options_id, products_options_name from " . TABLE_PRODUCTS_OPTIONS . " where language_id = '" . (int)$languages_id . "' order by products_options_name");

-----------------------------------------------

3a.- Change this:

$attribute_set_sql = "SELECT pas.products_attributes_sets_id, pas.products_attributes_sets_name, pas.products_options_id, po.products_options_name, pase.products_attributes_sets_elements_id, pase.options_values_id, pase.options_values_price, pase.price_prefix, pase.sort_order FROM " . TABLE_PRODUCTS_ATTRIBUTES_SETS . " pas, " . TABLE_PRODUCTS_ATTRIBUTES_SETS_ELEMENTS . " pase, ". TABLE_PRODUCTS_OPTIONS . " po WHERE pas.products_attributes_sets_id = " . $_GET['attset_id'] . " AND pas.products_attributes_sets_id = pase.products_attributes_sets_id AND pas.products_options_id = po.products_options_id ORDER BY pase.sort_order";

3b.- To this:

$attribute_set_sql = "SELECT pas.products_attributes_sets_id, pas.products_attributes_sets_name, pas.products_options_id, po.products_options_name, pase.products_attributes_sets_elements_id, pase.options_values_id, pase.options_values_price, pase.price_prefix, pase.sort_order FROM " . TABLE_PRODUCTS_ATTRIBUTES_SETS . " pas, " . TABLE_PRODUCTS_ATTRIBUTES_SETS_ELEMENTS . " pase, ". TABLE_PRODUCTS_OPTIONS . " po WHERE pas.products_attributes_sets_id = " . $_GET['attset_id'] . " AND pas.products_attributes_sets_id = pase.products_attributes_sets_id AND pas.products_options_id = po.products_options_id AND po.language_id = '" . (int)$languages_id . "' ORDER BY pase.sort_order";

-----------------------------------------------

4a.- Change this:

$options_query_sql = "select pov.products_options_values_name, pov.products_options_values_id from " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov, " . TABLE_PRODUCTS_OPTIONS_VALUES_TO_PRODUCTS_OPTIONS . " pov2po where pov2po.products_options_id = " . (int)$_POST['products_options_id'] . " and pov.products_options_values_id = pov2po.products_options_values_id order by pov.products_options_values_name";

4b.- To this:

$options_query_sql = "select pov.products_options_values_name, pov.products_options_values_id from " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov, " . TABLE_PRODUCTS_OPTIONS_VALUES_TO_PRODUCTS_OPTIONS . " pov2po where pov2po.products_options_id = " . (int)$_POST['products_options_id'] . " and pov.products_options_values_id = pov2po.products_options_values_id and pov.language_id = '" . (int)$languages_id . "' order by pov.products_options_values_name";

-----------------------------------------------

5a.- Change this:

$options_query_sql = "SELECT pov.products_options_values_name, pov.products_options_values_id FROM " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov, " . TABLE_PRODUCTS_OPTIONS_VALUES_TO_PRODUCTS_OPTIONS . " pov2po where pov2po.products_options_id = '" . $attribute_set['products_options_id'] . "' and pov.products_options_values_id=pov2po.products_opt ions_values_id order by pov.products_options_values_name";

5b.- To this:

$options_query_sql = "SELECT pov.products_options_values_name, pov.products_options_values_id FROM " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov, " . TABLE_PRODUCTS_OPTIONS_VALUES_TO_PRODUCTS_OPTIONS . " pov2po where pov2po.products_options_id = '" . $attribute_set['products_options_id'] . "' and pov.products_options_values_id=pov2po.products_opt ions_values_id and pov.language_id = '" . (int)$languages_id . "' order by pov.products_options_values_name";

-----------------------------------------------

SunDust


More... (http://addons.oscommerce.com/info/3610)