Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Cannot Add to Shopping Cart


m1ket

Recommended Posts

Hi,

 

I have a testing website up at http://www.surfingaddiction.com with osCommerce2.2 installed in conjunction with Wordpress.

 

Everything about osCommerce seems to be functioning properly. I have procucts, with product details, and all these details can be viewed via our website. An example can be seen @ http://surfingaddiction.com/shop/index.php?cPath=1

 

The main problem I am having is that when I try to add a product to the cart the following page reads "Your Shopping Cart is empty!".

 

I am a total osC newbie and this set up wasn't created by me. I have been given someone else's work to set up on a new server. So I have been playing around with the configure.php files a lot trying to get something so work. So I'm almost sure that the problem will lie in one of these files, but I have little understanding of what the DEFINE's should be.

 

I have also noticed that when I click "Add to Cart" the following page reads simply as http://www.surfingaddiction.com/shop/shopping_cart.php. This seems odd to me as I thought there would be some variables pass via the URL for the cart to add the product.

 

I am hoping that this problem of mine can be sorted relatively quickly. While I am a newbie with osC, I am pretty clued up with PHP. So helping me out shouldn't be to much of a task.

 

If I need to show any code to further help this problem get resolved just say.

 

Thanks in advance osC-Community!

</work><fun>

Link to comment
Share on other sites

Sorry to double post and bump so early guys. Just wanted to add a bit more information to this to try and get it resolved. I'm still racking my brain over this and getting nowhere.

 

It seems that there are no sessions being created by osCommerce? Whenever I click add to cart there are no osCsid's attached to the URL's.

 

Does anyone have any idea on this problem?

</work><fun>

Link to comment
Share on other sites

Sorry to double post and bump so early guys. Just wanted to add a bit more information to this to try and get it resolved. I'm still racking my brain over this and getting nowhere.

 

It seems that there are no sessions being created by osCommerce? Whenever I click add to cart there are no osCsid's attached to the URL's.

 

Does anyone have any idea on this problem?

 

It looks looks a template, is it? Many template writers hack the osc code as they don`t really know how things work, they just want to make it look nice!!

 

You may need to go back to the template writer to ask him to fix his code:

 

I see 2 issues:

 

1. Your not using tep_href_link for all links, so loosing the session whenever they are used. http://www.oscommerce.com/forums/index.php?showtopic=330479

 

 

2. Those links/forms that are (add to cart) is using PHPSESSID, but osC uses osCsid, don't know where thats from, or is it not a osc cart?

Link to comment
Share on other sites

Thanks for the reply Joe234.

 

To address point 2 first. The site is a bit messy at the moment. Apologies. There is remnants of an old cart on there that probably use PHPSESSID. I am guessing you found this page - http://www.surfingaddiction.com/products/freestyle/ or a similar which is an old products page still in the background. For the purposes of helping me further an osCommerce product page can be found @ http://www.surfingaddiction.com/shop/?cPath=1

 

Hope this isn't confusing things that much. Things are a bit all over the place with this project at the moment, and I'm trying my best to get things in line.

 

At the moment, an 'Add to Cart' link on http://www.surfingaddiction.com/shop/?cPath=1 looks like:

 

http://surfingaddiction.com/shop/index.php?cPath=1&action=buy_now&products_id=36

 

When I guess they should look like:

 

http://surfingaddiction.com/shop/index.php?cPath=1&action=buy_now&products_id=36&osCsid=fscosnc7k86mkvmt2i9mvvojv0&action=buy_now&products_id=36&osCsid=...

 

So I understand that. I also understand point 1 you made about tep_href_link. However, I am confused about where this would missing from so that sessions would be saved.

 

I check the 'Add to Cart' links in the theme I have been handed and that function is present:

$module .= '<a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $listing['products_id']) . '" class="deepdeep1"><p><img src="images/pay.jpg" height="40" /><strong>Add to cart</strong></p></a>';

 

With that piece of knowledge for the 'Add to Cart' buttons known, why are there no sessions being created?

 

Thanks for taking the time by the way. This feels like a real messy situation at the moment.

</work><fun>

Link to comment
Share on other sites

 

 

The add to cart on that page is

http://surfingaddiction.com/shop/index.php?cPath=1&action=buy_now&products_id=33&PHPSESSID=ev61sll07ectbelmiapi3rcks6

 

so still not oscsid

 

ALL your links must use tep_href_link not just the cart add ones, read the thread I linked fully & you should start to get it.

 

None of the links in your header are useing tep_href_link

 

osc will hide the sid from the url after the first few pages, thats why u don't always see it, you must visit the store afresh each time you want to check

Link to comment
Share on other sites

The add to cart on that page is

http://surfingaddiction.com/shop/index.php?cPath=1&action=buy_now&products_id=33&PHPSESSID=ev61sll07ectbelmiapi3rcks6

 

so still not oscsid

May I ask where you are finding this? Because if I just type:

 

http://surfingaddiction.com/shop/index.php?cPath=1

Into the address bar, the 'Add to Cart' URL for product_id 33 is:

 

http://surfingaddiction.com/shop/index.php?cPath=1&action=buy_now&products_id=33

I'm not seeing any PHPSESSID's?

 

What confuses me about the link you posted is that my logic is this:

 

I mean no where along that line has osCommerce had the chance to lose a session id, because only one link has been click and that link had the tep_href_link function attached to it. Surely one should get created either when I click onto the product page 'index.php/cPath1' or one should get created when I click 'Add to Cart'.

 

Is my thinking/logic on the right line?

</work><fun>

Link to comment
Share on other sites

It seems you think ignoring things will make them go away!! That'll never work.

 

As I said

it is using PHPSESSID, but osC uses osCsid

 

I'm not seeing any PHPSESSID's?

 

I did say:

 

osc will hide the sid from the url after the first few pages, thats why u don't always see it, you must visit the store afresh each time you want to check

 

Did you not understand that?

 

I would suspect you have modified the tep_href_link function so its adding an invalid attribute code, undo that mod.

 

Try starting with a standard osc setup instead of this hash-up, then when u have it working, look at adding mods u want.

Link to comment
Share on other sites

The site isn't making a cookie with the session ID in it.

 

It could be the cookie settings in the config file.

If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you.

 

"Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice."

- Me -

 

"Headers already sent" - The definitive help

 

"Cannot redeclare ..." - How to find/fix it

 

SSL Implementation Help

 

Like this post? "Like" it again over there >

Link to comment
Share on other sites

Thanks for all the help guys. Your combined effort has led me to the answer.

 

There was another plugin installed on my Wordpress system creating shopping cart sessions that were blocking osCommerce making them.

 

It's all good now. All I had to do was shutdown said plugins.

 

Thanks again, and apologies for being a newb.

</work><fun>

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...