I have added a Generic Attribute to some products, but I am struggling to access the Generic attribute in a view.
I have no problem accessing Generic Attributes in controllers, but I don't want modify the core, i want to create a custom view and access the Generic Attributes form the view.
Is this possible?, and if so some sample code would be great.
I have added a Generic Attribute to some products, but I am struggling to access the Generic attribute in a view.
I have no problem accessing Generic Attributes in controllers, but I don't want modify the core, i want to create a custom view and access the Generic Attributes form the view.
Is this possible?, and if so some sample code would be great.
I have added a Generic Attribute to some products, but I am struggling to access the Generic attribute in a view.
I have no problem accessing Generic Attributes in controllers, but I don't want modify the core, i want to create a custom view and access the Generic Attributes form the view.
Is this possible?, and if so some sample code would be great.
Thanks
How do you add a generic attribute? I want to add a new value to display for eg pack size in product details page. How can i do it?
Well in my case I wanted to display a youtube video on the product details page but not on all products, so I created a plugin that added a video tab in the admin section of the products where I could add the youtube url link in a product generic attribute.
Then when the product has a video I create a video tab on the product details page in the public store.
var product = _productService.GetProductById(id); _genericAttributeService.SaveAttribute<string>(product, Constants.ProductVideoUrlAttribute, productVideoUrl);
Well in my case I wanted to display a youtube video on the product details page but not on all products, so I created a plugin that added a video tab in the admin section of the products where I could add the youtube url link in a product generic attribute.
Then when the product has a video I create a video tab on the product details page in the public store.
var product = _productService.GetProductById(id); _genericAttributeService.SaveAttribute<string>(product, Constants.ProductVideoUrlAttribute, productVideoUrl);
I'm using nopcommerce 3.4 version. I want to display inner and outer pack size, cant i insert into specification attribute? We used import routines to import products in database. Would it be correct to insert into specification attribute during product import?
I have added a Generic Attribute to some products, but I am struggling to access the Generic attribute in a view.
I have no problem accessing Generic Attributes in controllers, but I don't want modify the core, i want to create a custom view and access the Generic Attributes form the view.
Is this possible?, and if so some sample code would be great.
@{ var genericAttributeService = EngineContext.Current.Resolve<IGenericAttributeService>(); var attributes = genericAttributeService.GetAttributesForEntity(Model.ProductId, "Product"); }
This gives you a list of attributes related to that product. You need to further locate the actual attribute you want to get. :)
I want to have Specification attribute on a view, say product box for some reason. Hoe can it be done. Not able to use enginecontext as it is not registered
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.