theodiablo Posted November 10, 2020 Share Posted November 10, 2020 (edited) Hi there, I have been trying for some time now to display the product variation image on the backoffice Order Detail's page in the product line. For some reason, it prints an incorrect image and I can't make it show the correct one. I have been trying to edit the getProducts from the AdminOrderController.php file, but it keeps showing an image from another product and I can't say why! This is my code right now: protected function getProducts($order) { $products = $order->getProducts(); foreach ($products as &$product) { $productInstance = new Product($product['product_id']); $combinationImages = $productInstance->getCombinationImages((int) Configuration::get('PS_LANG_DEFAULT')); $name = 'product_mini_' . (int) $product['product_id'] . (isset($product['product_attribute_id']) ? '_' . (int) $product['product_attribute_id'] : '') . '.jpg'; $attributeImages = Image::getBestImageAttribute((int) Configuration::get('PS_SHOP_DEFAULT'), (int) Configuration::get('PS_LANG_DEFAULT'), $product['product_id'], $product['product_attribute_id']); if(!empty($attributeImages)){ $attributeImage = new Image($attributeImages['id_image']); $product['image_tag'] = ImageManager::thumbnail(_PS_IMG_DIR_ . 'p/' . $attributeImage->getExistingImgPath() . '.jpg', $name, 80, 'jpg'); } else // Previous code here } } Here are my variations defined with the correct image associated: And as you can see here, the image displayed in the product line isn't correct: Here it should display the green image and not the blue one. I have cleared cache and deleted the cached thumbnail images which I know could cause errors, but it is still happening and I can't understand why 😞 Does anyone have this error before? How could I display the correct variation image? Thanks. Edited November 10, 2020 by theodiablo (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