Thanks Deepak,

I also suppose the session has always a delegator in.

Because we can always get a delegator from the dispatcher, not the reverse, if I would get this way, to keep things consistent, I would verify that session has always a dispatcher in, and document it in the screen variable wiki page.

Of course handling it only in these 3 cases is not bad too, just that there are 
maybe other cases I'm unaware of.

Jacques


Le 20/08/2018 à 13:05, Deepak Dixit a écrit :
Thanks Jacques,

I added this in my TODO list, I agree with Michael's comment.
I'll check and create a ticket if needed.

Thanks & Regards
--
Deepak Dixit


On Mon, Aug 20, 2018 at 12:36 PM, Jacques Le Roux <
jacques.le.r...@les7arts.com> wrote:

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/KeywordSearc
h.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