View Single Post
  #1  
Old 05-08-2015, 03:29 AM
 
xgarb xgarb is offline
 

eXpert
  
Join Date: Jul 2004
Location: UK
Posts: 263
 

Default Duplicating File Attachments module

Client wants two extra tabs for each product. A file downloads area and a case studies area.

I'm 98% there. I've duplicated the file attachments module and re-coded as necessary to create new fields in the database and files in the file system.

I have a problem though.. The code...

Code:
/** * Get attachment * * @return \XLite\Module\Client\CaseStudies\Model\Product\Casestudy */ protected function getCasestudy() { return \XLite\Core\Database::getRepo('XLite\Module\Client\CaseStudies\Model\Product\Casestudy') ->find(\XLite\Core\Request::getInstance()->objectId); }
doesn't seem to be returning anything when I upload a file.. or at least I'm getting the error..
Call to a member function getProduct() on a non-object
in
$path = parent::getStoreFileSystemRoot() . $this->getCasestudy()->getProduct()->getProductId() . LC_DS;

If I hard code the path it works but the attachment_id field in the database isn't filled in and therefor the list of attachments doesn't work properly until I put in the missing value manually.

Any ideas?

I was wondering if the Monthly Support subscription would enable me to get little things like this sorted? I have one big project at the moment on x5 and often little questions.
__________________
Core version: 5.5.xx
Reply With Quote