0

having an issue displaying the best tier price in Magento 1.7

The code below works perfectly well but it's only getting the first array price, so it's not the best possible multi buy tier price.

<?php
                    /* get the data */


                    $my_tier_rocks = $this->getTierPrices();
                    if (!empty($my_tier_rocks)){
                        $my_tier_rocks = $this->getTierPrices();

                            // Notice you may not be using formated_price_incl_tax but other field.
                            $my_tier_rocks = $my_tier_rocks[0]['formated_price_incl_tax'];

                            $_savingPercent = round((($my_tier_rocks-$_finalPrice)/$my_tier_rocks)*100,1);

                    ?>
                    <? /* let's print the data */ ?>
                    <? /* Use the HTML you want just notice the $my_tier_rocks var */ ?>
                    <span class="cat_multibuyprice">                     
                        <span class="label"><?php echo $this->__('Multi Buy Price:') ?></span>
                        <span class="price"><?=$my_tier_rocks?></span>               
                    </span>

                    <?php $_savingAmount = $_regularPrice-$_finalPrice; ?>

                    <? } /*end showing tier prices */ ?>

Any help to show the best tier price would be great, thanks you in advance.

1

Ok, silly me, all I had to do is use end function in array.

simply like;

$my_tier_best_price = end($my_tier_rocks);
$my_tier_rocks = $my_tier_best_price['formated_price_incl_tax'];
$_savingPercent = round((($my_tier_rocks-$_finalPrice)/$my_tier_rocks)*100,1);

Works fine now, grabs the last array which will be the best price for that product in the multi / tier price. Best way I have found.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.