2

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.

  • I'm representative of Store Manager for Magento support team. To tell the truth, we haven't faced such an issue before. Most likely that some of default settings are not applied. We have to investigate it more deeply to see what can be the reason of the problem. We have free support and we will provide you high-priority assistance if you leave us your request here - http://support.emagicone.com/submit_ticket and please mention that you are from this forum (to get right-away help). We will check for possible reason of the issue and post resolution h – Maria Oct 28 '13 at 15:53
  • Hello user2630461, this is the same problem i am facing too. Catalog price rules work only for 2 to 3 hours than i have to reapply them again otherwise it shows the default price of product. Strange thing with but i investigated this and it's a common problem. Hope to hear something from you. – Sarvagya Dec 5 '13 at 7:29
1

It looks like the method of importing the products is the problem. Store manager doesn't seem to build the same connections between products as rules as does the System > Import/Export > Import function.

When I tried Magento's native import and examined the rule connections, I found that it built them just fine.

So since I have a bunch of products in the store here with no price rules, I found that if I:

  • exported those products to a CSV (the ones imported via Store Manager)
  • turned around and immediately imported them in again via Magento's native import (replace mode)
  • re-index everything
  • re-apply rules

Then the rules are showing up in catalogrule_product_prices and the front end.

I would still very much be interested if anyone knows of a programmatic way to open and Save each product in a category, or Save and Apply each rule, one right after another. It would be easier to repair the missing connections than exporting the products in question and import / re-index / re-apply.

  • Can someone explain why is this the answer? I don't see too much benefit on the method proposed. – Dave Nov 20 '14 at 2:04
0

You can try this. This helped solve my problem. When calling v2 api for method catalogInventoryStockItemUpdate it would remove any pricing rules.

To alleviate the “rules disappear when saving product” phenomemon, here’s what worked for me:

  1. Open up Observer.php in /app/code/core/Mage/CatalogRule/Model/
  2. Find the applyAllRulesOnProduct() method
  3. At the end of the method, before “return $this;”, add: $this->applyAllRules( $this );

Now to address the catalog rules remaining in effect only for a limited time, here’s what worked for me (same procedure, different method):

  1. Make sure cron is set up and working properly—(but setting up the cron alone didn’t work for me)
  2. Open up Observer.php in /app/code/core/Mage/CatalogRule/Model/
  3. Find the dailyCatalogUpdate() method
  4. At the end of the method, before “return $this;”, add: $this->applyAllRules( $this );
  5. (Not sure if this step is necessary) Open up /app/code/core/Mage/CatalogRule/etc/config.xml
  6. Find the crontab > jobs > catalogrule_apply_all area
  7. Change 0 1 * * * to something more frequent than daily, perhaps every hour 0 * * * * Hope this helps!

http://www.magentocommerce.com/boards/viewthread/194930/

-1

Free extension fix catalog rules: http://www.magentocommerce.com/magento-connect/fix-catalog-rules.html

  • Please add more details about what the extension does, otherwise this will be considered as spam. Single link answers are not the best answers. – Marius Jul 25 '14 at 14:38

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.