欢迎光临

木子屋

标题: ECShop v2.7.2商品详情页上一个下一个商品链接的title属性修改

作者: dnawo

日期: 2010-05-19 10:10 PM

分类: 程序修改

内容: ECShop v2.7.2商品内容页上一个下一个链接的title属性值默认是空的，有人说不利SEO，下边我们稍做修改，将商品名称做为title属性值：
①.打开goods.php文件，在208行附近找到下边代码：
复制内容到剪贴板 程序代码/* 上一个商品下一个商品 */
= ->getOne("Select goods_id FROM " .->table('goods'). " Where cat_id=" . ['cat_id'] . " AND goods_id > " . ['goods_id'] . " AND is_on_sale = 1 AND is_alone_sale = 1 AND is_delete = 0 LIMIT 1");
if (!empty())
{
['url'] = build_uri('goods', array('gid' => ), ['goods_name']);
->assign('prev_good', );//上一个商品
}
= ->getOne("Select max(goods_id) FROM " . ->table('goods') . " Where cat_id=".['cat_id']." AND goods_id < ".['goods_id'] . " AND is_on_sale = 1 AND is_alone_sale = 1 AND is_delete = 0");
if (!empty())
{
['url'] = build_uri('goods', array('gid' => ), ['goods_name']);
->assign('next_good', );//下一个商品
}
修改成：
复制内容到剪贴板 程序代码/* 上一个商品下一个商品 */
= ->getRow("Select goods_id,goods_name FROM " .->table('goods'). " Where cat_id=" . ['cat_id'] . " AND goods_id > " . ['goods_id'] . " AND is_on_sale = 1 AND is_alone_sale = 1 AND is_delete = 0 LIMIT 1");
if (!empty())
{
['url'] = build_uri('goods', array('gid' => ['goods_id']), ['goods_name']);
->assign('prev_good', );//上一个商品
}
= ->getRow("Select goods_id,goods_name FROM " . ->table('goods') . " Where cat_id=".['cat_id']." AND goods_id < ".['goods_id'] . " AND is_on_sale = 1 AND is_alone_sale = 1 AND is_delete = 0 orDER BY goods_id DESC LIMIT 1");
if (!empty())
{
['url'] = build_uri('goods', array('gid' => ['goods_id']), ['goods_name']);
->assign('next_good', );//下一个商品
}
②.打开themes\default\goods.dwt文件，找下下边代码：
复制内容到剪贴板 程序代码{if }
<a href="{.url}"><img alt="prev" src="./images/up.gif" /></a>
{/if}
{if }
<a href="{.url}"><img alt="next" src="./images/down.gif" /></a>
{/if}
修改成：
复制内容到剪贴板 程序代码{if }
<a href="{.url}" title="{.goods_name}"><img alt="{.goods_name}" src="./images/up.gif" /></a>
{/if}
{if }
<a href="{.url}" title="{.goods_name}"><img alt="{.goods_name}" src="./images/down.gif" /></a>
{/if}
修改完成！

+ 查看当前日志评论 (0)

登录

────────────

木子屋

PJBlog3 v3.2.9.518 Inside.

Processed In 0.612 ms

返回

标题: ECShop v2.7.2商品详情页上一个下一个商品链接的title属性修改

你没有权限发表评论

────────────

木子屋

PJBlog3 v3.2.9.518 Inside.

Processed In 0.612 ms

返回

暂无评论

返回

────────────

木子屋

PJBlog3 v3.2.9.518 Inside.

Processed In 0.629 ms

返回