Skip to content

Commit

Permalink
🔃 [EngCom] Public Pull Requests - 2.1-develop
Browse files Browse the repository at this point in the history
Accepted Public Pull Requests:
 - #17613: [Backport] Added template as argument to the store address renderer to allow custom formatting (by @TomashKhamlai)
 - #17609: [Backport] 6305 - Resolved product custom option title save issue (by @jignesh-baldha)


Fixed GitHub Issues:
 - #6305: Can't save Customizable options (reported by @bachlee89) has been fixed in #17609 by @jignesh-baldha in 2.1-develop branch
   Related commits:
     1. cd9ba04
     2. 1bcd7dc
     3. 0a16848
     4. 470320e
  • Loading branch information
Stanislav Idolov authored Aug 15, 2018
2 parents 87f0927 + 684fe93 commit 964f7b0
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,9 @@ protected function isValidOptionTitle($title, $storeId)
if ($storeId > \Magento\Store\Model\Store::DEFAULT_STORE_ID && $title === null) {
return true;
}
if ($this->isEmpty($title)) {

// checking whether title is null and is empty string
if ($title === null || $title === '') {
return false;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,8 @@ protected function _saveValueTitles(AbstractModel $object)
$object->unsetData('title');
}

if ($object->getTitle()) {
/*** Checking whether title is not null ***/
if ($object->getTitle()!= null) {
if ($existInCurrentStore) {
if ($storeId == $object->getStoreId()) {
$where = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,8 @@ public function draw()
'feed' => 35,
];

if ($option['value']) {
// Checking whether option value is not null
if ($option['value']!= null) {
if (isset($option['print_value'])) {
$printValue = $option['print_value'];
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public function draw()
];

// draw options value
if ($option['value']) {
if ($option['value']!= null) {
$printValue = isset(
$option['print_value']
) ? $option['print_value'] : $this->filterManager->stripTags(
Expand Down
19 changes: 16 additions & 3 deletions app/code/Magento/Store/Model/Address/Renderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@
*/
class Renderer
{
const DEFAULT_TEMPLATE = "{{var name}}\n" .
"{{var street_line1}}\n" .
"{{depend street_line2}}{{var street_line2}}\n{{/depend}}" .
"{{depend city}}{{var city}},{{/depend}} {{var region}} {{depend postcode}}{{var postcode}},{{/depend}}\n" .
"{{var country}}";

/**
* @var EventManager
*/
Expand All @@ -25,18 +31,26 @@ class Renderer
*/
protected $filterManager;

/**
* @var string
*/
private $template;

/**
* Constructor
*
* @param EventManager $eventManager
* @param FilterManager $filterManager
* @param string $template
*/
public function __construct(
EventManager $eventManager,
FilterManager $filterManager
FilterManager $filterManager,
$template = self::DEFAULT_TEMPLATE
) {
$this->eventManager = $eventManager;
$this->filterManager = $filterManager;
$this->template = $template;
}

/**
Expand All @@ -50,8 +64,7 @@ public function format(DataObject $storeInfo, $type = 'html')
{
$this->eventManager->dispatch('store_address_format', ['type' => $type, 'store_info' => $storeInfo]);
$address = $this->filterManager->template(
"{{var name}}\n{{var street_line1}}\n{{depend street_line2}}{{var street_line2}}\n{{/depend}}"
. "{{var city}}, {{var region}} {{var postcode}},\n{{var country}}",
$this->template,
['variables' => $storeInfo->getData()]
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ public function testAddNegative($optionData)
];

if (TESTS_WEB_API_ADAPTER == self::ADAPTER_SOAP) {
if (isset($optionDataPost['title']) && empty($optionDataPost['title'])) {
if ($optionDataPost['title'] === null || $optionDataPost['title'] === '') {
$this->setExpectedException('SoapFault', 'Missed values for option required fields');
} else {
$this->setExpectedException('SoapFault', 'Invalid option');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

return [
'empty_required_field' => [
'title' => '',
'title' => null,
'type' => 'field',
'sort_order' => 1,
'is_require' => 1,
Expand Down Expand Up @@ -54,7 +54,7 @@
'price' => 10.0,
'price_type' => 'fixed',
'sku' => 'radio option 1 sku',
'title' => '',
'title' => null,
'sort_order' => 1,
],
],
Expand Down

0 comments on commit 964f7b0

Please sign in to comment.