0

I am trying to figure out how to format the tier pricing in Magento products detail page into a grid/table format. For example, I would like to have a Quantity Row, Price row, and discount row. And it about 5 columns. Is this possible? We sell products in bulk, so this layout is important. That would be great if someone can point me in the right direct. I am new to magento and finding the customization side of things difficult to pick up.

Thanks!

user2453902
  • 1
  • 1
  • 1

2 Answers2

2

I made the following template for my tierprices.phtml.
FYI I'm running Magento 1.8.x

<?php
$_product = $this->getProduct();
$_tierPrices = $this->getTierPrices();
if (count($_tierPrices) > 0):
    $_data = array();
    $_prevQty = 0;
    $_counter = 0;
    $_tierPrices = array_reverse($_tierPrices);
    foreach ($_tierPrices as $_index => $_price){
        $_counter++;
        if($_price['price_qty']>$_prevQty){
            if($_counter == 1){
                $label = $_price['price_qty'] . '+';
            } else {
                $label = $this->__('%d or less',$_price['price_qty']);
            }
            $_data[] = array('prev'=>$_prevQty,'next'=>$_price['price_qty'],'label'=>$label,'price'=>$_price['formated_price']);
            $_prevQty = $_price['price_qty'];
        } else {
            $label = $_price['price_qty'] . '-' . $_prevQty;
            $_data[] = array('prev'=>$_prevQty,'next'=>$_price['price_qty'],'label'=>$label,'price'=>$_price['formated_price']);
            $_prevQty = $_price['price_qty'];
        }
    }
    $_data = array_reverse($_data);
?>
    <table class="tiered-pricing">
        <tbody>
            <tr>
                <th>Quantity</th>
                <th>Price</th>
            </tr>
        <?php foreach ($_data as $_row): ?>
            <tr>
                <td><?php echo $_row['label']; ?></td>
                <td><?php echo $_row['price']; ?></td>
            </tr>
        <?php endforeach; ?>
        </tbody>
    </table>
<?php
endif;
?>

It makes a table version of the tiered pricing data.

daviddukeuk
  • 70
  • 1
  • 6
0

The following URL will be useful:

http://stackoverflow.com/questions/9257924/magento-tier-sales-prices

You can also modify the following template

magento/app/design/frontend/default/your_theme/template/catalog/product/view/tierprices.phtml

where you can loop through $_tierPrices array and generate html table element

CDspace
  • 2,639
  • 18
  • 30
  • 36
Dushyant Joshi
  • 3,672
  • 3
  • 28
  • 52