Пример #1
0
 /**
  * Delete shipping method.
  *
  * @param   object  $jinput  Joomla's jinput Object.
  * @param   string  $client  state.
  *
  * @since   2.2
  * @return   status.
  */
 public function deleteShipMeth($jinput, $client)
 {
     $db = JFactory::getDBO();
     $post = $jinput->post;
     $shipMethId = $post->get('shipMethId', '');
     $count = 0;
     if (empty($shipMethId)) {
         $cidArray = $post->get('cid', array(), 'ARRAY');
     } else {
         $cidArray[] = $shipMethId;
     }
     $qtcshiphelper = new qtcshiphelper();
     foreach ($cidArray as $cid) {
         try {
             // Check whether entry present in ship profile methods .
             $count_id = $qtcshiphelper->isAllowedToDelShipmethod($cid, $client);
             if ($count_id === true) {
                 print $query = $db->getQuery(true)->delete('#__kart_zoneShipMethods')->where('id =' . $cid);
                 $db->setQuery($query);
                 if (!$db->execute()) {
                     $this->setError($this->_db->getErrorMsg());
                     return 0;
                 }
                 $count++;
             }
         } catch (RuntimeException $e) {
             $this->setError($e->getMessage());
             return 0;
         }
     }
     return $count;
 }