0

On the category page I have a quick shop "Add to Cart" button, which adds one type of the product to the cart for virtual and simple products. Instead I would like this button to simply make it open the product. Below is my code;

<?php if($_product->isSaleable()): ?>
    <?php if ( !($_product->getTypeInstance(true)->hasRequiredOptions($_product)
    || $_product->isGrouped()) ): ?>

    <button rel="tooltip" data-placement="top" type="button" 
    title="<?php echo $this->__('Add to Cart') ?>" class="btn-cart lort" 
    onclick="setLocation('<?php echo $this->getAddToCartUrl($_product) ?>')">
    <span><span><?php echo $this->__('Add to Cart') ?></span></span></button>

How can I change that?

1

Try using

<?php if($_product->isSaleable()): ?>
    <?php if ( !($_product->getTypeInstance(true)->hasRequiredOptions($_product)
    || $_product->isGrouped()) ): ?>

    <button rel="tooltip" data-placement="top" type="button" 
    title="<?php echo $this->__('Add to Cart') ?>" class="btn-cart lort" 
    onclick="setLocation('<?php echo $_product->getUrlInStore() ?>')">
    <span><span><?php echo $this->__('Add to Cart') ?></span></span></button>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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