Price display for login user
Define observers in your module config.xml
<?xml version="1.0"?>
<config>
<global>
<events>
<catalog_product_collection_load_after>
<observers>
<hide_price_list_collection>
<type>singleton</type>
<class>Invisibleman_Sample_Model_Observer</class>
<method>listCollection</method>
</hide_price_list_collection>
</observers>
</catalog_product_collection_load_after>
<catalog_product_load_after>
<observers>
<hide_price_product>
<type>singleton</type>
<class>Invisibleman_Sample_Model_Observer</class>
<method>productLoadAfter</method>
</hide_price_product>
</observers>
</catalog_product_load_after>
<catalog_product_is_salable_after>
<observers>
<addtocart_modify_saleable>
<type>singleton</type>
<class>Webalive_Customer_Model_Observer</class>
<method>modifySaleable</method>
</addtocart_modify_saleable>
</observers>
</catalog_product_is_salable_after>
</events>
</global>
</config>
And in observer class create methods:
class Invisibleman_Sample_Model_Observer {
public function listCollection(Varien_Event_Observer $observer)
{
if (!Mage::helper('customer')->isLoggedIn()) {
$collection = $observer->getEvent()->getCollection();
foreach ($collection->getItems() as $_item ) {
$_item->setCanShowPrice(false);
}
}
return $this;
}
public function productLoadAfter(Varien_Event_Observer $observer)
{
if (!Mage::helper('customer')->isLoggedIn()) {
$product = $observer->getEvent()->getProduct();
$product->setCanShowPrice(false);
}
return $this;
}
public function modifySaleable($observer){
if (!Mage::helper('customer')->isLoggedIn()) {
$saleable = $observer->getSalable();
$saleable->setIsSalable(false);
}
}
}