presta_ch Posted September 23, 2021 Share Posted September 23, 2021 Referral program module work in the version 1.5 and I'm trying to make it work in 1.7 classes => Discount.php no longer exists in the version 1.7 I am trying to edit the code without result I need Discount::PERCENT & Discount::AMOUNT but not exists public function registerDiscount($id_customer, $register = false, $id_currency = 0) { $configurations = Configuration::getMultiple(array('REFERRAL_DISCOUNT_TYPE', 'REFERRAL_PERCENTAGE', 'REFERRAL_DISCOUNT_CUMULATIVE', 'REFERRAL_DISCOUNT_VALUE_'.(int)$id_currency, 'REFERRAL_TAX')); $cartRule = new CartRule(); if ($configurations['REFERRAL_DISCOUNT_TYPE'] == Discount::PERCENT) $cartRule->reduction_percent = (float)$configurations['REFERRAL_PERCENTAGE']; elseif ($configurations['REFERRAL_DISCOUNT_TYPE'] == Discount::AMOUNT AND isset($configurations['REFERRAL_DISCOUNT_VALUE_'.(int)$id_currency])) { $cartRule->reduction_amount = (float)$configurations['REFERRAL_DISCOUNT_VALUE_'.(int)$id_currency]; $cartRule->reduction_tax = (int)$configurations['REFERRAL_TAX']; } $cartRule->cart_rule_restriction = !(int)$configurations['REFERRAL_DISCOUNT_CUMULATIVE']; $cartRule->quantity = 1; $cartRule->quantity_per_user = 1; $cartRule->date_from = date('Y-m-d H:i:s', time()); $cartRule->date_to = date('Y-m-d H:i:s', time() + 31536000); // + 1 year $cartRule->code = $this->getDiscountPrefix().Tools::passwdGen(6); $cartRule->name = Configuration::getInt('REFERRAL_DISCOUNT_DESCRIPTION'); if (empty($cartRule->name)) $cartRule->name = 'Referral reward'; $cartRule->id_customer = (int)$id_customer; $cartRule->reduction_currency = (int)$id_currency; if ($cartRule->add()) { if ($register != false) { if ($register == 'sponsor') $this->id_cart_rule_sponsor = (int)$cartRule->id; elseif ($register == 'sponsored') $this->id_cart_rule = (int)$cartRule->id; return $this->save(); } return true; } return false; } I need to change => $discount = Discount::display((float)(Configuration::get('REFERRAL_PERCENTAGE')), $discount_type, new Currency($this->context->currency->id)); // get discount value (ready to display) $discount_type = (int)(Configuration::get('REFERRAL_DISCOUNT_TYPE')); if ($discount_type == 1) $discount = Discount::display((float)(Configuration::get('REFERRAL_PERCENTAGE')), $discount_type, new Currency($this->context->currency->id)); else $discount = Discount::display((float)(Configuration::get('REFERRAL_DISCOUNT_VALUE_'.(int)($this->context->currency->id))), $discount_type, new Currency($this->context->currency->id)); $activeTab = 'sponsor'; $error = false; // Mailing invitation to friend sponsor $invitation_sent = false; $nbInvitation = 0; Help me, please, I've been looking for a solution for 3 weeks, it's very urgent thanks in advance note : sorry for my english Link to comment Share on other sites More sharing options...
presta_ch Posted September 27, 2021 Author Share Posted September 27, 2021 No answer !! Link to comment Share on other sites More sharing options...
endriu107 Posted September 27, 2021 Share Posted September 27, 2021 4 minutes ago, presta_ch said: No answer !! At first you put this topics in incorrect forum section, I moved this topic from "Free modules and themes section" to "Addons, modules and themes developers" because you didn't offer free module and you want change module so I asume you are developer. If you are developer please provide more details wat you try, what is your prestashop version. Link to comment Share on other sites More sharing options...
presta_ch Posted September 27, 2021 Author Share Posted September 27, 2021 Aha ok I'm sorry My PrestaShop Version : 1.7.7.0 Link to comment Share on other sites More sharing options...
Nickz Posted October 17, 2021 Share Posted October 17, 2021 On 9/27/2021 at 10:57 AM, presta_ch said: Aha ok I'm sorry did you solve that issue? Link to comment Share on other sites More sharing options...
presta_ch Posted October 18, 2021 Author Share Posted October 18, 2021 No Link to comment Share on other sites More sharing options...
Nickz Posted October 18, 2021 Share Posted October 18, 2021 3 hours ago, presta_ch said: No which module you are trying to use in your PS Vs 1.7.x? Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now