0
votes

I want to insert some text directly below the tier price html if there is tier price info for item. So I am looking for code for a if then. This is what I have so far but it is not working. I am getting TEST for every product and not just for the tier price products.

<?php if ($this->getTierPriceHtml()):?>
<h2><?php echo $this->__('TEST') ?></h2>
<?php endif; ?>
1

1 Answers

0
votes

If you inspect the value returned by

$this->getTierPriceHtml()

when it is empty you will see that it is returning blank html with lots of spaces.Thats why when you cneck for

if ($this->getTierPriceHtml()):

always return true because there is blank spaces.

So first check like below

       $tier = $this->getTierPriceHtml();                    
                             $string = preg_replace('/\s+/', '', $tier);//This will remove all spaces
                             if($string!=""){
                                 echo $this->__('TEST');
                              }

Hope this will help.