I would like, filter by date. Is this possible?
This is possible, albeit a bit difficult to do.
Many people incorrectly attempt something like the following:
(this code will NOT work)
((%orderdate% GE '1/1/2006') AND (%orderdate% LE '2/15/2006'))
This format will not work due to the way Miva Script handles strings (and the way the date is stored). Instead you'll have to separate out each of the "month", "date" and "year" and make separate comparision such as:
((day_of_month GE 1) AND (day_of_month LE 15)) AND
((month GE 1) AND (month LE 2)) AND
((year GE 2005) AND (year LE 2006))
In addition, the token %orderdate% will display a text string of the date and isn't properly formatted for making accurate comparisons.
So the filter will have to use the raw date (the seconds since 1/1/1970) which is stored in the database field Orders.d.date. Throw in some miva script time functions (which derive the day of the month, the month, and the year from the raw time data) and you have a solution.
The correct syntax for that filter would be:
((time_t_dayofmonth(Orders.d.date, timezone()) GE '1') AND (time_t_dayofmonth(Orders.d.date, timezone()) LE '15')) AND
((time_t_month(Orders.d.date,timezone()) GE '1') AND (time_t_month(Orders.d.date,timezone()) LE '2')) AND
((time_t_year(Orders.d.date, timezone()) GE '2005') AND (time_t_year(Orders.d.date, timezone()) lE '2006'))
In instances where a particular day,month, or year isn't in a range it can be simplified using EQ (equal) but it isn't necessary:
((time_t_dayofmonth(Orders.d.date, timezone()) GE '1') AND (time_t_dayofmonth(Orders.d.date, timezone()) LE '15')) AND
((time_t_month(Orders.d.date,timezone()) GE '1') AND (time_t_month(Orders.d.date,timezone()) LE '2')) AND
((time_t_year(Orders.d.date, timezone()) GE '2005') AND (time_t_year(Orders.d.date, timezone()) lE '2005'))
can be simplified to:
((time_t_dayofmonth(Orders.d.date, timezone()) GE '1') AND (time_t_dayofmonth(Orders.d.date, timezone()) LE '15')) AND
((time_t_month(Orders.d.date,timezone()) GE '1') AND (time_t_month(Orders.d.date,timezone()) LE '2')) AND
((time_t_year(Orders.d.date, timezone()) EQ '2005'))
would find orders with a date from 1/1/2005 to 2/15/2005
Last update: 2007-11-08 14:00
Author: Luis
Revision: 1.2
You cannot comment on this entry
Most Recent FAQ Entries: 
- I have the UPS Custom Integration configured so that ... (2008-07-11 10:21)
- I would like to conditionally display something for a ... (2008-07-03 17:37)
- Is there any way to configure specific global headers ... (2008-06-02 18:28)
- I pay my affiliates with gift certificates from your ... (2008-05-29 10:42)
- Is there any way to add a negative number ... (2008-05-22 13:51)
Top 10 
- 2521 views:
Adding Tokens to Evaluate Expressions - 2510 views:
Why won't you call me for technical support? I ... - 2489 views:
Is there a way to "Limit" the number of ... - 2402 views:
Are license keys valid for more than one store? ... - 2308 views:
I'm trying to enter a license key and get ... - 2270 views:
How do I install a module? - 2133 views:
How do I check for a module upgrade? - 2132 views:
How can display and change the parameters of an ... - 1960 views:
The total on my checkout pages are not correct. ... - 1843 views:
I have select and radio type attributes in my ...
















