Hi ppl,
I want to echo a few different icons on categories page called from product_mpn BO;
The idea is if I put in MPN any number >1 it should echo the correspondent image
If MPN is 10 it should echo <img src="/images/icons/10.png">
If MPN is 11 it should echo <img src="/images/icons/11.png">
But it only echo <img src="/images/icons/.png">
(doesn't get the mpn content)
<?php if ($product->product_mpn >1) { ?>
<div class="mpn-promo"> <?php echo '<img src="images/icons/'. $product_mpn .'.png">'; ?></div>
<?php }?>
Thanks in advance
gpessoa
J3.9.12
VM3.4.2
maybe you should compare with correct type ?
$product->product_mpn >"1"
try also
echo '<pre>';
print_r($product);
echo '</pre>';
Jörgen @ Kreativ Fotografi
Not
echo '<img src="images/icons/'. $product_mpn .'.png">'
but
echo '<img src="images/icons/'. $product->product_mpn .'.png">
Hi again,
Thanks Studio 42, you make my day!
Is there a possibility to create an interval like:
<?php if ($product->product_mpn >1) echo promo1 div class (Works ok!)
something like this:
<?php if ($product->product_mpn >1 and <100) echo promo1 div class
<?php if ($product->product_mpn >101 and <200) echo promo2 div class
<?php if ($product->product_mpn >201 and <300) echo promo3 div class
Thanks in advance
gpessoa
J3.9.12
VM3.4.2
Try something like this
<?php
if (($product->product_mpn > '001') and ($product->product_mpn < '100')) {
echo 'Yourstuff 1';
} else if (($product->product_mpn >'101') and ($product->product_mpn < '200')) {
echo 'Yourstuff 2';
} else if (($product->product_mpn > '201') and ($product->product_mpn < '300')) {
echo 'Yourstuff 3';
}
?>
Jörgen @ Kreativ Fotografi