-2

I need to remove the "Add to Cart" button from the first product.

Plz see this image

Kindly guide me to edit the code in list.phtml file.

<p>
<?php 
if ($merchant_name){
?>
<a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->stripTags($_product->getName(), null, true) ?>">
<button type="button" title="View Product Detail" class="button btn-cart"><span><span>View Product Detail</span></span>
</button>
</a>
<?php }

if ($product = Mage::getModel('catalog/product')->load($_product->getId()));
{
?>
<?php if ($product->getIsEbayaffiliate()) { ?>

<a href="<?php echo $product->getProductUrl() ?>" title="<?php echo $this->stripTags($_product->getName(), null, true) ?>">
<button type="button" title="View Product Detail" class="button btn-cart"><span><span>View Product Detail</span></span>
</button>
</a>

<?php } else {  ?>
<button type="button" title="<?php echo $this->__('Add to Cart') ?>" class="button btn-cart" onclick="<?php if($enableAjax): ?>setLocationAjax<?php else: ?>setLocation<?php endif; ?>('<?php echo $this->getAddToCartUrl($_product) ?>','<?php echo $_product->getId()?>')"><span><span><?php echo $this->__('Add to Cart') ?></span></span>
</button>
<?php } ?>
<?php } ?>
</p>



<?php } else { ?>

<button type="button" title="<?php echo $this->__('Add to Cart') ?>" class="button btn-cart" onclick="<?php if($enableAjax): ?>showOptions('<?php echo $_product->getId()?>')<?php else: ?>setLocation('<?php echo $this->getAddToCartUrl($_product) ?>','<?php echo $_product->getId()?>')<?php endif;?>"><span><span><?php echo $this->__('Add to Cart') ?></span></span>
</button>

<a href='<?php echo $this->getUrl(' ajax/index/options ',array('product_id '=>$_product->getId()));?>' class='fancybox' id='fancybox<?php echo $_product->getId()?>' style="display: none;"><?php echo $this->__('Add to Cart') ?></a>

<?php }  ?>

<?php else: ?>

<p class="availability out-of-stock"><span><?php echo $this->__('Out of stock') ?></span></p>

<?php endif; ?>

Plz let me know if you need the full code.

Doodu
  • 107
  • 5

2 Answers2

0

Just remove the following code:

else {  ?>
<button type="button" title="<?php echo $this->__('Add to Cart') ?>"     class="button btn-cart" onclick="<?php if($enableAjax): ?>setLocationAjax<?php else: ?>setLocation<?php endif; ?>('<?php echo $this->getAddToCartUrl($_product) ?>','<?php echo $_product->getId()?>')"><span> <span><?php echo $this->__('Add to Cart') ?></span></span>
</button>
<?php } ?>

Please be aware of the braclets!

And remove the <button> some lines further:

<button type="button" title="<?php echo $this->__('Add to Cart') ?>" class="button btn-cart" onclick="<?php if($enableAjax): ?>showOptions('<?php echo $_product->getId()?>')<?php else: ?>setLocation('<?php echo $this->getAddToCartUrl($_product) ?>','<?php echo $_product->getId()?>')<?php endif;?>"><span><span><?php echo $this->__('Add to Cart') ?></span></span>

Daniel L.
  • 1
  • 1
-1

Parse error: syntax error, unexpected '}' There is some syntax error in your code. check all the braces between php and html to resolve it. after that, just remove the button tag which is of add to cart.

Zeshan Sajid
  • 559
  • 3
  • 14