Quant Posted June 17, 2020 Posted June 17, 2020 In the AdminProducts controller we have a small picture type. If this type is not or is it disabled for products? The initFormAttributes and initFormImages functions have a line that probably does not work correctly: $type = ImageType::getByNameNType('%', 'products', 'height'); //won't find anything it's better this way $type = ImageType::getByNameNType('*', 'products', 'height'); //will show first In initFormInformations (for inserting pictures in the description), the type small is also hardcoded: //type (small) as constant foreach ($images as $k => $image) { $images[$k]['src'] = $this->context->link->getImageLink($product->link_rewrite[$this->context->language->id], $product->id.'-'.$image['id_image'], ImageType::getFormatedName('small')); } it's better this way //better to find from what is $imageType = (ImageType::getImagesTypes('products'))[0]['name'] ?? 'Unknow'; foreach ($images as $k => $image) { $images[$k]['src'] = $this->context->link->getImageLink($product->link_rewrite[$this->context->language->id], $product->id.'-'.$image['id_image'], ImageType::getFormatedName($imageType)); } In my store (TB with the latest bleeding edge update) I do not use the "small" type. These fixes work for me. Maybe it should be for everyone.
Traumflug Posted June 17, 2020 Posted June 17, 2020 Your "fix" may work for you, and nice to see it does, but is certainly not a general solution. It always picks the first image type defined, which can be any size.
Quant Posted June 17, 2020 Author Posted June 17, 2020 15 minutes ago, Traumflug said: Your "fix" may work for you, and nice to see it does, but is certainly not a general solution. It always picks the first image type defined, which can be any size. I agree. In my situation, I could not find a better solution than to write such overrides. Will have to live with them. Of course, it's better not to delete the small type 😞
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now