Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

product_info.php cart problem


chooleen

Recommended Posts

Hi folks!

I have a problem and i can't solve it alone.

I've changed the host and after restoring, my online shop doesn't work as usual.

I have a osCommerce Online Merchant v2.2 RC2a store with a lot of contributions.

It works fine on the old host, but now, after relocation, I can't add to cart from product info page.

Adding to cart from index.php page (new products module), products_new.php or index.php?cPath=X pages (category pages) working very well.

The only problem occur on product_info.php page, for all products, with or without attributes, where the customer is redirected to cart, but the product isn't added.

Any help will be appreciated.

Thanks!

Link to comment
Share on other sites

Few probable reasons:

1) Cookies not getting stores this inturn means sessions are lost. Set force cookies to true and check what happens.

 

2) Session getting recreated.So whatever was added to the cart goes with old session and new session will not take details of previous session.

 

3) Register global issue. So code not adding to cart( very high probability if register global patch not applie or if register globals is set to false).

 

Satish

Ask/Skype for Free osCommerce value addon/SEO suggestion tips for your site.

 

Check My About US For who am I and what My company does.

Link to comment
Share on other sites

Thanks for reply Satish

 

My store is located in h..p://www.domainexample.com/catalog/ and have the following settings:

 

1. configure.php

...
 define('HTTP_SERVER', 'http://www.domainexample.com');
 define('HTTPS_SERVER', 'http://www.domainexample.com');
 define('ENABLE_SSL', false);
 define('HTTP_COOKIE_DOMAIN', 'domainexample.com');
 define('HTTPS_COOKIE_DOMAIN', 'domainexample.com');
 define('HTTP_COOKIE_PATH', '/catalog/');
 define('HTTPS_COOKIE_PATH', '/catalog/');
 define('DIR_WS_HTTP_CATALOG', '/catalog/');
 define('DIR_WS_HTTPS_CATALOG', '/catalog/');
...

 

2. Admin > Sessions

Session Directory 		/home/mydomain/public_html/catalog/cookies 	 
Force Cookie Use 		False	(tryed with True, too)
Check SSL Session ID 		False
Check User Agent 		False
Check IP Address 		False
Prevent Spider Sessions 	True
Recreate Session 		True	(tryed with False, too)

I have already tryed different settings, one at a time, without success.

 

As I posted before, product_info.php page is only one where I can't add to cart.

All other pages works like a charm.

 

Thanks!

Link to comment
Share on other sites

have you checked that manually.

 

like in application_top.php file find

 

if (isset($HTTP_GET_VARS['action'])) {

 

and write

 

print_r($_POST); exit;

 

see which variables are passed from the product info page.

 

have you changed your product info page?

 

i asked because there are hidden variable in product info page that contain product id.

 

if you changed the content of the page then you have to check the hidden variable is there or not?

Please take backup of your files before do changes suggested by me

Link to comment
Share on other sites

Thanks for the tip.

Yes, the problem is here. For different products I have the following results:

Array ( [id] => Array ( [1] => 2 [6] => 5 ) [quantity] => 1 [products_id] => 5 [x] => 41 [y] => 9 ) 
Array ( [id] => Array ( [1] => 2 [6] => 5 ) [quantity] => 9 [products_id] => 6 [x] => 55 [y] => 8 )
Array ( [id] => Array ( [1] => 1 [6] => 3 ) [quantity] => 1 [products_id] => 6 [x] => 36 [y] => 3 )
Array ( [quantity] => 1 [products_id] => 83 [x] => 37 [y] => 7 )

I must mention that there are some add-ons installed like "Quantiy box", "Buy N get 1 free", "Points/reward" modules and 1 or 2 attributes.

 

In application_top.php file I have:

// customer adds a product from the products page
     case 'add_product' :    if (isset($HTTP_POST_VARS['products_id']) && is_numeric($HTTP_POST_VARS['products_id'])) {
// original line                $cart->add_cart($HTTP_POST_VARS['products_id'], $cart->get_quantity(tep_get_uprid($HTTP_POST_VARS['products_id'], $HTTP_POST_VARS['id']))+1, $HTTP_POST_VARS['id']);
                               $cart->add_cart($HTTP_POST_VARS['products_id'], $cart->get_quantity(tep_get_uprid($HTTP_POST_VARS['products_id'], $HTTP_POST_VARS['id']))+$quantity, $HTTP_POST_VARS['id']);
                             }
                             tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters)));
                             break;

There is a $quantity variable that didn't work properly. If I revert the code to original line then it works, but I can add only a product at a time.

This variable is generated by quantity box in product_info.php file:

<td class="main" align="right" valign="top"><input type="text" name="quantity" value="1" maxlength="2" size="2"></td>

but I can't find it just now.

Any further help will be appreciated. Thanks to all!

Link to comment
Share on other sites

$HTTP_POST_VARS['id']))+$quantity

 

this variable $quantity is looks like creating issue.

With register globals off you need to use $_POST['quantity']

 

in case your code has initialized quantuty prior to this line then do paste you complete application_top file code.

 

Satish

 

Ask/Skype for Free osCommerce value addon/SEO suggestion tips for your site.

 

Check My About US For who am I and what My company does.

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...