I felt this mod was needed as i dont like the way affiliates have to type a product name in to generate an affiliate product link.
This mod, adds a new link to the category page under the existing Compare and wish list links.
If an affiliate is logged in, a new link is generated called "Affiliate Link"
If a standard user or an affiliate is not logged in, the link is replaced with the affiliate login page and the text is changed to ask the user to login.
This mod is quite basic, and i plan to update it so the link opens a popup window with the link generated as plain text for the affiliate to copy.
I also plan to intergrate this into a social network share module.
catalog/view/theme/yourtheme/stylesheet/styesheet.css
find
Code: Select all
.product-list .wishlist, .product-list .compare {
margin-bottom: 3px;
}
Code: Select all
.product-list .wishlist, .product-list .compare , .product-list .affiliate {
margin-bottom: 3px;
}
Code: Select all
.product-list .affiliate a {
color: #333333;
text-decoration: none;
padding-left: 18px;
display: block;
background: url('../image/add.png') left center no-repeat;
}
Code: Select all
.product-grid .wishlist, .product-grid .compare {
margin-bottom: 3px;
}
Code: Select all
.product-grid .wishlist, .product-grid .compare , .product-grid .affiliate{
margin-bottom: 3px;
}
Code: Select all
.product-grid .affiliate a {
color: #333333;
text-decoration: none;
padding-left: 18px;
display: block;
background: url('../image/add.png') left center no-repeat;
}
add at the bottom before the last ?>
Code: Select all
$_['text_affiliate_login'] = 'Affiliate Login';
$_['text_affiliate_share'] = 'Affiliate Link';
find
Code: Select all
<div class="compare"><a onclick="addToCompare('<?php echo $product['product_id']; ?>');"><?php echo $button_compare; ?></a></div>
Code: Select all
<div class="affiliate"><a href="<?php echo $link; ?>"><?php echo $text_affiliate; ?></a></div>
Code: Select all
$('.product-list > div').each(function(index, element) {
html = '<div class="right">';
html += ' <div class="cart">' + $(element).find('.cart').html() + '</div>';
html += ' <div class="wishlist">' + $(element).find('.wishlist').html() + '</div>';
html += ' <div class="compare">' + $(element).find('.compare').html() + '</div>';
html += '</div>';
Code: Select all
$('.product-list > div').each(function(index, element) {
html = '<div class="right">';
html += ' <div class="cart">' + $(element).find('.cart').html() + '</div>';
html += ' <div class="wishlist">' + $(element).find('.wishlist').html() + '</div>';
html += ' <div class="compare">' + $(element).find('.compare').html() + '</div>';
html += ' <div class="affiliate">' + $(element).find('.affiliate').html() + '</div>';
html += '</div>';
Code: Select all
html += '<div class="cart">' + $(element).find('.cart').html() + '</div>';
html += '<div class="wishlist">' + $(element).find('.wishlist').html() + '</div>';
html += '<div class="compare">' + $(element).find('.compare').html() + '</div>';
Code: Select all
html += '<div class="cart">' + $(element).find('.cart').html() + '</div>';
html += '<div class="wishlist">' + $(element).find('.wishlist').html() + '</div>';
html += '<div class="compare">' + $(element).find('.compare').html() + '</div>';
html += '<div class="affiliate">' + $(element).find('.affiliate').html() + '</div>';
find
Code: Select all
$this->data['products'][] = array(
Code: Select all
if (!$this->affiliate->isLogged()) {
$this->data['link'] = $this->url->link('affiliate/login', '', 'SSL');
$this->data['text_affiliate'] = $this->language->get('text_affiliate_login');
} else {
$this->data['link'] = $this->url->link('product/product', 'product_id=' . $result['product_id'] . '&tracking=' . $this->affiliate->getCode());
$this->data['text_affiliate'] = $this->language->get('text_affiliate_share');
}
Or if you just wish to show the affiliate link to affiliates logged in, add this ABOVE
Code: Select all
if (!$this->affiliate->isLogged()) {
$this->data['link'] = '';
$this->data['text_affiliate'] = '';
} else {
$this->data['link'] = $this->url->link('product/product', 'product_id=' . $result['product_id'] . '&tracking=' . $this->affiliate->getCode());
$this->data['text_affiliate'] = $this->language->get('text_affiliate_share');
}