magento - Display Drop down options for Values saved in Backend -
we created custom module , saved list of product brands
& models
in backend. in below image, apple, sony, samsung
brands & iphone4, iphone4s...etc
models.
brands
models
we want create dropdown options both brands & models in frontend, once select particular brand 1st drop-down box , associated models should display in 2nd drop-down box. here
company/brand/block/frontend/view.php
class company_brand_block_frontend_view extends mage_catalog_block_product_abstract { protected function _preparelayout() { $this->getlayout()->createblock('catalog/breadcrumbs'); $headblock = $this->getlayout()->getblock('head'); if ($headblock) { $product = $this->getproduct(); $title = $product->getmetatitle(); if ($title) { $headblock->settitle($title); } $keyword = $product->getmetakeyword(); $currentcategory = mage::registry('current_category'); if ($keyword) { $headblock->setkeywords($keyword); } elseif ($currentcategory) { $headblock->setkeywords($product->getname()); } $description = $product->getmetadescription(); if ($description) { $headblock->setdescription( ($description) ); } else { $headblock->setdescription(mage::helper('core/string')->substr($product->getdescription(), 0, 255)); } if ($this->helper('catalog/product')->canusecanonicaltag()) { $params = array('_ignore_category' => true); $headblock->addlinkrel('canonical', $product->geturlmodel()->geturl($product, $params)); } } return parent::_preparelayout(); } public function getproduct() { $collection = mage::getmodel('catalog/category')->load(310) ->getproductcollection() ->addattributetoselect('*') ->addattributetofilter('custom_phone_case', 1); $products=$collection->getfirstitem(); $product = mage::getmodel('catalog/product')->load($products->getid()); $p=mage::registry('product'); if ($p=='') {mage::register('product', $product);} return $product; }
i give 50 bounty if works me.
Comments
Post a Comment