Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Problem with products not loading to cart


altavistabiz

Recommended Posts

I am having a problem with products loading into the cart, however it only occurs when I'm clicking the "add to cart" button from the product_info page.

If i click "buy now" on the index.php page (where all the products are lined up in the category) it works just fine!

 

I have looked over the previous threads on similar issues but don't exactly know how to apply the changes to my specific circumstances. Please advise.

 

P.S. I have looked at the Global register and both settings are off. I am unable to determine where I make that change. I see the php directory, but don't know how to get there

Link to comment
Share on other sites

Do you have a template? The standard code for the "Add to Cart" button is this

 

<?php echo tep_draw_hidden_field('products_id', $product_info['products_id']) . tep_image_submit('button_in_cart.gif', IMAGE_BUTTON_IN_CART); ?>

 

Check you have that in product_info.php

Link to comment
Share on other sites

Do you have a template? The standard code for the "Add to Cart" button is this

 

<?php echo tep_draw_hidden_field('products_id', $product_info['products_id']) . tep_image_submit('button_in_cart.gif', IMAGE_BUTTON_IN_CART); ?>

 

Check you have that in product_info.php

 

Hi,

Yes, the code is exactly as you have it in product_info.php

 

As far as a template, I'm using the default installation of osCommerce provided by the hosting company.

Here's a link...

http://neatphotos.accountsupport.com/catal...;products_id=35

Link to comment
Share on other sites

Hmm, strange!

 

A default installation with no mods added?

 

I know! :blink: The only thing I can think is that there is some connection with the config files that I changed to allow for SSL. Everything else works just dandy. So, I'm stumped.

Link to comment
Share on other sites

I dont think that SSL and config files have anything to do with this.. Does your Add To Cart code in Product_info look like the one posted above??

 

it also seems that you do not have an oscsid (session id) which is what keeps the session alive while you are shopping.. Did you force cookies to true?? or did you ENABLE SEO FRIENDLY URLs??

 

if you enables SEO FRIENDLY urls try disabling it

A great place for newbies to start

Road Map to oscommerce File Structure

DO NOT PM ME FOR HELP. My time is valuable, unless i ask you to PM me, please dont. You will get better help if you post publicly. I am not as good at this as you think anyways!

 

HOWEVER, you can visit my blog (go to my profile to see it) and post a question there, i will find time to get back and answer you

 

Proud Memeber of the CODE BREAKERS CLUB!!

Link to comment
Share on other sites

I dont think that SSL and config files have anything to do with this.. Does your Add To Cart code in Product_info look like the one posted above??

 

it also seems that you do not have an oscsid (session id) which is what keeps the session alive while you are shopping.. Did you force cookies to true?? or did you ENABLE SEO FRIENDLY URLs??

 

if you enables SEO FRIENDLY urls try disabling it

 

I was wondering about that too. However, when I disable it I cannot get the enable cookies page to go away when I'm testing... I'll try again.

 

(10 minutes later) I disabled that and now cookies are forced, however original problem persists. I'm ready to look for another option. The funny thing is that clicking on the "buy now" button from the main page works, but from product_info page "add to cart" does not. I'm new to php and would like to code in the same buy now feature on the product-info page, but it appears not to be the same kind of functionality. I'll paste the code in a moment...

Link to comment
Share on other sites

I was wondering about that too. However, when I disable it I cannot get the enable cookies page to go away when I'm testing... I'll try again.

 

(10 minutes later) I disabled that and now cookies are forced, however original problem persists. I'm ready to look for another option. The funny thing is that clicking on the "buy now" button from the main page works, but from product_info page "add to cart" does not. I'm new to php and would like to code in the same buy now feature on the product-info page, but it appears not to be the same kind of functionality. I'll paste the code in a moment...

Oh, and yes the code is exactly as it appears above...

<?php echo tep_draw_hidden_field('products_id', $product_info['products_id']) . 
tep_image_submit('button_in_cart.gif', IMAGE_BUTTON_IN_CART); ?>

 

Okay, now I'm really stumped. I just tested in two browsers - Firefox and IE- and both times I keep get the enable cookies message. Cookies are enabled! I triple checked both browsers! Is this helping?

 

BTW, I really appreciate any and all help. Thank you to you who have responded. :wub:

Link to comment
Share on other sites

Oh, and yes the code is exactly as it appears above...
<?php echo tep_draw_hidden_field('products_id', $product_info['products_id']) . 
tep_image_submit('button_in_cart.gif', IMAGE_BUTTON_IN_CART); ?>

 

Okay, now I'm really stumped. I just tested in two browsers - Firefox and IE- and both times I keep get the enable cookies message. Cookies are enabled! I triple checked both browsers! Is this helping?

 

BTW, I really appreciate any and all help. Thank you to you who have responded. :wub:

 

I'm going to have to go in a different direction. So, how do I disable the ability to link to product_info.php from the index.php page?

 

Thanks,

Daphne

Link to comment
Share on other sites

I'm going to have to go in a different direction. So, how do I disable the ability to link to product_info.php from the index.php page?

 

Thanks,

Daphne

 

One suggestion I could make but cannot be specific is to remove that column from the results - should be an easy find and that's what I may end up doing temporarily.

 

I have the opposite problem - I can add anything to the cart from anywhere except from a the main product listing. Featured products, products info, specials, searches all work fine. But if someone adds to the cart after a search from the categories list, they get an empty cart.

 

I have SEO installed, and as far as I know, it worked when installed though I may not have checked every possibility. I believe whatever problem I have is going to be fixed in the products_listing file, but I'd hate to go in there and muck things up.

 

Can anyone please help? Any ideas?

 

Help would be greatly appreciated!

 

Thanks in advance.

 

/*

########################################
//   OLD CODE

         case 'PRODUCT_LIST_BUY_NOW':
           $lc_align = 'center';
          if ($listing['products_price_status']!= '0') { 
          $lc_text .= ' <br><a href="' . tep_href_link
	   (FILENAME_PRODUCT_INFO, 'products_id=' . $listing['products_id']) . '"><span class="productSpecialPrice">' . TEXT_CLICK_PRICE . '</span></a><br>';

//   END OLD CODE

########################################

*/
//   START NEW CODE

         case 'PRODUCT_LIST_BUY_NOW':
          $lc_align = 'center';
	   if ($listing['products_price_status']!= '0') {
          $lc_text = ' <br><a href="' . tep_href_link
	   (basename($PHP_SELF), tep_get_all_get_params(array('action', 'pName')) . 'action=buy_now&products_id=' . $listing['products_id']) . '">' . tep_image_button('button_buy_now.gif', IMAGE_BUTTON_BUY_NOW) . '</a> ';
          break;	

//   END NEW CODE

//Master Products            
       } elseif ($listing['products_master'] > 0) {
           $lc_text = ' <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $listing['products_master']) . '">' . tep_image_button('button_buy_now.gif', IMAGE_BUTTON_BUY_NOW) . '</a> ';       
       } elseif ($listing['products_master_status']== 1) {
           $lc_text = ' <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $listing['products_id']) . '">' . tep_image_button('button_buy_now.gif', IMAGE_BUTTON_BUY_NOW) . '</a> ';
       } else {

//Cure the buy now 302 bot problem with if/else

	  if ($session_started) { 
$lc_text = '<form name="buy_now_' . $listing['products_id'] . '" method="post" action="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=buy_now', 'NONSSL') . '"><input type="hidden" name="products_id" value="' . $listing['products_id'] . '">' . tep_image_submit('button_buy_now.gif', TEXT_BUY . $listing['products_name'] . TEXT_NOW) . '</form> '; 
           break;
	} else {$lc_text = ' ';}

	}        		
//Master Products EOF        	

Link to comment
Share on other sites

One suggestion I could make but cannot be specific is to remove that column from the results - should be an easy find and that's what I may end up doing temporarily.

 

I have the opposite problem - I can add anything to the cart from anywhere except from a the main product listing. Featured products, products info, specials, searches all work fine. But if someone adds to the cart after a search from the categories list, they get an empty cart.

 

I have SEO installed, and as far as I know, it worked when installed though I may not have checked every possibility. I believe whatever problem I have is going to be fixed in the products_listing file, but I'd hate to go in there and muck things up.

 

Can anyone please help? Any ideas?

 

Help would be greatly appreciated!

 

Thanks in advance.

 

/*

########################################
//   OLD CODE

         case 'PRODUCT_LIST_BUY_NOW':
           $lc_align = 'center';
          if ($listing['products_price_status']!= '0') { 
          $lc_text .= ' <br><a href="' . tep_href_link
	   (FILENAME_PRODUCT_INFO, 'products_id=' . $listing['products_id']) . '"><span class="productSpecialPrice">' . TEXT_CLICK_PRICE . '</span></a><br>';

//   END OLD CODE

########################################

*/
//   START NEW CODE

         case 'PRODUCT_LIST_BUY_NOW':
          $lc_align = 'center';
	   if ($listing['products_price_status']!= '0') {
          $lc_text = ' <br><a href="' . tep_href_link
	   (basename($PHP_SELF), tep_get_all_get_params(array('action', 'pName')) . 'action=buy_now&products_id=' . $listing['products_id']) . '">' . tep_image_button('button_buy_now.gif', IMAGE_BUTTON_BUY_NOW) . '</a> ';
          break;	

//   END NEW CODE

//Master Products            
       } elseif ($listing['products_master'] > 0) {
           $lc_text = ' <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $listing['products_master']) . '">' . tep_image_button('button_buy_now.gif', IMAGE_BUTTON_BUY_NOW) . '</a> ';       
       } elseif ($listing['products_master_status']== 1) {
           $lc_text = ' <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $listing['products_id']) . '">' . tep_image_button('button_buy_now.gif', IMAGE_BUTTON_BUY_NOW) . '</a> ';
       } else {

//Cure the buy now 302 bot problem with if/else

	  if ($session_started) { 
$lc_text = '<form name="buy_now_' . $listing['products_id'] . '" method="post" action="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=buy_now', 'NONSSL') . '"><input type="hidden" name="products_id" value="' . $listing['products_id'] . '">' . tep_image_submit('button_buy_now.gif', TEXT_BUY . $listing['products_name'] . TEXT_NOW) . '</form> '; 
           break;
	} else {$lc_text = ' ';}

	}        		
//Master Products EOF        	

 

 

Whoops, sorry Daphne. I responded too hastily.

 

If it is from the product_info page then disregard what I said.

 

Good luck.

Link to comment
Share on other sites

  • 2 weeks later...
  • 2 weeks later...

I'm not sure if this is what you are after but I believe that a "buy now" button should go off to some merchant site that allows you to buy one item now.

 

I wanted an "add to cart" feature which allows the client to continue shopping so I did the following:

 

Buy Now problem.

 

Please note that at least the following contributions have been appplied to this site.

Header tags 309

SID Killer 2 (this is where the forms come from)

Ultimate SEO URLs 2.6 (turned off - causes problems with manufacturers box)

Better Product Display 2.0.3

Add a BACK button

Product Listing Module 2.3

Infobox with many products

 

 

Checked catalog/includes/application_top.php for case 'add_product' and case 'buy_now', this is how I discovered

that product_quantity MUST be greater than Zero.

 

Edit Files:

catalog/products_new.php

catalog/includes/modules/new_products.php

catalog/includes/modules/product_listing.php

 

Changed the <form name="buy_now_ to <form name="add_cart_

No real reason but I want to add to cart not buy now.

 

Changed the 'action=buy_now' to 'action=add_product'

This takes me straight to the shopping cart.

 

Also - VERY IMPORTANT - ensure that the product quantities are greater than ZERO or you just get the

'Your Shopping Cart is empty!' message.

 

Not using product reviews yet so I haven't done anything about:

catalog/product_reviews.php

catalog/product_reviews_info.php

catalog/product_reviews_write.php

 

Hope this helps

Link to comment
Share on other sites

I'm not sure if this is what you are after but I believe that a "buy now" button should go off to some merchant site that allows you to buy one item now.

 

...

..................

 

Also - VERY IMPORTANT - ensure that the product quantities are greater than ZERO or you just get the

'Your Shopping Cart is empty!' message.

 

I am trying to put a add to cart box to specials here is the code I am using

 

<?php . tep_draw_form('cart_quantity', tep_href_link(FILENAME_PRODUCT_INFO, tep_get_all_get_params(array('action')) . 'action=add_product'))	. tep_draw_hidden_field('products_id', $product_info['products_id']) . tep_image_submit('button_in_cart.gif', IMAGE_BUTTON_IN_CART) .?>

 

and have that exact problem -nothing is added i just go to the the empty cart

 

I did nt quite get the solution from steve24 can someone explain

Link to comment
Share on other sites

Actually i have made the products_new.php to have the same look aw the specials

 

Used this code to add a cart box in the PRODUCTS_NEW

 

 echo '<a href="' . tep_href_link(FILENAME_PRODUCTS_NEW, tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $products_new['products_id']) . '">' . tep_image_button('button_in_cart.gif', IMAGE_BUTTON_IN_CART) .

 

and it worked

Link to comment
Share on other sites

I am trying to put a add to cart box to specials here is the code I am using

 

<?php . tep_draw_form('cart_quantity', tep_href_link(FILENAME_PRODUCT_INFO, tep_get_all_get_params(array('action')) . 'action=add_product'))	. tep_draw_hidden_field('products_id', $product_info['products_id']) . tep_image_submit('button_in_cart.gif', IMAGE_BUTTON_IN_CART) .?>

 

and have that exact problem -nothing is added i just go to the the empty cart

 

I did nt quite get the solution from steve24 can someone explain

 

Sorry, I should have been more specific. In your store your product quantities have to be greater than zero.

Just run this MySql query to set them to 50 (change 50 to be any number you like)

 

UPDATE products SET products_quantity = 50 WHERE products_quantity < 50;

Link to comment
Share on other sites

  • 7 months later...

after all the hassles / attempts to work out what was going on - turns out it was simply that i didn't have quantities in the products setup - all were 0 or less - as there isn't a 'stock' system as such - the stock will just keep going...

 

thanks for the answer :)

Link to comment
Share on other sites

I'm also getting this from the Category page - it empties the cart, and if you're logged in it kicks you out.

I've tried running the SQL code, and changing my config and session settings, but nothing seems to be working.

Link to comment
Share on other sites

  • 5 months later...
  • 1 year later...

after all the hassles / attempts to work out what was going on - turns out it was simply that i didn't have quantities in the products setup - all were 0 or less - as there isn't a 'stock' system as such - the stock will just keep going...

 

thanks for the answer smile.gif

 

Yes I am having the same issue -very annoying , if i add a product with 0 quantity in stock to cart from index is shows in SHOPPING_CART.php with *** (RED) not available, from product info is just displays "Your Shopping Cart is empty!" ...

 

.... I dont want to have to give products quantity .

 

Interestingly the stock OSC 2.3.1 works just fine..

 

So I am goning to dig deeper!

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...