Skip to main content
For reference only. Please use a different board for new questions

Adding merchant logo's and links to the component

More
12 years 4 months ago - 12 years 4 weeks ago #6 by redactie
This feature allows to use the logo's and links configured in the 'merchant' section of the feed configuration in the components templates.
Basics:
Add to the top of your (new) tmpl file :
Code:
$this->feedinfo=$this->get( 'Feedinfo');
location is not important, just above the foreach loop.
Example to display the logo's
Code:
if (isset($this->feedinfo[$item['feed_id']]['merchant_img']) ) { echo '<a class="dflink merchantlink" href="'. $this->feedinfo[$item['feed_id']]['merchant_url'].'" rel="nofollow" target="_blank"> <img class="merchant_img" src="'. $this->feedinfo[$item['feed_id']]['merchant_img'] .'" alt="" /> </a>'; echo $this->feedinfo[$item['feed_id']]['merchant_description'] }

using merchant logo's might require tweaking the template and css


complete tested example based on default_full.php
  • save as default_merchant.php in JOOMLA-ROOT/components/com_datafeeds/views/items/tmpl
  • assign 'merchant' layout in menu configuration (display options)
  • Assign Merchant Url and Merchant Image in feed configuration

Code:
<?php // no direct acce defined('_JEXEC') or die('Restricted access'); # # Copyright brambring.nl # https://www.affiliatefeeds.nl # joomla@brambring.nl # $this->assignRef('feedinfo', $this->get( 'Feedinfo')); if ($this->pagination ) { $links= $this->pagination->getPagesLinks(); echo '<div class="pagination" id="datafeeds_top">'.$links.'</div>'; } echo '<div class="datafeeds_clear">'; $zebra=0; foreach ( $this->dataitems as $item ) : $zebra++; ?> <div class="datafeeds dfzebra<?php echo $zebra%2?>"> <h2><a target="_blank" class="dflink" href="<?php echo $item['url'];?>" rel="nofollow"><?php echo $item['title'];?></a></h2> <div class='datafeeds_description'> <?php echo $item['description']; if (isset($this->feedinfo[$item['feed_id']]['merchant_img']) ) { echo '<a class="dflink merchantlink" href="'. $this->feedinfo[$item['feed_id']]['merchant_url'].'" rel="nofollow" target="_blank"> <img class="merchant_img" src="'. $this->feedinfo[$item['feed_id']]['merchant_img'] .'" alt="" /> </a>'; } if ( $item['pprijs'] > 0 ) { printf ('<p class="prijs"><span>'.$this->where['currency_sign'].' %2.2f</span></p>',$item['pprijs']); } ?> <p class="datafeeds_more"><a class="dflink" href="<?php echo $item['url'];?>" target="_blank" rel="nofollow" title="<?php echo $alt;?>"><?php echo $this->more_text?></a></p> </div> <a class="dflink" href="<?php echo $item['url'];?>" rel="nofollow" target="_blank"> <img class="datafeeds_img" src="<?php echo $item['image']; ?>" </a> <div class="datafeeds_clear datafeeds_fix">&nbsp;</div> </div> <?php endforeach; ?> </div> <?php if ($this->pagination ) { echo '<div class="pagination" id="datafeeds_bottom">'.$links.'</div>'; }
Last edit: 12 years 4 weeks ago by redactie.

Please Log in to join the conversation.

More
12 years 3 months ago #45 by marius
Indeed great idea Bram , but to many feeds dont even include a logo. What then ??

Please Log in to join the conversation.

More
12 years 3 months ago #48 by redactie
This is about adding logo's manual using the feed configuration ( upper right section ) not automatic from the feed.

So you have to create and upload the logo's.

Please Log in to join the conversation.

More
12 years 3 months ago #49 by marius
ok, done all the above in default_full.php , the logo shows in the configuration, but not at the front...

Please Log in to join the conversation.

More
12 years 1 month ago - 12 years 1 month ago #494 by redsent
How easy would it be to change this to show the merchant logo only, as a list with the link to that merchants items within the component. Like a directory of merchants.

Could this also be used in the data_menu module as a directory on the side?

The component layout would be similar to the thumb layout but this would be replaced with the merchant image and the link would be to the merchant page in the component?

Tried this for the component but can't get the merchant image!
Code:
<?php // no direct acce defined('_JEXEC') or die('Restricted access'); # # Copyright brambring.nl # https://www.affiliatefeeds.nl # joomla@brambring.nl # $this->feedinfo=$this->get( 'Feedinfo'); if ($this->pagination ) { $links= $this->pagination->getPagesLinks(); echo '<div class="pagination" id="datafeeds_top">'.$links.'</div>'; } echo '<div class="datafeeds_clear">'; $baselink= $this->where['baselink']. $this->where['slug']; $next=$this->where['next_level']; foreach ( $this->dataitems as $item ) { if ($next <=9 && @$s1=$item[$this->where['fields'][$next]]) { $next_link=JRoute::_( $baselink."&". make_urlencoded(array("q$next"=>$s1))); $next_title=$s1; } $product_ref=$item['url']; $product_title=str_replace(array("'","&amp;","&"),array('`',"&","&amp;"),$item['title']); echo '<div class="datafeeds_thumb">'; if ( $s1 ) { echo ' <p class="datafeeds_thumb_p"><a title="'.$next_title.'" href="'.$next_link.'">'.$next_title.'</a></p>'; } else { echo ' <p class="datafeeds_thumb_p"></p>'; } echo '<a class="dflink" href="'.$product_ref.'" target="_blank" title="'.$product_title.'" rel="nofollow"> <img class="merchant_img" src="'. $this->feedinfo[$item['feed_id']]['merchant_img'] .'" alt="'.$item['feed'].'" /> </a></div>'; } ?> <div class="datafeeds_clear datafeeds_fix">&nbsp;</div></div> <?php if ($this->pagination ) { echo '<div class="pagination" id="datafeeds_bottom">'.$links.'</div>'; }
Last edit: 12 years 1 month ago by redactie. Reason: working example

Please Log in to join the conversation.

More
12 years 1 month ago #499 by redactie
Hi


I updated the code in your post that should show the image, although I can't test it properly.


however for this usage I would use merchant logo's 'by convention' and not from the database. saves a query.
Code:
<img class="merchant_img" src="/images/logos/'. strtolower(str_replace(' ''_',$item['feed'])) .'.jpg" alt="'.$item['feed'].'" />

So each feed name is converted to lower case and spaces are replaced with underscores. Redcoon -> /images/logos/redcoon.jpg, 'Big shopper' -> /images/logos/big_shopper.jpg

there is a module included to show the merchants : merchant layout
The following user(s) said Thank You: redsent

Please Log in to join the conversation.

Time to create page: 0.388 seconds