Version 3.0.4.0
Would like to display the filter_id from oc_product_filter table above product image on the category page.
It is on a development site where I need a way to scroll quickly the products and check my product filters. No need pull data from oc_filter... table, only have 1 group and 5 filters, so just the id would definitely help.
Thanks
Would like to display the filter_id from oc_product_filter table above product image on the category page.
It is on a development site where I need a way to scroll quickly the products and check my product filters. No need pull data from oc_filter... table, only have 1 group and 5 filters, so just the id would definitely help.
Thanks
Hi!
If you want to do it manually, you may look how someone made similar moment to show product attributes. But you should replace attribute models to filter models. Also needle functions (SQL code to request product's filter_id) may not exists(idk), so you should create it.
If you want to do it manually, you may look how someone made similar moment to show product attributes. But you should replace attribute models to filter models. Also needle functions (SQL code to request product's filter_id) may not exists(idk), so you should create it.
My FREE extensions in marketplace. [ security | flexibility | speedup ]
Sounds like you might be doing something inadvisable. Give us a bit more info about what you're trying to do and why?
UK OpenCart Hosting | OpenCart Audits | OpenCart Support - please email info@antropy.co.uk
I wrote a quick function for you to place in the model/catalog/product (ModelCatalogProduct)
and call that from your category controller or where you want.
This will give you the ids and names of filters.
Simply pass the result to your view and you see the filter_id-filter_name,otherfilter_id-othername etc.
and call that from your category controller or where you want.
This will give you the ids and names of filters.
Simply pass the result to your view and you see the filter_id-filter_name,otherfilter_id-othername etc.
Code: Select all
// accepts (int) product_id
// returns filters as one string
public function getProductFilters($product_id) {
$sql = "SELECT p.product_id, GROUP_CONCAT(pf.filter_id,'-',fd.name) AS filters FROM `" . DB_PREFIX . "product` p
LEFT JOIN `" . DB_PREFIX . "product_filter` pf ON p.product_id = pf.product_id
LEFT JOIN `" . DB_PREFIX . "filter_description` fd ON pf.filter_id = fd.filter_id
WHERE p.product_id = ".(int)$product_id."
GROUP BY p.product_id
";
$query = $this->db->query($sql);
return $query->row['filters'];
}
All mods | OpenCart Bulk Related Products Ultimate Edition |GeoIP hide Prices / no add to cart by country| CSS override | Direct link to checkout / skip add to cart / buy now link | AUTO pilot - reward & purchase points
Who is online
Users browsing this forum: Bing [Bot] and 33 guests