Subversion Repositories SmartDukaan

Rev

Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

<div class="container">
        <div class="row">
                <?php if(!empty($categories)):?>
                        <?php foreach ($categories as $key => $category):?>
                                <div class="col-xs-6">
                                        <input class="category" type="radio" name="category_id" value="<?php echo $category['Category']['id'];?>"><?php echo $category['Category']['name'];?></input>
                                        <div class="clearfix"></div>
                                        <?php if(!empty($category['Brand'])):?>
                                        <select name="brands" multiple class="brands col-xs-12" data-categoryId="<?php echo $category['Category']['id'];?>">                                    
                                                <?php foreach ($category['Brand'] as $key => $brand):?>
                                                <option value="<?php echo $brand['id'];?>"><?php echo $brand['name'];?></option>        
                                                <?php endforeach;?>
                                        </select>
                                        <?php endif;?>
                                </div>                                                          
                        <?php endforeach;?>
                <?php endif;?>
        </div>
        <div class="clearfix mt20"/>
        <div class="row text-center">           
                <div class="col-xs-12">
                        URL : <textarea name="url" id="url" rows="2" ></textarea>
                </div>
        </div
</div>
<script type="text/javascript">
var baseurl = 'http://api.profittill.com/brands/filter/';
$(function(){
        $('.category').on('click',function(){
                $('#url').html('');
                $('.brands').each(function(){
                        $(this).attr('checked',false);
                });
        });
        $('.brands').on('change',function(){
                url = baseurl+$(this).val().join(',')+'/'+$(this).data('categoryid');
                $('#url').html(url);
                console.log($(this).data('categoryid'));
        })
});
</script>
<style type="text/css">
.brands{height: 200px !important;}
</style>