News:

Support the VirtueMart project and become a member

Main Menu

Display stock leval as text

Started by beha, July 09, 2012, 17:38:03 PM

Previous topic - Next topic

beha

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.


ivus

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.

Genius WebDesign

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