Skip to content

Instantly share code, notes, and snippets.

@EHLOVader
Forked from anonymous/gist:7001873
Last active December 25, 2015 15:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save EHLOVader/7001894 to your computer and use it in GitHub Desktop.
Save EHLOVader/7001894 to your computer and use it in GitHub Desktop.
// in action tab
$category_ids = array(array(5,10,6,7));
$this->data['products'] = Shop_Product::create()
->apply_filters()
->join('shop_products_categories', 'shop_products_categories.shop_product_id=shop_products.id')
->where('shop_products_categories.shop_category_id in (?)', $category_ids);
$this->data['products']->reset_order();
$this->data['products'] = $this->data['products']->order('shop_products.created_at desc')
->limit(16)
->find_all();
<?php
foreach($products as $p){
echo $p->categories[0]->name . ' ' . $p->sku . ' ' . $p->created_at . ' </br>';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment