[Skip to main content](#vessel-content)

#   Display View refreshes on checkout cart quantity update

##

- **[3by400](/forum/user/6842-3by400 "View 3by400's Profile")**
- [![3by400's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar6842.jpg)](/forum/user/6842-3by400 "View 3by400's Profile") Topic Author
- [ Offline](/forum/user/6842-3by400)

Less More

- Posts: 211
- Thank you received: 14
-
-
- [](https://3by400.com)
-

8 years 5 days ago [\#301074](#301074) by [3by400](/forum/user/6842-3by400 "View 3by400's Profile")  *[Display View refreshes on checkout cart quantity update](/forum/29-payment-methods/896348-display-view-refreshes-on-checkout-cart-quantity-update#301074 "-- HikaShop version -- : 4.0.0 -- Joomla version -- : 3.9.0 -- PHP version -- : 5.6.36  First, thanks for this (We avoid the shipping and payment blocks to refresh themselves when the selection is updated.) which made a world of difference.  I'm still having a minor issue with our Braintree payment plugin. When the address is updated or a new one is added during checkout, or when a product quantity is updated during checkout, the onHikashopBeforeDisplayView event is triggered. This in itself isn't a problem. But what it does is regenerate everything related to our payment method. That doesn't seem to be an issue, but since the page isn't reloaded, our JS doesn't re-initialize the payment's CC fields because it is waiting on a (document).ready.  You don't seem to be using AJAX (at least not jQuery). Is there something we can use when your block refreshes are complete as an event to start our reinitialization? I was trying to use (document).ajaxComplete, but since it doesn't seem that you're using AJAX proper (via jQuery at least) this doesn't do it.  If in fact you didn't intend to trigger the onHIkashopBeforeDisplayView event, maybe you could resolve that. Otherwise, any other solutions would be appreciated.  Thanks, Paul")* was created by *[3by400](/forum/user/6842-3by400 "View 3by400's Profile")*

-- HikaShop version -- : 4.0.0
-- Joomla version -- : 3.9.0
-- PHP version -- : 5.6.36

First, thanks for this (We avoid the shipping and payment blocks to refresh themselves when the selection is updated.) which made a world of difference.

I'm still having a minor issue with our Braintree payment plugin. When the address is updated or a new one is added during checkout, or when a product quantity is updated during checkout, the onHikashopBeforeDisplayView event is triggered. This in itself isn't a problem. But what it does is regenerate everything related to our payment method. That doesn't seem to be an issue, but since the page isn't reloaded, our JS doesn't re-initialize the payment's CC fields because it is waiting on a (document).ready.

You don't seem to be using AJAX (at least not jQuery). Is there something we can use when your block refreshes are complete as an event to start our reinitialization? I was trying to use (document).ajaxComplete, but since it doesn't seem that you're using AJAX proper (via jQuery at least) this doesn't do it.

If in fact you didn't intend to trigger the onHIkashopBeforeDisplayView event, maybe you could resolve that. Otherwise, any other solutions would be appreciated.

Thanks, Paul

---

3by400, Inc.
[ 3by400.com](https://3by400.com)
Websites that Work, Marketing that Matters

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI5LXBheW1lbnQtbWV0aG9kcy84OTYzNDgtZGlzcGxheS12aWV3LXJlZnJlc2hlcy1vbi1jaGVja291dC1jYXJ0LXF1YW50aXR5LXVwZGF0ZT90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86593
- Thank you received: 14334
-
-

8 years 4 days ago [\#301079](#301079) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Display View refreshes on checkout cart quantity update](/forum/29-payment-methods/896348-display-view-refreshes-on-checkout-cart-quantity-update#301079 "-- HikaShop version -- : 4.0.0 -- Joomla version -- : 3.9.0 -- PHP version -- : 5.6.36  First, thanks for this (We avoid the shipping and payment blocks to refresh themselves when the selection is updated.) which made a world of difference.  I'm still having a minor issue with our Braintree payment plugin. When the address is updated or a new one is added during checkout, or when a product quantity is updated during checkout, the onHikashopBeforeDisplayView event is triggered. This in itself isn't a problem. But what it does is regenerate everything related to our payment method. That doesn't seem to be an issue, but since the page isn't reloaded, our JS doesn't re-initialize the payment's CC fields because it is waiting on a (document).ready.  You don't seem to be using AJAX (at least not jQuery). Is there something we can use when your block refreshes are complete as an event to start our reinitialization? I was trying to use (document).ajaxComplete, but since it doesn't seem that you're using AJAX proper (via jQuery at least) this doesn't do it.  If in fact you didn't intend to trigger the onHIkashopBeforeDisplayView event, maybe you could resolve that. Otherwise, any other solutions would be appreciated.  Thanks, Paul")*

Hi,

It's normal that the onHikashopBeforeDisplayView trigger is called when the payment view is refreshed.
The javascript that you add that that point will be run by the browser, even in ajax.
However, you need to display it directly if you want it to be taken into account in ajax.
If you try to use the addScriptDeclaration or addScript functions of Joomla's library, then that javascript will be missing after the refresh as the ajax system only process the javascript directly echoed by the view being refreshed.
That's partly why you can see the javascript directly added with script tags in the show_block files of the checkout view instead of using addScriptDeclaration to add it to Joomla's document element. That way, the javascript is taken into account even in ajax.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI5LXBheW1lbnQtbWV0aG9kcy84OTYzNDgtZGlzcGxheS12aWV3LXJlZnJlc2hlcy1vbi1jaGVja291dC1jYXJ0LXF1YW50aXR5LXVwZGF0ZT90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[3by400](/forum/user/6842-3by400 "View 3by400's Profile")**
- [![3by400's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar6842.jpg)](/forum/user/6842-3by400 "View 3by400's Profile") Topic Author
- [ Offline](/forum/user/6842-3by400)

Less More

- Posts: 211
- Thank you received: 14
-
-
- [](https://3by400.com)
-

8 years 4 days ago [\#301110](#301110) by [3by400](/forum/user/6842-3by400 "View 3by400's Profile")  Replied by *[3by400](/forum/user/6842-3by400 "View 3by400's Profile")* on topic *[Display View refreshes on checkout cart quantity update](/forum/29-payment-methods/896348-display-view-refreshes-on-checkout-cart-quantity-update#301110 "-- HikaShop version -- : 4.0.0 -- Joomla version -- : 3.9.0 -- PHP version -- : 5.6.36  First, thanks for this (We avoid the shipping and payment blocks to refresh themselves when the selection is updated.) which made a world of difference.  I'm still having a minor issue with our Braintree payment plugin. When the address is updated or a new one is added during checkout, or when a product quantity is updated during checkout, the onHikashopBeforeDisplayView event is triggered. This in itself isn't a problem. But what it does is regenerate everything related to our payment method. That doesn't seem to be an issue, but since the page isn't reloaded, our JS doesn't re-initialize the payment's CC fields because it is waiting on a (document).ready.  You don't seem to be using AJAX (at least not jQuery). Is there something we can use when your block refreshes are complete as an event to start our reinitialization? I was trying to use (document).ajaxComplete, but since it doesn't seem that you're using AJAX proper (via jQuery at least) this doesn't do it.  If in fact you didn't intend to trigger the onHIkashopBeforeDisplayView event, maybe you could resolve that. Otherwise, any other solutions would be appreciated.  Thanks, Paul")*

Thanks Nicolas. I'll make those changes. Does that mean also that the addScriptOptions won't work? So I'll need to make my own AJAX call within the payment plugin to get information from Joomla to JS. Just clarifying that your comment about 'addScript functions' includes ANY activity with those functions.

Thanks, Paul

---

3by400, Inc.
[ 3by400.com](https://3by400.com)
Websites that Work, Marketing that Matters

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI5LXBheW1lbnQtbWV0aG9kcy84OTYzNDgtZGlzcGxheS12aWV3LXJlZnJlc2hlcy1vbi1jaGVja291dC1jYXJ0LXF1YW50aXR5LXVwZGF0ZT90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[Jerome](/forum/user/80-jerome "View Jerome's Profile")**
- [![Jerome's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar80.png)](/forum/user/80-jerome "View Jerome's Profile")
- [ Offline](/forum/user/80-jerome)
- HikaShop core developer

Less More

- Posts: 26402
- Thank you received: 4081
-
- [](http://obsi.dev)
-

8 years 4 days ago [\#301111](#301111) by [Jerome](/forum/user/80-jerome "View Jerome's Profile")  Replied by *[Jerome](/forum/user/80-jerome "View Jerome's Profile")* on topic *[Display View refreshes on checkout cart quantity update](/forum/29-payment-methods/896348-display-view-refreshes-on-checkout-cart-quantity-update#301111 "-- HikaShop version -- : 4.0.0 -- Joomla version -- : 3.9.0 -- PHP version -- : 5.6.36  First, thanks for this (We avoid the shipping and payment blocks to refresh themselves when the selection is updated.) which made a world of difference.  I'm still having a minor issue with our Braintree payment plugin. When the address is updated or a new one is added during checkout, or when a product quantity is updated during checkout, the onHikashopBeforeDisplayView event is triggered. This in itself isn't a problem. But what it does is regenerate everything related to our payment method. That doesn't seem to be an issue, but since the page isn't reloaded, our JS doesn't re-initialize the payment's CC fields because it is waiting on a (document).ready.  You don't seem to be using AJAX (at least not jQuery). Is there something we can use when your block refreshes are complete as an event to start our reinitialization? I was trying to use (document).ajaxComplete, but since it doesn't seem that you're using AJAX proper (via jQuery at least) this doesn't do it.  If in fact you didn't intend to trigger the onHIkashopBeforeDisplayView event, maybe you could resolve that. Otherwise, any other solutions would be appreciated.  Thanks, Paul")*

Hello,

The checkout system is made to refresh the blocks where there is a need ; when something changed.
If the modification of the billing address affect something in a payment method (make it available, change its price, or else) ; the payment block will be automatically refresh.
We are not based on jQuery since there are too many issues and conflicts to be able to use it ; we do prefer classic Javascript (also called "vanialla")
Please note that the checkout system use "events" and that is mostly how the blocks are communicating.

There is no need of "ajaxComplete" feature since the javascript within the blocks will be processed. If your payment method have some custom html with some javascript, that javascript will be processed during the refresh of the block.
Afterwards, as Nicolas explained, you can still use the addScriptDeclaration in order to push the biggest part of your JS code in the header ; then you can use the events to be notified when a checkout block is refreshed (even if I think that the best is to use the custom html to push the specific JS).

Regards,

---

Jerome - Obsidev.com
HikaMarket &amp; HikaSerial developer / HikaShop core dev team.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI5LXBheW1lbnQtbWV0aG9kcy84OTYzNDgtZGlzcGxheS12aWV3LXJlZnJlc2hlcy1vbi1jaGVja291dC1jYXJ0LXF1YW50aXR5LXVwZGF0ZT90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

Board Categories HikaShop Install &amp; Update Product &amp; Category Display Content Creation Sales and Orders Orders management Reports &amp; Statistics Customers Checkout Payment Methods Shipping Methods Import &amp; Export (CSV, XLS…) Specific Features Affilation Taxes Wishlist Vote Carousel &amp; Slider Mass Actions Filters &amp; Search Discount &amp; Coupon Feature Request Integrations Showcase General Talk about HikaShop Development HikaShop 3.0 Beta Translation Commercial Jobs HikaShop Components HikaMarket Market: Feature requests Market: How to? Market: Bug Report HikaSerial General talk about HikaSerial Serial: Bug Report Serial: How to? Support en Français de HikaSerial (French Support) HikaSubscription HikaAuction Auction: Feature requests Auction: How to? Auction: Bug report Hikashop around the world Support en Français (French Support) Russian FAQ. Курс выживания с Hikashop. Частые вопросы и о Расширения Hikashop Наши сайты на Hikashop 日本語版サポート(Japanese Support) Thai German Archives Bug Report How to?

[](/forum/topics/feed/mode-topics?format=feed&type=rss)

Time to create page: 0.046 seconds

[Powered by](/forum/credits) [Kunena Forum](https://www.kunena.org)
