toasty Posted April 4, 2006 Author Share Posted April 4, 2006 Hi stiksandstones Without trawling through your code I can tell you that your site WILL work without the code replacement. ASP is designed to work with standard osC code for precisely this reason. Perhaps I should make this clearer in the install instructions. The ASP replacement code for product_info.php adds the ability to DISPLAY the attributes in the required ASP sort order. Without it your attributes will not display in the 'sort' order you specify in attributes sets plus admin, but will display in the default osC order (or according to your other contribution code). Clearly you do not have standard osC code, but the code you have should work as it was designed to. cheers Chris. Quote Link to comment Share on other sites More sharing options...
stiksandstones Posted April 4, 2006 Share Posted April 4, 2006 Hi stiksandstones Without trawling through your code I can tell you that your site WILL work without the code replacement. ASP is designed to work with standard osC code for precisely this reason. Perhaps I should make this clearer in the install instructions. The ASP replacement code for product_info.php adds the ability to DISPLAY the attributes in the required ASP sort order. Without it your attributes will not display in the 'sort' order you specify in attributes sets plus admin, but will display in the default osC order (or according to your other contribution code). Clearly you do not have standard osC code, but the code you have should work as it was designed to. cheers Chris. Thanks for the quick reply Chris!! Yeah, I have been editing products this morning and adding attributes to them, seems to be sorting in order too? So, it works fine. I feel like I do when I put furniture together from Ikea and have parts leftover...but the couch works! Thanks Quote Link to comment Share on other sites More sharing options...
toasty Posted April 4, 2006 Author Share Posted April 4, 2006 Thanks for the quick reply Chris!! Yeah, I have been editing products this morning and adding attributes to them, seems to be sorting in order too? So, it works fine. I feel like I do when I put furniture together from Ikea and have parts leftover...but the couch works! Thanks They will not be sorting by the 'ASP sort order', but more likely by the osC id. This means (usually) that they will be sorted in the order you have added the attributes to the database table (in standard osC)...(unless your other contribution has changed the order to something else, like alphabetical or reverse order). So if you add them to the system in the order you want them to appear then yes, you should be happy forever more... C. Quote Link to comment Share on other sites More sharing options...
♥stubbsy Posted April 17, 2006 Share Posted April 17, 2006 I'm having a problem with speed issues with the product_info page displaying when browsing my site, esp if the product has a lot of attributes. If i remove this piece of code i get no problems // BOF Linkmatics attributes sets plus $products_options_query = tep_db_query(" SELECT pov.products_options_values_id, pov.products_options_values_name, pa.options_values_price, pa.price_prefix , pase.sort_order FROM " . TABLE_PRODUCTS_ATTRIBUTES . " pa, " . TABLE_PRODUCTS_ATTRIBUTES_SETS_TO_PRODUCTS . " pas2pa, " . TABLE_PRODUCTS_ATTRIBUTES_SETS . " pas, " . TABLE_PRODUCTS_ATTRIBUTES_SETS_ELEMENTS . " pase, " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov WHERE pa.products_id = '" . (int)$_GET['products_id'] . "' AND pa.options_id = '" . $products_options_name['products_options_id'] . "' AND pas2pa.products_id = pa.products_id AND pas.products_attributes_sets_id = pas2pa.products_attributes_sets_id AND pas.products_options_id = pa.options_id AND pase.products_attributes_sets_id = pas.products_attributes_sets_id AND pase.options_values_id = pa.options_values_id AND pov.products_options_values_id = pa.options_values_id AND pov.language_id = '" . $languages_id . "' ORDER BY pase.sort_order, pa.options_values_id"); // >>>>> BOF Linkmatics attributes sets plus patch v1.01 if (tep_db_num_rows($products_options_query)== 0 ) { $products_options_query = tep_db_query(" SELECT pov.products_options_values_id, pov.products_options_values_name, pa.options_values_price, pa.price_prefix , pa.options_values_id FROM " . TABLE_PRODUCTS_ATTRIBUTES . " pa, " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov WHERE pa.products_id = '" . (int)$_GET['products_id'] . "' AND pa.options_id = '" . $products_options_name['products_options_id'] . "' AND pov.products_options_values_id = pa.options_values_id AND pov.language_id = '" . $languages_id . "' ORDER BY pa.options_values_id"); } // <<<<< EOF Linkmatics attributes sets plus patch v1.01 // EOF Linkmatics attributes sets plus Check it out by selecting a product from this page here If i remove the above code and go back to the original code then there are no speed issues. Any ideas? cheers stubbsy Quote Link to comment Share on other sites More sharing options...
♥stubbsy Posted April 18, 2006 Share Posted April 18, 2006 I've removed that bit of code now as it was getting too slow, i think that it is struggling with nearly 3000 product attributes Quote Link to comment Share on other sites More sharing options...
Bastet Posted April 18, 2006 Share Posted April 18, 2006 Hi, anyone use this contrib with spanish language? I'm new in OSC and I'm not sure if only need to add the files with translations at spanish language folder or if other changes are needed thanks Quote Link to comment Share on other sites More sharing options...
Bastet Posted April 18, 2006 Share Posted April 18, 2006 Hi, anyone use this contrib with spanish language? I'm new in OSC and I'm not sure if only need to add the files with translations at spanish language folder or if other changes are needed thanks Quote Link to comment Share on other sites More sharing options...
Bastet Posted April 20, 2006 Share Posted April 20, 2006 Hi, anyone use this contrib with spanish language? I'm new in OSC and I'm not sure if only need to add the files with translations at spanish language folder or if other changes are needed thanks please, anyone can help me with this doubt Thanks again Quote Link to comment Share on other sites More sharing options...
♥stubbsy Posted April 20, 2006 Share Posted April 20, 2006 if you can read english, then you will be able to use this. None of the text included appears in the catalogue, only in the admin. If you download the file and look in the admin/includes/language/english, you will see what text you would need to translate Quote Link to comment Share on other sites More sharing options...
Bastet Posted April 21, 2006 Share Posted April 21, 2006 if you can read english, then you will be able to use this. None of the text included appears in the catalogue, only in the admin. If you download the file and look in the admin/includes/language/english, you will see what text you would need to translate yes I can use it in english but the real owner-user of the shop can't read english very well so i'm traying to install everything in spanish. also I just want to be sure that there is not incompatibility if I use the contrib in english and only having spanish language in osC (I have remove english and german because we don't need it) If you download the file and look in the admin/includes/language/english, you will see what text you would need to translate so I need to translate those files and upload it to admin/includes/language/english or upload it to admin/includes/language/spanish? thanks again Quote Link to comment Share on other sites More sharing options...
toasty Posted April 21, 2006 Author Share Posted April 21, 2006 Hi, anyone use this contrib with spanish language? I'm new in OSC and I'm not sure if only need to add the files with translations at spanish language folder or if other changes are needed thanks FYI. I see no reason why this will not work with Spanish, however, be aware that it may only work with ONE language (in other words NOT Spanish AND another language). It is not a major fix to make it work with multiple languages but it will take someone with SQL development skills to do it - I don't have the time I'm afraid (happy to advise if someone would like to do it). regards Chris. Quote Link to comment Share on other sites More sharing options...
Bastet Posted April 21, 2006 Share Posted April 21, 2006 FYI.I see no reason why this will not work with Spanish, however, be aware that it may only work with ONE language (in other words NOT Spanish AND another language). It is not a major fix to make it work with multiple languages but it will take someone with SQL development skills to do it - I don't have the time I'm afraid (happy to advise if someone would like to do it). it will be great to have multiple language option, but I haven't enought experience to do that change :( anyway I'll post the translations for spanish Another question about spanish: we have "strange" characters like ?, ? ? ? ecc. in attributes (and at categories, names...), is this a problem? thanks, Valentin Quote Link to comment Share on other sites More sharing options...
toasty Posted April 21, 2006 Author Share Posted April 21, 2006 <snip>we have "strange" characters like ?, ? ? ? ecc. in attributes (and at categories, names...), is this a problem? </snip> Should not be a problem. Quote Link to comment Share on other sites More sharing options...
Bastet Posted April 22, 2006 Share Posted April 22, 2006 Should not be a problem. thanks Quote Link to comment Share on other sites More sharing options...
seg Posted May 27, 2006 Share Posted May 27, 2006 Hi, I am trying to use both the Attribute Sets contribution and the Multiple Categories contribution: http://www.oscommerce.com/community/contributions,1537 It works together except for one really annoying conflict. When I edit a product the product is moved out of the category to the top level of the shop. I have identified the area that is causing the problem, but I am afraid that I am not savvy enough to know what exactly is happening within that code. Does any one know what might be causing this conflict and what might fix it? Original osc code for /admin/categories.php lines 388-400: $manufacturers_array = array(array('id' => '', 'text' => TEXT_NONE)); $manufacturers_query = tep_db_query("select manufacturers_id, manufacturers_name from " . TABLE_MANUFACTURERS . " order by manufacturers_name"); while ($manufacturers = tep_db_fetch_array($manufacturers_query)) { $manufacturers_array[] = array('id' => $manufacturers['manufacturers_id'], 'text' => $manufacturers['manufacturers_name']); } $tax_class_array = array(array('id' => '0', 'text' => TEXT_NONE)); $tax_class_query = tep_db_query("select tax_class_id, tax_class_title from " . TABLE_TAX_CLASS . " order by tax_class_title"); while ($tax_class = tep_db_fetch_array($tax_class_query)) { $tax_class_array[] = array('id' => $tax_class['tax_class_id'], 'text' => $tax_class['tax_class_title']); } Multiple Category instructions: After ... $manufacturers_array = array(array('id' => '', 'text' => TEXT_NONE)); $manufacturers_query = tep_db_query("select manufacturers_id, manufacturers_name from " . TABLE_MANUFACTURERS . " order by manufacturers_name"); while ($manufacturers = tep_db_fetch_array($manufacturers_query)) { $manufacturers_array[] = array('id' => $manufacturers['manufacturers_id'], 'text' => $manufacturers['manufacturers_name']); } ADD # get selected categories $categories_query_selected = tep_db_query("select categories_id from " . TABLE_PRODUCTS_TO_CATEGORIES . " where products_id = '" . $HTTP_GET_VARS['pID'] . "'"); $categories_array_selected = array(array('id' => '')); while ($categories = tep_db_fetch_array($categories_query_selected)) { $categories_array_selected[] = array('id' => $categories['categories_id']); } $categories_array = array(array('id' => '', 'text' => TEXT_NONE)); #Categories list displays only for one languge (Deafault is English) $language_id = 1; $categories_query = tep_db_query("select categories_id, categories_name from " . TABLE_CATEGORIES_DESCRIPTION . " where language_id = ". $language_id ." order by categories_name"); while ($categories = tep_db_fetch_array($categories_query)) { $categories_array[] = array('id' => $categories['categories_id'], 'text' => $categories['categories_name']); } $form_action = ($HTTP_GET_VARS['pID']) ? 'update_product' : 'insert_product'; Attribute Sets Instructions: ******** 7.3a: Change this (approximately line 462 (~389 in osC's original code)- look for those Table names to make sure you have the right location): $manufacturers_array = array(array('id' => '', 'text' => TEXT_NONE)); $manufacturers_query = tep_db_query("select manufacturers_id, manufacturers_name from " . TABLE_MANUFACTURERS . " order by manufacturers_name"); while ($manufacturers = tep_db_fetch_array($manufacturers_query)) { $manufacturers_array[] = array('id' => $manufacturers['manufacturers_id'], 'text' => $manufacturers['manufacturers_name']); } $tax_class_array = array(array('id' => '0', 'text' => TEXT_NONE)); $tax_class_query = tep_db_query("select tax_class_id, tax_class_title from " . TABLE_TAX_CLASS . " order by tax_class_title"); while ($tax_class = tep_db_fetch_array($tax_class_query)) { $tax_class_array[] = array('id' => $tax_class['tax_class_id'], 'text' => $tax_class['tax_class_title']); } ******** 7.3b: To this: $manufacturers_array = array(array('id' => '', 'text' => TEXT_NONE)); $manufacturers_query = tep_db_query("select manufacturers_id, manufacturers_name from " . TABLE_MANUFACTURERS . " order by manufacturers_name"); while ($manufacturers = tep_db_fetch_array($manufacturers_query)) { $manufacturers_array[] = array('id' => $manufacturers['manufacturers_id'], 'text' => $manufacturers['manufacturers_name']); } // >>>> BOF Linkmatics attributes sets (3 of 5) - building attributes array - Begin $attribute_sets_array = array(array('id' => '', 'text' => TEXT_NONE)); $attribute_sets_names_array = array(); $attribute_sets_query = tep_db_query("select products_attributes_sets_id, products_attributes_sets_name from " . TABLE_PRODUCTS_ATTRIBUTES_SETS . " order by products_attributes_sets_name"); while ($attribute_sets = tep_db_fetch_array($attribute_sets_query)) { $attribute_sets_array[] = array('id' => $attribute_sets['products_attributes_sets_id'], 'text' => $attribute_sets['products_attributes_sets_name']); $attribute_sets_names_array[ $attribute_sets['products_attributes_sets_id'] ] = $attribute_sets['products_attributes_sets_name']; } // <<<< EOF Linkmatics attributes sets plus(3 of 5) - building attributes array - End $tax_class_array = array(array('id' => '0', 'text' => TEXT_NONE)); $tax_class_query = tep_db_query("select tax_class_id, tax_class_title from " . TABLE_TAX_CLASS . " order by tax_class_title"); while ($tax_class = tep_db_fetch_array($tax_class_query)) { $tax_class_array[] = array('id' => $tax_class['tax_class_id'], 'text' => $tax_class['tax_class_title']); } This was my final code: $manufacturers_array = array(array('id' => '', 'text' => TEXT_NONE)); $manufacturers_query = tep_db_query("select manufacturers_id, manufacturers_name from " . TABLE_MANUFACTURERS . " order by manufacturers_name"); while ($manufacturers = tep_db_fetch_array($manufacturers_query)) { $manufacturers_array[] = array('id' => $manufacturers['manufacturers_id'], 'text' => $manufacturers['manufacturers_name']); } # get selected categories $categories_query_selected = tep_db_query("select categories_id from " . TABLE_PRODUCTS_TO_CATEGORIES . " where products_id = '" . $HTTP_GET_VARS['pID'] . "'"); $categories_array_selected = array(array('id' => '')); while ($categories = tep_db_fetch_array($categories_query_selected)) { $categories_array_selected[] = array('id' => $categories['categories_id']); } $categories_array = array(array('id' => '', 'text' => TEXT_NONE)); #PR Categories list displays only for one languge (Deafault is English) $language_id = 1; $categories_array = tep_get_category_tree(); // added by R Calder // >>>> BOF Linkmatics attributes sets (3 of 5) - building attributes array - Begin $attribute_sets_array = array(array('id' => '', 'text' => TEXT_NONE)); $attribute_sets_names_array = array(); $attribute_sets_query = tep_db_query("select products_attributes_sets_id, products_attributes_sets_name from " . TABLE_PRODUCTS_ATTRIBUTES_SETS . " order by products_attributes_sets_name"); while ($attribute_sets = tep_db_fetch_array($attribute_sets_query)) { $attribute_sets_array[] = array('id' => $attribute_sets['products_attributes_sets_id'], 'text' => $attribute_sets['products_attributes_sets_name']); $attribute_sets_names_array[ $attribute_sets['products_attributes_sets_id'] ] = $attribute_sets['products_attributes_sets_name']; } // <<<< EOF Linkmatics attributes sets plus(3 of 5) - building attributes array - End $form_action = ($HTTP_GET_VARS['pID']) ? 'update_product' : 'insert_product'; $tax_class_array = array(array('id' => '0', 'text' => TEXT_NONE)); $tax_class_query = tep_db_query("select tax_class_id, tax_class_title from " . TABLE_TAX_CLASS . " order by tax_class_title"); while ($tax_class = tep_db_fetch_array($tax_class_query)) { $tax_class_array[] = array('id' => $tax_class['tax_class_id'], 'text' => $tax_class['tax_class_title']); } Quote Link to comment Share on other sites More sharing options...
vmtent Posted May 27, 2006 Share Posted May 27, 2006 Hi Chris, I went through the entire install very slowly & carefully (or so I think). Everything seems to still be working, except when I click on the Attributes Sets in the left column all I get is a blank page. I have my Product Options & Product Values set up already in Products Attributes. Where did I go wrong? :'( Quote Link to comment Share on other sites More sharing options...
vmtent Posted May 27, 2006 Share Posted May 27, 2006 (edited) Hi Chris, I went through the entire install very slowly & carefully (or so I think). Everything seems to still be working, except when I click on the Attributes Sets in the left column all I get is a blank page. I have my Product Options & Product Values set up already in Products Attributes. Where did I go wrong? :'( Never mind! Like the N00b I am I had put the wrong products_attributes_sets.php & product_attributes_sets_edit.php files in the wrong folders. Even though they are named the same, I didn't check first to see that they were actually different from each other. Reversed them & now the page displays correctly. :-" :thumbsup: Edited May 27, 2006 by vmtent Quote Link to comment Share on other sites More sharing options...
esanzalone Posted May 30, 2006 Share Posted May 30, 2006 i just install the attribute sets. looks like it is going to the job BUT i get this error when i save the set. 1054 - Unknown column 'products_options_id' in 'field list' insert into products_attributes_sets (products_attributes_sets_id, products_attributes_sets_name, products_options_id) values ('','candlescents',1) can you tell me why.... i really am hoping to use this program, it will save me alot of time. my candlescents list is about 90 different scents & have to link each 1 to every type of candle would take me about a month. Quote Link to comment Share on other sites More sharing options...
esanzalone Posted May 30, 2006 Share Posted May 30, 2006 Never mind, i just learned what i have always known, i can't type. typo in database table. i just install the attribute sets. looks like it is going to the job BUT i get this error when i save the set. 1054 - Unknown column 'products_options_id' in 'field list' insert into products_attributes_sets (products_attributes_sets_id, products_attributes_sets_name, products_options_id) values ('','candlescents',1) can you tell me why.... i really am hoping to use this program, it will save me alot of time. my candlescents list is about 90 different scents & have to link each 1 to every type of candle would take me about a month. Quote Link to comment Share on other sites More sharing options...
esanzalone Posted May 30, 2006 Share Posted May 30, 2006 i have installed the attribute sets plus. works great, had some problems but it was all typos. my question is that when i build a set (ie candlescent is 90 different scents long) the last 4 items are out of order. i wanted it to be sorted alpha. but the last 4 itms start with a "c", "p" & "s". not when you go to the dropdown list they are at the end of the list. is there any way to have this auto sort alpha or do i have to change all the sort #'s in the set. (there's 90). you can check it out here.Old World Candle Store Quote Link to comment Share on other sites More sharing options...
bdhoundus Posted June 1, 2006 Share Posted June 1, 2006 When I set the price for an attribute option (say, a 2XL shirt size), and then later go to edit a product that uses that attribute... when I update the product information, the attribute option pricing changes to the pricing defined in the attribute set. I have an attribute set for shirt size, which includes everything from Small to 4XL. I left the pricing in the attribute set definition at $0.00 since the price increase for large sizes varies by product. I would like to use the one attribute set for all products that use the Small-4XL size range (mainly because I have 725 different products and don't want to have to create 725 size attribute sets). How can I keep the product attribute price from reverting back to the pricing defined in the attribute set when using the categories.php page to update general product info? My intent was to have the attribute set give me a quick way to add the attribute options to each product (with a $0 price for all sizes) until I go edit the attribute option pricing on a product by product basis. That all works fine, until I go back to edit the product later and get the option pricing zeroed back out. Quote Link to comment Share on other sites More sharing options...
bdhoundus Posted June 4, 2006 Share Posted June 4, 2006 When I set the price for an attribute option (say, a 2XL shirt size), and then later go to edit a product that uses that attribute... when I update the product information, the attribute option pricing changes to the pricing defined in the attribute set. I have an attribute set for shirt size, which includes everything from Small to 4XL. I left the pricing in the attribute set definition at $0.00 since the price increase for large sizes varies by product. I would like to use the one attribute set for all products that use the Small-4XL size range (mainly because I have 725 different products and don't want to have to create 725 size attribute sets). How can I keep the product attribute price from reverting back to the pricing defined in the attribute set when using the categories.php page to update general product info? My intent was to have the attribute set give me a quick way to add the attribute options to each product (with a $0 price for all sizes) until I go edit the attribute option pricing on a product by product basis. That all works fine, until I go back to edit the product later and get the option pricing zeroed back out. OK, looking at the code, I have partially isolated what is overwriting the option pricing when I edit the product (i.e. turning the option pricing back to what was originally definted in the attribute set). In admin/categories.php in the following chunk of code: } elseif ($action == 'update_product') { $update_sql_data = array('products_last_modified' => 'now()'); $sql_data_array = array_merge($sql_data_array, $update_sql_data); tep_db_perform(TABLE_PRODUCTS, $sql_data_array, 'update', "products_id = '" . (int)$products_id . "'"); // >>>> BOF Linkmatics attribute sets plus(2 of 5) calling custom function - update product - Begin $arr_pas = array(); $arr_remove_sets = array(); for( $i=0; $i<$_POST['AttributeSetCount']; $i++ ){ $arr_pas[$i] = $_POST["products_attributes_sets_id_".$i]; if( $_POST["remove_products_attributes_sets_id_".$i] == "on" ){ $arr_remove_sets["remove_products_attributes_sets_id_".$i] = $_POST["products_attributes_sets_id_".$i]; } else { $arr_remove_sets["remove_products_attributes_sets_id_".$i] = -1; } } jjg_db_attributeSets( $arr_pas, $products_id, $action, $arr_remove_sets ); // <<<< EOF Linkmatics attribute sets plus (2 of 5) - calling custom function - update product - End The call to "jjg_db_attributeSets" in the last line is what is resetting the option price. If I comment out that line, the pricing doesn't get changed. But, doing that also eliminates the ability to remove attribute sets assigned to a product. So, looking at admin/includes/functions/database.php (where the jjg_db_attributeSets function resides): // BOF Linkmatics attributes sets plus function jjg_db_attributeSets($arr_attributeSetID, $productID, $action, $arr_remove_sets = array(), $link = 'db_link'){ if( $action == 'update_product' || 'delete_product_confirm' ){ for($j=0; $j<count($arr_attributeSetID); $j++){ if( empty($arr_attributeSetID[$j]) ){ continue; } $options_query = "SELECT pas.products_options_id FROM products_attributes_sets pas WHERE pas.products_attributes_sets_id = " . (int)$arr_attributeSetID[$j]; $products_attributes_options_query = tep_db_query($options_query, $link); // Changed delete to only delete those options from product attributes that are currently in Attributes Sets - leaves existing options on product // This could be done in single delete query but split with above select for now while ($products_attributes_delete_options = tep_db_fetch_array($products_attributes_options_query)){ $delete_query = " DELETE FROM products_attributes WHERE products_id=" . $productID . " AND options_id=" . $products_attributes_delete_options['products_options_id'] . " "; tep_db_query($delete_query, $link); } $delete_query = " DELETE FROM " . TABLE_PRODUCTS_ATTRIBUTES_SETS_TO_PRODUCTS . " WHERE products_attributes_sets_id = " . $arr_attributeSetID[$j] . " AND products_id = " . $productID; tep_db_query($delete_query, $link); } } //if you remove the product, then our work is done if( $action == 'delete_product_confirm' ){ return; } reset($arr_attributeSetID); for($j=0; $j<count($arr_attributeSetID); $j++){ if( empty($arr_attributeSetID[$j]) ){ continue; } if( in_array($arr_attributeSetID[$j], $arr_remove_sets) ){ continue; } //$select_query = "select pas.products_options_id, pase.options_values_id, pase.options_values_price, pase.price_prefix, pase.sort_order $select_query = "select pas.products_options_id, pase.options_values_id, pase.sort_order FROM " . TABLE_PRODUCTS_ATTRIBUTES_SETS . " pas, " . TABLE_PRODUCTS_ATTRIBUTES_SETS_ELEMENTS . " pase WHERE pas.products_attributes_sets_id = " . $arr_attributeSetID[$j] . " AND pase.products_attributes_sets_id = " . $arr_attributeSetID[$j] . " "; $products_attributes_sets_query = tep_db_query($select_query, $link); while ($products_attributes_sets_values = tep_db_fetch_array($products_attributes_sets_query)){ $valOptions_id = $products_attributes_sets_values['products_options_id']; $valOptions_values_id = $products_attributes_sets_values['options_values_id']; //$valOptions_values_price = $products_attributes_sets_values['options_values_price']; //$valPrice_prefix = $products_attributes_sets_values['price_prefix']; $insert_query = "insert into " . TABLE_PRODUCTS_ATTRIBUTES . " (products_id, options_id, options_values_id) values ". " (".$productID.",".$valOptions_id.",".$valOptions_values_id.")"; //" (products_id, options_id, options_values_id, options_values_price, price_prefix) values ". //" (".$productID.",".$valOptions_id.",".$valOptions_values_id.",".$valOptions_values_price.",'".$valPrice_prefix."')"; tep_db_query($insert_query, $link); } //END OF FETCH WHILE LOOP $insert_query = "insert into ".TABLE_PRODUCTS_ATTRIBUTES_SETS_TO_PRODUCTS . " (products_attributes_sets_id, products_id) values (".$arr_attributeSetID[$j].",".$productID.")"; tep_db_query($insert_query, $link); } } // EOF DB rewrite I have modified that section (by commenting lines out in the sample abovE) hoping to have it ignore anything related to the options_values_price and price_prefix. But even with those changes made, the option pricing is still getting reset. Anyone have an idea as to what am I missing? Quote Link to comment Share on other sites More sharing options...
bdhoundus Posted June 5, 2006 Share Posted June 5, 2006 OK, I finally figured out my problem. My earlier attempt failed because I didn't realize that every time you edit a product that has an attribute set attached to it, it actually DELETES the existing attribute set for that product and then RE-INSERTS the same attribute set (which is how the option value pricing gets reset). When I commented out the option_values_price field, it didn't add the price back in from the attribute set, but it still zeroed out the value because the old option_values_price field was deleted when the attribute set was deleted, and the re-insert skipped the option_values_price field because I removed it from the Insert statement. Maybe I'm the only person that wants things this way, but in case I'm not, here is my modified jjg_db_attributeSets function from the database.php file (this change allows you to still remove attribute sets when editing a product, and doesn't affect adding attribute sets to a product that didn't already have that attribute set attached. It will prevent the option_values_price from getting changed back to the original attribute set's value when you are simply editing other parts of the product definition.) // BOF Linkmatics attributes sets plus function jjg_db_attributeSets($arr_attributeSetID, $productID, $action, $arr_remove_sets = array(), $link = 'db_link'){ if( $action == 'update_product' || $action == 'delete_product_confirm' ){ for($j=0; $j<count($arr_attributeSetID); $j++){ if( empty($arr_attributeSetID[$j]) ){ continue; } //If the attribute set already existed for this product, and wasn't requested to be removed, don't remove it. if ($arr_remove_sets["remove_products_attributes_sets_id_".$j] == -1) { continue; } $options_query = "SELECT pas.products_options_id FROM products_attributes_sets pas WHERE pas.products_attributes_sets_id = " . (int)$arr_attributeSetID[$j]; $products_attributes_options_query = tep_db_query($options_query, $link); // Changed delete to only delete those options from product attributes that are currently in Attributes Sets - leaves existing options on product // This could be done in single delete query but split with above select for now while ($products_attributes_delete_options = tep_db_fetch_array($products_attributes_options_query)){ $delete_query = " DELETE FROM products_attributes WHERE products_id=" . $productID . " AND options_id=" . $products_attributes_delete_options['products_options_id'] . " "; tep_db_query($delete_query, $link); } $delete_query = " DELETE FROM " . TABLE_PRODUCTS_ATTRIBUTES_SETS_TO_PRODUCTS . " WHERE products_attributes_sets_id = " . $arr_attributeSetID[$j] . " AND products_id = " . $productID; tep_db_query($delete_query, $link); } } //if you remove the product, then our work is done if( $action == 'delete_product_confirm' ){ return; } reset($arr_attributeSetID); for($j=0; $j<count($arr_attributeSetID); $j++){ if( empty($arr_attributeSetID[$j]) ){ continue; } if( in_array($arr_attributeSetID[$j], $arr_remove_sets) ){ continue; } $select_query = "select pas.products_options_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 WHERE pas.products_attributes_sets_id = " . $arr_attributeSetID[$j] . " AND pase.products_attributes_sets_id = " . $arr_attributeSetID[$j] . " "; $products_attributes_sets_query = tep_db_query($select_query, $link); //Only perform the attribute set insert operation when called from the attribute_sets_edit file (in this case the $arr_remove_sets is not passed) if (empty($arr_remove_sets)){ while ($products_attributes_sets_values = tep_db_fetch_array($products_attributes_sets_query)){ $valOptions_id = $products_attributes_sets_values['products_options_id']; $valOptions_values_id = $products_attributes_sets_values['options_values_id']; $valOptions_values_price = $products_attributes_sets_values['options_values_price']; $valPrice_prefix = $products_attributes_sets_values['price_prefix']; $insert_query = "insert into " . TABLE_PRODUCTS_ATTRIBUTES . " (products_id, options_id, options_values_id, options_values_price, price_prefix) values ". " (".$productID.",".$valOptions_id.",".$valOptions_values_id.",".$valOptions_values_price.",'".$valPrice_prefix."')"; tep_db_query($insert_query, $link); } //END OF FETCH WHILE LOOP $insert_query = "insert into ".TABLE_PRODUCTS_ATTRIBUTES_SETS_TO_PRODUCTS . " (products_attributes_sets_id, products_id) values (".$arr_attributeSetID[$j].",".$productID.")"; tep_db_query($insert_query, $link); } } } // EOF DB rewrite Quote Link to comment Share on other sites More sharing options...
toasty Posted June 5, 2006 Author Share Posted June 5, 2006 Hi On the surface this appears to be a nice little edit (not that I have looked to closely!) Your explanation was a bit confusing (the odd double negative!). To confirm (for the board), your edit is for the following reason: BEFORE: When using the standard osc product edit (in Admin) when clicking <update> to save changes, ASP currently DELETES all sets and RE-INSERTS all sets attached to that product, meaning all attributes options values are reset to the values defined in the set originally. AFTER: It is still possible to remove sets from a product in Admin/product edit It is still possible to add sets to a product in Admin/product edit If a set is already attached to a product it will not be effected (where previously it would have been deleted and re-added) ________________________________________________ Have I got that right? cheers Chris. Quote Link to comment Share on other sites More sharing options...
toasty Posted June 5, 2006 Author Share Posted June 5, 2006 i have installed the attribute sets plus. works great, had some problems but it was all typos. my question is that when i build a set (ie candlescent is 90 different scents long) the last 4 items are out of order. i wanted it to be sorted alpha. but the last 4 itms start with a "c", "p" & "s". not when you go to the dropdown list they are at the end of the list. is there any way to have this auto sort alpha or do i have to change all the sort #'s in the set. (there's 90). you can check it out here.Old World Candle Store I am away from my pc so can't look at the code but off the top my head, if you want this ordering for ALL your shop's options values (by alphabetical order) then: - remove the ASP code you added to product_info.php - put back the original code - in the code you have put back you will see an 'order by ...options_values_id ' <<can't remember exact field name, its something like that>> - change the order by field to <<I think>> 'order by options_values_name desc' NB: there maybe a table name on the front (eg. order by pov.options_values_name). Use a little common sense and you should be able to work it out. Sorry I can't a bit more precise, it is all from memory. hope that helps Chris. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.