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


PHP CI::Coupons方法代码示例

本文整理汇总了PHP中CI::Coupons方法的典型用法代码示例。如果您正苦于以下问题:PHP CI::Coupons方法的具体用法?PHP CI::Coupons怎么用?PHP CI::Coupons使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CI的用法示例。


在下文中一共展示了CI::Coupons方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: delete

 public function delete($id = false)
 {
     if ($id) {
         $coupon = \CI::Coupons()->getCoupon($id);
         //if the promo does not exist, redirect them to the customer list with an error
         if (!$coupon) {
             \CI::session()->set_flashdata('error', lang('error_not_found'));
             redirect('admin/coupons');
         } else {
             \CI::Coupons()->deleteCoupon($id);
             \CI::session()->set_flashdata('message', lang('message_coupon_deleted'));
             redirect('admin/coupons');
         }
     } else {
         //if they do not provide an id send them to the promo list page with an error
         \CI::session()->set_flashdata('message', lang('error_not_found'));
         redirect('admin/coupons');
     }
 }
开发者ID:lekhangyahoo,项目名称:gonline,代码行数:19,代码来源:AdminCoupons.php

示例2: submitOrder

 function submitOrder($transaction = false)
 {
     foreach ($this->items as $item) {
         if ($item->type == 'gift card') {
             //touch giftcard
             \CI::GiftCards()->updateAmountUsed($item->description, $item->total_price);
             continue;
         } elseif ($item->type == 'coupon') {
             //touch coupon
             \CI::Coupons()->touchCoupon($item->description);
             continue;
         } elseif ($item->type == 'product') {
             //update inventory
             if ($item->track_stock) {
                 \CI::Products()->touchInventory($item->product_id, $item->quantity);
             }
             //if this is a giftcard purchase, generate it and send it where it needs to go.
             if ($item->is_giftcard) {
                 //process giftcard
                 $options = CI::Orders()->getItemOptions(GC::getCart()->id);
                 $giftCard = [];
                 foreach ($options[$item->id] as $option) {
                     if ($option->option_name == 'gift_card_amount') {
                         $giftCard[$option->option_name] = $option->price;
                     } else {
                         $giftCard[$option->option_name] = $option->value;
                     }
                 }
                 $giftCard['code'] = generate_code();
                 $giftCard['activated'] = 1;
                 //save the card
                 \CI::GiftCards()->saveCard($giftCard);
                 //send the gift card notification
                 \GoCart\Emails::giftCardNotification($giftCard);
             }
         }
     }
     if (!$transaction) {
         $transaction = $this->transaction();
     }
     //add transaction info to the order
     $this->cart->order_number = $transaction->order_number;
     $this->cart->transaction_id = $transaction->id;
     $this->cart->status = config_item('order_status');
     $this->cart->ordered_on = date('Y-m-d H:i:s');
     $orderNumber = $this->cart->order_number;
     $this->saveCart();
     //refresh the cart
     $this->getCart(true);
     //get the order as it would be on the order complete page
     $order = \CI::Orders()->getOrder($orderNumber);
     //send the cart email
     \GoCart\Emails::Order($order);
     //return the order number
     return $orderNumber;
 }
开发者ID:berkapavel,项目名称:GoCart3,代码行数:56,代码来源:GoCart.php


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