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

Check the assigned block to render the order items defined in layout file vendor\magento\module-sales\view\adminhtml\layout\sales_order_view.xml <block class="Magento\Sales\Block\Adminhtml\Order\View\Items" name="order_items" template="Magento_Sales::order/view/items.phtml"> Block method \Magento\Sales\Block\Adminhtml\Order\View\Items::...


3

After some goggling and with the help of some core modules I came up with following solution : /** * @var \Magento\Sales\Api\OrderRepositoryInterface */ protected $orderRepository; /** * @var \Magento\Catalog\Api\ProductRepositoryInterface */ protected $productRepository; /** * @var \Magento\Quote\Api\Data\CartItemInterfaceFactory */ protected $...


2

Try this: $order = $_objectManager->create('Magento\Sales\Model\Order')->load($orderID); foreach ($order->getAllItems() as $item) { $productOptions = unserialize($item->getProductOptions()); echo "<pre>"; print_r($productOptions); // check the [attributes_info] for the attributes info } OR $order = $_objectManager-&...


2

Magento\Sales\Block\Adminhtml\Order\View\Items:getItemsCollection Is the method for getting items for section,If you want to MOdify that item collection then you have to work on that method


2

Try this, Add the below code in your controller <?php namespace Vendor\ModuleName\Controller\Orders; class ReadOrders extends \Magento\Framework\App\Action\Action { protected $resultPageFactory; protected $itemFactory; public function __construct( \Magento\...


1

If I want to add 'updated_at' too in the filter with the same condition like 'created_at' then what should I do in below query: $products = Mage::getResourceModel('catalog/product_collection') ->addAttributeToSelect('*') ->addFieldToFilter('created_at', array( ...


1

You can get the status of each individual item using the following: foreach ($_order->getAllItems() as $item) { echo $item->getStatus(); }


1

First it needs to said that you cant apply any filter on getItemsCollection() in Order model because the collection is already loaded in that method and after loading filters can't be applied anymore to a collection. But that shouldn't bother you. You can just iterate through the collection and remove non matching items. For example like this: $...


1

Try this, Inject this in your constructor \Magento\Sales\Model\Order\ItemFactory $itemFactory and add this in your constructor $this->itemFactory = $itemFactory; then you can apply filter like this anywhere in your function and in your case it would be like public function getAllItems() { $current_seller_id = 5; $order = $this->...


1

Try using the repository. use Magento\Sales\Api\OrderItemRepositoryInterface; /** * @var OrderItemRepositoryInterface */ private $orderItemRepository; public function __construct( OrderItemRepositoryInterface $orderItemRepository ) { $this->orderItemRepository = $orderItemRepository; } Now: $orderItem = $this->orderItemRepository->...


1

Try following code. <?php $orderid = 2; $objectManager = \Magento\Framework\App\ObjectManager::getInstance(); $order = $objectManager->create('Magento\Sales\Api\Data\OrderInterface')->load($orderid); //Loop through each item and fetch data foreach ($order->getAllItems() as $item) { //fetch whole item information print_r($item->getData(...


1

Sparta Gym Tank is configurable product. Check parent_item_id for this item. If parent_item_id is not empty/null then this product is child product. parent_item_id is the parent configurable product


1

I did it in this way. In the code below i just added the column DISCOUNT, but you could add what you want following the same logic. Also for creditmemo pdf. Create a custom module and override Magento\Sales\Model\ResourceModel\Order\Invoice and Magento\Sales\Model\Order\Pdf\Items\Invoice\DefaultInvoice with your class in di.xml. <?xml version="1.0"?> ...


1

Based on your json, you cannot get the delivery dates by options key, you have to use info_buyRequest, Try this foreach ($this->order->getAllVisibleItems() as $orderItem) { $options = $orderItem->getProductOptions(); if(!empty($options['info_buyRequest'])) { if(!empty($options['info_buyRequest']["deliverydates"])) { ...


1

You can try: $order = $_objectManager->create('Magento\Sales\Model\Order')->load($orderID); $items = $order->getAllVisibleItems(); // $items = $order->getAllItems(); // all items foreach ($items as $item) { $options = $item->getProductOptions(); // all product options } EDIT: If you can try not to use ObjectManager directly....


1

Use $order->getAllVisibleItems() instead of $order->getAllItems() Updated Answer $order->getAllVisibleItems() will return only configurable product. Then you can get the child items of configurable products using $item->getChildrenItems(). This method (getChildrenItems()) is defined in Mage_Sales_Model_Order_Item. So, the code will be foreach($...


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