In your Namespace/Module/Block/Adminhtml/your_module/Edit/Tab/Form.php
Collect your collection
// product collection dropdown start
$category = Mage::getModel('catalog/category')->load(3);
$productCollection = $category->getProductCollection();
$productCollection
->addStoreFilter()
->addAttributeToFilter('type_id','configurable')
->addAttributeToSelect('*');
foreach($productCollection as $_product) {
if($_product->getParent == NULL){
$_product_dropdown[] = array(
'value' => $_product->getId(),
'label' => $_product->getName(),
);
}
}
$fieldset->addField('product_id', 'select', array(
'name' => 'product_id',
'label' => Mage::helper('warranty')->__('Product Name'),
'title' => Mage::helper('warranty')->__('Product Name'),
'required' => false,
'note' => $note,
'class' => 'HideIt',
'values' => $_product_dropdown,
));
![]()
0 Comments