php - Getting both final price and out of stock products in Magento -
i'm working on code magento module , i've noticed pretty major issue can't seem find clean solution for.
basically, want fetch collection of products follows:
$products = mage::getresourcemodel('catalog/product_collection') ->setstoreid($storeid) // $storeid set before in code ->addattributetoselect('*') ->addfinalprice() ->addstorefilter() ->addurlrewrite() ->getitems(); if in place in code i'm iterating on collection can phone call getminimalprice() on individual bundle products , cost of product.
however, long i'm calling addfinalprice() when fetching collection out of stock products excluded collection. but, if remove phone call addfinalprice() it's not possible utilize getminimalprice() on bundle products (well, can phone call want won't info back.
so, find myself in problematic situation, how fetch collection in way fetches all products, regardless of if they're in stock or not, while still fetching plenty cost info cost of bundle products?
i not sure solve problem there function called addpricedata in product collection model helps gather info prices when load collection (instead of addfinalprice). can help minimal cost when product out of stock. final price, can function getfinalprice of mage_catalog_model_product or mage_catalog_model_product_type_price. sec model has many interesting function prices.
php magento
No comments:
Post a Comment