Post by fokz8 » Tue Jan 05, 2016 5:59 pm

Hey there.

When i go to my product page for specified item, i get desplayed "In stock" or "Out of stock". How is it possible, to display the number of items in stock, so that display would be like:

Stock: 50

Thanks :)

New member

Posts

Joined
Sun Jul 26, 2015 8:35 pm

Post by jimmyphong » Tue Jan 05, 2016 6:57 pm

Edit product controller

Open file

Code: Select all

catalog/controller/product/product.php
find

Code: Select all

if ($product_info['quantity'] <= 0) {
add before

Code: Select all

$data['number_stock'] = $product_info['quantity'] 
open file

Code: Select all

catalog\view\theme\your theme\template\product\product.tpl
find

Code: Select all

<?php echo $stock; ?>
replace

Code: Select all

<?php echo $number_stock;?>

News CMS || Plus SEO || Live Price change with Option Select


Active Member

Posts

Joined
Sat Aug 13, 2011 2:48 am


Post by fokz8 » Tue Jan 05, 2016 9:46 pm

jimmyphong wrote:Edit product controller

Open file

Code: Select all

catalog/controller/product/product.php
find

Code: Select all

if ($product_info['quantity'] <= 0) {
add before

Code: Select all

$data['number_stock'] = $product_info['quantity'] 
open file

Code: Select all

catalog\view\theme\your theme\template\product\product.tpl
find

Code: Select all

<?php echo $stock; ?>
replace

Code: Select all

<?php echo $number_stock;?>
Thank you, it works perfect!

New member

Posts

Joined
Sun Jul 26, 2015 8:35 pm

Post by IP_CAM » Wed Jan 06, 2016 5:58 am

@jimmyphong, you just forgot to add the ';' ;)
$data['number_stock'] = $product_info['quantity']
to make it look like;
$data['number_stock'] = $product_info['quantity'];

I created a free little VqMod for this, to match OpenCart v.1.5.6.x - v.2.x Versions
---
OpenCart v.2.x VqMod, tested here:
http://www.jti.li/shop/index.php?route= ... duct_id=29

OpenCart v.1.5.6.5_rc VqMod, tested here:
http://www.openshop.li/cart/index.php?r ... ct_id=4936

Display Stock on Product Page VqMod Extension Download Link:
http://www.opencart.com/index.php?route ... n_id=25260

Good Luck ;)
Ernie

My Github OC Site: https://github.com/IP-CAM
5'200 + FREE OC Extensions, on the World's largest private Github OC Repository Archive Site.


User avatar
Legendary Member

Posts

Joined
Tue Mar 04, 2014 1:37 am
Location - Switzerland
Who is online

Users browsing this forum: No registered users and 133 guests