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: 
- Alternate ways to display the product and attribute data ... (2008-09-02 18:40)
- Adding both "Add All to Basket" and "Add to ... (2008-09-01 09:46)
- When adding a product to the basket from an ... (2008-08-27 19:02)
- I have the module configured to add the key ... (2008-08-13 14:50)
- What is the format for the htaccess file if ... (2008-08-12 14:50)
Top 10 
- 2939 views:
Adding Tokens to Evaluate Expressions - 2866 views:
Is there a way to "Limit" the number of ... - 2791 views:
Why won't you call me for technical support? I ... - 2678 views:
Are license keys valid for more than one store? ... - 2577 views:
I'm trying to enter a license key and get ... - 2566 views:
How do I install a module? - 2409 views:
How do I check for a module upgrade? - 2372 views:
How can display and change the parameters of an ... - 2217 views:
The total on my checkout pages are not correct. ... - 2016 views:
I have select and radio type attributes in my ...
















