// Context part 27
git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@7812 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
@@ -104,9 +104,8 @@ class LoyaltyModule extends ObjectModel
|
||||
{
|
||||
if (!(int)(Configuration::get('PS_LOYALTY_NONE_AWARD')) AND Product::isDiscounted((int)$product['id_product']))
|
||||
{
|
||||
global $smarty;
|
||||
if (isset($smarty) AND is_object($newProduct) AND $product['id_product'] == $newProduct->id)
|
||||
$smarty->assign('no_pts_discounted', 1);
|
||||
if (isset($this->context->smarty) AND is_object($newProduct) AND $product['id_product'] == $newProduct->id)
|
||||
$this->context->smarty->assign('no_pts_discounted', 1);
|
||||
continue;
|
||||
}
|
||||
$total += ($taxesEnabled == PS_TAX_EXC ? $product['price'] : $product['price_wt'])* (int)($product['cart_quantity']);
|
||||
@@ -120,23 +119,17 @@ class LoyaltyModule extends ObjectModel
|
||||
|
||||
public static function getVoucherValue($nbPoints, $id_currency = NULL)
|
||||
{
|
||||
global $cookie;
|
||||
|
||||
if (empty($id_currency))
|
||||
$id_currency = (int)$cookie->id_currency;
|
||||
|
||||
return (int)$nbPoints * (float)Tools::convertPrice(Configuration::get('PS_LOYALTY_POINT_VALUE'), new Currency((int)$id_currency));
|
||||
$currency = $id_currency ? new Currency($id_currency) : $this->context->currency->id;
|
||||
|
||||
return (int)$nbPoints * (float)Tools::convertPrice(Configuration::get('PS_LOYALTY_POINT_VALUE'), $currency);
|
||||
}
|
||||
|
||||
public static function getNbPointsByPrice($price)
|
||||
{
|
||||
global $cookie;
|
||||
|
||||
if (Configuration::get('PS_CURRENCY_DEFAULT') != $cookie->id_currency)
|
||||
if (Configuration::get('PS_CURRENCY_DEFAULT') != $this->context->currency->id)
|
||||
{
|
||||
$currency = new Currency((int)($cookie->id_currency));
|
||||
if ($currency->conversion_rate)
|
||||
$price = $price / $currency->conversion_rate;
|
||||
if ($this->context->currency->conversion_rate)
|
||||
$price = $price / $this->context->currency->conversion_rate;
|
||||
}
|
||||
|
||||
/* Prevent division by zero */
|
||||
|
||||
Reference in New Issue
Block a user