====== Скрипт для удаления товаров и групп в зависимости от выбранных параметров ====== id; $aGroupsId[] = $oParGroup->id; } $oGroups = Core_Entity::factory('Shop_group'); $oGroups->queryBuilder() ->where('parent_id', 'IN', $aCurGroupsId); $aoCurGroups = $oGroups->findAll(); } while (count($aoCurGroups) != 0); $oItems->queryBuilder() ->where('shop_group_id', 'IN', $aGroupsId); } // Выборка из интернет магазина if($shopId) { $oItems->queryBuilder() ->where('shop_id', '=', $shopId); } $oItems->queryBuilder() ->limit($stepCount); $aoItems = $oItems->findAll(); $delCount = 0; foreach ($aoItems as $oItem) { if($oItem->delete()) { $delCount++; } } print '
' . $delCount . ' items deleted!'; if(count($aoItems) == $stepCount) { $RedirectTime = 500; Core::factory('Core_Html_Entity_Script') ->type('text/javascript') ->value('setTimeout(location.reload(), ' . $RedirectTime . ')') ->execute(); } else { if($delGroups) { $groupDelCount = 0; if($shopId) { $aoDelGroups = Core_Entity::factory('Shop_group')->getAllByShop_id($shopId); } elseif(isset($aGroupsId) && count($aGroupsId)) { $oDelGroups = Core_Entity::factory('Shop_group'); $oDelGroups->queryBuilder() ->where('id', 'IN', $aGroupsId); $aoDelGroups = $oDelGroups->findAll(); } else { $aoDelGroups = Core_Entity::factory('Shop_group')->findAll(); } if(count($aoDelGroups)) { foreach($aoDelGroups as $oDelGroup) { $oDelGroup->delete(); $groupDelCount++; } } print '
' . $groupDelCount . ' groups deleted!'; } }