我想创建一个函数,它接受店铺标识,并返回一个PHP数组具有商店的细节,如店铺名称,店铺代码,标志,横幅,命名等如何通过商店ID在PHP数组中获取Magento商店详情?
3
A
回答
2
试试这个它会工作...
public function get_storedetails($store) {
$res = array();
try {
$res["store"] = Mage::app()->getStore($store);
Mage::app()->setCurrentStore($store);
$res["storeid"] = Mage::app()->getStore($store)->getStoreId();
$res["storecode"] = Mage::app()->getStore($store)->getCode();
$res["storewebid"] = Mage::app()->getStore($store)->getWebsiteId();
$res["storename"] = Mage::app()->getStore($store)->getName();
$res["storeactive"] = Mage::app()->getStore($store)->getIsActive();
$res["rooturl"] = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
$res["storeurl"] = Mage::helper('core/url')->getHomeUrl();
$res["storelogo_alt"] = Mage::getStoreConfig('design/header/logo_alt');
$res["storefrontname"] = Mage::app()->getStore($store)->getFrontendName(); //getLogoSrc()
$res["current_url"] = Mage::helper('core/url')->getCurrentUrl();
$res["media_url1"] = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_LINK);
$res["media_url2"] = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA);
$res["skin_url"] = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_SKIN);
$res["js_url"] = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_JS);
$res["storelogo"] = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_SKIN).'frontend/default/default/'.Mage::getStoreConfig('design/header/logo_src');
$res["storeadminname"] = Mage::getStoreConfig('trans_email/ident_sales/name');
$res["storeemail"] = Mage::getStoreConfig('trans_email/ident_sales/email');
}
catch(Exception $ex) {
echo $ex;
}
return $res;
}
3
你可以得到一个商店的细节是这样的:
$store = Mage::getModel('core/store')->load($storeId);
$code = $store->getCode();
$name = $store->getName();
你可以做到这一点,看看有什么数据,你可以从商店对象获取
var_dump($store->getData())
您需要从配置部分获取徽标和其他设置。
$logo = Mage::getStoreConfig('design/header/logo_src', $soreId);
这样你就可以从配置中获得所有的信息。你只需要正确的路径。为此,您可以从system-> configuration和section name中看到输入字段的名称并构建路径。
让我们来分析一下这个标志。您可以在Design
选项卡中找到它,并且网址如下所示:'admin/system_config/edit/部分/设计'。所以路径的第一部分是部分名称design
。
该字段名称是groups[header][fields][logo_src][value]
。只要删除groups
,[fields]
和[value]
,您将得到路径header/logo_src
的其余部分。
相关问题
- 1. Magento的商店 - 通过
- 2. 如何获得magento商店?
- 3. Magento商店ID在cronjob
- 4. 获取magento商店列表
- 5. ExtJs - 如何通过id从商店中获取价值?
- 6. 获取在商店
- 7. Magento商店URL
- 8. 如何通过Magento商店获取CMS页面标题?
- 9. 获得magento当前URL由商店ID
- 10. 在opencart中获取当前商店ID
- 11. 使用opencart获取多商店设置的商店ID
- 12. 在ViewController中获取商店
- 13. 商店ID表
- 14. 通过.htaccess运行Magento商店
- 15. magento商店视图
- 16. 如何获得Magento商店货币
- 17. Magento - 如何获得商店的国家?
- 18. 如何更改商店ID?
- 19. 如何在ExtJS MVC中通过引用来获取商店?
- 20. 如何在drupal商业中创建商店并获取邮件黑猩猩的商店ID?
- 21. ExtJs:获取商店创建的商店数据
- 22. 如何使用PHP SDK或亚马逊PAAPI获取商店产品详情
- 23. 按部门在magento商店
- 24. Magento:在商店代码Dash
- 25. PHP商店值
- 26. 如何在magento中获取商店徽标和图像alt
- 27. 网站magento默认商店ID
- 28. 如何从商店获取值在extjs4
- 29. 如何以编程方式在magento中添加商店和商店视图
- 30. 如何通过钥匙获取redux商店中的物品?
感谢Shashi它正在按照我的需要工作。 –
@RishiBaduk:好的 – Shashi