#StackBounty: #magento2 #magento2.3 #product-attribute #search #magento2.3.5-p2 Magento 2 – Search result not working properly on dropd…

Bounty: 50

I have a dropdown attribute brand
Use in Search is set to "Yes"
Search Weight is set to 10, tried with 7 as well
In configuration Search Engine is set to MySql

There are more than 100 products are set to attribute value like "abc" Brand

But when I search for the word abc it only shows 29 products.

Indexing are up to date.
Cache is cleared

Please guide me fix the search on dropdown attribute?


Get this bounty!!!

#StackBounty: #magento2 #magento2.3 Duplicate orders created when proforma disabled programmatically via module Magento 2.3

Bounty: 250

In my custom module I’m using a custom customer attribute called disable_proforma_email, and using a plugin to stop the proforma email being sent if it is set to yes. This is working (or at least i thought it was) until i noticed that it is creating duplicate orders. If someone was to order 10 products it creates 1 orders every couple of seconds until it hits the amount of items they ordered originally (so until it creates a 10th order)

I’m not sure why this is happening, can anyone help?

etc/di.xml

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
    <type name="MagentoSalesModelOrderEmailContainerOrderIdentity">
        <plugin name="change_is_enable_method" type="XXBlockProformaPluginSalesOrderEmailContainerOrderIdentityPlugin"/>
    </type>
</config>

Plugin/Sales/Order/Email/Container/OrderIdentityPlugin.php

<?php

namespace XXBlockProformaPluginSalesOrderEmailContainer;
use MagentoCustomerApiCustomerRepositoryInterface;

class OrderIdentityPlugin
{
    /**
     * @var MagentoCheckoutModelSession $checkoutSession
     */
    protected $checkoutSession;

    protected $resourceConnection;

    protected $_customer;

    protected $customerRepository;

    /**
     * @param MagentoCheckoutModelSession $checkoutSession
     *
     * @codeCoverageIgnore
     */
    public function __construct(
        MagentoCheckoutModelSession $checkoutSession,
        MagentoFrameworkAppResourceConnection $resourceConnection,
        CustomerRepositoryInterface $customerRepository, 
        MagentoCustomerModelCustomer $customer
    )
    {
        $this->checkoutSession = $checkoutSession;
        $this->resourceConnection = $resourceConnection;
        $this->customerRepository = $customerRepository;
        $this->_customer = $customer;
    }

    /**
     * @param MagentoSalesModelOrderEmailContainerOrderIdentity $subject
     * @param callable $proceed
     * @return bool
     */
    public function aroundIsEnabled(MagentoSalesModelOrderEmailContainerOrderIdentity $subject, callable $proceed)
    {
        $returnValue = $proceed();

        $order = $this->checkoutSession->getLastRealOrder();
        $orderId=$order->getEntityId();  // order id
        
        $connection = $this->resourceConnection->getConnection();
        $sql = "select customer_id FROM sales_order where entity_id = " . $orderId;
        $result = $connection->fetchAll($sql);
        $customerId = null;
        foreach($result as $cid){
            $customerId = $cid["customer_id"];
        }

        $customerGetValue = $this->customerRepository->getById($customerId);
        $dpe = $customerGetValue->getCustomAttribute('disable_proforma_email')->getValue();

        if($dpe == 1){
            return false;
        }
        else{
            return true;
        }

    }
}

The functionality of the proforma not sending or sending depending on the attribute is working but of course I need it to stop duplicating orders.


Get this bounty!!!

#StackBounty: #magento2.3 #webapi #json-response Return JSON response in stead of JSON String

Bounty: 50

I’m working on building REST API which will return data of regions. API is working as expected but problem I’m facing is its returning response with JSON string and not able to parse that. Would like to get JSON response.

webapi.xml

    <route url="/V1/getRegions" method="GET">
        <service class="VendorModuleApiRegionsInterface" method="getRegions"/>
        <resources>
            <resource ref="self"/>
        </resources>
    </route>

Interface

<?php
namespace VendorModuleApi;

interface RegionsInterface
{
    /**
     * @return mixed
     */
    public function getRegions();
}

Next I added preference for interface and here’s that class.

<?php
declare(strict_types=1);
namespace VendorModuleModel;

use VendorModuleApiRegionsInterface;

class Regions implements RegionsInterface
{
    public function getRegions()
    {
        $data = [
            'status' => true,
            'message' => 'We will let you know!'
        ];

        return json_encode($data);

    }
}

When I’m triggering API with above code it returns like,

"{"status":true,"message":"We will let you know!"}"

I want response to be like,

{"status":true,"message":"We will let you know!"}

Any idea how to achieve this ?


Get this bounty!!!

#StackBounty: #magento2.3 #checkout #session #payment-gateway #magento2ccavenue Magento 2 Session Expire after return from payment gate…

Bounty: 50

We are facing the session expire issue, while, return from payment gateway.

We are integrated CCavenue Magento 2.3.4 Toolkit,

we are tried following ways

  1. Cache => somebody told maybe problem of cache content checkout and cart pages, so we tried to disable full page cache, then tried.
  2. Cookie Domain Mismatch => we are given the right hostname in cookie configuration.
  3. Stickie Session => we follow this blog, they suggested to use SameSite=lax.

Still, the session expires, after return from the payment gateway. we debug our toolkit, the session is there, before redirected to the payment gateway. after return from payment gateway only. session expires.

Suggest me, what is the issue and how to fix this.


Get this bounty!!!

#StackBounty: #magento2.3 #setup-di-compile #class-not-found Compile issue: Class AreProductsSalableInterface does not exist

Bounty: 50

Having issue in setup:di:compile and give below issue

enter image description here

Already checked: Magento 2 Setup di Compile Problem

Magento Vesion: 2.3.1

Update:

If i try with command bin/magento setup:di:compile -vvv, it gives below error

[root@server httpdocs]# bin/magento setup:di:compile -vvv
Compilation was started.
Area configuration aggregation... 5/7 [====================>-------]  71% 44 secs 287.0 MiB

In ClassReader.php line 35:

  [ReflectionException]
  Class MagentoInventorySalesApiApiAreProductsSalableInterface does not exist


Exception trace:
 () at /SITE_PATH/httpdocs/vendor/magento/framework/Code/Reader/ClassReader.php:35
 MagentoFrameworkCodeReaderClassReader->getConstructor() at /SITE_PATH/httpdocs/setup/src/Magento/Setup/Module/Di/Code/Reader/ClassReaderDecorator.php:35
 MagentoSetupModuleDiCodeReaderClassReaderDecorator->getConstructor() at /SITE_PATH/httpdocs/setup/src/Magento/Setup/Module/Di/Code/Reader/Decorator/Area.php:53
 MagentoSetupModuleDiCodeReaderDecoratorArea->getList() at /SITE_PATH/httpdocs/setup/src/Magento/Setup/Module/Di/App/Task/Operation/Area.php:112
 MagentoSetupModuleDiAppTaskOperationArea->getDefinitionsCollection() at /SITE_PATH/httpdocs/setup/src/Magento/Setup/Module/Di/App/Task/Operation/Area.php:87
 MagentoSetupModuleDiAppTaskOperationArea->doOperation() at /SITE_PATH/httpdocs/setup/src/Magento/Setup/Module/Di/App/Task/Manager.php:56
 MagentoSetupModuleDiAppTaskManager->process() at /SITE_PATH/httpdocs/setup/src/Magento/Setup/Console/Command/DiCompileCommand.php:206
 MagentoSetupConsoleCommandDiCompileCommand->execute() at /SITE_PATH/httpdocs/vendor/symfony/console/Command/Command.php:255
 SymfonyComponentConsoleCommandCommand->run() at /SITE_PATH/httpdocs/vendor/symfony/console/Application.php:893
 SymfonyComponentConsoleApplication->doRunCommand() at /SITE_PATH/httpdocs/vendor/symfony/console/Application.php:262
 SymfonyComponentConsoleApplication->doRun() at /SITE_PATH/httpdocs/vendor/magento/framework/Console/Cli.php:102
 MagentoFrameworkConsoleCli->doRun() at /SITE_PATH/httpdocs/vendor/symfony/console/Application.php:145
 SymfonyComponentConsoleApplication->run() at /SITE_PATH/httpdocs/bin/magento:23

In ClassReader.php line 29:
  
[ReflectionException]
  Class MagentoInventorySalesApiApiAreProductsSalableInterface does not exist


Exception trace:
 () at /SITE_PATH/httpdocs/vendor/magento/framework/Code/Reader/ClassReader.php:29
 ReflectionParameter->getClass() at /SITE_PATH/httpdocs/vendor/magento/framework/Code/Reader/ClassReader.php:29
 MagentoFrameworkCodeReaderClassReader->getConstructor() at /SITE_PATH/httpdocs/setup/src/Magento/Setup/Module/Di/Code/Reader/ClassReaderDecorator.php:35
 MagentoSetupModuleDiCodeReaderClassReaderDecorator->getConstructor() at /SITE_PATH/httpdocs/setup/src/Magento/Setup/Module/Di/Code/Reader/Decorator/Area.php:53
 MagentoSetupModuleDiCodeReaderDecoratorArea->getList() at /SITE_PATH/httpdocs/setup/src/Magento/Setup/Module/Di/App/Task/Operation/Area.php:112
 MagentoSetupModuleDiAppTaskOperationArea->getDefinitionsCollection() at /SITE_PATH/httpdocs/setup/src/Magento/Setup/Module/Di/App/Task/Operation/Area.php:87
 MagentoSetupModuleDiAppTaskOperationArea->doOperation() at /SITE_PATH/httpdocs/setup/src/Magento/Setup/Module/Di/App/Task/Manager.php:56
 MagentoSetupModuleDiAppTaskManager->process() at /SITE_PATH/httpdocs/setup/src/Magento/Setup/Console/Command/DiCompileCommand.php:206
 MagentoSetupConsoleCommandDiCompileCommand->execute() at /SITE_PATH/httpdocs/vendor/symfony/console/Command/Command.php:255
 SymfonyComponentConsoleCommandCommand->run() at /SITE_PATH/httpdocs/vendor/symfony/console/Application.php:893
 SymfonyComponentConsoleApplication->doRunCommand() at /SITE_PATH/httpdocs/vendor/symfony/console/Application.php:262
 SymfonyComponentConsoleApplication->doRun() at /SITE_PATH/httpdocs/vendor/magento/framework/Console/Cli.php:102
 MagentoFrameworkConsoleCli->doRun() at /SITE_PATH/httpdocs/vendor/symfony/console/Application.php:145
 SymfonyComponentConsoleApplication->run() at /SITE_PATH/httpdocs/bin/magento:23

setup:di:compile


Get this bounty!!!

#StackBounty: #magento2.3 #setup-di-compile #class-not-found Class AreProductsSalableInterface does not exist

Bounty: 50

Having issue in setup:di:compile and give below issue

enter image description here

Already checked: Magento 2 Setup di Compile Problem

Magento Vesion: 2.3.1

Update:

If i try with command bin/magento setup:di:compile -vvv, it gives below error

[root@server httpdocs]# bin/magento setup:di:compile -vvv
Compilation was started.
Area configuration aggregation... 5/7 [====================>-------]  71% 44 secs 287.0 MiB

In ClassReader.php line 35:

  [ReflectionException]
  Class MagentoInventorySalesApiApiAreProductsSalableInterface does not exist


Exception trace:
 () at /SITE_PATH/httpdocs/vendor/magento/framework/Code/Reader/ClassReader.php:35
 MagentoFrameworkCodeReaderClassReader->getConstructor() at /SITE_PATH/httpdocs/setup/src/Magento/Setup/Module/Di/Code/Reader/ClassReaderDecorator.php:35
 MagentoSetupModuleDiCodeReaderClassReaderDecorator->getConstructor() at /SITE_PATH/httpdocs/setup/src/Magento/Setup/Module/Di/Code/Reader/Decorator/Area.php:53
 MagentoSetupModuleDiCodeReaderDecoratorArea->getList() at /SITE_PATH/httpdocs/setup/src/Magento/Setup/Module/Di/App/Task/Operation/Area.php:112
 MagentoSetupModuleDiAppTaskOperationArea->getDefinitionsCollection() at /SITE_PATH/httpdocs/setup/src/Magento/Setup/Module/Di/App/Task/Operation/Area.php:87
 MagentoSetupModuleDiAppTaskOperationArea->doOperation() at /SITE_PATH/httpdocs/setup/src/Magento/Setup/Module/Di/App/Task/Manager.php:56
 MagentoSetupModuleDiAppTaskManager->process() at /SITE_PATH/httpdocs/setup/src/Magento/Setup/Console/Command/DiCompileCommand.php:206
 MagentoSetupConsoleCommandDiCompileCommand->execute() at /SITE_PATH/httpdocs/vendor/symfony/console/Command/Command.php:255
 SymfonyComponentConsoleCommandCommand->run() at /SITE_PATH/httpdocs/vendor/symfony/console/Application.php:893
 SymfonyComponentConsoleApplication->doRunCommand() at /SITE_PATH/httpdocs/vendor/symfony/console/Application.php:262
 SymfonyComponentConsoleApplication->doRun() at /SITE_PATH/httpdocs/vendor/magento/framework/Console/Cli.php:102
 MagentoFrameworkConsoleCli->doRun() at /SITE_PATH/httpdocs/vendor/symfony/console/Application.php:145
 SymfonyComponentConsoleApplication->run() at /SITE_PATH/httpdocs/bin/magento:23

In ClassReader.php line 29:
  
[ReflectionException]
  Class MagentoInventorySalesApiApiAreProductsSalableInterface does not exist


Exception trace:
 () at /SITE_PATH/httpdocs/vendor/magento/framework/Code/Reader/ClassReader.php:29
 ReflectionParameter->getClass() at /SITE_PATH/httpdocs/vendor/magento/framework/Code/Reader/ClassReader.php:29
 MagentoFrameworkCodeReaderClassReader->getConstructor() at /SITE_PATH/httpdocs/setup/src/Magento/Setup/Module/Di/Code/Reader/ClassReaderDecorator.php:35
 MagentoSetupModuleDiCodeReaderClassReaderDecorator->getConstructor() at /SITE_PATH/httpdocs/setup/src/Magento/Setup/Module/Di/Code/Reader/Decorator/Area.php:53
 MagentoSetupModuleDiCodeReaderDecoratorArea->getList() at /SITE_PATH/httpdocs/setup/src/Magento/Setup/Module/Di/App/Task/Operation/Area.php:112
 MagentoSetupModuleDiAppTaskOperationArea->getDefinitionsCollection() at /SITE_PATH/httpdocs/setup/src/Magento/Setup/Module/Di/App/Task/Operation/Area.php:87
 MagentoSetupModuleDiAppTaskOperationArea->doOperation() at /SITE_PATH/httpdocs/setup/src/Magento/Setup/Module/Di/App/Task/Manager.php:56
 MagentoSetupModuleDiAppTaskManager->process() at /SITE_PATH/httpdocs/setup/src/Magento/Setup/Console/Command/DiCompileCommand.php:206
 MagentoSetupConsoleCommandDiCompileCommand->execute() at /SITE_PATH/httpdocs/vendor/symfony/console/Command/Command.php:255
 SymfonyComponentConsoleCommandCommand->run() at /SITE_PATH/httpdocs/vendor/symfony/console/Application.php:893
 SymfonyComponentConsoleApplication->doRunCommand() at /SITE_PATH/httpdocs/vendor/symfony/console/Application.php:262
 SymfonyComponentConsoleApplication->doRun() at /SITE_PATH/httpdocs/vendor/magento/framework/Console/Cli.php:102
 MagentoFrameworkConsoleCli->doRun() at /SITE_PATH/httpdocs/vendor/symfony/console/Application.php:145
 SymfonyComponentConsoleApplication->run() at /SITE_PATH/httpdocs/bin/magento:23

setup:di:compile


Get this bounty!!!

#StackBounty: #magento2.3 Type Error occurred when creating object Magento 2

Bounty: 50

I have created custom module and it’s working fine in Dev, but it’s not working on Production. It’s throwing Type error.

Type Error occurred when creating object:
TinyProductCustomizationModelResourceModelProductCollectionInterceptor,
Argument 5 passed to
TinyProductCustomizationModelResourceModelProductCollectionInterceptor::__construct()
must implement interface MagentoFrameworkDBAdapterAdapterInterface
or be null, string given, called in
/var/www/html/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php
on line 121 [] [] [2021-01-11 10:11:47] report.CRITICAL: Type Error
occurred when creating object:
TinyProductCustomizationModelResourceModelProductCollectionInterceptor
[] []

My collection file as below

<?php

namespace TinyProductCustomizationModelResourceModelProduct;

use MagentoFrameworkModelResourceModelDbCollectionAbstractCollection;

class Collection extends AbstractCollection
{

    protected $_idFieldName = 'id';

    protected function _construct()
    {
        $this->_init(
            'TinyProductCustomizationModelProduct',
            'TinyProductCustomizationModelResourceModelProduct'
        );
        parent::_construct();
    }

}

and di.xml

<type name="MagentoFrameworkViewElementUiComponentDataProviderCollectionFactory">
        <arguments>
            <argument name="collections" xsi:type="array">
                <item name="tiny_grid_data_source" xsi:type="string">TinyProductCustomizationModelResourceModelProductCollection</item>
            </argument>
        </arguments>
    </type>
    <virtualType name="TinyProductCustomizationModelResourceModelProductCollection" type="MagentoFrameworkViewElementUiComponentDataProviderSearchResult">
        <arguments>
            <argument name="mainTable" xsi:type="string">tiny_pro</argument>
            <argument name="resourceModel" xsi:type="string">TinyProductCustomizationModelResourceModelProduct</argument>
        </arguments>
    </virtualType>

Can you please help me on this?


Get this bounty!!!

#StackBounty: #magento2 #magento2.3 #import #sorting #product-sorting Column 'created_at' not imported

Bounty: 50

My goal is to sort products on the frontend from newest to oldest.

The products CSV file contains the created_at column (e.g. 2020-10-31 14:05:44). Format seems to be correct.

After the standard import, I’m looking in the catalog_product_entity table, and created_at is actually the import’s timestamp (e.g. 2020-11-28 17:38:48).

Am I looking at the wrong DB field? Is there some locale-specific formatting under the hood? (I’m importing for the ro store)

References

Versions: Magento 2.3.5-p1, PHP 7.3.24


Get this bounty!!!

#StackBounty: #magento2 #magento2.3 #import #sorting #product-sorting Column 'created_at' not imported

Bounty: 50

My goal is to sort products on the frontend from newest to oldest.

The products CSV file contains the created_at column (e.g. 2020-10-31 14:05:44). Format seems to be correct.

After the standard import, I’m looking in the catalog_product_entity table, and created_at is actually the import’s timestamp (e.g. 2020-11-28 17:38:48).

Am I looking at the wrong DB field? Is there some locale-specific formatting under the hood? (I’m importing for the ro store)

References

Versions: Magento 2.3.5-p1, PHP 7.3.24


Get this bounty!!!