I imported a large number of products yesterday with Store Manager for Magento and and just waited for the cron that night to apply the price rules. Price rules apply on a custom attribute.
The next morning the special prices aren't there. Cron monitor says catalogrule_apply_all ran this morning at 4:50am and catalog_product_index_price_reindex_all ran at 5:45am.
I looked at the catalog_product_price table to see what prices were assigned to one of the imported products:
SELECT
cpe.sku,
cpp.rule_price,
cw.name
FROM catalogrule_product_price cpp
LEFT JOIN catalog_product_entity cpe
ON cpe.entity_id = cpp.product_id
LEFT JOIN core_website cw
ON cw.website_id = cpp.website_id
WHERE cpe.sku LIKE 'SKUPATTERN%'
GROUP BY cpp.website_id, cpp.rule_price
And what I discovered was that there weren't any: if I edit the price rule and click Save and Apply, entries begin to show up here in this table with the proper price. (Save and Apply takes maybe 30-50 seconds to run for each rule)
And they begin to show up on the front end as well.
Clicking Apply Rules in Promotions > Catalog Price Rules doesn't put any new entries into catalogrule_product_price nor do they show up in the front end.
Similarly, re-indexing all the indexes doesn't do anything.
I try explicitly running the catalogrule_apply_all etc. cron jobs manually via AOE Scheduler (http://www.fabrizio-branca.de/magento-cron-scheduler.html) to no effect.
I tried a few different variations on external scripts (https://stackoverflow.com/questions/8655913/cant-apply-catalog-price-rule-programmatically) to apply the price rules programmatically/manually (which I'm more or less doing from the front end already), but without success.
Anyone have any ideas on what's going wrong? I know the cron job normally takes care of everything. Maybe what went wrong this time was that the imported products was set to Disabled. Maybe that makes the price rules engine ignore them. I feel like if I could just find out what Magento does at night when it works its price rule magic and call it manually, everything would work.
I've been saving and applying for a few hours now while simultaneously trying other solutions. Saving and applying it is the only thing that seems to build the associations between the rules and products.
I'm supposing that Store Manager did the import via SQL only and because of that it doesn't build the associations that get built when you add a product by hand. Does that mean all SQL imports like what Store Manager does won't apply price rules?
This is Magento CE 1.6.0.0. Some similar reports:
- www.magentocommerce.com/boards/viewthread/79931
- www.magentocommerce.com/boards/viewthread/227080
One said that the Magento Team "fixed" the bug, without saying what it was, back in 1.4.2.
Even if I had a way to programmatically run Save and Apply on each rule one right after the other from the command line, it would be better than what I have now.