Skip to content

Commit 6c29a9d

Browse files
author
Nikita Chubukov
committed
MAGETWO-95816: Invoice PDF contain different address when use arabic symbols
- Added processing to SKU field
1 parent 21c67b9 commit 6c29a9d

File tree

2 files changed

+19
-4
lines changed

2 files changed

+19
-4
lines changed

app/code/Magento/Sales/Model/Order/Address/Renderer.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,4 +102,16 @@ public function reverseArabicText($string)
102102
}
103103
return implode(' ', $splitText);
104104
}
105+
106+
/**
107+
* Check and revert arabic text
108+
*
109+
* @param string $string
110+
* @return string
111+
*/
112+
public function processArabicText($string)
113+
{
114+
return ($this->isArabic($string))
115+
? $this->reverseArabicText($string) : $string;
116+
}
105117
}

app/code/Magento/Sales/Model/Order/Pdf/Items/Invoice/DefaultInvoice.php

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,13 +78,16 @@ public function draw()
7878
$lines = [];
7979

8080
// draw Product name
81-
$productName = ($this->renderer->isArabic($item->getName()))
82-
? $this->renderer->reverseArabicText($item->getName()) : $item->getName();
83-
$lines[0] = [['text' => $this->string->split($productName, 35, true, true), 'feed' => 35]];
81+
$lines[0] = [
82+
[
83+
'text' => $this->string->split($this->renderer->processArabicText($item->getName()), 35, true, true),
84+
'feed' => 35
85+
]
86+
];
8487

8588
// draw SKU
8689
$lines[0][] = [
87-
'text' => $this->string->split($this->getSku($item), 17),
90+
'text' => $this->string->split($this->renderer->processArabicText($item->getSku($item)), 17),
8891
'feed' => 290,
8992
'align' => 'right',
9093
];

0 commit comments

Comments
 (0)