当前位置: 首页>>代码示例>>PHP>>正文


PHP block::show_spec方法代码示例

本文整理汇总了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();
         }
     }
 }
开发者ID:herrify,项目名称:iwebshop,代码行数:36,代码来源:order_class.php

示例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();
             }
         }
     }
 }
开发者ID:zhendeguoke1008,项目名称:shop,代码行数:40,代码来源:order_class.php

示例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');
         //如果用户之前没有收货地址,那么会自动记录此次的地址信息并且为默认
开发者ID:chenyongze,项目名称:iwebshop,代码行数:67,代码来源:simple.php


注:本文中的block::show_spec方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。