Showing posts with label voucher. Show all posts
Showing posts with label voucher. Show all posts

Gift Card and Voucher Changes in Hybris Multi-channel suite 4.8 Accelerator | Hybris 4.8 tutorial

Gift Card /Voucher Changes in Hybris Accelerator:
1.    Voucher Façade creation
•    Defining Voucher interface: Voucher interface has been defined comprising following methods
a) String redeemVoucher(String voucherCode)

b) Boolean checkVoucherCode(String voucherCode)
•    Implementing Voucher methods: Voucher methods have been implemented using CartVoucherFacadeImpl class. RedeemVoucher methods redeems voucher for given voucher code & checkvoucherCode methods check for the validity of the voucher code.
•    Spring configuration for VoucherFacade: below is the spring configuration for voucherFacade
    <!-- Added by for Voucher(Gift card) changes -->
    <bean id="cartVoucherFacade" class="se.KM.facades.voucher.impl.CartVoucherFacadeImpl" scope="tenant"/>
   
2.    Store pickup changes: Following classes have been create/updated for store pickup
a.    KMUserFacade
b.    KMAddressService
c.    KMAddressServiceImpl
d.    KMAddressDao
e.    KMAddressDaoImpl
f.    KMCustomerReviewDaoImpl
g.    MultiStepCheckoutController
h.    GiftVoucherValidator
i.    deliveryAddressDetails.tag
j.    deliveryAddressSelector.tag
k.    header.tag
l.    deliveryAddressDetails.tag
m.    deliveryAddressSelector.tag
n.    /KMstorestorefront/web/webroot/WEB-INF/tags/mobile/common/header/header.tag

•    Spring configuration for store pickup: below are the spring file changes in file KMstorecore-spring-integration.xml
    <!-- Changes done By Sachin  -->
    <!--H&M Address Service -->
    <bean id="KMAddressService" class="se.KM.core.servicelayer.user.impl.KMAddressServiceImpl" parent="abstractBusinessService" scope="tenant">
        <property name="addressDao" ref="addressDao"/>       
    </bean>
   
    <!--H&M Address DAO -->
    <alias alias="addressDao" name="KMAddressDaoImpl"/>   
    <bean id="KMAddressDaoImpl" class="se.KM.core.servicelayer.user.daos.impl.KMAddressDaoImpl" scope="tenant"/>
   
    <!--H&M Checkout Facade -->
    <!-- <alias alias="checkoutFacade" name="KMCheckoutFacade"/>
    <bean id="KMCheckoutFacade" class="se.KM.core.commercefacades.order.impl.KMCheckoutFacade" scope="tenant" parent="defaultCheckoutFacade">
        <property name="KMAddressService" ref="KMAddressService"/>
    </bean> -->
   
    <!--H&M User Facade -->
    <alias alias="userFacade" name="KMUserFacade"/>
    <bean id="KMUserFacade" class="se.KM.core.commercefacades.user.impl.KMUserFacade" scope="tenant" parent="defaultUserFacade">
        <property name="KMAddressService" ref="KMAddressService" />
    </bean>
    <!-- H&M customer review DAO- Added by SACHIN -->
    <alias alias="customerReviewDao" name="KMCustomerReviewDao"/>
    <bean id="KMCustomerReviewDao" class="se.KM.core.servicelayer.user.daos.impl.KMCustomerReviewDaoImpl" parent="defaultCustomerReviewDao" scope="tenant"/>


3.    Promotion “KM Buy X get A% discount on X” changes: Following changes have been made while defining this promotion
•    Creating Promotion:  changes have been made in /KMstorecore/resources/KMstorecore-items.xml file
            <itemtype code="KMProductBOGOFPromotion"
                extends="ProductBOGOFPromotion"
                jaloclass="se.KM.core.promotions.jalo.KMProductBOGOFPromotion"
                autocreate="true"
                generate="true" >
                <attributes>
                    <attribute
                        qualifier="percentageDiscount"
                        autocreate="true"
                        type="java.lang.Double">
                        <defaultvalue>Double.valueOf(0.0D)</defaultvalue>
                        <description>Discount on product Y</description>
                        <modifiers read="true" write="true" />
                        <persistence type="property"/>
                    </attribute>
                </attributes>
            </itemtype>
•    KMc changes: following changes have been made in KMc.xml file for front end
    <!-- Configuration for extension KMstorecore -->
    <type name="KMProductBOGOFPromotion" mode="append">
        <organizer>
            <editor mode="append">
                <tab name="tab.promotion.properties" mode="append">
                    <section name="section.promotion.products" mode="append">
                        <columnlayout leftwidth="370">
                            <row>
                                <attribute name="percentageDiscount" labelwidth="100" />
                                <text name="text.KMproductbogofpromotion.percentageDiscount" />
                            </row>
                        </columnlayout>
                    </section>
                </tab>
            </editor>
        </organizer>
    </type>
•    Changes in Jalo class: following changes have been made in jalo class in order to invoke custom evaluate method
/KMstorecore/src/se/KM/core/promotions/jalo/KMProductBOGOFPromotion.java
Following methods need to be override while defining a new promotion
    @Override
    public List<PromotionResult> evaluate(final SessionContext ctx, final PromotionEvaluationContext promoContext)
    @Override
    public String getResultDescription(final SessionContext ctx, final PromotionResult promotionResult, final Locale locale)