Zen Cart Logo
Forums / Addon Templates / Show Available Stock Level in Cart -- addon Not Functioning in 1.39d?

Show Available Stock Level in Cart -- addon Not Functioning in 1.39d?

Views: 3,883

Results 1 to 13 of 13
25 Jun 2010, 5:33 AM
#1
haw77 avatar

haw77

New Zenner

Join Date:
Apr 2009
Posts:
1
Plugin Contributions:
0

Show Available Stock Level in Cart -- addon Not Functioning in 1.39d?

I just upgraded from 1.37 to 1.39d a couple of weeks ago. When using 1.37, I had "show available stock level in cart when less than order" set to true under Configuration > Stock. It always worked great and customers could see in the shopping cart if they tried to order more than was available and many would order exactly what I had on hand. So, this setting was particularly useful for me.

I just realized that using 1.39d, it no longer lists the available stock in the shopping cart when items are back-ordered, even though "show available stock in cart when less than order" is correctly set in configuration. Can someone tell me if I am missing something?

25 Jun 2010, 12:20 PM
#2
soxophoneplayer avatar

soxophoneplayer

Totally Zenned

Join Date:
Feb 2008
Posts:
534
Plugin Contributions:
0

Re: Show Available Stock Level in Cart -- addon Not Functioning in 1.39d?

I upgraded 1.3.8a to 1.3.9abcd and Stock by Attributes 1.4.7 updated to 1.4.9

I had some things 'missing' too - stock available not showing on cart or on product page.

It turned out I also had Product Attributes Grid 1.1.1 on my 1.3.8a site and not on my updated test site. When I added the second mod, everything was as it should be.

I don't know the why's and wherefore's but it worked for me.

28 Jun 2010, 9:08 PM
#3
p1lot avatar

p1lot

New Zenner

Join Date:
May 2009
Posts:
69
Plugin Contributions:
0

Re: Show Available Stock Level in Cart -- addon Not Functioning in 1.39d?

doesn't work for me either. anybody know how to fix that issue? i really rely on this particular feature.

i found out what the problem is, but don't know how to solve it.

<?php if ((STOCK_SHOW_LOW_IN_CART == 'true') && $product['flagStockCheck']) { echo '<span class="alert bold">'; echo PWA_STOCK_AVAILABLE; echo ((isset($product['stockAvailable'])) ? $product['stockAvailable']: 0); echo '</span>'; } ?>

The variable $product['flagStockCheck'] is NEVER set even though it should be if the customer has more items in the shopping cart than are available.

28 Jun 2010, 9:32 PM
#4
p1lot avatar

p1lot

New Zenner

Join Date:
May 2009
Posts:
69
Plugin Contributions:
0

Re: Show Available Stock Level in Cart -- addon Not Functioning in 1.39d?

^ i was talking about the file tpl_shopping_cart_default.php

28 Jun 2010, 10:45 PM
#5
soxophoneplayer avatar

soxophoneplayer

Totally Zenned

Join Date:
Feb 2008
Posts:
534
Plugin Contributions:
0

Re: Show Available Stock Level in Cart -- addon Not Functioning in 1.39d?

Bearing in mind I don't know coding:

I actually in my CUSTOM_TEMP the snippet in your quote. That snippet, I beleive, is part of the Stock By Attributes contribution - I see it the mod files but not in the 1.3.8 or 1.3.9 files.

BUT

There is another line in my CUSTOM_TEMP version:

<?php echo zen_draw_form('cart_quantity', zen_href_link(FILENAME_SHOPPING_CART, 'action=update_product')); ?>

And in the 1.3.9 TEMP_DEFAULT this shows as:

<?php echo zen_draw_form('cart_quantity', zen_href_link(FILENAME_SHOPPING_CART, 'action=update_product', $request_type)); ?>

I just tried in my own test site - when I use the former, and enter more than available stock, I get an error message AND the actual amount that exists in stock.

When I use the latter I get the error message, but NO indication of what is in stock.

That line of code in my CUSTOM_TEMP file also appears to come from the Stock By Attributes mod.

My test site is on PHP 5.2 and I am using zc 1.3.9d and SbyA 1.4.9 (As I said, I don't know code, so I don't know if this will give me grief when my server goes 5.3....but it works on 5.2)

28 Jun 2010, 11:15 PM
#6
p1lot avatar

p1lot

New Zenner

Join Date:
May 2009
Posts:
69
Plugin Contributions:
0

Re: Show Available Stock Level in Cart -- addon Not Functioning in 1.39d?

thanks i will try that, but don't you use the new updated fileset of SbyA for 1.3.9d?

Talking about this one: http://www.zen-cart.com/forum/showpost.php?p=882168&postcount=215

29 Jun 2010, 2:14 AM
#7
p1lot avatar

p1lot

New Zenner

Join Date:
May 2009
Posts:
69
Plugin Contributions:
0

Re: Show Available Stock Level in Cart -- addon Not Functioning in 1.39d?

ok, wasn't able to fix it with the solution posted above. maybe a zen cart coder could elaborate? :blush:

29 Jun 2010, 2:27 AM
#8
soxophoneplayer avatar

soxophoneplayer

Totally Zenned

Join Date:
Feb 2008
Posts:
534
Plugin Contributions:
0

Re: Show Available Stock Level in Cart -- addon Not Functioning in 1.39d?

the new updated fileset of SbyA for 1.3.9d?

This file set is pre-merged. I do my own merging as I have quite a few mods some files overlap.

On the tpl_shopping_cart_default, the file in the set you mention is the same as the 1.3.9d default except for 2 blocks of code added in the merge from S by A.

But in the original S by A files 1.4.9 there are, in fact, three codes sections that are different, the third being the one I pasted in my previous reply.

Good luck on your hunt ;o)

29 Jun 2010, 11:39 AM
#9
p1lot avatar

p1lot

New Zenner

Join Date:
May 2009
Posts:
69
Plugin Contributions:
0

Re: Show Available Stock Level in Cart -- addon Not Functioning in 1.39d?

how come you use 1.4.9 and not 1.4.10?

29 Jun 2010, 1:05 PM
#10
soxophoneplayer avatar

soxophoneplayer

Totally Zenned

Join Date:
Feb 2008
Posts:
534
Plugin Contributions:
0

Re: Show Available Stock Level in Cart -- addon Not Functioning in 1.39d?

how come you use 1.4.9 and not 1.4.10?

Just haven't got that far. Been trying to update everything on test store since 1.3.9a came out. Things won't stand still!

But I checked and the tpl_shopping_cart_default file is the same. It is also the same in 1.4.7 which I use on my livesite with zc 1.3.8a, and the stock shows correctly there as well.

The only other thing I can think of is - is this file placed in the folder of the template that your store is actually calling on - ie if its not then your store will call up the template default version instead.

29 Jun 2010, 10:54 PM
#11
p1lot avatar

p1lot

New Zenner

Join Date:
May 2009
Posts:
69
Plugin Contributions:
0

Re: Show Available Stock Level in Cart -- addon Not Functioning in 1.39d?

its not the template that is faulty, the value of $product['flagStockCheck'] should be allocated in the order.php file, so i guess that file is faulty at some point. im using the merged fileset of ideashop.

13 May 2011, 4:26 AM
#12
cooler0918 avatar

cooler0918

New Zenner

Join Date:
Apr 2011
Posts:
26
Plugin Contributions:
0

Re: Show Available Stock Level in Cart -- addon Not Functioning in 1.39d?

I running 1.39h and I just installed SBA 1.4.13. Everything appears to be working except 2 issues. One is the previously mentioned item on this thread, which is that my available stock does not show in the shopping cart when the quantity exceeds the current stock level for that attribute. I have been comparing all the files 2 to3 times and I am pretty sure i merged it correctly.

The other issue is more of a behavior problem. I have my setting set to not go to the shopping cart every time you add an item but if the first item added has insufficient stock they all show up as insufficient subsequently.

Any help would be much appreciated. :frusty:
Cooler0918

https://www.ahaccessories.com

28 Jul 2011, 12:00 AM
#13
etrader avatar

etrader

New Zenner

Join Date:
Dec 2005
Posts:
62
Plugin Contributions:
0

Re: Show Available Stock Level in Cart -- addon Not Functioning in 1.39d?

I found a solution to the problem of 'stock available' not showing on the shopping cart page when a customer places more items in the cart than are available. Using latest stock by attributes contrib with zen version 1.3.9h.

In the file: /includes/modules/pages/shopping_cart/header_php.php

Around line line 130 after:

  if (STOCK_CHECK == 'true') {
    $flagStockCheck = zen_check_stock($products[$i]['id'], $products[$i]['quantity'],$attributes);
    if ($flagStockCheck == true) {
      $flagAnyOutOfStock = true;
    }

Insert this line:

$stockAvailable = zen_get_products_stock($products[$i]['id']);

Hope that helps.