How to get the Description of a MagentoCatalogModelProduct?How to get products description and short description in products list page?How to get the Description?Pull admin text value to display on Catalog/ Product/ ListMagento 2 - Keep Product Image Aspect RatioGet Price For Configurable Product Magento 2How to move the add to cart section under the short description on product view pageCan't override list.phtml in Magento 2.1.6How to get the price of all simple products assigned to configurable products in magento 2 listpage?Magento2 - How to get a custom attribute for catalog product?how to disable Add to compare option in list.phtml file magento 2 custom theme?Magento 2 - language override phtmlChange text and Relink the “Add To Cart” button in the product list page (list.phtml)
Do I need to leave some extra space available on the disk which my database log files reside, for log backup operations to successfully occur?
Too much vertical space above xrightarrow
What Happens when Passenger Refuses to Fly Boeing 737 Max?
Is it true that real estate prices mainly go up?
Do f-stop and exposure time perfectly cancel?
Force user to remove USB token
What is the dot in “1.2.4."
When two POV characters meet
Replacing Windows 7 security updates with anti-virus?
Potentiometer like component
This equation is outside the page, how to modify it
Can "semicircle" be used to refer to a part-circle that is not a exact half-circle?
Why do Australian milk farmers need to protest supermarkets' milk price?
Is all copper pipe pretty much the same?
What is the definition of "Natural Selection"?
validation vs test vs training accuracy, which one to compare for claiming overfit?
Running a subshell from the middle of the current command
How does Dispel Magic work against Stoneskin?
How does airport security verify that you can carry a battery bank over 100 Wh?
Provisioning profile doesn't include the application-identifier and keychain-access-groups entitlements
what does the apostrophe mean in this notation?
Who is our nearest neighbor
It's a yearly task, alright
Silly Sally's Movie
How to get the Description of a MagentoCatalogModelProduct?
How to get products description and short description in products list page?How to get the Description?Pull admin text value to display on Catalog/ Product/ ListMagento 2 - Keep Product Image Aspect RatioGet Price For Configurable Product Magento 2How to move the add to cart section under the short description on product view pageCan't override list.phtml in Magento 2.1.6How to get the price of all simple products assigned to configurable products in magento 2 listpage?Magento2 - How to get a custom attribute for catalog product?how to disable Add to compare option in list.phtml file magento 2 custom theme?Magento 2 - language override phtmlChange text and Relink the “Add To Cart” button in the product list page (list.phtml)
I'm in Magento2 and the getDescription(); does not work.
I'm in the file Magento_Catalog/templates/product/list.phtml if that's relevant.
magento2 product-attribute phtml
add a comment |
I'm in Magento2 and the getDescription(); does not work.
I'm in the file Magento_Catalog/templates/product/list.phtml if that's relevant.
magento2 product-attribute phtml
add a comment |
I'm in Magento2 and the getDescription(); does not work.
I'm in the file Magento_Catalog/templates/product/list.phtml if that's relevant.
magento2 product-attribute phtml
I'm in Magento2 and the getDescription(); does not work.
I'm in the file Magento_Catalog/templates/product/list.phtml if that's relevant.
magento2 product-attribute phtml
magento2 product-attribute phtml
edited 3 hours ago
Rafael Corrêa Gomes
4,56923265
4,56923265
asked Apr 5 '16 at 17:32
Philipp SanderPhilipp Sander
6011521
6011521
add a comment |
add a comment |
4 Answers
4
active
oldest
votes
In Store > Attributes > Product > Description > Storefront Properties set Visible on Catalog Pages on Storefront and Used in Product Listing to TRUE.
In your code list.phtml you can use:
<?php echo $this->helper('MagentoCatalogHelperOutput')->productAttribute($_product, $_product->getDescription(), 'description') ?>
or
<?php echo $_product->getDescription() ?>
add a comment |
I solved it myself:
I wrote a Helper that reloads the product, because it seems like the collection in the template I used, didn't load the full object.
use MagentoCatalogModelProduct as ModelProduct;
class Description extends MagentoFrameworkAppHelperAbstractHelper
/**
* @var MagentoCatalogModelProductFactory
*/
protected $productFactory;
/**
* @param MagentoCatalogModelProductFactory $productFactory
*/
public function __construct(
MagentoCatalogModelProductFactory $productFactory
)
$this->productFactory = $productFactory;
/**
*
* Load the product and return its description
*
* @param ModelProduct $product
*/
public function getProductDescription($product)
$reloadedProduct = $this->productFactory->create()->load($product->getId());
return $reloadedProduct->getData('description');
Ever thought about what could actually cause this?
– Max
Oct 26 '17 at 18:15
add a comment |
See /vendor/magento/module-catalog/view/frontend/templates/product/view/description.phtml
/**
* Product description template
*
* @var $block MagentoCatalogBlockProductViewDescription
*/
?>
<?php /* @escapeNotVerified */ echo $this->helper('MagentoCatalogHelperOutput')->productAttribute($block->getProduct(), $block->getProduct()->getDescription(), 'description') ?>
I already tried that. It's not working. If you have a look at the class of the object that returned bygetProductyou will see, that there's nogetDescription()
– Philipp Sander
Apr 6 '16 at 8:22
github.com/magento/magento2/blob/develop/app/code/Magento/…
– Philipp Sander
Apr 6 '16 at 8:23
getDescription should be a magic method, where the string after "get" is the attribute name
– ahnbizcad
Sep 12 '16 at 4:26
Doesn't care if its not in the object, thus not a magic getter. :)
– Max
Oct 26 '17 at 18:15
add a comment |
Try this:
$productCollection = $this->helper('MagentoCatalogModelProductFactory');
$product = $productCollection->create()->load($id);
$description = $product->getDescription();
Hi and welcome to stackoverflow! you're answer does exactly what mine does.
– Philipp Sander
Nov 12 '18 at 9:28
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "479"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f109588%2fhow-to-get-the-description-of-a-magento-catalog-model-product%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
4 Answers
4
active
oldest
votes
4 Answers
4
active
oldest
votes
active
oldest
votes
active
oldest
votes
In Store > Attributes > Product > Description > Storefront Properties set Visible on Catalog Pages on Storefront and Used in Product Listing to TRUE.
In your code list.phtml you can use:
<?php echo $this->helper('MagentoCatalogHelperOutput')->productAttribute($_product, $_product->getDescription(), 'description') ?>
or
<?php echo $_product->getDescription() ?>
add a comment |
In Store > Attributes > Product > Description > Storefront Properties set Visible on Catalog Pages on Storefront and Used in Product Listing to TRUE.
In your code list.phtml you can use:
<?php echo $this->helper('MagentoCatalogHelperOutput')->productAttribute($_product, $_product->getDescription(), 'description') ?>
or
<?php echo $_product->getDescription() ?>
add a comment |
In Store > Attributes > Product > Description > Storefront Properties set Visible on Catalog Pages on Storefront and Used in Product Listing to TRUE.
In your code list.phtml you can use:
<?php echo $this->helper('MagentoCatalogHelperOutput')->productAttribute($_product, $_product->getDescription(), 'description') ?>
or
<?php echo $_product->getDescription() ?>
In Store > Attributes > Product > Description > Storefront Properties set Visible on Catalog Pages on Storefront and Used in Product Listing to TRUE.
In your code list.phtml you can use:
<?php echo $this->helper('MagentoCatalogHelperOutput')->productAttribute($_product, $_product->getDescription(), 'description') ?>
or
<?php echo $_product->getDescription() ?>
edited Jun 2 '16 at 19:02
answered Jun 2 '16 at 18:37
Rafael Corrêa GomesRafael Corrêa Gomes
4,56923265
4,56923265
add a comment |
add a comment |
I solved it myself:
I wrote a Helper that reloads the product, because it seems like the collection in the template I used, didn't load the full object.
use MagentoCatalogModelProduct as ModelProduct;
class Description extends MagentoFrameworkAppHelperAbstractHelper
/**
* @var MagentoCatalogModelProductFactory
*/
protected $productFactory;
/**
* @param MagentoCatalogModelProductFactory $productFactory
*/
public function __construct(
MagentoCatalogModelProductFactory $productFactory
)
$this->productFactory = $productFactory;
/**
*
* Load the product and return its description
*
* @param ModelProduct $product
*/
public function getProductDescription($product)
$reloadedProduct = $this->productFactory->create()->load($product->getId());
return $reloadedProduct->getData('description');
Ever thought about what could actually cause this?
– Max
Oct 26 '17 at 18:15
add a comment |
I solved it myself:
I wrote a Helper that reloads the product, because it seems like the collection in the template I used, didn't load the full object.
use MagentoCatalogModelProduct as ModelProduct;
class Description extends MagentoFrameworkAppHelperAbstractHelper
/**
* @var MagentoCatalogModelProductFactory
*/
protected $productFactory;
/**
* @param MagentoCatalogModelProductFactory $productFactory
*/
public function __construct(
MagentoCatalogModelProductFactory $productFactory
)
$this->productFactory = $productFactory;
/**
*
* Load the product and return its description
*
* @param ModelProduct $product
*/
public function getProductDescription($product)
$reloadedProduct = $this->productFactory->create()->load($product->getId());
return $reloadedProduct->getData('description');
Ever thought about what could actually cause this?
– Max
Oct 26 '17 at 18:15
add a comment |
I solved it myself:
I wrote a Helper that reloads the product, because it seems like the collection in the template I used, didn't load the full object.
use MagentoCatalogModelProduct as ModelProduct;
class Description extends MagentoFrameworkAppHelperAbstractHelper
/**
* @var MagentoCatalogModelProductFactory
*/
protected $productFactory;
/**
* @param MagentoCatalogModelProductFactory $productFactory
*/
public function __construct(
MagentoCatalogModelProductFactory $productFactory
)
$this->productFactory = $productFactory;
/**
*
* Load the product and return its description
*
* @param ModelProduct $product
*/
public function getProductDescription($product)
$reloadedProduct = $this->productFactory->create()->load($product->getId());
return $reloadedProduct->getData('description');
I solved it myself:
I wrote a Helper that reloads the product, because it seems like the collection in the template I used, didn't load the full object.
use MagentoCatalogModelProduct as ModelProduct;
class Description extends MagentoFrameworkAppHelperAbstractHelper
/**
* @var MagentoCatalogModelProductFactory
*/
protected $productFactory;
/**
* @param MagentoCatalogModelProductFactory $productFactory
*/
public function __construct(
MagentoCatalogModelProductFactory $productFactory
)
$this->productFactory = $productFactory;
/**
*
* Load the product and return its description
*
* @param ModelProduct $product
*/
public function getProductDescription($product)
$reloadedProduct = $this->productFactory->create()->load($product->getId());
return $reloadedProduct->getData('description');
answered Apr 6 '16 at 11:46
Philipp SanderPhilipp Sander
6011521
6011521
Ever thought about what could actually cause this?
– Max
Oct 26 '17 at 18:15
add a comment |
Ever thought about what could actually cause this?
– Max
Oct 26 '17 at 18:15
Ever thought about what could actually cause this?
– Max
Oct 26 '17 at 18:15
Ever thought about what could actually cause this?
– Max
Oct 26 '17 at 18:15
add a comment |
See /vendor/magento/module-catalog/view/frontend/templates/product/view/description.phtml
/**
* Product description template
*
* @var $block MagentoCatalogBlockProductViewDescription
*/
?>
<?php /* @escapeNotVerified */ echo $this->helper('MagentoCatalogHelperOutput')->productAttribute($block->getProduct(), $block->getProduct()->getDescription(), 'description') ?>
I already tried that. It's not working. If you have a look at the class of the object that returned bygetProductyou will see, that there's nogetDescription()
– Philipp Sander
Apr 6 '16 at 8:22
github.com/magento/magento2/blob/develop/app/code/Magento/…
– Philipp Sander
Apr 6 '16 at 8:23
getDescription should be a magic method, where the string after "get" is the attribute name
– ahnbizcad
Sep 12 '16 at 4:26
Doesn't care if its not in the object, thus not a magic getter. :)
– Max
Oct 26 '17 at 18:15
add a comment |
See /vendor/magento/module-catalog/view/frontend/templates/product/view/description.phtml
/**
* Product description template
*
* @var $block MagentoCatalogBlockProductViewDescription
*/
?>
<?php /* @escapeNotVerified */ echo $this->helper('MagentoCatalogHelperOutput')->productAttribute($block->getProduct(), $block->getProduct()->getDescription(), 'description') ?>
I already tried that. It's not working. If you have a look at the class of the object that returned bygetProductyou will see, that there's nogetDescription()
– Philipp Sander
Apr 6 '16 at 8:22
github.com/magento/magento2/blob/develop/app/code/Magento/…
– Philipp Sander
Apr 6 '16 at 8:23
getDescription should be a magic method, where the string after "get" is the attribute name
– ahnbizcad
Sep 12 '16 at 4:26
Doesn't care if its not in the object, thus not a magic getter. :)
– Max
Oct 26 '17 at 18:15
add a comment |
See /vendor/magento/module-catalog/view/frontend/templates/product/view/description.phtml
/**
* Product description template
*
* @var $block MagentoCatalogBlockProductViewDescription
*/
?>
<?php /* @escapeNotVerified */ echo $this->helper('MagentoCatalogHelperOutput')->productAttribute($block->getProduct(), $block->getProduct()->getDescription(), 'description') ?>
See /vendor/magento/module-catalog/view/frontend/templates/product/view/description.phtml
/**
* Product description template
*
* @var $block MagentoCatalogBlockProductViewDescription
*/
?>
<?php /* @escapeNotVerified */ echo $this->helper('MagentoCatalogHelperOutput')->productAttribute($block->getProduct(), $block->getProduct()->getDescription(), 'description') ?>
answered Apr 5 '16 at 17:44
Joshua34Joshua34
1,5691020
1,5691020
I already tried that. It's not working. If you have a look at the class of the object that returned bygetProductyou will see, that there's nogetDescription()
– Philipp Sander
Apr 6 '16 at 8:22
github.com/magento/magento2/blob/develop/app/code/Magento/…
– Philipp Sander
Apr 6 '16 at 8:23
getDescription should be a magic method, where the string after "get" is the attribute name
– ahnbizcad
Sep 12 '16 at 4:26
Doesn't care if its not in the object, thus not a magic getter. :)
– Max
Oct 26 '17 at 18:15
add a comment |
I already tried that. It's not working. If you have a look at the class of the object that returned bygetProductyou will see, that there's nogetDescription()
– Philipp Sander
Apr 6 '16 at 8:22
github.com/magento/magento2/blob/develop/app/code/Magento/…
– Philipp Sander
Apr 6 '16 at 8:23
getDescription should be a magic method, where the string after "get" is the attribute name
– ahnbizcad
Sep 12 '16 at 4:26
Doesn't care if its not in the object, thus not a magic getter. :)
– Max
Oct 26 '17 at 18:15
I already tried that. It's not working. If you have a look at the class of the object that returned by
getProduct you will see, that there's no getDescription()– Philipp Sander
Apr 6 '16 at 8:22
I already tried that. It's not working. If you have a look at the class of the object that returned by
getProduct you will see, that there's no getDescription()– Philipp Sander
Apr 6 '16 at 8:22
github.com/magento/magento2/blob/develop/app/code/Magento/…
– Philipp Sander
Apr 6 '16 at 8:23
github.com/magento/magento2/blob/develop/app/code/Magento/…
– Philipp Sander
Apr 6 '16 at 8:23
getDescription should be a magic method, where the string after "get" is the attribute name
– ahnbizcad
Sep 12 '16 at 4:26
getDescription should be a magic method, where the string after "get" is the attribute name
– ahnbizcad
Sep 12 '16 at 4:26
Doesn't care if its not in the object, thus not a magic getter. :)
– Max
Oct 26 '17 at 18:15
Doesn't care if its not in the object, thus not a magic getter. :)
– Max
Oct 26 '17 at 18:15
add a comment |
Try this:
$productCollection = $this->helper('MagentoCatalogModelProductFactory');
$product = $productCollection->create()->load($id);
$description = $product->getDescription();
Hi and welcome to stackoverflow! you're answer does exactly what mine does.
– Philipp Sander
Nov 12 '18 at 9:28
add a comment |
Try this:
$productCollection = $this->helper('MagentoCatalogModelProductFactory');
$product = $productCollection->create()->load($id);
$description = $product->getDescription();
Hi and welcome to stackoverflow! you're answer does exactly what mine does.
– Philipp Sander
Nov 12 '18 at 9:28
add a comment |
Try this:
$productCollection = $this->helper('MagentoCatalogModelProductFactory');
$product = $productCollection->create()->load($id);
$description = $product->getDescription();
Try this:
$productCollection = $this->helper('MagentoCatalogModelProductFactory');
$product = $productCollection->create()->load($id);
$description = $product->getDescription();
answered Nov 11 '18 at 13:50
Hieu Pham MinhHieu Pham Minh
12
12
Hi and welcome to stackoverflow! you're answer does exactly what mine does.
– Philipp Sander
Nov 12 '18 at 9:28
add a comment |
Hi and welcome to stackoverflow! you're answer does exactly what mine does.
– Philipp Sander
Nov 12 '18 at 9:28
Hi and welcome to stackoverflow! you're answer does exactly what mine does.
– Philipp Sander
Nov 12 '18 at 9:28
Hi and welcome to stackoverflow! you're answer does exactly what mine does.
– Philipp Sander
Nov 12 '18 at 9:28
add a comment |
Thanks for contributing an answer to Magento Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f109588%2fhow-to-get-the-description-of-a-magento-catalog-model-product%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown