Пример #1
0
 public function afterSave()
 {
     $categories = $this->getCategories();
     $categories = $this->object->setCategories($categories);
     $this->object->set('categories', $categories);
     return parent::afterSave();
 }
Пример #2
0
 public function afterSave()
 {
     $categories = $this->getCategories();
     if (is_array($categories)) {
         if (!empty($categories)) {
             $categories = $this->object->setCategories($categories);
         }
         // удаляем категории, которые не были установлены
         $this->removeNotAssignedCategories($categories);
         $this->object->set('categories', $categories);
     }
     $this->updateAssignedCategory();
     $this->updateOldKeys();
     return parent::afterSave();
 }
Пример #3
0
 public function prepare()
 {
     $this->option = $this->modx->getObject('msOption', $this->getProperty('option', 0));
     $this->optionCategories = $this->option ? $this->option->getMany('OptionCategories') : array();
     parent::prepare();
 }
Пример #4
0
 /**
  * @param msOption $option
  * @return null|msOptionType
  */
 public function getOptionType($option)
 {
     $className = $this->loadOptionType($option->get('type'));
     if (class_exists($className)) {
         return new $className($option);
     } else {
         $this->modx->log(modX::LOG_LEVEL_ERROR, 'Could not initialize miniShop2 option type class: "' . $className . '"');
         return null;
     }
 }