Skip to content
This repository has been archived by the owner on Sep 14, 2023. It is now read-only.

Commit

Permalink
Update-10-2-2019 - Made Changes from review by albert
Browse files Browse the repository at this point in the history
  • Loading branch information
ade committed Oct 15, 2019
1 parent b15039a commit 70722c8
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ protected function _prepareProductForResponse(Mage_Catalog_Model_Product $produc
*/
protected function _retrieveCollection()
{
return (isset($_GET['search_query']) && ($_GET['search_query'] !== '')) ? $this->handleSearch() : array();
return (isset($_GET['search_query']) && ($_GET['search_query'] !== '')) ? $this->handleSearch($_GET['search_query']) : array();
}

/**
Expand All @@ -79,15 +79,15 @@ private function getGalleryFromProduct(Mage_Catalog_Model_Product $product)
}

/**
* @param $searchQuery
* @return mixed
*/
private function handleSearch()
private function handleSearch($searchQuery)
{
$collection = Mage::getResourceModel('catalog/product_collection');
$collection->addAttributeToSelect(array_keys(
$this->getAvailableAttributes($this->getUserType(), Mage_Api2_Model_Resource::OPERATION_ATTRIBUTE_READ)
));
$searchQuery = $_GET['search_query'];
$collection->addFieldToFilter(array(
array('attribute' => 'name', array('like' => '%' . $searchQuery . '%')),
array('attribute' => 'sku', array('like' => '%' . $searchQuery . '%'))
Expand Down

0 comments on commit 70722c8

Please sign in to comment.