Magento의 고급 검색 app \ code \ core \ Mage \ CatalogSearch \ Model \ Mysql4을 수정하여 일부 맞춤 조건을 사용했습니다. 특정 속성 대신 검색을 사용하고 싶었 기 때문입니다. INMagento 사전 검색 문제
하지만 아무것도 반환하지 않습니다.
`SELECT DISTINCT `e`.*, `price_index`.`price`, `price_index`.`tax_class_id`, `price_index`.`final_price`, IF(`price_index`.`tier_price`, LEAST(`price_index`.`min_price`, `price_index`.`tier_price`), `price_index`.`min_price`) AS `minimal_price`, `price_index`.`min_price`, `price_index`.`max_price`, `price_index`.`tier_price`, `cat_index`.`position` AS `cat_index_position` FROM `catalog_product_entity` AS `e`
INNER JOIN `catalog_product_index_price` AS `price_index` ON price_index.entity_id = e.entity_id AND price_index.website_id = '1' AND price_index.customer_group_id = 0
INNER JOIN `catalog_category_product_index` AS `cat_index` ON cat_index.product_id=e.entity_id AND cat_index.store_id='3' AND cat_index.visibility IN(3, 4) AND cat_index.category_id='2'
INNER JOIN `catalog_product_index_eav` AS `ast_types` ON e.entity_id=ast_types.entity_id AND ast_types.attribute_id=150 AND ast_types.store_id=3
INNER JOIN `catalog_product_index_eav` AS `ast_condom_size` ON e.entity_id=ast_condom_size.entity_id AND ast_condom_size.attribute_id=151 AND ast_condom_size.store_id=3 WHERE (( ast_types.value= 131 AND ast_types.value= 135)) AND (ast_condom_size.`value` IN('141', '140'))`
새로운 수정 된 쿼리 : 무슨 일에
SELECT DISTINCT `e`.*, `price_index`.`price`, `price_index`.`tax_class_id`, `price_index`.`final_price`, IF(`price_index`.`tier_price`, LEAST(`price_index`.`min_price`, `price_index`.`tier_price`), `price_index`.`min_price`) AS `minimal_price`, `price_index`.`min_price`, `price_index`.`max_price`, `price_index`.`tier_price`, `cat_index`.`position` AS `cat_index_position` FROM `catalog_product_entity` AS `e`
INNER JOIN `catalog_product_index_price` AS `price_index` ON price_index.entity_id = e.entity_id AND price_index.website_id = '1' AND price_index.customer_group_id = 0
INNER JOIN `catalog_category_product_index` AS `cat_index` ON cat_index.product_id=e.entity_id AND cat_index.store_id='3' AND cat_index.visibility IN(3, 4) AND cat_index.category_id='2'
INNER JOIN `catalog_product_index_eav` AS `ast_types` ON e.entity_id=ast_types.entity_id AND ast_types.attribute_id=150 AND ast_types.store_id=3
INNER JOIN `catalog_product_index_eav` AS `ast_condom_size` ON e.entity_id=ast_condom_size.entity_id AND ast_condom_size.attribute_id=151 AND ast_condom_size.store_id=3 WHERE (( ast_types.`value`= 135 OR ast_types.`value`= 132 OR ast_types.`value`= 131 )) AND (ast_condom_size.`value` IN('141', '140')) GROUP BY sku HAVING COUNT(*)=3
어떤 생각
여기if(in_array($value,$cSizeArray) && isset($_GET['condom_size'])){
$select->where("{$tableAlias}.`value` IN(?)", $value);
}elseif(in_array($value,$lSizeArray) && isset($_GET['lubepack'])){
$select->where("{$tableAlias}.`value` IN(?)", $value);
}else{
if($tableAlias == 'ast_types' || $tableAlias== 'ast_lubetype'){
$condition = "(";
foreach($value as $v){
$condition.=" {$tableAlias}.`value`= $v AND";
}
$condition = substr($condition,0,-3);
$condition .= ") ";
$select->where($condition);
}else{
$select->where("{$tableAlias}.`value` IN(?)", $value);
}
}
내가 echo $select
를 사용하여 가지고 쿼리는 다음과 같습니다 내가 수정 한 쿼리입니다 접근 방식이 잘못되었습니다 ...
결과 SQL 쿼리를 살펴 봐야합니다. –