Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion src/Writer/Entity/Variant.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public function __construct(public string $id)

public function addDisplayValue(string $value, string $displayValue): void
{
$this->displayValues[$value] = $displayValue;
$this->displayValues[$value] = mb_substr($displayValue, 0, 256);
}

public function write(XmlWriter $writer): void
Expand Down
5 changes: 3 additions & 2 deletions tests/Writer/VariantsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@ class VariantsTest extends TestCase
public function test_variants_xml(): void
{
$variants = [
'colour' => ['red' => 'Red', 'blue' => 'Blue'],
'height' => ['H1' => 'Grande', 'H2' => 'Tall'],
'colour' => ['red' => 'Red', 'blue' => 'Blue'],
'height' => ['H1' => 'Grande', 'H2' => 'Tall'],
'description' => ['body' => 'Experience the UltraComfort Memory Foam Pillow, designed to support your neck and head with premium memory foam for ultimate comfort. The breathable, hypoallergenic cover keeps you cool all night. Perfect for any sleeping position, it promotes restful, refreshing sleep.'],
];

$xml = new XmlWriter;
Expand Down
7 changes: 7 additions & 0 deletions tests/fixtures/variants.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,11 @@
</variation-attribute-value>
</variation-attribute-values>
</variation-attribute>
<variation-attribute attribute-id="description" variation-attribute-id="description">
<variation-attribute-values>
<variation-attribute-value value="body">
<display-value xml:lang="x-default">Experience the UltraComfort Memory Foam Pillow, designed to support your neck and head with premium memory foam for ultimate comfort. The breathable, hypoallergenic cover keeps you cool all night. Perfect for any sleeping position, it promotes restful, ref</display-value>
</variation-attribute-value>
</variation-attribute-values>
</variation-attribute>
</catalog>