Created
January 29, 2009 14:56
-
-
Save samsoir/54567 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 | |
protected function get_stocks() | |
{ | |
// Get the arguments supplied to this function | |
$args = func_get_args(); | |
// Get the options supplied | |
$include_disabled = (bool) in_array('disabled', $args); | |
$include_empty = (bool) in_array('empty', $args); | |
if (isset($this->parent_id)) | |
$where = array('currency_id' => $this->parent_id); | |
else | |
$where = array('currency_id' => $this->id); | |
if ( ! $include_disabled) | |
$where += array('disable_stock' => 1); | |
if ( ! $include_empty) | |
$where += array('stock_inventory >' => 0); | |
$stocks = ORM::factory('currency_stocks') | |
->where($where) | |
->orderby('buy_gbp_rate', 'ASC') | |
->find_all(); | |
return $stocks; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment