當前位置: 首頁>>代碼示例>>PHP>>正文


PHP DbQuery::groupby方法代碼示例

本文整理匯總了PHP中DbQuery::groupby方法的典型用法代碼示例。如果您正苦於以下問題:PHP DbQuery::groupby方法的具體用法?PHP DbQuery::groupby怎麽用?PHP DbQuery::groupby使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在DbQuery的用法示例。


在下文中一共展示了DbQuery::groupby方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: getCartRulesDB

 public function getCartRulesDB()
 {
     $req = new DbQuery();
     $req->select('cart_rule.id_cart_rule, cart_rule.code, cart_rule.description, cart_cart_rule.id_cart as used_on_id_cart');
     $req->from('cart_rule', 'cart_rule');
     $req->leftJoin('cart_cart_rule', 'cart_cart_rule', 'cart_cart_rule.id_cart_rule = cart_rule.id_cart_rule');
     $req->where('cart_rule.code != ""');
     $req->groupby('cart_rule.id_cart_rule');
     $req->orderBy('used_on_id_cart DESC');
     $cart_rules = Db::getInstance()->executeS($req, true, false);
     if (_PS_MODE_DEV_) {
         echo '<!-- OK getCartRulesDB -->';
     }
     return $cart_rules;
 }
開發者ID:Oldwo1f,項目名稱:yakaboutique,代碼行數:15,代碼來源:adminmarketingestep4.php

示例2: getCustomersSmsRequest

    public static function getCustomersSmsRequest($campaign_id, $checked_langs, $checked_groups, $checked_campaign_active, $checked_products, $checked_categories, $limit = 0, &$list_total = null)
    {
        $sql_calc_found = is_null($list_total) ? '' : 'SQL_CALC_FOUND_ROWS ';
        $req = new DbQuery();
        $req->select($sql_calc_found . (int) $campaign_id . ' as campaign_id, address.phone_mobile as target,
				address.phone_mobile as col_0, customer.lastname as col_1, customer.firstname as col_2,address.postcode as col_3,
				address.city as col_4, \'prestashop\' as source');
        $req->from('customer', 'customer');
        $req->leftJoin('customer_group', 'customer_group', 'customer_group.id_customer = customer.id_customer');
        $req->leftJoin('guest', 'guest', 'guest.id_customer = customer.id_customer');
        $req->leftJoin('connections', 'connections', 'connections.id_guest = guest.id_guest');
        $req->innerJoin('address', 'address', 'address.id_customer = customer.id_customer AND address.phone_mobile <> \'\'');
        $req->leftJoin('country', 'country', 'address.id_country = country.id_country');
        $where = array();
        $where[] = 'address.phone_mobile IS NOT NULL AND address.phone_mobile <> \'\'';
        if (!empty($checked_langs)) {
            $where[] = 'customer.id_lang IN(' . implode(', ', array_map('intval', $checked_langs)) . ')';
        }
        if (!empty($checked_groups)) {
            $where[] = 'customer_group.id_group IN(' . implode(', ', array_map('intval', $checked_groups)) . ')';
        }
        if ($checked_campaign_active) {
            $where[] = 'customer.active = 1';
        }
        if (!empty($checked_products) || !empty($checked_categories)) {
            $where_products_categories = array();
            $req->leftJoin('cart', 'cart', 'cart.id_customer = customer.id_customer');
            $req->leftJoin('cart_product', 'cart_product', 'cart_product.id_cart = cart.id_cart');
            if (!empty($checked_products)) {
                $where_products_categories[] = 'cart_product.id_product IN(' . implode(', ', array_map('intval', $checked_products)) . ')';
            }
            if (!empty($checked_categories)) {
                $req->leftJoin('category_product', 'category_product', 'category_product.id_product = cart_product.id_product');
                $where_products_categories[] = 'category_product.id_category IN(' . implode(', ', array_map('intval', $checked_categories)) . ')';
            }
            $where[] = implode(' OR ', $where_products_categories);
        }
        $req->where(implode(' AND ', $where));
        $req->orderby('customer.id_customer');
        $req->groupby('customer.id_customer');
        $limit = (int) $limit;
        if ($limit) {
            $req->limit($limit);
        }
        return $req;
    }
開發者ID:Oldwo1f,項目名稱:yakaboutique,代碼行數:46,代碼來源:db_marketing.php


注:本文中的DbQuery::groupby方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。