php - How to check attributes belongs to specific product in opencart -
I'm trying to find products that have a multiplier specific attribute, I mean, I search for those products I want to have "type" = rings and "metal" = gold
I tried with the operator IN , but this is the option of or operation. I need more operations. The product_attribute table only contains product_id, attribute_id, how do I do and how it works in mysql OpenCart version 1.5.4 I 'below Have tried the given question Output is empty If you want a OR argument between attributes in the same group and AND / Li> function which You have to edit, that is specified at the beginning of the function From the variable: Find this code: } and < Code> $ sql. = "And pf.filter_id IN (". ',', $ Implode). "); Finally, I find this piece of code in the specified function: $ sql. = "P.product_id by group"; And change it to: $ sql = "Group by P. Product_ide Having COUNT (Distinct PF.filter_id) =". Calculation ($ filter_group); Hope I helped.
SELECT * fROM oc_product_attribute WHERE product_id = 42 and attribute_id = 15 and attribute_id = 17
public function getProducts ($ data = array), $ get_all = FALSE) {
$ validimi = false; $ Filter_groups = array ();
if (! $ Data ['filter_filter']) {$ Implode = array $ Filter = explosion (',', $ data ['filter_filter']); Forex ($ filter $ $ filter_id) {$ implode [] = (int) $ filter_id;} $ Sql. = " AND pf.filter_id IN ("Implode (',', $ implode).");
$ sql_check =" Distance from Select (filter_group_id) From ".db_prefix" filter WHERE filter_id IN (".implode (',', $ implode).); $ Query_check = $ this- & gt; db- & gt; query ($ sql_check); $ Filter_groups = array (); Foreign Exchange ($ query_check- & gt; Lines $ par As a result {$ filter_groups [$ result ['filter_group_id']] = array ();} if (counting ($ filter_groups)> 1) {$ validimi = true;} and {$ validimi = false;}
if ($ validimi) {
} Other {$ sql. = "Group byproduct_id"; Now try your filter that they should work fine, this is what I created and used on our own stores but the OpenCart version 1.5.5.1 But I think this will work well in your case. The logic is obvious so if this code does not help you, then you can use logic to create your own :)
Comments
Post a Comment