New answers tagged

0

I developed a simple code and it works well, please take a look: <!-- language: lang-php--> <?php declare(strict_types=1); namespace Vendor\Module\Model; use Magento\Quote\Api\CartManagementInterface; use Magento\Quote\Api\CartRepositoryInterface; use Magento\Catalog\Api\ProductRepositoryInterface; use Psr\Log\LoggerInterface; class ...


0

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 ...


0

six types of Cancel events for Orders in Magento 2 1. order_cancel_after 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. 2. sales_order_invoice_cancel Allows you to cancel the order invoice when you canceled ...


0

I think Store Manager for Magento soft should have reports like that (or at least the existing one can by customized)


0

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 ...


0

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, ...


0

I found this code : <?php error_reporting(E_ALL); ini_set("memory_limit", "100000M"); require_once('app/Mage.php'); //Path to Magento umask(0); Mage::app("default"); Mage::init(); // Set an Admin Session Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID); Mage::getSingleton('core/session', array('name' =&...


1

Step 1: 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 ...


0

Please get website's base URL from this code: public $_storeManager; public function __construct( \Magento\Store\Model\StoreManagerInterface $storeManager, ..... ) { ... $this->_storeManager=$storeManager; } $url = $this->_storeManager->getStore()->getBaseUrl(\Magento\Framework\UrlInterface::URL_TYPE_WEB); $orderUrl = $url.'sales/order/view/...


0

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


0

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. ...


1

Created custom event for this events.xml <?xml version="1.0"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd"> <event name="trigger_order_place"> <observer name="vtn_order_success" ...


0

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: https://webkul.com/blog/create-quote-and-order-programmatically-in-magento2/ https://www.mageplaza.com/devdocs/...


0

1)Create event.xml file: <?xml version="1.0"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd"> <event name="sales_order_place_after"> <observer name="neo_ordercomment_observer_orderneo" ...


2

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: { "paymentMethod": { ...


0

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\...


0

Check the following way: /** @var \Magento\Sales\Model\Order\AddressRepository $addressRepository */ $addressRepository = $obj->create('Magento\Sales\Model\Order\AddressRepository'); /** @var \Magento\Framework\Api\SearchCriteriaBuilder $searchCriteriaBuilder */ $searchCriteriaBuilder = $obj->create('Magento\Framework\Api\SearchCriteriaBuilder'); $...


0

The info_buyRequest option is not exposed via the rest API, you will have to create your own method if you want to access it.


0

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!


0

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 ...


3

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:...


1

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 ...


0

Add this in NameSpace_YourModule/view/frontend/layout/checkout_index_index.xml <?xml version="1.0"?> <!-- /** * Copyright © 2015 Magento. All rights reserved. * See COPYING.txt for license details. */ --> <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="1column" xsi:noNamespaceSchemaLocation=&...


0

You can add this code to your success.phtml page to get the order total <?php $objectManager = \Magento\Framework\App\ObjectManager::getInstance(); $order = $objectManager->create('Magento\Sales\Model\Order')->loadByIncrementId($block->getOrderId()); $total = $order->getGrandTotal(); ?> <?php echo $total ?>


Top 50 recent answers are included