aussie Posted October 25, 2008 Share Posted October 25, 2008 My code is throwing a 404 not found in IE 6 & 7 works fine in Firefox. I've put this in the javascript instead of php because I'm sure its the javascript issue. After researching it seems I am to add the statement 'return true' I've tried that but it still doesn't work so maybe I am not putting this statement in the right place. <input type="image" name="btnAddToCart" src="images/addtocart.gif" value="Add to Cart" onClick="window.location.href='<?php echo $cart_url; ?>';" class="addToCartButton" alt="add this item to your cart"> I added the return true like this <input type="image" name="btnAddToCart" src="images/addtocart.gif" value="Add to Cart" onClick="window.location.href='<?php echo $cart_url; ?>';return true" class="addToCartButton" alt="add this item to your cart"> still 404 page not found... in my functions page is the cart url $row['cart_url'] = "cart.php?action=add&p=$pdId"; I tried adding the return true statement there and that didn't work either. I added like this $row['cart_url'] = "cart.php?action=add&p=$pdId; return true"; I get this in the ie browser address bar and the page is a 404 cart.php?action=add&p=179;%20return%20true; cheers.. Quote Link to comment Share on other sites More sharing options...
JasonLewis Posted October 25, 2008 Share Posted October 25, 2008 You shouldn't need to do window.location.href Just using window.location should work fine, and that's how I've always done it. Quote Link to comment Share on other sites More sharing options...
BoltZ Posted October 25, 2008 Share Posted October 25, 2008 The 404 error is from the file not being found. Hover your mouse over the link and make sure it is a valid link that you have. If not then the php is wrong. Quote Link to comment Share on other sites More sharing options...
aussie Posted October 26, 2008 Author Share Posted October 26, 2008 Thank you for your replies. Tried taking out the .href and IE still showing 404 error page not found. This code has been working for years in Firefox and up until recently was working in Internet Explorer. How it works, When you click Add to the cart button, it just shows the same page and adds the product to the cart. So the page is there. When you click the 'view the cart button' the product is added there. Something in IE 6 & 7 has changed. I tried IE options-> security and removed protected mode but that didn't work. I also tried dropping the security level down to see if that made a difference. I need a work around I am feeling this is either a bug in the IE or some new security thing added in the latest updates to Internet Explorer. I have researched on google and it seems others are having the same problem but there are not answers for the issue.... Cheers Quote Link to comment Share on other sites More sharing options...
BoltZ Posted October 26, 2008 Share Posted October 26, 2008 Ask clients if they have the same error. You say this error is in IE ONLY? it works in FF? Chrome n Opera? What have you changed in the code recently Quote Link to comment Share on other sites More sharing options...
aussie Posted October 27, 2008 Author Share Posted October 27, 2008 Thankyou, Hmm! I have changed some of the code. I have made a .htaccess for friendly urls, and am making the php files be html in the .htaccess as well. To make all of that work I had to add a base href to the header.php Options +FollowSymLinks RewriteEngine on RewriteBase /main RewriteRule ^main/(.*).html index.php?c=$1 [L] RewriteRule ^products/(.*)/(.*)/(.*).html index.php?c=$1&p=$2 [L] RewriteRule ^articles/(.*)/(.*).html pages1.php?id=$1 [L] Cheers Quote Link to comment Share on other sites More sharing options...
aussie Posted July 9, 2009 Author Share Posted July 9, 2009 Thankyou, Hmm! I have changed some of the code. I have made a .htaccess for friendly urls, and am making the php files be html in the .htaccess as well. To make all of that work I had to add a base href to the header.php Options +FollowSymLinks RewriteEngine on RewriteBase /main RewriteRule ^main/(.*).html index.php?c=$1 [L] RewriteRule ^products/(.*)/(.*)/(.*).html index.php?c=$1&p=$2 [L] RewriteRule ^articles/(.*)/(.*).html pages1.php?id=$1 [L] Cheers I am still having issues with this and my cart has now been broken in IE for some time.... As I said earlier it is working perfectly in other browsers. So I need a work around for IE and not break everything else. I am sure I must have to add something to the .htaccess file. When I click on the add to cart button, I get this address and a 404 error. http://localhost/main/products/29/72/cart.php?action=add&p=72 In firefox clicking on the add to cart button then refreshes the page and show the contents in the cart. So I think I need a line in the .htaccess file to remove the main/products/29/72 and have the url go to http://localhost/main/cart.php?action=add&p=72 Any ideas???? Quote Link to comment Share on other sites More sharing options...
aussie Posted July 9, 2009 Author Share Posted July 9, 2009 Hi, As I am not able to receive help for this, should I post in a different section on this forum? I do believe this is the javascript onclick event in Internet explorer only that is causing this issue. Quote Link to comment Share on other sites More sharing options...
aussie Posted July 9, 2009 Author Share Posted July 9, 2009 Well I found a work around I got rid of the onclick event so it works now in IE Replaced: <input type="image" name="btnAddToCart" src="images/addtocart.gif" value="Add to Cart" onClick="window.location.href='<?php echo $cart_url; ?>';return true" class="addToCartButton" alt="add this item to your cart"> With <a href="<?php echo $cart_url;?>"><img src="images/addtocart.gif" border="0" alt="buy now"></a> So no 404 and all is added to cart. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.