Advertisement
Guest User

Untitled

a guest
Jan 30th, 2015
163
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. // delete all empty Categories
  2. $acSql = "select s_categories.id from s_categories left join s_articles_categories_ro ro on ro.categoryID = s_categories.id where ro.id IS NULL and s_categories.parent is not null and s_categories.blog=false and s_categories.path is not null";
  3. $categoryIds = Shopware()->Db()->fetchAll($acSql);
  4. foreach($categoryIds as $catId){
  5. try {
  6. $this->getCategoryResource()->delete($catId['id']);
  7. }catch(\Exception $e){
  8. //do nothing
  9. }
  10. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement