Custom fields in Catalog Price Rules Does not save to database
I have added some fields in the Catalog Price rule Module. when I save the form data it throws an error "Unable to save rule 5" . do I need to write a custom model for this or would it save automatically?
UI Form:
<?xml version="1.0" encoding="UTF-8"?>
<form xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd">
<fieldset name="rule_information" sortOrder="10">
<field name="name" formElement="input">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="source" xsi:type="string">catalog_rule</item>
</item>
</argument>
<settings>
<validation>
<rule name="required-entry" xsi:type="boolean">true</rule>
</validation>
<dataType>text</dataType>
<label translate="true">Sale Name</label>
<visible>true</visible>
<dataScope>name</dataScope>
</settings>
</field>
</fieldset>
<fieldset name="general">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="collapsible" xsi:type="boolean">true</item>
<item name="label" xsi:type="string" translate="true">Aditional Options</item>
<item name="sortOrder" xsi:type="number">100</item>
</item>
</argument>
<fieldset name="banners">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="collapsible" xsi:type="boolean">true</item>
<item name="label" xsi:type="string" translate="true">Top Banner On Product Pager</item>
<item name="sortOrder" xsi:type="number">100</item>
</item>
</argument>
<field name="product_top_banner">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="dataType" xsi:type="string">string</item>
<item name="source" xsi:type="string">catalog_rule</item>
<item name="label" xsi:type="string" translate="true">Upload</item>
<item name="visible" xsi:type="boolean">true</item>
<item name="formElement" xsi:type="string">fileUploader</item>
<item name="sortOrder" xsi:type="number">50</item>
<item name="elementTmpl" xsi:type="string">ui/form/element/uploader/uploader</item>
<item name="previewTmpl" xsi:type="string">PME_FlashSales/image-preview</item>
<item name="required" xsi:type="boolean">false</item>
<item name="uploaderConfig" xsi:type="array">
<item name="url" xsi:type="url" path="flash_sales/promo/banner/"/>
</item>
</item>
</argument>
</field>
<field name="product_top_banner_alt">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="label" xsi:type="string">Alt Text:</item>
<item name="visible" xsi:type="boolean">true</item>
<item name="dataType" xsi:type="string">text</item>
<item name="formElement" xsi:type="string">input</item>
<item name="source" xsi:type="string">catalog_rule</item>
<item name="validation" xsi:type="array">
<item name="required-entry" xsi:type="boolean">false</item>
</item>
</item>
</argument>
</field>
<field name="product_top_banner_link">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="label" xsi:type="string">Link:</item>
<item name="visible" xsi:type="boolean">true</item>
<item name="dataType" xsi:type="string">text</item>
<item name="formElement" xsi:type="string">input</item>
<item name="source" xsi:type="string">catalog_rule</item>
<item name="validation" xsi:type="array">
<item name="required-entry" xsi:type="boolean">false</item>
</item>
</item>
</argument>
</field>
</fieldset>
<!--After Product-->
<fieldset name="after_banners">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="collapsible" xsi:type="boolean">true</item>
<item name="label" xsi:type="string" translate="true">After Product Description Banner</item>
<item name="sortOrder" xsi:type="number">100</item>
</item>
</argument>
<field name="product_after_banner">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="dataType" xsi:type="string">string</item>
<item name="source" xsi:type="string">catalog_rule</item>
<item name="label" xsi:type="string" translate="true">Upload</item>
<item name="visible" xsi:type="boolean">true</item>
<item name="formElement" xsi:type="string">fileUploader</item>
<item name="sortOrder" xsi:type="number">50</item>
<item name="elementTmpl" xsi:type="string">ui/form/element/uploader/uploader</item>
<item name="previewTmpl" xsi:type="string">PME_FlashSales/image-preview</item>
<item name="required" xsi:type="boolean">false</item>
<item name="uploaderConfig" xsi:type="array">
<item name="url" xsi:type="url" path="flash_sales/promo/productbanner/"/>
</item>
</item>
</argument>
</field>
<field name="product_after_banner_alt">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="label" xsi:type="string">Alt Text:</item>
<item name="visible" xsi:type="boolean">true</item>
<item name="dataType" xsi:type="string">text</item>
<item name="formElement" xsi:type="string">input</item>
<item name="source" xsi:type="string">catalog_rule</item>
<item name="validation" xsi:type="array">
<item name="required-entry" xsi:type="boolean">false</item>
</item>
</item>
</argument>
</field>
<field name="product_after_banner_link">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="label" xsi:type="string">Link:</item>
<item name="visible" xsi:type="boolean">true</item>
<item name="dataType" xsi:type="string">text</item>
<item name="formElement" xsi:type="string">input</item>
<item name="source" xsi:type="string">catalog_rule</item>
<item name="validation" xsi:type="array">
<item name="required-entry" xsi:type="boolean">false</item>
</item>
</item>
</argument>
</field>
</fieldset>
<!--Label-->
<fieldset name="labels">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="collapsible" xsi:type="boolean">true</item>
<item name="label" xsi:type="string" translate="true">Labels</item>
<item name="sortOrder" xsi:type="number">150</item>
</item>
</argument>
<field name="product_labels">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="dataType" xsi:type="string">string</item>
<item name="source" xsi:type="string">product_top_banner</item>
<item name="label" xsi:type="string" translate="true">Upload</item>
<item name="visible" xsi:type="boolean">true</item>
<item name="formElement" xsi:type="string">fileUploader</item>
<item name="sortOrder" xsi:type="number">50</item>
<item name="elementTmpl" xsi:type="string">ui/form/element/uploader/uploader</item>
<item name="previewTmpl" xsi:type="string">PME_FlashSales/image-preview</item>
<item name="required" xsi:type="boolean">false</item>
<item name="uploaderConfig" xsi:type="array">
<item name="url" xsi:type="url" path="flash_sales/promo/label/"/>
</item>
</item>
</argument>
</field>
<field name="product_labels_alt">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="label" xsi:type="string">Alt Text:</item>
<item name="visible" xsi:type="boolean">true</item>
<item name="dataType" xsi:type="string">text</item>
<item name="formElement" xsi:type="string">input</item>
<item name="source" xsi:type="string">product_labels_alt</item>
<item name="validation" xsi:type="array">
<item name="required-entry" xsi:type="boolean">false</item>
</item>
</item>
</argument>
</field>
</fieldset>
</fieldset>
controller:
namespace CustomFlashSalesControllerAdminhtmlPromoCatalog;
use MagentoBackendAppActionContext;
use MagentoFrameworkExceptionLocalizedException;
use MagentoFrameworkRegistry;
use MagentoFrameworkStdlibDateTimeFilterDate;
use MagentoFrameworkAppRequestDataPersistorInterface;
class Save extends MagentoCatalogRuleControllerAdminhtmlPromoCatalogSave
{
/**
* @var DataPersistorInterface
*/
protected $dataPersistor;
/**
* @param Context $context
* @param Registry $coreRegistry
* @param Date $dateFilter
* @param DataPersistorInterface $dataPersistor
*/
public function __construct(
Context $context,
Registry $coreRegistry,
Date $dateFilter,
DataPersistorInterface $dataPersistor
) {
$this->dataPersistor = $dataPersistor;
parent::__construct($context, $coreRegistry, $dateFilter, $dataPersistor);
}
function execute()
{
if ($this->getRequest()->getPostValue()) {
/** @var MagentoCatalogRuleApiCatalogRuleRepositoryInterface $ruleRepository */
$ruleRepository = $this->_objectManager->get(
MagentoCatalogRuleApiCatalogRuleRepositoryInterface::class
);
/** @var MagentoCatalogRuleModelRule $model */
$model = $this->_objectManager->create(MagentoCatalogRuleModelRule::class);
// echo json_encode($model);exit;
try {
$data = $this->getRequest()->getPostValue();
// echo "<pre>";
// print_r($data);
// echo "</pre>";
// exit;
$this->_eventManager->dispatch(
'adminhtml_controller_catalogrule_prepare_save',
['request' => $this->getRequest()]
);
$id = $this->getRequest()->getParam('rule_id');
if ($id) {
$model = $ruleRepository->get($id);
}
$validateResult = $model->validateData(new MagentoFrameworkDataObject($data));
// echo json_encode($validateResult);exit;
if ($validateResult !== true) {
foreach ($validateResult as $errorMessage) {
// echo $errorMessage;exit;
$this->messageManager->addErrorMessage($errorMessage);
}
$this->_getSession()->setPageData($data);
$this->dataPersistor->set('catalog_rule', $data);
$this->_redirect('catalog_rule/*/edit', ['id' => $model->getId()]);
return;
}
if (isset($data['rule'])) {
$data['conditions'] = $data['rule']['conditions'];
unset($data['rule']);
}
$model->loadPost($data);
$this->_objectManager->get(MagentoBackendModelSession::class)->setPageData($data);
$this->dataPersistor->set('catalog_rule', $data);
// print_r($data);exit;
$ruleRepository->save($model);
$this->messageManager->addSuccessMessage(__('You saved the rule.'));
$this->_objectManager->get(MagentoBackendModelSession::class)->setPageData(false);
$this->dataPersistor->clear('catalog_rule');
if ($this->getRequest()->getParam('auto_apply')) {
$this->getRequest()->setParam('rule_id', $model->getId());
$this->_forward('applyRules');
} else {
if ($model->isRuleBehaviorChanged()) {
$this->_objectManager
->create(MagentoCatalogRuleModelFlag::class)
->loadSelf()
->setState(1)
->save();
}
if ($this->getRequest()->getParam('back')) {
$this->_redirect('catalog_rule/*/edit', ['id' => $model->getId()]);
return;
}
$this->_redirect('catalog_rule/*/');
}
return;
} catch (LocalizedException $e) {
$this->messageManager->addErrorMessage($e->getMessage());
} catch (Exception $e) {
$this->messageManager->addErrorMessage(
__('Something went wrong while saving the rule data. Please review the error log.')
);
$this->_objectManager->get(PsrLogLoggerInterface::class)->critical($e);
$this->_objectManager->get(MagentoBackendModelSession::class)->setPageData($data);
$this->dataPersistor->set('catalog_rule', $data);
$this->_redirect('catalog_rule/*/edit', ['id' => $this->getRequest()->getParam('rule_id')]);
return;
}
}
$this->_redirect('catalog_rule/*/');
}
}
catalog-price-rules
|
show 1 more comment
I have added some fields in the Catalog Price rule Module. when I save the form data it throws an error "Unable to save rule 5" . do I need to write a custom model for this or would it save automatically?
UI Form:
<?xml version="1.0" encoding="UTF-8"?>
<form xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd">
<fieldset name="rule_information" sortOrder="10">
<field name="name" formElement="input">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="source" xsi:type="string">catalog_rule</item>
</item>
</argument>
<settings>
<validation>
<rule name="required-entry" xsi:type="boolean">true</rule>
</validation>
<dataType>text</dataType>
<label translate="true">Sale Name</label>
<visible>true</visible>
<dataScope>name</dataScope>
</settings>
</field>
</fieldset>
<fieldset name="general">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="collapsible" xsi:type="boolean">true</item>
<item name="label" xsi:type="string" translate="true">Aditional Options</item>
<item name="sortOrder" xsi:type="number">100</item>
</item>
</argument>
<fieldset name="banners">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="collapsible" xsi:type="boolean">true</item>
<item name="label" xsi:type="string" translate="true">Top Banner On Product Pager</item>
<item name="sortOrder" xsi:type="number">100</item>
</item>
</argument>
<field name="product_top_banner">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="dataType" xsi:type="string">string</item>
<item name="source" xsi:type="string">catalog_rule</item>
<item name="label" xsi:type="string" translate="true">Upload</item>
<item name="visible" xsi:type="boolean">true</item>
<item name="formElement" xsi:type="string">fileUploader</item>
<item name="sortOrder" xsi:type="number">50</item>
<item name="elementTmpl" xsi:type="string">ui/form/element/uploader/uploader</item>
<item name="previewTmpl" xsi:type="string">PME_FlashSales/image-preview</item>
<item name="required" xsi:type="boolean">false</item>
<item name="uploaderConfig" xsi:type="array">
<item name="url" xsi:type="url" path="flash_sales/promo/banner/"/>
</item>
</item>
</argument>
</field>
<field name="product_top_banner_alt">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="label" xsi:type="string">Alt Text:</item>
<item name="visible" xsi:type="boolean">true</item>
<item name="dataType" xsi:type="string">text</item>
<item name="formElement" xsi:type="string">input</item>
<item name="source" xsi:type="string">catalog_rule</item>
<item name="validation" xsi:type="array">
<item name="required-entry" xsi:type="boolean">false</item>
</item>
</item>
</argument>
</field>
<field name="product_top_banner_link">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="label" xsi:type="string">Link:</item>
<item name="visible" xsi:type="boolean">true</item>
<item name="dataType" xsi:type="string">text</item>
<item name="formElement" xsi:type="string">input</item>
<item name="source" xsi:type="string">catalog_rule</item>
<item name="validation" xsi:type="array">
<item name="required-entry" xsi:type="boolean">false</item>
</item>
</item>
</argument>
</field>
</fieldset>
<!--After Product-->
<fieldset name="after_banners">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="collapsible" xsi:type="boolean">true</item>
<item name="label" xsi:type="string" translate="true">After Product Description Banner</item>
<item name="sortOrder" xsi:type="number">100</item>
</item>
</argument>
<field name="product_after_banner">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="dataType" xsi:type="string">string</item>
<item name="source" xsi:type="string">catalog_rule</item>
<item name="label" xsi:type="string" translate="true">Upload</item>
<item name="visible" xsi:type="boolean">true</item>
<item name="formElement" xsi:type="string">fileUploader</item>
<item name="sortOrder" xsi:type="number">50</item>
<item name="elementTmpl" xsi:type="string">ui/form/element/uploader/uploader</item>
<item name="previewTmpl" xsi:type="string">PME_FlashSales/image-preview</item>
<item name="required" xsi:type="boolean">false</item>
<item name="uploaderConfig" xsi:type="array">
<item name="url" xsi:type="url" path="flash_sales/promo/productbanner/"/>
</item>
</item>
</argument>
</field>
<field name="product_after_banner_alt">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="label" xsi:type="string">Alt Text:</item>
<item name="visible" xsi:type="boolean">true</item>
<item name="dataType" xsi:type="string">text</item>
<item name="formElement" xsi:type="string">input</item>
<item name="source" xsi:type="string">catalog_rule</item>
<item name="validation" xsi:type="array">
<item name="required-entry" xsi:type="boolean">false</item>
</item>
</item>
</argument>
</field>
<field name="product_after_banner_link">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="label" xsi:type="string">Link:</item>
<item name="visible" xsi:type="boolean">true</item>
<item name="dataType" xsi:type="string">text</item>
<item name="formElement" xsi:type="string">input</item>
<item name="source" xsi:type="string">catalog_rule</item>
<item name="validation" xsi:type="array">
<item name="required-entry" xsi:type="boolean">false</item>
</item>
</item>
</argument>
</field>
</fieldset>
<!--Label-->
<fieldset name="labels">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="collapsible" xsi:type="boolean">true</item>
<item name="label" xsi:type="string" translate="true">Labels</item>
<item name="sortOrder" xsi:type="number">150</item>
</item>
</argument>
<field name="product_labels">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="dataType" xsi:type="string">string</item>
<item name="source" xsi:type="string">product_top_banner</item>
<item name="label" xsi:type="string" translate="true">Upload</item>
<item name="visible" xsi:type="boolean">true</item>
<item name="formElement" xsi:type="string">fileUploader</item>
<item name="sortOrder" xsi:type="number">50</item>
<item name="elementTmpl" xsi:type="string">ui/form/element/uploader/uploader</item>
<item name="previewTmpl" xsi:type="string">PME_FlashSales/image-preview</item>
<item name="required" xsi:type="boolean">false</item>
<item name="uploaderConfig" xsi:type="array">
<item name="url" xsi:type="url" path="flash_sales/promo/label/"/>
</item>
</item>
</argument>
</field>
<field name="product_labels_alt">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="label" xsi:type="string">Alt Text:</item>
<item name="visible" xsi:type="boolean">true</item>
<item name="dataType" xsi:type="string">text</item>
<item name="formElement" xsi:type="string">input</item>
<item name="source" xsi:type="string">product_labels_alt</item>
<item name="validation" xsi:type="array">
<item name="required-entry" xsi:type="boolean">false</item>
</item>
</item>
</argument>
</field>
</fieldset>
</fieldset>
controller:
namespace CustomFlashSalesControllerAdminhtmlPromoCatalog;
use MagentoBackendAppActionContext;
use MagentoFrameworkExceptionLocalizedException;
use MagentoFrameworkRegistry;
use MagentoFrameworkStdlibDateTimeFilterDate;
use MagentoFrameworkAppRequestDataPersistorInterface;
class Save extends MagentoCatalogRuleControllerAdminhtmlPromoCatalogSave
{
/**
* @var DataPersistorInterface
*/
protected $dataPersistor;
/**
* @param Context $context
* @param Registry $coreRegistry
* @param Date $dateFilter
* @param DataPersistorInterface $dataPersistor
*/
public function __construct(
Context $context,
Registry $coreRegistry,
Date $dateFilter,
DataPersistorInterface $dataPersistor
) {
$this->dataPersistor = $dataPersistor;
parent::__construct($context, $coreRegistry, $dateFilter, $dataPersistor);
}
function execute()
{
if ($this->getRequest()->getPostValue()) {
/** @var MagentoCatalogRuleApiCatalogRuleRepositoryInterface $ruleRepository */
$ruleRepository = $this->_objectManager->get(
MagentoCatalogRuleApiCatalogRuleRepositoryInterface::class
);
/** @var MagentoCatalogRuleModelRule $model */
$model = $this->_objectManager->create(MagentoCatalogRuleModelRule::class);
// echo json_encode($model);exit;
try {
$data = $this->getRequest()->getPostValue();
// echo "<pre>";
// print_r($data);
// echo "</pre>";
// exit;
$this->_eventManager->dispatch(
'adminhtml_controller_catalogrule_prepare_save',
['request' => $this->getRequest()]
);
$id = $this->getRequest()->getParam('rule_id');
if ($id) {
$model = $ruleRepository->get($id);
}
$validateResult = $model->validateData(new MagentoFrameworkDataObject($data));
// echo json_encode($validateResult);exit;
if ($validateResult !== true) {
foreach ($validateResult as $errorMessage) {
// echo $errorMessage;exit;
$this->messageManager->addErrorMessage($errorMessage);
}
$this->_getSession()->setPageData($data);
$this->dataPersistor->set('catalog_rule', $data);
$this->_redirect('catalog_rule/*/edit', ['id' => $model->getId()]);
return;
}
if (isset($data['rule'])) {
$data['conditions'] = $data['rule']['conditions'];
unset($data['rule']);
}
$model->loadPost($data);
$this->_objectManager->get(MagentoBackendModelSession::class)->setPageData($data);
$this->dataPersistor->set('catalog_rule', $data);
// print_r($data);exit;
$ruleRepository->save($model);
$this->messageManager->addSuccessMessage(__('You saved the rule.'));
$this->_objectManager->get(MagentoBackendModelSession::class)->setPageData(false);
$this->dataPersistor->clear('catalog_rule');
if ($this->getRequest()->getParam('auto_apply')) {
$this->getRequest()->setParam('rule_id', $model->getId());
$this->_forward('applyRules');
} else {
if ($model->isRuleBehaviorChanged()) {
$this->_objectManager
->create(MagentoCatalogRuleModelFlag::class)
->loadSelf()
->setState(1)
->save();
}
if ($this->getRequest()->getParam('back')) {
$this->_redirect('catalog_rule/*/edit', ['id' => $model->getId()]);
return;
}
$this->_redirect('catalog_rule/*/');
}
return;
} catch (LocalizedException $e) {
$this->messageManager->addErrorMessage($e->getMessage());
} catch (Exception $e) {
$this->messageManager->addErrorMessage(
__('Something went wrong while saving the rule data. Please review the error log.')
);
$this->_objectManager->get(PsrLogLoggerInterface::class)->critical($e);
$this->_objectManager->get(MagentoBackendModelSession::class)->setPageData($data);
$this->dataPersistor->set('catalog_rule', $data);
$this->_redirect('catalog_rule/*/edit', ['id' => $this->getRequest()->getParam('rule_id')]);
return;
}
}
$this->_redirect('catalog_rule/*/');
}
}
catalog-price-rules
Can you please add your code?
– Abhishek Panchal
yesterday
code of controller or UI component?
– Ali Ejaz
yesterday
can you please add both the files?
– Abhishek Panchal
yesterday
added the complete code.
– Ali Ejaz
yesterday
You didnt define_objectManager
– Abhishek Panchal
yesterday
|
show 1 more comment
I have added some fields in the Catalog Price rule Module. when I save the form data it throws an error "Unable to save rule 5" . do I need to write a custom model for this or would it save automatically?
UI Form:
<?xml version="1.0" encoding="UTF-8"?>
<form xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd">
<fieldset name="rule_information" sortOrder="10">
<field name="name" formElement="input">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="source" xsi:type="string">catalog_rule</item>
</item>
</argument>
<settings>
<validation>
<rule name="required-entry" xsi:type="boolean">true</rule>
</validation>
<dataType>text</dataType>
<label translate="true">Sale Name</label>
<visible>true</visible>
<dataScope>name</dataScope>
</settings>
</field>
</fieldset>
<fieldset name="general">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="collapsible" xsi:type="boolean">true</item>
<item name="label" xsi:type="string" translate="true">Aditional Options</item>
<item name="sortOrder" xsi:type="number">100</item>
</item>
</argument>
<fieldset name="banners">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="collapsible" xsi:type="boolean">true</item>
<item name="label" xsi:type="string" translate="true">Top Banner On Product Pager</item>
<item name="sortOrder" xsi:type="number">100</item>
</item>
</argument>
<field name="product_top_banner">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="dataType" xsi:type="string">string</item>
<item name="source" xsi:type="string">catalog_rule</item>
<item name="label" xsi:type="string" translate="true">Upload</item>
<item name="visible" xsi:type="boolean">true</item>
<item name="formElement" xsi:type="string">fileUploader</item>
<item name="sortOrder" xsi:type="number">50</item>
<item name="elementTmpl" xsi:type="string">ui/form/element/uploader/uploader</item>
<item name="previewTmpl" xsi:type="string">PME_FlashSales/image-preview</item>
<item name="required" xsi:type="boolean">false</item>
<item name="uploaderConfig" xsi:type="array">
<item name="url" xsi:type="url" path="flash_sales/promo/banner/"/>
</item>
</item>
</argument>
</field>
<field name="product_top_banner_alt">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="label" xsi:type="string">Alt Text:</item>
<item name="visible" xsi:type="boolean">true</item>
<item name="dataType" xsi:type="string">text</item>
<item name="formElement" xsi:type="string">input</item>
<item name="source" xsi:type="string">catalog_rule</item>
<item name="validation" xsi:type="array">
<item name="required-entry" xsi:type="boolean">false</item>
</item>
</item>
</argument>
</field>
<field name="product_top_banner_link">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="label" xsi:type="string">Link:</item>
<item name="visible" xsi:type="boolean">true</item>
<item name="dataType" xsi:type="string">text</item>
<item name="formElement" xsi:type="string">input</item>
<item name="source" xsi:type="string">catalog_rule</item>
<item name="validation" xsi:type="array">
<item name="required-entry" xsi:type="boolean">false</item>
</item>
</item>
</argument>
</field>
</fieldset>
<!--After Product-->
<fieldset name="after_banners">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="collapsible" xsi:type="boolean">true</item>
<item name="label" xsi:type="string" translate="true">After Product Description Banner</item>
<item name="sortOrder" xsi:type="number">100</item>
</item>
</argument>
<field name="product_after_banner">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="dataType" xsi:type="string">string</item>
<item name="source" xsi:type="string">catalog_rule</item>
<item name="label" xsi:type="string" translate="true">Upload</item>
<item name="visible" xsi:type="boolean">true</item>
<item name="formElement" xsi:type="string">fileUploader</item>
<item name="sortOrder" xsi:type="number">50</item>
<item name="elementTmpl" xsi:type="string">ui/form/element/uploader/uploader</item>
<item name="previewTmpl" xsi:type="string">PME_FlashSales/image-preview</item>
<item name="required" xsi:type="boolean">false</item>
<item name="uploaderConfig" xsi:type="array">
<item name="url" xsi:type="url" path="flash_sales/promo/productbanner/"/>
</item>
</item>
</argument>
</field>
<field name="product_after_banner_alt">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="label" xsi:type="string">Alt Text:</item>
<item name="visible" xsi:type="boolean">true</item>
<item name="dataType" xsi:type="string">text</item>
<item name="formElement" xsi:type="string">input</item>
<item name="source" xsi:type="string">catalog_rule</item>
<item name="validation" xsi:type="array">
<item name="required-entry" xsi:type="boolean">false</item>
</item>
</item>
</argument>
</field>
<field name="product_after_banner_link">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="label" xsi:type="string">Link:</item>
<item name="visible" xsi:type="boolean">true</item>
<item name="dataType" xsi:type="string">text</item>
<item name="formElement" xsi:type="string">input</item>
<item name="source" xsi:type="string">catalog_rule</item>
<item name="validation" xsi:type="array">
<item name="required-entry" xsi:type="boolean">false</item>
</item>
</item>
</argument>
</field>
</fieldset>
<!--Label-->
<fieldset name="labels">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="collapsible" xsi:type="boolean">true</item>
<item name="label" xsi:type="string" translate="true">Labels</item>
<item name="sortOrder" xsi:type="number">150</item>
</item>
</argument>
<field name="product_labels">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="dataType" xsi:type="string">string</item>
<item name="source" xsi:type="string">product_top_banner</item>
<item name="label" xsi:type="string" translate="true">Upload</item>
<item name="visible" xsi:type="boolean">true</item>
<item name="formElement" xsi:type="string">fileUploader</item>
<item name="sortOrder" xsi:type="number">50</item>
<item name="elementTmpl" xsi:type="string">ui/form/element/uploader/uploader</item>
<item name="previewTmpl" xsi:type="string">PME_FlashSales/image-preview</item>
<item name="required" xsi:type="boolean">false</item>
<item name="uploaderConfig" xsi:type="array">
<item name="url" xsi:type="url" path="flash_sales/promo/label/"/>
</item>
</item>
</argument>
</field>
<field name="product_labels_alt">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="label" xsi:type="string">Alt Text:</item>
<item name="visible" xsi:type="boolean">true</item>
<item name="dataType" xsi:type="string">text</item>
<item name="formElement" xsi:type="string">input</item>
<item name="source" xsi:type="string">product_labels_alt</item>
<item name="validation" xsi:type="array">
<item name="required-entry" xsi:type="boolean">false</item>
</item>
</item>
</argument>
</field>
</fieldset>
</fieldset>
controller:
namespace CustomFlashSalesControllerAdminhtmlPromoCatalog;
use MagentoBackendAppActionContext;
use MagentoFrameworkExceptionLocalizedException;
use MagentoFrameworkRegistry;
use MagentoFrameworkStdlibDateTimeFilterDate;
use MagentoFrameworkAppRequestDataPersistorInterface;
class Save extends MagentoCatalogRuleControllerAdminhtmlPromoCatalogSave
{
/**
* @var DataPersistorInterface
*/
protected $dataPersistor;
/**
* @param Context $context
* @param Registry $coreRegistry
* @param Date $dateFilter
* @param DataPersistorInterface $dataPersistor
*/
public function __construct(
Context $context,
Registry $coreRegistry,
Date $dateFilter,
DataPersistorInterface $dataPersistor
) {
$this->dataPersistor = $dataPersistor;
parent::__construct($context, $coreRegistry, $dateFilter, $dataPersistor);
}
function execute()
{
if ($this->getRequest()->getPostValue()) {
/** @var MagentoCatalogRuleApiCatalogRuleRepositoryInterface $ruleRepository */
$ruleRepository = $this->_objectManager->get(
MagentoCatalogRuleApiCatalogRuleRepositoryInterface::class
);
/** @var MagentoCatalogRuleModelRule $model */
$model = $this->_objectManager->create(MagentoCatalogRuleModelRule::class);
// echo json_encode($model);exit;
try {
$data = $this->getRequest()->getPostValue();
// echo "<pre>";
// print_r($data);
// echo "</pre>";
// exit;
$this->_eventManager->dispatch(
'adminhtml_controller_catalogrule_prepare_save',
['request' => $this->getRequest()]
);
$id = $this->getRequest()->getParam('rule_id');
if ($id) {
$model = $ruleRepository->get($id);
}
$validateResult = $model->validateData(new MagentoFrameworkDataObject($data));
// echo json_encode($validateResult);exit;
if ($validateResult !== true) {
foreach ($validateResult as $errorMessage) {
// echo $errorMessage;exit;
$this->messageManager->addErrorMessage($errorMessage);
}
$this->_getSession()->setPageData($data);
$this->dataPersistor->set('catalog_rule', $data);
$this->_redirect('catalog_rule/*/edit', ['id' => $model->getId()]);
return;
}
if (isset($data['rule'])) {
$data['conditions'] = $data['rule']['conditions'];
unset($data['rule']);
}
$model->loadPost($data);
$this->_objectManager->get(MagentoBackendModelSession::class)->setPageData($data);
$this->dataPersistor->set('catalog_rule', $data);
// print_r($data);exit;
$ruleRepository->save($model);
$this->messageManager->addSuccessMessage(__('You saved the rule.'));
$this->_objectManager->get(MagentoBackendModelSession::class)->setPageData(false);
$this->dataPersistor->clear('catalog_rule');
if ($this->getRequest()->getParam('auto_apply')) {
$this->getRequest()->setParam('rule_id', $model->getId());
$this->_forward('applyRules');
} else {
if ($model->isRuleBehaviorChanged()) {
$this->_objectManager
->create(MagentoCatalogRuleModelFlag::class)
->loadSelf()
->setState(1)
->save();
}
if ($this->getRequest()->getParam('back')) {
$this->_redirect('catalog_rule/*/edit', ['id' => $model->getId()]);
return;
}
$this->_redirect('catalog_rule/*/');
}
return;
} catch (LocalizedException $e) {
$this->messageManager->addErrorMessage($e->getMessage());
} catch (Exception $e) {
$this->messageManager->addErrorMessage(
__('Something went wrong while saving the rule data. Please review the error log.')
);
$this->_objectManager->get(PsrLogLoggerInterface::class)->critical($e);
$this->_objectManager->get(MagentoBackendModelSession::class)->setPageData($data);
$this->dataPersistor->set('catalog_rule', $data);
$this->_redirect('catalog_rule/*/edit', ['id' => $this->getRequest()->getParam('rule_id')]);
return;
}
}
$this->_redirect('catalog_rule/*/');
}
}
catalog-price-rules
I have added some fields in the Catalog Price rule Module. when I save the form data it throws an error "Unable to save rule 5" . do I need to write a custom model for this or would it save automatically?
UI Form:
<?xml version="1.0" encoding="UTF-8"?>
<form xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd">
<fieldset name="rule_information" sortOrder="10">
<field name="name" formElement="input">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="source" xsi:type="string">catalog_rule</item>
</item>
</argument>
<settings>
<validation>
<rule name="required-entry" xsi:type="boolean">true</rule>
</validation>
<dataType>text</dataType>
<label translate="true">Sale Name</label>
<visible>true</visible>
<dataScope>name</dataScope>
</settings>
</field>
</fieldset>
<fieldset name="general">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="collapsible" xsi:type="boolean">true</item>
<item name="label" xsi:type="string" translate="true">Aditional Options</item>
<item name="sortOrder" xsi:type="number">100</item>
</item>
</argument>
<fieldset name="banners">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="collapsible" xsi:type="boolean">true</item>
<item name="label" xsi:type="string" translate="true">Top Banner On Product Pager</item>
<item name="sortOrder" xsi:type="number">100</item>
</item>
</argument>
<field name="product_top_banner">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="dataType" xsi:type="string">string</item>
<item name="source" xsi:type="string">catalog_rule</item>
<item name="label" xsi:type="string" translate="true">Upload</item>
<item name="visible" xsi:type="boolean">true</item>
<item name="formElement" xsi:type="string">fileUploader</item>
<item name="sortOrder" xsi:type="number">50</item>
<item name="elementTmpl" xsi:type="string">ui/form/element/uploader/uploader</item>
<item name="previewTmpl" xsi:type="string">PME_FlashSales/image-preview</item>
<item name="required" xsi:type="boolean">false</item>
<item name="uploaderConfig" xsi:type="array">
<item name="url" xsi:type="url" path="flash_sales/promo/banner/"/>
</item>
</item>
</argument>
</field>
<field name="product_top_banner_alt">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="label" xsi:type="string">Alt Text:</item>
<item name="visible" xsi:type="boolean">true</item>
<item name="dataType" xsi:type="string">text</item>
<item name="formElement" xsi:type="string">input</item>
<item name="source" xsi:type="string">catalog_rule</item>
<item name="validation" xsi:type="array">
<item name="required-entry" xsi:type="boolean">false</item>
</item>
</item>
</argument>
</field>
<field name="product_top_banner_link">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="label" xsi:type="string">Link:</item>
<item name="visible" xsi:type="boolean">true</item>
<item name="dataType" xsi:type="string">text</item>
<item name="formElement" xsi:type="string">input</item>
<item name="source" xsi:type="string">catalog_rule</item>
<item name="validation" xsi:type="array">
<item name="required-entry" xsi:type="boolean">false</item>
</item>
</item>
</argument>
</field>
</fieldset>
<!--After Product-->
<fieldset name="after_banners">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="collapsible" xsi:type="boolean">true</item>
<item name="label" xsi:type="string" translate="true">After Product Description Banner</item>
<item name="sortOrder" xsi:type="number">100</item>
</item>
</argument>
<field name="product_after_banner">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="dataType" xsi:type="string">string</item>
<item name="source" xsi:type="string">catalog_rule</item>
<item name="label" xsi:type="string" translate="true">Upload</item>
<item name="visible" xsi:type="boolean">true</item>
<item name="formElement" xsi:type="string">fileUploader</item>
<item name="sortOrder" xsi:type="number">50</item>
<item name="elementTmpl" xsi:type="string">ui/form/element/uploader/uploader</item>
<item name="previewTmpl" xsi:type="string">PME_FlashSales/image-preview</item>
<item name="required" xsi:type="boolean">false</item>
<item name="uploaderConfig" xsi:type="array">
<item name="url" xsi:type="url" path="flash_sales/promo/productbanner/"/>
</item>
</item>
</argument>
</field>
<field name="product_after_banner_alt">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="label" xsi:type="string">Alt Text:</item>
<item name="visible" xsi:type="boolean">true</item>
<item name="dataType" xsi:type="string">text</item>
<item name="formElement" xsi:type="string">input</item>
<item name="source" xsi:type="string">catalog_rule</item>
<item name="validation" xsi:type="array">
<item name="required-entry" xsi:type="boolean">false</item>
</item>
</item>
</argument>
</field>
<field name="product_after_banner_link">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="label" xsi:type="string">Link:</item>
<item name="visible" xsi:type="boolean">true</item>
<item name="dataType" xsi:type="string">text</item>
<item name="formElement" xsi:type="string">input</item>
<item name="source" xsi:type="string">catalog_rule</item>
<item name="validation" xsi:type="array">
<item name="required-entry" xsi:type="boolean">false</item>
</item>
</item>
</argument>
</field>
</fieldset>
<!--Label-->
<fieldset name="labels">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="collapsible" xsi:type="boolean">true</item>
<item name="label" xsi:type="string" translate="true">Labels</item>
<item name="sortOrder" xsi:type="number">150</item>
</item>
</argument>
<field name="product_labels">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="dataType" xsi:type="string">string</item>
<item name="source" xsi:type="string">product_top_banner</item>
<item name="label" xsi:type="string" translate="true">Upload</item>
<item name="visible" xsi:type="boolean">true</item>
<item name="formElement" xsi:type="string">fileUploader</item>
<item name="sortOrder" xsi:type="number">50</item>
<item name="elementTmpl" xsi:type="string">ui/form/element/uploader/uploader</item>
<item name="previewTmpl" xsi:type="string">PME_FlashSales/image-preview</item>
<item name="required" xsi:type="boolean">false</item>
<item name="uploaderConfig" xsi:type="array">
<item name="url" xsi:type="url" path="flash_sales/promo/label/"/>
</item>
</item>
</argument>
</field>
<field name="product_labels_alt">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="label" xsi:type="string">Alt Text:</item>
<item name="visible" xsi:type="boolean">true</item>
<item name="dataType" xsi:type="string">text</item>
<item name="formElement" xsi:type="string">input</item>
<item name="source" xsi:type="string">product_labels_alt</item>
<item name="validation" xsi:type="array">
<item name="required-entry" xsi:type="boolean">false</item>
</item>
</item>
</argument>
</field>
</fieldset>
</fieldset>
controller:
namespace CustomFlashSalesControllerAdminhtmlPromoCatalog;
use MagentoBackendAppActionContext;
use MagentoFrameworkExceptionLocalizedException;
use MagentoFrameworkRegistry;
use MagentoFrameworkStdlibDateTimeFilterDate;
use MagentoFrameworkAppRequestDataPersistorInterface;
class Save extends MagentoCatalogRuleControllerAdminhtmlPromoCatalogSave
{
/**
* @var DataPersistorInterface
*/
protected $dataPersistor;
/**
* @param Context $context
* @param Registry $coreRegistry
* @param Date $dateFilter
* @param DataPersistorInterface $dataPersistor
*/
public function __construct(
Context $context,
Registry $coreRegistry,
Date $dateFilter,
DataPersistorInterface $dataPersistor
) {
$this->dataPersistor = $dataPersistor;
parent::__construct($context, $coreRegistry, $dateFilter, $dataPersistor);
}
function execute()
{
if ($this->getRequest()->getPostValue()) {
/** @var MagentoCatalogRuleApiCatalogRuleRepositoryInterface $ruleRepository */
$ruleRepository = $this->_objectManager->get(
MagentoCatalogRuleApiCatalogRuleRepositoryInterface::class
);
/** @var MagentoCatalogRuleModelRule $model */
$model = $this->_objectManager->create(MagentoCatalogRuleModelRule::class);
// echo json_encode($model);exit;
try {
$data = $this->getRequest()->getPostValue();
// echo "<pre>";
// print_r($data);
// echo "</pre>";
// exit;
$this->_eventManager->dispatch(
'adminhtml_controller_catalogrule_prepare_save',
['request' => $this->getRequest()]
);
$id = $this->getRequest()->getParam('rule_id');
if ($id) {
$model = $ruleRepository->get($id);
}
$validateResult = $model->validateData(new MagentoFrameworkDataObject($data));
// echo json_encode($validateResult);exit;
if ($validateResult !== true) {
foreach ($validateResult as $errorMessage) {
// echo $errorMessage;exit;
$this->messageManager->addErrorMessage($errorMessage);
}
$this->_getSession()->setPageData($data);
$this->dataPersistor->set('catalog_rule', $data);
$this->_redirect('catalog_rule/*/edit', ['id' => $model->getId()]);
return;
}
if (isset($data['rule'])) {
$data['conditions'] = $data['rule']['conditions'];
unset($data['rule']);
}
$model->loadPost($data);
$this->_objectManager->get(MagentoBackendModelSession::class)->setPageData($data);
$this->dataPersistor->set('catalog_rule', $data);
// print_r($data);exit;
$ruleRepository->save($model);
$this->messageManager->addSuccessMessage(__('You saved the rule.'));
$this->_objectManager->get(MagentoBackendModelSession::class)->setPageData(false);
$this->dataPersistor->clear('catalog_rule');
if ($this->getRequest()->getParam('auto_apply')) {
$this->getRequest()->setParam('rule_id', $model->getId());
$this->_forward('applyRules');
} else {
if ($model->isRuleBehaviorChanged()) {
$this->_objectManager
->create(MagentoCatalogRuleModelFlag::class)
->loadSelf()
->setState(1)
->save();
}
if ($this->getRequest()->getParam('back')) {
$this->_redirect('catalog_rule/*/edit', ['id' => $model->getId()]);
return;
}
$this->_redirect('catalog_rule/*/');
}
return;
} catch (LocalizedException $e) {
$this->messageManager->addErrorMessage($e->getMessage());
} catch (Exception $e) {
$this->messageManager->addErrorMessage(
__('Something went wrong while saving the rule data. Please review the error log.')
);
$this->_objectManager->get(PsrLogLoggerInterface::class)->critical($e);
$this->_objectManager->get(MagentoBackendModelSession::class)->setPageData($data);
$this->dataPersistor->set('catalog_rule', $data);
$this->_redirect('catalog_rule/*/edit', ['id' => $this->getRequest()->getParam('rule_id')]);
return;
}
}
$this->_redirect('catalog_rule/*/');
}
}
catalog-price-rules
catalog-price-rules
edited yesterday
asked yesterday
Ali Ejaz
20110
20110
Can you please add your code?
– Abhishek Panchal
yesterday
code of controller or UI component?
– Ali Ejaz
yesterday
can you please add both the files?
– Abhishek Panchal
yesterday
added the complete code.
– Ali Ejaz
yesterday
You didnt define_objectManager
– Abhishek Panchal
yesterday
|
show 1 more comment
Can you please add your code?
– Abhishek Panchal
yesterday
code of controller or UI component?
– Ali Ejaz
yesterday
can you please add both the files?
– Abhishek Panchal
yesterday
added the complete code.
– Ali Ejaz
yesterday
You didnt define_objectManager
– Abhishek Panchal
yesterday
Can you please add your code?
– Abhishek Panchal
yesterday
Can you please add your code?
– Abhishek Panchal
yesterday
code of controller or UI component?
– Ali Ejaz
yesterday
code of controller or UI component?
– Ali Ejaz
yesterday
can you please add both the files?
– Abhishek Panchal
yesterday
can you please add both the files?
– Abhishek Panchal
yesterday
added the complete code.
– Ali Ejaz
yesterday
added the complete code.
– Ali Ejaz
yesterday
You didnt define
_objectManager
– Abhishek Panchal
yesterday
You didnt define
_objectManager
– Abhishek Panchal
yesterday
|
show 1 more comment
0
active
oldest
votes
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "479"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f256662%2fcustom-fields-in-catalog-price-rules-does-not-save-to-database%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Magento Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f256662%2fcustom-fields-in-catalog-price-rules-does-not-save-to-database%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Can you please add your code?
– Abhishek Panchal
yesterday
code of controller or UI component?
– Ali Ejaz
yesterday
can you please add both the files?
– Abhishek Panchal
yesterday
added the complete code.
– Ali Ejaz
yesterday
You didnt define
_objectManager
– Abhishek Panchal
yesterday