Jump to content


Photo
- - - - -

idea for news + rss


7 replies to this topic

#1 Ivan Pramono Susanto

Ivan Pramono Susanto

    Advanced Member

  • Members
  • PipPipPip
  • 141 posts

Posted 07 November 2013 - 03:42 PM

since rss feed code i got from Max works like a charm

i just got an idea

if there's a similar mod that publish latest news into rss so we can use it to auto post and tweet


  • 0

#2 MaxD

MaxD

    Administrator

  • Administrators
  • 715 posts

Posted 09 November 2013 - 03:55 PM

Maybe there is some modification of fido-x news that does this. But I havn't met one


  • 0

#3 Ivan Pramono Susanto

Ivan Pramono Susanto

    Advanced Member

  • Members
  • PipPipPip
  • 141 posts

Posted 09 November 2013 - 07:19 PM

http://www.opencart....ilter_license=0

 

still learn how this mod make the rss feed.

i wonder if i can make a feed for news based from this mod

if we can make feed for news that would be great

the rss feed for news can be used for auto post and tweet at facebook with http://twitterfeed.com or similar services :D

gotta find which code does the grabbing data from database and code to make feeds and apply it to news

sounds simple but hard to be done by a dummy like me

lol

this first code is surely how to make the subscribe button

i edit it a little to change the icon

<!--
  Copyright (C) 2012 Tri Le <trile7 at gmail dot com>

  This program is free software: you can redistribute it and/or modify
  it under the terms of the GNU General Public License as published by
  the Free Software Foundation, either version 3 of the License, or
  (at your option) any later version.

  This program is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU General Public License for more details.

  You should have received a copy of the GNU General Public License
  along with this program.  If not, see <http://www.gnu.org/licenses/>
-->

<modification>
  <id>latest, featured, and special products rss feed</id>
  <version>0.2</version>
  <vqmver>2.1.7</vqmver>
  <author>Tri Le trile7 at gmail dot com</author>

  <file name="catalog/view/theme/*/template/module/featured.tpl">
    <operation>
      <search position="replace"><![CDATA[<?php echo $heading_title; ?>]]></search>
      <add><![CDATA[<?php echo "$heading_title <a href='".HTTP_SERVER."?rss=featured' title='Subscribe to Featured Products'><img src='/image/data/rss-icon.png' alt='Subscribe' /></a>"; ?>]]></add>
    </operation>
  </file>

  <file name="catalog/view/theme/*/template/module/latest.tpl">
    <operation>
      <search position="replace"><![CDATA[<?php echo $heading_title; ?>]]></search>
      <add><![CDATA[<?php echo "$heading_title <a href='".HTTP_SERVER."?rss=latest' title='Subscribe to Latest Products'><img src='/image/data/rss-icon.png' alt='Subscribe' /></a>"; ?>]]></add>
    </operation>
  </file>

  <file name="catalog/view/theme/*/template/module/special.tpl">
    <operation>
      <search position="replace"><![CDATA[<?php echo $heading_title; ?>]]></search>
      <add><![CDATA[<?php echo "$heading_title <a href='".HTTP_SERVER."?rss=special' title='Subscribe to Special Products'><img src='/image/data/rss-icon.png' alt='Subscribe' /></a>"; ?>]]></add>
    </operation>
  </file>

  <file name="catalog/view/theme/*/template/module/bestseller.tpl">
    <operation>
      <search position="replace"><![CDATA[<?php echo $heading_title; ?>]]></search>
      <add><![CDATA[<?php echo "$heading_title <a href='".HTTP_SERVER."?rss=bestseller' title='Subscribe to Bestseller Products'><img src='/image/data/rss-icon.png' alt='Subscribe' /></a>"; ?>]]></add>
    </operation>
  </file>

the rest of this one is still mystery XD

how to call the data for news based on this code

  <file name="catalog/controller/common/header.php">
    <operation>
      <search position="after">protected function index</search>
      <add><![CDATA[
        $rss = isset($this->request->get["rss"]) ? $this->request->get["rss"] : "";
        if ($rss=="latest" || $rss=="featured" || $rss=="special" || $rss=="bestseller") {
          $this->load->model("catalog/product");
          $this->load->model("localisation/currency");
          $this->load->model("tool/image");
          $this->data["products"] = array();

          $limit = 20;
          $image_width = 100;
          $image_height = 100;
          $currency = $this->currency->getCode();

          if ($rss=="latest") {
            $data = array("sort"  => "p.date_modified", "order" => "DESC", "start" => 0, "limit" => $limit);
            $products = $this->model_catalog_product->getProducts($data);
          }
          elseif ($rss=="featured") {
            $featured_products = explode(",", $this->config->get("featured_product"));
            $featured_products = array_slice($featured_products, 0, $limit);
            foreach ($featured_products as $product_id) $products[] = $this->model_catalog_product->getProduct($product_id);
          }
          elseif ($rss=="special") {
            $data = array("sort"  => "pd.name", "order" => "ASC", "start" => 0, "limit" => $limit);
            $products = $this->model_catalog_product->getProductSpecials($data);
          }
          elseif ($rss=="bestseller") {
            $data = array("sort"  => "pd.name", "order" => "ASC", "start" => 0, "limit" => $limit);
            $products = $this->model_catalog_product->getBestSellerProducts($limit);
          }

          $output = "<?xml version='1.0' encoding='UTF-8' ?>";
          $output .= "<rss version='2.0'>";
          $output .= "<channel>";
          $output .= "<title><![CDATA[" . $this->config->get("config_name") . " - $rss products]]]]><![CDATA[></title>";
          $output .= "<description><![CDATA[" . $this->config->get("config_meta_description") . "]]]]><![CDATA[></description>";
          $output .= "<link><![CDATA[" . HTTP_SERVER . "]]]]><![CDATA[></link>";
          foreach ($products as $product) {
            $title = $product["name"];
            $link = HTTP_SERVER . "?route=product/product&product_id=$product[product_id]";
            $price = $this->config->get("config_customer_price") ? false : $this->currency->format($this->tax->calculate($product["price"], $product["tax_class_id"], $this->config->get("config_tax")));
            $special = ((float)$product["special"]) ? $this->currency->format($this->tax->calculate($product["special"], $product["tax_class_id"], $this->config->get("config_tax"))) : false;
            $image_url = $this->model_tool_image->resize($product["image"], $image_width, $image_height);
            $description = "";
            if ($price) $description .= ($special) ? "<p><strong><span style='color:red; text-decoration:line-through;'>$price</span> $special</strong></p>" : "<p><strong>$price</strong></p>";
            if ($image_url) $description .= "<p><a href='$link'><img src='$image_url' alt=''></a></p>";
            if ($product["description"]) $description .= html_entity_decode($product["description"]);

            if ($rss!="special" || $special) {
              $output .= "<item>";
              $output .= "<title><![CDATA[$title]]]]><![CDATA[></title>";
              $output .= "<link><![CDATA[$link]]]]><![CDATA[></link>";
              $output .= "<description><![CDATA[$description]]]]><![CDATA[></description>";
              $output .= "<guid><![CDATA[$link]]]]><![CDATA[></guid>";
              $output .= "<pubDate>" . date("D, d M Y H:i:s O", strtotime($product["date_added"])) . "</pubDate>";
              $output .= "</item>";
            }
          }
          $output .= "</channel>";
          $output .= "</rss>";

          header("Content-Type: application/rss+xml");
          echo "$output";
          die();
        }
      ]]></add>
    </operation>
  </file>

</modification>

this one is surely the format of the feed if i'm not mistaken

              $output .= "<item>";
              $output .= "<title><![CDATA[$title]]]]><![CDATA[></title>";
              $output .= "<link><![CDATA[$link]]]]><![CDATA[></link>";
              $output .= "<description><![CDATA[$description]]]]><![CDATA[></description>";
              $output .= "<guid><![CDATA[$link]]]]><![CDATA[></guid>";
              $output .= "<pubDate>" . date("D, d M Y H:i:s O", strtotime($product["date_added"])) . "</pubDate>";
              $output .= "</item>";

the last one is the one that shout the feed

          header("Content-Type: application/rss+xml");
          echo "$output";
          die();
        }
      ]]></add>
    </operation>
  </file>

</modification>

still confused with

$this->load->

$this->data

and everything with $this does

 

difference of

$output =

and
$output .=

 

$xyz = is surely declaring something that's called xyz which will be used next

 

whoah so many of them still confusing

maybe i can become "confucius"ed

lol

 

wish me luck XD


  • 0

#4 Ivan Pramono Susanto

Ivan Pramono Susanto

    Advanced Member

  • Members
  • PipPipPip
  • 141 posts

Posted 13 November 2013 - 12:22 AM

yay since i'm not done with this and still strugling i found a nice module

pavblog is nice since it has rss feed in it when i try it's demo

and it's freeeeeeeeee

yay

thanks to pavblog

just download it and wanna try it

hope it works well

 

update:

ouch still buggy :(


Edited by Ivan Pramono Susanto, 13 November 2013 - 01:54 AM.

  • 0

#5 MaxD

MaxD

    Administrator

  • Administrators
  • 715 posts

Posted 13 November 2013 - 01:03 PM

Let me know when pavblog will become a nice replacement for OpenShop news module.

 

All $this-> ... things are simple refs to "global" objects (like request, session and so on). I don't know why Daniel decided to stuff them into controller object.

 

$a += 3; is equal to $a = $a + 3; 

$a .= "x"; is equal to $a = $a . "x";

 

Dot (.) is strings concantenation operand at PHP. "a" . "b" = "ab"


  • 1

#6 Ivan Pramono Susanto

Ivan Pramono Susanto

    Advanced Member

  • Members
  • PipPipPip
  • 141 posts

Posted 13 November 2013 - 01:30 PM

thanks for the tutorial

 

got a pavblog modified to russian and it works but i cannot read them >.<

i can create category with it but i haven't test it further since translation problem >.<

i think i got it from https://github.com/1...e-pav-blog-news and http://opencartforum...остей-pav-blog/

 

lots of free nice thing in http://opencartforum.ru

but not everything compatible >.< such as easy checkout it's great but i cannot make it work

then again it's language barrier >.< i cannot ask them >.<


Edited by Ivan Pramono Susanto, 13 November 2013 - 01:34 PM.

  • 0

#7 Ivan Pramono Susanto

Ivan Pramono Susanto

    Advanced Member

  • Members
  • PipPipPip
  • 141 posts

Posted 14 November 2013 - 06:07 AM

modification of rss still stuck on how to get news data >.<
button prepared

some still unknown because don't know how to get news data

function prepared but still some are mark unknown

XD

<!--
  Copyright (C) 2012 Tri Le <trile7 at gmail dot com>

  This program is free software: you can redistribute it and/or modify
  it under the terms of the GNU General Public License as published by
  the Free Software Foundation, either version 3 of the License, or
  (at your option) any later version.

  This program is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU General Public License for more details.

  You should have received a copy of the GNU General Public License
  along with this program.  If not, see <http://www.gnu.org/licenses/>
-->

<modification>
  <id>latest, featured, and special products rss feed</id>
  <version>0.2</version>
  <vqmver>2.1.7</vqmver>
  <author>Tri Le trile7 at gmail dot com</author>

  <file name="catalog/view/theme/*/template/module/featured.tpl">
    <operation>
      <search position="replace"><![CDATA[<?php echo $heading_title; ?>]]></search>
      <add><![CDATA[<?php echo "$heading_title <a href='".HTTP_SERVER."?rss=featured' title='Subscribe to Featured Products'><img src='/image/data/rss-icon.png' alt='Subscribe' /></a>"; ?>]]></add>
    </operation>
  </file>

  <file name="catalog/view/theme/*/template/module/latest.tpl">
    <operation>
      <search position="replace"><![CDATA[<?php echo $heading_title; ?>]]></search>
      <add><![CDATA[<?php echo "$heading_title <a href='".HTTP_SERVER."?rss=latest' title='Subscribe to Latest Products'><img src='/image/data/rss-icon.png' alt='Subscribe' /></a>"; ?>]]></add>
    </operation>
  </file>

  <file name="catalog/view/theme/*/template/module/news.tpl">
    <operation>
      <search position="replace"><![CDATA[<?php echo $customtitle; ?>]]></search>
      <add><![CDATA[<?php echo "$customtitle <a href='".HTTP_SERVER."?rss=news' title='Subscribe to News'><img src='/image/data/rss-icon.png' alt='Subscribe' /></a>"; ?>]]></add>
    </operation>
  </file>
  
  <file name="catalog/view/theme/*/template/module/special.tpl">
    <operation>
      <search position="replace"><![CDATA[<?php echo $heading_title; ?>]]></search>
      <add><![CDATA[<?php echo "$heading_title <a href='".HTTP_SERVER."?rss=special' title='Subscribe to Special Products'><img src='/image/data/rss-icon.png' alt='Subscribe' /></a>"; ?>]]></add>
    </operation>
  </file>

  <file name="catalog/view/theme/*/template/module/bestseller.tpl">
    <operation>
      <search position="replace"><![CDATA[<?php echo $heading_title; ?>]]></search>
      <add><![CDATA[<?php echo "$heading_title <a href='".HTTP_SERVER."?rss=bestseller' title='Subscribe to Bestseller Products'><img src='/image/data/rss-icon.png' alt='Subscribe' /></a>"; ?>]]></add>
    </operation>
  </file>

  <file name="catalog/controller/common/header.php">
    <operation>
      <search position="after">protected function index</search>
      <add><![CDATA[
        $rss = isset($this->request->get["rss"]) ? $this->request->get["rss"] : "";
        if ($rss=="latest" || $rss=="featured" || $rss=="special" || $rss=="bestseller" || $rss=="news") {
          $this->load->model("catalog/product");
          $this->load->model("localisation/currency");
          $this->load->model("tool/image");
          $this->data["products"] = array();

          $limit = 20;
          $image_width = 100;
          $image_height = 100;
          $currency = $this->currency->getCode();

          if ($rss=="latest") {
            $data = array("sort"  => "p.date_modified", "order" => "DESC", "start" => 0, "limit" => $limit);
            $products = $this->model_catalog_product->getProducts($data);
          }
          elseif ($rss=="featured") {
            $featured_products = explode(",", $this->config->get("featured_product"));
            $featured_products = array_slice($featured_products, 0, $limit);
            foreach ($featured_products as $product_id) $products[] = $this->model_catalog_product->getProduct($product_id);
          }
          elseif ($rss=="special") {
            $data = array("sort"  => "pd.name", "order" => "ASC", "start" => 0, "limit" => $limit);
            $products = $this->model_catalog_product->getProductSpecials($data);
          }
          elseif ($rss=="bestseller") {
            $data = array("sort"  => "pd.name", "order" => "ASC", "start" => 0, "limit" => $limit);
            $products = $this->model_catalog_product->getBestSellerProducts($limit);
          }
		  elseif ($rss=="news") {
		    $data = array("sort" => "date_added", "order" => "DESC", "start" => 0, "limit" => $limit);
			$news = $this->unknown;
		  }

          $output = "<?xml version='1.0' encoding='UTF-8' ?>";
          $output .= "<rss version='2.0'>";
          $output .= "<channel>";
          $output .= "<title><![CDATA[" . $this->config->get("config_name") . " - $rss update]]]]><![CDATA[></title>";
          $output .= "<description><![CDATA[" . $this->config->get("config_meta_description") . "]]]]><![CDATA[></description>";
          $output .= "<link><![CDATA[" . HTTP_SERVER . "]]]]><![CDATA[></link>";
		  if ($rss=="latest" || $rss=="featured" || $rss=="special" || $rss=="bestseller") {
		  foreach ($products as $product) {
            $title = $product["name"];
            $link = HTTP_SERVER . "?route=product/product&product_id=$product[product_id]";
            $price = $this->config->get("config_customer_price") ? false : $this->currency->format($this->tax->calculate($product["price"], $product["tax_class_id"], $this->config->get("config_tax")));
            $special = ((float)$product["special"]) ? $this->currency->format($this->tax->calculate($product["special"], $product["tax_class_id"], $this->config->get("config_tax"))) : false;
            $image_url = $this->model_tool_image->resize($product["image"], $image_width, $image_height);
            $description = "";
            if ($price) $description .= ($special) ? "<p><strong><span style='color:red; text-decoration:line-through;'>$price</span> $special</strong></p>" : "<p><strong>$price</strong></p>";
            if ($image_url) $description .= "<p><a href='$link'><img src='$image_url' alt=''></a></p>";
            if ($product["description"]) $description .= html_entity_decode($product["description"]);

            if ($rss!="special" || $special) {
              $output .= "<item>";
              $output .= "<title><![CDATA[$title]]]]><![CDATA[></title>";
              $output .= "<link><![CDATA[$link]]]]><![CDATA[></link>";
              $output .= "<description><![CDATA[$description]]]]><![CDATA[></description>";
              $output .= "<guid><![CDATA[$link]]]]><![CDATA[></guid>";
              $output .= "<pubDate>" . date("D, d M Y H:i:s O", strtotime($product["date_modified"])) . "</pubDate>";
              $output .= "</item>";
            }
          }
          $output .= "</channel>";
          $output .= "</rss>";

          header("Content-Type: application/rss+xml");
          echo "$output";
          die();
        }
		else if ($rss=="news") { 
		foreach ($news as $news) {
		  $show_headline = unknown;
		  $newslink = HTTP_SERVER . "?route=information/news&news_id=$news[news_id]";;
		  $news_story = unknown;
		      $output .= "<item>";
              $output .= "<title><![CDATA[$show_headline]]]]><![CDATA[></title>";
              $output .= "<link><![CDATA[$newslink]]]]><![CDATA[></link>";
              $output .= "<description><![CDATA[$news_story]]]]><![CDATA[></description>";
              $output .= "<guid><![CDATA[$newslink]]]]><![CDATA[></guid>";
              $output .= "<pubDate>" . date("D, d M Y H:i:s O", strtotime($news["date_added"])) . "</pubDate>";
              $output .= "</item>";
		}
		$output .= "</channel>";
        $output .= "</rss>";

        header("Content-Type: application/rss+xml");
        echo "$output";
        die();
		}
		}
      ]]></add>
    </operation>
  </file>

</modification> 

tested without error so far >.<

but the most importand and difficult things still missing and remain "unknown"

got to pray harder XD

if this mod is successful it will be a nice addition to openshop


Edited by Ivan Pramono Susanto, 14 November 2013 - 06:52 AM.

  • 0

#8 Ivan Pramono Susanto

Ivan Pramono Susanto

    Advanced Member

  • Members
  • PipPipPip
  • 141 posts

Posted 14 November 2013 - 07:39 AM

latest trial with news extension from http://www.opencart....ilter_license=0

this vqmod xml is working now thanks to GOD for gimmie a revelation and Max for gimmie some hint although i don't understand well $this function but at least it gimmie an idea XD

thank GOD thank GOD

praise the LORD

don't sell this vqmod please

feel free to modify but don't sell it please

because i'm poor and cannot afford premium script >.<

<!--
  Copyright (C) 2012 Tri Le <trile7 at gmail dot com>

  This program is free software: you can redistribute it and/or modify
  it under the terms of the GNU General Public License as published by
  the Free Software Foundation, either version 3 of the License, or
  (at your option) any later version.

  This program is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU General Public License for more details.

  You should have received a copy of the GNU General Public License
  along with this program.  If not, see <http://www.gnu.org/licenses/>
-->

<modification>
  <id>latest, featured, and special products rss feed + news rss</id>
  <version>0.2a</version>
  <vqmver>2.1.7</vqmver>
  <author>Tri Le trile7 at gmail dot com + MaxD for mod date + bonboncat with GOD help</author>

  <file name="catalog/view/theme/*/template/module/featured.tpl">
    <operation>
      <search position="replace"><![CDATA[<?php echo $heading_title; ?>]]></search>
      <add><![CDATA[<?php echo "$heading_title <a href='".HTTP_SERVER."?rss=featured' title='Subscribe to Featured Products'><img src='/image/data/rss-icon.png' alt='Subscribe' /></a>"; ?>]]></add>
    </operation>
  </file>

  <file name="catalog/view/theme/*/template/module/latest.tpl">
    <operation>
      <search position="replace"><![CDATA[<?php echo $heading_title; ?>]]></search>
      <add><![CDATA[<?php echo "$heading_title <a href='".HTTP_SERVER."?rss=latest' title='Subscribe to Latest Products'><img src='/image/data/rss-icon.png' alt='Subscribe' /></a>"; ?>]]></add>
    </operation>
  </file>

  <file name="catalog/view/theme/*/template/module/news.tpl">
    <operation>
      <search position="replace"><![CDATA[<?php echo $customtitle; ?>]]></search>
      <add><![CDATA[<?php echo "$customtitle <a href='".HTTP_SERVER."?rss=news' title='Subscribe to News'><img src='/image/data/rss-icon.png' alt='Subscribe' /></a>"; ?>]]></add>
    </operation>
  </file>
  
  <file name="catalog/view/theme/*/template/module/special.tpl">
    <operation>
      <search position="replace"><![CDATA[<?php echo $heading_title; ?>]]></search>
      <add><![CDATA[<?php echo "$heading_title <a href='".HTTP_SERVER."?rss=special' title='Subscribe to Special Products'><img src='/image/data/rss-icon.png' alt='Subscribe' /></a>"; ?>]]></add>
    </operation>
  </file>

  <file name="catalog/view/theme/*/template/module/bestseller.tpl">
    <operation>
      <search position="replace"><![CDATA[<?php echo $heading_title; ?>]]></search>
      <add><![CDATA[<?php echo "$heading_title <a href='".HTTP_SERVER."?rss=bestseller' title='Subscribe to Bestseller Products'><img src='/image/data/rss-icon.png' alt='Subscribe' /></a>"; ?>]]></add>
    </operation>
  </file>

  <file name="catalog/controller/common/header.php">
    <operation>
      <search position="after">protected function index</search>
      <add><![CDATA[
        $rss = isset($this->request->get["rss"]) ? $this->request->get["rss"] : "";
        if ($rss=="latest" || $rss=="featured" || $rss=="special" || $rss=="bestseller" || $rss=="news") {
          $this->load->model("catalog/product");
          $this->load->model("localisation/currency");
          $this->load->model("tool/image");
          $this->data["products"] = array();
 $this->load->model("catalog/news");
 $this->data["news"] = array ();

          $limit = 20;
          $image_width = 100;
          $image_height = 100;
          $currency = $this->currency->getCode();

          if ($rss=="latest") {
            $data = array("sort"  => "p.date_modified", "order" => "DESC", "start" => 0, "limit" => $limit);
            $products = $this->model_catalog_product->getProducts($data);
          }
          elseif ($rss=="featured") {
            $featured_products = explode(",", $this->config->get("featured_product"));
            $featured_products = array_slice($featured_products, 0, $limit);
            foreach ($featured_products as $product_id) $products[] = $this->model_catalog_product->getProduct($product_id);
          }
          elseif ($rss=="special") {
            $data = array("sort"  => "pd.name", "order" => "ASC", "start" => 0, "limit" => $limit);
            $products = $this->model_catalog_product->getProductSpecials($data);
          }
          elseif ($rss=="bestseller") {
            $data = array("sort"  => "pd.name", "order" => "ASC", "start" => 0, "limit" => $limit);
            $products = $this->model_catalog_product->getBestSellerProducts($limit);
          }
 elseif ($rss=="news") {
   $data = array("sort" => "date_added", "order" => "DESC", "start" => 0, "limit" => $limit);
$news = $this->model_catalog_news->getNews();
 }

          $output = "<?xml version='1.0' encoding='UTF-8' ?>";
          $output .= "<rss version='2.0'>";
          $output .= "<channel>";
          $output .= "<title><![CDATA[" . $this->config->get("config_name") . " - $rss update]]]]><![CDATA[></title>";
          $output .= "<description><![CDATA[" . $this->config->get("config_meta_description") . "]]]]><![CDATA[></description>";
          $output .= "<link><![CDATA[" . HTTP_SERVER . "]]]]><![CDATA[></link>";
 if ($rss=="latest" || $rss=="featured" || $rss=="special" || $rss=="bestseller") {
 foreach ($products as $product) {
            $title = $product["name"];
            $link = HTTP_SERVER . "?route=product/product&product_id=$product[product_id]";
            $price = $this->config->get("config_customer_price") ? false : $this->currency->format($this->tax->calculate($product["price"], $product["tax_class_id"], $this->config->get("config_tax")));
            $special = ((float)$product["special"]) ? $this->currency->format($this->tax->calculate($product["special"], $product["tax_class_id"], $this->config->get("config_tax"))) : false;
            $image_url = $this->model_tool_image->resize($product["image"], $image_width, $image_height);
            $description = "";
            if ($price) $description .= ($special) ? "<p><strong><span style='color:red; text-decoration:line-through;'>$price</span> $special</strong></p>" : "<p><strong>$price</strong></p>";
            if ($image_url) $description .= "<p><a href='$link'><img src='$image_url' alt=''></a></p>";
            if ($product["description"]) $description .= html_entity_decode($product["description"]);

            if ($rss!="special" || $special) {
              $output .= "<item>";
              $output .= "<title><![CDATA[$title]]]]><![CDATA[></title>";
              $output .= "<link><![CDATA[$link]]]]><![CDATA[></link>";
              $output .= "<description><![CDATA[$description]]]]><![CDATA[></description>";
              $output .= "<guid><![CDATA[$link]]]]><![CDATA[></guid>";
              $output .= "<pubDate>" . date("D, d M Y H:i:s O", strtotime($product["date_modified"])) . "</pubDate>";
              $output .= "</item>";
            }
          }
          $output .= "</channel>";
          $output .= "</rss>";

          header("Content-Type: application/rss+xml");
          echo "$output";
          die();
        }
else if ($rss=="news") { 
foreach ($news as $news) {
 $show_headline = $news["title"];
 $newslink = HTTP_SERVER . "?route=information/news&news_id=$news[news_id]";;
 $news_image = $this->model_tool_image->resize($news["image"], $image_width, $image_height);
 $news_story = html_entity_decode($news["description"]);
  if ($news_image) $news_story .= "<p><a href='$newslink'><img src='$news_image' alt=''></a></p>";
     $output .= "<item>";
              $output .= "<title><![CDATA[$show_headline]]]]><![CDATA[></title>";
              $output .= "<link><![CDATA[$newslink]]]]><![CDATA[></link>";
              $output .= "<description><![CDATA[$news_story]]]]><![CDATA[></description>";
              $output .= "<guid><![CDATA[$newslink]]]]><![CDATA[></guid>";
              $output .= "<pubDate>" . date("D, d M Y H:i:s O", strtotime($news["date_added"])) . "</pubDate>";
              $output .= "</item>";
}
$output .= "</channel>";
        $output .= "</rss>";

        header("Content-Type: application/rss+xml");
        echo "$output";
        die();
}
}
      ]]></add>
    </operation>
  </file>

</modification>

case close

news + rss buttons completed

don't need pav blog unless i need category for news/blow

this solution is better since i got rss button in front as well

 

*added bonus*

use this sitemap generator

http://www.opencart....=sitemap&page=2

edit admin/model/tool/generate_sitemap.php and seo_url.php to add news sitemap

and viola

the greatest news mod i have XD

thank you so much Max


Edited by Ivan Pramono Susanto, 15 November 2013 - 01:58 AM.

  • 0



Reply to this topic



  



 

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

Community Skin by Fredson Nunes Junior