Magento视图没有显示适当的价格

时间:2013-01-24 16:38:36

标签: magento views

此文件(frontend / base / default / template / catalog / product / list.phtml)已被编辑,现在未显示正确的价格, http://www.personalproducts4u.co.uk/hotel-toiletries/au-lait

我在上面的文件中更改了第三个表格标签(仅第三个表格标签)并且价格显示所有相同(按折扣价格计算) 任何想法?

这是我更改的代码:(将其粘贴到列表文件的第三个表标签上)

 <table border="1" cellpadding="0" cellspacing="0">
                    <tr>
                        <th class="buy_heading">Buy</th>
                        <td class="buy_pay_content">1</td>
                     <?php 
                            /*foreach($tierPrices as $key=>$value) 
                            {
                                echo "<td class='buy_pay_content'>".number_format($tierPrices[$key]['price_qty'],0)."</td>";
                            } */
                        ?>
                        <?php
                     if(count($tierPrices)):
                     foreach($tierPrices as $key=>$value) 
                          {
                              echo "<td class='buy_pay_content'>";
                              echo number_format($tierPrices[$key]['price_qty'],0);
                              if($key == $count-1) 
                              {
                                    echo "+";
                              }
                              echo "</td>";
                          } 
                     else:
                    echo '<td class="buy_pay_content">5</td>
                     <td class="buy_pay_content">10+</td>';
                     endif; 

                      ?>
                        <td class="buy_pay_content">Quantity</td>
                    </tr>
                    <tr>
                        <th class="pay_heading">Pay</th>
                        <td class="buy_pay_content"><?php echo $this->getPriceHtml($_product) ?><?php //echo Mage::helper('core')->currency($_product->getPrice()) ; ?>

                        <?php //echo Mage::helper('core')->currency($_product->getPrice()) ; ?> <?php //echo $this->getPriceHtml($_product, true)

                         ?>
                        </td>
                       <?php 
                       $specialprices = Mage::getModel('catalog/product')->load($_product->getId())->getSpecialPrice(); 
                       if($specialprices)
                       {
                           $specialprice =$specialprices; 
                       }
                       else
                       {
                           $specialprice = 0;
                       }
                         if(count($tierPrices)):
                            foreach($tierPrices as $key=>$value) 
                            {
                                if($specialprice < $tierPrices[$key]['price'] && $specialprice != '0'):
                                //echo 'special less'.$specialprice;
                                ?>
                                <td class='buy_pay_content'><div class="price-box"> 
                                      <p class="old-price"><span id="old-price-182" class="price"> <?php echo Mage::helper('core')->currency($tierPrices[$key]['price']) ?> </span>  </p>
                                      <p class="special-price"> <span id="product-price-182" class="price"><?php echo Mage::helper('core')->currency($specialprice) ?></span></p>
                                   </div></td>
                                <?php
                                else:
                                ?>
                                <td class='buy_pay_content'><?php echo Mage::helper('core')->currency($tierPrices[$key]['price']) ?></td>
                                <?php
                                endif;
                                ?>


                            <?php } 
                            else:
                                echo "<td class='buy_pay_content'>".$this->getPriceHtml($_product, true)."</td>";
                                    echo "<td class='buy_pay_content'>".$this->getPriceHtml($_product, true)."</td>";
                            endif;
                        ?>

                        <td class="buy_pay_content"><input type="text" class="input-text qty" title="Qty" value="" maxlength="12" id="qty" name="qty"></td>
                    </tr>
                    </table>

1 个答案:

答案 0 :(得分:0)

问题似乎是getSpecialPrice()返回特价区域中的内容。我可能会弄错,但我不相信你可以在Magento提供特殊的分层价格。您仍然可以添加静态特价,但正如您已经体验过的那样,每次迭代都会显示相同的价格。

您可能需要某种自定义扩展程序或模板逻辑来正确显示此类销售。

我不确定您目前如何管理分层定价,但如果它是每个等级的固定百分比,您可以将分层价格设置为计算的销售价格,并通过除以每个分层折扣百分比来计算并显示原始等级价格并显示该号码。