How to find config column in core_config_data table?
-
14-04-2021 - |
سؤال
I want to add values to this field from "core_config_data" table, how do i identify it ?
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Config:etc/system_file.xsd">
<system>
<section id="vsbridge_indexer_settings">
<group id="catalog_settings" translate="label" type="text" sortOrder="500" showInDefault="1" showInWebsite="1" showInStore="1">
<field id="product_attributes" translate="label comment" type="multiselect" sortOrder="102" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Product attributes to export</label>
<source_model>Divante\VsbridgeIndexerCatalog\Model\Config\Source\Product\Attributes</source_model>
<backend_model>Divante\VsbridgeIndexerCatalog\Model\Config\Backend\Attributes</backend_model>
<can_be_empty>1</can_be_empty>
<comment>Select which product attributes should be exported. Some attributes will be always exported: name, sku, price, status, url_path, url_key, visibility.</comment>
</field>
</group>
</section>
</system>
</config>
المحلول
The value will be save in this pattern:
section_id/group_id/field_id
Sot the identifier for any of the filed will follow this pattern
For direct query in your database you can use:
select * from core_config_data where path='*section_id/group_id/field_id'
In your case query will be:
select * from core_config_data where path='vsbridge_indexer_settings/catalog_settings/product_attributes'
On code level you need to follow this to fetch your data using this:
protected $scopeConfig;
public function __construct(
...
\Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig,
...
)
{
...
$this->scopeConfig = $scopeConfig;
...
}
public function yourFunction()
{
$productAttributesConfig = $this->scopeConfig->getValue("vsbridge_indexer_settings/catalog_settings/product_attributes");
}
لا تنتمي إلى magento.stackexchange