예제 #1
0
 /**
  * Attach an existing attachment to the product
  *
  * @return void
  */
 public function attachment()
 {
     $app = JFactory::getApplication();
     if ($id = (int) $app->input->get('product_id')) {
         $attachments = trim($app->input->get('arrayAttachments'), ',');
         $attachments = explode(',', $attachments);
         if (!JeproshopAttachmentModelAttachment::attachToProduct($id, $attachments)) {
             JError::raiseError(500, JText::_('An error occurred while saving product attachments.'));
         }
     }
 }
예제 #2
0
 /**
  * Attach an existing attachment to the product
  *
  * @return void
  */
 public function processAttachments()
 {
     $app = JFactory::getApplication();
     $product_id = (int) $app->input->get('product_id');
     $data = JRequest::get('post');
     $input_data = $data['jform'];
     if ($product_id) {
         $attachments = trim($input_data['array_attachments'], ',');
         $attachments = explode(',', $attachments);
         if (!JeproshopAttachmentModelAttachment::attachToProduct($product_id, $attachments)) {
             $this->context->controller->has_errors = JText::_('An error occurred while saving product attachments.');
         }
     }
 }