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

#   is it possible to insert coupon in cart module?

##

- **[sadaf3d](/forum/user/46256-sadaf3d "View sadaf3d's Profile")**
- [![sadaf3d's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/46256-sadaf3d "View sadaf3d's Profile") Topic Author
- [ Offline](/forum/user/46256-sadaf3d)

Less More

- Posts: 221
- Thank you received: 8
-

4 years 8 months ago [\#339577](#339577) by [sadaf3d](/forum/user/46256-sadaf3d "View sadaf3d's Profile")  *[is it possible to insert coupon in cart module?](/forum/46-discount-coupon/904004-is-it-possible-to-insert-coupon-in-cart-module#339577 "hi i want my user can insert his coupon in a field in cart module. it seems this is not possible in current hikashop cart module. can i do that with some php code change?")* was created by *[sadaf3d](/forum/user/46256-sadaf3d "View sadaf3d's Profile")*

hi
i want my user can insert his coupon in a field in cart module. it seems this is not possible in current hikashop cart module. can i do that with some php code change?

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzQ2LWRpc2NvdW50LWNvdXBvbi85MDQwMDQtaXMtaXQtcG9zc2libGUtdG8taW5zZXJ0LWNvdXBvbi1pbi1jYXJ0LW1vZHVsZT90bXBsPW1hcmtkb3du) 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: 86556
- Thank you received: 14304
-
-

4 years 8 months ago [\#339581](#339581) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[is it possible to insert coupon in cart module?](/forum/46-discount-coupon/904004-is-it-possible-to-insert-coupon-in-cart-module#339581 "hi i want my user can insert his coupon in a field in cart module. it seems this is not possible in current hikashop cart module. can i do that with some php code change?")*

Hi,

There is indeed no option for that.

You can try to do itt with such code : Code:

&lt;?php $cartClass= hikashop_get('class.cart'); $cart = $cartClass-&gt;getFullCart(); if(empty($cart-&gt;coupon)) { global $Itemid; $url_itemid= ''; if(!empty($Itemid)) $url_itemid = '&amp;Itemid='.$Itemid; ?&gt; &lt;form action="&lt;?php echo hikashop_completeLink('product&amp;task=updatecart'.$url_itemid); ?&gt;"&gt; &lt;input type="text" name="coupon" value="" onchange="this.form.submit();" /&gt; &lt;/form&gt; &lt;?php } ?&gt;

You'll want to place this outside of the form in the product / cart view file via the menu Display&gt;views

The following user(s) said Thank You: [sadaf3d](/forum/user/46256-sadaf3d "View sadaf3d's Profile")

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

- **[sadaf3d](/forum/user/46256-sadaf3d "View sadaf3d's Profile")**
- [![sadaf3d's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/46256-sadaf3d "View sadaf3d's Profile") Topic Author
- [ Offline](/forum/user/46256-sadaf3d)

Less More

- Posts: 221
- Thank you received: 8
-

4 years 8 months ago [\#339600](#339600) by [sadaf3d](/forum/user/46256-sadaf3d "View sadaf3d's Profile")  Replied by *[sadaf3d](/forum/user/46256-sadaf3d "View sadaf3d's Profile")* on topic *[is it possible to insert coupon in cart module?](/forum/46-discount-coupon/904004-is-it-possible-to-insert-coupon-in-cart-module#339600 "hi i want my user can insert his coupon in a field in cart module. it seems this is not possible in current hikashop cart module. can i do that with some php code change?")*

1-can you check your code? i copy your code to correct path but it is not work. it is render empty field for input coupon and when i enter the valid coupon and press Enter or click on the cart , it is only redirect to hikashop checkout link without change total price or do anythink. it is maybe i set some hikashop property or configuration incompatible with your code?
simply i want my user can input his coupon in cart module and then change the total price and then redirect user to payment gateway.
2-is it possible add another button to redirect to payment directly without go to check out?

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzQ2LWRpc2NvdW50LWNvdXBvbi85MDQwMDQtaXMtaXQtcG9zc2libGUtdG8taW5zZXJ0LWNvdXBvbi1pbi1jYXJ0LW1vZHVsZT90bXBsPW1hcmtkb3du) 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: 86556
- Thank you received: 14304
-
-

4 years 8 months ago [\#339606](#339606) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[is it possible to insert coupon in cart module?](/forum/46-discount-coupon/904004-is-it-possible-to-insert-coupon-in-cart-module#339606 "hi i want my user can insert his coupon in a field in cart module. it seems this is not possible in current hikashop cart module. can i do that with some php code change?")*

Hi,

1. The code I wrote to you is fine. However, while trying it, I found that there is some code that needs to be changed in HikaShop for this to work.
The code: Code:

$used_data = array('form' =&gt; $formData, 'type' =&gt; $type); $status = $cartClass-&gt;update($formData, 0, $add, $type, true, false, $cart_id);

needs to change to: Code:

if(count($formData)) { $used_data = array('form' =&gt; $formData, 'type' =&gt; $type); $status = $cartClass-&gt;update($formData, 0, $add, $type, true, false, $cart_id); }

in the file components/com_hikashop/controllers/product.php and then it works fine and add the coupon to the cart.
We'll add that change on our end for the next version of HikaShop.

2. It depends on how your checkout workflow is configured.
If the user has to fill the guest form or login or register, then it won't be possible.
Otherwise, you can do so like that: Code:

&lt;?php global $Itemid; $url_itemid= ''; if(!empty($Itemid)) $url_itemid = '&amp;Itemid='.$Itemid; ?&gt; &lt;a href="&lt;?php echo hikashop_completeLink('checkout&amp;task=confirm'.$url_itemid); ?&gt;" class="hikabtn"&gt;go to payment&lt;/a&gt;

The following user(s) said Thank You: [sadaf3d](/forum/user/46256-sadaf3d "View sadaf3d's Profile")

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

- **[sadaf3d](/forum/user/46256-sadaf3d "View sadaf3d's Profile")**
- [![sadaf3d's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/46256-sadaf3d "View sadaf3d's Profile") Topic Author
- [ Offline](/forum/user/46256-sadaf3d)

Less More

- Posts: 221
- Thank you received: 8
-

4 years 8 months ago -  4 years 8 months ago [\#339629](#339629) by [sadaf3d](/forum/user/46256-sadaf3d "View sadaf3d's Profile")  Replied by *[sadaf3d](/forum/user/46256-sadaf3d "View sadaf3d's Profile")* on topic *[is it possible to insert coupon in cart module?](/forum/46-discount-coupon/904004-is-it-possible-to-insert-coupon-in-cart-module#339629 "hi i want my user can insert his coupon in a field in cart module. it seems this is not possible in current hikashop cart module. can i do that with some php code change?")*

1- i do all that you say and it is not work yet. please see this screencast:
[ www.screencast.com/users/samansamani2/fo...42-9607-61008edf205b](https://www.screencast.com/users/samansamani2/folders/Default/media/feebf141-e420-4d42-9607-61008edf205b)
2- it is work correctlly and thank you

Last edit: 4 years 8 months ago by [sadaf3d](/forum/user/46256-sadaf3d "View sadaf3d's Profile").

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzQ2LWRpc2NvdW50LWNvdXBvbi85MDQwMDQtaXMtaXQtcG9zc2libGUtdG8taW5zZXJ0LWNvdXBvbi1pbi1jYXJ0LW1vZHVsZT90bXBsPW1hcmtkb3du) 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: 86556
- Thank you received: 14304
-
-

4 years 8 months ago [\#339636](#339636) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[is it possible to insert coupon in cart module?](/forum/46-discount-coupon/904004-is-it-possible-to-insert-coupon-in-cart-module#339636 "hi i want my user can insert his coupon in a field in cart module. it seems this is not possible in current hikashop cart module. can i do that with some php code change?")*

Hi,

1. As I said in my first message, you need to put that code "outside of the form". However, in your screencast, I can see the &lt;/form&gt; tag after my code, which means that this code is inside the form of the view. That's why it doesn't work. You need to move the code after the &lt;/form&gt; tag

The following user(s) said Thank You: [sadaf3d](/forum/user/46256-sadaf3d "View sadaf3d's Profile")

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

- **[sadaf3d](/forum/user/46256-sadaf3d "View sadaf3d's Profile")**
- [![sadaf3d's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/46256-sadaf3d "View sadaf3d's Profile") Topic Author
- [ Offline](/forum/user/46256-sadaf3d)

Less More

- Posts: 221
- Thank you received: 8
-

4 years 8 months ago [\#339667](#339667) by [sadaf3d](/forum/user/46256-sadaf3d "View sadaf3d's Profile")  Replied by *[sadaf3d](/forum/user/46256-sadaf3d "View sadaf3d's Profile")* on topic *[is it possible to insert coupon in cart module?](/forum/46-discount-coupon/904004-is-it-possible-to-insert-coupon-in-cart-module#339667 "hi i want my user can insert his coupon in a field in cart module. it seems this is not possible in current hikashop cart module. can i do that with some php code change?")*

thank you @nicolas and excuse me for my mistake.
i was put it out of form tag in my previous test. i put it now out of form tag. it is work correctly and thank you.
for better UX is it possible change the total price via ajax in the Cart? now it is effect on total price but it is redirect to checkout progress. i want my user can see change the total price change in cart module after they enter coupon exactly such as checkout step.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzQ2LWRpc2NvdW50LWNvdXBvbi85MDQwMDQtaXMtaXQtcG9zc2libGUtdG8taW5zZXJ0LWNvdXBvbi1pbi1jYXJ0LW1vZHVsZT90bXBsPW1hcmtkb3du) 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: 86556
- Thank you received: 14304
-
-

4 years 8 months ago [\#339668](#339668) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[is it possible to insert coupon in cart module?](/forum/46-discount-coupon/904004-is-it-possible-to-insert-coupon-in-cart-module#339668 "hi i want my user can insert his coupon in a field in cart module. it seems this is not possible in current hikashop cart module. can i do that with some php code change?")*

Hi,

With custom javascript code in the code I gave it should be possible.
Please understand however that the code I've given you so far is already beyond normal user support.
If you want me to work on the modifications necessary to make it AJAX, please use our contact form to request a quote and I can do.
[ www.hikashop.com/support/contact-us.html](https://www.hikashop.com/support/contact-us.html)

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

- **[sadaf3d](/forum/user/46256-sadaf3d "View sadaf3d's Profile")**
- [![sadaf3d's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/46256-sadaf3d "View sadaf3d's Profile") Topic Author
- [ Offline](/forum/user/46256-sadaf3d)

Less More

- Posts: 221
- Thank you received: 8
-

4 years 8 months ago -  4 years 8 months ago [\#339774](#339774) by [sadaf3d](/forum/user/46256-sadaf3d "View sadaf3d's Profile")  Replied by *[sadaf3d](/forum/user/46256-sadaf3d "View sadaf3d's Profile")* on topic *[is it possible to insert coupon in cart module?](/forum/46-discount-coupon/904004-is-it-possible-to-insert-coupon-in-cart-module#339774 "hi i want my user can insert his coupon in a field in cart module. it seems this is not possible in current hikashop cart module. can i do that with some php code change?")*

> nicolas wrote: Please understand however that the code I've given you so far is already beyond normal user support.

I understand that and thank a lot for your reply and i am very grateful to you. I have to thank you for your kindness .
i use this code and it work for me maybe have benefit for future users. Take a look at these codes if your time allows.
with this code coupon can add ajaxify or remove in cart module in every page except hikashop checkout page.
in view product&gt;cart i put these code:

Code:

&lt;?php /** * @package HikaShop for Joomla! * @version 4.4.0 * @author hikashop.com * @copyright (C) 2010-2020 HIKARI SOFTWARE. All rights reserved. * @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html */ defined('_JEXEC') or die('Restricted access'); ?&gt;&lt;?php $tmpl = hikaInput::get()-&gt;getWord('tmpl', ''); $module_id = (int)$this-&gt;params-&gt;get('id', 0); if(!in_array($tmpl, array('component', 'ajax', 'raw'))) { $events = ($this-&gt;cart_type == 'cart') ? '["cart.updated","checkout.cart.updated"]' : '"wishlist.updated"'; ?&gt; &lt;script type="text/javascript"&gt; window.Oby.registerAjax(&lt;?php echo $events; ?&gt;, function(params) { var o = window.Oby, el = document.getElementById('hikashop_cart_&lt;?php echo $module_id; ?&gt;'); if(!el) return; if(params &amp;&amp; params.resp &amp;&amp; (params.resp.ret === 0 &#124;&#124; params.resp.module == &lt;?php echo (int)$module_id; ?&gt;)) return; if(params &amp;&amp; params.type &amp;&amp; params.type != '&lt;?php echo $this-&gt;cart_type; ?&gt;') return; o.addClass(el, "hikashop_checkout_loading"); o.xRequest("&lt;?php echo hikashop_completeLink('product&amp;task=cart&amp;module_id='.$module_id . '&amp;module_type='.$this-&gt;cart_type, true, false, true); ?&gt;", {update: el, mode:'POST', data:'return_url=&lt;?php echo urlencode(base64_encode(hikashop_currentURL('return_url'))); ?&gt;'}, function(xhr){ o.removeClass(el, "hikashop_checkout_loading"); }); }); &lt;/script&gt; &lt;?php } elseif(!headers_sent()){ header('X-Robots-Tag: noindex'); } $group = (int)$this-&gt;config-&gt;get('group_options', 0); $small_cart = (int)$this-&gt;params-&gt;get('small_cart', 0); $link_to_product = (int)$this-&gt;params-&gt;get('link_to_product_page', 1); $spinner_css=""; if (!empty($small_cart)) $spinner_css="small_spinner small_cart"; if(empty($this-&gt;rows)) { $hidecart = (int)$this-&gt;params-&gt;get('hide_cart', 0); $desc = trim($this-&gt;params-&gt;get('msg')); if((empty($desc) &amp;&amp; $desc != '0') &#124;&#124; $hidecart == 0) $desc = ($this-&gt;cart_type == 'cart') ? JText::_('CART_EMPTY') : JText::_('WISHLIST_EMPTY'); if($hidecart == 2) $desc = ''; if(empty($desc) &amp;&amp; $desc != '0' &amp;&amp; $tmpl == 'component') { if(!headers_sent()) header('Content-Type: text/css; charset=utf-8'); exit; } if(!empty($desc)) echo $this-&gt;notice_html; if(!in_array($tmpl, array('component', 'ajax', 'raw'))) { ?&gt; &lt;div id="hikashop_cart_&lt;?php echo $module_id; ?&gt;" class="hikashop_cart"&gt; &lt;?php } ?&gt; &lt;div class="hikashop_checkout_loading_elem"&gt;&lt;/div&gt; &lt;div class="hikashop_checkout_loading_spinner &lt;?php echo $spinner_css ?&gt;"&gt;&lt;/div&gt; &lt;?php if(!empty($desc)) echo $desc; if(!in_array($tmpl, array('component', 'ajax', 'raw'))) { ?&gt; &lt;/div&gt; &lt;div class="clear_both"&gt;&lt;/div&gt; &lt;?php } return; } $css_button = $this-&gt;config-&gt;get('css_button', 'hikabtn'); $css_button_checkout = $this-&gt;config-&gt;get('css_button_checkout', 'hikashop_cart_proceed_to_checkout'); if($this-&gt;params-&gt;get('print_cart', 0)) { $print_button = $this-&gt;popup-&gt;display( '&lt;i class="fas fa-print"&gt;&lt;/i&gt;', 'HIKA_PRINT', hikashop_completeLink('cart&amp;task=printcart&amp;cid='.$this-&gt;element-&gt;cart_id, true), 'hikashop_print_popup', 760, 480, 'title="'.JText::_('HIKA_PRINT').'"', '', 'link' ); } $this-&gt;setLayout('listing_price'); $this-&gt;params-&gt;set('show_quantity_field', 0); if(!in_array($tmpl, array('component', 'ajax', 'raw'))) { ?&gt; &lt;div id="hikashop_cart_&lt;?php echo $module_id; ?&gt;" class="hikashop_cart"&gt; &lt;?php } ?&gt; &lt;div class="hikashop_checkout_loading_elem"&gt;&lt;/div&gt; &lt;div class="hikashop_checkout_loading_spinner &lt;?php echo $spinner_css ?&gt;"&gt;&lt;/div&gt; &lt;?php echo $this-&gt;notice_html; if(!empty($this-&gt;element-&gt;messages)) { foreach($this-&gt;element-&gt;messages as $msg) { if(empty($msg['type'])) $msg['type'] = 'success'; hikashop_display($msg['msg'], $msg['type']); } } $text = ''; if(!empty($small_cart)) { $price_name = ''; if(!$this-&gt;params-&gt;get('show_shipping', 0) &amp;&amp; isset($this-&gt;total-&gt;prices[0]-&gt;price_value_without_shipping)){ $price_name = '_without_shipping'; } if(!$this-&gt;params-&gt;get('show_coupon', 0) &amp;&amp; isset($this-&gt;total-&gt;prices[0]-&gt;price_value_without_discount)){ $price_name = '_without_discount'; } $price = ''; if($this-&gt;params-&gt;get('price_with_tax')){ $var_name = 'price_value'.$price_name.'_with_tax'; $price .= $this-&gt;currencyClass-&gt;format(@$this-&gt;total-&gt;prices[0]-&gt;$var_name, $this-&gt;total-&gt;prices[0]-&gt;price_currency_id); } if($this-&gt;params-&gt;get('price_with_tax')==2){ $price .= JText::_('PRICE_BEFORE_TAX'); } if($this-&gt;params-&gt;get('price_with_tax')==2&#124;&#124;!$this-&gt;params-&gt;get('price_with_tax')){ $var_name = 'price_value'.$price_name; $price .= $this-&gt;currencyClass-&gt;format(@$this-&gt;total-&gt;prices[0]-&gt;price_value, $this-&gt;total-&gt;prices[0]-&gt;price_currency_id); } if($this-&gt;params-&gt;get('price_with_tax')==2){ $price .= JText::_('PRICE_AFTER_TAX'); } if((int)$this-&gt;params-&gt;get('show_cart_quantity', 1)) { $qty = 0; foreach($this-&gt;element-&gt;cart_products as $i =&gt; $row) { if(empty($row-&gt;cart_product_quantity) &amp;&amp; $this-&gt;element-&gt;cart_type == 'cart') continue; if($group &amp;&amp; $row-&gt;cart_product_option_parent_id) continue; $qty += $row-&gt;cart_product_quantity; } if($this-&gt;params-&gt;get('show_price')){ if($qty == 1 &amp;&amp; JText::_('X_ITEM_FOR_X') != 'X_ITEM_FOR_X') { $text = JText::sprintf('X_ITEM_FOR_X', $qty, $price); } else { $text = JText::sprintf('X_ITEMS_FOR_X', $qty, $price); } }else{ if($qty == 1) $text = JText::sprintf('X_ITEM', $qty); else $text = JText::sprintf('X_ITEMS', $qty); } } else { if($this-&gt;params-&gt;get('show_price')) $text = JText::sprintf('TOTAL_IN_CART_X', $price); else $text = JText::_('MINI_CART_PROCEED_TO_CHECKOUT'); } unset($this-&gt;row); $extra_data = ''; if($this-&gt;element-&gt;cart_type == 'cart') { $link = $this-&gt;url_checkout; } else { $link = hikashop_completeLink('cart&amp;task=showcart&amp;cart_id='.$this-&gt;element-&gt;cart_id.'&amp;cart_type='.$this-&gt;element-&gt;cart_type . $this-&gt;cart_itemid); } if($small_cart == 2) { $extra_data .= ' onclick="if(window.hikashop.toggleOverlayBlock(\'hikashop_cart_dropdown_'.$module_id.'\')) return false;"'; }elseif($small_cart == 3) { $extra_data .= ' ontouchend="window.hikashop.toggleOverlayBlock(\'hikashop_cart_dropdown_'.$module_id.'\', \'hover\'); return false;" onmouseover="window.hikashop.toggleOverlayBlock(\'hikashop_cart_dropdown_'.$module_id.'\', \'hover\'); return false;"'; } ?&gt; &lt;a class="hikashop_small_cart_checkout_link" href="&lt;?php echo $link; ?&gt;"&lt;?php echo $extra_data; ?&gt;&gt; &lt;span class="hikashop_small_cart_total_title"&gt;&lt;?php echo $text; ?&gt;&lt;/span&gt; &lt;/a&gt; &lt;?php if($this-&gt;element-&gt;cart_type == 'cart' &amp;&amp; $small_cart == 1 &amp;&amp; $this-&gt;params-&gt;get('print_cart', 0)) { ?&gt; &lt;span class="hikashop_checkout_cart_print_link"&gt; &lt;?php echo $print_button; ?&gt; &lt;/span&gt; &lt;?php } if($this-&gt;element-&gt;cart_type == 'cart' &amp;&amp; $small_cart == 1 &amp;&amp; $this-&gt;params-&gt;get('show_cart_delete', 1)) { $delete = hikashop_completeLink('product&amp;task=cleancart'); ?&gt; &lt;a class="hikashop_small_cart_clean_link" title="&lt;?php echo JText::_('EMPTY_THE_CART'); ?&gt;" href="&lt;?php echo $delete; ?&gt;" onclick="window.location='&lt;?php echo $delete. (strpos($delete, '?') ? '&amp;amp;' : '?') .'return_url='; ?&gt;'+window.btoa(window.location); return false;"&gt; &lt;i class="fa fa-times-circle"&gt;&lt;/i&gt; &lt;/a&gt; &lt;?php } if($this-&gt;element-&gt;cart_type == 'cart' &amp;&amp; $small_cart == 1 &amp;&amp; $this-&gt;params-&gt;get('show_cart_proceed', 1)) { ?&gt; &lt;a class="&lt;?php echo $css_button . ' ' . $css_button_checkout; ?&gt;" href="&lt;?php echo $this-&gt;url_checkout; ?&gt;" onclick="if(this.disable) return false; this.disable = true;"&gt;&lt;span&gt;&lt;?php echo JText::_('PROCEED_TO_CHECKOUT'); ?&gt;&lt;/span&gt;&lt;/a&gt; &lt;?php } if($small_cart == 1) { ?&gt; &lt;/div&gt; &lt;div class="clear_both"&gt;&lt;/div&gt; &lt;?php return; } $alignment = ''; $v = (int)$this-&gt;params-&gt;get('dropdown_left', 0); if($v != 0) $alignment .= 'left:'.(-$v).'px;'; $v = (int)$this-&gt;params-&gt;get('dropdown_right', 0); if($v != 0) $alignment .= 'right:'.(-$v).'px;'; ?&gt; &lt;div class="hikashop_cart_dropdown_container"&gt; &lt;div class="hikashop_cart_dropdown_content" id="hikashop_cart_dropdown_&lt;?php echo $module_id; ?&gt;" style="display:none;&lt;?php echo $alignment; ?&gt;"&gt; &lt;?php } $shows = array( 'price' =&gt; (int)$this-&gt;params-&gt;get('show_price', 1), 'coupon' =&gt; (int)$this-&gt;params-&gt;get('show_coupon', 0), 'shipping' =&gt; (int)$this-&gt;params-&gt;get('show_shipping', 0), 'payment' =&gt; (int)$this-&gt;params-&gt;get('show_payment', 0), 'taxes' =&gt; (int)$this-&gt;params-&gt;get('show_taxes', 0), ); $columns = array( 'image' =&gt; (int)$this-&gt;params-&gt;get('image_in_cart', 0), 'name' =&gt; (int)$this-&gt;params-&gt;get('show_cart_product_name', 1), 'quantity' =&gt; (int)$this-&gt;params-&gt;get('show_cart_quantity', 1), 'price' =&gt; (int)$shows['price'], 'delete' =&gt; (int)$this-&gt;params-&gt;get('show_cart_delete', 1) ); $nb_columns = 0; foreach($columns as $c) { if(!empty($c)) $nb_columns++; } ?&gt; &lt;form action="&lt;?php echo hikashop_completeLink('product&amp;task=updatecart'.$this-&gt;url_itemid, false, true); ?&gt;" method="post" name="hikashop_&lt;?php echo $this-&gt;element-&gt;cart_type; ?&gt;_form" onsubmit="if(window.hikashop) return window.hikashop.submitCartModule(this, 'hikashop_cart_&lt;?php echo $module_id; ?&gt;', '&lt;?php echo $this-&gt;element-&gt;cart_type; ?&gt;');"&gt; &lt;table class="hikashop_cart" width="100%"&gt; &lt;thead&gt; &lt;tr&gt; &lt;?php if(!empty($columns['image'])) { ?&gt; &lt;th class="hikashop_cart_module_product_image_title hikashop_cart_title"&gt;&lt;?php echo JText::_('CART_PRODUCT_IMAGE'); ?&gt;&lt;/th&gt; &lt;?php } ?&gt; &lt;?php if(!empty($columns['name'])) { ?&gt; &lt;th class="hikashop_cart_module_product_name_title hikashop_cart_title"&gt;&lt;?php echo JText::_('CART_PRODUCT_NAME'); ?&gt;&lt;/th&gt; &lt;?php } ?&gt; &lt;?php if(!empty($columns['quantity'])) { ?&gt; &lt;th class="hikashop_cart_module_product_quantity_title hikashop_cart_title"&gt;&lt;?php echo JText::_('CART_PRODUCT_QUANTITY'); ?&gt;&lt;/th&gt; &lt;?php } ?&gt; &lt;?php if(!empty($columns['price'])) { ?&gt; &lt;th class="hikashop_cart_module_product_price_title hikashop_cart_title"&gt;&lt;?php echo JText::_('CART_PRODUCT_PRICE'); ?&gt;&lt;/th&gt; &lt;?php } ?&gt; &lt;?php if($nb_columns == 0) { ?&gt; &lt;th&gt;&lt;/th&gt; &lt;?php } if($this-&gt;params-&gt;get('print_cart', 0)) { ?&gt; &lt;th class="hikashop_cart_module_product_image_title hikashop_cart_title"&gt; &lt;span class="hikashop_checkout_cart_print_link" style="width: 16px; display: inline-block;"&gt; &lt;?php echo $print_button; ?&gt; &lt;/span&gt; &lt;/th&gt; &lt;?php } ?&gt; &lt;/tr&gt; &lt;/thead&gt; &lt;?php if(!empty($shows['price']) &amp;&amp; $this-&gt;element-&gt;cart_type == 'cart') { $colspan = $nb_columns - (empty($columns['delete']) ? 1 : 2); ?&gt; &lt;tfoot&gt; &lt;?php if(!empty($shows['coupon']) &amp;&amp; !empty($this-&gt;element-&gt;coupon)) { ?&gt; &lt;tr&gt; &lt;?php if($colspan &gt; 0) { ?&gt; &lt;td class="hikashop_cart_module_coupon_title" colspan="&lt;?php echo $colspan; ?&gt;"&gt;&lt;?php echo JText::_('HIKASHOP_COUPON'); ?&gt;&lt;/td&gt; &lt;?php } ?&gt; &lt;td class="hikashop_cart_module_coupon_value"&gt;&lt;?php if(!$this-&gt;params-&gt;get('price_with_tax')) echo $this-&gt;currencyClass-&gt;format(@$this-&gt;element-&gt;coupon-&gt;discount_value_without_tax * -1, @$this-&gt;element-&gt;coupon-&gt;discount_currency_id); else echo $this-&gt;currencyClass-&gt;format(@$this-&gt;element-&gt;coupon-&gt;discount_value * -1, @$this-&gt;element-&gt;coupon-&gt;discount_currency_id); ?&gt;&lt;/td&gt; &lt;?php if(!empty($columns['delete'])) { ?&gt; &lt;td&gt;&lt;/td&gt; &lt;?php } ?&gt; &lt;/tr&gt; &lt;?php } ?&gt; &lt;?php if(!empty($shows['payment']) &amp;&amp; !empty($this-&gt;element-&gt;payment) &amp;&amp; $this-&gt;element-&gt;payment-&gt;payment_price !== null) { ?&gt; &lt;tr&gt; &lt;?php if($colspan &gt; 0) { ?&gt; &lt;td class="hikashop_cart_module_payment_title" colspan="&lt;?php echo $colspan; ?&gt;"&gt;&lt;?php echo JText::_('HIKASHOP_PAYMENT'); ?&gt;&lt;/td&gt; &lt;?php } ?&gt; &lt;td class="hikashop_cart_module_payment_value"&gt;&lt;?php echo $this-&gt;currencyClass-&gt;format($this-&gt;payment_price, $this-&gt;total-&gt;prices[0]-&gt;price_currency_id); ?&gt;&lt;/td&gt; &lt;?php if(!empty($columns['delete'])) { ?&gt; &lt;td&gt;&lt;/td&gt; &lt;?php } ?&gt; &lt;/tr&gt; &lt;?php } ?&gt; &lt;?php if(!empty($shows['shipping']) &amp;&amp; !empty($this-&gt;element-&gt;shipping) &amp;&amp; $this-&gt;shipping_price !== null) { ?&gt; &lt;tr&gt; &lt;?php if($colspan &gt; 0) { ?&gt; &lt;td class="hikashop_cart_module_shipping_title" colspan="&lt;?php echo $colspan; ?&gt;"&gt;&lt;?php echo JText::_('HIKASHOP_SHIPPING'); ?&gt;&lt;/td&gt; &lt;?php } ?&gt; &lt;td class="hikashop_cart_module_shipping_value"&gt;&lt;?php echo $this-&gt;currencyClass-&gt;format($this-&gt;shipping_price, $this-&gt;total-&gt;prices[0]-&gt;price_currency_id); ?&gt;&lt;/td&gt; &lt;?php if(!empty($columns['delete'])) { ?&gt; &lt;td&gt;&lt;/td&gt; &lt;?php } ?&gt; &lt;/tr&gt; &lt;?php } ?&gt; &lt;?php if(!empty($shows['taxes']) &amp;&amp; isset($this-&gt;total-&gt;prices[0])) { if ($this-&gt;config-&gt;get('detailed_tax_display') &amp;&amp; !empty($this-&gt;total-&gt;prices[0]-&gt;taxes)) { foreach($this-&gt;displayingPrices-&gt;taxes as $taxname =&gt; $taxdata){ ?&gt; &lt;tr&gt; &lt;?php if($colspan &gt; 0) { ?&gt; &lt;td class="hikashop_cart_module_tax_title" colspan="&lt;?php echo $colspan; ?&gt;"&gt;&lt;?php echo hikashop_translate($taxname); ?&gt;&lt;/td&gt; &lt;?php } ?&gt; &lt;td class="hikashop_cart_module_tax_value"&gt;&lt;?php echo $this-&gt;currencyClass-&gt;format($taxdata-&gt;tax_amount, $this-&gt;displayingPrices-&gt;price_currency_id); ?&gt;&lt;/td&gt; &lt;?php if(!empty($columns['delete'])) { ?&gt; &lt;td&gt;&lt;/td&gt; &lt;?php } ?&gt; &lt;/tr&gt; &lt;?php } }else{ ?&gt; &lt;tr&gt; &lt;?php if($colspan &gt; 0) { ?&gt; &lt;td class="hikashop_cart_module_tax_title" colspan="&lt;?php echo $colspan; ?&gt;"&gt;&lt;?php echo JText::_('TAXES'); ?&gt;&lt;/td&gt; &lt;?php } ?&gt; &lt;td class="hikashop_cart_module_tax_value"&gt;&lt;?php $taxes = round($this-&gt;displayingPrices-&gt;total-&gt;price_value_with_tax - $this-&gt;displayingPrices-&gt;total-&gt;price_value, $this-&gt;currencyClass-&gt;getRounding($this-&gt;displayingPrices-&gt;price_currency_id)); echo $this-&gt;currencyClass-&gt;format($taxes, $this-&gt;displayingPrices-&gt;price_currency_id); ?&gt;&lt;/td&gt; &lt;?php if(!empty($columns['delete'])) { ?&gt; &lt;td&gt;&lt;/td&gt; &lt;?php } ?&gt; &lt;/tr&gt; &lt;?php } } ?&gt; &lt;tr&gt; &lt;?php if($colspan &gt; 0) { ?&gt; &lt;td class="hikashop_cart_module_product_total_title" colspan="&lt;?php echo $colspan; ?&gt;"&gt;&lt;?php echo JText::_('HIKASHOP_TOTAL'); ?&gt;&lt;/td&gt; &lt;?php } ?&gt; &lt;td class="hikashop_cart_module_product_total_value"&gt;&lt;?php if($this-&gt;params-&gt;get('price_with_tax', 3) == 3) { $this-&gt;params-&gt;set('price_with_tax', (int)$this-&gt;config-&gt;get('price_with_tax')); } $total_price = ''; if($this-&gt;params-&gt;get('price_with_tax')){ $total_price .= $this-&gt;currencyClass-&gt;format($this-&gt;displayingPrices-&gt;total-&gt;price_value_with_tax, $this-&gt;displayingPrices-&gt;price_currency_id); } if($this-&gt;params-&gt;get('price_with_tax')==2){ $total_price .= JText::_('PRICE_BEFORE_TAX'); } if($this-&gt;params-&gt;get('price_with_tax')==2&#124;&#124;!$this-&gt;params-&gt;get('price_with_tax')){ $total_price .= $this-&gt;currencyClass-&gt;format($this-&gt;displayingPrices-&gt;total-&gt;price_value, $this-&gt;displayingPrices-&gt;price_currency_id); } if($this-&gt;params-&gt;get('price_with_tax')==2){ $total_price .= JText::_('PRICE_AFTER_TAX'); } ?&gt; &lt;span class="hikashop_product_price_full"&gt; &lt;span class="hikashop_product_price hikashop_product_price_0"&gt; &lt;?php echo $total_price; ?&gt; &lt;/span&gt; &lt;/span&gt; &lt;/td&gt; &lt;?php //exit; ?&gt; &lt;?php if(!empty($columns['delete'])) { ?&gt; &lt;td&gt;&lt;/td&gt; &lt;?php } ?&gt; &lt;/tr&gt; &lt;/tfoot&gt; &lt;?php } ?&gt; &lt;tbody&gt; &lt;?php $group = $this-&gt;config-&gt;get('group_options', 0); $width = (int)$this-&gt;config-&gt;get('cart_thumbnail_x', 50); $height = (int)$this-&gt;config-&gt;get('cart_thumbnail_y', 50); $image_options = array( 'default' =&gt; true, 'forcesize' =&gt; $this-&gt;config-&gt;get('image_force_size', true), 'scale' =&gt; $this-&gt;config-&gt;get('image_scale_mode','inside') ); $k = 0; foreach($this-&gt;element-&gt;products as $k =&gt; $product) { if($group &amp;&amp; !empty($product-&gt;cart_product_option_parent_id)) continue; if(empty($product-&gt;cart_product_quantity) &#124;&#124; substr($k,0,1) === 'p') continue; $cart_product = $this-&gt;element-&gt;cart_products[$k]; ?&gt; &lt;tr class="row&lt;?php echo $k; ?&gt;"&gt; &lt;?php if(!empty($columns['image'])) { ?&gt; &lt;td class="hikashop_cart_module_product_image hikashop_cart_value" style="vertical-align:middle !important;text-align:center;"&gt;&lt;?php $img = $this-&gt;imageHelper-&gt;getThumbnail(@$product-&gt;images[0]-&gt;file_path, array('width' =&gt; $width, 'height' =&gt; $height), $image_options); if($img-&gt;success) { $attributes = ''; if($img-&gt;external) $attributes = ' width="'.$img-&gt;req_width.'" height="'.$img-&gt;req_height.'"'; ?&gt;&lt;img class="hikashop_product_cart_image" title="&lt;?php echo $this-&gt;escape(@$product-&gt;images[0]-&gt;file_description); ?&gt;" alt="&lt;?php echo $this-&gt;escape(@$product-&gt;images[0]-&gt;file_name); ?&gt;" src="&lt;?php echo $img-&gt;url; ?&gt;" &lt;?php echo $attributes; ?&gt;/&gt;&lt;?php } ?&gt;&lt;/td&gt; &lt;?php } ?&gt; &lt;?php if(!empty($columns['name'])) { ?&gt; &lt;td class="hikashop_cart_module_product_name_value hikashop_cart_value"&gt; &lt;?php if($link_to_product == 1) { ?&gt;&lt;a href="&lt;?php echo hikashop_contentLink('product&amp;task=show&amp;cid='.$product-&gt;product_id.'&amp;name='.$product-&gt;alias.$this-&gt;url_itemid, $product);?&gt;"&gt;&lt;?php } ?&gt; &lt;?php echo $product-&gt;product_name; ?&gt; &lt;?php if ($this-&gt;config-&gt;get('show_code')) { ?&gt;&lt;span class="hikashop_product_code_cart"&gt;&lt;?php echo $product-&gt;product_code; ?&gt;&lt;/span&gt;&lt;?php } ?&gt; &lt;?php if($link_to_product == 1) { ?&gt;&lt;/a&gt;&lt;?php } ?&gt; &lt;?php $html = ''; if(hikashop_level(2) &amp;&amp; !empty($this-&gt;itemFields)) { foreach($this-&gt;itemFields as $field) { $namekey = $field-&gt;field_namekey; if(empty($cart_product-&gt;$namekey) &#124;&#124; !strlen($cart_product-&gt;$namekey)) continue; $html .= '&lt;p class="hikashop_cart_item_'.$namekey.'"&gt;' . $this-&gt;fieldsClass-&gt;getFieldName($field) . ': ' . $this-&gt;fieldsClass-&gt;show($field, $cart_product-&gt;$namekey) . '&lt;/p&gt;'; } } if($group) { foreach($this-&gt;element-&gt;products as $j =&gt; $optionElement) { if($optionElement-&gt;cart_product_option_parent_id != $product-&gt;cart_product_id) continue; if(!empty($optionElement-&gt;variant_name)) { $text = $optionElement-&gt;variant_name; } elseif(empty($optionElement-&gt;characteristics_text)){ $text = $optionElement-&gt;product_name; } else { $text = $optionElement-&gt;characteristics_text; } $html .= '&lt;p class="hikashop_cart_option_name"&gt;'. $text . '&lt;/p&gt;'; } } if(!empty($html)) { ?&gt; &lt;div class="hikashop_cart_product_custom_item_fields"&gt;&lt;?php echo $html; ?&gt;&lt;/div&gt; &lt;?php } ?&gt; &lt;/td&gt; &lt;?php } ?&gt; &lt;?php if(!empty($columns['quantity'])) { ?&gt; &lt;td class="hikashop_cart_module_product_quantity_value hikashop_cart_value"&gt;&lt;?php $this-&gt;row =&amp; $product; $this-&gt;quantityLayout = $this-&gt;cartHelper-&gt;getProductQuantityLayout($this-&gt;row); if(!in_array($this-&gt;quantityLayout, array('show_simple','show_select','show_select_price','show_none'))) $this-&gt;quantityLayout = 'show_simple'; echo $this-&gt;loadHkLayout('quantity', array( 'quantity_fieldname' =&gt; 'item['.$product-&gt;cart_product_id.'][cart_product_quantity]', 'onchange_script' =&gt; 'window.hikashop.checkQuantity(this); if(this.value == '.(int)$product-&gt;cart_product_quantity.'){ return; } if(this.form.onsubmit &amp;&amp; !this.form.onsubmit()) return; this.form.submit();', )); ?&gt;&lt;/td&gt; &lt;?php } ?&gt; &lt;?php if(!empty($columns['price'])) { if($group) { foreach($this-&gt;element-&gt;products as $j =&gt; $optionElement) { if($optionElement-&gt;cart_product_option_parent_id != $product-&gt;cart_product_id) continue; if(empty($optionElement-&gt;prices[0])) continue; if(!isset($product-&gt;prices[0])) { $product-&gt;prices[0] = new stdClass(); $product-&gt;prices[0]-&gt;price_value = 0; $product-&gt;prices[0]-&gt;price_value_with_tax = 0; $product-&gt;prices[0]-&gt;price_currency_id = hikashop_getCurrency(); } foreach(get_object_vars($product-&gt;prices[0]) as $key =&gt; $value) { if(strpos($key, 'price_value') === false) continue; if(is_object($value)) { foreach(get_object_vars($value) as $key2 =&gt; $var2) { $product-&gt;prices[0]-&gt;$key-&gt;$key2 += @$optionElement-&gt;prices[0]-&gt;$key-&gt;$key2; } } else { $product-&gt;prices[0]-&gt;$key += @$optionElement-&gt;prices[0]-&gt;$key; } } } } ?&gt; &lt;td class="hikashop_cart_module_product_price_value hikashop_cart_value"&gt;&lt;?php $this-&gt;row =&amp; $product; $this-&gt;unit = false; $this-&gt;cart_product_price = true; $price_with_tax_option = $this-&gt;params-&gt;get('price_with_tax'); if(!empty($shows['taxes']) &amp;&amp; $this-&gt;params-&gt;get('price_with_tax') == 1) $this-&gt;params-&gt;set('price_with_tax',0); if($this-&gt;params-&gt;get('show_discount', 3) == 3 &amp;&amp; isset($this-&gt;default_params['show_discount'])) { $this-&gt;params-&gt;set('show_discount', (int)$this-&gt;default_params['show_discount']); } echo $this-&gt;loadTemplate(); if(!empty($shows['taxes']) &amp;&amp; $price_with_tax_option == 1) $this-&gt;params-&gt;set('price_with_tax',$price_with_tax_option); ?&gt;&lt;/td&gt; &lt;?php } ?&gt; &lt;?php if(!empty($columns['delete'])) { $delete_url = hikashop_completeLink('product&amp;task=updatecart&amp;cart_id='.(int)$this-&gt;element-&gt;cart_id.'&amp;cart_product_id='.(int)$product-&gt;cart_product_id.'&amp;quantity=0'); $delete_url .= ((strpos($delete_url, '?') === false) ? '?' : '&amp;') . 'return_url='.urlencode(base64_encode(urldecode($this-&gt;params-&gt;get('url')))); ?&gt; &lt;td class="hikashop_cart_module_product_delete_value hikashop_cart_value"&gt; &lt;a href="&lt;?php echo $delete_url; ?&gt;" data-cart-id="&lt;?php echo (int)$this-&gt;element-&gt;cart_id; ?&gt;" data-cart-type="&lt;?php echo $this-&gt;escape($this-&gt;element-&gt;cart_type); ?&gt;" data-cart-product-id="&lt;?php echo (int)$product-&gt;cart_product_id; ?&gt;" onclick="if(window.hikashop) { return window.hikashop.deleteFromCart(this, null, 'hikashop_cart_&lt;?php echo $module_id; ?&gt;'); }" title="&lt;?php echo JText::_('HIKA_DELETE'); ?&gt;"&gt; &lt;i class="fa fa-times-circle"&gt;&lt;/i&gt; &lt;/a&gt; &lt;/td&gt; &lt;?php } ?&gt; &lt;?php if($nb_columns == 0) { ?&gt; &lt;td&gt;&lt;/td&gt; &lt;?php } ?&gt; &lt;/tr&gt; &lt;?php $k = 1 - $k; } ?&gt; &lt;/tbody&gt; &lt;/table&gt; &lt;input type="hidden" name="option" value="&lt;?php echo HIKASHOP_COMPONENT; ?&gt;"/&gt; &lt;input type="hidden" name="ctrl" value="product"/&gt; &lt;input type="hidden" name="task" value="updatecart"/&gt; &lt;input type="hidden" name="cart_type" value="&lt;?php echo $this-&gt;cart_type; ?&gt;"/&gt; &lt;input type="hidden" name="url" value="&lt;?php echo $this-&gt;escape($this-&gt;params-&gt;get('url')); ?&gt;"/&gt; &lt;?php if($this-&gt;params-&gt;get('show_cart_quantity', 1)) { ?&gt; &lt;noscript&gt; &lt;input type="submit" class="&lt;?php echo $css_button; ?&gt;" name="refresh" value="&lt;?php echo JText::_('REFRESH_CART');?&gt;"/&gt; &lt;/noscript&gt; &lt;?php } ?&gt; &lt;/form&gt; &lt;?php $cartClass= hikashop_get('class.cart'); $cart = $cartClass-&gt;getFullCart(); if(empty($cart-&gt;coupon)) { global $Itemid; $url_itemid= ''; if(!empty($Itemid)) $url_itemid = '&amp;Itemid='.$Itemid; ?&gt; &lt;?php } ?&gt; &lt;?php global $Itemid; $url_itemid= ''; if(!empty($Itemid)) $url_itemid = '&amp;Itemid='.$Itemid; ?&gt; &lt;?php require_once JPATH_ADMINISTRATOR . '/components/com_hikashop/helpers/checkout.php'; $checkoutHelper = hikashopCheckoutHelper::get(); $workflow = $checkoutHelper-&gt;checkout_workflow; foreach ($workflow['steps'] as $index1 =&gt; $stp) { foreach ($stp['content'] as $index2 =&gt; $pos) { if ($pos['task'] == 'coupon') { $step = $index1; $position = $index2; break 2; } } } $hikashop_checkout_coupon= 'hikashop_checkout_coupon_'. ($step + 1). '_'. ($position); $hikashop_checkout_coupon_input= 'hikashop_checkout_coupon_input_'. ($step + 1). '_'. ($position); $app = jfactory::getapplication(); $document = jfactory::getdocument(); $input = $app-&gt;input; $view = $input-&gt;get('view'); if (!in_array($view, ['checkout'])) { $cartClass = hikashop_get('class.cart'); $cart = $cartClass-&gt;getFullCart(); $document-&gt;addScript(juri::root() . 'media/com_hikashop/js/checkout.js') ?&gt; &lt;script&gt; jQuery(document).ready(function ($) { window.checkout.token = Joomla.getOptions('csrf.token'); window.checkout.urls.show = "/customer-order/checkout/showblock/tmpl-raw"; window.checkout.urls.submit = "/customer-order/checkout/submitblock/tmpl-raw"; window.checkout.urls.submitstep = "/customer-order/checkout/submitstep/tmpl-raw"; if (!window.checkout) window.checkout = {}; window.Oby.registerAjax(['checkout.coupon.updated', 'cart.updated'], function (params) { if (params &amp;&amp; (params.cart_empty &#124;&#124; (params.resp &amp;&amp; params.resp.empty))) return; window.checkout.refreshCoupon(1, 2); }); window.checkout.refreshCoupon = function (step, id) { return window.checkout.refreshBlock('coupon', step, id); }; window.checkout.submitCoupon = function (step, id) { var el = document.getElementById('hikashop_checkout_coupon_input_' + step + '_' + id); if (!el) return false; if (el.value == '') { window.Oby.addClass(el, 'hikashop_red_border'); return false; } return window.checkout.submitBlock('coupon', step, id); }; window.checkout.removeCoupon = function (step, id) { window.checkout.submitBlock('coupon', step, id, {'checkout[removecoupon]': 1}); return false; }; }) &lt;/script&gt; &lt;?php if (!empty($cart-&gt;coupon)): ?&gt; &lt;style&gt; .hikashop_checkout_coupon .fa-trash { color: #439a86 !important; } .hikashop_checkout_coupon a { color: #000 !important; } &lt;/style&gt; &lt;div id="&lt;?= $hikashop_checkout_coupon;?&gt;" data-checkout-step="&lt;?= ($step+1)?&gt;" data-checkout-pos="&lt;?= ($position)?&gt;" class="hikashop_checkout_coupon"&gt; &lt;div class="hikashop_checkout_loading_elem"&gt;&lt;/div&gt; &lt;div class="hikashop_checkout_loading_spinner"&gt;&lt;/div&gt; &lt;a href="#removeCoupon" onclick="return window.checkout.removeCoupon(&lt;?= ($step + 1) ?&gt;,&lt;?= ($position) ?&gt;);" title="حذف کوپن"&gt; حذف کوپن &lt;i class="fas fa-trash"&gt;&lt;/i&gt; &lt;/a&gt; &lt;/div&gt; &lt;?php else: ?&gt; &lt;div id="&lt;?= $hikashop_checkout_coupon;?&gt;" data-checkout-step="&lt;?= ($step + 1) ?&gt;" data-checkout-pos="&lt;?= ($position) ?&gt;" class="hikashop_checkout_coupon"&gt; &lt;div class="hikashop_checkout_loading_elem"&gt;&lt;/div&gt; &lt;div class="hikashop_checkout_loading_spinner"&gt;&lt;/div&gt; &lt;label for="&lt;?= $hikashop_checkout_coupon_input;?&gt;"&gt;کوپن خود را وارد کنيد&lt;/label&gt; &lt;div class="input-append"&gt; &lt;input class="hikashop_checkout_coupon_field" id="&lt;?= $hikashop_checkout_coupon_input;?&gt;" type="text" name="checkout[coupon]" value=""&gt; &lt;button type="submit" onclick="return window.checkout.submitCoupon(&lt;?= ($step + 1) ?&gt;,&lt;?= ($position) ?&gt;);" id="farhad" class="hikabtn hikabtn-primary"&gt;اضافه کردن &lt;/button&gt; &lt;/div&gt; &lt;/div&gt; &lt;?php endif; ?&gt; &lt;?php } ?&gt; &lt;?php if($this-&gt;element-&gt;cart_type == 'cart' &amp;&amp; $this-&gt;params-&gt;get('show_cart_proceed', 1)) { ?&gt; &lt;a class="&lt;?php echo $css_button . ' ' . $css_button_checkout; ?&gt;" href="&lt;?php echo $this-&gt;url_checkout; ?&gt;" onclick="if(this.disable) return false; this.disable = true;"&gt;&lt;span&gt;&lt;?php echo JText::_('PROCEED_TO_CHECKOUT'); ?&gt;&lt;/span&gt;&lt;/a&gt; &lt;a href="&lt;?php echo hikashop_completeLink('checkout&amp;task=confirm'.$url_itemid); ?&gt;" class="hikabtn hikabtn-success hikabtn_checkout_next"&gt;&lt;?= JText::_('CHECKOUT_BUTTON_FINISH');?&gt;&lt;/a&gt; &lt;?php } if(!empty($this-&gt;extraData-&gt;bottom)) { echo implode("\r\n", $this-&gt;extraData-&gt;bottom); } if(in_array($small_cart, array(2, 3))) { ?&gt; &lt;/div&gt; &lt;/div&gt; &lt;?php } if(!in_array($tmpl, array('component', 'ajax', 'raw'))) { ?&gt; &lt;/div&gt; &lt;div class="clear_both"&gt;&lt;/div&gt; &lt;?php }

Last edit: 4 years 8 months ago by [sadaf3d](/forum/user/46256-sadaf3d "View sadaf3d's Profile").

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzQ2LWRpc2NvdW50LWNvdXBvbi85MDQwMDQtaXMtaXQtcG9zc2libGUtdG8taW5zZXJ0LWNvdXBvbi1pbi1jYXJ0LW1vZHVsZT90bXBsPW1hcmtkb3du) 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: 86556
- Thank you received: 14304
-
-

4 years 8 months ago [\#339777](#339777) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[is it possible to insert coupon in cart module?](/forum/46-discount-coupon/904004-is-it-possible-to-insert-coupon-in-cart-module#339777 "hi i want my user can insert his coupon in a field in cart module. it seems this is not possible in current hikashop cart module. can i do that with some php code change?")*

Hi,

I would have done it a lot simpler by just submitting the this.form in ajax and then refreshing the cart module after the response from the server. I suppose it would have been a few lines of javascript to add the code I had provided so far.

Importing the whole code from the checkout coupon view sure is possible. If it works for you then it's all good.

The following user(s) said Thank You: [sadaf3d](/forum/user/46256-sadaf3d "View sadaf3d's Profile")

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

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