예제 #1
0
function product_assoc_get_price($unit_list_price, $feature, $party_id)
{
    $query = "SELECT PRODUCT_ID\n\t\t\t  FROM product_feature_appl\n\t\t\t  WHERE PRODUCT_FEATURE_APPL_ID = '" . $unit_list_price . "'\n\t\t\t  LIMIT 1";
    $data = db_query_to_row($query);
    $run_id = $data['PRODUCT_ID'] . '-COPY';
    $query = "SELECT PRODUCT_FEATURE_APPL_ID\n\t\t\t  FROM product_feature_appl\n\t\t\t  WHERE PRODUCT_ID = '{$run_id}' AND PRODUCT_FEATURE_ID = '{$feature}'\n\t\t\t  LIMIT 1";
    $data = db_query_to_row($query);
    $feature_price = product_feature_price_get($data['PRODUCT_FEATURE_APPL_ID'], CUSTOMER_PRICE, $party_id);
    if (empty($feature_price)) {
        $feature_price = product_feature_price_get($data['PRODUCT_FEATURE_APPL_ID'], GENERAL_PRICE, '');
    }
    return $feature_price['PRICE'];
}
예제 #2
0
파일: cart.php 프로젝트: sahartak/megamedia
         $errors[] = 'The additional email provided is incorrect';
     }
 }
 if (empty($errors)) {
     // Placing the actual order
     $placer_name = sprintf("%s %s", $_SESSION['user']['FIRST_NAME'], $_SESSION['user']['LAST_NAME']);
     $order_id = order_place(ORDER_NORMAL, $_POST['EXTERNAL_ID'], now(), $placer_name, DEFAULT_CURRENCY, $Cart->getTotal(), '', '', '0000-00-00', '', $_POST['COMMENTS'], 0.0, $Cart, $is_offer);
     // Storing Order items
     $order_items = $Cart->getProducts();
     foreach ($order_items as $seq => $_item) {
         foreach ($_item['PRODUCTS']['MOTIVES'] as $index => $_amount) {
             if ($_amount) {
                 $unit_list_price = $_item['PRODUCTS']['VARIANT'][$index] . '-' . $_item['OFFER'];
                 $feature_price = product_feature_price_get($unit_list_price, CUSTOMER_PRICE, $_SESSION['user']['PARTY_ID']);
                 if (empty($feature_price)) {
                     $feature_price = product_feature_price_get($unit_list_price, GENERAL_PRICE, '');
                 }
                 $run_price = product_assoc_get_price($unit_list_price, $_item['OFFER'], $_SESSION['user']['PARTY_ID']);
                 order_item_add($order_id, $_item['PRODUCTS']['VARIANT'][$index], '', '', $_amount, $_item['PRICE'], '', $placer_name, 0.0, DEFAULT_CURRENCY, ORDER_NORMAL, $_item['PRODUCTS']['RUNS'][$index], $seq, $_item['OFFER'], $feature_price['PRICE'], $run_price);
             }
         }
     }
     // Adding roles
     order_role_add($order_id, $_SESSION['user']['PARTY_ID'], ORDER_PLACER);
     order_role_add($order_id, $_SESSION['user']['PARTY_ID'], ORDER_CUSTOMER);
     order_role_add($order_id, ENTERPRICE_PARTY_ID, ORDER_RECEIVER);
     // We need to rename the order so we now have the order id
     // instead of the offer id
     if ($from_offer_id && !$is_offer) {
         order_change_id($from_offer_id, $order_id);
     }