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..
Hi, I got a question on a best practice: I am in my PayCommand. I need to get access to the itemTran
Hi, I got a question on a best practice:
I am in my PayCommand. I need to get access to the itemTransfer inside/ instead of the SalesOrderItemTransfer.
Why? The ItemTransfer provides a field "originalNetPrice", which I need (prices without margin).
My thought so far: I could receive this by resolving the productId and get the ItemTransfer this way. Is there a better idea?
Comments
-
You shouldn’t fetch it from the current product price.
The reason here is that while the order item you process might be created a few seconds ago in the meantime the product price could have changed.My suggestion is to copy the originalNetPrice into the order item during the creation of it and work on this copied data.
It’s the same reason why addresses for an order are copied to the order instead of referencing the original address.0 -
I agree, order data should not be changed after order was placed. All those information was accepted by customer (including prices and so on) during checkout process.
0 -
Alright 🙂 Thank you both, will extend the SpySalesOrderItemEntityTransfer then.
Can you tell me, at which point items are "changed" to OrderItems? My first guess was to add the new field (originNetPrice) during Calculation process.
0 -
There should be a placeOrder method in the sales bundle. This is were the quote gets converted into an order.
Implementing this in the calculation process is not a good idea as most parts of the calculation process are reused in the cart.0 -
Yep, I added an own step to checkout already (margin calculation).
OriginNetPrice of a product shouldn't change at all during process (well.. maybe if the price is changed in this time as you mentioned 😅 )Thanks! 🙂
0 -
https://github.com/spryker/sales/blob/master/src/Spryker/Zed/Sales/Business/Model/Order/OrderHydrator.php#L187 would be a good extension point via a order hydrator plugin
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