Hello Readers,
Some times you need to Hide ‘Add to Cart’ button as per client requirement.
So, in this blog i will show you 'how to hide ‘Add to Cart’ button from the List/Category Page.
Go to /app/design/frontend/theme/default/template/catalog/product/list.phtml & search for the following code.
Replace below code->
<?php if($_product->isSaleable()): ?>
<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><br>
<?php else: ?>
<p class="availability out-of-stock"><span><?php echo $this->__('Out of stock') ?></span></p>
<?php endif; ?>
with->
Below code will hide ADD TO CART Button from List page for unregistered or non-login users.
<?php
if(!Mage::getSingleton('customer/session')->isLoggedIn()){
echo '<span class="login_for_details" style="float:left"><strong>Login to Add to Cart</strong></span>';
}
else{
?>
<?php if($_product->isSaleable()): ?>
<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><br>
<?php else: ?>
<p class="availability out-of-stock"><span><?php echo $this->__('Out of stock') ?></span></p>
<?php endif; ?>
<?php }?>
0 Comment(s)