在前端包含CurrentCustomer帮助程序

时间:2018-06-25 12:42:19

标签: php magento magento2 php-7.1

我正在尝试在前端中包含一个magento帮助器,但它出错了。

/** @var \Magento\Customer\Helper\Session\CurrentCustomer $_sessionhelper */
$_sessionhelper = $this->helper('Magento\Customer\Helper\Session\CurrentCustomer');

"We're sorry, an error has occurred while generating this content."

这是我的代码头 我想检索相关人员的组,以显示价格,因为我知道由于个人显示我无法使用

\Magento_Catalog\templates\product\price\amount\default.phtml

<?php
/**
 * Copyright © 2015 Magento. All rights reserved.
 * See COPYING.txt for license details.
 */

use Magento\Framework\App\Action\Action;

// @codingStandardsIgnoreFile

?>
<?php
/**
 * Product list template
 *
 * @var $block \Magento\Catalog\Block\Product\ListProduct
 */
?>
<?php
$_productCollection = $block->getProductCollection()->getItems();
$_helper            = $this->helper('Magento\Catalog\Helper\Output');
$_imagehelper       = $this->helper('Magento\Catalog\Helper\Image');
/** @var \Magento\Customer\Helper\Session\CurrentCustomer $_sessionhelper */
$_sessionhelper = $this->helper('Magento\Customer\Helper\Session\CurrentCustomer');

$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$listBlock     = $objectManager->get('\Magento\Catalog\Block\Product\ListProduct');





?>

0 个答案:

没有答案