Magento Forum

   
Page 2 of 3
How do I hide prices and Add To Cart button? 
 
phprelated
Jr. Member
 
Avatar
Total Posts:  21
Joined:  2009-01-30
Romania
 

Check this extension too. Might be useful for hiding prices and not allowing to add products to cart before someone logs in:

http://phprelated.myworks.ro/products-page/magento-extensions/prices-after-login/
http://www.magentocommerce.com/magento-connect/phprelated/extension/6495/prices_after_login

 
Magento Community Magento Community
Magento Community
Magento Community
 
Ravi Goswami
Jr. Member
 
Avatar
Total Posts:  20
Joined:  2010-03-11
 

Thanks szotyi

All your changes plus needs to change app/design/frontend/your_interface/your_theme/template/catalog/product/compare/list.phtml

szotyi - 24 December 2008 01:32 PM

hiding price:
app/design/frontend/default/default/template/catalog/product/price.phtml
insert at the very beggining of the file:

<?php if (Mage::getSingleton('customer/session')->isLoggedIn()) { ?>
insert at the very end of the file
<?php } ?>

hiding add to cart:
app/design/frontend/default/default/template/catalog/product/list.phtml
<?php if($_product->isSaleable()): ?>
                    
<button class="form-button" onclick="setLocation('<?php echo $this->getAddToCartUrl($_product) ?>')"><span><?php echo $this->__('Add to Cart'?></span></button>
                
<?php else: ?>
                
<div class="out-of-stock"><?php echo $this->__('Out of stock'?></div>
                
<?php endif; ?>

before that code insert:
<?php if (Mage::getSingleton('customer/session')->isLoggedIn()) { ?>
after that code insert:
<?php } ?>

you will find two times in the file..(one for the list mode one for grid mode!)

app/design/frontend/default/default/template/catalog/product/view.phtml

<div class="add-to-holder">
                    
<?php if($_product->isSaleable()): ?>
                        <?php 
echo $this->getChildHtml('addtocart'?>
                        <?php 
if( $this->helper('wishlist')->isAllow() || $_compareUrl=$this->helper('catalog/product_compare')->getAddUrl($_product)): ?>
                            
<span class="add-or"><?php // echo $this->__('OR') ?></span>
                        
<?php endif; ?>
                    <?php 
endif; ?>
                    <?php 
echo $this->getChildHtml('addto'?>
                
</div>

before that code insert:
<?php if (Mage::getSingleton('customer/session')->isLoggedIn()) { ?>
after that code insert:
<?php } ?>


if you have tier prices etc.. you have to use the same trick in the other files. u can find them in one of this files in the folder:
app/design/frontend/default/default/template/catalog/product/
i think thats it…

 
Magento Community Magento Community
Magento Community
Magento Community
 
Webtex
Sr. Member
 
Avatar
Total Posts:  219
Joined:  2010-06-05
Minneapolis, USA
 

Hello,
This feature is now available in Customer Group Prices extension: http://www.magentocommerce.com/magento-connect/customer-group-prices.html.
Hopefully it will help.

 
Magento Community Magento Community
Magento Community
Magento Community
 
ualinker
Jr. Member
 
Avatar
Total Posts:  2
Joined:  2011-06-28
 

Sorry for bringing this topic up (it was a while since last reply) but I think this could help someone because link to this thread pops up first in Google. To easily solve this problem I’ve developed a free extension which you can check here:
PriceWatchdog

 
Magento Community Magento Community
Magento Community
Magento Community
 
2o11
Jr. Member
 
Total Posts:  1
Joined:  2011-02-08
 
ualinker - 12 July 2011 06:45 AM

Sorry for bringing this topic up (it was a while since last reply) but I think this could help someone because link to this thread pops up first in Google. To easily solve this problem I’ve developed a free extension which you can check here:
PriceWatchdog

it doesn’t work, sorry!

 
Magento Community Magento Community
Magento Community
Magento Community
 
llourenzo
Jr. Member
 
Total Posts:  9
Joined:  2011-07-15
 

Thank you so much !!! you guys are amazinG!!!! and for those guys really new on this like me… remember that the folder strings might be different if you had a different installed theme, as hellothemes , so will be something like default/hellowired/templates/…
Thank you agian and keep it up ! it works perfect in V 1.5.1.0rc
Blessings!!! Keep it up!!!

still looking for a solution to wholesale/retail site

different price and special login / registration for wholesale

I will really apreciatte any tip. Thank you!

 
Magento Community Magento Community
Magento Community
Magento Community
 
mcelsouth
Jr. Member
 
Total Posts:  3
Joined:  2011-04-03
 

Great code - thank you - works perfectly.

BUT I need a bit more please!!

If the user is not logged in, can I show a message where the price should be? For instance, “log in to view prices”

At the moment the area is blank, and my users are confused as to what they need to do....

Thank so much in advance - so helpful so far! grin

 
Magento Community Magento Community
Magento Community
Magento Community
 
grafician
Jr. Member
 
Total Posts:  2
Joined:  2011-10-13
 

@szotyi - lovely man, +100rep smile when i can - works on 1.4.2.0 - only problem was my custom template and your view.phtml is my featured_products.phtml
and second problem was that i have add-to-boxes instead of add-to-holder but works fine before that

 
Magento Community Magento Community
Magento Community
Magento Community
 
Webtex
Sr. Member
 
Avatar
Total Posts:  219
Joined:  2010-06-05
Minneapolis, USA
 

Hi guys,

Our extension allows to hide prices and show “You should login to see price”.

Regards, Alex

 
Magento Community Magento Community
Magento Community
Magento Community
 
mrcobcorals
Jr. Member
 
Total Posts:  3
Joined:  2010-11-02
 
Harish Namireddy -

To add the text “You should Log in to see the price”: just add the following to the end of app/design/frontend/default/default/template/catalog/product/price.phtml after following szotyi solution below.

<?php if (!Mage::getSingleton('customer/session')->isLoggedIn()) { ?>
<span id="loginSeePrice"><a href="/customer/account/login/">Login to see the price</a></span
<?php } ?>

Ravi Goswami - 27 May 2011 11:14 AM

Thanks szotyi

All your changes plus needs to change app/design/frontend/your_interface/your_theme/template/catalog/product/compare/list.phtml


szotyi - 24 December 2008 01:32 PM
hiding price:
app/design/frontend/default/default/template/catalog/product/price.phtml
insert at the very beggining of the file:
<?php if (Mage::getSingleton('customer/session')->isLoggedIn()) { ?>
insert at the very end of the file
<?php } ?>

hiding add to cart:
app/design/frontend/default/default/template/catalog/product/list.phtml
<?php if($_product->isSaleable()): ?>
                    
<button class="form-button" onclick="setLocation('<?php echo $this->getAddToCartUrl($_product) ?>')"><span><?php echo $this->__('Add to Cart'?></span></button>
                
<?php else: ?>
                
<div class="out-of-stock"><?php echo $this->__('Out of stock'?></div>
                
<?php endif; ?>

before that code insert:
<?php if (Mage::getSingleton('customer/session')->isLoggedIn()) { ?>
after that code insert:
<?php } ?>

you will find two times in the file..(one for the list mode one for grid mode!)

app/design/frontend/default/default/template/catalog/product/view.phtml

<div class="add-to-holder">
                    
<?php if($_product->isSaleable()): ?>
                        <?php 
echo $this->getChildHtml('addtocart'?>
                        <?php 
if( $this->helper('wishlist')->isAllow() || $_compareUrl=$this->helper('catalog/product_compare')->getAddUrl($_product)): ?>
                            
<span class="add-or"><?php // echo $this->__('OR') ?></span>
                        
<?php endif; ?>
                    <?php 
endif; ?>
                    <?php 
echo $this->getChildHtml('addto'?>
                
</div>

before that code insert:
<?php if (Mage::getSingleton('customer/session')->isLoggedIn()) { ?>
after that code insert:
<?php } ?>


if you have tier prices etc.. you have to use the same trick in the other files. u can find them in one of this files in the folder:
app/design/frontend/default/default/template/catalog/product/
i think thats it…

 
Magento Community Magento Community
Magento Community
Magento Community
 
mrcobcorals
Jr. Member
 
Total Posts:  3
Joined:  2010-11-02
 

To add the text “You should Log in to see the price”: just add the following to the end of app/design/frontend/default/default/template/catalog/product/price.phtml after following szotyi solution in this thread.

<?php if (!Mage::getSingleton('customer/session')->isLoggedIn()) { ?>
<span id="loginSeePrice"><a href="/customer/account/login/">You should Log in to see the price</a></span
<?php } ?>

 
Magento Community Magento Community
Magento Community
Magento Community
 
longstone
Jr. Member
 
Total Posts:  11
Joined:  2011-01-02
 
mrcobcorals - 05 May 2012 10:55 PM

To add the text “You should Log in to see the price”: just add the following to the end of app/design/frontend/default/default/template/catalog/product/price.phtml after following szotyi solution in this thread.

<?php if (!Mage::getSingleton('customer/session')->isLoggedIn()) { ?>
<span id="loginSeePrice"><a href="/customer/account/login/">You should Log in to see the price</a></span
<?php } ?>

With multiple view I did:

<?php if (!Mage::getSingleton('customer/session')->isLoggedIn()) { ?>
<span id="loginSeePrice">
    
<?php 
        $helper 
Mage::helper("customer"); // gets Mage_Customer_Helper_Data
        
$url $helper->getLoginUrl();
    
?>
    
<a href="<?php echo $url; ?>">You should Log in to see the price</a>
</
span
<?php } ?>

Now only the translation is missing…
bye
Enrico

 
Magento Community Magento Community
Magento Community
Magento Community
 
botam
Jr. Member
 
Total Posts:  7
Joined:  2012-12-30
 

Is it just me or does anyone else get tik’d off when these guys butt into the forum trying to pitch their modules?

I know how to search the modules thank you and if I wanted to pay $99 or $199 for a snippet of code, I would go to the modules section and do just that.

Why don’t you guys run an ad with Google or something and stay out of the forums pitching your snippets!

thank you very much and why doesn’t Magento MODERATE these

 
Magento Community Magento Community
Magento Community
Magento Community
 
marionnex
Member
 
Total Posts:  38
Joined:  2012-03-30
 

Hello guys,

All of the solutions posted here are helpful and works on 1.7.2 however, I was wondering if this is possible:

Price and Add to cart button is invisible to
‘--Not Logged In
‘--General

Price and Add to cart button is visible to
‘--Specific Customer Group

Thank you so much.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Amasty
Mentor
 
Avatar
Total Posts:  3769
Joined:  2009-11-10
 

Hi!
You can get the functionality you are asking about with this module - Customer Group Catalog extension.

-Hide price block and ‘add to cart’ button
-Use a cms-block instead of price
-Redirect to a CMS page or show 404 error for products
-Remove product and category links.

For more details, userguide and live demo please follow the link http://amasty.com/customer-group-catalog.html

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
    Back to top
Page 2 of 3