add to cart and redirect to custom page [solved]

  • Posts: 4
  • Thank you received: 0
12 years 6 months ago #48848

Hey,

Do you have a tip on how I can solve this?

on my main page are 3 images.
when I click on one of those it adds a specific product to the cart and redirects me to a custom url.

for example:

Click on Image "A" it adds product "1" to the cart and redirects me to "category xyz001"
Click on Image "B" it adds product "2" to the cart and redirects me to "category xyz001"
Click on Image "C" it adds product "3" to the cart and redirects me to "category xyz001"

"category xyz001" is a specific link with new products listed when I click on "add to cart" of on of the products on this page should not redirect anywhere. (actually everything in this last sentence is already working.)

thx
i really love hika. it is well made!

Last edit: 12 years 6 months ago by futureknight.

Please Log in or Create an account to join the conversation.

  • Posts: 82728
  • Thank you received: 13343
  • MODERATOR
12 years 6 months ago #48871

In your products, you have an "add to cart HTML button" button that you can click on in order to get the HTML to use for the add to cart of that product.
It will add the product and redirect to the checkout by default.
In order to redirect somewhere else, you will have to remove the checkout=1 parameter from the URL and instead add a parameter return_url=XXX where XXX is the base64_encoded URL of your category listing.

The following user(s) said Thank You: futureknight

Please Log in or Create an account to join the conversation.

  • Posts: 4
  • Thank you received: 0
12 years 6 months ago #48889

thanks it works!

return_url=XXX was the missing piece.

Please Log in or Create an account to join the conversation.

  • Posts: 65
  • Thank you received: 0
12 years 3 months ago #56785

Hello I have a similar problem but return_url(to base64_encoded URL of your category listing) doesnt seem to work for me.
I basically added an HTML Add to cart button to one of my product description pages and what I want is to stay on the current page when add to cart is clicked. So in this case what do I put in return_url??

Thank you for your help.

Please Log in or Create an account to join the conversation.

  • Posts: 65
  • Thank you received: 0
12 years 3 months ago #56786

Just one more thing, I have added a return-url to my add to cart module, like this
<a href="/tempweb/component/hikashop/product/updatecart/quantity-1/return_url=index.php?option=com_content&view=article&id=19/cid-2/return_url-index.php?option=com_content&view=article&id=19" class="addcart"> <strong>Add to cart</strong> </a>

and it does redirect to the correct page, but it doesnt add the product to the cart??
please help.

thank you

Please Log in or Create an account to join the conversation.

  • Posts: 82728
  • Thank you received: 13343
  • MODERATOR
12 years 3 months ago #56820

You need to base64_encode the return URL...You can't just put it in the add to cart URL link that.

Here is a base64_encoder:
www.motobit.com/util/base64-decoder-encoder.asp

If you put index.php?option=com_content&view=article&id=19 in it, you get:
aW5kZXgucGhwP29wdGlvbj1jb21fY29udGVudCZ2aWV3PWFydGljbGUmaWQ9MTk=

You actually also have to URL encode that because of the = character which cannot be used directly in the URL. Here is a tool for that:
www.string-functions.com/urlencode.aspx
So you get that:
aW5kZXgucGhwP29wdGlvbj1jb21fY29udGVudCZ2aWV3PWFydGljbGUmaWQ9MTk%3d

Thus, your link should be:
<a href="/tempweb/component/hikashop/product/updatecart/quantity-1/return_url=index.php?option=com_content&view=article&id=19/cid-2/return_url-aW5kZXgucGhwP29wdGlvbj1jb21fY29udGVudCZ2aWV3PWFydGljbGUmaWQ9MTk%3d" class="addcart"> <strong>Add to cart</strong> </a>

Please Log in or Create an account to join the conversation.

  • Posts: 44
  • Thank you received: 1
11 years 4 weeks ago #126823

Hi Nicolas,
I have followed this topic and used it successfully on our own site.
However, some of our products consist of a main product with options and/or variants.

When a customer orders, the transaction shows up in the back end order report as typically) two distinct items i.e. the main product itself + the option/variant.

Is it possible to somehow modify or concatenate the 'add to cart' html string so that two products get added to the cart when that link is activated? In our case, that would be the main product itself plus its option/variant.

Regards
PhilP

Please Log in or Create an account to join the conversation.

  • Posts: 13201
  • Thank you received: 2322
11 years 4 weeks ago #126925

Hi,

I think that what you need is to enable the option "Group options with product" in Configuration > Main > Cart.
This will display only one item with its options.

Please Log in or Create an account to join the conversation.

  • Posts: 44
  • Thank you received: 1
11 years 4 weeks ago #126937

Hi Xavier,
Yes, that is already enabled.
In the meantime, I think I have thought of another way of achieving what I want. I'll try it but if I still have problems I'll come back to you.
Thanks for your help anyway.
Regards
PhilP

Please Log in or Create an account to join the conversation.

Time to create page: 0.097 seconds
Powered by Kunena Forum