1: <?php
2: /**
3: * Magento
4: *
5: * NOTICE OF LICENSE
6: *
7: * This source file is subject to the Open Software License (OSL 3.0)
8: * that is bundled with this package in the file LICENSE.txt.
9: * It is also available through the world-wide-web at this URL:
10: * http://opensource.org/licenses/osl-3.0.php
11: * If you did not receive a copy of the license and are unable to
12: * obtain it through the world-wide-web, please send an email
13: * to license@magentocommerce.com so we can send you a copy immediately.
14: *
15: * DISCLAIMER
16: *
17: * Do not edit or add to this file if you wish to upgrade Magento to newer
18: * versions in the future. If you wish to customize Magento for your
19: * needs please refer to http://www.magentocommerce.com for more information.
20: *
21: * @category Mage
22: * @package Mage_Adminhtml
23: * @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
24: * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25: */
26:
27: /**
28: * Obtain all carts contents for specified client
29: *
30: */
31: class Mage_Adminhtml_Block_Customer_Edit_Tab_Carts extends Mage_Adminhtml_Block_Template
32: {
33: /**
34: * Add shopping cart grid of each website
35: *
36: * @return Mage_Adminhtml_Block_Customer_Edit_Tab_Carts
37: */
38: protected function _prepareLayout()
39: {
40: $sharedWebsiteIds = Mage::registry('current_customer')->getSharedWebsiteIds();
41: $isShared = count($sharedWebsiteIds) > 1;
42: foreach ($sharedWebsiteIds as $websiteId) {
43: $blockName = 'customer_cart_' . $websiteId;
44: $block = $this->getLayout()->createBlock('adminhtml/customer_edit_tab_cart',
45: $blockName, array('website_id' => $websiteId));
46: if ($isShared) {
47: $block->setCartHeader($this->__('Shopping Cart from %s', Mage::app()->getWebsite($websiteId)->getName()));
48: }
49: $this->setChild($blockName, $block);
50: }
51: return parent::_prepareLayout();
52: }
53:
54: /**
55: * Just get child blocks html
56: *
57: * @return string
58: */
59: protected function _toHtml()
60: {
61: Mage::dispatchEvent('adminhtml_block_html_before', array('block' => $this));
62: return $this->getChildHtml();
63: }
64: }
65: