Project Synopsis
This project involved operating an online perfume-selling website on the Magento platform, offering a diverse selection of perfumes for online purchase.
The website is intricately linked to a warehouse management system. When a customer places an order, the order information is seamlessly transmitted to the ERP (Enterprise Resource Planning) system.
Subsequently, the ERP system orchestrates the distribution of products to the appropriate warehouse based on the shipping address and product availability.
Currently, the project involves an ongoing process of addressing tasks and fixing bugs. The team uses Trello as a collaborative tool for task management.
Whenever a task or issue arises, it is documented on Trello, and developers collaborate closely with the team to resolve it.
This collaborative approach ensures that tasks are effectively tracked and promptly addressed, and updates are recorded on Trello to maintain transparency and accountability within the project.
Project Requirements
The client identified a bug and sought the assistance of Valuecoders to resolve the issue and ensure it was thoroughly tested.
Key challenges
Key Challenge |
Solution |
Due to multiple redirects of the payment gateway, there was a possibility of a cookie-lost session. |
The developer attempted to change the cookie’s SameSite attribute from “Secure Lax” to “Secure None. |
The initial solution did not work, so the team had to develop something else. |
The method was changed from GetlastrealorderId to GetlastrealOrder of Magento/checkout/model/session. |
Modify the constructor to directly invoke the object manager. |
The team directly utilized the Magento 2 object manager to retrieve the details of the last real order. |
Solution Implementation
To address this issue, the team examined the cookies and sessions. This was necessary because when a user was redirected to our website after a successful or failed payment, it could not locate the last order ID due to a loss of session or cookie data.
PROCESS
1. Initially, the team tried to modify the cookies on the same site from “lax” to “none.” To achieve this, the developers performed an override of the default Magento cookie module, specifically the Magento\Framework\Stdlib\CookieManagerInterface, to effect the change in the same-site attribute of the cookies.
2. The team implemented a solution to store the last actual order ID in local storage using JavaScript. This implementation was executed within the controller.
3. The method for obtaining the order was modified to achieve this. Instead of using the get orderID method, the team updated it to utilize the last real order method from Magento/Checkout/Model/Session.
ARCHITECTURE
For this project, two Magento Frameworks are used.
Results
Finally, when a payment is successful, the order status changes to “Processing” based on the last order ID. The developer explored three solutions, with the last one proving effective. Consequently, when a customer clicks “Pay with Tap” on the checkout page, it redirects to the payment gateway page.