Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
cart.phtml
Go to the documentation of this file.
1 <?php
7 // @codingStandardsIgnoreFile
8 
12 $item = $block->getItem();
13 $product = $item->getProduct();
14 ?>
15 <?php foreach ($block->getChildNames() as $childName): ?>
16  <?= /* @noEscape */ $block->getLayout()->renderElement($childName, false) ?>
17 <?php endforeach;?>
18 <div class="box-tocart">
19  <fieldset class="fieldset">
20  <?php if ($item->canHaveQty() && $product->isVisibleInSiteVisibility()): ?>
21  <div class="field qty">
22  <label class="label" for="qty[<?= $block->escapeHtmlAttr($item->getId()) ?>]"><span><?= $block->escapeHtml(__('Qty')) ?></span></label>
23  <div class="control">
24  <input type="number" data-role="qty" id="qty[<?= $block->escapeHtmlAttr($item->getId()) ?>]" class="input-text qty" data-validate="{'required-number':true,'validate-greater-than-zero':true}"
25  name="qty[<?= $block->escapeHtmlAttr($item->getId()) ?>]" value="<?= /* @noEscape */ (int)($block->getAddToCartQty($item) * 1) ?>">
26  </div>
27  </div>
28  <?php endif; ?>
29  <?php if ($product->isSaleable()): ?>
30  <div class="product-item-actions">
31  <div class="actions-primary">
32  <button type="button" data-role="tocart" data-post='<?= /* @noEscape */ $block->getItemAddToCartParams($item) ?>' title="<?= $block->escapeHtmlAttr(__('Add to Cart')) ?>" data-item-id="<?= $block->escapeHtmlAttr($item->getId()) ?>" class="action tocart primary">
33  <span><?= $block->escapeHtml(__('Add to Cart')) ?></span>
34  </button>
35  </div>
36  </div>
37  <?php else: ?>
38  <?php if ($product->getIsSalable()): ?>
39  <p class="available stock" title="<?= $block->escapeHtmlAttr(__('Availability')) ?>">
40  <span><?= $block->escapeHtml(__('In stock')) ?></span>
41  </p>
42  <?php else: ?>
43  <p class="unavailable stock" title="<?= $block->escapeHtmlAttr(__('Availability')) ?>">
44  <span><?= $block->escapeHtml(__('Out of stock')) ?></span>
45  </p>
46  <?php endif; ?>
47  <?php endif; ?>
48  </fieldset>
49 </div>
$block setTitle( 'CMS Block Title') -> setIdentifier('fixture_block') ->setContent('< h1 >Fixture Block Title</h1 >< a href=" store url</a><p> Config value
Definition: block.php:9
$item
Definition: cart.phtml:12
foreach( $this->main as $item) endforeach
Definition: side-menu.phtml:10
__()
Definition: __.php:13
$block
Definition: block.php:8
if( $item->canHaveQty() &&$product->isVisibleInSiteVisibility())( $item->getId()) ?>]"><span><? endif
Definition: cart.phtml:25
$product
Definition: cart.phtml:13