本文整理汇总了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);
}