binshops / prestashop-rest

PrestaShop REST API module to expose your PrestaShop website's REST endpoints
https://www.binshops.com/prestashop-api
Academic Free License v3.0
95 stars 33 forks source link

some Notice error about productsearch.php #19

Closed langziyang closed 2 years ago

langziyang commented 2 years ago

first:open prestashop debug mode; the vist https://rest.binshops.com/rest/productSearch?s=mug&resultsPerPage=10

productsearch.php line 68 to 73

change

if ($variables['facets']) {
            $facets = array();
            foreach ($variables['facets']['filters']->getFacets() as $facet) {
                array_push($facets, $facet->toArray());
            }
        }

to

$facets = array();
        if ($variables['facets']) {            
            foreach ($variables['facets']['filters']->getFacets() as $facet) {
                array_push($facets, $facet->toArray());
            }
        }

line 82 change

$variables['facets']['activeFilters']

to

isset($variables['facets']['activeFilters'])?$variables['facets']['activeFilters']:[]
samberrry commented 2 years ago

@langziyang many thanks for your contribution.