Add the following to the block file for use: It is generally set in the block with the largest content, for example, mage_catalog_block_category_view.
Protected function _ preparelayout ()
{
Parent: _ preparelayout ();
$ This-> getlayout ()-> createblock ('catalog/breadcrumbs ');
If ($ headblock = $ this-> getlayout ()-> getblock ('head ')){
$ Category = $ this-> getcurrentcategory ();
If ($ Title = $ category-> getcategoritle ()){
$ Headblock-> settitle ($ title );
}
If ($ description = $ category-> getmetadescription ()){
$ Headblock-> setdescription ($ description );
}
If ($ KEYWORDS = $ category-> getmetakeywords ()){
$ Headblock-> setkeywords ($ keywords );
}
If ($ this-> helper ('catalog/Category ')-> canusecanonicaltag ()){
$ Headblock-> addlinkrel ('canonical', $ category-> geturl ());
}
/*
Want to show RSS feed in the URL
*/
If ($ this-> isrsscatalogenable () & $ this-> istopcategory ()){
$ Title = $ this-> helper ('rss ')->__ (' % s RSS feed', $ this-> getcurrentcategory ()-> getname ());
$ Headblock-> additem ('rss ', $ this-> getrsslink (), 'title = "'. $ title .'"');
}
}
Return $ this;
}
Example:
Protected function _ preparelayout ()
{
$ This-> getlayout ()-> createblock ('catalog/breadcrumbs ');
If ($ headblock = $ this-> getlayout ()-> getblock ('head ')){
If ($ Title = $ this-> getproduct ()-> getaskitle ()){
$ Headblock-> settitle ($ title );
}
// Title = Name is used as title.
Else {$ headblock-> settitle ($ this-> getproduct ()-> getname ());}
If ($ keyword = $ this-> getproduct ()-> getmetakeyword ()){
$ Headblock-> setkeywords ($ keyword );
} Elseif ($ currentcategory = Mage: Registry ('current _ category ')){
// Enter keywords here.
$ KEYWORDS = "Replica watches, Rolex watches ";
$ Headblock-> setkeywords ($ keywords );
// $ Headblock-> setkeywords ($ this-> getproduct ()-> getname ());
}
If ($ description = $ this-> getproduct ()-> getmetadeworkflow ()){
$ Headblock-> setdescription ($ description ));
} Else {
//
$ ZZ = $ this-> getproduct ()-> getname ();
// $ Arr1 = array ($ ZZ. & quot; 111 & quot;, $ ZZ. & quot; 222 & quot;, $ ZZ. & quot; 333 & quot;, $ ZZ. & quot; 444 & quot;, $ ZZ. & quot; 555 & quot;, $ ZZ. "666 ");
// Rand descroption array! The description to be randomly written here.
$ Arr1 = array (
$ ZZ. "On Sale ",
$ ZZ. "For Sale"
);
$ Ss = array_rand ($ arr1 );
//
$ Headblock-> setdescription ($ arr1 [$ SS]);
// $ Headblock-> setdescription ($ this-> getproduct ()-> getdescription ());
}
}
Return parent: _ preparelayout ();
}