KonaKart Community Forum

Installation / Configuration => Programming of KonaKart => Topic started by: rmauge on February 02, 2010, 03:34:07 pm

Title: Customizing ProductMgr methods
Post by: rmauge on February 02, 2010, 03:34:07 pm
Hello All, I want to change the behaviour of ProductMgr so that products return exclude a group of products that I have indicated by using a known custom field text. I want this change to be application wide so I assumed that one of the central integration points to achieve this would be a customized ProductMgr. If I am wrong please let me know.

I have tried using the example MyProductMgr as a start and it extends com.konakart.bl.ProductMgr but this class does not have the methods that I want to customize Ex. fetchAllNewProds(). So this did not work.

I tried (since I saw this class used in ShowAllNewProdsAction) extending com.konakart.al.ProductMgr but on this does not work either since the constructor is wrong; it does not have one with the right signature as public MyProductMgr(KKEngIf eng). So this approach also failed.

So is it possible to override the standard ProductMgr to make changes to a few methods and it what way is this done if so?

As an aside what does the package naming "al" and "bl" represent.

Thanks

Ray.
Title: Re: Customizing ProductMgr methods
Post by: julie on February 06, 2010, 10:40:38 am
MyProductMgr shows examples of how to add and modify criteria that will be available application wide. i.e. The manageDataDescriptor() method.

al refers to application logic (client engine) and bl refers to business logic (server engine). fetchAllNewProducts() is a method of the client engine which eventually calls getAllProductsWithOptions() of the server engine, and then caches them on the session. The server engine is stateless whereas there is an instance of the client engine for all customers since it keeps state for that customer.
Title: Re: Customizing ProductMgr methods
Post by: rmauge on February 08, 2010, 05:49:05 pm
Thanks for your answer Julie. So it looks like the com.konakart.al.ProductMgr delegates work to the methods of the KKEng instantiated. So to change its behavior I have implemented the custom engine and made the changes to the necessary methods.

To do this however I had to "figure out" what engine methods were being used by com.konakart.al.ProductMgr and then I implemented these methods. I did this by attaching a debugger and stepping through the code. Is there another "safer"/"better" way to do this?

Thanks again
Ray.