From 70722c8bf00f71df1caa17bde50a5acd90274f66 Mon Sep 17 00:00:00 2001 From: ade Date: Tue, 15 Oct 2019 11:45:38 +0200 Subject: [PATCH] Update-10-2-2019 - Made Changes from review by albert --- .../Productapi/Model/Api2/Product/Rest/Admin/V1.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/code/local/Everlytic/Productapi/Model/Api2/Product/Rest/Admin/V1.php b/app/code/local/Everlytic/Productapi/Model/Api2/Product/Rest/Admin/V1.php index b7c4956..d6bf0f2 100644 --- a/app/code/local/Everlytic/Productapi/Model/Api2/Product/Rest/Admin/V1.php +++ b/app/code/local/Everlytic/Productapi/Model/Api2/Product/Rest/Admin/V1.php @@ -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(); } /** @@ -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 . '%'))