Unix timestamp mass action filter

  • Posts: 68
  • Thank you received: 8
  • Hikashop Business
10 years 10 months ago #139866

-- url of the page with the problem -- : mywebsite.com/mypage
-- HikaShop version -- : 2.2.3
-- Joomla version -- : 3.2
-- PHP version -- : 5.3.3
-- Browser(s) name and version -- : XXXXX x.x.x
-- Error-message(debug-mod must be tuned on) -- : Error_message

Hi I have created a mass action to export order history to a CSV and I would like to filter it by the date column (by month specifically) but the date is stored in the database as a Unix timestamp.
Is there anyway to get the massaction to export orders for one month only?

Please Log in or Create an account to join the conversation.

  • Posts: 13201
  • Thank you received: 2322
10 years 10 months ago #139873

Hi,

Actually it's not possible to filter by month by selecting a month.
You have to filter on the created_date, and set a date > to a defined timestamp.

I will add this on our TODO list.

The following user(s) said Thank You: MumsHealth

Please Log in or Create an account to join the conversation.

  • Posts: 68
  • Thank you received: 8
  • Hikashop Business
10 years 10 months ago #139909

Thanks thats what I thought.

Perhaps as a temporary fix you could just add a range operator to the filters so we can enter a timecode range.
Will keep an eye out in the future.

Thanks a lot,

Nathan

Please Log in or Create an account to join the conversation.

  • Posts: 13201
  • Thank you received: 2322
10 years 10 months ago #139933

Hi,

By range you mean interval, right ?
If it is, you can add two filters in one mass action to just get the order of a specific month.
One filter for orders where created_date is > specified timestamp (ex timestamp for 1 december)
And another one where created_date is < specified timestamps (ex timestamp for 31 december)

Please Log in or Create an account to join the conversation.

  • Posts: 68
  • Thank you received: 8
  • Hikashop Business
10 years 10 months ago #140113

Yes, that works fine for me.

Thanks

Please Log in or Create an account to join the conversation.

  • Posts: 68
  • Thank you received: 8
  • Hikashop Business
10 years 10 months ago #140114

One more small thing. It's nice how the "order_created" and "order_modified" fields are converted from a timestamp to a date when they are exported. The field "order_invoice_created" on the other hand stays as a timestamp. Is there any way to fix this as our accountants dont really know how to read a timestamp.

Please Log in or Create an account to join the conversation.

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
10 years 10 months ago #140134

Change the line:
$timestamps = array('product_sale_start','product_sale_end','product_last_seen_date');
to:
$timestamps = array('product_sale_start','product_sale_end','product_last_seen_date','order_invoice_created');

in the file administrator/components/com_hikashop/classes/massaction.php and that should do it.

Please Log in or Create an account to join the conversation.

Time to create page: 0.082 seconds
Powered by Kunena Forum