Feed > filter_quantity
Posted: Sat Jul 18, 2020 12:16 am
Hello
, i need help pls. I create modul for Feed.
catalog/controller/extension/feed/myfeed.php
catalog/model/catalog/product.php
"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

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) {
....
}
}
}
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_quantity" - Fail, write all products with quantity ( 0,1,2 ... )
Thanks for help. Jozef