Jump to content

Downloadable Products..Mass Import Migration


Recommended Posts

I have a large collection of ebooks that I'm migrating to prestashop.
Using Excel & MS Access, I've organized all of the information so that I can convert it to properly formed cvs files using the templates provided.

The products uploaded great, but I too am having issue with getting the product images to display.

That aside, another issue is updating the downloads section of each product.
The IMPORT Tool does not address Virtual Products.

I found the ps_product_download table. Downloaded sample data and structure via a csv file into Excel.
And added my data to the columns making sure that the product ID matched with the other tables.
The download information updated on each product successfully.

I noticed that when uploading a product using the admin panel, the system would create a hashed file name with no extension and place it in the downloads folder. The display file name was different from the physical filename (hashed version). I opted to leave both file names the same and uploaded the files into the downloads folder and then chmod'd them 777.

Now when I try to edit a product in the catalog I'm getting the following message: (an example of the message on one of the products..the filename changes according to the product.)

Hack attempt (ProductDownload -> physically_filename = howtacanyinfeb1_2034_.pdf)

The two things I would like to do is upload all the virtual products and the product images.... Everything is there now, and I can see all of the settings and products. The two issues are:
Product images are not displaying
Downloaded products are visible but I can no longer edit the products in the catalog through the admin panel without getting the error message above.

Any good solutions?

Thanks,
Ben H.

Link to comment
Share on other sites

Took a little digging. . .the issue is that the ProductDownload object is initially setup with a validation field type of "sha1". When its parent classes' validation method is run it checks whether the filename looks like an sha1 hash:

static public function isSha1($sha1)
       {
               return preg_match('/^[a-z0-9]{40}$/ui', $sha1);
       }



This code gets triggered because of this on line 56 of "classes/ProductDownload.php":

protected       $fieldsValidate = array(
               'id_product' => 'isUnsignedId',
               'display_filename' => 'isGenericName',
               'physically_filename' => 'isSha1',
               'date_deposit' => 'isDate',
               'date_expiration' => 'isDate',
               'nb_days_accessible' => 'isUnsignedInt',
               'nb_downloadable' => 'isUnsignedInt',
               'active' => 'isUnsignedInt'
       );



So "physically_filename" would have to have its validation attribute changed to use real filenames here ("isGenericName" presumably).

Cheers

Link to comment
Share on other sites

  • 6 months later...

Was this topic solved?

Is this a safe solution? Are the files still protected from download attempts because they are located in a protected directory?

I would like to set up extra large video files for download, but my client's web host cannot handle the demand on the php. I would like to upload the large files via ftp to bypass the php upload, but the encryption can not be duplicated, so the ftp-ed files are not showing up via the purchase link.

Any updates to this thread would be appreciated.

Link to comment
Share on other sites

  • 5 years later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...