Jump to content

Different Page Title For Each Product Group


saadsalman

Recommended Posts

Hi,

 

I need to have different page titles for different groups in my shopping cart instead of the default "Company Name - Shopping Cart" as shown:

 

"Company Name - Shared Web Hosting" for http://www.mysite.com/cart.php?gid=1

 

"Company Name - Reseller Hosting" for http://www.mysite.com/cart.php?gid=2

 

"Company Name - Anything Else" for http://www.mysite.com/cart.php?gid=3

 

Anyone already done with this? Is that even possible?

 

Regards

Link to comment
Share on other sites

Hi,

 

I need to have different page titles for different groups in my shopping cart instead of the default "Company Name - Shopping Cart" as shown:

 

"Company Name - Shared Web Hosting" for http://www.mysite.com/cart.php?gid=1

 

"Company Name - Reseller Hosting" for http://www.mysite.com/cart.php?gid=2

 

"Company Name - Anything Else" for http://www.mysite.com/cart.php?gid=3

 

Anyone already done with this? Is that even possible?

 

Regards

 

By default; no but the page title is defined in the template files so it is possible to do using the header.tpl file. Put this in top of your header.tpl:

{php}
if(preg_match('/^[0-9]{1,}$/', $_GET['gid']) AND preg_match("/cart.php/", $_SERVER["SCRIPT_NAME"]))
{
$result = select_query("tblproductgroups","name",array("id" => $_GET['gid']));
$data = mysql_fetch_array($result);

$this->assign("pagecat", $data['name']);
}
{/php}

 

And replace the <title> line with:

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

Link to comment
Share on other sites

  • 12 years later...

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