Jump to content

1.7.1 Show Parent Category in product page


ThunderOver

Recommended Posts

Not really clear question, can you give more details?

Note: Prestashop show product's category in the breadcrumb always

Exactly, I would like it to go out before the product name.
 

jsjGiHw.png

I was able to print the id of the parent category (18) but not the associated name
Link to comment
Share on other sites

if you're using Prestashop 1.6.x simply put this code beside the product name in your theme/product.tpl file like this: http://prntscr.com/geqws9

{if isset($product->category) && $product->category}<span style="color: #01AEEC">{ucfirst($product->category)}</span> - {/if}

Result: http://prntscr.com/geqwjw

 

Good luck

Thank you very much for your support =)
Now I try the code from you written, my version of prestashop is 1.7.1
Link to comment
Share on other sites

  • 2 months later...
  • 10 months later...

Old topic, but if someone need it: 

 

Here a solution to add - manufacturer logo (if available) + link to parent category (using the breadcrumbs trick)

 

 {block name='product_reference'}
    {if isset($product_manufacturer->id)}
      <div class="product-manufacturer">
        {if isset($manufacturer_image_url)}
          <a href="{$breadcrumb.links[2].url}">
            <img src="{$manufacturer_image_url}" class="img img-thumbnail manufacturer-logo" alt="{$product_manufacturer->name}" title="Bekijk alle {$product_manufacturer->name} {$breadcrumb.links[1].title}s">
          </a>
        {else}
          <label class="label">{l s='Brand' d='Shop.Theme.Catalog'}</label>
          <span>
            <a href="{$breadcrumb.links[2].url}">{$product_manufacturer->name}</a>
          </span>
        {/if}
      </div>
    {/if}
  {/block}

 

Link to comment
Share on other sites

  • 4 months later...
On 11/2/2017 at 11:18 AM, Inform-All said:

To have a really simple, yet effective solution, i would use the breadcrumb title.

You can use this for any level of your category just change the number.


{$breadcrumb.links[2].title}

 

How can I see al this costants and variables? As

{$breadcrumb.links[2].title}

I just want to display the category, but I remember in 1.6 there was a {debug} function that pops up a new window with all the costants and variables displayed (or printed) in the page. How I do that in 1.7?

Best regards

Link to comment
Share on other sites

  • 7 months later...

Hi there.
I thought I had the same question but actually mine is a bit different.
Actually my products belong to several different categories and my problem is finally not to know the parent category...
I need to know from which catgeory page the user clicked to reach the product page!

I am using Prestashop 1.6.
Any idea?

thank you!

Edited by Pat_07 (see edit history)
  • Like 1
Link to comment
Share on other sites

  • 1 month 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...