Jump to content

[Solved] Change the size of the cross selling module images


Recommended Posts

Hi,

 

I'd like to change the size of the images displayed in the crossselling module on the product page, that are currently set to 'medium', so that they would be the same size as my home images (way bigger).

<img src="{$orderProduct.image}" alt="{$orderProduct.name|htmlspecialchars}">

As I understand it the size is hard coded in the crossselling.php file (seriously ?),

$orderProduct['image'] = $this->context->link->getImageLink($orderProduct['link_rewrite'], (int)$orderProduct['product_id'].'-'.(int)$orderProduct['id_image'], ImageType::getFormatedName('medium'));

but is it possible to change the size without having to edit this file ? I'm selling a theme and can't override any PHP, or am I wrong ? I'm not gonna have to duplicate the crossselling module and give it a new name, then edit the PHP just to change the size of the images ?

 

Thanks for any help.

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

Oh man, that was so simple, works a charm ! Obviously PHP isn't my thing.

 

Thanks a lot ! :)

PHP is not my strong thing either. Sometimes all you need to do is think a little :)

Normally product images in prestashop are loaded with this code:

{$link->getImageLink($product.link_rewrite, $product.id_image, 'home_default')|escape:'html'}

Crosselling module uses similar code to determine {$orderProduct.image} that is used to load images:

$orderProduct['image'] = $this->context->link->getImageLink($orderProduct['link_rewrite'], (int)$orderProduct['product_id'].'-'.(int)$orderProduct['id_image'], ImageType::getFormatedName('medium'));

so it seemed logical that changing $product to $orderProduct in first code should do the trick :)

Link to comment
Share on other sites

PHP is not my strong thing either. Sometimes all you need to do is think a little :)

Normally product images in prestashop are loaded with this code:

{$link->getImageLink($product.link_rewrite, $product.id_image, 'home_default')|escape:'html'}

Crosselling module uses similar code to determine {$orderProduct.image} that is used to load images:

$orderProduct['image'] = $this->context->link->getImageLink($orderProduct['link_rewrite'], (int)$orderProduct['product_id'].'-'.(int)$orderProduct['id_image'], ImageType::getFormatedName('medium'));

so it seemed logical that changing $product to $orderProduct in first code should do the trick :)

Not logical for my brain ! ;p But thanks for your explanation, it's clearer now !

Link to comment
Share on other sites

  • 4 weeks later...

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