Jump to content
Latest News: (loading..)

mrtickle

Members
  • Content count

    4
  • Joined

  • Last visited

Profile Information

  • Real Name
    James Brown
  1. mrtickle

    Attribute Sets Plus

    Hi, I have an issue where I have color swatches on some of my product options and the attribute sets module is over writting them on every product update. Basically I would like it to not do that if the product hasn't been updated. I have played around with this for hours and no luck I know this code does all the deleting and updating I am hoping someone can help me change it so it doesnt update all the attribute sets of the product when you are just editing the name etc. // 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 ".TABLE_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 ". TABLE_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); 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); } }
  2. Just wanted to say that in the version I have "otf autothumb v2.4fix3" $parameters was being called as $params in the image wrapper function This resulted in no image parameters coming through. MrTickle
×