Jump to content

RSS does not show the latest added products! (SOLVED)


Recommended Posts

Hi,

I am using prestashop 1.5.4.1 on a live server.

The problem is that, the rss page just shows the ten first products and does not shows the last ten added products.

http://www.artterest.../feeder/rss.php

 

Does anybody know how can I fix that?

By the way, the favicon of the site does not appear in rss page.

 

Thank you very much,

Mojtaba

Edited by mojtabam (see edit history)
Link to comment
Share on other sites

Hello, mojtabam

 

I go through the feeder module and saw that there are some parameter need to use . For better rss show. If that parameter do not provided they use default value.

 

What you can do by provided the parameter on feeder module i show some like example with your site..

1. no of product show on rss http://www.artterest...der/rss.php?n=2

it means i want to show 2 product on my rss

2. show particular category product http://www.artterest...p?id_category=2

If the category is not provided it will take the default home category product. (PS_HOME_CATEGORY)

 

Hope you understand. Here is the variables which feeder use for rss generate.

// Get data
$number = ((int)(Tools::getValue('n')) ? (int)(Tools::getValue('n')) : 10);
$orderBy = Tools::getProductsOrder('by', Tools::getValue('orderby'));
$orderWay = Tools::getProductsOrder('way', Tools::getValue('orderway'));
$id_category = ((int)(Tools::getValue('id_category')) ? (int)(Tools::getValue('id_category')) : Configuration::get('PS_HOME_CATEGORY'));
$products = Product::getProducts((int)Context::getContext()->language->id, 0, ($number > 10 ? 10 : $number), $orderBy, $orderWay, $id_category, true);
$currency = new Currency((int)Context::getContext()->currency->id);
$affiliate = (Tools::getValue('ac') ? '?ac='.(int)(Tools::getValue('ac')) : '');

Edited by smartdatasoft (see edit history)
Link to comment
Share on other sites

Hi,

 

Thank you very much.

Actually the problem is that it shows n-first products in each category when I use ?id_category or with other configurations.

Do you know what should I do to make it shows n-last number of products instead of first ones?

Because first products are always the same.

By the way, when I am adding products, I usually associate them to both home and one another category and make that other category their default category.

 

Thank you very much for your help

Mojtaba

Link to comment
Share on other sites

I am not getting n no of product . Do you want to show 10 or 20 product if so than

http://www.artterest.com/modules/feeder/rss.php?id_category=2

 

If got anser please marked as solved [solved] and also like the answer. So that other can know this is solved and expert can give concentration to other post. Without looking solved answer.

Edited by smartdatasoft (see edit history)
Link to comment
Share on other sites

after lots of study i am able to figure out how to do this. It is really difficult for normal customer to find this. The module need to be proper documentation.

 

Here is how you can achieve your goal.

 

1. want to show 10 product so parameter at the end will be.

http://localhost/prestashop/modules/feeder/rss.php?n=10

2. if you want to order your product asc oder

http://localhost/prestashop/modules/feeder/rss.php?n=10&orderby=id_product

3. If you want to descending order of the product by there product id than you need to do like .

http://localhost/prestashop/modules/feeder/rss.php?n=10&orderby=id_product&orderway=desc

 

So here is the parameter at a glance.

1.

n = how many no of product you want to show.

2.

orderby  how you like to short your rss by product id , name or other

supporter parameter for orderby

 

 

'id_product', 'price',  'date_add', 'date_upd'

 

supported sorting

'asc',   'desc'

 

Hope any one from now got a better help for feeder tutorial from this post . :)

Edited by smartdatasoft (see edit history)
  • Like 3
  • Thanks 1
Link to comment
Share on other sites

  • 5 months later...

Can anyone upload the RSS file please?

<?php
/*
* 2007-2013 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to [email protected] so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
*  @author PrestaShop SA <[email protected]>
*  @copyright  2007-2013 PrestaShop SA
*  @license    http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
*  International Registered Trademark & Property of PrestaShop SA
*/
include(dirname(__FILE__).'/../../config/config.inc.php');
require_once(dirname(__FILE__).'/../../init.php');

// Get data
$number = ((int)(Tools::getValue('n')) ? (int)(Tools::getValue('n')) : 10);
$orderBy = Tools::getProductsOrder('by', Tools::getValue('orderby'));
$orderWay = Tools::getProductsOrder('way', Tools::getValue('orderway'));
$id_category = ((int)(Tools::getValue('id_category')) ? (int)(Tools::getValue('id_category')) : Configuration::get('PS_HOME_CATEGORY'));
$products = Product::getProducts((int)Context::getContext()->language->id, 0, ($number > 10 ? 10 : $number), $orderBy, $orderWay, $id_category, true);
$currency = new Currency((int)Context::getContext()->currency->id);
$affiliate = (Tools::getValue('ac') ? '?ac='.(int)(Tools::getValue('ac')) : '');
$metas = Meta::getMetaByPage('index', (int)Context::getContext()->language->id);

// Send feed
header("Content-Type:text/xml; charset=utf-8");
echo '<?xml version="1.0" encoding="UTF-8"?>'."\n";
?>
<rss version="2.0">
	<channel>
		<title><![CDATA[<?php echo Configuration::get('PS_SHOP_NAME') ?>]]></title>
		<description><![CDATA[<?php echo $metas['description'] ?>]]></description>
		<link><?php echo _PS_BASE_URL_.__PS_BASE_URI__; ?></link>
		<webMaster><?php echo Configuration::get('PS_SHOP_EMAIL') ?></webMaster>
		<generator>PrestaShop</generator>
		<language><?php echo Context::getContext()->language->iso_code; ?></language>
		<image>
			<title><![CDATA[<?php echo Configuration::get('PS_SHOP_NAME') ?>]]></title>
			<url><?php echo _PS_BASE_URL_.__PS_BASE_URI__.'img/logo.jpg'; ?></url>
			<link><?php echo _PS_BASE_URL_.__PS_BASE_URI__; ?></link>
		</image>
<?php
	foreach ($products AS $product)
	{
		$image = Image::getImages((int)($cookie->id_lang), $product['id_product']);
		echo "\t\t<item>\n";
		echo "\t\t\t<title><![CDATA[".$product['name']." - ".html_entity_decode(Tools::displayPrice(Product::getPriceStatic($product['id_product']), $currency), ENT_COMPAT, 'UTF-8')." ]]></title>\n";
		echo "\t\t\t<description>";
		$cdata = true;
		if (is_array($image) AND sizeof($image))
		{
			$imageObj = new Image($image[0]['id_image']);
			echo "<![CDATA[<img src='"._PS_BASE_URL_._THEME_PROD_DIR_.$imageObj->getExistingImgPath()."-small_default.jpg' title='".str_replace('&', '', $product['name'])."' alt='thumb' />";
			$cdata = false;
		}
		if ($cdata)
			echo "<![CDATA[";
		echo $product['description_short']."]]></description>\n";

		echo "\t\t\t<link><![CDATA[".str_replace('&', '&', htmlspecialchars($link->getproductLink($product['id_product'], $product['link_rewrite'], Category::getLinkRewrite((int)($product['id_category_default']), $cookie->id_lang)))).$affiliate."]]></link>\n";
		echo "\t\t</item>\n";
	}
?>
	</channel>
</rss>

Link to comment
Share on other sites

  • 1 year later...

Hi this does not work for me PS1.6.0.5 . I dont have real latest products.
 
My solution is :
 
I have change
 
this
 

$products = Product::getProducts((int)Context::getContext()->language->id, 0, ($number > 10 ? 10 : $number), $orderBy, $orderWay, $id_category, true);

 
by
 

$products = Product::getNewProducts((int)Context::getContext()->language->id, 0,($number > 10 ? 10 : $number));

in RSS.php

 

You can check here : Fournisseur de tatouage temporaire

Real Last product

 

I hope this will help some poeple.

 

Regards

  • Like 1
Link to comment
Share on other sites

  • 1 year later...
×
×
  • Create New...