diff --git a/classes/Discount.php b/classes/Discount.php index 379fef7e3..90f61a823 100644 --- a/classes/Discount.php +++ b/classes/Discount.php @@ -126,7 +126,7 @@ class DiscountCore extends CartRule { Tools::displayAsDeprecated(); $obj = $this->parent; - if (in_array($method, array('add', 'update', 'getIdByName', 'getCustomerDiscounts', 'getValue', 'discountExists', 'createOrderDiscount', 'getVouchersToCartDisplay'))) + if (in_array($method, array('add', 'update', 'getIdByName', 'getCustomerDiscounts', 'getValue', 'discountExists', 'createOrderDiscount', 'getVouchersToCartDisplay', 'display'))) $obj = $this; return call_user_func_array(array($obj, $method), $args); } @@ -202,10 +202,7 @@ class DiscountCore extends CartRule * @deprecated 1.5.0.1 */ public static function createOrderDiscount($order, $productList, $qtyList, $name, $shipping_cost = false, $id_category = 0, $subcategory = 0) - { - // Todo - //die ('TODO'); - + { $languages = Language::getLanguages($order); $products = $order->getProducts(false, $productList, $qtyList); @@ -252,4 +249,19 @@ class DiscountCore extends CartRule return $voucher; } + + /** + * @deprecated 1.5.0.1 + */ + public static function display($value, $type, $currency = null) + { + if ((float)$value && (int)$type) + { + if ($type == 1) + return $value.chr(37); // ASCII #37 --> % (percent) + elseif ($type == 2) + return Tools::displayPrice($value, $currency); + } + return ''; // return a string because it's a display method + } } \ No newline at end of file diff --git a/modules/referralprogram/ReferralProgramModule.php b/modules/referralprogram/ReferralProgramModule.php index 7f3be001d..2e1a9ed9e 100644 --- a/modules/referralprogram/ReferralProgramModule.php +++ b/modules/referralprogram/ReferralProgramModule.php @@ -35,8 +35,8 @@ class ReferralProgramModule extends ObjectModel public $lastname; public $firstname; public $id_customer; - public $id_discount; - public $id_discount_sponsor; + public $id_cart_rule; + public $id_cart_rule_sponsor; public $date_add; public $date_upd; @@ -52,8 +52,8 @@ class ReferralProgramModule extends ObjectModel 'lastname' => array('type' => self::TYPE_STRING, 'validate' => 'isName', 'required' => true, 'size' => 128), 'firstname' => array('type' => self::TYPE_STRING, 'validate' => 'isName', 'required' => true, 'size' => 128), 'id_customer' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'), - 'id_discount' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'), - 'id_discount_sponsor' =>array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'), + 'id_cart_rule' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'), + 'id_cart_rule_sponsor' =>array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'), 'date_add' => array('type' => self::TYPE_DATE, 'validate' => 'isDate'), 'date_upd' => array('type' => self::TYPE_DATE, 'validate' => 'isDate'), ), @@ -66,14 +66,14 @@ class ReferralProgramModule extends ObjectModel public function registerDiscountForSponsor($id_currency) { - if ((int)$this->id_discount_sponsor > 0) + if ((int)$this->id_cart_rule_sponsor > 0) return false; return $this->registerDiscount((int)$this->id_sponsor, 'sponsor', (int)$id_currency); } public function registerDiscountForSponsored($id_currency) { - if (!(int)$this->id_customer OR (int)$this->id_discount > 0) + if (!(int)$this->id_customer OR (int)$this->id_cart_rule > 0) return false; return $this->registerDiscount((int)$this->id_customer, 'sponsored', (int)$id_currency); } diff --git a/modules/referralprogram/my-account.tpl b/modules/referralprogram/my-account.tpl index 32d343f16..532855e23 100644 --- a/modules/referralprogram/my-account.tpl +++ b/modules/referralprogram/my-account.tpl @@ -25,5 +25,5 @@ *} -
{l s='Referral program' mod='referralprogram'}
{l s='Referral program' mod='referralprogram'}