Page 1 of 1

Feed > filter_quantity

Posted: Sat Jul 18, 2020 12:16 am
by jtomcik
Hello :), i need help pls. I create modul for Feed.

catalog/controller/extension/feed/myfeed.php

Code: Select all

class ControllerExtensionFeedMyFeed extends Controller {

public function index() {
	...
	...	
 	$filter_data = array(
                        'filter_manufacturer_id' => 12,
                        'filter_quantity' => 1
        );
                        
                        $products = $this->model_catalog_product->getProducts($filter_data);
                        
			foreach ($products as $product) {
			....
			}
	    }	
}			
catalog/model/catalog/product.php

Code: Select all

public function getProducts($data = array()) {
...
...
	if (!empty($data['filter_manufacturer_id'])) {
		$sql .= " AND p.manufacturer_id = '" . (int)$data['filter_manufacturer_id'] . "'";
        }
        if (!empty($data['filter_quantity'])) {
		$sql .= " AND p.quantity = '" . (int)$data['filter_quantity'] . "'";
        }
}
"filter_manufacturer_id" - OK, write products with manufacturer id "12"
"filter_quantity" - Fail, write all products with quantity ( 0,1,2 ... )

Thanks for help. Jozef

Re: Feed > filter_quantity

Posted: Mon Jul 20, 2020 10:30 am
by IP_CAM
catalog/controller/extension/feed/......
is NOT an OC v.1.5.x related Server Path. :o