I am looking for a way to add the Stock Status to the latest Module like what is displayed on the Product page. I just want it to show In Stock or Out of Stock. I would list it under the model on the latest_home.tpl
I found this code for the product page which is what I think I need but I am not sure how to incorporate it into the latest.php and latest_home.tpl or if there are other files I need to edit also. Any help would be great!
From Product.php
$this->data['text_availability'] = $this->language->get('text_availability');
From Product.tpl
<?php echo $text_availability; ?>
Ok, I figured out an answer to my problem. I am a newb when it comes to PHP programming so there may be a better way to do this but from what I can tell it works great! Ill post how I got it to work in case someone else was wondering the same thing.
First find the following in latest.php and add code 'availability' => $result['quantity'],
Then in latest_home.tpl find <span style="color: #999; font-size: 11px;"><?php echo $products[$j]['model']; ?></span><br /> Below this line add the following code:
To see an example of how it works check out my sotre: http://www.segastyle.com/store
First find the following in latest.php and add code 'availability' => $result['quantity'],
Code: Select all
$this->data['products'][] = array(
'product_id' => $result['product_id'],
'name' => $result['name'],
'model' => $result['model'],
'rating' => $rating,
'stars' => sprintf($this->language->get('text_stars'), $rating),
'price' => $price,
'options' => $options,
'availability' => $result ['quantity'],
'special' => $special,
Code: Select all
<?php
if ($products[$j]['availability'] == 0)
$stockdisplay = "Out of Stock";
else
$stockdisplay = "In Stock";
?>
<span style="color: #000; font-size: 11px; font-weight: bold;"><?php echo $stockdisplay; ?></span><br />
This really helped me out a lot... thanks for taking the time to post it Balbaroy!!
I'm curious though if I could tweak the code just a bit so that if there was only one or two items left it would say 'Only One (Or Only Two) Left!' I've been playing with it but can't quite figure it out.
Thanks again.
I'm curious though if I could tweak the code just a bit so that if there was only one or two items left it would say 'Only One (Or Only Two) Left!' I've been playing with it but can't quite figure it out.
Thanks again.
Who is online
Users browsing this forum: No registered users and 3 guests