+1-888-365-2779
Try Now
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

1 posts, 0 answered
  1. kevin
    kevin avatar
    0 posts
    Registered:
    05 May 2016
    14 Oct
    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, http://docs.sitefinity.com/for-developers-add-custom-fields-for-product-variations , 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