Please open a Jira if you think that

   we normally expect the dispatcher to be always in the session

I don't know if a such rule exists. And this is not related with the work I did 
in OFBIZ-9164

Jacques

Le 20/08/2018 à 12:06, Taher Alkhateeb a écrit :
Agreed, surface level fixes are not good, you might have a logic flaw
underneath. We should always go for root cauae analysis.

On Mon, Aug 20, 2018, 1:00 PM Michael Brohl <michael.br...@ecomify.de>
wrote:

Jacques,

inline...

Am 20.08.18 um 11:27 schrieb Jacques Le Roux:
Hi Michael,

Yes but at this point the session misses the dispatcher, that's why I use

    request.getSession().setAttribute("dispatcher",dispatcher)

to put it in. As shown at


https://cwiki.apache.org/confluence/display/OFBIZ/Variables+always+available+in+screen+context
  the dispatcher is always available in screen context. Not sure why
the session misses the dispatcher there, I did not want to digg in...
I think you should do that. If we normally expect the dispatcher to be
always in the session and it is not in this case, there might be an
error somewhere.
Implementing a workaround just covers this error but does not fix it.

Regards,
Michael

Jacques


Le 20/08/2018 à 09:12, Michael Brohl a écrit :
Hi Jacques,

maybe I am missing something but you should be able to get the
session with request.getSession(), no?

Regards,

Michael


Am 20.08.18 um 09:06 schrieb Jacques Le Roux:
Hi Deepak,

I used this way because it starts in Groovy with
     ProductSearchSession.getProductSearchResult(request, delegator,
prodCatalogId)
the session is not in the request, and there is no alternative
signature for ProductSearchSession::getProductSearchResult
As I did not want to get too deep in that I preferred this simple
way at the root in Groovy

Please amend it if you see a better way to do it.

Thanks

Jacques


Le 20/08/2018 à 06:33, Deepak Dixit a écrit :
Hi Jacques,

I think instead of setting dispatcher in groovy files I think we
can fix
the work done under OFBIZ-9164

Instead of getting dispatcher from a session we can get this from the
request or can use the different method signature of
searchGetConstraintStrings method.
{code}

LocalDispatcher dispatcher = (LocalDispatcher)
request.getAttribute("dispatcher");

{code}



Thanks & Regards
--
Deepak Dixit


On Sun, Aug 19, 2018 at 9:00 PM, <jler...@apache.org> wrote:

Author: jleroux
Date: Sun Aug 19 15:30:42 2018
New Revision: 1838381

URL: http://svn.apache.org/viewvc?rev=1838381&view=rev
Log:
Fixed: Search in Ecommerce no longer works
(OFBIZ-10531)

I guess that when I worked on OFBIZ-9164 I broke that.

I found 3 occurences where the dispatcher was not in the session
because
the
session comes from the request and the request has not it in.

Modified:
      ofbiz/ofbiz-framework/trunk/applications/order/
groovyScripts/entry/catalog/KeywordSearch.groovy
      ofbiz/ofbiz-framework/trunk/applications/product/
groovyScripts/catalog/find/KeywordSearch.groovy
      ofbiz/ofbiz-plugins/trunk/ecommerce/groovyScripts/
catalog/LayeredNavigation.groovy

Modified: ofbiz/ofbiz-framework/trunk/applications/order/
groovyScripts/entry/catalog/KeywordSearch.groovy
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/

applications/order/groovyScripts/entry/catalog/KeywordSearch.groovy?rev=
1838381&r1=1838380&r2=1838381&view=diff
============================================================
==================
--- ofbiz/ofbiz-framework/trunk/applications/order/
groovyScripts/entry/catalog/KeywordSearch.groovy (original)
+++ ofbiz/ofbiz-framework/trunk/applications/order/
groovyScripts/entry/catalog/KeywordSearch.groovy Sun Aug 19
15:30:42 2018
@@ -28,6 +28,7 @@ import org.apache.ofbiz.product.product.
   module = "KeywordSearch.groovy"

   // note: this can be run multiple times in the same request without
causing problems, will check to see on its own if it has run again
+request.getSession().setAttribute("dispatcher",dispatcher)
   ProductSearchSession.processSearchParameters(parameters, request)
   prodCatalogId = CatalogWorker.getCurrentCatalogId(request)
   result = ProductSearchSession.getProductSearchResult(request,
delegator,
prodCatalogId)

Modified: ofbiz/ofbiz-framework/trunk/applications/product/
groovyScripts/catalog/find/KeywordSearch.groovy
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/

applications/product/groovyScripts/catalog/find/KeywordSearch.groovy?rev=
1838381&r1=1838380&r2=1838381&view=diff
============================================================
==================
--- ofbiz/ofbiz-framework/trunk/applications/product/
groovyScripts/catalog/find/KeywordSearch.groovy (original)
+++ ofbiz/ofbiz-framework/trunk/applications/product/
groovyScripts/catalog/find/KeywordSearch.groovy Sun Aug 19
15:30:42 2018
@@ -24,6 +24,7 @@ import org.apache.ofbiz.product.product.
   module = "KeywordSearch.groovy"

   // note: this can be run multiple times in the same request without
causing problems, will check to see on its own if it has run again
+request.getSession().setAttribute("dispatcher",dispatcher)
   ProductSearchSession.processSearchParameters(parameters, request)
   prodCatalogId = CatalogWorker.getCurrentCatalogId(request)
   result = ProductSearchSession.getProductSearchResult(request,
delegator,
prodCatalogId)

Modified: ofbiz/ofbiz-plugins/trunk/ecommerce/groovyScripts/
catalog/LayeredNavigation.groovy
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-plugins/trunk/
ecommerce/groovyScripts/catalog/LayeredNavigation.
groovy?rev=1838381&r1=1838380&r2=1838381&view=diff
============================================================
==================
--- ofbiz/ofbiz-plugins/trunk/ecommerce/groovyScripts/
catalog/LayeredNavigation.groovy (original)
+++ ofbiz/ofbiz-plugins/trunk/ecommerce/groovyScripts/
catalog/LayeredNavigation.groovy Sun Aug 19 15:30:42 2018
@@ -47,6 +47,7 @@ if (!parameters.clearSearch || !"N".equa
       ProductSearchSession.searchClear(session)
   }

+request.getSession().setAttribute("dispatcher",dispatcher)
   ProductSearchSession.processSearchParameters(parameters, request)
   prodCatalogId = CatalogWorker.getCurrentCatalogId(request)
   result = ProductSearchSession.getProductSearchResult(request,
delegator,
prodCatalogId)








Reply via email to