Tips and Tricks HQ Support Portal › Forums › Simple PayPal Shopping Cart › Simple shopping Cart Troubleshooting › Add To Cart POST goes to blank page.
Tagged: wordpress with redirection
- This topic has 6 replies, 3 voices, and was last updated 14 years, 11 months ago by deejayspinz.
-
AuthorPosts
-
December 14, 2009 at 1:00 pm #555deejayspinzMember
Hi,
I installed the plugin and setup a number of products on a page. When I click the Add to Cart button, I get a blank page with “Page Cannot Be Displayed Error. HTTP 405 – Resource not allowed.”. I did some digging and “think” it may have to do with the Action postback going to the cart (eg Action=””). For example, I modified the line:
$replacement = ‘<object><form method=”post” action=”” style=”display:inline” onsubmit=”return ReadForm(this, true);”>’;
To (see the action parameter):
$replacement = ‘<object><form method=”post” action=”index.php?page_id=839″ style=”display:inline” onsubmit=”return ReadForm(this, true);”>’;
However, the problem is that this seems like an odd way to fix something that may have an easier answer, and I am not even sure its a fix. Currently I have the Add to Cart and View Cart links on the same page. When I use the above tweak, I can add to cart, it refreshes and shows the cart contents on the same page, but again, I dont know if this is a real fix or if it breaks something else.
A side note about my site. The contents of my WP site are within a subfolder (eg /Wordpress) and I have changed the site (as suggested in WP docs) to allow me to call from the root (www.plastibots.com). I moved the index.php file to the root as suggested. The site is working fine with this change.
Help!
December 14, 2009 at 11:06 pm #16711amin007ParticipantIt’s good to know that you got it working by tweaking it but you really shouldn’t have to do any tweaking. I don’t know exactly what you did for your specific wordpress setup but I suspect some steps might be missing. I have a few customers who installed thier wordpress in a sub-directory then used redirection to access it from the root domain.
The changes you did shouldn’t break anything else but it can be limiting as you are specifically posting to a page.
action=""
means post to the current page (whatever this page maybe)December 14, 2009 at 11:36 pm #16712deejayspinzMemberProblem is, it is not really working. I think that normally, WordPress handles my site calls to the root at index.php. For example, my About page calls to this: http://www.plastibots.com/?page_id=2 (WP and IIS are fine). But, in your plugin action=”” and calls back to the same page seem to break. Any other thoughts on how to fix this? I dont really want to patch the action reference as it seems more like a bandage solution.
December 15, 2009 at 11:47 pm #16713timheuerMemberdeejayspinz – looks like you are hosting on IIS as well — did you ever get this working. I’m using a 404 handler for better URL formats and this broke the paypal shopping cart. I can’t figure out how to input the correct settings to get it to work.
December 16, 2009 at 2:08 am #16714deejayspinzMember@timheuer, I got it working, but noting being a PHP guru, I feel like it’s a bandage solution. My first post alluded to the fix, however after testing it, I also noticed that the red ‘x’ to delete an item from the cart was also broke, so I had to do a similar fix for that. I have posted the updates I made below, but remember that these may not be the proper fix and it would be better if they are fixed by an official update to the plugin.
In a nutshell I think the problem I am having is a combination of IIS, and permalinks (I cannot get permalinks working with anything other than forcing /index.php?page=). Oh and I also followed the WordPress notes to move my index.php out of the wordpress folder and into the root of the site. So I think that all of these tweaks are playing a role here.
That said, here are the mods I made to wp_shopping_cart.php (change your pageid to be
the pageid for your blog. In my case the products and cart are both on the same page:
Within the block of code beginning on line 222 that starts with $output .= ”
There are two calls to action=””
I modified each to include a reference to index.php?page_id=839 and they look like this: action=”index.php?page_id=839″ Make sure you get the and ” in the right place.
approx line 441:
Change:
//$replacement = ‘<object><form method=”post” action=”” style=”display:inline” onsubmit=”return ReadForm(this, true);”>’;
To:
$replacement = ‘<object><form method=”post” action=”index.php?page_id=839″ style=”display:inline” onsubmit=”return ReadForm(this, true);”>’;
Once I made these changes, the cart appears to be working ok. However, Im screwed if I change the page, or add the cart elsewhere.. I will cross that bridge if and when I have to..
December 16, 2009 at 4:38 am #16715timheuerMember@deejayspinz – thanks — I tried that but still isn’t working for me — I wonder because I have the cart in a page that is within a category? Do you have yours in a public place I can look? Mine is here: http://cortinahoa.com/documents/online-payment
December 16, 2009 at 11:58 pm #16716deejayspinzMemberI just tried your link and your cart seems to work fine. (I only added and removed from the cart).
-
AuthorPosts
- You must be logged in to reply to this topic.