예제 #1
0
                 //tracking with options
                 $product['inventory_amount'] = $product['inventory_amount'] - $array['amount'];
                 //substract the amount present in cart
             } elseif ($product['tracking'] === 'D') {
                 //no tracking
                 if ($ls_final_order_amount > 1) {
                     //linked variants(not products present in cart)
                     $product['amount'] = $product['amount'] - $ls_final_order_amount + 1;
                     //substract the amount present in cart from product page array(including component products in cart and linked)
                 } else {
                     $product['amount'] = $product['amount'] - $array['amount'];
                     //substract the amount present in cart from product page array
                 }
             }
             //calculate the estimation
             $ls_individual_estimation = fn_ls_delivery_estimation($array, $hash, 0, true);
             break;
         }
     }
 }
 Registry::get('view')->assign('ls_shipping_estimation_date', date($ls_individual_estimation));
 Registry::get('view')->assign('ls_inventory_amount', $product['inventory_amount']);
 Registry::get('view')->assign('ls_amount', $product['amount']);
 Registry::get('view')->assign('product', $product);
 // Update the images in the list/grid templates
 if (!empty($_REQUEST['image'])) {
     foreach ($_REQUEST['image'] as $div_id => $value) {
         list($obj_id, $width, $height, $type) = explode(',', $value['data']);
         $images_data[$div_id] = array('obj_id' => $obj_id, 'width' => $width, 'height' => $height, 'type' => $type, 'link' => isset($value['link']) ? $value['link'] : '');
     }
     Registry::get('view')->assign('images', $images_data);
예제 #2
0
function fn_ls_delivery_estimation_total($cart_products)
{
    //var_dump($cart_products);
    //get linked products and its details
    fn_ls_get_linked_products($cart_products);
    //get common linked products order total
    fn_ls_linked_products_order_total($cart_products);
    //pass here only linked products that are in cart
    //correct the inventory and order amounts if there are linked products in cart
    fn_linked_products_in_cart_amount($cart_products);
    $ls_shipping_estimation = 0;
    $ls_individual_estimations = array();
    $ls_all_estimations = array();
    foreach ($cart_products as $combination_hash => $product) {
        $ls_shipping_estimation = max(fn_ls_delivery_estimation($product, $combination_hash, $ls_shipping_estimation), $ls_shipping_estimation);
        //total delivery estimation
        //shipping estimation for individual products
        //   $ls_individual_estimations[$combination_hash] = fn_ls_delivery_estimation($product, $combination_hash, 0);
        $ls_individual_estimations[$combination_hash] = fn_ls_delivery_estimation($product, $combination_hash, 0);
        //check if the estimation is Sunday
        if (date("D", $ls_individual_estimations[$combination_hash]) === 'Sun') {
            //add one more day to the estimation
            $ls_individual_estimations[$combination_hash] = $ls_individual_estimations[$combination_hash] + 24 * 60 * 60;
        }
        //    echo "<br>ls_individual_estimation for $combination_hash is ".date('d m Y ',$ls_individual_estimations[$combination_hash]);
    }
    //check if the estimation is Sunday
    if (date("D", $ls_shipping_estimation) === 'Sun') {
        //add one more day to the estimation
        $ls_shipping_estimation = $ls_shipping_estimation + 24 * 60 * 60;
    }
    $ls_all_estimations['total_estimation'] = $ls_shipping_estimation;
    $ls_all_estimations['individual_estimations'] = $ls_individual_estimations;
    return $ls_all_estimations;
}