I am attaching the below snapshots of prestashop shopping cart So how I will get the code of discount amount from the voucher redeemed.
http://imgur.com/a/bvx7J
http://imgur.com/a/XgT9p
I am attaching the below snapshots of prestashop shopping cart So how I will get the code of discount amount from the voucher redeemed.
http://imgur.com/a/bvx7J
http://imgur.com/a/XgT9p
You can use the getCartRules()
function to fetch all the cart rules applied on any cart. This function is defined in the Cart.php class file.
You can use the following code to fetch all the coupon details on current cart:
$this->context->cart->getCartRules();
and you can use below code to know if the customer is using the voucher for the first time.
if ($context->cart->id_customer) {
$quantityUsed = Db::getInstance()->getValue('
SELECT count(*)
FROM '._DB_PREFIX_.'orders o
LEFT JOIN '._DB_PREFIX_.'order_cart_rule od ON o.id_order = od.id_order
WHERE o.id_customer = '.$context->cart->id_customer.'
AND od.id_cart_rule = '.(int)$this->id.'
AND '.(int)Configuration::get('PS_OS_ERROR').' != o.current_state
');
if ($quantityUsed == 0) {
// Customer is using the coupon for first time.
}
}