magento2.3 – Magento 2.3.3 + elasticsearch 6 – empty catalog. Elasticsearch adds WHERE (NULL) to product collection

I have elasticsearch 6.8 and M2.3.3.
On the both category and search pages Magento display:

We can't find products matching the selection.

(MYSQL engine works correctly)

Reindex and cache are refreshed. I also added 2 patches:
https://github.com/magento/magento2/issues/27112#issuecomment-748916677

https://devdocs.magento.com/guides/v2.3/release-notes/release-notes-2-3-3-open-source.html#apply-the-catalog-pagination-issue-on-elasticsearch-6x-patch-to-resolve-a-critical-search-result-pagination-issue

Elasticseach is configured properly:

curl -X GET http://elasticsearch:9200/test_product_1_v15/_search?q=sergei

{"took":7,"timed_out":false,"_shards":{"total":5,"successful":5,"skipped":0,"failed":0},"hits":{"total":1,"max_score":4.255225,"hits":({"_index":"test_product_1_v15","_type":"document","_id":"246","_score":4.255225,"_source":{"store_id":"1","sku":"Sergey","status":"1","status_value":"Enabled","visibility":"4","name":"Sergey","category_ids":(2,52,84,125),"position_category_2":"0","name_category_2":"Test Category","position_category_52":"0","name_category_52":"Test Category 2","position_category_84":"0","name_category_84":"Test Category 3","position_category_125":"0","name_category_125":"Test","price_4_1":"80.000000","price_0_1":"100.000000","price_1_1":"100.000000","price_2_1":"100.000000","price_3_1":"100.000000","price_5_1":"100.000000","price_6_1":"100.000000"}})}}

Here is the final SQL query from list.phtml – it contains strange condition WHERE (NULL)

SELECT `e`.*, `price_index`.`price`, `price_index`.`tax_class_id`, `price_index`.`final_price`, IF(price_index.tier_price IS NOT NULL, LEAST(price_index.min_price, price_index.tier_price), price_index.min_price) AS `minimal_price`, `price_index`.`min_price`, `price_index`.`max_price`, `price_index`.`tier_price`, IFNULL(review_summary.reviews_count, 0) AS `reviews_count`, IFNULL(review_summary.rating_summary, 0) AS `rating_summary` FROM `catalog_product_entity` AS `e`
 INNER JOIN `catalog_product_index_price` AS `price_index` ON price_index.entity_id = e.entity_id AND price_index.website_id = '1' AND price_index.customer_group_id = 0
 LEFT JOIN `review_entity_summary` AS `review_summary` ON e.entity_id = review_summary.entity_pk_value AND review_summary.store_id = 1 AND review_summary.entity_type = (SELECT `review_entity`.`entity_id` FROM `review_entity` WHERE (entity_code = 'product')) WHERE (NULL)

Without this condition all seems fine.

I logged collection in this method (I suppose it’s elasticsearch output(?)): MagentoElasticsearchModelLayerCategoryItemCollectionProvider::getCollection()

and WHERE (NULL) already here:

SELECT `e`.* FROM `catalog_product_entity` AS `e` WHERE (NULL)

Any ideas why elastic search adds this condition and how can I rightly discard it?

If elastic search (magento extension) adds NULL because the answer from elastic search is empty, how can I debug it in magento?

catalog – Magento upgraded 2.3 to 2.4 After Category page not loading in frontend

Magento 2.4 upgraded successfully. All are working in admin and storefront but only problem with category page showing error

” Error: Call to a member function getUrl() on null in /home/mydomain.com/dqgdqtpdwx/public_html/vendor/magento/module-catalog/view/frontend/templates/category/image.phtml:21 Stack trace: #0

/home/mydomain.com/dqgdqtpdwx/public_html/vendor/magento/framework/View/TemplateEngine/Php.php(71): include() #1 “

I can access product page but issue with category page access after show in above error.
This issue solve any tips please share with me. Thanks for advance

magento2.3 – Magento 2 catalog price rules vanish after 2 days

I saw a million posts of this type of question but none of them have an answer to it and most of them are related to the Magento 1, so I was hopping that we can accomplish that here. Catalog price rules are simply gone after 2 days and I don’t why. I am using Magento 2.3.5 -p1 and my timezones are correctly written. I am hopping for your help on this problem.

magento2 – Magento 2 visibility “catalog” not saving in default store view

Magento 2 visibility “catalog” not saving in “default store view” but when store is “All store view” it is saving “catalog” but in default store view when visibility set “catalog” after save it is showing “catalog,search”

Using Magento 2.3.5p1

enter image description here
Anyone how to solve this?

catalog – Magento 2 Unit Testing with Helper dependency

I have a Helper class and a Model class, which looks like

<?php
# File: app/code/MagePsycho/Catalog/Helper/Data.php

namespace MagePsychoCatalogHelper;

use MagentoFrameworkAppHelperAbstractHelper;
use MagentoFrameworkAppHelperContext;
use MagentoStoreModelStoreManagerInterface;

class Data extends AbstractHelper
{
    /**
     * @var StoreManagerInterface
     */
    protected $storeManager;

    public function __construct(
        Context $context,
        StoreManagerInterface $storeManager
    ) {
        $this->storeManager = $storeManager;

        parent::__construct($context);
    }

    public function getUrl($route, $params = ())
    {
        return $this->_getUrl($route, $params);
    }

    // Other helper methods...
}

and

<?php
# File: app/code/MagePsycho/Catalog/Model/UrlResolver.php

namespace MagePsychoCatalogModel;

use MagentoCatalogApiProductRepositoryInterface;
use MagentoCatalogHelperProduct as ProductHelper;
use MagePsychoCatalogHelperData as Helper;

class UrlResolver
{
    /**
     * @var Helper
     */
    private $helper;

    /**
     * @var ProductHelper
     */
    private $productHelper;

    /**
     * @var ProductRepositoryInterface
     */
    private $productRepository;

    public function __construct(
        Helper $helper,
        ProductHelper $productHelper,
        ProductRepositoryInterface $productRepository
    ) {
        $this->helper = $helper;
        $this->productHelper = $productHelper;
        $this->productRepository = $productRepository;
    }

    public function getDefaultUrl($keyword)
    {
        return $this->helper->getUrl('catalogsearch/result', ('_secure' => true)) . '?q=' . $keyword;
    }

    public function getUrlBySku($sku)
    {
        $product = $this->productRepository->get($sku);
        if (!$product || !$product->getId()) {
            return false;
        }

        if (!$this->productHelper->canShow($product)) {
            return false;
        }

        return $product->getProductUrl();
    }
}

Now I want to test the getDefaultUrl() and getUrlBySku() methods of UrlResolver.
And I tried to test getDefaultUrl() as

<?php
# File: app/code/MagePsycho/Catalog/Test/Unit/Model/UrlResolverTest.php

namespace MagePsychoCatalogTestUnitModel;

use MagentoCatalogApiProductRepositoryInterface;
use MagentoCatalogHelperProduct as ProductHelper;
use MagePsychoCatalogHelperData as Helper;
use MagePsychoCatalogModelUrlResolver;
use PHPUnitFrameworkTestCase;
use MagentoFrameworkTestFrameworkUnitHelperObjectManager as ObjectManagerHelper;

class UrlResolverTest extends TestCase
{
    /**
     * @var UrlResolver
     */
    protected $model;

    public function setUp(): void
    {
        $objectManager = new ObjectManagerHelper($this);
        $productRepository = $this->getMockBuilder(ProductRepositoryInterface::class)
            ->disableOriginalConstructor()
            ->getMockForAbstractClass();
        $productHelper = $this->getMockBuilder(ProductHelper::class)
            ->disableOriginalConstructor()
            ->getMock();

        $arguments = $objectManager->getConstructArguments(Helper::class);
        $helper = $objectManager->getObject(Helper::class, $arguments);
        //$helper = $this->createMock(Helper::class);

        $this->model = $objectManager->getObject(
            UrlResolver::class,
            (
                'helper' => $helper,
                'productHelper' => $productHelper,
                'productRepository' => $productRepository,
            )
        );
    }

    /**
     * @dataProvider defaultUrlDataProvider
     */
    public function testGetDefaultUrl($sku, $url)
    {
        $this->assertStringContainsString($url, $this->model->getDefaultUrl($sku));
    }

    public function defaultUrlDataProvider(): array
    {
        return (
            ('sku1', 'catalogsearch/result?q=sku1'),
            ('sku2', 'catalogsearch/result?q=sku2'),
        );
    }
}

But $this->model->getDefaultUrl($sku) always results in ?q=$sku without the URL part.
I feel that Helper dependency injection is not working properly.

Can you please let me know how should I test getDefaultUrl() and getUrlBySku() methods of UrlResolver?

lightroom catalog – Mac ~Library/Caches/Adobe Camera Raw: Ok to delete?

It depends on how you have set the preferences in your particular system.

We do not know how you have set the preference for what is stored in that folder.

Is it all the metadata for all your raw files?

I do not know enough about what the default settings would be to advise you. But i do know enough to not delete things until i understand them. (learned the hard way)

If you do not know enough about how your system is set up then you should not go deleting things until you learn how and why it set up the way it is.

EDIT: I checked my Adobe Camera Raw Cache folder and it’s size is 1.07 GB, all files have a .dat file extension.

A web search lead me to the following discussion.

What are ACR cached .dat files? Delete them?.

As others have said you CAN delete them BUT if you do when you go to a
folder in Bridge that has RAW images in it Bridge/ARC will just
recreate them. Those files are created so Bridge can display RAW
camera files. Deleting them will save you some space on your drive BUT
it will also cost you some time for Bridge/ARC to recreate them when
you go back to look at these images.

Personally I have my Bridge/ARC cache set to 4 GB. Of course I have
tons of unused space on my hard drives.

magento2 – Magento 2 sort product in catalog product list based on product attribute option position

I am working with Magento 2, I need to sort the product on category page based n product attribute.

  1. Product attribute type is dropdown.
  2. I will sort the option while creating attribute.

Now in front if I select this attribute product should sort based on option position.

Example :
Product Attribute name : Test

Attribute type is dropdown.
Option 1: sort1
Option 2: sort2

I have two products. Both has diff value assign. Now if I change the options position it should sort accordingly in frontend.

Thanks in advance.