Magento: 获取商店名称及邮件地址 Get Store Email Addresses

General Contact

/* Sender Name */
Mage::getStoreConfig('trans_email/ident_general/name'); 
/* Sender Email */
Mage::getStoreConfig('trans_email/ident_general/email');

 

Sales Representative

/* Sender Name */
Mage::getStoreConfig('trans_email/ident_sales/name'); 
/* Sender Email */
Mage::getStoreConfig('trans_email/ident_sales/email');

 

Customer Support

/* Sender Name */
Mage::getStoreConfig('trans_email/ident_support/name'); 
/* Sender Email */
Mage::getStoreConfig('trans_email/ident_support/email');

 

Custom Email 1

/* Sender Name */
Mage::getStoreConfig('trans_email/ident_custom1/name'); 
/* Sender Email */
Mage::getStoreConfig('trans_email/ident_custom1/email');

 

Custom Email 2

/* Sender Name */
Mage::getStoreConfig('trans_email/ident_custom2/name'); 
/* Sender Email */
Mage::getStoreConfig('trans_email/ident_custom2/email');

 

或者:

<?php
$store = Mage::app()->getStore();
$name = $store->getName();

 

Programmatically change Magento’s core config data

Every Magento installation has certain core configuration data already set. When you update those values from the administration interfaces, changes are saved mainly to core_config_data database table. It seems important and something that you shouldn’t touch, right? As always, there are times you will wish to get your hands on it. In some cases you will wish to chance settings directly from the code. This article demonstrates the proper way.


Let’s say we want to change “demo store notice” (on/off) – change value from 0 to 1 and vice versa.
All you need to do is open your database,
for example with phpmyadmin,
browse table “core_config_data“,
change the data you want and save it…

Magento: 获取商店名称及邮件地址 Get Store Email Addresses
Magento: 获取商店名称及邮件地址 Get Store Email Addresses

I’m just joking, that’s not the way.


Here it is, you can call it wherever in your code:

$inchooSwitch = new Mage_Core_Model_Config();
/*
*turns notice on
*/
$inchooSwitch ->saveConfig('design/head/demonotice', "1", 'default', 0);
/*
*turns notice off
*/
$inchooSwitch ->saveConfig('design/head/demonotice', "0", 'default', 0);

 

Code which does the magic:

class Mage_Core_Model_Config
{
	.
	.
	.
 
	/**
     * Save config value to DB
     *
     * @param string $path
     * @param string $value
     * @param string $scope
     * @param int $scopeId
     * @return Mage_Core_Store_Config
     */
    public function saveConfig($path, $value, $scope = 'default', $scopeId = 0)
    {
        $resource = $this->getResourceModel();
        $resource->saveConfig(rtrim($path, '/'), $value, $scope, $scopeId);
 
        return $this;
    }
 
	.
	.
	.
}

 

Enjoy coding!

 

(http://inchoo.net/magento/how-to-programmatically-change-magentos-core-config-data/)

其他参考:http://www.khemissi.com/2010/07/09/magento-diagram-website-store-store-view/

 

转自:Magento: 获取商店名称及邮件地址 Get Store Email Addresses

 

 

 

 

 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值