SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Guru rashidr's Avatar
    Join Date
    Jun 2004
    Posts
    643
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Prestashop 1.3 RSS Feed is not updating

    I am using Presta Shop 1.3 (Latest Version).
    My problem is 'My RSS Feed is not updating.' Please help me... I am screwed..

    Following is the code.

    PHP Code:
    <?php
    include(dirname(__FILE__).'/../../config/config.inc.php');
    require_once(
    dirname(__FILE__).'/../../init.php');

    // Get data
    $number = (intval(Tools::getValue('n')) ? intval(Tools::getValue('n')) : 10);
    $orderByValues = array(=> 'name'=> 'price'=> 'date_add'=> 'date_upd'=> 'position');
    $orderWayValues = array(=> 'ASC'=> 'DESC');
    $orderBy Tools::strtolower(Tools::getValue('orderby'$orderByValues[intval(Configuration::get('PS_PRODUCTS_ORDER_BY'))]));
    $orderWay Tools::strtoupper(Tools::getValue('orderway'$orderWayValues[intval(Configuration::get('PS_PRODUCTS_ORDER_WAY'))]));
    if (!
    in_array($orderBy$orderByValues))
        
    $orderBy $orderByValues[0];
    if (!
    in_array($orderWay$orderWayValues))
        
    $orderWay $orderWayValues[0];
    $id_category = (intval(Tools::getValue('id_category')) ? intval(Tools::getValue('id_category')) : 1);
    $products Product::getProducts(intval($cookie->id_lang), 0, ($number 10 10 $number), $orderBy$orderWay$id_categorytrue);
    $currency = new Currency(intval($cookie->id_currency));
    $affiliate = (Tools::getValue('ac') ? '?ac='.intval(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>
            <generator>PrestaShop</generator>
            <description>Apparels.....</description>
            <language><?php echo Language::getIsoById(intval($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(intval($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>";
            if (
    is_array($image) AND sizeof($image)) echo "&lt;img src=&quot;"._PS_BASE_URL_.__PS_BASE_URI__."img/p/".$image[0]['id_product']."-".$image[0]['id_image']."-small.jpg&quot; title=&quot;".str_replace('&'''$product['name'])."&quot; alt=&quot;thumb&quot; /&gt";
            echo 
    "<![CDATA[".$product['description_short']."]]></description>\n";
            echo 
    "\t\t\t<link><![CDATA[".htmlspecialchars($link->getproductLink($product['id_product'], $product['link_rewrite'], Category::getLinkRewrite(intval(Tools::getValue('id_category')), $cookie->id_lang))).$affiliate."]]></link>\n";
            echo 
    "\t\t</item>\n";
        }
    ?>
        </channel>
    </rss>

    and following is the output...

    HTML Code:
    <?xml version="1.0"  encoding="UTF-8"?>
    <rss version="2.0">
        <channel>
            <title><![CDATA[Styles Inn]]></title>
            <link>Removed.......</link>
            <generator>PrestaShop</generator>
            <description>Apparel</description>
            <language>en</language>
    
            <image>
                <title><![CDATA[Styles Inn]]></title>
                <url>img/logo.jpg</url>
                <link>Removed by Me</link>
            </image>
        </channel>
    </rss>

  2. #2
    SitePoint Wizard silver trophybronze trophy Cups's Avatar
    Join Date
    Oct 2006
    Location
    France, deep rural.
    Posts
    6,869
    Mentioned
    17 Post(s)
    Tagged
    1 Thread(s)
    so, your channel definition is working, and it is closing the xml file ok, you just have no payload?

    It looks as if your problem is elsewhere:

    try this:
    PHP Code:
    var_dump$products ) ; 
    just before your foreach loop.

  3. #3
    SitePoint Guru rashidr's Avatar
    Join Date
    Jun 2004
    Posts
    643
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Here is the output.

    PHP Code:
    array(0) {

    Just before this

    PHP Code:
        </channel


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •