-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ENGCOM-7062: #27124: Update wishlist image logic to match logic on wi…
…shlist page #27125
- Loading branch information
Showing
2 changed files
with
63 additions
and
16 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 |
---|---|---|
|
@@ -4,29 +4,73 @@ | |
* See COPYING.txt for license details. | ||
*/ | ||
|
||
/** | ||
* Wishlist block customer items | ||
* | ||
* @author Magento Core Team <[email protected]> | ||
*/ | ||
namespace Magento\Wishlist\Block\Share\Email; | ||
|
||
use Magento\Catalog\Model\Product; | ||
use Magento\Catalog\Model\Product\Configuration\Item\ItemResolverInterface; | ||
use Magento\Catalog\Model\Product\Image\UrlBuilder; | ||
use Magento\Framework\App\ObjectManager; | ||
use Magento\Framework\View\ConfigInterface; | ||
use Magento\Wishlist\Model\Item; | ||
|
||
/** | ||
* Wishlist share items | ||
* | ||
* @api | ||
* @since 100.0.2 | ||
*/ | ||
class Items extends \Magento\Wishlist\Block\AbstractBlock | ||
{ | ||
/** | ||
* @var ItemResolverInterface | ||
*/ | ||
private $itemResolver; | ||
|
||
/** | ||
* @var string | ||
*/ | ||
protected $_template = 'Magento_Wishlist::email/items.phtml'; | ||
|
||
/** | ||
* Items constructor. | ||
* | ||
* @param \Magento\Catalog\Block\Product\Context $context | ||
* @param \Magento\Framework\App\Http\Context $httpContext | ||
* @param array $data | ||
* @param ConfigInterface|null $config | ||
* @param UrlBuilder|null $urlBuilder | ||
* @param ItemResolverInterface|null $itemResolver | ||
*/ | ||
public function __construct( | ||
\Magento\Catalog\Block\Product\Context $context, | ||
\Magento\Framework\App\Http\Context $httpContext, | ||
array $data = [], | ||
ConfigInterface $config = null, | ||
UrlBuilder $urlBuilder = null, | ||
ItemResolverInterface $itemResolver = null | ||
) { | ||
parent::__construct($context, $httpContext, $data, $config, $urlBuilder); | ||
$this->itemResolver = $itemResolver ?? ObjectManager::getInstance()->get(ItemResolverInterface::class); | ||
} | ||
|
||
/** | ||
* Identify the product from which thumbnail should be taken. | ||
* | ||
* @param Item $item | ||
* | ||
* @return Product | ||
*/ | ||
public function getProductForThumbnail(Item $item): Product | ||
{ | ||
return $this->itemResolver->getFinalProduct($item); | ||
} | ||
|
||
/** | ||
* Retrieve Product View URL | ||
* | ||
* @param \Magento\Catalog\Model\Product $product | ||
* @param array $additional | ||
* | ||
* @return string | ||
*/ | ||
public function getProductUrl($product, $additional = []) | ||
|
@@ -40,6 +84,7 @@ public function getProductUrl($product, $additional = []) | |
* | ||
* @param \Magento\Catalog\Model\Product $product | ||
* @param array $additional | ||
* | ||
* @return string | ||
*/ | ||
public function getAddToCartUrl($product, $additional = []) | ||
|
@@ -53,6 +98,7 @@ public function getAddToCartUrl($product, $additional = []) | |
* Check whether wishlist item has description | ||
* | ||
* @param \Magento\Wishlist\Model\Item $item | ||
* | ||
* @return bool | ||
*/ | ||
public function hasDescription($item) | ||
|
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