This conversation has been locked due to inactivity. Please create a new post.
This conversation has been locked due to inactivity. Please create a new post.
Because i need to add an button[Add to cart] into sidekick after write code in file sidekick.js, please see following screenshot. Here my requirement is to collect this current page or node path to store in somewhere if user to press this button [Add to cart]. I am a new to AEM and already complete a OSGI bundle to save it. But best confused me is i don't know how and where to invoke this bundle?
Anyone could help see this question? Thanks a lot. Anyway if anybody have better solution for that, please comment on it. Thanks again.
[img]sidekick2.png[/img]
public int add2Cart(Node node) throws Exception { final int OK = 1; final int EXISTED = -1; String cart = "cart"; session = this.getSession(); Node root = session.getRootNode(); Node content = root.getNode("content"); Node cartRoot = null; int cartRec = this.doesNodeExist(content, cart); if (cartRec == -1) { cartRoot = content.addNode(cart, "sling:OrderedFolder"); } else { cartRoot = content.getNode(cart); } Node userCartNode = null; String userCart = cart + "-" + this.getCurrentUserId(); int userRec = this.doesNodeExist(cartRoot, userCart); if (userRec == -1) { userCartNode = cartRoot.addNode(userCart, "nt:unstructured"); } else { userCartNode = cartRoot.getNode(userCart); } // verify if this property existed. Property prop = userCartNode.getProperty(node.getName()); if (prop == null) { userCartNode.setProperty(node.getName(), node.getName()); } else { return EXISTED; } session.save(); return OK; }
Solved! Go to Solution.
Views
Replies
Total Likes
Along with jorg suggestion look for couple of sidekick example to add and invoke calls at http://experience-aem.blogspot.com/2013/08/in-blog-experiencing-adobe-experience.html
Views
Replies
Total Likes
Hi,
Your button should invoke a call to the server (normally to a servlet). Then this servlet can do the necessary work and e.g. call your code.
Views
Replies
Total Likes
Along with jorg suggestion look for couple of sidekick example to add and invoke calls at http://experience-aem.blogspot.com/2013/08/in-blog-experiencing-adobe-experience.html
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies