/**
  * Display the view
  */
 public function display($tpl = null)
 {
     $this->params = JComponentHelper::getParams('com_quick2cart');
     $comquick2cartHelper = new comquick2cartHelper();
     $zoneHelper = new zoneHelper();
     // Check whether view is accessible to user
     if (!$zoneHelper->isUserAccessible()) {
         return;
     }
     $qtcshiphelper = new qtcshiphelper();
     $app = JFactory::getApplication();
     $jinput = $app->input;
     $user = JFactory::getUser();
     $layout = $jinput->get('layout', 'default');
     $model = $this->getModel('shipprofileform');
     // Check for errors.
     if (count($errors = $this->get('Errors'))) {
         throw new Exception(implode("\n", $errors));
     }
     if ($layout == 'default') {
         $this->state = $this->get('State');
         $this->item = $this->get('Data');
         $this->form = $this->get('Form');
         // Check whether user is authorized for this zone ?
         if (!empty($this->item->store_id)) {
             $status = $comquick2cartHelper->store_authorize('shipprofileform_default', $this->item->store_id);
             if (!$status) {
                 $zoneHelper->showUnauthorizedMsg();
                 return false;
             }
         }
         // Get store name while edit view
         if (!empty($this->item->id) && !empty($this->item->store_id)) {
             $comquick2cartHelper = new comquick2cartHelper();
             $this->storeDetails = $comquick2cartHelper->getSoreInfo($this->item->store_id);
             $this->shipPluglist = $model->getShipPluginListSelect();
         }
         // Get shipping profile_id
         $shipprofile_id = $app->input->get('id', 0);
         // Getting saved tax rules.
         if (!empty($shipprofile_id)) {
             $this->shipMethods = $model->getShipMethods($shipprofile_id);
         }
     } else {
         $this->qtcShipProfileId = $jinput->get('id');
         $this->shipmethId = $jinput->get('shipmethId', 0);
         $shipProfileDetail = $this->shipProfileDetail = $qtcshiphelper->getShipProfileDetail($this->qtcShipProfileId);
         // Getting saved tax rules.
         if (!empty($this->shipmethId) && !empty($shipProfileDetail['store_id'])) {
             // GET PLUGIN DETAIL
             $this->plgDetail = $qtcshiphelper->getPluginDetailByShipMethId($this->shipmethId);
             $this->shipPluglist = $model->getShipPluginListSelect($this->plgDetail['extension_id']);
             // Get plugin shipping methods
             $qtcshiphelper = new qtcshiphelper();
             $this->response = $qtcshiphelper->qtcLoadShipPlgMethods($this->plgDetail['extension_id'], $shipProfileDetail['store_id'], $this->plgDetail['methodId']);
         }
     }
     $this->_prepareDocument();
     parent::display($tpl);
 }
 /**
  * Display the view
  */
 public function display($tpl = null)
 {
     $comquick2cartHelper = new comquick2cartHelper();
     $zoneHelper = new zoneHelper();
     // Check whether view is accessible to user
     if (!$zoneHelper->isUserAccessible()) {
         return;
     }
     $app = JFactory::getApplication();
     $user = JFactory::getUser();
     $this->state = $this->get('State');
     $this->item = $this->get('Data');
     $this->params = $app->getParams('com_quick2cart');
     $this->form = $this->get('Form');
     if (!empty($this->item->zone_id)) {
         $zoneDetail = $zoneHelper->getZoneDetail($this->item->zone_id);
         // Check whether user is authorized for this zone ?
         if (!empty($zoneDetail['store_id'])) {
             $status = $comquick2cartHelper->store_authorize('taxrateform_default', $zoneDetail['store_id']);
             if (!$status) {
                 $zoneHelper->showUnauthorizedMsg();
                 return false;
             }
         }
     }
     // Check for errors.
     if (count($errors = $this->get('Errors'))) {
         throw new Exception(implode("\n", $errors));
     }
     $this->_prepareDocument();
     parent::display($tpl);
 }
 /**
  * Display the view
  */
 public function display($tpl = null)
 {
     $zoneHelper = new zoneHelper();
     $comquick2cartHelper = new comquick2cartHelper();
     // Check whether view is accessible to user
     if (!$zoneHelper->isUserAccessible('zoneform', "default", 'form')) {
         return;
     }
     $app = JFactory::getApplication();
     $previousId = JFactory::getApplication()->input->get('id');
     $user = JFactory::getUser();
     $jinput = $app->input;
     $layout = $jinput->get('layout', '');
     $this->state = $this->get('State');
     $this->item = $this->get('Data');
     $this->params = $app->getParams('com_quick2cart');
     $this->form = $this->get('Form');
     $model = $this->getModel('zoneform');
     if ($this->item) {
         // Getting countries
         $country = $model->getCountry();
         $this->country = $country;
         // Getting zone rules
         $this->geozonerules = $model->getZoneRules();
         // Check whether user is authorized for this zone ?
         if (!empty($this->item->store_id)) {
             $status = $comquick2cartHelper->store_authorize('zoneform_default');
             if (!$status) {
                 $zoneHelper->showUnauthorizedMsg();
                 return false;
             }
         }
     }
     // For edit zone rules
     if ($layout === 'setrule') {
         $this->rule_id = $jinput->get('zonerule_id');
         // Getting zone rule detail
         $this->ruleDetail = $model->getZoneRuleDetail($this->rule_id);
         if (!empty($this->ruleDetail->country_id)) {
             // Getting Regions from country
             $this->getRegionList = $model->getRegionList($this->ruleDetail->country_id);
         }
         // Getting countries
         $country = $model->getCountry();
         $this->country = $country;
         $app->setUserState('com_quick2cart.edit.zone.id', $previousId);
     }
     // Check for errors.
     if (count($errors = $this->get('Errors'))) {
         throw new Exception(implode("\n", $errors));
     }
     $this->_prepareDocument();
     parent::display($tpl);
 }
$qtczoneShipHelper = new qtczoneShipHelper();
$comquick2cartHelper = new comquick2cartHelper();
$productHelper = new productHelper();
$zoneHelper = new zoneHelper();
$qtcshiphelper = new qtcshiphelper();
$taxHelper = new taxHelper();
$mainframe = JFactory::getApplication();
$jinput = $mainframe->input;
$extension_id = $jinput->get('extension_id');
$methodId = $jinput->get('methodId', 0);
$shipMethDetail = $qtcshiphelper->getShipMethDetail($methodId);
$itemid = $comquick2cartHelper->getitemid('index.php?option=com_quick2cart&view=vendor&layout=cp');
if (!empty($methodId)) {
    $status = $comquick2cartHelper->store_authorize('', $shipMethDetail['store_id']);
    if (!$status) {
        $zoneHelper->showUnauthorizedMsg();
        return false;
    }
}
?>
<script type="text/javascript">

function qtcAddShipMethRates()
{
	var SelectedZoneVal  = document.id('zone_id').value;


	if(SelectedZoneVal  == '')
	{
		var msg = "<?php 
echo JText::_('PLG_QTC_DEFAULT_ZONESHIPPING_INVALID_ZONE_SELECTION');
 /**
  * Display the view
  */
 public function display($tpl = null)
 {
     $comquick2cartHelper = new comquick2cartHelper();
     $zoneHelper = new zoneHelper();
     // Check whether view is accessible to user
     if (!$zoneHelper->isUserAccessible()) {
         return;
     }
     $app = JFactory::getApplication();
     $jinput = $app->input;
     $user = JFactory::getUser();
     $this->params = $app->getParams('com_quick2cart');
     $layout = $jinput->get('layout', 'default');
     $model = $this->getModel('taxprofileform');
     // Check for errors.
     if (count($errors = $this->get('Errors'))) {
         throw new Exception(implode("\n", $errors));
     }
     if ($layout == 'default') {
         $this->state = $this->get('State');
         $this->item = $this->get('Data');
         $this->form = $this->get('Form');
         // Get taxprofile_id
         $taxprofile_id = $app->input->get('id', 0);
         // Getting saved tax rules.
         if (!empty($taxprofile_id)) {
             $this->taxrules = $model->getTaxRules($taxprofile_id);
         }
         // Check whether user is authorized for this zone ?
         if (!empty($this->item->store_id)) {
             $status = $comquick2cartHelper->store_authorize('taxprofileform_default', $this->item->store_id);
             if (!$status) {
                 $zoneHelper->showUnauthorizedMsg();
                 return false;
             }
         }
         // Get store name while edit view
         if (!empty($this->item->id) && !empty($this->item->store_id)) {
             $comquick2cartHelper = new comquick2cartHelper();
             $this->storeDetails = $comquick2cartHelper->getSoreInfo($this->item->store_id);
             // Getting tax rates and Adress types
             $this->taxrate = $model->getTaxRateListSelect($this->item->store_id, '');
             $this->address = $model->getAddressList();
         }
         // Check for errors.
         if (count($errors = $this->get('Errors'))) {
             throw new Exception(implode("\n", $errors));
         }
     } else {
         $this->taxRule_id = $jinput->get('id');
         $defaultTaxRateId = '';
         $defaultAddressId = '';
         // Getting saved tax rules.
         if (!empty($this->taxRule_id)) {
             $this->taxrules = $model->getTaxRules('', $this->taxRule_id);
             if (!empty($this->taxrules)) {
                 $defaultTaxRateId = $this->taxrules[0]->taxrate_id;
                 $defaultAddressId = $this->taxrules[0]->address;
             }
             // Get store id of taxrule
             $taxHelper = new taxHelper();
             $store_id = $taxHelper->getStoreIdFromTaxrule($this->taxRule_id);
             if (empty($store_id)) {
                 $this->qtcStoreNotFoundMsg();
             }
             // Getting tax rates and Adress types
             $this->taxrate = $model->getTaxRateListSelect($store_id, $defaultTaxRateId);
             $this->address = $model->getAddressList($defaultAddressId);
         }
     }
     $this->_prepareDocument();
     parent::display($tpl);
 }