Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Display Modes
  #1 (permalink)  
Old October 30th, 2007, 06:31 AM
Authorized User
 
Join Date: Oct 2007
Location: , , .
Posts: 46
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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)

  #2 (permalink)  
Old October 30th, 2007, 06:04 PM
Imar's Avatar
Wrox Author
Points: 71,804, Level: 100
Points: 71,804, Level: 100 Points: 71,804, Level: 100 Points: 71,804, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,050
Thanks: 80
Thanked 1,581 Times in 1,558 Posts
Default

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
  #3 (permalink)  
Old October 31st, 2007, 04:30 AM
Authorized User
 
Join Date: Oct 2007
Location: , , .
Posts: 46
Thanks: 0
Thanked 0 Times in 0 Posts
Default

 
Quote:
quote: ''' <summary>
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 ?

  #4 (permalink)  
Old October 31st, 2007, 04:18 PM
Imar's Avatar
Wrox Author
Points: 71,804, Level: 100
Points: 71,804, Level: 100 Points: 71,804, Level: 100 Points: 71,804, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,050
Thanks: 80
Thanked 1,581 Times in 1,558 Posts
Default

Yeah, something like that would work, although you can just add the amount directly:

tempResult += 6.5

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
  #5 (permalink)  
Old October 31st, 2007, 06:06 PM
Authorized User
 
Join Date: Oct 2007
Location: , , .
Posts: 46
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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

  #6 (permalink)  
Old October 31st, 2007, 06:15 PM
Imar's Avatar
Wrox Author
Points: 71,804, Level: 100
Points: 71,804, Level: 100 Points: 71,804, Level: 100 Points: 71,804, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,050
Thanks: 80
Thanked 1,581 Times in 1,558 Posts
Default

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
  #7 (permalink)  
Old October 31st, 2007, 06:16 PM
Imar's Avatar
Wrox Author
Points: 71,804, Level: 100
Points: 71,804, Level: 100 Points: 71,804, Level: 100 Points: 71,804, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,050
Thanks: 80
Thanked 1,581 Times in 1,558 Posts
Default

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
  #8 (permalink)  
Old October 31st, 2007, 06:29 PM
Authorized User
 
Join Date: Oct 2007
Location: , , .
Posts: 46
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hmm that was the wrong one :P

Ive tried these 2 but both nothing:
 
Quote:
quote: ''' <summary>
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:
quote: ''' <summary>
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

  #9 (permalink)  
Old October 31st, 2007, 06:51 PM
Imar's Avatar
Wrox Author
Points: 71,804, Level: 100
Points: 71,804, Level: 100 Points: 71,804, Level: 100 Points: 71,804, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,050
Thanks: 80
Thanked 1,581 Times in 1,558 Posts
Default

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
  #10 (permalink)  
Old November 1st, 2007, 04:03 AM
Authorized User
 
Join Date: Oct 2007
Location: , , .
Posts: 46
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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
 


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem with blank fields in Shipping Address radrussell BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 3 November 23rd, 2009 11:57 AM
Why Shipping address is not validated? webeye BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 1 September 18th, 2008 11:31 AM
UPS shipping problem for Canada with osCommerce snowbydave1 PHP How-To 0 June 5th, 2008 06:14 AM
Adding SaleTax and Shipping goldenstate BOOK: Beginning ASP.NET 2.0 BOOK VB ISBN: 978-0-7645-8850-1; C# ISBN: 978-0-470-04258-8 0 November 16th, 2007 12:01 PM
Shipping Progress -ASP.Net Gibs_poovath General .NET 6 May 10th, 2004 02:04 PM



All times are GMT -4. The time now is 06:53 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.