Product prices should visible after entering username and password as like admin panel
Question
If we visit magento site, Products "prices" or "add to cart button"[optional either one] should not visible on entire site[on product list page, product view page, featured products , everywhere.] after entering username and password only customers can see the products prices. [as like in admin panel login, but USername: & password box: should be on home page] ,
Please help me to find solution.
Solution
Then, You have to place the add to cart code in the
if($sessionCustomer->isLoggedIn())
{
<p><button type="button" title="<?php echo $this->__('Add to Cart') ?>" class="button btn-cart" onclick="setLocation('<?php echo $this->getAddToCartUrl($_product) ?>')"><span><span><?php echo $this->__('Add to Cart') ?></span></span></button></p>
}
in list.phtml
Then in View.phtml
if($sessionCustomer->isLoggedIn())
{
<?php echo $this->getChildHtml('addtocart') ?>
}
Try this code.
OTHER TIPS
You can use this code. Check whether the customer is logged in or not
List page
$sessionCustomer = Mage::getSingleton("customer/session");
if($sessionCustomer->isLoggedIn())
{
echo $this->getPriceHtml($_product, true);
}
View page
$sessionCustomer = Mage::getSingleton("customer/session");
if($sessionCustomer->isLoggedIn())
{
echo $this->getChildHtml('product_type_data');
}
I would recommend you to use one of the B2B extension available in the market. Below i have pasted the link of one of the free extension Sitewards B2B
It will cover your requirement well and you won't need to play dirty around code.
NOTE : This is a free extension and i am not in any way related with the ext developer. I have used it in one of the website and suggesting it from my experience