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

#   Ajax Add to cart

##

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

Less More

- Posts: 3
- Thank you received: 0
-
-

12 years 7 months ago [\#148096](#148096) by [antuanb](/forum/user/31235-antuanb "View antuanb's Profile")  *[Ajax Add to cart](/forum/31-development/866614-ajax-add-to-cart#148096 "I try to use the equivalent of the url below from the hikashop demo page (it does respond with the markup of the updated cart module so that it can be updated) The problem is that in my testing site (not accessible from outside) the output of that page is just this:  I know something is right, using the debugger I can check that in the display() function from hikashopView (in components/com&#95;hikashop/helpers/helper.php) the view of the module has been correctly rendered, but the output is finally another one!  I'm going mad with this one! :S :) -- url of the page with the problem -- :   demo.hikashop.com/index.php?option=com&#95;h...NzgmbGFuZz1lbg%3D%3D  -- HikaShop version -- : 2.3.0 -- Joomla version -- : 3.2.2 -- PHP version -- : 5.3.28 -- Browser(s) name and version -- : Firefox 27.0 -- Error-message(debug-mod must be tuned on) -- : No error messsage on screen or PHP error log")* was created by *[antuanb](/forum/user/31235-antuanb "View antuanb's Profile")*

I try to use the equivalent of the url below from the hikashop demo page (it does respond with the markup of the updated cart module so that it can be updated)
The problem is that in my testing site (not accessible from outside) the output of that page is just this: Code:

&lt;div id="system-message-container"&gt; &lt;div id="system-message"&gt; &lt;/div&gt; &lt;/div&gt;

I know something is right, using the debugger I can check that in the display() function from hikashopView (in components/com_hikashop/helpers/helper.php) the view of the module has been correctly rendered, but the output is finally another one! Code:

function display($tpl = null) { $lang = JFactory::getLanguage(); if($lang-&gt;isRTL()) $this-&gt;direction = 'rtl'; if($this-&gt;triggerView) { JPluginHelper::importPlugin('hikashop'); $dispatcher = JDispatcher::getInstance(); $dispatcher-&gt;trigger('onHikashopBeforeDisplayView', array(&amp;$this)); } if(!empty($this-&gt;toolbar)) { $toolbarHelper = hikashop_get('helper.toolbar'); $toolbarHelper-&gt;process($this-&gt;toolbar); } parent::display($tpl); &lt;--***---Here the view is correctly rendered if($this-&gt;triggerView) {&lt;--****---Even if this is set to false by the debugger the output is still wrong $dispatcher-&gt;trigger('onHikashopAfterDisplayView', array( &amp;$this)); } }

I'm going mad with this one! :S ![:)](/media/kunena/emoticons/8.png ":)")
-- url of the page with the problem -- : [ demo.hikashop.com/index.php?option=com\_h...NzgmbGFuZz1lbg%3D%3D](http://demo.hikashop.com/index.php?option=com_hikashop&ctrl=product&task=updatecart&tmpl=component&Itemid=78&lang=en&from=module&product_id=192&cart_type=cart&hikashop_ajax=1&quantity=1&add=1&Itemid=78&return_url=aHR0cDovL2RlbW8uaGlrYXNob3AuY29tL2luZGV4LnBocD9vcHRpb249Y29tX2hpa2FzaG9wJmN0cmw9cHJvZHVjdCZ0YXNrPXNob3cmY2lkPTE5MiZuYW1lPSZJdGVtaWQ9NzgmbGFuZz1lbg%3D%3D)
-- HikaShop version -- : 2.3.0
-- Joomla version -- : 3.2.2
-- PHP version -- : 5.3.28
-- Browser(s) name and version -- : Firefox 27.0
-- Error-message(debug-mod must be tuned on) -- : No error messsage on screen or PHP error log

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

- **[Xavier](/forum/user/4105-xavier "View Xavier's Profile")**
- [![Xavier's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar4105.png)](/forum/user/4105-xavier "View Xavier's Profile")
- [ Offline](/forum/user/4105-xavier)

Less More

- Posts: 13201
- Thank you received: 2322
-
-
-
- [](http://www.kidiweb.fr)
-

12 years 7 months ago [\#148112](#148112) by [Xavier](/forum/user/4105-xavier "View Xavier's Profile")  Replied by *[Xavier](/forum/user/4105-xavier "View Xavier's Profile")* on topic *[Ajax Add to cart](/forum/31-development/866614-ajax-add-to-cart#148112 "I try to use the equivalent of the url below from the hikashop demo page (it does respond with the markup of the updated cart module so that it can be updated) The problem is that in my testing site (not accessible from outside) the output of that page is just this:  I know something is right, using the debugger I can check that in the display() function from hikashopView (in components/com&#95;hikashop/helpers/helper.php) the view of the module has been correctly rendered, but the output is finally another one!  I'm going mad with this one! :S :) -- url of the page with the problem -- :   demo.hikashop.com/index.php?option=com&#95;h...NzgmbGFuZz1lbg%3D%3D  -- HikaShop version -- : 2.3.0 -- Joomla version -- : 3.2.2 -- PHP version -- : 5.3.28 -- Browser(s) name and version -- : Firefox 27.0 -- Error-message(debug-mod must be tuned on) -- : No error messsage on screen or PHP error log")*

Hi,

I don't really understand the origin of the problem. When do you need to use this url ?

What is the display returned after clicking on an ajax add to cart button ?

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

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

Less More

- Posts: 3
- Thank you received: 0
-
-

12 years 7 months ago [\#148234](#148234) by [antuanb](/forum/user/31235-antuanb "View antuanb's Profile")  Replied by *[antuanb](/forum/user/31235-antuanb "View antuanb's Profile")* on topic *[Ajax Add to cart](/forum/31-development/866614-ajax-add-to-cart#148234 "I try to use the equivalent of the url below from the hikashop demo page (it does respond with the markup of the updated cart module so that it can be updated) The problem is that in my testing site (not accessible from outside) the output of that page is just this:  I know something is right, using the debugger I can check that in the display() function from hikashopView (in components/com&#95;hikashop/helpers/helper.php) the view of the module has been correctly rendered, but the output is finally another one!  I'm going mad with this one! :S :) -- url of the page with the problem -- :   demo.hikashop.com/index.php?option=com&#95;h...NzgmbGFuZz1lbg%3D%3D  -- HikaShop version -- : 2.3.0 -- Joomla version -- : 3.2.2 -- PHP version -- : 5.3.28 -- Browser(s) name and version -- : Firefox 27.0 -- Error-message(debug-mod must be tuned on) -- : No error messsage on screen or PHP error log")*

The sites offers special content to which one can be subscribed.

I need to embed the add to cart links into the content viewers and update the cart module accordingly

The return is like a half processed component.. Code:

&lt;div id="system-message-container"&gt; &lt;div id="system-message"&gt; &lt;/div&gt; &lt;/div&gt;

Thanks

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMxLWRldmVsb3BtZW50Lzg2NjYxNC1hamF4LWFkZC10by1jYXJ0P3RtcGw9bWFya2Rvd24=) 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: 26394
- Thank you received: 4078
-
- [](http://obsi.dev)
-

12 years 7 months ago [\#148311](#148311) by [Jerome](/forum/user/80-jerome "View Jerome's Profile")  Replied by *[Jerome](/forum/user/80-jerome "View Jerome's Profile")* on topic *[Ajax Add to cart](/forum/31-development/866614-ajax-add-to-cart#148311 "I try to use the equivalent of the url below from the hikashop demo page (it does respond with the markup of the updated cart module so that it can be updated) The problem is that in my testing site (not accessible from outside) the output of that page is just this:  I know something is right, using the debugger I can check that in the display() function from hikashopView (in components/com&#95;hikashop/helpers/helper.php) the view of the module has been correctly rendered, but the output is finally another one!  I'm going mad with this one! :S :) -- url of the page with the problem -- :   demo.hikashop.com/index.php?option=com&#95;h...NzgmbGFuZz1lbg%3D%3D  -- HikaShop version -- : 2.3.0 -- Joomla version -- : 3.2.2 -- PHP version -- : 5.3.28 -- Browser(s) name and version -- : Firefox 27.0 -- Error-message(debug-mod must be tuned on) -- : No error messsage on screen or PHP error log")*

Hi,

What are your talking about ?
Why you are trying to modify the HikaShop helper ?!

1 - Your content is your "component" template page without any specific content except the Joomla messaging system.
That is totally logical because you don't have the right HikaShop configuration to get the cart in return of your ajax call.

2 - For most I understand (and it is not very much) ; Your problem is not in the helper, not even in the view, it should be in the controller.
You are calling the "updatecart" task which depending your HikaShop configuration will work in ajax or not.
In ajax, you will get the cart content otherwise you can be redirected to the "return_url".

3 - You have to first understand the process of the cart before trying to modify a main core file of HikaShop.
And if you want some help to understand some points, please explain them clearly.

If you want to display the cart content, use the cart view.
If you want to update the cart, use the "updatecart" url but be careful with the arguments you put into.

Regards,

---

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

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

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

Less More

- Posts: 3
- Thank you received: 0
-
-

12 years 7 months ago [\#148347](#148347) by [antuanb](/forum/user/31235-antuanb "View antuanb's Profile")  Replied by *[antuanb](/forum/user/31235-antuanb "View antuanb's Profile")* on topic *[Ajax Add to cart](/forum/31-development/866614-ajax-add-to-cart#148347 "I try to use the equivalent of the url below from the hikashop demo page (it does respond with the markup of the updated cart module so that it can be updated) The problem is that in my testing site (not accessible from outside) the output of that page is just this:  I know something is right, using the debugger I can check that in the display() function from hikashopView (in components/com&#95;hikashop/helpers/helper.php) the view of the module has been correctly rendered, but the output is finally another one!  I'm going mad with this one! :S :) -- url of the page with the problem -- :   demo.hikashop.com/index.php?option=com&#95;h...NzgmbGFuZz1lbg%3D%3D  -- HikaShop version -- : 2.3.0 -- Joomla version -- : 3.2.2 -- PHP version -- : 5.3.28 -- Browser(s) name and version -- : Firefox 27.0 -- Error-message(debug-mod must be tuned on) -- : No error messsage on screen or PHP error log")*

I think I have been misunderstood, I'm not trying to modify Hikashop helper at all, I'm just trying to adapt my code to work with hikashop like hikashop itself does.
The following query in the demo page of hikashop:

[ demo.hikashop.com/index.php?option=com\_h...NzgmbGFuZz1lbg%3D%3D](http://demo.hikashop.com/index.php?option=com_hikashop&ctrl=product&task=updatecart&tmpl=component&Itemid=78&lang=en&from=module&product_id=192&cart_type=cart&hikashop_ajax=1&quantity=1&add=1&Itemid=78&return_url=aHR0cDovL2RlbW8uaGlrYXNob3AuY29tL2luZGV4LnBocD9vcHRpb249Y29tX2hpa2FzaG9wJmN0cmw9cHJvZHVjdCZ0YXNrPXNob3cmY2lkPTE5MiZuYW1lPSZJdGVtaWQ9NzgmbGFuZz1lbg%3D%3D)

manages to send all the information needed for the cart to be updated according to the product that is added.
As well as getting back exactly the markup needed to update the cart module
It does it all through the GET query with no additional POST information.

My problem comes if I create a Hikashop category page in my site with some products and click on the add to cart button, it doesn't update the cart module, the query that hikashop sends similar to the one above doesn't bring back the markup to update the cart module (the '**Use AJAX when possible for add to cart buttons**' preference is set in the hikashop configuration)

Thanks,

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMxLWRldmVsb3BtZW50Lzg2NjYxNC1hamF4LWFkZC10by1jYXJ0P3RtcGw9bWFya2Rvd24=) 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)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Away](/forum/user/63-nicolas)

Less More

- Posts: 86292
- Thank you received: 14271
-
-

12 years 7 months ago [\#148527](#148527) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Ajax Add to cart](/forum/31-development/866614-ajax-add-to-cart#148527 "I try to use the equivalent of the url below from the hikashop demo page (it does respond with the markup of the updated cart module so that it can be updated) The problem is that in my testing site (not accessible from outside) the output of that page is just this:  I know something is right, using the debugger I can check that in the display() function from hikashopView (in components/com&#95;hikashop/helpers/helper.php) the view of the module has been correctly rendered, but the output is finally another one!  I'm going mad with this one! :S :) -- url of the page with the problem -- :   demo.hikashop.com/index.php?option=com&#95;h...NzgmbGFuZz1lbg%3D%3D  -- HikaShop version -- : 2.3.0 -- Joomla version -- : 3.2.2 -- PHP version -- : 5.3.28 -- Browser(s) name and version -- : Firefox 27.0 -- Error-message(debug-mod must be tuned on) -- : No error messsage on screen or PHP error log")*

It would have been helpful if you had provided the PHP code that you used to generate your add to cart button, and a link to the page with the issue so that we could analyze the result.
Without these, I can only answer you vaguely and tell you that if you want it to work, you need to properly generate the add to the cart button with the call to the javascript function hikashopQuantityChange and make sure that this function is defined in the header of the page with the necessary javascript in it, like HikaShop does for its add to cart buttons. Since it doesn't work with your code, it means that you're missing something, but hard to say what without more information on what you did...

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

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

[](#top)
