Skip to content

Instantly share code, notes, and snippets.

@unlocomqx
Created October 1, 2020 14:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save unlocomqx/f7b836e43067f9aa8a6c24b83bf0082f to your computer and use it in GitHub Desktop.
Save unlocomqx/f7b836e43067f9aa8a6c24b83bf0082f to your computer and use it in GitHub Desktop.
<?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