1

Regarding to the post below, how can I add "Login to View Price" if the user is not signed in? What is the code?

Is there a way to hide prices?

Thank you in advance, Elvis

1
  • I would suggest you post here the code you've already tried. And in case you haven't tried anything yet, please do. Commented Sep 24, 2014 at 14:09

2 Answers 2

1

Edit /app/design/frontend///template/catalog/product/price.phtml When you can't find, copy from base.

Around line 56:

<?php if (!$_product->isGrouped()): ?>

change to:

<?php if (Mage::getSingleton('customer/session')->isLoggedIn()) : // look if logged in ?>
<?php if (!$_product->isGrouped()): ?>

and at the end of the file

<?php endif; /* if (!$_product->isGrouped()): */ ?>

change to :

<?php endif; /* if (!$_product->isGrouped()): */ ?>        
<?php else: ?>
    <a href="/customer/account/login/">Login to view price</a>
<?php endif; ?>

Not tested

1
  • although I think it'll work, please try to test your code before presenting it as an answer. Commented Sep 24, 2014 at 14:57
1

Your last lines must be:

<?php else: ?>
    <a href="/customer/account/login/">Login to view price</a>
<?php endif; ?>

After <?php } ?>

5
  • Thank you Henk. I implemented your code on the price.html file and did not see "Login to view price" when I was not logged in. Partial code below from price.phtml <?php if (Mage::getSingleton('customer/session')->isLoggedIn()) : // look if logged in ?> ente<?php if (!$_product->isGrouped()): ?> <?php $_weeeTaxAmount = $_weeeHelper->getAmountForDisplay($_product); ?> --------- <?php endif; /* if (!$_product->isGrouped()): */ ?> <?php else: ?> <a href="/customer/account/login/">Login to view price</a> <?php endif; ?> <?php } ?>
    – Elvis
    Commented Sep 24, 2014 at 18:17
  • Thanks Henk. I tried this and my product page does not render normally. The Description, Reviews and right rail were removed. I see only the product image, title, and stock availability.
    – Elvis
    Commented Sep 25, 2014 at 13:38
  • what is the URL?
    – Henk Valk
    Commented Oct 1, 2014 at 11:33
  • Thank you Henk. The URL test product page is e.dev25.com/index.php/test1/test1.html
    – Elvis
    Commented Oct 2, 2014 at 19:29
  • Why is there no pricebox in your theme?
    – Henk Valk
    Commented Oct 7, 2014 at 11:43

Not the answer you're looking for? Browse other questions tagged or ask your own question.