Пример #1
0
 /**
  * Update product tags
  *
  * @param array Languages
  * @return boolean Update result
  */
 public function updateTags($languages)
 {
     $tag_success = true;
     /* Reset all tags for THIS product */
     if (!JeproshopTagModelTag::deleteTagsForProduct((int) $this->product_id)) {
         $this->context->controller->has_errors = true;
         JError::raiseError(500, 'An error occurred while attempting to delete previous tags.');
     }
     $input = JRequest::get('post');
     $input_data = $input['information'];
     /* Assign tags to this product */
     foreach ($languages as $language) {
         if ($value = $input_data['tag_' . $language->lang_id]) {
             $tag_success &= JeproshopTagModelTag::addTags($language->lang_id, (int) $this->product_id, $value);
         }
     }
     if (!$tag_success) {
         $this->context->controller->has_errors = true;
         JError::raiseError(500, 'An error occurred while adding tags.');
     }
     return $tag_success;
 }