【问题标题】:how to view product price in right bar in magento product details page如何在magento产品详细信息页面的右侧栏中查看产品价格
【发布时间】:2014-04-29 10:59:49
【问题描述】:

如何在右侧栏中查看产品的产品价格,

在 Magento 产品详细信息页面中?

(我的详细信息页面是 2column-right)

如果有人知道,请帮助我,是否可能

谢谢

【问题讨论】:

    标签: magento


    【解决方案1】:

    先在catalog.xml(app/design/)下添加如下代码

    <catalog_product_view>
    .......
    <reference name="right">
                <block type="catalog/product_view" name="catalog.product.rightprice" before="-" template="catalog/product/view/rightprice.phtml"/>
            </reference>
    
     </catalog_product_view>
    

    catalog/product/view下创建一个phtml(rightprice.phtml)

    rightprice.phtml 的代码是

    echo Mage::registry('current_product')->getFinalPrice();
    

    还有更多详情,你可以试试这个

    if(Mage::registry('current_product')){
    $product=Mage::registry('current_product');
    $displayMinimalPrice = false;
    $idSuffix = '-right';
    
            $type_id = $product->getTypeId();
            if (Mage::helper('catalog')->canApplyMsrp($product)) {
                $realPriceHtml = $this->_preparePriceRenderer($type_id)
                    ->setProduct($product)
                    ->setDisplayMinimalPrice($displayMinimalPrice)
                    ->setIdSuffix($idSuffix)
                    ->setIsEmulateMode(true)
                    ->toHtml();
                $product->setAddToCartUrl($this->getAddToCartUrl($product));
                $product->setRealPriceHtml($realPriceHtml);
                $type_id = $this->_mapRenderer;
    
    
           echo   $this->_preparePriceRenderer($type_id)
                ->setProduct($product)
                ->setDisplayMinimalPrice($displayMinimalPrice)
                ->setIdSuffix($idSuffix)
                ->toHtml();
            }
    

    如果有任何问题,请告诉我

    【讨论】:

    • 这个工作但 formatCurrency() 不工作我遇到了一个小问题你能帮我吗?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2013-10-16
    • 1970-01-01
    • 2014-07-09
    • 1970-01-01
    • 2021-12-30
    • 2022-10-13
    • 1970-01-01
    相关资源
    最近更新 更多