ofbiz-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Vince Clark <vcl...@globalera.com>
Subject Re: How to create a new screen portlet n integrate that in Ofbiz ecommerce
Date Mon, 02 Jul 2007 18:34:13 GMT
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
vclark@globalera.com <mailto:vclark@globalera.com>
www.globalera.com

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message