ruạṛ
<?php /** * Update quantities of all products submitted with form * (usually either a single product or all products in cart) * @version 0.9 * @author Robert Urquhart <programmer@activatedesign.co.nz> * @package WEP-CMS * @todo institute a check that the request for this page is coming from a valid page on-site */ /** * @var string $includes_dir location of database connection details and global functions * @var string $template_dir location of template specific functions (and user connection details if different permissions supported) */ $data_dir = $_SERVER['DOCUMENT_ROOT'].'/admin/scripts-includes/'; $template_dir = $_SERVER['DOCUMENT_ROOT'].'/resources/template/'; /** * load includes */ require_once $data_dir.'universal.php'; require_once $template_dir.'functions.php'; /* * start the session (after includes so objects stored in $_SESSION are created properly) */ session_start(); /** * set up database connection * @var resource $connID db connection reference */ $connID=connect_to_db(); /** * suhosin workaround - load session user data * @var object $customer * @var object $cart */ $customer = user_load(); $cart = $customer->load_cart('wishlist'); if(!$cart->num_products) { getout('',select_one('page_data','path','page_type','wishlist')); exit; } else { $message = ''; //$message .= print_r($cart->products,true).'<br />'; //debugging; $reference = clean_plain_data($_GET['product']); if(isset($cart->products["$reference"])) { //$message .= "isset <br />"; //debugging; $cart->product($reference,0); if($customer->user_id){ $customer->update_cart($cart,'wishlist'); } else { user_cart_save($cart,'wishlist'); } $message .= '<p class="message">Your wishlist has been updated</p>'; } } setcookie('wishlistMessage', $message, time()+30, '/'); getout('',select_one('page_data','path','page_type','wishlist')); exit; ?>
cải xoăn