Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/add eu responsible data #3602

Open
wants to merge 57 commits into
base: stable
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
26286f5
add space for testing purpose
ivladu-plenty Oct 22, 2024
94823e4
add eu responsible tab
ivladu-plenty Oct 23, 2024
e0a8a27
Added default values for manufacturer
teodorrosusn Oct 23, 2024
5ce83fa
Update DefaultSingleItemPreset.php
teodorrosusn Oct 23, 2024
711f8b9
Changes
teodorrosusn Oct 23, 2024
d243e63
Attempt number 300
teodorrosusn Oct 23, 2024
0b8dc19
Changed manufacturer fields
teodorrosusn Oct 23, 2024
20c24dd
Update DefaultSingleItemPreset.php
teodorrosusn Oct 23, 2024
5b25c06
createManufacturerResponsibleName
teodorrosusn Oct 23, 2024
97104f3
Added generator for EU Responsible Fields
teodorrosusn Oct 23, 2024
a6586c1
Testing
teodorrosusn Oct 23, 2024
be76f46
Update DefaultSingleItemPreset.php
teodorrosusn Oct 23, 2024
f533a0e
testing
teodorrosusn Oct 23, 2024
4de1c3a
asdf
teodorrosusn Oct 23, 2024
b5e6680
Added translation
teodorrosusn Oct 23, 2024
99cf21c
Another one
teodorrosusn Oct 23, 2024
6031292
Import classes
teodorrosusn Oct 23, 2024
7340c11
Update ManufacturerDataWidget.twig
teodorrosusn Oct 24, 2024
efb6f8e
test
teodorrosusn Oct 24, 2024
ddfb66f
Update ManufacturerDataWidget.twig
teodorrosusn Oct 24, 2024
127088c
Update ManufacturerDataWidget.twig
teodorrosusn Oct 24, 2024
8b626bd
Update ManufacturerDataWidget.twig
teodorrosusn Oct 24, 2024
6e23129
remove unused code
ivladu-plenty Oct 24, 2024
af17fd1
test settings
ivladu-plenty Oct 24, 2024
986576f
test item_data_field
ivladu-plenty Oct 24, 2024
8cf11c9
test item_data_field 2
ivladu-plenty Oct 24, 2024
6821914
add raw
ivladu-plenty Oct 24, 2024
e41e305
Update DefaultSingleItemPreset.php
teodorrosusn Oct 28, 2024
b3bdcff
Update DefaultSingleItemPreset.php
teodorrosusn Oct 28, 2024
597a5c9
Update DefaultSingleItemPreset.php
teodorrosusn Oct 28, 2024
0aafb53
Update DefaultSingleItemPreset.php
teodorrosusn Oct 28, 2024
16c626f
changes
ivladu-plenty Oct 28, 2024
315b44e
Update DefaultSingleItemPreset.php
teodorrosusn Oct 28, 2024
0a3174e
Update DefaultSingleItemPreset.php
teodorrosusn Oct 28, 2024
4c6a933
remove duplicate code
ivladu-plenty Oct 28, 2024
6a83fc2
Update DefaultSingleItemPreset.php
teodorrosusn Oct 28, 2024
8e1b39b
Update DefaultSingleItemPreset.php
teodorrosusn Oct 28, 2024
b9fb0ee
Update DefaultSingleItemPreset.php
teodorrosusn Oct 28, 2024
7e97911
changes to twig
ivladu-plenty Oct 28, 2024
70c2921
changes to default
ivladu-plenty Oct 28, 2024
15b7bd1
add custom classes
ivladu-plenty Oct 29, 2024
7a8c367
add var dump
ivladu-plenty Oct 29, 2024
3bfd89f
add print_r
ivladu-plenty Oct 29, 2024
a5281bf
remove print r
ivladu-plenty Oct 29, 2024
d96e2e4
add children
ivladu-plenty Oct 29, 2024
b7055d9
Merge branch 'stable' into feat/add_eu_responsible_data
ivladu-plenty Oct 29, 2024
79dd193
add all fields
ivladu-plenty Oct 29, 2024
abc2d83
change field from data provider
ivladu-plenty Oct 29, 2024
99b2ef0
change field from data provider 2
ivladu-plenty Oct 29, 2024
00fe760
use inlinetextwidget
ivladu-plenty Oct 29, 2024
9f85bd1
remove unused files
ivladu-plenty Oct 29, 2024
b8e4e19
fix error
ivladu-plenty Oct 29, 2024
c78b234
changes
ivladu-plenty Oct 29, 2024
dc68645
remove duplicate field
ivladu-plenty Oct 30, 2024
d7f7a08
Add text to eu responsible tab
ivladu-plenty Oct 30, 2024
0464658
make title smaller and add br tag
ivladu-plenty Oct 30, 2024
7ac7b87
remove title and body
ivladu-plenty Oct 30, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions resources/lang/de/Template.properties
Original file line number Diff line number Diff line change
Expand Up @@ -812,6 +812,9 @@ singleItemDimensions = "Maße"
singleItemExclusive = "zzgl."
singleItemExclVAT = "zzgl. ges. MwSt."
singleItemExternalVariationId = "Varianten-ID"
singleItemEuResponsiblePerson = "EU-Verantwortlicher"
singleItemEuResponsiblePersonTitle = "VERANTWORTLICHE STELLE IN DER EU"
singleItemEuResponsiblePersonBody = "Ein Wirtschaftsakteur mit Sitz innerhalb der EU, der sicherstellt, dass das Produkt allen erforderlichen Vorschriften entspricht."
singleItemFootnote1 = "*"
singleItemFootnote12 = "*, **"
singleItemFootnote2 = "**"
Expand Down
1 change: 1 addition & 0 deletions resources/lang/de/Widget.properties
Original file line number Diff line number Diff line change
Expand Up @@ -1081,3 +1081,4 @@ languageDetectionRedirect = "Automatische Weiterleitung aktivieren"
basketItemConsentLabel = "Zustimmung im Checkout"
basketItemConsentPropertyIdLabel = "Eigenschafts-ID"
basketItemConsentPropertyIdTooltip = "ID einer Eigenschaft eingeben. Nutzer:innen müssen Artikeln, die mit dieser Eigenschaft verknüpft sind, im Checkout über eine Checkbox zustimmen."
manufacturerLabel = "Herstellerin"
3 changes: 3 additions & 0 deletions resources/lang/en/Template.properties
Original file line number Diff line number Diff line change
Expand Up @@ -815,6 +815,9 @@ singleItemDimensions = "Dimensions"
singleItemExclusive = "excl."
singleItemExclVAT = "Excl. VAT"
singleItemExternalVariationId = "Variation ID"
singleItemEuResponsiblePerson = "EU-Responsible Person"
singleItemEuResponsiblePersonTitle = "RESPONSIBLE ENTITY IN THE EU"
singleItemEuResponsiblePersonBody = "An economic operator based within the EU who ensures that the product complies with all necessary regulations."
singleItemFootnote1 = "*"
singleItemFootnote12 = "*, **"
singleItemFootnote2 = "**"
Expand Down
1 change: 1 addition & 0 deletions resources/lang/en/Widget.properties
Original file line number Diff line number Diff line change
Expand Up @@ -1081,3 +1081,4 @@ languageDetectionRedirect = "Activate automatic redirect"
basketItemConsentLabel = "Consent in the checkout"
basketItemConsentPropertyIdLabel = "Property ID"
basketItemConsentPropertyIdTooltip = "Enter a property ID. Users need to separately consent to items that are linked to this property in the checkout via a checkbox."
manufacturerLabel = "Manufacturer"
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,53 @@
*/
class ManufacturerDataFieldProvider extends DataFieldProvider
{
/**
/** @var string */
public const RESPONSIBLE_NAME = 'responsibleName';
/** @var string */
public const RESPONSIBLE_STREET = 'responsibleStreet';
/** @var string */
public const RESPONSIBLE_HOUSE_NO = 'responsibleHouseNo';
/** @var string */
public const RESPONSIBLE_POST_CODE = 'responsiblePostCode';
/** @var string */
public const RESPONSIBLE_TOWN = 'responsibleTown';
/** @var string */
public const RESPONSIBLE_COUNTRY = 'responsibleCountry';
/** @var string */
public const RESPONSIBLE_EMAIL = 'responsibleEmail';
/** @var string */
public const RESPONSIBLE_PHONE = 'responsiblePhoneNo';

/**
* Registers item data fields for use in the ShopBuilder.
*/
function register()
{
$this->addField("name", "Ceres::Widget.dataFieldManufacturerName", "item_data_field('item.manufacturer.name')");
$this->addField("externalName", "Ceres::Widget.dataFieldManufacturerExternalName", "item_data_field('item.manufacturer.externalName')");
$this->addField("logo", "Ceres::Widget.dataFieldManufacturerLogo", "item_data_field('item.manufacturer.logo', null, 'src', 'img')");
$this->addField("responsibleName", "Ceres::Widget.dataFieldManufacturerResponsibleName", "item_data_field('item.manufacturer.responsibleName')");
$this->addField("responsibleStreet", "Ceres::Widget.dataFieldManufacturerResponsibleStreet", "item_data_field('item.manufacturer.responsibleStreet')");
$this->addField("responsibleHouseNo", "Ceres::Widget.dataFieldManufacturerResponsibleHouseNo", "item_data_field('item.manufacturer.responsibleHouseNo')");
$this->addField("responsiblePostCode", "Ceres::Widget.dataFieldManufacturerResponsiblePostCode", "item_data_field('item.manufacturer.responsiblePostCode')");
$this->addField("responsibleTown", "Ceres::Widget.dataFieldManufacturerResponsibleTown", "item_data_field('item.manufacturer.responsibleTown')");
$this->addField("responsibleCountry", "Ceres::Widget.dataFieldManufacturerResponsibleCountry", "item_data_field('item.manufacturer.responsibleCountry')");
$this->addField("responsibleEmail", "Ceres::Widget.dataFieldManufacturerResponsibleEmail", "item_data_field('item.manufacturer.responsibleEmail')");
$this->addField("responsiblePhoneNo", "Ceres::Widget.dataFieldManufacturerResponsiblePhoneNo", "item_data_field('item.manufacturer.responsiblePhoneNo')");

$this->addField(self::RESPONSIBLE_NAME, "Ceres::Widget.dataFieldManufacturerResponsibleName", "item_data_field('item.manufacturer.responsibleName')");
$this->addField(self::RESPONSIBLE_STREET, "Ceres::Widget.dataFieldManufacturerResponsibleStreet", "item_data_field('item.manufacturer.responsibleStreet')");
$this->addField(self::RESPONSIBLE_HOUSE_NO, "Ceres::Widget.dataFieldManufacturerResponsibleHouseNo", "item_data_field('item.manufacturer.responsibleHouseNo')");
$this->addField(self::RESPONSIBLE_POST_CODE, "Ceres::Widget.dataFieldManufacturerResponsiblePostCode", "item_data_field('item.manufacturer.responsiblePostCode')");
$this->addField(self::RESPONSIBLE_TOWN, "Ceres::Widget.dataFieldManufacturerResponsibleTown", "item_data_field('item.manufacturer.responsibleTown')");
$this->addField(self::RESPONSIBLE_COUNTRY, "Ceres::Widget.dataFieldManufacturerResponsibleCountry", "item_data_field('item.manufacturer.responsibleCountry')");
$this->addField(self::RESPONSIBLE_EMAIL, "Ceres::Widget.dataFieldManufacturerResponsibleEmail", "item_data_field('item.manufacturer.responsibleEmail')");
$this->addField(self::RESPONSIBLE_PHONE, "Ceres::Widget.dataFieldManufacturerResponsiblePhoneNo", "item_data_field('item.manufacturer.responsiblePhoneNo')");
}

public static function getFields(): array
{
return [
self::RESPONSIBLE_NAME,
self::RESPONSIBLE_STREET,
self::RESPONSIBLE_HOUSE_NO,
self::RESPONSIBLE_POST_CODE,
self::RESPONSIBLE_TOWN,
self::RESPONSIBLE_COUNTRY,
self::RESPONSIBLE_EMAIL,
self::RESPONSIBLE_PHONE,
];
}
}
69 changes: 49 additions & 20 deletions src/Widgets/Presets/DefaultSingleItemPreset.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace Ceres\Widgets\Presets;

use Ceres\Config\CeresConfig;
use Ceres\ShopBuilder\DataFieldProvider\Item\ManufacturerDataFieldProvider;
use Ceres\Widgets\Helper\Factories\PresetWidgetFactory;
use Ceres\Widgets\Helper\PresetHelper;
use Plenty\Modules\ShopBuilder\Contracts\ContentPreset;
Expand Down Expand Up @@ -125,6 +126,7 @@ private function createManufacturer()
->withSetting('spacing.padding.bottom.unit', null)
->withSetting('text', $dataProvider);
}

private function createNameHeader()
{
$itemName = '';
Expand Down Expand Up @@ -270,15 +272,20 @@ private function createItemBundleWidget()
private function createTabWidget()
{
$uuidGenerator = pluginApp(UniqueId::class);
$uuidTabDescription = $uuidGenerator->generateUniqueId();
$uuidTabTechData = $uuidGenerator->generateUniqueId();
$uuidTabMoreDetails = $uuidGenerator->generateUniqueId();
$uuidTabDescription = $uuidGenerator->generateUniqueId();
$uuidTabTechData = $uuidGenerator->generateUniqueId();
$uuidTabMoreDetails = $uuidGenerator->generateUniqueId();
$uuidEuResponsiblePerson = $uuidGenerator->generateUniqueId();
$titleTabDescription = $this->translator->trans("Ceres::Template.singleItemDescription");
$titleTabTechData = $this->translator->trans("Ceres::Template.singleItemTechnicalData");
$titleTabMoreDetails = $this->translator->trans("Ceres::Template.singleItemMoreDetails");
$tabs = array(array('title' => $titleTabDescription,'uuid' => $uuidTabDescription),
array('title' => $titleTabTechData, 'uuid' => $uuidTabTechData),
array('title' => $titleTabMoreDetails, 'uuid' => $uuidTabMoreDetails));
$titleTabEuResponsiblePerson = $this->translator->trans("Ceres::Template.singleItemEuResponsiblePerson");
$tabs = array(
array('title' => $titleTabDescription,'uuid' => $uuidTabDescription),
array('title' => $titleTabTechData, 'uuid' => $uuidTabTechData),
array('title' => $titleTabMoreDetails, 'uuid' => $uuidTabMoreDetails),
array('title' => $titleTabEuResponsiblePerson, 'uuid' => $uuidEuResponsiblePerson),
);

$this->tabWidget = $this->secondTwoColumnWidget->createChild('first', 'Ceres::TabWidget')
->withSetting('tabs', $tabs)
Expand Down Expand Up @@ -315,20 +322,42 @@ private function createTabWidget()
->withSetting('text',$this->getShopBuilderDataFieldProvider('TextsDataFieldProvider::technicalData',array('texts.technicalData', null, null)));

$this->tabWidget->createChild($uuidTabMoreDetails, 'Ceres::ItemDataTableWidget')
->withSetting('itemInformation',
array("item.id",
"item.condition.names.name",
"item.ageRestriction",
"variation.externalId",
"variation.model",
"item.manufacturer.externalName",
"item.producingCountry.names.name",
"unit.names.name",
"variation.weightG",
"variation.weightNetG",
"item.variationDimensions",
"variation.customsTariffNumber"));
}
->withSetting('itemInformation', [
"item.id",
"item.condition.names.name",
"item.ageRestriction",
"variation.externalId",
"variation.model",
"item.manufacturer.externalName",
"item.producingCountry.names.name",
"unit.names.name",
"variation.weightG",
"variation.weightNetG",
"item.variationDimensions",
"variation.customsTariffNumber"
]);

foreach (ManufacturerDataFieldProvider::getFields() as $field) {
$this->tabWidget->createChild($uuidEuResponsiblePerson, 'Ceres::InlineTextWidget')
->withSetting('appearance','none')
->withSetting('spacing.customPadding', true)
->withSetting('spacing.padding.left.value', 0)
->withSetting('spacing.padding.left.unit', null)
->withSetting('spacing.padding.right.value', 0)
->withSetting('spacing.padding.right.unit', null)
->withSetting('spacing.padding.top.value', 0)
->withSetting('spacing.padding.top.unit', null)
->withSetting('spacing.padding.bottom.value', 0)
->withSetting('spacing.padding.bottom.unit', null)
->withSetting(
'text',
$this->getShopBuilderDataFieldProvider(
'ManufacturerDataFieldProvider::' . $field,
['item.manufacturer.' . $field, null, null]
)
);
}
}

private function createAttributeWidget()
{
Expand Down