Hot answers tagged

6

Please follow below step to add SR No into Sales order items list. Open app/design/adminhtml/default/default/template/sales/order/view/items.phtml file and replace with below code. <?php $_order = $this->getOrder() ?> <div class="grid np"> <div class="hor-scroll"> <table cellspacing="0" class="data order-tables"> <...


5

Step 1: Create a new di.xml in this path: app/code/NameSpace/ModuleName/etc/di.xml and put the below code <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd"> <type name="Magento\SalesSequence\Model\Sequence"> <plugin name="...


4

Use the below code to show the correct configurable's child product image. <?php $_item = $block->getItem(); $objectManager = \Magento\Framework\App\ObjectManager::getInstance(); $productRepository = $objectManager->get('\Magento\Catalog\Model\ProductRepository'); $_product = $productRepository->get($_item->getSku()); $...


3

For me, sales_order_save_commit_after was the only event that worked well: If you need the event to be triggered in the admin area and also in the frontend, you can add the following code in etc/events.xml. If you need it for the order created from admin only, you need to add the following code in etc/adminhtml/events.xml Code: <?xml version="1.0"?> ...


3

Following steps will be useful step 1: override the items.phtml code Path:app/design/frontend/Theme/Magento_Sales/templates/email/items.phtml <?php /** * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ // @codingStandardsIgnoreFile ?> <?php $_order = $block->getOrder() ?> <?php if ($...


3

Could be either yes or no. Is the old domain being dropped? If so you need to speak to whoever is in charge of the migration. Ideally you want to go from this www.olddomain.com/ www.olddomain.com/oldadminpanel To this www.newdomain.com/ www.newdomain.com/newadminpanel With a subdomain archive.newdomain.com/ archive.newdomain.com/oldadminpanel Then ...


3

access your backend by IP address: php bin/magento setup:store-config:set --base-url="http://1.2.3.4/" php bin/magento setup:store-config:set --use-secure=0 php bin/magento cache:flush where 1.2.3.4 is your old IP address. that simple. http://1.2.3.4/admin_xxxx


3

Looking at your code, I guess you miss the trick. You have to set order items fields to 0 which are effected by creating invoice. Replace your item foreach with this. $items = $order->getAllItems(); foreach ($items as $k => $item) { echo $item->getId() . "\n"; $item->setBaseRowInvoiced(0); $item->setRowInvoiced(0);...


3

First read this below articles: https://store.fooman.co.nz/blog/an-introduction-to-extension-attributes.html https://devdocs.magento.com/guides/v2.3/extension-dev-guide/extension_attributes/adding-attributes.html If you want to add a field them you need to use extension_atttibutes Extension attribute gives the facility to add a new field to existing API ...


3

Be safe: make a backup of your SQL first. SET FOREIGN_KEY_CHECKS = 0; Truncate order tables: TRUNCATE TABLE `gift_message`; TRUNCATE TABLE `quote`; TRUNCATE TABLE `quote_address`; TRUNCATE TABLE `quote_address_item`; TRUNCATE TABLE `quote_id_mask`; TRUNCATE TABLE `quote_item`; TRUNCATE TABLE `quote_item_option`; TRUNCATE TABLE `quote_payment`; TRUNCATE ...


3

Run this sql query in your database SELECT so.customer_email, soi.sku, soi.name FROM `sales_order` as so left join sales_order_item as soi on so.entity_id = soi.order_id where soi.sku = 'your_product_sku' Replace your_product_sku with your product actual sku. You can create script also. Please let me know still if you have any question.


3

You need to create a small module, which will use event-observer feature of magento. we will put an observer which will get trigger when any order will get placed! create following files: app/code/Pawan/GenerateCSV/registration.php <?php \Magento\Framework\Component\ComponentRegistrar::register( \Magento\Framework\Component\ComponentRegistrar::MODULE,...


3

I don't think it's related to customer being logged in or not, but I think order items are not persisted yet, as you're retrieving new order object. Also you should never use objectManager directly. Try updating your code to this: public function execute(\Magento\Framework\Event\Observer $observer){ $order = $observer->getEvent()->getOrder(); $...


3

In mageto2, you can not cancel an order which is at Hold status. If you want then you first need to changes order status to UnHold then you can cancel.


2

<?php namespace CustomAPI\MyRecentOrder\Model; use CustomAPI\MyRecentOrder\Api\MyRecentOrderInterface; //use Magento\Catalog\Model\ResourceModel\Product\CollectionFactory as productCollectionFactory; //use Magento\Catalog\Api\ProductRepositoryInterface as productRepository; class MyRecentOrder implements MyRecentOrderInterface { //protected $logger; ...


2

fetch all pending orders through REST API, add comments on it and change status for those orders $userData = array("username" => "adminuser", "password" => "adminpassowrd"); $ch = curl_init("https://yourhost.com/index.php/rest/V1/integration/admin/token"); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST"); curl_setopt($ch, CURLOPT_POSTFIELDS, ...


2

There is a feature request / open issue on this topic since it was supported in m1 but got lost in m2: https://github.com/magento/magento2/issues/14509


2

I think a better answer is to use the following api entry point ("/rest/V1/orders/{orderId}/comments", Method.POST); pass the StatusHistory object in the post body, setting the appropriate fields to update the order status. { "statusHistory": { "comment": "string", "createdAt": "string", "entityId": 0, "entityName": "string", "...


2

I have got this work, I have changed few things & now tis worked for me. Thanks @arun. <?php $_order = $block->getOrder() ?> <?php if ($_order): ?> <?php $_items = $_order->getAllItems(); ?> <table class="email-items" cellspacing="0" cellpadding="0" border="0" width="650" style="border:1px solid #EAEAEA;"> &...


2

In shipping.js you must also add the dependency for Magento_Checkout/js/model/cart/estimate-service. This will trigger the recalculation of the grand total when the shipping cost is updated. define([ 'jquery', 'Magento_Checkout/js/view/summary/abstract-total', 'Magento_Checkout/js/model/quote', 'Magento_Checkout/js/model/cart/estimate-...


2

If you are on community edition Return management is not part of it You would have create a RMA module or Buy some existing modules If you are on Enterprise Edition You can enable it with following steps On the Admin sidebar, tap Stores. Then under Settings, choose Configuration. In the panel on the left, under Sales, choose Sales. Expand the RMA ...


2

Explanation: This happens because, in $quote->addProduct($product, intval($item['qty']));. $product is always the same instance of the Product model. Solution: Replace this in the constructor \Magento\Catalog\Model\Product $product with \Magento\Catalog\Model\ProductFactory $productFactory. Replace this $this->_product = $product; with $this->...


2

You have to dump for these tables for all orders records: sales_invoice sales_invoice_comment sales_invoice_grid sales_invoice_item sales_invoiced_aggregated sales_invoiced_aggregated_order sales_order sales_order_address sales_order_aggregated_created sales_order_aggregated_updated sales_order_grid sales_order_item sales_order_payment ...


2

Try this for getting website id from an order in observer file $websiteid=$order->getStore()->getWebsiteId();


2

The event will be defined at etc/events.xml Nor etc/event.xml.Seems file name is wrong. events.xmlcode will be like.Also, the Syntax of declare event is wrong. Please used below code: <?xml version="1.0"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd"> ...


2

In the Temando_Shipping module there is the method Temando\Shipping\Plugin\Sales\OrderRepositoryPlugin::afterSave. In the comment of this method there is this /** * Manifest order at Temando platform. * * Observers don't work: * - `sales_order_save_commit_after` is no longer triggered in guest checkout * - `sales_order_save_after` does not have related ...


2

Try this! <?php require_once(Mage::getModuleDir('controllers','Mage_Checkout').DS.'OnepageController.php'); class SR_MagentoCommunity_OnepageController extends Mage_Checkout_OnepageController { /** * Save checkout billing address */ public function saveBillingAction() { if ($this->_expireAjax()) { return; ...


2

If you want to get order id on checkout_onepage_controller_success_action then you have to call $observer->getEvent()->getOrderIds() $observer->getEvent()->getOrderIds() provide an array which consist of one order id of single checkout and provide multiple order ids. <?php nameSpace YourNameSpace; use Magento\Framework\Event\Observer as ...


2

Extension attributes are not custom attributes. You have to personally handle their persistence (create a column|table for them in the database and save|load them). More about this in the Official docs and an example here Magento Official Github Example documented here Another comprehensive tutorial can be found here


2

Your third-party payment methods don't support admin order. Same for PayPal Express Checkout. PayPal Express Checkout redirects to Paypal that's why this is not working for admin section if you enabled by hacking code. For Check / Money Order this payment method extends Magento\Payment\Model\Method\AbstractMethod class. If you open then you can see ...


Only top voted, non community-wiki answers of a minimum length are eligible