What exactly are you trying to achieve? Why do you want external link?
Professional OpenCart extensions, support and custom work.
Contact me via email or Skype by support@thekrotek.com
So basically you want to display products from YOUR database, but Add to Cart button should redirect customer to 3rd party site?
Professional OpenCart extensions, support and custom work.
Contact me via email or Skype by support@thekrotek.com
Guess, in this case you need to have an extra field on product editing page, something like Redirect Link. You need to query this field on front-end and replace all occurrences of cart.add() functions in your template with this redirect link. It's not hard to do, but not something you can achieve without some knowledge in coding.
Professional OpenCart extensions, support and custom work.
Contact me via email or Skype by support@thekrotek.com
Did this on one of the sites I'm working on:
You can do something as easy as this in catalog/view/theme/mytheme/template/product/category.php & product.php (basically, anywhere that add to cart button shows - there's quite a few places; search engine, manufacturer pages, etc.):
Find:
Replace with:
That way, you can have both an affiliate field and your own products loading. If $affiliate_link returns blank, it defaults to the native add to cart button.
In line with thekrotek's suggestion (adding the field to the db, calling that field in the query returns from catalog/model/catalog/product.php & catalog/controller/product/product.php)Steyn wrote:Does anybody know of a free add to cart button redirect module to external link? If not, does anybody know how to manually change the link of the add to cart button on the product page? Ver 2.3.0.2
You can do something as easy as this in catalog/view/theme/mytheme/template/product/category.php & product.php (basically, anywhere that add to cart button shows - there's quite a few places; search engine, manufacturer pages, etc.):
Find:
Code: Select all
<button type="button" onclick="cart.add('<?php echo $product['product_id']; ?>', '<?php echo $product['minimum']; ?>');"><span class="hidden-xs hidden-sm hidden-md"><?php echo $button_cart; ?></span> <i class="fa fa-shopping-cart"></i></button>
Code: Select all
<?php
if ($affiliate_link) {
?>
<button type="button" onclick="location.href=('<?php echo $affiliate_link;?>');"><i class="fa fa-shopping-cart"></i> <span class="hidden-xs hidden-sm hidden-md"><?php echo $button_cart;?></span></button>
<?php } ?>
Files' extension is .tpl and there're also modules, don't forget them. Every module also have cart.add() function.angela wrote:You can do something as easy as this in catalog/view/theme/mytheme/template/product/category.php & product.php (basically, anywhere that add to cart button shows - there's quite a few places; search engine, manufacturer pages, etc.)
Professional OpenCart extensions, support and custom work.
Contact me via email or Skype by support@thekrotek.com
Who is online
Users browsing this forum: Baidu [Spider] and 62 guests