|
|
| |
1. Problem with array object |
|
Reply |
|
|
 Darren Whittington | 2010-05-19 21:40:27 |
Hi I have adapted a basket script to take products as objects, when I try to subtract a product from the basket array i get the above error, they look like this:
>>> to remove from basket
Product Object
(
[productId] => 3
[accessories] => Array
(
[0] => fab_prot
[1] => endcap
)
[productQuantity] => 0
)
>>> this is the existing basket
Array
(
[0] => Product Object
(
[productId] => 1
[accessories] => Array
(
)
[productQuantity] => 1
)
[1] => Product Object
(
[productId] => 3
[accessories] => Array
(
[0] => fab_prot
[1] => endcap
)
[productQuantity] => 0
)
)
This is the method/function i'm using:
function DeleteFromBasket($id)
{
echo "<pre>";
print_r($product = $this->getProduct($id)); //outputs the lines above
print_r($this->products);
echo "<pre>";
$this->products = array_diff($this->products, array($product));
return true;
}
Darren |
There are 2 replies in this thread, which are not being displayed. Browsing this forum thread replies is available only to premium subscribers.
Go to the premium subscriptions page to learn how to become a premium subscriber and have full access to this forum. |