Beispiel #1
0
 public function display($tpl = null)
 {
     $option = JRequest::getVar('option');
     $extra_field = new extra_field();
     $order_functions = new order_functions();
     $Redconfiguration = new Redconfiguration();
     $document = JFactory::getDocument();
     $document->setTitle(JText::_('COM_REDSHOP_ORDER'));
     $document->addScript('components/' . $option . '/assets/js/select_sort.js');
     $document->addStyleSheet('components/' . $option . '/assets/css/search.css');
     $document->addScript('components/' . $option . '/assets/js/search.js');
     $document->addScript('components/' . $option . '/assets/js/json.js');
     $document->addScript('components/' . $option . '/assets/js/validation.js');
     $document->addScript('components/' . $option . '/assets/js/order.js');
     $document->addScript('components/' . $option . '/assets/js/common.js');
     $uri = JFactory::getURI();
     $lists = array();
     $billing = array();
     $shippinginfo = array();
     $model = $this->getModel();
     $detail = $this->get('data');
     $redhelper = new redhelper();
     $payment_lang_list = $redhelper->getPlugins("redshop_payment");
     $language = JFactory::getLanguage();
     $base_dir = JPATH_ADMINISTRATOR;
     $language_tag = $language->getTag();
     for ($l = 0; $l < count($payment_lang_list); $l++) {
         $extension = 'plg_redshop_payment_' . $payment_lang_list[$l]->element;
         $language->load($extension, $base_dir, $language_tag, true);
     }
     $err = JRequest::getVar('err', '');
     $shipping_rate_id = JRequest::getVar('shipping_rate_id');
     $user_id = JRequest::getVar('user_id', 0);
     if ($user_id != 0) {
         $billing = $order_functions->getBillingAddress($user_id);
         $shippinginfo = $order_functions->getShippingAddress($user_id);
     } else {
         $billing = $model->setBilling();
     }
     $shipping_country = 0;
     $shipping_state = 0;
     $key = 0;
     $shippingop = array();
     $shippingop[0] = new stdClass();
     $shippingop[0]->users_info_id = 0;
     $shippingop[0]->text = JText::_('COM_REDSHOP_SELECT');
     if (count($shippinginfo) > 0) {
         $shipping_users_info_id = JRequest::getVar('shipping_users_info_id', 0);
         if ($shipping_users_info_id != 0) {
             for ($o = 0; $o < count($shippinginfo); $o++) {
                 if ($shippinginfo[$o]->users_info_id == $shipping_users_info_id) {
                     $key = $o;
                     break;
                 }
             }
             $shipping_country = $shippinginfo[$key]->country_code;
             $shipping_state = $shippinginfo[$key]->state_code;
         }
         $shippingop = array_merge($shippingop, $shippinginfo);
         $billisship = $shippinginfo[$key]->billisship = $shipping_users_info_id ? 0 : 1;
     } else {
         $shippinginfo[0] = $model->setShipping();
         $shipping_users_info_id = $shippinginfo[0]->users_info_id = 0;
         $billisship = $shippinginfo[0]->billisship;
     }
     $shdisable = $billisship ? "disabled" : "";
     $detail->user_id = $user_id;
     $lists['shippinginfo_list'] = JHTML::_('select.genericlist', $shippingop, 'shipp_users_info_id', 'class="inputbox" ' . $shdisable . ' onchange="getShippinginfo(this.value, ' . $billing->is_company . ');" ', 'users_info_id', 'text', $shipping_users_info_id);
     $payment_detail = $this->get('payment');
     JToolBarHelper::title(JText::_('COM_REDSHOP_ORDER') . ': <small><small>[ ' . JText::_('COM_REDSHOP_NEW') . ' ]</small></small>', 'redshop_order48');
     if ($err == "" && array_key_exists("users_info_id", $billing) && $billing->users_info_id) {
         JToolBarHelper::custom('savepay', 'save.png', 'save_f2.png', 'Save + Pay', false);
         JToolBarHelper::custom('save_without_sendmail', 'save.png', 'save_f2.png', JText::_('COM_REDSHOP_SAVE_WITHOUT_SEND_ORDERMAIL_LBL'), false);
         JToolBarHelper::save();
     }
     JToolBarHelper::cancel();
     $countryarray = $Redconfiguration->getCountryList((array) $billing, "country_code", "BT");
     $billing->country_code = $countryarray['country_code'];
     $lists['country_code'] = $countryarray['country_dropdown'];
     $statearray = $Redconfiguration->getStateList((array) $billing, "state_code", "country_code", "BT", 1);
     $lists['state_code'] = $statearray['state_dropdown'];
     $shipping['country_code_ST'] = $shippinginfo[$key]->country_code;
     $countryarray = $Redconfiguration->getCountryList((array) $shipping, "country_code_ST", "ST");
     $shipping['country_code_ST'] = $shippinginfo[$key]->country_code = $countryarray['country_code_ST'];
     $lists['country_code_ST'] = $countryarray['country_dropdown'];
     $statearray = $Redconfiguration->getStateList((array) $shipping, "state_code_ST", "country_code_ST", "ST", 1);
     $lists['state_code_ST'] = $statearray['state_dropdown'];
     $lists['is_company'] = JHTML::_('select.booleanlist', 'is_company', 'class="inputbox" onchange="showOfflineCompanyOrCustomer(this.value);" ', $billing->is_company, JText::_('COM_REDSHOP_USER_COMPANY'), JText::_('COM_REDSHOP_USER_CUSTOMER'));
     $lists['customer_field'] = $extra_field->list_all_field(7, $billing->users_info_id);
     $lists['company_field'] = $extra_field->list_all_field(8, $billing->users_info_id);
     $lists['shipping_customer_field'] = $extra_field->list_all_field(14, $shippinginfo[0]->users_info_id);
     $lists['shipping_company_field'] = $extra_field->list_all_field(15, $shippinginfo[0]->users_info_id);
     $this->lists = $lists;
     $this->detail = $detail;
     $this->billing = $billing;
     $this->shipping = $shippinginfo[$key];
     $this->shipping_users_info_id = $shipping_users_info_id;
     $this->payment_detail = $payment_detail;
     $this->shipping_rate_id = $shipping_rate_id;
     $this->request_url = $uri->toString();
     parent::display($tpl);
 }
Beispiel #2
0
$redhelper = new redhelper();
$redTemplate = new Redtemplate();
$shippinghelper = new shipping();
$session = JFactory::getSession();
$document = JFactory::getDocument();
// Get redshop helper
$Itemid = $redhelper->getCheckoutItemid();
$model = $this->getModel('checkout');
$cart = $session->get('cart');
JHTML::Script('credit_card.js', 'components/com_redshop/assets/js/', false);
$billingaddresses = $model->billingaddresses();
if (!count($billingaddresses)) {
    $msg = JText::_('COM_REDSHOP_LOGIN_USER_IS_NOT_REDSHOP_USER');
    $app->Redirect("index.php?option=com_redshop&view=account_billto&return=checkout&Itemid=" . $Itemid, $msg);
}
$paymentmethod = $redhelper->getPlugins('redshop_payment');
$selpayment_method_id = 0;
if (count($paymentmethod) > 0) {
    $selpayment_method_id = $paymentmethod[0]->element;
}
$shippingBoxes = $shippinghelper->getShippingBox();
$selshipping_box_post_id = 0;
if (count($shippingBoxes) > 0) {
    $selshipping_box_post_id = $shippingBoxes[0]->shipping_box_id;
}
$users_info_id = JRequest::getInt('users_info_id', $this->users_info_id);
$payment_method_id = JRequest::getCmd('payment_method_id', $selpayment_method_id);
$shipping_box_post_id = JRequest::getInt('shipping_box_id', $selshipping_box_post_id);
$shipping_rate_id = JRequest::getInt('shipping_rate_id', 0);
if ($users_info_id == 0) {
    $users_info_id = $billingaddresses->users_info_id;
Beispiel #3
0
 public function display($tpl = null)
 {
     $option = JRequest::getVar('option');
     $document = JFactory::getDocument();
     $document->setTitle(JText::_('COM_REDSHOP_ORDER'));
     $order_functions = new order_functions();
     $redhelper = new redhelper();
     $uri = JFactory::getURI();
     // Load language file
     $payment_lang_list = $redhelper->getPlugins("redshop_payment");
     $language = JFactory::getLanguage();
     $base_dir = JPATH_ADMINISTRATOR;
     $language_tag = $language->getTag();
     for ($l = 0; $l < count($payment_lang_list); $l++) {
         $extension = 'plg_redshop_payment_' . $payment_lang_list[$l]->element;
         $language->load($extension, $base_dir, $language_tag, true);
     }
     $layout = JRequest::getVar('layout');
     $document->addScript('components/' . $option . '/assets/js/order.js');
     $document->addScript('components/' . $option . '/assets/js/common.js');
     $document->addScript('components/' . $option . '/assets/js/validation.js');
     $document->addScript(JURI::base() . 'components/' . $option . '/assets/js/select_sort.js');
     $document->addStyleSheet(JURI::base() . 'components/' . $option . '/assets/css/search.css');
     $document->addScript(JURI::base() . 'components/' . $option . '/assets/js/search.js');
     $document->addScript(JURI::base() . 'components/' . $option . '/assets/js/json.js');
     $lists = array();
     $model = $this->getModel();
     $detail = $this->get('data');
     $billing = $order_functions->getOrderBillingUserInfo($detail->order_id);
     $shipping = $order_functions->getOrderShippingUserInfo($detail->order_id);
     $task = JRequest::getVar('task');
     if ($task == 'ccdetail') {
         $ccdetail = $model->getccdetail($detail->order_id);
         $this->ccdetail = $ccdetail;
         $this->setLayout('ccdetail');
         parent::display($tpl);
         exit;
     }
     if ($layout == 'shipping' || $layout == 'billing') {
         if (!$shipping || $layout == 'billing') {
             $shipping = $billing;
         }
         $this->setLayout($layout);
         $Redconfiguration = new Redconfiguration();
         $countryarray = $Redconfiguration->getCountryList((array) $shipping);
         $shipping->country_code = $countryarray['country_code'];
         $lists['country_code'] = $countryarray['country_dropdown'];
         $statearray = $Redconfiguration->getStateList((array) $shipping);
         $lists['state_code'] = $statearray['state_dropdown'];
         $showcountry = count($countryarray['countrylist']) == 1 && count($statearray['statelist']) == 0 ? 0 : 1;
         $showstate = $statearray['is_states'] <= 0 ? 0 : 1;
         $this->showcountry = $showcountry;
         $this->showstate = $showstate;
     } elseif ($layout == "print_order" || $layout == 'productorderinfo' || $layout == 'creditcardpayment') {
         $this->setLayout($layout);
     } else {
         $this->setLayout('default');
     }
     $payment_detail = $order_functions->getOrderPaymentDetail($detail->order_id);
     if (count($payment_detail) > 0) {
         $payment_detail = $payment_detail[0];
     }
     $isNew = $detail->order_id < 1;
     $text = $isNew ? JText::_('COM_REDSHOP_NEW') : JText::_('COM_REDSHOP_EDIT');
     JToolBarHelper::title(JText::_('COM_REDSHOP_ORDER') . ': <small><small>[ ' . $text . ' ]</small></small>', 'redshop_order48');
     $redhelper = new redhelper();
     $backlink = 'index.php?option=com_redshop&view=order';
     $backlink = $redhelper->sslLink($backlink, 0);
     $new_link = 'index.php?option=com_redshop&view=order';
     JToolBarHelper::back(JText::_('COM_REDSHOP_ORDERLIST'), 'javascript:location.href=\'' . $new_link . '\';');
     // Section can be added from here
     $option = array();
     $option[] = JHTML::_('select.option', '0', JText::_('COM_REDSHOP_SELECT'));
     $this->lists = $lists;
     $this->detail = $detail;
     $this->billing = $billing;
     $this->shipping = $shipping;
     $this->payment_detail = $payment_detail;
     $this->shipping_rate_id = $detail->ship_method_id;
     $this->request_url = $uri->toString();
     parent::display($tpl);
 }
Beispiel #4
0
 public function display($tpl = null)
 {
     $app = JFactory::getApplication();
     $model = $this->getModel('checkout');
     $Itemid = JRequest::getInt('Itemid');
     $task = JRequest::getCmd('task');
     $user = JFactory::getUser();
     $redhelper = new redhelper();
     $field = new extraField();
     $session = JFactory::getSession();
     // Load language file
     $payment_lang_list = $redhelper->getPlugins("redshop_payment");
     $language = JFactory::getLanguage();
     $base_dir = JPATH_ADMINISTRATOR;
     $language_tag = $language->getTag();
     for ($l = 0; $l < count($payment_lang_list); $l++) {
         $extension = 'plg_redshop_payment_' . $payment_lang_list[$l]->element;
         $language->load($extension, $base_dir, $language_tag, true);
     }
     JHTML::Script('joomla.javascript.js', 'includes/js/', false);
     JHTML::Script('validate.js', 'media/system/js/', false);
     JHTML::Script('jquery-1.4.2.min.js', 'components/com_redshop/assets/js/', false);
     JHTML::Script('jquery.validate.js', 'components/com_redshop/assets/js/', false);
     JHTML::Script('common.js', 'components/com_redshop/assets/js/', false);
     JHTML::Script('jquery.metadata.js', 'components/com_redshop/assets/js/', false);
     JHTML::Script('registration.js', 'components/com_redshop/assets/js/', false);
     JHTML::Stylesheet('validation.css', 'components/com_redshop/assets/css/');
     JHTML::Script('redBOX.js', 'components/com_redshop/assets/js/', false);
     if (JPluginHelper::isEnabled('redshop_veis_registration', 'rs_veis_registration')) {
         JHTML::Script('veis.js', 'plugins/redshop_veis_registration/rs_veis_registration/js/', false);
     }
     $cart = $session->get('cart');
     $auth = $session->get('auth');
     if (!is_array($auth)) {
         $auth['users_info_id'] = 0;
         $session->set('auth', $auth);
         $auth = $session->get('auth');
     }
     if ($cart['idx'] < 1) {
         $msg = JText::_('COM_REDSHOP_EMPTY_CART');
         $link = 'index.php?option=com_redshop&Itemid=' . $Itemid;
         $app->Redirect($link, $msg);
     }
     $lists = array();
     if ($task != '') {
         $tpl = $task;
     } else {
         if ($user->id || $auth['users_info_id'] > 0) {
             $cart = $session->get('cart');
             if (DEFAULT_QUOTATION_MODE == 1 && !array_key_exists("quotation_id", $cart)) {
                 $app->Redirect('index.php?option=com_redshop&view=quotation&Itemid=' . $Itemid);
             }
             $users_info_id = JRequest::getInt('users_info_id');
             $billingaddresses = $model->billingaddresses();
             $shippingaddresses = $model->shippingaddresses();
             if (!$users_info_id) {
                 if ((!isset($users_info_id) || $users_info_id == 0) && count($shippingaddresses) > 0) {
                     $users_info_id = $shippingaddresses[0]->users_info_id;
                 } elseif ((!isset($users_info_id) || $users_info_id == 0) && count($billingaddresses) > 0) {
                     $users_info_id = $billingaddresses->users_info_id;
                 } else {
                     $app->Redirect("index.php?option=com_redshop&view=account_billto&Itemid=" . $Itemid);
                 }
             }
             $shipping_rate_id = JRequest::getInt('shipping_rate_id');
             $element = JRequest::getCmd('payment_method_id');
             $ccinfo = JRequest::getInt('ccinfo');
             $total_discount = $cart['cart_discount'] + $cart['voucher_discount'] + $cart['coupon_discount'];
             $subtotal = SHIPPING_AFTER == 'total' ? $cart['product_subtotal'] - $total_discount : $cart['product_subtotal'];
             $this->users_info_id = $users_info_id;
             $this->shipping_rate_id = $shipping_rate_id;
             $this->element = $element;
             $this->ccinfo = $ccinfo;
             $this->order_subtotal = $subtotal;
             $this->ordertotal = $cart['total'];
         } else {
             // Field_section 6 : Customer Registration
             $lists['extra_field_user'] = $field->list_all_field(7);
             // Field_section 6 : Company Address
             $lists['extra_field_company'] = $field->list_all_field(8);
             $lists['shipping_customer_field'] = $field->list_all_field(14, 0, 'billingRequired valid');
             $lists['shipping_company_field'] = $field->list_all_field(15, 0, 'billingRequired valid');
         }
     }
     if (($user->id || $auth['users_info_id'] > 0) && ONESTEP_CHECKOUT_ENABLE) {
         $this->setLayout('onestepcheckout');
     }
     $this->lists = $lists;
     parent::display($tpl);
 }