如何获得有条件的产品,例如所有产品数量为0的产品? 我使用getProducts函数,但条件没有选项。
/**
* Get all available products
*
* @param integer $id_lang Language id
* @param integer $start Start number
* @param integer $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) {...}
我想在get之后添加条件,但它正在吞噬更多资源:
$products = $category->getProducts($this->context->language->id, 1, 100);
$condition_products;
foreach ($products as $key => $product)
{
if (condition)
{
$condition_products .= $product
}
}