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

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.

Related

Magento Catalog Price Rule not calculating properly for some products

One order has an issue during our Black friday promotion (Catalog price rule 20%). The product original price is $198 but went through for $167 (around 15.6%). I checked the logs, order details etc but don't see any issues. The sale price is fine on front end and other orders were fine too.
Any thoughts how it happened? We are using Magento ver. 1.9.3.2.
Product order amount
Product original amount
The sale amount should have been $158.4
It seems like the rule which was applied is different. Please see the rule details assigned to the corresponding order.
You can see the rule by running the below SQL.
SELECT applied_rule_ids FROM sales_flat_order WHERE entity_id=[MAGNETO_ORDER_ID]
And then see the rule details corresponding to that applied_rule_id

catalog price rules disappear after mid night in magento site

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.

Magento Stock (Configurable, Bundle)

I have a website made with Magento, and a theme by me. The problem is:
The simple product with low stock is associated to a configurable product, and when i try to add a higher quantity of that simple product, it allows, and then, after the checkout proccess, we receive a e-mail from the store that there is a failure in the proccess like:
Payment operation failed:
Reason:
Not all products are available in the requested quantity
It occurs in bundle products that have a default quanity more than 1 too.
Someone can help me?
Thanks.
EDIT:
Found this solution but i can't truncate my sales tables on database. I have all my sales records there, and there are a lot of them. I can't loose it. Magento: After ordering configurable product, its canceled because its out of stock
How many orders do you need to remove? If you got a handful that you can count by hand, you can try this solution to remove unwanted orders.
how can i delete test order from magento
It looks like it should work, but, as always, review the code and try it on one order first..

Magento: Revert price data from index. False price data saved, but not indexed

i hope i am able to describe the problem correctly here, as it is quite complex. I guess you guys are my last chance.
We have ca. 120 config products based on 600 simple products. Some days ago, we accidently overwrote all the prices of the simple products with false prices. We did not notice as in the frontend every price is still ok, they are not indexed.
So we now have the correct prices in the frontend, but the wrong prices for the simple products in the backend.
Is there any method the get the prices from the indexed frontend and write them back in the backend?
Until i reindex all proces should be ok in the frontend.
Does anyone have any idea what i could do to get the prices right again?
If you browse the database, there should be a catalog_product_flat_1 table - this is basically your product index. You should have columns for all the product attributes (including SKU and Price) so you could export this table, then do a product export from Magento, then update all the prices/SKUs accordingly and re-import. Or duplicate the flat_1 table, then write a PHP script to loop through it, updating all the prices, then re-index your data (after checking it's worked of course!)

Magento 1.6, allow SKU's to be used in catalog promotion rules

I'd like to set up catalog price rules discounts based on SKU.
However when I go to 'manage attributes' and try to edit SKU to 'use in Promo Rules: yes'. I get an error saying that SKU is a system reserved atrribute.
I have already changed the SKU attribute to user_defined=1 under eav_attribute table, but the message still appears.
It seems this was possible in earlier version of magento but not 1.6?
Any help is much appreciated.
I took a guess and managed to fix my own problem.
I had set SKU attribute to user_defined=1 under eav_attribute table earlier on along with every other attribute. I had assumed setting them all to '1' would make life easier in the future. However, setting SKU user_defined to 0 via phpmyadmin, actually allowed me to make the changes I wanted.

Resources