/** * * @return unknown_type */ function filterZones() { $app = JFactory::getApplication(); JLoader::import('com_citruscart.library.json', JPATH_ADMINISTRATOR . '/components'); Citruscart::load('CitruscartSelect', 'library.select'); $idtag = 'zone_id'; $countryid = $app->input->getInt('countryid', 0); $idprefix = $app->input->getInt('idprefix', 0); /* $countryid = JRequest::getVar( 'countryid', '', 'request', 'int' ); $idprefix = JRequest::getVar( 'idprefix', '', 'request'); */ if (count($idprefix) > 0) { $idtag = $idprefix . $idtag; } $url = "index.php?option=com_citruscart&format=raw&controller=zones&task=addZone&geozoneid="; $attribs = array('class' => 'inputbox', 'size' => '1'); $hookgeozone = $app->input->get('hookgeozone', TRUE); //$hookgeozone = JRequest::getVar( 'hookgeozone', TRUE, 'request', 'boolean' ); if ($hookgeozone) { $attribs['onchange'] = 'citruscartDoTask( \'' . $url . '\'+document.getElementById(\'geozone_id\').value+\'&zoneid=\'+this.options[this.selectedIndex].value, \'current_zones_wrapper\', \'\');'; } $html = CitruscartSelect::zone('', $idtag, $countryid, $attribs, $idtag, true); // set response array $response = array(); $response['msg'] = $html; // encode and echo (need to echo to send back to browser) echo json_encode($response); return; }
/** * @Returns a selectlist of zones * @Called via Ajax * * @return unknown_type */ function getZones() { $app = JFactory::getApplication(); Citruscart::load('CitruscartSelect', 'library.select'); $html = ''; $text = ''; $country_id = $app->input->getInt('country_id'); $name = $app->input->get('name', 'zone_id'); if (empty($country_id)) { $html = JText::_('COM_CITRUSCART_SELECT_COUNTRY_FIRST'); } else { $html = CitruscartSelect::zone('', $name, $country_id); } $response = array(); $response['msg'] = $html; $response['error'] = ''; // encode and echo (need to echo to send back to browser) echo json_encode($response); return; }
?> </td> </tr> <tr> <th style="width: 100px; text-align: right;" class="key"> <?php echo JText::_('COM_CITRUSCART_ZONE'); ?> </th> <td> <div id="zones_wrapper"> <?php if (empty($row->zone_id)) { echo JText::_('COM_CITRUSCART_SELECT_COUNTRY_FIRST'); } else { echo CitruscartSelect::zone(@$row->zone_id, 'zone_id', @$row->country_id); } ?> </div> </td> </tr> <?php if ($config->get('show_field_zip', '3') != '0') { ?> <tr> <th style="width: 100px; text-align: right;" class="key"> <?php echo JText::_('COM_CITRUSCART_POSTAL_CODE'); ?> </th> <td>
/** * Gets an address form for display * * param string $prefix * return string html */ function getAddressForm($prefix, $guest = false, $forShipping = false) { $html = ''; $model = $this->getModel('addresses', 'CitruscartModel'); $view = $this->getView($this->get('suffix'), 'html'); $view->set('_controller', $this->get('suffix')); $view->set('_view', $this->get('suffix')); $view->set('_doTask', true); $view->set('hidemenu', true); $view->set('form_prefix', $prefix); $view->set('guest', $guest); $view->setLayout('form_address'); // Checking whether shipping is required $showShipping = false; $cartsModel = $this->getModel('carts'); if ($isShippingEnabled = $cartsModel->getShippingIsEnabled()) { $showShipping = true; } $view->assign('showShipping', $showShipping); $view->assign('forShipping', $forShipping); JModelLegacy::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_citruscart/models'); $countries_model = JModelLegacy::getInstance('Countries', 'CitruscartModel'); $default_country = $countries_model->getDefault(); $default_country_id = $default_country->country_id; $attribs = array('class' => 'inputbox', 'size' => '1'); if ($this->onepage_checkout) { //$attribs['onchange'] = 'citruscartCheckoutAutomaticShippingRatesUpdate( \''.$prefix.'zone_id\', \''.JText::_('COM_CITRUSCART_UPDATING_SHIPPING_RATES').'\', \''.JText::_('COM_CITRUSCART_UPDATING_CART').'\', \''.JText::_('COM_CITRUSCART_UPDATING_ADDRESS').'\', \''.JText::_('COM_CITRUSCART_UPDATING_PAYMENT_METHODS').'\' ); '; } Citruscart::load('CitruscartSelect', 'library.select'); $zones = CitruscartSelect::zone('', $prefix . 'zone_id', $default_country_id, $attribs, $prefix . 'zone_id'); $view->assign('default_country_id', $default_country_id); $view->assign('zones', $zones); $html = $view->loadTemplate(); return $html; }
</td> <td></td> </tr> <tr> <th style="width: 25%;"><?php echo JText::_('COM_CITRUSCART_STATE_REGION'); ?> </th> <td> <div id="zones_wrapper"> <?php $shop_zone = $this->row->get('shop_zone', ''); if (empty($shop_zone)) { echo JText::_('COM_CITRUSCART_SELECT_COUNTRY_FIRST'); } else { echo CitruscartSelect::zone($shop_zone, 'shop_zone', $this->row->get('shop_country', '')); } ?> </div> </td> <td></td> </tr> <tr> <th style="width: 25%;"><?php echo JText::_('COM_CITRUSCART_POSTAL_CODE'); ?> </th> <td><input type="text" name="shop_zip" value="<?php echo $this->row->get('shop_zip', ''); ?> " />
</td> </tr> <tr> <td style="width: 100px; text-align: right;" class="key"> <?php echo JText::_('COM_CITRUSCART_ZONE'); ?> : </td> <td> <div id="shipping_zones_wrapper"> <?php if (empty($row->orderinfo->shipping_zone_id)) { echo JText::_('COM_CITRUSCART_SELECT_COUNTRY_FIRST'); } else { echo CitruscartSelect::zone($row->orderinfo->shipping_zone_id, 'shipping_zone_id', $row->orderinfo->shipping_country_id); } ?> </div> </td> </tr> </table> </fieldset> <input type="hidden" name="id" value="<?php echo $row->order_id; ?> " /> <input type="hidden" name="task" id="task" value="saveAddresses" /> </form>
<?php if ($elements['zone'][0]) { ?> <div class="control-group"> <label class="key"> <?php echo JText::_('COM_CITRUSCART_STATE_PROVINCE'); ?> </label> <div id="<?php echo $this->form_prefix; ?> zones_wrapper"> <?php $attribs = array('class' => 'required', 'size' => '1'); echo CitruscartSelect::zone('', $this->form_prefix . 'zone_id', $this->default_country_id, $attribs, $this->form_prefix . 'zone_id'); ?> </div> </div> <?php } ?> <?php if ($elements['zip'][0]) { ?> <div class="control-group"> <label for="<?php echo $this->form_prefix; ?> postal_code">
/** * Returns a selectlist of zones * Called via Ajax * * @return unknown_type */ function getZones() { Citruscart::load('CitruscartSelect', 'library.select'); $html = ''; $text = ''; /* Get the application */ $app = JFactory::getApplication(); $country_id = $app->input->getInt('country_id'); //$country_id = JRequest::getVar('country_id'); $prefix = $app->input->getString('prefix'); //$prefix = JRequest::getVar('prefix'); if (empty($country_id)) { $html = JText::_('COM_CITRUSCART_SELECT_COUNTRY'); } else { $html = CitruscartSelect::zone('', $prefix . 'zone_id', $country_id); } $response = array(); $response['msg'] = $html . " *"; $response['error'] = ''; // encode and echo (need to echo to send back to browser) echo json_encode($response); return; }
/** * Returns a selectlist of zones * Called via Ajax * * @return unknown_type */ function getZones() { $input = JFactory::getApplication()->input; Citruscart::load('CitruscartSelect', 'library.select'); $html = ''; $text = ''; $country_id = $input->getInt('country_id'); $prefix = $input->getString('prefix'); $html = CitruscartSelect::zone('', $prefix . 'zone_id', $country_id); $response = array(); $response['msg'] = $html; $response['error'] = ''; // encode and echo (need to echo to send back to browser) echo json_encode($response); return; }