Jump to content

Anyway to display meta title in place of product name?


DagCardella

Recommended Posts

Hello,

i'm using a management software to export all of my products before I can upload them to Prestashop: since the title are getting wiped out at every upload (I know I can just ignore the title column, but I work for a pharmacy and products are constatly changing, so I add a lot of them every time) I'm using the meta tag.

The product names from the management are ugly as hell (it's a kind of conventional code of abbreviation for pharmacies, where, for instance, "pills" are "PLL"): is there a way to let the customers display the meta title in place of the ugly product name?

I attached a screenshot with highlighted ugly title and meta title (as under <head>)

I already got the "meta title" written in its location, I just need prestashop frontend to display that instead of the product name... but when I analyzed the product page I found that there are two <title> tag, one in the head section (that's the meta title, which is what I want my customers to see) and the other one in the body section (the ugly one, but that I can't get rid of because it's automatically imported each time I run the cvs upload)

905165102_Screenshot2020-11-18at18_58_17.png.335c90e7f309d886196b597ce3063e17.png

Link to comment
Share on other sites

I edited in themes/"my theme"/templates/catalog/ the product.tpl file: at line 81 I changed

<h1 class="h1 namne_details" itemprop="name">{block name='page_title'}{$product.name}{/block}</h1>

to

<h1 class="h1 namne_details" itemprop="name">{block name='page_title'}{$page.meta.title}{/block}</h1>

This worked for all the titles! Do you have any ideas about where to put my hands on for product names in search and related/same category boxes?

Screenshot_20201119_000005.png

Screenshot_20201119_005116.png

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

I found in dbprefix_product_lang the two columns that I think need for this: they're "name" and "meta_title": but I can't find where to say to prestashop that it has to take the information from "meta_title" and not from "name" in those instances.

Can someone just pointing me where to look at? I searched in a lot ot tpl and php files to no avail... 

 

  • Like 1
Link to comment
Share on other sites

  • 2 weeks later...

EDIT: I managed to change every title aside from the ones found in search box with this mod in public_html/themes/mytheme/templates/catalog/_partials/miniatures/product.tpl:

I went from:

{block name='product_name'} <h4><a href="{$product.url}" title="{$product.name}" itemprop="name" class="product_name">{$product.name}</a></h4> {/block}

to

{block name='product_name'} <h4><a href="{$product.url}" title="{$product.meta_title}" itemprop="name" class="product_name">{$product.meta_title}</a></h4> {/block}

My question yet is still the same: Where do I look for search box titles?

Screenshot 2020-12-01 at 17.08.32.png

Screenshot 2020-12-01 at 17.05.03.png

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