1+ <?php
2+
3+ require dirname (__FILE__ ) . '/app/bootstrap.php ' ;
4+ $ bootstrap = \Magento \Framework \App \Bootstrap::create (BP , $ _SERVER );
5+
6+ class Outslide extends \Magento \Framework \App \Http
7+ implements \Magento \Framework \AppInterface {
8+ public function launch ()
9+ {
10+
11+ // $this->_state->setAreaCode('frontend');
12+ $ this ->_state ->setAreaCode ('adminhtml ' );
13+ // $this->_state->setAreaCode(\Magento\Framework\App\Area::AREA_FRONTEND);
14+ // $this->_state->setAreaCode(\Magento\Framework\App\Area::AREA_ADMINHTML);
15+
16+ $ productRepository = $ this ->_objectManager ->create ('Magento\Catalog\Model\ProductRepository ' );
17+
18+ // YOU WANT TO LOAD BY ID?
19+ $ id = "YOUR ID HERE " ;
20+ // YOU WANT TO LOAD BY SKU?
21+ $ sku = "YOUR SKU HERE " ;
22+
23+ if ($ id ) {
24+ $ product = $ productRepository ->getById ($ id );
25+ }
26+ if ($ sku ) {
27+ $ product = $ productRepository ->get ($ sku );
28+ }
29+
30+ $ shortDescriptionAttributeCode = "short_description " ;
31+ $ descriptionAttributeCode = "description " ;
32+
33+ $ shortDescriptionAttributeValue = "YOUR NEW VALUE " ;
34+ $ descriptionAttributeValue = "YOUR NEW VALUE " ;
35+
36+
37+ $ product ->addAttributeUpdate ($ shortDescriptionAttributeCode , $ shortDescriptionAttributeValue , 0 );
38+ $ product ->addAttributeUpdate ($ descriptionAttributeCode , $ descriptionAttributeValue , 0 );
39+
40+ echo 'Done! ' ;
41+ //the method must end with this line
42+ return $ this ->_response ;
43+ }
44+ }
45+
46+ /** @var \Magento\Framework\App\Http $app */
47+ $ app = $ bootstrap ->createApplication ('Outslide ' );
48+ $ bootstrap ->run ($ app );
0 commit comments