#StackBounty: #magento2.3 #sales-order #payment #magento2.3.5 #order-collection How to add payment filter in Order collection factory m…

Bounty: 50

I need to add the "po_number" as filter in order collection factory, i am trying to implement this in the sales order history page using getOrders function in the History.php

Full Code :

<?php
/**
 * Copyright © Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */
namespace SmSalesOrderGridTableBlockOrder;

use MagentoFrameworkAppObjectManager;
use MagentoSalesModelResourceModelOrderCollectionFactoryInterface;

/**
 * Sales order history block
 *
 * @api
 * @since 100.0.2
 */
class History extends MagentoFrameworkViewElementTemplate
{
    /**
     * @var string
     */
    protected $_template = 'Magento_Sales::order/history.phtml';

    /**
     * @var MagentoSalesModelResourceModelOrderCollectionFactory
     */
    protected $_orderCollectionFactory;

    /**
     * @var MagentoCustomerModelSession
     */
    protected $_customerSession;

    /**
     * @var MagentoSalesModelOrderConfig
     */
    protected $_orderConfig;

    /**
     * @var MagentoSalesModelResourceModelOrderCollection
     */
    protected $orders;

    /**
     * @var CollectionFactoryInterface
     */
    private $orderCollectionFactory;

    /**
     * @param MagentoFrameworkViewElementTemplateContext $context
     * @param MagentoSalesModelResourceModelOrderCollectionFactory $orderCollectionFactory
     * @param MagentoCustomerModelSession $customerSession
     * @param MagentoSalesModelOrderConfig $orderConfig
     * @param array $data
     */
    public function __construct(
        MagentoFrameworkViewElementTemplateContext $context,
        MagentoSalesModelResourceModelOrderCollectionFactory $orderCollectionFactory,
        MagentoCustomerModelSession $customerSession,
        MagentoSalesModelOrderConfig $orderConfig,
        array $data = []
    ) {
        $this->_orderCollectionFactory = $orderCollectionFactory;
        $this->_customerSession = $customerSession;
        $this->_orderConfig = $orderConfig;
        parent::__construct($context, $data);
    }

    /**
     * @inheritDoc
     */
    protected function _construct()
    {
        parent::_construct();
        $this->pageConfig->getTitle()->set(__('My Orders'));
    }

    /**
     * Provide order collection factory
     *
     * @return CollectionFactoryInterface
     * @deprecated 100.1.1
     */
    private function getOrderCollectionFactory()
    {
        if ($this->orderCollectionFactory === null) {
            $this->orderCollectionFactory = ObjectManager::getInstance()->get(CollectionFactoryInterface::class);
        }
        return $this->orderCollectionFactory;
    }

    /**
     * Get customer orders
     *
     * @return bool|MagentoSalesModelResourceModelOrderCollection
     */
    public function getOrders()
    {
        if (!($customerId = $this->_customerSession->getCustomerId())) {
            return false;
        }
        if (!$this->orders) {
            $this->orders = $this->getOrderCollectionFactory()->create($customerId)->addFieldToSelect(
                '*'
            )->addFieldToFilter(
                'status',
                ['in' => $this->_orderConfig->getVisibleOnFrontStatuses()]
            )->addFieldToFilter(
                'entity_id',
                ['num' => 362]
            )->setOrder(
                'ext_order_id',
                'desc'
            );
        }
        $this->orders->getSelect()
        ->join(
            ["sop" => $this->getTable("sales_order_payment")],
            'main_table.entity_id = sop.parent_id'
        )
        ->where('sop.po_number = ?','08RRR');

        echo "<pre>"; print_r($this->orders->getData()); die("dead");
        return $this->orders;
    }
}

Specific get Orders():

public function getOrders()
        {
            if (!($customerId = $this->_customerSession->getCustomerId())) {
                return false;
            }
            if (!$this->orders) {
                $this->orders = $this->getOrderCollectionFactory()->create($customerId)->addFieldToSelect(
                    '*'
                )->addFieldToFilter(
                    'status',
                    ['in' => $this->_orderConfig->getVisibleOnFrontStatuses()]
                )->addFieldToFilter(
                    'entity_id',
                    ['num' => 362]
                )->setOrder(
                    'ext_order_id',
                    'desc'
                );
            }
            $this->orders->getSelect()
            ->join(
                ["sop" => $this->getTable("sales_order_payment")],
                'main_table.entity_id = sop.parent_id'
            )
            ->where('sop.po_number = ?','08RRR');
    
            echo "<pre>"; print_r($this->orders->getData()); die("dead");
            return $this->orders;
        }


Get this bounty!!!

#StackBounty: #magento2.3 #csv #importexport #magento-cron Import new and update products and their attributes with a CSV file and cron…

Bounty: 50

I am using Magento 2.3.3 and wants to import products using cron and csv. I have google Sheet which contains all products data and sheet’s data changes continuously. So I have to run a cron every day which updates product price, qty and some attributes values.

  1. I’ve generated csv from sheet and it is being successfully imported manually.
  2. Then I tried to import csv using cron by hitting some import functions existing in module-
    import-export. But didn’t work and everything messed up.
  3. Now I’m trying to import products by directly save them in database.

Is it possible to do that? Or is their another way?

Checked this link also but didn’t understand that much.


Get this bounty!!!

#StackBounty: #magento2.3 #addtocart Increase the success/exception message time span in Magento 2

Bounty: 50

When product add to cart the success/exception message is hiding rapidly, So I just tried below way to show/increase the time span of the message. But it’s not worked for me.

I have modified the messages.js file as below from vendor/magento/Module-Ui/view/frontend/web/js/view/messages.js

/**
         * @param {Boolean} isHidden
         */
        onHiddenChange: function (isHidden) {
            var self = this; 
            // Hide message block if needed
             if (isHidden) {
                setTimeout(function () {
                    $(self.selector).hide('blind', {}, 500);
                }, 50000);
            }
        }

The above code is not working for me. Please suggest me increase the time span of the message.

enter image description here


Get this bounty!!!

#StackBounty: #magento2.3 #multi-source-inventory #vendor #magento2-b2b B2B Multiple warehouse management for sellers and shipping from…

Bounty: 50

single vendor multiple warehouse concept in B2B. Like vendors, warehouses should be located in different cities.
Is there any extension available for this and any idea about this.

Multiple warehouse management for sellers and shipping from multiple warehouses.

Example: Asian paints have two warehouses. Warehouse A and Warehouse B
If an order is placed, I can ship from A or B.

The warehouse will have products. If I shop from that warehouse then stock gets reduced from there.

Any help would be appreciated.


Get this bounty!!!