Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | 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 Search this Thread Display Modes
  #1 (permalink)  
Old October 14th, 2006, 10:27 AM
Registered User
 
Join Date: Oct 2006
Location: Sydney, NSW, Australia.
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default Webshop modification

Good day all.

Very good book and nice forum.
One question.
Is there some way how to get two or more webshops running within this example?
Lets say, there would be one more page showing all available webshops and they would have all available products and so on...
Or is it major change and should not be done?

Thanks for reading this.

Peter

  #2 (permalink)  
Old October 15th, 2006, 08:56 AM
Imar's Avatar
Wrox Author
Points: 72,073, Level: 100
Points: 72,073, Level: 100 Points: 72,073, Level: 100 Points: 72,073, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

Hi Peter,

I am glad you like the book....

The whole idea about the applications in this book is reuse. You should be able to take the shop and reuse it in scenarios where you see fit. So, yes, this should definitely be possible.

But you need to think about how you want to approach this. Do the shops get their own database and products? Or do you want to share content between the sites. Does each shop get a unique look and feel or do you want to share presentation as well? And, also important, how would users browse to the shop? E.g. www.domain.com/Shop1 and www.domain.com/Shop2 or www.shop1.com and www.shop2.com?

If you can elaborate a bit about what you have in mind, I may be able to give better suggestions and advice.

Cheers,

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004
Want to be my colleague? Then check out this post.
  #3 (permalink)  
Old October 24th, 2006, 05:45 AM
Registered User
 
Join Date: Oct 2006
Location: Sydney, NSW, Australia.
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hey Imar!

Thanks for reply to my problem.
I was shopping around in last couple of weeks(buying and reading other books with similar solutions) but im back here admiting that this is best material available.

So my problem is: I would like to create 3 different webshops. They would share one DB file (so membership same for all shops) and would be accessed as www.domain.com/shop1, www.domain.com/shop2....
They would sell different products.

If you can just hint few things, I would much appreciate.

Peter
  #4 (permalink)  
Old October 24th, 2006, 02:11 PM
Imar's Avatar
Wrox Author
Points: 72,073, Level: 100
Points: 72,073, Level: 100 Points: 72,073, Level: 100 Points: 72,073, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

Hi Peter,

If you want to have different shops under the same domain, you need some way to determine the current "shop" in your code. One way to do this is to use a common base page that all your pages derive from. That's the way I designed a similar shop solution that was the basis for the (simplified) shop in the book.

In your App_Code folder, add a class called BasePage for example, that inherits from System.Web.UI.Page, like this:
Code:
Public Class BasePage
  Inherits System.Web.UI.Page
End Class
Then make your pages in the site inherit from that BaseClass instead of from System.Web.UI.Page (which is the default).

Next, give this BasePage class a read-only property like CurrentSite. This can be an Integer, or an enumeration for example that represents the current site. In the getter for this property, look at the current path, and based on something like /Site1/ or /Site2/ return the right shop number.

Next, in the same BaseClass, in the OnPreInit event you can (if that's a requirement) dynamically switch the MasterPage or the Theme to give each site a unique visual appearance.

Another thing you need to take into account is displaying the right products. However, with the CurrentSite property on the BasePage you can always see what site you're in and base your queries on that. That is, pass something like Me.CurrentSite to select methods that return your products.

You need to apply the same stuff to the Management section, so you can add products for the various shops.

Of course there's more stuff to take into account, but it's difficult to recommend anything without knowing what route you're going to take. I'll be more than happy to provide more help when you start with this and run into unforeseen issues....

Suggested reading for a BasePage and switching MasterPages:

ASP.Net 2.0 - Master Pages: Tips, Tricks, and Traps
Establish common ASP.NET page features through inheritance


Cheers,


Imar


---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004
While typing this post, I was listening to: Reptile by Nine Inch Nails (Track 12 from the album: The Downward Spiral) What's This?
  #5 (permalink)  
Old November 16th, 2006, 11:41 AM
saf saf is offline
Authorized User
 
Join Date: Nov 2006
Location: , , .
Posts: 26
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Imar -

I'm looking to do something similiar to what you describe here. For example, I will have users login by selecting their shopname, entering password and based on valid login direct them to their shop... Shops will share a database with shopid as key and share presentation.
I imagine when I get to rolling this out I will have one domain name accessed www.domain.com/shop1. So, similar to what Peter is trying to do. Any chance you have a sample of this in your bag of tricks that would get me going?

Thanks!

  #6 (permalink)  
Old November 18th, 2006, 12:00 PM
Imar's Avatar
Wrox Author
Points: 72,073, Level: 100
Points: 72,073, Level: 100 Points: 72,073, Level: 100 Points: 72,073, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

Hi saf,

Can you explain with a bit more detail what kind of information you need? Doesn't my previous post get you in the right direction?

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004
Want to be my colleague? Then check out this post.
  #7 (permalink)  
Old November 22nd, 2006, 12:19 PM
saf saf is offline
Authorized User
 
Join Date: Nov 2006
Location: , , .
Posts: 26
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Imar -

Nevermind. I think I'm on the right track. Thanks for getting back to me though...

  #8 (permalink)  
Old November 25th, 2006, 07:30 AM
Imar's Avatar
Wrox Author
Points: 72,073, Level: 100
Points: 72,073, Level: 100 Points: 72,073, Level: 100 Points: 72,073, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

You're welcome. Hope it's working out....

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004
Want to be my colleague? Then check out this post.
  #9 (permalink)  
Old November 27th, 2006, 08:28 AM
Registered User
 
Join Date: Oct 2006
Location: Sydney, NSW, Australia.
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hey Imar!

This is not directly related to webshop, but im trying to get some reports printed.
As for example for current user, to display his daily/monthly spendings.
I can see, that there are tables that are recording transactions, but i was thinking about the way
how to determine current user (who is logged in) and im struggling with it.

Thanks for reading this.

Peter

  #10 (permalink)  
Old November 27th, 2006, 04:53 PM
Imar's Avatar
Wrox Author
Points: 72,073, Level: 100
Points: 72,073, Level: 100 Points: 72,073, Level: 100 Points: 72,073, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

Hi Peter,

The column CustomerId in the table OrderBase is the user's ID from the aspnet_Users table. You can use this ID to find specific orders (and their details) for a user. You can get at the user's ID with the following code:
Code:
Dim myUser As MembershipUser = Membership.GetUser()
Dim userId As Guid = CType(myUser.ProviderUserKey, Guid)
You can then pass this ID into the DAL and forward it to a stored procedure that queries the orders for a user like this:
Code:
SELECT     Id, OrderDate, CustomerId, FirstName, LastName, Street, ZipCode, City, Country
FROM         OrderBase
WHERE     (CustomerId = @userId)
You can join the OrderBase table on the OrderDetail table to get related order info.

Don't forget that Membership.GetUser() only returns a valid user when the current user is logged in.

Does this put you in the right direction?

Is this shop live somewhere on the Internet? Would love to see how it is used....

Cheers,

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004
Want to be my colleague? Then check out this post.
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
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
Instant Results Modification of webshop problems malex BOOK: ASP.NET 2.0 Instant Results ISBN: 978-0-471-74951-6 1 March 8th, 2007 04:12 PM
Modification on records.....one by one. akshay_rangar ASP.NET 2.0 Basics 0 January 26th, 2007 12:57 PM
Webshop Modification saf BOOK: ASP.NET 2.0 Instant Results ISBN: 978-0-471-74951-6 5 November 3rd, 2006 07:49 PM
Kernal Modification!!HOW????? harsh_hot Linux 3 May 28th, 2006 09:23 PM
Installation package modification eelisMX Pro VB.NET 2002/2003 0 April 20th, 2005 03:34 AM



All times are GMT -4. The time now is 09:51 PM.


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