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

#   refresh button in cart

##

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

Less More

- Posts: 298
- Thank you received: 5
-
-
-
- [](https://brainforge.co.uk)
-

15 years 4 months ago [\#20333](#20333) by [brainforge](/forum/user/423-brainforge "View brainforge's Profile")  *[refresh button in cart](/forum/4-how-to/20333-refresh-button-in-cart#20333 "At the end of step.php you have the following line of code:  What would be the best way to add a similar refresh button?")* was created by *[brainforge](/forum/user/423-brainforge "View brainforge's Profile")*

At the end of step.php you have the following line of code: Code:

echo $this-&gt;cart-&gt;displayButton(JText::_('CONTINUE_SHOPPING'),'continue_shopping',$this-&gt;params,JRoute::_($this-&gt;continueShopping),'window.location=\''.JRoute::_($this-&gt;continueShopping).'\';return false;','id="hikashop_checkout_shopping_button"');

What would be the best way to add a similar refresh button?

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzQtaG93LXRvLzIwMzMzLXJlZnJlc2gtYnV0dG9uLWluLWNhcnQ/dG1wbD1tYXJrZG93bg==) 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: 86578
- Thank you received: 14321
-
-

15 years 4 months ago [\#20346](#20346) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Re: refresh button in cart](/forum/4-how-to/20333-refresh-button-in-cart#20346 "At the end of step.php you have the following line of code:  What would be the best way to add a similar refresh button?")*

Like that maybe:
echo $this-&gt;cart-&gt;displayButton(JText::_('REFRESH'),'refresh',$this-&gt;params,'#','location.reload(true);return false;','id="hikashop_checkout_refresh_button"');

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

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

Less More

- Posts: 298
- Thank you received: 5
-
-
-
- [](https://brainforge.co.uk)
-

15 years 4 months ago [\#20369](#20369) by [brainforge](/forum/user/423-brainforge "View brainforge's Profile")  Replied by *[brainforge](/forum/user/423-brainforge "View brainforge's Profile")* on topic *[Re: refresh button in cart](/forum/4-how-to/20333-refresh-button-in-cart#20369 "At the end of step.php you have the following line of code:  What would be the best way to add a similar refresh button?")*

Looking at what I want to do in more detail this morning raised further issues:

(a) I have added a product quantity update icon to my checkout, like you have in the demo.
Found that if I change the quantity and click the icon it updates OK.
If I then click the icon again it submits the order - same thing happens on your demo :S
My code is: Code:

&lt;a onclick="var qty_field = document.getElementById('hikashop_checkout_quantity_&lt;?php echo $row-&gt;cart_product_id;?&gt;'); qty_field.form.submit(); return false;" href="#"&gt; &lt;img border="0" alt="Refresh" src="&lt;?php echo HIKASHOP_IMAGES; ?&gt;refresh.png"/&gt; &lt;/a&gt;

(b) The refresh button code works OK thanks (equivalent to cancel/undo).
What I also wanted was an update button.
We have auto submit payment / shipping turned off, so wanted an update button.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzQtaG93LXRvLzIwMzMzLXJlZnJlc2gtYnV0dG9uLWluLWNhcnQ/dG1wbD1tYXJrZG93bg==) 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: 86578
- Thank you received: 14321
-
-

15 years 4 months ago [\#20399](#20399) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Re: refresh button in cart](/forum/4-how-to/20333-refresh-button-in-cart#20399 "At the end of step.php you have the following line of code:  What would be the best way to add a similar refresh button?")*

a/ Indeed. We didn't think of that. A solution could be to hide the icon after submitting:

By adding a this.style.display='none'; in the onclick event after the form submission or maybe a this.disabled=true

Would you have a better idea ?

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

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

Less More

- Posts: 298
- Thank you received: 5
-
-
-
- [](https://brainforge.co.uk)
-

15 years 4 months ago -  15 years 4 months ago [\#20425](#20425) by [brainforge](/forum/user/423-brainforge "View brainforge's Profile")  Replied by *[brainforge](/forum/user/423-brainforge "View brainforge's Profile")* on topic *[Re: refresh button in cart](/forum/4-how-to/20333-refresh-button-in-cart#20425 "At the end of step.php you have the following line of code:  What would be the best way to add a similar refresh button?")*

I would be inclined to add a hidden input field to the form and then modify the onclick() javascript to set that according to which element was clicked before submitting the form.

The functionality would then be something like:

Quantity refresh icon - update values* and then always return to current page.
Next - update values* and, if validation succeeded, proceed to next page (as now).
Continue shopping - lose changes* and proceed to main shop page (as now).

*Support for the following, additional buttons (I am expecting to be asked for these!):*
Save and continue shopping - update values* and, if validation succeeded, proceed to main shop page.
Cancel - undo any changes* made so far.
Update - update values* and then always return to current page.

* = any input fields (quantities, shipping, payment, extra order information).

So I suppose the value of that hidden field would be the required action, rather than button name:
E.G. UPDATE CANCEL NEXT CANCEL-SHOP UPDATE-SHOP

Last edit: 15 years 4 months ago by [brainforge](/forum/user/423-brainforge "View brainforge's Profile").

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzQtaG93LXRvLzIwMzMzLXJlZnJlc2gtYnV0dG9uLWluLWNhcnQ/dG1wbD1tYXJrZG93bg==) 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: 86578
- Thank you received: 14321
-
-

15 years 4 months ago [\#20446](#20446) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Re: refresh button in cart](/forum/4-how-to/20333-refresh-button-in-cart#20446 "At the end of step.php you have the following line of code:  What would be the best way to add a similar refresh button?")*

adding an input field is not easy has the checkout controller returning page or action can't be controlled easily. So that would mean a lot of work to that that, even if I agree that it's a good solution. I was thinking of something more easy to implement were it would just remove the possibility to click again on the link once clicked once.

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

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

Less More

- Posts: 298
- Thank you received: 5
-
-
-
- [](https://brainforge.co.uk)
-

15 years 3 months ago [\#22635](#22635) by [brainforge](/forum/user/423-brainforge "View brainforge's Profile")  Replied by *[brainforge](/forum/user/423-brainforge "View brainforge's Profile")* on topic *[Re: refresh button in cart](/forum/4-how-to/20333-refresh-button-in-cart#22635 "At the end of step.php you have the following line of code:  What would be the best way to add a similar refresh button?")*

One solution for the product quantity update icon is to add a before / after field value check as below:

Code in checkout/cart.php of v1.5.3 Code:

&lt;div class="hikashop_cart_product_quantity_refresh"&gt; &lt;a href="#" onclick="var qty_field = document.getElementById('hikashop_checkout_quantity_&lt;?php echo $row-&gt;cart_product_id;?&gt;'); qty_field.form.submit(); return false;"&gt; &lt;img src="&lt;?php echo HIKASHOP_IMAGES . 'refresh.png';?&gt;" border="0" alt="Refresh information" /&gt; &lt;/a&gt; /div&gt;

Code in my checkout/cart.php custom view override Code:

&lt;div class="hikashop_cart_product_quantity_refresh"&gt; &lt;a onclick="var qty_field = document.getElementById('hikashop_checkout_quantity_&lt;?php echo $row-&gt;cart_product_id;?&gt;'); if (qty_field.value != '&lt;?php echo $row-&gt;cart_product_quantity; ?&gt;') qty_field.form.submit(); return false;" href="#"&gt; &lt;img border="0" alt="Refresh" src="&lt;?php echo HIKASHOP_IMAGES; ?&gt;refresh.png"/&gt; &lt;/a&gt; &lt;/div&gt;

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzQtaG93LXRvLzIwMzMzLXJlZnJlc2gtYnV0dG9uLWluLWNhcnQ/dG1wbD1tYXJrZG93bg==) 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: 86578
- Thank you received: 14321
-
-

15 years 3 months ago [\#22638](#22638) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Re: refresh button in cart](/forum/4-how-to/20333-refresh-button-in-cart#22638 "At the end of step.php you have the following line of code:  What would be the best way to add a similar refresh button?")*

Indeed. We'll do that modification. It's a small change and it's effective.
The best though might be to have a hidden input which we would set to 1 once the form would be submitted and skip the submission if that field is set to 1.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzQtaG93LXRvLzIwMzMzLXJlZnJlc2gtYnV0dG9uLWluLWNhcnQ/dG1wbD1tYXJrZG93bg==) 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.141 seconds

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