I developed a simple code and it works well, please take a look:
<!-- language: lang-php-->
You can follow magento reorder functionality. E.g: vendor/magento/module-sales/Controller/AbstractController/Reorder.php
The following line will create new quote:
$reorderOutput = $this->reorder->execute($order->getIncrementId(), $order->getStoreId());
You can open vendor/magento/module-sales/Model/Reorder/Reorder.php, where you can found more ...
six types of Cancel events for Orders in Magento 2
This event is used after order canceled. If you want to do something after an order is canceled you can use this event.
Check file, vendor/magento/module-sales/Model/Order.php at cancel() function.
Allows you to cancel the order invoice when you canceled ...
I was not able to test it just by the information that you provide, although I have some clue what is wrong: fieldValue is 0, no entity will return a cart for this value.
If you are performing the request for guest user you can check the table quote_id_mask but the fieldValue must be a hash. For logged users fieldValue needs be an int greater than 0 and that ...
This solution is working till Magento2.3.5. The following error occurred with Magento2.3.6 and Magento2.4 versions. Any help would be appreciated.
Type Error occurred when creating object: Magento\InventoryIndexer\Model\Queue\ReservationData, Argument 2 passed to Magento\InventoryIndexer\Model\Queue\ReservationData::__construct() must be of the type int, ...
I found this code :
require_once('app/Mage.php'); //Path to Magento
// Set an Admin Session
Mage::getSingleton('core/session', array('name' =&...
Create frontname_controllerdirectory_controllerclass.xml inside your module view/adminhtml/layout
Then copy all the layout of sales_order_view.xml from vendor/magento/module-sales/view/adminhtml/layout
Then add custom block or your logic you want to implement and create redirect to your link frontname_controllerdirectory_controllerclass and create ...
Please get website's base URL from this code:
public $_storeManager; public function __construct(
} $url = $this->_storeManager->getStore()->getBaseUrl(\Magento\Framework\UrlInterface::URL_TYPE_WEB);
$orderUrl = $url.'sales/order/view/...
I tried myself and found out that Magento use CustomerSession which sometimes cannot get the customer Id, I don't know why this happen, but since I know this, I always turn to SessionFactory
One way or the other, you have to edit the code to use SessionFactory to accomplish the task. Here is how it's display in default theme
I faced the similar issue as you've mentioned, in my sales_order_save_before/sales_order_save_after observers.
I think the difference of getAllVisibleItems() and getAllItems() comes when order is created. If you're calling these functions before order creation, the output of both will remain same.
I solved this issue by loading quote from order, as follow. ...
May be these articles can help you, as I think you have built a custom module already to fill the customer and product details, I know you asked for event, but if its custom module, you will have to create your own event using dispatch event:
By checking the Redoc reference of this endpoint, you will see that the email field is required also outside the billing address array - https://magento.redoc.ly/2.4.2-guest/#operation/checkoutGuestPaymentInformationManagementV1SavePaymentInformationAndPlaceOrderPost.
Basically your payload should look something like this:
When you say you got the wrong shipping address - do you mean you got billing address?
As a quick test, I can retrieve correct shipping address from order repository, but it's a bit convoluted.
You call getExtensionAttributes which returns \Magento\Sales\Api\Data\OrderExtensionInterface
then call getShippingAssignments which returns \Magento\Sales\Api\Data\...
After looking into my checkout_index_index.xml I realized an obvious mistake of mine. I missed the following in my code:
<item name="summary" xsi:type="array">
<item name="children" xsi:type="array">
Watch out while coding tired folks!
Magento doesn't have a cancel order from the frontend feature as of now. You can cancel an order from the backend by going through the following steps:-
Sign in to your admin panel then go to Sales>Orders.
From the list of orders find the order that you want to cancel and from the Action, column click on View
Click on the Cancel button on the top. Agree ...
Cancel order from frontend can be easily achieved with few easy steps:-
Step1:- Change the sales_order_history XML file to change the default order history template(we will add cancel link). Path:- view/frontend/layout/sales_order_history.xml.
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:...
The ID that appears in the URL is the Magento internal order ID that you will also find in the database as entity_id in the orders table sales_order.
The one displayed with '#' it's called increment_id and you should see it like the 'SKU of the order' as it is usually used to reference the order when integrations with other systems are used. So you will use ...
You can add this code to your success.phtml page to get the order total
$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$order = $objectManager->create('Magento\Sales\Model\Order')->loadByIncrementId($block->getOrderId());
$total = $order->getGrandTotal(); ?>
<?php echo $total ?>