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


PHP Quote::query方法代碼示例

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


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

示例1: ListQuoteItems

 public function ListQuoteItems($quote_id)
 {
     //    return; // fix that function
     App::uses("Quote", "QuoteManager.Model");
     $list_quote = new Quote();
     $query = "SELECT t.code as code,SUM(t.quantity) as quantity FROM(SELECT coi.code as code ,coi.quantity as quantity FROM  cabinet_order_items as coi WHERE coi.cabinet_order_id in (\n              SELECT co.id FROM cabinet_orders AS co WHERE co.quote_id ={$quote_id}) || coi.quote_id={$quote_id} ) AS t GROUP BY t.code";
     $list_data = $list_quote->query($query);
     $list = array();
     $title_list = array();
     $name_list = array();
     $price_list = array();
     $all_items = $this->ListAllTypesOfItems();
     $index = 0;
     //    debug($list_data);
     foreach ($list_data as $row) {
         $list[$row['t']['code']] = $row[0]['quantity'];
         @($name_list[$row['t']['code']] = $all_items['main_list'][$row['t']['code']]);
         @($price_list[$row['t']['code']] = $all_items['price_list'][$row['t']['code']]);
         @($title_list[$row['t']['code']] = $all_items['title_list'][$row['t']['code']]);
         $index++;
     }
     $query = "SELECT t.code as code,SUM(t.quantity) as quantity FROM(SELECT coi.code as code ,coi.quantity as quantity FROM  granite_order_items as coi WHERE coi.granite_order_id= (\n              SELECT co.id FROM granite_orders AS co WHERE co.quote_id ={$quote_id}) || coi.quote_id={$quote_id} ) AS t GROUP BY t.code";
     $list_data = $list_quote->query($query);
     //    debug($list_data);
     foreach ($list_data as $row) {
         if (array_key_exists($row['t']['code'], $list)) {
             $list[$row['t']['code']] = $list[$row['t']['code']] + $row[0]['quantity'];
         } else {
             $list[$row['t']['code']] = $row[0]['quantity'];
             $name_list[$row['t']['code']] = $all_items['main_list'][$row['t']['code']];
             $price_list[$row['t']['code']] = $all_items['price_list'][$row['t']['code']];
             $title_list[$row['t']['code']] = $all_items['title_list'][$row['t']['code']];
         }
     }
     return array('quantity_list' => $list, 'name_list' => $name_list, 'price_list' => $price_list, 'title_list' => $title_list);
 }
開發者ID:khaled-saiful-islam,項目名稱:zen_v1.0,代碼行數:36,代碼來源:QuoteItemComponent.php


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