Récemment


[1.6.X.X] Le module loyalty s'affiche sur les articles en promotion


  • legacy

    Le module loyalty affiche des points de fidélité sur les articles en promotion alors que dans le backoffice il est coché ne pas donner de points aux articles en promotion.

    Prestashop compare une variable avec parseInt qui retourne donc un nombre entier.

    Ca fonctionne de nouveau pour les versions de theme > 1.6.1.0 avec

    https://github.com/PrestaShop/PrestaShop/pull/8791

    Autre solution qui fonctionnera en 1.6.0.X ( @doekia )

    Ajouter dans le tpl

    {addJsDef no_pts_discounted=$no_pts_discounted}
    

    Remplacer :

    if (typeof(new_price) == 'undefined' || typeof(productPriceWithoutReduction) == 'undefined')
    

    Par

    if (typeof(new_price) == 'undefined' || typeof(productPriceWithoutReduction) == 'undefined' || no_pts_discounted == 1)
    

  • legacy

    Pour les versions 1.6.1.X

    $(document).ready(function() {
    	$(document).on('change', '#our_price_display', function(e){
    		updateLoyaltyView(priceWithDiscountsDisplay);
    	})
    	updateLoyaltyView(priceWithDiscountsDisplay);
    });
    
    function updateLoyaltyView(new_price) {
    	if (typeof(new_price) == 'undefined' || typeof(productPriceWithoutReduction) == 'undefined')
    		return;
    
    	var points = Math.floor(new_price / point_rate);
    	var total_points = points_in_cart + points;
    	var voucher = total_points * point_value;
    
    	if (none_award == 0 && productPriceWithoutReduction != new_price) {
    		$('#loyalty').html(loyalty_already);
    	}
    	else if (!points) {
    		$('#loyalty').html(loyalty_nopoints);
    	}
    	else
    	{
    		var content = loyalty_willcollect + " <b><span id=\"loyalty_points\">"+points+'</span> ';
    		if (points > 1)
    			content += loyalty_points + "</b>. ";
    		else
    			content += loyalty_point + "</b>. ";
    
    		content += loyalty_total + " <b><span id=\"total_loyalty_points\">"+total_points+'</span> ';
    		if (total_points > 1)
    			content += loyalty_points;
    		else
    			content += loyalty_point;
    
    		content += '</b> ' + loyalty_converted + ' ';
    		content += '<span id="loyalty_price">'+formatCurrency(voucher, currencyFormat, currencySign, currencyBlank)+'</span>.';
    		$('#loyalty').html(content);
    	}
    }
    

    Fonctionne également si un produit à une remise que sur une déclinaison.