Jump to content

PS1.7 Module category image the good way ?


Recommended Posts

Hi,

I searched a way to add the category thumbnail in a module under prestashop 1.7.

I found several way to do it, but I wonder what il the best way in 1.7 context.

Here is how I done it :

1/ use Link interface

use PrestaShop\PrestaShop\Core\Module\WidgetInterface;
use Link;

2/ create a link instance

$link = new Link;

3/ use method getCatImageLink()

$category['image'] = $link->getCatImageLink($cat->getName(),$cat->id_image);

 

But we can also use the ImageRetriever interface, which use Link (so I choose to use Link directly).

Am I doing it right ?

Any better other 1.7 compliant solution ?

Best,

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