Hi again.
Now I trying write custom code to product detail page. i need show one image, if manufacturer have id 1.
But, my code not work :(
<div class="VyrobenoCR">
<?php // Czechia flag
if ($this->product->virtuemart_manufacturer_id==1 ){
echo '<img src="/templates/astroid_template_zero/html/com_virtuemart/assets/images/availability/flag-cr.png" />';
}?>
</div>
is your var correct and what is its value when u echo it out?
img path correct?
Maybe the / before the path /templates?
image got the right permissions?
on the product page
$this->product->virtuemart_manufacturer_id[0]
My friend of the Czech community VM advised me. I post here if someone liked it and wanted to use it.
<div class="VyrobenoCR">
<?php // Vyrobeno v ČR
$pole = $this->product->virtuemart_manufacturer_id;
$klic = array_search('1', $pole);
if (is_numeric($klic)){
echo '<img src="/templates/astroid_template_zero/html/com_virtuemart/assets/images/availability/vlajka-cr.png" />';
}?>
</div>
Very strange code ?
To be sure your link is right use JURI:root(true)
echo '<img src="'.JURI:root(true).'/templates/astroid_template_zero/html/com_virtuemart/assets/images/availability/vlajka-cr.png" />';
for $this->product->virtuemart_manufacturer_id convert to int to be sure
if ((int)$this->product->virtuemart_manufacturer_id===1 ){
So the final code should be
<div class="VyrobenoCR">
<?php
if ((int)$this->product->virtuemart_manufacturer_id===1 ){
echo '<img src="'.JURI:root(true).'/templates/astroid_template_zero/html/com_virtuemart/assets/images/availability/vlajka-cr.png" />';
} ?>
</div>
Note that i dont understand why you use the folder templates/astroid_template_zero/html/com_virtuemart/assets/images/availability
And not a shorter one.
templates/astroid_template_zero/images/virtuemart/manufacturer/vlajka-cr.png