Skip to content

Commit

Permalink
used magento getTableName() function for getting the table name with …
Browse files Browse the repository at this point in the history
…prefix (#65)
  • Loading branch information
santosh-gaggle authored and alfredsgenkins committed Oct 9, 2020
1 parent 9a266ac commit 37caf85
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
16 changes: 9 additions & 7 deletions src/Model/AttributeDbProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,15 @@ public function getProductAttributes(): array
$fieldsUsedInQuery = $this->queryFields->getFieldsUsedInQuery();
$connection = $this->connection->getConnection();
$placeHolders = str_repeat('?,', count($fieldsUsedInQuery) - 1) . '?';
$sql = "SELECT eav_attribute.attribute_code
FROM eav_attribute
WHERE eav_attribute.attribute_id IN (
SELECT catalog_eav_attribute.attribute_id
FROM catalog_eav_attribute
WHERE catalog_eav_attribute.is_filterable = 1
) AND eav_attribute.attribute_code IN ($placeHolders)";
$eavAttribute = $this->connection->getTableName('eav_attribute');
$catalogEavAttribute = $this->connection->getTableName('catalog_eav_attribute');
$sql = "SELECT {$eavAttribute}.attribute_code
FROM {$eavAttribute}
WHERE {$eavAttribute}.attribute_id IN (
SELECT {$catalogEavAttribute}.attribute_id
FROM {$catalogEavAttribute}
WHERE {$catalogEavAttribute}.is_filterable = 1
) AND {$eavAttribute}.attribute_code IN ($placeHolders)";
$query = $connection->query($sql, array_keys($fieldsUsedInQuery));

return $query->fetchAll(\PDO::FETCH_COLUMN);
Expand Down
2 changes: 1 addition & 1 deletion src/Model/Variant/Collection.php
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ protected function getChildCollectionMapAndList(): array {
$conn = $this->connection->getConnection();
$select = $conn->select()
->from(
['s' => 'catalog_product_super_link'],
['s' => $this->connection->getTableName('catalog_product_super_link')],
['product_id', 'parent_id']
)
->where('s.parent_id IN (?)', $parentIds);
Expand Down

0 comments on commit 37caf85

Please sign in to comment.