Let's suppose I want to add a custom link to my product in M1, is there a way to do that? These products would be linked to an external site. I have two buttons on my website - Buy Now And Add to Cart. Buy now redirects customers directly to the checkout page.
I want this feature to function something like this:
If there is no custom URL entered in the backend, Magento should create product URL as it usually does and both buy now & add to cart button should appear.
If there is a custom product URL entered, Magento should use that link. ONLY 'buy now' button should appear in that case, and if customers click on buy now button, it should redirect them to the external website.
Here's the code in addtocart.phtml
<?php $_product = $this->getProduct(); ?>
<?php $buttonTitle = $this->__('Add to Cart'); ?>
<?php $buyNowTitle = $this->__('Buy Now'); ?>
<?php if($_product->isSaleable()): ?>
<div class="add-to-cart actions-wrapper">
<?php if(!$_product->isGrouped()): ?>
<input type="text" name="qty" id="qty" maxlength="12" value="<?php echo $this->getProductDefaultQty() * 1 ?>" title="<?php echo $this->__('Qty') ?>" class="input-text qty" />
<?php endif; ?>
<div style="display:inline-block;margin-top: 5px;">
<a title="<?php echo $buyNowTitle ?>" id="product-buynow-button" class="button btn-cart product-add-btn" onclick="productBuyNowForm.submit(this)"><span><span><?php echo $buyNowTitle ?></span></span></a>
<button type="button" title="<?php echo $buttonTitle ?>" id="product-addtocart-button" class="button btn-cart product-add-btn" onclick="productAddToCartForm.submit(this)"><span><span><?php echo $buttonTitle ?></span></span></button>
Buy Now
button and in which phtml ? – Pawan Apr 7 '19 at 14:42