对于多域名,多网店,我们想产看一下当前magento网店的website和store,这就要使用到magento的collection,故,需要把magento的所有的website和store调用出来,供使用,下面是一个得到webisite和store的collection,然后遍历出来的程序代码!希望有此需求的时候对您有所帮助
<?php
2 |
require_once('app/Mage.php'); |
9 |
$websites = Mage::getModel('core/website') |
12 |
foreach($websites as $website) { |
13 |
$website_data = $website->getData(); ?> |
14 |
<h3><?php echo $website->getName(); ?></h3> |
16 |
<?php foreach($website_data as $key => $item) { ?> |
18 |
<td><?php echo $key; ?></td> |
19 |
<td><?php echo $item; ?></td> |
28 |
$stores = Mage::getModel('core/store') |
31 |
foreach($stores as $store) { |
32 |
$store_data = $store->getData(); ?> |
33 |
<h3><?php echo $store->getName(); ?></h3> |
35 |
<?php foreach($store_data as $key => $item) { ?> |
37 |
<td><?php echo $key; ?></td> |
38 |
<td><?php echo $item; ?></td> |