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

#   add to cart link - return url

##

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

Less More

- Posts: 40
- Thank you received: 1
-
-

10 years 6 months ago [\#238952](#238952) by [rndm](/forum/user/40094-rndm "View rndm's Profile")  *[add to cart link - return url](/forum/27-checkout/884288-add-to-cart-link-return-url#238952 "-- HikaShop version -- : HikaShop Business: 2.6.2 -- Joomla version -- : 3.5.1 -- PHP version -- : 5.3  Hello!  I'm tring to configure custom add to cart html link to make component return me to original page.  First, I make a hidden input with the value containing current url:  I checked, url is correct before encoding.  Then I generate my quantity input and adding link:  In this example 's id is a hikashop product id.  Finally, I process the link:  As a result, my good is added to cart, the quantity is right, but I dont return to original page. Instead I go to checkout. What am I doing wrong?..  Thank you!")* was created by *[rndm](/forum/user/40094-rndm "View rndm's Profile")*

-- HikaShop version -- : HikaShop Business: 2.6.2
-- Joomla version -- : 3.5.1
-- PHP version -- : 5.3

Hello!

I'm tring to configure custom add to cart html link to make component return me to original page.

First, I make a hidden input with the value containing current url: Code:

&lt;?php $thisUrl = urlencode(base64_encode("http://".$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'])); ?&gt; &lt;input type = "hidden" id="urlbase64" value="&lt;?php echo $thisUrl; ?&gt;"&gt;

I checked, url is correct before encoding.

Then I generate my quantity input and adding link: Code:

&lt;input type="number" min="1" max="100" value="1" class="quantityinput" id="q6724" /&gt; &lt;a class="add2cart" id="6724" href="#"&gt;&lt;img src="/images/icons/cart_put.png" align="absmiddle" /&gt;&lt;/a&gt;

In this example &lt;a&gt;'s id is a hikashop product id.

Finally, I process the link: Code:

$(".add2cart").click ( function(e) { e.preventDefault(); var id = $(this).attr('id'); var quantity = $("#q" + id).val(); var returnURL = $("#urlbase64").val(); document.location.href = "index.php?option=com_hikashop&amp;ctrl=product&amp;task=updatecart&amp;quantity="+quantity+"&amp;product_id="+id+"return_url="+returnURL; } );

As a result, my good is added to cart, the quantity is right, but I dont return to original page. Instead I go to checkout.
What am I doing wrong?..

Thank you!

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI3LWNoZWNrb3V0Lzg4NDI4OC1hZGQtdG8tY2FydC1saW5rLXJldHVybi11cmw/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: 86587
- Thank you received: 14325
-
-

10 years 6 months ago [\#239009](#239009) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[add to cart link - return url](/forum/27-checkout/884288-add-to-cart-link-return-url#239009 "-- HikaShop version -- : HikaShop Business: 2.6.2 -- Joomla version -- : 3.5.1 -- PHP version -- : 5.3  Hello!  I'm tring to configure custom add to cart html link to make component return me to original page.  First, I make a hidden input with the value containing current url:  I checked, url is correct before encoding.  Then I generate my quantity input and adding link:  In this example 's id is a hikashop product id.  Finally, I process the link:  As a result, my good is added to cart, the quantity is right, but I dont return to original page. Instead I go to checkout. What am I doing wrong?..  Thank you!")*

Hi,

You're missing a &amp; before Code:

return_url="+returnURL

in your code

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

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

Less More

- Posts: 40
- Thank you received: 1
-
-

10 years 6 months ago [\#239055](#239055) by [rndm](/forum/user/40094-rndm "View rndm's Profile")  Replied by *[rndm](/forum/user/40094-rndm "View rndm's Profile")* on topic *[add to cart link - return url](/forum/27-checkout/884288-add-to-cart-link-return-url#239055 "-- HikaShop version -- : HikaShop Business: 2.6.2 -- Joomla version -- : 3.5.1 -- PHP version -- : 5.3  Hello!  I'm tring to configure custom add to cart html link to make component return me to original page.  First, I make a hidden input with the value containing current url:  I checked, url is correct before encoding.  Then I generate my quantity input and adding link:  In this example 's id is a hikashop product id.  Finally, I process the link:  As a result, my good is added to cart, the quantity is right, but I dont return to original page. Instead I go to checkout. What am I doing wrong?..  Thank you!")*

Oh my, I'm a fool. Thank you a lot. It's working perfect.

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

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

Less More

- Posts: 40
- Thank you received: 1
-
-

10 years 6 months ago [\#239056](#239056) by [rndm](/forum/user/40094-rndm "View rndm's Profile")  Replied by *[rndm](/forum/user/40094-rndm "View rndm's Profile")* on topic *[add to cart link - return url](/forum/27-checkout/884288-add-to-cart-link-return-url#239056 "-- HikaShop version -- : HikaShop Business: 2.6.2 -- Joomla version -- : 3.5.1 -- PHP version -- : 5.3  Hello!  I'm tring to configure custom add to cart html link to make component return me to original page.  First, I make a hidden input with the value containing current url:  I checked, url is correct before encoding.  Then I generate my quantity input and adding link:  In this example 's id is a hikashop product id.  Finally, I process the link:  As a result, my good is added to cart, the quantity is right, but I dont return to original page. Instead I go to checkout. What am I doing wrong?..  Thank you!")*

Nikolas,

It is working, but I noticed that if I have, for example, five products in cart (I mean, one name, and quantity = 5), and after that add one more using this method, then I have only one product in cart instead of six.

Is there a quick sollution to fix it, or should I manually analize the cart contents and add up corresponding quantities?..

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI3LWNoZWNrb3V0Lzg4NDI4OC1hZGQtdG8tY2FydC1saW5rLXJldHVybi11cmw/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: 86587
- Thank you received: 14325
-
-

10 years 6 months ago [\#239064](#239064) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[add to cart link - return url](/forum/27-checkout/884288-add-to-cart-link-return-url#239064 "-- HikaShop version -- : HikaShop Business: 2.6.2 -- Joomla version -- : 3.5.1 -- PHP version -- : 5.3  Hello!  I'm tring to configure custom add to cart html link to make component return me to original page.  First, I make a hidden input with the value containing current url:  I checked, url is correct before encoding.  Then I generate my quantity input and adding link:  In this example 's id is a hikashop product id.  Finally, I process the link:  As a result, my good is added to cart, the quantity is right, but I dont return to original page. Instead I go to checkout. What am I doing wrong?..  Thank you!")*

Hi,

You just want to add the parameter &amp;add=1 to the add to cart URL. Otherwise, the system will assign that you are updating the quantity in the cart instead of adding to it.

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

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