malcek Posted July 23, 2020 Share Posted July 23, 2020 I need to change size of displayed picture in detail page of order in BO. I did find in css, but I can't find where is this picture generated. any advice is good for me Martin Link to comment Share on other sites More sharing options...
Guest Posted July 23, 2020 Share Posted July 23, 2020 And will you tell us the version of Prestashop? Link to comment Share on other sites More sharing options...
malcek Posted July 23, 2020 Author Share Posted July 23, 2020 at this moment 1.7.5.2, but planned for next week to upgrade to 1.7.6.7 Link to comment Share on other sites More sharing options...
Guest Posted July 23, 2020 Share Posted July 23, 2020 (edited) ./controllers/admin/AdminOrdersController.php find function: protected function getProducts($order) { $products = $order->getProducts(); foreach ($products as &$product) { if ($product['image'] != null) { $name = 'product_mini_' . (int) $product['product_id'] . (isset($product['product_attribute_id']) ? '_' . (int) $product['product_attribute_id'] : '') . '.jpg'; // generate image cache, only for back office $product['image_tag'] = ImageManager::thumbnail(_PS_IMG_DIR_ . 'p/' . $product['image']->getExistingImgPath() . '.jpg', $name, 45, 'jpg'); if (file_exists(_PS_TMP_IMG_DIR_ . $name)) { $product['image_size'] = getimagesize(_PS_TMP_IMG_DIR_ . $name); } else { $product['image_size'] = false; } } } ksort($products); return $products; } Change the function and create a new preview image. Edited July 23, 2020 by Guest (see edit history) Link to comment Share on other sites More sharing options...
Guest Posted July 23, 2020 Share Posted July 23, 2020 change size to 100 x 100 sample: protected function getProducts($order) { $products = $order->getProducts(); foreach ($products as &$product) { if ($product['image'] != null) { $name = 'product_mini_' . (int) $product['product_id'] . (isset($product['product_attribute_id']) ? '_' . (int) $product['product_attribute_id'] : '') . '.jpg'; if (file_exists(_PS_TMP_IMG_DIR_ . $name)) { unlink(_PS_TMP_IMG_DIR_ . $name); } // generate image cache, only for back office $product['image_tag'] = ImageManager::thumbnail(_PS_IMG_DIR_ . 'p/' . $product['image']->getExistingImgPath() . '.jpg', $name, 100, 'jpg'); if (file_exists(_PS_TMP_IMG_DIR_ . $name)) { $product['image_size'] = getimagesize(_PS_TMP_IMG_DIR_ . $name); } else { $product['image_size'] = false; } } } ksort($products); return $products; } Link to comment Share on other sites More sharing options...
Guest Posted July 23, 2020 Share Posted July 23, 2020 I only added an unlink. You can also create your own thumbnail. Just change the name. Eg $name = 'product_mini_' . (int) $product['product_id'] . (isset($product['product_attribute_id']) ? '_' . (int) $product['product_attribute_id'] : '') . '_100.jpg'; etc....... Link to comment Share on other sites More sharing options...
DARKF3D3 Posted September 7, 2021 Share Posted September 7, 2021 (edited) I just found the correct file for PS1.7.7: /httpdocs/src/Adapter/Order/QueryHandler/GetOrderProductsForViewingHandler.php Just search for 45 and change to the preferred size. If you still see the old images, you should delete product_mini images into /img/tmp/ folder. Edited March 2, 2023 by DARKF3D3 (see edit history) Link to comment Share on other sites More sharing options...
DARKF3D3 Posted September 7, 2021 Share Posted September 7, 2021 (edited) This is tested working also on PS8.0.1 Edited March 2, 2023 by DARKF3D3 (see edit history) Link to comment Share on other sites More sharing options...
Luigi Donato Posted September 23, 2023 Share Posted September 23, 2023 On 9/7/2021 at 11:27 AM, DARKF3D3 said: I just found the correct file for PS1.7.7: /httpdocs/src/Adapter/Order/QueryHandler/GetOrderProductsForViewingHandler.php Just search for 45 and change to the preferred size. If you still see the old images, you should delete product_mini images into /img/tmp/ folder. Hello and thanks for your solution, I found it very practical, do you know if a similar thing can also be done for the products in the products catalogue? Link to comment Share on other sites More sharing options...
Ponas Programuotojas Posted November 12, 2023 Share Posted November 12, 2023 (edited) On 9/23/2023 at 7:32 PM, Luigi Donato said: Hello and thanks for your solution, I found it very practical, do you know if a similar thing can also be done for the products in the products catalogue? Image sizes change in the tmp directory, but how to change them on the admin products page? Now prestashop 8.1.2 shows nail size pictures that I can't identify the products by, especially when they are very similar. And what do presta developers think that users do not need to recognize the product? why is there no place in the admin config settings where you can change the picture sizes or distances? Now you have to search for three hours in the files to change the icon size and you can't even find it.Maybe the prestashop developers think that showing product icons the size of a nail is a very good thing and progress? Edited November 12, 2023 by vardenis2 (see edit history) Link to comment Share on other sites More sharing options...
DARKF3D3 Posted November 12, 2023 Share Posted November 12, 2023 You can ask to Prestashop here:https://github.com/PrestaShop/PrestaShop/discussions Link to comment Share on other sites More sharing options...
Ponas Programuotojas Posted November 12, 2023 Share Posted November 12, 2023 (edited) On 9/7/2021 at 12:27 PM, DARKF3D3 said: I just found the correct file for PS1.7.7: /httpdocs/src/Adapter/Order/QueryHandler/GetOrderProductsForViewingHandler.php Just search for 45 and change to the preferred size. If you still see the old images, you should delete product_mini images into /img/tmp/ folder. Do not working on Prestashop 8.1.2 working this: change product_mini image size in classes/ImageManager.php by defining $size value. 80 line Example: Quote $size = 250; if (!file_exists($image)) { And change Quote $max_x = $size * 3; to Quote $max_x = $size * 1; after delete img/tmp all thumnails in corect size but images chage olnly in index.php/sell/catalog/products/465 how change image size in bo: /index.php/sell/catalog/products where are css with class="imgm img-thumbnail"? I looked through all the css of the admin theme and couldn't find it. And in general, is it possible to change the larger images only on the product administration page, and to leave the smaller ones on the product adjustment page itself? Maybe someone knows how to display product images from the images/p directory on the admin page. Because after increasing the dimensions of the images in the tmp directory, I would have 20,000 product images, the size of which I increase significantly, so it is more relevant for me to show product images from the private image directory. Edited November 12, 2023 by vardenis2 (see edit history) Link to comment Share on other sites More sharing options...
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