Hi there,
I need to show the Ecom.Price in to seperate parts like:
29<sup>95</sup>
How can I split the totalprice into two parts before and after the decimal separator?
Can be done with JS, but are there DWtags available to use?
Niek
Developer forum
E-mail notifications
Split price at decimal seperator
Posted on 20/04/2010 11:15:16
Replies
Posted on 20/04/2010 13:20:11
Hi Niek,
You can use the ProdutTemplateExtender to manipulate the output, ie:
You can use the ProdutTemplateExtender to manipulate the output, ie:
using Dynamicweb;
using Dynamicweb.eCommerce.Products;
namespace myModule
{
public class ProductTemplateExtender1 : ProductTemplateExtender
{
public override void ExtendTemplate(Dynamicweb.Templatev2.Template Template)
{
if (Template.TagExists("Ecom:Product.Price"))
{
Template.SetTag("Ecom:Product.Price",Product.Price.ToString().Replace(".","your stuff"));
}
}
}
}
Notice that the Ecom:Product.Price also contains the currency at the beginning, so you may want to use another available tag (see available product tags at http://templates.dynamicweb.dk/eCommerce/Dynamicweb-eCommerce-template-tags/Product-Catalog/Product-detail.aspx). Though, the above should be able to get you along.
Regards /Snedker
Notice that the Ecom:Product.Price also contains the currency at the beginning, so you may want to use another available tag (see available product tags at http://templates.dynamicweb.dk/eCommerce/Dynamicweb-eCommerce-template-tags/Product-Catalog/Product-detail.aspx). Though, the above should be able to get you along.
Regards /Snedker
Posted on 22/04/2010 17:10:25
Hi thanks, that works but can i do the same with <!--@Ecom:Product.ActualPriceWithoutVAT-->?
It seems that this tag is not recognizes when building the project.
Niek
It seems that this tag is not recognizes when building the project.
Niek
Nicolai Høeg Pedersen
Posted on 22/04/2010 17:31:49
The product.price is a Piceinfo object which has different properties, i.e. the price without VAT:
Product.Price.PriceWithoutVAT.ToString().Replace(".","your stuff"));
Product.Price.PriceWithoutVAT.ToString().Replace(".","your stuff"));
You must be logged in to post in the forum