Basically it appears that each time an item is added to the cart, the cart is getting re-initialized or reset, b/c there's ever only a single item in the cart
Additionally when trying to proceed, the third step of the check out displays these errors....anyone have any ideas on the 'cc' and 'cod' indexes in the global namespace?
Notice: Undefined index: cc in D:\MyStore\catalog\includes\functions\general.php on line 1060
Notice: Undefined index: cod in D:\MyStore\catalog\includes\functions\general.php on line 1060
Latest News: (loading..)
Shopping cart not initializing
Started by kokaddict, Aug 22 2011, 15:51
9 replies to this topic
#1
Posted 22 August 2011, 15:51
#2
Posted 22 August 2011, 16:08
kokaddict, on 22 August 2011, 15:51, said:
Basically it appears that each time an item is added to the cart, the cart is getting re-initialized or reset, b/c there's ever only a single item in the cart
Additionally when trying to proceed, the third step of the check out displays these errors....anyone have any ideas on the 'cc' and 'cod' indexes in the global namespace?
Notice: Undefined index: cc in D:\MyStore\catalog\includes\functions\general.php on line 1060
Notice: Undefined index: cod in D:\MyStore\catalog\includes\functions\general.php on line 1060
Additionally when trying to proceed, the third step of the check out displays these errors....anyone have any ideas on the 'cc' and 'cod' indexes in the global namespace?
Notice: Undefined index: cc in D:\MyStore\catalog\includes\functions\general.php on line 1060
Notice: Undefined index: cod in D:\MyStore\catalog\includes\functions\general.php on line 1060
// Check if product has attributes
function tep_has_product_attributes($products_id) {
$attributes_query = tep_db_query("select count(*) as count from " . TABLE_PRODUCTS_ATTRIBUTES . " where products_id = '" . (int)$products_id . "'");
$attributes = tep_db_fetch_array($attributes_query);
if ($attributes['count'] > 0)
return true;
} else {
return false;
}
}
Look if one of your attribute doesn't bug. Do you have install an add-on for attributes ?
Edited by goldoi, 22 August 2011, 16:09.
#3
Posted 22 August 2011, 16:11
(Thanks for the quick response)
Attributes are turned on yes, but they aren't being used so the block that outputs their information in the cart was commented. Do they have to be shown in order for the logic to work?
Attributes are turned on yes, but they aren't being used so the block that outputs their information in the cart was commented. Do they have to be shown in order for the logic to work?
#4
Posted 22 August 2011, 16:22
In doing a little more deep dive, it appears the problem is the session variables. When the "continue shopping" is hit (which goes to the index.php of the catalog), it resets the session variable and the "cart" object is lost.
In application_top I commented the pieces around the if (tep_session_is_registered('cart') && is_object($cart)) logic to see if the value was set. Turns out any time index.php is hit, the session is lost and therefor, the shopping cart instance too.
Is this a configuration problem?
In application_top I commented the pieces around the if (tep_session_is_registered('cart') && is_object($cart)) logic to see if the value was set. Turns out any time index.php is hit, the session is lost and therefor, the shopping cart instance too.
Is this a configuration problem?
#5
Posted 22 August 2011, 16:22
In think, which addon do you use for check out ?
edit:
You could just try
$cart->reset(true);
Into checkout_success.php , but I would first check your payment modules and your checkout_process.php file
and:
Check in includes/configure.php of /admin and of catalog that STORE_SESSIONS is well defined on mysql:
define('STORE_SESSIONS', 'mysql');
and
Be carefull of session gestion in admin/config/sessions
Use of cookies by strengh: True ou False
Check user: False
Checj ip adress: False
stop spider session: True or False
Renew session False
All must be False except these up!
edit:
You could just try
$cart->reset(true);
Into checkout_success.php , but I would first check your payment modules and your checkout_process.php file
and:
Check in includes/configure.php of /admin and of catalog that STORE_SESSIONS is well defined on mysql:
define('STORE_SESSIONS', 'mysql');
and
Be carefull of session gestion in admin/config/sessions
Use of cookies by strengh: True ou False
Check user: False
Checj ip adress: False
stop spider session: True or False
Renew session False
All must be False except these up!
Edited by goldoi, 22 August 2011, 16:31.
#6
Posted 22 August 2011, 16:40
Did you happen to catch the error about the session getting lost?
#7
Posted 23 August 2011, 03:16
Is Seesion ID is lost( oscsid) then any previous cart entry will be lost.
So check if oscsid is changing ( This can be check by looking at url will have oscsid or checking cookies ).
Satish
So check if oscsid is changing ( This can be check by looking at url will have oscsid or checking cookies ).
Satish
Ask for osCommerce value addon suggestion tips for your site.
Check My About US For who am I and what My company does.
Check My About US For who am I and what My company does.
#8
Posted 23 August 2011, 03:24
Thanks for the update, this is most frustrating for sure.
As long as navigation stays in the product-view/display pages, all is well, session (and cart) are kept.
However, when linking to the main index.php page...the session is lost.
In following the code the system does a session_write_close before leaving the shopping_cart.php (or product_info pages)
then as soon as it his the index page (which has application_top.php as it's first line) in it, the session logic is broken.
In dumping the values of the session read/write to the screen, EVERY time the index page is hit, the system doesn't pull the old one, but rather, creates a new one.
The ONLY logic anywhere in the code that's touching the sessions is application_top and it's corresponding session classes & logic files.
HELP is greatly appreciated as I'm about to throw this osCommerce out the window!
As long as navigation stays in the product-view/display pages, all is well, session (and cart) are kept.
However, when linking to the main index.php page...the session is lost.
In following the code the system does a session_write_close before leaving the shopping_cart.php (or product_info pages)
then as soon as it his the index page (which has application_top.php as it's first line) in it, the session logic is broken.
In dumping the values of the session read/write to the screen, EVERY time the index page is hit, the system doesn't pull the old one, but rather, creates a new one.
The ONLY logic anywhere in the code that's touching the sessions is application_top and it's corresponding session classes & logic files.
HELP is greatly appreciated as I'm about to throw this osCommerce out the window!
#9
Posted 23 August 2011, 04:11
site url to see whats happening.
Probably when you linked to home page session ID was not carried thru or somewhere session is getting destroyed or recreated.
Satish
Probably when you linked to home page session ID was not carried thru or somewhere session is getting destroyed or recreated.
Satish
Ask for osCommerce value addon suggestion tips for your site.
Check My About US For who am I and what My company does.
Check My About US For who am I and what My company does.
#10
Posted 23 August 2011, 04:23
That's certainly a likely suspect...however
>> when you linked to home page session ID was not carried thru
Save a page INSIDE the catalog directory...let's say product_info....last active line in the file is: tep_session_close();
Inside that page is the following tag:
<a href='<?=$root_path?>sample_index.php'>Click Me</a>
Now, sample_index.php DOES NOT live under the /catalog/ of the osCommerce folder, however, it does include application_top.php as it's first line. No other session handling/touching is taking place other than what's in application_top.php.
in the logic block started by: if (tep_session_is_registered('cart') && is_object($cart)) [[ in application_top.php ]]
there is a line in each section of the if dumping whether or not an OLD session was re-created or a NEW one was created.
when sample_index.php is hit, EVERY TIME this code is activated:
tep_session_register('cart');
$cart = new shoppingCart;
which obviously nukes any existing and starts fresh. My question is this, can file outside of the osCommerce catalog/ folder be used with osCommerce sessions?
>> when you linked to home page session ID was not carried thru
Save a page INSIDE the catalog directory...let's say product_info....last active line in the file is: tep_session_close();
Inside that page is the following tag:
<a href='<?=$root_path?>sample_index.php'>Click Me</a>
Now, sample_index.php DOES NOT live under the /catalog/ of the osCommerce folder, however, it does include application_top.php as it's first line. No other session handling/touching is taking place other than what's in application_top.php.
in the logic block started by: if (tep_session_is_registered('cart') && is_object($cart)) [[ in application_top.php ]]
there is a line in each section of the if dumping whether or not an OLD session was re-created or a NEW one was created.
when sample_index.php is hit, EVERY TIME this code is activated:
tep_session_register('cart');
$cart = new shoppingCart;
which obviously nukes any existing and starts fresh. My question is this, can file outside of the osCommerce catalog/ folder be used with osCommerce sessions?














