1

Magento's SpecialToDate does not include a time stamp so any deal runs until midnight.

What I would like to do is to be able to set the time as well as the date.

I was thinking of changing the SpecialToDate date attribute to a text filed, would this work?

my second option is "If the special price didn't recognize the time" where would I hard code a new atttribute(.html) that the special Price uses to check the date?

0

The attributes backend is DATETIME, so changing the input to a text field and entering a MySQL DATETIME string should be a possible solution to store them with time.

But you will still have to modify the price index to compare dates and times.

As far as I see, you have to change line 247-251 of Mage_Catalog_Model_Resource_Product_Indexer_Price_Default and remove getDatePartSql() to use the full datetime values.

  • Ah makes sense. I have tried removing it but didn't work. Is there something I should replace it with and How should I remove it, just getDatePartSql part? – Mike Tim Turner Aug 24 '16 at 9:09
  • yes, $specialFromDate = $write->getDatePartSql($specialFrom); would become $specialFromDate = $specialFrom; – Fabian Schmengler Aug 24 '16 at 9:12
  • What about currentDate? I have changed the attribute input to 'text' and in the products the time is now 2016-08-25 00:00:00. If I change the time and save, it will not update? – Mike Tim Turner Aug 24 '16 at 9:25
  • Looks like it's not that simple, I would have to investigate more. Probably the attribute is using a backend model that strips of the time. – Fabian Schmengler Aug 24 '16 at 9:26
0

I have managed to add the Time to SpecialToDate, this is what I did.

  1. Go in to Database and go to Table: eav_attribute and edit special_to_date change frontend_input from date to text and save.

  2. Edit app/code/core/Mage/Core/Model/Locale.php

    find $date = new Zend_Date($date, $part, $locale);

    and replace with $date = new Zend_Date($date, $locale);

    You can now use time with SpecialToDate

Update:

Just seen this in the same file.

if ($dateTo) {
$toTimeStamp += 86400;
}

This will need to be deleted as the date will be one day out.

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.