Beispiel #1
0
 private function setCartAddress(&$cart)
 {
     include JPATH_ROOT . DS . 'components' . DS . 'com_onepage' . DS . 'config' . DS . 'onepage.cfg.php';
     require_once JPATH_OPC . DS . 'overrides' . DS . 'cart_override.php';
     require_once JPATH_OPC . DS . 'helpers' . DS . 'loader.php';
     $OPCcheckout = new OPCcheckout($cart);
     $loader = new OPCloader();
     $obj = new stdClass();
     $obj->cart = $cart;
     $tos_required = $loader->getTosRequired($obj);
     if (!empty($op_no_display_name)) {
         JRequest::setVar('name', OPCLang::_('COM_VIRTUEMART_SHOPPER_FORM_ADDRESS_1'));
         JRequest::setVar('shipto_name', OPCLang::_('COM_VIRTUEMART_SHOPPER_FORM_ADDRESS_1'));
     }
     if ($tos_required) {
         if (!empty($post['tosAccepted'])) {
             $cart->tosAccepted = 1;
             $cart->BT['agreed'] = 1;
             if (!empty($cart->ST)) {
                 $cart->ST['agreed'] = 1;
             }
             JRequest::setVar('agreed', 1);
             JRequest::setVar('shipto_agreed', 1);
         } else {
         }
     } else {
         JRequest::setVar('agreed', 1);
         JRequest::setVar('shipto_agreed', 1);
         JRequest::setVar('tosAccepted', 1);
     }
     // we need to find in what type we are
     $ship_to_id = JRequest::getVar('shipto_logged', false);
     $bt_id = JRequest::getVar('ship_to_info_id_bt', false);
     $test = JRequest::getVar('ship_to_info_id', false);
     if (!empty($ship_to_id) && !empty($bt_id)) {
         // let's set BT id as the BT address
         $sa = JRequest::getVar('sa', false);
         if ($sa == 'adresaina') {
             $stopen = true;
             JRequest::setVar('shiptoopen', true);
         } else {
             $stopen = false;
             JRequest::setVar('shiptoopen', false);
         }
         //$this->setAddress($cart, false, true);
         $this->setAddress($cart, false);
         if ($stopen) {
             $cart->selected_shipto = $ship_to_id;
             $cart->STsameAsBT = 0;
         } else {
             $cart->ST = 0;
             $cart->selected_shipto = $bt_id;
             $cart->STsameAsBT = 1;
         }
     } else {
         $this->setAddress($cart, false);
     }
 }