public function renderEditForm($tpl = NULL) { $app = JFactory::getApplication(); if (!isset($this->context)) { $this->context = JeproshopContext::getContext(); } $this->helper = new JeproshopHelper(); $languages = JeproshopLanguageModelLanguage::getLanguages(); $this->assignRef('languages', $languages); $currencies = JeproshopCurrencyModelCurrency::getStaticCurrencies(); $this->assignRef('currencies', $currencies); $zones = JeproshopZoneModelZone::getZones(); $this->assignRef('zones', $zones); $addressLayout = JeproshopAddressFormatModelAddressFormat::getAddressCountryFormat($this->country->country_id); if ($value = $app->input->get('address_layout')) { $addressLayout = $value; } $default_layout = ''; $default_layout_tab = array(array('firstname', 'lastname'), array('company'), array('vat_number'), array('address1'), array('address2'), array('postcode', 'city'), array('Country:name'), array('phone'), array('phone_mobile')); foreach ($default_layout_tab as $line) { $default_layout .= implode(' ', $line) . "\r\n"; } $this->assignRef('address_layout', $addressLayout); $encodingAddressLayout = urlencode($addressLayout); $this->assignRef('encoding_address_layout', $encodingAddressLayout); $encodingDefaultLayout = urlencode($default_layout); $this->assignRef('encoding_default_layout', $encodingDefaultLayout); $displayValidFields = $this->displayValidFields(); $this->assignRef('display_valid_fields', $displayValidFields); $this->addToolBar(); $this->sideBar = JHtmlSidebar::render(); parent::display($tpl); }
/** * Returns address format fields in array by country * * @param int $country_id * @param bool $split_all * @param bool $cleaned * @return Array String field address format */ public static function getOrderedAddressFields($country_id = 0, $split_all = false, $cleaned = false) { $out = array(); $field_set = explode("\n", JeproshopAddressFormatModelAddressFormat::getAddressCountryFormat($country_id)); foreach ($field_set as $field_item) { if ($split_all) { $keyList = array(); if ($cleaned) { $keyList = $cleaned ? preg_split(self::_CLEANING_REGEX_, $field_item, -1, PREG_SPLIT_NO_EMPTY) : explode(' ', $field_item); } foreach ($keyList as $word_item) { $out[] = trim($word_item); } } else { $out[] = $cleaned ? implode(' ', preg_split(self::_CLEANING_REGEX_, trim($field_item), -1, PREG_SPLIT_NO_EMPTY)) : trim($field_item); } } return $out; }