Пример #1
0
 /**
  * This function calls respective task on respective plugin
  */
 function qtcHandleShipAjaxCall()
 {
     $plgActionRes = '';
     $app = JFactory::getApplication();
     $qtcshiphelper = new qtcshiphelper();
     $comquick2cartHelper = new comquick2cartHelper();
     $jinput = JFactory::getApplication()->input;
     $extension_id = $jinput->get('extension_id');
     // Get plugin detail
     $plugName = $qtcshiphelper->getPluginDetail($extension_id);
     // Call specific plugin trigger
     JPluginHelper::importPlugin('tjshipping', $plugName);
     $dispatcher = JDispatcher::getInstance();
     $plgRes = $dispatcher->trigger('TjShip_AjaxCallHandler', array($jinput));
     if (!empty($plgRes)) {
         $plgActionRes = $plgRes[0];
     }
     echo $plgActionRes;
     $app->close();
 }
Пример #2
0
 /**
  * Method to add shipping method.
  *
  * @since   2.2
  * @return   null object of shipping method select box.
  */
 public function addShippingPlgMeth($update = 0)
 {
     $app = JFactory::getApplication();
     $data = $app->input->post->get('jform', array(), 'array');
     $db = $this->getDbo();
     $query = $db->getQuery(true);
     $query->select('COUNT(*)');
     $query->from('#__kart_shipProfileMethods AS sm');
     if ($update == 1) {
         $data['id'] = $data['qtc_shipProfileMethodId'];
         $query->where('sm.id !=' . $db->escape($data['qtc_shipProfileMethodId']));
     }
     $qtcshiphelper = new qtcshiphelper();
     $data['client'] = $qtcshiphelper->getPluginDetail($data['qtcShipPluginId']);
     $query->where('sm.shipprofile_id=' . $db->escape($data['shipprofile_id']));
     $query->where('sm.client=' . $db->Quote($db->escape($data['client'])));
     $query->where('sm.methodId=' . $db->Quote($db->escape($data['methodId'])));
     $db->setQuery($query);
     $result = $db->loadResult();
     if (!empty($result)) {
         $this->setError(JText::_("COM_QUICK2CART_SHIPMETHOD_ALREADY_EXISTS"));
         return false;
     }
     $table = $this->getTable('Shipmethods');
     if (!$table->bind($data)) {
         $this->setError($table->getError());
         return false;
     }
     if (!$table->check()) {
         $this->setError($table->getError());
         return false;
     }
     if (!$table->store()) {
         $this->setError($table->getError());
         return false;
     }
     $app->input->set('shipMethodId', $table->id);
     return true;
 }
Пример #3
0
 protected function getShipPluginForm($extension_id)
 {
     $mainframe = JFactory::getApplication();
     $jinput = $mainframe->input;
     $qtcshiphelper = new qtcshiphelper();
     $plugName = $qtcshiphelper->getPluginDetail($extension_id);
     $import = JPluginHelper::importPlugin('tjshipping', $plugName);
     $dispatcher = JDispatcher::getInstance();
     $result = $dispatcher->trigger('TjShip_shipBuildLayout', array($jinput));
     if (!empty($result[0])) {
         return $this->form = $result[0];
     }
     return '';
 }
Пример #4
0
 /**
  * Method to give shipping pluign's method select list.
  *
  * @param   string   $extension_id  extentin id from #_extention table .
  * @param   integer  $store_id      store_id.
  * @param   string   $default       default value to be selected .
  *
  * @since   2.2
  * @return   null
  */
 public function qtcLoadShipPlgMethods($extension_id, $store_id, $default = '')
 {
     $methList = array();
     $response = array();
     $response['error'] = 0;
     if (!empty($extension_id)) {
         $qtcshiphelper = new qtcshiphelper();
         $plugName = $qtcshiphelper->getPluginDetail($extension_id);
         // GET PLUGIN LIST
         $import = JPluginHelper::importPlugin('tjshipping', $plugName);
         $dispatcher = JDispatcher::getInstance();
         $result = $dispatcher->trigger('TjShip_getAvailableShipMethods', array($store_id));
         if (!empty($result[0])) {
             $methList = $result[0];
         }
     }
     $plugin_options[] = JHtml::_('select.option', '', JText::_("COM_QUICK2CART_SHIPPLUGIN_SELECT_SHIP_METH"));
     foreach ($methList as $item) {
         $plugin_options[] = JHtml::_('select.option', $item['methodId'], $item['name']);
     }
     $attr = 'class=""  aria-invalid="false" size="1"  autocomplete="off" ';
     //$response['shipMethList'] = JHtml::_('select.genericlist', 'qtc_shipMethod', $plugin_options, $attr, 'value', 'text', $default, 'qtc_shipMethod');
     $response['shipMethList'] = JHtml::_('select.genericlist', $plugin_options, $attr, 'qtc_shipMethod', 'value', 'text', $default, 'qtc_shipMethod');
     return $response;
 }