Post by socal2 » Fri Jan 13, 2012 3:26 am

Gents,

2 years ago on 1.34 I have received help as to how to display the quantity remaining on the home page (for Featured and Latest products, and on category pages.

Please see prior thread. Xsecrets had given me some input that worked splendidly
http://forum.opencart.com/viewtopic.php ... ing#p37641


I have had to upgrade cart and I am supposing that the old instructions would not work on the new version I'm working with which is 1.513 ?

Any feedback on that would be appreciated.

Here is the code the Xsecrets gave me for the 1.34 version. (2 years ago)

in catalog/controler/common/home.php change

Code: Select all
$this->data['products'][] = array(
'name' => $result['name'],
'model' => $result['model'],
'rating' => $rating,
'stars' => sprintf($this->language->get('text_stars'), $rating),
'thumb' => image_resize($image, $this->config->get('config_image_product_width'), $this->config->get('config_image_product_height')),
'price' => $price,
'special' => $special,
'href' => $this->model_tool_seo_url->rewrite($this->url->http('product/product&product_id=' . $result['product_id']))
);

to

Code: Select all
$this->data['products'][] = array(
'name' => $result['name'],
'model' => $result['model'],
'rating' => $rating,
'stars' => sprintf($this->language->get('text_stars'), $rating),
'thumb' => image_resize($image, $this->config->get('config_image_product_width'), $this->config->get('config_image_product_height')),
'price' => $price,
'quantity' => $result['quantity'],
'special' => $special,
'href' => $this->model_tool_seo_url->rewrite($this->url->http('product/product&product_id=' . $result['product_id']))
);


then in catalog/view/theme/{yourtheme}/template/common/home.tpl add

Code: Select all
<?php echo $products[$j]['quantity']; ?>

somewhere in the products loop wherever you want it. you may need to add appropriate breaks/styling etc.




in catalog/controller/product/category.php find around line 145

Code: Select all
'model' => $result['model'],

make a new line after that and add

Code: Select all
'quantity' => $result['quantity'],


then in catalog/view/theme/{yourtheme}/template/product/category.tpl around line 54 (somewhere in the products loop) add

Code: Select all
<?php echo $products[$j]['quantity']; ?>

once again this has no styling whatsoever you can add that as you wish.



Thanks Again !

New member

Posts

Joined
Tue Dec 01, 2009 12:45 am
Who is online

Users browsing this forum: No registered users and 32 guests