• Welcome to KonaKart Community Forum. Please login or sign up.
 

How to get product "Custom Relationship 1"?

Started by Asset, May 15, 2012, 02:50:04 pm

Previous topic - Next topic

Asset

Dear All,

In version 6.2 there is new custom attributes called "Custom Relationship 1,2,3" for the merchandising of the product?

How can I fetch the products assigned to these customs? I searched for something like " kkAppEng.getProductMgr().fetchRelatedProducts()" in the APIs but I didn't find ?

Could you please help?

julie

Just use the getRelatedProducts() API call of the engine:

ProductsIf getRelatedProducts(java.lang.String sessionId,
                              DataDescriptorIf dataDesc,
                              int productId,
                              int relationType,
                              int languageId)
                              throws KKException
Find products related to the product defined by the productId parameter.
The relationType defines the relation. Valid values for relationType are:

com.konakart.bl.ProductMgr.ALL_RELATIONSHIPS: All relationships. Returns all related products.
com.konakart.bl.ProductMgr.UP_SELL: Up Selling. Normally a superior version of the same product.
com.konakart.bl.ProductMgr.CROSS_SELL: Cross Selling. Normally similar or related products.
com.konakart.bl.ProductMgr.ACCESSORY: Accessories
com.konakart.bl.ProductMgr.DEPENDENT_ITEM: Dependent Item. Normally cannot be sold independently such as a warranty.
com.konakart.bl.ProductMgr.BUNDLED_PRODUCT_RELATIONSHIP: This relationship can be used when productId is the id of a "bundle" product. It returns all products that are part of the bundle.
com.konakart.bl.ProductMgr.CUSTOM_RELATIONSHIP_1: Custom Relationship
com.konakart.bl.ProductMgr.CUSTOM_RELATIONSHIP_2: Custom Relationship
com.konakart.bl.ProductMgr.CUSTOM_RELATIONSHIP_3: Custom Relationship
When all relationships are returned by setting relationType to 0, the prodRelationType attribute of the returned products is set, so that the information about the type of relationship is not lost.

Parameters:
sessionId - The session id of the logged in user
dataDesc - Used to control the data offset, limit the number of items returned and set the sort order. It may be null, in which case, the number of retrieved products is limited to a default number, the products are ordered by the ProductId and the offset is set to zero.
productId - The numeric id of the product
relationType - The numeric relation type defining up selling, cross selling etc.
languageId - The id for the language that will be used. Value of -1 selects the default language.
Returns:
Array of products
Throws:
KKException

Asset

thanks julie  for your help  :) I will try this solution.