Forums / Setting Up Categories, Products, Attributes / Quantity did not subtract. What went wrong?

Quantity did not subtract. What went wrong?

Locked

Views: 2,522

Results 1 to 20 of 20
This thread is locked. New replies are disabled.
1 Sep 2008, 1:17 AM
#1
cocoholo avatar

cocoholo

New Zenner

Join Date:
Sep 2008
Posts:
16
Plugin Contributions:
0

Quantity did not subtract. What went wrong?

Hi,

I'm selling items which is good only for 1 purchase. Meaning, after a buyer payed it, it should be out of the stores' front immediately. The problem is, it is still showing.

During product setup, I see to it that the PRODUCTS QUANTITY is set to 1. ( I assume this is the inventory).

Next, I check the Admin - STOCK, so that the SUBTRACT STOCK is set to TRUE

But surprisingly, when I tried to purchased it, it did not came out as expected, to be ZERO or not available.

What went wrong? Please help me.

Anna

1 Sep 2008, 1:45 AM
#2
cocoholo avatar

cocoholo

New Zenner

Join Date:
Sep 2008
Posts:
16
Plugin Contributions:
0

Re: Quantity did not subtract. What went wrong?

Additionally, I have increased the Number of STOCKS into 5, and tried to purchased it again, but still the Number of units available stayed at 5 which is already 4 supposedly.

1 Sep 2008, 2:52 AM
#3
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Quantity did not subtract. What went wrong?

Is this a physical product? Or is this a Download?

In Stock Settings you have set:
Check stock level true
Subtract stock true

Check the 2 configure.php files:
/includes/configure.php
/admin/includes/configure.php

and make sure they are using the same database ...

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

1 Sep 2008, 3:03 AM
#4
cocoholo avatar

cocoholo

New Zenner

Join Date:
Sep 2008
Posts:
16
Plugin Contributions:
0

Re: Quantity did not subtract. What went wrong?

This is a download product.
Yes, both using the same database.

This is my stock settings.

Check stock level true
Subtract stock true
Allow Checkout true
Mark product out of stock *** Info
Stock Re-order level 5

Also, I noticed that, if I do not attached any attribute such as DOWNLOAD, the inventory is successfully updated. It became 0. But the problem is, how will my customers download the product if I don't attach any attributes.

Please help

Anna

1 Sep 2008, 3:07 AM
#5
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Quantity did not subtract. What went wrong?

Downloads do not subtract from stock ...

Can you give a bit more information about your products so I can have a minute to think about the best solution to this without breaking things ... there is always a way ... :flex:

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

1 Sep 2008, 3:16 AM
#6
cocoholo avatar

cocoholo

New Zenner

Join Date:
Sep 2008
Posts:
16
Plugin Contributions:
0

Re: Quantity did not subtract. What went wrong?

Ok, thanks for the reply.

Basically, I setup a site which allows my clients to download .ZIP files. Since, this is an exclusive store, I don't want anybody to download the same .ZIP files more than once.

For instance I have,

PACK-01.ZIP 1 Unit Available
PACK-02.ZIP 1 Unit Available
PACK-03.ZIP 1 Unit Available

Now, if CUSTOMER A downloads PACK-01.ZIP, I expect that ZEN will treat this as SOLD OUT, since I have set it up as 1 Unit Available.

But since, you told me that DOWNLOADS are not treated and will not be subtracted to the INVENTORY, can you suggest something that this particular pack will be out of the store the moment somebody paid for it?

Thanks.

Anna

1 Sep 2008, 3:25 AM
#7
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Quantity did not subtract. What went wrong?

Are 100% of all of your products Downloads?

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

1 Sep 2008, 3:34 AM
#8
cocoholo avatar

cocoholo

New Zenner

Join Date:
Sep 2008
Posts:
16
Plugin Contributions:
0

Re: Quantity did not subtract. What went wrong?

Yes. I do not have any physical products as of the moment and do not have any plans in the future too.

All my products are digital and in ZIP form.

Also, the mode of payment is Paypal Express checkout. I hope this does not conflict on anything.

1 Sep 2008, 3:36 AM
#9
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Quantity did not subtract. What went wrong?

Need a bit of customizing on the class for orders.php to alter how it handles the Downloads and make them behave like regular products without messing up the code ...

Have you got your coder's hat on? :smartalec:

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

1 Sep 2008, 3:40 AM
#10
cocoholo avatar

cocoholo

New Zenner

Join Date:
Sep 2008
Posts:
16
Plugin Contributions:
0

Re: Quantity did not subtract. What went wrong?

Well, it seems that there is no way except to tinker the codes.

Please help me. I have a working knowledge on php

Anna

1 Sep 2008, 3:41 AM
#11
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Quantity did not subtract. What went wrong?

I would more or less have to write it for this to show you ...

If I get some more time, I will try to come up with a quick cheat that should work for you ... :cool:

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

1 Sep 2008, 3:47 AM
#12
kobra avatar

kobra

Black Belt

Join Date:
Aug 2005
Location:
Arizona
Posts:
31,500
Plugin Contributions:
4

Re: Quantity did not subtract. What went wrong?

cocoholo & Ajeh,

Could not a product be created(normal) and a default attribute added to it that is the download - once the Normal product is out of stock it will not display???

Is this a viable workaround?

Zen-Venom Get Bitten

1 Sep 2008, 3:53 AM
#13
cocoholo avatar

cocoholo

New Zenner

Join Date:
Sep 2008
Posts:
16
Plugin Contributions:
0

Re: Quantity did not subtract. What went wrong?

Well could be.. But how do I exactly create a product that's normal and at the same time downlodable?

1 Sep 2008, 2:27 PM
#14
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Quantity did not subtract. What went wrong?

Products are tested to see if they have attributes ...

If they don't then they are not made to address any download needs ...

Altering the stock tracking in the orders.php class is really the only method that I think would work for this ...

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

1 Sep 2008, 8:30 PM
#15
kobra avatar

kobra

Black Belt

Join Date:
Aug 2005
Location:
Arizona
Posts:
31,500
Plugin Contributions:
4

Re: Quantity did not subtract. What went wrong?

Was only a shot - - albeit - - in the dark

Zen-Venom Get Bitten

1 Sep 2008, 8:50 PM
#16
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Quantity did not subtract. What went wrong?

Looking at the orders.php class, you might see if any of these changes are able to manage your downloads and manage the ordering based on your stock setting per product ...

      // Stock Update - Joao Correia
      if (STOCK_LIMITED == 'true') {
// change to force stock on downloads - will do ALL PRODUCTS        
//        if (DOWNLOAD_ENABLED == 'true') {
        if (false) {
          $stock_query_raw = "select p.products_quantity, pad.products_attributes_filename, p.product_is_always_free_shipping
                              from " . TABLE_PRODUCTS . " p
                              left join " . TABLE_PRODUCTS_ATTRIBUTES . " pa
                               on p.products_id=pa.products_id
                              left join " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD . " pad
                               on pa.products_attributes_id=pad.products_attributes_id
                              WHERE p.products_id = '" . zen_get_prid($this->products[$i]['id']) . "'";

          // Will work with only one option for downloadable products
          // otherwise, we have to build the query dynamically with a loop
          $products_attributes = $this->products[$i]['attributes'];
          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_values = $db->Execute($stock_query_raw);
        } else {
          $stock_values = $db->Execute("select * from " . TABLE_PRODUCTS . " where products_id = '" . zen_get_prid($this->products[$i]['id']) . "'");
        }

        $zco_notifier->notify('NOTIFY_ORDER_PROCESSING_STOCK_DECREMENT_BEGIN');

        if ($stock_values->RecordCount() > 0) {
          // do not decrement quantities if products_attributes_filename exists
// change to force stock on downloads - will do ALL PRODUCTS        
//          if ((DOWNLOAD_ENABLED != 'true') || $stock_values->fields['product_is_always_free_shipping'] == 2 || (!$stock_values->fields['products_attributes_filename']) ) {
          if (true) {
            $stock_left = $stock_values->fields['products_quantity'] - $this->products[$i]['qty'];
            $this->products[$i]['stock_reduce'] = $this->products[$i]['qty'];
          } else {
            $stock_left = $stock_values->fields['products_quantity'];
          }

          //            $this->products[$i]['stock_value'] = $stock_values->fields['products_quantity'];

          $db->Execute("update " . TABLE_PRODUCTS . " set products_quantity = '" . $stock_left . "' where products_id = '" . zen_get_prid($this->products[$i]['id']) . "'");
          //        if ( ($stock_left < 1) && (STOCK_ALLOW_CHECKOUT == 'false') ) {
          if ($stock_left <= 0) {
            // only set status to off when not displaying sold out
            if (SHOW_PRODUCTS_SOLD_OUT == '0') {
              $db->Execute("update " . TABLE_PRODUCTS . " set products_status = 0 where products_id = '" . zen_get_prid($this->products[$i]['id']) . "'");
            }
          }

          // for low stock email
          if ( $stock_left <= STOCK_REORDER_LEVEL ) {
            // WebMakers.com Added: add to low stock email
            $this->email_low_stock .=  'ID# ' . zen_get_prid($this->products[$i]['id']) . "\t\t" . $this->products[$i]['model'] . "\t\t" . $this->products[$i]['name'] . "\t\t" . ' Qty Left: ' . $stock_left . "\n";
          }
        }
      }

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

2 Sep 2008, 12:17 AM
#17
cocoholo avatar

cocoholo

New Zenner

Join Date:
Sep 2008
Posts:
16
Plugin Contributions:
0

Re: Quantity did not subtract. What went wrong?

Now I'm getting confused. What I did is setup the product as Non Downloadable, wait for my client to pay and send the packs to his email manually just to keep my store going.

Hopefully, soon, digital downloads can be accounted too.

2 Sep 2008, 2:24 AM
#18
cocoholo avatar

cocoholo

New Zenner

Join Date:
Sep 2008
Posts:
16
Plugin Contributions:
0

Re: Quantity did not subtract. What went wrong?

FINALLY SOLVED without touching a code.

So basically, what I want is to control the number of downloads of ZIP files to only one buyer. After the payment, I expect that the product will no longer be on the store.

What I did was setup the product with the following settings.

Product is Virtual: NO, SHIPPING ADDRESS REQUIRED
Always free shipping: Special, Product/Download Combo Requires a Shipping Address

Product Quantity Minimum: 1
Product Qty Maximum: 1
Product Qty Units: 1

Then;

Products Quantity: 1 (this is the inventory of items)

Then, I went ahead and setup the attributes. That is DROPDOWN, then ZIP FILE (download).

Also, I make sure that the shipping address is free. I got some errors during the testing that we do not ship this on this zone. You might want to check your shipping zones too.

Whew! took me 2 days to configure this stuff right under my nose.

I hope somebody finds this helpful :clap:

2 Sep 2008, 2:49 AM
#19
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Quantity did not subtract. What went wrong?

That really works only because it is an error in how to setup products ... :eek:

If you were to ever have physical products, this will break everything ...

Right now it is tripping the Free Shipping in the checkout_shipping ... but were you to add a Physical Product, then the counts, weights, prices etc. would all be off and cause shipping issues ...

Keep an eye on things and see if this faking out the products works for you with numerous testing ... :lamo:

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

2 Sep 2008, 5:32 AM
#20
cocoholo avatar

cocoholo

New Zenner

Join Date:
Sep 2008
Posts:
16
Plugin Contributions:
0

Re: Quantity did not subtract. What went wrong?

Thanks.

Right now, I don't have any plans of adding physical products to my store and hopefully won't be experiencing those problems you mentioned.

I just need to get my store running and I think setting up the products this way is just what I need as of the moment.

:smile: