Developer forum

Forum » Development » Loading product information from custom tables

Loading product information from custom tables

Anders Ebdrup
Reply

Hi,

 

Does anyone know how to load information from custom tables into the products, so it is accessible in the frontend on the product list?? And at the same time make it possible to search into these related tables when searching for products?

 

Best regards,

Anders


Replies

 
Nicolai Høeg Pedersen
Reply

Rendering them while listing/showing products can be achieved using a product template extender.

 

Getting them into search, you need to extend the Lucene indexing, see docs here:

http://developer.dynamicweb-cms.com/documentation/for-developers/ecommerce/indexed-search/introduction.aspx

 

BR Nicolai

 
Anders Ebdrup
Reply

Hi Nicolai,

 

Thanks for reply. Regarding the last part with the search index; how do I put in values/fields into the product index, which does not belong to the product table?

 

Anders

 
Nicolai Høeg Pedersen
Reply

That is an excellent question.

 

I'll have someone clever than me answer that one. Will get back.

 

BR Nicolai

 
Pavel Volgarev
Reply

Hi Anders,

 

There's a possibility of modifying the contents of the index by creating an indexer (or data provider). More details can be found here: http://volpav.wordpress.com/2010/12/22/new-search-in-dynamicweb-creating-your-own-index/. Note that the "index" argument in IndexerIdentityAttribute constructor must have a value "Products". Otherwise the system will think that you're creating a completely different index.

 

To use the new field you'll have to create a custom filter (since the system doesn't know anything about the fields you're adding). Here's an article that will get you started with custom filters: http://volpav.wordpress.com/2010/12/07/new-search-in-dynamicweb-developing-your-own-filters/.

 

-- Pavel

 

 
Jeppe Eriksson Agger Dynamicweb Employee
Jeppe Eriksson Agger
Reply

What about product categories?

 

- Jeppe

 
Anders Ebdrup
Reply

Hi Pavel,

 

Thanks for the reply. If I create a new ProductIndexer will it then work by inherit from the existing indexer;

    [IndexerIdentity("Products", "Products")]
    public class ProductIndexer: Dynamicweb.eCommerce.Searching.Index.ProductIndexer
    {
        protected override IEnumerable<IndexEntry> Index(IndexerDataRequest request)
        {
            ICollection<IndexEntry> entries = base.Index(request).ToList();

            // TODO: add new fields

            return entries;
        }
    }

And then just add the new fields in here or should all code from you indexer be copied and create my own: ProductIndexEntry?

 

Best regards, Anders

 
Anders Ebdrup
Reply

Hi Pavel

 

Any update on this one?

 

Best regards, Anders

 
Pavel Volgarev
Reply

Hi Anders,

 

It's not going to work with way. And you can't "extend" existing index entries with your own data, you can only add additional ones (that might or might not have the same schema). We can fix this by introducing the notification subscriber that will receive a list of index entries and the data request so you will be able to actually extend any document of any indexer before it gets committed. Is this the way to go, what do you think?

 

-- Pavel

 
Anders Ebdrup
Reply

Hi Pavel,

 

Yaahh! That sounds great! Otherwise I will have to replicate all your logic for the product indexing and not take advantage of bug fixes/new functionality! :-)

 

I am looking very much forward to this feature!

 

Best regards, Anders

 
Anders Ebdrup
Reply

Hi Pavel,

 

Do you know the time frame for this notifier to get into Dw?

 

Best regards, Anders

 
Anders Ebdrup
Reply

Hi Pavel,

 

Any news about this topic? Remember that it should be possible to set the "IndexEntryFieldInfo" for each field.

 

Best regards, Anders

 
Pavel Volgarev
Reply

Hi Anders,

 

I've asked my colleagues to prioritize the item (TFS #12158). As it's a relatively small and "safe" change, I hope they'll give a green light and it will make it to the next release.

 

-- Pavel

 
Anders Ebdrup
Reply

Hi Pavel

 

Have you got green light for this change? And will it be in next hotfix?

 

Best regards, Anders

 
Morten Snedker
Reply

Hi Anders,

 

The light is green. It will not be in a hotfix though, but is planned for release in 8.3.

 

Regards /Snedker

 
Pavel Volgarev
Reply

Hi Anders,

 

I'm pleased to announce that the functionality you requested has been implemented (slightly differently than we agreed though) and is now being tested (will be out in 8.3 I guess). I've also blogged about this: Adding additional fields to the index.

 

-- Pavel

 
Anders Ebdrup
Reply

Thanks! I am looking very much forward to use this approach!

 

Best regards, Anders

 
Anders Ebdrup
Reply

Hi Pavel,

 

I have one thought about this implementation and it is about performance. Now is seems like every product is handled one by one and it does not seem to benefit from the paging structure of the ProductIndexer?

 

Is it meant that I will have to implement custom ProductIndexer which inherits from the current ProductIndexer and in the retrieval cache the values so it is accessible in the SurrogatEntry as the indexing process at the moment takes very long time for only 100.000 products with some custom product fields?

 

Best regards, Anders

 
Anders Ebdrup
Reply

Hi Dw,

Have you made some performance considerations for this approach when indexing approx. 250.000 products? With this approach it seems that the values have to be fetched one at the time...

Best regards, Anders

 

You must be logged in to post in the forum