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/indolok.id/application/controllers/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /var/www/indolok.id/application/controllers/Cart.php
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');

class Cart extends Public_Controller {

	public function __construct()
	{
		parent::__construct();
		$this->load->model('cart_model');   
		$this->load->model('product_m'); 
		$this->load->library('form_validation');
		$this->load->library('cart');
	}

	public function index() {	

		//get SEO
		$this->db->select('website_name')->from('configuration')->where('id_configuration', 1);
		$website_name = $this->db->get()->row();
		$this->data_header['browser_title'] =  ucwords($website_name->website_name) . ' - My Cart'; 
		$this->data_header['meta_description'] = ucwords($website_name->website_name) . ' - My Cart';

		if (!$this->cart->contents()){
			$data['message'] = '<pre style="background:grey; color:white; padding:10px; margin-bottom:100px;">Your cart is empty</pre>';
		
		} else {
			$data['message'] = $this->session->flashdata('message');
		}

		$this->session->set_userdata('is_from_cart', 'yes');

		$this->load->view("themes/$this->theme_no/header", $this->data_header);
		$this->load->view('cart', $data);
		$this->load->view("themes/$this->theme_no/footer", $this->data_footer); 
	}

	public function adds() {
	
		$warehouse_id = (int) $this->input->post('warehouse_id');
		$product_id = (int) $this->input->post('product_id');	
		$qty = (int) $this->input->post('qty');	
	
		if($this->input->post('indentagree')) {
			$indent_agree = true;
		} else {
			$indent_agree = false;
		}

		//check if stock is enough
		$stock = $this->db->select('stock')->from('stock')->where('warehouse_id', $warehouse_id)->where('id_product', $product_id)->get()->row()->stock;
	
		if($stock < $qty && $indent_agree == false) {
			//get product alias
			$product_alias = $this->db->select('alias')->from('products')->where('id_products', (int) $this->input->post('product_id'))->get()->row()->alias;

			$this->session->set_flashdata('message', "<br>
			<p style='background:red; color:white; padding:5px; font-weight:bold;'>Maaf stok tidak mencukupi. Silahkan pilih kuantitas lain.</p>");

			redirect('product/' . $product_alias);
		}

		$this->load->helper('cart');

		//get warehouse name
		$warehouse_name = $this->db->select('name')->from('warehouse')->where('id', $warehouse_id)->get()->row()->name;

		$data['id'] 	= $product_id;	
		$data['qty']	= $qty;
		$data['option']['warehouse_id'] = $warehouse_id;
		$data['option']['warehouse_name'] = $warehouse_name;
		if($indent_agree === true) {
			$data['option']['is_backorder'] = 'yes';
		} else {
			$data['option']['is_backorder'] = 'no';
		}

		//get product data
		$this->db->select('title, sale_price, discounted_price, is_sale')->from('products')->where('id_products', (int) $data['id']);
		$product = $this->db->get()->row();
		$data['name'] = ucwords($product->title);
		if($product->is_sale == 'yes' && $product->discounted_price > 0) {
			$data['price'] = $product->discounted_price; 
		} 
		else {
			$data['price'] = $product->sale_price; 
		}
		
		$this->cart->product_name_rules = '[:print:]'; //this is to eliminate cart product name restriction on special characters
		$this->cart->insert($data); 

		redirect('cart'); 	
	}
	
	public function remove($rowid) {
		if ($rowid=="all"){
			$this->cart->destroy();
		}else{
			$data = array(
				'rowid'   => $rowid,
				'qty'     => 0
			);

			$this->cart->update($data);
		}
		
		redirect('cart');
	}

	/*email to user if product is available*/
	public function customer_notification(){
		$data = array(
			'id_products' 	=> (int) $this->input->post('product_id'),
			'email' 		=> $this->security->xss_clean($this->input->post('emailMeAvailable')),
		);

		$this->db->select('*');
		$this->db->from('customers_notification');
		$this->db->where('id_products', $data['id_products']);
		$this->db->where('email', $data['email']);
		$query1 = $this->db->get();
		$cek = $query1->row();

		if($cek != null){
			$this->session->set_flashdata('email_sended1', '<br>
				<p style="background:green; color:white; padding:5px; font-weight:bold;">
					Anda sudah mengirim e-mail untuk mengetahui informasi produk ini.<br> 
					Kami akan segera memberi tahu anda apabila stok tersedia.
				</p>'
			);
		}
		else{
			$this->db->insert('customers_notification',$data);
			$this->session->set_flashdata('email_sended', '<br>
				<p style="background:green; color:white; padding:5px; font-weight:bold;">
					Alamat E-mail diterima.<br> 
					Kami akan segera memberi tahu anda apabila stok tersedia.
				</p>'
			);
		}

		redirect($this->input->post('page_url'));
	}
	public function customer_notifications(){
		$data = array(
			'id_products' 	=> (int) $this->input->post('product_id'),
			'email' 		=> $this->security->xss_clean($this->input->post('emailMeAvailable')),
		);

		$this->db->select('*');
		$this->db->from('customers_notification');
		$this->db->where('id_products', $data['id_products']);
		$this->db->where('email', $data['email']);
		$query1 = $this->db->get();
		$cek = $query1->row();

		if($cek != null){
			$this->session->set_flashdata('email_sended1', '<br>
				<p style="background:green; color:white; padding:5px; font-weight:bold;">
					Anda sudah mengirim e-mail untuk mengetahui informasi produk ini.<br> 
					Kami akan segera memberi tahu anda apabila stok tersedia.
				</p>'
			);
		}
		else{
			$this->db->insert('customers_notification',$data);
			$this->session->set_flashdata('email_sended', '<br>
				<p style="background:green; color:white; padding:5px; font-weight:bold;">
					Alamat E-mail diterima.<br> 
					Kami akan segera memberi tahu anda apabila stok tersedia.
				</p>'
			);
		}

		redirect($this->input->post('page_url').'#'.$data['id_products']);
	}



}

https://t.me/RX1948 - 2025