Category Page Custom Title

Store UI, layout, design, look and feel; Discussion on the customer facing pages of your online store. Cascading Style Sheets, Themes, Scriptlets, NVelocity and the components in the ConLib directory.
Post Reply
stephenw
Ensign (ENS)
Ensign (ENS)
Posts: 11
Joined: Wed Mar 21, 2012 4:05 pm

Category Page Custom Title

Post by stephenw » Thu Mar 22, 2012 8:54 am

While our category pages automatically use the name of the cat as the html <title>Title</title>, which is alright, but I wish to change what the Title is, without changing the category name.

Instead of "Category" as the title, I'd like it to show <title>Category at StoreName.com</title>

So I pretty much want to tack on our store's name onto the category name, as the title (for cat pages only.) We have many categories.

How would I do this? I've seen somewhat similar threads, but they didn't exactly address this specific thing, in a way that helps with just this.

Thank you to anyone who helps me with this - This is my first time here, so this would be much appreciated :)

User avatar
david-ebt
Captain (CAPT)
Captain (CAPT)
Posts: 253
Joined: Fri Dec 31, 2010 10:12 am

Re: Category Page Custom Title

Post by david-ebt » Thu Mar 22, 2012 9:09 am

Welcome!

The file you need to change depends on which category page and which category ConLib control you're using. Here is the code from the CategoryGridPage.ascx.cx file where it sets the page title:

Code: Select all

private void BindPage()
{
//BIND THE DISPLAY ELEMENTS
if (IsValidCategory())
{
    CategoryBreadCrumbs1.Visible = DisplayBreadCrumbs;
    CategoryBreadCrumbs1.CategoryId = this.CategoryId;
    if (_Category != null)
    {
	Page.Title = _Category.Name;                
	Caption.Text = _Category.Name;
    }
    else
    {
	// IF IT IS ROOT CATEGORY
	Page.Title = DefaultCaption;
	Caption.Text = DefaultCaption;
    }
You can change that to:

Code: Select all

private void BindPage()
{
//BIND THE DISPLAY ELEMENTS
if (IsValidCategory())
{
    CategoryBreadCrumbs1.Visible = DisplayBreadCrumbs;
    CategoryBreadCrumbs1.CategoryId = this.CategoryId;
    if (_Category != null)
    {
	Page.Title = _Category.Name + " at " + Token.Instance.Store.Name;                
	Caption.Text = _Category.Name;
    }
    else
    {
	// IF IT IS ROOT CATEGORY
	Page.Title = DefaultCaption + " at " + Token.Instance.Store.Name;
	Caption.Text = DefaultCaption;
    }
The other category ConLib controls have the same code. I hope that helps!
David
http://www.ecombuildertoday.com
Enhanced Reporting for AbleCommerce
Image

stephenw
Ensign (ENS)
Ensign (ENS)
Posts: 11
Joined: Wed Mar 21, 2012 4:05 pm

Re: Category Page Custom Title

Post by stephenw » Thu Mar 22, 2012 12:36 pm

Thanks for the help here, david-ebt - I truly appreciate it. Quick reply, too! You rock.

This looks like a perfect solution for what I need done. It must work normally, but it won't on my site. It must be because I have had a plugin enabled at one point, then have since disabled it. This was web 2 market, which I'm not using anymore. Maybe it changed some files in a way that makes the fix you provided not work?

User avatar
david-ebt
Captain (CAPT)
Captain (CAPT)
Posts: 253
Joined: Fri Dec 31, 2010 10:12 am

Re: Category Page Custom Title

Post by david-ebt » Thu Mar 22, 2012 1:28 pm

You're welcome.

It could be the ConLib controls that are active on the site are still custom ConLibs. If you log in as an Admin user, then browse to a category page, then go to the bottom of the page and Edit Page, then click on the notepad icon to the left of the Content drop down, does it show ConLib or ConLib\Custom (or something else) for the location of the ConLib control?

If it is something other than ConLib, then just go into that folder and take a look in the appropriate .cs file for the ConLib control and look in the BindPage function.
David
http://www.ecombuildertoday.com
Enhanced Reporting for AbleCommerce
Image

stephenw
Ensign (ENS)
Ensign (ENS)
Posts: 11
Joined: Wed Mar 21, 2012 4:05 pm

Re: Category Page Custom Title

Post by stephenw » Thu Mar 22, 2012 3:25 pm

Hey again, sorry for such a late reply - It's been a few hours since I've checked in on this forum.

Thanks very much for continuing to help with this. It blows my mind someone would spend their time helping answer such questions, so this really is cool of you.

This is what I have here - [[ConLib:Custom\CategoryGridPage4 DefaultCaption="Catalog" DisplayBreadCrumbs="false" size="100" PagingLinksLocation="NONE" MaximumSummaryLength="0"]]

stephenw
Ensign (ENS)
Ensign (ENS)
Posts: 11
Joined: Wed Mar 21, 2012 4:05 pm

Re: Category Page Custom Title

Post by stephenw » Thu Mar 22, 2012 3:28 pm

And this is what I have within the custom CategoryGridPage4 BindPage:

Code: Select all

private void BindPage()
    {
        CategoryBreadCrumbs1.Visible = DisplayBreadCrumbs;
        CategoryBreadCrumbs1.CategoryId = this.CategoryId;

        //BIND THE DISPLAY ELEMENTS
        if (IsValidCategory())
        {
            if (_Category != null)
            {
                Page.Title = _Category.Name + " at " + Token.Instance.Store.Name + ".com";
                Caption.Text = _Category.Name;

                if (!string.IsNullOrEmpty(_Category.Description))
                {
                    CategoryDescriptionPanel.Visible = true;
                    CategoryDescription.Text = _Category.Description;
                }
                else CategoryDescriptionPanel.Visible = false;

                // BEGIN MOD:  AbleMods.com
                // 3/9/2012
                // bind meta tags using PageHelper routine
                PageHelper.BindMetaTags(this.Page, _Category);
                // END MOD: AbleMods.com


            }
            else
            {
                // IF IT IS ROOT CATEGORY
                Page.Title = DefaultCaption + " at " + Token.Instance.Store.Name;
                Caption.Text = DefaultCaption;
                CategoryDescriptionPanel.Visible = false;
            }
        }
        else
        {
            CategoryHeaderPanel.Visible = false;
        }
        BindSearchResultsPanel();
    }

User avatar
david-ebt
Captain (CAPT)
Captain (CAPT)
Posts: 253
Joined: Fri Dec 31, 2010 10:12 am

Re: Category Page Custom Title

Post by david-ebt » Thu Mar 22, 2012 6:41 pm

This looks good. The page title doesn't display as Category Name at Store.com?

Can you post a URL or PM me with one?
David
http://www.ecombuildertoday.com
Enhanced Reporting for AbleCommerce
Image

stephenw
Ensign (ENS)
Ensign (ENS)
Posts: 11
Joined: Wed Mar 21, 2012 4:05 pm

Re: Category Page Custom Title

Post by stephenw » Fri Mar 23, 2012 9:36 am

Alright, thanks again - PM sent!

stephenw
Ensign (ENS)
Ensign (ENS)
Posts: 11
Joined: Wed Mar 21, 2012 4:05 pm

Re: Category Page Custom Title

Post by stephenw » Fri Mar 23, 2012 12:20 pm

OK everything is perfect now!

All I had to do was rearrange the code above into the following, so the title would over ride

Code: Select all

PageHelper.BindMetaTags(this.Page, _Category);
which was over riding the title fix david has shared with me:

Code: Select all

private void BindPage()
    {
        CategoryBreadCrumbs1.Visible = DisplayBreadCrumbs;
        CategoryBreadCrumbs1.CategoryId = this.CategoryId;

        //BIND THE DISPLAY ELEMENTS
        if (IsValidCategory())
        {
            if (_Category != null)
            {
                 // BEGIN MOD:  AbleMods.com
                // bind meta tags using PageHelper routine
                PageHelper.BindMetaTags(this.Page, _Category);
                // END MOD: AbleMods.com

               Page.Title = _Category.Name + " at " + Token.Instance.Store.Name + ".com";
                Caption.Text = _Category.Name;

                if (!string.IsNullOrEmpty(_Category.Description))
                {
                    CategoryDescriptionPanel.Visible = true;
                    CategoryDescription.Text = _Category.Description;
                }
                else CategoryDescriptionPanel.Visible = false;

            }
            else
            {
                // IF IT IS ROOT CATEGORY
                Page.Title = DefaultCaption + " at " + Token.Instance.Store.Name;
                Caption.Text = DefaultCaption;
                CategoryDescriptionPanel.Visible = false;
            }
        }
        else
        {
            CategoryHeaderPanel.Visible = false;
        }
        BindSearchResultsPanel();
    }

Post Reply