3

In order to show add to cart button in up sell products i have added an upsell.phtml file inside app/design/frontend/your_package/your_theme/template/catalog/product/list/

my code for upsell.phtml file is

<form action="<?php echo $this->getAddToCartUrl($_link) ?>" method="post" 
id="product_addtocart_form_<?php echo $_link->getId()?>"<?php if($_link-
>getOptions()): ?> enctype="multipart/form-data"<?php endif; ?>>

<?php if(!$_link->isGrouped()): ?>
<input type="text" name="qty" id="qty" maxlength="12" value="<?php echo 
($this->getMinimalQty($_link)?$this->getMinimalQty($_link):1) ?>" />
<label for="qty"><?php echo $this->__('Qty') ?>:</label>
<?php endif; ?>
<button type="button" onclick="this.form.submit()"><span><span><span><?php echo $this->__('Add to Cart') ?></span></span></span></button>

Unfortunately add to cart button is not showing up in upsell.phtml file. Please help me achieve this, thanks

1

1 Answer 1

3

find the items.phtml file in module catalog using template path hints ,here you can configure each products type (related,cross cell and up sell) inside switch case statements.select the product type and change:

$showCart = true;.

I recommend to extend the module in custom theme directory.This worked for me perfectly in product view page.

1
  • But it doesn't comes with Ajax Add to Cart implementation.
    – Aji
    Feb 4, 2020 at 10:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.