Jump to content

[SOLVED] Customization file upload 1.7


dakendalliii
 Share

Recommended Posts

Hey all,

I'm developing a new 1.7 shop that is going to sell virtual product.  We need the customer to upload a picture and then forward that picture to another server for processing.  I have created a module to perform the forwarding procedure, but I can't determine which uploaded file (which has an encoded name) is associated with the logged in customer (there will be no "guest" customers).  Does anyone know how to identify the file that is uploaded with a specific order/customer?

Thank you!!!!

Dave

Share this post


Link to post
Share on other sites

Customized data are stored in customized_data table.

Uploaded file are data with "type" = 0 (Constant value is Product::CUSTOMIZE_FILE )

So you can find the customization associated with the id_cart and id_product

SELECT cd.value AS file
FROM ps_customization AS c
INNER JOIN ps_customized_data AS cd ON (cd.id_customization = c.id_customization)
WHERE cd.type = 0
AND c.id_product = 19
AND c.id_cart = 6

Should return something like "b4b22ae6de73dafc74fae848b22e4715", that's the filename

If you have multiple customization fields of type upload you have to target on it specifically to retrieve one value. So add ps_customization_field in the query to be sure to retrieve the value for the right field. Customization Field associated can be find with "index" of ps_customized_data value (Yes that's weird)

Edited by Janett (see edit history)

Share this post


Link to post
Share on other sites

  • dakendalliii changed the title to [SOLVED] Customization file upload 1.7
  • 1 year later...
Em 23/03/2019 em 9:14 PM, dakendalliii disse:

Hey all,

I'm developing a new 1.7 shop that is going to sell virtual product.  We need the customer to upload a picture and then forward that picture to another server for processing.  I have created a module to perform the forwarding procedure, but I can't determine which uploaded file (which has an encoded name) is associated with the logged in customer (there will be no "guest" customers).  Does anyone know how to identify the file that is uploaded with a specific order/customer?

Thank you!!!!

Dave

Hi dakendalliii,

Can you give me more information about the module you created? I need a similar solution. I need product customization to securely accept other file extensions besides jpg, png and gif that is allowed by prestashop.

Share this post


Link to post
Share on other sites

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
 Share

×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More