Instead of something like this:
$(this).getForm().sendRequest('shop:on_addToCart',{update: {'basket_total': "basket_total"}});
Which updates an HTML element called 'basket_total' inside a partial also called 'basket_total'.
Is it possible to target the current page, instead of a partial? Something like this maybe?
$(this).getForm().sendRequest('shop:on_addToCart',{update: {'basket_total': "this"}});
I don't really see the need for so many partials everywhere. If I just want to update a div on the page, why does it need to be done via an include?
Page 1 of 1
AJAX partial
#2
Posted 02 February 2012 - 04:37 PM
Hi Dominic,
In the default LemonStand, you would put the entire page in a partial, and alone render that partial in the page. However, you're talking about the inclusion of the Layout as well, correct? The cart total wouldn't be inside the Page, it would be inside the Layout somewhere.
Also, you should not have an element 'basket_total' inside a partial called 'basket_total'. The 'basket_total' element should WRAP the 'basket_total' partial, or else the element will duplicate.
I wrote up an alternative method. If you install the Tweak module, you can update an element ID with the content of the Page by using "ls_cms_page" as the value (used on Utility profile page). It does not include the Layout. The reason is because the Layout includes the HTML/HEAD/BODY declarations. You could modify it to render the entire BODY, by adding an ls_body option. The entire body would have to be inside a partial, and you would render that partial when ls_body is requested. Then, you can keep rendering that 1 partial instead of many different partials. However, it will be more data transfer and not as fast.
Let me know how you fair.
In the default LemonStand, you would put the entire page in a partial, and alone render that partial in the page. However, you're talking about the inclusion of the Layout as well, correct? The cart total wouldn't be inside the Page, it would be inside the Layout somewhere.
Also, you should not have an element 'basket_total' inside a partial called 'basket_total'. The 'basket_total' element should WRAP the 'basket_total' partial, or else the element will duplicate.
I wrote up an alternative method. If you install the Tweak module, you can update an element ID with the content of the Page by using "ls_cms_page" as the value (used on Utility profile page). It does not include the Layout. The reason is because the Layout includes the HTML/HEAD/BODY declarations. You could modify it to render the entire BODY, by adding an ls_body option. The entire body would have to be inside a partial, and you would render that partial when ls_body is requested. Then, you can keep rendering that 1 partial instead of many different partials. However, it will be more data transfer and not as fast.
Let me know how you fair.
Share this topic:
Page 1 of 1

Help













