Пример #1
0
 public static function renderNamed(&$BTaddressNamed, $adr1, &$cart, $OPCloader, $virtuemart_userinfo_id, $returnHtml = false)
 {
     $uid = JFactory::getUser()->get('id');
     // will load all the shipping addresses
     $ada = array();
     foreach ($adr1 as $k => $v) {
         $ada[$k] = $v;
         $ada['shipto_' . $k] = $v;
     }
     $cart->ST = $ada;
     //do_dump($ref->cart->ST); echo '<br /><br />';
     $adr1->edit_link = '#" onclick="return Onepage.op_showEditST(' . $adr1->virtuemart_userinfo_id . ')';
     $i = 2;
     $adr1 = $OPCloader->setCountryAndState($adr1);
     $arr = array('ST' => $adr1, 'bt_user_info_id' => $virtuemart_userinfo_id, 'BTaddress' => $BTaddressNamed, 'uid' => $uid, 'cart' => $cart, 'i' => $i);
     $html2_1 = $OPCloader->fetch($OPCloader, 'get_shipping_address_v2.tpl', $arr);
     if (empty($html2_1)) {
         // theme file not found, please create or copy /overrides/get_shipping_address_v2.tpl.php
         /// ************** start of customer info / shipping address
         foreach ($BTaddressNamed as $key => $val) {
             if (!empty($adr1->{$key})) {
                 $BTaddressNamed[$key]['value'] = $adr1->{$key};
             } else {
                 unset($BTaddressNamed[$key]);
             }
         }
         $vars = array('BTaddress' => $BTaddressNamed, 'edit_link' => $adr1->edit_link);
         $html2_1 = $OPCloader->fetch($OPCloader, 'customer_info.tpl', $vars);
         $edit_label = OPCLang::_('JACTION_EDIT');
         if ($edit_label == 'JACTION_EDIT') {
             $edit_label = OPCLang::_('EDIT');
         }
         $html2_1 = str_replace(OPCLang::_('COM_VIRTUEMART_USER_FORM_EDIT_BILLTO_LBL'), $edit_label, $html2_1);
         /// ************** end of customer info
     }
     if (!empty($cart->ST['virtuemart_country_id'])) {
         $dc = $cart->ST['virtuemart_country_id'];
     } else {
         $dc = OPCloader::getDefaultCountry($cart, true);
     }
     $hasmissing = $OPCloader->hasMissingFieldsST($cart->ST);
     $html2_id = '<div ';
     if (empty($hasmissing)) {
         $html2_id .= ' style="display: none;" ';
     }
     $html2_id .= ' id="opc_stedit_' . $adr1->virtuemart_userinfo_id . '">';
     $html2_id .= ' <input type="hidden" name="st_complete_list" value="' . $adr1->virtuemart_userinfo_id . '" />';
     $gf = $OPCloader->getSTfields($OPCloader, true, true, $dc);
     //do_dump($gf); echo '<br /><br />';
     $html2_id .= $gf;
     $html2_id .= '</div>';
     $html2_id = str_replace('id="', 'id="REPLACE' . $adr1->virtuemart_userinfo_id . 'REPLACE', $html2_id);
     $html2_id = str_replace('name="', 'name="REPLACE' . $adr1->virtuemart_userinfo_id . 'REPLACE', $html2_id);
     $html2 = '<input type="hidden" id="opc_st_changed_' . $adr1->virtuemart_userinfo_id . '" name="opc_st_changed_' . $adr1->virtuemart_userinfo_id . '" value="';
     if (!empty($hasmissing)) {
         $html2 .= '1';
     } else {
         $html2 .= '0';
     }
     $html2 .= '" />';
     $html2 .= '<div ';
     if (!empty($hasmissing)) {
         $html2 .= ' style="display: none;" ';
     }
     $html2 .= ' id="opc_st_' . $adr1->virtuemart_userinfo_id . '">' . $html2_1 . '</div>' . $html2_id;
     if ($i == 1) {
         $i++;
     } elseif ($i == 2) {
         $i--;
     }
     if (!empty($STaddressList)) {
         $html2 .= '<input type="hidden" name="shipto_logged" value="' . $adr1->virtuemart_userinfo_id . '" />';
     } else {
         $html2 .= '<input type="hidden" name="shipto_logged" value="new" />';
     }
     $html2 = '<div id="hidden_st_' . $adr1->virtuemart_userinfo_id . '" style="display: none;">' . $html2 . '</div>';
     if ($returnHtml) {
         return $html2;
     }
     if (!isset(OPCloader::$extrahtml)) {
         OPCloader::$extrahtml = '';
     }
     OPCloader::$extrahtml .= $html2;
     return $html2;
 }