Created
November 11, 2024 13:48
-
-
Save EscApp2/d5ca30846cea8b05e91abbb10fd26c7b to your computer and use it in GitHub Desktop.
Очищать старые корзины
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <? | |
| /* | |
| * task- Нужно очищать все корзины - поставить агента 28800 | |
| * */ | |
| function clearAllBasketsAgent(){ | |
| $day = 7; | |
| \Bitrix\Main\Loader::includeModule('sale'); | |
| $date = date('d.m.Y', time() - 86400 * $day); | |
| $obBasket = \Bitrix\Sale\Basket::getList( | |
| array( | |
| 'select' => array( | |
| 'FUSER_ID' | |
| ), | |
| 'filter' => array( | |
| 'ORDER_ID' => false, | |
| '<=DATE_INSERT' => $date, //DATE_UPDATE | |
| ), | |
| ) | |
| ); | |
| while($bItem = $obBasket->Fetch()){ | |
| CSaleBasket::DeleteAll( | |
| $bItem['FUSER_ID'], | |
| False | |
| ); | |
| } | |
| return "clearAllBasketsAgent();"; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment