Subversion Repositories SmartDukaan

Rev

Rev 17518 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
11517 lgm 1
<script src="<?=base_url().$this->config->item('current_client')?>/js/cart.js?version=<?=$this->config->item('cdn_version');?>" type="text/javascript"></script>
16121 manish.sha 2
<script data-pace-options='{ "elements": { "selectors": [".confirm-qty"] }, "startOnPageLoad": false }' src="assets/js/pace.js"></script>
11924 anikendra 3
        <?php
10582 lgm 4
        if(isset($carts[0]->lines) && !empty($carts[0]->lines)){
5
          $cartCount = sizeof($carts[0]->lines);
6
          if($carts[0]->discountedPrice >=0 && isset($carts[0]->couponCode)){
7
            $discount = ($carts[0]->totalPrice - $carts[0]->discountedPrice);
8
            $discount = number_format((float)$discount,0,'.','');
9
          }
10
        }
11
        $authorized = $this->session->userdata('authorized');
12
        if(isset($authorized['isLoggedIn']) && !empty($authorized['isLoggedIn'])){
13
          $isLoggedIn = 1;
14
        }
15
        else{
16
          $isLoggedIn = 0;
17
        }
11286 lgm 18
        if(isset($authorized['pincode']) && !empty($authorized['pincode'])){
10582 lgm 19
          $pinCode = $authorized['pincode'];
20
        }
21
        else{
11286 lgm 22
          $pinCode = '';
10582 lgm 23
        }
17474 manish.sha 24
 
25
        $shipingCharges = 0;
26
        $grandTotalPrice = $carts[0]->totalPrice;
27
        if(isset($discount)){
28
            $grandTotalPrice = $grandTotalPrice - $discount;
29
        }
17524 manish.sha 30
        if(!empty($authorized['isPrivateDealUser'])){
31
	        if($carts[0]->totalPrice < 500){
32
	            $shipingCharges = 100;
33
	        } elseif($carts[0]->totalPrice >= 500 && $carts[0]->totalPrice <1000){
34
	            $shipingCharges = 50;
35
	        }
17474 manish.sha 36
        }
37
        $grandTotalPrice = $grandTotalPrice + $shipingCharges;
10582 lgm 38
        ?>
39
        <div class="cart-cont">
40
          <div id="error" class="error_msg" style="display:none"></div>  
41
          <?php if(isset($carts[0]->lines) && !empty($carts[0]->lines)){?>
42
          <div class="cart-head clearfix">
43
            <div>cart summary(<?php if($cartCount >1){ echo $cartCount.' items)'; } else{ echo $cartCount.' item)';}?> </div>
44
            <!-- <div>Delivery time for pin: 122001 <a href="#"></a></div> -->
45
            <div><input type="text" id="pincode" value="<?php echo $pinCode;?>" onKeyDown="if(event.keyCode==13) checkShipping();"/><div onclick="checkShipping()" class="btn">Change Pin</div></div>
46
          </div><!--cart-head-->
16062 manish.sha 47
          <?php if(!empty($carts[0]->message) && isset($carts[0]->message)){?>
16114 manish.sha 48
            <div id="cart-quantity-msg" class="cart-quantity-msg" style="display:block;">
16062 manish.sha 49
            	<?php echo $carts[0]->message;?>
50
            </div>
51
             <?php } ?>
52
            <div id="max-quantity-msg" class="max-quantity-msg" style="display:none;">You can not order more than 20 units of the same product</div>
53
          <div class="added-pd-hldr">           
10582 lgm 54
          <?php 
55
           $i=0;
11286 lgm 56
           $notServiceableLocation = 0;
10582 lgm 57
           $item = array();
58
           foreach($carts[0]->lines as $items){
59
            $theftinsurance = ($items->actualPrice * $items->quantity * $this->config->item('insurance'))/100;
60
            $theftinsurance = round($theftinsurance);
61
            $item[$i]['id'] = $items->itemId;
62
            $item[$i]['quantity'] = $items->quantity;
63
            $i++;
11286 lgm 64
            if(($items->logisticsInfo->delivery_estimate) && ($items->logisticsInfo->delivery_estimate == -1)){
65
              $notServiceableLocation++;
66
            }
10582 lgm 67
            ?>
68
          <div class="added-pd clearfix">
69
            <div class="pd-img" style="background:url('<?php echo $items->imageUrl;?>')no-repeat center center;background-size:contain;"></div>
70
            <div class="pd-info">
71
              <div class="pd-name">
72
                <span onclick="removeItem(<?php echo $items->itemId;?>)"class="cancel"></span>
73
                <div><?php echo $items->name;?></div>
74
                <?php if(isset($items->color) && !empty($items->color)) {?>
75
                <div class="spec">Color: <?php echo $items->color;?></div>
76
                <?php } ?>
11887 anikendra 77
                <div id="<?php echo $items->itemId;?>" class="dealdiv spec">
11867 anikendra 78
                <?php if(isset($items->dealText) && !empty($items->dealText)):?>
11887 anikendra 79
			<?php echo $items->dealText;?>
11867 anikendra 80
                <?php endif; ?>
11887 anikendra 81
		</div>
17470 manish.sha 82
                <div id="<?php echo $items->itemId.'delivery';?>" class="spec" style="display:<?php if(isset($items->logisticsInfo->delivery_estimate) && ($items->logisticsInfo->delivery_estimate != -1)){ echo 'block'; } else {echo 'none';}?>"><?php if(empty($authorized['isPrivateDealUser'])){ ?>Free <?php }?>Delivery by <span id="<?php echo $items->itemId.'del';?>"><?php echo $items->logisticsInfo->delivery_estimate;?></span></div>
10582 lgm 83
                <div id="<?php echo $items->itemId.'otg';?>" class="spec" style="display:<?php if(isset($items->logisticsInfo->on_time_guarantee) && !empty($items->logisticsInfo->on_time_guarantee)){ echo 'block'; } else {echo 'none';}?>"><span>On Time Guarantee</span></div>
84
                <div id="<?php echo $items->itemId.'cod';?>" class="spec" style="display:<?php if(isset($items->logisticsInfo->is_cod_available_for_location) && ($items->logisticsInfo->is_cod_available_for_location == 1)){ echo 'block'; } else {echo 'none';}?>"><span>You Can Pay By Cash On Delivery</span></div>
11286 lgm 85
                <div id="<?php echo $items->itemId.'service';?>" style="display:<?php if(($items->logisticsInfo->delivery_estimate) && ($items->logisticsInfo->delivery_estimate == -1)){ echo 'block';} else { echo 'none'; }?>">Location is not servicable</div>
10582 lgm 86
              </div>
87
 
88
            </div><!--pd-info-->
89
            <div class="clear"></div>
90
 
91
            <div class="insure">
92
              <?php if($items->isTheftInsuranceAvailable == 1){?>
93
              <div class="clearfix insure-hldr"><img src="<?php echo base_url().'assets/images/insurance.jpg'; ?>" alt="insurance"/><input class="checkbox" onclick="teftinsure(event)" data-value="<?php echo $items->itemId;?>" data-key="ins" type="checkbox" id="<?php echo $items->itemId.'insurance';?>" <?php if($items->insurer ==1){?> checked="true" <?php } ?>/><label for="<?php echo $items->itemId.'insurance';?>">I want to opt for 1 year WorldWide Theft Insurance for this product for Rs <span id="<?php echo $items->itemId.'theft';?>"><?php echo $theftinsurance;?></span></label></div> 
94
              <div class="clearfix" <?php if($items->insurer == 1){?> style="display:block" <?php } else { ?> style="display:none" <?php } ?>  id="<?php echo $items->itemId.'tc'?>"><input onclick="teftinsure(event)" data-key="tnc" data-value="<?php echo $items->itemId;?>" type="checkbox" id="<?php echo $items->itemId.'tnc';?>" <?php if($items->insurer ==1){?> checked="true" <?php } ?> /><label for="<?php echo $items->itemId.'tnc';?>">I agree to terms &amp; conditions</label></div>
95
              <?php } ?>
96
              <?php if($items->isDataProtectionAvailable == 1){?>
97
                <div class="one-assist clearfix" ><img src="<?php echo base_url().'assets/images/oneassist.jpg'; ?>" alt="one assist"/><input data-value="<?php echo $items->itemId;?>" type="checkbox" onclick="dataprotection(event)" id="<?php echo $items->itemId.'assist';?>"/ <?php if($items->dataProtectionInsurer == 2){?> checked="true" <?php } ?>> <label for="<?php echo $items->itemId.'assist';?>">I want 90 days SIM-blocking, Temporary Mobile Replacement & Data Backup plan worth</label></div>
98
              <?php } ?>
99
            </div>
100
            <div class="pd-price clearfix">
16010 manish.sha 101
                <div style="width:20%">
10582 lgm 102
                  <span>Unit Price</span>
103
                  <div><?php echo $items->actualPrice;?></div>
104
                </div>
105
                <span>X</span>
16010 manish.sha 106
                <div style="width:40%">
15933 manish.sha 107
                  <span>Enter Qty</span>
15965 manish.sha 108
                  <input id="qty_<?php echo $items->itemId;?>" type="number" value="<?php echo $items->quantity;?>" min="1" data-value="<?php echo $items->quantity;?>" onfocus="showQtyConfirmButton(<?php echo $items->itemId;?>)" onKeydown="Javascript: if (event.keyCode==13) showQtyConfirmButton(<?php echo $items->itemId;?>);"/>
15987 manish.sha 109
                  <div id="confirmQty_<?php echo $items->itemId;?>" class="confirm-qty" style="display:none" onclick="updateQuantity(<?php echo $items->itemId;?>,<?php echo $items->quantity;?>)">OK</div>
15965 manish.sha 110
                </div>
16012 manish.sha 111
                <div style="width:30%;text-align: center;">
10582 lgm 112
                  <span>Price</span>
113
                  <div>Rs <?php echo ($items->actualPrice * $items->quantity);?></div>
114
                </div>
115
              </div><!--pd-price-->
116
            </div><!--added-pd-->
117
 
118
          <?php } ?>
119
          <div id="addCoupon" class="add-coupon" <?php if(empty($carts[0]->couponCode)){?> style="display:block" <?php } else { ?> style="display:none" <?php } ?>>
120
            <div id="coupon-msg" style="display:none"></div>
15952 manish.sha 121
            <div style="display:none">Have A Coupon Code?</div>
10582 lgm 122
            <div class="clearfix">
15933 manish.sha 123
            <input onfocus="clearmsg();" id="couponcode" type="text" placeholder="Enter Coupon Code (If Any)"/><div onclick="applycoupon()" class="apply-coupon">Apply</div>
10582 lgm 124
            </div>
125
          </div>
10753 lgm 126
          <div id="removeCoupon" onclick="clearcoupon('<?php if(isset($couponCode) && !empty($carts[0]->couponCode)) echo $carts[0]->couponCode;?>')" class="remove-coupon" <?php if(isset($carts[0]->couponCode) && !empty($carts[0]->couponCode)){?> style="display:block" <?php } else { ?> style="display:none" <?php } ?>>Remove Coupon: <?php if(isset($carts[0]->couponCode)) {echo $carts[0]->couponCode;}?></div>
10582 lgm 127
          </div>
128
 
129
          <div class="sub-total">
17470 manish.sha 130
          	  <div class="sub-total-head">
10582 lgm 131
                cart total
17474 manish.sha 132
              </div>    			
17470 manish.sha 133
 
10582 lgm 134
              <div class="left">Total</div><div class="right">Rs <span id="total"><?php echo $carts[0]->totalPrice; ?></span></div>
10753 lgm 135
              <div id="discount" <?php if(isset($discount)){ ?> style="display:block" <?php } else{ ?> style="display:none" <?php }?>><div class="left">Discount</div><div class="right">Rs <span id="discountAmt"><?php if(isset($discount)) {echo $discount;} ?></span></div></div>
10582 lgm 136
              <div id="discountPrice" <?php if($carts[0]->discountedPrice >= 0 && isset($carts[0]->couponCode)){ ?> style="display:block" <?php } else{ ?> style="display:none" <?php }?>><div class="left">Discounted Price</div><div class="right">Rs <span id="discountedPrice"><?php echo $carts[0]->discountedPrice; ?></span></div></div>
17517 manish.sha 137
              <div class="left">Shipping<?php if(!empty($authorized['isPrivateDealUser']) && $shipingCharges>0): ?><br><span style="color:red;font-size:0.7em">(Free Delivery Above 1000 Rupees)</span><?php endif;?>
17505 manish.sha 138
              </div>
139
              <?php if(empty($authorized['isPrivateDealUser'])): ?>
140
	              <div class="right">Free</div>
141
	          <?php else:?>
142
	          	  <?php if($shipingCharges==0){?>
143
	              	<div class="right">Free</div>
144
	              <?php } else{ ?>
17518 manish.sha 145
	              	<div class="right"> Rs <span id="shppingCharges"><?php echo $shipingCharges; ?></span><br><span style="color:red;font-size:0.7em">&nbsp;</span></div>
17505 manish.sha 146
	              <?php } ?>
147
	          <?php endif;?>
148
              <div class="left">Grand Total</div><div class="right">Rs <span id="grandtotal" style="color:red;"><?php echo $grandTotalPrice; ?></span></div>
10582 lgm 149
          </div>
150
          <div class="checkout-hldr clear">
151
            <div class="checkout-btn btn" onclick="checkout(<?php echo $isLoggedIn;?>);">
152
              checkout
153
            </div>
154
          </div>
155
          <?php } else { ?>
156
            <div class="empty-cart">
157
 
158
            </div><!--empty-msg-->
10954 lgm 159
            <p class="empty-msg tcenter">Your Shopping Cart is empty</p>
10582 lgm 160
 
161
              <div class="shop-more" onclick="shomoreredirect();">
162
                Shop More
163
              </div>
164
              <div class="clear"></div>
165
            <?php } ?>
11517 lgm 166
            <div>
10582 lgm 167
        <script type="text/javascript">
10753 lgm 168
        <?php if(isset($items) && !empty($items)){?>
11286 lgm 169
          var items = <?php echo json_encode($item);?><?php }?>;
11296 lgm 170
        <?php if(isset($notServiceableLocation)){?>
171
          var notServiceableLocation = <?php echo $notServiceableLocation;?><?php }?>;
11845 anikendra 172
        <?php if(isset($item) && !empty($item)):?>
16269 amit.gupta 173
          <?php $itemString = ''?> 
11845 anikendra 174
          <?php foreach($item AS $i):?>
175
          <?php $itemString .= $i['id'].',';?>
176
          <?php endforeach;?>
177
          <?php $itemString = substr($itemString, 0, -1);?>
178
        <?php endif;?>
179
        var itemString = '<?php echo $itemString;?>';
11885 anikendra 180
	/*var referrer = document.referrer.split('/')[3];
11859 anikendra 181
	if(referrer && referrer == 'mobile-phones') {
182
		delete document.referrer;
183
		document.location = '/cart';
11885 anikendra 184
	}*/
11924 anikendra 185
	<?php if(isset($carts[0]->message) && !empty($carts[0]->message)):?>
16055 manish.sha 186
		var coupon = document.getElementById("couponcode").value
187
		if (coupon.length > 0) {
188
			document.getElementById('coupon-msg').innerHTML = '<?php echo $carts[0]->message;?>';
189
			document.getElementById('coupon-msg').style.display = 'block';
16061 manish.sha 190
			document.getElementById('cart-quantity-msg').style.display = 'none';
16057 manish.sha 191
			document.getElementById('cart-quantity-msg').innerHTML = '';
16061 manish.sha 192
		}else{
193
			document.getElementById('cart-quantity-msg').innerHTML = message;
194
			document.getElementById('cart-quantity-msg').style.display = 'block';
16055 manish.sha 195
		}
11924 anikendra 196
		document.getElementById('addCoupon').style.display = 'block';
197
        <?php endif;?>
11859 anikendra 198
        </script>