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
Solved! Go to Solution.
Views
Replies
Total Likes
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
Views
Replies
Total Likes
Is it on a specific browser or on all browsers ?
Views
Replies
Total Likes
Seems like FireFox is okay but IE and Chrome are not. Interesting…
Views
Replies
Total Likes
In Chrome and IE, do you see any JS error ?
Views
Replies
Total Likes
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
Views
Replies
Total Likes
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
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies
Views
Likes
Replies