Latest products feeds
49 posts
• Page 1 of 3 • 1, 2, 3
Latest products feeds
Note: This is adapted from the original Module from krikey here http://www.opencart.com/index.php?route=extension/extension/info&extension_id=1540&filter_search=feed&sort=e.date_modified&order=DESC i wanted to post the code in the comments but it only allows 1000 characters max
To make this a valid RSS Feed I adapted the code a bit...
This is displaying:
Copyright
Language
Date Timestamp
Shop Logo
SEO Links
Product images (can be auto resized find "->resize($product['image'], 80, 80)" and change 80, 80 to what ever you want. Rss maximum allowed width 144/ height 400. )
Product price
Product description
Validates on http://validator.w3.org/feed/
Feeds are working for Facebook (Notes and RSSGraffiti)
Demo Feed can be seen here http://www.caprice-modeschmuck.de/index ... oducts_rss
Facebook Page here http://www.facebook.com/pages/Caprice-M ... 3201793290
copy and replace code in replace the code in catalog/controller/feed/latest_products_rss.php with the code below
To make this a valid RSS Feed I adapted the code a bit...
This is displaying:
Copyright
Language
Date Timestamp
Shop Logo
SEO Links
Product images (can be auto resized find "->resize($product['image'], 80, 80)" and change 80, 80 to what ever you want. Rss maximum allowed width 144/ height 400. )
Product price
Product description
Validates on http://validator.w3.org/feed/
Feeds are working for Facebook (Notes and RSSGraffiti)
Demo Feed can be seen here http://www.caprice-modeschmuck.de/index ... oducts_rss
Facebook Page here http://www.facebook.com/pages/Caprice-M ... 3201793290
copy and replace code in replace the code in catalog/controller/feed/latest_products_rss.php with the code below
- Code: Select all
<?php
class ControllerFeedLatestProductsRSS extends Controller {
public function index() {
if ($this->config->get('latest_products_rss_status')) {
$output = '<?xml version="1.0" encoding="UTF-8" ?>' . "\n";
$output .= '<rss version="2.0">' . "\n";
$output .= '<channel>' . "\n";
$output .= '<title>' . $this->config->get('config_name') . '</title>' . "\n";
$output .= '<copyright>' . 'Copyright (c) ' . date("Y") . ' ' . $this->config->get('config_name') . ' All rights reserved.' . '</copyright>' . "\n";
$output .= '<link>' . HTTP_SERVER . '</link>' . "\n";
$output .= '<description>' . $this->config->get('config_name') . ' Latest Products Feed' . '</description>' . "\n";
$output .= '<language>de-DE</language>' . "\n";
$output .= '<pubDate>' . gmdate("D\, d M Y H:i:s T") . '</pubDate>' . "\n";
$output .= '<image>' . "\n";
$output .= '<title>' . $this->config->get('config_name') . '</title>' . "\n";
$output .= '<width>142</width>' . "\n";
$output .= '<height>18</height>' . "\n";
$output .= '<link>' . HTTP_SERVER . '</link>' . "\n";
if( $this->config->get( 'config_logo' )
&& file_exists( DIR_IMAGE . $this->config->get( 'config_logo' ) ) ) {
$output .= '<url>' . HTTP_IMAGE . $this->config->get( 'config_logo' ) . '</url>' . "\n";
}else{
$output .= '<url> </url>' . "\n";
}
$output .= '</image>' . "\n";
$this->load->model('catalog/product');
$this->load->model('localisation/currency');
$this->load->model('tool/image');
$this->load->model('tool/seo_url');
$limit = $this->config->get('latest_products_rss_limit') ? $this->config->get('latest_products_rss_limit') : 100;
$products = $this->model_catalog_product->getLatestProducts($limit);
if (isset($this->request->get['currency'])) {
$currency = $this->request->get['currency'];
}
else {
$currency = $this->currency->getCode();
}
foreach ($products as $product) {
if ($product['description']) {
$output .= '<item>' . "\n";
$output .= '<title>' . html_entity_decode($product['name'], ENT_QUOTES, 'UTF-8') . '</title>' . "\n";
//$output .= '<link>' . HTTP_SERVER . 'index.php?route=product/product&product_id=' . $product['product_id'] . '</link>' . "\n";
$output .= '<link>' . str_replace('&', '&', $this->model_tool_seo_url->rewrite(HTTP_SERVER . 'index.php?route=product/product&product_id=' . $product['product_id'])) . '</link>';
$special = $this->model_catalog_product->getProductSpecial($product['product_id']);
if ($special) {
$price = $this->currency->format($this->tax->calculate($special, $product['tax_class_id']), $currency, FALSE, TRUE);
} else {
$price = $this->currency->format($this->tax->calculate($product['price'], $product['tax_class_id']), $currency, FALSE, TRUE);
}
$p = htmlspecialchars('<p><strong>Price: ' . $price . '</strong></p>');
//$output .= '<description>' . $p . $product['description'] . '</description>' . "\n";
$output .= '<description>';
if ($product['image']) {
$output .= '<a href="' . str_replace('&', '&', $this->model_tool_seo_url->rewrite(HTTP_SERVER . 'index.php?route=product/product&product_id=' . $product['product_id'])) . '">' . "\n";
$output .= '<img src="' . $this->model_tool_image->resize($product['image'], 80, 80) . '" border="0"/></a>' . $p . $product['description'] . '</description>' . "\n";
} else {
$output .= $p . $product['description'] . '</description>' . "\n";
}
$output .= '</item>' . "\n";
}
}
$output .= '</channel>' . "\n";
$output .= '</rss>' . "\n";
$this->response->addHeader('Content-Type: application/rss+xml');
$this->response->setOutput($output, 0);
}
}
}
?>
- tomtom
- Posts: 44
- Joined: Sun May 23, 2010 12:28 pm
Re: Latest products feeds
Thank you it's work perfectly
Do you plane to upgrade it for OC 1.5.1.x ?
Do you plane to upgrade it for OC 1.5.1.x ?
- FT Industriels
- Posts: 3
- Joined: Fri Jul 08, 2011 6:35 pm
- Location: Morocco
Re: Latest products feeds
Well, I have not switched over to 1.5 yet, but if I do I will and post it here.
- tomtom
- Posts: 44
- Joined: Sun May 23, 2010 12:28 pm
Re: Latest products feeds
Now compatible with v1.5.1.x (to avoid the error messages on screen). As for the content sides, a bit more work may be required.
- Attachments
-
Latest_products_RSS.zip- Compatible with v1.5.1.x
- (18.56 KiB) Downloaded 99 times
Regards,
Straightlight
Straightlight
- straightlight
- Posts: 1930
- Joined: Mon Nov 14, 2011 3:38 pm
- Location: Canada, ON
Re: Latest products feeds
Last edited by phatmaxi on Tue Dec 06, 2011 6:22 pm, edited 1 time in total.
- phatmaxi
- Posts: 14
- Joined: Sun Nov 27, 2011 9:49 pm
Re: Latest products feeds
If you're referring to my ZIP file above, the feed folder is not what has been specified as a folder from my package. Although, I can't neither reproduce the error you're encountering nor having a line 73 on the file since it rathers ends on line 59 ...
Regards,
Straightlight
Straightlight
- straightlight
- Posts: 1930
- Joined: Mon Nov 14, 2011 3:38 pm
- Location: Canada, ON
Re: Latest products feeds
straightlight wrote:If you're referring to my ZIP file above, the feed folder is not what has been specified as a folder from my package. Although, I can't neither reproduce the error you're encountering nor having a line 73 on the file since it rathers ends on line 59 ...
Not sure what you mean, my intention was to replicate the original extension and I accomplished that. The errors were from my playing around with the code. But the actual link is updated and valid. The goal is the have a starting point were we can all create a really nice rss feed. I have minimal php skills, this took some work for me. Check out the link:
http://rrautomotivegroup.com/shop/index.php?route=feed/latest_products_rss
What's Missing from the original is the SEO and Specials price... didn't have time to figure it out.
- Attachments
-
Latest_products_RSS.1.5.zip- My code for reference...
- (20.1 KiB) Downloaded 108 times
Last edited by phatmaxi on Tue Dec 06, 2011 7:03 pm, edited 2 times in total.
- phatmaxi
- Posts: 14
- Joined: Sun Nov 27, 2011 9:49 pm
Re: Latest products feeds
It's a bit clearer now that not only a URL has been posted. 

Regards,
Straightlight
Straightlight
- straightlight
- Posts: 1930
- Joined: Mon Nov 14, 2011 3:38 pm
- Location: Canada, ON
Re: Latest products feeds
straightlight wrote:It's a bit clearer now that not only a URL has been posted.
awesome- phatmaxi
- Posts: 14
- Joined: Sun Nov 27, 2011 9:49 pm
Re: Latest products feeds
Thank you for this modification.
I need to use url seo, do you know how can I do that ?
I need to use url seo, do you know how can I do that ?
- FTIndustriels
- Posts: 7
- Joined: Wed Jul 27, 2011 7:48 am
- Location: Morocco
Re: Latest products feeds
Any one can do that for us ?
- FTIndustriels
- Posts: 7
- Joined: Wed Jul 27, 2011 7:48 am
- Location: Morocco
Re: Latest products feeds
I install the model successfully in 1.5.1.3 , but can't enable it always. anyone know why?
- barryhung
- Posts: 2
- Joined: Sun Dec 18, 2011 4:39 pm
Re: Latest products feeds
I found the code in controller $this->config->get('rss_status') and anyone know where is the config I can found, DB or cache file?
- barryhung
- Posts: 2
- Joined: Sun Dec 18, 2011 4:39 pm
Re: Latest products feeds
In the setting table's value field from PHPMyAdmin, you will probably see it.
Regards,
Straightlight
Straightlight
- straightlight
- Posts: 1930
- Joined: Mon Nov 14, 2011 3:38 pm
- Location: Canada, ON
Re: Latest products feeds
Edit.
Oke I got it fixed!
dekloned.be/index.php?route=feed/latest_products_rss
It's showing the productinfo double; any ideas?
Oke I got it fixed!
dekloned.be/index.php?route=feed/latest_products_rss
It's showing the productinfo double; any ideas?
- dklnd
- Posts: 89
- Joined: Mon Nov 14, 2011 10:30 am
Re: Latest products feeds
Just by showing the RSS feeds won't really help to get the right information. The first things to know is starting from your 'got it fixed', what was the way to make that happen as a result of having double productinfo results ?
Regards,
Straightlight
Straightlight
- straightlight
- Posts: 1930
- Joined: Mon Nov 14, 2011 3:38 pm
- Location: Canada, ON
Re: Latest products feeds
anyone has figure it out the problem in enabling the plugin? I'm having the same issue of Barryhung on OC 1.5.1
- kralizec
- Posts: 7
- Joined: Fri Dec 30, 2011 10:58 am
Re: Latest products feeds
What is your version of what you did in order to get this problem ?
Regards,
Straightlight
Straightlight
- straightlight
- Posts: 1930
- Joined: Mon Nov 14, 2011 3:38 pm
- Location: Canada, ON
49 posts
• Page 1 of 3 • 1, 2, 3
Who is online
Users browsing this forum: fma1955 and 5 guests













