+1-888-365-2779
Try Now
More in this section

Forums / Ecommerce / Force Login for Product Type

Force Login for Product Type

3 posts, 0 answered
  1. S. Webb
    S. Webb avatar
    36 posts
    Registered:
    28 Dec 2006
    12 Aug 2015
    Link to this post

    Hi,

     Is there any way to create a new product type that will require a user to be logged in to checkout but will not require me to upload a file as part of the product when I create it?

     Thanks,
    Steve

  2. Stanislav Velikov
    Stanislav Velikov avatar
    1113 posts
    Registered:
    05 Dec 2016
    17 Aug 2015
    Link to this post
    Hello Steve,

    To request the user to login set permissions to the page where the checkout widget is placed (the default permissions are for Everyone to view set it to Authenticated and it will request authentication).

    Requiring authentication from the user for only one product type on the other  hand is a tough one since all products on the site get added to the shopping cart and when there are products of a type that should require authentication and for a product that should not require authentication must the authentication be requested or skipped?

    To have a product not validate the file selector field remove the validation from the client component of the control that is the file selector.

    Refer to the attached files. They contain a custom field control for selecting downloadable files in products.
    1. Set the build action of the two javascript files as EmbeddedResource.2
    2. register the embedded resource in AssemblyInfo.cs
    [assembly: WebResource("SitefinityWebApp.CustomProductFileSelector.IRequiresDataItem.js", "application/x-javascript")]
    [assembly: WebResource("SitefinityWebApp.CustomProductFileSelector.CustomControl.js", "application/x-javascript")]
    3.In CustomControl.js I have commended out the login in the validate function and now it always returns True.
    4. Update the namespaces in the class for the control and in the JS files to match the ones you use at your end.

    Register the field control to replace the built in selector for files from Administration->Settings->Advanced->ContrntView->Controls->ProductsBackendDefinitionName->Views->insert_sf_ec_prdct_software (this is for software product type chose another if you use custom one)
    ->Sections->DownloadableFilesSection->Fields->DownloadFileField and in textbox FieldType enter the CLR type of the custom field control
    SitefinityWebApp.CustomProductFileSelector.CustomControl, SitefinityWebApp
    Clear the browser cache to remove any JS from the built in control and the new control will be in use and will not validate.

    Regards,
    Stanislav Velikov
    Telerik
     
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
     
  3. Clinton
    Clinton avatar
    14 posts
    Registered:
    27 Feb 2014
    24 Aug 2015 in reply to Stanislav Velikov
    Link to this post

    Thanks for this Stanislav, was effortless to get this to work.

     Much appreciated,

     Clinton

3 posts, 0 answered