Skip to content

Commit f2efe76

Browse files
author
Korshenko, Oleksii(okorshenko)
committed
Merge pull request #385 from magento-api/cart-price-rules
[API] Staging: Cart Price Rule
2 parents 3beb931 + 2990ece commit f2efe76

File tree

54 files changed

+1616
-372
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+1616
-372
lines changed

app/code/Magento/Backend/Block/System/Store/Edit/Form/Website.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,9 @@ protected function _prepareStoreFieldset(\Magento\Framework\Data\Form $form)
108108
);
109109
}
110110

111-
if (!$websiteModel->getIsDefault() && $websiteModel->getStoresCount()) {
111+
$hasOnlyDefaultStore = $websiteModel->getStoresCount() == 1 &&
112+
array_key_exists(\Magento\Store\Model\Store::DEFAULT_STORE_ID, $websiteModel->getStoreIds());
113+
if (!$websiteModel->getIsDefault() && $websiteModel->getStoresCount() && !$hasOnlyDefaultStore) {
112114
$fieldset->addField(
113115
'is_default',
114116
'checkbox',

app/code/Magento/Backend/Helper/Dashboard/Order.php

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
*/
66
namespace Magento\Backend\Helper\Dashboard;
77

8+
use Magento\Framework\App\ObjectManager;
9+
810
/**
911
* Adminhtml dashboard helper for orders
1012
*/
@@ -15,6 +17,11 @@ class Order extends \Magento\Backend\Helper\Dashboard\AbstractDashboard
1517
*/
1618
protected $_orderCollection;
1719

20+
/**
21+
* @var \Magento\Store\Model\StoreManagerInterface
22+
*/
23+
protected $_storeManager;
24+
1825
/**
1926
* @param \Magento\Framework\App\Helper\Context $context
2027
* @param \Magento\Reports\Model\ResourceModel\Order\Collection $orderCollection
@@ -24,9 +31,18 @@ public function __construct(
2431
\Magento\Reports\Model\ResourceModel\Order\Collection $orderCollection
2532
) {
2633
$this->_orderCollection = $orderCollection;
27-
parent::__construct(
28-
$context
29-
);
34+
parent::__construct($context);
35+
}
36+
37+
/**
38+
* @return \Magento\SalesRule\Model\RuleFactory
39+
* @deprecated
40+
*/
41+
public function getStoreManager()
42+
{
43+
if ($this->_storeManager instanceof \Magento\Store\Model\StoreManagerInterface) {
44+
$this->_storeManager = ObjectManager::getInstance()->get('\Magento\Store\Model\StoreManagerInterface');
45+
}
3046
}
3147

3248
/**

app/code/Magento/Catalog/Ui/Component/Listing/Columns/Websites.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ public function __construct(
4343

4444
/**
4545
* {@inheritdoc}
46+
* @deprecated
4647
*/
4748
public function prepareDataSource(array $dataSource)
4849
{
@@ -63,15 +64,16 @@ public function prepareDataSource(array $dataSource)
6364

6465
return $dataSource;
6566
}
66-
67+
6768
/**
6869
* Prepare component configuration
6970
* @return void
7071
*/
7172
public function prepare()
7273
{
73-
if (!$this->storeManager->isSingleStoreMode()) {
74-
parent::prepare();
74+
parent::prepare();
75+
if ($this->storeManager->isSingleStoreMode()) {
76+
$this->_data['config']['componentDisabled'] = true;
7577
}
7678
}
7779
}

app/code/Magento/Catalog/view/adminhtml/ui_component/product_listing.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@
230230
</item>
231231
</argument>
232232
</column>
233-
<column name="websites">
233+
<column name="websites" class="Magento\Catalog\Ui\Component\Listing\Columns\Websites">
234234
<argument name="data" xsi:type="array">
235235
<item name="options" xsi:type="object">Magento\Store\Model\ResourceModel\Website\Collection</item>
236236
<item name="config" xsi:type="array">

app/code/Magento/CatalogRule/Block/Adminhtml/Promo/Catalog/Edit/Tab/Conditions.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ protected function addTabToForm($model, $fieldsetId = 'conditions_fieldset', $fo
153153

154154
$renderer = $this->_rendererFieldset->setTemplate('Magento_CatalogRule::promo/fieldset.phtml')
155155
->setNewChildUrl($newChildUrl)
156-
->setConditionsFieldSetId($model->getConditionsFieldSetId($formName));
156+
->setFieldSetId($model->getConditionsFieldSetId($formName));
157157

158158
$fieldset = $form->addFieldset(
159159
$fieldsetId,

app/code/Magento/CatalogRule/view/adminhtml/templates/promo/fieldset.phtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
/**@var \Magento\Backend\Block\Widget\Form\Renderer\Fieldset $block */
1010
?>
1111
<?php $_element = $block->getElement() ?>
12-
<?php $_jsObjectName = $block->getConditionsFieldSetId() != null ? $block->getConditionsFieldSetId() : $_element->getHtmlId() ?>
12+
<?php $_jsObjectName = $block->getFieldSetId() != null ? $block->getFieldSetId() : $_element->getHtmlId() ?>
1313
<div class="rule-tree">
1414
<fieldset id="<?php /* @escapeNotVerified */ echo $_jsObjectName ?>" <?php /* @escapeNotVerified */ echo $_element->serialize(['class']) ?> class="fieldset">
1515
<legend class="legend"><span><?php /* @escapeNotVerified */ echo $_element->getLegend() ?></span></legend>

app/code/Magento/Cms/view/adminhtml/ui_component/cms_page_form.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@
171171
</argument>
172172
</field>
173173
</fieldset>
174-
<fieldset name="websites">
174+
<fieldset name="websites" class="Magento\Store\Ui\Component\Form\Fieldset\Websites">
175175
<argument name="data" xsi:type="array">
176176
<item name="config" xsi:type="array">
177177
<item name="collapsible" xsi:type="boolean">true</item>
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
<?php
2+
/**
3+
* Copyright © 2015 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\Customer\Ui\Component\Listing\Column;
7+
8+
use Magento\Framework\View\Element\UiComponent\ContextInterface;
9+
use Magento\Framework\View\Element\UiComponentFactory;
10+
use Magento\Ui\Component\Listing\Columns\Column;
11+
use Magento\Store\Model\StoreManagerInterface as StoreManager;
12+
13+
/**
14+
* Class Websites
15+
*/
16+
class Websites extends Column
17+
{
18+
/**
19+
* Store manager
20+
*
21+
* @var StoreManager
22+
*/
23+
protected $storeManager;
24+
25+
/**
26+
* @param ContextInterface $context
27+
* @param UiComponentFactory $uiComponentFactory
28+
* @param StoreManager $storeManager
29+
* @param array $components
30+
* @param array $data
31+
*/
32+
public function __construct(
33+
ContextInterface $context,
34+
UiComponentFactory $uiComponentFactory,
35+
StoreManager $storeManager,
36+
array $components = [],
37+
array $data = []
38+
) {
39+
$this->storeManager = $storeManager;
40+
parent::__construct($context, $uiComponentFactory, $components, $data);
41+
}
42+
43+
/**
44+
* Prepare component configuration
45+
* @return void
46+
*/
47+
public function prepare()
48+
{
49+
parent::prepare();
50+
if ($this->storeManager->isSingleStoreMode()) {
51+
$this->_data['config']['componentDisabled'] = true;
52+
}
53+
}
54+
}

app/code/Magento/Customer/view/adminhtml/ui_component/customer_listing.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@
245245
</item>
246246
</argument>
247247
</column>
248-
<column name="website_id">
248+
<column name="website_id" class="Magento\Customer\Ui\Component\Listing\Column\Websites">
249249
<argument name="data" xsi:type="array">
250250
<item name="config" xsi:type="array">
251251
<item name="filter" xsi:type="string">select</item>
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright © 2015 Magento. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
<form xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd">
9+
<fieldset name="actions">
10+
<field name="simple_free_shipping">
11+
<argument name="data" xsi:type="array">
12+
<item name="options" xsi:type="object">Magento\OfflineShipping\Model\Source\SalesRule\FreeShippingOptions</item>
13+
<item name="config" xsi:type="array">
14+
<item name="dataType" xsi:type="string">text</item>
15+
<item name="label" xsi:type="string" translate="true">Free Shipping</item>
16+
<item name="formElement" xsi:type="string">select</item>
17+
<item name="dataScope" xsi:type="string">simple_free_shipping</item>
18+
<item name="caption" xsi:type="string" translate="true">-- Please Select --</item>
19+
<item name="sortOrder" xsi:type="number">80</item>
20+
</item>
21+
</argument>
22+
</field>
23+
</fieldset>
24+
</form>

app/code/Magento/Sales/Setup/InstallSchema.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3216,6 +3216,12 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con
32163216
'12,4',
32173217
[],
32183218
'Grand Total'
3219+
)->addColumn(
3220+
'base_grand_total',
3221+
\Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL,
3222+
'12,4',
3223+
[],
3224+
'Base Grand Total'
32193225
)->addColumn(
32203226
'created_at',
32213227
\Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP,
@@ -3234,6 +3240,9 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con
32343240
)->addIndex(
32353241
$installer->getIdxName('sales_invoice_grid', ['grand_total']),
32363242
['grand_total']
3243+
)->addIndex(
3244+
$installer->getIdxName('sales_invoice_grid', ['base_grand_total']),
3245+
['base_grand_total']
32373246
)->addIndex(
32383247
$installer->getIdxName('sales_invoice_grid', ['order_id']),
32393248
['order_id']

app/code/Magento/Sales/etc/adminhtml/system.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@
109109
<group id="dashboard" translate="label,comment" sortOrder="60" showInDefault="1" showInWebsite="0" showInStore="0">
110110
<label>Dashboard</label>
111111
<field id="use_aggregated_data" translate="label" sortOrder="10" type="select" showInDefault="1" showInWebsite="0" showInStore="0">
112-
<label>Use Aggregated Data (beta)</label>
112+
<label>Use Aggregated Data</label>
113113
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
114114
<comment>Improves dashboard performance but provides non-realtime data.</comment>
115115
</field>

app/code/Magento/Sales/etc/di.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -634,6 +634,7 @@
634634
<item name="shipping_information" xsi:type="string">sales_order.shipping_description</item>
635635
<item name="subtotal" xsi:type="string">sales_order.base_subtotal</item>
636636
<item name="shipping_and_handling" xsi:type="string">sales_order.base_shipping_amount</item>
637+
<item name="base_grand_total" xsi:type="string">sales_invoice.base_grand_total</item>
637638
<item name="grand_total" xsi:type="string">sales_invoice.grand_total</item>
638639
<item name="created_at" xsi:type="string">sales_invoice.created_at</item>
639640
<item name="updated_at" xsi:type="string">sales_invoice.updated_at</item>

app/code/Magento/Sales/i18n/en_US.csv

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -615,7 +615,7 @@ Comma-separated,Comma-separated
615615
"We'll use the default description above if you leave this empty.","We'll use the default description above if you leave this empty."
616616
"Multi-address Error to Show in Shopping Cart","Multi-address Error to Show in Shopping Cart"
617617
"We'll use the default error above if you leave this empty.","We'll use the default error above if you leave this empty."
618-
"Use Aggregated Data (beta)","Use Aggregated Data (beta)"
618+
"Use Aggregated Data","Use Aggregated Data"
619619
"Sales Emails","Sales Emails"
620620
"New Order Confirmation Email Sender","New Order Confirmation Email Sender"
621621
"New Order Confirmation Template","New Order Confirmation Template"

app/code/Magento/Sales/view/adminhtml/ui_component/sales_order_invoice_grid.xml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,11 +141,19 @@
141141
</item>
142142
</argument>
143143
</column>
144-
<column name="grand_total" class="Magento\Sales\Ui\Component\Listing\Column\Price">
144+
<column name="base_grand_total" class="Magento\Sales\Ui\Component\Listing\Column\Price">
145145
<argument name="data" xsi:type="array">
146146
<item name="config" xsi:type="array">
147147
<item name="filter" xsi:type="string">textRange</item>
148-
<item name="label" xsi:type="string" translate="true">Amount</item>
148+
<item name="label" xsi:type="string" translate="true">Grand Total (Base)</item>
149+
</item>
150+
</argument>
151+
</column>
152+
<column name="grand_total" class="Magento\Sales\Ui\Component\Listing\Column\PurchasedPrice">
153+
<argument name="data" xsi:type="array">
154+
<item name="config" xsi:type="array">
155+
<item name="filter" xsi:type="string">textRange</item>
156+
<item name="label" xsi:type="string" translate="true">Grand Total (Purchased)</item>
149157
</item>
150158
</argument>
151159
</column>

0 commit comments

Comments
 (0)