Php 隐藏未登录的层价格-目录权限扩展管理

Php 隐藏未登录的层价格-目录权限扩展管理,php,magento,Php,Magento,我正在使用aheadWorks的目录权限扩展来隐藏未登录客户的定价。但是,我也需要能够隐藏层次定价。PHP代码是什么,我将把它放在什么文件中?分层定价很好,但您不想向每个客户显示每个价格。要仅向登录的访问者显示分层定价,请转到:app/design/frontend/default/default/template/catalog/product/view/tierplices.phtml 在这个文件中,添加这个PHP函数 <?php if(Mage::getSingleton('cust

我正在使用aheadWorks的目录权限扩展来隐藏未登录客户的定价。但是,我也需要能够隐藏层次定价。PHP代码是什么,我将把它放在什么文件中?

分层定价很好,但您不想向每个客户显示每个价格。要仅向登录的访问者显示分层定价,请转到:
app/design/frontend/default/default/template/catalog/product/view/tierplices.phtml

在这个文件中,添加这个PHP函数

<?php if(Mage::getSingleton('customer/session')->isLoggedIn()):

然后在末尾添加此代码

<?php endif; ?>

创建您自己的布局文件,并在内部将您自己的模板文件设置为所需的条件

   <catalog_product_view>
       <reference name="core_reference_name">
          <action method="setTemplate">
            <template>yournamespace/catalog/product/view.phtml</template>
            </action>
        </reference>      
   </catalog_product_view>

yournamespace/catalog/product/view.phtml

在类别列表页面、产品视图页面和比较弹出窗口中隐藏价格。 按基本模块覆盖默认的Magento文件

为基本模块Hideproductprice创建文件夹和文件

app/etc/modules/Hideproductprice_Hideproductprice.xml
app/code/local/Hideproductprice/Hideproductprice/controllers/IndexController.php
app/code/local/Hideproductprice/Hideproductprice/etc/config.xml
app/code/local/Hideproductprice/Hideproductprice/Block/Index.php

app/design/frontend/base/default/layout/hideproductprice.xml
app/design/frontend/base/default/template/hideproductprice/price.phtml
1:在自定义模块布局文件中添加以下代码

(app/design/frontend/base/default/layout/hideproductprice.xml)
<default>
        <reference name="catalog_product_price_template">
            <action method="addPriceBlockType"><type>simple</type><block>catalog/product_price</block><template>hideproductprice/price.phtml</template></action>
            <action method="addPriceBlockType"><type>grouped</type><block>catalog/product_price</block><template>hideproductprice/price.phtml</template></action>
            <action method="addPriceBlockType"><type>configurable</type><block>catalog/product_price</block><template>hideproductprice/price.phtml</template></action>
            <action method="addPriceBlockType"><type>virtual</type><block>catalog/product_price</block><template>hideproductprice/price.phtml</template></action>
            <action method="addPriceBlockType"><type>bundled</type><block>catalog/product_price</block><template>hideproductprice/price.phtml</template></action>
        </reference>
  </default>

如果该函数只适用于一个类别,该怎么办?
(app/design/frontend/base/default/layout/hideproductprice.xml)
<default>
        <reference name="catalog_product_price_template">
            <action method="addPriceBlockType"><type>simple</type><block>catalog/product_price</block><template>hideproductprice/price.phtml</template></action>
            <action method="addPriceBlockType"><type>grouped</type><block>catalog/product_price</block><template>hideproductprice/price.phtml</template></action>
            <action method="addPriceBlockType"><type>configurable</type><block>catalog/product_price</block><template>hideproductprice/price.phtml</template></action>
            <action method="addPriceBlockType"><type>virtual</type><block>catalog/product_price</block><template>hideproductprice/price.phtml</template></action>
            <action method="addPriceBlockType"><type>bundled</type><block>catalog/product_price</block><template>hideproductprice/price.phtml</template></action>
        </reference>
  </default>
<?php
    if(!Mage::getSingleton('customer/session')->isLoggedIn()){
        echo '<span class="login_for_price"><b>Login to See Price</b></span><br>';
        return;
    }
    ?>
/* adding customer name section */       
        $customerFirstNameAttr = Mage::getSingleton('customer/customer')->getResource()->getAttribute('firstname');
        $collection->getSelect()
                            ->joinLeft(
                                array('cusFirstnameTb' => $customerFirstNameAttr->getBackend()->getTable()),
                                'main_table.customer_id = cusFirstnameTb.entity_id AND cusFirstnameTb.attribute_id = '.$customerFirstNameAttr->getId(). ' AND cusFirstnameTb.entity_type_id = '.Mage::getSingleton('customer/customer')->getResource()->getTypeId(),
                                array('customer_name' =>'cusFirstnameTb.value')
                            ); 
            /* end adding customer name section */