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


PHP OrderDetail类代码示例

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


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

示例1: executeFormWidget

 public function executeFormWidget(dmWebRequest $request)
 {
     $form = new OrderForm();
     if ($request->hasParameter($form->getName()) && $form->bindAndValid($request)) {
         $order = $form->save();
         $order->setUid(md5(rand(1111, 9999) . time()));
         $order->save();
         // link order details
         $this->shopping_cart = $shopping_cart = $this->getUser()->getShoppingCart();
         $this->items = $shopping_cart->getItems();
         foreach ($shopping_cart->getItems() as $i => $item) {
             $od = new OrderDetail();
             $od->fromArray(array('product_id' => $item->getId(), 'order_id' => $order->id, 'quantity' => $item->getQuantity(), 'price' => $item->getPrice()));
             $od->save();
         }
         if (sfConfig::get('app_send_order', false)) {
             dm::enableMailer();
             //send mail
             $message = $this->getMailer()->compose($_from = dmConfig::get('orderEmail'), $_to = array($order->email, dmConfig::get('orderEmail')), $_subj = '[' . dmConfig::get('siteName') . '] thanks for order');
             $message->setBody($this->getPartial('order/mailOrder', array('order' => $order, 'companyName' => dmConfig::get('companyName'), 'companyPhone' => dmConfig::get('companyPhone'), 'siteUrl' => dmConfig::get('siteUrl'), 'siteName' => dmConfig::get('siteName'))));
             $message->setContentType('text/html');
             $this->getMailer()->send($message);
         }
         // if send order
         // clear cart now
         $shopping_cart->clear();
         //redirect to order info
         $this->redirect($this->getHelper()->link('main/ordershow?uid=' . $order->uid)->getHref());
         //$this->redirectBack();
     }
     $this->forms['Order'] = $form;
 }
开发者ID:rafix,项目名称:dmshop,代码行数:32,代码来源:actions.class.php

示例2: actionCheckout

 public function actionCheckout()
 {
     if ($postData = Yii::$app->request->post()) {
         $model = new Product();
         $order = new Order();
         $order->shipping_address = $postData['address'];
         $order->city = $postData['city'];
         $order->country = $postData['country'];
         $order->postal_code = $postData['postal_code'];
         $order->status = 0;
         $order->save();
         $order_id = $order->order_id;
         $items = [];
         foreach ($postData['qty'] as $key => $val) {
             $order_detail = new OrderDetail();
             $order_detail->order_id = $order_id;
             $order_detail->prod_id = $postData['prod_id'][$key];
             $order_detail->quantity = $postData['qty'][$key];
             $order_detail->unit_price = $postData['prod_price'][$key];
             $order_detail->unit_sum = $postData['prod_price'][$key] * $order_detail->quantity;
             $order_detail->save();
             $item = new Item();
             $item->setName($postData['prod_name'][$key])->setCurrency('USD')->setQuantity($val)->setPrice($postData['prod_price'][$key]);
             $items[] = $item;
         }
         $itemList = new ItemList();
         $itemList->setItems($items);
         $payment = preparePaypal($itemList);
         print_r($items);
     }
     exit;
 }
开发者ID:syedmaaz,项目名称:marxmall-,代码行数:32,代码来源:CartController.php

示例3: getOrderIDArray

 public function getOrderIDArray($userID, $proID)
 {
     $order = new Order();
     $idArray = $order->getOrderID($userID);
     //var_dump($idArray);
     $orderDetail = new OrderDetail();
     $orderArray = $orderDetail->getOrderIDByIdArray($idArray, $proID);
     if ($orderArray) {
         return $orderArray;
     } else {
         return false;
     }
 }
开发者ID:xiaohong1633,项目名称:eshop,代码行数:13,代码来源:comments.model.php

示例4: isCommentAble

 public function isCommentAble($userID, $proID)
 {
     $order = new Order();
     $idArray = $order->getOrderID($userID);
     //var_dump($idArray);
     $orderDetail = new OrderDetail();
     //echo "return".$orderDetail->checkProByOrderArray($idArray,$proID);
     if ($orderDetail->checkProByOrderArray($idArray, $proID)) {
         //return true;
         //echo "commnetAble";
         return 'true';
     } else {
         //return false;
         //echo "disCommentAble";
         return 'false';
     }
 }
开发者ID:xiaohong1633,项目名称:eshop,代码行数:17,代码来源:v_comments.model.php

示例5: __construct

 public function __construct($id, $date, $userID)
 {
     $this->id = $id;
     $this->date = $date;
     $this->userID = $userID;
     $this->order_details = OrderDetail::find($id);
     $this->sum = $this->getSum();
 }
开发者ID:Hield,项目名称:e-commerce,代码行数:8,代码来源:order.php

示例6: postCheckOut

 /**
  * postCheckOut
  */
 public function postCheckOut()
 {
     $customer = Input::get('customer');
     $customer = Customer::find($customer);
     $customer_address = CustomerReceivedAddress::where('customer_id', $customer->id)->where('default', 1)->first();
     //订单编号
     $orderno = OrderGeneration::where('customer_no', $customer->customer_no)->where('used', 0)->first();
     if (!$orderno) {
         foreach (range(1001, 9998) as $index) {
             if ($index == 1111 || $index == 2222 || $index == 3333 || $index == 4444 || $index == 5555 || $index == 6666 || $index == 7777 || $index == 8888) {
                 continue;
             }
             OrderGeneration::create(['customer_no' => $customer->customer_no, 'order_no' => $index, 'used' => 0]);
         }
         $order_no = $index;
         $no = $order_no . $customer->customer_no;
     } else {
         $order_no = $orderno->order_no;
         $no = $order_no . $customer->customer_no;
     }
     $order = new Order();
     $order->no = $no;
     $order->customer_id = $customer->id;
     $order->customer_address_id = $customer_address->id;
     $order->payment_method_id = 1;
     $order->shipping_method_id = 1;
     $order->order_status = 'order_price_confirmed';
     $order->item_fee = 0.0;
     $order->shipping_fee = 0;
     $order->amount_fee = 0.0;
     $order->point_fee = 0;
     $order->credit_fee = 0;
     $order->pay_fee = 0.0;
     $order->caution_money = 0;
     $order->save();
     $ordergeneration = OrderGeneration::where('order_no', $order_no)->where('customer_no', $customer->customer_no)->first();
     $ordergeneration->used = 1;
     $ordergeneration->save();
     //orderdetail
     $carts = Cart::where('customer_id', $customer->id)->get();
     $sum = 0;
     foreach ($carts as $cart) {
         $total = 0;
         if ($cart->confirm_price == 0.0) {
             $cart->confirm_price = $cart->item->price_market;
         }
         OrderDetail::create(['order_id' => $order->id, 'item_id' => $cart->item_id, 'craft_description' => $cart->craft_description, 'quantity' => $cart->quantity, 'confirm_price' => $cart->confirm_price, 'confirm_quantity' => 0, 'delivery_quantity' => 0]);
         $total = $cart->confirm_price * $cart->quantity;
         $sum += $total;
     }
     $order = Order::find($order->id);
     $order->item_fee = $sum;
     $order->save();
     //查看订单详细页面
     return Redirect::to('admin/orders');
 }
开发者ID:yanguanglan,项目名称:sz,代码行数:59,代码来源:CartsController.php

示例7: __construct

 public function __construct()
 {
     parent::__construct();
     if ($this->is_ajax_request() == TRUE) {
         $this->template = new View('layout/default_json');
     }
     role::check('orders');
     $this->order_basic_obj = OrderBasic::instance();
     $this->order_detail_obj = OrderDetail::instance();
 }
开发者ID:RenzcPHP,项目名称:3dproduct,代码行数:10,代码来源:order.php

示例8: __construct

 public function __construct()
 {
     parent::__construct();
     $this->obj_user_help = userfunc::get_instance();
     $this->obj_order = order::get_instance();
     $this->obj_orderbasic = OrderBasic::instance();
     $this->obj_orderdetail = OrderDetail::instance();
     if ($this->obj_user_help->is_login() == FALSE) {
         //header('Location: http://'.$this->_site_config['site_config']['name'].'/user/login');
     }
 }
开发者ID:RenzcPHP,项目名称:3dproduct,代码行数:11,代码来源:service.php

示例9: setUp

 public function setUp()
 {
     $order_detail = new OrderDetail();
     $order_detail->setBarcode(171804847258);
     $order_detail->setDe(111);
     $order_detail->setInfo(1111);
     $user = new User();
     $user->setBirthday('1981-06-13');
     $user->setEmail('email@email.com');
     $user->setFirstName('FirstName');
     $user->setLastName('LastName');
     $user->setGender(-1);
     $user->setIndentityNumber('asv');
     $user->setJob('Job');
     $user->setMartialStatus(-1);
     $user->setPhone('5335514040');
     $this->order_info = new OrderInfo();
     $this->order_info->setClientPassword("ANRGGCLBU2V55LKKSY3E");
     $this->order_info->setInvoiceNumber("150909-47786");
     $this->order_info->setOrderDetail($order_detail);
     $this->order_info->setPointCode("TDR-4327");
     $this->order_info->setUser($user);
 }
开发者ID:lambadijital,项目名称:bukoli,代码行数:23,代码来源:OrderInfoTest.php

示例10: store

 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store()
 {
     $carts = Cart::content();
     if (Cart::count() < 1) {
         Session::flash('flash_error', 'You need add at least one product!');
     }
     $order = new Order();
     $order->user_id = Auth::user()->id;
     $order->date = date('Y-m-d h:i:s');
     $order->total = money_format('%.2n', Cart::total());
     $order->save();
     foreach ($carts as $row) {
         $product = Product::find($row->id)->firstOrFail();
         $orderDetail = new OrderDetail();
         $orderDetail->order_id = $order->id;
         $orderDetail->product_id = $product->code;
         $orderDetail->quantity = $row->qty;
         $orderDetail->sub_total = money_format('%.2n', $row->subtotal);
         $orderDetail->save();
         Cart::destroy();
     }
     Session::flash('message', 'Successfully created order!');
     return Redirect::to('orders');
 }
开发者ID:elioth010,项目名称:carretilla_online,代码行数:29,代码来源:OrderController.php

示例11: getTableRecentOrders

 public function getTableRecentOrders()
 {
     $header = array(array('title' => $this->l('Customer Name'), 'class' => 'text-left'), array('title' => $this->l('Products'), 'class' => 'text-center'), array('title' => $this->l('Total'), 'class' => 'text-center'), array('title' => $this->l('Date'), 'class' => 'text-center'), array('title' => $this->l('Action'), 'class' => 'text-center'));
     $orders = Order::getOrdersWithInformations((int) Configuration::get('DASHPRODUCT_NBR_SHOW_LAST_ORDER', 10));
     $body = array();
     foreach ($orders as $order) {
         $currency = Currency::getCurrency((int) $order['id_currency']);
         $tr = array();
         $tr[] = array('id' => 'firstname_lastname', 'value' => Tools::htmlentitiesUTF8($order['firstname']) . ' ' . Tools::htmlentitiesUTF8($order['lastname']), 'class' => 'text-left');
         $tr[] = array('id' => 'state_name', 'value' => count(OrderDetail::getList((int) $order['id_order'])), 'class' => 'text-center');
         $tr[] = array('id' => 'total_paid', 'value' => Tools::displayPrice((double) $order['total_paid'], $currency), 'class' => 'text-center', 'wrapper_start' => '<span class="badge">', 'wrapper_end' => '<span>');
         $tr[] = array('id' => 'date_add', 'value' => Tools::displayDate($order['date_add']), 'class' => 'text-center');
         $tr[] = array('id' => 'details', 'value' => $this->l('Details'), 'class' => 'text-right', 'wrapper_start' => '<a class="btn btn-default" href="index.php?tab=AdminOrders&id_order=' . (int) $order['id_order'] . '&vieworder&token=' . Tools::getAdminTokenLite('AdminOrders') . '" title="' . $this->l('Details') . '"><i class="icon-search"></i>', 'wrapper_end' => '</a>');
         $body[] = $tr;
     }
     return array('header' => $header, 'body' => $body);
 }
开发者ID:dev-lav,项目名称:htdocs,代码行数:17,代码来源:dashproducts.php

示例12: fire

 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function fire()
 {
     $days_to_wait = Config::get('store.days_to_close');
     //\DB::enableQueryLog();
     $this->info("Checks If there are orders to be closed ({$days_to_wait} Days Old)");
     //Checks all closed orders that has not been rated nor mail has been sent and where updated 5 days ago
     //and the mails has not been sent yet
     $orders = Order::where('status', 'sent')->where('updated_at', '<', Carbon::now()->subDays($days_to_wait))->get();
     //$this->info(print_r(\DB::getQueryLog()));
     $this->info("Orders That need to be closed: " . $orders->count());
     foreach ($orders as $order) {
         $this->info("Order: " . $order->id . ' Needs to be closed');
         $buyer = User::find($order->user_id);
         if ($buyer) {
             $email = $buyer->email;
             $mail_subject = trans('email.cron_emails.order_closed_for_time');
             $data = ['email_message' => $mail_subject, 'email' => $email, 'subject' => $mail_subject, 'order_id' => $order->id];
             Mail::queue('emails.cron.close_order', $data, function ($message) use($data) {
                 $message->to($data['email'])->subject($data['subject']);
             });
             $order->status = 'closed';
             $order->end_date = DB::raw('NOW()');
             $seller = User::findOrFail($order->seller_id);
             if ($seller) {
                 $order_content = OrderDetail::where('order_id', $order->id)->get();
                 $total_points = 0;
                 foreach ($order_content as $order_detail) {
                     $total_points += $order_detail->quantity * $order_detail->price;
                     $order_detail->status = 0;
                     $order_detail->delivery_date = DB::raw('NOW()');
                     $order_detail->save();
                     if ($order_detail->product->type != 'item') {
                         switch ($order_detail->product->type) {
                             case 'key':
                                 $virtualProductsId = VirtualProductOrder::select('virtual_product_id')->where('order_id', $order->id)->get()->toArray();
                                 VirtualProduct::where('product_id', $order_detail->product_id)->whereIn('id', $virtualProductsId)->update(['status' => 'closed']);
                                 break;
                         }
                     }
                 }
                 $seller->modifyPoints($total_points, 8, $order->id);
             }
             $order->save();
         }
     }
 }
开发者ID:masterpowers,项目名称:antVel,代码行数:51,代码来源:CloseOrdersByTime.php

示例13: addPartialSlipDetail

 public function addPartialSlipDetail($order_detail_list)
 {
     // start of implementation of the module code - taxamo
     $reg_taxamo_transaction = null;
     $last_id_order_transaction = Taxamoeuvat::getLastIdByOrder($this->id_order);
     if (!is_null($last_id_order_transaction)) {
         $reg_taxamo_transaction = Taxamoeuvat::idExistsTransaction((int) $last_id_order_transaction);
     }
     // end of code implementation module - taxamo
     foreach ($order_detail_list as $id_order_detail => $tab) {
         $order_detail = new OrderDetail($id_order_detail);
         $order_slip_resume = self::getProductSlipResume($id_order_detail);
         if ($tab['amount'] + $order_slip_resume['amount_tax_incl'] > $order_detail->total_price_tax_incl) {
             $tab['amount'] = $order_detail->total_price_tax_incl - $order_slip_resume['amount_tax_incl'];
         }
         if ($tab['amount'] == 0) {
             continue;
         }
         if ($tab['quantity'] + $order_slip_resume['product_quantity'] > $order_detail->product_quantity) {
             $tab['quantity'] = $order_detail->product_quantity - $order_slip_resume['product_quantity'];
         }
         $tab['amount_tax_excl'] = $tab['amount_tax_incl'] = $tab['amount'];
         $id_tax = (int) Db::getInstance()->getValue('SELECT `id_tax` FROM `' . _DB_PREFIX_ . 'order_detail_tax` WHERE `id_order_detail` = ' . (int) $id_order_detail);
         if ($id_tax > 0) {
             $rate = (double) Db::getInstance()->getValue('SELECT `rate` FROM `' . _DB_PREFIX_ . 'tax` WHERE `id_tax` = ' . (int) $id_tax);
             if ($rate > 0) {
                 $rate = 1 + $rate / 100;
                 $tab['amount_tax_excl'] = $tab['amount_tax_excl'] / $rate;
             }
         }
         if ($tab['quantity'] > 0 && $tab['quantity'] > $order_detail->product_quantity_refunded) {
             $order_detail->product_quantity_refunded = $tab['quantity'];
             $order_detail->save();
         }
         $insert_order_slip = array('id_order_slip' => (int) $this->id, 'id_order_detail' => (int) $id_order_detail, 'product_quantity' => (int) $tab['quantity'], 'amount_tax_excl' => (double) $tab['amount_tax_excl'], 'amount_tax_incl' => (double) $tab['amount_tax_incl']);
         Db::getInstance()->insert('order_slip_detail', $insert_order_slip);
         // start of implementation of the module code - taxamo
         if (!is_null($reg_taxamo_transaction)) {
             Tools::taxamoRefunds($reg_taxamo_transaction[0]['key_transaction'], $order_detail->product_id, (double) $tab['amount_tax_incl']);
         }
         // end of code implementation module - taxamo
     }
 }
开发者ID:hjcalvo,项目名称:prestashop-taxamo-plugin,代码行数:43,代码来源:OrderSlip.php

示例14: getTaxCalculator

 /**
  * Returns the tax calculator associated to this order detail.
  * @since 1.5.0.1
  * @return TaxCalculator
  */
 public function getTaxCalculator()
 {
     return OrderDetail::getTaxCalculatorStatic($this->id);
 }
开发者ID:nmardones,项目名称:PrestaShop,代码行数:9,代码来源:OrderDetail.php

示例15: init

 public function init()
 {
     if (isset($this->context->employee) && $this->context->employee->isLoggedBack() && Tools::getValue('file')) {
         // Admin can directly access to file
         $filename = Tools::getValue('file');
         if (!Validate::isSha1($filename)) {
             die(Tools::displayError());
         }
         $file = _PS_DOWNLOAD_DIR_ . strval(preg_replace('/\\.{2,}/', '.', $filename));
         $filename = ProductDownload::getFilenameFromFilename(Tools::getValue('file'));
         if (empty($filename)) {
             $newFileName = Tools::getValue('filename');
             if (!empty($newFileName)) {
                 $filename = Tools::getValue('filename');
             } else {
                 $filename = 'file';
             }
         }
         if (!file_exists($file)) {
             Tools::redirect('index.php');
         }
     } else {
         if (!($key = Tools::getValue('key'))) {
             $this->displayCustomError('Invalid key.');
         }
         Tools::setCookieLanguage();
         if (!$this->context->customer->isLogged() && !Tools::getValue('secure_key') && !Tools::getValue('id_order')) {
             Tools::redirect('index.php?controller=authentication&back=get-file.php&key=' . $key);
         } else {
             if (!$this->context->customer->isLogged() && Tools::getValue('secure_key') && Tools::getValue('id_order')) {
                 $order = new Order((int) Tools::getValue('id_order'));
                 if (!Validate::isLoadedObject($order)) {
                     $this->displayCustomError('Invalid key.');
                 }
                 if ($order->secure_key != Tools::getValue('secure_key')) {
                     $this->displayCustomError('Invalid key.');
                 }
             }
         }
         /* Key format: <sha1-filename>-<hashOrder> */
         $tmp = explode('-', $key);
         if (count($tmp) != 2) {
             $this->displayCustomError('Invalid key.');
         }
         $filename = $tmp[0];
         $hash = $tmp[1];
         if (!($info = OrderDetail::getDownloadFromHash($hash))) {
             $this->displayCustomError('This product does not exist in our store.');
         }
         /* Product no more present in catalog */
         if (!isset($info['id_product_download']) || empty($info['id_product_download'])) {
             $this->displayCustomError('This product has been deleted.');
         }
         if (!file_exists(_PS_DOWNLOAD_DIR_ . $filename)) {
             $this->displayCustomError('This file no longer exists.');
         }
         if (isset($info['product_quantity_refunded']) && isset($info['product_quantity_return']) && ($info['product_quantity_refunded'] > 0 || $info['product_quantity_return'] > 0)) {
             $this->displayCustomError('This product has been refunded.');
         }
         $now = time();
         $product_deadline = strtotime($info['download_deadline']);
         if ($now > $product_deadline && $info['download_deadline'] != '0000-00-00 00:00:00') {
             $this->displayCustomError('The product deadline is in the past.');
         }
         $customer_deadline = strtotime($info['date_expiration']);
         if ($now > $customer_deadline && $info['date_expiration'] != '0000-00-00 00:00:00') {
             $this->displayCustomError('Expiration date has passed, you cannot download this product');
         }
         if ($info['download_nb'] >= $info['nb_downloadable'] && $info['nb_downloadable']) {
             $this->displayCustomError('You have reached the maximum number of allowed downloads.');
         }
         /* Access is authorized -> increment download value for the customer */
         OrderDetail::incrementDownload($info['id_order_detail']);
         $file = _PS_DOWNLOAD_DIR_ . $info['filename'];
         $filename = $info['display_filename'];
     }
     /* Detect mime content type */
     $mimeType = false;
     if (function_exists('finfo_open')) {
         $finfo = @finfo_open(FILEINFO_MIME);
         $mimeType = @finfo_file($finfo, $file);
         @finfo_close($finfo);
     } else {
         if (function_exists('mime_content_type')) {
             $mimeType = @mime_content_type($file);
         } else {
             if (function_exists('exec')) {
                 $mimeType = trim(@exec('file -b --mime-type ' . escapeshellarg($file)));
                 if (!$mimeType) {
                     $mimeType = trim(@exec('file --mime ' . escapeshellarg($file)));
                 }
                 if (!$mimeType) {
                     $mimeType = trim(@exec('file -bi ' . escapeshellarg($file)));
                 }
             }
         }
     }
     if (empty($mimeType)) {
         $bName = basename($filename);
         $bName = explode('.', $bName);
//.........这里部分代码省略.........
开发者ID:FAVHYAN,项目名称:a3workout,代码行数:101,代码来源:GetFileController.php


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