Beispiel #1
0
 /**
  * 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;
 }
 public function checkConfig()
 {
     // Check if the settings are all empty
     if (MagebridgeModelConfig::allEmpty() == true) {
         JError::raiseWarning(500, JText::sprintf('Check the online %s for more information.', MageBridgeHelper::getHelpText('quickstart')));
         return;
     }
     // Otherwise check all values
     $config = MagebridgeModelConfig::load();
     foreach ($config as $c) {
         if (isset($c['name']) && isset($c['value']) && ($message = MageBridge::getConfig()->check($c['name'], $c['value']))) {
             JError::raiseWarning(500, $message);
         }
     }
     return;
 }