2

I'm updating a data feed export, which links a Product to a given Category. I want to also include that product's merchandising position within that category, which currently exists in Business Manger, and is used to control sorting on Product listing pages:

Screenshot of Business Manger highlighting field in question

I'm digging through the API docs, and the logical place for this information to be exposed in in dw.catalog.CategoryAssignment, but it's not there. I'm currently inferring the position by essentially doing this:

// assume var product, category
var position = category.products.firstIndex(p => p.ID == product.ID);

However, this tells me where the Product got sorted to, not what the actual Position value is within Demandware. It works for now as an expedient hack, but I really want to replace it with something that pulls the actual value from DW.

Where in the Commerce Cloud API can I find the merchandising position for a given Product in a given Category?

DeathB4Decaf
  • 390
  • 1
  • 10

2 Answers2

0

I think you would'nt get the actual position of the product index as you may have multiple sorting rules to display different outputs on the category listing pages. These sorting rules can be created as and when required based on certain rules. I don't think this can be reflected on the product feed.

Shrikant
  • 1
  • 2
0

It took some digging, but I managed to find that the "Position" field for Products in the BM is stored as Product.searchPlacement. To find it, you have to look in Category.products, find the Product you want, and grab the searchPlacement property of that product.

In effect, I used:

// assume var product, category
var position = category.products.find(p => p.ID == product.ID).searchPlacement;

For Products that don't have a Position assigned in the Business Manager, searchPlacement is 0. Otherwise, it reflects the value entered in the BM.

DeathB4Decaf
  • 390
  • 1
  • 10