This commit is contained in:
2025-05-26 10:35:03 +02:00
2 changed files with 50 additions and 73 deletions

View File

@@ -113,7 +113,6 @@ foreach ($existingXml->xpath('//o') as $offer) {
}
}
// Dodanie elementu <a> z nazwą producenta odpowiedzialnego
if ($responsibleManufacturerId) {
$manufacturerName = $mdb->get(
'materac_x13gpsr_responsible_manufacturer',
@@ -121,13 +120,12 @@ foreach ($existingXml->xpath('//o') as $offer) {
['id_x13gpsr_responsible_manufacturer' => $responsibleManufacturerId]
);
$attrs = $offer->xpath('attrs');
if ($attrs && isset($attrs[0]))
{
$attrsElement = $attrs[0];
$attrElement = $attrsElement->addChild('a');
$attrElement->addAttribute('name', 'Producent odpowiedzialny');
$attrElement[0] = $manufacturerName;
if ($manufacturerName) {
$a = $dom->createElement('a');
$a->setAttribute('name', 'Producent odpowiedzialny');
$cdata = $dom->createCDATASection($manufacturerName);
$a->appendChild($cdata);
$offer->appendChild($a);
}
}
}