News:

You may pay someone to create your store, or you visit our seminar and become a professional yourself with the silver certification

Main Menu

Show stock image in product list depending on stock

Started by cod3gen, December 14, 2012, 19:16:22 PM

Previous topic - Next topic

cod3gen

Hello!

Im trying to add a couple futures to the product list to show stock avaibility.
Like when over 5 products in stock, green image, when  under 5 products in stock orange image, and 0 stock red image and extra text. Also count together.

Ive tried this but it will just show green image no mather how many products in stock, is it an easy way to do this?
                        <?php if (($this->product->product_in_stock ) < 5) { ?>
                        <div class="produktlager"><?php echo 'Tilgjengelighet: '$product->product_in_stock'<img src="http://www.mydomain.no/templates/explore/images/Stocked.gif" />' ?></div>


Any one could help?

xcover

Hi,
maybe you can use this:

<div<span class="stock-level"><?php echo JText::_('COM_VIRTUEMART_STOCK_LEVEL_DISPLAY_TITLE_TIP'?></span>

<?php 
$stato "";
$statotip "";
if ($this->product->product_in_stock 1) {
$stato "nostock";
$statotip "Entschuldigung, wir haben derzeit keine Exemplare dieses Artikels auf Lager";

} else {
if ($this->product->product_in_stock 3) {
$stato "lowstock";
$statotip "Sofort Lieferbar, aber nur noch wenige Exemplare auf Lager!";

} else {
$stato "normalstock";
$statotip "Sofort Lieferbar!";
}
?>

<span class="vmicon vm2-<?php echo $stato ?>" title="<?php echo $statotip ?>"></div>
<div class="lagerstatus">
<?php 

if ($this->product->product_in_stock 1) {
echo  "Nicht auf Lager!";
} else {
if ($this->product->product_in_stock 3) {
echo "Wenige Exemplare auf Lager!";
} else {
echo "Auf Lager!";
}
?>

</div>


Greetings
Xcover

lostmail

...works great this code.

But how can i change it in category ?

When i open a category - all products are "green"  - but when i click a product - it`s yellow or red status...

How can i modify the category/views/default.php to work same way like productdisplay ?

QuoteFound this line in category:
               <?php
                  if ( VmConfig::get ('display_stock', 1)) { ?>
                  <!--                   if (!VmConfig::get('use_as_catalog') and !(VmConfig::get('stockhandle','none')=='none')){?> -->
                  <div class="paddingtop8">
                     <span class="vmicon vm2-<?php echo $product->stock->stock_level ?>" title="<?php echo $product->stock->stock_tip ?>"></span>
                     <span class="stock-level"><?php echo JText::_ ('COM_VIRTUEMART_STOCK_LEVEL_DISPLAY_TITLE_TIP') ?></span>
                  </div>
                  <?php } ?>

VirtueMart VirtueMart 4.4.0 11095 | Joomla 5.x | PHP 8.3 | Vp_neoteric 1.6

lostmail

#3
At last:
I´d like to know how the default stock images are working.

I see that there are 3 Status Levels (green, yellow and red) - how does virtuemart set these levels and where can i set at which level the status is yellow/green in backend ????

Should it not be a  standard feature to define at which stock level (count) the image hast to change from one to the other ?
VirtueMart VirtueMart 4.4.0 11095 | Joomla 5.x | PHP 8.3 | Vp_neoteric 1.6