关于让ecshop的feed.xml支持输出文章
2016-09-11 20:39 来源:www.chinab4c.com 作者:ecshop专家
ecshop的feed.xml.输出的全部都是商品,不输出文章的。但是我们频繁更新网站内容都是文章,相对来说文章收录也很好,那么如何把文章也加到这个总的feed.xml当中呢?
很简单,修改网站根目录下的feed.php文件,直接修改底部:
else
{
$in_cat = $cat > 0 ? ' AND ' . get_children($cat) : '';
$sql = 'SELECT c.cat_name, g.goods_id, g.goods_name, g.goods_brief, g.last_update ' .
'FROM ' . $ecs->table('category') . ' AS c, ' . $ecs->table('goods') . ' AS g ' .
'WHERE c.cat_id = g.cat_id AND g.is_delete = 0 AND g.is_alone_sale = 1 ' . $brd . $cat .
'ORDER BY g.last_update DESC';
$res = $db->query($sql);
if ($res !== false)
{
while ($row = $db->fetchRow($res))
{
$item_url = build_uri('goods', array('gid' => $row['goods_id']), $row['goods_name']);
$separator = (strpos($item_url, '?') === false)? '?' : '&';
$about = $uri . $item_url;
$title = htmlspecialchars($row['goods_name']);
$link = $uri . $item_url . $separator ;
$desc = htmlspecialchars($row['goods_brief']);
$subject = htmlspecialchars($row['cat_name']);
$date = local_date('r', $row['last_update']);
$rss->addItem($about, $title, $link, $desc, $subject, $date);
}
}
$sql = 'SELECT article_id, title, author, add_time' .
' FROM ' .$GLOBALS['ecs']->table('article') .
' WHERE is_open = 1' ;
$res = $db->query($sql);
if ($res !== false)
{
while ($row = $db->fetchRow($res))
{
$item_url = build_uri('article', array('aid' => $row['article_id']), $row['title']);
$separator = (strpos($item_url, '?') === false)? '?' : '&';
$about = $uri . $item_url;
$title = htmlspecialchars($row['title']);
$link = $uri . $item_url . $separator . 'from=rss';
$desc = '';
$subject = htmlspecialchars($row['author']);
$date = local_date('r', $row['add_time']);
$rss->addItem($about, $title, $link, $desc, $subject, $date);
}
}
$rss->outputRSS($ver);
}
就可以了,另外如何删除ecshop的feed.xml?from=rss,请看文章
最近更新
常用插件
- ecshop2.7.2生成虚拟订单2.
以前我们开发过ecshop下的虚拟订单,就是客户在访问的时候,会自动生...
- ecshop二次开发商品购买增
图片1香...
- ecshop2.7.1邮件发送插件
ecshop2.7.1邮件发送插件:该插件主要的开发思想是源于ecshop短信发送系统...
- ecshop最小购买数量控制插
ecshop最小购买数量控制插件,这个插件主要是为我们提供一个十分方便...
- ecshop没登陆情况下订单查
ecshop没登陆情况下订单查询插件,主要是针对ecshop在没有登陆的情况下...