Skip to main content

Add products newer than 3 weeks to a category

More
12 years 1 month ago #168523 by kimono
-- HikaShop version -- : 2.3.2

Hi,

I want to use a mass action in order to add products, which are newer than 3 weeks to the category "new".
I have tried an expression, which somebody mentioned in this forum before: {time}-1814400 (for "3 weeks in seconds") with "product_created <= {time}-1814400".
But all I get is the message "wrong value - 0 results".

>> What expression do I have to insert here?

Unfortunately, I didn't find any helpful hints in the documentation.
Looking forward to any advice.

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

More
12 years 1 month ago #168545 by Jerome
Hi,

Firstly, I guess it will be "product_created" >= {time}-1814400.
Secondly, you have the edit the file "administrator/components/com_hikashop/classes/massaction.php" and replace the code
Code:
if((in_array($filter['operator'],array('<=','>=','<','>')) && !preg_match('/^(?:\d+|\d*\.\d+)$/',$filter['value']))){ echo JText::_('WRONG_VALUE').' - '; return '1 = 2'; }
By
Code:
if((in_array($filter['operator'],array('<=','>=','<','>')) && !preg_match('/^(?:\d+|\d*\.\d+)$/',$filter['value']))){ if(strpos($filter['value'],'{time}') !== false){ $query = new HikaShopQuery(); $filter['value'] = $query->_replaceDate($filter['value']); $filter['value'] = strftime('%Y-%m-%d %H:%M:%S',$filter['value']); } else { echo JText::_('WRONG_VALUE').' - '; return '1 = 2'; } }
It will add the support of "{time}" in the global mass action system, not only in the Acymailing integration.

Regards,

Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

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

Time to create page: 0.106 seconds
Powered by Kunena Forum