-- 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:
<?php
$thisUrl = urlencode(base64_encode("http://".$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI']));
?>
<input type = "hidden" id="urlbase64" value="<?php echo $thisUrl; ?>">
I checked, url is correct before encoding.
Then I generate my quantity input and adding link:
<input type="number" min="1" max="100" value="1" class="quantityinput" id="q6724" />
<a class="add2cart" id="6724" href="#"><img src="/images/icons/cart_put.png" align="absmiddle" /></a>
In this example <a>'s id is a hikashop product id.
Finally, I process the link:
$(".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&ctrl=product&task=updatecart&quantity="+quantity+"&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!