Post by Reptile » Tue Sep 12, 2017 9:53 pm

I am working on a extension which uploads a file to the download folder.
Now the problem with Opencart 3.x is that the whole storage folder isn't in the opencart installation folder anymore because you have to move it out of there and place it elsewhere on the server.

How can I link to this folder from within Opencart?
As if I link to DIR_DOWNLOAD it gives you the server path and this is not accessible from outside your server.

Now when I want to link to the folder it gives me this:
http://www.domain.com/volume1/web/oc_st ... d/file.zip

Could someone point me in the right direction?

All our extensions: Click here or Click here
Need custom work done? Click here


User avatar
Active Member
Online

Posts

Joined
Mon Jan 30, 2012 7:23 pm
Location - The Netherlands

Post by Reptile » Wed Sep 13, 2017 10:00 pm

No developers here who could point me in right direction?

All our extensions: Click here or Click here
Need custom work done? Click here


User avatar
Active Member
Online

Posts

Joined
Mon Jan 30, 2012 7:23 pm
Location - The Netherlands

Post by JNeuhoff » Wed Sep 13, 2017 10:31 pm

In OpenCart 3 an extension is only allowed to install files in the following folders:

'admin/controller/extension/',
'admin/language/',
'admin/model/extension/',
'admin/view/image/',
'admin/view/javascript/',
'admin/view/stylesheet/',
'admin/view/template/extension/',
'catalog/controller/extension/',
'catalog/language/',
'catalog/model/extension/',
'catalog/view/javascript/',
'catalog/view/theme/',
'system/config/',
'system/library/',
'image/catalog/'

You may have to rethink your folders structure. Why do you need a file in the download folder?

MHC Web Design
Override Engine * Integrated VQMod * Multilingual SEO * Instant Option Price Calculator * TrustPilot Reviews * Download Options * Free Download Buttons * Export/Import Tool * Template Switcher PHP/Twig


User avatar
Expert Member

Posts

Joined
Wed Dec 05, 2007 3:38 am


Post by Reptile » Wed Sep 13, 2017 10:55 pm

I am working on an extension which let's you upload a file in Admin order history.
The file is placed in the download folder.
In OC2.x you could simply link to the file like this: http://www.domain.com/system/storage/download/file.zip
But in OC3.x the storage folder is moved out of the opencart installation dir.

I am looking for a way to internally link to this location (in the controller for example)
In the opencart Admin I want to be able to open the file placed in the download folder.
But I am stuck on this for a couple of days as I have no idea how to accomplish this.

All our extensions: Click here or Click here
Need custom work done? Click here


User avatar
Active Member
Online

Posts

Joined
Mon Jan 30, 2012 7:23 pm
Location - The Netherlands

User avatar
Expert Member

Posts

Joined
Wed Dec 05, 2007 3:38 am


Post by Reptile » Thu Sep 14, 2017 12:31 am

Yes I already tried that but that gives you a path like:

http://www.domain.com/volume1/web/storage/download

As volume1 is a server folder it is inaccessible from the outside.

The only option now is to make a folder in the image/catalog/download.
But to do this the customer has to set the folder CHMOD to 755 or 777 which isn't something you would want your customer to do.
And aside from that the url would also look funny as it has the image folder in the url.

All our extensions: Click here or Click here
Need custom work done? Click here


User avatar
Active Member
Online

Posts

Joined
Mon Jan 30, 2012 7:23 pm
Location - The Netherlands

Post by JNeuhoff » Thu Sep 14, 2017 11:46 pm

The storage folder is normally located under the system folder. Looks like you are not using a standard OpenCart folder structure.

MHC Web Design
Override Engine * Integrated VQMod * Multilingual SEO * Instant Option Price Calculator * TrustPilot Reviews * Download Options * Free Download Buttons * Export/Import Tool * Template Switcher PHP/Twig


User avatar
Expert Member

Posts

Joined
Wed Dec 05, 2007 3:38 am


Post by Reptile » Fri Sep 15, 2017 12:28 am

Yes but Opencart 3.x makes you move the folder outside of your installation.

Have you ever installed OC3?
This is the first thing you must do.

All our extensions: Click here or Click here
Need custom work done? Click here


User avatar
Active Member
Online

Posts

Joined
Mon Jan 30, 2012 7:23 pm
Location - The Netherlands

Post by JNeuhoff » Fri Sep 15, 2017 1:01 am

I see, I usually disable the warning about having to move the storage folder because I don't.

Anyway, normally you should be able to access your download folder from an admin controller via a normal

Code: Select all

file_get_contents( DIR_DOWNLOAD . 'myfile' )
This assumes that, after having moved your whole storage folder, the admin/config.php has been updated accordingly.

MHC Web Design
Override Engine * Integrated VQMod * Multilingual SEO * Instant Option Price Calculator * TrustPilot Reviews * Download Options * Free Download Buttons * Export/Import Tool * Template Switcher PHP/Twig


User avatar
Expert Member

Posts

Joined
Wed Dec 05, 2007 3:38 am


Post by Reptile » Fri Sep 15, 2017 3:35 am

Yes I could do this too but I have to keep in mind the extension is for customers who probably have movd the folder.

I will try your idea tomorrow thank and I will let you know if it worked.

All our extensions: Click here or Click here
Need custom work done? Click here


User avatar
Active Member
Online

Posts

Joined
Mon Jan 30, 2012 7:23 pm
Location - The Netherlands

Post by Brio-go » Sat Sep 16, 2017 1:17 pm

It's like reading that I'm doing the wrong thing.



gclub

Newbie

Posts

Joined
Sun Sep 10, 2017 3:24 pm
Who is online

Users browsing this forum: Seraph77 and 9 guests