Thursday, October 23, 2014

Hướng dẫn sắp xếp sản phẩm tại admin theo thời gian (sort product by date)

Leave a Comment
 Mặc định opencart sắp xếp sản phẩm theo tên. điều này rất khó trong việc quản lý sản phẩm..vi mình sẽ ko biết được sản phẩm nào mới thêm vào...



Sắp xếp sản phẩm theo thời gian


Đầu tiên  vào : admin/controller/catalog/product.php
 Tìm ( ctrl +F)

  if (isset($this->request->get['sort'])) {
         $sort = $this->request->get['sort'];
      } else {
         $sort = 'pd.name';
      }

      if (isset($this->request->get['order'])) {
         $order = $this->request->get['order'];
      } else {
         $order = 'ASC';
      }
Thay thành code sau ( Replace with following code):

if (isset($this->request->get['sort'])) {
 $sort = $this->request->get['sort'];
 } else {
 $sort = 'p.date_added';
 }

 if (isset($this->request->get['order'])) {
 $order = $this->request->get['order'];
 } else {
 $order = 'DESC';
 }
Tiếp theo tìm đến đường dẫn sau:
In the file admin/model/catalog/product.php add the red marked code

$sort_data = array(
'pd.name',
'p.model',
'p.price',
'p.quantity',
'p.status',
'p.sort_order',
'p.date_added' //thêm dòng này vào (add this column name)
);

0 comments:

Post a Comment