1

i have create custom button("live preview")on product page using following code

<?php 
    if($_product->getCustom_button()){ //yes or no button
?>
    <button type="button" title="<?php echo $_product->getCustom_button_name() ;?>" class="btn btn-default" onclick="window.open('<?php echo $_product->getCustom_button_url() ;?>')"><span><span><i class="icon-desktop"></i><?php echo $_product->getCustom_button_name() ;?></span></span></button>
<?php } ?>

how i can add this button on product category page button name is "live preview" i am using magento

image of custom button

  • Please let me know your code using on category page for this button – Purushotam Sharma Aug 8 '16 at 5:17
1

please use this code in you product display loop in list.phtml

<?php 
    $product = Mage::getModel('catalog/product')->load($_product->getId()); 
    if($product->getCustomButton()){ //yes or no button
?>
    <button type="button" title="<?php echo $product->getCustomButtonName() ;?>" class="btn btn-default" onclick="window.open('<?php echo $product->getCustomButtonUrl() ;?>')"><span><span><i class="icon-desktop"></i><?php echo $product->getCustomButtonName() ;?></span></span></button>
<?php } ?>
| improve this answer | |

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.