Inheritance: extends AppModel
Example #1
0
 /**
  * @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();
 }
Example #2
0
 /**
  * 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();
     }
 }
Example #3
0
 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));
 }
Example #4
0
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");
    }
}
 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);
 }
 /**
  * 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;
 }
Example #7
0
 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');
 }
Example #8
0
    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);
    }
Example #9
0
 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;
 }
Example #10
0
    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;
    }
 /**
  * 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();
 }
 public function createOrder($pizzaType)
 {
     $order = new Order();
     $order->setPizzaType($pizzaType);
     $this->storage->addOrder($order);
     return $this;
 }
Example #13
0
 function show_all($page)
 {
     $order = new Order();
     $dataonepage = $order->show_all_order($page);
     $nums_page = $order->num_page;
     include 'order_view.php';
 }
 /**
  * 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;
 }
 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);
 }
 /**
  * can go to next step if order has been paid
  * @see Order::doNextStatus
  * @param Order $order
  * @return OrderStep | Null (next step OrderStep object)
  **/
 public function nextStep(Order $order)
 {
     if ($order->IsPaid()) {
         return parent::nextStep($order);
     }
     return null;
 }
 /**
  * Distribute Items into Packages
  * 
  * @param Order   $order
  * @param float   $maxPricePerPackage
  * @param integer $numPackages
  * 
  * @return void
  * 
  * @throws \UnexpectedValueException
  */
 protected function distributeItemsIntoPackages(Order $order, $maxPricePerPackage, $numPackages)
 {
     $packages = [];
     for ($i = 0; $i < $numPackages; $i++) {
         $packages[] = new Package($maxPricePerPackage);
     }
     if ($this->algoType == self::ALGO_BEST_PRICE) {
         $orderedItems = $order->getItemsOrderedByPriceDesc();
     } else {
         if ($this->algoType == self::ALGO_EVENLY_DISTRIBUTED) {
             $orderedItems = $order->getItemsOrderedByWeightDesc();
         } else {
             throw new \UnexpectedValueException('Undefined algo type: ' . $this->algoType);
         }
     }
     foreach ($orderedItems as $item) {
         $bestPackage = $this->findBestPackageForItem($item, $packages);
         if ($bestPackage >= 0) {
             $packages[$bestPackage]->addItem($item);
         } else {
             // Cannot place item due to restriction so add one more package
             return $this->distributeItemsIntoPackages($order, $maxPricePerPackage, $numPackages + 1);
         }
     }
     // Add packages to order
     $order->setPackages($packages);
 }
Example #18
0
 public function run()
 {
     $faker = Faker::create();
     $parking_lot = ParkingLot::all()->random();
     $car = Car::all()->random();
     $order = new Order();
     $order->parking_lot_id = $parking_lot->id;
     $order->car_id = $car->id;
     $order->stripe_customer_id = $faker->swiftBicNumber;
     $order->save();
     $parking_lot = ParkingLot::all()->random();
     $car = Car::all()->random();
     $order2 = new Order();
     $order2->parking_lot_id = $parking_lot->id;
     $order2->car_id = $car->id;
     $order2->stripe_customer_id = $faker->swiftBicNumber;
     $order2->save();
     $parking_lot = ParkingLot::all()->random();
     $car = Car::all()->random();
     $order3 = new Order();
     $order3->parking_lot_id = $parking_lot->id;
     $order3->car_id = $car->id;
     $order3->stripe_customer_id = $faker->swiftBicNumber;
     $order3->save();
 }
Example #19
0
    public function renderCRTypeDashboard()
    {
        $model = new Order ( 'search' );
        $model->unsetAttributes();  // clear any default values
        $model->splsearch = Helper::CONST_Tomorrow;
        $model->hdnactionname = Helper::CONST_indexactionid;

        $timeslotmodel = new Persontimeslot;
        $timeslotmodel->unsetAttributes();
        $timeslotmodel->slotdate = $model->splsearch;

        if ( isset( $_GET['Order'] ) )
        {
            $model->attributes = $_GET['Order'];
            $timeslotmodel->slotdate = $model->splsearch;
        }
        $options = $this->prepareOrderGridOptions($model->hdnactionname, 
                Helper::CONST_grid_Height_200);
        $this->render( $this->getView('index','index'),
                        array(
                            'model' => $model,
                            'origin' => $model->hdnactionname,
                            'options'=> $options,
                            'fromdb' => true,
                            'timeslotmodel' => $timeslotmodel,
                            )
                    );
    }
Example #20
0
    function index()
    {
        $order = new Order();
        echo 'Grand total is $' . $order->total();
        $product = Product::getProductByID(1);
        echo $product->name . '<br>';
        echo $product->price . '<br>';
        echo $product->id . '<br>';
        echo $product->products_description->description . '<br>';
        /*
		$att = $product->aattributes;
		foreach($att as $at){
			echo $at->name .'<BR>';
			$r = $at->where('aattributes_products.product_id' , $product->id)->aattributes_product;
			echo $r->aattributes_value_id;
						
			foreach($at->aattributes_values->value as $av){
				foreach($av->aattributes_values as $f){
					echo $f->value.'<BR>';
				}
			}
			
			echo '<BR>';
		}
		
		
		$my_at = new Aattribute_Model;
		$my_at->name = 'color';
		$r = $my_at->where('aattributes_values.value', 'blue')->products;
		*/
        echo '<BR><BR>';
        $cat = $product->categories;
        echo 'has ' . $product->find_related('categories')->count_all() . ' categories<br>';
        echo 'has ' . $product->like('name', $product->name)->count_all() . ' related products<br>';
Example #21
0
 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function show($id)
 {
     $order = new Order();
     $orderDetail = $order->getOrderById($id);
     $msg = "Order Details are retrieved successfully.";
     return $this->successMessageWithVar($msg, $orderDetail, 'orderDetails');
 }
 /**
  * Form fields for displaying on the Checkout form, a {@link FlatFeeTaxField} that has
  * a hidden field with an ID for the {@link FlatFeeTaxRate} and a description of 
  * how much the calculated tax amounts to for the current {@link Order}.
  * 
  * @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();
     //Get tax rate based on shipping address
     $shippingCountryID = null;
     if ($order && $order->exists()) {
         $shippingAddress = $order->ShippingAddress();
         if ($shippingAddress) {
             $shippingCountryID = $shippingAddress->CountryID;
         }
     }
     if ($shippingCountryID) {
         $flatFeeTaxRate = DataObject::get_one('FlatFeeTaxRate', "CountryID = '{$shippingCountryID}'");
         if ($flatFeeTaxRate && $flatFeeTaxRate->exists()) {
             $flatFeeTaxField = new FlatFeeTaxField($this, $flatFeeTaxRate->Label(), $flatFeeTaxRate->ID);
             //Set the amount for display on the Order form
             $flatFeeTaxField->setAmount($this->Amount($order, $flatFeeTaxField->Value()));
             $fields->push($flatFeeTaxField);
         }
     }
     //Include the js for tax fields in either case
     if (!$fields->exists()) {
         Requirements::javascript('swipestripe/javascript/FlatFeeTaxField.js');
     }
     return $fields;
 }
 /**
  * can run step once order has been submitted.
  * NOTE: must have a payment (even if it is a fake payment).
  * The reason for this is if people pay straight away then they want to see the payment shown on their invoice.
  * @param Order object
  * @return Boolean - true if the current step is ready to be run...
  **/
 public function initStep(Order $order)
 {
     if ($order->IsSubmitted()) {
         return true;
     }
     return false;
 }
 /**
  * Add a XeroTaxModification to the order by applying tax rates to Items and Modifications in the order using 
  * the taxCalculator.
  * 
  * @param Order $order
  * @param Mixed $value Unused
  */
 public function add($order, $value = null)
 {
     // Go through the items and modifications in the order and apply a tax rate to them
     // Calculate tax based on rates for each item and modification
     $items = $order->Items();
     if ($items && $items->exists()) {
         foreach ($items as $item) {
             $this->taxCalculator->applyItemTaxRate($item);
         }
     }
     $mods = $order->Modifications();
     if ($mods && $mods->exists()) {
         foreach ($mods as $mod) {
             $this->taxCalculator->applyModificationTaxRate($mod);
         }
     }
     // Create new modification using rates for each item and modification in the order
     $taxAmount = $this->taxCalculator->calculate($order);
     $mod = new XeroTaxModification();
     $mod->Price = $taxAmount->getAmount();
     $mod->Description = _t('Xero.TAX', 'Tax');
     $mod->OrderID = $order->ID;
     $mod->Value = null;
     $mod->write();
 }
 /**
  * Add Lipstick card to order if there are non backordered
  * lipstick order items.
  *
  * @param Order $Model
  * @param null $id
  * @return bool
  */
 public function addLipstickCard(Order $Model, $id = null)
 {
     if (empty($id)) {
         $id = $Model->id;
     }
     $Model->id = $id;
     $order = $Model->loadDisplayDetails();
     $already_added = false;
     $shipment_id = null;
     $this->OrderItem = ClassRegistry::init('OrderItem');
     $this->Item = ClassRegistry::init('Item');
     /**
      * Lipstick card is currently not available in these markets
      */
     if (in_array($order['Order']['order_market_id'], [Market::MARKET_UNITED_KINGDOM, Market::MARKET_GERMANY, Market::MARKET_FRANCE, Market::MARKET_SPAIN])) {
         return true;
     }
     $lipstick_card = $this->Item->find('first', ['conditions' => ['Item.sku' => $this->lipstick_card_sku], 'fields' => ['Item.id']]);
     /**
      * Review order items and decide if backorder card is needed
      */
     foreach ($order['OrderCustomer']['OrderItem'] as $item) {
         $hold_code = $item['order_item_hold_code_id'];
         if (in_array($item['Item']['sku'], $this->lipstick_skus) && $hold_code == OrderItemHoldCode::NONE) {
             $pre_kit_backordered = false;
             /**
              * Check for backordered pre-kit parent
              */
             if (!empty($item['parent_id'])) {
                 foreach ($order['OrderCustomer']['OrderItem'] as $parent_item) {
                     if ($parent_item['id'] == $item['parent_id'] && !empty($parent_item['Item']['is_prekit']) && $parent_item['order_item_hold_code_id'] == OrderItemHoldCode::BACKORDERED) {
                         $pre_kit_backordered = true;
                         break;
                     }
                 }
             }
             if (!$pre_kit_backordered) {
                 $lipstick_item = $item;
                 $shipment_id = $item['order_shipment_id'];
             }
         }
         /**
          * Check if there is already a lipstick card
          */
         if ($item['Item']['sku'] == $this->lipstick_card_sku) {
             $already_added = true;
         }
     }
     /**
      * Add lipstick card if needed on shipment
      */
     if (!empty($lipstick_item) && !empty($shipment_id) && !$already_added) {
         $this->OrderItem->clear();
         $item_data = ['order_customer_id' => $order['OrderCustomer']['id'], 'order_shipment_id' => $shipment_id, 'item_id' => $lipstick_card['Item']['id'], 'order_item_type_id' => OrderItemType::TYPE_RETAIL, 'promotion_id' => 0, 'price' => 0, 'commission' => 0, 'quantity' => $this->lipstick_card_qty, 'extended_price' => 0, 'tax_amount' => 0, 'handling_fee' => 0, 'points' => 0, 'date_created' => date('Y-m-d H:i:s'), 'ns_warehouse_id' => $lipstick_item['ns_warehouse_id']];
         $this->OrderItem->save($item_data);
         return true;
     }
     return true;
 }
Example #26
0
 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store()
 {
     $order = new Order();
     $order->pet_id = Input::get('pid');
     $order->user_id = Input::get('uid');
     $order->save();
     return Input::get('pet_id');
 }
Example #27
0
 public function create($data, $save = true)
 {
     $order = new Order($this, $data);
     if ($save) {
         $order->save();
     }
     return $order;
 }
 public function setData(Order $order, array $data)
 {
     if (isset($data['Notes'])) {
         $order->Notes = $data['Notes'];
     }
     //TODO: save this to an order log
     $order->write();
 }
Example #29
0
 /**
  * @param Order $order
  */
 public static function resetEvents(Order $order = null)
 {
     if ($order !== null) {
         unset(static::$events[$order->getInternalId()]);
     } else {
         static::$events = array();
     }
 }
Example #30
0
 /**
  * The function returns Order object for current row.
  * 
  * @access public
  * @return object The Order object.
  */
 public function getOrder()
 {
     if ($this->cachedOrder === null) {
         $Order = new Order();
         $this->cachedOrder = $Order->findItem(array('Id = ' . $this->OrderId));
     }
     return $this->cachedOrder;
 }