diff --git a/modules/referralprogram/preview-email.php b/modules/referralprogram/preview-email.php index fa3133088..3facd439d 100644 --- a/modules/referralprogram/preview-email.php +++ b/modules/referralprogram/preview-email.php @@ -46,8 +46,15 @@ $file = str_replace('{email}', $customer->email, $file); $file = str_replace('{firstname_friend}', 'XXXXX', $file); $file = str_replace('{lastname_friend}', 'xxxxxx', $file); $file = str_replace('{link}', 'authentication.php?create_account=1', $file); -$file = str_replace('{discount}', ReferralProgram::displayDiscount((float)Configuration::get('REFERRAL_DISCOUNT_VALUE_' . Context::getContext()->currency->id), (int)Configuration::get('REFERRAL_DISCOUNT_TYPE'), Context::getContext()->currency), $file); - +$discount_type = (int)(Configuration::get('REFERRAL_DISCOUNT_TYPE')); +if ($discount_type == 1) +{ + $file = str_replace('{discount}', Discount::display((float)(Configuration::get('REFERRAL_PERCENTAGE')), $discount_type, new Currency($cookie->id_currency)), $file); +} +else +{ + $file = str_replace('{discount}', Discount::display((float)(Configuration::get('REFERRAL_DISCOUNT_VALUE_' . $cookie->id_currency)), $discount_type, new Currency($cookie->id_currency)), $file); +} echo $file; diff --git a/modules/referralprogram/referralprogram-program.php b/modules/referralprogram/referralprogram-program.php index deeeeb09b..87c3d7e0c 100644 --- a/modules/referralprogram/referralprogram-program.php +++ b/modules/referralprogram/referralprogram-program.php @@ -42,8 +42,15 @@ $context->controller->addJqueryPlugin(array('thickbox', 'idTabs')); include(dirname(__FILE__).'/../../header.php'); // get discount value (ready to display) -$discount = ReferralProgram::displayDiscount((float)Configuration::get('REFERRAL_DISCOUNT_VALUE_'.(int)($cookie->id_currency)), (int)Configuration::get('REFERRAL_DISCOUNT_TYPE'), new Currency($cookie->id_currency)); - +$discount_type = (int)(Configuration::get('REFERRAL_DISCOUNT_TYPE')); +if ($discount_type == 1) +{ + $discount = Discount::display((float)(Configuration::get('REFERRAL_PERCENTAGE')), $discount_type, new Currency($cookie->id_currency)); +} +else +{ + $discount = Discount::display((float)(Configuration::get('REFERRAL_DISCOUNT_VALUE_'.(int)($cookie->id_currency))), $discount_type, new Currency($cookie->id_currency)); +} $activeTab = 'sponsor'; $error = false;