Created
September 2, 2024 10:19
-
-
Save unlocomqx/ee2adee23dd9d471004b10c39d0d9840 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 | |
/** @var int $id_product */ | |
/** @var float $product_price */ | |
use DynamicProduct\classes\DynamicTools; | |
use DynamicProduct\classes\module\DynamicCalculator; | |
if (isset($reverse_discount)) { | |
$reverse_discount = 1; | |
$dynamicCalculator = new DynamicCalculator(DynamicTools::getModule(), DynamicTools::getContext()); | |
$specific_price = $dynamicCalculator->getProductReduction($id_product); | |
if ($specific_price['reduction_type'] === 'percentage') { | |
$discount = $specific_price['reduction']; | |
if ($discount > 0) { | |
$reverse_discount = 1 / (1 - $discount); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment