Skip to content

Commit

Permalink
MAGETWO-85285: 12482: Sitemap image links in MultiStore #935
Browse files Browse the repository at this point in the history
 - Merge Pull Request magento-engcom/magento2ce#935 from RomaKis/magento2:12482
 - Merged commits:
   1. 8e426fe
  • Loading branch information
ishakhsuvarov committed Dec 11, 2017
2 parents b05a957 + 8e426fe commit 84e49c8
Show file tree
Hide file tree
Showing 109 changed files with 2,863 additions and 700 deletions.
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,10 @@ To suggest documentation improvements, click [here][4].
| ![reject](http://devdocs.magento.com/common/images/github_reject.png) | The pull request has been rejected and will not be merged into mainline code. Possible reasons can include but are not limited to: issue has already been fixed in another code contribution, or there is an issue with the code contribution. |
| ![bug report](http://devdocs.magento.com/common/images/github_bug.png) | The Magento Team has confirmed that this issue contains the minimum required information to reproduce. |
| ![acknowledged](http://devdocs.magento.com/common/images/gitHub_acknowledged.png) | The Magento Team has validated the issue and an internal ticket has been created. |
| ![acknowledged](http://devdocs.magento.com/common/images/github_inProgress.png) | The internal ticket is currently in progress, fix is scheduled to be delivered. |
| ![acknowledged](http://devdocs.magento.com/common/images/github_needsUpdate.png) | The Magento Team needs additional information from the reporter to properly prioritize and process the issue or pull request. |
| ![in progress](http://devdocs.magento.com/common/images/github_inProgress.png) | The internal ticket is currently in progress, fix is scheduled to be delivered. |
| ![needs update](http://devdocs.magento.com/common/images/github_needsUpdate.png) | The Magento Team needs additional information from the reporter to properly prioritize and process the issue or pull request. |

To learn more about issue gate labels click [here](https://github.com/magento/magento2/wiki/Magento-Issue-Gates)

<h2>Reporting security issues</h2>

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>
2 changes: 1 addition & 1 deletion app/code/Magento/Backend/Block/Dashboard/Orders/Grid.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ protected function _prepareCollection()
protected function _afterLoadCollection()
{
foreach ($this->getCollection() as $item) {
$item->getCustomer() ?: $item->setCustomer('Guest');
$item->getCustomer() ?: $item->setCustomer($item->getBillingAddress()->getName());
}
return $this;
}
Expand Down
4 changes: 2 additions & 2 deletions app/code/Magento/Captcha/i18n/en_US.csv
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ Always,Always
"Incorrect CAPTCHA","Incorrect CAPTCHA"
"Incorrect CAPTCHA.","Incorrect CAPTCHA."
"The account is locked. Please wait and try again or contact %1.","The account is locked. Please wait and try again or contact %1."
"Please enter the letters from the image","Please enter the letters from the image"
"Please enter the letters and numbers from the image","Please enter the letters and numbers from the image"
"<strong>Attention</strong>: Captcha is case sensitive.","<strong>Attention</strong>: Captcha is case sensitive."
"Reload captcha","Reload captcha"
"Please type the letters below","Please type the letters below"
"Please type the letters and numbers below","Please type the letters and numbers below"
"Attention: Captcha is case sensitive.","Attention: Captcha is case sensitive."
CAPTCHA,CAPTCHA
"Enable CAPTCHA in Admin","Enable CAPTCHA in Admin"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ $captcha = $block->getCaptchaModel();
?>
<div class="admin__field _required">
<label for="captcha" class="admin__field-label">
<span><?= $block->escapeHtml(__('Please enter the letters from the image')) ?></span>
<span><?= $block->escapeHtml(__('Please enter the letters and numbers from the image')) ?></span>
</label>
<div class="admin__field-control">
<input
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
$captcha = $block->getCaptchaModel();
?>
<div class="field captcha required" role="<?= $block->escapeHtmlAttr($block->getFormId()) ?>">
<label for="captcha_<?= $block->escapeHtmlAttr($block->getFormId()) ?>" class="label"><span><?= $block->escapeHtml(__('Please type the letters below')) ?></span></label>
<label for="captcha_<?= $block->escapeHtmlAttr($block->getFormId()) ?>" class="label"><span><?= $block->escapeHtml(__('Please type the letters and numbers below')) ?></span></label>
<div class="control captcha">
<input name="<?= $block->escapeHtmlAttr(\Magento\Captcha\Helper\Data::INPUT_NAME_FIELD_VALUE) ?>[<?= $block->escapeHtmlAttr($block->getFormId()) ?>]" type="text" class="input-text required-entry" data-validate="{required:true}" id="captcha_<?= $block->escapeHtmlAttr($block->getFormId()) ?>" />
<div class="nested">
Expand All @@ -23,7 +23,7 @@ $captcha = $block->getCaptchaModel();
"imageLoader": "<?= $block->escapeUrl($block->getViewFileUrl('images/loader-2.gif')) ?>",
"type": "<?= $block->escapeHtmlAttr($block->getFormId()) ?>"}}'>
<div class="control captcha-image">
<img alt="<?= $block->escapeHtmlAttr(__('Please type the letters below')) ?>" class="captcha-img" height="<?= /* @noEscape */ (float) $block->getImgHeight() ?>" src="<?= $block->escapeUrl($captcha->getImgSrc()) ?>"/>
<img alt="<?= $block->escapeHtmlAttr(__('Please type the letters and numbers below')) ?>" class="captcha-img" height="<?= /* @noEscape */ (float) $block->getImgHeight() ?>" src="<?= $block->escapeUrl($captcha->getImgSrc()) ?>"/>
<button type="button" class="action reload captcha-reload" title="<?= $block->escapeHtmlAttr(__('Reload captcha')) ?>"><span><?= $block->escapeHtml(__('Reload captcha')) ?></span></button>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@
-->
<!-- ko if: (isRequired() && getIsVisible())-->
<div class="field captcha required" data-bind="blockLoader: getIsLoading()">
<label data-bind="attr: {for: 'captcha_' + formId}" class="label"><span data-bind="i18n: 'Please type the letters below'"></span></label>
<label data-bind="attr: {for: 'captcha_' + formId}" class="label"><span data-bind="i18n: 'Please type the letters and numbers below'"></span></label>
<div class="control captcha">
<input name="captcha_string" type="text" class="input-text required-entry" data-bind="value: captchaValue(), attr: {id: 'captcha_' + formId, 'data-scope': dataScope}" />
<input name="captcha_form_id" type="hidden" data-bind="value: formId, attr: {'data-scope': dataScope}" />
<div class="nested">
<div class="field captcha no-label">
<div class="control captcha-image">
<img data-bind="attr: {
alt: $t('Please type the letters below'),
alt: $t('Please type the letters and numbers below'),
height: imageHeight(),
src: getImageSource(),
}"
Expand Down
140 changes: 104 additions & 36 deletions app/code/Magento/Catalog/Block/Product/ListProduct.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,20 @@
use Magento\Catalog\Api\CategoryRepositoryInterface;
use Magento\Catalog\Block\Product\ProductList\Toolbar;
use Magento\Catalog\Model\Category;
use Magento\Catalog\Model\Config;
use Magento\Catalog\Model\Layer;
use Magento\Catalog\Model\Layer\Resolver;
use Magento\Catalog\Model\Product;
use Magento\Catalog\Model\ResourceModel\Product\Collection;
use Magento\Catalog\Pricing\Price\FinalPrice;
use Magento\Eav\Model\Entity\Collection\AbstractCollection;
use Magento\Framework\App\ActionInterface;
use Magento\Framework\App\Config\Element;
use Magento\Framework\Data\Helper\PostHelper;
use Magento\Framework\DataObject\IdentityInterface;
use Magento\Framework\Exception\NoSuchEntityException;
use Magento\Framework\Pricing\Render;
use Magento\Framework\Url\Helper\Data;

/**
* Product list
Expand All @@ -40,17 +49,17 @@ class ListProduct extends AbstractProduct implements IdentityInterface
/**
* Catalog layer
*
* @var \Magento\Catalog\Model\Layer
* @var Layer
*/
protected $_catalogLayer;

/**
* @var \Magento\Framework\Data\Helper\PostHelper
* @var PostHelper
*/
protected $_postDataHelper;

/**
* @var \Magento\Framework\Url\Helper\Data
* @var Data
*/
protected $urlHelper;

Expand All @@ -61,18 +70,18 @@ class ListProduct extends AbstractProduct implements IdentityInterface

/**
* @param Context $context
* @param \Magento\Framework\Data\Helper\PostHelper $postDataHelper
* @param \Magento\Catalog\Model\Layer\Resolver $layerResolver
* @param PostHelper $postDataHelper
* @param Resolver $layerResolver
* @param CategoryRepositoryInterface $categoryRepository
* @param \Magento\Framework\Url\Helper\Data $urlHelper
* @param Data $urlHelper
* @param array $data
*/
public function __construct(
\Magento\Catalog\Block\Product\Context $context,
\Magento\Framework\Data\Helper\PostHelper $postDataHelper,
\Magento\Catalog\Model\Layer\Resolver $layerResolver,
Context $context,
PostHelper $postDataHelper,
Resolver $layerResolver,
CategoryRepositoryInterface $categoryRepository,
\Magento\Framework\Url\Helper\Data $urlHelper,
Data $urlHelper,
array $data = []
) {
$this->_catalogLayer = $layerResolver->get();
Expand Down Expand Up @@ -113,7 +122,7 @@ protected function _getProductCollection()
/**
* Get catalog layer model
*
* @return \Magento\Catalog\Model\Layer
* @return Layer
*/
public function getLayer()
{
Expand All @@ -137,7 +146,35 @@ public function getLoadedProductCollection()
*/
public function getMode()
{
return $this->getChildBlock('toolbar')->getCurrentMode();
if ($this->getChildBlock('toolbar')) {
return $this->getChildBlock('toolbar')->getCurrentMode();
}

return $this->getDefaultListingMode();
}

/**
* Get listing mode for products if toolbar is removed from layout.
* Use the general configuration for product list mode from config path catalog/frontend/list_mode as default value
* or mode data from block declaration from layout.
*
* @return string
*/
private function getDefaultListingMode()
{
// default Toolbar when the toolbar layout is not used
$defaultToolbar = $this->getToolbarBlock();
$availableModes = $defaultToolbar->getModes();

// layout config mode
$mode = $this->getData('mode');

if (!$mode || !isset($availableModes[$mode])) {
// default config mode
$mode = $defaultToolbar->getCurrentMode();
}

return $mode;
}

/**
Expand All @@ -148,28 +185,60 @@ public function getMode()
protected function _beforeToHtml()
{
$collection = $this->_getProductCollection();
$this->configureToolbar($this->getToolbarBlock(), $collection);

$this->addToolbarBlock($collection);

$collection->load();

return parent::_beforeToHtml();
}

/**
* Retrieve Toolbar block
* Add toolbar block from product listing layout
*
* @param Collection $collection
*/
private function addToolbarBlock(Collection $collection)
{
$toolbarLayout = $this->getToolbarFromLayout();

if ($toolbarLayout) {
$this->configureToolbar($toolbarLayout, $collection);
}
}

/**
* Retrieve Toolbar block from layout or a default Toolbar
*
* @return Toolbar
*/
public function getToolbarBlock()
{
$block = $this->getToolbarFromLayout();

if (!$block) {
$block = $this->getLayout()->createBlock($this->_defaultToolbarBlock, uniqid(microtime()));
}

return $block;
}

/**
* Get toolbar block from layout
*
* @return bool|Toolbar
*/
private function getToolbarFromLayout()
{
$blockName = $this->getToolbarBlockName();

$toolbarLayout = false;

if ($blockName) {
$block = $this->getLayout()->getBlock($blockName);
if ($block) {
return $block;
}
$toolbarLayout = $this->getLayout()->getBlock($blockName);
}
$block = $this->getLayout()->createBlock($this->_defaultToolbarBlock, uniqid(microtime()));
return $block;

return $toolbarLayout;
}

/**
Expand Down Expand Up @@ -203,7 +272,7 @@ public function setCollection($collection)
}

/**
* @param array|string|integer|\Magento\Framework\App\Config\Element $code
* @param array|string|integer| Element $code
* @return $this
*/
public function addAttribute($code)
Expand All @@ -223,7 +292,7 @@ public function getPriceBlockTemplate()
/**
* Retrieve Catalog Config object
*
* @return \Magento\Catalog\Model\Config
* @return Config
*/
protected function _getConfig()
{
Expand All @@ -233,8 +302,8 @@ protected function _getConfig()
/**
* Prepare Sort By fields from Category Data
*
* @param \Magento\Catalog\Model\Category $category
* @return \Magento\Catalog\Block\Product\ListProduct
* @param Category $category
* @return $this
*/
public function prepareSortableFieldsByCategory($category)
{
Expand Down Expand Up @@ -278,38 +347,38 @@ public function getIdentities()
/**
* Get post parameters
*
* @param \Magento\Catalog\Model\Product $product
* @param Product $product
* @return string
*/
public function getAddToCartPostParams(\Magento\Catalog\Model\Product $product)
public function getAddToCartPostParams(Product $product)
{
$url = $this->getAddToCartUrl($product);
return [
'action' => $url,
'data' => [
'product' => $product->getEntityId(),
\Magento\Framework\App\ActionInterface::PARAM_NAME_URL_ENCODED => $this->urlHelper->getEncodedUrl($url),
ActionInterface::PARAM_NAME_URL_ENCODED => $this->urlHelper->getEncodedUrl($url),
]
];
}

/**
* @param \Magento\Catalog\Model\Product $product
* @param Product $product
* @return string
*/
public function getProductPrice(\Magento\Catalog\Model\Product $product)
public function getProductPrice(Product $product)
{
$priceRender = $this->getPriceRender();

$price = '';
if ($priceRender) {
$price = $priceRender->render(
\Magento\Catalog\Pricing\Price\FinalPrice::PRICE_CODE,
FinalPrice::PRICE_CODE,
$product,
[
'include_container' => true,
'display_minimal_price' => true,
'zone' => \Magento\Framework\Pricing\Render::ZONE_ITEM_LIST,
'zone' => Render::ZONE_ITEM_LIST,
'list_category_page' => true
]
);
Expand All @@ -322,7 +391,7 @@ public function getProductPrice(\Magento\Catalog\Model\Product $product)
* Specifies that price rendering should be done for the list of products
* i.e. rendering happens in the scope of product list, but not single product
*
* @return \Magento\Framework\Pricing\Render
* @return Render
*/
protected function getPriceRender()
{
Expand All @@ -348,7 +417,7 @@ protected function getPriceRender()
private function initializeProductCollection()
{
$layer = $this->getLayer();
/* @var $layer \Magento\Catalog\Model\Layer */
/* @var $layer Layer */
if ($this->getShowRootCategory()) {
$this->setCategoryId($this->_storeManager->getStore()->getRootCategoryId());
}
Expand Down Expand Up @@ -386,9 +455,8 @@ private function initializeProductCollection()
if ($origCategory) {
$layer->setCurrentCategory($origCategory);
}

$toolbar = $this->getToolbarBlock();
$this->configureToolbar($toolbar, $collection);

$this->addToolbarBlock($collection);

$this->_eventManager->dispatch(
'catalog_block_product_list_collection',
Expand Down
Loading

0 comments on commit 84e49c8

Please sign in to comment.