コード例 #1
0
 public function updateItem($data)
 {
     $producthelper = new producthelper();
     $order_functions = new order_functions();
     $stockroomhelper = new rsstockroomhelper();
     $order_item_id = $data['order_item_id'];
     $orderitemdata = $this->getTable('order_item_detail');
     $orderitemdata->load($order_item_id);
     $orderdata = $this->getTable('order_detail');
     $orderdata->load($this->_id);
     $order_id = $this->_id;
     $product_id = $orderitemdata->product_id;
     $currentStock = $stockroomhelper->getStockroomTotalAmount($product_id);
     $user_id = $orderdata->user_id;
     $productPrice = $data['update_price'];
     $productPrice_new = 0;
     if ($productPrice < 0) {
         $productPrice_new = $productPrice;
         $productPrice = $productPrice * -1;
     }
     $customer_note = $data['customer_note'];
     $product_tax = $producthelper->getProductTax($product_id, $productPrice, $user_id);
     if ($productPrice_new < 0) {
         $product_tax = $product_tax * -1;
         $productPrice = $productPrice_new;
     }
     $new_added_qty = $data['quantity'] - $orderitemdata->product_quantity;
     if ($currentStock >= $new_added_qty || USE_STOCKROOM == 0) {
         $quantity = (int) $data['quantity'];
     } else {
         $quantity = (int) $orderitemdata->product_quantity;
     }
     $product_item_price = $productPrice + $product_tax;
     $product_item_price_excl_vat = $productPrice;
     $product_final_price = $product_item_price * $quantity;
     $productTotalTax = $product_tax * $quantity;
     $subtotal = $product_item_price * $quantity;
     $OrderItems = $order_functions->getOrderItemDetail($order_id);
     $totalTax = $product_tax * $quantity;
     for ($i = 0; $i < count($OrderItems); $i++) {
         if ($order_item_id != $OrderItems[$i]->order_item_id) {
             $itemtax = $OrderItems[$i]->product_item_price - $OrderItems[$i]->product_item_price_excl_vat;
             $totalTax = $totalTax + $itemtax * $OrderItems[$i]->product_quantity;
             $subtotal = $subtotal + $OrderItems[$i]->product_item_price * $OrderItems[$i]->product_quantity;
         }
         if ($order_item_id == $OrderItems[$i]->order_item_id) {
             $newquantity = $OrderItems[$i]->product_quantity - $quantity;
             if ($newquantity > 0) {
                 $stockroomhelper->manageStockAmount($product_id, $newquantity, $orderitemdata->stockroom_id);
             } elseif ($newquantity < 0) {
                 $updatestock = $stockroomhelper->updateStockroomQuantity($product_id, -$newquantity);
                 $stockroom_id_list = $updatestock['stockroom_list'];
                 $stockroom_quantity_list = $updatestock['stockroom_quantity_list'];
                 $orderitemdata->stockroom_id = $stockroom_id_list;
                 $orderitemdata->stockroom_quantity = $stockroom_quantity_list;
             }
             $this->updateAttributeItem($order_item_id, $newquantity, $orderitemdata->stockroom_id);
         }
     }
     $total = $subtotal + $orderdata->order_shipping - abs($orderdata->order_discount);
     $orderitemdata->product_item_price = $product_item_price;
     $orderitemdata->product_item_price_excl_vat = $product_item_price_excl_vat;
     $orderitemdata->product_final_price = $product_final_price;
     $orderitemdata->product_quantity = $quantity;
     $orderitemdata->customer_note = $customer_note;
     $orderdata->order_tax = $totalTax;
     $orderdata->order_total = $total;
     $orderdata->order_subtotal = $subtotal;
     if ($orderitemdata->store()) {
         if (!$orderdata->store()) {
             return false;
         }
         $tmpArr['special_discount'] = $orderdata->special_discount;
         $this->special_discount($tmpArr, true);
     } else {
         return false;
     }
     $order_functions->update_status();
     return true;
 }
コード例 #2
0
ファイル: order.php プロジェクト: jaanusnurmoja/redjoomla
 public function update_status()
 {
     $order_functions = new order_functions();
     $order_functions->update_status();
 }
コード例 #3
0
 public function update_status()
 {
     require_once JPATH_COMPONENT . '/helpers/order.php';
     $order_function = new order_functions();
     $order_function->update_status();
 }