Jump to content

Changing Title of cart/domain page through hook


jacksony

Recommended Posts

Hi!

 

Can someone advise how can we use hook to change title of a page? We want to change for cart.php?a=add&domain=register.

 

The code below should work (although it is for all cart pages, although we want it for domain pages only), but don't..

 

<?php

function hook_setpagetitle($vars){

if ($vars['filename']=='cart'){
   $pagetitle = "Domain Name Registration";
}

return array("pagetitle" => $pagetitle);
}
add_hook("ClientAreaPage", 1, "hook_setpagetitle");

Link to comment
Share on other sites

  • 3 years later...

Hey guys,

Sorry to bump such an old post but haven't found a solution elsewhere and this is topic is the closest to a solution I've found.

I have modified the  header.tpl title to the following:

<title>{if $groupname}{$groupname}{else}{$pagetitle}{/if}{if $kbarticle.title} - {$kbarticle.title}{/if} - {$companyname}</title>

This works great because it has significantly improved SEO throughout my system, specially on the cart pages which only showed Shopping Cart for all product/services.

However, the Domain and Transfer pages still show the Shopping Cart title, I tried implementing the code provided by Brian and it does the trick for the Domain page and works well BUT now the title for all the shopping cart related pages is gone, showing only "{companyname} -(blank)".

I've been trying to play around with the code to make the Shopping Cart title appear again while also including a title for the Domain Transfer Page without success.

Any help would be much appreciated.

Link to comment
Share on other sites

  • 2 years later...

Mi workaround is the following:

Edit the header.tpl file, inside the used theme folder, and you can configure <title> as this (my code is in Spanish language, but change with yours):

{if $templatefile eq "pagebuilder" or $templatefile eq "homepage"}
<title>{if $groupname}{$groupname}{else}{$pagetitle}{/if}{if $pagedata.meta_title}{$pagedata.meta_title}{else}{$pagedata.item.name} - {$companyname}{/if}</title>
{elseif $templatefile == 'clientareadomains'}
<title>Gestión de dominios contratados - {$companyname}</title>
{elseif $templatefile == 'clientareadomaindetails'}
<title>{$domain} - Gestión de dominios contratados - {$companyname}</title>
{elseif $templatefile == 'clientareaproducts'}
<title>Gestión de servicios contratados - {$companyname}</title>
{elseif $templatefile == 'clientareaproductdetails'}
<title>{$domain} - Gestión de servicios contratados - {$companyname}</title>
{elseif $templatefile == 'clientareainvoices'}
<title>Mis facturas - {$companyname}</title>
{elseif $templatefile == 'clientareadetails'}
<title>Mis datos de cliente - {$companyname}</title>
{elseif $templatefile == 'account-contacts-new'}
<title>Contactos y subcuentas - {$companyname}</title>
{elseif $templatefile == 'clientareasecurity'}
<title>Seguridad de la cuenta - {$companyname}</title>
{elseif $templatefile == 'clientareaemails'}
<title>Emails recibidos como cliente - {$companyname}</title>
{else}
<title>{if $templatefile == 'viewannouncement'}{$title}{elseif $templatefile == 'announcements'}{lang key="news"}{elseif $kbarticle.title}{$kbarticle.title}{elseif $templatefile == 'knowledgebasecat'}{$kbcurrentcat.name}{else}{$pagetitle}{/if} - {$companyname}</title>
{/if}

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated