Je suis actuellement en utilisant ce code pour calculer la taxe sur un de mes formulaires, mais je voudrais avoir un autre formulaire calculer la taxe ainsi et je ne suis pas sûr de savoir comment modifier ce code afin ça affecte 2 formes ou s'il y a quelque chose de mieux que je puisse faire ???Gravity Forms - Formes multiples avec la taxe
// update the "78" to the ID of your form add_filter('gform_pre_render_78', 'add_total_script'); function add_total_script($form) { ?> function gform_product_total(formId, total){ var tax = ((5 * total)/100); // update the "20" to the desired tax percentage; tax = Math.round(tax*100)/100; //rounding tax to 2 decimal digits return total + tax; } 'Tax', // name that will appear in PayPal and pricing summary tables 'price' => $tax, // amount of total tax 'quantity' => 1 ); return $product_info; } function get_total($products) { $total = 0; foreach($products["products"] as $product){ $price = GFCommon::to_number($product["price"]); if(is_array($product["options"])){ foreach($product["options"] as $option){ $price += GFCommon::to_number($option["price"]); } } $subtotal = floatval($product["quantity"]) * $price; $total += $subtotal; } $total += floatval($products["shipping"]["price"]); return $total; }
Merci. J'ai déjà vu cet article, mais je n'arrive pas à le faire fonctionner pour moi. Il dit d'ajouter le code dans mes functions.php mais quand je le fais, je reçois juste l'écran blanc de la mort et rien ne fonctionne. Y a-t-il peut-être une autre solution pour cela? ou quelque chose qui me manque? J'utilise un thème gratuit appelé Pinboard si ça aide. – Cameron
Consultez cette page pour plus d'aide: l'installation des extraits http://gravitywiz.com/documentation/snippet-troubleshooting/ Sinon, déposez un commentaire sur l'article (même si vous avez déjà précédemment) et je serai heureux d'aider. – David