コード例 #1
0
ファイル: view.html.php プロジェクト: Shtier/digicom
 function newCustomer($tpl = null)
 {
     JToolBarHelper::title(JText::_('Create Order'), 'generic.png');
     JToolBarHelper::cancel();
     require_once JPATH_COMPONENT . '/helpers/sajax.php';
     $db = JFactory::getDBO();
     $username = JRequest::getVar('username', '');
     $user = $this->_models['customer']->getUserByName($username);
     if (!empty($user->id)) {
         $customer = $this->_models['customer']->getCustomerbyID($user->id);
         if (empty($customer->email)) {
             $customer->email = $user->email;
         }
         if (empty($customer->firstname)) {
             $customer->firstname = $user->name;
         }
     } else {
         $customer = $this->_models['customer']->getCustomerbyID(0);
         if (empty($customer->username)) {
             $customer->username = $username;
         }
     }
     $this->assign("cust", $customer);
     $configs = $this->_models['config']->getConfigs();
     $country_option = DigiComHelperDigiCom::get_country_options($customer, false, $configs);
     $lists['country_option'] = $country_option;
     $profile = new StdClass();
     $profile->country = $customer->shipcountry;
     $profile->state = $customer->shipstate;
     $shipcountry_option = DigiComHelperDigiCom::get_country_options($customer, true, $configs);
     $lists['shipcountry_options'] = $shipcountry_option;
     $lists['customerlocation'] = DigiComHelperDigiCom::get_store_province($customer);
     $profile = new StdClass();
     $profile->country = $customer->shipcountry;
     $profile->state = $customer->shipstate;
     $lists['customershippinglocation'] = DigiComHelperDigiCom::get_store_province($profile, true, $configs);
     $cclasses = explode("\n", $customer->taxclass);
     $data = $this->get('listCustomerClasses', 'digicomCustomer');
     $select = '<select name="taxclass" >';
     if (count($data) > 0) {
         foreach ($data as $i => $v) {
             $select .= '<option value="' . $v->id . '" ';
             if (in_array($v->id, $cclasses)) {
                 $select .= ' selected ';
             }
             $select .= ' > ' . $v->name . '</option>';
         }
     }
     $select .= '</select>';
     $lists['customer_class'] = $select;
     $this->assign("lists", $lists);
     $this->assign("configs", $configs);
     parent::display($tpl);
 }