Skip to content

Commit a21f473

Browse files
committedAug 22, 2020
Create appLayoutCategpry.php
1 parent 0fb22e3 commit a21f473

File tree

1 file changed

+48
-0
lines changed

1 file changed

+48
-0
lines changed
 

‎appLayoutCategpry.php

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
<?php
2+
3+
// Update layout category magento 2
4+
5+
ini_set('display_startup_errors', 1);ini_set('display_errors', 1); error_reporting(-1);
6+
7+
require dirname(__FILE__) . '/app/bootstrap.php';
8+
$bootstrap = \Magento\Framework\App\Bootstrap::create(BP, $_SERVER);
9+
10+
class Outslide extends \Magento\Framework\App\Http
11+
implements \Magento\Framework\AppInterface {
12+
public function launch()
13+
{
14+
15+
$appState = $this->_objectManager->get('\Magento\Framework\App\State');
16+
17+
$appState->setAreaCode('frontend');
18+
19+
$categoryCollection = $this->_objectManager->get('\Magento\Catalog\Model\ResourceModel\Category\CollectionFactory');
20+
21+
$categories = $categoryCollection->create();
22+
23+
$categories->addAttributeToSelect('*');
24+
25+
$categories->load();
26+
27+
if (count($categories) > 0):
28+
foreach($categories as $category):
29+
$catId = $category->getId();
30+
$category = $this->_objectManager->create('Magento\Catalog\Model\CategoryFactory')->create()->setStoreId(0)->load($catId);
31+
$category->setData('custom_use_parent_settings', '0')->setData('custom_design', '');
32+
$category->save();
33+
echo 'Update ' . $category->getName() . '<br/>';
34+
endforeach;
35+
else: echo "No Results";
36+
endif;
37+
38+
echo 'Done update layout page';
39+
40+
//the method must end with this line
41+
return $this->_response;
42+
}
43+
44+
}
45+
46+
/** @var \Magento\Framework\App\Http $app */
47+
$app = $bootstrap->createApplication('Outslide');
48+
$bootstrap->run($app);

0 commit comments

Comments
 (0)
Please sign in to comment.