本文整理汇总了PHP中Collection::orderBy方法的典型用法代码示例。如果您正苦于以下问题:PHP Collection::orderBy方法的具体用法?PHP Collection::orderBy怎么用?PHP Collection::orderBy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Collection
的用法示例。
在下文中一共展示了Collection::orderBy方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: renderView
public function renderView()
{
$badges_feature = new Collection('badge', $this->context->language->id);
$badges_feature->where('type', '=', 'feature');
$badges_feature->orderBy('id_group');
$badges_feature->orderBy('group_position');
$badges_achievement = new Collection('badge', $this->context->language->id);
$badges_achievement->where('type', '=', 'achievement');
$badges_achievement->orderBy('id_group');
$badges_achievement->orderBy('group_position');
$badges_international = new Collection('badge', $this->context->language->id);
$badges_international->where('type', '=', 'international');
$badges_international->orderBy('id_group');
$badges_international->orderBy('group_position');
$groups = array();
$query = new DbQuery();
$query->select('DISTINCT(b.`id_group`), bl.group_name, b.type');
$query->from('badge', 'b');
$query->join('
LEFT JOIN `' . _DB_PREFIX_ . 'badge_lang` bl ON bl.`id_badge` = b.`id_badge`');
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($query);
foreach ($result as $res) {
$groups['badges_' . $res['type']][$res['id_group']] = $res['group_name'];
}
$badges_type = array('badges_feature' => array('name' => $this->l('Features'), 'badges' => $badges_feature), 'badges_achievement' => array('name' => $this->l('Achievements'), 'badges' => $badges_achievement), 'badges_international' => array('name' => $this->l('International'), 'badges' => $badges_international));
$levels = array(1 => $this->l('1. Beginner'), 2 => $this->l('2. Pro'), 3 => $this->l('3. Expert'), 4 => $this->l('4. Wizard'), 5 => $this->l('5. Guru'), 6 => $this->l('6. Legend'));
$this->tpl_view_vars = array('badges_type' => $badges_type, 'current_level_percent' => (int) Configuration::get('GF_CURRENT_LEVEL_PERCENT'), 'current_level' => (int) Configuration::get('GF_CURRENT_LEVEL'), 'groups' => $groups, 'levels' => $levels);
return parent::renderView();
}
示例2: testQueryException
public function testQueryException()
{
$this->setExpectedException("\\ModelException");
$this->object->orderBy("nesmysl");
$this->object[0];
// init
}
示例3: getThemes
public static function getThemes()
{
$themes = new Collection('Theme');
$themes->orderBy('name');
return $themes;
}
示例4: renderCSV
//.........这里部分代码省略.........
$combination->leftjoin('erpip_zone', 'subarea', '(subarea.id_erpip_zone = ewpl.id_zone)');
// apply filters
// warehouse
if ($id_warehouse != -1) {
$combination->where('s.id_warehouse = ' . (int) $id_warehouse . ' OR wpl.id_warehouse = ' . (int) $id_warehouse);
// area
if (Tools::isSubmit('area')) {
$combination->where('ewpl.id_zone_parent= ' . Tools::getValue('area'));
// sub area
if (Tools::isSubmit('subarea')) {
$combination->where('ewpl.id_zone= ' . Tools::getValue('subarea'));
}
}
}
if ($id_category != -1) {
$combination->where('pa.id_product IN (' . implode(',', array_map('intval', $categories)) . ')');
}
if ($id_supplier != -1) {
$combination->where('pa.id_product IN (' . implode(',', array_map('intval', $suppliers)) . ')');
}
if ($id_manufacturer != -1) {
$combination->where('pa.id_product IN (' . implode(',', array_map('intval', $manufacturers)) . ')');
}
if ($moreless != -1) {
if ($quantity > 0) {
$where_quantity_filter = ' physical_quantity ' . $moreless . ' ' . (int) $quantity;
if ($moreless == '=' && $quantity == 0 || $moreless == "<" && $quantity > 0) {
$where_quantity_filter .= ' OR physical_quantity IS NULL ';
}
}
$combination->where($where_quantity_filter);
}
$combination->groupBy('pa.id_product, pa.id_product_attribute, w.id_warehouse');
$combination->orderBy('pa.id_product, pa.id_product_attribute');
if ($this->controller_status == STATUS1) {
$combination->limit($stckmgtfr);
$this->informations[] = sprintf($this->l('You are using the free version of 1-Click ERP which limits document editing to %d products'), $stckmgtfr);
}
$combinations = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($combination);
// List of product id
$ids = array();
foreach ($combinations as $combination) {
$ids[] = $combination['id_product'];
}
$ids = array_unique($ids);
// Product without attribute
$product = new DbQuery();
$product->select('p.id_product as id_product,
0 as id_product_attribute,
p.reference as reference,
p.ean13 as ean13,
w.name as warehouse,
wpl.id_warehouse_product_location,
wpl.location as location,
area.name as areaname,
subarea.name as subareaname');
//if ($id_warehouse != -1)
$product->select('IFNULL(s.physical_quantity, 0) as physical_quantity, IFNULL(s.usable_quantity, 0) as usable_quantity');
// else
//$product->select('SUM(IFNULL(s.physical_quantity, 0)) as physical_quantity, SUM(IFNULL(s.usable_quantity, 0)) as usable_quantity');
$product->from('product', 'p');
$product->leftjoin('warehouse_product_location', 'wpl', '(wpl.id_product = p.id_product AND wpl.id_product_attribute = 0' . ($id_warehouse != -1 ? ' AND wpl.id_warehouse = ' . (int) $id_warehouse : '') . ')');
$product->leftjoin('stock', 's', '(s.id_product = p.id_product)');
$product->leftjoin('erpip_warehouse_product_location', 'ewpl', '(wpl.id_warehouse_product_location = ewpl.id_warehouse_product_location)');
$product->leftjoin('warehouse', 'w', 's.id_warehouse = w.id_warehouse');
$product->leftjoin('erpip_zone', 'area', '(area.id_erpip_zone = ewpl.id_zone_parent)');