Post by tjonnyc » Sat May 07, 2016 5:01 am

I need to show the current stock status (field "quantity" in table "product") directly on the category page, as well as the "Related Products" carousel.

In other words, I want to show the price AND stock, right in the category, BEFORE clicking on the product itself.

I can directly show <?php echo $product['href']; ?>, <?php echo $product['name']; ?>, <?php echo $product['description']; ?>, <?php echo $product['price']; ?>, and so on - but the moment I add the code <?php echo $product['quantity']; ?>, I get an "Undefined index: quantity" error.

How can I get this to work?

Active Member

Posts

Joined
Tue Dec 21, 2010 5:05 am

Post by MarketInSG » Sat May 07, 2016 8:37 am

Go over to catalog/controller/product/category.php and find

Code: Select all

=> $result['product_id']
below that line, add

Code: Select all

'quantity' => $result['quantity'],
That should allow you to print the quantity on the category template


User avatar
Guru Member

Posts

Joined
Wed Nov 16, 2011 11:53 am
Location - Singapore

Post by tjonnyc » Fri May 20, 2016 12:48 am

Unfortunately, this takes the quantity of the 1st item listed on the category, and replicates it to ALL items in the category. So, it's meaningless...

Active Member

Posts

Joined
Tue Dec 21, 2010 5:05 am

User avatar
Guru Member

Posts

Joined
Wed Nov 16, 2011 11:53 am
Location - Singapore
Who is online

Users browsing this forum: No registered users and 30 guests