This commit is contained in:
rGaillard
2011-07-06 10:54:11 +00:00
parent 4d2c770c6f
commit 8fc7f11014
5398 changed files with 482149 additions and 0 deletions
+12
View File
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8" ?>
<module>
<name>feeder</name>
<displayName><![CDATA[RSS products feed]]></displayName>
<version><![CDATA[0.2]]></version>
<description><![CDATA[Generate a RSS products feed]]></description>
<author><![CDATA[PrestaShop]]></author>
<tab><![CDATA[front_office_features]]></tab>
<is_configurable>0</is_configurable>
<need_instance>0</need_instance>
<limited_countries></limited_countries>
</module>
+8
View File
@@ -0,0 +1,8 @@
<?php
global $_MODULE;
$_MODULE = array();
$_MODULE['<{feeder}prestashop>feeder_4dce2f12546b229088d3cc214c3c2f7d'] = 'RSS-Feeds für Produkte';
$_MODULE['<{feeder}prestashop>feeder_d70a880c7153de483014eababfa65f11'] = 'Generieren Sie ein RSS-Feed für Produkte';
?>
+4
View File
@@ -0,0 +1,4 @@
<?php
global $_MODULE;
$_MODULE = array();
+6
View File
@@ -0,0 +1,6 @@
<?php
global $_MODULE;
$_MODULE = array();
$_MODULE['<{feeder}prestashop>feeder_4dce2f12546b229088d3cc214c3c2f7d'] = 'Fuente de productos RSS';
$_MODULE['<{feeder}prestashop>feeder_d70a880c7153de483014eababfa65f11'] = 'Generar fuente de productos RSS';
+87
View File
@@ -0,0 +1,87 @@
<?php
/*
* 2007-2011 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 license@prestashop.com 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 <contact@prestashop.com>
* @copyright 2007-2011 PrestaShop SA
* @version Release: $Revision: 6844 $
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
if (!defined('_CAN_LOAD_FILES_'))
exit;
class Feeder extends Module
{
private $_postErrors = array();
public function __construct()
{
$this->name = 'feeder';
$this->tab = 'front_office_features';
$this->version = 0.2;
$this->author = 'PrestaShop';
$this->need_instance = 0;
$this->_directory = dirname(__FILE__).'/../../';
parent::__construct();
$this->displayName = $this->l('RSS products feed');
$this->description = $this->l('Generate a RSS products feed');
}
function install()
{
if (!parent::install())
return false;
if (!$this->registerHook('header'))
return false;
return true;
}
function hookHeader($params)
{
global $smarty, $cookie;
$id_category = (int)(Tools::getValue('id_category'));
if (!$id_category)
{
if (isset($_SERVER['HTTP_REFERER']) AND preg_match('!^(.*)\/([0-9]+)\-(.*[^\.])|(.*)id_category=([0-9]+)(.*)$!', $_SERVER['HTTP_REFERER'], $regs) AND !strstr($_SERVER['HTTP_REFERER'], '.html'))
{
if (isset($regs[2]) AND is_numeric($regs[2]))
$id_category = (int)($regs[2]);
elseif (isset($regs[5]) AND is_numeric($regs[5]))
$id_category = (int)($regs[5]);
}
elseif ($id_product = (int)(Tools::getValue('id_product')))
{
$product = new Product($id_product);
$id_category = $product->id_category_default;
}
}
$category = new Category($id_category);
$orderBy = Tools::getProductsOrder('by', Tools::getValue('orderby'));
$orderWay = Tools::getProductsOrder('way', Tools::getValue('orderway'));
$smarty->assign(array(
'feedUrl' => Tools::getShopDomain(true, true).__PS_BASE_URI__.'modules/'.$this->name.'/rss.php?id_category='.$id_category.'&amp;orderby='.$orderBy.'&amp;orderway='.$orderWay,
));
return $this->display(__FILE__, 'feederHeader.tpl');
}
}
+27
View File
@@ -0,0 +1,27 @@
{*
* 2007-2011 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 license@prestashop.com 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 <contact@prestashop.com>
* @copyright 2007-2011 PrestaShop SA
* @version Release: $Revision: 6844 $
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*}
<link rel="alternate" type="application/rss+xml" title="{$meta_title|escape:html:'UTF-8'}" href="{$feedUrl}" />
+6
View File
@@ -0,0 +1,6 @@
<?php
global $_MODULE;
$_MODULE = array();
$_MODULE['<{feeder}prestashop>feeder_4dce2f12546b229088d3cc214c3c2f7d'] = 'Flux RSS de produits';
$_MODULE['<{feeder}prestashop>feeder_d70a880c7153de483014eababfa65f11'] = 'Générer un Flux RSS de produits';
+8
View File
@@ -0,0 +1,8 @@
<?php
global $_MODULE;
$_MODULE = array();
$_MODULE['<{feeder}prestashop>feeder_4dce2f12546b229088d3cc214c3c2f7d'] = 'Feed RSS prodotti';
$_MODULE['<{feeder}prestashop>feeder_d70a880c7153de483014eababfa65f11'] = 'Crea un Feed RSS prodotti';
?>
Binary file not shown.

After

Width:  |  Height:  |  Size: 1009 B

+78
View File
@@ -0,0 +1,78 @@
<?php
/*
* 2007-2011 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 license@prestashop.com 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 <contact@prestashop.com>
* @copyright 2007-2011 PrestaShop SA
* @version Release: $Revision: 7310 $
* @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')) : 1);
$products = Product::getProducts((int)($cookie->id_lang), 0, ($number > 10 ? 10 : $number), $orderBy, $orderWay, $id_category, true);
$currency = new Currency((int)($cookie->id_currency));
$affiliate = (Tools::getValue('ac') ? '?ac='.(int)(Tools::getValue('ac')) : '');
// 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>
<link><?php echo _PS_BASE_URL_.__PS_BASE_URI__; ?></link>
<mail><?php echo Configuration::get('PS_SHOP_EMAIL') ?></mail>
<generator>PrestaShop</generator>
<language><?php echo Language::getIsoById((int)($cookie->id_lang)); ?></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.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[".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>