E-commerce & N2

Aug 7, 2008 at 3:55 PM
following the discussion started in this thread for simplicity a separate thread for this topic...
---------------------------------------------------------------------------------------------
In response to Tischnoetentoet:

I do not believe a lot of users are not using N2 because it lacks e-commerce as a standard integration.
Note that N2 is not a standard CMS and without good enough knowlegde of programming it is of small use anyway...
With enough (not really that much btw) knowledge of programming it is not so hard to built an e-commerce solution using N2 as the core.
I choose to seperate the customers tables and the shoppingcart tables merly for a specific use, but I could have used the N2 tables as well.
I do miss some functionallity here and there (see my other posts), but usually it is provided...I just did not find it yet (or Cristian put's it in the next update :-) ).

The N2 structure as it is facilitates me to built these e-commerce solutions where the target-audience for the currently deployed website is 100.000 plus students and staff (private login).
We are building some more solutions right now with targets from 10.000 to 2,5 billion non-anonymous users...
The reason I seperated the customer and shoppingcart part of the database is because of these numbers.
I figured if I put all entities in the same table the database would suffer a loss in performance and it would be very difficult to oversea that (important) part of the database (billions of records).

Although I would support a standard e-commerce system (I would probbably be able to use it for other customers) I do believe a standard system just never meets my needs...but, it might be a good startingpoint.
Perhaps it would be good to start with a list of the desired functions here? That would be a start to test whether they are supported by N2 or not and what has to be done?
Could you kick it of? What should be possible from a user and a developer point of view to be able to say "we have e-commerce in N2"?

Aug 7, 2008 at 4:32 PM
My vision of "e-commerce4n2" is more like an e-catalog of a sort:

So imagine a 3-level hierarchy of:
- "Catalog" root item
- "Identity" 2nd level item (or "Category", the other way)
- "Product" 3rd level item with a set of properties, loosely defined by a parent "Identity" (so, basically, typed entity should not be necessary)

Let's call the above a "Master catalog"

Then, for every registered user let's establish a sort of "junction point" -- the similar top-level "Catalog" item, initially bound to this master, in which users will be able to "import" Products from a master catalog; modify them (or, better yet: "override", say hypothetical Price property) and, finally, "publish" at will. Thus building their own "working copies" (using svn jargon) of a master catalog.

I think the idea of such a complex "Catalog" item can be generalised into a sort of imaginary "Active Content Item". That is, an item which underlying hierarchy could be replicated/modified/overriden by users into their own sub-structures. Having such "content-item-hierarchical-template" functionality in place would enable even more interesting scenarios: let's imagine a quick web-mail UI with a predefined set of "folders" (Inbox, Drafts, Sent, Bin), customizable start pages (for which a presentation layer can already be found in a form of "Dropthings" project here, at Codeplex), web storages and what's not..

Now the trick is to work out such a design to make it feasible..
Aug 16, 2008 at 1:00 AM
Hello MartijnRasenberg

I am am trying to create  e-commerce4n2 and would like to do so in the same way you did. As in add new tables to the database. I am kinda new to nhibernate can you please share the steps you had to take to get these new tables to work with N2 and where i can find how to get my business objects to persist to the to these tables with N2 and nhibernate.

Thanks for any help
Elizabeth
Coordinator
Aug 16, 2008 at 1:12 PM
Hi all. Let me know if I can help.

I like the catalog idea. It would also be a way of bridging what could be a separate table of products into the CMS and make them administerable through the same interface.  Most webshops seems to have a single template for the "product" and providing a way of adaping this page to different products would be a great feature.

Maybe a mailing list is a better place to discuss technical details.

If you havn't already take a look at nhibernate alone first. It's a great O/R mapper. N2 only uses a small part of it's features. A few resources that can help:

What N2 does, during initialization:

  • Reads a basic mapping (Default.hbm.xml) for the abstract base class and the detail collections (this is where you could inject your own mapping if you want them to live in the same nhibernate environment as N2)
  • Finds all classes deriving from N2.ContentItem in the application and generates mappings for the nhibernate configuration
  • Builds the session factory from the nhibernate configuration

At each request:

  • Creates a session and stores it in the request's item bag
  • Loads the start page node from a session
  • Find an item matching the requested page following the Children association from the start page (NHibernate will lazy load these collection as needed)
  • Closes the session at end request

To inject your own mappings you can use the configuration <n2><database hibernateMapping="Namespace.MappingFile.hbm.xml, Assembly". You will need to include all of N2's mappings as well if you don't want to break N2's stuff.

Also look at INHRepository<key, entity> (N2.Context.Current.Resolve<INHRepository<key, entity>>()). It's a wrapper around the nhibernate session.

There's probably a better way. Please help me find it.

Aug 20, 2008 at 10:35 AM
@mozts
I have not used NHibernate for new tables, I just used the standard database editors for this...
The link with N2 is using the same ID's in foreign keys, as simple as that...
Aug 20, 2008 at 1:36 PM
Hi,

Sorry for my absense, but I was on a holiday :)

I also use a different table for my user management (default tables just never fit ;)). What I was thinking of was to create some kind of UserProvider which just takes a user ID (nothing more is required than just a simple ID which identifies the user).

Then, every user needs at least:

  • Company Name
  • User Name
  • Email
  • Address
  • Postal
  • City
  • Country
  • VAT

So, creating some kind of IECommerceUser interface which implements these properties would do the job. Then, every software developer can make his/her own convertor between the user database and the ecommerce part. I am also implementing such an interface in my Hour Registration system (which I will make available soon as well).

Coordinator
Aug 20, 2008 at 6:13 PM
Is there a membership provider?
Aug 21, 2008 at 6:43 AM
What do you mean?
Mar 22, 2009 at 2:04 PM
Edited Mar 22, 2009 at 9:55 PM
Just an observation:
there's a promising .net-based e-commerce solution out there: nopCommerce@codeplex. (Some russian guys seem to be doing the right thing, just look at the codebase!)

I wonder does it make sense to start integrating it into N2 (i have a quite positive experience building a data-access provider for a 3rd party project on top of N2 content items. Yeah, yeah, that was my stuff for BlogEngine.Net ;-) ?

Aside from a purely mechanical question of integrating existing product, i see a big problem all e-com solutions have in common -- a challenge that could be tackled alone to create something new and unique to N2: that's a problem of a Product Catalogue i've outlined above. I think solving this one would have a value on it's own (not just for e-commerce purpose, just think of inventory tracking, universal data storage, storing meta-info, say, for a feature-rich image gallery -- every possible taks where a large amount of a structured information should be stored and manipulated).

As is see it, one crucial part of such catalog (aside from a category hierarchy, an ability for user customization/personalization, and so on, as per my raving above) would be an efficient mean to navigate/filter catalog entities by their properties. I know, it's hard to comprehend my narratives, so just look at the filter block at left on dell's catalog page -- this is it. (I dream of building such a thing for 2 years already, that's how i've bumped at N2 in the first place ;-). I'm building a prototype by prototype, but it's only recently that it started to look right in my hands. This seemingly simple filter implementation in fact requires enormous engineering complexity (or is it just me so stupid ?). There's even more advanced case of a product catalog at our local ukrainian service hotline.ua -- notice, when you select some criterias at left, they'll show you a numbers of how many items are remaining/available per criteria. How they calculate these numbers is a greatest puzzle for me. I'd be very happy to collaborate on solving it, given that anybody is willing to tackle this problem too.

UPD: i've forced myself to throw online at least some catalog bits to show the concept i'm talking about (i confess, it's crap, but the vision is clear)
Coordinator
Mar 22, 2009 at 10:09 PM
Are you asking how one could implement such a feature? I'm probably missing the crucial point but I'll try to give this a stab at the risk of humiliating myself =)

Each product is assigned a number of categories (ASUS, 17", etc.). At the database level this will be a many-to-many relationship.

When no category is selected the list of categories is computed against an outer join with grouping and count (pseudocode):

select categories.*, count(products.id) as productsInCategory from categories
    left outer join categorizedProducts on ...
    left outer join products on...
group by categories.*

When one or more categories are selected the query is slightly different:

select categories.*, count(products.id) as productsInCategory from categories
    left outer join categorizedProducts on ...  AND categories.id in (selectedcategory1, selectedcategory2, etc.)
    left outer join products on...
group by categories.*

I have no idea how this would scale. I did read an interesting article on how google combines results on multiple search terms. The link however is lost to me.

One could also build a denomalized matrix of category*category*.. (until the groups are small enough to filter dynamically if needed)

Interesting problem by the way.
Mar 23, 2009 at 7:47 AM
first o'aLL, nice to see that conversation keeps going -- who knows where else could i discuss such a special matters :=)

now, lemme guess what a subtlety is still to be considered in your reasoning above:

your "categories" thing is something i use to call "tags" -- a planar set of descriptors, assigned to an entity on a M:M basis, that is for a computer monitor this might look like this pseudo-JSON (imagine, for a second, that there's a references instead of strings in the list):

monitor: ['17"', 'ASUS', 'TFT', ... ]

that was your mental model, right ?

Now. let's see how it might be done by Dell/HotLine/PriceGrabber folks:

monitor: { Brand: "ASUS", diagonal: '17"', technology: "TFT", ... }

Spot the difference? Instead of a planar set of descriptors, there's already a 2-level hierarchy of a properties and their values. Here values are closest couterparts to your tags. This hierarchy doesn't really matter if we just want to store entities. But it has a great impact on a design of a hypothetical filter block a-la Dell: now we have to consider a different semantics of selecting values of a single property (a), or values of different properties (b). In your case the filter might look like this (a pseudo-HQL to avoid "join" syntax verbosity):

FROM entity AS e
WHERE e.Categories IN ('ASUS', 'ViewSonic', '17"', '22"')

Now see what we're getting with properties/values taxonomy:

FROM entity AS e
WHERE e.Brand IN ('ASUS', 'ViewSonic') AND e.Diagonal IN ('17"', '22"')

So far so good. Now let's guess how they compute magic numbers. First, we have to analyse what these numbers realy mean. Let's call a property, that has at least one value selected a "bound property", so that the opposite will be "unbound". Let's classify magic numbers meaning per value nature:
  1. Selected value (naturaly, it's respective property immediatelly falls into "bound" class by definition): no need to show numbers -- it equals to a COUNT(selected entities).
  2. Unselected values of a "bound" property: a number of aLL entities that selecting this value would yield
  3. Values of "unbound" property: a number of entities from a current selection, that selecting this value would yield
Now, let's sketch algos for cases 2 and 3 :

Case 2: for each unselected value of a bound property the following query should be issued:

SELECT COUNT(e.Brand)
FROM Entity AS e
WHERE e.Brand IN ('ASUS', 'ViewSonic') AND e.Diagonal IN ('17"', '22"')
GROUP BY e.Brand

Notice: the WHERE condition is different for each"bound" property

Case 3: for each value of unbound property

FROM Entity AS e
SELECT COUNT(e.Technology)
WHERE e.Brand IN ('ASUS', 'ViewSonic') AND e.Diagonal IN ('17"', '22"')
GROUP BY e.Technology

The WHERE remains the same all the time, which gives a way for some optimization..

Okay, i think i should do a pause for now..
Apr 5, 2009 at 4:11 PM
Suddenly discovered a whole universe of things that bugged me for a while in regard to information catalogisation, classification, tagging and so on: just go search 'taxonomy' at drupal.org !

Silly me got so excited that even went so far to enforce drupal 6.x to start under Phalanger -- another great effort out there, hope to get it running smoothly the next week..

My resume: drupal has a full load of great conceptual stuff to learn and borrow.
Coordinator
Apr 5, 2009 at 9:19 PM
I can agree there is a lot of interesting stuff coming out of the php community. Especially so when it comes to solutions to the problem of getting stuff in.

The hierarchical for one is very understandable but it doesn't encourage writing content.

Can you point to any concrete modules that are especially interesting?
Apr 6, 2009 at 8:06 AM
Edited Apr 6, 2009 at 9:31 AM
  • Machine Tags -- a rought solution, but has some interesting links on a subject of categorisation
  • Taxonomy API and REST -- in continuation to 'universal data access web service' topic (btw, here they seem to get the REST wrong: they're using url to express both resources and actions, but they should use HTTP verbs for the latter)
  • Taxonomy Manager -- cool UI for tagging, they seem to use jQuery for that
  • Taxonomy Query Language -- their examples suggest that queries with multiple criterias for a single property are possible with drupal taxonomy module
  • Taxonomy Filter -- yet another hint that taxonomy is something close to PriceGrabber/Hotline/Dell approach to multi-criteria filtering
all in all, for me, a 'php dummy', this all seems quite a bizarre adventure, especially looking into code i've got an impression of a total mess the php code is. I wonder what way is better to leverage the most for .net / n2 community ? So far, investigating Phalanger seems to be the right direction, don't you think so ?
Coordinator
Apr 6, 2009 at 7:15 PM
The gut feeling is that using anything but the complete application as is, is going to be pain but I'd love to hear the tale of your adventures. Keep in mind that I've been diagnosed with a cronical case of the NIH syndrome.
Apr 12, 2009 at 12:07 PM
Edited Apr 12, 2009 at 12:09 PM

Certain intermediate result -- with some crutches Drupal 6.x is now running on a recent Phalanger (instructions).

Indeed, its' clear that Taxonomies is what i was dreaming for a long time. It's something i've came close with my N2 Catalogs, basing solely on intuition.

Also, clearly, there's a long road to transfer Drupal's expertise in content management to .Net. But there're certain advantages, say, considering Drupal to be a 'SharePoint done right', it would be nice to be able to integrate it into existing ASP.Net apps. N2 seems to be a good playground for this sort of investigation.

Now, enough fluff, my practical question is this: how hard/useful would it be to introduce a per-addon installation hook in N2 ? Okay, maybe it's not a wright question to ask.. A broader goal i'd like to achieve is to be able to create a dedicated per-item tables, to keep content in a normalized form (see dream #8 of 'materialiser'). Is this kind of thing feasible ?

Apr 13, 2009 at 12:36 PM
Sorry, more questions:

Is it possible to abstract ItemDefintion class so that it could use a database a backing store, instead of reflecting app domain types ? (An obvious answer would be first make a lot of members virtual.)

A recursive one ;-) Where it could be better to post questions like this ? Is there a sort of web services just for posting alot of  brief questions ?
Apr 14, 2009 at 3:41 AM
I am currently building an opensource commerce application.

I am building this with N2 in mind. I am creating just enough abstraction to leave N2 out of the loop. N2 provides the extensibility needed to integrate another framework into it.

Currently, I have built a UI using DynamicData and runs under a seperate app domain (similar to the way Edit is in N2). My application supports complete localization of all fields that reflect configured cultures in N2 (due to implementations of components).

I began investigating wether a commerce system could be built ontop of N2 but I decided not to. Mainly because I want to have support for new N2 versions and I want users to have the ability to run my app with their own presentation layer rather than strictly N2.

I can create a template pages (under a store page) that is used for categories and products. I created a part that renders content. In the content you can put {{Price}} or {{Description}} to give client complete control over the UI. I also created  parts for most popular products, and category products, etc.

Does anyone want to help me on this open source project?
Apr 14, 2009 at 6:41 AM
You say "Open Source" ? Then, show me the code, plz! :-)

Let's put down what does an e-commerce mean. I see following blocks:

  • catalog (product specification, classification, comparison, media information)
  • shopping cart (a personalised product selectionon a per-user basis)
  • inventory tracking ("how much of a product remains on a stock?")
  • check-out engine (payment/shipping gateways, taxes)
  • social network capabilities (ratings, reviews -- possibly, it's overlaps with a 'shopping cart' above OR a 'catalog' engine?)
Anything else ?
Ideally, all parts should be abstracted of each other and be interchangeable. This is what most e-comm. sollutions fall short: one project cannot possibly cover all of the areas above.

Recently, i had an iteresting talk with owner of a major local (.ua) online payment provider. He told, that given the above list of modules, the "online payment" should be and, in fact must be implemented the last. I can explain it so that only when all business processes are functioning well (catalog, inventory, cart), we can start thinking about payments, that is "money", that is a "commerce" per se.

I'd be definitely interested in the first block, "catalog" (that's why my recent obsession with Drupal's taxonomies). I'm building it with an idea of possibly integrating into some other solutions, why not into an e-commerce proj. ..
Apr 14, 2009 at 7:28 PM
By the way, am i the last to discover Magento e-commerce? OMG, what a beautiful beast ! (Cannot help but notice how many great projects are already in existence!)
Apr 14, 2009 at 7:37 PM
I have used magento and can say that its very good system but not very fast and effective. It has many marketing options, inventory system, group discounts and e.g.
Apr 15, 2009 at 5:49 AM
@SerZHio
sounds good (except for performance;-). I wonder would it be possible to run it under Phalanger, to reuse it from existing ASP.Net apps.
Apr 15, 2009 at 9:15 AM
I did not have it hosted on a svn but it is about time I do. I just published what I have to codeplex for you to check out. It is far from done. All I have done right now is the catalog and it's integration into N2CMS. It looks promising though ;)

http://flexicommerce.codeplex.com/SourceControl/changeset/view/7291
Apr 15, 2009 at 1:15 PM
I have used Magento too and I have to agree on the speed (disappointingly slow) -- The system itself is wonderfully well thought out and makes up for many of the shortcomings of other eCommerce systems out there.  Speaking of open source PHP projects -- has anyone looked at SilverStripe CMS?  Just was included in the MS Web Platform Installer...  Their development API is strikingly similar to N2:  http://doc.silverstripe.com/doku.php?id=tutorial:2-extending-a-basic-site  The admin interface is also very slick (and reminiscent of N2)
Apr 15, 2009 at 5:06 PM
Edited Apr 15, 2009 at 5:20 PM
@theonlylawislove
Could you deploy your system developed on some server for test purposes?
Apr 15, 2009 at 6:24 PM
I'm sorry, but I don't have a internet facing server available to me.
Apr 15, 2009 at 7:31 PM
@theonlylawislove
Cool! I'm gonna inspect it closer. How do you think, would it be possible to separate catalog and the rest of the system (shopping cart, check-out, payment) ? Say, i want to assemble a catalog from old plain N2.Templates' TextPages, and just put a sort of "Buy It" link on each ?

@jemerick
How do you think, does it make sense to put some effort into running Magento on ASP.Net under Phalanger ? With the latter they promise a performance boost, so i wonder would it be an advantage. (Recently, i dug quite deeply into Phalanger, thus see some areas worth improving (e.g.: better session handling), the only question: would anybody be interested at the end..)

@SerZHio_hiper
let's better ask theonlylawislove for a pre-compiled package with all binaries and db included -- ASP.Net Web Server Here is by far the best demoing tool

Apr 15, 2009 at 8:22 PM
I think it would be improbable, if not impossible, to abstract the catalog from everything else. IMO, commerce applications require enforced integrity that can only be applied with foreign keys and the such. How do you think you could handle situations like deleting categories (or contentitems)? How would the system react to this wild mapping to a non existent category?

In my solution, it's important to only abstract the store from N2 for the store to be used in non N2CMS systems. I could provide points of extensibility for your situation (abstract catalog), but what about the integrity issue? Also, I think your situation could be better approached when looking at a clear seperation between N2 and the store. What I mean is that your situation could be solved by adding a contentitem page, lets call it a productpage. The product page can have an editable field for getting a productID to be associated with the productpage. The field can render realtime products from the store. Expose a property CurrentProduct that retrives the product based on the productID detail. Parts can be make specifically for the product page (buy now, images, reviews, etc) that depends on CurrentPage.CurrentProduct.

I think this solution is only viable for people with a few products. Creating pages and then putting parts on them would be a massive project when you require 100+, even 30+ products. My solution takes on a templated approach but maybe I could support this also.

When I have some free time, I will compile that site for you guys ;)
Apr 16, 2009 at 11:54 AM
@theonlylawislove
could you please outline briefly on what technology your solution is based ? i mean these strange System.Web.DomainServices things -- is it netfx 4 ? I've tried building it with no luck so far :-/
Apr 16, 2009 at 3:21 PM
When I initially read your first sentence, I thought "He sees the resemblance to N2!". I like the design of N2 so I started with N2's concept of IEngine and IPersister.

But as for the dependencies, it's part of .NET RIA services which are planned to be RTM in .net 4.

DomainServices allow for abstracting the UI from the BL. You can also register a domainservice as a metamodel provider with dynamic data preview 3. Right now, I have NHibernate sitting on top of DD :-). Best of both worlds!

Have you used DD before or are you familiar with it? Very efficient and robust.
Oct 7, 2013 at 3:12 PM
@theonlylawislove
Have there been any further developments to integrate N2 with Nop Commerce?
Coordinator
Oct 7, 2013 at 5:18 PM
@MrBoesch, I haven't seen anything. I would love to bring ecommerce functionality to N2 but there are perhaps better ways of doing this rather than trying to merge two very large software projects together (or even make them talk to one another).
Creating pages and then putting parts on them would be a massive project when you require 100+, even 30+ products. My solution takes on a templated approach but maybe I could support this also.
You could just create a page type which would avoid the need of dragging parts onto many pages individually. You could easily re-template things as needed.

I think the most difficult pieces would be inventory management and user management. In particular:
  • Would it be possible for N2 to expose the same interface that Nop Commerce uses for payment providers?
  • Can we make it easier for people to sign up, log in, etc. to N2-based sites, perhaps with a more cross-platform sign-up/login widget?
If people are interested in supporting this effort I can try to help in some way. But I can't do it all by myself!

Cheers,
Ben