 |
BOOK: ASP.NET 2.0 Instant Results ISBN: 978-0-471-74951-6
 | This is the forum to discuss the Wrox book ASP.NET 2.0 Instant Results by Imar Spaanjaars, Paul Wilton, Shawn Livermore; ISBN: 9780471749516 |
|
Welcome to the p2p.wrox.com Forums.
You are currently viewing the BOOK: ASP.NET 2.0 Instant Results ISBN: 978-0-471-74951-6 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|
|

October 30th, 2007, 05:31 AM
|
|
Authorized User
|
|
Join Date: Oct 2007
Posts: 46
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Shipping costs
hey i am wondering what do i have to do to get shipping costs in my webshop
it would allready be great if the total order amount has a nullvalue of 6,20 and the products prices would just count up.
(i am really ashamed for all of my questions  ) but i hope you can help me with this.
so if i could say that the product total has a null value of 6,20 it would be fine
(also becouse ideal has to send it trough)
|
|

October 30th, 2007, 05:04 PM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
Hi there,
There are a number of ways to do this. First of all, you could add a ShippingCosts product to your cart in the constructor of the shopping cart. So, whenever you create a new cart, the costs are already there. If you choose this solution, you also need to make sure you can't delete this item from the cart anymore.
Advantage: pretty easy to implement in the cart; disadvantage: odd UI tricks to avoid deleting the item.
As an alternative, you can create a ShippingCosts property on the cart, and have TotalCosts return both the total item count and the shipping costs, Then, right below the cart, display both the total cart value, the shipping costs and the total amount in a label.
The downside of this is that the cart os not really in control of the costs. This may not be that bad though....
Hope this gives you some ideas.....
Imar
---------------------------------------
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004
|
|

October 31st, 2007, 03:30 AM
|
|
Authorized User
|
|
Join Date: Oct 2007
Posts: 46
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Quote:
''' Returns the total order amount.
''' </summary>
Public ReadOnly Property Total() As Decimal
Get
Dim tempResult As Decimal
For Each myOrderedProduct As OrderedProduct In _items
tempResult += myOrderedProduct.SubTotal
Next
Return tempResult
Then
tempResult = tempResult.Add(6.20) As Decimal
End Get
End Property
#End Region
|
I wanted to do something like this?
But is this a way also?
(it doesnt matter if it has no security options it just has to add 6,20 to the total)
Do you know how i format this so that it wil work ?
|
|

October 31st, 2007, 05:06 PM
|
|
Authorized User
|
|
Join Date: Oct 2007
Posts: 46
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
i'm really sorry that i am so annoying
i have the following code:
''' <summary>
''' Returns the total number of items in the cart.
''' </summary>
''' <remarks>Note that this property returns the total number of ordered items, not the number of unique products in the cart.</remarks>
Public ReadOnly Property Count() As Integer
Get
Dim tempResult As Integer
For Each myOrderedProduct As OrderedProduct In _items
tempResult += myOrderedProduct.Quantity
Next
Return tempResult
tempResult += 5
End Get
End Property
But when i now add a product of 1 euro it show me 1 euro everywhere
|
|

October 31st, 2007, 05:15 PM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
Quote:
quote:Return tempResult
tempResult += 5
|
You return the value before you add 5 to it. Try swapping these two lines.
Imar
---------------------------------------
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004
|
|

October 31st, 2007, 05:16 PM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
Quote:
|
quote:Note that this property returns the total number of ordered items, not the number of unique products in the cart
|
BTW, why do you add 5 to the *Count* of the cart? It shows the number of items in the cart; not the price.
Imar
---------------------------------------
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004
|
|

October 31st, 2007, 05:29 PM
|
|
Authorized User
|
|
Join Date: Oct 2007
Posts: 46
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Hmm that was the wrong one :P
Ive tried these 2 but both nothing:
Quote:
''' Returns the total order amount.
''' </summary>
Public ReadOnly Property Total() As Decimal
Get
Dim tempResult As Decimal
For Each myOrderedProduct As OrderedProduct In _items
tempResult += myOrderedProduct.SubTotal
Next
tempResult += 5
Return tempResult
End Get
End Property
|
Quote:
''' Returns the total order amount.
''' </summary>
Public ReadOnly Property Total() As Decimal
Get
Dim tempResult As Decimal
For Each myOrderedProduct As OrderedProduct In _items
tempResult += myOrderedProduct.SubTotal
Next
Return tempResult
tempResult += 5
End Get
End Property
|
I was pretty sure this was the way to do it
Or did i make some dumb mistakes again
|
|

October 31st, 2007, 05:51 PM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
Quote:
quote: Get
Dim tempResult As Decimal
For Each myOrderedProduct As OrderedProduct In _items
tempResult += myOrderedProduct.SubTotal
Next
tempResult += 5
Return tempResult
End Get
|
The only problem I see with this is that if you have no items in the cart, your shipping costs still apply.
Other than that, I don't see anything wrong with this. Can you define "but both nothing"? Do you get an error?
Imar
---------------------------------------
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004
|
|

November 1st, 2007, 03:03 AM
|
|
Authorized User
|
|
Join Date: Oct 2007
Posts: 46
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
No i dont get an error
but with the 2 codes
he still doesn't show any shipping costs just the costs of the products
Edit:
I found one thing
on the Thanking page he does show 10 euro instead of 5 so here are the shiping costs inserted.
But why not in the gridviews :S
|
|
 |