Jump to content

Add Brand Logo beside Product Images in Product List (Categories, Homepage modules, etc.) PS 8.0.x


Recommended Posts

Hi,

Do anyone know of a simple and elegante code to add the brand logos (images) beside the product images in product list, for example on category pages, homepage modules (popular product, bestsellers etc.).?

I am running Prestashop 8.0.x

Many thanks in advance.

Have a great weekend.

Best regards,

Link to comment
Share on other sites

Hi.

Just modify one file. (prestashop 8.x)

./themes/your_theme/templates/catalog/_partials/miniatures/product.tpl

add after:

{hook h='displayProductPriceBlock' product=$product type="before_price"}

 

small code:

{block name='brand_miniature_item'}
                {if $product.id_manufacturer}
       
                    <div class="brand-img">
                      <a href="{$link->getmanufacturerLink($product.id_manufacturer)}">
                        <img 
                          src="/img/m/{$product.id_manufacturer}-small_default.jpg" 
                          alt="{$product.manufacturer_name}" 
                          title="{$product.manufacturer_name}" 
                          loading="lazy"
                        >
                      </a>
                    </div>
                 
                {/if}
              {/block}

 

result:

obrazek.png.fd372531192ae10983c88a8f5a9d665e.png

Edited by ps8moduly.cz
Remove li tag (see edit history)
Link to comment
Share on other sites

Hi!

MANY THANKS for this one!

Unfortunately it doesn't seem to be working as expected, the brand logo is overlapped at the bottom and the price won't show as well. Also, there appears a "dot" under the product title.

brand-logo-beside-product-image-ps8.png.1b907ef1b56bc64c9ee0ff3ce1834323.png

Do you have any idea to resolve this?

Should the "block" be inside of the price block, or maybe before?

Thanks again, appreciate it.

Best regards,

Link to comment
Share on other sites

Okay, so I opened up /themes/classic/templates/catalog/product.tpl and added this:

{block name='brand_productpage'}
    {if $product.id_manufacturer}
        <div class="brand-productpage" style="margin-bottom:6px;">
            <a href="{$link->getmanufacturerLink($product.id_manufacturer)}" title="{$product.manufacturer_name|escape:html:'UTF-8'}">
                <img
                src="/img/m/{$product.id_manufacturer}-small_default.jpg"
                alt="{$product.manufacturer_name|escape:html:'UTF-8'}"
                loading="lazy"
                >
            </a>
        </div>
    {/if}
{/block}

BELOW this:

{block name='page_header_container'}

..and it seems to be working fine.

Do the block name has to refer to an actual "name" within Prestashop, or can I just use "brand_productpage" as I have done?

Thanks in advance,

Best regards,

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