Jump to content

Images management function - Prestashop 1.7.8.6


quentinvillanova

Recommended Posts

I've take a look and it not seems to be what I'm searching for.

In the function you told me there is no "image" variable or something like that.

I set some breakpoint and when I try to create a product with an image nothing break.

But thanks for your help.

 

Edit: But I find something interesting in AdminProductDataProvider.php file.

Edited by quentinvillanova (see edit history)
Link to comment
Share on other sites

1 hour ago, quentinvillanova said:

I've take a look and it not seems to be what I'm searching for.

In the function you told my there is no "image" variable or something like that.

I set some breakpoint and when I try to create a product with an image nothing break.

But thanks for your help.

 

Edit: But I find something interesting in AdminProductDataProvider.php file.

Actually every thing happens in that file. Just take a look at this method saveProductImages in this file src/Adapter/ImportProductImportHandler.php

Link to comment
Share on other sites

I don't understand, the saveProductImages seems to be what I'm searching for.

But I put breakpoint in it and nothing happens, I create a new product in Back-Office and it should break where I want but the page refresh nomally.

I know that my debugger work fine so it's not the problem.

So create a product work, I can see it in Front-Office, but it looks like it never pass through the function.

I'm a bit desperate actually.

Edited by quentinvillanova (see edit history)
Link to comment
Share on other sites

I think importing a product is totally different from creating a new one. Please verify you are importing at first. And then ensure you are using prestashop import controller in BO. If you are using a module to do the import it might not go through that exact file and they might have copied the file to their module and then every thing about the import happens there.

Link to comment
Share on other sites

I enabled debug mode and found the backoffice controller

This is the controller: "src/PrestaShopBundle/Controller/Admin/ProductController.php"

image.thumb.png.5cc3e29554b283cd11dd377d2e09a64d.png

Then I searched through that file. I got to this part "$form->isSubmitted()" and some lines after this part I found "$adminProductController->setAction('save'); ". This means the products is saved in "controllers/admin/AdminProductsController.php"

Link to comment
Share on other sites

Hi,

So actually, I found that image path is generated right when I drop or select an image in the image field, so before I save the product.

Tell me if I'm wrong but I think this part is manage in a js file ?

So if I really understand, the path is generate from a sort of id which depends on the last one registered.

I learnt a lot of things but i think it's too far from what I'm searching for at the beginning explained in that post :

 

Thanks a lot for your help.

Edited by quentinvillanova (see edit history)
Link to comment
Share on other sites

Thats kind of right. I have not digged into this before, but i have searched for the import of product, that does not get any files as input, it gets a series of URLs, downloads them in a temp path and then, it creates a folder based on the id_image and then save the original and resized versions of that image. For example if id_image is 1234, then it will go to this path, img/p/1/2/3/4/image.jpg

Link to comment
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
×
×
  • Create New...