<? PHP
02 $ c = Mage: GetModel ('catalog/Category ');
// Obtain a model set based on the attributes.
03 $ Pc = $ C-> loadbyattribute ('name', 'buy gift box ');
04 if ($ PC-> haschildren ()){
05 $ IDs = $ PC-> getchildren ();
// Obtain the classification set of all products.
06 $ subcategories = Mage: GetModel ('catalog/Category ')-> getcollection ();
// Use the getselect () method and the where () method to reselect.
07 $ subcategories-> getselect ()-> where ("e. entity_id in ($ IDs )");
08 $ subcategories-> addattributetoselect ('*');
09 $ subcategories-> load ();
10}
11?>
The label <cms_page_read> in layout is the layout handle loaded when weburl/CMS/page/read is the access path. layout is the default one !! So powerful, let me come up with it tonight !!
!
// Load the cache.
$ This-> loadlayout ();
// Obtain the block instance.
$ Block = Mage: getblocksingleton ('profile/profile ');
// Load Profile
// $ Block-> getprofile () ---------- return a collection of profiles.
$ Profile = $ block-> getprofile ();
If ($ profile ){
// Operate the parameters in layout (using methods), so it is flexible !!
$ This-> getlayout ()-> getblock ('head')-> settitle ($ profile-> getdata ("content_heading "))
-> Setdescription ($ profile-> getdata ("meta_description "))
-> Setkeywords ($ profile-> getdata ("meta_keywords "));
}
// Draw it out !!
$ This-> renderlayout ();
// Return a collection of profiles.
Public Function getprofiles ($ category_id ){
$ Profiles = Mage: GetModel ('profile/profile ')-> getcollection ()
// The following is a detailed study !!
-> Addstorefilter (Mage: APP ()-> getstore ()-> GETID ());
$ Profiles-> addfieldtofilter ('category _ id', $ category_id );
$ Profiles-> setorder ("creation_time", "DESC ");
Return $ profiles;
}