Skip to content

Commit

Permalink
Merge branch 'develop' of https://github.com/magento/magento2ce into …
Browse files Browse the repository at this point in the history
…2.3-develop
  • Loading branch information
Magento Team committed Sep 25, 2017
2 parents d513d77 + 0f71c20 commit df50692
Show file tree
Hide file tree
Showing 8 changed files with 54 additions and 23 deletions.
14 changes: 13 additions & 1 deletion app/code/Magento/Catalog/Helper/Product/ProductList.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ class ProductList
*/
protected $scopeConfig;

/**
* @var \Magento\Framework\Registry
*/
private $coreRegistry;

/**
* Default limits per page
*
Expand All @@ -41,9 +46,11 @@ class ProductList
* @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig
*/
public function __construct(
\Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig
\Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig,
\Magento\Framework\Registry $coreRegistry = null
) {
$this->scopeConfig = $scopeConfig;
$this->coreRegistry = $coreRegistry ?: \Magento\Framework\App\ObjectManager::getInstance()->get(\Magento\Framework\Registry::class);
}

/**
Expand Down Expand Up @@ -97,6 +104,11 @@ public function getDefaultViewMode($options = [])
*/
public function getDefaultSortField()
{
$currentCategory = $this->coreRegistry->registry('current_category');
if ($currentCategory) {
return $currentCategory->getDefaultSortBy();
}

return $this->scopeConfig->getValue(
\Magento\Catalog\Model\Config::XML_PATH_LIST_DEFAULT_SORT_BY,
\Magento\Store\Model\ScopeInterface::SCOPE_STORE
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@
<argument name="at_call" xsi:type="string">getShortDescription</argument>
<argument name="at_code" xsi:type="string">short_description</argument>
<argument name="css_class" xsi:type="string">overview</argument>
<argument name="at_label" xsi:type="string">none</argument>
<argument name="at_label" translate="true" xsi:type="string">none</argument>
<argument name="title" translate="true" xsi:type="string">Overview</argument>
<argument name="add_attribute" xsi:type="string">itemprop="description"</argument>
</arguments>
Expand Down Expand Up @@ -135,7 +135,7 @@
<argument name="at_call" xsi:type="string">getDescription</argument>
<argument name="at_code" xsi:type="string">description</argument>
<argument name="css_class" xsi:type="string">description</argument>
<argument name="at_label" xsi:type="string">none</argument>
<argument name="at_label" translate="true" xsi:type="string">none</argument>
<argument name="title" translate="true" xsi:type="string">Details</argument>
</arguments>
</block>
Expand Down
2 changes: 0 additions & 2 deletions app/code/Magento/Checkout/Model/Cart.php
Original file line number Diff line number Diff line change
Expand Up @@ -366,9 +366,7 @@ public function addProduct($productInfo, $requestInfo = null)
) {
$request->setQty($minimumQty);
}
}

if ($productId) {
try {
$result = $this->getQuote()->addProduct($product, $request);
} catch (\Magento\Framework\Exception\LocalizedException $e) {
Expand Down
3 changes: 2 additions & 1 deletion app/code/Magento/Sales/Model/Service/OrderService.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,8 @@ public function __construct(
public function cancel($id)
{
$order = $this->orderRepository->get($id);
if ((bool)$order->cancel()) {
if ($order->canCancel()) {
$order->cancel();
$this->orderRepository->save($order);
return true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,9 +163,30 @@ public function testCancel()
$this->orderMock->expects($this->once())
->method('cancel')
->willReturn($this->orderMock);
$this->orderMock->expects($this->once())
->method('canCancel')
->willReturn(true);
$this->assertTrue($this->orderService->cancel(123));
}

/**
* test for Order::cancel() fail case
*/
public function testCancelFailed()
{
$this->orderRepositoryMock->expects($this->once())
->method('get')
->with(123)
->willReturn($this->orderMock);
$this->orderMock->expects($this->never())
->method('cancel')
->willReturn($this->orderMock);
$this->orderMock->expects($this->once())
->method('canCancel')
->willReturn(false);
$this->assertFalse($this->orderService->cancel(123));
}

public function testGetCommentsList()
{
$this->filterBuilderMock->expects($this->once())
Expand Down
30 changes: 15 additions & 15 deletions app/code/Magento/Sales/view/adminhtml/layout/sales_order_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -41,21 +41,21 @@
<item name="total" xsi:type="string" translate="true">Row Total</item>
</argument>
</arguments>
<block class="Magento\Sales\Block\Adminhtml\Order\View\Items\Renderer\DefaultRenderer" as="default" template="Magento_Sales::order/view/items/renderer/default.phtml">
<arguments>
<argument name="columns" xsi:type="array">
<item name="product" xsi:type="string" translate="false">col-product</item>
<item name="status" xsi:type="string" translate="false">col-status</item>
<item name="price-original" xsi:type="string" translate="false">col-price-original</item>
<item name="price" xsi:type="string" translate="false">col-price</item>
<item name="qty" xsi:type="string" translate="false">col-ordered-qty</item>
<item name="subtotal" xsi:type="string" translate="false">col-subtotal</item>
<item name="tax-amount" xsi:type="string" translate="false">col-tax-amount</item>
<item name="tax-percent" xsi:type="string" translate="false">col-tax-percent</item>
<item name="discont" xsi:type="string" translate="false">col-discont</item>
<item name="total" xsi:type="string" translate="false">col-total</item>
</argument>
</arguments>
<block class="Magento\Sales\Block\Adminhtml\Order\View\Items\Renderer\DefaultRenderer" as="default" name="default_order_items_renderer" template="Magento_Sales::order/view/items/renderer/default.phtml">
<arguments>
<argument name="columns" xsi:type="array">
<item name="product" xsi:type="string" translate="false">col-product</item>
<item name="status" xsi:type="string" translate="false">col-status</item>
<item name="price-original" xsi:type="string" translate="false">col-price-original</item>
<item name="price" xsi:type="string" translate="false">col-price</item>
<item name="qty" xsi:type="string" translate="false">col-ordered-qty</item>
<item name="subtotal" xsi:type="string" translate="false">col-subtotal</item>
<item name="tax-amount" xsi:type="string" translate="false">col-tax-amount</item>
<item name="tax-percent" xsi:type="string" translate="false">col-tax-percent</item>
<item name="discont" xsi:type="string" translate="false">col-discont</item>
<item name="total" xsi:type="string" translate="false">col-total</item>
</argument>
</arguments>
</block>
<block class="Magento\Sales\Block\Adminhtml\Items\Column\Qty" name="column_qty" template="Magento_Sales::items/column/qty.phtml" group="column"/>
<block class="Magento\Sales\Block\Adminhtml\Items\Column\Name" name="column_name" template="Magento_Sales::items/column/name.phtml" group="column"/>
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/Swagger/Block/Index.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class Index extends Template
*/
private function getParamStore()
{
return ($this->getRequest()->getParam('store')) ? $this->getRequest()->getParam('store') : 'all';
return $this->getRequest()->getParam('store') ?: 'all';
}

/**
Expand Down
1 change: 0 additions & 1 deletion app/code/Magento/Tax/etc/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
<based_on>shipping</based_on>
<price_includes_tax>0</price_includes_tax>
<shipping_includes_tax>0</shipping_includes_tax>
<discount_tax>0</discount_tax>
<apply_tax_on>0</apply_tax_on>
</calculation>
<defaults>
Expand Down

0 comments on commit df50692

Please sign in to comment.