VirtueMart Forum

VirtueMart 2 + 3 + 4 => Product pricing => Topic started by: marvays on January 30, 2017, 13:51:40 PM

Title: special text in product detail if price is 4000,- and more?
Post by: marvays on January 30, 2017, 13:51:40 PM
hi.
now i try set in product detail page default.php this code:
<div style="color: #F44336;font-weight: 700;">
<?php
   if(empty(
$this->product->prices) > 4000){ 
echo JText::_('COM_VIRTUEMART_CART_FREE_SHIPPING');
}?>

</div>


what is bad? nothing show for me :(

J!2.5.28 and VM 2.6.22 and VM 2.0.14
Title: Re: special text in product detail if price is 4000,- and more?
Post by: marvays on January 30, 2017, 16:43:19 PM
ok . . . this work for me in product detail page:
<div class="Doprava" style="color: #F44336;font-weight: 700;">
<?php // zobrazení dopravy zdarma
   if ($this->product->prices['salesPrice']>=4000 ){ 
echo JText::_('COM_VIRTUEMART_CART_FREE_SHIPPING');
}?>

</div>


but not in category page. why?
Title: Re: special text in product detail if price is 4000,- and more?
Post by: GJC Web Design on January 30, 2017, 23:04:58 PM
try

<div class="Doprava" style="color: #F44336;font-weight: 700;">
         <?php // zobrazení dopravy zdarma
      if ($product->prices['salesPrice']>=4000 ){
      echo JText::_('COM_VIRTUEMART_CART_FREE_SHIPPING');
      }?>
         </div>
Title: Re: special text in product detail if price is 4000,- and more?
Post by: marvays on January 31, 2017, 10:08:08 AM
Quote from: GJC Web Design on January 30, 2017, 23:04:58 PM
try

<div class="Doprava" style="color: #F44336;font-weight: 700;">
         <?php // zobrazení dopravy zdarma
      if ($product->prices['salesPrice']>=4000 ){
      echo JText::_('COM_VIRTUEMART_CART_FREE_SHIPPING');
      }?>
         </div>

work it :)

i must change to:
<?php if ($product->prices['salesPrice']>=4000 ){ ?>
<div class="Doprava-kategorie" ><div>Doprava zdarma</div></div>
<?php } ?>

thx alot
           <?php } ?>
Title: Re: special text in product detail if price is 4000,- and more?
Post by: Milbo on February 03, 2017, 10:11:44 AM
You should use vmdebug, that makes it easier, then you would have seen that prices is always an array and never empty
Title: Re: special text in product detail if price is 4000,- and more?
Post by: marvays on February 03, 2017, 10:16:38 AM
now i try make this code for cart . . . (free delivery price - add products = price to free delivery for this order) :)
Title: Re: special text in product detail if price is 4000,- and more?
Post by: Milbo on February 03, 2017, 13:44:45 PM
You should use the right option for it. and not write your own stuff. There is the optoin "free shipment if price is higher than" doing anything for you.
Title: Re: special text in product detail if price is 4000,- and more?
Post by: marvays on February 03, 2017, 13:55:43 PM
i know. But i have one website on joomla 2.5.28 and Vm 2.0.14