https://t.me/RX1948
Server : Apache/2.4.18 (Ubuntu)
System : Linux canvaswebdesign 3.13.0-71-generic #114-Ubuntu SMP Tue Dec 1 02:34:22 UTC 2015 x86_64
User : oppastar ( 1041)
PHP Version : 7.0.33-0ubuntu0.16.04.15
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,
Directory :  /var/www/kanvakanva.com/public_html/application/views/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //var/www/kanvakanva.com/public_html/application/views/cart.php
<?php defined('BASEPATH') OR exit('No direct script access allowed'); ?>

<!-- BEGIN CONTENT PAGE -->
<section class="all-content-page">			
    <!-- Banner Categories -->					
    <div class="baner-top-categories">
        <div class="categories-text-hero">
            <h1>SHOPPING CART</h1>
        </div>
        <img src="<?=base_url()?>assets/frontend_new/images/banner/11.jpg" alt="banner">
    </div>		

	<div class="container">
		<div class="breadcrumbs">
            <a href="<?=base_url()?>">Home</a>
            <span>Shopping Cart</span>
        </div>	

	<div class="row">

	<?php echo form_open('cart/update_cart'); ?>
		<div class="col-sm-12"> 
			<p><?= $this->session->flashdata('no_stock'); ?></p>

			<?php
				// echo '<pre>';
				// print_r($this->cart->contents());
				// echo '</pre>';
			?>

			<div style="color:#F00; text-transform:uppercase; font-weight: bold;" ><?php echo $message?></div>

			<div>
		 	<table class="table table-cart">

			<?php if ($cart = $this->cart->contents()): ?>

					<thead>
						<tr>
							<th>Product</th>
							<th>Unit Price</th>
							<th>Quantity</th>
							<th>Sub Total</th>
							<!-- <th>Delete</th> -->
						</tr>
					</thead>

					<tbody>

				<?php
					$grand_total = 0;
					$total_weight_gram = array();
					$list_district = '';
					$list_brand = '';
					$list_kanva_group = '';
					$rnm_brand = '';
					$rkanva_group = '';
					foreach ($cart as $item):
						echo form_hidden('cart['. $item['id'] .'][id]', $item['id']);
						echo form_hidden('cart['. $item['id'] .'][rowid]', $item['rowid']);
						echo form_hidden('cart['. $item['id'] .'][name]', $item['name']);
						echo form_hidden('cart['. $item['id'] .'][price]', $item['price']);
						echo form_hidden('cart['. $item['id'] .'][qty]', $item['qty']);
						echo form_hidden('cart['. $item['id'] .'][size_id]', $item['options']['size_id']);

						$item_id = (int) $item['id'];
						//get product weight
						$this->db->select('weight')->from('stocks')->where('product_id', $item_id)->where('size_id', $item['options']['size_id']);
						$item_weight = $this->db->get()->row()->weight * $item['qty'];

						$this->db->select('b.id_district,b.brand,b.kanva_group')->from('products a')
						->join('brands b','a.brand_id=b.id_brands','left')
						->where('a.id_products', $item_id);
						$res = $this->db->get()->row();
						$district_brand = $res->id_district;
						$nm_brand = $res->brand;
						$kanva_group = $res->kanva_group;
						if($rnm_brand != $nm_brand && $nm_brand != '' && $nm_brand != null && $rkanva_group != $kanva_group){
							if($rnm_brand == ''){
								$list_district .= $district_brand;
								if($kanva_group == '1'){
									$list_brand .= 'Kanva';
								}else{
									$list_brand .= $nm_brand;
								}
								$list_kanva_group .= $kanva_group;
							}else{
								$list_district .= ','.$district_brand;
								if($kanva_group == '1'){
									$list_brand .= ',Kanva';
								}else{
									$list_brand .= ','.$nm_brand;
								}
								$list_kanva_group .= ','.$kanva_group;
							}
							if($rkanva_group == '' && $kanva_group == '1'){
								$rkanva_group = '1';
							}
							
							$rnm_brand = $nm_brand;
						}

						if($kanva_group == '1'){
							$rnm_brand = 'Kanva';
						}

						$ar_brand = str_replace(' ','_',$rnm_brand);
						if (array_key_exists($ar_brand, $total_weight_gram)) {
							$total_weight_gram[$ar_brand] += $item_weight;
						}else{
							$total_weight_gram[$ar_brand] = $item_weight;
						}
				?>
					
						<tr style="padding-top:10px;">
							<td>
								<?php
									//get product image
									$image_thumb = $this->product_m->get_image($item['id']);
								?>	
								<div class="left-lpi-img">
									<img src="<?= base_url('uploads/product/thumbnail') .'/'. $image_thumb->image1; ?>" alt="thumb">
									<span class="remove-item">
										<a href="<?=base_url('cart/remove') . '/' . $item['rowid']; ?>">
											<i class="fa fa-times-circle" aria-hidden="true" style="font-size:17px;"></i>
										</a>
									</span>
								</div>
								<div class="right-lpi-text" style="width:calc(100% - 80px);padding-left: 25px;">
									<h3><?php echo strtoupper($item['name']); ?></h3>										
								</div>
							</td>
							
							<td>IDR <?php echo number_format($item['price']); ?></td>

							<td style="height:50px;">
								<div class="quantity">
									<?php 
										$data = array( 
											'name'        => 'cart[' . $item['id'] . '][qty]',
											'type'        => 'number',
											'value'       => $item['qty'],
											'min'   	  => '1',
											'step'		  => '1',
										);
			
										echo form_input($data);
									?>
								</div>
							</td>

							<?php $grand_total = $grand_total + $item['subtotal']; ?>
							
							<td>IDR 
							<?php echo number_format($item['subtotal']); ?>

							</td>
							
							<!-- <td><a title="Delete Item" href="<?= 
							base_url('cart/remove') . '/' . $item['rowid']; ?>">Delete</a></td> -->
						</tr>  

					<?php endforeach; ?>

					</tbody>
					
			</table>
			</div>

			<?php
				//set new userdata
				$from_cart = array(
				'is_from_cart'  => 'yes',
			);

				$this->session->set_userdata($from_cart); 
			?>

			<?php endif; ?>

			<div class="text-right">
				<button type="submit" class="button submit w-m-100" style="margin-left:0px">update cart</button>
			</div>
			<?php echo form_close(); ?>

			<hr>

		</div>

		<div class="col-sm-6 pa-r-30">
			
				<p class="title-unline">Shipping Address</p>
					
				<!-- <?php foreach ($address as $key1 => $addr) : ?>
					<?php
							$flag = true;
							foreach ($addr as $key1 => $value1) {
								foreach ($current_addr as $key2 => $value2) {
									if ($key1 == $key2) {
										$flag = $flag && ($value1 == $value2);
									}
								}
							}
							$selected = ($flag) ? "selected" : "" ;
						?>
						<option <?= $selected ?> value="<?= $addr->id_address ?>"> <?= $addr->address_name ?> </option>
					<?php endforeach; ?> -->
					<br>
					<?php //if(count($address) > 0) : ?>
					<div class="row">
						<?= form_open('account/set_default_address'); ?>
						<div class="form-group col-sm-5">
							<input type="hidden" name="shipping_summarypage">
							
							<select class="form-control" name="default_address" onchange="this.form.submit()">
								<?php foreach ($address as $key1 => $addr) : ?>
									<?php
										$flag = true;
										foreach ($addr as $key1 => $value1) {
											foreach ($shipping as $key2 => $value2) {
												if ($key1 == $key2) {
													$flag = $flag && ($value1 == $value2);
												}
											}
										}
										$selected = ($flag) ? "selected" : "" ;
									?>
									<option <?= $selected ?> value="<?= $addr->id_address ?>">
									<?php if(empty($addr->address_name)) : ?>
									Default Address
									<?php else : ?>
										<?= $addr->address_name ?>		
									<?php endif; ?> 
									</option>
								<?php endforeach; ?>
							</select>
						</div>
						<?= form_close(); ?>

						<div class="col-sm-7">
							<?= form_open('account/shipping'); ?>

							<input type="hidden" name="shipping_summarypage">

							<input type="submit" name="submit" value="ADD / EDIT ADDRESS" style="button submit place-order w-m-100">

							<?= form_close(); ?>
						</div>

					</div>
					<?php //endif; ?>

					<div class="row" style="margin-top:10px;">
						<div class="col-sm-12">
							<p><?= ucwords($shipping->recipient_name); ?><br>
								<?= ucwords($shipping->address); ?><br>
								<?= ucwords($shipping->district); ?><br>
								<?= ucwords($shipping->subdistrict); ?><br>
								<?= ucwords($shipping->province); ?><br>
							<?php
							if ($shipping->country == 'IDN') {
									echo 'Indonesia ' . $shipping->postcode.'<br>';
							}
							?>
							Phone: <?= $shipping->phone; ?></p>
						</div>
					</div>

				<?php
					//to store current shipping details in session
					$this->session->set_userdata('recipient_name', $shipping->recipient_name);
					$this->session->set_userdata('address', $shipping->address);
					$this->session->set_userdata('country', $shipping->country);
					$this->session->set_userdata('postcode', $shipping->postcode);
					$this->session->set_userdata('phone', $shipping->phone);
					$this->session->set_userdata('id_district', $shipping->id_district);
					$this->session->set_userdata('id_province', $shipping->id_province);
				?>


				<!--<p class="title-unline">Calculate shipping</p>
				<p>Click on logo to choose carrier</p>
				<div class="row">
					<?php
						$courier1 = '';
						$courier2 = '';
						if($code_carrier == 'sicepat_reguler'){
							$courier1 = 'background-color:#f9eadb';
							$courier2 = '';
						}else{
							$courier1 = '';
							$courier2 = 'background-color:#f9eadb';
						}
					?>
					<div class="col-sm-4 col-xs-6">
						<p style="padding:10px;<?=$courier1?>">
							<a href="<?= base_url('cart/index/sicepat_reguler'); ?>" title="Sicepat Reguler"><img style="width:150px" src="<?= base_url('assets/frontend/img/sicepat.png'); ?>"></a><br>
							SICEPAT REGULER<br>(1-3 DAYS)
						</p>
					<br>
					</div>
					<div class="col-sm-4 col-xs-6">
						<p style="padding:10px;<?=$courier2?>">
							<a href="<?= base_url('cart/index/sicepat_best'); ?>" title="Sicepat Best"><img style="width:150px" src="<?= base_url('assets/frontend/img/sicepat.png'); ?>"></a><br>
							SICEPAT BEST<br>(1 DAY)
						</p>
					<br>
					</div>
				</div> -->
			
		</div>

		<div class="col-sm-6">
			<p class="title-unline">CART TOTALS</p>
			<div class="">
				<table class="table table-cart" style="margin-top:0px;">								
					<tbody><tr>
						<td>SUBTOTAL</td>
						<td>IDR <?php echo number_format($grand_total); ?></td>									
					</tr>

							<?php
							
							//get city origin ID from configuration table
							$this->db->select('shop_district_id')->from('configuration')->where('id_configuration', 1);
							$shop_origin_city_id = (int) $this->db->get()->row()->shop_district_id;
							$kanva_origin_city_id = $shop_origin_city_id;

							//get destination IDs
							$destination_city_id = (int) $shipping->id_district; 

							if(count($total_weight_gram) > 0) {

								//get shipping cost from RajaOngkir API for 1 ikg
								$rdistrict = explode(',',$list_district);
								$rbrand = explode(',',$list_brand);
								$rkanva_group = explode(',',$list_kanva_group);
								if(count($rdistrict) > 0){
									$sum_ongkir = 0;
									$no_brand  = 0;

									foreach($rdistrict as $res_district) {
										$total_shipping_fee = 0;
										if($rkanva_group[$no_brand] == '1'){
											$shop_origin_city_id = $kanva_origin_city_id;
										}else{
											$shop_origin_city_id = $res_district;
										}

										$ar_brand = str_replace(' ','_',$rbrand[$no_brand]);
										$total_weight_kg = ceil($total_weight_gram[$ar_brand] / 1000);
										
										$rajaongkir_cost = get_rajaongkir_ongkos($shop_origin_city_id, $destination_city_id, 1000, $carrier);
										//echo json_encode($rajaongkir_cost).'<br><br>';
										$this->session->set_userdata('carrier_name','JNE REG');
	
										foreach($rajaongkir_cost['rajaongkir']['results'][0]['costs'] as $key => $result) {
											
											if($result['service'] == 'REG') {
												$total_shipping_fee = $result['cost'][0]['value'];
												$total_shipping_fee = $total_shipping_fee * $total_weight_kg;
												break;
											}elseif($result['service'] == 'CTC') {
												$total_shipping_fee = $result['cost'][0]['value'];
												$total_shipping_fee = $total_shipping_fee * $total_weight_kg;
												break;
											} else {
												$total_shipping_fee = NULL; //service is not available
											}
										}
										
										if($this->session->userdata('chosen_voucher_type') == 'free shipping') {
											$total_shipping_fee = 0;
										}

										//get free shipping min purchase amount from configuration table
										$this->db->select('free_shipping')->from('configuration')->where('id_configuration', 1);
										$free_shipping = $this->db->get()->row()->free_shipping;

										if ($free_shipping != NULL) {
											if ($grand_total >= $free_shipping) {
												$total_shipping_fee = 0;
											}
										}

										if($rkanva_group[$no_brand] == '1'){
											echo '<tr>
												<td>SHIPPING FROM KANVA</td>
												<td>';
										}else{
											echo '<tr>
												<td>SHIPPING FROM '.strtoupper(strtolower($rbrand[$no_brand])).'</td>
												<td>';
										}

										if ($total_shipping_fee == 0 && $free_shipping != NULL) : $shipping = 0;
											echo 'Free Shipping';
										elseif ($total_shipping_fee == 0 && $free_shipping == NULL) : $shipping = 0;
											echo 'carrier not available';
										else :  $shipping = $total_shipping_fee;
											echo 'IDR '.number_format($total_shipping_fee);
										endif;

										echo '</tr>';

										$sum_ongkir += $shipping;
										$no_brand++;
									}
									$shipping = $sum_ongkir;
									$this->session->set_userdata('total_shipping_fee',$sum_ongkir);
								}else{
									$rajaongkir_cost = get_rajaongkir_ongkos($shop_origin_city_id, $destination_city_id, 1000, $carrier);

									$this->session->set_userdata('carrier_name','SICEPAT REG');

									foreach($rajaongkir_cost['rajaongkir']['results'][0]['costs'] as $key => $result) {
										if($result['service'] == 'REG') {
											$total_shipping_fee = $result['cost'][0]['value'];
											$total_shipping_fee = $total_shipping_fee * $total_weight_kg;
											break;
										} elseif($result['service'] == 'CTC') {
											$total_shipping_fee = $result['cost'][0]['value'];
											$total_shipping_fee = $total_shipping_fee * $total_weight_kg;
											break;
										} else {
											$total_shipping_fee = NULL; //service is not available
										}
									}
									
									if($this->session->userdata('chosen_voucher_type') == 'free shipping') {
											$total_shipping_fee = 0;
									}

									//get free shipping min purchase amount from configuration table
									$this->db->select('free_shipping')->from('configuration')->where('id_configuration', 1);
									$free_shipping = $this->db->get()->row()->free_shipping;

									if ($free_shipping != NULL) {
										if ($grand_total >= $free_shipping) {
											$total_shipping_fee = 0;
										}
									}

									echo '<tr>
											<td>SHIPPING</td>
											<td>';

									if ($total_shipping_fee == 0 && $free_shipping != NULL) : $shipping = 0;
										echo 'Free Shipping';
									elseif ($total_shipping_fee == 0 && $free_shipping == NULL) : $shipping = 0;
										echo 'carrier not available';
									else :  $shipping = $total_shipping_fee;
										echo 'IDR '.number_format($total_shipping_fee);
									endif;

									echo '</tr>';
									
									$this->session->set_userdata('total_shipping_fee',$shipping);
								}

								
							} else {
								$this->session->set_userdata('carrier_name','');
								$total_shipping_fee = 0;

								echo '<tr>
										<td>SHIPPING</td>
										<td>';

								if ($total_shipping_fee == 0 && $free_shipping != NULL) : $shipping = 0;
									echo 'Free Shipping';
								elseif ($total_shipping_fee == 0 && $free_shipping == NULL) : $shipping = 0;
									echo 'carrier not available';
								else :  $shipping = $total_shipping_fee;
									echo 'IDR '.number_format($total_shipping_fee);
								endif;

								echo '</tr>';
								
								$this->session->set_userdata('total_shipping_fee',$shipping);
							}

							?>

					<tr>
						<td>Order Total</td>
						<td>IDR <?php echo number_format($grand_total + $shipping); ?></td>									
					</tr>
				</tbody></table>
				<!--/////////////////-->
				
				<a href="<?= base_url(); ?>" class="button submit btn-color w-m-100" style="margin-left:0px">continue shopping</a>
				
				<?php if($total_shipping_fee == 0 && $free_shipping == NULL) : ?>
					<div style="margin-bottom:20px; margin-top:20px;">
					<p><input disabled readonly type="submit" name="process_payment" value="PROCESS PAYMENT" style="button submit place-order w-m-100" id="process_payment"><br>
					Please choose other carrier</p>
					</div>
				<?php else : ?>
					<a href="<?= base_url('register'); ?>" class="button submit btn-color w-m-100" id="button_checkout" style="margin-left:0px">proceed to checkout</a>
				<?php endif; ?>
				
			</div>
		</div>
		

	</div>
	</div>

</section>

<script> 
window.addEventListener('DOMContentLoaded', (event) => {
  document.getElementById('button_checkout').addEventListener('click', function() {
    fbq('track', 'InitiateCheckout');
  });
});
</script>


https://t.me/RX1948 - 2025