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


PHP Order类代码示例

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


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

示例1: __construct

 /**
  * @param PaymentId $id
  * @param Order $order
  */
 public function __construct(PaymentId $id, Order $order)
 {
     $this->id = $id;
     $this->createdAt = new \DateTimeImmutable();
     $this->orderId = $order->id();
     $this->state = new Unpaid();
 }
开发者ID:dumplie,项目名称:dumplie,代码行数:11,代码来源:Payment.php

示例2: add

 /**
  * Iterate over the order items and calculate the gst
  * for each depending on StreakGSTModule.config.currency_percentages()
  *
  * @param Order     $order
  * @param null $value
  * @throws ValidationException
  * @throws null
  */
 public function add($order, $value = null)
 {
     $gst = new Price();
     $gst->setCurrency(ShopConfig::current_shop_config()->BaseCurrency);
     $descriptions = array();
     /** @var Price|null $calculated */
     $calculated = null;
     /** @var Item $item */
     foreach ($order->Items() as $item) {
         if ($price = $item->Price()) {
             $currency = $price->getCurrency();
             if ($rate = self::rate_for_currency($currency)) {
                 if (!$calculated) {
                     $calculated = new Price();
                 }
                 $percentage = Zend_Locale_Math::Div($rate, 100.0, 10);
                 $taxed = Zend_Locale_Math::Mul($price, $percentage, 10);
                 $temp = Zend_Locale_Math::Add($calculated, $taxed, 10);
                 $calculated->setAmount($temp);
                 $descriptions[$currency] = static::description($currency);
             }
         }
     }
     if ($calculated) {
         $mod = new StreakGST_Modification();
         $mod->OrderID = $order->ID;
         $mod->Price = 0;
         $mod->Description = implode("<br/>\n", $descriptions);
         $mod->GST = $calculated->getAmount();
         $mod->Value = $calculated->getAmount();
         $mod->write();
     }
 }
开发者ID:swipestreak,项目名称:gst,代码行数:42,代码来源:Modification.php

示例3: actionIndex

 public function actionIndex()
 {
     //        echo 'test';
     $order = new Order();
     $order_info = $order->findAllByAttributes(array('pusher' => Yii::app()->user->getName()));
     $this->render('index', array('order' => $order_info));
 }
开发者ID:shunwusong,项目名称:timer,代码行数:7,代码来源:DefaultController.php

示例4: wpmp_reduce_stock

function wpmp_reduce_stock($orderid = 0)
{
    $settings = maybe_unserialize(get_option('_wpmp_settings'));
    if ($settings['stock']['enable'] == 1) {
        if ($orderid == 0) {
            $orderid = $_POST['order_id'];
        }
        $order = new Order();
        //$order1 = $order->GetOrder($orderid);
        $order_items = $order->GetOrderItems($orderid);
        //print_r($order_items);
        foreach ($order_items as $product_info) {
            $post_meta = array();
            $post_meta = get_post_meta($product_info['pid'], "wpmp_list_opts", true);
            //print_r($post_meta);
            if ($post_meta['manage_stock'] == 1) {
                $quant = $post_meta['stock_qty'] - $product_info['quantity'];
                if ($quant >= 0) {
                    $post_meta['stock_qty'] = $quant;
                } else {
                    $post_meta['stock_qty'] = 0;
                }
                update_post_meta($product_info['pid'], "wpmp_list_opts", $post_meta);
            }
        }
        die("Stock Reduced");
    } else {
        die("Stock not enabled");
    }
}
开发者ID:tvolmari,项目名称:hammydowns,代码行数:30,代码来源:stock.php

示例5: actionEditCustomer

 public function actionEditCustomer($id)
 {
     $data = CJSON::decode(file_get_contents('php://input'));
     $customer = Customer::model()->findByPk($id);
     if (!$customer) {
         $response = array('success' => false, 'message' => 'Couldn\'t find customer with id = ' . $id);
         $this->renderJSON($response);
     }
     $orders = array();
     if (isset($data['orders'])) {
         $orders = $data['orders'];
         unset($data['orders']);
     }
     $customer->attributes = $data;
     $customer->save();
     if (count($orders)) {
         $ordersArray = array();
         foreach ($orders as $order) {
             $order = array('customer_id' => $id, 'posted_at' => $order['postedAt'], 'amount' => $order['amount'], 'paid_at' => $order['paidAt']);
             $orderModel = new Order();
             $orderModel->attributes = $order;
             $orderModel->save();
         }
     }
     $response = array('success' => true);
     $this->renderJSON($response);
 }
开发者ID:krolenyatko,项目名称:testtask,代码行数:27,代码来源:CustomerController.php

示例6: nextStep

 /**
  * We can run the next step, once any items have been added.
  * @see Order::doNextStatus
  * @param Order $order
  * @return OrderStep | Null (next step OrderStep object)
  **/
 public function nextStep(Order $order)
 {
     if ($order->TotalItems($recalculate = true)) {
         return parent::nextStep($order);
     }
     return null;
 }
开发者ID:helpfulrobot,项目名称:sunnysideup-ecommerce,代码行数:13,代码来源:OrderStep_Created.php

示例7: testSinglePageConfig

 public function testSinglePageConfig()
 {
     ShopTest::setConfiguration();
     //start a new order
     $order = new Order();
     $order->write();
     $config = new SinglePageCheckoutComponentConfig($order);
     $components = $config->getComponents();
     //assertions!
     $fields = $config->getFormFields();
     //assertions!
     $required = $config->getRequiredFields();
     //assertions!
     //$validateData = $config->validateData($data);
     //assertions!
     $data = $config->getData();
     //assertions!
     $config->setData($data);
     //assertions!
     //form field generation
     //validate data
     //set data
     //get data
     $this->markTestIncomplete('Lots missing here');
 }
开发者ID:8secs,项目名称:cocina,代码行数:25,代码来源:CheckoutComponentTest.php

示例8: testCreateOrderFromCart

    public function testCreateOrderFromCart()
    {
        $cart_srl = 774;

		try
		{
			$cart = new Cart($cart_srl);
			$order = new Order($cart);
			$order->save();
			$order->saveCartProducts($cart);
		}
		catch(Exception $e)
		{
			$this->fail($e->getMessage());
		}


        $order_repository = new OrderRepository();
        $order = $order_repository->getOrderBySrl($order->order_srl);

        $this->assertEquals(count($cart->getProducts()), count($order->getProducts()));
        $this->assertEquals($cart->getShippingMethodName(), $order->shipping_method);
        $this->assertEquals($cart->getShippingCost(), $order->shipping_cost);
        $this->assertEquals($cart->getPaymentMethodName(), $order->payment_method);
        $this->assertEquals($cart->getTotal(), $order->total);
    }
开发者ID:haegyung,项目名称:xe-module-shop,代码行数:26,代码来源:OrderTest.php

示例9: validateOrder

 public function validateOrder($cart, $id_module, $id_order_status)
 {
     global $cookie;
     if (!Validate::isLoadedObject($cart)) {
         die(Tools::displayError());
     }
     $currency = new Currency((int) $cart->id_currency);
     $order = new Order();
     $order->id_cart = (int) $cart->id;
     $order->id_user = (int) $cart->id_user;
     $order->id_currency = (int) $cart->id_currency;
     $order->id_address = (int) $cart->id_address;
     $order->id_carrier = (int) $cart->id_carrier;
     $order->id_order_status = (int) $id_order_status;
     $order->id_module = (int) $id_module;
     $order->discount = floatval($cart->discount);
     $order->product_total = floatval($cart->getProductTotal());
     $order->shipping_total = floatval($cart->getShippingTotal());
     $order->amount = floatval($cart->getOrderTotal());
     $order->conversion_rate = floatval($currency->conversion_rate);
     $order->track_number = "null";
     if ($order->add()) {
         unset($cookie->id_cart);
         $this->currentOrder = $order->id;
         if ($id_order_status == 2) {
             $products = $cart->getProducts();
             foreach ($products as $row) {
                 Product::updateOrders($row['id_product']);
             }
         }
         return true;
     }
     return false;
 }
开发者ID:yiuked,项目名称:tmcart,代码行数:34,代码来源:PaymentModule.php

示例10: get_from_id

    public static function get_from_id($OrderID, $ChefsTasting = NULL) {
        $OrderID        = (int) $OrderID;
        $data           = dbi()->q_1("  SELECT o.*
                                        FROM Orders o
                                            JOIN OrderDetails od USING (OrderID)
                                            JOIN Items i USING (ItemID)
                                            JOIN Menus m USING (MenuID)
                                        WHERE o.OrderID = '$OrderID'
                                        ORDER BY m.Sequence");
        $order          = new Order($data);
        $order->OrderID = $OrderID;

        if ($ChefsTasting !== NULL) {
            $additional = "AND Chefs_Tasting = '$ChefsTasting'";
        }

        $meals = dbi()->q_all("SELECT ItemID, Count, VegCount, Chefs_Tasting
                                FROM OrderDetails
                                WHERE OrderID = '$order->OrderID'
                                $additional");

        if ($order->CustomerID) {
            $order->Customer = Customer::get_from_id($order->CustomerID);
            $order->add_delivery_fee($order->Customer->DeliveryAddress->Zip);
        } else {
            $order->Amounts->DeliveryFee = new Amount(0);
        }

        foreach ($meals as $meal) {
            $order->add_meal($meal->ItemID, $meal->Count, $meal->VegCount, $meal->Chefs_Tasting);
        }
        return $order;
    }
开发者ID:elliecm,项目名称:MadisonandRayne,代码行数:33,代码来源:order.class.php

示例11: actionAdditem

 /**
  * Displays a particular model.
  * @param integer $id the ID of the model to be displayed
  */
 public function actionAdditem($item_id)
 {
     $user_id = Yii::app()->user->id;
     // find the users cart
     $user = User::model()->find(array('condition' => 'id=:user_id', 'params' => array(':user_id' => $user_id)));
     // find the users cart
     $cart = Cart::model()->find(array('condition' => 'cart_owner=:cart_owner', 'params' => array(':cart_owner' => $user_id)));
     // find the item being reffered to by item_id
     $item = Item::model()->find(array('condition' => 'id=:item_id', 'params' => array(':item_id' => $item_id)));
     if (is_null($cart)) {
         // if the cart is not found. create a cart for the user.
         $cart = new Cart();
         $cart->cart_owner = $user->id;
         $cart->save();
     }
     // check if the same order was already made & increment else, create new
     $order = Order::model()->find(array('condition' => 'item_id=:item_id AND cart_id=:cart_id AND order_by=:order_by', 'params' => array(':item_id' => $item_id, ':cart_id' => $cart->id, ':order_by' => $user->id)));
     if (is_null($order)) {
         $order = new Order();
         $order->create_time = time();
         $order->quantity = 1;
         $order->item_id = $item->id;
         $order->cart_id = $cart->id;
         $order->order_by = $user->id;
     } else {
         $order->quantity = 1 + $order->quantity;
         $order->update_time = time();
     }
     $order->save();
     // find all orders by this user.
     $orders = Order::model()->findAll('cart_id=:cart_id AND order_by=:order_by', array(':cart_id' => $cart->id, ':order_by' => $user->id));
     $return = array('success' => true, 'data' => $orders);
     echo CJavaScript::jsonEncode($return);
     Yii::app()->end();
 }
开发者ID:iusedtobecat,项目名称:sweetparticles,代码行数:39,代码来源:CartController.php

示例12: createOrder

 public function createOrder($pizzaType)
 {
     $order = new Order();
     $order->setPizzaType($pizzaType);
     $this->storage->addOrder($order);
     return $this;
 }
开发者ID:elfelrandcor,项目名称:seminar-3-oop,代码行数:7,代码来源:AbstractPizzaStore.php

示例13: show_all

 function show_all($page)
 {
     $order = new Order();
     $dataonepage = $order->show_all_order($page);
     $nums_page = $order->num_page;
     include 'order_view.php';
 }
开发者ID:nguyenanhtu,项目名称:ecommerce,代码行数:7,代码来源:order_control.php

示例14: getFormFields

 /**
  * Form fields for displaying on the Checkout form, a dropdown of {@link FlatFeeShippingRate}s
  * that are filtered depending on the shipping country selected.
  * 
  * @see FlatFeeShippingRate
  * @see Modifier::combined_form_fields()
  * @param Order $order
  * @return FieldSet
  */
 public function getFormFields($order)
 {
     //TODO use SiteConfig object to get the countries back, but at the moment
     //SiteConfig ID not being set correctly on country db rows
     $fields = new FieldSet();
     $flatFeeShippingRates = DataObject::get('FLatFeeShippingRate');
     if ($flatFeeShippingRates) {
         //TODO could probably do this filter in the DataObject::get()
         //Filter based on shipping address
         $shippingCountry = null;
         if ($order && $order->exists()) {
             $shippingAddress = $order->ShippingAddress();
             if ($shippingAddress) {
                 $shippingCountry = $shippingAddress->Country;
             }
         }
         if ($shippingCountry) {
             foreach ($flatFeeShippingRates as $rate) {
                 if ($rate->CountryCode != $shippingCountry) {
                     $flatFeeShippingRates->remove($rate);
                 }
             }
         }
         $fields->push(new FlatFeeShippingField($this, 'Flat Fee Shipping', $flatFeeShippingRates->map('ID', 'Label')));
     }
     return $fields;
 }
开发者ID:helpfulrobot,项目名称:swipestripe-swipestripe,代码行数:36,代码来源:FlatFeeShipping.php

示例15: __construct

 public function __construct($controller, $name, Order $order)
 {
     $this->order = $order;
     $fields = FieldList::create(HiddenField::create('OrderID', '', $order->ID));
     $actions = FieldList::create();
     //payment
     if (self::config()->allow_paying && $order->canPay()) {
         $gateways = GatewayInfo::get_supported_gateways();
         //remove manual gateways
         foreach ($gateways as $gateway => $gatewayname) {
             if (GatewayInfo::is_manual($gateway)) {
                 unset($gateways[$gateway]);
             }
         }
         if (!empty($gateways)) {
             $fields->push(HeaderField::create("MakePaymentHeader", _t("OrderActionsForm.MAKEPAYMENT", "Make Payment")));
             $outstandingfield = Currency::create();
             $outstandingfield->setValue($order->TotalOutstanding());
             $fields->push(LiteralField::create("Outstanding", sprintf(_t("OrderActionsForm.OUTSTANDING", "Outstanding: %s"), $outstandingfield->Nice())));
             $fields->push(OptionsetField::create('PaymentMethod', _t("OrderActionsForm.PAYMENTMETHOD", "Payment Method"), $gateways, key($gateways)));
             $actions->push(FormAction::create('dopayment', _t('OrderActionsForm.PAYORDER', 'Pay outstanding balance')));
         }
     }
     //cancelling
     if (self::config()->allow_cancelling && $order->canCancel()) {
         $actions->push(FormAction::create('docancel', _t('OrderActionsForm.CANCELORDER', 'Cancel this order')));
     }
     parent::__construct($controller, $name, $fields, $actions);
     $this->extend("updateForm", $order);
 }
开发者ID:NobrainerWeb,项目名称:silverstripe-shop,代码行数:30,代码来源:OrderActionsForm.php


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