- Create the button to click
- Whenever the button is clicked. Create and set a session variable
that the price will not show like:
Mage::getSingleton(‘core/session’)->setMyValue("nopriceview");
- Have a check in the (category/view.phtml and product/view.phtml)
where if the session is active:
if (Mage::getSingleton('core/session')->getNoPriceView())
then add a container around the price and add inline css display none.
For example:
You have the hide price button inside a form.
<form name="priceView" action="" method="post" />
<input type="submit" value="submit" name="priceCheck" />
</form>
Then you also have PHP code to check if the form has been submitted.
<?php
if(!(isset($_SESSION["priceView"]))) {
$_SESSION["priceView"] = "yesPrice";
}
if (isset($_POST['priceCheck'])){
if($_SESSION["priceView"] == "yesPrice") {
$_SESSION["priceView"] = "noPrice";
} elseif($_SESSION["priceView"] == "noPrice") {
$_SESSION["priceView"] = "yesPrice";
}
}
?>
I'm using basic PHP but if you need this the Magento way we can do that also.