Tuesday 3 December 2013 1 comments

Creating new ATG module with Merchandizing / ATG BCC setup for new module



Step 1:
Create two domains with two ports associated. Let’s take dshop, dbcc for example. And set protocol.jar file in “classpath” of startWeblogic.cmd file in both the domains. (Refer previous post for how to create a new domain)
Step 2:
Create Database Users. (Refer previous post for how to Create Database Users using Oracle and sql developer).
Creating users using MySQL:
i.                     create database dshop;

ii.                   CREATE USER 'PROD'@'localhost' IDENTIFIED BY 'PROD';
iii.                  grant all on *.* to 'PROD'@'localhost';

iv.                 CREATE USER 'PUB'@'localhost' IDENTIFIED BY 'PUB';
v.                   grant all on *.* to 'PUB'@'localhost';

vi.                 CREATE USER 'A'@'localhost' IDENTIFIED BY 'A';
vii.                grant all on *.* to 'A'@'localhost';

viii.              CREATE USER 'B'@'localhost' IDENTIFIED BY 'B';
ix.                 grant all on *.* to 'B'@'localhost';
Step 3:
i.                     Run “startWeblogic.cmd” file in both the domains.
ii.                   Run cim.bat which is located in <<ATG_DIR>>\home\bin\cim.bat
iii.                  Create schemas required.
Step 4:
i.                     In eclipse, create a new ATG module (say MyShop) under ATG installation path.
ii.                   Fill in all the details and proceed. (Refer previous post for creating new ATG module )
iii.                  Create Data Sources Properties files for shop.
As we are using switching data sources we have to give the bellow configurations.
iv.                 in /atg/dynamo/service/jdbc  folder
JTDataSource.properties must point to production (core) datasource,
DirectJTDataSourcemust point to production (core) datasource,
SwitchingDataSourceAmust point to DataSourceA,
SwitchingDataSourceBmust point to DataSourceB.

In ProductCatalog.properties, PriceLists.properties, SiteRepository.propertiesthe dataSource should be pointed to SwitchingDataSource(in case of switching data base otherwise no need of these properties files.)


v.                   Edit Manifest.MF with ATG-Required property.

Manifest-Version: 1.0
ATG-Config-Path: config/
ATG-Required: DAS DCS DPS PublishingAgent
ATG-J2EE: j2ee-apps/kshop
ATG-EAR-Module: j2ee-apps/kshop
ATG-Class-Path: bin


vi.                 Edit build.xml as required for application assembly.

vii.                Create a new folder “Versioned” inside your new module (MyShop/Versioned).
viii.              Create config folder inside (MyShop/Versioned).
Configurations must be as following:

ix.                 in /atg/dynamo/service/jdbc  folder
JTDataSource.properties must point to publishing datasource,
DirectJTDataSourcemust point to publishing datasource,
SwitchingDataSourceA must point to DataSourceA,
SwitchingDataSourceB must point to DataSourceB.


In ProductCatalog.properties, PriceLists.properties, SiteRepository.properties the dataSource should be pointed to publishing(in case of switching data base otherwise no need of these properties files.)


In DirectJTDataSource_production.properties, change JNDIname to core(prod) data source
In other xxxxxx_production.properties, change data source to switching datasource.

x.                   Create Manifest.MF file in (MyShop/Versioned). Edit it as shown below.
xi.                 Edit build.xml to include another target for versioned
(<arg line=" -m DafEar.Admin MyShop MyShop.Versioned" />)

xii.                After build, once BCC server is up with no errors, if we are not able to open bcc page, we need to do the below things:
a.       In <ATG-DIR>/home/localconfig/atg/dynamo/service/jdbc/ (create one if you don’t find it!) folder
create new files FakeXADataSource.properties and JTDataSource.properties.
In FakeXADataSource.properties, add below lines:
$class=atg.service.jdbc.FakeXADataSource
URL=jdbc:oracle:thin:@localhost:1521/xe
user=publishing_username
password=publishing_password
driver=oracle.jdbc.xa.client.OracleXADataSource(driver class)
In JTDataSource.properties, add below lines
$class=atg.service.jdbc.MonitoredDataSource
dataSource=/atg/dynamo/service/jdbc/FakeXADataSource

b.       Run <ATG-DIR>/BIZUI/install/importBizui.bat


NOTE: While running, if you get any SQLExceptions w.r.t drivers, we should add CLASSPATH with driver(ojdbc14.jar) path and add the path(path to ojdbc14.jar) to PATH variable.
Thursday 14 November 2013 1 comments

How to configure Currency Code for Price Info in ATG / changing priceInfo.currencyCode value in atg


 PricingTools Determine the Pricing Locale. PricingTools returns the configured defaultLocale property. The pricing engines use this to determine the currency code. If you are using Oracle ATG Web Commerce’s multisite feature and want to use different currency codes for different sites, you can take the following steps:
  1. Add a pricing locale to the Site repository items.
  2. Override the PricingTools.getDefaultLocale method to retrieve the currency code for the site


    Instaed of overriding  PricingTools.getDefaultLocale method what you can also do is:

    1. Create the following folder structure 





    2. In PricingTools.properties add the bellow property, build and verify.

    defaultLocale = <<your desired locale>>

    eg: defaultLocale = en_IN (for india) this locale will return currency code as INR.



    FOR ANY QUERIES KINDLY POST A COMMENT.









0 comments

Products Not Getting Displayed in ATG / Products Not Getting Displayed for Anonymous user in ATG

If you are not able to see the products in the module you created in ATG or Products Not Getting Displayed and no error is there in your server console then:

Probably this might be because of null value in the default catalog in the profile when it is getting created. to overcome this:

1.  Create folder Structure similar to the following




2. In CatalogTools.properties add

defaultCatalogId=<<Some catalogId you have already created>>

eg: defaultCatalogId=catalog20004


Build and check the output. This will help.


FOR ANY CLARIFICATIONS KINDLY POST A COMMENT.
1 comments

How to display products and skus in ATG, How to add a Sku to cart, How to display Sku images

After Creating New ATG MODULE,( Refer Previous Post Here)




Use the Following Out Of the BOX Atg droplets to display. Code Snippet is as shown bellow:

   

<%@ taglib uri="http://www.atg.com/taglibs/daf/dspjspTaglib1_0" prefix="dsp" %>
<dsp:importbean bean="/atg/userprofiling/Profile" var="Profile"/>
<dsp:page>
<dsp:droplet name="/atg/dynamo/droplet/ForEach">

        <dsp:param name="array" bean="/atg/userprofiling/Profile.catalog.allRootCategories" />
          <dsp:param name="elementName" value="category" />
        <dsp:oparam name="output">
         <br/>

            <dsp:a href="categoryNavigation.jsp">

                <dsp:valueof param="category.displayName" />

                <dsp:param name="categoryId" param="category.id" />

            </dsp:a>

        </dsp:oparam>

    </dsp:droplet>

</dsp:page>


categoryNavigation.jsp:


 <%@ taglib uri="http://www.atg.com/taglibs/daf/dspjspTaglib1_0" prefix="dsp" %>
<dsp:page>
<dsp:droplet name="/atg/commerce/catalog/CategoryLookup">

        <dsp:param name="id" param="categoryId" />

        <dsp:param name="elementName" value="category" />

        <dsp:oparam name="output">
         <dsp:droplet name="/atg/dynamo/droplet/ForEach">

                <dsp:param name="array" param="category.childCategories" />

                <dsp:param name="elementName" value="category" />

                <dsp:oparam name="output">

                    <br />

                    <dsp:a href="categoryNavigation.jsp">

                        <dsp:valueof param="category.displayName" />

                        <dsp:param name="categoryId" param="category.id" />

                    </dsp:a>

                </dsp:oparam>

            </dsp:droplet>

            <dsp:droplet name="/atg/dynamo/droplet/ForEach">

                <dsp:param name="array" param="category.childProducts" />

                <dsp:param name="elementName" value="childProduct" />

                <dsp:oparam name="output">
<ul>
                    <br />
                        <dsp:valueof param="childProduct.id" />
                        <dsp:valueof param="childProduct.displayName" />
                        <dsp:valueof param="childProduct.childSKUs" />
                            <dsp:droplet name="/atg/dynamo/droplet/ForEach">
                                <dsp:param name="array" param="childProduct.childSKUs" />
                                <dsp:param name="elementName" value="childSKU" />
                                <dsp:oparam name="output">
                            <li>    <dsp:valueof param="childSKU.id" />
                        <dsp:valueof param="childSKU.displayName" />
                        <dsp:valueof param="childSKU.listPrice" />
                        <img src='/walletshop<dsp:valueof param="childSKU.largeImage.url"/>'/>
                        <dsp:form id="addSku" action="categoryNavigation.jsp">
                        <dsp:input bean="/atg/commerce/order/purchase/CartModifierFormHandler.addItemCount" value="1" type="hidden"/>
                        <dsp:input bean="/atg/commerce/order/purchase/CartModifierFormHandler.addItemToOrderSuccessURL" value="/walletshop/catagrydisplay.jsp" type="hidden"/>
                        <dsp:input bean="/atg/commerce/order/purchase/CartModifierFormHandler.addItemToOrderErrorURL" value="/walletshop/errors.jsp" type="hidden"/>
                        <dsp:input bean="/atg/commerce/order/purchase/CartModifierFormHandler.items[0].productId" paramvalue="childProduct.id" type="hidden"/>
                        <dsp:input bean="/atg/commerce/order/purchase/CartModifierFormHandler.items[0].quantity" type="hidden" value="1" />
                        <dsp:input bean="/atg/commerce/order/purchase/CartModifierFormHandler.items[0].catalogRefId" paramvalue="childSKU.id" type="hidden" />
                        <dsp:input bean="/atg/commerce/order/purchase/CartModifierFormHandler.pageFlow" value="true" type="hidden" />
                        <dsp:input bean="/atg/commerce/order/purchase/CartModifierFormHandler.addItemToOrder" value="add" type="hidden"/>      
                        <input type="submit"  value="Submit"/>
                        </dsp:form>
                      
                      
                      
                        </li>
                                </dsp:oparam>
                            </dsp:droplet>
</ul>
                </dsp:oparam>

            </dsp:droplet>



</dsp:oparam>

</dsp:droplet>
</dsp:page>



THE FORM IN THE categoryNavigation.jsp  IS TO ADD ITEM TO CART.




Tuesday 13 August 2013 0 comments

ATG Scheduler



If the Dynamo application want to perform a task at regular intervals of time or a period of time it includes a scheduler service (atg.service.scheduler.Scheduler) which executes the appropriate services at specified times.
Dynamo also includes a SingletonSchedulableService, atg.service.scheduler.SingletonSchedulableService, which enables multiple Dynamo servers to run the same scheduled service, while guaranteeing that only one instance of the service performs the scheduled task at a time. This provides some protection from server failures, as the loss of one Dynamo server does not prevent the scheduled service from running on another Dynamo server.

Scheduling a Task in ATG:

In order to schedule a task, a component needs a pointer to the Scheduler, which is usually set as a component property. The component schedules a new task by calling addScheduledJob on the Scheduler. The Scheduler executes the job as scheduled.
When the Scheduler executes a job, it calls performScheduledTask on the object that performs the task, which must implement atg.service.scheduler.Schedulable. Typically, the component that schedules the task is also the Schedulable component that executes it, but this is not strictly required.
When a component schedules a task, it must provide the Scheduler with the following information:
·         A name for the scheduled job; used only for display to the administrator.
·         The name of the component scheduling the job; used only for display to the administrator.
·         The Schedulable object that handles the job; typically, the same as the component that schedules the job.
·         A flag that indicates how to run the job:
o    In a separate thread.
o    In the same thread as other scheduled services.
o    In a dedicated, reusable thread.
If a job runs in the same thread as other services, no other scheduled services can run until the job finishes. If the job is long and expensive, it should run in a separate thread. If the job is short, it should run in the same thread. The Schedule that indicates when the job should run. This is specified as an object that implements atg.service.scheduler.Schedule. The scheduler package provides a set of useful Schedule types, including schedules that represent an event at a specific time, schedules that represent periodic events, and schedules that represent events based on the calendar—for example, on the 1st and 15th of every month. Usually the Schedule is passed in as a property. All of this information is encapsulated in a ScheduledJob object, which is passed to the Scheduler’s addScheduledJob()method.When a job is added to the Scheduler, the Scheduler returns an integer job ID, which you can later use to reference that job. For example, to stop a scheduled job, you can call removeScheduledJob on the Scheduler, passing in the ID of the job to stop.




To make sure that your task starts automatically with dynamo Start :
Add your component to one of the inital arrays in an Initial component.
In initial.properties add your scheduler component created to initialServices property.

If you want to run the schedulers manually you can do it from dyn/admin.

Example Scheduler:

 







 
;