More in this section
Forums / Ecommerce / Add custom field for file selection to Ecommerce Product Variation

Add custom field for file selection to Ecommerce Product Variation

The forums are in read-only mode. In case that you want to directly contact the Progress Sitefinity team use the support center. In our Google Plus group you can find more than one thousand Sitefinity developers discussing different topics. For the Stack Overflow threads don’t forget to use the “Sitefinity” tag.
1 posts, 0 answered
  1. kevin
    kevin avatar
    0 posts
    05 May 2016
    14 Oct 2016
    Link to this post
    When creating a Variation of an Ecommerce Product, I would like to have the ability to select a file (a document file, such as pdf). Unfortunately, this is not an out-of-the-box option, although an Image can be selected and a SKU can be entered.

    Therefore, I believe what I need to do is add a custom field for the Product Variations. However, the next challenge I face is that Sitefinity does not provide a way to add a custom field to a Product Variation that is as simple as, say, adding a custom field to a Page. It seems that adding a custom field to a product variation is only possible programmatically and/or via the Advanced Settings in the Sitefinity backend, unfortunately.

    This tutorial looked promising, , however, in this example the custom field being added is very basic – it’s of type string (rather than a more complex type that I’m interested in, which I think is ProductDocumentsAndFilesField or possibly FileField).

    Can you please advise how I can achieve my goal of adding a custom field to a product variation for the purpose of selecting a document file, and include any relevant code snippets?

    As a side note, I believe there is an error in the above mentioned tutorial’s final block of code:

    This line is incorrect:
    var editView = (DetailFormViewElement)productVariationDefinitions.ViewsConfig[ProductVariationDefinitions.BackendProductVariationsDefinitionName];

    I believe it should be:
    var editView = (DetailFormViewElement)productVariationDefinitions.ViewsConfig[ProductVariationDefinitions.ProductVariationsBackendEditViewName];

    Thank you kindly in advance.
1 posts, 0 answered