// get product by product id
<?php
$productId = 1;
$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$currentproduct = $objectManager->create('Magento\Catalog\Model\Product')->load($productId);
echo $currentproduct->getName();
?>
// Get current product data
<?php
$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$product = $objectManager->get('Magento\Framework\Registry')->registry('current_product');//get current product
echo $product->getId();
echo $product->getName();
echo $product->getDescription();
echo $description = $product->getData('description');;
echo $finalPrice = $product->getFinalPrice();
?>
<?php
$productId = 1;
$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$currentproduct = $objectManager->create('Magento\Catalog\Model\Product')->load($productId);
echo $currentproduct->getName();
?>
// Get current product data
<?php
$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$product = $objectManager->get('Magento\Framework\Registry')->registry('current_product');//get current product
echo $product->getId();
echo $product->getName();
echo $product->getDescription();
echo $description = $product->getData('description');;
echo $finalPrice = $product->getFinalPrice();
?>
Comments
Post a Comment