Subversion Repositories SmartDukaan

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
16261 anikendra 1
<div class="container">
2
	<div class="row">
3
		<?php if(!empty($categories)):?>
4
			<?php foreach ($categories as $key => $category):?>
5
				<div class="col-xs-6">
6
					<input class="category" type="radio" name="category_id" value="<?php echo $category['Category']['id'];?>"><?php echo $category['Category']['name'];?></input>
7
					<div class="clearfix"></div>
8
					<?php if(!empty($category['Brand'])):?>
9
					<select name="brands" multiple class="brands col-xs-12" data-categoryId="<?php echo $category['Category']['id'];?>">					
10
						<?php foreach ($category['Brand'] as $key => $brand):?>
11
						<option value="<?php echo $brand['id'];?>"><?php echo $brand['name'];?></option>	
12
						<?php endforeach;?>
13
					</select>
14
					<?php endif;?>
15
				</div>								
16
			<?php endforeach;?>
17
		<?php endif;?>
18
	</div>
19
	<div class="clearfix mt20"/>
20
	<div class="row text-center">		
21
		<div class="col-xs-12">
22
			URL : <textarea name="url" id="url" rows="2" ></textarea>
23
		</div>
24
	</div
25
</div>
26
<script type="text/javascript">
27
var baseurl = 'http://api.profittill.com/brands/filter/';
28
$(function(){
29
	$('.category').on('click',function(){
30
		$('#url').html('');
31
		$('.brands').each(function(){
32
			$(this).attr('checked',false);
33
		});
34
	});
35
	$('.brands').on('change',function(){
36
		url = baseurl+$(this).val().join(',')+'/'+$(this).data('categoryid');
37
		$('#url').html(url);
38
		console.log($(this).data('categoryid'));
39
	})
40
});
41
</script>
42
<style type="text/css">
43
.brands{height: 200px !important;}
44
</style>