News:

Looking for documentation? Take a look on our wiki

Main Menu

Availability field in custom template

Started by thefbi, July 02, 2020, 11:15:58 AM

Previous topic - Next topic

thefbi

Hello,
i need the availability field for products out of stock.

I try to add this code (find in the sublayout) in my template :
<?php echo (file_exists(JPATH_BASE '/' VmConfig::get('assets_general_path') . 'images/availability/' VmConfig::get('rised_availability'))) ? JHtml::image(JURI::root() . VmConfig::get('assets_general_path') . 'images/availability/' VmConfig::get('rised_availability''7d.gif'), VmConfig::get('rised_availability''7d.gif'), array('class' => 'availability')) : vmText::_(VmConfig::get('rised_availability')); ?>

It work, but... Only with the general parameters and it show on ALL product, not only when out of stock.
If somebody can tell me the right code i have to put in my template to make it work ?

Regards,

VM 3.8.4 10335
Joomla 3.9.19

pinochico

What do you want with this?

Change template, add labels, show info about discontinued.... ?
www.minijoomla.org  - new portal for Joomla!, Virtuemart and other extensions
XML Easy Feeder - feeds for FB, GMC,.. from products, categories, orders, users, articles, acymailing subscribers and database table
Virtuemart Email Manager - customs email templates
Import products for Virtuemart - from CSV and XML
Rich Snippets - Google Structured Data
VirtueMart Products Extended - Slider with products, show Others bought, Products by CF ID and others filtering products

thefbi

#2
If i use the protostar template, when a product is out of stock, i can have an image i define in general config or per product, to say for example "3-4 days" as shipping delay.
With my custom template, this field dos not appear, so i want to put manually in the code. So i need the correct syntax to call this field if a product is not in stock.
See attachment, with protostar and my template.


pinochico

Look at the sublayout stockhandle.php

There is all codes. In our template we use override and change as we wish (we use info from ERP and then change code for this).
www.minijoomla.org  - new portal for Joomla!, Virtuemart and other extensions
XML Easy Feeder - feeds for FB, GMC,.. from products, categories, orders, users, articles, acymailing subscribers and database table
Virtuemart Email Manager - customs email templates
Import products for Virtuemart - from CSV and XML
Rich Snippets - Google Structured Data
VirtueMart Products Extended - Slider with products, show Others bought, Products by CF ID and others filtering products

thefbi

Yes, that what i did. But even with copy/past the whole code into my template, i have the information of all products...
And i cant override the general information, and the info is on all product, even if in stock...

So i dont understand...

thefbi

I got it !

I only have to put this code in my template :
<?php

echo shopFunctionsF::renderVmSubLayout('stockhandle',array('product'=>$this->product));

?>


And now it work fine.