We are Displaying Drop-down options here using values Present in Backend

After selecting dropdown options & if we click on "See Cases", we are redirecting to particular product [ id : 44 ] using below code.


public function getProduct()
        $product =  Mage::getModel('catalog/product')->load(44);
            if ($p=='') {Mage::register('product', $product);}
            return  $product;

But we want to do some ajax coding [ or any other way] & we have to redirect to Particular Brand & Model selected in Dropdown options as here

enter image description here

<div class="custom_case">
    <div class="custom_case_left">
        <h1 class="cc1">Custom Cases</h1>
        <h2 class="cc2">Make Your Own design</h2>


$resource = Mage::getSingleton('core/resource');

$readConnection = $resource->getConnection('core_read');

$writeConnection = $resource->getConnection('core_write');

$readConnection = $resource->getConnection('core_read');

$query = 'SELECT category_id, category_name FROM ' . $resource->getTableName('outthink_advance_brand_category');

$categories = $readConnection->fetchAll($query);

$brandsArr = array();

$brandSelect = '<select id="brand_select">';
$brandSelect .= '<option value="">My Brand</option>';
foreach ($categories as $category){
$cat_id = $category["category_id"];

$brandSelect .= "<option value='".$category["category_id"]."'>".$category["category_name"]."</option>";

$query = 'SELECT `outthink_advance_brand`.brand_id, `outthink_advance_brand`.bmodel FROM `outthink_advance_brand` ';
$query .= ' inner join `outthink_advance_brand_category_item` on
(`outthink_advance_brand`.brand_id = `outthink_advance_brand_category_item`.brand_id )';
$query .= ' where `outthink_advance_brand_category_item`.category_id = '.$cat_id;

$brands = $readConnection->fetchAll($query);

$bArr = array();

foreach ($brands as $brand){
$bArr[$brand["brand_id"]] = $brand["bmodel"];
$brandsArr[$cat_id] = $bArr;
$brandSelect .= '</select>';

echo $brandSelect;
echo '<select id="model_select"><option value="">My Model</option></select>';

<div class ="cc3">
<div class ="cc4">
<a href="http://sbdev2.kidsdial.com/customized-mobile-cases/customcase/"><span class ="cc5"> See Cases > </span> </a>


var models = <?php echo json_encode($brandsArr) ?>;


jQuery( "#brand_select" ).change(function() {
var brandId = jQuery(this).val();
jQuery('#model_select').empty().append('<option value="">MY MODEL</option>');

jQuery.each(models[brandId], function(key,value) {
jQuery('#model_select').append(jQuery('<option>', {
value: key,
text : value

//trigger change event first time if required
//jQuery( "#brand_select" ).change();

    <div class="custom_case_right">
    <img height="200px;" width="2000px;" src="<?php echo $this->getSkinUrl('images/custom.png'); ?>" >


i will give 50 bounty if it works for me.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.