laravelshoppingcart
laravelshoppingcart copied to clipboard
Call to a member function applyCondition() on array
When I try to save my cart data to database I'm getting error below on all my app (it completely messed my app now i can't load any page of my app!)
Call to a member function applyCondition() on array
Cart DD
CartCollection {#2781 ▼
#items: array:1 [▼
22 => ItemCollection {#2624 ▼
#config: array:6 [▶]
#items: array:6 [▼
"id" => 22
"name" => "style four"
"price" => 50000.0
"quantity" => "1"
"attributes" => ItemAttributeCollection {#2625 ▼
#items: array:3 [▼
"attr" => array:2 [▼
"name" => "weight"
"value" => "1"
]
"slug" => "style-four"
"photo" => "productCover-gmyrDtczNR.jpeg"
]
}
"conditions" => array:2 [▼
0 => CartCondition {#2626 ▼
-args: array:4 [▼
"name" => "red"
"value" => "7500"
"type" => "additional"
"target" => "item"
]
-parsedRawValue: 7500.0
}
1 => CartCondition {#2627 ▼
-args: array:4 [▼
"name" => "title 33"
"value" => "3"
"type" => "additional"
"target" => "item"
]
-parsedRawValue: 3.0
}
]
]
}
]
}
Item DD
ItemCollection {#2624 ▼
#config: array:6 [▶]
#items: array:6 [▼
"id" => 22
"name" => "style four"
"price" => 57503.0
"quantity" => "1"
"attributes" => ItemAttributeCollection {#2625 ▼
#items: array:3 [▼
"attr" => array:2 [▼
"name" => "weight"
"value" => "1"
]
"slug" => "style-four"
"photo" => "productCover-gmyrDtczNR.jpeg"
]
}
"conditions" => array:2 [▼
0 => array:2 [▼
"name" => "red"
"value" => "7500"
]
1 => array:2 [▼
"name" => "title 33"
"value" => "3"
]
]
]
}
Getting same error when trying item level conditions
Also getting the same error. Any workarounds?
Any resolutions for this? I have the same error and issue has been active for quite sometime.
From debugging the code, calling $cart->getContent()->toArray()
causes the item level conditions to store incorrectly. This issue happens only when an item condition exists. The item level condition gets stored as following
"conditions": [{"parsedRawValue": null}],
@robertnicjoo @Mohammed-Daud @alibaba258 were you guys able to fix this issue?
Pushed a fix for this, hopefully it helps others.