Example #1
0
 /**
  * One Step checkout process
  *
  * @return void
  */
 public function oneStepCheckoutProcess()
 {
     $producthelper = new producthelper();
     $redTemplate = new Redtemplate();
     $carthelper = new rsCarthelper();
     $order_functions = new order_functions();
     $model = $this->getModel('checkout');
     $post = JRequest::get('post');
     $user = JFactory::getUser();
     $session = JFactory::getSession();
     $cart = $session->get('cart');
     $users_info_id = $post['users_info_id'];
     $shipping_box_id = $post['shipping_box_id'];
     $shipping_rate_id = $post['shipping_rate_id'];
     $customer_note = $post['customer_note'];
     $req_number = $post['requisition_number'];
     $customer_message = $post['rs_customer_message_ta'];
     $referral_code = $post['txt_referral_code'];
     $payment_method_id = $post['payment_method_id'];
     $order_total = $cart['total'];
     $total_discount = $cart['cart_discount'] + $cart['voucher_discount'] + $cart['coupon_discount'];
     $order_subtotal = SHIPPING_AFTER == 'total' ? $cart['product_subtotal'] - $total_discount : $cart['product_subtotal_excl_vat'];
     $Itemid = $post['Itemid'];
     $objectname = $post['objectname'];
     $rate_template_id = $post['rate_template_id'];
     $cart_template_id = $post['cart_template_id'];
     $onestep_template_desc = "";
     $rate_template_desc = "";
     if ($objectname == "users_info_id" || $objectname == "shipping_box_id") {
         if ($users_info_id > 0) {
             $shipping_template = $redTemplate->getTemplate("redshop_shipping", $rate_template_id);
             if (count($shipping_template) > 0) {
                 $rate_template_desc = $shipping_template[0]->template_desc;
             }
             $returnarr = $carthelper->replaceShippingTemplate($rate_template_desc, $shipping_rate_id, $shipping_box_id, $user->id, $users_info_id, $order_total, $order_subtotal);
             $rate_template_desc = $returnarr['template_desc'];
             $shipping_rate_id = $returnarr['shipping_rate_id'];
         } else {
             $rate_template_desc = JText::_('COM_REDSHOP_FILL_SHIPPING_ADDRESS');
         }
     }
     if ($shipping_rate_id != "") {
         $shipArr = $model->calculateShipping($shipping_rate_id);
         $cart['shipping'] = $shipArr['order_shipping_rate'];
         $cart['shipping_vat'] = $shipArr['shipping_vat'];
         $cart = $carthelper->modifyDiscount($cart);
     }
     if ($cart_template_id != 0) {
         $templatelist = $redTemplate->getTemplate("checkout", $cart_template_id);
         $onestep_template_desc = $templatelist[0]->template_desc;
         $onestep_template_desc = $model->displayShoppingCart($onestep_template_desc, $users_info_id, $shipping_rate_id, $payment_method_id, $Itemid, $customer_note, $req_number, '', $customer_message, $referral_code);
     }
     $display_shippingrate = '<div id="onestepshiprate">' . $rate_template_desc . '</div>';
     $display_cart = '<div id="onestepdisplaycart">' . $onestep_template_desc . '</div>';
     $description = $display_shippingrate . $display_cart;
     $lang = JFactory::getLanguage();
     $Locale = $lang->getLocale();
     if (in_array('ru', $Locale)) {
         // Commented because redshop currency symbole has been changed because of ajax response
         $description = html_entity_decode($description, ENT_QUOTES, 'KOI8-R');
     }
     $cart_total = $producthelper->getProductFormattedPrice($cart['mod_cart_total']);
     echo "`_`" . $description . "`_`" . $cart_total;
     die;
 }
Example #2
0
}
if (SHIPPING_METHOD_ENABLE) {
    if ($users_info_id > 0) {
        $ordertotal = $cart['total'];
        $total_discount = $cart['cart_discount'] + $cart['voucher_discount'] + $cart['coupon_discount'];
        $order_subtotal = SHIPPING_AFTER == 'total' ? $cart['product_subtotal'] - $total_discount : $cart['product_subtotal'];
        $shippingbox_template_desc = $carthelper->replaceShippingBoxTemplate($shippingbox_template_desc, $shipping_box_post_id);
        $onestep_template_desc = str_replace($shippingbox_template, $shippingbox_template_desc, $onestep_template_desc);
        $returnarr = $carthelper->replaceShippingTemplate($shipping_template_desc, $shipping_rate_id, $shipping_box_post_id, $user->id, $users_info_id, $ordertotal, $order_subtotal);
        $shipping_template_desc = $returnarr['template_desc'];
        $shipping_rate_id = $returnarr['shipping_rate_id'];
        if ($shipping_rate_id) {
            $shipArr = $model->calculateShipping($shipping_rate_id);
            $cart['shipping'] = $shipArr['order_shipping_rate'];
            $cart['shipping_vat'] = $shipArr['shipping_vat'];
            $cart = $carthelper->modifyDiscount($cart);
        }
        $onestep_template_desc = str_replace($shipping_template, $shipping_template_desc, $onestep_template_desc);
    } else {
        $onestep_template_desc = str_replace($shippingbox_template, "", $onestep_template_desc);
        $onestep_template_desc = str_replace($shipping_template, JText::_('COM_REDSHOP_FILL_SHIPPING_ADDRESS'), $onestep_template_desc);
    }
} else {
    $onestep_template_desc = str_replace($shippingbox_template, "", $onestep_template_desc);
    $onestep_template_desc = str_replace($shipping_template, "", $onestep_template_desc);
}
// Get billing info for check is_company
$is_company = $billingaddresses->is_company;
$ean_number = 0;
if ($billingaddresses->ean_number != "") {
    $ean_number = 1;