Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Call to a member function applyCondition() on array #166

Open
robertnicjoo opened this issue Feb 4, 2019 · 5 comments · May be fixed by #370
Open

Call to a member function applyCondition() on array #166

robertnicjoo opened this issue Feb 4, 2019 · 5 comments · May be fixed by #370

Comments

@robertnicjoo
Copy link

robertnicjoo commented Feb 4, 2019

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

screenshot_2019-02-04 whoops there was an error

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"
      ]
    ]
  ]
}
@Mohammed-Daud
Copy link

Getting same error when trying item level conditions

@alibaba258
Copy link

Also getting the same error. Any workarounds?

@abishekrsrikaanth
Copy link

abishekrsrikaanth commented Sep 15, 2023

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}],

@abishekrsrikaanth
Copy link

@robertnicjoo @Mohammed-Daud @alibaba258 were you guys able to fix this issue?

@abishekrsrikaanth
Copy link

Pushed a fix for this, hopefully it helps others.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants