radnows 请教下有没有办法将前台产品的默认改为最新时间排序

用于收藏精华贴子、网友共享的资料等。可以回复,不能发新贴。

版主: Jack

版面规则
本版面不能发新贴,可以回复

Re: radnows 请教下有没有办法将前台产品的默认改为最新时间排序

帖子yiyunet » 2010-02-23 19:11

附三个地方改动代码:
1.
if(isset($_GET['productsort']) && (int)$_GET['productsort'] > 0){
switch ($_GET['productsort']){
case 2:
$product_sort = " order by pd.products_name ";
break;
case 3:
$product_sort = " order by p.products_price";
break;
case 4:
$product_sort = " order by p.products_price DESC";
break;
case 5:
$product_sort = " order by p.products_date_added DESC";
break;
default:
$product_sort = " order by p.products_date_added DESC";
}

2.
if (!defined('IS_ADMIN_FLAG')) {
die('Illegal Access');
}
$productsort = array();
$nsort = array('Bestselling','Item Name','Price(Low to high)','Price(High to low)','New Arrival');

3.
// We show them all
$listing_sql = "select " . $select_column_list . " p.products_id, p.products_type,p.products_status,p.products_price,p.products_price_retail,p.products_price_sample,p.product_is_wholesale,p.product_wholesale_min,p.products_quantity, p.products_quantity_order_min, p.master_categories_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, pd.products_description, IF(s.status = 1, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status =1, s.specials_new_products_price, p.products_price) as final_price, p.products_sort_order, p.product_is_call, p.product_is_always_free_shipping, p.products_qty_box_status
from " . TABLE_PRODUCTS_DESCRIPTION . " pd, " .
TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m on p.manufacturers_id = m.manufacturers_id, " .
TABLE_PRODUCTS_TO_CATEGORIES . " p2c left join " . TABLE_SPECIALS . " s on p2c.products_id = s.products_id
where p.products_status = 1
and p.products_id = p2c.products_id
and pd.products_id = p2c.products_id
and pd.language_id = '" . (int)$_SESSION['languages_id']."'". $displayOrder. $priceOrder."
and " . $product_in_categories_sql . " order by p.products_date_added DESC";
}
}
yiyunet
高级会员
高级会员
 
帖子: 198
注册: 2009-07-14 0:21

Re: radnows 请教下有没有办法将前台产品的默认改为最新时间排序

帖子Jack » 2010-02-23 22:14

order by p.products_date_added DESC 重复了,最后的那个去掉
Zen Cart - 让每个人拥有自己生意的梦想成真
加入Zen Cart地图 | 恕不回复站内短信提问 | QQ: 3171061
头像
Jack
论坛版主
论坛版主
 
帖子: 12265
注册: 2004-12-16 10:04

Re: radnows 请教下有没有办法将前台产品的默认改为最新时间排序

帖子yiyunet » 2010-02-24 0:21

Jack,是说第三步那个order by p.products_date_added DESC吗?
where p.products_status = 1
and p.products_id = p2c.products_id
and pd.products_id = p2c.products_id
and pd.language_id = '" . (int)$_SESSION['languages_id']."'". $displayOrder. $priceOrder."
and " . $product_in_categories_sql . " order by p.products_date_added DESC";
}
}
yiyunet
高级会员
高级会员
 
帖子: 198
注册: 2009-07-14 0:21

Re: radnows 请教下有没有办法将前台产品的默认改为最新时间排序

帖子yiyunet » 2010-02-24 9:26

感谢Radnows,感谢Jack,感谢MTV,CCTV ^_^ 问题圆满解决!
附完整步聚:

1.默认default:的sql改为order by p.products_date_added DESC ,原来case5改为$product_sort = " order by p.products_ordered DESC"; {文件地址:\includes\index_filters\default_filter.php}
2.修改product_listing.php的array('Bestselling','Item Name','Price(Low to high)','Price(High to low)','New Arrival'); 为
$nsort = array('New Arrival','Item Name','Price(Low to high)','Price(High to low)','Bestselling'); {文件地址:\includes\modules\product_listing.php}
3.改代码:{文件地址:\includes\index_filters\default_filter.php}
// We show them all
$listing_sql = "select " . $select_column_list . " p.products_id, p.products_type,p.products_status,p.products_price,p.products_price_retail,p.products_price_sample,p.product_is_wholesale,p.product_wholesale_min,p.products_quantity, p.products_quantity_order_min, p.master_categories_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, pd.products_description, IF(s.status = 1, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status =1, s.specials_new_products_price, p.products_price) as final_price, p.products_sort_order, p.product_is_call, p.product_is_always_free_shipping, p.products_qty_box_status
from " . TABLE_PRODUCTS_DESCRIPTION . " pd, " .
TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m on p.manufacturers_id = m.manufacturers_id, " .
TABLE_PRODUCTS_TO_CATEGORIES . " p2c left join " . TABLE_SPECIALS . " s on p2c.products_id = s.products_id
where p.products_status = 1
and p.products_id = p2c.products_id
and pd.products_id = p2c.products_id
and pd.language_id = '" . (int)$_SESSION['languages_id']."'". $displayOrder. $priceOrder."
and " . $product_in_categories_sql;
}
}
-------------------------------------->
// We show them all

if ($_GET['productsort'] =='') {
$sort = ' order by p.products_date_added DESC';
}else{
$sort = '';
}
$listing_sql = "select " . $select_column_list . " p.products_id, p.products_type,p.products_status,p.products_price,p.products_price_retail,p.products_price_sample,p.product_is_wholesale,p.product_wholesale_min,p.products_quantity, p.products_quantity_order_min, p.master_categories_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, pd.products_description, IF(s.status = 1, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status =1, s.specials_new_products_price, p.products_price) as final_price, p.products_sort_order, p.product_is_call, p.product_is_always_free_shipping, p.products_qty_box_status
from " . TABLE_PRODUCTS_DESCRIPTION . " pd, " .
TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m on p.manufacturers_id = m.manufacturers_id, " .
TABLE_PRODUCTS_TO_CATEGORIES . " p2c left join " . TABLE_SPECIALS . " s on p2c.products_id = s.products_id
where p.products_status = 1
and p.products_id = p2c.products_id
and pd.products_id = p2c.products_id
and pd.language_id = '" . (int)$_SESSION['languages_id']."'". $displayOrder. $priceOrder."
and " . $product_in_categories_sql . $sort;
}
}
yiyunet
高级会员
高级会员
 
帖子: 198
注册: 2009-07-14 0:21

Re: radnows 请教下有没有办法将前台产品的默认改为最新时间排序

帖子kalytweh » 2010-04-04 20:11

不错,不错时隔几个月上来看到圆满的解决方案,感谢
kalytweh
新手上路
新手上路
 
帖子: 7
注册: 2009-09-21 13:15

Re: radnows 请教下有没有办法将前台产品的默认改为最新时间排序

帖子wuyichao36 » 2010-04-07 11:58

yiyunet 写道:刚试了下。报错。Parse error: parse error in D:\xampp\htdocs\includes\index_filters\default_filter.php on line 125
步骤:
1.默认default:的sql改为order by p.products_date_added DESC
2.修改的array('Bestselling','Item Name','Price(Low to high)','Price(High to low)','New Arrival'); 为
$nsort = array('New Arrival','Item Name','Price(Low to high)','Price(High to low)','Bestselling');
3.and " . $product_in_categories_sql; 改为
and " . $product_in_categories_sql;. " order by p.products_date_added DESC"




这个我怎么找不到啊 product_listing.php文件里面的。。。知道的说啊
wuyichao36
新手上路
新手上路
 
帖子: 18
注册: 2010-04-07 11:21
QQ 帐号: 1028726543

Re: radnows 请教下有没有办法将前台产品的默认改为最新时间排序

帖子yiyunet » 2010-04-08 16:18

这个是LB模板的。
yiyunet
高级会员
高级会员
 
帖子: 198
注册: 2009-07-14 0:21

Re: radnows 请教下有没有办法将前台产品的默认改为最新时间排序

帖子LuckyYuan » 2010-04-12 11:59

不错是这样的
Zen Cart E-commerce Art 交流至上
头像
LuckyYuan
高级会员
高级会员
 
帖子: 125
注册: 2009-12-22 15:07
QQ 帐号: 845284806

Re: radnows 请教下有没有办法将前台产品的默认改为最新时间排序

帖子zshuai613 » 2010-04-27 14:54

商品打开后的详细页上方有本目录下的商品列,那个顺序好像挺乱的,怎么也按上架时间排序?
我是ZENCART新手,请大家多多指教http://www.baocody.com,纯中文站:http://www.louisvuitton-cn.com
zshuai613
普通会员
普通会员
 
帖子: 49
注册: 2009-05-19 0:30

Re: radnows 请教下有没有办法将前台产品的默认改为最新时间排序

帖子letgonebygone » 2010-06-01 16:13

yiyunet 写道:感谢Radnows,感谢Jack,感谢MTV,CCTV ^_^ 问题圆满解决!
附完整步聚:

1.默认default:的sql改为order by p.products_date_added DESC ,原来case5改为$product_sort = " order by p.products_ordered DESC"; {文件地址:\includes\index_filters\default_filter.php}
2.修改product_listing.php的array('Bestselling','Item Name','Price(Low to high)','Price(High to low)','New Arrival'); 为
$nsort = array('New Arrival','Item Name','Price(Low to high)','Price(High to low)','Bestselling'); {文件地址:\includes\modules\product_listing.php}
3.改代码:{文件地址:\includes\index_filters\default_filter.php}
// We show them all
$listing_sql = "select " . $select_column_list . " p.products_id, p.products_type,p.products_status,p.products_price,p.products_price_retail,p.products_price_sample,p.product_is_wholesale,p.product_wholesale_min,p.products_quantity, p.products_quantity_order_min, p.master_categories_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, pd.products_description, IF(s.status = 1, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status =1, s.specials_new_products_price, p.products_price) as final_price, p.products_sort_order, p.product_is_call, p.product_is_always_free_shipping, p.products_qty_box_status
from " . TABLE_PRODUCTS_DESCRIPTION . " pd, " .
TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m on p.manufacturers_id = m.manufacturers_id, " .
TABLE_PRODUCTS_TO_CATEGORIES . " p2c left join " . TABLE_SPECIALS . " s on p2c.products_id = s.products_id
where p.products_status = 1
and p.products_id = p2c.products_id
and pd.products_id = p2c.products_id
and pd.language_id = '" . (int)$_SESSION['languages_id']."'". $displayOrder. $priceOrder."
and " . $product_in_categories_sql;
}
}
-------------------------------------->
// We show them all

if ($_GET['productsort'] =='') {
$sort = ' order by p.products_date_added DESC';
}else{
$sort = '';
}
$listing_sql = "select " . $select_column_list . " p.products_id, p.products_type,p.products_status,p.products_price,p.products_price_retail,p.products_price_sample,p.product_is_wholesale,p.product_wholesale_min,p.products_quantity, p.products_quantity_order_min, p.master_categories_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, pd.products_description, IF(s.status = 1, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status =1, s.specials_new_products_price, p.products_price) as final_price, p.products_sort_order, p.product_is_call, p.product_is_always_free_shipping, p.products_qty_box_status
from " . TABLE_PRODUCTS_DESCRIPTION . " pd, " .
TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m on p.manufacturers_id = m.manufacturers_id, " .
TABLE_PRODUCTS_TO_CATEGORIES . " p2c left join " . TABLE_SPECIALS . " s on p2c.products_id = s.products_id
where p.products_status = 1
and p.products_id = p2c.products_id
and pd.products_id = p2c.products_id
and pd.language_id = '" . (int)$_SESSION['languages_id']."'". $displayOrder. $priceOrder."
and " . $product_in_categories_sql . $sort;
}
}
letgonebygone
 
帖子: 2
注册: 2010-05-26 13:56
QQ 帐号: 707586252

上一页下一页

  • 相关话题
    回复总数
    阅读次数
    最新文章

回到 精华共享



在线用户

正在浏览此版面的用户:没有注册用户 和 0 位游客