久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

覆蓋 Magento 配置

Override Magento Config(覆蓋 Magento 配置)
本文介紹了覆蓋 Magento 配置的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

我正在尋找一個很好的解決方案來覆蓋 Magento 配置而不更改默認值.

I am looking for a good solution to override the Magento config without changing the default values.

例如,我想在不刪除現有值的情況下覆蓋 core_config_data 表中的web/unsecure/base_skin_url"項.因此,如果代碼中的任何地方都調用了此確切代碼:

For example, I want to override the "web/unsecure/base_skin_url" item in the core_config_data table without deleting the existing value. So if anywhere in the code this exact code is called:

Mage::getStoreConfig('web/unsecure/base_skin_url');

它會找到我設置的配置選項,而不是默認的...

It will find the config option I set and not the default one...

提前致謝!

查克

推薦答案

Magento 在運行時直接從配置對象的樹結構中讀取其配置值,因此需要使用配置對象的原生 setNode 方法更改值.但是,由于 Magento 加載范圍配置(自鏈接)的方式,它并不那么直接向前看.

Magento reads its configuration values at runtime directly from the configuration object's tree structure, so you need to use the configuration object's native setNode method to change the values. However, because of the way Magento loads in scoped configuration (self link), it's not as straight forward as it seems.

使用當前版本的 Magento(我相信,但尚未使用舊版本測試),您需要在當前 store 的節點集中設置配置值.

With current versions of Magento (and I believe, but have not tested, with older versions), you'll need to set the configuration value in the set of nodes for the current store.

第一步是獲取當前設置的商店的代碼.您可以通過以下方式以編程方式執行此操作

Step one is getting the code for the currently set store. You can do this programmatically with the following

$store = Mage::app()->getStore();
$code  = $store->getCode();

然后,您可以通過以下調用設置配置值

then, you can set a configuration value with the following call

$config = Mage::getConfig();
$config->setNode("stores/$code/web/unsecure/base_skin_url", 'value_to_set');

請記住,這一切都需要在 Magento 引導配置對象之后發生.還要記住,有一段時間 Magento 會加載配置,但不會加載 store 對象.如果是這種情況,您將無法從商店對象加載商店代碼.

Keep in mind this all needs to happen after Magento has bootstrapped the configuration object. Also keep in mind there's a period of time where Magento will have a loaded configuration, but the store object will not be loaded. If this is the case you will not be able to load the store code from the store object.

我在我的 Pulse Storm Chaos 模塊中做了類似的事情.如果您對工作代碼感興趣,請訪問 Github.

I did something similar in my Pulse Storm Chaos module. If you're interested in working code it's on Github.

這篇關于覆蓋 Magento 配置的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

相關文檔推薦

What would cause a print_r and/or a var_dump to fail debugging a variable?(什么會導致 print_r 和/或 var_dump 調試變量失敗?)
How to update custom options programatically in magento?(如何在 magento 中以編程方式更新自定義選項?)
Magento 404 on Admin Page(管理頁面上的 Magento 404)
Magento - get price rules from order(Magento - 從訂單中獲取價格規則)
Magento Change Product Page Titles to Include Attributes(Magento 更改產品頁面標題以包含屬性)
Magento: adding duties/taxes to a quote during review(Magento:在審查期間向報價添加關稅/稅款)
主站蜘蛛池模板: 亚洲一区二区三区视频 | 日韩三级视频 | 91视频官网 | 欧美日韩国产一区二区三区 | 天堂资源最新在线 | 亚洲精选一区 | 极品销魂美女一区二区 | 国产高清一区二区三区 | 色综合久| 久久精品国产一区二区三区 | 欧美黑人狂野猛交老妇 | 亚洲一区二区在线 | 久久机热 | 亚洲国产成人精品女人久久久 | 精品91视频 | 91精品国产一区二区 | 欧美精品被 | 日韩精品一区二区三区第95 | 中国一级特黄毛片大片 | 国产成人精品一区二区三区 | 欧美激情在线精品一区二区三区 | 精品视频一区二区三区在线观看 | 欧美美女一区二区 | 99亚洲国产精品 | 九九激情视频 | 这里只有精品999 | 久久久久久久久蜜桃 | 国产成人精品免费视频大全最热 | 中文字幕免费中文 | 伊人婷婷 | 精品产国自在拍 | 国产精品久久久久久久岛一牛影视 | 久久成人综合 | 韩国av影院| 亚洲综合字幕 | 午夜精品久久久久久久久久久久久 | 亚洲福利在线观看 | 91精品国产综合久久婷婷香蕉 | 91精品国产乱码久久久久久久久 | 久草视频网站 | 狠狠躁天天躁夜夜躁婷婷老牛影视 |