How to create a new screen portlet n integrate that in Ofbiz ecommerce

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

How to create a new screen portlet n integrate that in Ofbiz ecommerce

Amit Gangadhar Mehetre

Hello there,

 

I am new to Ofbiz, n just started to know it.....

 

I don't know how to create a totally new screen portlet in Ofbiz ....
Also on how to add it to the existing ecommerce site......

 

Is there any configurations ...that needs to be changed.....  I went
through many xml files in the application.... But couldn't figure where
exactly to make the changes,,,,

 

Actually I have created one new web application and I want to integrate
that in the Ofbiz ecommerce site....

 

 

Kindly..help me out with this,,,,,

 

 

Regards

Amit

 



**************** CAUTION - Disclaimer *****************
This e-mail contains PRIVILEGED AND CONFIDENTIAL INFORMATION intended solely for the use of the addressee(s). If you are not the intended recipient, please notify the sender by e-mail and delete the original message. Further, you are not to copy, disclose, or distribute this e-mail or its contents to any other person and any such actions are unlawful. This e-mail may contain viruses. Infosys has taken every reasonable precaution to minimize this risk, but is not liable for any damage you may sustain as a result of any virus in this e-mail. You should carry out your own virus checks before opening the e-mail or attachment. Infosys reserves the right to monitor and review the content of all messages sent to or from this e-mail address. Messages sent to or from this e-mail address may be stored on the Infosys e-mail system.
***INFOSYS******** End of Disclaimer ********INFOSYS***
Reply | Threaded
Open this post in threaded view
|

Re: How to create a new screen portlet n integrate that in Ofbiz ecommerce

Ashish Vijaywargiya-3
Amit,

Comments Inline :

On 7/2/07, Amit Gangadhar Mehetre <[hidden email]> wrote:
>
>
> Hello there,
>
>
>
> I am new to Ofbiz, n just started to know it.....


Welcome to  the Ofbiz world.

I don't know how to create a totally new screen portlet in Ofbiz ....


http://docs.ofbiz.org/display/OFBTECH/Framework+Introduction+Videos+and+Diagrams


Also on how to add it to the existing ecommerce site......

 Is there any configurations ...that needs to be changed.....  I went

> through many xml files in the application.... But couldn't figure where
> exactly to make the changes,,,,



For changing anything in ecommerce site you should go to folder "ecommerce"
subfolder inside applications folder.
But rather I will prefer you to create a new component inside hot-deploy
directory and maintain your own component from there.It will be future safe
for maintenance.


Actually I have created one new web application and I want to integrate
> that in the Ofbiz ecommerce site....


Can you please some more details on this ??

Kindly..help me out with this,,,,,

>
>
>
>
>
> Regards
>
> Amit
>
>
>
>
>
> **************** CAUTION - Disclaimer *****************
> This e-mail contains PRIVILEGED AND CONFIDENTIAL INFORMATION intended
> solely for the use of the addressee(s). If you are not the intended
> recipient, please notify the sender by e-mail and delete the original
> message. Further, you are not to copy, disclose, or distribute this e-mail
> or its contents to any other person and any such actions are unlawful. This
> e-mail may contain viruses. Infosys has taken every reasonable precaution to
> minimize this risk, but is not liable for any damage you may sustain as a
> result of any virus in this e-mail. You should carry out your own virus
> checks before opening the e-mail or attachment. Infosys reserves the right
> to monitor and review the content of all messages sent to or from this
> e-mail address. Messages sent to or from this e-mail address may be stored
> on the Infosys e-mail system.
> ***INFOSYS******** End of Disclaimer ********INFOSYS***



--
Thanks & Regards
Ashish Vijaywargiya
Aditisoft Technology Laboratory
http://www.adititechlabs.com
[hidden email]
__________________________________
Office          :  509.855.4113
Cellphone    :  +919893479711
Reply | Threaded
Open this post in threaded view
|

Re: How to create a new screen portlet n integrate that in Ofbiz ecommerce

Vince Clark
In reply to this post by Amit Gangadhar Mehetre
Amit

I am doing basically the same thing as you, and am a few steps ahead so
I will detail what I've done so far. Hopefully someone else will then
help me past my next hurdle.

1. Copied the ecommerce component (/applications/ecommerce) to
hot-deploy and renamed ecommerce to webstore (call it whatever you want,
I will use "webstore" for the remainder of this thread.)
2. Change all the necessary references from ecommerce to your new
webstore name. Search and replace in eclipse works well for this. I
started with my new folder under hot-deploy and replaced from there. You
need to replace all references to:
component://ecommerce/webapp/ecommerce with the new path. Something
like: component://webstore/webapp/webstore
3. Update the ofbiz-component.xml file in your new component. Change the
component name to webstore and change the webapp settings:
 <webapp name="webstore"
        title="eCommerce"
        server="default-server"
        location="webapp/webstore"
        mount-point="/webstore"
        app-bar-display="false"/>

    <webapp name="images"
        title="Webstore Images"
        server="default-server"
        location="webapp/images"
        mount-point="/webstore/images"
        app-bar-display="false"/>

Note that I added an "images" webapp to keep custom style sheets and
images separate from the default image location.

There is a document set available on Sourceforge from the OpenTaps
project that does a very good job of explaining all of the changes that
need to be made in this process. I suggest you review it. Download the
zip file and look in the eCommerce Online Store folder. There is a doc
called "customizing your online store.doc".

When I first tried accessing my webapp I received some errors. I found a
few other references that needed to be changed but the errors are good
indicators and will lead you to what is wrong.

Once you have your new component established it is now time to start
making changes.

In my particular case, I am retaining basically the same layout but want
to change most of the information and/or navigation in the left and
right columns of the eCommerce window. I used existing "screenlets" as a
point of reference and created additional ones for my custom use.
Examples are sidedeepcategory, keywordsearch, etc. You will find file
pairs like:
sidedeepcategory.bsh
sidedeepcategory.ftl

Add your custom ftl to CatalogScreens.xml (under your widget directory)
Add and rearrange items on the eCommerce window in CommonScreens.xml
Each of these files contains plenty of good examples so I will not
elaborate.

That's the basics. Now to the next step, customizing the information in
the screenlets. This is where I am stuck. As far as I can tell the
process is basically to execute the bean shell (bsh file) defined in the
<action> tag of the screen definition. This interacts with the service
layer and puts information in the request object so it is accessible to
the ftl file for rendering.

I am struggling with understanding how beanshell puts the data in the
request. I see "context.put" and assume it happens here. I am also
struggling with what classes to use to get the information I need, and
how to pass these classes constraints to limit the result.

Amit Gangadhar Mehetre wrote:

> Hello there,
>
>  
>
> I am new to Ofbiz, n just started to know it.....
>
>  
>
> I don't know how to create a totally new screen portlet in Ofbiz ....
> Also on how to add it to the existing ecommerce site......
>
>  
>
> Is there any configurations ...that needs to be changed.....  I went
> through many xml files in the application.... But couldn't figure where
> exactly to make the changes,,,,
>
>  
>
> Actually I have created one new web application and I want to integrate
> that in the Ofbiz ecommerce site....
>
>  
>
>  
>
> Kindly..help me out with this,,,,,
>
>  
>
>  
>
> Regards
>
> Amit
>
>  
>
>
>
> **************** CAUTION - Disclaimer *****************
> This e-mail contains PRIVILEGED AND CONFIDENTIAL INFORMATION intended solely for the use of the addressee(s). If you are not the intended recipient, please notify the sender by e-mail and delete the original message. Further, you are not to copy, disclose, or distribute this e-mail or its contents to any other person and any such actions are unlawful. This e-mail may contain viruses. Infosys has taken every reasonable precaution to minimize this risk, but is not liable for any damage you may sustain as a result of any virus in this e-mail. You should carry out your own virus checks before opening the e-mail or attachment. Infosys reserves the right to monitor and review the content of all messages sent to or from this e-mail address. Messages sent to or from this e-mail address may be stored on the Infosys e-mail system.
> ***INFOSYS******** End of Disclaimer ********INFOSYS***
>  

--
Vince Clark
Global Era
The freedom of open source.
(303) 493-6723
(303) 455-2409 fax
[hidden email] <mailto:[hidden email]>
www.globalera.com
Reply | Threaded
Open this post in threaded view
|

Re: How to create a new screen portlet n integrate that in Ofbiz ecommerce

Adrian Crum
Vince Clark wrote:

> That's the basics. Now to the next step, customizing the information in
> the screenlets. This is where I am stuck. As far as I can tell the
> process is basically to execute the bean shell (bsh file) defined in the
> <action> tag of the screen definition. This interacts with the service
> layer and puts information in the request object so it is accessible to
> the ftl file for rendering.
>
> I am struggling with understanding how beanshell puts the data in the
> request. I see "context.put" and assume it happens here. I am also
> struggling with what classes to use to get the information I need, and
> how to pass these classes constraints to limit the result.

The beanshell context object is basically a HashMap that is passed to Freemarker. So anything you
"put" in the beanshell context is available to "get" in Freemarker (or screen widgets).

In bsh:

context.put("MyMessage", "Hello World!");

In ftl:

<h1>${MyMessage}</h1>

Reply | Threaded
Open this post in threaded view
|

Re: How to create a new screen portlet n integrate that in Ofbiz ecommerce

Vince Clark
Thanks. That is so simple and clears up my confusion.

This thread should probably be in the dev forum at this point, but I'll
continue here.

Can you provide some clarity on how to get the information I want? For
example, if I want a screenlet with all "Brands" listed so I can click
on one and get all products of that brand?

I see two classes available under org.ofbiz.product.feature
ParametricSearch.java
ProductFeatureServices.java

ParametricSearch.java has a method called getAllFeaturesByType. Sure
sounds like what I need. It accepts a GenericDelegator. I haven't
explored this code yet but I assume it would be used in the following
fashion:
Use beanshell to instantiate a GenericDelegator, store the featureTypeId
in it somehow, then call the service.
Use context.put to store the results in the bsh context so the ftl can
access.


Adrian Crum wrote:

> Vince Clark wrote:
>> That's the basics. Now to the next step, customizing the information in
>> the screenlets. This is where I am stuck. As far as I can tell the
>> process is basically to execute the bean shell (bsh file) defined in the
>> <action> tag of the screen definition. This interacts with the service
>> layer and puts information in the request object so it is accessible to
>> the ftl file for rendering.
>>
>> I am struggling with understanding how beanshell puts the data in the
>> request. I see "context.put" and assume it happens here. I am also
>> struggling with what classes to use to get the information I need, and
>> how to pass these classes constraints to limit the result.
>
> The beanshell context object is basically a HashMap that is passed to
> Freemarker. So anything you "put" in the beanshell context is
> available to "get" in Freemarker (or screen widgets).
>
> In bsh:
>
> context.put("MyMessage", "Hello World!");
>
> In ftl:
>
> <h1>${MyMessage}</h1>

--
Vince Clark
Global Era
The freedom of open source.
(303) 493-6723
(303) 455-2409 fax
[hidden email] <mailto:[hidden email]>
www.globalera.com
Reply | Threaded
Open this post in threaded view
|

Re: How to create a new screen portlet n integrate that in Ofbiz ecommerce

Adrian Crum
This is the correct mailing list for this discussion. The dev list is for discussions about the
development of OFBiz itself, not end-user modifications. It might be a good idea to start a new
thread though.

I don't use the eCommerce component, so I can't help you with this question. Maybe someone else can
chime in.

-Adrian

Vince Clark wrote:

> Thanks. That is so simple and clears up my confusion.
>
> This thread should probably be in the dev forum at this point, but I'll
> continue here.
>
> Can you provide some clarity on how to get the information I want? For
> example, if I want a screenlet with all "Brands" listed so I can click
> on one and get all products of that brand?
>
> I see two classes available under org.ofbiz.product.feature
> ParametricSearch.java
> ProductFeatureServices.java
>
> ParametricSearch.java has a method called getAllFeaturesByType. Sure
> sounds like what I need. It accepts a GenericDelegator. I haven't
> explored this code yet but I assume it would be used in the following
> fashion:
> Use beanshell to instantiate a GenericDelegator, store the featureTypeId
> in it somehow, then call the service.
> Use context.put to store the results in the bsh context so the ftl can
> access.
>
>
> Adrian Crum wrote:
>
>>Vince Clark wrote:
>>
>>>That's the basics. Now to the next step, customizing the information in
>>>the screenlets. This is where I am stuck. As far as I can tell the
>>>process is basically to execute the bean shell (bsh file) defined in the
>>><action> tag of the screen definition. This interacts with the service
>>>layer and puts information in the request object so it is accessible to
>>>the ftl file for rendering.
>>>
>>>I am struggling with understanding how beanshell puts the data in the
>>>request. I see "context.put" and assume it happens here. I am also
>>>struggling with what classes to use to get the information I need, and
>>>how to pass these classes constraints to limit the result.
>>
>>The beanshell context object is basically a HashMap that is passed to
>>Freemarker. So anything you "put" in the beanshell context is
>>available to "get" in Freemarker (or screen widgets).
>>
>>In bsh:
>>
>>context.put("MyMessage", "Hello World!");
>>
>>In ftl:
>>
>><h1>${MyMessage}</h1>
>
>
Reply | Threaded
Open this post in threaded view
|

Re: How to create a new screen portlet n integrate that in Ofbiz ecommerce

David E Jones
In reply to this post by Vince Clark

Your best bet really is looking at the existing code that uses the lower level objects.

Quick note: the "delegator" object will already in the bsh context, so no need to create or lookup that object (and it's better not to so that the per-application settings in web.xml don't get broken).

A good example of using the ProductSearch stuff is in the keywordsearch.bsh file (in the order component, also used in ecommerce, or the one in the catalog component). You'll see most stuff is handled in the underlying object, so the best thing to do is look at the forms and such to make sure parameters are named properly.

Some of this is redundant to the other email I sent in reply to your question about this. Did you get that one?

-David


Vince Clark wrote:

> Thanks. That is so simple and clears up my confusion.
>
> This thread should probably be in the dev forum at this point, but I'll
> continue here.
>
> Can you provide some clarity on how to get the information I want? For
> example, if I want a screenlet with all "Brands" listed so I can click
> on one and get all products of that brand?
>
> I see two classes available under org.ofbiz.product.feature
> ParametricSearch.java
> ProductFeatureServices.java
>
> ParametricSearch.java has a method called getAllFeaturesByType. Sure
> sounds like what I need. It accepts a GenericDelegator. I haven't
> explored this code yet but I assume it would be used in the following
> fashion:
> Use beanshell to instantiate a GenericDelegator, store the featureTypeId
> in it somehow, then call the service.
> Use context.put to store the results in the bsh context so the ftl can
> access.
>
>
> Adrian Crum wrote:
>> Vince Clark wrote:
>>> That's the basics. Now to the next step, customizing the information in
>>> the screenlets. This is where I am stuck. As far as I can tell the
>>> process is basically to execute the bean shell (bsh file) defined in the
>>> <action> tag of the screen definition. This interacts with the service
>>> layer and puts information in the request object so it is accessible to
>>> the ftl file for rendering.
>>>
>>> I am struggling with understanding how beanshell puts the data in the
>>> request. I see "context.put" and assume it happens here. I am also
>>> struggling with what classes to use to get the information I need, and
>>> how to pass these classes constraints to limit the result.
>> The beanshell context object is basically a HashMap that is passed to
>> Freemarker. So anything you "put" in the beanshell context is
>> available to "get" in Freemarker (or screen widgets).
>>
>> In bsh:
>>
>> context.put("MyMessage", "Hello World!");
>>
>> In ftl:
>>
>> <h1>${MyMessage}</h1>
>
Reply | Threaded
Open this post in threaded view
|

Re: How to create a new screen portlet n integrate that in Ofbiz ecommerce

Vince Clark
David

I got the previous email. It was a bit vague but each round gives me
another clue. :-)

Probably my biggest gap in understanding right now is how to set a
variable so I can limit my data. Where do I set it? How/where is it
read? If the delegator is part of the beanshell context already, then
how do I use it? Are there predetermined variable names or can I create
my own?

I will continue digging thru examples and maybe the light bulb will come on.

David E Jones wrote:

>
> Your best bet really is looking at the existing code that uses the
> lower level objects.
>
> Quick note: the "delegator" object will already in the bsh context, so
> no need to create or lookup that object (and it's better not to so
> that the per-application settings in web.xml don't get broken).
>
> A good example of using the ProductSearch stuff is in the
> keywordsearch.bsh file (in the order component, also used in
> ecommerce, or the one in the catalog component). You'll see most stuff
> is handled in the underlying object, so the best thing to do is look
> at the forms and such to make sure parameters are named properly.
>
> Some of this is redundant to the other email I sent in reply to your
> question about this. Did you get that one?
>
> -David
>
>
> Vince Clark wrote:
>> Thanks. That is so simple and clears up my confusion.
>>
>> This thread should probably be in the dev forum at this point, but I'll
>> continue here.
>>
>> Can you provide some clarity on how to get the information I want? For
>> example, if I want a screenlet with all "Brands" listed so I can click
>> on one and get all products of that brand?
>>
>> I see two classes available under org.ofbiz.product.feature
>> ParametricSearch.java
>> ProductFeatureServices.java
>>
>> ParametricSearch.java has a method called getAllFeaturesByType. Sure
>> sounds like what I need. It accepts a GenericDelegator. I haven't
>> explored this code yet but I assume it would be used in the following
>> fashion:
>> Use beanshell to instantiate a GenericDelegator, store the featureTypeId
>> in it somehow, then call the service.
>> Use context.put to store the results in the bsh context so the ftl can
>> access.
>>
>>
>> Adrian Crum wrote:
>>> Vince Clark wrote:
>>>> That's the basics. Now to the next step, customizing the
>>>> information in
>>>> the screenlets. This is where I am stuck. As far as I can tell the
>>>> process is basically to execute the bean shell (bsh file) defined
>>>> in the
>>>> <action> tag of the screen definition. This interacts with the service
>>>> layer and puts information in the request object so it is
>>>> accessible to
>>>> the ftl file for rendering.
>>>>
>>>> I am struggling with understanding how beanshell puts the data in the
>>>> request. I see "context.put" and assume it happens here. I am also
>>>> struggling with what classes to use to get the information I need, and
>>>> how to pass these classes constraints to limit the result.
>>> The beanshell context object is basically a HashMap that is passed to
>>> Freemarker. So anything you "put" in the beanshell context is
>>> available to "get" in Freemarker (or screen widgets).
>>>
>>> In bsh:
>>>
>>> context.put("MyMessage", "Hello World!");
>>>
>>> In ftl:
>>>
>>> <h1>${MyMessage}</h1>
>>

--
Vince Clark
Global Era
The freedom of open source.
(303) 493-6723
(303) 455-2409 fax
[hidden email] <mailto:[hidden email]>
www.globalera.com
Reply | Threaded
Open this post in threaded view
|

Re: How to create a new screen portlet n integrate that in Ofbiz ecommerce

jitender
In reply to this post by Vince Clark

Vince Clark wrote
Amit

I am doing basically the same thing as you, and am a few steps ahead so
I will detail what I've done so far. Hopefully someone else will then
help me past my next hurdle.

1. Copied the ecommerce component (/applications/ecommerce) to
hot-deploy and renamed ecommerce to webstore (call it whatever you want,
I will use "webstore" for the remainder of this thread.)
2. Change all the necessary references from ecommerce to your new
webstore name. Search and replace in eclipse works well for this. I
started with my new folder under hot-deploy and replaced from there. You
need to replace all references to:
component://ecommerce/webapp/ecommerce with the new path. Something
like: component://webstore/webapp/webstore
3. Update the ofbiz-component.xml file in your new component. Change the
component name to webstore and change the webapp settings:
 <webapp name="webstore"
        title="eCommerce"
        server="default-server"
        location="webapp/webstore"
        mount-point="/webstore"
        app-bar-display="false"/>

    <webapp name="images"
        title="Webstore Images"
        server="default-server"
        location="webapp/images"
        mount-point="/webstore/images"
        app-bar-display="false"/>

Note that I added an "images" webapp to keep custom style sheets and
images separate from the default image location.

There is a document set available on Sourceforge from the OpenTaps
project that does a very good job of explaining all of the changes that
need to be made in this process. I suggest you review it. Download the
zip file and look in the eCommerce Online Store folder. There is a doc
called "customizing your online store.doc".

When I first tried accessing my webapp I received some errors. I found a
few other references that needed to be changed but the errors are good
indicators and will lead you to what is wrong.

Once you have your new component established it is now time to start
making changes.

In my particular case, I am retaining basically the same layout but want
to change most of the information and/or navigation in the left and
right columns of the eCommerce window. I used existing "screenlets" as a
point of reference and created additional ones for my custom use.
Examples are sidedeepcategory, keywordsearch, etc. You will find file
pairs like:
sidedeepcategory.bsh
sidedeepcategory.ftl

Add your custom ftl to CatalogScreens.xml (under your widget directory)
Add and rearrange items on the eCommerce window in CommonScreens.xml
Each of these files contains plenty of good examples so I will not
elaborate.

That's the basics. Now to the next step, customizing the information in
the screenlets. This is where I am stuck. As far as I can tell the
process is basically to execute the bean shell (bsh file) defined in the
<action> tag of the screen definition. This interacts with the service
layer and puts information in the request object so it is accessible to
the ftl file for rendering.

I am struggling with understanding how beanshell puts the data in the
request. I see "context.put" and assume it happens here. I am also
struggling with what classes to use to get the information I need, and
how to pass these classes constraints to limit the result.

Amit Gangadhar Mehetre wrote:
> Hello there,
>
>  
>
> I am new to Ofbiz, n just started to know it.....
>
>  
>
> I don't know how to create a totally new screen portlet in Ofbiz ....
> Also on how to add it to the existing ecommerce site......
>
>  
>
> Is there any configurations ...that needs to be changed.....  I went
> through many xml files in the application.... But couldn't figure where
> exactly to make the changes,,,,
>
>  
>
> Actually I have created one new web application and I want to integrate
> that in the Ofbiz ecommerce site....
>
>  
>
>  
>
> Kindly..help me out with this,,,,,
>
>  
>
>  
>
> Regards
>
> Amit
>
>  
>
>
>
> **************** CAUTION - Disclaimer *****************
> This e-mail contains PRIVILEGED AND CONFIDENTIAL INFORMATION intended solely for the use of the addressee(s). If you are not the intended recipient, please notify the sender by e-mail and delete the original message. Further, you are not to copy, disclose, or distribute this e-mail or its contents to any other person and any such actions are unlawful. This e-mail may contain viruses. Infosys has taken every reasonable precaution to minimize this risk, but is not liable for any damage you may sustain as a result of any virus in this e-mail. You should carry out your own virus checks before opening the e-mail or attachment. Infosys reserves the right to monitor and review the content of all messages sent to or from this e-mail address. Messages sent to or from this e-mail address may be stored on the Infosys e-mail system.
> ***INFOSYS******** End of Disclaimer ********INFOSYS***
>  

--
Vince Clark
Global Era
The freedom of open source.
(303) 493-6723
(303) 455-2409 fax
vclark@globalera.com <mailto:vclark@globalera.com>
www.globalera.com
=======================================
Hi Vince and Amit and all
according to previous mails.
i did not found any component under applications:(i.e folder under (/applications/ecommerce)
i am not sure that it is folder otherwise anyother configuration
it is in specialpurpose folder:
(/applications/ecommerce

please let me know asap

jitender9717989688