2024-11-05 16:13:03 +01:00
|
|
|
<?php
|
2024-11-20 18:50:18 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Copyright (c) D3 Data Development (Inh. Thomas Dartsch)
|
|
|
|
*
|
|
|
|
* For the full copyright and license information, please view
|
|
|
|
* the LICENSE file that was distributed with this source code.
|
|
|
|
*
|
|
|
|
* https://www.d3data.de
|
|
|
|
*
|
|
|
|
* @copyright (C) D3 Data Development (Inh. Thomas Dartsch)
|
|
|
|
* @author D3 Data Development - Max Buhe, Daniel Seifert <info@shopmodule.com>
|
|
|
|
* @link https://www.oxidmodule.com
|
|
|
|
*/
|
|
|
|
|
2024-11-05 16:13:03 +01:00
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
|
|
namespace D3\ManufacturerInformation\Modules\Application\Model;
|
|
|
|
|
|
|
|
use OxidEsales\Eshop\Application\Model\Manufacturer;
|
|
|
|
use OxidEsales\Eshop\Core\Field;
|
2024-11-21 17:01:14 +01:00
|
|
|
use OxidEsales\Eshop\Core\Registry;
|
2024-12-19 14:21:49 +01:00
|
|
|
use OxidEsales\Eshop\Core\UtilsView;
|
|
|
|
use OxidEsales\EshopCommunity\Internal\Container\ContainerFactory;
|
|
|
|
use OxidEsales\EshopCommunity\Internal\Framework\Module\Facade\ModuleSettingService;
|
|
|
|
use OxidEsales\EshopCommunity\Internal\Framework\Module\Facade\ModuleSettingServiceInterface;
|
|
|
|
use OxidEsales\EshopCommunity\Internal\Framework\Templating\TemplateRendererBridgeInterface;
|
|
|
|
use OxidEsales\EshopCommunity\Internal\Framework\Templating\TemplateRendererInterface;
|
2024-11-05 16:13:03 +01:00
|
|
|
|
|
|
|
class ManufacturerInfoList extends ManufacturerInfoList_parent
|
|
|
|
{
|
2024-11-20 18:50:18 +01:00
|
|
|
/**
|
|
|
|
* @param Manufacturer|D3ManufacturerLongDesc $oManufacturer
|
|
|
|
* @return void
|
|
|
|
*/
|
2024-12-19 16:28:29 +01:00
|
|
|
protected function addCategoryFields($oManufacturer): void
|
2024-11-20 18:50:18 +01:00
|
|
|
{
|
|
|
|
parent::addCategoryFields($oManufacturer);
|
|
|
|
|
2024-12-19 14:21:49 +01:00
|
|
|
/** @var ModuleSettingService $setting */
|
|
|
|
$setting = ContainerFactory::getInstance()->getContainer()->get(ModuleSettingServiceInterface::class);
|
2024-12-05 12:15:33 +01:00
|
|
|
|
2024-12-19 14:21:49 +01:00
|
|
|
if ($setting->getBoolean('d3manufacturerinformation_showManufacturertextOnManufacturerPage', 'd3manufacturerinformation')) {
|
|
|
|
/** @var UtilsView $oUtilsView */
|
|
|
|
$oUtilsView = Registry::getUtilsView();
|
|
|
|
$longdesc = $oManufacturer->d3GetLongdesc( )->getRawValue() ?? '';
|
2024-12-05 12:15:33 +01:00
|
|
|
$deactivateSmarty = Registry::getConfig()->getConfigParam('deactivateSmartyForCmsContent');
|
|
|
|
$processLongDescriptions = Registry::getConfig()->getConfigParam('bl_perfParseLongDescinSmarty');
|
|
|
|
if (!$deactivateSmarty && $processLongDescriptions) {
|
2024-12-19 14:21:49 +01:00
|
|
|
$longdesc = $this->getRenderer()->renderFragment(
|
2024-12-05 12:15:33 +01:00
|
|
|
$longdesc,
|
|
|
|
$oManufacturer->getId() . $oManufacturer->getLanguage(),
|
2024-12-19 14:21:49 +01:00
|
|
|
[],
|
2024-12-05 12:15:33 +01:00
|
|
|
true
|
|
|
|
) ?? '';
|
|
|
|
}
|
|
|
|
$oManufacturer->oxcategories__oxlongdesc = new Field(html_entity_decode($longdesc), Field::T_RAW);
|
2024-11-21 17:01:14 +01:00
|
|
|
}
|
2024-11-20 18:50:18 +01:00
|
|
|
}
|
2024-12-19 14:21:49 +01:00
|
|
|
|
|
|
|
private function getRenderer(): TemplateRendererInterface
|
|
|
|
{
|
|
|
|
return $this->getContainer()->get(TemplateRendererBridgeInterface::class)->getTemplateRenderer();
|
|
|
|
}
|
2024-11-20 18:50:18 +01:00
|
|
|
}
|