+1-888-365-2779
Try Now
More in this section

Forums / General Discussions / Create Multiple Categories

Create Multiple Categories

11 posts, 0 answered
  1. Asif
    Asif avatar
    110 posts
    Registered:
    18 Nov 2010
    16 Dec 2010
    Link to this post
    Hi,
    I am usning my custom module. I want a functionality when admin creates a product add a cateogry then admin can select multiple categories.
    Please find my attached screenshot. Please help.
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    17 Dec 2010
    Link to this post
    Hi Asif,

    You need to create a custom metkeys ( User Manual , page 214 ,Adding Custom Fields) for each new filed you want to add. Then create a control that is bound to all categories, similar to this one I sent you here. Note that you should use a custom or user control that implements ITextControl interface.

    Best wishes,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. Asif
    Asif avatar
    110 posts
    Registered:
    18 Nov 2010
    17 Dec 2010
    Link to this post
    Hi,
    I believe my question wasn't so much clear.
    i want my client to create a product with multiple categories. That means If my client creates a product then he can choose multiple categories. The scenario is after creation of the product when my client goes to categories section and click on the category then it should point to the related product.
    For example if there are 4 categories are linked to a product then on clicking on each category the product title should appear. I am not sure how to create a link between multiple categories to a single product.
  4. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    20 Dec 2010
    Link to this post
    Hi Asif,

    You need to create several metakeys which will act the same way as the default Category metakey. Out of the box you cannot set more than one value to a given metakey. You need to query the IContent object for each metakey you have created, so you can get its value. The IContent has two methods that you can use to get /set metadata - GetMetaData and SetMetaData

    Greetings,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  5. Asif
    Asif avatar
    110 posts
    Registered:
    18 Nov 2010
    20 Dec 2010
    Link to this post
    Hi,
    If you can provide me any sample code that will be really help full. Because I am not sure how to achieve this task.
  6. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    20 Dec 2010
    Link to this post
    Hi Asif,

    The articles from the links in the previous post provides examples about the functionality you need.

    All the best,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  7. Asif
    Asif avatar
    110 posts
    Registered:
    18 Nov 2010
    21 Dec 2010
    Link to this post
    Hi Again,
    I have spent so much time in creating the screen shots. Please have a look at them because I am not sure if  I am explaining clearly. The scenario is.
    1. product-screen.jpg, In this screen I have created a functionality to add multiple categories in a product. and then I have created a 1 meta Field to store the multiple categories. I am concatenating multiple categories in a single meta field by using "|" symbol. I cant create multiple metafield in a web.config because I am not sure how many categories user can add in single product because it is a dynamic.
    2. cat-screen.jpg, the issue i am facing is if i go to categories page and click on the category (i added in product) then it doesnt point or link to the related product. Because I am not doing any thing to create a relation between the categories and product. I am just only storing the multiple categories with "|" symbol in only one metafield.
  8. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    21 Dec 2010
    Link to this post
    Hello Asif,

    You can add dynamic types without any modifications to the web.config. You can work only with the API

    Manager.MetaKeys.Add(new KeyValuePair<string, IMetaInfo>("field", new MetaInfo("someval", MetaValueTypes.ShortText)));

    so you will not have problems with CategoriesView.

    Kind regards,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  9. Asif
    Asif avatar
    110 posts
    Registered:
    18 Nov 2010
    22 Dec 2010
    Link to this post
    Lets say If I am using this code to add categories dynamically. My question is

    How they will store into sf_GCMetaData?? For example I have added 3 categories so the column "KeyValue" should be "Cat1, Cat2, Cat3" and column "ShortText" will be "abc","def","ghi"? But, how to create a link or relation between the categories and the product? I know the categoriy's names will be storing into the sf_GCMetaData table but how to create a link between category table and this. If user goes to Admin/Categories page then on clicking on any category how the specific product will be linked?
  10. Asif
    Asif avatar
    110 posts
    Registered:
    18 Nov 2010
    24 Dec 2010
    Link to this post
    Hi,
    I didnt hear any response. Please help me out.
  11. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    27 Dec 2010
    Link to this post
    Hello Asif,

    The identifier will be your product. The categories are metadata which are set for the content item. You should get the content item and then its metakeys. Thus you will know all variables associated with your content item.

    Best wishes,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Register for webinar
11 posts, 0 answered