Kinetic Pulse
  • Home
  • Services
  • Portfolio
  • Blog
  • Terms
  • Contact

Zen Cart – stock by attributes plugin bug

March 22, 2011

I’ve found a couple of bugs with this, otherwise excellent, module:


  1. If you are not logged in Zen Cart will allow you to progress to the login page even if you have ignored the ‘delete out-of-stock’ products message on the shopping cart page. This may not seem a big deal, as you can’t progress further, but from a user experience perspective it’s definitely not ideal.
  2. If there is an out-of-stock product in your cart, all subsequent products you add will also be flagged as out-of-stock whether or not this is true.



Fortunately both issues were easy to fix with a little digging.

Issue 1 involves a modification to /includes/modules/pages/checkout_shipping/header_php.php.
Simply move the block of code under
// Stock Check
until it is above the section beginning with

// if the customer is not logged on, redirect them to the login page

This will force the page to check for stock before redirecting to the login page.

Issue 2 needs a small addition to
/includes/modules/pages/shopping_cart/header_php.php

Look for this section around line 59:

$flagAnyOutOfStock = false;
$products = $_SESSION[‘cart’]->get_products();
for ($i=0, $n=sizeof($products); $i$n; $i++) {
if (($i/2) == floor($i/2)) {
Change it to read:

$products = $_SESSION[‘cart’]->get_products();
for ($i=0, $n=sizeof($products); $i$n; $i++) {
$flagStockCheck = false;
if (($i/2) == floor($i/2)) {


This will force a reset of the flag for each iteration of the loop which builds the product array.

Share

Facebook Google+ Twitter Pinterest Email

Back to Blog

Testimonials

Absolutely fantastically professional web developer – I would highly recommend!!! Thank you so much Kinetic Pulse!
Tania MarstonDoris Designs
I like it.  I like it a lot !!!

 You have interpreted what I wanted to achieve perfectly considering what you have to play with i.e not redoing the whole thing in the process.

Fiona Simmons-MooreSouth Gloucestershire Parents & Carers
Amazing and brilliant, Kinetic Pulse have lifted a dream to reality, Highly recommended and great if you are total novice, they know their stuff…Thanks again
Annie LindridgeSalt Yourself Out
Thank you for all of your hard work its looks fab and I am over the moon with it!
Amanda MercerAmanda Mercer Ceramics
It’s been fab working with you – we love the site and certainly going to recommend you!
James DaviesThirty Eight Degrees North
Thanks so much for all your work on this, really appreciated. It’s come on in leaps and bounds since you took over.
Pete KewRedwood Strip Curtains
Thank you guys so much for all that you’ve done helping us to create a really awesome website!! We get such great feedback – everyone loves it & we couldn’t be prouder! Look forward to working with you again soon!
Wild Thyme PlantsWild Thyme Plants

Copyright 2025 Kinetic Pulse