本文整理匯總了PHP中block::show_spec方法的典型用法代碼示例。如果您正苦於以下問題:PHP block::show_spec方法的具體用法?PHP block::show_spec怎麽用?PHP block::show_spec使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類block
的用法示例。
在下文中一共展示了block::show_spec方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: insertOrderGoods
/**
* @brief 把訂單商品同步到order_goods表中
* @param $order_id 訂單ID
* @param $goodsInfo 商品和貨品信息(購物車數據結構,countSum 最終生成的格式)
*/
public function insertOrderGoods($order_id, $goodsResult = array())
{
$orderGoodsObj = new IModel('order_goods');
//清理舊的關聯數據
$orderGoodsObj->del('order_id = ' . $order_id);
$goodsArray = array('order_id' => $order_id);
if (isset($goodsResult['goodsList'])) {
foreach ($goodsResult['goodsList'] as $key => $val) {
//拚接商品名稱和規格數據
$specArray = array('name' => $val['name'], 'goodsno' => $val['goods_no'], 'value' => '');
if (isset($val['spec_array'])) {
$spec = block::show_spec($val['spec_array']);
foreach ($spec as $skey => $svalue) {
$specArray['value'] .= $skey . ':' . $svalue . ',';
}
$specArray['value'] = trim($specArray['value'], ',');
}
$goodsArray['product_id'] = $val['product_id'];
$goodsArray['goods_id'] = $val['goods_id'];
$goodsArray['img'] = $val['img'];
$goodsArray['goods_price'] = $val['sell_price'];
$goodsArray['real_price'] = $val['sell_price'] - $val['reduce'];
$goodsArray['goods_nums'] = $val['count'];
$goodsArray['goods_weight'] = $val['weight'];
$goodsArray['goods_array'] = IFilter::addSlash(JSON::encode($specArray));
$goodsArray['seller_id'] = $val['seller_id'];
$orderGoodsObj->setData($goodsArray);
$orderGoodsObj->add();
}
}
}
示例2: insertOrderGoods
/**
* @brief 把訂單商品同步到order_goods表中
* @param $order_id 訂單ID
* @param $goodsInfo 商品和貨品信息(購物車數據結構,countSum 最終生成的格式)
*/
public function insertOrderGoods($order_id, $goodsResult = array())
{
$orderGoodsObj = new IModel('order_goods');
//清理舊的關聯數據
$orderGoodsObj->del('order_id = ' . $order_id);
$goodsArray = array('order_id' => $order_id);
$findType = array('goods' => 'goodsList', 'product' => 'productList');
foreach ($findType as $key => $list) {
if (isset($goodsResult[$list]) && count($goodsResult[$list]) > 0) {
foreach ($goodsResult[$list] as $k => $val) {
//拚接商品名稱和規格數據
$specArray = array('name' => $val['name'], 'value' => '');
if ($key == 'product') {
$goodsArray['product_id'] = $val['id'];
$goodsArray['goods_id'] = $val['goods_id'];
$spec = block::show_spec($val['spec_array']);
foreach ($spec as $skey => $svalue) {
$specArray['value'] .= $skey . ':' . $svalue . ' , ';
}
} else {
$goodsArray['goods_id'] = $val['id'];
$goodsArray['product_id'] = 0;
}
$goodsArray['img'] = $val['img'];
$goodsArray['goods_price'] = $val['sell_price'];
$goodsArray['real_price'] = $val['sell_price'] - $val['reduce'];
$goodsArray['goods_nums'] = $val['count'];
$goodsArray['goods_weight'] = $val['weight'];
$goodsArray['goods_array'] = JSON::encode($specArray);
$orderGoodsObj->setData($goodsArray);
$orderGoodsObj->add();
}
}
}
}
示例3: cart3
//.........這裏部分代碼省略.........
$paymentRow = $paymentObj->getObj('id = ' . $payment, 'type,poundage,poundage_type,name,note');
$paymentName = $paymentRow['name'];
$paymentType = $paymentRow['type'];
$paymentNote = $paymentRow['note'];
if ($paymentRow['poundage_type'] == 1) {
$payment_fee = ($final_sum_r + $tax + $deliveryPrice_r + $protect_price) * ($paymentRow['poundage'] / 100);
} else {
$payment_fee = $paymentRow['poundage'];
}
}
//最終訂單金額計算
$order_amount = $final_sum_r + $deliveryPrice_r + $payment_fee + $tax + $protect_price;
$order_amount = $order_amount <= 0 ? 0 : round($order_amount, 2);
//生成的訂單數據
$dataArray = array('order_no' => $order_no, 'user_id' => $user_id, 'accept_name' => $accept_name, 'pay_type' => $payment, 'distribution' => $delivery_id, 'status' => 1, 'pay_status' => 0, 'distribution_status' => 0, 'postcode' => $zip, 'telphone' => $telphone, 'province' => $province, 'city' => $city, 'area' => $area, 'address' => $address, 'mobile' => $mobile, 'create_time' => ITime::getDateTime(), 'invoice' => $is_tax, 'postscript' => $order_message, 'invoice_title' => $tax_title, 'accept_time' => $accept_time, 'exp' => $exp_r, 'point' => $point_r, 'type' => $order_type, 'prop' => isset($dataArray['prop']) ? $dataArray['prop'] : null, 'payable_amount' => $goodsResult['sum'], 'real_amount' => $goodsResult['final_sum'], 'payable_freight' => $deliveryPrice, 'real_freight' => $deliveryPrice_r, 'pay_fee' => $payment_fee, 'taxes' => $tax, 'promotions' => $proReduce_r + $reduce_r, 'order_amount' => $order_amount, 'if_insured' => $if_insured, 'insured' => $protect_price);
$orderObj = new IModel('order');
$orderObj->setData($dataArray);
$this->order_id = $orderObj->add();
if ($this->order_id == false) {
IError::show(403, '訂單生成錯誤');
}
/*將訂單中的商品插入到order_goods表*/
$orderGoodsObj = new IModel('order_goods');
$goodsArray = array('order_id' => $this->order_id);
$findType = array('goods' => 'goodsList', 'product' => 'productList');
foreach ($findType as $key => $list) {
if (isset($goodsResult[$list]) && count($goodsResult[$list]) > 0) {
foreach ($goodsResult[$list] as $k => $val) {
//拚接商品名稱和規格數據
$specArray = array('name' => $val['name'], 'value' => '');
if ($key == 'product') {
$goodsArray['product_id'] = $val['id'];
$goodsArray['goods_id'] = $val['goods_id'];
$spec = block::show_spec($val['spec_array']);
foreach ($spec as $skey => $svalue) {
$specArray['value'] .= $skey . ':' . $svalue . ' , ';
}
} else {
$goodsArray['goods_id'] = $val['id'];
$goodsArray['product_id'] = 0;
}
$specArray = serialize($specArray);
$goodsArray['goods_price'] = $val['sell_price'];
$goodsArray['real_price'] = $val['sell_price'] - $val['reduce'];
$goodsArray['goods_nums'] = $val['count'];
$goodsArray['goods_weight'] = $val['weight'];
$goodsArray['goods_array'] = $specArray;
$orderGoodsObj->setData($goodsArray);
$orderGoodsObj->add();
}
}
}
//更改購買商品的庫存數量
Block::updateStore($this->order_id, 'reduce');
//記錄用戶默認習慣的數據
if (!isset($memberRow['custom'])) {
$memberObj = new IModel('member');
$memberRow = $memberObj->getObj('user_id = ' . $user_id, 'custom');
}
$memberData = array('custom' => serialize(array('payment' => $payment, 'delivery' => $delivery_id)));
$memberObj->setData($memberData);
$memberObj->update('user_id = ' . $user_id);
//收貨地址的處理
if ($user_id) {
$addressObj = new IModel('address');
//如果用戶之前沒有收貨地址,那麽會自動記錄此次的地址信息並且為默認