Created
October 1, 2020 14:03
-
-
Save unlocomqx/f7b836e43067f9aa8a6c24b83bf0082f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Customization price | |
if ((int)$id_customization) { | |
$customization_cost = Tools::convertPrice(Customization::getCustomizationPrice($id_customization), $id_currency); | |
if ((int)$id_cart) { | |
$discount_qty = 10; | |
$discount = 50; | |
$nb_total_customizations = (int)Db::getInstance()->getValue(' | |
SELECT SUM(quantity) | |
FROM `' . _DB_PREFIX_ . 'cart_product` | |
WHERE id_cart = ' . (int)$id_cart . ' AND id_customization != 0' | |
); | |
if ($only_reduc || $use_reduc) { | |
if ($nb_total_customizations >= $discount_qty) { | |
$customization_cost -= $customization_cost * ($discount / 100); | |
} | |
} | |
} | |
$price += $customization_cost; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment