Compare commits
9 Commits
Author | SHA1 | Date | |
---|---|---|---|
9d43ddf078 | |||
4e19dea360 | |||
b93ea7a787 | |||
0a641b40c2 | |||
77bd789f14 | |||
c84a109281 | |||
00848cc007 | |||
6c0a476c80 | |||
b81c779b43 |
@ -94,8 +94,8 @@ class ManufacturerInfoLongdesc extends AdminDetailsController
|
|||||||
$aParams = Registry::getRequest()->getRequestEscapedParameter("editval");
|
$aParams = Registry::getRequest()->getRequestEscapedParameter("editval");
|
||||||
$oManufacturer->assign($aParams);
|
$oManufacturer->assign($aParams);
|
||||||
|
|
||||||
if (false === is_null($this->d3GetLongdescParamValue($oManufacturer))) {
|
if (false === is_null($this->d3GetLongdescParamValue())) {
|
||||||
$oManufacturer->d3SetLongdesc($this->d3GetLongdescParamValue($oManufacturer));
|
$oManufacturer->d3SetLongdesc($this->d3GetLongdescParamValue());
|
||||||
$oManufacturer->save();
|
$oManufacturer->save();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -103,7 +103,7 @@ class ManufacturerInfoLongdesc extends AdminDetailsController
|
|||||||
/**
|
/**
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function d3GetLongdescParamValue(Manufacturer $oManufacturer): string
|
public function d3GetLongdescParamValue(): string
|
||||||
{
|
{
|
||||||
return (string) Registry::getRequest()->getRequestEscapedParameter("editval")['oxmanufacturers__d3description'];
|
return (string) Registry::getRequest()->getRequestEscapedParameter("editval")['oxmanufacturers__d3description'];
|
||||||
}
|
}
|
||||||
@ -114,13 +114,13 @@ class ManufacturerInfoLongdesc extends AdminDetailsController
|
|||||||
*
|
*
|
||||||
* @param $sValue
|
* @param $sValue
|
||||||
*
|
*
|
||||||
* @return mixed
|
* @return string
|
||||||
*/
|
*/
|
||||||
protected function processLongDesc($sValue): mixed
|
protected function processLongDesc($sValue): string
|
||||||
{
|
{
|
||||||
$aSearch = ['&nbsp;', '&', '"', '&lang=', '<p> </p>', '<p> </p>'];
|
$aSearch = ['&nbsp;', '&', '"', '&lang=', '<p> </p>', '<p> </p>'];
|
||||||
$aReplace = [' ', '&', '"', '&lang=', '', ''];
|
$aReplace = [' ', '&', '"', '&lang=', '', ''];
|
||||||
|
|
||||||
return str_replace($aSearch, $aReplace, $sValue);
|
return (string) str_replace($aSearch, $aReplace, $sValue);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
10
CHANGELOG.md
10
CHANGELOG.md
@ -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/),
|
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).
|
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
|
## [2.0.3.0](https://git.d3data.de/D3Private/manufacturer-information/compare/2.0.2.0...2.0.3.0) - 2024-12-19
|
||||||
### Added
|
### Added
|
||||||
|
@ -18,6 +18,7 @@ declare(strict_types=1);
|
|||||||
namespace D3\ManufacturerInformation\Modules\Application\Model;
|
namespace D3\ManufacturerInformation\Modules\Application\Model;
|
||||||
|
|
||||||
use D3\ManufacturerInformation\Application\Model\Constants;
|
use D3\ManufacturerInformation\Application\Model\Constants;
|
||||||
|
use Exception;
|
||||||
use OxidEsales\Eshop\Core\Field;
|
use OxidEsales\Eshop\Core\Field;
|
||||||
use OxidEsales\Eshop\Core\Registry;
|
use OxidEsales\Eshop\Core\Registry;
|
||||||
|
|
||||||
@ -33,7 +34,7 @@ class D3ManufacturerLongDesc extends D3ManufacturerLongDesc_parent
|
|||||||
try {
|
try {
|
||||||
$this->assign([Constants::D3_OXMANUFACTURERS_LONGDESC_FIELDNAME => $sValue]);
|
$this->assign([Constants::D3_OXMANUFACTURERS_LONGDESC_FIELDNAME => $sValue]);
|
||||||
$this->save();
|
$this->save();
|
||||||
} catch (\Exception $exception) {
|
} catch ( Exception $exception) {
|
||||||
Registry::getLogger()->error($exception->getMessage());
|
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);
|
$longName = $this->getFieldLongName(Constants::D3_OXMANUFACTURERS_LONGDESC_FIELDNAME);
|
||||||
return $this->$longName ?: oxNew(Field::class);
|
return $this->$longName ?: oxNew(Field::class);
|
||||||
|
@ -20,18 +20,22 @@ namespace D3\ManufacturerInformation\Modules\Application\Model;
|
|||||||
use OxidEsales\Eshop\Application\Model\Manufacturer;
|
use OxidEsales\Eshop\Application\Model\Manufacturer;
|
||||||
use OxidEsales\Eshop\Core\Field;
|
use OxidEsales\Eshop\Core\Field;
|
||||||
use OxidEsales\Eshop\Core\Registry;
|
use OxidEsales\Eshop\Core\Registry;
|
||||||
use OxidEsales\Eshop\Core\UtilsView;
|
|
||||||
use OxidEsales\EshopCommunity\Internal\Container\ContainerFactory;
|
use OxidEsales\EshopCommunity\Internal\Container\ContainerFactory;
|
||||||
use OxidEsales\EshopCommunity\Internal\Framework\Module\Facade\ModuleSettingService;
|
use OxidEsales\EshopCommunity\Internal\Framework\Module\Facade\ModuleSettingService;
|
||||||
use OxidEsales\EshopCommunity\Internal\Framework\Module\Facade\ModuleSettingServiceInterface;
|
use OxidEsales\EshopCommunity\Internal\Framework\Module\Facade\ModuleSettingServiceInterface;
|
||||||
use OxidEsales\EshopCommunity\Internal\Framework\Templating\TemplateRendererBridgeInterface;
|
use OxidEsales\EshopCommunity\Internal\Framework\Templating\TemplateRendererBridgeInterface;
|
||||||
use OxidEsales\EshopCommunity\Internal\Framework\Templating\TemplateRendererInterface;
|
use OxidEsales\EshopCommunity\Internal\Framework\Templating\TemplateRendererInterface;
|
||||||
|
use Psr\Container\ContainerExceptionInterface;
|
||||||
|
use Psr\Container\NotFoundExceptionInterface;
|
||||||
|
|
||||||
class ManufacturerInfoList extends ManufacturerInfoList_parent
|
class ManufacturerInfoList extends ManufacturerInfoList_parent
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @param Manufacturer|D3ManufacturerLongDesc $oManufacturer
|
* @param Manufacturer|D3ManufacturerLongDesc $oManufacturer
|
||||||
|
*
|
||||||
* @return void
|
* @return void
|
||||||
|
* @throws ContainerExceptionInterface
|
||||||
|
* @throws NotFoundExceptionInterface
|
||||||
*/
|
*/
|
||||||
protected function addCategoryFields($oManufacturer): void
|
protected function addCategoryFields($oManufacturer): void
|
||||||
{
|
{
|
||||||
@ -41,25 +45,36 @@ class ManufacturerInfoList extends ManufacturerInfoList_parent
|
|||||||
$setting = ContainerFactory::getInstance()->getContainer()->get(ModuleSettingServiceInterface::class);
|
$setting = ContainerFactory::getInstance()->getContainer()->get(ModuleSettingServiceInterface::class);
|
||||||
|
|
||||||
if ($setting->getBoolean('d3manufacturerinformation_showManufacturertextOnManufacturerPage', 'd3manufacturerinformation')) {
|
if ($setting->getBoolean('d3manufacturerinformation_showManufacturertextOnManufacturerPage', 'd3manufacturerinformation')) {
|
||||||
/** @var UtilsView $oUtilsView */
|
|
||||||
$oUtilsView = Registry::getUtilsView();
|
|
||||||
$longdesc = $oManufacturer->d3GetLongdesc( )->getRawValue() ?? '';
|
$longdesc = $oManufacturer->d3GetLongdesc( )->getRawValue() ?? '';
|
||||||
$deactivateSmarty = Registry::getConfig()->getConfigParam('deactivateSmartyForCmsContent');
|
$deactivateSmarty = Registry::getConfig()->getConfigParam('deactivateSmartyForCmsContent');
|
||||||
$processLongDescriptions = Registry::getConfig()->getConfigParam('bl_perfParseLongDescinSmarty');
|
$processLongDescriptions = Registry::getConfig()->getConfigParam('bl_perfParseLongDescinSmarty');
|
||||||
if (!$deactivateSmarty && $processLongDescriptions) {
|
if (!$deactivateSmarty && $processLongDescriptions) {
|
||||||
|
$viewData = array_merge(
|
||||||
|
Registry::getConfig()->getActiveView()->getViewData(),
|
||||||
|
[
|
||||||
|
'oShop' => Registry::getConfig()->getActiveShop(),
|
||||||
|
'oViewConf' => Registry::getConfig()->getActiveView()->getViewConfig()
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
$longdesc = $this->getRenderer()->renderFragment(
|
$longdesc = $this->getRenderer()->renderFragment(
|
||||||
$longdesc,
|
$longdesc,
|
||||||
$oManufacturer->getId() . $oManufacturer->getLanguage(),
|
sprintf('ox:%s%s', $oManufacturer->getId(), $oManufacturer->getLanguage()),
|
||||||
[],
|
$viewData
|
||||||
true
|
|
||||||
) ?? '';
|
) ?? '';
|
||||||
}
|
}
|
||||||
|
|
||||||
$oManufacturer->oxcategories__oxlongdesc = new Field(html_entity_decode($longdesc), Field::T_RAW);
|
$oManufacturer->oxcategories__oxlongdesc = new Field(html_entity_decode($longdesc), Field::T_RAW);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return TemplateRendererInterface
|
||||||
|
* @throws ContainerExceptionInterface
|
||||||
|
* @throws NotFoundExceptionInterface
|
||||||
|
*/
|
||||||
private function getRenderer(): TemplateRendererInterface
|
private function getRenderer(): TemplateRendererInterface
|
||||||
{
|
{
|
||||||
return $this->getContainer()->get(TemplateRendererBridgeInterface::class)->getTemplateRenderer();
|
return ContainerFactory::getInstance()->getContainer()->get(TemplateRendererBridgeInterface::class)->getTemplateRenderer();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -18,18 +18,23 @@ declare(strict_types=1);
|
|||||||
namespace D3\ManufacturerInformation\Modules\Core;
|
namespace D3\ManufacturerInformation\Modules\Core;
|
||||||
|
|
||||||
use D3\ManufacturerInformation\Application\Model\Constants;
|
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 OxidEsales\EshopCommunity\Internal\Framework\Module\Facade\ModuleSettingServiceInterface;
|
||||||
|
use Psr\Container\ContainerExceptionInterface;
|
||||||
|
use Psr\Container\NotFoundExceptionInterface;
|
||||||
|
|
||||||
class ManufacturerConfig extends ManufacturerConfig_parent
|
class ManufacturerConfig extends ManufacturerConfig_parent
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @param string $sName
|
* @param string $sName
|
||||||
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
|
* @throws ContainerExceptionInterface
|
||||||
|
* @throws NotFoundExceptionInterface
|
||||||
*/
|
*/
|
||||||
public function d3GetBoolModuleSettingByName(string $sName): bool
|
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);
|
return $moduleSettingService->getBoolean(Constants::OXID_MODULE_ID.$sName, Constants::OXID_MODULE_ID);
|
||||||
}
|
}
|
||||||
|
@ -26,7 +26,7 @@ Sofern nötig, bestätigen Sie bitte, dass Sie `package-name` erlauben, Code aus
|
|||||||
```bash
|
```bash
|
||||||
./vendor/bin/oe-eshop-db_migrate migrations:migrate d3manufacturerinformation
|
./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:deactivate d3manufacturerinformation
|
||||||
./vendor/bin/oe-console oe:module:activate d3manufacturerinformation
|
./vendor/bin/oe-console oe:module:activate d3manufacturerinformation
|
||||||
|
|
||||||
|
2
menu.xml
2
menu.xml
@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="ISO-8859-15"?>
|
<?xml version="1.0" encoding="ISO-8859-15"?>
|
||||||
<OX>
|
<OX>
|
||||||
<OXMENU id="NAVIGATION_ESHOPADMIN">
|
<OXMENU id="NAVIGATION_ESHOPADMIN">
|
||||||
<MAINMENU id="mxuadmin">
|
<MAINMENU id="mxmainmenu">
|
||||||
<SUBMENU id="mxmanufacturer" cl="manufacturer" list="manufacturer_list">
|
<SUBMENU id="mxmanufacturer" cl="manufacturer" list="manufacturer_list">
|
||||||
<TAB id="mxd3manufacturerinfolongdesc" cl="d3manufacturerinfolongdesc" />
|
<TAB id="mxd3manufacturerinfolongdesc" cl="d3manufacturerinfolongdesc" />
|
||||||
</SUBMENU>
|
</SUBMENU>
|
||||||
|
@ -40,7 +40,7 @@ $aModule = [
|
|||||||
'en' => 'adds manufacturer information to the article list',
|
'en' => 'adds manufacturer information to the article list',
|
||||||
],
|
],
|
||||||
'thumbnail' => 'picture.svg',
|
'thumbnail' => 'picture.svg',
|
||||||
'version' => '2.0.3.0',
|
'version' => '2.0.3.1',
|
||||||
'author' => '(D3) Data Development (Inh.: Thomas Dartsch)',
|
'author' => '(D3) Data Development (Inh.: Thomas Dartsch)',
|
||||||
'email' => 'support@shopmodule.com',
|
'email' => 'support@shopmodule.com',
|
||||||
'url' => 'https://www.oxidmodule.com/',
|
'url' => 'https://www.oxidmodule.com/',
|
||||||
|
@ -18,6 +18,7 @@ declare(strict_types=1);
|
|||||||
namespace D3\ManufacturerInformation\Migrations;
|
namespace D3\ManufacturerInformation\Migrations;
|
||||||
|
|
||||||
use Doctrine\DBAL\Schema\Schema;
|
use Doctrine\DBAL\Schema\Schema;
|
||||||
|
use Doctrine\DBAL\Schema\SchemaException;
|
||||||
use Doctrine\DBAL\Types\TextType;
|
use Doctrine\DBAL\Types\TextType;
|
||||||
use Doctrine\Migrations\AbstractMigration;
|
use Doctrine\Migrations\AbstractMigration;
|
||||||
|
|
||||||
@ -45,7 +46,7 @@ final class Version20241023154223 extends AbstractMigration
|
|||||||
/**
|
/**
|
||||||
* @param Schema $schema
|
* @param Schema $schema
|
||||||
* @return void
|
* @return void
|
||||||
* @throws \Doctrine\DBAL\Schema\SchemaException
|
* @throws SchemaException
|
||||||
*/
|
*/
|
||||||
public function d3AddLongdescColumnToOxmanufacturers(Schema $schema)
|
public function d3AddLongdescColumnToOxmanufacturers(Schema $schema)
|
||||||
{
|
{
|
||||||
|
@ -17,7 +17,9 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace D3\ManufacturerInformation\Migrations;
|
namespace D3\ManufacturerInformation\Migrations;
|
||||||
|
|
||||||
|
use Doctrine\DBAL\Exception;
|
||||||
use Doctrine\DBAL\Schema\Schema;
|
use Doctrine\DBAL\Schema\Schema;
|
||||||
|
use Doctrine\DBAL\Schema\SchemaException;
|
||||||
use Doctrine\DBAL\Types\TextType;
|
use Doctrine\DBAL\Types\TextType;
|
||||||
use Doctrine\Migrations\AbstractMigration;
|
use Doctrine\Migrations\AbstractMigration;
|
||||||
|
|
||||||
@ -44,8 +46,10 @@ final class Version20241028172608 extends AbstractMigration
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Schema $schema
|
* @param Schema $schema
|
||||||
|
*
|
||||||
* @return void
|
* @return void
|
||||||
* @throws \Doctrine\DBAL\Schema\SchemaException
|
* @throws Exception
|
||||||
|
* @throws SchemaException
|
||||||
*/
|
*/
|
||||||
public function d3AddLongdescMultilangColumnsToOxmanufacturers(Schema $schema)
|
public function d3AddLongdescMultilangColumnsToOxmanufacturers(Schema $schema)
|
||||||
{
|
{
|
||||||
|
@ -33,7 +33,9 @@
|
|||||||
<input type="hidden" name="catlang" value="{{ catlang }}">
|
<input type="hidden" name="catlang" value="{{ catlang }}">
|
||||||
<input type="hidden" name="editval[oxmanufacturers__d3description]" value="">
|
<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>
|
</form>
|
||||||
|
|
||||||
{% include "bottomnaviitem.html.twig" %}
|
{% include "bottomnaviitem.html.twig" %}
|
||||||
|
@ -4,17 +4,19 @@
|
|||||||
{{ parent() }}
|
{{ parent() }}
|
||||||
|
|
||||||
{% set oManufacturer = oView.getManufacturer() %}
|
{% set oManufacturer = oView.getManufacturer() %}
|
||||||
{% set sShopURL = config.getConfigParam('sShopURL') %}
|
{% if oManufacturer && oManufacturer.getId() %}
|
||||||
{% set description = oManufacturer.d3GetLongdesc() %}
|
{% set sShopURL = config.getConfigParam('sShopURL') %}
|
||||||
|
{% set description = oManufacturer.d3GetLongdesc() %}
|
||||||
|
|
||||||
{% if oManufacturer and config.d3GetBoolModuleSettingByName('_showManufacturertextOnDetailsPage') and description|striptags|trim %}
|
{% if config.d3GetBoolModuleSettingByName('_showManufacturertextOnDetailsPage') and description|striptags|trim %}
|
||||||
<div class="col-12 col-md-6">
|
<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">
|
<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" }) }}
|
{{ translate({ ident: "D3_MANUFACTURERINFO_TAB" }) }}
|
||||||
|
</div>
|
||||||
|
<div id="manufacturer" class="collapse" aria-labelledby="manufacturer-collapsible">
|
||||||
|
{{ include(template_from_string(description)) }}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div id="manufacturer" class="collapse" aria-labelledby="manufacturer-collapsible">
|
{% endif %}
|
||||||
{{ include(template_from_string(description)) }}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endblock %}
|
{% endblock %}
|
Reference in New Issue
Block a user