Catalog/product Call
$product _model = Mage::getmodel (' catalog/product '); $product = $product _model->load ($product _id);
Catalog/product_collection Call
$extra _links = Mage::getresourcemodel (' catalog/product_collection ')->addidfilter ($ Product_ids)->setstoreid (Mage::app ()->getstore (),getId ())->addminimalprice () ///getchildhtml will be usedas low as--Addfinalprice (),addtaxpercents () ->addattributetoselect (Mage::getsingleton (' Catalog/config '),getproductattributes ())- >addurlrewrite (); // URL rewrite for multiple products
Catalog/category Call (remove all products from a category)
$category _model= Mage::getmodel (' catalog/category ');$category _model->load ($category _id);//$category_name $category _model->getname () can be obtained through $category_id;$product _collection=$category _model-getproductcollection ();foreach($product _collection as $_product) {$product _id=$_product-getId (); $product _name=$_product-getName ();}
catalog/Category_collection Call$currentCatIds=$_product-getcategoryids ();$categoryCollection=mage::getresourcemodel (' catalog/category_collection ')//with Mage::getmodel (' Catalog/category ')->getcollection ();->addattributetoselect (' name ') ->addattributetoselect (' url ') ->addfieldtofilter (' Level ',Array(' Gteq ' =>1)); ->addattributetofilter (' entity_id ',$currentCatIds) -Addisactivefilter ();//Take out all the categories//First of a product:$product=$this-getproduct ();$product _id=$product-getId ();$product _ids=$product-getcategoryids ();//The second type:$category _model= Mage::getmodel (' catalog/category ');$category _model->load ($category _id);$product _collection=$category _model-getproductcollection ();$product _ids=Array();foreach($product _collection as $product) {$product _ids[] =$product-getId ();}
catalog/Category_collection Call$currentCatIds=$_product-getcategoryids ();$categoryCollection=mage::getresourcemodel (' catalog/category_collection ')//with Mage::getmodel (' Catalog/category ')->getcollection ();->addattributetoselect (' name ') ->addattributetoselect (' url ') ->addfieldtofilter (' Level ',Array(' Gteq ' =>1)); ->addattributetofilter (' entity_id ',$currentCatIds) -Addisactivefilter ();//Take out all the categories//First of a product:$product=$this-getproduct ();$product _id=$product-getId ();$product _ids=$product-getcategoryids ();//The second type:$category _model= Mage::getmodel (' catalog/category ');$category _model->load ($category _id);$product _collection=$category _model-getproductcollection ();$product _ids=Array();foreach($product _collection as $product) {$product _ids[] =$product-getId ();}
Magento related products related and bottom recommended products upsell cannot repeat
This issue should take into account the related module and the Upsell module who first loaded the problem results prove that the content of the Upsell module first loaded (this loading by the way can be adjusted temporarily no research)
So first record Mage::register ("Upsell_used_product_ids", $all _product_ids); The related product module calls Mage::registry (' Upsell_used_product_ids ') to filter the products that already exist in the Upsell
Magento Related/upsell Product and products/category calls