Products - Tạo block Grid hay List chứa danh sách các sản phẩm cần lọc trong Magento
////////////////////////////// Built Up Some Collection Of Products /////////////////////////// // Collection 1: $products = Mage::getResourceModel('catalog/product_collection') ->addAttributeToSelect('*') ->addAttributeToFilter('status', 1); ////////////////////////////// Built Up Some Collections Product End /////////////////////////// // Create Block List Of Product Base On Collections Above $block = Mage::getSingleton('core/layout')->createBlock('catalog/product_list') ->setTemplate('catalog/product/list.phtml') ->setCollection($products); // Write To Html Format to send to browser: echo $block->toHtml();
0 nhận xét:
Đăng nhận xét