Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

SOLVED

why pushed button in the sidekick don't display sometimes?

Avatar

Not applicable

Hi there,

I add following JS code under the folder apps\myApp\clientlib

CQ.Ext.ns("MyClientLib"); MyClientLib.ContentFinder = { addToCart: function(sk){ var pagePanel = sk.panels["PAGE"]; var button = pagePanel.findBy(function(comp){ return comp["name"] == "ADD2_CART"; }, pagePanel); if(button && button.length > 0){ return; } button = { xtype: "button", scope: sk, name: "ADD2_CART", text: "Add to cart", "context": [ CQ.wcm.Sidekick.PAGE ], handler: function(){ //store to cart var pagePath = CQ.WCM.getPagePath(); var params = {"nodePath": pagePath}; CQ.shared.HTTP.post("/bin/mySearchServlet", function(options, success, response) { if (!success) { CQ.Ext.Msg.alert( CQ.I18n.getMessage("Error"), CQ.I18n.getMessage("Could not add current page to cart.")); } else { CQ.Ext.Msg.alert("Success","Current page has been added to the cart."); } },params); } }; pagePanel.insert(10,button); sk.actns.push(button); } }; (function(){ var result; var ipAddress; CQ.Ext.Ajax.request({ url: CQ.HTTP.externalize("/bin/customer"), method: "GET", success: function(response) { var info = CQ.Ext.util.JSON.decode(response.responseText); var ack = info[0].result; var ip = info[1].ipAddress; result = ack; ipAddress = ip; }, failure: function(response) { } }); var c = MyClientLib.ContentFinder; if( ( window.location.pathname == "/cf" ) || ( window.location.pathname.indexOf("/content") == 0)){ var SK_INTERVAL = setInterval(function(){ var sk = CQ.WCM.getSidekick(); if(sk){ clearInterval(SK_INTERVAL); c.addToCart(sk); } }, 250); } })();

Then i begin test that in the website Geometrixx Demo Site, it is okey. But found the weird point is if i enter website Geometrixx Mobile Demo Site, the sidekick don't display the new button in another laptop.

Also i notice it is okey for Firefox browser except IE and chrome.

Anybody know how to deal with this problem to make sure the new button display in the sidekick on all browser..

 

Thanks a lot.

 

Best regards,

Brian

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

It could be because,In Geometrix site, they have included <cq:include path="clientcontext" resourceType="cq/personalization/components/clientcontext"/> in the body.jsp and it might not have been included in Geometrix Mobile Site

View solution in original post

0 Replies

Avatar

Community Advisor

Is it on a specific browser or on all browsers ?

Avatar

Not applicable

Seems like FireFox is okay but IE and Chrome are not.  Interesting…

Avatar

Community Advisor

In Chrome and IE, do you see any JS error ?

Avatar

Not applicable

No find JS error but find server error log:

31.03.2015 15:14:54.744 *ERROR* [10.10.215.29 [1427786094713] GET /content/geometrixx_mobile/en/products.feature.html HTTP/1.1] org.apache.sling.servlets.get.impl.DefaultGetServlet No renderer for extension html, cannot render resource SyntheticResource, type=cq/personalization/components/contextcloud, path=/content/geometrixx_mobile/en/products/jcr:content/contextcloud

Avatar

Correct answer by
Community Advisor

It could be because,In Geometrix site, they have included <cq:include path="clientcontext" resourceType="cq/personalization/components/clientcontext"/> in the body.jsp and it might not have been included in Geometrix Mobile Site