Wednesday, December 14, 2016

Blank CRS Home Page when running on Endeca

CRS home page is a endeca page and gets the content from the Experience Manager.
If there is no default site id configured in XM, then CRS home page will be blank.
To add the default site, follow below steps.

1. C:\Endeca\Apps\<App-name>\control\runcommand.bat IFCR exportApplication <App-name>
2. Unzip and edit C:\Endeca\Apps\<App-name>\control\<App-name>\pages\_.json to add "defaultSiteId": "/storeSiteUS"

{
    "ecr:createDate": "2015-11-26T22:15:35.205-06:00",
    "ecr:type": "page-root",
    "defaultSiteId": "/storeSiteUS"
}

3. C:\Endeca\Apps\<App-name>\control>C:\Endeca\Apps\<App-name>\control\runcommand.bat IFCR importApplication <App-name>


Friday, November 11, 2016

Adding New Pricing Calculator

The below example shows on how to add a new item price precalculator to calculate the wholesale price.


  1. Create a new class ItemWholeSalePriceCalculator extending ItemPriceCalculator class similar to ItemListPriceCalculator to calculate the whole sale price of each commerceItem.

public class ItemWholeSalePriceCalculator extends ItemPriceCalculator{
  protected void priceItem(double pPrice, ItemPriceInfo pPriceQuote, CommerceItem pItem,
                           RepositoryItem pPricingModel, Locale pLocale,
                           RepositoryItem pProfile, Map pExtraParameters)
    throws PricingException{
      double totalPrice = NumberUtils.multiply(pPrice, pItem.getQuantityDerivedAsFloatingPoint()).doubleValue();
      pPriceQuote.setAmount(totalPrice);
  }
}

2. Create a new component ItemWholeSalePriceCalculator similar to ItemListPriceCalculator component to handle above class.
$class=atg.commerce.pricing.ItemWholeSalePriceCalculator

loggingIdentifier=ItemWholeSalePriceCalculator
pricePropertyName=wholeSalePrice
requirePriceValue=false
priceFromCatalogRef=true

pricingTools=/atg/commerce/pricing/PricingTools


3. Override the values of ItemPricingEngine component to add the new calculator ItemWholeSalePriceCalculator.

/atg/commerce/pricing/ItemPricingEngine.properties
preCalculators+=\
calculators/ItemWholeSalePriceCalculator


Tuesday, October 11, 2016

PermissionDeniedException while creating site agents in BCC

When creating site agents in BCC, there is error in logs:
Caused by: CONTAINER:atg.repository.RepositorySecurityException; SOURCE:atg.security.PermissionDeniedException: You do not have read access to the project item descriptor.
        at atg.adapter.secure.GenericSecuredRepository.checkAccess(GenericSecuredRepository.java:457) [_DAS_slib_sclasses.jar:]
        at atg.adapter.secure.GenericSecuredRepositoryView.executeQuery(GenericSecuredRepositoryView.java:401) [_DAS_slib_sclasses.jar:]
        at atg.repository.rql.RqlStatement.executeQuery(RqlStatement.java:227) [_DAS_slib_sclasses.jar:]
        at atg.repository.tojava.runtime.RJSupport.executeRqlStatementForOne(RJSupport.java:1121) [_DAS_slib_sclasses.jar:]
        ... 42 more


This is caused because there user selected the project and then trying to create the agents.
The workaround is logout and login directly to <bcc-url>/atg/atgadmin and create the agents.