Zen Cart Logo
If this is your first visit, check our documentation. To post, register or login.
Forums / General Questions / General Questions / Saved cart items that have gone out of stock

Saved cart items that have gone out of stock

Started by philip937 on 15 Jun 2014, 3:31 PM · Views: 614

Results 1 to 8 of 8
15 Jun 2014, 3:31 PM
#1
philip937 avatar

philip937

Totally Zenned

Join Date:
Aug 2009
Location:
Bedford, England
Posts:
968
Plugin Contributions:
0

Post #1 by philip937

I've had a customer telling me today that they couldn't get past the shopping cart page, after much investigation it has become apparent that it is because the item they previously had saved in their cart is now out of stock.

For some reason the shopping cart in this situation is not flagging a message saying that the item is out of stock.

Is this normal? If so any way of adding something to provide a message stack to alert the customer a product in their cart is no longer available?

Phil Rogers
A problem shared is a problem solved.

15 Jun 2014, 4:05 PM
#2
ajeh avatar

ajeh

Oba-san

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

Post #2 by ajeh

By default, if you have something in the cart and it is out of stock there should be both a messstack displayed and the Product has the *** ...

Test this out for yourself on your test customer account to ensure you see the message, if you do not, switch to Classic Template, does the message show?

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!

15 Jun 2014, 4:07 PM
#3
philip937 avatar

philip937

Totally Zenned

Join Date:
Aug 2009
Location:
Bedford, England
Posts:
968
Plugin Contributions:
0

Post #3 by philip937

Thanks Linda, I have SBA installed so assume it's that messing with it.

Phil Rogers
A problem shared is a problem solved.

15 Jun 2014, 5:10 PM
#4
philip937 avatar

philip937

Totally Zenned

Join Date:
Aug 2009
Location:
Bedford, England
Posts:
968
Plugin Contributions:
0

Post #4 by philip937

I have narrowed it down, it was not as I thought, I have forced the out of stock item into the cart from scratch and still doesnt show the message, yet oher items that have a drop down option that is out of stock, when adding the message shows fine.

main difference is that the products that dont display the message are set with an attribute as display only, im wondering if SBA is ignoreing this for stock checking..

can you point me to where the code is so that I can have a look see if I can work it out?

Phil Rogers
A problem shared is a problem solved.

15 Jun 2014, 5:17 PM
#5
ajeh avatar

ajeh

Oba-san

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

Post #5 by ajeh

The stock is checked on the checkout_shipping
/includes/modules/pages/checkout_shipping/header_php.php

// Stock Check
  if ( (STOCK_CHECK == 'true') && (STOCK_ALLOW_CHECKOUT != 'true') ) {
    $products = $_SESSION['cart']->get_products();
    for ($i=0, $n=sizeof($products); $i<$n; $i++) {
      if (zen_check_stock($products[$i]['id'], $products[$i]['quantity'])) {
        zen_redirect(zen_href_link(FILENAME_SHOPPING_CART));
        break;
      }
    }
  }

I do not know what your add-on or template may have changed ...

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!

15 Jun 2014, 5:19 PM
#6
philip937 avatar

philip937

Totally Zenned

Join Date:
Aug 2009
Location:
Bedford, England
Posts:
968
Plugin Contributions:
0

Post #6 by philip937

cheers, i'll check it out, if I get completly stuck i'll post the modified code here to see if you or anyone else can spot it.

Cheers for your help:)

Phil Rogers
A problem shared is a problem solved.

15 Jun 2014, 5:22 PM
#7
philip937 avatar

philip937

Totally Zenned

Join Date:
Aug 2009
Location:
Bedford, England
Posts:
968
Plugin Contributions:
0

Post #7 by philip937

Ajeh:

The stock is checked on the checkout_shipping
/includes/modules/pages/checkout_shipping/header_php.php

// Stock Check
if ( (STOCK_CHECK == 'true') && (STOCK_ALLOW_CHECKOUT != 'true') ) {
$products = $_SESSION['cart']->get_products();
for ($i=0, $n=sizeof($products); $i<$n; $i++) {
if (zen_check_stock($products[$i]['id'], $products[$i]['quantity'])) {
zen_redirect(zen_href_link(FILENAME_SHOPPING_CART));
break;
}
}
}

> 
> I do not know what your add-on or template may have changed ...

just noticed that this is the code that redirects back to the shopping cart page. this actually still works. its the code that places the message next to the out of stock items that doesnt. where will that be located?

Phil Rogers
A problem shared is a problem solved.

15 Jun 2014, 5:34 PM
#8
ajeh avatar

ajeh

Oba-san

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

Post #8 by ajeh

You would need to check the header on:
/includes/modules/shopping_cart/header_php.php

and the template:
/includes/templates/template_default/templates/tpl_shopping_cart_default.php

vs your templates and overrides file:
/includes/templates/your_template_dir/templates/tpl_shopping_cart_default.php

for I think this section of code:

<?php
  if ($product['flagShowFixedQuantity']) {
    echo $product['showFixedQuantityAmount'] . '<br /><span class="alert bold">' . $product['flagStockCheck'] . '</span><br /><br />' . $product['showMinUnits'];
  } else {
    echo $product['quantityField'] . '<br /><span class="alert bold">' . $product['flagStockCheck'] . '</span><br /><br />' . $product['showMinUnits'];
  }
?>

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!