Init
This commit is contained in:
29
ajax/cart.php
Normal file
29
ajax/cart.php
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
session_start();
|
||||
chdir('..');
|
||||
require_once('api/Simpla.php');
|
||||
$simpla = new Simpla();
|
||||
$arr = '';
|
||||
if($simpla->request->get('feature')){
|
||||
$str = urldecode($simpla->request->get('feature'));
|
||||
parse_str( $str,$arr );
|
||||
}
|
||||
//print_r($arr);
|
||||
$simpla->cart->add_item($simpla->request->get('variant', 'integer'), $simpla->request->get('amount', 'integer'),@$arr['feature']);
|
||||
$cart = $simpla->cart->get_cart();
|
||||
$simpla->design->assign('cart', $cart);
|
||||
|
||||
$currencies = $simpla->money->get_currencies(array('enabled'=>1));
|
||||
if(isset($_SESSION['currency_id']))
|
||||
$currency = $simpla->money->get_currency($_SESSION['currency_id']);
|
||||
else
|
||||
$currency = reset($currencies);
|
||||
|
||||
$simpla->design->assign('currency', $currency);
|
||||
|
||||
$result = $simpla->design->fetch('cart_informer.tpl');
|
||||
header("Content-type: application/json; charset=UTF-8");
|
||||
header("Cache-Control: must-revalidate");
|
||||
header("Pragma: no-cache");
|
||||
header("Expires: -1");
|
||||
print json_encode($result);
|
||||
Reference in New Issue
Block a user