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