Zen Cart Logo
Forums / All Other Contributions/Addons / Easy Populate 1.2.5.7 - add to products_quantity, not overwrite

Easy Populate 1.2.5.7 - add to products_quantity, not overwrite

Views: 1,184

Results 1 to 10 of 10
26 Apr 2012, 8:08 PM
#1
sbbemn avatar

sbbemn

Zen Follower

Join Date:
Jan 2010
Posts:
182
Plugin Contributions:
0

Easy Populate 1.2.5.7 - add to products_quantity, not overwrite

Hello,

So easy enough I'd like to have two columns to upload in EP.

  1. v_products_id
  2. v_products_quantity

This us what was received and will add to current stock.

At my line 1561 a query selects the current contents...

    $sql = "SELECT
        p.products_quantity as v_products_quantity,

I see in my line 1980 this...

$query = "UPDATE " . TABLE_PRODUCTS . " SET
products_quantity = '" . zen_db_input($v_products_quantity) . "' ,

When updating, using + to SUM together, how do I parse the current qty and the incoming quantity?

Or is it simply '" . zen_db_input($v_products_quantity + products_quantity) . "'

28 Apr 2012, 5:34 PM
#2
webmart avatar

webmart

New Zenner

Join Date:
Nov 2011
Posts:
34
Plugin Contributions:
0

Re: Easy Populate 1.2.5.7 - add to products_quantity, not overwrite

I'm need to add an option for read the html content on external txt file for create product description, something like this:

$desc_ext = 'http://www.siteweb.com/test_to_copy.txt';

$content = file_get_contents($desc_ext);
if ($content !== false) {
$v_products_description[$l_id] = $content;
} else {
$v_products_description[$l_id] = 'No description';
}

but $v_products_description result always as "No description".

If i try to include the text directly in:

includes/templates/mytemplate/templates/tpl_product_info_display.php:

<!--bof Product description --> <?php echo file_get_contents('http://www.siteweb.com/test_to_copy.txt'); etc... it work but i need to read string on my sql db of course. Any help?
30 Apr 2012, 2:39 PM
#3
sbbemn avatar

sbbemn

Zen Follower

Join Date:
Jan 2010
Posts:
182
Plugin Contributions:
0

Re: Easy Populate 1.2.5.7 - add to products_quantity, not overwrite

hmmm threadjacking?

To summarize my first post, my goal is to ADD to current qty, not overwrite with Easy Populate.

Is it this?......

$query = "UPDATE " . TABLE_PRODUCTS . " SET
products_quantity = '" . zen_db_input($v_products_quantity + products_quantity) . "' ,
30 Apr 2012, 2:49 PM
#4
schoolboy avatar

schoolboy

Totally Zenned

Join Date:
Jun 2005
Location:
Cumbria, UK
Posts:
10,327
Plugin Contributions:
0

Re: Easy Populate 1.2.5.7 - add to products_quantity, not overwrite

If you want to add a value to the current value (eg: 6 currently in stock, PLUS 2 = 8 in stock)

Then the following should work, run through Install SQL Patches under your tools menu:

UPDATE products SET products_quantity = (products_quantity + 2);

This will take the EXISTING quantity of ALL products and add TWO more to it.

To constrain the calculation, you can use WHERE statements:

UPDATE products SET products_quantity = (products_quantity + 2) WHERE products_id = 1322;

... will apply the calculation ONLY to the product with the ID 1322.

30 Apr 2012, 3:46 PM
#5
sbbemn avatar

sbbemn

Zen Follower

Join Date:
Jan 2010
Posts:
182
Plugin Contributions:
0

Re: Easy Populate 1.2.5.7 - add to products_quantity, not overwrite

Thanks schoolboy,

That's a very useful tool for global qty updating (or per product id).

I would like to apply dozens of different quantities to dozens of products as a CSV upload.

Right now, I download from EP to get current qty and custom fields for order quantities and reorder levels. I would then save a CSV with products_id and products_qty columns. The product arrives (say 146 items with different quantities) and then I can upload in one shot the product received with the CSV. As it stands, we manually update each individual item at the product pages.

I'm sure other companies are not doing this archaic and laborious way of receiving inventory.

30 Apr 2012, 3:57 PM
#6
schoolboy avatar

schoolboy

Totally Zenned

Join Date:
Jun 2005
Location:
Cumbria, UK
Posts:
10,327
Plugin Contributions:
0

Re: Easy Populate 1.2.5.7 - add to products_quantity, not overwrite

EP 1,2,5,7 is not a reliable version.

Depending on what ZC version you are using, you should be useing EP1.2.5.4 (ZC 1.3.9), or EP4 (ZC 1.5).

And yes... updating product quantity is easy with EP.

Recently, we have been using APSONA SHOPADMIN, which we believe to be better and more reliable.

I have a WIKI ARTICLE on Easy Populate 1,2,5,4
http://www.zen-cart.com/wiki/index.php/Easy_Populate

30 Apr 2012, 4:43 PM
#7
sbbemn avatar

sbbemn

Zen Follower

Join Date:
Jan 2010
Posts:
182
Plugin Contributions:
0

Re: Easy Populate 1.2.5.7 - add to products_quantity, not overwrite

1.3.8a
During the initial post with this new site layout, there was a drop down selection for ZC version - thought that appeared somewhere on the post.

I recently added Apsona as well, though I inquired about adding product qty to existing. They said it is not available. They suggested downloading that manufacturer's products and manually changing all the quantities.

Well, with 1,200 products from one of our companies, 300 may come in. So manually filtering though 1,200 items, updating 300 manually then uploading back up is not real-time. Could take 15 minutes - meanwhile 5 products may have been purchased since then and quantities changed on you.

30 Apr 2012, 6:21 PM
#8
schoolboy avatar

schoolboy

Totally Zenned

Join Date:
Jun 2005
Location:
Cumbria, UK
Posts:
10,327
Plugin Contributions:
0

Re: Easy Populate 1.2.5.7 - add to products_quantity, not overwrite

sbbemn:

1.3.8a

Before you worry about how you are going to change product quantities, UPGRADE the Zc software.

This version is very vulnerable. If you get hacked (strong possibility) then you will have a LOT more to worry about than how many products you have in stock.

If you have a lot of add-ons, then AT LEAST upgrade to 1.3.9h, and do it tonight.

30 Apr 2012, 6:30 PM
#9
sbbemn avatar

sbbemn

Zen Follower

Join Date:
Jan 2010
Posts:
182
Plugin Contributions:
0

Re: Easy Populate 1.2.5.7 - add to products_quantity, not overwrite

schoolboy:

Before you worry about how you are going to change product quantities, UPGRADE the Zc software.

This version is very vulnerable. If you get hacked (strong possibility) then you will have a LOT more to worry about than how many products you have in stock.

If you have a lot of add-ons, then AT LEAST upgrade to 1.3.9h, and do it tonight.

We've been sweating over this for a while. We have way too many new and existing customized pages to the point where we feel too overwhelmed to upgrade. Would take a LOT of merging, which at this point is the only option.

30 Apr 2012, 6:34 PM
#10
schoolboy avatar

schoolboy

Totally Zenned

Join Date:
Jun 2005
Location:
Cumbria, UK
Posts:
10,327
Plugin Contributions:
0

Re: Easy Populate 1.2.5.7 - add to products_quantity, not overwrite

That's why I suggest an upgrade to at least 1.3.9h. The Changelog is quite easy to follow, and about a year ago we did a rather detailed upgrade of a new client's site where they had ignored the over-ride procedure.

It was a bit of a hassle, but the whole process took us about 2 hours.

... compared to the 20 or so hours it can take to try to fix a hack...