9 Commits

12 gewijzigde bestanden met toevoegingen van 73 en 35 verwijderingen

Bestand weergeven

@ -94,8 +94,8 @@ class ManufacturerInfoLongdesc extends AdminDetailsController
$aParams = Registry::getRequest()->getRequestEscapedParameter("editval");
$oManufacturer->assign($aParams);
if (false === is_null($this->d3GetLongdescParamValue($oManufacturer))) {
$oManufacturer->d3SetLongdesc($this->d3GetLongdescParamValue($oManufacturer));
if (false === is_null($this->d3GetLongdescParamValue())) {
$oManufacturer->d3SetLongdesc($this->d3GetLongdescParamValue());
$oManufacturer->save();
}
}
@ -103,7 +103,7 @@ class ManufacturerInfoLongdesc extends AdminDetailsController
/**
* @return string
*/
public function d3GetLongdescParamValue(Manufacturer $oManufacturer): string
public function d3GetLongdescParamValue(): string
{
return (string) Registry::getRequest()->getRequestEscapedParameter("editval")['oxmanufacturers__d3description'];
}
@ -114,13 +114,13 @@ class ManufacturerInfoLongdesc extends AdminDetailsController
*
* @param $sValue
*
* @return mixed
* @return string
*/
protected function processLongDesc($sValue): mixed
protected function processLongDesc($sValue): string
{
$aSearch = ['&amp;nbsp;', '&amp;', '&quot;', '&lang=', '<p>&nbsp;</p>', '<p>&nbsp; </p>'];
$aReplace = ['&nbsp;', '&', '"', '&amp;lang=', '', ''];
return str_replace($aSearch, $aReplace, $sValue);
return (string) str_replace($aSearch, $aReplace, $sValue);
}
}

Bestand weergeven

@ -4,7 +4,15 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [unreleased](https://git.d3data.de/D3Private/manufacturer-information/compare/2.1.0.0...rel_2.x)
## [unreleased](https://git.d3data.de/D3Private/manufacturer-information/compare/2.0.3.1...rel_2.x)
## [2.0.3.1](https://git.d3data.de/D3Private/manufacturer-information/compare/2.0.3.0...2.0.3.1) - 2025-01-03
### Fixed
- installation instructions
- parsing Smarty based longdescription
- replace OXID >= 7.1 code by compatible one
- prevent unset object error in template
- align admin menu section
## [2.0.3.0](https://git.d3data.de/D3Private/manufacturer-information/compare/2.0.2.0...2.0.3.0) - 2024-12-19
### Added

Bestand weergeven

@ -18,6 +18,7 @@ declare(strict_types=1);
namespace D3\ManufacturerInformation\Modules\Application\Model;
use D3\ManufacturerInformation\Application\Model\Constants;
use Exception;
use OxidEsales\Eshop\Core\Field;
use OxidEsales\Eshop\Core\Registry;
@ -33,7 +34,7 @@ class D3ManufacturerLongDesc extends D3ManufacturerLongDesc_parent
try {
$this->assign([Constants::D3_OXMANUFACTURERS_LONGDESC_FIELDNAME => $sValue]);
$this->save();
} catch (\Exception $exception) {
} catch ( Exception $exception) {
Registry::getLogger()->error($exception->getMessage());
}
}
@ -42,9 +43,9 @@ class D3ManufacturerLongDesc extends D3ManufacturerLongDesc_parent
}
/**
* @return field
* @return Field
*/
public function d3GetLongdesc(): field
public function d3GetLongdesc(): Field
{
$longName = $this->getFieldLongName(Constants::D3_OXMANUFACTURERS_LONGDESC_FIELDNAME);
return $this->$longName ?: oxNew(Field::class);

Bestand weergeven

@ -20,18 +20,22 @@ namespace D3\ManufacturerInformation\Modules\Application\Model;
use OxidEsales\Eshop\Application\Model\Manufacturer;
use OxidEsales\Eshop\Core\Field;
use OxidEsales\Eshop\Core\Registry;
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;
use Psr\Container\ContainerExceptionInterface;
use Psr\Container\NotFoundExceptionInterface;
class ManufacturerInfoList extends ManufacturerInfoList_parent
{
/**
* @param Manufacturer|D3ManufacturerLongDesc $oManufacturer
*
* @return void
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
*/
protected function addCategoryFields($oManufacturer): void
{
@ -41,25 +45,36 @@ class ManufacturerInfoList extends ManufacturerInfoList_parent
$setting = ContainerFactory::getInstance()->getContainer()->get(ModuleSettingServiceInterface::class);
if ($setting->getBoolean('d3manufacturerinformation_showManufacturertextOnManufacturerPage', 'd3manufacturerinformation')) {
/** @var UtilsView $oUtilsView */
$oUtilsView = Registry::getUtilsView();
$longdesc = $oManufacturer->d3GetLongdesc( )->getRawValue() ?? '';
$deactivateSmarty = Registry::getConfig()->getConfigParam('deactivateSmartyForCmsContent');
$processLongDescriptions = Registry::getConfig()->getConfigParam('bl_perfParseLongDescinSmarty');
if (!$deactivateSmarty && $processLongDescriptions) {
$viewData = array_merge(
Registry::getConfig()->getActiveView()->getViewData(),
[
'oShop' => Registry::getConfig()->getActiveShop(),
'oViewConf' => Registry::getConfig()->getActiveView()->getViewConfig()
]
);
$longdesc = $this->getRenderer()->renderFragment(
$longdesc,
$oManufacturer->getId() . $oManufacturer->getLanguage(),
[],
true
sprintf('ox:%s%s', $oManufacturer->getId(), $oManufacturer->getLanguage()),
$viewData
) ?? '';
}
$oManufacturer->oxcategories__oxlongdesc = new Field(html_entity_decode($longdesc), Field::T_RAW);
}
}
/**
* @return TemplateRendererInterface
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
*/
private function getRenderer(): TemplateRendererInterface
{
return $this->getContainer()->get(TemplateRendererBridgeInterface::class)->getTemplateRenderer();
return ContainerFactory::getInstance()->getContainer()->get(TemplateRendererBridgeInterface::class)->getTemplateRenderer();
}
}

Bestand weergeven

@ -18,18 +18,23 @@ declare(strict_types=1);
namespace D3\ManufacturerInformation\Modules\Core;
use D3\ManufacturerInformation\Application\Model\Constants;
use OxidEsales\EshopCommunity\Core\Di\ContainerFacade;
use OxidEsales\EshopCommunity\Internal\Container\ContainerFactory;
use OxidEsales\EshopCommunity\Internal\Framework\Module\Facade\ModuleSettingServiceInterface;
use Psr\Container\ContainerExceptionInterface;
use Psr\Container\NotFoundExceptionInterface;
class ManufacturerConfig extends ManufacturerConfig_parent
{
/**
* @param string $sName
*
* @return bool
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
*/
public function d3GetBoolModuleSettingByName(string $sName): bool
{
$moduleSettingService = ContainerFacade::get(ModuleSettingServiceInterface::class);
$moduleSettingService = ContainerFactory::getInstance()->getContainer()->get(ModuleSettingServiceInterface::class);
return $moduleSettingService->getBoolean(Constants::OXID_MODULE_ID.$sName, Constants::OXID_MODULE_ID);
}

Bestand weergeven

@ -26,7 +26,7 @@ Sofern nötig, bestätigen Sie bitte, dass Sie `package-name` erlauben, Code aus
```bash
./vendor/bin/oe-eshop-db_migrate migrations:migrate d3manufacturerinformation
./vendor/bin/oe-console oe:module:install source/modules/d3/manufacturerinformation
./vendor/bin/oe-console oe:module:install vendor/d3/manufacturerinformation
./vendor/bin/oe-console oe:module:deactivate d3manufacturerinformation
./vendor/bin/oe-console oe:module:activate d3manufacturerinformation

Bestand weergeven

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="ISO-8859-15"?>
<OX>
<OXMENU id="NAVIGATION_ESHOPADMIN">
<MAINMENU id="mxuadmin">
<MAINMENU id="mxmainmenu">
<SUBMENU id="mxmanufacturer" cl="manufacturer" list="manufacturer_list">
<TAB id="mxd3manufacturerinfolongdesc" cl="d3manufacturerinfolongdesc" />
</SUBMENU>

Bestand weergeven

@ -40,7 +40,7 @@ $aModule = [
'en' => 'adds manufacturer information to the article list',
],
'thumbnail' => 'picture.svg',
'version' => '2.0.3.0',
'version' => '2.0.3.1',
'author' => '(D3) Data Development (Inh.: Thomas Dartsch)',
'email' => 'support@shopmodule.com',
'url' => 'https://www.oxidmodule.com/',

Bestand weergeven

@ -18,6 +18,7 @@ declare(strict_types=1);
namespace D3\ManufacturerInformation\Migrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\DBAL\Schema\SchemaException;
use Doctrine\DBAL\Types\TextType;
use Doctrine\Migrations\AbstractMigration;
@ -45,7 +46,7 @@ final class Version20241023154223 extends AbstractMigration
/**
* @param Schema $schema
* @return void
* @throws \Doctrine\DBAL\Schema\SchemaException
* @throws SchemaException
*/
public function d3AddLongdescColumnToOxmanufacturers(Schema $schema)
{

Bestand weergeven

@ -17,7 +17,9 @@ declare(strict_types=1);
namespace D3\ManufacturerInformation\Migrations;
use Doctrine\DBAL\Exception;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\DBAL\Schema\SchemaException;
use Doctrine\DBAL\Types\TextType;
use Doctrine\Migrations\AbstractMigration;
@ -44,8 +46,10 @@ final class Version20241028172608 extends AbstractMigration
/**
* @param Schema $schema
*
* @return void
* @throws \Doctrine\DBAL\Schema\SchemaException
* @throws Exception
* @throws SchemaException
*/
public function d3AddLongdescMultilangColumnsToOxmanufacturers(Schema $schema)
{

Bestand weergeven

@ -33,7 +33,9 @@
<input type="hidden" name="catlang" value="{{ catlang }}">
<input type="hidden" name="editval[oxmanufacturers__d3description]" value="">
{% include "include/category_text_editor.html.twig" %}
<div style="margin-bottom: 40px">
{% include "include/category_text_editor.html.twig" %}
</div>
</form>
{% include "bottomnaviitem.html.twig" %}

Bestand weergeven

@ -4,17 +4,19 @@
{{ parent() }}
{% set oManufacturer = oView.getManufacturer() %}
{% set sShopURL = config.getConfigParam('sShopURL') %}
{% set description = oManufacturer.d3GetLongdesc() %}
{% if oManufacturer && oManufacturer.getId() %}
{% set sShopURL = config.getConfigParam('sShopURL') %}
{% set description = oManufacturer.d3GetLongdesc() %}
{% if oManufacturer and config.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" }) }}
{% if config.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" }) }}
</div>
<div id="manufacturer" class="collapse" aria-labelledby="manufacturer-collapsible">
{{ include(template_from_string(description)) }}
</div>
</div>
<div id="manufacturer" class="collapse" aria-labelledby="manufacturer-collapsible">
{{ include(template_from_string(description)) }}
</div>
</div>
{% endif %}
{% endif %}
{% endblock %}