2016-11-04 86 views
0

我想获得我的Prestashop 1.6的所有产品。prestashop 1.6获得所有产品

有人能学会我得到所有产品吗? 喜欢的东西

$products = Controller::getAllProducts(); 

$products = Controller::getProducts(); 

如果这是不可能的,使用HTML选择是如何让类别的产品?

回答

1

在您的模块或定制控制器类型:

$products = Product::getProducts($this->context->language->id, 1, 5000, 'name', 'ASC'); 

的getProducts的原型()的方法是:

/** 
    * Get all available products 
    * 
    * @param int $id_lang Language id 
    * @param int $start Start number 
    * @param int $limit Number of products to return 
    * @param string $order_by Field for ordering 
    * @param string $order_way Way for ordering (ASC or DESC) 
    * @return array Products details 
    */ 
    public static function getProducts($id_lang, $start, $limit, $order_by, $order_way, $id_category = false, $only_active = false, Context $context = null)