Skip to content

Commit

Permalink
Smile-SA#743 - fix missing table prefix while looking up db
Browse files Browse the repository at this point in the history
  • Loading branch information
Valentin Clavreul committed Feb 12, 2018
1 parent 122cba4 commit 50b4770
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,9 @@ private function getAdditionalColumns()
*/
private function getMaxPosition()
{
$fullTableName = $this->getResource()->getTable(self::CATEGORY_FILTER_CONFIG_TABLE);
$categoryPositionSelect = $this->getConnection()->select()
->from(self::CATEGORY_FILTER_CONFIG_TABLE, [])
->from($fullTableName, [])
->columns(['category_max_position' => new \Zend_Db_Expr('MAX(position)')])
->where($this->getConnection()->quoteInto('entity_id = ?', (int) $this->category->getId()));

Expand Down Expand Up @@ -167,7 +168,8 @@ private function getAdditionalTableFields()
{
$type = $this->eavConfig->getEntityType(\Magento\Catalog\Model\Product::ENTITY);
$table = $type->getAdditionalAttributeTable();
$tableDesc = $this->getConnection()->describeTable($table);
$fullTableName = $this->getResource()->getTable($table);
$tableDesc = $this->getConnection()->describeTable($fullTableName);
$tableFields = array_keys($tableDesc);

return array_diff($tableFields, $this->overridenColumns);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,9 @@ public function __construct(
*/
public function getByProductIds(array $productIds, $storeId)
{
$searchQueryTable = $this->getTable('search_query');
$select = $this->getBaseSelect()
->joinInner($this->getTable('search_query'), 'main_table.query_id = search_query.query_id', [])
->joinInner($searchQueryTable, "main_table.query_id = {$searchQueryTable}.query_id", [])
->where('product_id IN(?)', $productIds)
->where('store_id = ?', $storeId)
->columns(['product_id', 'query_id', 'position']);
Expand Down

0 comments on commit 50b4770

Please sign in to comment.