1

After switching the Catalog Price Scope from Global to Website and trying to reindex I get the following SQL error. How do I fix it?

Design Config Grid index has been rebuilt successfully in 00:00:00

Customer Grid index has been rebuilt successfully in 00:00:00

Category Products index has been rebuilt successfully in 00:00:00

Product Categories index has been rebuilt successfully in 00:00:00

Catalog Rule Product index has been rebuilt successfully in 00:00:00

Product EAV index has been rebuilt successfully in 00:00:00

Stock index has been rebuilt successfully in 00:00:00

Inventory index has been rebuilt successfully in 00:00:00

Catalog Product Rule index has been rebuilt successfully in 00:00:00

SQLSTATE[42S22]: Column not found: 1054 Unknown column 'cwd.default_store_id' in 'on clause', query was: INSERT INTO catalog_product_index_price_temp SELECT e.entity_id, pw.website_id, IF(IFNULL(tas_tax_class_id.value_id, -1) > 0, tas_tax_class_id.value, tad_tax_class_id.value) AS tax_class_id, IFNULL((IF(IFNULL(tas_price.value_id, -1) > 0, tas_price.value, tad_price.value)), 0) AS price, IFNULL((LEAST(IF(IFNULL(tas_price.value_id, -1) > 0, tas_price.value, tad_price.value), IF(IF(IFNULL(tas_special_price.value_id, -1) > 0, tas_special_price.value, tad_special_price.value) IS NOT NULL AND IF(IFNULL(tas_special_from_date.value_id, -1) > 0, tas_special_from_date.value, tad_special_from_date.value) IS NULL OR DATE(IF(IFNULL(tas_special_from_date.value_id, -1) > 0, tas_special_from_date.value, tad_special_from_date.value)) <= cwd.website_date AND IF(IFNULL(tas_special_to_date.value_id, -1) > 0, tas_special_to_date.value, tad_special_to_date.value) IS NULL OR DATE(IF(IFNULL(tas_special_to_date.value_id, -1) > 0, tas_special_to_date.value, tad_special_to_date.value)) >= cwd.website_date, IF(IFNULL(tas_special_price.value_id, -1) > 0, tas_special_price.value, tad_special_price.value), ~0), IFNULL((IF(tier_price_1.value_id is NULL AND tier_price_2.value_id is NULL AND tier_price_3.value_id is NULL AND tier_price_4.value_id is NULL, NULL, LEAST(IFNULL((IF(tier_price_1.value = 0, ROUND(IF(IFNULL(tas_price.value_id, -1) > 0, tas_price.value, tad_price.value) * (1 - ROUND(tier_price_1.percentage_value * cwd.rate, 4) / 100), 4), ROUND(tier_price_1.value * cwd.rate, 4))), ~0), IFNULL((IF(tier_price_2.value = 0, ROUND(IF(IFNULL(tas_price.value_id, -1) > 0, tas_price.value, tad_price.value) * (1 - ROUND(tier_price_2.percentage_value * cwd.rate, 4) / 100), 4), ROUND(tier_price_2.value * cwd.rate, 4))), ~0), IFNULL((IF(tier_price_3.value = 0, ROUND(IF(IFNULL(tas_price.value_id, -1) > 0, tas_price.value, tad_price.value) * (1 - ROUND(tier_price_3.percentage_value * cwd.rate, 4) / 100), 4), ROUND(tier_price_3.value * cwd.rate, 4))), ~0), IFNULL((IF(tier_price_4.value = 0, ROUND(IF(IFNULL(tas_price.value_id, -1) > 0, tas_price.value, tad_price.value) * (1 - ROUND(tier_price_4.percentage_value * cwd.rate, 4) / 100), 4), ROUND(tier_price_4.value * cwd.rate, 4))), ~0)))), ~0))), 0) AS final_price, IFNULL((LEAST(IF(IFNULL(tas_price.value_id, -1) > 0, tas_price.value, tad_price.value), IF(IF(IFNULL(tas_special_price.value_id, -1) > 0, tas_special_price.value, tad_special_price.value) IS NOT NULL AND IF(IFNULL(tas_special_from_date.value_id, -1) > 0, tas_special_from_date.value, tad_special_from_date.value) IS NULL OR DATE(IF(IFNULL(tas_special_from_date.value_id, -1) > 0, tas_special_from_date.value, tad_special_from_date.value)) <= cwd.website_date AND IF(IFNULL(tas_special_to_date.value_id, -1) > 0, tas_special_to_date.value, tad_special_to_date.value) IS NULL OR DATE(IF(IFNULL(tas_special_to_date.value_id, -1) > 0, tas_special_to_date.value, tad_special_to_date.value)) >= cwd.website_date, IF(IFNULL(tas_special_price.value_id, -1) > 0, tas_special_price.value, tad_special_price.value), ~0), IFNULL((IF(tier_price_1.value_id is NULL AND tier_price_2.value_id is NULL AND tier_price_3.value_id is NULL AND tier_price_4.value_id is NULL, NULL, LEAST(IFNULL((IF(tier_price_1.value = 0, ROUND(IF(IFNULL(tas_price.value_id, -1) > 0, tas_price.value, tad_price.value) * (1 - ROUND(tier_price_1.percentage_value * cwd.rate, 4) / 100), 4), ROUND(tier_price_1.value * cwd.rate, 4))), ~0), IFNULL((IF(tier_price_2.value = 0, ROUND(IF(IFNULL(tas_price.value_id, -1) > 0, tas_price.value, tad_price.value) * (1 - ROUND(tier_price_2.percentage_value * cwd.rate, 4) / 100), 4), ROUND(tier_price_2.value * cwd.rate, 4))), ~0), IFNULL((IF(tier_price_3.value = 0, ROUND(IF(IFNULL(tas_price.value_id, -1) > 0, tas_price.value, tad_price.value) * (1 - ROUND(tier_price_3.percentage_value * cwd.rate, 4) / 100), 4), ROUND(tier_price_3.value * cwd.rate, 4))), ~0), IFNULL((IF(tier_price_4.value = 0, ROUND(IF(IFNULL(tas_price.value_id, -1) > 0, tas_price.value, tad_price.value) * (1 - ROUND(tier_price_4.percentage_value * cwd.rate, 4) / 100), 4), ROUND(tier_price_4.value * cwd.rate, 4))), ~0)))), ~0))), 0) AS min_price, IFNULL((LEAST(IF(IFNULL(tas_price.value_id, -1) > 0, tas_price.value, tad_price.value), IF(IF(IFNULL(tas_special_price.value_id, -1) > 0, tas_special_price.value, tad_special_price.value) IS NOT NULL AND IF(IFNULL(tas_special_from_date.value_id, -1) > 0, tas_special_from_date.value, tad_special_from_date.value) IS NULL OR DATE(IF(IFNULL(tas_special_from_date.value_id, -1) > 0, tas_special_from_date.value, tad_special_from_date.value)) <= cwd.website_date AND IF(IFNULL(tas_special_to_date.value_id, -1) > 0, tas_special_to_date.value, tad_special_to_date.value) IS NULL OR DATE(IF(IFNULL(tas_special_to_date.value_id, -1) > 0, tas_special_to_date.value, tad_special_to_date.value)) >= cwd.website_date, IF(IFNULL(tas_special_price.value_id, -1) > 0, tas_special_price.value, tad_special_price.value), ~0), IFNULL((IF(tier_price_1.value_id is NULL AND tier_price_2.value_id is NULL AND tier_price_3.value_id is NULL AND tier_price_4.value_id is NULL, NULL, LEAST(IFNULL((IF(tier_price_1.value = 0, ROUND(IF(IFNULL(tas_price.value_id, -1) > 0, tas_price.value, tad_price.value) * (1 - ROUND(tier_price_1.percentage_value * cwd.rate, 4) / 100), 4), ROUND(tier_price_1.value * cwd.rate, 4))), ~0), IFNULL((IF(tier_price_2.value = 0, ROUND(IF(IFNULL(tas_price.value_id, -1) > 0, tas_price.value, tad_price.value) * (1 - ROUND(tier_price_2.percentage_value * cwd.rate, 4) / 100), 4), ROUND(tier_price_2.value * cwd.rate, 4))), ~0), IFNULL((IF(tier_price_3.value = 0, ROUND(IF(IFNULL(tas_price.value_id, -1) > 0, tas_price.value, tad_price.value) * (1 - ROUND(tier_price_3.percentage_value * cwd.rate, 4) / 100), 4), ROUND(tier_price_3.value * cwd.rate, 4))), ~0), IFNULL((IF(tier_price_4.value = 0, ROUND(IF(IFNULL(tas_price.value_id, -1) > 0, tas_price.value, tad_price.value) * (1 - ROUND(tier_price_4.percentage_value * cwd.rate, 4) / 100), 4), ROUND(tier_price_4.value * cwd.rate, 4))), ~0)))), ~0))), 0) AS max_price, IF(tier_price_1.value_id is NULL AND tier_price_2.value_id is NULL AND tier_price_3.value_id is NULL AND tier_price_4.value_id is NULL, NULL, LEAST(IFNULL((IF(tier_price_1.value = 0, ROUND(IF(IFNULL(tas_price.value_id, -1) > 0, tas_price.value, tad_price.value) * (1 - ROUND(tier_price_1.percentage_value * cwd.rate, 4) / 100), 4), ROUND(tier_price_1.value * cwd.rate, 4))), ~0), IFNULL((IF(tier_price_2.value = 0, ROUND(IF(IFNULL(tas_price.value_id, -1) > 0, tas_price.value, tad_price.value) * (1 - ROUND(tier_price_2.percentage_value * cwd.rate, 4) / 100), 4), ROUND(tier_price_2.value * cwd.rate, 4))), ~0), IFNULL((IF(tier_price_3.value = 0, ROUND(IF(IFNULL(tas_price.value_id, -1) > 0, tas_price.value, tad_price.value) * (1 - ROUND(tier_price_3.percentage_value * cwd.rate, 4) / 100), 4), ROUND(tier_price_3.value * cwd.rate, 4))), ~0), IFNULL((IF(tier_price_4.value = 0, ROUND(IF(IFNULL(tas_price.value_id, -1) > 0, tas_price.value, tad_price.value) * (1 - ROUND(tier_price_4.percentage_value * cwd.rate, 4) / 100), 4), ROUND(tier_price_4.value * cwd.rate, 4))), ~0))) AS tier_price FROM catalog_product_entity AS e LEFT JOIN mageworx_catalog_product_entity_decimal_temp AS tad_price ON tad_price.entity_id = e.entity_id AND tad_price.attribute_id = 214 AND tad_price.store_id = 0 LEFT JOIN mageworx_catalog_product_entity_decimal_temp AS tas_price ON tas_price.entity_id = e.entity_id AND tas_price.attribute_id = 214 AND tas_price.store_id = cwd.default_store_id INNER JOIN catalog_product_website AS pw ON pw.product_id = e.entity_id INNER JOIN catalog_product_index_website AS cwd ON pw.website_id = cwd.website_id LEFT JOIN catalog_product_index_tier_price AS tp ON tp.entity_id = e.entity_id AND tp.customer_group_id = ta_price.customer_group_id AND tp.website_id = pw.website_id LEFT JOIN catalog_product_entity_tier_price AS tier_price_1 ON tier_price_1.entity_id = e.entity_id AND tier_price_1.all_groups = 0 AND tier_price_1.customer_group_id = ta_price.customer_group_id AND tier_price_1.qty = 1 AND tier_price_1.website_id = 0 LEFT JOIN catalog_product_entity_tier_price AS tier_price_2 ON tier_price_2.entity_id = e.entity_id AND tier_price_2.all_groups = 0 AND tier_price_2.customer_group_id = ta_price.customer_group_id AND tier_price_2.qty = 1 AND tier_price_2.website_id = pw.website_id LEFT JOIN catalog_product_entity_tier_price AS tier_price_3 ON tier_price_3.entity_id = e.entity_id AND tier_price_3.all_groups = 1 AND tier_price_3.customer_group_id = 0 AND tier_price_3.qty = 1 AND tier_price_3.website_id = 0 LEFT JOIN catalog_product_entity_tier_price AS tier_price_4 ON tier_price_4.entity_id = e.entity_id AND tier_price_4.all_groups = 1 AND tier_price_4.customer_group_id = 0 AND tier_price_4.qty = 1 AND tier_price_4.website_id = pw.website_id LEFT JOIN mageworx_catalog_product_entity_decimal_temp AS tad_special_price ON tad_special_price.entity_id = e.entity_id AND tad_special_price.attribute_id = 215 AND tad_special_price.store_id = 0 LEFT JOIN mageworx_catalog_product_entity_decimal_temp AS tas_special_price ON tas_special_price.entity_id = e.entity_id AND tas_special_price.attribute_id = 215 AND tas_special_price.store_id = cwd.default_store_id LEFT JOIN catalog_product_entity_int AS tad_tax_class_id ON tad_tax_class_id.entity_id = e.entity_id AND tad_tax_class_id.attribute_id = 266 AND tad_tax_class_id.store_id = 0 LEFT JOIN catalog_product_entity_int AS tas_tax_class_id ON tas_tax_class_id.entity_id = e.entity_id AND tas_tax_class_id.attribute_id = 266 AND tas_tax_class_id.store_id = cwd.default_store_id INNER JOIN catalog_product_entity_int AS tad_status ON tad_status.entity_id = e.entity_id AND tad_status.attribute_id = 234 AND tad_status.store_id = 0 LEFT JOIN catalog_product_entity_int AS tas_status ON tas_status.entity_id = e.entity_id AND tas_status.attribute_id = 234 AND tas_status.store_id = cwd.default_store_id LEFT JOIN catalog_product_entity_datetime AS tad_special_to_date ON tad_special_to_date.entity_id = e.entity_id AND tad_special_to_date.attribute_id = 217 AND tad_special_to_date.store_id = 0 LEFT JOIN catalog_product_entity_datetime AS tas_special_to_date ON tas_special_to_date.entity_id = e.entity_id AND tas_special_to_date.attribute_id = 217 AND tas_special_to_date.store_id = cwd.default_store_id LEFT JOIN catalog_product_entity_datetime AS tad_special_from_date ON tad_special_from_date.entity_id = e.entity_id AND tad_special_from_date.attribute_id = 216 AND tad_special_from_date.store_id = 0 LEFT JOIN catalog_product_entity_datetime AS tas_special_from_date ON tas_special_from_date.entity_id = e.entity_id AND tas_special_from_date.attribute_id = 216 AND tas_special_from_date.store_id = cwd.default_store_id WHERE (IF(IFNULL(tas_status.value_id, -1) > 0, tas_status.value, tad_status.value) = 1) AND (e.type_id = 'simple') AND (e.entity_id BETWEEN 1 AND 1537)

Google Product Removal Feed index has been rebuilt successfully in 00:00:00

Google Product Feed index has been rebuilt successfully in 00:00:00

Catalog Search index has been rebuilt successfully in 00:00:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.