News:

Looking for documentation? Take a look on our wiki

Main Menu

Override VM assets in template?

Started by EvanGR, June 01, 2020, 13:21:05 PM

Previous topic - Next topic

EvanGR

Hello,

I had replaced some images in here:

/components/com_virtuemart/assets/images/availability

but it seems a VM update restored the default files.

Can I override these in my template instead, to avoid future issues? If so, how would I structure the path relative to the template?

Thanks!

AH

#1
Yes it is annoying - I had to be careful of this every time

NOTE that if you have category based template overrides - this will not work for you

You can store your availability images in /yourtemplate/images/availability
When you do this the product admin function looks for /yourtemplate/images/availability

If it finds it, it uses this for the config of products - BUT VM just does not carry this option through into the FE views !!


So stick you availability images in the template folder as shown above:
/yourtemplate/images/availability

Then use the available shopfunctions to determine if there is an availability images folder in your FE template 

By doing this to any place where you display FE availability images:-


$vmtemplate = VmTemplate::loadVmTemplateStyle();
$availabilityImagePath = shopFunctions::getAvailabilityIconUrl($vmtemplate);


Now you have the place where your template images are configured from in the FE

So just edit the display of the image:

From

if (!empty($this->product->product_availability)) { ?>
<div class="availability">
<?php echo (file_exists(JPATH_BASE $availabilityImagePath $product->product_availability)) ? JHtml::image(JURI::root() . $availabilityImagePath $product->product_availability$product->product_availability, array('class' => 'availability')) : vmText::_($product->product_availability); ?>
</div>


to


<?php
if (!empty($this->product->product_availability)) { ?>

<div class="availability">
<?php echo JHtml::image(JURI::root().$availabilityImagePath.$this->product->product_availability$this->product->product_availability, array('class' => 'availability')); ?>
</div>
<?php ?>


I have asked the team to look into this
Regards
A

Joomla 3.10.11
php 8.0

EvanGR

Thank you very much for the detailed reply. I was hoping for a simple answer, I hope this gets sorted soon.


AH

I dont think it is a priority!  So dont hold your breath.
Regards
A

Joomla 3.10.11
php 8.0