コード例 #1
0
ファイル: wishlists.php プロジェクト: annggeel/tienda
 function delete($oid = null, $doReconciliation = true)
 {
     $k = $this->_tbl_key;
     if ($oid) {
         $this->{$k} = intval($oid);
     }
     $id = $this->{$k};
     if ($return = parent::delete($oid)) {
         if ($id) {
             $query = "UPDATE #__tienda_wishlistitems SET wishlist_id = '0' WHERE wishlist_id = '" . $id . "'";
             $db = $this->getDBO();
             $db->setQuery($query);
             $db->query();
         }
     }
     return parent::check();
 }
コード例 #2
0
ファイル: productcomments.php プロジェクト: annggeel/tienda
 /**
  * 
  * @param $oid
  * @return unknown_type
  */
 function delete($oid = null, $doReconciliation = true)
 {
     $k = $this->_tbl_key;
     if ($oid) {
         $this->{$k} = intval($oid);
     }
     if ($doReconciliation) {
         if ($oid) {
             $row = JTable::getInstance('ProductComments', 'TiendaTable');
             $row->load($oid);
             $product_id = $row->product_id;
         } else {
             $product_id = $this->product_id;
         }
     }
     if (parent::delete($oid)) {
         DSCModel::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_tienda/models');
         $model = DSCModel::getInstance('ProductCommentsHelpfulness', 'TiendaModel');
         $model->setState('filter_comment', $this->{$k});
         if ($items = $model->getList()) {
             $table = $model->getTable();
             foreach ($items as $item) {
                 if (!$table->delete($item->productcommentshelpfulness_id)) {
                     $this->setError($table->getError());
                 }
             }
         }
         if ($doReconciliation) {
             $product = JTable::getInstance('Products', 'TiendaTable');
             $product->load($product_id);
             $product->updateOverallRating();
             if (!$product->save()) {
                 $this->setError($product->getError());
             }
         }
     }
     return parent::check();
 }
コード例 #3
0
ファイル: productattributes.php プロジェクト: annggeel/tienda
 /**
  * Run function after deleteing
  */
 function delete($oid = null, $doReconciliation = true)
 {
     $k = $this->_tbl_key;
     if ($oid) {
         $this->{$k} = intval($oid);
     }
     if ($doReconciliation) {
         if ($oid) {
             $row = JTable::getInstance('ProductAttributes', 'TiendaTable');
             $row->load($oid);
             $product_id = $row->product_id;
         } else {
             $product_id = $this->product_id;
         }
     }
     $db = $this->getDBO();
     $db->setQuery('SET foreign_key_checks = 0;');
     $db->query();
     if ($return = parent::delete($oid)) {
         DSCModel::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_tienda/models');
         $model = DSCModel::getInstance('ProductAttributeOptions', 'TiendaModel');
         $model->setState('filter_attribute', $this->{$k});
         if ($items = $model->getList()) {
             $table = $model->getTable();
             foreach ($items as $item) {
                 if (!$table->delete($item->productattributeoption_id)) {
                     $this->setError($table->getError());
                 }
             }
         }
         if ($doReconciliation) {
             Tienda::load("TiendaHelperProduct", 'helpers.product');
             TiendaHelperProduct::doProductQuantitiesReconciliation($product_id);
         }
     }
     $db->setQuery('SET foreign_key_checks = 1;');
     $db->query();
     return parent::check();
 }
コード例 #4
0
ファイル: orders.php プロジェクト: annggeel/tienda
 public function delete($oid = null)
 {
     $delete = array();
     $k = $this->_tbl_key;
     if ($oid) {
         $this->{$k} = intval($oid);
     }
     // this should all be a transaction...
     // Delete all the orderitems, orderpayments, ordershipping, etc
     $delete['items'] = $this->deleteItems('items', $oid);
     $delete['payments'] = $this->deleteItems('payments', $oid);
     $delete['info'] = $this->deleteItems('info', $oid);
     $delete['shippings'] = $this->deleteItems('shippings', $oid);
     $delete['history'] = $this->deleteItems('history', $oid);
     $delete['taxclasses'] = $this->deleteItems('taxclasses', $oid);
     $delete['taxrates'] = $this->deleteItems('taxrates', $oid);
     $delete['coupons'] = $this->deleteItems('coupons', $oid);
     $delete['order'] = parent::delete($oid);
     $this->deleteResults = $delete;
     return parent::check();
 }
コード例 #5
0
ファイル: addresses.php プロジェクト: annggeel/tienda
 /**
  * Checks the entry to maintain DB integrity
  * @return unknown_type
  */
 function check()
 {
     $config = Tienda::getInstance();
     if (!$this->addresstype_id) {
         $this->addresstype_id = '1';
     }
     $address_type = $this->addresstype_id;
     if (empty($this->user_id)) {
         $this->user_id = JFactory::getUser()->id;
         if (empty($this->user_id)) {
             $this->setError(JText::_('COM_TIENDA_USER_REQUIRED'));
         }
     }
     Tienda::load('TiendaHelperAddresses', 'helpers.addresses');
     $elements = TiendaHelperAddresses::getAddressElementsData($address_type);
     if (empty($this->address_name)) {
         $this->address_name = $this->address_1;
     }
     if (empty($this->address_name) && $elements['address_name'][1]) {
         $this->setError(JText::_("COM_TIENDA_PLEASE_INCLUDE_AN_ADDRESS_TITLE" . $address_type));
     }
     $address_checks = array(array('first_name', 'name', "COM_TIENDA_FIRST_NAME_REQUIRED"), array('middle_name', 'middle', "COM_TIENDA_MIDDLE_NAME_REQUIRED"), array('last_name', 'last', "COM_TIENDA_LAST_NAME_REQUIRED"), array('address_1', 'address1', "COM_TIENDA_AT_LEAST_ONE_ADDRESS_LINE_IS_REQUIRED"), array('address_2', 'address2', "COM_TIENDA_SECOND_ADDRESS_LINE_IS_REQUIRED"), array('company', 'company', "COM_TIENDA_COMPANY_REQUIRED"), array('tax_number', 'tax_number', "COM_TIENDA_COMPANY_TAX_NUMBER_REQUIRED"), array('city', 'city', "COM_TIENDA_CITY_REQUIRED"), array('postal_code', 'zip', "COM_TIENDA_POSTAL_CODE_REQUIRED"), array('phone_1', 'phone', "COM_TIENDA_PHONE_REQUIRED"));
     for ($i = 0, $c = count($address_checks); $i < $c; $i++) {
         $current = $address_checks[$i];
         if (empty($this->{$current}[0]) && $elements[$current[1]][1]) {
             $this->setError(JText::_($current[2]));
         }
     }
     if (empty($this->country_id)) {
         if ($elements['country'][1]) {
             $this->setError(JText::_('COM_TIENDA_COUNTRY_REQUIRED'));
         } else {
             $this->country_id = 9999;
         }
     }
     $countryA = explode(',', trim($config->get('ignored_countries', '83,188,190')));
     if (empty($this->zone_id) && !in_array($this->country_id, $countryA)) {
         if ($elements['zone'][1]) {
             $this->setError(JText::_('COM_TIENDA_ZONE_REQUIRED'));
         } else {
             $this->zone_id = 9999;
         }
     }
     return parent::check();
 }
コード例 #6
0
ファイル: productfiles.php プロジェクト: annggeel/tienda
 function delete($oid = null)
 {
     $k = $this->_tbl_key;
     if ($oid) {
         $this->{$k} = intval($oid);
     }
     if ($return = parent::delete($oid)) {
         $query = new TiendaQuery();
         $query->delete();
         $query->from('#__tienda_productdownloads');
         $query->where('productfile_id = ' . $this->{$k});
         $this->_db->setQuery((string) $query);
         $this->_db->query();
         $query = new TiendaQuery();
         $query->delete();
         $query->from('#__tienda_productdownloadlogs');
         $query->where('productfile_id = ' . $this->{$k});
         $this->_db->setQuery((string) $query);
         $this->_db->query();
     }
     return parent::check();
 }