Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <body>
- <referenceContainer name="product.info.social">
- <block class="MagentoFrameworkViewElementTemplate" name="product.info.custom" template="Lapisbard_Product::social.phtml" after="product.info.addtocart">
- </block>
- </referenceContainer>
- </body>
- <p>Hey there !</p>
- <?php //$_product = $block->getProduct();
- <?php
- namespace TestCatalogBlockProductView;
- use MagentoCatalogBlockProductAbstractProduct;
- class Extra extends AbstractProduct
- {
- }
- <?xml version="1.0"?>
- <body>
- <referenceContainer name="product.info.social">
- <block class="TestCatalogBlockProductViewExtra"
- name="product.view.extra"
- template="Test_Catalog::product/view/extra.phtml"
- after="-">
- </block>
- </referenceContainer>
- </body>
- <?php /* @var $block TestCatalogBlockProductViewExtra */?>
- <?php $_product = $block->getProduct() ?>
- <h3><?php echo 'My Product Name Is: ' . $_product->getName(); ?></h3>
- public function getSomething()
- {
- return 'something'
- }
- <?php echo $block->getSomething() ?>
- /**
- * Class AbstractProduct
- * @api
- * @deprecated 101.1.0
- * @SuppressWarnings(PHPMD.NumberOfChildren)
- * @SuppressWarnings(PHPMD.CouplingBetweenObjects)
- * @since 100.0.2
- */
- class AbstractProduct extends MagentoFrameworkViewElementTemplate
- <?php
- namespace VendorModuleBlock;
- use MagentoFrameworkViewElementTemplate;
- use MagentoFrameworkRegistry;
- class ProductView extends Template
- {
- /**
- * @var Registry
- */
- protected $registry;
- /**
- * @var MagentoCatalogModelProduct
- */
- protected $product;
- /**
- * ProductView constructor.
- * @param TemplateContext $context
- * @param array $data
- * @param Registry $registry
- */
- public function __construct(
- TemplateContext $context,
- array $data = [],
- Registry $registry
- )
- {
- $this->registry = $registry;
- parent::__construct($context, $data);
- }
- /**
- * @return MagentoCatalogModelProduct
- */
- public function getProduct()
- {
- if (is_null($this->product)) {
- $this->product = $this->registry->registry('product');
- }
- return $this->product;
- }
- }
Add Comment
Please, Sign In to add comment