Jump to content

ps 1.6 webservice api get images of customisations return SQL error


saitokaito

Recommended Posts

when i try to retrieve any kind of image i get it except of images/customisations i get this error:

 

request:

mywebsite.com/api/images/customisations

 

result:  code 97 message:

 Unknown column 'customizations' in 'where clause'. From ImageTypeCore->getImagesTypes() Query was : SELECT * FROM `ps_image_type` WHERE 1 AND `customizations` = 1 ORDER BY `name` ASC

 

when i misname images type i get this result for example:

 

 

request:

mywebsite.com/api/images/customisation

 

result: code 48 message:

Image of type "customization" does not exist. Did you mean: "customizations"? The full list is: "general", "products", "categories", "manufacturers", "suppliers", "stores", "customizations"

 

so Image of type "customization" is recognized by webservice but column 'customizations' is not defined in table `ps_image_type`

 

as a turnaround i tried to add column 'customizations' to table `ps_image_type` thus i didn't get error but neither image i get a very strange xml return

 

mywebsite.com/api/images/customisations

 

 

 

<prestashop xmlns:xlink="http://www.w3.org/1999/xlink">
<carts>
<cart id="6" xlink:href="http://localhost/prestashop/api/images/customizations/6"/>
<cart id="7" xlink:href="http://localhost/prestashop/api/images/customizations/7"/>
<cart id="8" xlink:href="http://localhost/prestashop/api/images/customizations/8"/>
<cart id="9" xlink:href="http://localhost/prestashop/api/images/customizations/9"/>

</carts>
</prestashop>
 
RETURN
<prestashop xmlns:xlink="http://www.w3.org/1999/xlink">
<customizations>
<customization id="4" xlink:href="http://localhost/p/prestashop/api/images/customizations/4"/>
</customizations>
</prestashop>
 
RETURN
<prestashop xmlns:xlink="http://www.w3.org/1999/xlink">
<customizations></customizations>
</prestashop>
 
OBVIOUSLY adding column 'customizations' to table `ps_image_type` is not a turnaround solution, but i have no idea how to get those customizations images so ithink sql error is areal serious bug.

 

Link to comment
Share on other sites

Images of customisations is you want your customers to customize their purchased products by sending an image on.

 

And yes that's the issue, there is no field (column) called "customizations" in the ps_image_type table. While it is checked in file prestashop_1.6.1.5\classes\webservice\WebserviceSpecificManagementImages.php function manageImages() line 319 which call ImageType::getImagesTypes($this->imageType) where the error occurs.

 

By altering ps_image_type table adding field customizations i managed to follow the flow process and get the image i want by calling

/api/images/customizations/{id_cart}/{id_customization}/{id_image}

 

Which is a very poor code arch/pattern to retrieve this image, le pire c'est que there is no resources or docs to learn about doing this.

 

 

To reproduce this bug, go to backoffice products catalog => customize a product by adding an image field => go to front add upload a picture to that product save, add to cart and order. then try to retrieve like i describe in this topic.

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

Thank you Tuk66 for trying to help but this have nothing to do with my bug reporting.

 

This method getWsCustomizedDataImages  is to get the name of custom image attached to product and not to display customization image via api !!! and it is not referenced in any file in classes/webservice !!!!

 

Like i said try to reproduce the bug and help us report it.

 

For me i fixed that in my project and i retrieved the image i want via api

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...