• Toll-free  888-665-8637
  • International  +1 717-220-0012
Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Matt@9BallDesign
#1 Posted : Tuesday, December 9, 2008 2:52:05 PM(UTC)
Matt@9BallDesign

Rank: Member

Joined: 12/23/2003(UTC)
Posts: 909

I'm testing a site and purposefully not selecting any choices and clicking add to cart. An error message should appear, however it is not.


I've checked the Pre and Post HTML and I see no error message displayed. However this is what I get:



<div id="ctl00_MainContentHolder_ValidationSummary1" class="errormessage" style="color:Red;display:none;">

</div>



the red is what I believe to be the culprit, the product template page has the default code in there:



<asp:ValidationSummary ID="ValidationSummary1" runat="server" CssClass="errormessage" />



anybody else experiencing this? This was happening on earlier versions as well. I may have muffed something somewhere but I'm leaning towards the doubtful side of the fence... wouldn't mind being proven wrong!
Matt Martell


http://www.9balldesign.com - Web, Print, Graphic


http://www.martellhardware.com/ - Decorative & Builder's Hardware

------------------------------------------------
Andy Miller
#2 Posted : Tuesday, December 9, 2008 2:59:40 PM(UTC)
Andy Miller

Rank: Member

Joined: 11/5/2003(UTC)
Posts: 2,136

Was thanked: 1 time(s) in 1 post(s)
Thank sure rings a bell. I recall a similar problem (maybe that problem) from 5 beta days. It turned out that the validator was not run on the server. Does the "add to cart" code for the page call Page.Validate?
Andy Miller
Structured Solutions

Shipper 3 - High Velocity Shipment Processing
Matt@9BallDesign
#3 Posted : Tuesday, December 9, 2008 3:15:58 PM(UTC)
Matt@9BallDesign

Rank: Member

Joined: 12/23/2003(UTC)
Posts: 909

Page Template:


Code:

<%@ Register Src="../../Controls/AddToCartButton.ascx" TagName="AddToCartButton" TagPrefix="uc6" %>


Page Template:

[code]
<div id="addcartbutton"><uc6:AddToCartButton ID="AddToCartButton1" runat="server" /></div>

AddToCartButton.ascx

Code:

<%@ Control Language="VB" AutoEventWireup="false" CodeFile="AddToCartButton.ascx.vb" Inherits="BVModules_Controls_AddToCartButton" %>
<%@ Register Assembly="Anthem" Namespace="Anthem" TagPrefix="anthem" %>
<%@ Register Src="MessageBox.ascx" TagName="MessageBox" TagPrefix="uc2" %>
<%@ Register Src="VariantsDisplay.ascx" TagName="VariantsDisplay" TagPrefix="uc1" %>
<anthem:ImageButton id="btnAdd" runat="server" AlternateText="Add to Cart" ImageUrl="~/BVModules/Themes/Bvc5/Images/Buttons/AddToCart.png" EnabledDuringCallBack="False" EnableCallBack="false"></anthem:ImageButton>
<asp:ImageButton ID="btnSaveChanges" runat="server" AlternateText="Add to Cart" ImageUrl="~/BVModules/Themes/Bvc5/images/Buttons/SaveChanges.png" Visible="False"/>

AddToCartButton.ascx.vb

Code:

Imports BVSoftware.Bvc5.Core

Partial Class BVModules_Controls_AddToCartButton
Inherits System.Web.UI.UserControl

Public Event AddToCartClicked(ByVal args As AddToCartClickedEventArgs)

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Me.btnAdd.ImageUrl = Page.ResolveUrl(PersonalizationServices.GetThemedButton("AddToCart"))
Me.btnSaveChanges.ImageUrl = Page.ResolveUrl(PersonalizationServices.GetThemedButton("SaveChanges"))

If Not Page.IsPostBack Then
Me.btnAdd.EnableCallBack = (Not WebAppSettings.RedirectToCartAfterAddProduct)
If Request.QueryString("LineItemId") Is Nothing Then
btnAdd.Visible = True
btnSaveChanges.Visible = False
Else
btnAdd.Visible = False
btnSaveChanges.Visible = True
End If
End If
End Sub

Private Sub CheckForBackOrder()
If Not WebAppSettings.DisableInventory Then
If TypeOf Me.Page Is BaseStoreProductPage Then
Dim p As BaseStoreProductPage = CType(Me.Page, BaseStoreProductPage)
Select Case p.LocalProduct.InventoryStatus
Case Catalog.ProductInventoryStatus.NotAvailable
btnAdd.Visible = False
btnAdd.UpdateAfterCallBack = True
Case Else
btnAdd.Visible = True
btnAdd.UpdateAfterCallBack = True
End Select
End If
End If
End Sub

Protected Sub btnAdd_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles btnAdd.Click, btnSaveChanges.Click
Dim args As New AddToCartClickedEventArgs()
RaiseEvent AddToCartClicked(args)

If args.IsValid Then
If Page.IsValid Then
Dim selectedProduct As Catalog.Product
If args.VariantsDisplay IsNot Nothing Then
If Not args.VariantsDisplay.IsValid Then
Return
End If
selectedProduct = args.VariantsDisplay.GetSelectedProduct(Nothing)
If selectedProduct Is Nothing Then
EventLog.LogEvent("AddToCartButton.aspx.vb", "Product could not be found from Variants display. Current product: " & args.Page.LocalProduct.Bvin & " " & args.Page.LocalProduct.Sku, Metrics.EventLogSeverity.Error)
Return
Else
If args.VariantsDisplay.IsValidCombination Then
args.Page.LocalProduct = selectedProduct
Else
args.MessageBox.ShowError("Cannot Add To Cart. Current Selection Is Not Available.")
End If
End If
ElseIf args.KitDisplay IsNot Nothing Then
If Not args.KitDisplay.IsValid Then
args.MessageBox.ShowError("Required selections are missing.")
End If
selectedProduct = args.Page.LocalProduct
Else
selectedProduct = args.Page.LocalProduct
End If

args.Page.ModuleProductQuantity = args.Quantity

Dim destination As String = String.Empty

Dim Basket As Orders.Order = SessionManager.CurrentShoppingCart

If Basket.UserID <> SessionManager.GetCurrentUserId Then
Basket.UserID = SessionManager.GetCurrentUserId
End If

If Request.QueryString("LineItemId") IsNot Nothing Then
Basket.RemoveItem(Request.QueryString("LineItemId"))
End If

Dim li As New Orders.LineItem()
li.ProductId = selectedProduct.Bvin
li.Quantity = args.Quantity

If args.VariantsDisplay IsNot Nothing Then
args.VariantsDisplay.WriteValuesToLineItem(li)
ElseIf args.KitDisplay IsNot Nothing Then
args.KitDisplay.WriteToLineItem(li)
End If
Basket.AddItem(li)

If Basket.LastLineItemAdded IsNot Nothing Then
If args.ProductOverridePrice > 0 Then
Basket.LastLineItemAdded.BasePrice = args.ProductOverridePrice
End If

If sender.Equals(Me.btnSaveChanges) Then
destination = "~/Cart.aspx"
Else
destination = selectedProduct.GetCartDestinationUrl(Basket.LastLineItemAdded)
End If

Orders.LineItem.Update(Basket.LastLineItemAdded)
If destination.Trim() = String.Empty Then
args.ItemAddedToCartLabel.Text = WebAppSettings.ItemAddedToCartText
args.ItemAddedToCartLabel.Visible = True
args.ItemAddedToCartLabel.UpdateAfterCallBack = True
Else
Response.Redirect(destination)
End If
End If
End If
End If
End Sub


Protected Sub Page_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.PreRender
CheckForBackOrder()
End Sub
End Class

Matt Martell


http://www.9balldesign.com - Web, Print, Graphic


http://www.martellhardware.com/ - Decorative & Builder's Hardware

------------------------------------------------
Andy Miller
#4 Posted : Tuesday, December 9, 2008 3:47:19 PM(UTC)
Andy Miller

Rank: Member

Joined: 11/5/2003(UTC)
Posts: 2,136

Was thanked: 1 time(s) in 1 post(s)
It is running the validators (or probably is because I see the Page.IsValid there). I forgot to ask if the item gets added to the cart. If the code is behaving, then it should refuse to add the item to the cart. If the UI is behaving then you should also see the message "Required selections are missing." (not a very helpful message IMO).

If the code is working, but the UI is not; then we just need to find out why the code is disconnected from the UI.
Andy Miller
Structured Solutions

Shipper 3 - High Velocity Shipment Processing
Matt@9BallDesign
#5 Posted : Tuesday, December 9, 2008 4:29:19 PM(UTC)
Matt@9BallDesign

Rank: Member

Joined: 12/23/2003(UTC)
Posts: 909

Product does not get added to the cart. This has been a highly modifed product template but not so much in the form of .vb changes. just code location and some new span's and div's for styling.


if anyone has an OOTB BV5.4 template handy....
Matt Martell


http://www.9balldesign.com - Web, Print, Graphic


http://www.martellhardware.com/ - Decorative & Builder's Hardware

------------------------------------------------
Marcus
#6 Posted : Thursday, December 18, 2008 11:05:51 AM(UTC)
Marcus

Rank: Member

Joined: 11/5/2003(UTC)
Posts: 1,786

Matt,

What page template are you using? One of the built in ones or a custom one? What service pack version?
Matt@9BallDesign
#7 Posted : Thursday, December 18, 2008 11:13:22 AM(UTC)
Matt@9BallDesign

Rank: Member

Joined: 12/23/2003(UTC)
Posts: 909

I copied versions of the BV 2004 template to create these custom ones. The mods I've made were some rearrangements of code for layout. The .vb changes were minor, i.e. removing the % savings from the you save label, additional SEO stuff.
Matt Martell


http://www.9balldesign.com - Web, Print, Graphic


http://www.martellhardware.com/ - Decorative & Builder's Hardware

------------------------------------------------
Marcus
#8 Posted : Thursday, December 18, 2008 11:16:23 AM(UTC)
Marcus

Rank: Member

Joined: 11/5/2003(UTC)
Posts: 1,786

The product pages are really tricky with all of the ajax updates etc. I hate making code changes to them :-) I'd really have to see your code to compare it to a stock page to tell if that could cause a problem.

What happens if you set the product back to a stock template? Does the validator work then?
Matt@9BallDesign
#9 Posted : Thursday, December 18, 2008 12:22:05 PM(UTC)
Matt@9BallDesign

Rank: Member

Joined: 12/23/2003(UTC)
Posts: 909

I'll zip you a template.
Matt Martell


http://www.9balldesign.com - Web, Print, Graphic


http://www.martellhardware.com/ - Decorative & Builder's Hardware

------------------------------------------------
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

©2024 Develisys. All rights reserved.
  • Toll-free  888-665-8637
  • International  +1 717-220-0012