Hi,
How can I change a custom field value on a product-item on-the-fly with out change in the database.
It easy to change a "standard" field on-the-fly like:
Product.Meta.Keywords = "my keywords"
But how do I change a custom field value? What im looking for is something like this:
if ( you == "veryspecial") {
Product.CustomFieldsXml["mycustomfield"] = "My Very Special Value";
}
... !?
/Morten
Developer forum
E-mail notifications
Change eCom custom-field on-the-fly
Posted on 14/10/2010 10:50:22
Replies
Jeppe Eriksson Agger
Posted on 14/10/2010 13:01:54
Hi Morten
The property you're looking for is called ProductFieldValues.
So what you do is:
prod.ProductFieldValues.GetProductFieldValue("yourcustomfield").Value = "Your Very Special Value";
NB.:
prod is a Product ( duh ;-) )
GetProductFieldValues can return null.
"yourcustomfield" is the System Name of the field.
- Jeppe
The property you're looking for is called ProductFieldValues.
So what you do is:
prod.ProductFieldValues.GetProductFieldValue("yourcustomfield").Value = "Your Very Special Value";
NB.:
prod is a Product ( duh ;-) )
GetProductFieldValues can return null.
"yourcustomfield" is the System Name of the field.
- Jeppe
Posted on 14/10/2010 13:43:40
Hi Jeppe,
Sweet ... Brilliant!
Just what I was lookin for :)
/Morten
Sweet ... Brilliant!
Just what I was lookin for :)
/Morten
Posted on 09/11/2010 10:44:54
Can I access custom-field on ecom groups in the same way - been trying - with no luck:
Dynamicweb.eCommerce.Products.Group myGroup = new Dynamicweb.eCommerce.Products.Group(HttpContext.Current.Request.QueryString["groupid"]);
Dynamicweb.Frontend.PageView.Current().Meta.Title = myGroup.ProductGroupFieldValues.GetProductGroupFieldValue("grouppagetitle").Value.ToString();
How is that done?
Dynamicweb.eCommerce.Products.Group myGroup = new Dynamicweb.eCommerce.Products.Group(HttpContext.Current.Request.QueryString["groupid"]);
Dynamicweb.Frontend.PageView.Current().Meta.Title = myGroup.ProductGroupFieldValues.GetProductGroupFieldValue("grouppagetitle").Value.ToString();
How is that done?
You must be logged in to post in the forum