Ok,
Here are my changes that seem to work.
1. Replace the GiftCertificates files with the ones attached. The change is that the control will fire an event when a GC is changed.
2. Add this to your checkout.vb to force the reload of the order when the GC have changed:
Protected Sub GiftCertificates1_GiftCertificatesChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles GiftCertificates1.GiftCertificatesChanged
LoadBasket()
End Sub
3. In the LoadBasket function replace the If Not Basket.HasShippingItems Then [...] with:
If Not Basket.HasShippingItems Then
PaymentUC.LoadPaymentMethods(Basket.GrandTotal)
Else
'PaymentUC.LoadPaymentMethods(1D)
Dim gc As Decimal = OrderUtils.OrderValueWithoutGiftCertificates(Basket)
Dim hasGc As Boolean = OrderUtils.OrderHasGiftCertificates(Basket)
PaymentUC.LoadPaymentMethods(gc, hasGc)
End If
4. Create the OrderUtils class (if you don't have one) in the App_Code and drop these two methods:
Public Shared Function OrderValueWithoutGiftCertificates(ByVal order As Orders.Order) As Decimal
order.CalculateGrandTotalOnly(False, False)
Dim gc As Decimal = GetGiftCertificateValue(order)
If gc > 0 Then
If gc > order.GrandTotal Then
Return order.GrandTotal
Else
Return order.GrandTotal - gc
End If
Else
Return order.GrandTotal
End If
End Function
Public Shared Function OrderHasGiftCertificates(ByVal order As Orders.Order) As Boolean
For Each item As Orders.OrderPayment In order.Payments
If item.PaymentMethodId = WebAppSettings.PaymentIdGiftCertificate Then
Return True
End If
Next
Return False
End Function
This should work. At least "it works on my computer" and live on my site as well :)
Regards,
Corneliu.
File Attachment(s):
GiftCertificates.ascx
(2kb) downloaded 2 time(s).You cannot view/download attachments. Try to login or register.