Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

surf55

Pioneers
  • Posts

    12
  • Joined

  • Last visited

Posts posted by surf55

  1. Hi

     

    Thanks for this amazing contribution, it makes all so much easyer and faster.

     

    I'm also using a new stock notifyer contribution: http://addons.oscommerce.com/info/3152

     

    it works when editing quantities in categories.php. It requires editing categories.php like this:

    FIND this:
    	    tep_db_query("insert into " . TABLE_PRODUCTS_TO_CATEGORIES . " (products_id, categories_id) values ('" . (int)$products_id . "', '" . (int)$current_category_id . "')");
    	  } elseif ($action == 'update_product') {
    Insert this directly AFTER it:
    // BEGIN Automatic Stock Notification
      $current_stock_query = tep_db_query("select products_quantity from " . TABLE_PRODUCTS . " where products_id = '" . (int)$_GET['pID'] . "'");
      $current_stock = tep_db_fetch_array($current_stock_query);
      if ($current_stock['products_quantity'] < 1) {
     if ($_POST['products_quantity'] > 0) {
       $audience = array();
       $products_query = tep_db_query("select distinct pn.customers_id, c.customers_firstname, c.customers_lastname, c.customers_email_address from " . TABLE_CUSTOMERS . " c, " . TABLE_PRODUCTS_NOTIFICATIONS . " pn where c.customers_id = pn.customers_id and pn.products_id in ( '" . (int)$products_id . "')");
       while ($products = tep_db_fetch_array($products_query)) {
      $audience[$products['customers_id']] = array('firstname' => $products['customers_firstname'],
    			  'lastname' => $products['customers_lastname'],
    			  'email_address' => $products['customers_email_address']);
       }
       $product_query_raw = tep_db_query("select p.products_id, pd.language_id, pd.products_name, pd.products_description, pd.products_url, p.products_quantity, p.products_model, p.products_image, p.products_price, p.products_weight, p.products_date_added, p.products_last_modified, p.products_date_available, p.products_status, p.manufacturers_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_id = pd.products_id and p.products_id = '" . (int)$_GET['pID'] . "'");
       $product = tep_db_fetch_array($product_query_raw);
       $customers_query_raw = tep_db_query("select distinct pn.customers_id, c.customers_firstname, c.customers_lastname, c.customers_email_address from " . TABLE_CUSTOMERS . " c, " . TABLE_PRODUCTS_NOTIFICATIONS . " pn where c.customers_id = pn.customers_id and pn.products_id in ( '" . (int)$products_id . "')");
       $customer = tep_db_fetch_array($customers_query_raw);
       reset($audience);
       while (list($key, $value) = each ($audience)) {
      $mimemessage = new email(array('X-Mailer: osCommerce System Mailer'));
      // add the message to the object
      if (EMAIL_USE_HTML == 'true') {
     $mimemessage->add_html(HTML_NOTIFICATION1 . $value['firstname'] . ' ' . $value['lastname'] . HTML_NOTIFICATION2 . STORE_NAME . HTML_NOTIFICATION3 . $products_id . '">' . $product['products_name'] . HTML_NOTIFICATION4 . '">' . STORE_NAME . HTML_NOTIFICATION5 . $product['products_name'] . HTML_NOTIFICATION6 . $product['products_name'] . HTML_NOTIFICATION7 . STORE_NAME . HTML_NOTIFICATION8 . $products_id . '">' . $product['products_name'] . HTML_NOTIFICATION9 . STORE_NAME);
      } else {
     $mimemessage->add_text(TEXT_NOTIFICATION1 . $value['firstname'] . ' ' . $value['lastname'] . TEXT_NOTIFICATION2 . STORE_NAME . TEXT_NOTIFICATION3 . $product['products_name'] . TEXT_NOTIFICATION4 . $product['products_name'] . TEXT_NOTIFICATION5 . $product['products_name'] . TEXT_NOTIFICATION6 . STORE_NAME . TEXT_NOTIFICATION7 . $product['products_name'] . TEXT_NOTIFICATION8 . STORE_NAME);
      }
      $mimemessage->build_message();
      $mimemessage->send($value['firstname'] . ' ' . $value['lastname'], $value['email_address'], STORE_NAME, STORE_OWNER_EMAIL_ADDRESS, EMAIL_SUBJECT . $product['products_name'], $email_order);
      // the following line deletes the customer notification so that that after the email is sent, the customer will have to visit the product page and select the notification button in order to receive future email stock notifications
      tep_db_query("delete from " . TABLE_PRODUCTS_NOTIFICATIONS . " where products_id = '" . $products_id . "' ");
       }
     }
      }
    // END Automatic Stock Notification
    

     

    So I presume I would have to add same code into quick_stockupdate.php too? But where to insert it?

    <?php
    /*
     $Id: quick_stockupdate.php 1739 2009-05-05 00:52:16Z Azrin Aris $
     Quick Product update - V3.8.1
    
    ChangeLog:
    
    v3.8.1   05/06/09 Version by: Azrin Aris
    Summary :
     1. Add "Title" tag to Category/Manufacture selector to show its category/manufacture id - requested by Jim Hande ;)
    
    BugFix:
     1. MySQL not updating if manufactures_id is not set when MySQL is configures as 'STRICT' - Fixed by Steve (Jimbob_pooley)
    
    v3.8   05/05/09 Version by: Azrin Aris
    Summary :
    1. Minor Redesign on UI:
     + added Top/Bottom Action Bar
    2. Added Update/Copy/Move/Delete Function
    3. Added Numeric Input filtering
    4. Added quick_stockupdate.css file for easier table customization
    
    BugFix:
     - if a value is more than a thousand, using autoupdate will make the price to 1.00 - Fixed
    v3.7   01/25/09 Version by: Azrin Aris
    Summary :
    1. Add Language filter
    
    v3.6   01/23/09 Version by: Azrin Aris
    Summary :
    1. Remove the need to use /tmp directory
    2. Add Search by Category or By Manufacture
    
    
    v3.5   12/16/08 Version by: Azrin Aris
    Summary :
    1. Add Quick Stock Updater Configuration page (Configuration->Quick Stock Updater)
      - Enable/Disable Add to stock option (value entered in 'New Stock' will be added to existing stock - Default = Enable)
      - Enable/Disable Update Process time (Default = Enable)
      - Set Max input character for 'Model' field (Default = 8)
      - Set Max input character for 'Weight' field (Default = 4)
      - Set Max input character for 'New Stock' field (Default = 4)
      - Set Max input character for 'Price' field (Default = 6)
      - Set decimal point for 'Price' field (Default = 2)
    2. SQL installation script for configuration page QuickStock_sql_install.sql is included
    3. SQL uninstallation script for configuration page QuickStock_sql_uninstall.sql is included
    
    
    v3.2   12/12/08 Version by: Azrin Aris
    Summary :
    1. Remove Server loading checking
    2. Remove Row-By-Row SQL Update method
    3. Change update method to SQL import method
    4. Add update time display
    
    v3.1   12/1/08 Version by: Azrin Aris
    Summary :
    1. Added serverload checking to avoid server bogging if items are too many
    2. Added Data changed event to update only changed record(s) to minimize server load
    3. Added Message notification
    4. Added Screen shot ;)
    5. Added MoSoft German Translation - but addition Variable still need translation
    
    v3.0   12/1/08 Version by: Azrin Aris
    Summary :
    Rewrite the quick_stokupdate.php in admin/include - solved the > 40 items problem (at least on my online store ;)). I've tested on FireFox, please let me know if it works on other browsers.
    
    
    
    */
     require('includes/application_top.php');
     require('includes/classes/currencies.php');
    //--------------------------------------------------------------------------------------------------------------------------------------------------
    
    //Function to return time in seconds.
    function microtime_float(){
      list($usec, $sec) = explode(" ", microtime());
      return ((float)$usec + (float)$sec);
    }
    //--------------------------------------------------------------------------------------------------------------------------------------------------
    
    
     //Credit to surfalot (Run SQL Script)
    function qs_db_query($query, $link = 'db_link') {
       global $$link;
       return mysql_query($query, $$link);
     }
    //--------------------------------------------------------------------------------------------------------------------------------------------------
    //Credit to surfalot (Run SQL Script)
    //Modified for Quick Stock Update - 2008-12-12 Azrin Aris
    function qs_update_db_file($qs_file){
    
     if (file_exists($qs_file)) {
      $fd = fopen($qs_file, 'rb');
      $restore_query = fread($fd, filesize($qs_file));
      fclose($fd);
      qs_upsate_db($restore_query);
     } else {
      return false;
     }
    }
    
    function qs_update_db($qs_sql){
     $sql_array = array();
     $sql_length = strlen($qs_sql);
     $pos = strpos($qs_sql, ';');
     for ($i=$pos; $i<$sql_length; $i++) {
      if ($qs_sql[0] == '#' || $qs_sql[0] == '-') {
       $qs_sql = ltrim(substr($qs_sql, strpos($qs_sql, "\n")));
       $sql_length = strlen($qs_sql);
       $i = strpos($qs_sql, ';')-1;
       continue;
      }
      if ($qs_sql[($i+1)] == "\n") {
       for ($j=($i+2); $j<$sql_length; $j++) {
     if (trim($qs_sql[$j]) != '') {
      $next = substr($qs_sql, $j, 6);
      if ($next[0] == '#' || $next[0] == '-') {
    // find out where the break position is so we can remove this line (#comment line)
       for ($k=$j; $k<$sql_length; $k++) {
        if ($qs_sql[$k] == "\n") break;
       }
       $query = substr($qs_sql, 0, $i+1);
       $qs_sql = substr($qs_sql, $k);
    // join the query before the comment appeared, with the rest of the dump
       $qs_sql = $query . $qs_sql;
       $sql_length = strlen($qs_sql);
       $i = strpos($qs_sql, ';')-1;
       continue 2;
      }
      break;
     }
       }
       if ($next == '') { // get the last insert query
     $next = 'insert';
       }
       if ( (eregi('alter ', $next)) || (eregi('update', $next)) || (eregi('create', $next)) || (eregi('insert', $next)) || (eregi('delete', $next)) || (eregi('drop t', $next)) ) {
     $next = '';
     $sql_array[] = substr($qs_sql, 0, $i);
     $qs_sql = ltrim(substr($qs_sql, $i+1));
     $sql_length = strlen($qs_sql);
     $i = strpos($qs_sql, ';')-1;
       }
      }
     }
     for ($i=0; $i<sizeof($sql_array); $i++) {
      if (!qs_db_query($sql_array[$i])) {
       $db_error = mysql_error();
       $i = sizeof($sql_array);
      }
     }
     return true;
     }
    //--------------------------------------------------------------------------------------------------------------------------------------------------
    
    // Function to query Manufacturer List from DB - Added 2008/12/30 Azrin Aris
    function tep_quickstock_get_manufacturer_list(){
     //get manufacture id and name
     $manufacturers_query = tep_db_query("select manufacturers_id, manufacturers_name from " . TABLE_MANUFACTURERS . " order by manufacturers_name");
     $manufacturers_array;
     while ($manufacturers = tep_db_fetch_array($manufacturers_query)) {
      $manufacturers_array[$manufacturers['manufacturers_id']] = $manufacturers['manufacturers_name'];
     }
    
     return $manufacturers_array;
     }
    //--------------------------------------------------------------------------------------------------------------------------------------------------
    
    // Function to create drop down list for manufacturer selection - Added 2009/01/21 Azrin Aris
    function tep_quickstock_manufacturer_selector($manufacturers_list){
    global $mfg_id;
    
    $result = '<select name="mfg_id" onchange="this.form.submit();" title="'. QUICK_MANUFACTURER_ID . $mfg_id.'"><option value=0>--NONE--</option>';
    reset($manufacturers_list);
    
    while (list($key, $value) = each ($manufacturers_list)) {
     if($mfg_id==$key){
       $result .= '<option value="' . $key . '" selected="selected">' . $value . '</option>';
     } else {
       $result .= '<option value="' . $key . '">' . $value . '</option>';
     } }  
    $result .= '</select>';
    return $result;
     }
    //--------------------------------------------------------------------------------------------------------------------------------------------------
    // Function to create drop down list for manufacturer selection - Added 2008/12/30 Azrin Aris
    function tep_quickstock_manufacturer_selectorEx($manufacturers_list,$cat_id,$default_id){
    
    
    $result = '<select name="stock_update[' .$cat_id . '][manufacturer]" onchange="changed(\'stock_update[' . $cat_id . '][changed]\');" title="'. QUICK_MANUFACTURER_ID . $default_id.'"><option value=></option>';
    reset($manufacturers_list);
    while (list($key, $value) = each ($manufacturers_list)) {
     if($default_id==$key){
       $result .= '<option value="' . $key . '" selected="selected">' . $value . '</option>';
     } else {
       $result .= '<option value="' . $key . '">' . $value . '</option>';
     }
    }  
    $result .= '</select>';
    return $result;
     }
    //--------------------------------------------------------------------------------------------------------------------------------------------------
    
    // Function to query language List from DB - Added 2008/12/30 Azrin Aris
     function tep_quickstock_get_language_list(){
     //get manufacture id and name
     $languages_query = tep_db_query("select languages_id, name from " . TABLE_LANGUAGES . " order by languages_id");
     $languages_array;
     while ($languages = tep_db_fetch_array($languages_query)) {
      $languages_array[$languages['languages_id']] = $languages['name'];
     }
    
     return $languages_array;
     }
    //--------------------------------------------------------------------------------------------------------------------------------------------------
    
    // Function to create drop down list for language selection - Added 2009/01/21 Azrin Aris
    function tep_quickstock_language_selector(){
    global $lang_id;
    
    $languages_list =tep_quickstock_get_language_list();
    
    $result = '<select name="lang_id" onchange="this.form.submit();">';
    reset($languages_list);
    
    while (list($key, $value) = each ($languages_list)) {
     if($lang_id==$key){
       $result .= '<option value="' . $key . '" selected="selected">' . $value . '</option>';
     } else {
       $result .= '<option value="' . $key . '">' . $value . '</option>';
     } }  
    $result .= '</select>';
    return $result;
     }
    //--------------------------------------------------------------------------------------------------------------------------------------------------
    
    
     // Function to create drop down list for category selection - Added 2008/12/30 Azrin Aris
    function tep_quickstock_category_selectorEx($cat_id,$default_id,$enabled = true){
     $disabled = $enabled?"":" disabled";
     $select_name = 'stock_update[' .$cat_id . '][category]';
     $select_onchange = 'onchange="changed(\'stock_update[' . $cat_id . '][changed]\');"';
    
     $tree = tep_get_category_tree();
    
    
     $dropdown= tep_draw_pull_down_menu($select_name, $tree, $default_id, $select_onchange . ' title="'. QUICK_CATEGORY_ID . $default_id.'"' . $disabled); //single
     return $dropdown;
     }
    //--------------------------------------------------------------------------------------------------------------------------------------------------
    
     // Function to create drop down list for category selection - Added 2008/12/30 Azrin Aris
     function tep_quickstock_category_selector(){
     global $cat_id;
    
     $tree = tep_get_category_tree();
    
     $dropdown= tep_draw_pull_down_menu('cat_id', $tree, '', 'onchange="this.form.submit();" title="'. QUICK_CATEGORY_ID . $cat_id.'"'); //single
     return $dropdown;
     }
    
    //--------------------------------------------------------------------------------------------------------------------------------------------------
    
     // Function to create list of products base on selected category/manufacturer - Added 2008/12/30 Azrin Aris
     function tep_quickstock_product_listing($sel_id){
     global $lang_id;
     global $manufacturers_list;
     global $filter_type;
    
    
     if (tep_not_null($sel_id)) {
      if($filter_type==1){
       $sql2 = tep_db_query("SELECT p.products_model, p.products_id, p. products_quantity, p.products_status, p.products_weight, p.products_price, p.manufacturers_id, pd.products_name, pd.language_id, ptc.categories_id from products p, products_to_categories ptc, products_description pd where p.products_id = ptc.products_id and p.products_id = pd.products_id and ptc.categories_id = '" . $sel_id . "' and pd.language_id = '" . (int)$lang_id . "' order by pd.products_name");
       }
       else{
       $sql2 = tep_db_query("SELECT p.products_model, p.products_id, p. products_quantity, p.products_status, p.products_weight, p.products_price, p.manufacturers_id, pd.products_name, pd.language_id, ptc.categories_id from products p, products_to_categories ptc, products_description pd where p.products_id = ptc.products_id and p.products_id = pd.products_id and p.manufacturers_id = '" . $sel_id . "' and pd.language_id = '" . (int)$lang_id . "' order by pd.products_name");
       }
    
    
    
      while ($results = tep_db_fetch_array($sql2)) {
    
     //check the item status
     $active = ($results['products_status'] == 1) ? ' checked="CHECKED"' : '';
     $inactive = ($results['products_status'] == 0) ? ' checked="CHECKED"' : '';
    
    
     //create mannufacture select statement
     if($filter_type==1){
       $catman_select = tep_quickstock_manufacturer_selectorEx($manufacturers_list, $results['products_id'],$results['manufacturers_id']);
      }
      else {
       $catman_select = tep_quickstock_category_selectorEx($results['products_id'],$results['categories_id'],false);
      }
    
     $doChange = 'changed(\'stock_update[' . $results['products_id'] . '][changed]\');';
       $doValidate_flt = 'javascript: this.value = validate (this.value, 2, 0);';
       $doValidate_int = 'javascript: this.value = validate (this.value, 0, 1);';
    
     ?>
     <tr class="dataTableRow">
      <td class="dataTableContent" align="center"><input type="CHECKBOX" name="stock_update[<?php echo  $results['products_id'] ?>][changed]">
    	 <input type="HIDDEN" name="stock_update[<?php echo  $results['products_id'] ?>][ptc]" value="<?php echo $results['categories_id'] ?>"></td>
        <td class="dataTableContent" align="center"><?php echo $results['products_id'] ?></td>
    	 <td class="dataTableContent" align="center"><input type="text" size="<?php echo QUICK_STOCK_MODELSIZE ?>" name="stock_update[<?php echo  $results['products_id'] ?>][model]" value="<?php echo $results['products_model'] ?>" onchange="<?php echo $doChange?>"></td>
    	 <td class="dataTableContent" align="center"><?php echo $catman_select?></td>
    	 <td class="dataTableContent" align="left" ><?php echo $results['products_name'] ?></td>
    	 <td class="dataTableContent" align="center"><input type="text" size="<?php echo QUICK_STOCK_WEIGHTSIZE ?>" name="stock_update[<?php echo $results['products_id'] ?>][weight]" value="<?php echo $results['products_weight'] ?>" onchange="<?php echo $doChange?>" onblur="<?php echo $doValidate_flt?>"></td>
    	 <td class="dataTableContent" align="center"><input type="text" size="<?php echo QUICK_STOCK_PRICESIZE ?>" name="stock_update[<?php  echo $results['products_id'] ?>][price]" value="<?php echo number_format($results['products_price'],QUICK_STOCK_PRICEDEC,'.',','); ?>" onchange="<?php echo $doChange?>" onblur="<?php echo $doValidate_flt?>"></td>
    	 <td class="dataTableContent" align="center"><?php echo $results['products_quantity'] ?><input type="hidden" size="4" name="stock_update[<?php echo $results['products_id'] ?>][oldstock]" value="<?php echo $results['products_quantity'] ?>" onchange="<?php echo $doChange?>"></td>
    	 <td class="dataTableContent" width = "50px" align="center"><input type="text" size="<?php echo QUICK_STOCK_STOCKSIZE ?>" name="stock_update[<?php echo $results['products_id'] ?>][newstock]" value="0" onchange="<?php echo $doChange?>" onblur="<?php echo $doValidate_int?>"></td>
    	 <td class="dataTableContent" align="center" ><input type="radio" name="stock_update[<?php echo $results['products_id'] ?>][active]" value="1" <?php echo $active ?> onclick="<?php echo $doChange?>"></td>
    	 <td class="dataTableContent" align="center" ><input type="radio" name="stock_update[<?php echo $results['products_id'] ?>][active]" value="0" <?php echo $inactive ?> onclick="<?php echo $doChange?>"></td>
        </tr>
    
    
      <?php
      }
     }
    }
    //--------------------------------------------------------------------------------------------------------------------------------------------------
     // Function to create Action Bar - Added 2009/04/01 Azrin Aris
     function draw_action_bar($action_id){
     global $action_type;
     global $dest_id;
     global $auto_status;
     ?>		 
       <tr class="alt">
        <th scope="col" align="left" colspan="9" >
    	 Action :
    	 <select name="action_type[]" id="select_action" onchange="showElement(this)">
    		    <option value="0"<?php if($action_type==0){echo ' selected="selected"';}?>><?php echo QUICK_UPDATE?></option>
    		    <option value="1"<?php if($action_type==1){echo ' selected="selected"';}?>><?php echo QUICK_COPY  ?></option>
    		    <option value="2"<?php if($action_type==2){echo ' selected="selected"';}?>><?php echo QUICK_MOVE  ?></option>
    		    <option value="3"<?php if($action_type==3){echo ' selected="selected"';}?>><?php echo QUICK_DELETE?></option>
    		    </select>
    	 <?php
    	    $cat_tree = tep_get_category_tree();
    	    echo tep_draw_pull_down_menu('dest_id[]', $cat_tree, $dest_id, 'onchange="updateDest(this)"'); //single
    	 ?>
        </th>
        <th scope="col" colspan="2" align="center">
    	  <input type="CHECKBOX" name="auto_status[]" onchange="updateAutoStatus(this)" ><?php echo QUICK_AUTOSTATUS?>		 
        </th>
       </tr>
     <?php
     }
    
    //--------------------------------------------------------------------------------------------------------------------------------------------------
    // Function to remove formatted number - Added 2009/05/05 Azrin Aris
    function number_unformat ($input)
    {
     $curr = new currencies();
    
     $thousands_sep = $curr->currencies[DEFAULT_CURRENCY]['thousands_point'];
     $decimal_point = $curr->currencies[DEFAULT_CURRENCY]['decimal_point'];
    
      if ($thousands_sep == chr(160)) {
    
     // change non-breaking space into ordinary space
    
     $thousands_sep = chr(32);
    
      } // if
    
    
    
      $count = count_chars($input, 1);
    
      if ($count[ord($decimal_point)] > 1) {
    
     // too many decimal places
    
     return $input;
    
      } // if
    
    
    
      // split number into 2 distinct parts
    
      list($integer, $fraction) = explode($decimal_point, $input);
    
    
    
      // remove thousands separator
    
      $integer = str_replace($thousands_sep, NULL, $integer);
    
    
    
      // join the two parts back together again
    
      $number = $integer .'.' .$fraction;
    
    
    
      return $number;
    
    
    } // number_unformat
    //--------------------------------------------------------------------------------------------------------------------------------------------------
    
     //Check if cat_id is set by user selection
     $cat_id = (isset($HTTP_POST_VARS['cat_id']) ? $HTTP_POST_VARS['cat_id'] : '');
     //Check if stock_update is set
     $stock_update = (isset($HTTP_POST_VARS['stock_update']) ? $HTTP_POST_VARS['stock_update'] : '');
    
     //Check if update_status is set
     $update_status = (isset($HTTP_POST_VARS['update_status']) ? $HTTP_POST_VARS['update_status'] : '');
    
     //Check if filter_type is set
     $filter_type = (isset($HTTP_POST_VARS['filter_type']) ? $HTTP_POST_VARS['filter_type'] : '1');
    
    //Check if mfg_id is set
     $mfg_id = (isset($HTTP_POST_VARS['mfg_id']) ? $HTTP_POST_VARS['mfg_id'] : '0');
    //Check if lang_id is set
     $lang_id = (isset($HTTP_POST_VARS['lang_id']) ? $HTTP_POST_VARS['lang_id'] : '1');
    //Check if action_type is set
     $action_array = array();
     $action_array = (isset($HTTP_POST_VARS['action_type']) ? $HTTP_POST_VARS['action_type'] : '');
     $action_type = $action_array[1];
    
    //Check if dest_id is set
     $dest_array = array();
     $dest_array = (isset($HTTP_POST_VARS['dest_id']) ? $HTTP_POST_VARS['dest_id'] : '');
     $dest_id = $dest_array[1];
    //Check if auto_status is set
     $auto_status_array = array();
     $auto_status_array = (isset($HTTP_POST_VARS['auto_status']) ? $HTTP_POST_VARS['auto_status'] : '');
     $auto_status = $auto_status_array[1]=="on"?1:0;
    
    
     $manufacturers_list[] = array();
     $manufacturers_list = tep_quickstock_get_manufacturer_list();
    
    //--------------------------------------------------------------------------------------------------------------------------------------------------
    
     if(tep_not_null($stock_update)){
    
      $update_count = 0;
      $busy_count = 0;
      $qs_sql = '';
    
    
      while (list($key, $items) = each($stock_update)){
    
     $changed = $items['changed'];
     $categories_id = $items['oldstock'];
    
    
     $items_price = number_unformat($items['price']);
    
     if ($items['manufacturer'] == '') {$items['manufacturer']=0;}// Credit to Jimbob_pooley for this fix
    
     if($action_type==0)
     {
    
     if(QUICK_STOCK_ADDTOSTOCK == 'true'){
      $current_stock = $items['newstock'] + $items['oldstock'];
     } else {
      $current_stock = $items['newstock'];
     }
    
     if(tep_not_null($auto_status)){
       $new_status = $current_stock>0?"1":"0";
      if($items['active']!=$new_status)
      {
       $items['active'] = $new_status;
       $changed = 1;
      }
     }//End if(tep_not_nul...
    
    
    
     if($changed){
    
      //Begin Validation Code
    
      //End of Validation Code
      $update_count++;
    
      if($filter_type==1){
       $sql = "UPDATE products SET products_quantity = '".$current_stock."', products_model = '".$items['model']."', products_price = '".$items_price."', products_weight = '".$items['weight']."', manufacturers_id = '".$items['manufacturer']."', products_status = '".$items['active']."' WHERE products_id = $key";
    
       $qs_sql .= "$sql;\n";
      }
      else {
       $sql = "UPDATE products SET products_quantity = '".$current_stock."', products_model = '".$items['model']."', products_price = '".$items_price."', products_weight = '".$items['weight']."', products_status = '".$items['active']."' WHERE products_id = $key";
    
       $qs_sql .= "$sql;\n";
    
      }
    
     }//End if($changed)
     }//End if($action_type==0)
     else if($action_type==1)
     {
      if($changed)
      {
        $update_count++;
     $sql = "INSERT into products_to_categories (products_id, categories_id) values ('$key', '$dest_id')";
     $qs_sql .= "$sql;\n";
      }
     }
     else if($action_type==2)
     {
     if($changed)
      {
        $update_count++;
        $sql = "UPDATE products_to_categories SET categories_id = '".$dest_id."' WHERE products_id = $key";
        $qs_sql .= "$sql;\n";
      }
     }
     else if($action_type==3)
     {
     if($changed)
      {
        $update_count++;
        $sql = "DELETE FROM products_to_categories where products_id = $key AND categories_id ='" . $items['ptc'] ."'";
        $qs_sql .= "$sql;\n";
    
      }
    
     }  
     }//End while($list...
    
     if($update_count){
    
      $time_start = microtime_float();
      $update_status = qs_update_db($qs_sql);
    
      $time_end = microtime_float();
      $time = $time_end - $time_start;   
    
      if($update_status){
       $msg_str = sprintf(QUICK_MSG_ITEMSUPDATED,$update_count);
       $messageStack->add(QUICK_MSG_SUCCESS . ' ' . $msg_str,'success'); 
    
       if(QUICK_STOCK_SHOWELAPSETIME == 'true'){
     $msg_str = sprintf(QUICK_MSG_UPDATETIME,$time);
     $messageStack->add(QUICK_MSG_SUCCESS . ' ' . $msg_str,'success'); 
       }
    
      } else {
       $messageStack->add(QUICK_MSG_ERROR . ' ' . QUICK_MESSAGE_UPDATEERROR,'error');		 
      }//End if(qd_update_db(...
    
     } else {
      $messageStack->add(QUICK_MSG_WARNING . ' ' . QUICK_MSG_NOITEMUPDATED ,'warning');
     }//End if($update_count) 
     }//End Of stock update
    //this line puts in the proper menu column on left in admin for OSC 2.3
     require('includes/template_top.php');
    
    ?>
    <!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html <?php echo HTML_PARAMS; ?>>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
    <title><?php echo TITLE; ?></title>
    <link rel="stylesheet" type="text/css" href="includes/stylesheet.css">
    <link rel="stylesheet" type="text/css" href="quick_stockupdate.css">
    <script language="javascript" src="includes/general.js"></script>
    <SCRIPT TYPE="text/javascript">
    <!--
    function changed(a){
    var allElements = document.getElementsByName(a);
    
    for (var i=0; i < allElements.length; i++) {
     allElements[i].value = 1;
     allElements[i].checked = true;
    
    }
    }
    
    function checkall(a){
    var forms = document.QuickUpdate_Form;
    
    for(i=0; i<forms.elements.length;i++)
    {
     if(forms.elements[i].type=="checkbox" && forms.elements[i].name!="auto_status[]")
     {
      forms.elements[i].checked=a.checked;
     }
    }
    }
    function updateAutoStatus(a){
    var ds = document.getElementsByName(a.name);
    var st = document.getElementsByName("status_txt");
    for (b=0; b < ds.length; b++) {
     ds[b].checked = a.checked;
    
    }
    
    st[0].style.visibility = a.checked?"visible":"hidden";
    }
    function updateDest(a){
    var ds = document.getElementsByName(a.name);
    
    
    for (b=0; b < ds.length; b++) {
     ds[b].value = a.value;
    
    }
    }
    function showElement(a){
    do_showElement(a.value);
    }
    
    function do_showElement(a){
    var action_select = document.getElementsByName("action_type[]");
    var dest_select = document.getElementsByName("dest_id[]");
    var auto_status = document.getElementsByName("auto_status[]");
    var st = document.getElementsByName("status_txt");
    
    var showelement = (a>0 && a<3);
    
    st[0].style.visibility = auto_status[0].checked?"visible":"hidden";
    
    
    for (var j=0; j < 2; j++) {
     action_select[j].value = a;
    
     if(showelement==true)
     {
      dest_select[j].style.visibility = "visible";
     }
     else
     {
      dest_select[j].style.visibility = "hidden";
     }
    
     if(a==0)
     {
      auto_status[j].disabled = "";
     }
     else
     {
      auto_status[j].disabled = "disabled";
     }
    }
    }
    function validate (str, dec, bNeg)
    { // auto-correct input - force numeric data based on params.
    var cDec = '.'; // decimal point symbol
     var bDec = false; var val = "";
     var strf = ""; var neg = ""; var i = 0;
     if (str == "")
     return parseFloat ("0").toFixed (dec);
     if (bNeg && str.charAt (i) == '-')
     {
     neg = '-';
     i++;
    }
     for (i; i < str.length; i++)
     {
       val = str.charAt (i);
       if (val == cDec)
       {
      if (!bDec)
      {
       strf += val;
       bDec = true;
      }
       }
       else if (val >= '0' && val <= '9')
     {
      strf += val;
     }
     }
    
     strf = (strf == "" ? 0 : neg + strf);
     return parseFloat (strf).toFixed (dec);
    }
    //-->
    </SCRIPT>
    </head>
    <body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" bgcolor="#FFFFFF" onload="SetFocus();">
    <!-- header //-->
    <?php require(DIR_WS_INCLUDES . 'header.php'); ?>
    <!-- header_eof //-->
    
    <!-- body //-->
    <table border="0" width="100%" cellspacing="2" cellpadding="2">
     <tr>
       <td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="1" cellpadding="1" class="columnLeft">
    <!-- left_navigation //-->
    <!-- left_navigation_eof //-->
       </table></td>
    <!-- body_text //-->
       <td width="100%" valign="top"><table border="0" width="100%" cellspacing="2" cellpadding="2">
     <tr>
      <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
        <tr>
    	 <td class="pageHeading"><?php echo QUICK_HEAD1; ?></td>
    	 <td class="pageHeading" align="right"><?php echo tep_draw_separator('pixel_trans.gif', HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td>
        </tr>
       </table></td>
     </tr>
     <tr>
      <form action="quick_stockupdate.php" method="post" name="SearchCriteria_Form">
      <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
    	 <!--<tr>
    	  <td class="main" colspan="3"><?php //echo QUICK_HEAD2; ?></td>
    	 </tr>-->
    	 <tr>
    	  <td class="main" colspan="2" align="left"><?php echo 'Search by'; ?></td>
    	  <td class="main" colspan="2" align="left"><?php echo $filter_type==1?'Select Category':'Select Manufacturer'; ?></td>
    	  <td class="main" colspan="2" align="left"><?php echo 'Select Language'; ?></td>
    	 </tr>
    	  <!--START OF SEARCH CRITERIA BOX-->   
    	 <tr>
    	  <td class="main" align="left" width="50px">
    	   <select name="filter_type" id="select" onchange="this.form.submit();">
        <option value="1"<?php if($filter_type==1){echo ' selected="selected"';}?>><?php echo QUICK_CATEGORY  ?></option>
        <option value="2"<?php if($filter_type==2){echo ' selected="selected"';}?>><?php echo QUICK_MANUFACTURER?></option>
      </select>
    	  </td>
    	  <td class="main" width="10px"></td>
    	  <td class="main" align="left" width="100px"><p><?php if($filter_type==1){ echo tep_quickstock_category_selector();} else{echo tep_quickstock_manufacturer_selector($manufacturers_list);} ?></p></td>
    	  <td class="main" width="10px"></td>
    	  <td class="main" align="left" width="100px"><p><?php echo tep_quickstock_language_selector(); ?></p></td>
    	  <td class="pageHeading" align="right"><?php echo tep_draw_separator('pixel_trans.gif', HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td>
    	 </tr>
    	 <!--/END OF SEARCH CRITERIA BOX-->	   
    	 </table></td>
      </form>	 
     </tr>
     <tr>
        <td><table border="0" width="100%" cellspacing="2" cellpadding="2">
        <form action="quick_stockupdate.php" method="post" name="QuickUpdate_Form">
    	 <tr>
    	  <td valign="top">
    	   <table class="QuickTable" border="0" width="100%" cellspacing="2" cellpadding="2">
    	    <!--/START OF ACTION BOX--> 
      <?php draw_action_bar(1);?>
    	    <!--/END OF ACTION BOX-->			 
    	    <tr>
    		 <th scope="col" width="1%" align="center"><input type="checkbox" name="check_all" onclick="checkall(this);"></th>
    		 <th scope="col" width="3%" align="center"><?php echo QUICK_ID; ?></th>
    		 <th scope="col" width="7%" align="center"> <?php echo QUICK_MODEL; ?></th>
    		 <th scope="col" width="10%" align="center"> <?php echo $filter_type==1?QUICK_MANUFACTURER:QUICK_CATEGORY; ?></th>
    		 <th scope="col" width="40%" align="left"><?php echo QUICK_NAME; ?></th>
    		 <th scope="col" width="3%" align="center"><?php echo QUICK_WEIGHT; ?></th>
    		 <th scope="col" width="8%" align="center"><?php echo QUICK_PRICE; ?></th>
    		 <th scope="col" width="4%" align="center"><?php echo QUICK_STOCK; ?></th>
    		 <th scope="col" width="4%" align="center"><?php echo QUICK_NEW_STOCK; ?></th>
    		 <th scope="col"  width="15%" align="center" colspan="2"><?php echo QUICK_STATUS; ?><br> <?php echo '<font color="009933">' .QUICK_ACTIVE . '</font> / <font color="ff0000">' . QUICK_INACTIVE . '</font>';?></th>
    	    </tr>
     <?php tep_quickstock_product_listing($filter_type==1?$cat_id:$mfg_id); ?>
    	    <!--/START OF ACTION BOX--> 
      <?php draw_action_bar(2);?>
    	    <!--/END OF ACTION BOX-->
     </table>
    	  </td>
    	 </tr>
    	 <tr>
        <td align="center" colspan="10" class="smallText">
    	   <input type="hidden" name="cat_id" value="<?php echo $cat_id;?>">
    	   <input type="hidden" name="mfg_id" value="<?php echo $mfg_id;?>">		  
    	   <input type="hidden" name="lang_id" value="<?php echo $lang_id;?>">		  
    	   <input type="hidden" name="filter_type" value="<?php echo $filter_type;?>">
       <?php echo '<p name="status_txt">' . QUICK_TEXT . '</p>'; ?>		  
    	   <input type="submit" value="Update">
    
    
    
    		    <SCRIPT TYPE="text/javascript">
    		    <!--
    
       do_showElement("<?php echo $action_type; ?>");
    		    //-->
    		    </SCRIPT>
    	  </td>
    	 </tr>
        </form>
       </table></td>
      </tr>
       </table></td>
    <!-- body_text_eof //-->
     </tr>
    </table>
    <!-- body_eof //-->
    <!-- footer //-->
    <?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
    <!-- footer_eof //-->
    <br>
    </body>
    </html>
    <?php
     require(DIR_WS_INCLUDES . 'template_bottom.php');
     require(DIR_WS_INCLUDES . 'application_bottom.php');
    ?>
    

  2. In istallation html it says:The first time you run a page it may seem slow as the thumbs are generated, subsequent loads should be fast as the thumbnailer has done its work.

     

    Are the thumbs generated for every visitor separately and stored in customer computer or the thumbs are generated only once and every next customer gets the resized images already? Or does every customer have to wait long for the first load?

     

    Somebody please answer!

  3. @@surf55

     

    I would personally use the addon found here if you havea 2.3 site. It has a supported support forum unlike this one

     

    http://addons.oscommerce.com/info/8492/v,23

     

    Ok thanks I'll look into it. But still I can't understand if I need this addon or not?

    If I install the Kissit addom do I need to upload a small thumbnail image and then all the rest product images in normal size?

     

     

    If I resize the first image before upload do I still need this contribution?

  4. There is still a big question about this addon I can't understand.

    Are the images resized when a client visits the page first time and after that chased images are used?

     

    If so then the first time the customer loads the page he/she will still have to wait until the large image is downloaded and resized?

     

    So preresizing my thumbnail image before I upload it would still be more useful then right? Since it doesn't have to be resized "on the fly", only it would be more work.

     

     

    Is that right??

×
×
  • Create New...