Macro condition of SKU Category

merav tg asked on May 15, 2016 11:07


i want to create a catalog rule i want to apply it on the SKU Category. the category i create in the categories application and add to the Product in the product application.

i want to create a macro that basically ask: is product category = X.

but i don't know where can i find the category in the tree.

please advise.


Recent Answers

Trevor Fayas answered on May 16, 2016 15:25

Often when i need to figure this out, i use SQL Management studio to take a look at the table structure to see where the relationship is stored.

In the database i see a COM_SKUOptionCategory, COM_OptionCategory, however these may be more partaining to Sku Options than Skus.

SKUs also have an associated Document ID if they are not a sku option or something similar, so the relationship may be in the DocumentCategory Table.

I'm sorry i don't have the time to create a test, but this is what i would do.

  1. Add a category to a sku
  2. Check to see if that relationship is between the SKU's Document (in CMS_DocumentCategory), or if it's in the COM_SKUOptionCategory table.
  3. Once you have that, use this macro, adjusting the where condition:
    SiteObjects.SKUs.Where("the where condition here").FirstItem

The where condition will depend on where the relationship is, but something like SKUID in (Select SKUID from _______ where CategoryID = (select top 1 CategoryID from THEJOINTABLE where CategoryName = 'mycategory'))

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.