X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Dev Questions (https://forum.x-cart.com/forumdisplay.php?f=20)
-   -   Update Quantity(add or subtract from Quantity) (https://forum.x-cart.com/showthread.php?t=14218)

Tuner 05-26-2005 02:47 PM

Update Quantity(add or subtract from Quantity)
 
OK This mod allow you to update you quantity relative to the current quantity. Tested on 4.0.13

If you check Relative update it will add to the quantity if the number is positive and subtract if the number is negative.

Find: (provider/inv_update.php)
Code:

                while ($columns = fgetcsv ($fp, 65536, $delimiter)) {
                        if (empty($columns[0])) {
                                continue;
                        }
                        $columns[0] = addslashes($columns[0]);
                        $pid = func_query_first_cell ("SELECT productid FROM $sql_tbl[products] WHERE productcode='$columns[0]' $provider_condition");

Below this last line Add the following code:
Code:

                        if (!empty($rel)){
                        $pquan = func_query_first_cell ("SELECT avail FROM $sql_tbl[products] WHERE productcode='$columns[0]' $provider_condition");
                        $pquan = $pquan + $columns[1];
                        } else {
                        $pquan = $columns[1];
                        }


Now find (in provider/inv_update.tpl):
Code:

<TD>{$lng.lbl_csv_file}</TD>
<TD><INPUT type="file" name="userfile">


Make Look Like this:
Code:

<TD>{$lng.lbl_csv_file}</TD>
<TD><INPUT type="file" name="userfile">
<INPUT type="checkbox" name="rel">Relative Qauntity Change


Cheers

CC 05-28-2005 07:33 AM

I am not quite sure what you mean by this...

What does it do exactly?

Tuner 05-28-2005 01:00 PM

If I have a .csv file that looks like this:

Code:

MIN-98D, -1
XL-837-R, 2


And I had the Relative Quantity option enabled. When I upload the .csv with SKU and Quantity If the Quantity is a positive number "2" it will add 2 to the current Quantity and If the Quantity is a negaitve number "-1" it will subetract 1 from the current Quantity.

Currently the default inventory update just replaces the current quantity with the quantity shown in the .csv

I sell items on ebay over the phone and at our show room. I update the inventory online daily with our stores Quickbooks inventory list but our Ebay items are not removed from the Quickbooks inventory so I have a list of all Ebay items that I want to remove from the online inventory after I update it with Quickbooks inventory. I could not do this because I need to have a list subtract one from the online inventory and x-cart only lets you replace the value.

Hope this helps
Scott


All times are GMT -8. The time now is 02:46 PM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.