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

Attachments

stock_on_product_page_v2.jpg

OC v.2.x Display Stock on Product Page - stock_on_product_page_v2.jpg (42.79 KiB) Viewed 856 times


I'm no longer active at the OC Forum. To reach me, contact: jti@jacob.ch
A Demoversion of my free OpenCart LIGHT v.1.5.6.5 Software Edition
can be seen in Action here: http://www.jti.li/shop/
---
940+ FREE OC Extension-Repositories - from OC v.1.5.x up,
on the world's largest OC-related Github Site: https://github.com/IP-CAM
---
Image


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 72 guests