Group: Administrators
Last Active: Sun 27 Sep 2015
Posts: 115,
Visits: 706
|
No need to make changes to the code to validate option selection, as Kartris has that feature already.
While in modify product page, Go to Options tab, then select Product Options sub-tab. Now, all you need to do is to make sure you have not selected the "Optional" checkbox at the last column, save the changes and that will fire the validation if the customer tries to add to the basket without selecting any of that option.
You can change the message that will pop up, its inside the "btnAdd_Options_Click" event (same you are trying to modify), the "Else" part of the "If strNonSelectedOptions Is Nothing Then".
|
Group: Forum Members
Last Active: Thu 18 Jun 2015
Posts: 98,
Visits: 1,382
|
I have noticed that the system allows you to add an options product without selecting any options.
I am trying to code this so that the button click fires a validation event to check that all options have been chosen. I made the following change to the ProductVersions.ascx.vb page but that is only checking that any option has been selected and not all.
Having looked further into the OptionsContainer.ascx.vb code I am a little confused as to how I can interogate each dropdown and check that the selected option is not 0.
I was trying to go down this route....
Public Function ValidOptionsSelected() As Boolean For Each obj In phdOptions.Controls If Control.SelectedValue = 0
return false
Next Return true
End Function
Protected Sub btnAdd_Options_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnAdd_Options.Click
If UC_OptionsContainer.GetSelecetedOptions = "" Then
UC_PopupMessage.SetTitle = "No Options Selected"
UC_PopupMessage.SetTextMessage = "Please select product options before adding to basket."
UC_PopupMessage.SetWidthHeight(300, 70)
UC_PopupMessage.ShowPopup()
Else
Dim strNonSelectedOptions As String = UC_OptionsContainer.CheckForValidSelection()
If strNonSelectedOptions Is Nothing Then
|