/* --- MODULE: SALE--- */ if (!empty($get_cart->promo_item_id) && $get_cart->promo_start_datetime <= date('Y-m-d') && $get_cart->promo_end_datetime >= date('Y-m-d')) { if ($get_cart->promo_id == 1) { $price_now = $get_cart->type_price - $get_cart->promo_value / 100 * $get_cart->type_price; } else { $price_now = $get_cart->type_price - $get_cart->promo_value; } } else { $price_now = $get_cart->type_price; } if (CURRENCY === 2) { $get_cart->type_price = $get_cart->type_price / $_global_general->currency_rate; $price_now = $price_now / $_global_general->currency_rate; } /* --- INSERT ORDER ITEM --- */ $_checkout_update->insertOrderItem($get_order_id->latest_order_id, $order_item, $get_stock->stock_name, $session_qty[$key], $get_cart->type_price, $get_cart->type_price - $price_now, "0000-00-00 00:00:00", ' ', ' '); /* --- PROMOTION (DISCOUNT) --- */ $item_discount = ''; $get_discount = 0; if ($get_cart->promo_id == 1 and $get_cart->promo_start_datetime <= date('Y-m-d') and $get_cart->promo_end_datetime >= date('Y-m-d')) { $item_discount = $get_cart->promo_value / 100 * $get_cart->type_price; } else { if ($get_cart->promo_id == 2 and $get_cart->promo_start_datetime <= date('Y-m-d') and $get_cart->promo_end_datetime >= date('Y-m-d')) { $item_discount = $get_cart->promo_value; } } $get_discount += $item_discount; /* --- SOLD OUT --- */ $get_product_id = $_checkout_get->success_get_productid($order_item); $check_product_sold = $_checkout_get->success_check_productsoldout($get_product_id->id); $check_type_sold = $_checkout_get->success_check_typesoldout($order_item);
} //$item_discount_price = $get_cart->type_price - $price_now; $item_discount_price = $price['was_price'] - $price['now_price']; /* echo '<br> Order ID: '.$get_order_id->latest_order_id; echo '<br> Order Item: '.$order_item; echo '<br> Stock Name: '.$get_stock->stock_name; echo '<br> Item Quantity: '.$session_qty[$key]; echo '<br> Item Price: '.$price['was_price']; echo '<br> Item Discount: '.$item_discount_price; */ /* --- INSERT ORDER ITEM --- */ $_checkout_update->insertOrderItem($get_order_id->latest_order_id, $order_item, $get_stock->stock_name, $session_qty[$key], $price['was_price'], $item_discount_price, "0000-00-00 00:00:00", ' ', ' '); /* --- DECREMENT STOCK --- */ //$now_qty = $get_cart->stock_quantity - $session_qty[$key]; //$_checkout_update->updateProduct($now_qty, $session_stock[$key]); /* --- PROMOTION (DISCOUNT) --- */ $item_discount = ''; $get_discount = 0; if($get_cart->promo_id == 1 and $get_cart->promo_start_datetime <= date('Y-m-d') and $get_cart->promo_end_datetime >= date('Y-m-d')){ $item_discount = ($get_cart->promo_value / 100) * $get_cart->type_price; }else if($get_cart->promo_id == 2 and $get_cart->promo_start_datetime <= date('Y-m-d') and $get_cart->promo_end_datetime >= date('Y-m-d')){ $item_discount = $get_cart->promo_value; }