/** * Method to store the item * * @package MageBridge * @access public * @param array $data * @return bool */ public function store($data) { if (!empty($data['store'])) { $values = explode(':', $data['store']); $data['type'] = $values[0] == 'g' ? 'storegroup' : 'storeview'; $data['name'] = $values[1]; $data['title'] = $values[2]; unset($data['store']); } else { $this->setError(JText::_('COM_MAGEBRIDGE_MODEL_STORE_NO_STORE_SELECTED')); return false; } if (!empty($data['default']) && $data['default']) { $this->storeDefault($data['type'], $data['name']); return true; } if (empty($data['name']) || empty($data['title'])) { $this->setError(JText::_('COM_MAGEBRIDGE_MODEL_STORE_INVALID_STORE')); return false; } if (empty($data['label'])) { $data['label'] = $data['title']; } $rt = parent::store($data); if ($rt == true && $data['published'] == 1) { MageBridge::getConfig()->saveValue('load_stores', 1); } return $rt; }
/** * Method to store the item * * @package MageBridge * @access public * @param array $data * @return bool */ public function store($data) { if (empty($data['label'])) { $data['label'] = $data['sku']; } $data['connector'] = ''; $data['connector_value'] = ''; return parent::store($data); }
/** * Method to store the item * * @package MageBridge * @access public * @param array $data * @return bool */ public function store($data) { // Store the item $rt = parent::store($data); // Change the setting "load_urls" in the MageBridge configuration if ($data['published'] == 1) { MagebridgeModelConfig::saveValue('load_urls', 1); } return $rt; }
/** * Method to store the item * * @package MageBridge * @access public * @param array $data * @return bool */ public function store($data) { // Prepare the data $now = new JDate('now'); // Build the data $data['remote_addr'] = $_SERVER['REMOTE_ADDR']; $data['http_agent'] = $_SERVER['HTTP_USER_AGENT']; $data['timestamp'] = $now->toSql(); return parent::store($data); }
/** * Method to store the model * * @access public * @param mixed $data * @return bool */ public function store($data) { $table = $this->getTable(); // Insert $categories manually if (!empty($data['categories'])) { $categories = $data['categories']; unset($data['categories']); } // Insert link manually if (isset($data['link_type'])) { $type = $data['link_type']; if (!empty($data['link_' . $type])) { $data['link'] = $data['link_' . $type]; } } // @todo: Implement "flags" (F = featured, N = new, P = popular) // Remove the old category-relations if ($data['id'] == 0 && count($categories) == 1) { $query = 'SELECT MAX(`item`.`ordering`) FROM `#__simplelists_items` AS `item`' . ' LEFT JOIN `#__simplelists_categories` AS `category` ON `category`.`id`=`item`.`id`' . ' WHERE `category`.`category_id`=' . $categories[0]; $this->_db->setQuery($query); $data['ordering'] = $this->_db->loadResult() + 1; } // Store these data $rs = parent::store($data); if ($rs == false) { return false; } // Handle category-relations if ($this->getId() > 0) { // Remove the old category-relations $query = 'DELETE FROM `#__simplelists_categories` WHERE `id`=' . (int) $this->getId(); $this->_db->setQuery($query); $this->_db->query(); // Store the new category-relations if (!empty($categories)) { foreach ($categories as $c) { $query = 'INSERT INTO `#__simplelists_categories` SET `id`=' . (int) $this->getId() . ',`category_id`=' . (int) $c; $this->_db->setQuery($query); $this->_db->query(); } } } return true; }