Jump to content
perusi

Bigger image in BO Order details Product Line

Recommended Posts

I`m interested in showing a bigger image in the Order details page in BO. Now it currently displays the mini image, but i`m interested in showing a bigger image. I don't want to modify the mini image size and height, but to ask for another image size.

 

I know this is the code to modify in _product_line.tpl from  admin/themes/default/template/controllers/orders

<td align="center">{if isset($product.image) && $product.image->id}{$product.image_tag}{/if}</td>

I`m using PS 1.5.3.1

 

Thanks

Share this post


Link to post
Share on other sites

Hi friends.

First create an override

Create a file in > override\controllers\admin\AdminOrdersController.php

 

Then add this code:

class AdminOrdersController extends AdminOrdersControllerCore
{

	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;
			}
		}

		return $products;
	}
}

Look at the code when says 

$product['image_tag'] = ImageManager::thumbnail(_PS_IMG_DIR_.'p/'.$product['image']->getExistingImgPath().'.jpg', $name, 45, 'jpg');

Change the number 45, to 100 or 150, this is the size in pixels.

 

Go to images/tmp/ then delete the product cached images, they look like "product_mini_780_1500.jpg"

 

The sistem will regenerate automaticly the images to this new size when you deletes the smallers.

 

I tested this on only orders, but this will affects to the entire backoffice, because the temp image is used in products lists an other admin pages.

 

;)

 

Share this post


Link to post
Share on other sites

Hello,

Thank you for the tips.

I would like to make it working on the product list of the back office on PS 1.6, to get the product_mini size to 250 px.

But the product_mini keeps a small size !!

I have deleted the tmp picture file. I have tried to override with the same code the AdminProductscontroller. I have modifyed the image size of the product_mini and regenerated the thumbnails.. I also change the size in the classes/adminTab

If you have an idea that would be great.

Thank you in advance !

Share this post


Link to post
Share on other sites

To change product list image size, go to classes/helper/HelperList.php

 

Edit this line :

$this->_list[$index][$key] = ImageManager::thumbnail($path_to_image, $this->table.'_mini_'.$item_id.'.'.$this->imageType, 45, $this->imageType);

And like before, change the 45 value for anything you want :)

Edited by KevinNash (see edit history)

Share this post


Link to post
Share on other sites

Hello ,

I tried to make the same thing on pictures on invoces on PS 1.6.1.15

I would like to make the pictures of products on invoces pdf , more bigger

Any ideas please ?

 

Regards

Share this post


Link to post
Share on other sites

Hello!

There is a way to make this image, at order details product line, a link to the product at the Store Front?

Regards

Edited by siomosp (see edit history)

Share this post


Link to post
Share on other sites
On 3/25/2014 at 9:46 PM, mantobani said:

Hi friends.

First create an override

Create a file in > override\controllers\admin\AdminOrdersController.php

 

Then add this code:


class AdminOrdersController extends AdminOrdersControllerCore
{

	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;
			}
		}

		return $products;
	}
}

Look at the code when says 


$product['image_tag'] = ImageManager::thumbnail(_PS_IMG_DIR_.'p/'.$product['image']->getExistingImgPath().'.jpg', $name, 45, 'jpg');

Change the number 45, to 100 or 150, this is the size in pixels.

 

Go to images/tmp/ then delete the product cached images, they look like "product_mini_780_1500.jpg"

 

The sistem will regenerate automaticly the images to this new size when you deletes the smallers.

 

I tested this on only orders, but this will affects to the entire backoffice, because the temp image is used in products lists an other admin pages.

 

;)

 

hi i've tried on Prestashop 1.7.5 it show me "internal error 500" can you explain me what to change in this code for 1.7.5 version please ? thank you very much !!

Share this post


Link to post
Share on other sites
7 ore fa, eviatar dice:

hi i've tried on Prestashop 1.7.5 it show me "internal error 500" can you explain me what to change in this code for 1.7.5 version please ? thank you very much !!

On PS1.7 make a backup copy of this file:
    /controllers/admin/AdminOrdersController.php

Then find these 2 rows:

Around row 1813:

$pack_item['image_tag'] = ImageManager::thumbnail(_PS_IMG_DIR_.'p/'.$pack_item['image']->getExistingImgPath().'.jpg', $name, 45, 'jpg');

Around row 2807:

$product['image_tag'] = ImageManager::thumbnail(_PS_IMG_DIR_.'p/'.$product['image']->getExistingImgPath().'.jpg', $name, 45, 'jpg');

On both change 45 with the size you need. In my case I set them to 160.

Last step it's to delete tmp image cache... To do this locate images/tmp/ folder and delete alla the images images with name that start with "product_mini_".

Hope this helps.

Edited by DARKF3D3 (see edit history)
  • Like 2

Share this post


Link to post
Share on other sites
On 1/31/2019 at 8:40 PM, DARKF3D3 said:

On PS1.7 make a backup copy of this file:
    /controllers/admin/AdminOrdersController.php

Then find these 2 rows:

Around row 1813:


$pack_item['image_tag'] = ImageManager::thumbnail(_PS_IMG_DIR_.'p/'.$pack_item['image']->getExistingImgPath().'.jpg', $name, 45, 'jpg');

Around row 2807:


$product['image_tag'] = ImageManager::thumbnail(_PS_IMG_DIR_.'p/'.$product['image']->getExistingImgPath().'.jpg', $name, 45, 'jpg');

On both change 45 with the size you need. In my case I set them to 160.

Last step it's to delete tmp image cache... To do this locate images/tmp/ folder and delete alla the images images with name that start with "product_mini_".

Hope this helps.

oh sorry i've forgot to say to you thank you ! it's perfect thank you very much !

Share this post


Link to post
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...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More