Back to JKShop Support

Sevenface
Sevenface

I have a little question and I think it would be pretty easy to solve it but I don't know how.

I want that my product and categories name is in the page title (meta title). Something like that for your plugin:

function onEnd() {

// get the post component
$_post = $this->components['blogPost'];
$_post = $_post->post; // post is the alias of my component

// get the title
$_title = $_post->title;

// update the page title
$this->page->title = $_title;

}

Last updated

Jiri Kubak
Jiri Kubak

Sevenface said:

I have a little question and I think it would be pretty easy to solve it but I don't know how.

I want that my product and categories name is in the page title (meta title). Something like that for your plugin:

Hi,

i dont know if this deneps on my plugin but generally u use somethink like this:

in layout

{% if  (this.page.meta_title!="")  %}<meta name="title" content="{{ this.page.meta_title }}">{% endif %}
{% if  (this.page.meta_description!="")  %}<meta name="description" content="{{ this.page.meta_description }}">{% endif %}
{% if  (this.page.meta_keywords!="")  %}<meta name="keywords" content="{{ this.page.meta_keywords }}">{% endif %}

and same as you updated page title you can setup meta title for every page

function onEnd() {
// update the page title
$this->page->meta_title = $_title;}

Best

Jiri

Last updated

dan12625
dan12625

If you are still looking, the simplest way is to use this:

function onEnd() { // update the page title $this->page->title = $this->product->title; }

Add this to the code on your view product page.

1-3 of 3