Skip to content

Instantly share code, notes, and snippets.

Created October 16, 2013 02:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save anonymous/7001873 to your computer and use it in GitHub Desktop.
Save anonymous/7001873 to your computer and use it in GitHub Desktop.
// in action tab
$category_ids = array(array(5,4,6,7));
$this->data['products'] = Shop_Product::create()->apply_filters();
$this->data['products']->join('shop_products_categories', 'shop_products_categories.shop_product_id=shop_products.id');
$this->data['products']->join('shop_categories', 'shop_products_categories.shop_category_id=shop_categories.id');
$this->data['products']->where('shop_categories.id in (?)', $category_ids);
//$this->data['products']->where('shop_categories.id = 5');
//$this->data['products']->orWhere('shop_categories.id = 4');
//$this->data['products']->orWhere('shop_categories.id = 6');
//$this->data['products']->orWhere('shop_categories.id = 7');
//$this->data['products']->where('shop_categories.id = 4 OR shop_categories.id = 5 OR shop_categories.id = 6 OR shop_categories.id = 7');
//$this->data['products']->where('shop_categories.code LIKE "custom%"');
$this->data['products']->order('shop_products.created_at desc');
$this->data['products']->limit(16);
// in page tab
$products->find_all()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment