Jump to content
zonetown

[Contribution] QTpro - Quantity Tracking Professional

Recommended Posts

Hi, i have just got someone to install qtpro on an older snapshot of oscommerce for me.

But i am experience some problems.

 

Sometimes a product i have like 5 of instock (which i got if i look at product / stock), but for some weird reason, at first when i add the products its says the right quanity in (stock report to).

But then, it just says 0 instock in the stock report, but it still says 5 when i go to product / stock.

The reason why im bothered because of this, is as soon as it says 0 in stock report, there aint possible to buy the item, if anyone try itl take you back to "cart" after you try go to checkout, this sure is annoying since fellas sometimes try buy without actually managed todo it because of this error...

 

please try to help a fella

Edited by Lofi

Share this post


Link to post
Share on other sites

eyey, i have figured out why it happens, but i cant figure out how to fix it, so please help.

Each time i either change description on products or simply hit the update button and proceed on products.

It will put 0 on that item in stock report, but it still says the exact amount on product / stock.

So what i have todo is simply remove everything from stock again, then readd it.

So ill guess there should be a way to make it so the stock report doesnt say "0" each time ill hit the update button on a product, thanx for all the help i can get...

 

 

Fredrik

Share this post


Link to post
Share on other sites

Not sure if anyone following this topic is still interested in this. I am using the QTPro successfully but need to be able to have my product_info.php page show when items are out of stock. I have hacked a few lines of code that seems to do the trick. It is not elegent as I am somewhat of a hack. I have seen other ask for this, so I thought I would post it here. To add the changes find the following code in the product_info.php file:

$products_options = tep_db_fetch_array($products_options_query))

 

Then add the following code which will query the specific attribute that is about to be displayed in the options menu:

//START get attribute stock values
         $attribute_stock_query = tep_db_query("select products_stock_quantity from " . TABLE_PRODUCTS_STOCK . " where products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and products_stock_attributes = '" . (int)$products_options['options_id'] . "-" . (int)$products_options['options_values_id'] . "'");
         $attributes_stock = tep_db_fetch_array($attribute_stock_query);
         $option_stock = $attributes_stock['products_stock_quantity'];
//END get attribute stock values

 

Then immediatly following the above code you can do something to either add text to show the item is out of stock, or simply don't display it at all in the menu. To add an out of stock string to the options menu selection, replace the following code:

 $products_options_array[] = array('id' => $products_options['products_options_values_id'], 'text' => $products_options['products_options_values_name']);

 

With this code:

if ($option_stock == 0) {
           $products_options_array[] = array('id' => $products_options['products_options_values_id'], 'text' => 'Out of Stock - ' . $products_options['products_options_values_name']);
         } else {
           $products_options_array[] = array('id' => $products_options['products_options_values_id'], 'text' => $products_options['products_options_values_name']);
         }

 

To skip this item on the menu altogether. Just jump down a few lines in the code to the <tr> statment that does the menu item print out and conditionally skip based on the $options_stock variable like in the if statment above.

 

Warning: I have not yet rolled this into my live store, but it seems to be working on my test site. Hope it helps someone.

 

Oh yeah. I am thinking of creating a separate page that will show the status of all the stock attributes of a particular product. The link would be added to the product_info.php page and allow someone to click and see a one page view of all the available attributes, their stock status, etc... Anyone else that would use this? Or have all moved onto the Master Products contrib :)


-MichaelC

Share this post


Link to post
Share on other sites
Not sure if anyone following this topic is still interested in this.    I am using the QTPro successfully but need to be able to have my product_info.php page show when items are out of stock.  I have hacked a few lines of code that seems to do the trick.  It is not elegent as I am somewhat of a hack.    I have seen other ask for this, so I thought I would post it here.  To add the changes find the following code in the product_info.php file:

$products_options = tep_db_fetch_array($products_options_query))

 

Then add the following code which will query the specific attribute that is about to be displayed in the options menu:

//START get attribute stock values
? ? ? ? ?$attribute_stock_query = tep_db_query("select products_stock_quantity from " . TABLE_PRODUCTS_STOCK . " where products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and products_stock_attributes = '" . (int)$products_options['options_id'] . "-" . (int)$products_options['options_values_id'] . "'");
? ? ? ? ?$attributes_stock = tep_db_fetch_array($attribute_stock_query);
? ? ? ? ?$option_stock = $attributes_stock['products_stock_quantity'];
//END get attribute stock values

 

Then immediatly following the above code you can do something to either add text to show the item is out of stock, or simply don't display it at all in the menu.  To add an out of stock string to the options menu selection, replace the following code: 

 $products_options_array[] = array('id' => $products_options['products_options_values_id'], 'text' => $products_options['products_options_values_name']);

 

With this code:

if ($option_stock == 0) {
? ? ? ? ? ?$products_options_array[] = array('id' => $products_options['products_options_values_id'], 'text' => 'Out of Stock - ' . $products_options['products_options_values_name']);
? ? ? ? ?} else {
? ? ? ? ? ?$products_options_array[] = array('id' => $products_options['products_options_values_id'], 'text' => $products_options['products_options_values_name']);
? ? ? ? ?}

 

To skip this item on the menu altogether.  Just jump down a few lines in the code to the <tr> statment that does the menu item print out and conditionally skip based on the $options_stock variable like in the if statment above. 

 

Warning:  I have not yet rolled this into my live store, but it seems to be working on my test site.  Hope it helps someone.   

 

Oh yeah.  I am thinking of creating a separate page that will show the status of all the stock attributes of a particular product.    The link would  be added to the product_info.php page and allow someone to click and see a one page view of all the available attributes, their stock status, etc...    Anyone else that would use this?  Or have all moved onto the Master Products contrib :)

OK. I forgot one important step. you need to add a couple of entries to another query. In product_info.php find the following code:

while ($products_options = tep_db_fetch_array($products_options_query))

 

Just before this code, you need to add pa.options_id and pa.options_values_id to the $products_options_query = tep_db_query statment.

 

Sorry about that :(


-MichaelC

Share this post


Link to post
Share on other sites

I have installed QTPro on ms2 and everything seems to work fine. This is great except for 2 points:

 

1. Did anyone try to delete on order with restock option selected? Seems it is restocking products qty but not products_stock qty.

Has anyone tried to fix this?

 

2. Stock.php has a link to FILENAME_STATS_LOW_STOCK_ATTRIB. This seems to be an updated stock report but it is not included in the contrib files. Does anyone have this additional file?

 

Thanks :rolleyes:

Share this post


Link to post
Share on other sites

thERE IS ACONTRIBUTION low stock report v1.1extra

WHICH PRODUCES THIS REPORT

Share this post


Link to post
Share on other sites

Oh I forgot to ask the question

 

How and where do I get the STOCK REPORT ?

I have Stock.php in the admin but can't see

any new Link in the Navigation, nor remember

seeing any thing in the QTPRO NOTES version I

merged with my MS1 cart.

 

Can someone please put me in the right direction?

Share this post


Link to post
Share on other sites

I have a quick question.

I have added several mods to my store which can be seen here:

 

Sonicterror Store

 

I have installed some code that displays the quantities ie (in stock, low stock, 1 left, an sold out)

 

Can I use the contribution to my store without screwing up what i have already established? Currently the store is live and I would hate to break it by installing conflicting code.

 

thanks for your help and advice..

if you need me to post my code for any particular files just let me know.

 

Thanks!!

:lol:

Share this post


Link to post
Share on other sites

Can anyone please help with this Installation

of QTpro Notes on an MS1 Version

 

I get this error when I try to access admin/Stock.php

 

1064 - You have an error in your SQL syntax near 'and products_attributes.options_id=products_options.products_options_id and prod' at line 1

 

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 products_description, products_attributes,products_options,products_options_values where products_attributes.products_id=products_description.products_id and products_attributes.products_id= and products_attributes.options_id=products_options.products_options_id and products_attributes.options_values_id=products_options_values.products_options_v

alues_id and products_description.language_id=1 and products_options_values.language_id=1 and products_options.special=0 and products_options.language_id=1 order by products_attributes.options_id

Share this post


Link to post
Share on other sites

Hi Everyone,

A question:

 

After the QTPro Installation, I still have to declare a quantity for the product when I am adding a new product. Here is the problem:

 

Here is what I have: Product (A) Total Qty: 10

Size 1 Qty 3

Size 2 Qty 2

Size 3 Qty 4

Size 4 Qty 1

 

1. If I enter the quantity 0 in the product information page: The product can not be purchased by shoppers, and the out of stock message is displayed at the shopping cart.

 

2. If I enter any qty less than 10 in the product information page: Once that qty is reached the product is marked as out of stock, even if I still have a few left based on my stock information.

 

3. If I enter qty 10 in the product information page: All the sizes can be purchased at any quantity up to 10, despite the fact that I may only have 1 for the size 4! That mean that buyer can order qty 10 for the size 4 (availability=1).

 

This is pretty weird and defies the whole idea of the usefulness for this contribution. Any suggestion on how I can take care of this problem?

Share this post


Link to post
Share on other sites

I am trying to set up QTPro on a site that I am developing, but I am having a little trouble.

 

From admin, which I go to Categories.php I get a blank page, no error. I am still learning php, so I am not sure what is causing the problem. I can tell you that it is probably related the the shop also using ultra images and there are some overlapping modifed lines, which I have have screwed up. I am using beyond compare to to the integration, but it's still tough when changes from two mods are on the same line, and you are just learning the syntax. Here is my categories.php

 

<?php

/*

 $Id: categories.php,v 1.146 2003/07/11 14:40:27 hpdl Exp $

 

 osCommerce, Open Source E-Commerce Solutions

 http://www.oscommerce.com

 

 Copyright (c) 2003 osCommerce

 

 Amended for Attributes Inventory - FREEZEHELL - 08/11/2003 freezehell@hotmail.com

 Copyright (c) 2003 IBWO

 

 

 Released under the GNU General Public License

*/

 

 require('includes/application_top.php');

 

 require(DIR_WS_CLASSES . 'currencies.php');

 $currencies = new currencies();

 

 $action = (isset($HTTP_GET_VARS['action']) ? $HTTP_GET_VARS['action'] : '');

 

 if (tep_not_null($action)) {

   switch ($action) {

     case 'setflag':

       if ( ($HTTP_GET_VARS['flag'] == '0') || ($HTTP_GET_VARS['flag'] == '1') ) {

         if (isset($HTTP_GET_VARS['pID'])) {

           tep_set_product_status($HTTP_GET_VARS['pID'], $HTTP_GET_VARS['flag']);

         }

 

         if (USE_CACHE == 'true') {

           tep_reset_cache_block('categories');

           tep_reset_cache_block('also_purchased');

         }

       }

 

       tep_redirect(tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $HTTP_GET_VARS['cPath'] . '&pID=' . $HTTP_GET_VARS['pID']));

       break;

     case 'insert_category':

     case 'update_category':

       if (isset($HTTP_POST_VARS['categories_id'])) $categories_id = tep_db_prepare_input($HTTP_POST_VARS['categories_id']);

       $sort_order = tep_db_prepare_input($HTTP_POST_VARS['sort_order']);

 

       $sql_data_array = array('sort_order' => $sort_order);

 

       if ($action == 'insert_category') {

         $insert_sql_data = array('parent_id' => $current_category_id,

                                  'date_added' => 'now()');

 

         $sql_data_array = array_merge($sql_data_array, $insert_sql_data);

 

         tep_db_perform(TABLE_CATEGORIES, $sql_data_array);

 

         $categories_id = tep_db_insert_id();

       } elseif ($action == 'update_category') {

         $update_sql_data = array('last_modified' => 'now()');

 

         $sql_data_array = array_merge($sql_data_array, $update_sql_data);

 

         tep_db_perform(TABLE_CATEGORIES, $sql_data_array, 'update', "categories_id = '" . (int)$categories_id . "'");

       }

 

       $languages = tep_get_languages();

       for ($i=0, $n=sizeof($languages); $i<$n; $i++) {

         $categories_name_array = $HTTP_POST_VARS['categories_name'];

 

         $language_id = $languages[$i]['id'];

 

         $sql_data_array = array('categories_name' => tep_db_prepare_input($categories_name_array[$language_id]));

 

         if ($action == 'insert_category') {

           $insert_sql_data = array('categories_id' => $categories_id,

                                    'language_id' => $languages[$i]['id']);

 

           $sql_data_array = array_merge($sql_data_array, $insert_sql_data);

 

           tep_db_perform(TABLE_CATEGORIES_DESCRIPTION, $sql_data_array);

         } elseif ($action == 'update_category') {

           tep_db_perform(TABLE_CATEGORIES_DESCRIPTION, $sql_data_array, 'update', "categories_id = '" . (int)$categories_id . "' and language_id = '" . (int)$languages[$i]['id'] . "'");

         }

       }

 

       if ($categories_image = new upload('categories_image', DIR_FS_CATALOG_IMAGES)) {

         tep_db_query("update " . TABLE_CATEGORIES . " set categories_image = '" . tep_db_input($categories_image->filename) . "' where categories_id = '" . (int)$categories_id . "'");

       }

 

       if (USE_CACHE == 'true') {

         tep_reset_cache_block('categories');

         tep_reset_cache_block('also_purchased');

       }

 

       tep_redirect(tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . '&cID=' . $categories_id));

       break;

     case 'delete_category_confirm':

       if (isset($HTTP_POST_VARS['categories_id'])) {

         $categories_id = tep_db_prepare_input($HTTP_POST_VARS['categories_id']);

 

         $categories = tep_get_category_tree($categories_id, '', '0', '', true);

         $products = array();

         $products_delete = array();

 

         for ($i=0, $n=sizeof($categories); $i<$n; $i++) {

           $product_ids_query = tep_db_query("select products_id from " . TABLE_PRODUCTS_TO_CATEGORIES . " where categories_id = '" . (int)$categories[$i]['id'] . "'");

 

           while ($product_ids = tep_db_fetch_array($product_ids_query)) {

             $products[$product_ids['products_id']]['categories'][] = $categories[$i]['id'];

           }

         }

 

         reset($products);

         while (list($key, $value) = each($products)) {

           $category_ids = '';

 

           for ($i=0, $n=sizeof($value['categories']); $i<$n; $i++) {

             $category_ids .= "'" . (int)$value['categories'][$i] . "', ";

           }

           $category_ids = substr($category_ids, 0, -2);

 

           $check_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS_TO_CATEGORIES . " where products_id = '" . (int)$key . "' and categories_id not in (" . $category_ids . ")");

           $check = tep_db_fetch_array($check_query);

           if ($check['total'] < '1') {

             $products_delete[$key] = $key;

           }

         }

 

// removing categories can be a lengthy process

         tep_set_time_limit(0);

         for ($i=0, $n=sizeof($categories); $i<$n; $i++) {

           tep_remove_category($categories[$i]['id']);

         }

 

         reset($products_delete);

         while (list($key) = each($products_delete)) {

           tep_remove_product($key);

         }

       }

 

       if (USE_CACHE == 'true') {

         tep_reset_cache_block('categories');

         tep_reset_cache_block('also_purchased');

       }

 

       tep_redirect(tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath));

       break;

     case 'delete_product_confirm':

       if (isset($HTTP_POST_VARS['products_id']) && isset($HTTP_POST_VARS['product_categories']) && is_array($HTTP_POST_VARS['product_categories'])) {

         $product_id = tep_db_prepare_input($HTTP_POST_VARS['products_id']);

         $product_categories = $HTTP_POST_VARS['product_categories'];

 

         for ($i=0, $n=sizeof($product_categories); $i<$n; $i++) {

           tep_db_query("delete from " . TABLE_PRODUCTS_TO_CATEGORIES . " where products_id = '" . (int)$product_id . "' and categories_id = '" . (int)$product_categories[$i] . "'");

         }

 

         $product_categories_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS_TO_CATEGORIES . " where products_id = '" . (int)$product_id . "'");

         $product_categories = tep_db_fetch_array($product_categories_query);

 

         if ($product_categories['total'] == '0') {

           tep_remove_product($product_id);

         }

       }

 

       if (USE_CACHE == 'true') {

         tep_reset_cache_block('categories');

         tep_reset_cache_block('also_purchased');

       }

 

       tep_redirect(tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath));

       break;

     case 'move_category_confirm':

       if (isset($HTTP_POST_VARS['categories_id']) && ($HTTP_POST_VARS['categories_id'] != $HTTP_POST_VARS['move_to_category_id'])) {

         $categories_id = tep_db_prepare_input($HTTP_POST_VARS['categories_id']);

         $new_parent_id = tep_db_prepare_input($HTTP_POST_VARS['move_to_category_id']);

 

         $path = explode('_', tep_get_generated_category_path_ids($new_parent_id));

 

         if (in_array($categories_id, $path)) {

           $messageStack->add_session(ERROR_CANNOT_MOVE_CATEGORY_TO_PARENT, 'error');

 

           tep_redirect(tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . '&cID=' . $categories_id));

         } else {

           tep_db_query("update " . TABLE_CATEGORIES . " set parent_id = '" . (int)$new_parent_id . "', last_modified = now() where categories_id = '" . (int)$categories_id . "'");

 

           if (USE_CACHE == 'true') {

             tep_reset_cache_block('categories');

             tep_reset_cache_block('also_purchased');

           }

 

           tep_redirect(tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $new_parent_id . '&cID=' . $categories_id));

         }

       }

 

       break;

     case 'move_product_confirm':

       $products_id = tep_db_prepare_input($HTTP_POST_VARS['products_id']);

       $new_parent_id = tep_db_prepare_input($HTTP_POST_VARS['move_to_category_id']);

 

       $duplicate_check_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS_TO_CATEGORIES . " where products_id = '" . (int)$products_id . "' and categories_id = '" . (int)$new_parent_id . "'");

       $duplicate_check = tep_db_fetch_array($duplicate_check_query);

       if ($duplicate_check['total'] < 1) tep_db_query("update " . TABLE_PRODUCTS_TO_CATEGORIES . " set categories_id = '" . (int)$new_parent_id . "' where products_id = '" . (int)$products_id . "' and categories_id = '" . (int)$current_category_id . "'");

 

       if (USE_CACHE == 'true') {

         tep_reset_cache_block('categories');

         tep_reset_cache_block('also_purchased');

       }

 

       tep_redirect(tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $new_parent_id . '&pID=' . $products_id));

       break;

     case 'insert_product':

     case 'update_product':

       if (isset($HTTP_POST_VARS['edit_x']) || isset($HTTP_POST_VARS['edit_y'])) {

         $action = 'new_product';

       } else {

       

// BOF MaxiDVD: Modified For Ultimate Images Pack!

           $image_count_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS . " where products_image='" . $HTTP_POST_VARS['products_previous_image'] . "'");

           $image_count = tep_db_fetch_array($image_count_query);

           if (($HTTP_POST_VARS['delete_image'] == 'yes') && ($image_count['total']<= '1')) {

               unlink(DIR_FS_CATALOG_IMAGES . $HTTP_POST_VARS['products_previous_image']);

           }

           $image_med_count_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS . " where products_image_med='" . $HTTP_POST_VARS['products_previous_image_med'] . "'");

           $image_med_count = tep_db_fetch_array($image_med_count_query);

           if (($HTTP_POST_VARS['delete_image_med'] == 'yes') && ($image_med_count['total']<= '1')) {

               unlink(DIR_FS_CATALOG_IMAGES . $HTTP_POST_VARS['products_previous_image_med']);

           }

           $image_lrg_count_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS . " where products_image_lrg='" . $HTTP_POST_VARS['products_previous_image_lrg'] . "'");

           $image_lrg_count = tep_db_fetch_array($image_lrg_count_query);

           if (($HTTP_POST_VARS['delete_image_lrg'] == 'yes') && ($image_lrg_count['total']<= '1')) {

               unlink(DIR_FS_CATALOG_IMAGES . $HTTP_POST_VARS['products_previous_image_lrg']);

           }

// MaxiDVD Added ULTRA Image SM - LG 1

           $image_sm_1_count_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS . " where products_image_sm_1='" . $HTTP_POST_VARS['products_previous_image_sm_1'] . "'");

           $image_sm_1_count = tep_db_fetch_array($image_sm_1_count_query);

           if (($HTTP_POST_VARS['delete_image_sm_1'] == 'yes') && ($image_sm_1_count['total']<= '1')) {

               unlink(DIR_FS_CATALOG_IMAGES . $HTTP_POST_VARS['products_previous_image_sm_1']);

           }

           $image_xl_1_count_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS . " where products_image_xl_1='" . $HTTP_POST_VARS['products_previous_image_xl_1'] . "'");

           $image_xl_1_count = tep_db_fetch_array($image_xl_1_count_query);

           if (($HTTP_POST_VARS['delete_image_xl_1'] == 'yes') && ($image_xl_1_count['total']<= '1')) {

               unlink(DIR_FS_CATALOG_IMAGES . $HTTP_POST_VARS['products_previous_image_xl_1']);

           }

// MaxiDVD Added ULTRA Image SM - LG 2

           $image_sm_2_count_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS . " where products_image_sm_2='" . $HTTP_POST_VARS['products_previous_image_sm_2'] . "'");

           $image_sm_2_count = tep_db_fetch_array($image_sm_2_count_query);

           if (($HTTP_POST_VARS['delete_image_sm_2'] == 'yes') && ($image_sm_1_count['total']<= '1')) {

               unlink(DIR_FS_CATALOG_IMAGES . $HTTP_POST_VARS['products_previous_image_sm_2']);

           }

           $image_xl_2_count_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS . " where products_image_xl_2='" . $HTTP_POST_VARS['products_previous_image_xl_2'] . "'");

           $image_xl_2_count = tep_db_fetch_array($image_xl_2_count_query);

           if (($HTTP_POST_VARS['delete_image_xl_2'] == 'yes') && ($image_xl_1_count['total']<= '1')) {

               unlink(DIR_FS_CATALOG_IMAGES . $HTTP_POST_VARS['products_previous_image_xl_2']);

           }

// MaxiDVD Added ULTRA Image SM - LG 3

           $image_sm_3_count_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS . " where products_image_sm_3='" . $HTTP_POST_VARS['products_previous_image_sm_3'] . "'");

           $image_sm_3_count = tep_db_fetch_array($image_sm_3_count_query);

           if (($HTTP_POST_VARS['delete_image_sm_3'] == 'yes') && ($image_sm_1_count['total']<= '1')) {

               unlink(DIR_FS_CATALOG_IMAGES . $HTTP_POST_VARS['products_previous_image_sm_3']);

           }

           $image_xl_3_count_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS . " where products_image_xl_3='" . $HTTP_POST_VARS['products_previous_image_xl_3'] . "'");

           $image_xl_3_count = tep_db_fetch_array($image_xl_3_count_query);

           if (($HTTP_POST_VARS['delete_image_xl_3'] == 'yes') && ($image_xl_1_count['total']<= '1')) {

               unlink(DIR_FS_CATALOG_IMAGES . $HTTP_POST_VARS['products_previous_image_xl_3']);

           }

// MaxiDVD Added ULTRA Image SM - LG 4

           $image_sm_4_count_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS . " where products_image_sm_4='" . $HTTP_POST_VARS['products_previous_image_sm_4'] . "'");

           $image_sm_4_count = tep_db_fetch_array($image_sm_4_count_query);

           if (($HTTP_POST_VARS['delete_image_sm_4'] == 'yes') && ($image_sm_1_count['total']<= '1')) {

               unlink(DIR_FS_CATALOG_IMAGES . $HTTP_POST_VARS['products_previous_image_sm_4']);

           }

           $image_xl_4_count_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS . " where products_image_xl_4='" . $HTTP_POST_VARS['products_previous_image_xl_4'] . "'");

           $image_xl_4_count = tep_db_fetch_array($image_xl_4_count_query);

           if (($HTTP_POST_VARS['delete_image_xl_4'] == 'yes') && ($image_xl_1_count['total']<= '1')) {

               unlink(DIR_FS_CATALOG_IMAGES . $HTTP_POST_VARS['products_previous_image_xl_4']);

           }

// MaxiDVD Added ULTRA Image SM - LG 5

           $image_sm_5_count_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS . " where products_image_sm_5='" . $HTTP_POST_VARS['products_previous_image_sm_5'] . "'");

           $image_sm_5_count = tep_db_fetch_array($image_sm_5_count_query);

           if (($HTTP_POST_VARS['delete_image_sm_5'] == 'yes') && ($image_sm_1_count['total']<= '1')) {

               unlink(DIR_FS_CATALOG_IMAGES . $HTTP_POST_VARS['products_previous_image_sm_5']);

           }

           $image_xl_5_count_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS . " where products_image_xl_5='" . $HTTP_POST_VARS['products_previous_image_xl_5'] . "'");

           $image_xl_5_count = tep_db_fetch_array($image_xl_5_count_query);

           if (($HTTP_POST_VARS['delete_image_xl_5'] == 'yes') && ($image_xl_1_count['total']<= '1')) {

               unlink(DIR_FS_CATALOG_IMAGES . $HTTP_POST_VARS['products_previous_image_xl_5']);

           }

// MaxiDVD Added ULTRA Image SM - LG 6

           $image_sm_6_count_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS . " where products_image_sm_6='" . $HTTP_POST_VARS['products_previous_image_sm_6'] . "'");

           $image_sm_6_count = tep_db_fetch_array($image_sm_6_count_query);

           if (($HTTP_POST_VARS['delete_image_sm_6'] == 'yes') && ($image_sm_1_count['total']<= '1')) {

               unlink(DIR_FS_CATALOG_IMAGES . $HTTP_POST_VARS['products_previous_image_sm_6']);

           }

           $image_xl_6_count_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS . " where products_image_xl_6='" . $HTTP_POST_VARS['products_previous_image_xl_6'] . "'");

           $image_xl_6_count = tep_db_fetch_array($image_xl_6_count_query);

           if (($HTTP_POST_VARS['delete_image_xl_6'] == 'yes') && ($image_xl_1_count['total']<= '1')) {

               unlink(DIR_FS_CATALOG_IMAGES . $HTTP_POST_VARS['products_previous_image_xl_6']);

           }

// EOF: MaxiDVD Added ULTRA IMAGES

 

// EOF MaxiDVD: Modified For Ultimate Images Pack!

         if (isset($HTTP_GET_VARS['pID'])) $products_id = tep_db_prepare_input($HTTP_GET_VARS['pID']);

         $products_date_available = tep_db_prepare_input($HTTP_POST_VARS['products_date_available']);

 

         $products_date_available = (date('Y-m-d') < $products_date_available) ? $products_date_available : 'null';

 

         $sql_data_array = array('products_quantity' => tep_db_prepare_input($HTTP_POST_VARS['products_quantity']),

                                 'products_model' => tep_db_prepare_input($HTTP_POST_VARS['products_model']),

                                 'products_price' => tep_db_prepare_input($HTTP_POST_VARS['products_price']),

                                 'products_date_available' => $products_date_available,

                                 'products_weight' => tep_db_prepare_input($HTTP_POST_VARS['products_weight']),

                                 'products_status' => tep_db_prepare_input($HTTP_POST_VARS['products_status']),

                                 'products_tax_class_id' => tep_db_prepare_input($HTTP_POST_VARS['products_tax_class_id']),

                                 'manufacturers_id' => tep_db_prepare_input($HTTP_POST_VARS['manufacturers_id']));

 

// BOF MaxiDVD: Modified For Ultimate Images Pack!

      if (($HTTP_POST_VARS['unlink_image'] == 'yes') or ($HTTP_POST_VARS['delete_image'] == 'yes')) {

           $sql_data_array['products_image'] = '';

          } else {

        if (isset($HTTP_POST_VARS['products_image']) && tep_not_null($HTTP_POST_VARS['products_image']) && ($HTTP_POST_VARS['products_image'] != 'none')) {

           $sql_data_array['products_image'] = tep_db_prepare_input($HTTP_POST_VARS['products_image']);

         }

         }

      if (($HTTP_POST_VARS['unlink_image_med'] == 'yes') or ($HTTP_POST_VARS['delete_image_med'] == 'yes')) {

           $sql_data_array['products_image_med'] = '';

          } else {

         if (isset($HTTP_POST_VARS['products_image_med']) && tep_not_null($HTTP_POST_VARS['products_image_med']) && ($HTTP_POST_VARS['products_image_med'] != 'none')) {

           $sql_data_array['products_image_med'] = tep_db_prepare_input($HTTP_POST_VARS['products_image_med']);

         }

         }

      if (($HTTP_POST_VARS['unlink_image_lrg'] == 'yes') or ($HTTP_POST_VARS['delete_image_lrg'] == 'yes')) {

           $sql_data_array['products_image_lrg'] = '';

          } else {

         if (isset($HTTP_POST_VARS['products_image_lrg']) && tep_not_null($HTTP_POST_VARS['products_image_lrg']) && ($HTTP_POST_VARS['products_image_lrg'] != 'none')) {

           $sql_data_array['products_image_lrg'] = tep_db_prepare_input($HTTP_POST_VARS['products_image_lrg']);

         }

         }

      if (($HTTP_POST_VARS['unlink_image_sm_1'] == 'yes') or ($HTTP_POST_VARS['delete_image_sm_1'] == 'yes')) {

           $sql_data_array['products_image_sm_1'] = '';

          } else {

         if (isset($HTTP_POST_VARS['products_image_sm_1']) && tep_not_null($HTTP_POST_VARS['products_image_sm_1']) && ($HTTP_POST_VARS['products_image_sm_1'] != 'none')) {

           $sql_data_array['products_image_sm_1'] = tep_db_prepare_input($HTTP_POST_VARS['products_image_sm_1']);

         }

         }

      if (($HTTP_POST_VARS['unlink_image_xl_1'] == 'yes') or ($HTTP_POST_VARS['delete_image_xl_1'] == 'yes')) {

           $sql_data_array['products_image_xl_1'] = '';

          } else {

         if (isset($HTTP_POST_VARS['products_image_xl_1']) && tep_not_null($HTTP_POST_VARS['products_image_xl_1']) && ($HTTP_POST_VARS['products_image_xl_1'] != 'none')) {

           $sql_data_array['products_image_xl_1'] = tep_db_prepare_input($HTTP_POST_VARS['products_image_xl_1']);

         }

         }

      if (($HTTP_POST_VARS['unlink_image_sm_2'] == 'yes') or ($HTTP_POST_VARS['delete_image_sm_2'] == 'yes')) {

           $sql_data_array['products_image_sm_2'] = '';

          } else {

         if (isset($HTTP_POST_VARS['products_image_sm_2']) && tep_not_null($HTTP_POST_VARS['products_image_sm_2']) && ($HTTP_POST_VARS['products_image_sm_2'] != 'none')) {

           $sql_data_array['products_image_sm_2'] = tep_db_prepare_input($HTTP_POST_VARS['products_image_sm_2']);

         }

         }

      if (($HTTP_POST_VARS['unlink_image_xl_2'] == 'yes') or ($HTTP_POST_VARS['delete_image_xl_2'] == 'yes')) {

           $sql_data_array['products_image_xl_2'] = '';

          } else {

         if (isset($HTTP_POST_VARS['products_image_xl_2']) && tep_not_null($HTTP_POST_VARS['products_image_xl_2']) && ($HTTP_POST_VARS['products_image_xl_2'] != 'none')) {

           $sql_data_array['products_image_xl_2'] = tep_db_prepare_input($HTTP_POST_VARS['products_image_xl_2']);

         }

         }

      if (($HTTP_POST_VARS['unlink_image_sm_3'] == 'yes') or ($HTTP_POST_VARS['delete_image_sm_3'] == 'yes')) {

           $sql_data_array['products_image_sm_3'] = '';

          } else {

         if (isset($HTTP_POST_VARS['products_image_sm_3']) && tep_not_null($HTTP_POST_VARS['products_image_sm_3']) && ($HTTP_POST_VARS['products_image_sm_3'] != 'none')) {

           $sql_data_array['products_image_sm_3'] = tep_db_prepare_input($HTTP_POST_VARS['products_image_sm_3']);

         }

         }

      if (($HTTP_POST_VARS['unlink_image_xl_3'] == 'yes') or ($HTTP_POST_VARS['delete_image_xl_3'] == 'yes')) {

           $sql_data_array['products_image_xl_3'] = '';

          } else {

         if (isset($HTTP_POST_VARS['products_image_xl_3']) && tep_not_null($HTTP_POST_VARS['products_image_xl_3']) && ($HTTP_POST_VARS['products_image_xl_3'] != 'none')) {

           $sql_data_array['products_image_xl_3'] = tep_db_prepare_input($HTTP_POST_VARS['products_image_xl_3']);

         }

         }

      if (($HTTP_POST_VARS['unlink_image_sm_4'] == 'yes') or ($HTTP_POST_VARS['delete_image_sm_4'] == 'yes')) {

           $sql_data_array['products_image_sm_4'] = '';

          } else {

         if (isset($HTTP_POST_VARS['products_image_sm_4']) && tep_not_null($HTTP_POST_VARS['products_image_sm_4']) && ($HTTP_POST_VARS['products_image_sm_4'] != 'none')) {

           $sql_data_array['products_image_sm_4'] = tep_db_prepare_input($HTTP_POST_VARS['products_image_sm_4']);

         }

         }

      if (($HTTP_POST_VARS['unlink_image_xl_4'] == 'yes') or ($HTTP_POST_VARS['delete_image_xl_4'] == 'yes')) {

           $sql_data_array['products_image_xl_4'] = '';

          } else {

         if (isset($HTTP_POST_VARS['products_image_xl_4']) && tep_not_null($HTTP_POST_VARS['products_image_xl_4']) && ($HTTP_POST_VARS['products_image_xl_4'] != 'none')) {

           $sql_data_array['products_image_xl_4'] = tep_db_prepare_input($HTTP_POST_VARS['products_image_xl_4']);

         }

         }

      if (($HTTP_POST_VARS['unlink_image_sm_5'] == 'yes') or ($HTTP_POST_VARS['delete_image_sm_5'] == 'yes')) {

           $sql_data_array['products_image_sm_5'] = '';

          } else {

         if (isset($HTTP_POST_VARS['products_image_sm_5']) && tep_not_null($HTTP_POST_VARS['products_image_sm_5']) && ($HTTP_POST_VARS['products_image_sm_5'] != 'none')) {

           $sql_data_array['products_image_sm_5'] = tep_db_prepare_input($HTTP_POST_VARS['products_image_sm_5']);

         }

         }

      if (($HTTP_POST_VARS['unlink_image_xl_5'] == 'yes') or ($HTTP_POST_VARS['delete_image_xl_5'] == 'yes')) {

           $sql_data_array['products_image_xl_5'] = '';

          } else {

         if (isset($HTTP_POST_VARS['products_image_xl_5']) && tep_not_null($HTTP_POST_VARS['products_image_xl_5']) && ($HTTP_POST_VARS['products_image_xl_5'] != 'none')) {

           $sql_data_array['products_image_xl_5'] = tep_db_prepare_input($HTTP_POST_VARS['products_image_xl_5']);

         }

         }

      if (($HTTP_POST_VARS['unlink_image_sm_6'] == 'yes') or ($HTTP_POST_VARS['delete_image_sm_6'] == 'yes')) {

           $sql_data_array['products_image_sm_6'] = '';

          } else {

         if (isset($HTTP_POST_VARS['products_image_sm_6']) && tep_not_null($HTTP_POST_VARS['products_image_sm_6']) && ($HTTP_POST_VARS['products_image_sm_6'] != 'none')) {

           $sql_data_array['products_image_sm_6'] = tep_db_prepare_input($HTTP_POST_VARS['products_image_sm_6']);

         }

         }

      if (($HTTP_POST_VARS['unlink_image_xl_6'] == 'yes') or ($HTTP_POST_VARS['delete_image_xl_6'] == 'yes')) {

           $sql_data_array['products_image_xl_6'] = '';

          } else {

         if (isset($HTTP_POST_VARS['products_image_xl_6']) && tep_not_null($HTTP_POST_VARS['products_image_xl_6']) && ($HTTP_POST_VARS['products_image_xl_6'] != 'none')) {

           $sql_data_array['products_image_xl_6'] = tep_db_prepare_input($HTTP_POST_VARS['products_image_xl_6']);

         }

         }

// EOF MaxiDVD: Modified For Ultimate Images Pack!

 

         if ($action == 'insert_product') {

           $insert_sql_data = array('products_date_added' => 'now()');

 

           $sql_data_array = array_merge($sql_data_array, $insert_sql_data);

 

           tep_db_perform(TABLE_PRODUCTS, $sql_data_array);

           $products_id = tep_db_insert_id();

 

           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') {

           $update_sql_data = array('products_last_modified' => 'now()');

 

           $sql_data_array = array_merge($sql_data_array, $update_sql_data);

 

           tep_db_perform(TABLE_PRODUCTS, $sql_data_array, 'update', "products_id = '" . (int)$products_id . "'");

         }

 

         $languages = tep_get_languages();

         for ($i=0, $n=sizeof($languages); $i<$n; $i++) {

           $language_id = $languages[$i]['id'];

 

           $sql_data_array = array('products_name' => tep_db_prepare_input($HTTP_POST_VARS['products_name'][$language_id]),

                                   'products_description' => tep_db_prepare_input($HTTP_POST_VARS['products_description'][$language_id]),

                                   'products_url' => tep_db_prepare_input($HTTP_POST_VARS['products_url'][$language_id]));

 

           if ($action == 'insert_product') {

             $insert_sql_data = array('products_id' => $products_id,

                                      'language_id' => $language_id);

 

             $sql_data_array = array_merge($sql_data_array, $insert_sql_data);

 

             tep_db_perform(TABLE_PRODUCTS_DESCRIPTION, $sql_data_array);

           } elseif ($action == 'update_product') {

             tep_db_perform(TABLE_PRODUCTS_DESCRIPTION, $sql_data_array, 'update', "products_id = '" . (int)$products_id . "' and language_id = '" . (int)$language_id . "'");

           }

         }

 

         if (USE_CACHE == 'true') {

           tep_reset_cache_block('categories');

           tep_reset_cache_block('also_purchased');

         }

 

         tep_redirect(tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . '&pID=' . $products_id));

       }

       break;

     case 'copy_to_confirm':

       if (isset($HTTP_POST_VARS['products_id']) && isset($HTTP_POST_VARS['categories_id'])) {

         $products_id = tep_db_prepare_input($HTTP_POST_VARS['products_id']);

         $categories_id = tep_db_prepare_input($HTTP_POST_VARS['categories_id']);

 

         if ($HTTP_POST_VARS['copy_as'] == 'link') {

           if ($categories_id != $current_category_id) {

             $check_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS_TO_CATEGORIES . " where products_id = '" . (int)$products_id . "' and categories_id = '" . (int)$categories_id . "'");

             $check = tep_db_fetch_array($check_query);

             if ($check['total'] < '1') {

               tep_db_query("insert into " . TABLE_PRODUCTS_TO_CATEGORIES . " (products_id, categories_id) values ('" . (int)$products_id . "', '" . (int)$categories_id . "')");

             }

           } else {

             $messageStack->add_session(ERROR_CANNOT_LINK_TO_SAME_CATEGORY, 'error');

           }

         } elseif ($HTTP_POST_VARS['copy_as'] == 'duplicate') {

// BOF MaxiDVD: Modified For Ultimate Images Pack!

           $product_query = tep_db_query("select products_quantity, products_model, products_image, products_image_med, products_image_lrg, products_image_sm_1, products_image_xl_1, products_image_sm_2, products_image_xl_2, products_image_sm_3, products_image_xl_3, products_image_sm_4, products_image_xl_4, products_image_sm_5, products_image_xl_5, products_image_sm_6, products_image_xl_6, products_price, products_date_available, products_weight, products_tax_class_id, manufacturers_id from " . TABLE_PRODUCTS . " where products_id = '" . (int)$products_id . "'");

           $product = tep_db_fetch_array($product_query);

           tep_db_query("insert into " . TABLE_PRODUCTS . " (products_quantity, products_model, products_image, products_image_med, products_image_lrg, products_image_sm_1, products_image_xl_1, products_image_sm_2, products_image_xl_2, products_image_sm_3, products_image_xl_3, products_image_sm_4, products_image_xl_4, products_image_sm_5, products_image_xl_5, products_image_sm_6, products_image_xl_6, products_price, products_date_added, products_date_available, products_weight, products_status, products_tax_class_id, manufacturers_id) values ('" . tep_db_input($product['products_quantity']) . "', '" . tep_db_input($product['products_model']) . "', '" . tep_db_input($product['products_image']) . "', '" . tep_db_input($product['products_image_med']) . "', '" . tep_db_input($product['products_image_lrg']) . "', '" . tep_db_input($product['products_image_sm_1']) . "', '" . tep_db_input($product['products_image_xl_1']) . "', '" . tep_db_input($product['products_image_sm_2']) . "',

      '" . tep_db_input($product['products_image_xl_2']) . "', '" . tep_db_input($product['products_image_sm_3']) . "', '" . tep_db_input($product['products_image_xl_3']) . "', '" . tep_db_input($product['products_image_sm_4']) . "', '" . tep_db_input($product['products_image_xl_4']) . "', '" . tep_db_input($product['products_image_sm_5']) . "', '" . tep_db_input($product['products_image_xl_5']) . "', '" . tep_db_input($product['products_image_sm_6']) . "', '" . tep_db_input($product['products_image_xl_6']) . "', '" . tep_db_input($product['products_price']) . "',  now(), '" . tep_db_input($product['products_date_available']) . "', '" . tep_db_input($product['products_weight']) . "', '0', '" . (int)$product['products_tax_class_id'] . "', '" . (int)$product['manufacturers_id'] . "')");

// BOF MaxiDVD: Modified For Ultimate Images Pack!

           $dup_products_id = tep_db_insert_id();

 

           $description_query = tep_db_query("select language_id, products_name, products_description, products_url from " . TABLE_PRODUCTS_DESCRIPTION . " where products_id = '" . (int)$products_id . "'");

           while ($description = tep_db_fetch_array($description_query)) {

             tep_db_query("insert into " . TABLE_PRODUCTS_DESCRIPTION . " (products_id, language_id, products_name, products_description, products_url, products_viewed) values ('" . (int)$dup_products_id . "', '" . (int)$description['language_id'] . "', '" . tep_db_input($description['products_name']) . "', '" . tep_db_input($description['products_description']) . "', '" . tep_db_input($description['products_url']) . "', '0')");

           }

 

           tep_db_query("insert into " . TABLE_PRODUCTS_TO_CATEGORIES . " (products_id, categories_id) values ('" . (int)$dup_products_id . "', '" . (int)$categories_id . "')");

           $products_id = $dup_products_id;

         }

 

         if (USE_CACHE == 'true') {

           tep_reset_cache_block('categories');

           tep_reset_cache_block('also_purchased');

         }

       }

 

       tep_redirect(tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $categories_id . '&pID=' . $products_id));

       break;

       

// BOF MaxiDVD: Modified For Ultimate Images Pack!

     case 'new_product_preview':

// copy image only if modified

  if (($HTTP_POST_VARS['unlink_image'] == 'yes') or ($HTTP_POST_VARS['delete_image'] == 'yes')) {

       $products_image = '';

       $products_image_name = '';

       } else {

       $products_image = new upload('products_image');

       $products_image->set_destination(DIR_FS_CATALOG_IMAGES);

       if ($products_image->parse() && $products_image->save()) {

         $products_image_name = $products_image->filename;

       } else {

         $products_image_name = (isset($HTTP_POST_VARS['products_previous_image']) ? $HTTP_POST_VARS['products_previous_image'] : '');

       }

       }

  if (($HTTP_POST_VARS['unlink_image_med'] == 'yes') or ($HTTP_POST_VARS['delete_image_med'] == 'yes')) {

       $products_image_med = '';

      $products_image_med_name = '';

       } else {

       $products_image_med = new upload('products_image_med');

       $products_image_med->set_destination(DIR_FS_CATALOG_IMAGES);

       if ($products_image_med->parse() && $products_image_med->save()) {

         $products_image_med_name = $products_image_med->filename;

       } else {

         $products_image_med_name = (isset($HTTP_POST_VARS['products_previous_image_med']) ? $HTTP_POST_VARS['products_previous_image_med'] : '');

       }

       }

  if (($HTTP_POST_VARS['unlink_image_lrg'] == 'yes') or ($HTTP_POST_VARS['delete_image_lrg'] == 'yes')) {

       $products_image_lrg = '';

       $products_image_lrg_name = '';

       } else {

       $products_image_lrg = new upload('products_image_lrg');

       $products_image_lrg->set_destination(DIR_FS_CATALOG_IMAGES);

       if ($products_image_lrg->parse() && $products_image_lrg->save()) {

         $products_image_lrg_name = $products_image_lrg->filename;

       } else {

         $pro

Share this post


Link to post
Share on other sites

I have QTPro installed and it works fine. However, I had to add a field to the products_stock table called prod_mod_id . This is a model id for the option selected which we still use on our old system. How can I get the value of the prod_mod_id to be stored when the customer makes an order?

Share this post


Link to post
Share on other sites

Where in the code does the information from the products_stock table get stored into the orders_products_attributes table? I have added a field to the products_stock table and want that information to be stored into the orders_products_attributes table as well. I just can not find where this happens.

Share this post


Link to post
Share on other sites

I added QTPro to my site and it is working beautifully (asside from some lack of documentation).

 

My only problem is after multiple comparisons and digging through the files I still cannot find why my stock is not diminishing when its being purchased. What file/page in QTPro has the step for removing the purchased item from the stock?

 

Any help would be greatly appreciated.

Share this post


Link to post
Share on other sites

rystan:

 

You should have made some changes to the checkout_process.php file. In that file search for the string products_stock_attributes_array.

 

This will get you into the section of code that actually updates the stock. The actual begining of the qtpro section starts with the following if statment:

if (is_array($products_attributes)) {

 

Within this code block are the actual sql "update" calls that insert the new quantity back into the products_table.

 

Hope that helps get you in right area for debugging..


-MichaelC

Share this post


Link to post
Share on other sites
A question:

 

After the QTPro Installation, I still have to declare a quantity for the product when I am adding a new product. Here is the problem:

 

Here is what I have: Product (A) Total Qty: 10

Size 1 Qty 3

Size 2 Qty 2

Size 3 Qty 4

Size 4 Qty 1

 

1. If I enter the quantity 0 in the product information page: The product can not be purchased by shoppers, and the out of stock message is displayed at the shopping cart.

 

2. If I enter any qty less than 10 in the product information page: Once that qty is reached the product is marked as out of stock, even if I still have a few left based on my stock information.

 

3. If I enter qty 10 in the product information page: All the sizes can be purchased at any quantity up to 10, despite the fact that I may only have 1 for the size 4! That mean that buyer can order qty 10 for the size 4 (availability=1).

 

This is pretty weird and defies the whole idea of the usefulness for this contribution. Any suggestion on how I can take care of this problem?

I'm having these problems as well. Does anyone have this working where the inventory is being deducted like it is supposed to? :blink:

 

 

Somebody please HELP!

 

Lisa

Share this post


Link to post
Share on other sites

Hmm. Thanks for the reply!

 

I've gone through that section with a fine tooth comb. It matches the file that came with QTPro perfectly. I have a few other addons or I would not bother with file comparison and just replaced the file :)

 

the section in question is

if (is_array($products_attributes)) {
         $stock_query_raw .= " AND pa.options_id = '" . $products_attributes[0]['option_id'] . "' AND pa.options_values_id = '" . $products_attributes[0]['value_id'] . "'";
       }
       $stock_query = tep_db_query($stock_query_raw);
     } else {
       if (is_array($products_attributes)) {
   $products_stock_attributes_array = array();
        For($k=0, $n3=sizeof($products_attributes); $k<$n3; $k++){
         if ($products_attributes[$k]['special'] == 0) {
         $products_stock_attributes_array[] = $products_attributes[$k]['option_id']."-".$products_attributes[$k]['value_id'];
         }
        }
         asort($products_stock_attributes_array);
         reset($products_stock_attributes_array); 
  $products_stock_attributes=implode(",",$products_stock_attributes_array);
       $attributes_stock_query = tep_db_query("select products_stock_quantity from " . TABLE_PRODUCTS_STOCK . " where products_stock_attributes = '$products_stock_attributes' AND products_id = '" . tep_get_prid($order->products[$i]['id']) . "'");
if (tep_db_num_rows($attributes_stock_query) > 0) {
        $attributes_stock_values = tep_db_fetch_array($attributes_stock_query);
        $attributes_stock_left = $attributes_stock_values['products_stock_quantity'] - $order->products[$i]['qty'];
        if ($attributes_stock_left < 1) {
          tep_db_query("update " . TABLE_PRODUCTS_STOCK . " set products_stock_quantity = '0' where products_stock_attributes = '$products_stock_attributes' AND products_id = '" . tep_get_prid($order->products[$i]['id']) . "'");
          $actual_stock_bought = $attributes_stock_values['products_stock_quantity'];
         }else{
          tep_db_query("update " . TABLE_PRODUCTS_STOCK . " set products_stock_quantity = '" . $attributes_stock_left . "' where products_stock_attributes = '$products_stock_attributes' AND products_id = '" . tep_get_prid($order->products[$i]['id']) . "'");
          $actual_stock_bought = $order->products[$i]['qty'];
         }
      }else{
 $actual_stock_bought = $order->products[$i]['qty'];
 }
      }else{
 $actual_stock_bought = $order->products[$i]['qty'];
 }
       $stock_query = tep_db_query("select products_quantity from " . TABLE_PRODUCTS . " where products_id = '" . tep_get_prid($order->products[$i]['id']) . "'");
     }

 

What is confusing me is that it as is, makes sense to my less then expert eyes and rereading it over and over again is just going to give me eye strain. I've even checked the DB tables and they are showing the same info.

Share this post


Link to post
Share on other sites
A question:

 

After the QTPro Installation, I still have to declare a quantity for the product when I am adding a new product. Here is the problem:

 

Here is what I have: Product (A) Total       Qty: 10

                                              Size 1      Qty 3

                                              Size 2      Qty  2

                                              Size 3      Qty  4

                                              Size 4      Qty  1

 

1. If I enter the quantity 0 in the product information page: The product can not be purchased by shoppers, and the out of stock message is displayed at the shopping cart.

 

2. If I enter any qty less than 10 in the product information page: Once that qty is reached the product is marked as out of stock, even if I still have a few left based on my stock information.

 

3. If I enter qty 10 in the product  information page: All the sizes can be purchased at any quantity up to 10, despite the fact that I may only have 1 for the size 4! That mean that buyer can order qty 10 for the size 4 (availability=1).

 

This is pretty weird and defies the whole idea of the usefulness for this contribution. Any suggestion on how I can take care of this problem?

I'm having these problems as well. Does anyone have this working where the inventory is being deducted like it is supposed to? :blink:

 

 

Somebody please HELP!

 

Lisa

Well. It is working fine for me. I have never modified the quantity in the product detail page. As a matter of fact. When adding a new product, I don't set the quantity to any value. Then I only modify the quantity using the stock button (stock.php).

 

I know this is probably of no real help, but at least you know it is working for someone else.


-MichaelC

Share this post


Link to post
Share on other sites
Hmm.  Thanks for the reply!

 

I've gone through that section with a fine tooth comb.  It matches the file that came with QTPro perfectly.  I have a few other addons or I would not bother with file comparison and just replaced the file :)

 

the section in question is

if (is_array($products_attributes)) {
? ? ? ? ?$stock_query_raw .= " AND pa.options_id = '" . $products_attributes[0]['option_id'] . "' AND pa.options_values_id = '" . $products_attributes[0]['value_id'] . "'";
? ? ? ?}
? ? ? ?$stock_query = tep_db_query($stock_query_raw);
? ? ?} else {
? ? ? ?if (is_array($products_attributes)) {
? ?$products_stock_attributes_array = array();
? ? ? ? For($k=0, $n3=sizeof($products_attributes); $k<$n3; $k++){
? ? ? ? ?if ($products_attributes[$k]['special'] == 0) {
? ? ? ? ?$products_stock_attributes_array[] = $products_attributes[$k]['option_id']."-".$products_attributes[$k]['value_id'];
? ? ? ? ?}
? ? ? ? }
? ? ? ? ?asort($products_stock_attributes_array);
? ? ? ? ?reset($products_stock_attributes_array); 
? $products_stock_attributes=implode(",",$products_stock_attributes_array);
? ? ? ?$attributes_stock_query = tep_db_query("select products_stock_quantity from " . TABLE_PRODUCTS_STOCK . " where products_stock_attributes = '$products_stock_attributes' AND products_id = '" . tep_get_prid($order->products[$i]['id']) . "'");
if (tep_db_num_rows($attributes_stock_query) > 0) {
? ? ? ? $attributes_stock_values = tep_db_fetch_array($attributes_stock_query);
? ? ? ? $attributes_stock_left = $attributes_stock_values['products_stock_quantity'] - $order->products[$i]['qty'];
? ? ? ? if ($attributes_stock_left < 1) {
? ? ? ? ? tep_db_query("update " . TABLE_PRODUCTS_STOCK . " set products_stock_quantity = '0' where products_stock_attributes = '$products_stock_attributes' AND products_id = '" . tep_get_prid($order->products[$i]['id']) . "'");
? ? ? ? ? $actual_stock_bought = $attributes_stock_values['products_stock_quantity'];
? ? ? ? ?}else{
? ? ? ? ? tep_db_query("update " . TABLE_PRODUCTS_STOCK . " set products_stock_quantity = '" . $attributes_stock_left . "' where products_stock_attributes = '$products_stock_attributes' AND products_id = '" . tep_get_prid($order->products[$i]['id']) . "'");
? ? ? ? ? $actual_stock_bought = $order->products[$i]['qty'];
? ? ? ? ?}
? ? ? }else{
?$actual_stock_bought = $order->products[$i]['qty'];
?}
? ? ? }else{
?$actual_stock_bought = $order->products[$i]['qty'];
?}
? ? ? ?$stock_query = tep_db_query("select products_quantity from " . TABLE_PRODUCTS . " where products_id = '" . tep_get_prid($order->products[$i]['id']) . "'");
? ? ?}

 

What is confusing me is that it as is, makes sense to my less then expert eyes and rereading it over and over again is just going to give me eye strain.  I've even checked the DB tables and they are showing the same info.

If that is your actual code. There is a problem with the second line.

$stock_query_raw .= " AND pa.options_id = '" . $products_attributes[0]['option_id'] . "' AND

 

The element in $products_attributes[] should be set to $i instead of 0.


-MichaelC

Share this post


Link to post
Share on other sites

Woohoo!

 

thanks for the reply. I actually had 2 problems. 1 was exactly what you mentioned, the 2nd, after rereading the code, i found that it didn't remove stock if it was a downloadable one.. which.. for some stupid reason, i had downloading enabled.. which totaly jimmied the works.

 

Thank you, i can now sleep with some measure of peace.

 

Ryan

Share this post


Link to post
Share on other sites

Hi All,

 

I'm currently messing around with Oscommerce and this specific mod to determine if this solution will suit the needs of my client or spend the time to add on to an ecommerce engine we wrote ourselves.

 

I am leaning towards oscommerce, but it's dependant on the Inventory/Stock Management capabilities of this mod.

 

In my playing around. I have bene able to set up a free attributes of colour and size.

 

I have assigned thse attributes to a product but here's my problem thus far:

 

1) When I am assigning a colour/size attrbitue... I have to do it one at a time. So for example:

 

- I set one attribute (say colour blue).

- I set another attribute (say size Small)

- I set another attribute (say colour Red)

- I set another attribute (say size Large)

 

NO where is it possible for me to set BOTH attributes at the same time?

 

Reason why this is a problem... a potential customer upon selecting this product.. COULD select the Blue shirt and the size Large.... but what if I don't carry a Blue shirt in a large size?

 

The customer can make-up any combinations possible even if they are not really available to order.

 

Please tell me I am wrong about this and there's another way to get this to work correctly?

 

Thanks for your help!!!

 

Aaron

Share this post


Link to post
Share on other sites

Master Products sounds closer to what you need. Since each Sized blue shirt is a different set of stock items, Master Products would allow you to set inventory on Large Blue Shirts and Small Pink ones each with different stock numbers and qty.

 

Here is where you'll find the module in question:

 

http://www.oscommerce.com/community/contributions,1681

 

Good luck.

Share this post


Link to post
Share on other sites
A question:

 

After the QTPro Installation, I still have to declare a quantity for the product when I am adding a new product. Here is the problem:

 

Here is what I have: Product (A) Total       Qty: 10

                                              Size 1      Qty 3

                                              Size 2      Qty  2

                                              Size 3      Qty  4

                                              Size 4      Qty  1

 

1. If I enter the quantity 0 in the product information page: The product can not be purchased by shoppers, and the out of stock message is displayed at the shopping cart.

 

2. If I enter any qty less than 10 in the product information page: Once that qty is reached the product is marked as out of stock, even if I still have a few left based on my stock information.

 

3. If I enter qty 10 in the product  information page: All the sizes can be purchased at any quantity up to 10, despite the fact that I may only have 1 for the size 4! That mean that buyer can order qty 10 for the size 4 (availability=1).

 

This is pretty weird and defies the whole idea of the usefulness for this contribution. Any suggestion on how I can take care of this problem?

I'm having these problems as well. Does anyone have this working where the inventory is being deducted like it is supposed to? :blink:

 

 

Somebody please HELP!

 

Lisa

coffman is right.

 

Don't modify the quantity on the product page. When you create a product leave the product quantity to 0. To fix a current product, just zero the product out then adjust the attributes stock level.

 

Hit the stock button and add your quantities for each size.

 

Size 1 Qty 3

Size 2 Qty 2

Size 3 Qty 4

Size 4 Qty 1

 

Afterward you should see the product quantity is now 10. If someone purchases one Size1 it will decrement both the Size1 quantity down to 2 and the total product quantity down to 9.

 

Make sure your subtract stock is set to true and lower your stock re-order level if you keep low inventory on some items.


while (!succeed) {try()};

 

GMT -6:00

Share this post


Link to post
Share on other sites
coffman is right.

 

Don't modify the quantity on the product page. When you create a product leave the product quantity to 0. To fix a current product, just zero the product out then adjust the attributes stock level.

 

Hit the stock button and add your quantities for each size.

 

Size 1      Qty  3

Size 2      Qty  2

Size 3      Qty  4

Size 4      Qty  1

 

Afterward you should see the product quantity is now 10. If someone purchases one Size1 it will decrement both the Size1 quantity down to 2 and the total product quantity down to 9.

 

Make sure your subtract stock is set to true and lower your stock re-order level if you keep low inventory on some items.

 

Hi Guys,

The problem here is that since after you enter the available stock qty using the QTPro, the quantity on the product information page sets to the total stock for all the available options (total=10), the buyer can order up to 10 for any of the available sizes. Here is how it works:

 

I set the stock quantities for a particular product as you mentioned in your example:

 

Size 1 Qty 3

Size 2 Qty 2

Size 3 Qty 4

Size 4 Qty 1

=====

Total Qty 10

 

(NOTE: I do not add any qty using the product page)

 

However, my clients can order quantity 10 of any of these sizes. That means they can put Qty 10 for Size 1 or Qty 6 for size 4 and qty 4 for size 2 (total 10) in their shopping basket and successfuly checkout, which defeats the whole purpose of the contribution.

 

You may want to give it a try and see if that is not going to happen in your case, but my QTPro behaves just like that.

 

Scotty

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×