Error filtering template: Notice: Undefined variable: pro_price in /Magento_Catalog/templates/product/widget/new/content/categories_shop.phtml on line 112

i'm getting this error even if comments or remove pro_price variable. code where i'm getting this error ,its comes after deleting most of the products from catalog. before this was working fine. any suggestion? this small code from file

$type = 'widget-new-grid';
$categoryProducts = $category1->getProductCollection()->addAttributeToSelect('*');                             
foreach ($categoryProducts as $product) {
     $pro_price=$block->getProductPriceHtml($product, $type);
  • try to declare $pro_price before the foreach-loop – Robin Nov 15 '17 at 12:45
  • thanks for reply robin. i got the problem and solved it. – Ganesh Nov 16 '17 at 10:50

thanks for reply robin. i got the problem and solved it. my client deleted some virtual products ,magento 2 creates virtual products or simple product with creation of configurable product. it store the price configurable product in virtual or simple product. so mistake was he need to delete configurable product and its virtual products too. when he deleted virtual product which carry configurable product price in it so there will be no price for that configurable product . so i got the error.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.