3

We are migrating our legacy application in sitecore. We have a large database that we want to reuse in our sitecore application specially dbo.Product table. Product table contains ProductName, ProductID and other foreign key references. We are using buckets for Product creation in sitecore, I want to create all the Products from external database with existing fields(ProductID, ProductName etc) and apply corresponding renderings.There are many child items under each product. What is the best approach to solve this puzzle?

Product Structure :enter image description here

14
  • I'm not sure I fully understand. Can you expand on your question to make it clearer? For example, what do you mean by 'There are many child items under each product'? Oct 18 '16 at 12:03
  • Do you just want to expose your products from your current database in Sitecore? If so you don't actually need to import them as such. There are ways to pull the products in as items as if they exist in Sitecore - even though they actually don't. Are you able to maintain the existing database or do you need to get rid of it? If so this might be an option for you. As Martin says we'd need to see more info on your current data structure to help recommend the best approach. Oct 18 '16 at 12:10
  • I don't want to maintain my existing database. We want to create products in sitecore database.
    – Sandeep
    Oct 18 '16 at 12:12
  • @MartinDavies Suppose we have Product named AA then childs of this Product AA is bb, cc, dd and bb have further childs bb1, bb2 etc.
    – Sandeep
    Oct 18 '16 at 12:14
  • 1
    Consider using the Data Exchange Framework. Oct 18 '16 at 12:29
1

I would discourage you from copying your items into bucket in this case. According to Sitecore's documentation:

When you store items in an item bucket, the parent-to-child relationship between the items is removed, and instead the items are organized in a folder structure according to the date and time they were created. Therefore, the item buckets feature is primarily designed for storing content items that do not need to be stored in a hierarchy.

Your description of a problem states that you do have an important parent-to-child relationshipt. In such a case I would recommend one of the two possible solutions:

  1. If you have small number of products (I assume 3k is number of all the items including FAQs, newsletters, etc.) you can easily go with importing them as regular items

  2. If you plan to have larger database of products you could add only the products into a bucket and other items (FAQs, newsletters, etc.) as regular items under a separate item and connect them using for example multilist.

Does this approach solves your problem?

1
  • I am using branch template in order to create child items.
    – Sandeep
    Oct 18 '16 at 13:33
0

To import the items you could for example create a script using a bit of C# combined with the Sitecore Powershell module. Or you could do it purely in Powershell if you can extract the current data into a CSV. The module comes with a bunch of examples to get you started.

If you want to import the data into a products bucket but still retain the relationship between the product and the child items, then you need to remember to lock the relationship at the template level.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.