Exemple #1
0
 function TiendaTableUsers(&$db)
 {
     $tbl_key = 'id';
     $tbl_suffix = 'users';
     $this->set('_suffix', $tbl_suffix);
     parent::__construct("#__{$tbl_suffix}", $tbl_key, $db);
 }
Exemple #2
0
 /**
  * Stores the object
  * @param object
  * @return boolean
  */
 function store($updateNulls = false)
 {
     $date = JFactory::getDate();
     $this->modified_date = $date->toMysql();
     $store = parent::store($updateNulls);
     return $store;
 }
 function TiendaTableReviewHelpfulness(&$db)
 {
     $tbl_key = 'helpfulness_id';
     $tbl_suffix = 'reviewhelpfulness';
     $this->set('_suffix', $tbl_suffix);
     $name = "tienda";
     parent::__construct("#__{$name}_{$tbl_suffix}", $tbl_key, $db);
 }
Exemple #4
0
 function TiendaTableShippingRates(&$db)
 {
     $tbl_key = 'shipping_rate_id';
     $tbl_suffix = 'shippingrates';
     $this->set('_suffix', $tbl_suffix);
     $name = 'tienda';
     parent::__construct("#__{$name}_{$tbl_suffix}", $tbl_key, $db);
 }
Exemple #5
0
 function TiendaTableUserInfo(&$db)
 {
     $tbl_key = 'user_info_id';
     $tbl_suffix = 'userinfo';
     $this->set('_suffix', $tbl_suffix);
     $name = 'tienda';
     parent::__construct("#__{$name}_{$tbl_suffix}", $tbl_key, $db);
 }
Exemple #6
0
 function TiendaTablePosRequests(&$db)
 {
     $tbl_key = 'pos_id';
     $tbl_suffix = 'posrequests';
     $this->set('_suffix', $tbl_suffix);
     $name = 'tienda';
     parent::__construct("#__{$name}_{$tbl_suffix}", $tbl_key, $db);
 }
Exemple #7
0
 function TiendaTableConfig(&$db)
 {
     $tbl_key = 'config_id';
     $tbl_suffix = 'config';
     $this->set('_suffix', $tbl_suffix);
     $name = "tienda";
     parent::__construct("#__{$name}_{$tbl_suffix}", $tbl_key, $db);
 }
Exemple #8
0
 function TiendaTableOrderTaxClasses(&$db)
 {
     $tbl_key = 'ordertaxclass_id';
     $tbl_suffix = 'ordertaxclasses';
     $this->set('_suffix', $tbl_suffix);
     $name = 'tienda';
     parent::__construct("#__{$name}_{$tbl_suffix}", $tbl_key, $db);
 }
 function TiendaTableOrderItemAttributes(&$db)
 {
     $tbl_key = 'orderitemattribute_id';
     $tbl_suffix = 'orderitemattributes';
     $this->set('_suffix', $tbl_suffix);
     $name = 'tienda';
     parent::__construct("#__{$name}_{$tbl_suffix}", $tbl_key, $db);
 }
Exemple #10
0
 function TiendaTableCreditTypes(&$db)
 {
     $tbl_key = 'credittype_id';
     $tbl_suffix = 'credittypes';
     $this->set('_suffix', $tbl_suffix);
     $name = 'tienda';
     parent::__construct("#__{$name}_{$tbl_suffix}", $tbl_key, $db);
 }
 function TiendaTableShippingMethodsWeightbased(&$db)
 {
     $tbl_key = 'shipping_method_weightbased_id';
     $tbl_suffix = 'shippingmethods_weightbased';
     $this->set('_suffix', $tbl_suffix);
     $name = 'tienda';
     parent::__construct("#__{$name}_{$tbl_suffix}", $tbl_key, $db);
 }
Exemple #12
0
 function TiendaTableUnexServices(&$db)
 {
     $tbl_key = 'service_id';
     $tbl_suffix = 'unexservices';
     $this->set('_suffix', $tbl_suffix);
     $name = 'tienda';
     parent::__construct("#__{$name}_{$tbl_suffix}", $tbl_key, $db);
 }
Exemple #13
0
 function TiendaTableGeozones(&$db)
 {
     $tbl_key = 'geozone_id';
     $tbl_suffix = 'geozones';
     $this->set('_suffix', $tbl_suffix);
     $name = 'tienda';
     parent::__construct("#__{$name}_{$tbl_suffix}", $tbl_key, $db);
 }
Exemple #14
0
 function TiendaTableProductQuantities(&$db)
 {
     $tbl_key = 'productquantity_id';
     $tbl_suffix = 'productquantities';
     $this->set('_suffix', $tbl_suffix);
     $name = 'tienda';
     parent::__construct("#__{$name}_{$tbl_suffix}", $tbl_key, $db);
 }
Exemple #15
0
 function TiendaTableOrderVendors(&$db)
 {
     $tbl_key = 'ordervendor_id';
     $tbl_suffix = 'ordervendors';
     $this->set('_suffix', $tbl_suffix);
     $name = 'tienda';
     parent::__construct("#__{$name}_{$tbl_suffix}", $tbl_key, $db);
 }
Exemple #16
0
 function TiendaTableProductDownloads(&$db)
 {
     $tbl_key = 'productdownload_id';
     $tbl_suffix = 'productdownloads';
     $this->set('_suffix', $tbl_suffix);
     $name = 'tienda';
     parent::__construct("#__{$name}_{$tbl_suffix}", $tbl_key, $db);
 }
 function TiendaTableProductCommentsHelpfulness(&$db)
 {
     $tbl_key = 'productcommentshelpfulness_id';
     $tbl_suffix = 'productcommentshelpfulness';
     $this->set('_suffix', $tbl_suffix);
     $name = "tienda";
     parent::__construct("#__{$name}_{$tbl_suffix}", $tbl_key, $db);
 }
Exemple #18
0
 function save($src = '', $orderingFilter = '', $ignore = '')
 {
     if ($return = parent::save($src, $orderingFilter, $ignore)) {
         if ($this->_increase_coupon_uses) {
             $coupon = JTable::getInstance('Coupons', 'TiendaTable');
             $coupon->load(array('coupon_id' => $this->coupon_id));
             $coupon->coupon_uses = $coupon->coupon_uses + 1;
             if (!$coupon->save()) {
                 JFactory::getApplication()->enqueueMessage($coupon->getError());
             }
         }
     }
     return $return;
 }
Exemple #19
0
 function TiendaTableReports(&$db)
 {
     if (version_compare(JVERSION, '1.6.0', 'ge')) {
         // Joomla! 1.6+ code here
         $tbl_key = 'extension_id';
         $tbl_suffix = 'extensions';
     } else {
         // Joomla! 1.5 code here
         $tbl_key = 'id';
         $tbl_suffix = 'plugins';
     }
     $this->set('_suffix', $tbl_suffix);
     parent::__construct("#__{$tbl_suffix}", $tbl_key, $db);
 }
 /**
  * 
  * @param unknown_type $updateNulls
  * @return unknown_type
  */
 function store($updateNulls = false)
 {
     if ($return = parent::store($updateNulls)) {
         if ($this->notify_customer == '1') {
             Tienda::load("TiendaHelperBase", 'helpers._base');
             $helper = TiendaHelperBase::getInstance('Email');
             $model = Tienda::getClass("TiendaModelSubscriptions", "models.subscriptions");
             $model->setId($this->subscription_id);
             $subscription = $model->getItem();
             $helper->sendEmailNotices($subscription, 'subscription');
         }
     }
     return $return;
 }
Exemple #21
0
 /**
  * 
  * @param unknown_type $updateNulls
  * @return unknown_type
  */
 function store($updateNulls = false)
 {
     if ($return = parent::store($updateNulls)) {
         if ($this->notify_customer == '1') {
             Tienda::load("TiendaHelperBase", 'helpers._base');
             $helper = TiendaHelperBase::getInstance('Email');
             $model = Tienda::getClass("TiendaModelOrders", "models.orders");
             $model->setId($this->order_id);
             // this isn't necessary because you specify the requested PK id as a getItem() argument
             $order = $model->getItem($this->order_id, true);
             $helper->sendEmailNotices($order, 'order');
         }
     }
     return $return;
 }
Exemple #22
0
 function save($src = '', $orderingFilter = '', $ignore = '')
 {
     $prev = clone $this;
     if (!empty($this->id)) {
         $prev->load($this->id);
     }
     if ($save = parent::save($src, $orderingFilter, $ignore)) {
         if ($prev->subscription_enabled && empty($this->subscription_enabled)) {
             // if it was previously enabled and now is disabled
             Tienda::load('TiendaHelperJuga', 'helpers.juga');
             $helper = new TiendaHelperJuga();
             $helper->doExpiredSubscription($this);
         }
     }
     return $save;
 }
Exemple #23
0
 public function __construct($db = null, $tbl_name = null, $tbl_key = null)
 {
     if (version_compare(JVERSION, '1.6.0', 'ge')) {
         // Joomla! 1.6+ code here
         $tbl_key = 'extension_id';
         $tbl_suffix = 'extensions';
     } else {
         // Joomla! 1.5 code here
         $tbl_key = 'id';
         $tbl_suffix = 'plugins';
     }
     $this->set('_suffix', 'shipping');
     if (empty($db)) {
         $db = JFactory::getDBO();
     }
     parent::__construct("#__{$tbl_suffix}", $tbl_key, $db);
 }
Exemple #24
0
 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();
 }
Exemple #25
0
 /**
  * Delete also the prices linked to this group
  */
 function delete($oid = null)
 {
     $k = $this->_tbl_key;
     $default_user_group = Tienda::getInstance()->get('default_user_group', '1');
     if ($oid) {
         $key = $oid;
     } else {
         $key = $this->{$k};
     }
     if ($key != $default_user_group) {
         $return = parent::delete($oid);
         if ($return) {
             // Delete user group relationships
             $model = JModel::getInstance('UserGroups', 'TiendaModel');
             $model->setState('filter_group', $this->{$k});
             $links = $model->getList();
             if ($links) {
                 $table = JTable::getInstance('UserGroups', 'TiendaTable');
                 foreach ($links as $link) {
                     $table->delete($link->user_id);
                 }
             }
             // Delete prices
             $model = JModel::getInstance('ProductPrices', 'TiendaModel');
             $model->setState('filter_user_group', $this->{$k});
             $prices = $model->getList();
             if ($prices) {
                 $table = JTable::getInstance('ProductPrices', 'TiendaTable');
                 foreach ($prices as $price) {
                     $table->delete($price->user_id);
                 }
             }
         }
     } else {
         $this->setError(JText::_('COM_TIENDA_COM_TIENDA_YOU_CANT_DELETE_THE_DEFAULT_USER_GROUP'));
         return false;
     }
     return $return;
 }
Exemple #26
0
 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();
 }
Exemple #27
0
 /**
  * (non-PHPdoc)
  * @see DSCTable::save()
  */
 function save($src = '', $orderingFilter = '', $ignore = '')
 {
     $isNew = false;
     if (empty($this->productcomment_id)) {
         $isNew = true;
     }
     if ($save = parent::save($src, $orderingFilter, $ignore)) {
         if ($this->productcomment_enabled && empty($this->rating_updated)) {
             // get the product row
             $product = JTable::getInstance('Products', 'TiendaTable');
             $product->load($this->product_id);
             $product->updateOverallRating();
             if (!$product->save()) {
                 $this->setError($product->getError());
             } else {
                 $this->rating_updated = '1';
                 parent::store();
             }
         } elseif (!$this->productcomment_enabled && !empty($this->rating_updated)) {
             // comment has been disabled after it already updated the overall rating
             // so remove it from the overall rating
             // get the product row
             $product = JTable::getInstance('Products', 'TiendaTable');
             $product->load($this->product_id);
             $product->updateOverallRating();
             if (!$product->save()) {
                 $this->setError($product->getError());
             } else {
                 $this->rating_updated = '0';
                 parent::store();
             }
         }
     }
     return $save;
 }
Exemple #28
0
 /**
  * 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();
 }
Exemple #29
0
 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();
 }
Exemple #30
0
 /**
  * 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();
 }