58 lines
1.7 KiB
PHP
58 lines
1.7 KiB
PHP
|
<?php
|
||
|
/**
|
||
|
* giftvoucher-ajax.php
|
||
|
* Gift voucher module
|
||
|
* @category modules
|
||
|
*
|
||
|
* @author dids <prestashop@dids.fr>
|
||
|
* @copyright dids - des idées et des sites - 2009-2011
|
||
|
* @version 1.1.5
|
||
|
*
|
||
|
*/
|
||
|
|
||
|
require_once(dirname(__FILE__).'/../../config/config.inc.php');
|
||
|
require_once(dirname(__FILE__).'/../../init.php');
|
||
|
require_once(dirname(__FILE__).'/giftvoucher.php');
|
||
|
|
||
|
global $cookie;
|
||
|
|
||
|
$giftVoucher = new GiftVoucher();
|
||
|
$hookArgs = array();
|
||
|
|
||
|
|
||
|
if (Tools::getValue('no_info') == 'true') {
|
||
|
GiftVoucherModule::setNoInfoToGiftVouchersFromCart(intval($cookie->id_cart));
|
||
|
|
||
|
$hookArgs['cookie'] = $cookie;
|
||
|
|
||
|
echo $giftVoucher->hookAjaxCallEmpty($hookArgs);
|
||
|
} else if (Tools::getValue('customize') == 'true') {
|
||
|
if ($_SERVER['REQUEST_METHOD'] == "GET") { // GET
|
||
|
$giftVoucher->checkGiftsVoucher(null);
|
||
|
|
||
|
$all = (Tools::getValue('all') == 'true');
|
||
|
$giftvouchers = GiftVoucherModule::getGiftVouchersFromCart(intval($cookie->id_cart), intval($cookie->id_lang), $all);
|
||
|
|
||
|
$hookArgs['cookie'] = $cookie;
|
||
|
$hookArgs['giftvouchers'] = $giftvouchers;
|
||
|
|
||
|
echo $giftVoucher->hookAjaxCallCustomize($hookArgs);
|
||
|
} else { // POST
|
||
|
//$all = (Tools::getValue('all') == 'true');
|
||
|
$giftvouchers = GiftVoucherModule::getGiftVouchersFromCart(intval($cookie->id_cart), intval($cookie->id_lang));
|
||
|
|
||
|
$hookArgs['cookie'] = $cookie;
|
||
|
$hookArgs['giftvouchers'] = $giftvouchers;
|
||
|
|
||
|
echo $giftVoucher->hookAjaxSendCustomize($hookArgs);
|
||
|
}
|
||
|
} else {
|
||
|
$giftvouchers = GiftVoucherModule::getGiftVouchersFromCart(intval($cookie->id_cart), intval($cookie->id_lang));
|
||
|
|
||
|
$hookArgs['cookie'] = $cookie;
|
||
|
$hookArgs['giftvouchers'] = $giftvouchers;
|
||
|
|
||
|
echo $giftVoucher->hookAjaxCall($hookArgs);
|
||
|
}
|
||
|
?>
|