Skip to Content
author's profile photo Former Member
Former Member

Override DefaultCartFacade class

Hi,

I need to override DefaultCartFacade class, actually I took some steps but when I debug and open a new cart, and add a new product to cart, my custom class are not triggered at that time.

When I do this, I took advantage from this link : link text

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • Posted on Feb 25, 2019 at 08:52 AM

    1) Firstly configure like this in your *facade-spring xml:

         <bean id="xyzCartFacade" class="com.xyz.facades.cart.facade.impl.DefaultXyzCartFacade" parent="defaultCartFacade">
     </bean>
    

    2) If you want to create your own interface, create it. public interface XyzCartFacade extends CartFacade

    3) Your class will be like: public class DefaultXyzCartFacade extends DefaultCartFacade implements XyzCartFacade

    Do the needful.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Feb 25, 2019 at 09:54 AM

    , as test, I needn't any interface but as you said, the class signature is same.

     public class KoctasParoDefaultCartFacade extends DefaultCartFacade {
     
         @Override
         public CartData getSessionCart() {
             return super.getSessionCart();
         }
     
         @Override
         public boolean hasSessionCart() {
             return super.hasSessionCart();
         }
     
         @Override
         public CartModificationData addToCart(String code, long quantity) throws CommerceCartModificationException {
             return super.addToCart(code, quantity);
         }
     
         @Override
         public CartModificationData addToCart(AddToCartParams addToCartParams) throws CommerceCartModificationException {
             return super.addToCart(addToCartParams);
         }
     }
    
    

    and, my spring xml looks like that.

        <alias name="koctasParoDefaultCartFacade" alias="cartFacade"/>
         <bean id="koctasParoDefaultCartFacade" class="com.itelligence.koctas.paro.facade.KoctasParoDefaultCartFacade"
               parent="defaultCartFacade" />
    
    
    

    What am I doing wrong ?

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.