当前位置: 首页>>代码示例>>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;未经允许,请勿转载。