Currently, when one searches for an item, the quick search also brings up any bundles that contain items that fit the search criteria. How would I stop this?
A solution that filters out all bundled items from search results all together would be fine too.
UPDATE
I don't want the items to show in either the catalogue or search, but am using them as upsell items. This seems to leave two options:
- I could amend the search results controller to omit bundled items (the method I was asking about), or
- I could change the
Upsell.php
script to include "Don't show individually" items.
The second is perhaps easier? Currently the filter applied is:
Mage::getSingleton('catalog/product_visibility')->addVisibleInSearchFilterToCollection($this->_itemCollection);
How would I change this so it shows don't show individually items?
Apologies for the incomplete initial question.
Second Update:
Ok, I've added
->setVisibility(null)
and it already has
->addStoreFilter()
But there is no change.
Essentially, if I don't have either of:
Mage::getSingleton('catalog/product_visibility')->addVisibleInCatalogFilterToCollection($this->_itemCollection);
Mage::getSingleton('catalog/product_visibility')->addVisibleInSearchFilterToCollection($this->_itemCollection);
Then I get the following error:
SELECT 1 AS
status
,e
.entity_id
,e
.type_id
,e
.attribute_set_id
,price_index
.price
,price_index
.tax_class_id
,price_index
.final_price
, IF(price_index.tier_price IS NOT NULL, LEAST(price_index.min_price, price_index.tier_price), price_index.min_price) ASminimal_price
,price_index
.min_price
,price_index
.max_price
,price_index
.tier_price
,e
.name
,e
.short_description
,e
.sku
,e
.price
,e
.special_price
,e
.special_from_date
,e
.special_to_date
,e
.manufacturer
,e
.manufacturer_value
,e
.small_image
,e
.thumbnail
,e
.news_from_date
,e
.news_to_date
,e
.tax_class_id
,e
.url_key
,e
.required_options
,e
.image_label
,e
.small_image_label
,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
,e
.rc_manufacturer
,e
.rc_manufacturer_value
,e
.rc_vehicle
,e
.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
,e
.rc_scale_value
,e
.rc_motor_type
,e
.rc_motor_type_value
,e
.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
.rc_gear_material
,e
.rc_gear_material_value
,e
.rc_operation
,e
.rc_operation_value
,e
.rc_torque_6v
,e
.rc_torque_6v_value
,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
,e
.rc_input_supply
,e
.rc_input_supply_value
,e
.rc_power_output_amps
,e
.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
,e
.rc_nitro_content_value
,e
.rc_exhaust_type
,e
.rc_exhaust_type_value
,e
.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
.rc_container_size
,e
.rc_container_size_value
,e
.rc_class
,e
.rc_class_value
,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
.rc_pack_contents_value
,e
.rc_spare_part_type
,e
.rc_spare_part_type_value
,e
.rc_oil_weight
,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
,e
.rc_engine_spare_type_value
,e
.rc_tune_up_type
,e
.rc_tune_up_type_value
,e
.rc_bearing_pack_type
,e
.rc_bearing_pack_type_value
,e
.rc_driver_type
,e
.rc_driver_type_value
,e
.rc_nut_type
,e
.rc_nut_type_value
,e
.rc_plane_type
,e
.rc_plane_type_value
,e
.rc_boat_type
,e
.rc_boat_type_value
,e
.pre_order
,e
.pre_order_value
,e
.msrp_enabled
,e
.msrp_display_actual_price_type
,e
.msrp
,links
.link_id
,link_attribute_position_int
.value
ASposition
FROMcatalog_product_flat_1
ASe
INNER JOINcatalog_product_index_price
ASprice_index
ON price_index.entity_id = e.entity_id AND price_index.website_id = '1' AND price_index.customer_group_id = 0 INNER JOINcatalog_product_link
ASlinks
ON links.linked_product_id = e.entity_id AND links.link_type_id = 4 LEFT JOINcatalog_product_link_attribute_int
ASlink_attribute_position_int
ON link_attribute_position_int.link_id = links
I've also tried the following, but get the error:
Mage::getSingleton('catalog/product_status')->addSaleableFilterToCollection($this->_itemCollection);
Mage::getSingleton('catalog/product_status')->addVisibleFilterToCollection($this->_itemCollection);
Thanks for the help.