How to Log Bundle Product Data (Print Product complete information)In Default Product list.phtml file in magento 2.I am Getting
foreach ($_productCollection as $_product):
When I write
echo $_product->getProductUrl()It is displaying correct product url.But When I tried to print the Entire Product Data by using
print_r($_product->getData());It is showing Blank Page I changed memory size but again showing blank page only (It is a bundle product) So atleast I want to Log that data in some test.log file for that I used
$writer = new \Zend\Log\Writer\Stream(BP . '/var/log/test.log'); $logger = new \Zend\Log\Logger(); $logger->addWriter($writer); $logger->info(print_r($_product->getData()), true);but the test.log file is empty.Can anyone Help me on this.
asked Nov 3, 2016 at 7:51
1 Answer 1
You can try something like as well you can use this to pass data in to log.
<?php
echo "<pre>";
print_r(json_encode($_product->getData()));
exit;
?>
answered Nov 3, 2016 at 9:49
-
thank you Krishna..It is printing product data but it is a bundle product na so i need bundled items also.Here Bundle Items are not showing.How to get Bundle items also like this way..?shankar boss– shankar boss2016年11月03日 10:20:56 +00:00Commented Nov 3, 2016 at 10:20
-
1You can refer this magento.stackexchange.com/questions/139920/…Krishna ijjada– Krishna ijjada2016年11月03日 10:22:42 +00:00Commented Nov 3, 2016 at 10:22
-
definitely I will accept if it works :)shankar boss– shankar boss2016年11月03日 10:25:15 +00:00Commented Nov 3, 2016 at 10:25
Explore related questions
See similar questions with these tags.
default