-
Notifications
You must be signed in to change notification settings - Fork 9.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #125 from magento-nord/EPAM-SPRINT-13
[Nord] Epam Sprint 13
- Loading branch information
Showing
43 changed files
with
522 additions
and
94 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?php | ||
/** | ||
* Copyright © 2016 Magento. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
namespace Magento\Catalog\Block\Product; | ||
|
||
/** | ||
* Class Product Aware interface | ||
*/ | ||
interface AwareInterface | ||
{ | ||
/** | ||
* Set product | ||
* | ||
* @param \Magento\Catalog\Api\Data\ProductInterface $product | ||
* @return $this | ||
*/ | ||
public function setProduct(\Magento\Catalog\Api\Data\ProductInterface $product); | ||
} |
20 changes: 20 additions & 0 deletions
20
app/code/Magento/Catalog/Block/Product/ProductList/Item/AddTo/Compare.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?php | ||
/** | ||
* Copyright © 2016 Magento. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
namespace Magento\Catalog\Block\Product\ProductList\Item\AddTo; | ||
|
||
/** | ||
* Add product to compare | ||
*/ | ||
class Compare extends \Magento\Catalog\Block\Product\ProductList\Item\Block | ||
{ | ||
/** | ||
* @return \Magento\Catalog\Helper\Product\Compare | ||
*/ | ||
public function getCompareHelper() | ||
{ | ||
return $this->_compareProduct; | ||
} | ||
} |
38 changes: 38 additions & 0 deletions
38
app/code/Magento/Catalog/Block/Product/ProductList/Item/Block.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<?php | ||
/** | ||
* Copyright © 2016 Magento. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
namespace Magento\Catalog\Block\Product\ProductList\Item; | ||
|
||
use Magento\Catalog\Api\Data\ProductInterface; | ||
use Magento\Catalog\Block\Product\AbstractProduct; | ||
use Magento\Catalog\Block\Product\AwareInterface as ProductAwareInterface; | ||
|
||
/** | ||
* Class List Item Block | ||
*/ | ||
class Block extends AbstractProduct implements ProductAwareInterface | ||
{ | ||
/** | ||
* @var ProductInterface | ||
*/ | ||
private $product; | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function setProduct(ProductInterface $product) | ||
{ | ||
$this->product = $product; | ||
return $this; | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function getProduct() | ||
{ | ||
return $this->product; | ||
} | ||
} |
31 changes: 31 additions & 0 deletions
31
app/code/Magento/Catalog/Block/Product/ProductList/Item/Container.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?php | ||
/** | ||
* Copyright © 2016 Magento. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
namespace Magento\Catalog\Block\Product\ProductList\Item; | ||
|
||
use Magento\Catalog\Block\Product\AwareInterface as ProductAwareInterface; | ||
|
||
/** | ||
* Class List Item Block Container | ||
*/ | ||
class Container extends Block | ||
{ | ||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function getChildHtml($alias = '', $useCache = false) | ||
{ | ||
$layout = $this->getLayout(); | ||
if ($layout) { | ||
$name = $this->getNameInLayout(); | ||
foreach ($layout->getChildBlocks($name) as $child) { | ||
if ($child instanceof ProductAwareInterface) { | ||
$child->setProduct($this->getProduct()); | ||
} | ||
} | ||
} | ||
return parent::getChildHtml($alias, $useCache); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
app/code/Magento/Catalog/Block/Product/View/AddTo/Compare.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?php | ||
/** | ||
* Copyright © 2016 Magento. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
|
||
namespace Magento\Catalog\Block\Product\View\AddTo; | ||
|
||
/** | ||
* Product view compare block | ||
*/ | ||
class Compare extends \Magento\Catalog\Block\Product\View | ||
{ | ||
/** | ||
* Return compare params | ||
* | ||
* @return string | ||
*/ | ||
public function getPostDataParams() | ||
{ | ||
$product = $this->getProduct(); | ||
return $this->_compareProduct->getPostDataParams($product); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
app/code/Magento/Catalog/view/frontend/templates/product/list/addto/compare.phtml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?php | ||
/** | ||
* Copyright © 2016 Magento. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
|
||
// @codingStandardsIgnoreFile | ||
/** @var $block Magento\Catalog\Block\Product\ProductList\Item\AddTo\Compare */ | ||
?> | ||
<a href="#" | ||
class="action tocompare" | ||
title="<?php echo $block->escapeHtml(__('Add to Compare')); ?>" | ||
aria-label="<?php echo $block->escapeHtml(__('Add to Compare')); ?>" | ||
data-post='<?php /* @escapeNotVerified */ echo $block->getCompareHelper()->getPostDataParams($block->getProduct()); ?>' | ||
role="button"> | ||
<span><?php /* @escapeNotVerified */ echo __('Add to Compare') ?></span> | ||
</a> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
app/code/Magento/Catalog/view/frontend/templates/product/view/addto/compare.phtml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<?php | ||
/** | ||
* Copyright © 2016 Magento. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
|
||
// @codingStandardsIgnoreFile | ||
|
||
/** @var $block \Magento\Catalog\Block\Catalog\Product\View\Addto\Compare */ | ||
?> | ||
|
||
<a href="#" data-post='<?php /* @escapeNotVerified */ echo $block->getPostDataParams();?>' | ||
data-role="add-to-links" | ||
class="action tocompare"><span><?php /* @escapeNotVerified */ echo __('Add to Compare') ?></span></a> |
Oops, something went wrong.