2

Invalid date issue on dynamic generated fields. Having multiple date filed in tier price. On deleting the rows from tier price , other rows from and to date value showing weird invalid date like "12/05/1905".

Using Magento2.2 Please check attached screenshot from more info.

class DateRangeTier implements ModifierInterface { protected $arrayManager; public function __construct(ArrayManager $arrayManager) { $this->arrayManager = $arrayManager; } public function modifyMeta(array $meta) { $tierPricePath = $this->arrayManager->findPath('tier_price', $meta, null, 'children'); if ($tierPricePath) { $meta = $this->arrayManager->merge( $tierPricePath, $meta, $this->getTierPriceStructure() ); } //echo json_encode($meta);die; $meta['advanced_pricing_modal']['children']['advanced-pricing']['children']['tier_price']['arguments']['data']['config']['label'] = 'Manage Price Rules'; $meta['advanced_pricing_modal']['children']['advanced-pricing']['children']['tier_price']['children']['record']['children']['website_id']['arguments']['data']['config']['visible'] = false; $meta['advanced_pricing_modal']['children']['advanced-pricing']['children']['tier_price']['children']['record']['children']['cust_group']['arguments']['data']['config']['visible'] = false; $meta['advanced_pricing_modal']['children']['advanced-pricing']['children']['tier_price']['children']['record']['children']['price_qty']['arguments']['data']['config']['value'] = 1; $meta['advanced_pricing_modal']['children']['advanced-pricing']['children']['tier_price']['children']['record']['children']['price_qty']['arguments']['data']['config']['disabled'] = true; /*echo "<pre>"; echo json_encode($customPricing); echo "preee";die;*/ return $meta; } public function modifyData(array $data){ //echo "<pre>";print_r($data);die; return $data; } protected function getTierPriceStructure() { return [ 'children' => [ 'record' => [ 'children' => [ 'from_date' => [ 'arguments' => [ 'data' => [ 'config' => [ 'dataType' => 'date', 'formElement' => 'date', 'componentType' => Field::NAME, 'label' => __('From Date'), 'dataScope' => 'from_date', 'date_format' => 'm/d/Y', 'sortOrder' => 5, 'validation' => [ 'required-entry' => true, ], ], ], ], ], 'to_date' => [ 'arguments' => [ 'data' => [ 'config' => [ 'dataType' => 'date', 'formElement' => 'date', 'componentType' => Field::NAME, 'label' => __('To Date'), 'dataScope' => 'product', 'date_format' => 'm/d/Y', 'sortOrder' => 6, 'validation' => [ 'required-entry' => true, ], ], ], ], ], 'reward_points' => [ 'arguments' => [ 'data' => [ 'config' => [ 'formElement' => Input::NAME, 'componentType' => Field::NAME, 'dataType' => Number::NAME, 'label' => __('Reward Points'), 'dataScope' => 'reward_points', 'sortOrder' => 38, 'validation' => [ 'required-entry' => true, 'validate-greater-than-zero' => true, 'validate-digits' => true, ], ], ], ], ], ], ], ], ]; } } 

Added Custom columns to Tier Price. Using Magento2.2 . From and to date is required field. When i add more than one rows in tier price and selected different different date in all fields. After that if i delete any row, all other rows date field values is changed.

Like if first row is having from date "05/16/2018" and to date "05/17/2018"

In 2nd row from date "05/18/2018" and to date "05/19/2018". Now if i delete the 2nd row, the from and to date field value in first row is showing as from date "01/20/1905" to date "05/20/2018".

Field added using adminhtml di.xml:

<?xml version="1.0"?> <!-- /** * Copyright © 2016 Magento. All rights reserved. * See COPYING.txt for license details. */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Config:etc/system_file.xsd"> <virtualType name="Magento\Catalog\Ui\DataProvider\Product\Form\Modifier\Pool" type="Magento\Ui\DataProvider\Modifier\Pool"> <arguments> <argument name="modifiers" xsi:type="array"> <item name="neoCustomAdvancePricing" xsi:type="array"> <item name="class" xsi:type="string">Neo\Marketplace\Ui\DataProvider\Product\Form\Modifier\DateRangeTier</item> <item name="sortOrder" xsi:type="number">95</item> </item> </argument> </arguments> </virtualType> </config> 

Multiple date field in tier price

Multiple rows with tier price

On deleting any row, from and to date in all other will be changed to past year like "12/02/1905"

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.