Force Login for Product Type - Ecommerce - Ecommerce - Progress Community

Force Login for Product Type

 Ecommerce

Force Login for Product Type

  • Force Login for Product Type
  • 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

  • 288bb904-7b51-4fd2-9a95-5862f9062f34_CustomProductFileSelector.zip
    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
     
  • Thanks for this Stanislav, was effortless to get this to work.

     Much appreciated,

     Clinton