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
Solved! Go to Solution.
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; ?>
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; ?>