/** * mno: Restore simple features_hash support: "feature_id-variant_id" * Example: features_hash=4-5797 */ function fn_my_changes_get_products( &$params, &$fields, $sortings, &$condition, &$join, $sorting, &$group_by, $lang_code, $having ) { if (empty($params['features_hash']) || !is_string($params['features_hash'])) { return; } // Support only the broken-but-used format: "feature_id-variant_id" if (!preg_match('/^(\d+)-(\d+)$/', $params['features_hash'], $m)) { return; } $feature_id = (int) $m[1]; $variant_id = (int) $m[2]; // Join feature values and filter by pair $join .= db_quote( ' INNER JOIN ?:product_features_values AS mno_pfv' . ' ON mno_pfv.product_id = products.product_id' . ' AND mno_pfv.feature_id = ?i' . ' AND mno_pfv.variant_id = ?i', $feature_id, $variant_id ); // Safety: avoid duplicates from joins if (!$group_by) { $group_by = 'products.product_id'; } elseif (strpos($group_by, 'products.product_id') === false) { $group_by .= ', products.product_id'; } } Рябцевич В. Н.
Популярные
Смотреть все
Книги до 150
Смотреть все
Новые поступления
Смотреть все