Пример #1
0
 /**
  * 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);
 }