Author Topic: Availability field in custom template  (Read 150 times)

thefbi

  • Jr. Member
  • **
  • Posts: 178
Availability field in custom template
« on: July 02, 2020, 11:15:58 am »
Hello,
i need the availability field for products out of stock.

I try to add this code (find in the sublayout) in my template :
Code: [Select]
<?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

  • 3rd party VirtueMart Developer
  • Jr. Member
  • *
  • Posts: 481
    • MiniJoomla
  • VirtueMart Version: 3
Re: Availability field in custom template
« Reply #1 on: July 02, 2020, 12:43:42 pm »
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 from products, orders and database table
Virtuemart Email Manager - customs email templates

thefbi

  • Jr. Member
  • **
  • Posts: 178
Re: Availability field in custom template
« Reply #2 on: July 02, 2020, 13:21:46 pm »
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

  • 3rd party VirtueMart Developer
  • Jr. Member
  • *
  • Posts: 481
    • MiniJoomla
  • VirtueMart Version: 3
Re: Availability field in custom template
« Reply #3 on: July 02, 2020, 15:44:04 pm »
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 from products, orders and database table
Virtuemart Email Manager - customs email templates

thefbi

  • Jr. Member
  • **
  • Posts: 178
Re: Availability field in custom template
« Reply #4 on: Yesterday at 10:20:00 »
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

  • Jr. Member
  • **
  • Posts: 178
Re: Availability field in custom template
« Reply #5 on: Yesterday at 11:12:16 »
I got it !

I only have to put this code in my template :
Code: [Select]
<?php

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

?>

And now it work fine.