Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

php8 compatibility #16

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions Model/ResourceModel/ProductVisibilityGrid/Collection.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ class Collection extends DataCollection
protected $sortDir;
protected $platformMetaData;
protected $identityField;
protected $storeManager;

/**
* Maps field aliases to real fields.
Expand Down Expand Up @@ -209,7 +210,8 @@ public function prepareCollection()
$this->_addAttribute($attribute);
}

$this->addCategoryVisibility();
// Cause issue on the count query
$this->addCategoryVisibility();

return $this;
}
Expand All @@ -222,7 +224,8 @@ protected function addCategoryVisibility()
$this->productCollection->addStoreFilter($this->storeId);
$this->collectionFilter->filter($this->productCollection, $category);
$this->stockHelper->addIsInStockFilterToCollection($this->productCollection);
$this->productCollection->addAttributeToFilter('status', ['eq' => \Magento\Catalog\Model\Product\Attribute\Source\Status::STATUS_ENABLED]);
// TODO: Fix the filter to avoid huge load
// $this->productCollection->addAttributeToFilter('status', ['eq' => \Magento\Catalog\Model\Product\Attribute\Source\Status::STATUS_ENABLED]);

$subSelect = $this->productCollection->getSelect();
$this->productCollection->getSelect()
Expand All @@ -232,8 +235,6 @@ protected function addCategoryVisibility()

$this->getSelect()->columns(['is_online_in_cat'=> new \Zend_Db_Expr('IF(category_collection.is_online_in_cat_sub,1,0)')]);
$this->getSelect()->joinLeft(['category_collection'=>$subSelect], 'main_table.entity_id = category_collection.p_entity_id');

//echo $this->productCollection->getSelect();
}

/**
Expand Down Expand Up @@ -490,4 +491,4 @@ public function getIsCommerce(){
return true;
}
}
}
}
12 changes: 10 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "itonomy/productvisibilitygrid",
"name": "synoptik-labs/productvisibilitygrid",
"description": "",
"require": {
"php": ">=7.2",
Expand All @@ -8,8 +8,16 @@
"suggest": {

},
"authors": [
{
"name": "Synoptik Labs",
"email": "opensource@synoptik-labs.com",
"homepage": "https://www.synoptik-labs.com/",
"role": "Developer"
}
],
"type": "magento2-module",
"version": "2.1.2",
"version": "2.1.6",
"license": [
"MIT"
],
Expand Down