Forums / Bug Reports / Negative products on re-login to cart

Negative products on re-login to cart

Locked

Views: 1,920

Results 1 to 11 of 11
This thread is locked. New replies are disabled.
22 Jan 2010, 10:25 AM
#1
boardgamerentals avatar

boardgamerentals

New Zenner

Join Date:
Jan 2010
Location:
Wellington, NZ
Posts:
12
Plugin Contributions:
0

Negative products on re-login to cart

HI

I am just setting up my first site with this great tool (amazing in fact) and have found an irritating issue. (version 1.3.8a)

The site is set up to rent board games - so each product has 3 price attributes that relate to the length of the rental period - 1,3,6 wks. There is only 1 item of stock, the customer selects the attribute and then goes to checkout etc.

I have the config in admin set to not allow stock to be put in the cart when there is none there.

What I have found is that if I log in and fill the cart with items, go straight thought to the last page on checkout before the order is confirmed - the cart gets saved.

If I then go back to the site without loging in I can select the same item with a different attribute and add it to the cart, log in when required and then checkout and they system allows this. I presume it relates to the different attributes and the single product.

The situation can occur that a customer could check out 3 of the same product, one per attribute and take the stock level of -2. I presume it could affect 2-3 to customers at once so I would love some guidence on this.

If you go to the site https://www.boardgamerentals.net/shopping you should be able to try it.

Thanks in advanced

Peter

22 Jan 2010, 10:30 AM
#2
misty avatar

misty

Inactive

Join Date:
Apr 2004
Location:
UK
Posts:
5,752
Plugin Contributions:
1

Re: Negative products on re-login to cart

Try using stock by attributes mod...
Free Software Add ons..link top left of this page

Dezina ZenCart Templates
Please do not PM for support queries..Post in forums..help others

22 Jan 2010, 6:22 PM
#3
boardgamerentals avatar

boardgamerentals

New Zenner

Join Date:
Jan 2010
Location:
Wellington, NZ
Posts:
12
Plugin Contributions:
0

Re: Negative products on re-login to cart

Hi thanks for the idea,

I had looked at stock by attributes - it adds a stock number to each attribute which I don't want. I still only want **one **stock just with three different prices for the different rental periods. As once one of the rental periods has been selected and rented at I won't have the item any more.

What seems to be happening is that Zen may not do a check on relogin to see if the saved cart is still valid when you add it to the new cart.

I would suspect that the logic goes that the old cart was checked to see if there was enough stock = true. So ok to save.

When the new cart is created the same check occurs and as the stock has not been checked out the answer is also = true.

What it seems does not happen is a third check that says does the new combined cart (new stuff and previous stuff) exceed the current stock level. Both carts independantly were fine, but together they aren't any more and an error message of low stock should pop up for the cart.

I'm sorry but I don't know enough about php to check if this third check takes place and therefore if there is a problem with my cart or that it is a simple oversight with zen's cart logic.

Thanks in advanced again.

Peter

22 Jan 2010, 6:45 PM
#4
misty avatar

misty

Inactive

Join Date:
Apr 2004
Location:
UK
Posts:
5,752
Plugin Contributions:
1

Re: Negative products on re-login to cart

I'm sorry but I don't know enough about php to check if this third check takes place and therefore if there is a problem with my cart or that it is a simple oversight with zen's cart logic.
Regret neither do i for this particular task...if zencart coder does not respond, then suggest you post in Commercial section

Dezina ZenCart Templates
Please do not PM for support queries..Post in forums..help others

31 Jan 2010, 1:42 AM
#5
boardgamerentals avatar

boardgamerentals

New Zenner

Join Date:
Jan 2010
Location:
Wellington, NZ
Posts:
12
Plugin Contributions:
0

Re: Negative products on re-login to cart

Hi - more information.

I have done a fresh install of Zen and have been able to reproduce the bug 1.3.8a (patched) .

  1. Did clean install - all standard templates.
  2. Set up test category
  3. Set up test product (quanity 1)
  4. Set up pricing attributes (1 attribute, 3 values - pricing 1 wk, 3, wk 6 wk rental)
  5. Applied attributes to product.
  6. Set config not to all checkout if stock low.
  7. Went to live site.
  8. Created account.
  9. Loaded cart with item for for purchase (value 1wk).
  10. Went through to page before confirm of order and logged off.
  11. Went into site and load product with (value 3wk) into cart.
  12. went through checkout process.
  13. Relogged in when requested.
  14. Old items loaded into cart and now have 2 items – one for each value – even thought only 1 in stock. No note of out of stock due on the cart.

This only seems to happen on re-login and combining the previous cart. If you add the 1 wk and then add the 3 wk in one session the programme gives an error and keeps the original in the cart.

If you want to check this then you can visit - https://www.ishanipeter.com/shopping (this is the test site area foor board game rentals). I have added the item in with a quantity of one.

Please try this.

Thanks in advance.

31 Jan 2010, 9:27 AM
#6
boardgamerentals avatar

boardgamerentals

New Zenner

Join Date:
Jan 2010
Location:
Wellington, NZ
Posts:
12
Plugin Contributions:
0

Re: Negative products on re-login to cart

HI - my site is not live at the moment, but this outcome seems unprofessional from a customer perspective - all of the people I have tested the site with agree that it looks poor. It would mean that in these situations (due to rental nature of the business that I am running and the number of stock) it is quite possible to occur - I would have to email customers back in each situation to ask them which rental option they actually want - either the 1,3,6 week.

I'm wondering is there something I could have done **wrong **in setting up the price by attributes that allows this or otherwise this does seem to be a general over sight in the code. It does seem strange that it has not come up much before if it is in the code (I have read another thread a few years back that mentioned this). The situation does not occur where there are no attributes for a product. I have looked at the low stock php files but don't know enough to workout a solution or see the problem. I was thinking of just resetting the cart if people leave and don't buy but that also has the issue of negative customer impact.

Just wondering if it is a simple fix or if others have seen this issue. The issue is easy to re-create from the fresh install so hopefully someone can steer me in a direction to fix the install or solve the code issue.

Thanks.

Peter

31 Jan 2010, 6:54 PM
#7
ajeh avatar

ajeh

Oba-san

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

Re: Negative products on re-login to cart

You could try a change of instead of using the function zen_check_stock in the Catalog by itself to use the in_cart_mixed with it ... example:

$_SESSION['cart']->in_cart_mixed($product['id'])

where the $product['id'] is the current products_id being checked, depending on where you are in the code ...

The difference between the two is that based on the setting of the Product where:
Product Qty Min/Unit Mix: YES

means that the quantities of all attribute combos should be considered the same products_id ...

In the Tools ... Developers Tool Kit ... you could do a search of the Catalog on:
zen_check_stock

to see where the tests for stock are done ...

Then, try commenting out the original line and use the same line but with the new quantity to test by just passing it the current products_id reference from the in_cart_mixed ...

Example, in the shopping_cart header_php.php it uses:

    $flagStockCheck = zen_check_stock($products[$i]['id'], $products[$i]['quantity']);

This could be changed to:

//    $flagStockCheck = zen_check_stock($products[$i]['id'], $products[$i]['quantity']);
    $flagStockCheck = zen_check_stock($products[$i]['id'], [B]$_SESSION['cart']->in_cart_mixed($products[$i]['id'])[/B]);

So if the Mixed is set to YES on the Product, which is the default setting ... it would count the total quantities for the Product that are in the cart by adding each Attribute combo together to check the quantity available ...

NOTE: there are several references to this in the Catalog and you would need to adjust them all ...

NOTE: in theory, this should work ... but I have not tested all instances that I can think of for this to see if there are an exceptions to this ...

NOTE: be sure to save copies of both the original files and your customizations as you will be changing core files that do not have overrides ...

Doesn't this sound like fun? :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 Feb 2010, 9:10 AM
#8
boardgamerentals avatar

boardgamerentals

New Zenner

Join Date:
Jan 2010
Location:
Wellington, NZ
Posts:
12
Plugin Contributions:
0

Re: Negative products on re-login to cart

Hi - thanks for this I have tried and it worked. In the end have done it to the shopping cart only, but it now clearly displays an out of stock when two different rental options are selected for the stock.

Thanks alot.

Great.

Peter

1 Feb 2010, 3:24 PM
#9
ajeh avatar

ajeh

Oba-san

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

Re: Negative products on re-login to cart

I am glad that this works for you ...

Be aware, if you only did this on the shopping_cart ... it only displays the warning ... it does not prevent the checkout ...

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 Feb 2010, 6:58 PM
#10
boardgamerentals avatar

boardgamerentals

New Zenner

Join Date:
Jan 2010
Location:
Wellington, NZ
Posts:
12
Plugin Contributions:
0

Re: Negative products on re-login to cart

Hi

Thanks, I will go and do it to the others. Just ran out of time last night. But it was great to see the bit I did work. Would this be an improvement that could be put into a next realise. I can't think of a reason not to have the software do this?

Thanks again.

Peter

1 Feb 2010, 9:37 PM
#11
ajeh avatar

ajeh

Oba-san

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

Re: Negative products on re-login to cart

It is something to consider but it is also a very different result on the current checkout that has to be considered ...

There are so many uses to attributes and the affect on stock that you don't want to just make a change like this without considering the long range affects on a bazzillion shops that use them ... :smile:

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!