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..
Hello again 🙂 when using the step engine in yves, there is a last “successStep
Hello again 🙂
when using the step engine in yves, there is a last “successStep” which will display a “thank you for your order” phrase. We want also to display the order number of the current finished order. Unfortunately, the success execute step clears the quote before the getTemplateVariables() method gets called. So we have no order reference anymore. Question: Is there some elegant way to get the last order reference anyway without extensive changes? Any “getLastOrder” functionality or something like this?
Best regards
Comments
-
One idea is to bypass the step engine on the “successAction” in the CheckoutController and pass an extra variable to the render call … but this would be extremely ugly in my opinion
0 -
Another idea: outsource the clearQuote logic to an additional step called “clearQuoteStep” and append it as the very last step (after success page). The problem is, i cannot be ensured that the “clearquote” step is really executed. 😕
0 -
U can to do this in controller successAction.
U can clone the quote transfer and then execute the process (standard).
And provide the cloned quote transfer to view..0 -
As far as i see, the quote is $response in that case
$response = $this->createStepProcess()->process($request);
This will implicit execute all steps (including clear quote) … how to clone this here?
0 -
Okay, the response is not the quote but it is included in it …
0 -
U have the DataContainer in CheckoutPage Bundle.. Just get data from DataContainer and u have the quote transfer used in step engine
0 -
okay, means, get the datacontainer and pass an extra variable to the template?
0 -
yes.. this is the fast way..
0 -
Would be some solution that i already evaluated, but also very ugly in my opinion^^
0 -
No.. why?
0 -
Because the response is already rendered and should include all the info that is required for rendering the output
0 -
Feels like hacking the whole process to me in some way
0 -
SuccessStep ist the last step.. successStep execute will be run before getTemplateVariables etc... u have no other options..
Another options is to make this logic in successStep execute.. there maybe clone and then this cloned var used in getTemplateVariables.. but is the same.. maybe clean0 -
Okay, might be the only workaround for this 😕 Thanks a lot 🙂
0 -
as said clean would be to implement this in successStep on pyz level..
Let me know if u found another "better" solution 🙂
0 -
p.s.: take a look in placeOrderAction in CheckoutController.. Spryker self make some checks or other things before run process... it is just similar..
0 -
ah i see …
0 -
$quoteTransfer = $this->getFactory()
->getQuoteClient()
->getQuote();0 -
as said clean would be to implement this in successStep on pyz level..
How would you do this? I would suggest editing the execute method, but unfortunately, the return value of the execute gets saved to the session … so adding the order reference here leads to unwanted effects for the next order/quote
0 -
even with clone quoteTransfer saved as class variable i.e. and then used in getTemplateVariables.
Ok.. In our project we have a secondary data container where we save in session the quote placed as order.. in our case then is just to read this one.. but this happened in our project already in place order action to avoid double orders problem where Spryker just working on it (great problem in spryker place order)
0 -
but we have a completely re-structured checkout.. we have an OnePageCheckout.. otherwise i could post the source code for u..
0 -
Thanks for your offer 🙂 i think i will go for least resistance way and bypass some variable to the template^^might be appropriate for the current siutation
0 -
$orderReference = $this->getFactory()->getQuoteClient()->getQuote()->getOrderReference();
return $this->view(
array_merge($response, [‘orderReference’ => $orderReference]), …is the way i’ll go
0 -
Ok.. where u placed
$orderReference = $this->getFactory()->getQuoteClient()->getQuote()->getOrderReference();
?
0 -
successAction, first execution line
0 -
right before
$response = $this->createStepProcess()->process($request);
0 -
since it will change the quote
0 -
Ok in controller.. then u go with first option as my first suggestion..
Yes it is ok!
0 -
Thanks a lot 🙂
0 -
u are welcome.
p.s.: of course there is still a better or elegant solution, but this ist the fast and also "not ugly" solution!
0
Categories
- All Categories
- 42 Getting Started & Guidelines
- 7 Getting Started in the Community
- 8 Additional Resources
- 7 Community Ideas and Feedback
- 75 Spryker News
- 921 Developer Corner
- 781 Spryker Development
- 88 Spryker Dev Environment
- 362 Spryker Releases
- 3 Oryx frontend framework
- 34 Propel ORM
- 68 Community Projects
- 3 Community Ideation Board
- 30 Hackathon
- 3 PHP Bridge
- 6 Gacela Project
- 25 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