0

addViewsCount function not working on Custom Attirbute set

How to make it Working for all other product attribute sets ?

As far as i am getting, it is setting the attribute set id to default Attribute set

Please Check it here: DashBoard -> Most Viewed

File :- vendor/magento/module-reports/Model/ResourceModel/Product/Collection.php

Line 120 :

$this->setProductAttributeSetId($product->getEntityType()->getDefaultAttributeSetId());

Line 322:

$this->getConnection()->quoteInto(
                'e.entity_id = report_table_views.object_id AND e.attribute_set_id = ?',
                $this->getProductAttributeSetId()
0

Remove attribute_set_id from join. Just replace

    $this->getConnection()->quoteInto(
        'e.entity_id = report_table_views.object_id AND e.attribute_set_id = ?',
        $this->getProductAttributeSetId()
    )

with

    'e.entity_id = report_table_views.object_id'

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.