[Added] manufacturer to details; Component\ArticleDetails extension

method to call the settings on the details page
This commit is contained in:
MaxBuhe01 2024-11-22 21:34:45 +01:00
parent beb67d992e
commit ce4a96c279
6 changed files with 51 additions and 22 deletions

View File

@ -26,3 +26,12 @@ namespace D3\ManufacturerInformation\Modules\Application\Model{
{
}
}
namespace D3\ManufacturerInformation\Modules\Application\Component\Widgets{
use OxidEsales\Eshop\Application\Component\Widget\ArticleDetails;
class ArticleDetailsManufacturer_parent extends ArticleDetails
{
}
}

View File

@ -0,0 +1,37 @@
<?php
/**
* 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
*/
declare(strict_types=1);
namespace D3\ManufacturerInformation\Modules\Application\Component\Widgets;
use D3\ManufacturerInformation\Application\Component\Widget\ArticleDetailsManufacturer_parent;
use D3\ManufacturerInformation\Application\Model\Constants;
use OxidEsales\EshopCommunity\Core\Di\ContainerFacade;
use OxidEsales\EshopCommunity\Internal\Framework\Module\Facade\ModuleSettingServiceInterface;
class ArticleDetailsManufacturer extends ArticleDetailsManufacturer_parent
{
/**
* @param string $sName
* @return bool
*/
public function d3GetBoolModuleSettingByName(string $sName): bool
{
$moduleSettingService = ContainerFacade::get(ModuleSettingServiceInterface::class);
return $moduleSettingService->getBoolean(Constants::OXID_MODULE_ID.$sName, Constants::OXID_MODULE_ID);
}
}

View File

@ -17,8 +17,10 @@ declare(strict_types=1);
use D3\ManufacturerInformation\Application\Controller\Admin\ManufacturerInfoLongdesc;
use D3\ManufacturerInformation\Application\Model\Constants;
use D3\ManufacturerInformation\Modules\Application\Component\Widgets\ArticleDetailsManufacturer;
use D3\ManufacturerInformation\Modules\Application\Model\D3ManufacturerLongDesc;
use D3\ManufacturerInformation\Modules\Application\Model\ManufacturerInfoList;
use OxidEsales\Eshop\Application\Component\Widget\ArticleDetails as OEArticleDetails;
use OxidEsales\Eshop\Application\Model\Manufacturer as OEManufacturer;
use OxidEsales\Eshop\Application\Model\ManufacturerList as OEManufacturerList;
@ -48,6 +50,7 @@ $aModule = [
'extend' => [
OEManufacturer::class => D3ManufacturerLongDesc::class,
OEManufacturerList::class => ManufacturerInfoList::class,
OEArticleDetails::class => ArticleDetailsManufacturer::class,
],
'templates' => [
'@' . Constants::OXID_MODULE_ID . '/admin/d3manufacturerlongdesc.tpl' => 'views/smarty/admin/d3manufacturerlongdesc.tpl',

View File

@ -7,7 +7,7 @@
{% set sShopURL = config.getConfigParam('sShopURL') %}
{% set description = oManufacturer.d3GetLongdesc() %}
{% if oManufacturer and true and description|striptags|trim %}
{% if oManufacturer and oView.d3GetBoolModuleSettingByName('_showManufacturertextOnDetailsPage') and description|striptags|trim %}
<div class="col-12 col-md-6">
<div id="manufacturer-collapsible" class="h4" data-bs-target="#manufacturer" data-bs-toggle="collapse" role="button" aria-expanded="false" aria-controls="manufacturer">
{{ translate({ ident: "D3_MANUFACTURERINFO_TAB" }) }}

View File

@ -1,20 +0,0 @@
{% extends "page/details/inc/tabs.html.twig" %}
{% block details_tabs_invite %}
{{ parent() }}
{% set oConfig = oViewConf.getConfig() %}
{% set oManufacturer = oView.getManufacturer() %}
{% set sShopURL = oConfig.getConfigParam('sShopURL') %}
{% set description = oManufacturer.d3GetLongdesc() %}
{% if oManufacturer and oConfig.getConfigParam('d3manufacturerinformation_showManufacturertextOnDetailsPage') and description.rawValue|striptags|trim %}
{% capture append = "tabs" %}<a href="#manufacturertab" data-toggle="tab">{{ translate({ ident: "MANUFACTURER" }) }}</a>{% endcapture %}
{% capture append = "tabsContent" %}
<div id="manufacturertab" class="tab-pane{% if blFirstTab %} active{% endif %}">
{{ include(template_from_string(description)) }}
</div>
{% set blFirstTab = false %}
{% endcapture %}
{% endif %}
{% endblock %}