Jump to content

Problème pour intégrer une fonction perso dans cart-summary.js


Recommended Posts

Bonjour,

 

Sur mon site j'ai un double affichage des prix : yens + une autre devise au choix.

J'ai donc créé une fonction toute bête dans classes/Product.php

La fonction est la suivante:

static function multiprices($params, &$smarty)
{		  
	global $cookie;
	$price=$params['price'];

	if(!isset($cookie->currency2)) {
		$other_currency = 1;
		} else {
	$other_currency = $cookie->currency2;
	}
	//deuxieme currency
	$currency2 = new Currency($other_currency);
	$price2 = Tools::convertPrice($price, $currency2);
	$price3 = Tools::displayPrice($price2, $currency2, $no_utf8 = false, $convert = true);
	return $price3;	
}

 

Cette fonction fonctionne presque partout mais j'ai un problème sur la page Cart Summary.

Je voudrais intégrer cette fonction dans le fichier cart-summary.js de la même façon que la fonction formatCurrency

$('#total_product').html(formatCurrency(json.total_products, currencyFormat, currencySign, currencyBlank));

Je n'arrive pas à trouver comment faire.

J'ai essayé des trucs du genre

$('#total_product2').html(Product::multiprices(json.total_products, smarty));
$('#total_product2').html(multiprices(json.total_products, smarty));

mais ça ne fonctionne pas.

 

C'est un petit problème qui me pose un trés gros soucis je suis bloqué à cause de ça !

Edited by cactusman2 (see edit history)
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...