What are the Slack Archives?
Itβs a history of our time together in the Slack Community! Thereβs a ton of knowledge in here, so feel free to search through the archives for a possible answer to your question.
Because this space is not active, you wonβt be able to create a new post or comment here. If you have a question or want to start a discussion about something, head over to our categories and pick one to post in! You can always refer back to a post from Slack Archives if needed; just copy the link to use it as a reference..
Can anybody help me with conditions in the statemachine? My Condition test does not work and I have
Can anybody help me with conditions in the statemachine?
My Condition test does not work and I have no clue why?
I'm runing the spryker b2c demo shop on docker.
My statemachine code for the condition looks like:
<transition condition="Oms/CheckInvoiceAmount" happy="true"> <source>release</source> <target>payment pending</target> <event>check amount</event> </transition> <transition condition="Oms/CheckInvoiceAmount" happy="true"> <source>release</source> <target>release order</target> <event>check amount</event> </transition>
And the condition class check function:
return $orderItem->getGrossPrice() > 500 ? true : false;
The result of the condition check always ends in the "release order" state.
Any suggestions?
Comments
-
Hello Robert! You have 2 transitions with happy=true. Probably this is the issue
0 -
Yes I know that. But changing this and having only one happy path is not the solution
0 -
Yes that should not matter π€
0 -
Why are there two transitions from the same state under the same condition?
0 -
There can always only be one result. And the order then comes down to implementation details
0 -
I think this should be conceptually different
0 -
Can you elaborate on the scenario?
0 -
Thanks Marco for your help. Maybe there is the error in my concept. I'll give it a try.
0 -
Still interested in what you found π
0 -
@UJN2JRU4F - Is there a log output for transitions and state changes in spryker?
0 -
There is in the database. Also for the oms state machine it is displayed next to the order items in zed
0 -
I know the current state for the order in the sales tab.
I'll have a look at the database.
Maybe my condition is "always" true.
0 -
Just to satisfy my ocd I have to remark that
? true : false
is always redundant0 -
Any suggestions for debugging / logging the check function ?
0 -
Ok solved the problem!
0 -
Good to hear! You can always share you solution to help other with the same problem π
0 -
scheduler off, console command + xdebug would be the easiest way
0 -
- @UJN2JRU4F solution with writing the condition in ust one transition
- the gross price of the order item is an integer. π
0 -
Now my last problem is to check this condition for the whole order not the item level.
Example:
Order total is above X then got to this state
0 -
\Spryker\Zed\Sales\Business\SalesFacade::findOrderByIdSalesOrderItem might help you
0 -
$orderItem->getOrder()->getLastOrderTotals()->getGrandTotal()
Is the total of the order!
0
Categories
- All Categories
- 42 Getting Started & Guidelines
- 7 Getting Started in the Community
- 8 Additional Resources
- 7 Community Ideas and Feedback
- 76 Spryker News
- 929 Developer Corner
- 787 Spryker Development
- 89 Spryker Dev Environment
- 362 Spryker Releases
- 3 Oryx frontend framework
- 35 Propel ORM
- 68 Community Projects
- 3 Community Ideation Board
- 30 Hackathon
- 3 PHP Bridge
- 6 Gacela Project
- 26 Job Opportunities
- 3.2K π Slack Archives
- 116 Academy
- 5 Business Users
- 370 Docker
- 551 Slack General
- 2K Help
- 75 Knowledge Sharing
- 6 Random Stuff
- 4 Code Testing
- 32 Product & Business Questions
- 70 Spryker Safari Questions
- 50 Random