Skip to content

Commit 48b0568

Browse files
committed
Update
1 parent a4a94d0 commit 48b0568

File tree

3 files changed

+201
-0
lines changed

3 files changed

+201
-0
lines changed

addAttributeFeatured.php

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
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+
$setup = $this->_objectManager->create('\Magento\Framework\Setup\ModuleDataSetupInterface');
11+
$eavSetupFactory = $this->_objectManager->create('\Magento\Eav\Setup\EavSetupFactory');
12+
$eavSetup = $eavSetupFactory->create(['setup' => $setup]);
13+
14+
$eavSetup->addAttribute(
15+
\Magento\Catalog\Model\Product::ENTITY,
16+
'featured',
17+
[
18+
'group' => 'General',
19+
'type' => 'int',
20+
'backend' => '',
21+
'frontend' => '',
22+
'label' => 'Featured Product',
23+
'input' => 'boolean',
24+
'class' => '',
25+
'source' => 'Magento\Eav\Model\Entity\Attribute\Source\Boolean',
26+
'global' => \Magento\Catalog\Model\ResourceModel\Eav\Attribute::SCOPE_STORE,
27+
'visible' => true,
28+
'required' => false,
29+
'user_defined' => true,
30+
'default' => '',
31+
'searchable' => false,
32+
'filterable' => false,
33+
'comparable' => false,
34+
'visible_on_front' => false,
35+
'used_in_product_listing' => true,
36+
'unique' => false,
37+
'is_used_in_grid' => true,
38+
'is_filterable_in_grid' => true,
39+
'apply_to' => ''
40+
]
41+
);
42+
43+
echo 'Done!';
44+
//the method must end with this line
45+
return $this->_response;
46+
}
47+
}
48+
49+
/** @var \Magento\Framework\App\Http $app */
50+
$app = $bootstrap->createApplication('Outslide');
51+
$bootstrap->run($app);

appTheme.php

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
<?php
2+
ini_set('display_startup_errors', 1);ini_set('display_errors', 1); error_reporting(-1);
3+
use Magento\Theme\Model\Theme\Collection;
4+
use Magento\Framework\App\Area;
5+
6+
require dirname(__FILE__) . '/app/bootstrap.php';
7+
$bootstrap = \Magento\Framework\App\Bootstrap::create(BP, $_SERVER);
8+
9+
class Outslide extends \Magento\Framework\App\Http
10+
implements \Magento\Framework\AppInterface {
11+
public function launch()
12+
{
13+
$this->showTableTheme();
14+
$this->setType(4);
15+
$this->setType(5);
16+
$this->setType(6);
17+
$this->setType(7);
18+
$this->setType(8);
19+
$this->setType(9);
20+
21+
// $themesCollections = $this->_objectManager->create('Magento\Theme\Model\Theme\Collection');
22+
// $themesCollections->addConstraint(Collection::CONSTRAINT_AREA, Area::AREA_FRONTEND);
23+
// $themes = [];
24+
// $themesCollections = $this->_objectManager->create('Magento\Framework\View\Design\Theme\ListInterface');
25+
26+
//the method must end with this line
27+
return $this->_response;
28+
}
29+
30+
public function showTableTheme()
31+
{
32+
$collections = $this->_objectManager->create('Magento\Theme\Model\Theme');
33+
$themes = $collections->getCollection()->addFieldToSelect('*');
34+
35+
?>
36+
<table>
37+
<thead align="left" style="display: table-header-group">
38+
<tr>
39+
<th>theme_id </th>
40+
<th>parent_id </th>
41+
<th>theme_path </th>
42+
<th>theme_title </th>
43+
<th>preview_image </th>
44+
<th>is_featured </th>
45+
<th>area </th>
46+
<th>type </th>
47+
<th>code </th>
48+
</tr>
49+
</thead>
50+
<tbody>
51+
<?php foreach ($themes as $theme) : ?>
52+
<?php
53+
// var_dump($theme->toArray());
54+
?>
55+
<tr class="item_row">
56+
<td> <?php echo $theme->getData('theme_id'); ?> </td>
57+
<td> <?php echo $theme->getData('parent_id'); ?> </td>
58+
<td> <?php echo $theme->getData('theme_path'); ?> </td>
59+
<td> <?php echo $theme->getData('theme_title'); ?> </td>
60+
<td> <?php echo $theme->getData('preview_image'); ?></td>
61+
<td> <?php echo $theme->getData('is_featured'); ?> </td>
62+
<td> <?php echo $theme->getData('area'); ?> </td>
63+
<td> <?php echo $theme->getData('type'); ?> </td>
64+
<td> <?php echo $theme->getData('code'); ?> </td>
65+
66+
</tr>
67+
<?php endforeach; ?>
68+
</tbody>
69+
</table>
70+
<?php
71+
}
72+
73+
public function setType($id)
74+
{
75+
$theme = $this->_objectManager->create('Magento\Theme\Model\Theme');
76+
try {
77+
$theme->load($id, 'theme_id');
78+
$theme->setType(0);
79+
$theme->save();
80+
echo 'done';
81+
} catch (\Exception $e) {
82+
$this->messageManager->addError(__('Can\'t create child theme error "%1"', $e->getMessage()));
83+
}
84+
}
85+
86+
87+
}
88+
89+
/** @var \Magento\Framework\App\Http $app */
90+
$app = $bootstrap->createApplication('Outslide');
91+
$bootstrap->run($app);

moveOrderToCustomer.php

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
<?php
2+
/**
3+
* Magiccart
4+
* @category Magiccart
5+
* @copyright Copyright (c) 2014 Magiccart (http://www.magiccart.net/)
6+
* @license http://www.magiccart.net/license-agreement.html
7+
* @Author: DOng NGuyen<[email protected]>
8+
* @@Create Date: 2018-03-20 21:14:06
9+
* @@Modify Date: 2018-05-31 10:17:23
10+
* @@Function:
11+
*/
12+
ini_set('display_startup_errors', 1);ini_set('display_errors', 1); error_reporting(-1);
13+
//// Setup Base
14+
$folder = ''; //Folder Name
15+
$file = $folder ? "$folder/app/bootstrap.php" : "app/bootstrap.php";
16+
17+
if(!file_exists ($file)) $file = "app/bootstrap.php";
18+
if(file_exists ($file)){
19+
require dirname(__FILE__) .'/' .$file;
20+
$bootstrap = \Magento\Framework\App\Bootstrap::create(BP, $_SERVER);
21+
} else {die('Not found bootstrap.php');}
22+
23+
class Outslide extends \Magento\Framework\App\Http
24+
implements \Magento\Framework\AppInterface {
25+
26+
public function launch()
27+
{
28+
29+
30+
31+
$this->_state->setAreaCode('adminhtml');
32+
// $_storeManager = $this->_objectManager->create('\Magento\Store\Model\StoreManagerInterface');
33+
// $_storeManager->setCurrentStore(0);
34+
$orderRepository = $this->_objectManager->create('Magento\Sales\Api\OrderRepositoryInterface');
35+
$searchCriteriaBuilder = $this->_objectManager->create('Magento\Framework\Api\SearchCriteriaBuilder');
36+
37+
$incrementId = 2000000222;
38+
$customerId = 999;
39+
40+
$searchCriteria = $searchCriteriaBuilder->addFilter('increment_id', $incrementId, 'eq')->create();
41+
$order = $orderRepository->getList($searchCriteria)->getFirstItem();
42+
if ($order->getId() && !$order->getCustomerId())
43+
{
44+
$order->setCustomerId($customerId);
45+
$order->setCustomerIsGuest(0);
46+
$orderRepository->save($order);
47+
48+
49+
echo "Update order done!<br/>";
50+
}
51+
echo 'done';
52+
return $this->_response;
53+
}
54+
55+
}
56+
57+
/** @var \Magento\Framework\App\Http $app */
58+
$app = $bootstrap->createApplication('Outslide');
59+
$bootstrap->run($app);

0 commit comments

Comments
 (0)