1: <?php
2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25:
26:
27: 28: 29: 30: 31: 32: 33:
34: class Mage_Adminhtml_Block_Customer_Edit_Tab_View_Accordion extends Mage_Adminhtml_Block_Widget_Accordion
35: {
36: protected function _prepareLayout()
37: {
38: $customer = Mage::registry('current_customer');
39:
40: $this->setId('customerViewAccordion');
41:
42: $this->addItem('lastOrders', array(
43: 'title' => Mage::helper('customer')->__('Recent Orders'),
44: 'ajax' => true,
45: 'content_url' => $this->getUrl('*/*/lastOrders', array('_current' => true)),
46: ));
47:
48:
49: foreach (Mage::registry('current_customer')->getSharedWebsiteIds() as $websiteId) {
50: $website = Mage::app()->getWebsite($websiteId);
51:
52:
53: $cartItemsCount = Mage::getModel('sales/quote')
54: ->setWebsite($website)->loadByCustomer($customer)
55: ->getItemsCollection(false)
56: ->addFieldToFilter('parent_item_id', array('null' => true))
57: ->getSize();
58:
59: $title = Mage::helper('customer')->__('Shopping Cart - %d item(s)', $cartItemsCount);
60: if (count($customer->getSharedWebsiteIds()) > 1) {
61: $title = Mage::helper('customer')->__('Shopping Cart of %1$s - %2$d item(s)', $website->getName(), $cartItemsCount);
62: }
63:
64:
65: $this->addItem('shopingCart' . $websiteId, array(
66: 'title' => $title,
67: 'ajax' => true,
68: 'content_url' => $this->getUrl('*/*/viewCart', array('_current' => true, 'website_id' => $websiteId)),
69: ));
70: }
71:
72:
73: $wishlistCount = Mage::getModel('wishlist/item')->getCollection()
74: ->addCustomerIdFilter($customer->getId())
75: ->addStoreData()
76: ->getSize();
77:
78: $this->addItem('wishlist', array(
79: 'title' => Mage::helper('customer')->__('Wishlist - %d item(s)', $wishlistCount),
80: 'ajax' => true,
81: 'content_url' => $this->getUrl('*/*/viewWishlist', array('_current' => true)),
82: ));
83: }
84: }
85: