News:

You may pay someone to create your store, or you visit our seminar and become a professional yourself with the silver certification

Main Menu

"if" manufacturer id = 1

Started by marvays, November 08, 2018, 21:34:25 PM

Previous topic - Next topic

marvays

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==){ 
        echo '<img src="/templates/astroid_template_zero/html/com_virtuemart/assets/images/availability/flag-cr.png" />';
}?>

</div>

GJC Web Design

is your var correct and what is  its value when u echo it out? 
img path correct?
GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

StefanSTS

#2
Maybe the / before the path /templates?

image got the right permissions?
--
Stefan Schumacher
www.jooglies.com - VirtueMart Invoice Layouts

Please use only stable versions with even numbers for your live shop! Use Alpha versions only if you know what risk you are taking.

PRO

on the product page

$this->product->virtuemart_manufacturer_id[0]

marvays

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>



Studio 42

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===){
        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