Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
addtocart.phtml
Go to the documentation of this file.
1 <?php
7 // @codingStandardsIgnoreFile
8 
10 ?>
11 <?php $_product = $block->getProduct(); ?>
12 <?php $buttonTitle = __('Add to Cart'); ?>
13 <?php if ($_product->isSaleable()): ?>
14 <div class="box-tocart">
15  <div class="fieldset">
16  <?php if ($block->shouldRenderQuantity()): ?>
17  <div class="field qty">
18  <label class="label" for="qty"><span><?= /* @escapeNotVerified */ __('Qty') ?></span></label>
19  <div class="control">
20  <input type="number"
21  name="qty"
22  id="qty"
23  value="<?= /* @escapeNotVerified */ $block->getProductDefaultQty() * 1 ?>"
24  title="<?= /* @escapeNotVerified */ __('Qty') ?>"
25  class="input-text qty"
26  data-validate="<?= $block->escapeHtml(json_encode($block->getQuantityValidators())) ?>"
27  />
28  </div>
29  </div>
30  <?php endif; ?>
31  <div class="actions">
32  <button type="submit"
33  title="<?= /* @escapeNotVerified */ $buttonTitle ?>"
34  class="action primary tocart"
35  id="product-addtocart-button">
36  <span><?= /* @escapeNotVerified */ $buttonTitle ?></span>
37  </button>
38  <?= $block->getChildHtml('', true) ?>
39  </div>
40  </div>
41 </div>
42 <?php endif; ?>
43 <script type="text/x-magento-init">
44  {
45  "#product_addtocart_form": {
46  "Magento_Catalog/js/validate-product": {}
47  }
48  }
49 </script>
$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
$buttonTitle
Definition: addtocart.phtml:12
__()
Definition: __.php:13
$_product
Definition: addtocart.phtml:11
$block
Definition: block.php:8
endif
Definition: addtocart.phtml:38