Post by jtomcik » Sat Jul 18, 2020 12:16 am

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

Newbie

Posts

Joined
Tue Jan 28, 2020 7:36 pm

Post by IP_CAM » Mon Jul 20, 2020 10:30 am

catalog/controller/extension/feed/......
is NOT an OC v.1.5.x related Server Path. :o

My Github OC Site: https://github.com/IP-CAM
5'600 + FREE OC Extensions, on the World's largest private Github OC Repository Archive Site.


User avatar
Legendary Member

Posts

Joined
Tue Mar 04, 2014 1:37 am
Location - Switzerland
Who is online

Users browsing this forum: No registered users and 5 guests