目前,当搜索某个项目时,快速搜索还会显示包含符合搜索条件的项目的任何包。我怎么能阻止这个?
从搜索结果中过滤掉所有捆绑项目的解决方案也可以。
更新
我不希望这些项目显示在目录或搜索中,而是将它们用作加售项目。这似乎有两个选择:
Upsell.php
脚本以包含“不要单独显示”项目。第二个可能更容易?目前应用的过滤器是:
Mage::getSingleton('catalog/product_visibility')->addVisibleInSearchFilterToCollection($this->_itemCollection);
我如何更改此内容以显示不单独显示项目?
对不完整的初始问题抱歉。
第二次更新:
好的,我添加了
->setVisibility(null)
它已经有了
->addStoreFilter()
但没有变化。
基本上,如果我没有:
Mage::getSingleton('catalog/product_visibility')->addVisibleInCatalogFilterToCollection($this->_itemCollection);
Mage::getSingleton('catalog/product_visibility')->addVisibleInSearchFilterToCollection($this->_itemCollection);
然后我收到以下错误:
SELECT 1 AS
status
,e
。entity_id
,e
。type_id
,e
。attribute_set_id
,{{ 1}}。price_index
,price
。price_index
,tax_class_id
。price_index
,IF(price_index.tier_price IS NOT NULL,LEAST(price_index.min_price,price_index) .tier_price),price_index.min_price)ASfinal_price
,minimal_price
。price_index
,min_price
。price_index
,max_price
。price_index
,tier_price
。e
,name
。e
,short_description
。e
,sku
。e
,{ {1}}。price
,e
。special_price
,e
。special_from_date
,e
。special_to_date
,{{1 } {。{}},e
。manufacturer
,e
。manufacturer_value
,e
。small_image
,e
。thumbnail
,e
。news_from_date
,e
。news_to_date
,e
。tax_class_id
,e
。{ {1}},url_key
。e
,required_options
。e
,image_label
。e
,small_image_label
。{{1 },e
。thumbnail_label
,e
。price_type
,e
。weight_type
,e
。price_view
,e
。shipment_type
,e
。links_purchased_separately
,e
。links_exist
,e
。is_imported
,{ {1}}。e
,rc_manufacturer
。e
,rc_manufacturer_value
。e
,rc_vehicle
。e
,{{1 } {。{}},rc_vehicle_value
。e
,rc_assembly_type
。e
,rc_assembly_type_value
。e
,surface_type
。e
,surface_type_value
。e
,rc_drive
。e
,rc_drive_value
。e
,rc_scale
。{ {1}},e
。rc_scale_value
,e
。rc_motor_type
,e
。rc_motor_type_value
,e
。{{1 },rc_engine_start_type
。e
,rc_engine_start_type_value
。e
,rc_engine_size
。e
,rc_engine_size_value
。e
,rc_form_factor
。e
,rc_form_factor_value
。e
,rc_frequency
。e
,rc_frequency_value
。e
,{ {1}}。rc_gear_material
,e
。rc_gear_material_value
,e
。{ {1}},rc_operation
。e
,rc_operation_value
。e
,rc_torque_6v
。e
,rc_torque_6v_value
。{{1 },e
。rc_speed_6v
,e
。rc_speed_6v_value
,e
。rc_bearing_type
,e
。rc_bearing_type_value
,e
。rc_waterproofing
,e
。rc_waterproofing_value
,e
。rc_battery_application
,e
。rc_battery_application_value
,{ {1}}。e
,rc_input_supply
。e
,rc_input_supply_value
。e
,rc_power_output_amps
。e
,{{1 } {。{}},rc_power_output_amps_value
。e
,rc_power_output_watts
。e
,rc_power_output_watts_value
。e
,rc_lead_connector_type
。e
,rc_lead_connector_type_value
。e
,rc_gear_pitch
。e
,rc_gear_pitch_value
。e
,rc_nitro_content
。{ {1}},e
。rc_nitro_content_value
,e
。rc_exhaust_type
,e
。rc_exhaust_type_value
,e
。{{1 },rc_engine_starter_type
。e
,rc_engine_starter_type_value
。e
,rc_head_fitting
。e
,rc_head_fitting_value
。e
,rc_temperature_rating
。e
,rc_temperature_rating_value
。e
,rc_oil_type
。e
,rc_oil_type_value
。e
,{ {1}}。rc_container_size
,e
。rc_container_size_value
,e
。rc_class
,e
。rc_class_value
,{{1 } {。{}},e
。rc_paint_application
,e
。rc_paint_application_value
,e
。rc_size
,e
。rc_size_value
,e
。rc_colour
,e
。rc_colour_value
,e
。rc_pack_contents
,e
。{ {1}},rc_pack_contents_value
。e
,rc_spare_part_type
。e
,rc_spare_part_type_value
。e
,rc_oil_weight
。{{1 },e
。rc_oil_weight_value
,e
。rc_glue_type
,e
。rc_glue_type_value
,e
。rc_usage
,e
。rc_usage_value
,e
。rc_tool_type
,e
。rc_tool_type_value
,e
。rc_engine_spare_type
,{ {1}}。e
,rc_engine_spare_type_value
。e
,rc_tune_up_type
。e
,rc_tune_up_type_value
。e
,{{1 } {。{1}},rc_bearing_pack_type
。e
,rc_bearing_pack_type_value
。e
,rc_driver_type
。e
ASrc_driver_type_value
来自e
ASrc_nut_type
INNER JOINe
ASrc_nut_type_value
ON price_index.entity_id = e.entity_id AND price_index.website_id ='1'AND price_index.customer_group_id = 0 INNER JOINe
ASrc_plane_type
ON links.linked_product_id = e.entity_id AND links.link_type_id = 4 LEFT JOINe
ASrc_plane_type_value
ON link_attribute_position_int.link_id = links
我也尝试过以下操作,但得到错误:
e
感谢您的帮助。
答案 0 :(得分:1)
根据您更新的问题:
如果您没有使用Enterprise Edition TargetRule或其他自动加售的模块(即加售是由管理员明确定义的),那么最简单的方法可能是您指定的方法 - 重写Upsell块以不添加可见性过滤器。作为猜测,为了达到最佳效果,您可能需要在集合上调用setVisibility(null)
和addStoreFilter()
来触发正常的限制行为。
编辑:原始答案
答案 1 :(得分:0)
我通过修改自定义模块解决了这个问题,所以我不需要担心这个问题。它可能有一些用途,因为它涉及使用:
$collection->addAttributeToFilter('type_id', array('neq' => 'bundle'));
其中只排除了集合中的所有捆绑项目。