The ecshop product list page has been added to sort by sales_html/css_WEB-ITnose

WBOY
Release: 2016-06-24 11:45:28
Original
1484 people have browsed it

STEP1: Add a field to the table "ecs_goods": salesnum (note: custom field name)


STEP2: Open the file in the root directory: flow.php


Find the following code:


/* Insert order goods*/
$sql = "INSERT INTO" . $ecs->table('order_goods') . "( ".
"order_id, goods_id, goods_name, goods_sn, product_id, goods_number, market_price, ".
"goods_price, goods_attr, is_real, extension_code, parent_id, is_gift, goods_attr_id) ".
          ” SELECT '$new_order_id ', goods_id, goods_name, goods_sn, product_id, goods_number, market_price, ".
"goods_price, goods_attr, is_real, extension_code, parent_id, is_gift, goods_attr_id".
" FROM " .$ecs-& gt;table(' cart') .
                                                                                                                                                                                                   WHERE session_id = '".SESS_ID."' AND rec_type = '$flow_type'"; Below this code, add the following code:


/* Insert the salesnum field of the product table to count the sales ranking*/


$sql = "update " . $GLOBALS['ecs']->table('goods') . " AS a, ".$GLOBALS['ecs']->table('cart') . " AS b ".


“ set a.salesnum= a.salesnum b.goods_number".


“ WHERE a.goods_id=b.goods_id AND b.session_id = '".SESS_ID."' AND b .rec_type = '$flow_type'";





$db->query($sql);


STEP3: Open File: defaultlibrarygoods_list.lbi, find the following code:


ASCDESC#goods_list”>


Add below the above code:


ASCDESC#goods_list ”>{$pager.order}default.gif” alt=”Ranked by sales volume”>


The difference between the two pieces of code, you can analyze it yourself.


STEP4: Open the file: category.php and find the following code:


$sort = (isset($_REQUEST['sort']) && in_array(trim( strtolower($_REQUEST['sort'])), array('goods_id', 'shop_price', 'last_update')))


Modified to:


$ sort = (isset($_REQUEST['sort']) && in_array(trim(strtolower($_REQUEST['sort'])), array('goods_id', 'shop_price', 'last_update','salesnum')))


source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template