[Phplib-users] HEAVY cart problems
Brought to you by:
nhruby,
richardarcher
|
From: Feite B. <fei...@os...> - 2001-09-27 09:53:30
|
Hi,
I have created some shopping site using phplib and extended the cart
class. Now I had *NO* problems when using the basic functionality of
the add_item(..) method of the cart class.
Because I needed to have the possiblity to save options for an article
I created an article object that can hold the options for this article
and I extended the derived cart class with a new add_item_new(..) method
to be able to store an object in an item array .
Storing an object with this code leads to an error:
$this->extendeditem[$idx] = array (
"code" => $articlecode,
"num" => $num,
"articleObject" => $artObj
);
********
Parse error: parse error in session.inc on line 272
********
but Session.inc has nothing to do with it !
If I make it like this:
$this->extendeditem[$idx] = array (
"code" => $articlecode,
"num" => $num
);
... the error is gone. But then of course I don't get the object stored.
I did some testing with storing objects in an array like the code below
and that works just fine.
<?php
$db = new DB_shop;
$ao = array();
$art = new Article($db);
$art->GetDetails('AD011520');
$ao[] = $art;
unset($art);
$art = new Article($db);
$art->GetDetails('AD011521');
$ao[] = $art;
unset($art);
$art = new Article($db);
$art->GetDetails('AD011526');
$ao[] = $art;
unset($art);
reset($ao);
# Loop through all the Article objects and display their Details using
the ShowDetails method of the object
while(list($k, $v) = each($ao)) {
echo("----------------------- $k --------------------------
<BR>\n");
$v->ShowDetails();
}
?>
So my question is :
Why is it not possible to store an object by passing is to a method of a
cart object ?
Hope someone can help me out here, thanks !
--
Feite Brekeveld
fei...@os...
http://www.osiris-it.nl
|