[ Index ]

PHP Cross Reference of osCMax 2.0.4

title

Body

[close]

/admin/attributeManager/ -> attributeManager.php (source)

   1  <?php
   2  /*
   3    $Id: attributeManager.php,v 1.0 21/02/06 Sam West$
   4  
   5    osCommerce, Open Source E-Commerce Solutions
   6    http://www.oscommerce.com
   7  
   8    Released under the GNU General Public License
   9    
  10    Copyright © 2006 Kangaroo Partners
  11    http://kangaroopartners.com
  12    [email protected]
  13  */
  14  
  15  // change the directory upone for application top includes
  16  chdir('../');
  17  //ini_set('include_path', dirname(dirname(__FILE__)) . (((substr(strtoupper(PHP_OS),0,3)) == "WIN") ? ";" : ":") . ini_get('include_path'));
  18  
  19  // OSC application top needed for sessions, defines and functions
  20  require_once ('includes/application_top.php');
  21  
  22  // db wrapper
  23  require_once('attributeManager/classes/amDB.class.php');
  24  
  25  // session functions
  26  require_once('attributeManager/includes/attributeManagerSessionFunctions.inc.php');
  27  
  28  // config
  29  require_once('attributeManager/classes/attributeManagerConfig.class.php');
  30  
  31  // misc functions
  32  require_once('attributeManager/includes/attributeManagerGeneralFunctions.inc.php');
  33  
  34  // parent class
  35  require_once('attributeManager/classes/attributeManager.class.php');
  36  
  37  // instant class
  38  require_once('attributeManager/classes/attributeManagerInstant.class.php');
  39  
  40  // atomic class
  41  require_once('attributeManager/classes/attributeManagerAtomic.class.php');
  42  
  43  // security class
  44  require_once('attributeManager/classes/stopDirectAccess.class.php');
  45  
  46  // check that the file is allowed to be accessed
  47  stopDirectAccess::checkAuthorisation(AM_SESSION_VALID_INCLUDE);
  48  
  49  
  50  // get an instance of one of the attribute manager classes
  51  $attributeManager =& amGetAttributeManagerInstance($_GET);
  52  
  53  // do any actions that should be done
  54  $globalVars = $attributeManager->executePageAction($_GET);
  55  
  56  
  57  // set any global variables from the page action execution
  58  if(0 !== count($globalVars) && is_array($globalVars)) 
  59      foreach($globalVars as $varName => $varValue)
  60          $$varName = $varValue;
  61  
  62  
  63  // get the current products options and values
  64  $allProductOptionsAndValues = $attributeManager->getAllProductOptionsAndValues(true);
  65  //$SortedProductAttributes = $attributeManager->sortArrSessionVar();
  66  
  67  
  68  // count the options
  69  $numOptions = count($allProductOptionsAndValues);
  70  // output a response header
  71  //header('Content-type: text/html; charset=ISO-8859-1');
  72  header('Content-type: text/html; charset='.CHARSET);
  73  
  74  //$attributeManager->debugOutput($allProductOptionsAndValues);
  75  //$attributeManager->debugOutput($SortedProductAttributes);
  76  //$attributeManager->debugOutput($attributeManager);
  77  
  78  // include any prompts
  79  require_once('attributeManager/includes/attributeManagerPrompts.inc.php');
  80  
  81  if(!isset($_GET['target']) || 'topBar' == $_GET['target'] ) {
  82      if(!isset($_GET['target'])) 
  83          echo '<div id="topBar">';
  84  ?>
  85  
  86  <table width="100%" cellpadding="0" cellspacing="0">
  87      <tr>
  88          <td>
  89          <?php
  90          $languages = tep_get_languages();
  91          if(count($languages) > 1) {
  92              foreach ($languages as $amLanguage) {
  93              ?>
  94              &nbsp;<input type="image" <?php echo ($attributeManager->getSelectedLanaguage() == $amLanguage['id']) ? 'style="padding:1px;border:1px solid black" onClick="return false" ' :'onclick="return amSetInterfaceLanguage(\''.$amLanguage['id'].'\');" '?> src="<?php echo DIR_WS_CATALOG_LANGUAGES . $amLanguage['directory'] . '/images/' . $amLanguage['image']?>"  border="0" title="<?=AM_AJAX_CHANGES?>" />
  95              <?php
  96              }
  97          }
  98          ?>
  99          </td>
 100          <td align="right">
 101  
 102          <?php
 103          if(false !== AM_USE_TEMPLATES) {
 104              ?>
 105              <div  style="padding:5px 3px 5px 0px">
 106                  <input type="image" <?php if($attributeManager->getTemplateOrder()=='123'){echo 'style="border:1px solid #DDDDDD;"';} ?> src="attributeManager/images/icon_123.png" onclick="return amTemplateOrder('123');" border="0" title="" />
 107                  <input type="image" <?php if($attributeManager->getTemplateOrder()=='abc'){echo 'style="border:1px solid #DDDDDD;"';} ?> src="attributeManager/images/icon_abc.png" onclick="return amTemplateOrder('abc');" border="0" title="" />
 108                  &nbsp;
 109                  <?php echo tep_draw_pull_down_menu('template_drop',$attributeManager->buildAllTemplatesDropDown($attributeManager->getTemplateOrder()),(0 == $selectedTemplate) ? '0' : $selectedTemplate,'id="template_drop" style="margin-bottom:3px"');    ?>
 110                  &nbsp;
 111                  <input type="image" src="attributeManager/images/icon_load.png" onclick="return customTemplatePrompt('loadTemplate');" border="0" title="<?=AM_AJAX_LOADS_SELECTED_TEMPLATE?>" />
 112                  &nbsp;
 113                  <input type="image" src="attributeManager/images/icon_save.png" onclick="return customPrompt('saveTemplate');" border="0" title="<?=AM_AJAX_SAVES_ATTRIBUTES_AS_A_NEW_TEMPLATE?>" />
 114                  &nbsp;
 115                  <input type="image" src="attributeManager/images/icon_rename.png" onclick="return customTemplatePrompt('renameTemplate');" border="0" title="<?=AM_AJAX_RENAMES_THE_SELECTED_TEMPLATE?>" />
 116                  &nbsp;
 117                  <input type="image" src="attributeManager/images/icon_delete.png" onclick="return customTemplatePrompt('deleteTemplate');" border="0" title="<?=AM_AJAX_DELETES_THE_SELECTED_TEMPLATE?>" />
 118                  &nbsp;
 119              </div>
 120              <?php
 121          }
 122          ?>
 123          </td>
 124      </tr>
 125  </table>
 126  <?php
 127      if(!isset($_GET['target'])) 
 128          echo '</div>';
 129  } // end target = topBar
 130      
 131  if(!isset($_GET['target'])) 
 132      echo '<div id="attributeManagerAll">';
 133  ?>
 134  <?php
 135  if(!isset($_GET['target']) || 'currentAttributes' == $_GET['target']) {
 136      if(!isset($_GET['target'])) 
 137          echo '<div id="currentAttributes">';
 138  ?>
 139      <table width="100%" border="0" cellspacing="0" cellpadding="3">    
 140          <tr class="header">
 141              <td width="50" align="center">
 142                  <input type="image" src="attributeManager/images/icon_plus.gif" onclick="return amShowHideAllOptionValues([<?php echo implode(',',array_keys($allProductOptionsAndValues));?>],true);" border="0" />
 143                  &nbsp;
 144                  <input type="image" src="attributeManager/images/icon_minus.gif" onclick="return amShowHideAllOptionValues([<?php echo implode(',',array_keys($allProductOptionsAndValues));?>],false);" border="0" />
 145              </td>
 146              <td>
 147                  <?=AM_AJAX_NAME?>
 148              </td>
 149      
 150              <td align="right">
 151                  <span style="margin-right:40px"><?=AM_AJAX_ACTION?></span>
 152              </td>
 153          </tr>
 154          
 155      <?php
 156      if(0 < $numOptions) {
 157          foreach($allProductOptionsAndValues as $optionId => $optionInfo){
 158              $numValues = count($optionInfo['values']);
 159      ?>
 160              <tr class="option">
 161                  <td align="center">
 162                  <input type="image" border="0" id="show_hide_<?php echo $optionId; ?>" src="attributeManager/images/icon_plus.gif" onclick="return amShowHideOptionsValues(<?php echo $optionId; ?>);" />
 163                  
 164                  </td>
 165                  <td>
 166                      <?php echo "{$optionInfo['name']} ($numValues)";?>
 167                  </td>
 168          
 169                  <td align="right">
 170                      <?php echo tep_draw_pull_down_menu("new_option_value_$optionId",$attributeManager->buildOptionValueDropDown($optionId),$selectedOptionValue,'style="margin:3px 0px 3px 0px;" id="new_option_value_'.$optionId.'"')?>
 171                      <input type="image" src="attributeManager/images/icon_add.png" value="Add" border="0" onclick="return amAddOptionValueToProduct('<?php echo $optionId?>');" title="<?php echo htmlspecialchars(sprintf(AM_AJAX_ADDS_ATTRIBUTE_TO_OPTION, $optionInfo['name'])); ?>" />
 172                  
 173                      <input type="image" title="<? echo htmlspecialchars(sprintf(AM_AJAX_ADDS_NEW_VALUE_TO_OPTION,$optionInfo['name'])) ?>" border="0" src="attributeManager/images/icon_add_new.png" onclick="return customPrompt('amAddNewOptionValueToProduct','<?php echo addslashes("option_id:$optionId|option_name:".str_replace('"','&quot;',$optionInfo['name']))?>');" />
 174  <?php
 175  if(false){
 176  ?>
 177  <!--                    <input type="image" src="attributeManager/images/icon_rename.png" onclick="return customTemplatePrompt('renameTemplate');" border="0" title="Renames the selected template" />-->
 178  <?php
 179  }
 180  ?>
 181                      <input type="image" border="0" onClick="return customPrompt('amRemoveOptionFromProduct','<?php echo addslashes("option_id:$optionId|option_name:".str_replace('"','&quot;',$optionInfo['name']))?>');" src="attributeManager/images/icon_delete.png" title="<? echo htmlspecialchars(addslashes(sprintf(AM_AJAX_PRODUCT_REMOVES_OPTION_AND_ITS_VALUES,$optionInfo['name'],$numValues))) ?>" />
 182  
 183              
 184                      <?php
 185                      if(AM_USE_SORT_ORDER) {
 186                      ?>    
 187                      <input type="image" onclick="return amMoveOption('<?php echo 'option_id:'.$optionId ; ?>', 'up');" src="attributeManager/images/icon_up.png" title="Moves option up" /> 
 188                      <input type="image" onclick="return amMoveOption('<?php echo 'option_id:'.$optionId ; ?>', 'down');" src="attributeManager/images/icon_down.png" title="Moves option down" /> 
 189                      <?php
 190                      }
 191                      ?>
 192                  </td>
 193              </tr>
 194              
 195  <!-- ----- -->
 196  <!-- Show Option Values -->
 197  <!-- ----- -->
 198      <?php
 199              if(0 < $numValues){
 200                  foreach($optionInfo['values'] as $optionValueId => $optionValueInfo) {
 201      ?>
 202  
 203              <tr class="optionValue" id="trOptionsValues_<?php echo $optionId; ?>" style="display:none" >
 204                  <td align="center">
 205                      <img src="attributeManager/images/icon_arrow.gif" />
 206                  </td>
 207                  <td>
 208                      <?php echo $optionValueInfo['name']; ?>
 209                      
 210                  </td>
 211                  <td align="right">
 212  <?php
 213  //----------------------------
 214  // Change: Add download attributes function for AM
 215  // @author Urs Nyffenegger ak mytool
 216  // Function: Add Buttons for functionality
 217  //-----------------------------
 218  
 219                  
 220                      if($optionValueInfo['products_attributes_filename']){
 221  
 222                          ?>
 223                          
 224                      <input type="image" border="0" onClick="return customPrompt('amEditDownloadForProduct','<?php echo addslashes('option_id:' . $optionId . '|products_attributes_filename:' . $optionValueInfo['products_attributes_filename'] . '|products_attributes_maxdays:'.$optionValueInfo['products_attributes_maxdays']  . '|products_attributes_maxcount:'.$optionValueInfo['products_attributes_maxcount'] .'|option_value_name:'.str_replace('"','&quot;',$optionValueInfo['name'] .'|products_attributes_id:'.$optionValueInfo['products_attributes_id']))?>');" src="attributeManager/images/icon_down_edit.png" title="<? echo htmlspecialchars(sprintf(AM_AJAX_DOWLNOAD_EDIT,$optionValueInfo['name'],$optionInfo['name'])) ?>" />
 225                      <input type="image" border="0" onClick="return customPrompt('amDeleteDownloadForProduct','<?php echo addslashes('option_id:' . $optionId . '|option_value_name:'.str_replace('"','&quot;',$optionValueInfo['name']) .'|products_attributes_id:'.$optionValueInfo['products_attributes_id'])?>');" src="attributeManager/images/icon_down_delete.png" title="<? echo htmlspecialchars(sprintf(AM_AJAX_DOWLNOAD_DELETE,$optionValueInfo['name'],$optionInfo['name'])) ?>" style="margin-right: 30px;" />
 226                              
 227                      <?php
 228                      } else {
 229                      ?>
 230                      <input type="image" border="0" onClick="return customPrompt('amAddNewDownloadForProduct','<?php echo addslashes('option_id:' . $optionId .'|option_value_id:'.$optionValueId . '|option_value_name:'.str_replace('"','&quot;',$optionValueInfo['name']).'|products_attributes_id:'.$optionValueInfo['products_attributes_id'])?>');" src="attributeManager/images/icon_download.png" title="<? echo htmlspecialchars(sprintf(AM_AJAX_DOWLNOAD_ADD_NEW,$optionValueInfo['name'],$optionInfo['name'])) ?>" style="margin-right: 30px;" />        
 231  <?php                    
 232                      }    
 233  
 234  
 235  //----------------------------
 236  // EOF Change: download attributes for AM
 237  //-----------------------------
 238  ?>    
 239  
 240                      <span style="margin-right:41px;">
 241                      <?php echo drawDropDownPrefix('id="prefix_'.$optionValueId.'" style="margin:3px 0px 3px 0px;" onChange="return amUpdate(\''.$optionId.'\',\''.$optionValueId.'\',\'prefix\');"',$optionValueInfo['prefix']);?><?php echo tep_draw_input_field("price_$optionValueId",$optionValueInfo['price'],' style="margin:3px 0px 3px 0px;" id="price_'.$optionValueId.'" size="7" onfocus="amF(this)" onblur="amB(this)" onChange="return amUpdate(\''.$optionId.'\',\''.$optionValueId.'\',\'price\');"'); ?>
 242                      <?php
 243                      if(AM_USE_SORT_ORDER) {
 244  /*                    ?>
 245                      <?php echo tep_draw_input_field("sortOrder_$optionValueId",$optionValueInfo['sortOrder'],' style="margin:3px 0px 3px 0px;" id="sortOrder_'.$optionValueId.'" size="4" onChange="return amUpdate(\''.$optionId.'\',\''.$optionValueId.'\');"'); ?>
 246                      <?php
 247  */                    }
 248                      ?>
 249                      </span>
 250  <?php
 251  if(false){
 252  ?>
 253  <!--                    <input type="image" src="attributeManager/images/icon_rename.png" onclick="return customTemplatePrompt('renameTemplate');" border="0" title="Renames the selected template" />-->
 254  <?php
 255  }
 256  ?>
 257                      <input type="image" border="0" onClick="return customPrompt('amRemoveOptionValueFromProduct','<?php echo addslashes("option_id:$optionId|option_value_id:$optionValueId|option_value_name:".str_replace('"','&quot;',$optionValueInfo['name']))?>');" src="attributeManager/images/icon_delete.png" title="<? echo htmlspecialchars(sprintf(AM_AJAX_PRODUCT_REMOVES_VALUE_FROM_OPTION,$optionValueInfo['name'],$optionInfo['name'])) ?>" />
 258                      <?php
 259                      if(AM_USE_SORT_ORDER) {
 260                      ?>    
 261                          <input type="image" onclick="return amMoveOptionValue('<?php echo 'option_id:'.$optionId.'|option_value_id:'.$optionValueId.'|products_attributes_id:'.$optionValueInfo['products_attributes_id']; ?>', 'up');" src="attributeManager/images/icon_up.png" title="<?=AM_AJAX_MOVES_VALUE_UP?>" /> 
 262                          <input type="image" onclick="return amMoveOptionValue('<?php echo 'option_id:'.$optionId.'|option_value_id:'.$optionValueId.'|products_attributes_id:'.$optionValueInfo['products_attributes_id']; ?>', 'down');" src="attributeManager/images/icon_down.png" title="<?=AM_AJAX_MOVES_VALUE_DOWN?>" />  
 263                      <?php
 264                      }
 265                      ?>
 266                  </td>
 267              </tr>
 268      <?php
 269                  }
 270              }
 271          }    
 272      }
 273      ?>
 274  <!-- ----- -->
 275  <!-- EOF Show Option Values -->
 276  <!-- ----- -->
 277      </table>
 278      <?php
 279      if(!isset($_GET['target'])) 
 280          echo '</div>';
 281  } // end target = currentAttributes
 282  
 283  if(!isset($_GET['target']) || 'newAttribute' == $_GET['target'] ) {
 284      if(!isset($_GET['target'])) 
 285          echo '<div id="newAttribute">';
 286      
 287      // check to see if the selected option isset if it isn't pick the first otion in the dropdown
 288      $optionDrop = $attributeManager->buildOptionDropDown();
 289      
 290      if(!is_numeric($selectedOption)) {
 291          foreach($optionDrop as $key => $value) {
 292              if(tep_not_null($value['id'])){
 293                  $selectedOption = $value['id'];
 294                  break;
 295              }
 296          }
 297      }
 298  
 299      $optionValueDrop = $attributeManager->buildOptionValueDropDown($selectedOption);
 300  ?>
 301  <!-- ----- -->
 302  <!-- SHOW NEW OPTION PANEL on Bottom -->
 303  <!-- ----- -->
 304          <div class="newOptionPanel-header">
 305              <?=AM_AJAX_OPTION_NEW_PANEL?>
 306          </div>
 307      <table border="0"  cellpadding="0" cellspacing="0">
 308          <tr>
 309              <td align="right" valign="middle" class="newOptionPanel-label">
 310                  <?=AM_AJAX_OPTION?> <?php echo tep_draw_pull_down_menu('optionDropDown',$optionDrop,$selectedOption,'id="optionDropDown" onChange="return amUpdateNewOptionValue(this.value);" class="optionDropDown"')?>
 311              </td>
 312              <td align="right" valign="middle" class="newOptionPanel-button">
 313                  <input border="0"  type="image" src="attributeManager/images/icon_add_new.png" onclick="return customPrompt('amAddOption');" title="<?=AM_AJAX_ADDS_NEW_OPTION?>" />
 314              </td>
 315              <td align="right" valign="middle" class="newOptionPanel-label">
 316                  <?=AM_AJAX_VALUE?> <?php echo tep_draw_pull_down_menu('optionValueDropDown',$optionValueDrop,(is_numeric($selectedOptionValue) ? $selectedOptionValue : ''),'id="optionValueDropDown" class="optionValueDropDown"')?>
 317              </td>
 318              <td align="right" valign="middle" class="newOptionPanel-button">
 319                      <input border="0" type="image" src="attributeManager/images/icon_add_new.png" onclick="return customPrompt('amAddOptionValue');" title="<?=AM_AJAX_ADDS_NEW_OPTION_VALUE?>" />
 320              </td>
 321              <td valign="top" class="newOptionPanel-label">
 322                  <?=AM_AJAX_PREFIX?> <?php echo drawDropDownPrefix('id="prefix_0"')?>
 323              </td>
 324              <td valign="top" class="newOptionPanel-label">
 325                  <?=AM_AJAX_PRICE?> <?php echo tep_draw_input_field('newPrice','','size="4" id="newPrice"'); ?>
 326              </td>
 327              <?php
 328              if(AM_USE_SORT_ORDER) {
 329              ?>
 330              <!--
 331              <td valign="top" class="newOptionPanel-label">
 332                  <?=AM_AJAX_SORT?> <?php echo tep_draw_input_field('newSort','','size="4" id="newSort"'); ?>
 333              </td>
 334              -->
 335              <?php
 336              } else {
 337              ?>
 338              <td valign="top">
 339                  <?php echo tep_draw_hidden_field('newSort','','size="4" id="newSort"'); ?>
 340              </td>
 341              <?php
 342              }
 343              ?>
 344  
 345              <td align="right" valign="middle" class="newOptionPanel-button">
 346                  <input type="image" src="attributeManager/images/icon_add.png" value="Add" onclick="return amAddAttributeToProduct();" title="<?=AM_AJAX_ADDS_ATTRIBUTE_TO_PRODUCT?>" border="0"  />
 347              </td>
 348          </tr>
 349      </table>            
 350  <?php
 351      if(!isset($_GET['target'])) 
 352          echo '</div>';
 353  } // end target = newAttribute
 354  if(!isset($_GET['target'])) 
 355      echo '</div>';
 356  ?>
 357  <?php
 358  if (AM_USE_QT_PRO) {
 359     if(!isset($_GET['target']) || 'currentProductStockValues' == $_GET['target']) {
 360      if(!isset($_GET['target'])) 
 361          echo '<div id="currentProductStockValues">';
 362  
 363  $q=tep_db_query($sql="select products_name, products_options_name as _option, products_attributes.options_id as _option_id, products_options_values_name as _value, products_attributes.options_values_id as _value_id from ".
 364                    "products_description, products_attributes, products_options, products_options_values where ".
 365                    "products_attributes.products_id = products_description.products_id and ".
 366                    "products_attributes.products_id = '" . $products_id . "' and ".
 367                    "products_attributes.options_id = products_options.products_options_id and ".
 368                    "products_attributes.options_values_id = products_options_values.products_options_values_id and ".
 369                    "products_description.language_id = " . (int)$languages_id . " and ".
 370                    "products_options_values.language_id = " . (int)$languages_id . " and products_options.products_options_track_stock = 1 and ".
 371                    "products_options.language_id = " . (int)$languages_id . " order by products_attributes.options_id, products_attributes.options_values_id");
 372    if (tep_db_num_rows($q)>0) {
 373      $flag=1;
 374      while($list=tep_db_fetch_array($q)) {
 375        $options[$list[_option_id]][]=array($list[_value],$list[_value_id]);
 376        $option_names[$list[_option_id]]=$list[_option];
 377        $product_name=$list[products_name];
 378      }
 379  }
 380  ?>
 381      <table width="100%" border="0" cellspacing="0" cellpadding="3">    
 382          <tr class="header">
 383              <td width="50" align="center">
 384                  &nbsp;
 385              </td>
 386              <td>
 387                  QT Pro
 388              </td>
 389      
 390              <td align="right" colspan="<?php echo (sizeof($options)+2); ?>">
 391                  <span style="margin-right:40px"><?=AM_AJAX_ACTION?></span>
 392              </td>
 393          </tr>
 394          <tr class="option">
 395              <td align="center">
 396              <input type="image" border="0" id="show_hide_9999" src="attributeManager/images/icon_plus.gif" onclick="return amShowHideOptionsValues(9999);" />
 397              </td>
 398  <?php
 399    if (tep_db_num_rows($q)>0) {
 400      while(list($k,$v)=each($options)) {
 401  ?>       
 402              <td>
 403                  <?php echo $option_names[$k]; ?>
 404              </td>
 405  <?php
 406        $title[$title_num]=$k;
 407      }
 408  ?>
 409              <td align="right">
 410                  <span style="margin-right:41px;">
 411                  <?=AM_AJAX_QUANTITY?>
 412                  </span>
 413              </td>
 414          </tr>
 415  <?php
 416      $q=tep_db_query("select * from " . TABLE_PRODUCTS_STOCK . " where products_id='" . $products_id . "' order by products_stock_attributes");
 417      while($rec=tep_db_fetch_array($q)) {
 418        $val_array=explode(",",$rec[products_stock_attributes]);
 419  ?>      
 420          <tr class="optionValue" id="trOptionsValues_9999" style="display:none" >
 421              <td align="center">
 422                  <?php echo $rec[products_stock_id]; ?>
 423                  <img src="attributeManager/images/icon_arrow.gif" />
 424              </td>
 425  <?php                
 426        foreach($val_array as $val) {
 427          if (preg_match("/^(\d+)-(\d+)$/",$val,$m1)) {
 428  ?>
 429              <td>
 430                  &nbsp;&nbsp;&nbsp;<?php echo tep_values_name($m1[2]); ?>
 431              </td>
 432  <?php                
 433          } else {
 434  ?>    
 435                     <td>
 436                         &nbsp;
 437                     </td>
 438  <?php
 439          }
 440        }
 441        for($i=0;$i<sizeof($options)-sizeof($val_array);$i++) {
 442  ?>
 443                     <td>
 444                         &nbsp;
 445                     </td>
 446  <?php        
 447        }
 448  ?>      
 449              <td align="right">
 450                  <span style="margin-right:41px;">
 451                  <?php echo tep_draw_input_field("productStockQuantity_$rec[products_stock_id]", $rec[products_stock_quantity], ' style="margin:3px 0px 3px 0px;" id="productStockQuantity_'.$rec[products_stock_id].'" size="4" onChange="return amUpdateProductStockQuantity(\''.$rec[products_stock_id].'\');"'); ?>
 452                  </span>
 453                  <input type="image" border="0" onClick="return customPrompt('amRemoveStockOptionValueFromProduct','<?php echo addslashes("option_id:$rec[products_stock_id]")?>');" src="attributeManager/images/icon_delete.png" title="<?=AM_AJAX_ADDS_ATTRIBUTE_TO_PRODUCT?>" />
 454              </td>
 455          </tr>
 456  <?php
 457      }
 458  ?>
 459  <?php
 460    }
 461  ?>
 462      </table>
 463  <?php
 464      if(!isset($_GET['target'])) 
 465          echo '</div>';
 466      } // end target = currentStockValues
 467  if(!isset($_GET['target']) || 'newProductStockValue' == $_GET['target'] ) {
 468      
 469      if(!isset($_GET['target'])) 
 470          echo '<div id="newProductStockValue">';
 471  ?>
 472      <table border="0" cellpadding="3">
 473          <tr>
 474              <td align="right" valign="top">
 475      <?php    
 476    
 477    if (tep_db_num_rows($q)>0) {
 478      $flag=1;
 479      while($list=tep_db_fetch_array($q)) {
 480        $options[$list[_option_id]][]=array($list[_value],$list[_value_id]);
 481        $option_names[$list[_option_id]]=$list[_option];
 482        $product_name=$list[products_name];
 483      }
 484    } else {
 485      $flag=0;
 486      $q=tep_db_query("select products_quantity, products_name from " . TABLE_PRODUCTS . " p,products_description pd where pd.products_id= p.products_id and p.products_id='" . $products_id ."'");
 487      $list=tep_db_fetch_array($q);
 488      $db_quantity=$list[products_quantity];
 489      $product_name=stripslashes($list[products_name]);
 490    }
 491     $title_num=1;
 492    if ($flag) {
 493      reset($options);
 494      $i=0;
 495      while(list($k,$v)=each($options)) {
 496        echo "<td><select name=option$k id=option$k>";
 497        $dropDownOptions[] = 'option'.$k;
 498        foreach($v as $v1) {
 499          echo "<option value=".$v1[1].">".$v1[0];
 500        }
 501        echo "</select></td>";
 502        $i++;
 503      }
 504    } else {
 505      $i=1;
 506      echo '<td>'.AM_AJAX_QUANTITY.'</td>';
 507    }
 508  ?>
 509              <td>
 510                  <?php echo tep_draw_input_field("stockQuantity", $db_quantity, ' style="margin:3px 0px 3px 0px;" id="stockQuantity" size="4"'); ?>
 511               </td>
 512              <td valign="top">
 513                  <input type="image" src="attributeManager/images/icon_add.png" value="Add" onclick="return root('<?php echo implode(",", $dropDownOptions); ?>');" title="<?=AM_AJAX_UPDATE_OR_INSERT_ATTRIBUTE_COMBINATIONBY_QUANTITY?>" border="0"  /><br/>t: 
 514              </td>
 515          </tr>
 516      </table>            
 517  <?php
 518      if(!isset($_GET['target'])) 
 519          echo '</div>';
 520  } // end target = newProductStockValue
 521  if(!isset($_GET['target'])) 
 522      echo '</div>';
 523  ?>
 524  <?php
 525  } // End QT Pro Plugin
 526  ?>


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