[ Index ]

PHP Cross Reference of osCMax 2.0.4

title

Body

[close]

/admin/ -> new_attributes_change.php (source)

   1  <?php
   2  // I found the easiest way to do this is just delete the current attributes & start over =)
   3  MYSQL_QUERY( "DELETE FROM products_attributes WHERE products_id = '$current_product_id'" );
   4  
   5  // Simple, yet effective.. loop through the selected Option Values.. find the proper price & prefix.. insert.. yadda yadda yadda.
   6  for ($i = 0; $i < sizeof($optionValues); $i++) {
   7  
   8      $query = "SELECT * FROM products_options_values_to_products_options where products_options_values_id = '$optionValues[$i]'";
   9  
  10      $result = mysql_query($query) or die(mysql_error());
  11  
  12      $matches = mysql_num_rows($result);
  13  
  14         while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {
  15                                                                     
  16              $optionsID = $line['products_options_id'];
  17              
  18         }
  19  
  20  
  21      $value_price =  $HTTP_POST_VARS[$optionValues[$i] . '_price'];
  22  
  23      $value_prefix = $HTTP_POST_VARS[$optionValues[$i] . '_prefix'];
  24      
  25      if ( $optionTypeInstalled == "1" ) {
  26                                             
  27          $value_type = $HTTP_POST_VARS[$optionValues[$i] . '_type'];
  28          $value_qty = $HTTP_POST_VARS[$optionValues[$i] . '_qty'];
  29          $value_order = $HTTP_POST_VARS[$optionValues[$i] . '_order'];
  30          $value_linked = $HTTP_POST_VARS[$optionValues[$i] . '_linked'];
  31          
  32          MYSQL_QUERY( "INSERT INTO products_attributes ( products_id, options_id, options_values_id, options_values_price, price_prefix, options_type_id, options_values_qty, attribute_order, collegamento )
  33                       VALUES( '$current_product_id', '$optionsID', '$optionValues[$i]', '$value_price', '$value_prefix', '$value_type', '$value_qty', '$value_order', '$value_linked' )" ) or die(mysql_error());
  34                       
  35      } else if ( $optionSortCopyInstalled == "1" ) {
  36                                                        
  37          $value_sort = $HTTP_POST_VARS[$optionValues[$i] . '_sort'];
  38          $value_weight = $HTTP_POST_VARS[$optionValues[$i] . '_weight'];
  39          $value_weight_prefix = $HTTP_POST_VARS[$optionValues[$i] . '_weight_prefix'];
  40  
  41          MYSQL_QUERY( "INSERT INTO products_attributes ( products_id, options_id, options_values_id, options_values_price, price_prefix, products_options_sort_order, products_attributes_weight, products_attributes_weight_prefix )
  42                       VALUES( '$current_product_id', '$optionsID', '$optionValues[$i]', '$value_price', '$value_prefix', '$value_sort', '$value_weight', '$value_weight_prefix' )" ) or die(mysql_error());
  43                       
  44      } else {
  45  
  46          MYSQL_QUERY( "INSERT INTO products_attributes ( products_id, options_id, options_values_id, options_values_price, price_prefix )
  47                       VALUES( '$current_product_id', '$optionsID', '$optionValues[$i]', '$value_price', '$value_prefix' )" ) or die(mysql_error());
  48                   
  49      }             
  50  
  51  }
  52  
  53  // For text input option type feature by chandra
  54  if ( $optionTypeTextInstalled == "1" && is_array( $HTTP_POST_VARS['optionValuesText'] )) {
  55     
  56     for ($i = 0; $i < sizeof($optionValuesText); $i++) {
  57                                                            
  58          $value_price =  $HTTP_POST_VARS[$optionValuesText[$i] . '_price'];
  59  
  60          $value_prefix = $HTTP_POST_VARS[$optionValuesText[$i] . '_prefix'];
  61          
  62          $value_product_id = $HTTP_POST_VARS[$optionValuesText[$i] . '_options_id'];
  63          
  64          MYSQL_QUERY( "INSERT INTO products_attributes ( products_id, options_id, options_values_id, options_values_price, price_prefix )
  65          VALUES( '$current_product_id', '$value_product_id', '0', '$value_price', '$value_prefix' )" ) or die(mysql_error());
  66          
  67     }
  68     
  69  }
  70  
  71  
  72  
  73  
  74  
  75  
  76  
  77  
  78  
  79  
  80  ?>


Generated: Fri Jan 1 13:43:16 2010 Cross-referenced by PHPXref 0.7