Array
(
[0] => Array
(
[cart_id] => 24763
[product_id] => 740
[name] => Samsung S20
[model] => Samsung S20
[shipping] => 1
[image] => catalog/samsung/samsungs20.jpg
[option] => Array
(
)
[download] => Array
(
)
)
[1] => Array
(
[cart_id] => 24799
[product_id] => 749
[name] => Huawei P40
[model] => Huawei P40
[shipping] => 1
[image] => catalog/huawei/huaweip40.jpg
[option] => Array
(
)
[download] => Array
(
)
)
)
^ Above is the output of the array
$productdata = $this->cart->getProducts();
^ Above is the code for query out array
is there anyway to check product_id of each array ? Let say that if product_id = 749 , alert ('P40');
Tried to do
foreach ($productdata as $productdatas) {
if ($productdata['product_id'] = 749)
{ alert('P40');
}
}
nothing happen
foreachand then look at which of these variables you use to check the product id... do you see the problem now?