[ Index ]

PHP Cross Reference of osCMax 2.0.4

title

Body

[close]

/admin/ -> new_attributes_functions.php (source)

   1  <?php
   2  // A simple little function to determine if the current value is already selected for the current product.
   3  function checkAttribute( $current_value_id, $current_product_id, $current_product_option_id )
   4  {
   5   global $attribute_value_price, $attribute_value_prefix, $posCheck, $negCheck;
   6  
   7   $query = "SELECT * FROM products_attributes where options_values_id = '$current_value_id' AND products_id = '$current_product_id' AND options_id = '$current_product_option_id'";
   8  
   9   $result = mysql_query($query) or die(mysql_error());
  10  
  11   $isFound = mysql_num_rows($result);
  12   
  13   if ($isFound) {
  14  
  15      while($line = mysql_fetch_array($result, MYSQL_ASSOC)) {
  16          
  17          $attribute_value_price = $line['options_values_price'];
  18          $attribute_value_prefix = $line['price_prefix'];
  19          
  20          if ($attribute_value_prefix == "+") { $posCheck = " SELECTED";
  21                                                $negCheck = "";
  22                                                
  23          } else { $posCheck = "";
  24                   $negCheck = " SELECTED";
  25  
  26          }
  27  
  28      }
  29  
  30      return true; 
  31      
  32      } else {
  33      
  34      $attribute_value_price = ""; 
  35      $attribute_value_prefix = "";
  36      $posCheck = "";
  37      $negCheck = "";
  38  
  39      return false; }
  40  
  41  }
  42  
  43  function rowClass($i){
  44      $class1 = "attributes-odd";
  45      $class2 = "attributes-even";
  46  
  47      if ( $i%2 ) {
  48          return $class1;
  49      } else {
  50          return $class2;
  51      } 
  52  }
  53  
  54  // For Options Type Contribution
  55  function extraValues( $current_value_id, $current_product_id )
  56  {
  57   global $attribute_qty, $attribute_order, $attribute_linked, $attribute_prefix, $attribute_type, $isSelected;
  58  
  59   if ( $isSelected ) {
  60                          
  61          $query = "SELECT * FROM products_attributes where options_values_id = '$current_value_id' AND products_id = '$current_product_id'";
  62  
  63          $result = mysql_query($query) or die(mysql_error());
  64  
  65          while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {
  66                                                                      
  67                  $attribute_qty = $line['options_values_qty'];
  68                  $attribute_order = $line['attribute_order'];
  69                  $attribute_linked = $line['collegamento'];
  70                  $attribute_prefix = $line['price_prefix'];
  71                  $attribute_type = $line['options_type_id'];
  72  
  73          }
  74          
  75   } else {
  76              
  77              $attribute_qty = "1";
  78              $attribute_order = "100";
  79              $attribute_linked = "0";
  80              $attribute_prefix = "";
  81              $attribute_type = "";
  82   }
  83   
  84  }
  85  
  86  function displayOptionTypes( $attribute_type )
  87  {
  88   global $isSelected;
  89  
  90   $availableTypes = array( 'Disabled' => '0', 'Select' => '1', 'Checkbox' => '2', 'Radio' => '3', 'Select Multiple' => '4', 'Text' => '5' );
  91   
  92   foreach( $availableTypes as $name => $id ){
  93                                                  
  94          if ( $isSelected && $attribute_type == $id ) { $SELECT = " SELECTED"; }
  95  
  96          else { $SELECT = ""; }
  97                                                                                                    
  98          echo "<OPTION VALUE=\"" . $id . "\"" . $SELECT . ">" . $name;
  99          
 100   }
 101  
 102  }
 103  
 104  // Get values for Linda McGrath's contribution
 105  function getSortCopyValues( $current_value_id, $current_product_id )
 106  {
 107   global $attribute_sort, $attribute_weight, $attribute_weight_prefix, $isSelected;
 108  
 109   if ( $isSelected ) {
 110                          
 111          $query = "SELECT * FROM products_attributes where options_values_id = '$current_value_id' AND products_id = '$current_product_id'";
 112  
 113          $result = mysql_query($query) or die(mysql_error());
 114  
 115          while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {
 116                                                                      
 117                  $attribute_sort = $line['products_options_sort_order'];
 118                  $attribute_weight = $line['products_attributes_weight'];
 119                  $attribute_weight_prefix = $line['products_attributes_weight_prefix'];
 120  
 121          }
 122          
 123   } else {
 124              
 125              $attribute_sort = "0";
 126              $attribute_weight = "";
 127              $attribute_weight_prefix = "";
 128   }
 129   
 130  }
 131  function sortCopyWeightPrefix( $attribute_weight_prefix )
 132  {
 133   global $isSelected;
 134   
 135   $availablePrefixes = array( '+', '-' );
 136   
 137   foreach( $availablePrefixes as $prefix ) {
 138                                                
 139          if ( $isSelected && $prefix == $attribute_weight_prefix ) {
 140                                                                        
 141                  $SELECT = " SELECTED";
 142                  
 143          } else { $SELECT = ""; }
 144          
 145          echo "<OPTION VALUE=\"" . $prefix . "\"" . $SELECT . ">" . $prefix;
 146          
 147          }
 148          
 149  }
 150  
 151  ?>
 152  
 153  
 154  
 155  
 156  
 157  
 158  
 159  
 160  
 161  
 162  
 163  


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