- Posts: 4
- Thank you received: 0
add to cart and redirect to custom page [solved]
- futureknight
-
Topic Author
- Offline
Less
More
14 years 5 months ago - 14 years 4 months ago #48848
by futureknight
add to cart and redirect to custom page [solved] was created by futureknight
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!
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: 14 years 4 months ago by futureknight.
Please Log in or Create an account to join the conversation.
14 years 5 months ago #48871
by nicolas
Replied by nicolas on topic Re: add to cart and redirect to custom page
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.
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.
- futureknight
-
Topic Author
- Offline
Less
More
- Posts: 4
- Thank you received: 0
14 years 5 months ago #48889
by futureknight
Replied by futureknight on topic Re: add to cart and redirect to custom page
thanks it works!
return_url=XXX was the missing piece.
return_url=XXX was the missing piece.
Please Log in or Create an account to join the conversation.
14 years 2 months ago #56785
by soheilom
Replied by soheilom on topic Re: add to cart and redirect to custom page
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.
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.
14 years 2 months ago #56786
by soheilom
Replied by soheilom on topic Re: add to cart and redirect to custom page
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
<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.
14 years 2 months ago #56820
by nicolas
Replied by nicolas on topic Re: add to cart and redirect to custom page
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>
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.
12 years 11 months ago #126823
by PhilP
Replied by PhilP on topic Re: add to cart and redirect to custom page
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
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.
12 years 11 months ago #126925
by Xavier
Replied by Xavier on topic Re: add to cart and redirect to custom page
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.
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.
12 years 11 months ago #126937
by PhilP
Replied by PhilP on topic Re: add to cart and redirect to custom page
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
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.272 seconds