53 lines
1.3 KiB
PHP
Executable File
53 lines
1.3 KiB
PHP
Executable File
<?php
|
|
include(dirname(__FILE__).'/../../config/config.inc.php');
|
|
require_once(dirname(__FILE__).'../../../init.php');
|
|
include_once(dirname(__FILE__).'/../../modules/privatesales/Sale.php');
|
|
|
|
global $cookie;
|
|
global $smarty;
|
|
|
|
$id_product = Tools::getValue('id_product', 0);
|
|
$idCombination = Tools::getValue('idCombination', 0);
|
|
|
|
if($id_product){
|
|
$product = new Product($id_product, false, $cookie->id_lang);
|
|
$quantity = Tools::getValue('quantity', 1);
|
|
|
|
$cart = new Cart((int)($cookie->id_cart));
|
|
$cart->id_lang = (int)($cookie->id_lang);
|
|
|
|
if($idCombination != 0){
|
|
$price = $product->getPrice(true, $idCombination, 2) * $quantity;
|
|
}else{
|
|
$price = $product->getPrice(true, NULL, 2) * $quantity;
|
|
}
|
|
|
|
$sale = Sale::getSaleFromCategory($product->id_category_default, false);
|
|
if (isset($sale)) {
|
|
$delivery_delay = (int)$sale->delivery_delay;
|
|
}
|
|
|
|
$bestSaleCart = Module::hookExec('bestSaleCart');
|
|
|
|
$link = new Link();
|
|
|
|
$tpl = $smarty->createTemplate('ajax_cart.tpl');
|
|
|
|
$tpl->assign(array(
|
|
'product' => $product,
|
|
'link' => $link,
|
|
'img_dir' => '/themes/site/img/',
|
|
'quantity' => $quantity,
|
|
'bestSaleCart' => $bestSaleCart,
|
|
'price' => $price,
|
|
'delivery_delay' => (isset($delivery_delay) ? $delivery_delay : null)
|
|
));
|
|
|
|
echo $rendu = $tpl->fetch();
|
|
die;
|
|
|
|
}else{
|
|
return false;
|
|
}
|
|
|
|
?>
|