cancel
Showing results for 
Search instead for 
Did you mean: 

Remove add to Cart on Related Products Template

SOLVED

Remove add to Cart on Related Products Template

I have tried to use the getIsInStock to remove the add to cart button on the related product item but it is generating an error...

 

Fatal error: Method name must be a string in /path/to/file/product/list/related.phtml on line 75

 

 

Here is the code I am using:

 

<?php if($_item->$getIsInStock($product)=='1') : ?>
<div class="actions-inner">
<input name="qty" type="text" class="input-text qty" id="qty-<?php echo $product->getId(); ?>" value="1" />
<input type="hidden" class="product_id" value="<?php echo $product->getId() ?>"/>
<button class="button btn-cart" title="<?php echo $this->__('Add to Cart') ?>" type="submit">
<span><span><?php echo $this->__('Add to Cart') ?></span></span>
</button>

</div>
<?php endif; ?>

 

 

Thank You

1 ACCEPTED SOLUTION

Accepted Solutions

Re: Remove add to Cart on Related Products Template

Hi @Nexobus

 

   Replace your code with below code

 

<?php if($_item->getIsInStock($product)=='1') : ?>
            <div class="actions-inner">
            <input name="qty" type="text" class="input-text qty" id="qty-<?php echo $product->getId(); ?>" value="1" />
            <input type="hidden" class="product_id" value="<?php echo $product->getId() ?>"/>
            <button class="button btn-cart" title="<?php echo $this->__('Add to Cart') ?>" type="submit">
            <span><span><?php echo $this->__('Add to Cart') ?></span></span>
            </button>

            </div>
<?php endif; ?>

 

 

Query solved? Accept as Solution.Thanks
Eric Baily

View solution in original post

1 REPLY 1

Re: Remove add to Cart on Related Products Template

Hi @Nexobus

 

   Replace your code with below code

 

<?php if($_item->getIsInStock($product)=='1') : ?>
            <div class="actions-inner">
            <input name="qty" type="text" class="input-text qty" id="qty-<?php echo $product->getId(); ?>" value="1" />
            <input type="hidden" class="product_id" value="<?php echo $product->getId() ?>"/>
            <button class="button btn-cart" title="<?php echo $this->__('Add to Cart') ?>" type="submit">
            <span><span><?php echo $this->__('Add to Cart') ?></span></span>
            </button>

            </div>
<?php endif; ?>

 

 

Query solved? Accept as Solution.Thanks
Eric Baily