Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
compared_default_list.phtml
Go to the documentation of this file.
1 <?php
7 // @codingStandardsIgnoreFile
8 
9 ?>
10 <?php
11 if ($exist = $block->getRecentlyComparedProducts()) {
12  $type = 'widget-compared';
13  $mode = 'list';
14 
15  $type = $type . '-' . $mode;
16 
17  $image = 'recently_compared_products_images_names_widget';
18  $title = __('Recently Compared');
19  $items = $exist;
20 
21  $showWishlist = false;
22  $showCompare = false;
23  $showCart = false;
24  $rating = false;
25  $description = false;
26 }
27 ?>
28 <?php if ($exist): ?>
29 <div class="block widget block-compared-products-<?= /* @escapeNotVerified */ $mode ?>">
30  <div class="block-title">
31  <strong><?= /* @escapeNotVerified */ $title ?></strong>
32  </div>
33  <div class="block-content">
34  <?php $suffix = $block->getNameInLayout(); ?>
35  <ol class="product-items" id="widget-compared-<?= /* @escapeNotVerified */ $suffix ?>">
36  <?php foreach ($items as $_product): ?>
37  <li class="product-item">
38  <div class="product-item-info">
39  <a class="product-item-photo" href="<?= /* @escapeNotVerified */ $_product->getProductUrl() ?>"
40  title="<?= /* @escapeNotVerified */ $block->stripTags($_product->getName(), null, true) ?>">
41  <?= $block->getImage($_product, $image)->toHtml() ?>
42  </a>
43  <div class="product-item-details">
44  <strong class="product-item-name">
45  <a href="<?= /* @escapeNotVerified */ $_product->getProductUrl() ?>"
46  title="<?= /* @escapeNotVerified */ $block->stripTags($_product->getName(), null, true) ?>)">
47  <?= /* @escapeNotVerified */ $this->helper('Magento\Catalog\Helper\Output')->productAttribute($_product, $_product->getName(), 'name') ?>
48  </a>
49  </strong>
50  <?php /* @escapeNotVerified */ echo $block->getProductPriceHtml(
51  $_product,
52  \Magento\Catalog\Pricing\Price\FinalPrice::PRICE_CODE,
53  \Magento\Framework\Pricing\Render::ZONE_ITEM_LIST,
54  [
55  'price_id_suffix' => '-widget-compared-' . $suffix
56  ]
57  ) ?>
58  <div class="product-item-actions">
59  <?php if ($_product->isSaleable()): ?>
60  <div class="actions-primary">
61  <?php if ($_product->getTypeInstance()->hasRequiredOptions($_product)): ?>
62  <button class="action tocart primary"
63  data-mage-init='{"redirectUrl": {"url": "<?= /* @escapeNotVerified */ $block->getAddToCartUrl($_product) ?>"}}'
64  type="button" title="<?= /* @escapeNotVerified */ __('Add to Cart') ?>">
65  <span><?= /* @escapeNotVerified */ __('Add to Cart') ?></span>
66  </button>
67  <?php else: ?>
68  <?php
69  $postDataHelper = $this->helper('Magento\Framework\Data\Helper\PostHelper');
70  $postData = $postDataHelper->getPostData($block->getAddToCartUrl($_product), ['product' => $_product->getEntityId()])
71  ?>
72  <button class="action tocart primary"
73  data-post='<?= /* @escapeNotVerified */ $postData ?>'
74  type="button" title="<?= /* @escapeNotVerified */ __('Add to Cart') ?>">
75  <span><?= /* @escapeNotVerified */ __('Add to Cart') ?></span>
76  </button>
77  <?php endif; ?>
78  </div>
79  <?php else: ?>
80  <?php if ($_product->getIsSalable()): ?>
81  <div class="stock available"><span><?= /* @escapeNotVerified */ __('In stock') ?></span></div>
82  <?php else: ?>
83  <div class="stock unavailable"><span><?= /* @escapeNotVerified */ __('Out of stock') ?></span></div>
84  <?php endif; ?>
85  <?php endif; ?>
86  </div>
87  </div>
88  </div>
89  </li>
90  <?php endforeach; ?>
91  </ol>
92  </div>
93 </div>
94 <?php endif; ?>
$title
Definition: default.phtml:14
$suffix
Definition: name.phtml:27
$postData endif
if( $form)() ?>< script > require(['jquery' mage mage
Definition: save.phtml:15
__()
Definition: __.php:13
$rating
Definition: item.phtml:18
$_product
Definition: summary.phtml:12
$block
Definition: block.php:8
$type
Definition: item.phtml:13
$showCompare
Definition: grid.phtml:21
if($exist=($block->getProductCollection() && $block->getProductCollection() ->getSize())) $mode
Definition: grid.phtml:15
$showCart
Definition: grid.phtml:22
$showWishlist
Definition: grid.phtml:20
$items