View Cart - not re-direecting to the view cart page?
What's wrong with this code:
<form action="<?php echo ($_SERVER["PHP_SELF"].(isset($_SERVER["QUERY_STRING"])?"?".htmlentities($_SERVER["QUERY_STRING"]):""));?>" method="post" name="quickcartFORM">
<div class="btn-group btn-group-justified" role="group" aria-label="cartbtns">
<div class="btn-group" role="group">
<input name="whiskyCART_View_100" type="submit" class="btn btn-default" role="button" id="whiskyCART_View_100" onClick="MM_goToURL('plugins/parent','view-basket.php');" value="View Basket" />
</div>
<div class="btn-group" role="group">
<input type="submit" name="whiskyCART_Clear_100" id="whiskyCART_Clear_100" class="btn btn-default" role="button" value="Clear Basket" />
</div>
<div class="btn-group" role="group">
<input type="submit" name="whiskyCART_Checkout" id="whiskyCART_Checkout" class="btn btn-default" role="button" value="Checkout" />
</div>
</div>
</form>
I have this on every page of my site with the following above the header:
<?php
//WA eCart Include
require_once("WA_eCart/whiskyCART_PHP.php");
?>
<?php
$whiskyCART->GetContent();
?>
<?php
// WA eCart Clear Cart
if (isset($_POST["whiskyCART_Clear_100"]) || isset($_POST["whiskyCART_Clear_100_x"])) {
$whiskyCART->ClearCart();
$Redirect_redirStr="";
if ($Redirect_redirStr != "") {
$whiskyCART->redirStr = $Redirect_redirStr;
}
$whiskyCART->cartAction = "ClearCart";
}
?>
<?php
//WA eCart Redirect Check Out
if (isset($_POST["whiskyCART_Checkout"]) || isset($_POST["whiskyCART_Checkout_x"])) {
$Redirect_redirStr="";
if ($Redirect_redirStr != "") {
if (isset($_SERVER['QUERY_STRING']) && $_SERVER['QUERY_STRING'] != "") {
if (strpos($Redirect_redirStr, "?") === false) {
$Redirect_redirStr .= "?".$_SERVER['QUERY_STRING'];
}
else {
$Redirect_redirStr .= "&".$_SERVER['QUERY_STRING'];
}
}
$whiskyCART->redirStr = $Redirect_redirStr;
}
$whiskyCART->cartAction = "Checkout";
}
?>
<?php
// WA eCart Redirect
if ($whiskyCART->redirStr != "") {
if (function_exists("rel2abs")) $whiskyCART->redirStr = rel2abs($whiskyCART->redirStr,dirname(__FILE__));
header("Location: ".$whiskyCART->redirStr);
die();
}
?>
But it doesn't re-direct to cart, it just refreshes the page.
So I tried adding the View Cart button to a blank page, which inserted this into the head section, albeit it inserted it right in the middle of other JS script on the page:
<script type="text/javascript">
function MM_goToURL() { //v3.0
var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
}
</script>
You can see this live at
www.nathonjoneswebdesign.co.uk/whiskybroker/
No idea why eCart does this. View Cart shouldn't be this difficult. :(
Hope you can help. Thank you.
NJ