Skip to content

Commit

Permalink
Merge branch '2.2-develop' of github.com:magento/magento2ce into 8830
Browse files Browse the repository at this point in the history
  • Loading branch information
omiroshnichenko committed Dec 14, 2017
2 parents 0a6a2d9 + 3839c0f commit 53c1fa3
Show file tree
Hide file tree
Showing 1,000 changed files with 28,571 additions and 1,477 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,7 @@ protected function saveAndReplaceAdvancedPrices()
? $rowData[self::COL_TIER_PRICE] : 0,
'percentage_value' => $rowData[self::COL_TIER_PRICE_TYPE] === self::TIER_PRICE_TYPE_PERCENT
? $rowData[self::COL_TIER_PRICE] : null,
'website_id' => $this->getWebsiteId($rowData[self::COL_TIER_PRICE_WEBSITE])
'website_id' => $this->getWebSiteId($rowData[self::COL_TIER_PRICE_WEBSITE])
];
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class WebsiteTest extends \PHPUnit\Framework\TestCase

protected function setUp()
{
$this->webSiteModel = $this->getMockBuilder(\Magento\Store\Model\WebSite::class)
$this->webSiteModel = $this->getMockBuilder(\Magento\Store\Model\Website::class)
->setMethods(['getBaseCurrency'])
->disableOriginalConstructor()
->getMock();
Expand Down
18 changes: 18 additions & 0 deletions app/code/Magento/Analytics/etc/di.xml
Original file line number Diff line number Diff line change
Expand Up @@ -254,4 +254,22 @@
<argument name="responseResolver" xsi:type="object">NotifyDataChangedResponseResolver</argument>
</arguments>
</type>
<type name="Magento\Config\Model\Config\TypePool">
<arguments>
<argument name="sensitive" xsi:type="array">
<item name="analytics/url/signup" xsi:type="string">1</item>
<item name="analytics/url/update" xsi:type="string">1</item>
<item name="analytics/url/bi_essentials" xsi:type="string">1</item>
<item name="analytics/url/otp" xsi:type="string">1</item>
<item name="analytics/url/report" xsi:type="string">1</item>
<item name="analytics/url/notify_data_changed" xsi:type="string">1</item>
<item name="analytics/general/token" xsi:type="string">1</item>
</argument>
<argument name="environment" xsi:type="array">
<item name="crontab/default/jobs/analytics_collect_data/schedule/cron_expr" xsi:type="string">1</item>
<item name="crontab/default/jobs/analytics_update/schedule/cron_expr" xsi:type="string">1</item>
<item name="crontab/default/jobs/analytics_subscribe/schedule/cron_expr" xsi:type="string">1</item>
</argument>
</arguments>
</type>
</config>
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ protected function _prepareForm()
['data' => ['id' => 'edit_form', 'action' => $this->getData('action'), 'method' => 'post']]
);

$this->_prepareStoreFieldSet($form);
$this->_prepareStoreFieldset($form);

$form->addField(
'store_type',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@ public function execute()
$user = $this->_objectManager->create(\Magento\User\Model\User::class)->load($userId);

$user->setId($userId)
->setUsername($this->getRequest()->getParam('username', false))
->setFirstname($this->getRequest()->getParam('firstname', false))
->setLastname($this->getRequest()->getParam('lastname', false))
->setUserName($this->getRequest()->getParam('username', false))
->setFirstName($this->getRequest()->getParam('firstname', false))
->setLastName($this->getRequest()->getParam('lastname', false))
->setEmail(strtolower($this->getRequest()->getParam('email', false)));

if ($this->_objectManager->get(\Magento\Framework\Validator\Locale::class)->isValid($interfaceLocale)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ public function testSetFilterTypePropagatesFilterTypeToColumns()

public function testGetRowUrlIfUrlPathNotSet()
{
$this->assertEquals('#', $this->_block->getRowUrl(new \StdClass()));
$this->assertEquals('#', $this->_block->getRowUrl(new \stdClass()));
}

public function testGetRowUrl()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ public function testSetGetGrid()

$this->_block->setFilter('StdClass');

$grid = new \StdClass();
$grid = new \stdClass();
$this->_block->setGrid($grid);
$this->assertEquals($grid, $this->_block->getGrid());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ public function testBeforeSave($value, $errorMessage = null)
\Magento\Backend\Model\Config\SessionLifetime\BackendModel::class
);
if ($errorMessage !== null) {
$this->expectException(\Magento\Framework\Exception\LocalizedException::class, $errorMessage);
$this->expectException(\Magento\Framework\Exception\LocalizedException::class);
$this->expectExceptionMessage($errorMessage);
}
$model->setValue($value);
$object = $model->beforeSave();
Expand Down
3 changes: 3 additions & 0 deletions app/code/Magento/Backend/etc/adminhtml/di.xml
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,9 @@
<item name="dev" xsi:type="const">Magento\Config\Model\Config\Structure\ElementVisibilityInterface::HIDDEN</item>
<item name="general/locale/code" xsi:type="const">Magento\Config\Model\Config\Structure\ElementVisibilityInterface::DISABLED</item>
</argument>
<argument name="exemptions" xsi:type="array">
<item name="dev/debug/debug_logging" xsi:type="string"/>
</argument>
</arguments>
</type>
<type name="Magento\Framework\View\Layout\Generator\Block">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
data-mage-init='{"dropdown":{}}'
data-toggle="dropdown">
<span class="admin__action-dropdown-text">
<span class="admin-user-account-text"><?= $block->escapeHtml($block->getUser()->getUsername()) ?></span>
<span class="admin-user-account-text"><?= $block->escapeHtml($block->getUser()->getUserName()) ?></span>
</span>
</a>
<ul class="admin__action-dropdown-menu">
Expand All @@ -39,7 +39,7 @@
href="<?= /* @escapeNotVerified */ $block->getUrl('adminhtml/system_account/index') ?>"
<?= /* @escapeNotVerified */ $block->getUiId('user', 'account', 'settings') ?>
title="<?= $block->escapeHtml(__('Account Setting')) ?>">
<?= /* @escapeNotVerified */ __('Account Setting') ?> (<span class="admin-user-name"><?= $block->escapeHtml($block->getUser()->getUsername()) ?></span>)
<?= /* @escapeNotVerified */ __('Account Setting') ?> (<span class="admin-user-name"><?= $block->escapeHtml($block->getUser()->getUserName()) ?></span>)
</a>
</li>
<?php endif; ?>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,16 @@
<script data-template="search-suggest" type="text/x-magento-template">
<ul class="search-global-menu">
<li class="item">
<a id="searchPreviewProducts" href="<?= /* @escapeNotVerified */ $block->getURL('catalog/product/index/') ?>?search=<%- data.term%>" class="title">"<%- data.term%>" in Products</a>
<a id="searchPreviewProducts" href="<?= /* @escapeNotVerified */ $block->getUrl('catalog/product/index/') ?>?search=<%- data.term%>" class="title">"<%- data.term%>" in Products</a>
</li>
<li class="item">
<a id="searchPreviewOrders" href="<?= /* @escapeNotVerified */ $block->getURL('sales/order/index/') ?>?search=<%- data.term%>" class="title">"<%- data.term%>" in Orders</a>
<a id="searchPreviewOrders" href="<?= /* @escapeNotVerified */ $block->getUrl('sales/order/index/') ?>?search=<%- data.term%>" class="title">"<%- data.term%>" in Orders</a>
</li>
<li class="item">
<a id="searchPreviewCustomers" href="<?= /* @escapeNotVerified */ $block->getURL('customer/index/index/') ?>?search=<%- data.term%>" class="title">"<%- data.term%>" in Customers</a>
<a id="searchPreviewCustomers" href="<?= /* @escapeNotVerified */ $block->getUrl('customer/index/index/') ?>?search=<%- data.term%>" class="title">"<%- data.term%>" in Customers</a>
</li>
<li class="item">
<a id="searchPreviewPages" href="<?= /* @escapeNotVerified */ $block->getURL('cms/page/index/') ?>?search=<%- data.term%>" class="title">"<%- data.term%>" in Pages</a>
<a id="searchPreviewPages" href="<?= /* @escapeNotVerified */ $block->getUrl('cms/page/index/') ?>?search=<%- data.term%>" class="title">"<%- data.term%>" in Pages</a>
</li>
<% if (data.items.length) { %>
<% _.each(data.items, function(value){ %>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ $numColumns = sizeof($block->getColumns());
<?php if ($block->getPagerVisibility()): ?>
<div class="admin__data-grid-pager-wrap">
<select name="<?= /* @escapeNotVerified */ $block->getVarNameLimit() ?>"
id="<?= $block->escapeHTML($block->getHtmlId()) ?>_page-limit"
id="<?= $block->escapeHtml($block->getHtmlId()) ?>_page-limit"
onchange="<?= /* @escapeNotVerified */ $block->getJsObjectName() ?>.loadByElement(this)"
class="admin__control-select">
<option value="20"<?php if ($block->getCollection()->getPageSize() == 20): ?>
Expand All @@ -91,7 +91,7 @@ $numColumns = sizeof($block->getColumns());
selected="selected"<?php endif; ?>>200
</option>
</select>
<label for="<?= $block->escapeHTML($block->getHtmlId()) ?><?= $block->escapeHTML($block->getHtmlId()) ?>_page-limit"
<label for="<?= $block->escapeHtml($block->getHtmlId()) ?><?= $block->escapeHtml($block->getHtmlId()) ?>_page-limit"
class="admin__control-support-text"><?= /* @escapeNotVerified */ __('per page') ?></label>

<div class="admin__data-grid-pager">
Expand All @@ -107,12 +107,12 @@ $numColumns = sizeof($block->getColumns());
<button type="button" class="action-previous disabled"><span><?= /* @escapeNotVerified */ __('Previous page') ?></span></button>
<?php endif; ?>
<input type="text"
id="<?= $block->escapeHTML($block->getHtmlId()) ?>_page-current"
id="<?= $block->escapeHtml($block->getHtmlId()) ?>_page-current"
name="<?= /* @escapeNotVerified */ $block->getVarNamePage() ?>"
value="<?= /* @escapeNotVerified */ $_curPage ?>"
class="admin__control-text"
onkeypress="<?= /* @escapeNotVerified */ $block->getJsObjectName() ?>.inputPage(event, '<?= /* @escapeNotVerified */ $_lastPage ?>')" <?= /* @escapeNotVerified */ $block->getUiId('current-page') ?> />
<label class="admin__control-support-text" for="<?= $block->escapeHTML($block->getHtmlId()) ?>_page-current">
<label class="admin__control-support-text" for="<?= $block->escapeHtml($block->getHtmlId()) ?>_page-current">
<?= /* @escapeNotVerified */ __('of %1', '<span>' . $block->getCollection()->getLastPageNumber() . '</span>') ?>
</label>
<?php if ($_curPage < $_lastPage): ?>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,6 @@ public function getExtendedElement($switchAttributeCode)
[
'name' => "product[{$switchAttributeCode}]",
'values' => $this->getOptions(),
'value' => $switchAttributeCode,
'class' => 'required-entry next-toinput',
'no_span' => true,
'disabled' => $this->isDisabledField(),
Expand Down
14 changes: 11 additions & 3 deletions app/code/Magento/Catalog/Block/Product/ListProduct.php
Original file line number Diff line number Diff line change
Expand Up @@ -334,13 +334,21 @@ public function prepareSortableFieldsByCategory($category)
public function getIdentities()
{
$identities = [];
foreach ($this->_getProductCollection() as $item) {
$identities = array_merge($identities, $item->getIdentities());
}

$category = $this->getLayer()->getCurrentCategory();
if ($category) {
$identities[] = Product::CACHE_PRODUCT_CATEGORY_TAG . '_' . $category->getId();
}

//Check if category page shows only static block (No products)
if ($category->getData('display_mode') == Category::DM_PAGE) {
return $identities;
}

foreach ($this->_getProductCollection() as $item) {
$identities = array_merge($identities, $item->getIdentities());
}

return $identities;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -689,7 +689,7 @@ public function getWidgetOptionsJson(array $customOptions = [])
'limit' => ToolbarModel::LIMIT_PARAM_NAME,
'modeDefault' => $defaultMode,
'directionDefault' => $this->_direction ?: ProductList::DEFAULT_SORT_DIRECTION,
'orderDefault' => $this->_productListHelper->getDefaultSortField(),
'orderDefault' => $this->getOrderField(),
'limitDefault' => $this->_productListHelper->getDefaultLimitPerPageValue($defaultMode),
'url' => $this->getPagerUrl(),
];
Expand Down
8 changes: 3 additions & 5 deletions app/code/Magento/Catalog/Block/Product/View/Attributes.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,15 +83,13 @@ public function getAdditionalData(array $excludeAttr = [])
if ($attribute->getIsVisibleOnFront() && !in_array($attribute->getAttributeCode(), $excludeAttr)) {
$value = $attribute->getFrontend()->getValue($product);

if (!$product->hasData($attribute->getAttributeCode())) {
$value = __('N/A');
} elseif ((string)$value == '') {
$value = __('No');
if ($value instanceof Phrase) {
$value = (string)$value;
} elseif ($attribute->getFrontendInput() == 'price' && is_string($value)) {
$value = $this->priceCurrency->convertAndFormat($value);
}

if ($value instanceof Phrase || (is_string($value) && strlen($value))) {
if (is_string($value) && strlen($value)) {
$data[$attribute->getAttributeCode()] = [
'label' => __($attribute->getStoreLabel()),
'value' => $value,
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/Catalog/Block/Product/View/Gallery.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ public function getGalleryImagesJson()
'thumb' => $image->getData('small_image_url'),
'img' => $image->getData('medium_image_url'),
'full' => $image->getData('large_image_url'),
'caption' => $image->getLabel(),
'caption' => ($image->getLabel() ?: $this->getProduct()->getName()),
'position' => $image->getPosition(),
'isMain' => $this->isMainImage($image),
'type' => str_replace('external-', '', $image->getMediaType()),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ public function getValuesHtml()
]
);
if ($_option->getType() == \Magento\Catalog\Api\Data\ProductCustomOptionInterface::OPTION_TYPE_DROP_DOWN) {
$select->setName('options[' . $_option->getid() . ']')->addOption('', __('-- Please Select --'));
$select->setName('options[' . $_option->getId() . ']')->addOption('', __('-- Please Select --'));
} else {
$select->setName('options[' . $_option->getid() . '][]');
$select->setName('options[' . $_option->getId() . '][]');
$select->setClass('multiselect admin__control-multiselect' . $require . ' product-custom-option');
}
foreach ($_option->getValues() as $_value) {
Expand Down
28 changes: 20 additions & 8 deletions app/code/Magento/Catalog/Console/Command/ImagesResizeCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
*/
namespace Magento\Catalog\Console\Command;

use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;

class ImagesResizeCommand extends \Symfony\Component\Console\Command\Command
{
/**
Expand Down Expand Up @@ -58,10 +61,8 @@ protected function configure()
/**
* {@inheritdoc}
*/
protected function execute(
\Symfony\Component\Console\Input\InputInterface $input,
\Symfony\Component\Console\Output\OutputInterface $output
) {
protected function execute(InputInterface $input, OutputInterface $output)
{
$this->appState->setAreaCode(\Magento\Framework\App\Area::AREA_GLOBAL);

/** @var \Magento\Catalog\Model\ResourceModel\Product\Collection $productCollection */
Expand All @@ -73,6 +74,7 @@ protected function execute(
return \Magento\Framework\Console\Cli::RETURN_SUCCESS;
}

$errorMessage = '';
try {
foreach ($productIds as $productId) {
try {
Expand All @@ -82,9 +84,13 @@ protected function execute(
continue;
}

/** @var \Magento\Catalog\Model\Product\Image\Cache $imageCache */
$imageCache = $this->imageCacheFactory->create();
$imageCache->generate($product);
try {
/** @var \Magento\Catalog\Model\Product\Image\Cache $imageCache */
$imageCache = $this->imageCacheFactory->create();
$imageCache->generate($product);
} catch (\Magento\Framework\Exception\RuntimeException $e) {
$errorMessage = $e->getMessage();
}

$output->write(".");
}
Expand All @@ -95,6 +101,12 @@ protected function execute(
}

$output->write("\n");
$output->writeln("<info>Product images resized successfully</info>");
$output->writeln("<info>Product images resized successfully.</info>");

if ($errorMessage !== '') {
$output->writeln("<comment>{$errorMessage}</comment>");
}

return 0;
}
}
Loading

0 comments on commit 53c1fa3

Please sign in to comment.