VirtueMart Forum

VirtueMart 2 + 3 + 4 => General Questions => Topic started by: beha on July 09, 2012, 17:38:03 PM

Title: Display stock leval as text
Post by: beha on July 09, 2012, 17:38:03 PM
Hello, i searched forum, but i cannot find solution on how to display stock level as text on product details. Could you help me with this, i want to get result as: Product on stock (is stock leval is 1 or more) or Out of stock (if stock level is 0)

Virtuemart is version 2.0.8, and set in catalog mode only.

Title: Re: Display stock leval as text
Post by: ivus on July 18, 2012, 12:00:45 PM
Hi beha,

In your productsdetails.php file try placing this bit of code where you want to display the stock level.

   <?php if (!VmConfig::get('use_as_catalog') and !(VmConfig::get('stockhandle','none')=='none') && (VmConfig::get ( 'display_stock', 1 )) ) : ?>
        <?php echo JText::_('COM_VIRTUEMART_STOCK_LEVEL_DISPLAY_TITLE_TIP') .' '. $this->product->product_in_stock - $this->product->product_ordered; ?>
   <?php endif; ?>

I hope this helps.
Title: Re: Display stock leval as text
Post by: Genius WebDesign on July 18, 2012, 14:48:16 PM
Hi beha,

You need to make some PHP if-statements to be able to do so.
You can actually do alot of cool stuff with the stock-info, e.g. place a module to be shown according to different stock levels. You could then make a custom HTML-module for each stock level and have them shown with all the content you want at the right time.

I´ve been working alot in this particular field with my own projects, and I currently offer my work to others who needs coding/styling.

You are always welcome to send me an e-mail, webmaster@traeogbyg.dk, if you want me to take a look at your site