catalog price rules disappear after mid night in magento site - magento

we have a problem with catalog price rules in 1.9.0
we have some 1000 products in a site.
we applied catalog price rules to give discount for 500 products.
i did't gave any date limit for catalog price rules
those special prices are displaying only until mid night.
next day, after mid- night special prices are not displaying in site.
cron is working fine.
please help me to find some solution.

source : Magento catalog price rule disappears at night
credits for genius "Alexei Yerofeyev". mostly i will never forget this man.
Yes, this is a bug in Magento (or some logic beyond my understanding). When Magento displays products on frontend, it checks if there are catalog rules for this date. And the date used for this check is your local, so in your case GMT+5. However, when catalog rules are being applied, it uses GMT date. So that means that you aren't able to apply rules until 5 AM.
The problem is in Mage_CatalogRule_Model_Action_Index_Refresh::execute() function. You will have to rewrite this function/class either in your extension, or via the local version of the file.
You have to replace line 121 here : app/code/core/Mage/CatalogRule/Model/Action/Index/Refresh.php
$timestamp = $coreDate->gmtTimestamp('Today');
with this line:
$timestamp = Mage::app()->getLocale()->date(null, null, null, true)->get(Zend_Date::TIMESTAMP);
After that you should be able to apply the rules.

Related

catalog price rules will not work after mid night in magento site

We have a problem with catalog price rules in 1.9.0
We uploaded 1000 products in a site.
After catalog price rules to give discount for 500 products, there is no date limit for catalog price rules. Those special prices are displaying only until mid-night.
Next day, after mid-night, special prices are not displaying in site.
cron job is working fine.
Please help me to find some solution.
this issue was only solved for me with this:
The problem is in Mage_CatalogRule_Model_Action_Index_Refresh::execute() function. You will have to rewrite this function/class either in your extension, or via the local version of the file.
You have to replace line 121 here :
app/code/core/Mage/CatalogRule/Model/Action/Index/Refresh.php
$timestamp = $coreDate->gmtTimestamp('Today');
with this line:
$timestamp = Mage::app()->getLocale()->date(null, null, null, true)->get(Zend_Date::TIMESTAMP);
view the original post:
https://magento.stackexchange.com/questions/67970/catalog-price-rules-disappear-after-mid-night
Step 1:
Please make sure that Cron is working fine. For this you can install AOE Scheduler extension.
Step 2:
You need to debug the issue by debugging magento tables. Following tables used for catalog rules:
catalogrule
catalogrule_affected_product
catalogrule_customer_group
catalogrule_group_website
catalogrule_product
catalogrule_product_price
catalogrule_website
You can delete all catalog rules and create one single rule for one product and check following tables:
catalogrule_product - In this table Magento will manage all product discount percent for all customer group.
catalogrule_product_price - In this table Magento will manage discounted final price for each product. Here magento will insert three days record for each record. you can check this by "rule_date" field.
If it is work perfectly. Then Again After deleting all Catalog rules again, Please truncate following tables from MySQL.
catalogrule_product
catalogrule_product_price
As due to many records primary key reach on maximum limit and try again by creating rule for 500 products. hope it will start work.
Hope this help!!
As stated above by #Davi-Reinoldo the problem is with the indexer.
I had this problem as well, the issue exists when there is an offset of the local timezone greater than +01:00.
Basically just because magento is using the gmtTimestamp for the rule date which in the above stated case results in the day before today.
Therefor I developed a small module https://github.com/Chuvisco88/Chuvisco_CatalogRuleFix to fix the issue.
If someone ever has this problem, please give it a try.

Magento shopwide price reduction without needing to add a catalog price rule

I have added a shopwide catalog price rule of 20% on all products. This seems to work. However, for some reason after a re-index I have to reset this price rule time and time again. As most of my shop runs with automatic imports and cron jobs - I would somehow like to hardcode this rule in. So I don't need to reset the rule every time.
Also the fact that my price is tagged as special price is something I would like to get rid of. The price is just the initial price minus 20%. This is not a special offer - it's just the price how I want to offer it to my customers.
Up till now I haven't found a solution to my problem - or where to start. Suggestions would very welcome!
Use shopping cart price rules
admin/promo_quote/
And set the discount of 20% there. It will apply to the cart and you won't have to the catalog price rules every time.
If you need more fine-grain control, check out:
http://www.amasty.com ( unaffiliated but happy with dozens of their extensions )

Price rules in Magento

I have a problem with the price rules in magento version 1.5.1. I have a rule that defines the discount according to an attribute of the product , called fascia_sconto . I had a series of products that had an attribute that defined a discount of 20 % , but now I need to change the discount to be able to cancel it and put another on the same products .
I changed that attribute using store manager for magento , changing all the products concerned , putting the attribute in the rule that defines a discount to 0 , and then I applied this rule , thinking now that the discount was applied . But I have not noticed any change. Then I emptied the cache, reindexed everything, but nothing yet , there is always the old discount. But the mystery of all mysteries: if I go to a product of which I have modified the attribute, and save it , magically the rule, for that product, of course, is applied , then the item on the frontend has no discount . I have to resave 1,600 products , so I can’t certainly lose a whole day one by one to save all the products to make the rule active .
I also tried to make a rule for it , which should overwrite the previous one. I set a rule that defined a discount of 18 % on those products , putting between actions, “Stop processing more rules “ to “ yes”, so that the previous rule was no longer calculated , but that this was directly applied . But nothing , magento continues to calculate the discount starting with the rule of 20 (which no longer exists all over for those products , since I changed the attribute ) and then apply an additional discount of 18% on discount price! I’m not understanding anything, would you be able to kindly give me a hand ? Where was I wrong?
I hope I was clear enough, and I really hope you grow to be of help .
PS: I’m sorry for my bad English, but it’s not my primary language
Applying price rules based on product attribute changes can be very difficult. I am sypmathetic to your cause.
It might not work but you are welcome to follow carefully my (paranoid) process for applying sale promotion rules:
(change any product attributes relating to the sales rules)
Re-index everything
Refresh the caches
'Save and apply' the rule to apply it to the fresh indexes
Re-index again
Refresh the caches again

Magento Discount ANd Tax Calculation

Kindly have a look the image showing the checkout details on my magento store. The subtotal price of 6929.82 is correct - to which a discount of 10% is to be applied. The discount amount of 692.98 is also correct. However I cannot figure out how in the world could magento calculate the difference of 6929.82 and 692.98 as 6321.94 .
Though I am using a custom theme but I have tried restoring to default theme and the result remains the same which tells that the problem is either in the backend settings or in the core magento files. Further into the calculations - application of 14% tax after discount is calculated correctly and added to the figure.
Can anybody help me out in locating the setting that is leading to this strange behaviour from Magento.
Looks like its a bug. See https://magento.stackexchange.com/questions/2900/completely-incorrect-tax-calculation
Try the following solution
app/code/local/Mage/Tax/Model/Sales/Total/Quote/Tax.php
Line 144
if('cart' == Mage::app()->getRequest()->getControllerName()){
$address->setGrandTotal($address->getGrandTotal() + $address->getTaxAmount());
$address->setBaseGrandTotal($address->getBaseGrandTotal() + $address->getBaseTaxAmount());
} // if
Maybe there is Shipping&handling total is not displayed (amount 85.1). You can check all totals and their value through database, review sales_flat_quote_address table.
After a lot of searching for possible solutions I could not come across any full proof solution to my problem. Modifying the Core Magento files is also something I would not recommend unless and until you are very sure what all areas of your website it will affect.
The solution I have implemented is to set the catalog prices as "excluding tax" in Tax Settings and thereafter manually changing all product prices by deducting the tax applicable on them.
e.g Before Implementing the solution:
Tax Setting - Catalog prices include tax
Price of Item (as entered in product specification)- 100 {subtotal 86 + 14#14% tax}
After Solution
Tax Setting - Catalog prices exclude tax
Price of Item (as entered in product specification)- 86
After implementing this I found the discount totals and everything was being calculated correctly. Since I had only 400 odd products I did it manually over the week just to be sure. However for larger number of products you can also run a query through phpmyadmin(etc) to change the values directly in the database. Do remember to backup your DB before doing so.

Magento - Catalog Price Rules only working on some of the products

I want to apply a catalog price rule only on a certain category.
This works to a certain extent. The category has 109 products, but I can only see the reduced price on the frontend of like 20 of the 109 products. The rest is unchanged.
What could be the cause of this? If I manually edit the products the price rule is applied, but having to do this for 80+ products is a bit too much.
Thanks in advance
Magento has a weird way of storing and indexing pricing when there are pricing rules.
Try to run a cron job every few minutes or so.

Resources