我想将所有Courier List获取到一个PHP文件(外部接口)中。我的目标是在不使用$this对象的情况下获取所有快递。
我能够通过以下代码将magento函数调用到核心PHP文件:
文件:MagentoFolder/PHPModule/index.php
<?php
require_once('../app/Mage.php'); //Path to Magento
umask(0);
Mage::app();
// extra code
?>
<select>
<?php
// Code to Get All Shipping Courier List
?>
</select>
//获取所有快递清单的代码
<?php
$courier_list= array();
$carriers = Mage::getsingleton("shipping/config")->getAllCarriers();
foreach($carriers as $code => $method) {
$courier_list[] = array(
"title" => Mage::getStoreConfig("carriers/$code/title"),
);
}
foreach($courier_list as $item) {
echo "<option>".$item['title']."</option>";
}?>