0

I'm developing a store that allows a client to download custom scripts. I've set up the download folder and the Store and my configuration seems to be correct.

            {exp:channel:entries entry_id="{entry_id}"}
                <li>{exp:store:download order_id="{order_id}" url="{file_for_sale}"}
                  Download
                {/exp:store:download}</li>
            {/exp:channel:entries}

What happens is I get an error like this:ExpressionEngine Throwback Error

What is even more confusing is that my original folder path isn't

/homepages/9/d201932266/htdocs/frameexpert/

My original file path is:

/kruden/homepages/9/d201932266/htdocs/frameexpert/

I'm not sure where this file path is coming from. I've scoured all the config files to see if this is one of the directories, but it isn't.

Any insights would be great!

Thanks.

2
  • 1
    Which version of Store are you running? What is the 'Server Path to Upload Directory' set to under Content > Files > File Upload Preferences? Apr 24, 2014 at 5:06
  • Expresso Store 2.2.0 Apr 25, 2014 at 15:03

1 Answer 1

1

Here is the bug I discovered. Whether or not this is just a problem specific to the server I'm using or just a downright mistake in the Expresso Store 2.2.0 code I'm yet to be determined.

My settings: -Server Path to Upload Directory: /homepages/9/d201932266/htdocs/frameexpert/images/page_images/

I Edited this file: store/src/store/service/StoreService.php

public function get_file_path($file_id)
{
    $path = ee()->db->where('file_id', $file_id)
        ->get('files')->row('rel_path');

    if (empty($path)) return FALSE;

    // is this a relative path?
    if (strpos($path, '/') !== 0) {

        //Note: Detected Bug in Expresso Store. The '../' doesn't bring us far enough
        //back. APPPATH returns '/direct_path_to_ee/frameexpert/expressionengine/system/'
        //What this line of code returns is 
        //'/direct_path_to_ee/frameexpert/expressionengine/system/../frameexpert/images/page_images/file.zip'

        $path = APPPATH.'../'.$path;
    }

    return $path;
}

What is happening here is that the 'get_file_path()' function returns an incorrect path. All I did to fix this was:

    // is this a relative path?
    if (strpos($path, '/') !== 0) {

        //Note: Changed '../' to '../../../'
        $path = APPPATH.'../../../'.$path;
    }

This resolved my issue.

4
  • I wouldn't recommend editing core files and this shouldn't be necessary. You didn't provide an answer to Adrian's question above regarding your file upload preferences but I'm fairly sure that is where you problem lies. Check your File Upload Preferences and ensure they point to the right location. You can use absolute or relative paths.
    – Ian Young
    Apr 25, 2014 at 16:11
  • What I found is that the problem isn't with my direct server path. The problem is with the APPPATH constant that is set to go to the '(home directory)/expressionengine/system/' and my download folder lives in (home directory). Apr 25, 2014 at 18:00
  • Another solution would be to place my download folder into '/expressionengine/' Apr 25, 2014 at 18:01
  • Pretty sure this is already fixed in the latest version (2.3.1). If you can test and let us know it would be useful. Apr 25, 2014 at 22:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.