magento2 icon indicating copy to clipboard operation
magento2 copied to clipboard

Simple block loading javascript.

Open paales opened this issue 12 years ago • 4 comments

Related to #322 and #82.

The idea is that it should be possible to load a certain block (cart, toplinks, wishlist block) without creating a controller, with a nice Javascript API that is scalable for frontend developers.

As @kandy metioned, it is already possible to load certain blocks (although, that seems to have been build for the pagecache, not partial reloads), but I couldn't find a proper JS library to achieve this.

This issue focusses on the JS API.

We have created such a solution for our own needs: https://github.com/ho-nl/Ho_AjaxCart

In short, We have an action source:

<a href="#" data-ho-ajax-link="cart">foo</a>

And have target:

<div data-ho-ajax="<?php echo $this->getNameInLayout(); ?>" data-ho-ajax-group="cart">
   ...
</div>

When the action is called, the target is reloaded without reloading the complete page.

This solution works well for us, allows us to create fully ajax-reloaded pages. For example: The cart page allows you to clear an item from your cart an it reloads the products table, totals, shipping costs and the cart header. When someone estimates their shipping the shipping block is reloaded and the totals, but the products table.

Something like this would be really handy if it were in the core and would greatly improve compatibility with modules.

paales avatar Jun 28 '14 14:06 paales

Magento 2 already have one to show private content (see: \Magento\PageCache\Controller\Block::renderAction)

kandy avatar Jun 28 '14 14:06 kandy

@paales, thank you. We will investigate this. I will keep you informed. @kandy, thanks also.

ilol avatar Jul 03 '14 08:07 ilol

Internal ticket: MAGETWO-25908

vpelipenko avatar Jan 29 '15 12:01 vpelipenko

Thank you for your submission.

We recently made some changes to the way we process GitHub submissions to more quickly identify and respond to core code issues.

Feature Requests and Improvements should now be submitted to the new Magento 2 Feature Requests and Improvements forum (see details here).

We are closing this GitHub ticket and have moved your request to the new forum.

piotrekkaminski avatar Aug 30 '16 20:08 piotrekkaminski