Podcast #128: We chat with Kent C Dodds about why he loves React and discuss what life was like in the dark days before Git. Listen now.
100

We need to call the default method available. Just Use \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig, In your constructor argument and set the class property: $this->scopeConfig = $scopeConfig; Now to Get the configuration value just use $this->scopeConfig->getValue('dev/debug/template_hints', \Magento\Store\Model\ScopeInterface:...


30

Open your PHP Admin database (I tested on php 7) Find & click on the table called: sequence_order_1 (it is located in database itself not in the information_schema ) Click on "Operations" tab & under "AUTO_INCREMENT" edit to desired order number.


24

Go to your database from phpmyadmin, Here _1 is used for store id after tablename. Default Frontend store id is 1. if you have multi store then you have to set query for each store with table name like sequence_order_2 upto sequence_order_.* Enter below query for table sequence_order_1 is used for default store. If you have multiple store you have to set ...


21

There is the same saveConfig method: https://github.com/magento/magento2/blob/2.0.0/app/code/Magento/Config/Model/ResourceModel/Config.php#L26-L61 A usage example from the core: https://github.com/magento/magento2/blob/2.0.0/app/code/Magento/Payment/Observer/UpdateOrderStatusForPaymentMethodsObserver.php#L59-L64


21

This is how you should save data in magento2 core_config_data use Magento\Framework\App\Config\ScopeConfigInterface; /** * @var \Magento\Framework\App\Config\Storage\WriterInterface */ protected $configWriter; /** * * @param \Magento\Framework\App\Config\Storage\WriterInterface $configWriter */ public function ...


20

You can get a certain node from the config like this. $value = Mage::getConfig()->getNode('default/wishlist/general/active'); this should retrive the value of <default> <wishlist> <general> <active>1</active> <!-- this value --> </general> </wishlist> </default> ...


18

I wouldn't use a model or a resource model, but \Magento\Framework\App\Config\Storage\WriterInterface or \Magento\Framework\App\Config\ConfigResource\ConfigInterface (the first delegating to the second). Pretty straight-forward, too: use Magento\Framework\App\Config\Storage\WriterInterface; class SomeClass { public function __construct(...


16

What was previously in eav_entity_store is now covered in sales_sequence_profile and sales_sequence_meta. The table sequence_order_1 gets populated when orders are placed.


15

go to database and execute this query SELECT * FROM core_config_data WHERE path LIKE 'dev%' change these value from 1 to 0 dev/js/merge_files dev/css/merge_css_files


12

Yes, we can do this. We should take a look: vendor/magento/module-payment/etc/adminhtml/system.xml <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Config:etc/system_file.xsd"> <system> <section id="payment" translate="label" type="text" sortOrder="400" ...


11

core_config_data table contain two important fields scope and scope_id. There are three scope types default websites stores If scope is set to default then scope_id is always 0. If scope is set to websites then scope_id is website_id. If scope is set to stores then scope_id is store_id(store view). Imagine that we need to get some config value. How ...


8

If you have access to the Admin backend, navigate to the following configuration and set both CSS and JS merge to No and save config System=>Configuration=>Advanced=>Developer Also check to make sure you haven't set up separate configuration scopes for this (arrow - upper right corner) Then clear your Magento cache and the CSS and JS merge caches ...


8

First you need to include the Magento\Store\Model\ScopeInterface class in your constructor: protected $_scopeConfig; public function __construct( ... \Magento\Store\Model\ScopeInterface $scopeInterface, ... ) { ... $this->_scopeConfig = $scopeInterface; ... } Then in your class' method you can call the following: $this->...


7

In theory you can set any config value in the database (table core_config_data). But for most of the cases, the values saved there have the path column like this: section/group/field. So only 3 parts. The cron schedule is an exception. The general config of Magento comes from different sources. All of these sources are merged into one big xml. In case ...


7

Format for new order id is defined by default by constant in Magento\SalesSequence\Model\Sequence : const DEFAULT_PATTERN = "%s%'.09d%s"; It's pattern for sprintf() function that creates new id. To remove leading zeros you have to pass your pattern to constructor like this: <type name="Magento\SalesSequence\Model\Sequence"> <arguments> ...


7

=> For Magento 1.9 : Get Store Id : Mage::app()->getStore()->getStoreId(); Get Config Value : $configValue = Mage::getStoreConfig('sectionName/groupName/fieldName'); as per store vise : $storeId = 2; // ID of the store you want to fetch the value of $configValue = Mage::getStoreConfig('sectionName/groupName/fieldName', $storeId); => For Magento ...


6

Create A Custommodule: Api File(Api.php) <?php class Amit_Customapi_Model_Api extends Mage_Api_Model_Resource_Abstract { public function myregion() { $countryList = explode(',', Mage::getStoreConfig(general/region/state_required)); return $countryList; } } and etc/api.xml is <?xml version="1.0"?...


6

You can access the config.xml of any module through Mage::getConfig. All XMLs are merged into one string so you can't really specify the exact module but you can filter on tags path. $default_xml = Mage::getConfig() ->loadModulesConfiguration('config.xml') ->getNode('default/wishlist') ->asXML(); You might need to add a dependency in ...


6

Though all above answers are correct fully/partially, I thought to write down the answer as this would be helpful for future readers. This answer will address two questions: 1) How to change the order sequence number? 2) How to add Prefix or Suffix to an order number? Before making any blind changes in the database, you should understand which sequence ...


6

I haven't tested this, so I'm just taking a wild guess. The link you mentioned from integer-net explains how to use a select field using a class Namespace_Module_Block_Config_Adminhtml_Form_Field_Country as renderer. Using the same example, just add a new method to the renderer class (mentioned above) public function getExtraParams() { return ' ...


5

Try Mage::app()->getConfig()->reinit();


5

The classname should be [Namespace]_[Module]_Model_Observer, to make sure the right class is used in your config.xml you can specify the whole classname in the <class> tag. <class>[Namespace]_[Module]_Model_Observer</class> It might be helpful to also post the system.xml contents to see if the admin_system_config_changed_section_[...


5

you need to inject the an instance of \Magento\Framework\App\Config\ScopeConfigInterface in your block. $protected $scopeConfig; protected $storeManager; public function __construct( .... \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig, \Magento\Store\Model\StoreManagerInterface $storeManager, .... ) { ... $this->...


5

You can Inject ConfigInterface class and use it to save the value. protected $_configInterface; public function __construct( \Magento\Framework\App\Config\ConfigResource\ConfigInterface $configInterface ) { $this->_configInterface = $configInterface; } Then you can use it in your method like $this->_configInterface ->saveConfig('...


4

You can call the core_config_data table's resource model: Mage::getModel('core/config_data')->load($id) You can even get the model from the collection, like any other collection in Magento: Mage::getModel('core/config_data')->getCollection()->addFieldToFilter('config_id',$id); Or just get the first item in the collection: Mage::getModel('core/...


4

I had this issue and in case anyone doesn't know the answer here it is, - the above code will also not allow checkouts or anything that requires index.php as the rule is not rewriting the index just removing it. Follow the already posted instructions by Amit Bera to ensure you are allowing rewrites in the config then change your htaccess file to reflex ...


4

Create a function for getting configuration values in your custom module's helper. public function getConfig($config_path) { return $this->scopeConfig->getValue( $config_path, \Magento\Store\Model\ScopeInterface::SCOPE_STORE ); } and call anywhere you want for example in test.phtml $moduleStatus = $this->...


4

How it works The settings that you're referring to are set when you save the admin panel view of the System Config. However, these will not save if the values are set to be "inherit from parent" or from an outer scope such as Website or global. XML configuration in the module's etc/config.xml are the final fallback and Magento will load these if it finds ...


4

Finally I have achieved by updating Customer.php file from Helper class <?php namespace Learning\Custom\Helper; class Customer { const XML_PATH = 'custom_customer/custom_customer_nav_api/customer_soap_header'; /** * Core store config * * @var \Magento\Framework\App\Config\ScopeConfigInterface */ protected $scopeConfig; ...


4

You can also use \Magento\Config\Model\Config::save. Below a simple sample: $configData = [ 'section' => 'MY_SECTION', 'website' => null, 'store' => null, 'groups' => [ 'MY_GROUP' => [ 'fields' => [ 'MY_FIELD' => [ 'value' => $myValue, ], ...


Only top voted, non community-wiki answers of a minimum length are eligible