Created
March 16, 2009 14:36
-
-
Save shadowhand/79905 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
public function find_all_by_country($country) | |
{ | |
return $this | |
->select('DISTINCT categories.*') | |
->join('categories_products', 'categories_products.category_id', 'categories.id') | |
->join('products', 'products.id', 'categories_products.product_id') | |
->join('product_skus', 'product_skus.product_id', 'products.id') | |
->join('countries_product_skus', 'countries_product_skus.product_sku_id', 'product_skus.id') | |
->where('countries_product_skus.country_id', $country->id) | |
->where('categories.category_parent_id', NULL) | |
->find_all(); | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment