Tuesday, 1 October 2013

Category Pages for Mobile Devices - ( default Devicefmt_id taking precedence over the configured devicefmt_id. )

If you landed up here, You were most probably looking for how you could have a totally different set of catalog asset , for one of the various smart devices .

You will have to define the new catalog Asset in the DISPCGPREL table. This table holds the page names used to display CatalogGroups . The selection of page name is based on Store , MemberGroup , DeviceType  , CatalogGroup & Language . 
Catgroup_id = 0  implies that the page is for all catalogs . 
storeent_id = 0 implies that the page for the catalogGroup is for all stores published . 
Mbrgrp_id = 0 implies that the page is for anybody accessing the site. 

DEvicefmt_id = -1 defines that the device accessing the page is a web browser.

Entirely different pages can be displayed for CatalogGroups based on the language as is evident.
Problem :
You have defined a new configuration in the DISPCGPREL table for a non-default device format, that is, a value not -1, however the new configuration is not used. Instead, a category-specific page for the default device format is instead used
You want to configure a unique  Categories display page for a mobile device.  or 

You want to configure a unique subCategories display page for a mobile device.

Resolving the problem


For example, if you have defined the following entries in the DISPCGPREL table:
  1. CATGROUP_ID = 10001, DEVICEFMT_ID = -1, RANK = 2, PAGENAME = /Store/Page1.jsp,
  2. CATGROUP_ID = 0, DEVICEFMT_ID = -2, RANK = 2, PAGENAME = /Store/Page2.jsp
Zero is the fallback value for the catalog group and -1 is the default device format.
WebSphere Commerce implements the following query to retrieve the page based on these parameters:

  • Store
  • MemberGroup
  • DeviceType
  • CatalogGroup
  • Language

SELECT T1.DEVICEFMT_ID, T1.MBRGRP_ID, T1.DESCRIPTION, T1.PAGENAME, T1.OID, T1.FIELD1, T1.RANK, T1.STOREENT_ID, T1.FIELD2, T1.DISPCGPREL_ID, T1.CATGROUP_ID, T1.LANGUAGE_ID, T1.OPTCOUNTER
FROM DISPCGPREL T1
WHERE (T1.STOREENT_ID IN(?,?) or T1.STOREENT_ID=0)
and (T1.catgroup_id=? or T1.catgroup_id=0)
and (T1.devicefmt_id=? or T1.devicefmt_id=-1)
and (T1.MBRGRP_ID=? or T1.MBRGRP_ID=0)
and (T1.LANGUAGE_ID=? or T1.LANGUAGE_ID is null)
order by T1.mbrgrp_id desc, T1.CATGROUP_id desc, T1.STOREENT_ID desc, T1.RANK asc


If a request is made using the following parameters: CATGROUP_ID = 10001 and DEVICEFMT_ID= -2,
given that the catalog group has precedence, /Store/Page1.jsp is returned. This page corresponds
to the row with DEVICEFMT_ID = -1, not -2.


To force the page with devicefmt -2 to be returned, you must insert a new row in the table
for the specific catalog group with a rank that is lower than the rank used for the default device format (-1).
For example:

  1. CATGROUP_ID = 10001, DEVICEFMT_ID = -1, RANK = 2, PAGENAME = /Store/Page1.jsp .
  2. CATGROUP_ID = 0, DEVICEFMT_ID = -2, RANK = 2, PAGENAME = /Store/Page2.jsp .
  3. CATGROUP_ID = 10001, DEVICEFMT_ID = -2, RANK = 1, PAGENAME = /Store/Page2.jsp .

If you query again using CATGROUP_ID = 10001 and DEVICEFMT_ID= -2, row 3 is returned, which is specific for device format -2 .

No comments:

Post a Comment