diff --git a/.gitignore b/.gitignore
index 490342a4bd161..1eb86299e2089 100644
--- a/.gitignore
+++ b/.gitignore
@@ -13,7 +13,8 @@ atlassian*
/app/config_sandbox
/app/etc/local.xml
/app/etc/local.xml.*
-/app/etc/modules/XEnterprise_Enabler.xml
+/app/etc/modules/XEnterprise_Edition.xml
+/app/etc/modules/XSaas_Edition.xml
/downloader/.cache
/downloader/cache.cfg
/downloader/connect.cfg
@@ -28,6 +29,7 @@ atlassian*
/pub/media/*
/pub/media/customer/*
/pub/media/downloadable/*
-/pub/media/theme/*
-/pub/media/theme/customization/*
+/pub/static/*
+!/pub/static/.htaccess
/var/*
+*swp
diff --git a/CHANGELOG.markdown b/CHANGELOG.markdown
index a3010683ee3a6..b181ed336ea96 100644
--- a/CHANGELOG.markdown
+++ b/CHANGELOG.markdown
@@ -1,3 +1,107 @@
+2.0.0.0-dev44
+=============
+* Product creating & editing:
+ * Added ability to control base text styling without WYSIWYG when editing description fields
+ * Added validation for price and quantity fields
+ * Removed category suggest limit
+* Product template management:
+ * Automatically update Product Template when modifying structure in Create Product flow
+ * Improvements to change attribute set functionality
+* Refactored JavaScript to use JQuery library:
+ * Refactored the following pages: catalog tags, one page checkout, multishipping checkout, gift options, gift messages (across the board)
+ * Converted jQuery popupwindow.js plugin to a jQuery widget
+ * Replaced Prototype code for Switch/Maestro and Solo credit card with jQuery widget
+ * Replaced Prototype Validation with jQuery validation plugin
+ * Converted credit card payment tool tip to jQuery in all themes
+ * Removed legacy JS files from all themes
+* Various improvements in look & feel of backend UI:
+ * Styling of components: catalog, sales, customers, reports, CMS, newsletter
+ * Generic styling: grids, popup windows
+ * Changes to support IE browser
+* Enhancements in "suggest" JavaScript widget:
+ * Ability to delete selected item using keyboard
+ * Ability to display all available search items, if "recent items" is empty
+ * Fixes of behavior of currently selected elements and "spinner"
+ * Display "No Records" message in suggest widget if all items already selected
+ * Fixed suggest widget to no longer show deleted items
+* Improved `Magento_Test_Helper_ObjectManager` in unit tests to discover types of constructor arguments
+* Removed workaround of unsetting objects referenced in `tearDown()` of integration tests
+* Updated Menu and Navigation layout, including redesigned backend menu item System -> My Account
+* Made store address format consistent with format of shipping origin address
+* Added ability to navigate directly to a section in backend system configuration, with corresponding accordion expanded
+* Removed some of unnecessary coupling between several modules
+* General improvements to unit and integration test code coverage, as well as compliance with coding standards
+* Application framework:
+ * Implemented ability to compress/decompress data in a cache backend
+ * Verified ability to disable in configuration triggering of system upgrade
+ * Abolished code pools and the mechanism of overriding files using include\_path (without alternative)
+ * Implemented segmentation of cache by types -- ability to assign separate cache configuration per type. Reviewed and verified possibility to isolate configuration cache segment
+ * Segregated application configuration into several layers. Primary configuration is used by the object manager and loaded before application is initialized
+ * Instead of `Zend\Di`, implemented `Magento\ObjectManager` library that has less features and suits Magento application needs better in terms of performance
+ * Introduced "context" object as dependencies for super-classes (`Mage_Core_Model_Abstract`, `Mage_Core_Block_Abstract`, etc) to reduce complexity of their constructors' API
+ * Implemented tools for pre-populating all auto-generated proxy and factory classes, used by dependency injection framework
+ * Replaced "developer" mode with general "mode", that has 3 states: developer, default, production
+ * In "production" mode, the application will not invoke fallback for static view files (images, CSS-files, JavaScript). Instead, it will assume that they are already placed in a fully qualified location. Added tools for populating static view files from `app` directory into `pub/static`
+ * Introduced support for Twig templating
+ * template rendering, including phtml, was abstracted into a `Mage_Core_Block_Template_Engine` to make support for other template engines easier
+ * included Magento-specific Twig functions and filters
+ * phtml templates can now only access public methods of the corresponding Block class
+ * ability to define dependencies on data provided by a service that is then made available to the templates -- eliminates some of the code in Blocks
+ * Introduced support for webhooks and callbacks: outbound HTTP requests for notifications and real-time integrations
+ * Added ability to define options for System Configuration select fields in XML: static options are defined inline, dynamic options can reuse data provided by a service
+* Moved product business logic found in blocks into `Mage_Catalog_Service_Product` to consolidate logic into a single structure that both controllers and web services can invoke
+* Converted product view page to demonstrate use of Twig templates and services
+* Updated shipping carrier `collectRates` logic to support remote callbacks and converted the FedEx shipping carrier to comply with the same interface
+* Added webhook support for the following topics: `customer/created`, `customer/updated`, `customer/deleted`, and `order/created`
+* Visual design editor:
+ * Ability to view all CSS-files of a theme
+ * Ported numerous features of visual design editor from Magento Go 1.x to Magento Core 2.x: style editing, managing catalog images
+ * Various improvements in UI
+ * Improved image sizing functionality
+ * Improved test coverage
+ * Ability to launch physical themes, including workflow preview mode and workflow design mode
+ * Ability to duplicate existing themes for customization
+* GitHub requests
+ * [#162](https://github.com/magento/magento2/pull/162) -- classmap needs to be prepended to autoloader stack to have any effect
+ * [#179](https://github.com/magento/magento2/pull/179) -- fix that makes `Mage_Install` compatible with the new version of SimpleXml
+ * [#180](https://github.com/magento/magento2/pull/180) -- fixed `getBaseUrl()` when type was injected via setter
+ * [#203](https://github.com/magento/magento2/pull/203) -- fixed problem with login in to backend area on php 5.4
+ * [#216](https://github.com/magento/magento2/pull/216) -- explicit nullification of `$_store` in `Mage_Core_Model_Sore_Storage_Db->_initStores()`
+ * [#220](https://github.com/magento/magento2/pull/220) -- make topmenu HTML editable by an event
+ * [#221](https://github.com/magento/magento2/pull/221) -- changed minimum required PHP version from PHP 5.2.3 to 5.3.3
+* Bug fixes:
+ * Restored missing Paypal configuration options
+ * Fixed numerous display issues on the following pages: admin login, product management, category management, CMS poll, VDE, tax, shipping
+ * Fixed XSS vulnerability related to customer data & bundle options
+ * Fixed "Preview Theme" functionality
+ * Fixed JS File upload problem with Internet Explorer
+ * Replaced `truncateOptions` function in `varien/js.js` with inline widget
+ * Fixed broken XPaths in `SystemConfiguration.yml`
+ * Fixed jQuery metadata plugin's data attribute scanning for validation
+ * Synchronized default value of `quantity_and_stock_status` with Stock Availability control
+ * Fixed display of G.T. Purchased column in Order grid when order in non-default currency
+ * Fixed Foreign Key support for MS SQL
+ * Fixed "Create Customer" functionality on New Order screen
+ * Restored State/Province field to Review Order page
+ * Fixed Add New Tax Rate functionality
+ * Fixed problem with displaying New Shopping Cart Price Rule tab
+ * Fixed problem of configurable product options getting lost when adding product to wishlist
+ * Fixed UPS Shipping label printing
+ * Fixed performance issue with Catalog Management
+ * Fixed input file type validation when importing customers
+ * Fixed custom product placeholder image display
+ * Added missing files referenced by `quick\_style.css`
+ * Fixed validation error messaging and message placement
+ * Fixed access problem to SOAP/XML User and Roles pages
+ * Fixed access problem created when editing your own permissions
+ * Several fixes for problems with cleaning cache in tag scope
+ * Fixed invalid link problem in Gift Card email
+ * Fixed problem with deleting selected product category after changing attribute set
+ * Fixed theme management for Windows by adopting `Magento_Filesystem` abstraction to access directories
+ * Fixed cart rendering in case of empty cart
+ * Remove duplicate "Link to Store Front" link from admin, made obsolete by "Customer View" link
+ * Removed "Flat Rate" from pre-installed shipping methods
+
2.0.0.0-dev43
=============
* Implemented functional limitation that restricts max number of catalog products in the system
diff --git a/app/Mage.php b/app/Mage.php
index 7b63049b6225d..483a51ff8a599 100644
--- a/app/Mage.php
+++ b/app/Mage.php
@@ -46,6 +46,11 @@ final class Mage
*/
const PARAM_RUN_TYPE = 'MAGE_RUN_TYPE';
+ /**
+ * Application run code
+ */
+ const PARAM_MODE = 'MAGE_MODE';
+
/**
* Base directory
*/
@@ -99,7 +104,7 @@ final class Mage
*
* @var array
*/
- static private $_registry = array();
+ static private $_registry = array();
/**
* Application root absolute path
@@ -141,21 +146,14 @@ final class Mage
*
* @var bool
*/
- static private $_isDownloader = false;
-
- /**
- * Is developer mode flag
- *
- * @var bool
- */
- static private $_isDeveloperMode = false;
+ static private $_isDownloader = false;
/**
* Is allow throw Exception about headers already sent
*
* @var bool
*/
- public static $headersSentThrowsException = true;
+ public static $headersSentThrowsException = true;
/**
* Logger entities
@@ -220,7 +218,7 @@ public static function getVersionInfo()
'revision' => '0',
'patch' => '0',
'stability' => 'dev',
- 'number' => '43',
+ 'number' => '44',
);
}
@@ -258,9 +256,9 @@ public static function reset()
self::$_config = null;
self::$_objects = null;
self::$_isDownloader = false;
- self::$_isDeveloperMode = false;
self::$_loggers = array();
self::$_design = null;
+ self::$_objectManager = null;
// do not reset $headersSentThrowsException
}
@@ -375,9 +373,7 @@ public static function objects($key = null)
*/
public static function getBaseDir($type = Mage_Core_Model_Dir::ROOT)
{
- /** @var $dirs Mage_Core_Model_Dir */
- $dirs = self::$_objectManager->get('Mage_Core_Model_Dir');
- return $dirs->getDir($type);
+ return self::getSingleton('Mage_Core_Model_Dir')->getDir($type);
}
/**
@@ -442,8 +438,7 @@ public static function getBaseUrl($type = Mage_Core_Model_Store::URL_TYPE_LINK,
*/
public static function getUrl($route = '', $params = array())
{
- return self::getObjectManager()->create('Mage_Core_Model_Url', array('data' => array()))
- ->getUrl($route, $params);
+ return self::getObjectManager()->create('Mage_Core_Model_Url')->getUrl($route, $params);
}
/**
@@ -488,9 +483,7 @@ public static function getConfig()
*/
public static function dispatchEvent($name, array $data = array())
{
- /** @var $eventManager Mage_Core_Model_Event_Manager */
- $eventManager = self::$_objectManager->get('Mage_Core_Model_Event_Manager');
- $eventManager->dispatch($name, $data);
+ return Mage::getSingleton('Mage_Core_Model_Event_Manager')->dispatch($name, $data);
}
/**
@@ -506,21 +499,20 @@ public static function getModel($modelClass = '', $arguments = array())
if (!is_array($arguments)) {
$arguments = array($arguments);
}
- return self::getObjectManager()->create($modelClass, $arguments, false);
+ return self::getObjectManager()->create($modelClass, $arguments);
}
/**
* Retrieve model object singleton
*
* @param string $modelClass
- * @param array $arguments
* @return Mage_Core_Model_Abstract
*/
- public static function getSingleton($modelClass = '', array $arguments=array())
+ public static function getSingleton($modelClass = '')
{
$registryKey = '_singleton/'.$modelClass;
if (!self::registry($registryKey)) {
- self::register($registryKey, self::getObjectManager()->get($modelClass, $arguments));
+ self::register($registryKey, self::getObjectManager()->get($modelClass));
}
return self::registry($registryKey);
}
@@ -565,17 +557,16 @@ public static function getResourceModel($modelClass, $arguments = array())
}
/**
- * Retrieve resource vodel object singleton
+ * Retrieve resource model object singleton
*
* @param string $modelClass
- * @param array $arguments
* @return object
*/
- public static function getResourceSingleton($modelClass = '', array $arguments = array())
+ public static function getResourceSingleton($modelClass = '')
{
$registryKey = '_resource_singleton/'.$modelClass;
if (!self::registry($registryKey)) {
- self::register($registryKey, self::getObjectManager()->get($modelClass, $arguments));
+ self::register($registryKey, self::getObjectManager()->get($modelClass));
}
return self::registry($registryKey);
}
@@ -629,7 +620,13 @@ public static function getResourceHelper($moduleName)
if (substr($moduleName, 0, 5) == 'Mage_') {
$connection = substr($connection, 5);
}
- return self::getObjectManager()->get($helperClassName, array('modulePrefix' => $connection));
+ $key = 'resourceHelper/' . $connection;
+ if (!self::registry($key)) {
+ self::register(
+ $key, self::getObjectManager()->create($helperClassName, array('modulePrefix' => $connection))
+ );
+ }
+ return self::registry($key);
}
/**
@@ -682,7 +679,7 @@ public static function app()
*/
public static function isInstalled()
{
- return (bool) self::$_objectManager->get('Mage_Core_Model_Config_Primary')->getInstallDate();
+ return (bool) Mage::getSingleton('Mage_Core_Model_Config_Primary')->getInstallDate();
}
/**
@@ -723,29 +720,26 @@ public static function logException(Exception $e)
self::$_objectManager->get('Mage_Core_Model_Logger')->logException($e);
}
- /**
- * Set enabled developer mode
- *
- * @param bool $mode
- * @return bool
- *
- * @deprecated use Mage_Core_Model_App_State::setIsDeveloperMode()
- */
- public static function setIsDeveloperMode($mode)
- {
- self::$_isDeveloperMode = (bool)$mode;
- return self::$_isDeveloperMode;
- }
-
/**
* Retrieve enabled developer mode
*
* @return bool
- * @deprecated use Mage_Core_Model_App_State::isDeveloperMode()
+ * @deprecated use Mage_Core_Model_App_State::getMode()
*/
public static function getIsDeveloperMode()
{
- return self::$_isDeveloperMode;
+ $objectManager = self::getObjectManager();
+ if (!$objectManager) {
+ return false;
+ }
+
+ $appState = $objectManager->get('Mage_Core_Model_App_State');
+ if (!$appState) {
+ return false;
+ }
+
+ $mode = $appState->getMode();
+ return $mode == Mage_Core_Model_App_State::MODE_DEVELOPER;
}
/**
@@ -756,7 +750,7 @@ public static function getIsDeveloperMode()
*/
public static function printException(Exception $e, $extra = '')
{
- if (self::$_isDeveloperMode) {
+ if (self::getIsDeveloperMode()) {
print '
';
if (!empty($extra)) {
diff --git a/app/bootstrap.php b/app/bootstrap.php
index d20ee4c1956c8..d258845e54e7d 100644
--- a/app/bootstrap.php
+++ b/app/bootstrap.php
@@ -34,20 +34,18 @@
* Environment initialization
*/
error_reporting(E_ALL | E_STRICT);
-#ini_set('display_errors', 1);
+ini_set('display_errors', 1);
umask(0);
/**
* Require necessary files
*/
-require_once BP . '/app/code/core/Mage/Core/functions.php';
+require_once BP . '/app/code/Mage/Core/functions.php';
require_once BP . '/app/Mage.php';
require_once __DIR__ . '/autoload.php';
Magento_Autoload_IncludePath::addIncludePath(array(
- BP . DS . 'app' . DS . 'code' . DS . 'local',
- BP . DS . 'app' . DS . 'code' . DS . 'community',
- BP . DS . 'app' . DS . 'code' . DS . 'core',
+ BP . DS . 'app' . DS . 'code',
BP . DS . 'lib',
BP . DS . 'var' . DS . 'generation',
));
@@ -56,14 +54,14 @@
require_once BP . '/lib/Magento/Autoload/ClassMap.php';
$classMap = new Magento_Autoload_ClassMap(BP);
$classMap->addMap(unserialize(file_get_contents($classMapPath)));
- spl_autoload_register(array($classMap, 'load'));
+ spl_autoload_register(array($classMap, 'load'), true, true);
}
if (!defined('BARE_BOOTSTRAP')) {
/* PHP version validation */
- if (version_compare(phpversion(), '5.3.0', '<') === true) {
+ if (version_compare(phpversion(), '5.3.3', '<') === true) {
if (PHP_SAPI == 'cli') {
- echo 'Magento supports PHP 5.3.0 or newer. Please read http://www.magento.com/install.';
+ echo 'Magento supports PHP 5.3.3 or newer. Please read http://www.magento.com/install.';
} else {
echo <<
@@ -71,7 +69,7 @@
Whoops, it looks like you have an invalid PHP version.
- Magento supports PHP 5.3.0 or newer.
+
Magento supports PHP 5.3.3 or newer.
Find out
how to install Magento using PHP-CGI as a work-around.
@@ -88,9 +86,6 @@
}
exit;
}
- if (isset($_SERVER['MAGE_IS_DEVELOPER_MODE'])) {
- Mage::setIsDeveloperMode(true);
- }
if (!empty($_SERVER['MAGE_PROFILER'])) {
$profilerConfigData = $_SERVER['MAGE_PROFILER'];
diff --git a/app/code/core/Mage/AdminNotification/Helper/Data.php b/app/code/Mage/AdminNotification/Helper/Data.php
similarity index 100%
rename from app/code/core/Mage/AdminNotification/Helper/Data.php
rename to app/code/Mage/AdminNotification/Helper/Data.php
diff --git a/app/code/core/Mage/AdminNotification/Model/Config/Source/Frequency.php b/app/code/Mage/AdminNotification/Model/Config/Source/Frequency.php
similarity index 100%
rename from app/code/core/Mage/AdminNotification/Model/Config/Source/Frequency.php
rename to app/code/Mage/AdminNotification/Model/Config/Source/Frequency.php
diff --git a/app/code/core/Mage/AdminNotification/Model/Feed.php b/app/code/Mage/AdminNotification/Model/Feed.php
similarity index 100%
rename from app/code/core/Mage/AdminNotification/Model/Feed.php
rename to app/code/Mage/AdminNotification/Model/Feed.php
diff --git a/app/code/core/Mage/AdminNotification/Model/Inbox.php b/app/code/Mage/AdminNotification/Model/Inbox.php
similarity index 100%
rename from app/code/core/Mage/AdminNotification/Model/Inbox.php
rename to app/code/Mage/AdminNotification/Model/Inbox.php
diff --git a/app/code/core/Mage/AdminNotification/Model/Observer.php b/app/code/Mage/AdminNotification/Model/Observer.php
similarity index 100%
rename from app/code/core/Mage/AdminNotification/Model/Observer.php
rename to app/code/Mage/AdminNotification/Model/Observer.php
diff --git a/app/code/core/Mage/AdminNotification/Model/Resource/Inbox.php b/app/code/Mage/AdminNotification/Model/Resource/Inbox.php
old mode 100755
new mode 100644
similarity index 100%
rename from app/code/core/Mage/AdminNotification/Model/Resource/Inbox.php
rename to app/code/Mage/AdminNotification/Model/Resource/Inbox.php
diff --git a/app/code/core/Mage/AdminNotification/Model/Resource/Inbox/Collection.php b/app/code/Mage/AdminNotification/Model/Resource/Inbox/Collection.php
old mode 100755
new mode 100644
similarity index 100%
rename from app/code/core/Mage/AdminNotification/Model/Resource/Inbox/Collection.php
rename to app/code/Mage/AdminNotification/Model/Resource/Inbox/Collection.php
diff --git a/app/code/core/Mage/AdminNotification/Model/Survey.php b/app/code/Mage/AdminNotification/Model/Survey.php
similarity index 100%
rename from app/code/core/Mage/AdminNotification/Model/Survey.php
rename to app/code/Mage/AdminNotification/Model/Survey.php
diff --git a/app/code/Mage/AdminNotification/etc/adminhtml/acl.xml b/app/code/Mage/AdminNotification/etc/adminhtml/acl.xml
new file mode 100644
index 0000000000000..39db7fd2495d0
--- /dev/null
+++ b/app/code/Mage/AdminNotification/etc/adminhtml/acl.xml
@@ -0,0 +1,45 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/code/Mage/AdminNotification/etc/adminhtml/menu.xml b/app/code/Mage/AdminNotification/etc/adminhtml/menu.xml
new file mode 100644
index 0000000000000..edcecc10b7e2d
--- /dev/null
+++ b/app/code/Mage/AdminNotification/etc/adminhtml/menu.xml
@@ -0,0 +1,32 @@
+
+
+
+
+
+
+
diff --git a/app/code/core/Mage/AdminNotification/etc/adminhtml/system.xml b/app/code/Mage/AdminNotification/etc/adminhtml/system.xml
similarity index 100%
rename from app/code/core/Mage/AdminNotification/etc/adminhtml/system.xml
rename to app/code/Mage/AdminNotification/etc/adminhtml/system.xml
diff --git a/app/code/Mage/AdminNotification/etc/config.xml b/app/code/Mage/AdminNotification/etc/config.xml
new file mode 100644
index 0000000000000..76aa7397979f5
--- /dev/null
+++ b/app/code/Mage/AdminNotification/etc/config.xml
@@ -0,0 +1,81 @@
+
+
+
+
+
+ 1.6.0.0
+ true
+
+
+
+
+
+
+
+
+
+
+ Mage_AdminNotification
+
+
+
+
+
+
+
+
+
+ Mage_AdminNotification.csv
+
+
+
+
+
+
+
+
+ Mage_AdminNotification_Model_Observer
+ preDispatch
+
+
+
+
+
+
+
+
+ notifications.magentocommerce.com/community/notifications.rss
+ widgets.magentocommerce.com/notificationPopup
+ widgets.magentocommerce.com/%s/%s.gif
+ 0
+ 1
+ 0
+
+
+
+
diff --git a/app/code/core/Mage/AdminNotification/locale/de_DE/Mage_AdminNotification.csv b/app/code/Mage/AdminNotification/locale/de_DE/Mage_AdminNotification.csv
similarity index 100%
rename from app/code/core/Mage/AdminNotification/locale/de_DE/Mage_AdminNotification.csv
rename to app/code/Mage/AdminNotification/locale/de_DE/Mage_AdminNotification.csv
diff --git a/app/code/core/Mage/AdminNotification/locale/en_US/Mage_AdminNotification.csv b/app/code/Mage/AdminNotification/locale/en_US/Mage_AdminNotification.csv
similarity index 100%
rename from app/code/core/Mage/AdminNotification/locale/en_US/Mage_AdminNotification.csv
rename to app/code/Mage/AdminNotification/locale/en_US/Mage_AdminNotification.csv
diff --git a/app/code/core/Mage/AdminNotification/locale/es_ES/Mage_AdminNotification.csv b/app/code/Mage/AdminNotification/locale/es_ES/Mage_AdminNotification.csv
similarity index 100%
rename from app/code/core/Mage/AdminNotification/locale/es_ES/Mage_AdminNotification.csv
rename to app/code/Mage/AdminNotification/locale/es_ES/Mage_AdminNotification.csv
diff --git a/app/code/core/Mage/AdminNotification/locale/fr_FR/Mage_AdminNotification.csv b/app/code/Mage/AdminNotification/locale/fr_FR/Mage_AdminNotification.csv
similarity index 100%
rename from app/code/core/Mage/AdminNotification/locale/fr_FR/Mage_AdminNotification.csv
rename to app/code/Mage/AdminNotification/locale/fr_FR/Mage_AdminNotification.csv
diff --git a/app/code/core/Mage/AdminNotification/locale/nl_NL/Mage_AdminNotification.csv b/app/code/Mage/AdminNotification/locale/nl_NL/Mage_AdminNotification.csv
similarity index 100%
rename from app/code/core/Mage/AdminNotification/locale/nl_NL/Mage_AdminNotification.csv
rename to app/code/Mage/AdminNotification/locale/nl_NL/Mage_AdminNotification.csv
diff --git a/app/code/core/Mage/AdminNotification/locale/pt_BR/Mage_AdminNotification.csv b/app/code/Mage/AdminNotification/locale/pt_BR/Mage_AdminNotification.csv
similarity index 100%
rename from app/code/core/Mage/AdminNotification/locale/pt_BR/Mage_AdminNotification.csv
rename to app/code/Mage/AdminNotification/locale/pt_BR/Mage_AdminNotification.csv
diff --git a/app/code/core/Mage/AdminNotification/locale/zh_CN/Mage_AdminNotification.csv b/app/code/Mage/AdminNotification/locale/zh_CN/Mage_AdminNotification.csv
similarity index 100%
rename from app/code/core/Mage/AdminNotification/locale/zh_CN/Mage_AdminNotification.csv
rename to app/code/Mage/AdminNotification/locale/zh_CN/Mage_AdminNotification.csv
diff --git a/app/code/core/Mage/AdminNotification/sql/adminnotification_setup/install-1.6.0.0.php b/app/code/Mage/AdminNotification/sql/adminnotification_setup/install-1.6.0.0.php
similarity index 100%
rename from app/code/core/Mage/AdminNotification/sql/adminnotification_setup/install-1.6.0.0.php
rename to app/code/Mage/AdminNotification/sql/adminnotification_setup/install-1.6.0.0.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Api/Buttons.php b/app/code/Mage/Adminhtml/Block/Api/Buttons.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Api/Buttons.php
rename to app/code/Mage/Adminhtml/Block/Api/Buttons.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Api/Editroles.php b/app/code/Mage/Adminhtml/Block/Api/Editroles.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Api/Editroles.php
rename to app/code/Mage/Adminhtml/Block/Api/Editroles.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Api/Grid/Role.php b/app/code/Mage/Adminhtml/Block/Api/Grid/Role.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Api/Grid/Role.php
rename to app/code/Mage/Adminhtml/Block/Api/Grid/Role.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Api/Role.php b/app/code/Mage/Adminhtml/Block/Api/Role.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Api/Role.php
rename to app/code/Mage/Adminhtml/Block/Api/Role.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Api/Role/Grid/User.php b/app/code/Mage/Adminhtml/Block/Api/Role/Grid/User.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Api/Role/Grid/User.php
rename to app/code/Mage/Adminhtml/Block/Api/Role/Grid/User.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Api/Roles.php b/app/code/Mage/Adminhtml/Block/Api/Roles.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Api/Roles.php
rename to app/code/Mage/Adminhtml/Block/Api/Roles.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Api/Tab/Roleinfo.php b/app/code/Mage/Adminhtml/Block/Api/Tab/Roleinfo.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Api/Tab/Roleinfo.php
rename to app/code/Mage/Adminhtml/Block/Api/Tab/Roleinfo.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Api/Tab/Rolesedit.php b/app/code/Mage/Adminhtml/Block/Api/Tab/Rolesedit.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Api/Tab/Rolesedit.php
rename to app/code/Mage/Adminhtml/Block/Api/Tab/Rolesedit.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Api/Tab/Rolesusers.php b/app/code/Mage/Adminhtml/Block/Api/Tab/Rolesusers.php
similarity index 97%
rename from app/code/core/Mage/Adminhtml/Block/Api/Tab/Rolesusers.php
rename to app/code/Mage/Adminhtml/Block/Api/Tab/Rolesusers.php
index bacf853a40378..f7bbd8630fcd0 100644
--- a/app/code/core/Mage/Adminhtml/Block/Api/Tab/Rolesusers.php
+++ b/app/code/Mage/Adminhtml/Block/Api/Tab/Rolesusers.php
@@ -47,7 +47,7 @@ protected function _prepareLayout()
return parent::_prepareLayout();
}
- protected function _getGridHtml()
+ public function getGridHtml()
{
return $this->getChildHtml('userGrid');
}
diff --git a/app/code/core/Mage/Adminhtml/Block/Api/User.php b/app/code/Mage/Adminhtml/Block/Api/User.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Api/User.php
rename to app/code/Mage/Adminhtml/Block/Api/User.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Api/User/Edit.php b/app/code/Mage/Adminhtml/Block/Api/User/Edit.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Api/User/Edit.php
rename to app/code/Mage/Adminhtml/Block/Api/User/Edit.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Api/User/Edit/Form.php b/app/code/Mage/Adminhtml/Block/Api/User/Edit/Form.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Api/User/Edit/Form.php
rename to app/code/Mage/Adminhtml/Block/Api/User/Edit/Form.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Api/User/Edit/Tab/Main.php b/app/code/Mage/Adminhtml/Block/Api/User/Edit/Tab/Main.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Api/User/Edit/Tab/Main.php
rename to app/code/Mage/Adminhtml/Block/Api/User/Edit/Tab/Main.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Api/User/Edit/Tab/Roles.php b/app/code/Mage/Adminhtml/Block/Api/User/Edit/Tab/Roles.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Api/User/Edit/Tab/Roles.php
rename to app/code/Mage/Adminhtml/Block/Api/User/Edit/Tab/Roles.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Api/User/Edit/Tabs.php b/app/code/Mage/Adminhtml/Block/Api/User/Edit/Tabs.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Api/User/Edit/Tabs.php
rename to app/code/Mage/Adminhtml/Block/Api/User/Edit/Tabs.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Api/User/Grid.php b/app/code/Mage/Adminhtml/Block/Api/User/Grid.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Api/User/Grid.php
rename to app/code/Mage/Adminhtml/Block/Api/User/Grid.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Backup.php b/app/code/Mage/Adminhtml/Block/Backup.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Backup.php
rename to app/code/Mage/Adminhtml/Block/Backup.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Backup/Dialogs.php b/app/code/Mage/Adminhtml/Block/Backup/Dialogs.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Backup/Dialogs.php
rename to app/code/Mage/Adminhtml/Block/Backup/Dialogs.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Cache.php b/app/code/Mage/Adminhtml/Block/Cache.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Cache.php
rename to app/code/Mage/Adminhtml/Block/Cache.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Cache/Additional.php b/app/code/Mage/Adminhtml/Block/Cache/Additional.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Cache/Additional.php
rename to app/code/Mage/Adminhtml/Block/Cache/Additional.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Cache/Grid.php b/app/code/Mage/Adminhtml/Block/Cache/Grid.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Cache/Grid.php
rename to app/code/Mage/Adminhtml/Block/Cache/Grid.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Cache/Notifications.php b/app/code/Mage/Adminhtml/Block/Cache/Notifications.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Cache/Notifications.php
rename to app/code/Mage/Adminhtml/Block/Cache/Notifications.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Category/Abstract.php b/app/code/Mage/Adminhtml/Block/Catalog/Category/Abstract.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Catalog/Category/Abstract.php
rename to app/code/Mage/Adminhtml/Block/Catalog/Category/Abstract.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Category/Checkboxes/Tree.php b/app/code/Mage/Adminhtml/Block/Catalog/Category/Checkboxes/Tree.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Catalog/Category/Checkboxes/Tree.php
rename to app/code/Mage/Adminhtml/Block/Catalog/Category/Checkboxes/Tree.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Category/Edit.php b/app/code/Mage/Adminhtml/Block/Catalog/Category/Edit.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Catalog/Category/Edit.php
rename to app/code/Mage/Adminhtml/Block/Catalog/Category/Edit.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Category/Edit/Form.php b/app/code/Mage/Adminhtml/Block/Catalog/Category/Edit/Form.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Catalog/Category/Edit/Form.php
rename to app/code/Mage/Adminhtml/Block/Catalog/Category/Edit/Form.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Category/Helper/Image.php b/app/code/Mage/Adminhtml/Block/Catalog/Category/Helper/Image.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Catalog/Category/Helper/Image.php
rename to app/code/Mage/Adminhtml/Block/Catalog/Category/Helper/Image.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Category/Helper/Pricestep.php b/app/code/Mage/Adminhtml/Block/Catalog/Category/Helper/Pricestep.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Catalog/Category/Helper/Pricestep.php
rename to app/code/Mage/Adminhtml/Block/Catalog/Category/Helper/Pricestep.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Category/Helper/Sortby/Available.php b/app/code/Mage/Adminhtml/Block/Catalog/Category/Helper/Sortby/Available.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Catalog/Category/Helper/Sortby/Available.php
rename to app/code/Mage/Adminhtml/Block/Catalog/Category/Helper/Sortby/Available.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Category/Helper/Sortby/Default.php b/app/code/Mage/Adminhtml/Block/Catalog/Category/Helper/Sortby/Default.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Catalog/Category/Helper/Sortby/Default.php
rename to app/code/Mage/Adminhtml/Block/Catalog/Category/Helper/Sortby/Default.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Category/Tab/Attributes.php b/app/code/Mage/Adminhtml/Block/Catalog/Category/Tab/Attributes.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Catalog/Category/Tab/Attributes.php
rename to app/code/Mage/Adminhtml/Block/Catalog/Category/Tab/Attributes.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Category/Tab/Design.php b/app/code/Mage/Adminhtml/Block/Catalog/Category/Tab/Design.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Catalog/Category/Tab/Design.php
rename to app/code/Mage/Adminhtml/Block/Catalog/Category/Tab/Design.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Category/Tab/General.php b/app/code/Mage/Adminhtml/Block/Catalog/Category/Tab/General.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Catalog/Category/Tab/General.php
rename to app/code/Mage/Adminhtml/Block/Catalog/Category/Tab/General.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Category/Tab/Product.php b/app/code/Mage/Adminhtml/Block/Catalog/Category/Tab/Product.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Catalog/Category/Tab/Product.php
rename to app/code/Mage/Adminhtml/Block/Catalog/Category/Tab/Product.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Category/Tabs.php b/app/code/Mage/Adminhtml/Block/Catalog/Category/Tabs.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Catalog/Category/Tabs.php
rename to app/code/Mage/Adminhtml/Block/Catalog/Category/Tabs.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Category/Tree.php b/app/code/Mage/Adminhtml/Block/Catalog/Category/Tree.php
similarity index 98%
rename from app/code/core/Mage/Adminhtml/Block/Catalog/Category/Tree.php
rename to app/code/Mage/Adminhtml/Block/Catalog/Category/Tree.php
index 67619d263620d..2223168468494 100644
--- a/app/code/core/Mage/Adminhtml/Block/Catalog/Category/Tree.php
+++ b/app/code/Mage/Adminhtml/Block/Catalog/Category/Tree.php
@@ -34,8 +34,6 @@
*/
class Mage_Adminhtml_Block_Catalog_Category_Tree extends Mage_Adminhtml_Block_Catalog_Category_Abstract
{
- const XML_PATH_SUGGESTED_CATEGORIES_LIMIT = 'global/catalog/suggested_categories/limit';
-
protected $_withProductCount;
protected $_template = 'catalog/category/tree.phtml';
@@ -123,7 +121,6 @@ public function getSuggestedCategoriesJson($namePart)
$matchingNamesCollection->addAttributeToFilter('name', array('like' => $escapedNamePart))
->addAttributeToFilter('entity_id', array('neq' => Mage_Catalog_Model_Category::TREE_ROOT_ID))
->addAttributeToSelect('path')
- ->setPageSize((string)Mage::getConfig()->getNode(self::XML_PATH_SUGGESTED_CATEGORIES_LIMIT))
->setStoreId($storeId);
$shownCategoriesIds = array();
diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Category/Widget/Chooser.php b/app/code/Mage/Adminhtml/Block/Catalog/Category/Widget/Chooser.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Catalog/Category/Widget/Chooser.php
rename to app/code/Mage/Adminhtml/Block/Catalog/Category/Widget/Chooser.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Form.php b/app/code/Mage/Adminhtml/Block/Catalog/Form.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Catalog/Form.php
rename to app/code/Mage/Adminhtml/Block/Catalog/Form.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Form/Renderer/Attribute/Urlkey.php b/app/code/Mage/Adminhtml/Block/Catalog/Form/Renderer/Attribute/Urlkey.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Catalog/Form/Renderer/Attribute/Urlkey.php
rename to app/code/Mage/Adminhtml/Block/Catalog/Form/Renderer/Attribute/Urlkey.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Form/Renderer/Config/DateFieldsOrder.php b/app/code/Mage/Adminhtml/Block/Catalog/Form/Renderer/Config/DateFieldsOrder.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Catalog/Form/Renderer/Config/DateFieldsOrder.php
rename to app/code/Mage/Adminhtml/Block/Catalog/Form/Renderer/Config/DateFieldsOrder.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Form/Renderer/Config/YearRange.php b/app/code/Mage/Adminhtml/Block/Catalog/Form/Renderer/Config/YearRange.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Catalog/Form/Renderer/Config/YearRange.php
rename to app/code/Mage/Adminhtml/Block/Catalog/Form/Renderer/Config/YearRange.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Form/Renderer/Fieldset/Element.php b/app/code/Mage/Adminhtml/Block/Catalog/Form/Renderer/Fieldset/Element.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Catalog/Form/Renderer/Fieldset/Element.php
rename to app/code/Mage/Adminhtml/Block/Catalog/Form/Renderer/Fieldset/Element.php
diff --git a/app/code/Mage/Adminhtml/Block/Catalog/Helper/Form/Wysiwyg.php b/app/code/Mage/Adminhtml/Block/Catalog/Helper/Form/Wysiwyg.php
new file mode 100644
index 0000000000000..4ab9d280d8a27
--- /dev/null
+++ b/app/code/Mage/Adminhtml/Block/Catalog/Helper/Form/Wysiwyg.php
@@ -0,0 +1,96 @@
+
+ */
+class Mage_Adminhtml_Block_Catalog_Helper_Form_Wysiwyg extends Varien_Data_Form_Element_Textarea
+{
+ /**
+ * Retrieve additional html and put it at the end of element html
+ *
+ * @return string
+ */
+ public function getAfterElementHtml()
+ {
+ $html = parent::getAfterElementHtml();
+ if ($this->getIsWysiwygEnabled()) {
+ $disabled = ($this->getDisabled() || $this->getReadonly());
+ $html .= Mage::app()->getLayout()
+ ->createBlock('Mage_Adminhtml_Block_Widget_Button', '', array('data' => array(
+ 'label' => Mage::helper('Mage_Catalog_Helper_Data')->__('WYSIWYG Editor'),
+ 'type' => 'button',
+ 'disabled' => $disabled,
+ 'class' => ($disabled) ? 'disabled action-wysiwyg' : 'action-wysiwyg',
+ 'onclick' => 'catalogWysiwygEditor.open(\''
+ . Mage::helper('Mage_Adminhtml_Helper_Data')->getUrl('adminhtml/catalog_product/wysiwyg')
+ . '\', \'' . $this->getHtmlId().'\')'
+ )))->toHtml();
+ $html .= <<
+jQuery('#{$this->getHtmlId()}')
+ .addClass('wysiwyg-editor')
+ .data(
+ 'wysiwygEditor',
+ new tinyMceWysiwygSetup(
+ '{$this->getHtmlId()}',
+ {
+ settings: {
+ theme_advanced_buttons1 : 'bold,italic,|,justifyleft,justifycenter,justifyright,|,' +
+ 'fontselect,fontsizeselect,|,forecolor,backcolor,|,link,unlink,image,|,bullist,numlist,|,code',
+ theme_advanced_buttons2: null,
+ theme_advanced_buttons3: null,
+ theme_advanced_buttons4: null,
+ theme_advanced_statusbar_location: null
+ }
+ }
+ ).turnOn()
+ );
+
+HTML;
+ }
+ return $html;
+ }
+
+ /**
+ * Check whether wysiwyg enabled or not
+ *
+ * @return boolean
+ */
+ public function getIsWysiwygEnabled()
+ {
+ if (Mage::helper('Mage_Catalog_Helper_Data')->isModuleEnabled('Mage_Cms')) {
+ return (bool)(Mage::getSingleton('Mage_Cms_Model_Wysiwyg_Config')->isEnabled()
+ && $this->getEntityAttribute()->getIsWysiwygEnabled());
+ }
+
+ return false;
+ }
+}
diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Helper/Form/Wysiwyg/Content.php b/app/code/Mage/Adminhtml/Block/Catalog/Helper/Form/Wysiwyg/Content.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Catalog/Helper/Form/Wysiwyg/Content.php
rename to app/code/Mage/Adminhtml/Block/Catalog/Helper/Form/Wysiwyg/Content.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Product.php b/app/code/Mage/Adminhtml/Block/Catalog/Product.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Catalog/Product.php
rename to app/code/Mage/Adminhtml/Block/Catalog/Product.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Attribute.php b/app/code/Mage/Adminhtml/Block/Catalog/Product/Attribute.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Catalog/Product/Attribute.php
rename to app/code/Mage/Adminhtml/Block/Catalog/Product/Attribute.php
diff --git a/app/code/Mage/Adminhtml/Block/Catalog/Product/Attribute/Edit.php b/app/code/Mage/Adminhtml/Block/Catalog/Product/Attribute/Edit.php
new file mode 100644
index 0000000000000..faafc38e7a4cf
--- /dev/null
+++ b/app/code/Mage/Adminhtml/Block/Catalog/Product/Attribute/Edit.php
@@ -0,0 +1,123 @@
+
+ */
+
+class Mage_Adminhtml_Block_Catalog_Product_Attribute_Edit extends Mage_Adminhtml_Block_Widget_Form_Container
+{
+
+ protected function _construct()
+ {
+ $this->_objectId = 'attribute_id';
+ $this->_controller = 'catalog_product_attribute';
+
+ parent::_construct();
+
+ if($this->getRequest()->getParam('popup')) {
+ $this->_removeButton('back');
+ $this->_addButton(
+ 'save_in_new_set',
+ array(
+ 'label' => Mage::helper('Mage_Catalog_Helper_Data')->__('Save in New Attribute Set'),
+ 'class' => 'save',
+ 'onclick' => 'saveAttributeInNewSet(\''
+ . Mage::helper('Mage_Catalog_Helper_Data')->__('Enter Name for New Attribute Set')
+ . '\')',
+ )
+ );
+ } else {
+ $this->_addButton(
+ 'save_and_edit_button',
+ array(
+ 'label' => Mage::helper('Mage_Catalog_Helper_Data')->__('Save and Continue Edit'),
+ 'class' => 'save',
+ 'data_attribute' => array(
+ 'mage-init' => array(
+ 'button' => array('event' => 'saveAndContinueEdit', 'target' => '#edit_form'),
+ ),
+ ),
+ ),
+ 100
+ );
+ }
+
+ $this->_updateButton('save', 'label', Mage::helper('Mage_Catalog_Helper_Data')->__('Save Attribute'));
+ $this->_updateButton('save', 'data_attribute', array(
+ 'mage-init' => array(
+ 'button' => array('event' => 'save', 'target' => '#edit_form'),
+ ),
+ ));
+
+ if (!Mage::registry('entity_attribute') || !Mage::registry('entity_attribute')->getIsUserDefined()) {
+ $this->_removeButton('delete');
+ } else {
+ $this->_updateButton('delete', 'label', Mage::helper('Mage_Catalog_Helper_Data')->__('Delete Attribute'));
+ }
+ }
+
+ /**
+ * Retrieve header text
+ *
+ * @return string
+ */
+ public function getHeaderText()
+ {
+ if (Mage::registry('entity_attribute')->getId()) {
+ $frontendLabel = Mage::registry('entity_attribute')->getFrontendLabel();
+ if (is_array($frontendLabel)) {
+ $frontendLabel = $frontendLabel[0];
+ }
+ return Mage::helper('Mage_Catalog_Helper_Data')->__('Edit Product Attribute "%s"', $this->escapeHtml($frontendLabel));
+ }
+ return Mage::helper('Mage_Catalog_Helper_Data')->__('New Product Attribute');
+ }
+
+ /**
+ * Retrieve URL for validation
+ *
+ * @return string
+ */
+ public function getValidationUrl()
+ {
+ return $this->getUrl('*/*/validate', array('_current'=>true));
+ }
+
+ /**
+ * Retrieve URL for save
+ *
+ * @return string
+ */
+ public function getSaveUrl()
+ {
+ return $this->getUrl('*/'.$this->_controller.'/save', array('_current'=>true, 'back'=>null));
+ }
+}
diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Attribute/Edit/Form.php b/app/code/Mage/Adminhtml/Block/Catalog/Product/Attribute/Edit/Form.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Catalog/Product/Attribute/Edit/Form.php
rename to app/code/Mage/Adminhtml/Block/Catalog/Product/Attribute/Edit/Form.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Attribute/Edit/Tab/Front.php b/app/code/Mage/Adminhtml/Block/Catalog/Product/Attribute/Edit/Tab/Front.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Catalog/Product/Attribute/Edit/Tab/Front.php
rename to app/code/Mage/Adminhtml/Block/Catalog/Product/Attribute/Edit/Tab/Front.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Attribute/Edit/Tab/Main.php b/app/code/Mage/Adminhtml/Block/Catalog/Product/Attribute/Edit/Tab/Main.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Catalog/Product/Attribute/Edit/Tab/Main.php
rename to app/code/Mage/Adminhtml/Block/Catalog/Product/Attribute/Edit/Tab/Main.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Attribute/Edit/Tab/Options.php b/app/code/Mage/Adminhtml/Block/Catalog/Product/Attribute/Edit/Tab/Options.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Catalog/Product/Attribute/Edit/Tab/Options.php
rename to app/code/Mage/Adminhtml/Block/Catalog/Product/Attribute/Edit/Tab/Options.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Attribute/Edit/Tab/System.php b/app/code/Mage/Adminhtml/Block/Catalog/Product/Attribute/Edit/Tab/System.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Catalog/Product/Attribute/Edit/Tab/System.php
rename to app/code/Mage/Adminhtml/Block/Catalog/Product/Attribute/Edit/Tab/System.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Attribute/Edit/Tabs.php b/app/code/Mage/Adminhtml/Block/Catalog/Product/Attribute/Edit/Tabs.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Catalog/Product/Attribute/Edit/Tabs.php
rename to app/code/Mage/Adminhtml/Block/Catalog/Product/Attribute/Edit/Tabs.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Attribute/Grid.php b/app/code/Mage/Adminhtml/Block/Catalog/Product/Attribute/Grid.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Catalog/Product/Attribute/Grid.php
rename to app/code/Mage/Adminhtml/Block/Catalog/Product/Attribute/Grid.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Attribute/New/Product/Attributes.php b/app/code/Mage/Adminhtml/Block/Catalog/Product/Attribute/New/Product/Attributes.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Catalog/Product/Attribute/New/Product/Attributes.php
rename to app/code/Mage/Adminhtml/Block/Catalog/Product/Attribute/New/Product/Attributes.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Attribute/New/Product/Created.php b/app/code/Mage/Adminhtml/Block/Catalog/Product/Attribute/New/Product/Created.php
similarity index 92%
rename from app/code/core/Mage/Adminhtml/Block/Catalog/Product/Attribute/New/Product/Created.php
rename to app/code/Mage/Adminhtml/Block/Catalog/Product/Attribute/New/Product/Created.php
index e2b61043d8bce..2053341a464dc 100644
--- a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Attribute/New/Product/Created.php
+++ b/app/code/Mage/Adminhtml/Block/Catalog/Product/Attribute/New/Product/Created.php
@@ -48,11 +48,6 @@ protected function _prepareLayout()
$this->getLayout()->createBlock('Mage_Adminhtml_Block_Catalog_Product_Attribute_New_Product_Attributes')
->setGroupAttributes($this->_getGroupAttributes())
);
-
- $this->addChild('close_button', 'Mage_Adminhtml_Block_Widget_Button', array(
- 'label' => Mage::helper('Mage_Catalog_Helper_Data')->__('Close Window'),
- 'onclick' => 'addAttribute(true)'
- ));
}
/**
diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Attribute/Set/Main.php b/app/code/Mage/Adminhtml/Block/Catalog/Product/Attribute/Set/Main.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Catalog/Product/Attribute/Set/Main.php
rename to app/code/Mage/Adminhtml/Block/Catalog/Product/Attribute/Set/Main.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Attribute/Set/Main/Formattribute.php b/app/code/Mage/Adminhtml/Block/Catalog/Product/Attribute/Set/Main/Formattribute.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Catalog/Product/Attribute/Set/Main/Formattribute.php
rename to app/code/Mage/Adminhtml/Block/Catalog/Product/Attribute/Set/Main/Formattribute.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Attribute/Set/Main/Formgroup.php b/app/code/Mage/Adminhtml/Block/Catalog/Product/Attribute/Set/Main/Formgroup.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Catalog/Product/Attribute/Set/Main/Formgroup.php
rename to app/code/Mage/Adminhtml/Block/Catalog/Product/Attribute/Set/Main/Formgroup.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Attribute/Set/Main/Formset.php b/app/code/Mage/Adminhtml/Block/Catalog/Product/Attribute/Set/Main/Formset.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Catalog/Product/Attribute/Set/Main/Formset.php
rename to app/code/Mage/Adminhtml/Block/Catalog/Product/Attribute/Set/Main/Formset.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Attribute/Set/Main/Tree/Attribute.php b/app/code/Mage/Adminhtml/Block/Catalog/Product/Attribute/Set/Main/Tree/Attribute.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Catalog/Product/Attribute/Set/Main/Tree/Attribute.php
rename to app/code/Mage/Adminhtml/Block/Catalog/Product/Attribute/Set/Main/Tree/Attribute.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Attribute/Set/Main/Tree/Group.php b/app/code/Mage/Adminhtml/Block/Catalog/Product/Attribute/Set/Main/Tree/Group.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Catalog/Product/Attribute/Set/Main/Tree/Group.php
rename to app/code/Mage/Adminhtml/Block/Catalog/Product/Attribute/Set/Main/Tree/Group.php
diff --git a/app/code/Mage/Adminhtml/Block/Catalog/Product/Attribute/Set/Toolbar/Add.php b/app/code/Mage/Adminhtml/Block/Catalog/Product/Attribute/Set/Toolbar/Add.php
new file mode 100644
index 0000000000000..be947e0ee6a86
--- /dev/null
+++ b/app/code/Mage/Adminhtml/Block/Catalog/Product/Attribute/Set/Toolbar/Add.php
@@ -0,0 +1,89 @@
+
+ */
+class Mage_Adminhtml_Block_Catalog_Product_Attribute_Set_Toolbar_Add extends Mage_Adminhtml_Block_Template
+{
+
+ protected $_template = 'catalog/product/attribute/set/toolbar/add.phtml';
+
+ protected function _prepareLayout()
+ {
+ $this->addChild('save_button', 'Mage_Adminhtml_Block_Widget_Button', array(
+ 'label' => Mage::helper('Mage_Catalog_Helper_Data')->__('Save Attribute Set'),
+ 'class' => 'save',
+ 'data_attribute' => array(
+ 'mage-init' => array(
+ 'button' => array('event' => 'save', 'target' => '#set-prop-form'),
+ ),
+ ),
+ ));
+ $this->addChild('back_button', 'Mage_Adminhtml_Block_Widget_Button', array(
+ 'label' => Mage::helper('Mage_Catalog_Helper_Data')->__('Back'),
+ 'onclick' => 'setLocation(\''.$this->getUrl('*/*/').'\')',
+ 'class' => 'back'
+ ));
+
+ $this->addChild('setForm', 'Mage_Adminhtml_Block_Catalog_Product_Attribute_Set_Main_Formset');
+ return parent::_prepareLayout();
+ }
+
+ protected function _getHeader()
+ {
+ return Mage::helper('Mage_Catalog_Helper_Data')->__('Add New Attribute Set');
+ }
+
+ protected function getSaveButtonHtml()
+ {
+ return $this->getChildHtml('save_button');
+ }
+
+ protected function getBackButtonHtml()
+ {
+ return $this->getChildHtml('back_button');
+ }
+
+ protected function getFormHtml()
+ {
+ return $this->getChildHtml('setForm');
+ }
+
+ /**
+ * Return id of form, used by this block
+ *
+ * @return string
+ */
+ public function getFormId()
+ {
+ return $this->getChildBlock('setForm')->getForm()->getId();
+ }
+}
diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Attribute/Set/Toolbar/Main.php b/app/code/Mage/Adminhtml/Block/Catalog/Product/Attribute/Set/Toolbar/Main.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Catalog/Product/Attribute/Set/Toolbar/Main.php
rename to app/code/Mage/Adminhtml/Block/Catalog/Product/Attribute/Set/Toolbar/Main.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Attribute/Set/Toolbar/Main/Filter.php b/app/code/Mage/Adminhtml/Block/Catalog/Product/Attribute/Set/Toolbar/Main/Filter.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Catalog/Product/Attribute/Set/Toolbar/Main/Filter.php
rename to app/code/Mage/Adminhtml/Block/Catalog/Product/Attribute/Set/Toolbar/Main/Filter.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Composite/Configure.php b/app/code/Mage/Adminhtml/Block/Catalog/Product/Composite/Configure.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Catalog/Product/Composite/Configure.php
rename to app/code/Mage/Adminhtml/Block/Catalog/Product/Composite/Configure.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Composite/Error.php b/app/code/Mage/Adminhtml/Block/Catalog/Product/Composite/Error.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Catalog/Product/Composite/Error.php
rename to app/code/Mage/Adminhtml/Block/Catalog/Product/Composite/Error.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Composite/Fieldset.php b/app/code/Mage/Adminhtml/Block/Catalog/Product/Composite/Fieldset.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Catalog/Product/Composite/Fieldset.php
rename to app/code/Mage/Adminhtml/Block/Catalog/Product/Composite/Fieldset.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Composite/Fieldset/Configurable.php b/app/code/Mage/Adminhtml/Block/Catalog/Product/Composite/Fieldset/Configurable.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Catalog/Product/Composite/Fieldset/Configurable.php
rename to app/code/Mage/Adminhtml/Block/Catalog/Product/Composite/Fieldset/Configurable.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Composite/Fieldset/Grouped.php b/app/code/Mage/Adminhtml/Block/Catalog/Product/Composite/Fieldset/Grouped.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Catalog/Product/Composite/Fieldset/Grouped.php
rename to app/code/Mage/Adminhtml/Block/Catalog/Product/Composite/Fieldset/Grouped.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Composite/Fieldset/Options.php b/app/code/Mage/Adminhtml/Block/Catalog/Product/Composite/Fieldset/Options.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Catalog/Product/Composite/Fieldset/Options.php
rename to app/code/Mage/Adminhtml/Block/Catalog/Product/Composite/Fieldset/Options.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Composite/Fieldset/Qty.php b/app/code/Mage/Adminhtml/Block/Catalog/Product/Composite/Fieldset/Qty.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Catalog/Product/Composite/Fieldset/Qty.php
rename to app/code/Mage/Adminhtml/Block/Catalog/Product/Composite/Fieldset/Qty.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Composite/Update/Result.php b/app/code/Mage/Adminhtml/Block/Catalog/Product/Composite/Update/Result.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Catalog/Product/Composite/Update/Result.php
rename to app/code/Mage/Adminhtml/Block/Catalog/Product/Composite/Update/Result.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Created.php b/app/code/Mage/Adminhtml/Block/Catalog/Product/Created.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Catalog/Product/Created.php
rename to app/code/Mage/Adminhtml/Block/Catalog/Product/Created.php
diff --git a/app/code/Mage/Adminhtml/Block/Catalog/Product/Edit.php b/app/code/Mage/Adminhtml/Block/Catalog/Product/Edit.php
new file mode 100644
index 0000000000000..23a543176da1d
--- /dev/null
+++ b/app/code/Mage/Adminhtml/Block/Catalog/Product/Edit.php
@@ -0,0 +1,360 @@
+
+ */
+class Mage_Adminhtml_Block_Catalog_Product_Edit extends Mage_Adminhtml_Block_Widget
+{
+ protected $_template = 'catalog/product/edit.phtml';
+
+ protected function _construct()
+ {
+ parent::_construct();
+ $this->setId('product_edit');
+ }
+
+ /**
+ * Retrieve currently edited product object
+ *
+ * @return Mage_Catalog_Model_Product
+ */
+ public function getProduct()
+ {
+ return Mage::registry('current_product');
+ }
+
+ /**
+ * Add elements in layout
+ *
+ * @return Mage_Adminhtml_Block_Catalog_Product_Edit
+ */
+ protected function _prepareLayout()
+ {
+ if (!$this->getRequest()->getParam('popup')) {
+ $this->addChild('back_button', 'Mage_Adminhtml_Block_Widget_Button', array(
+ 'label' => Mage::helper('Mage_Catalog_Helper_Data')->__('Back'),
+ 'title' => Mage::helper('Mage_Catalog_Helper_Data')->__('Back'),
+ 'onclick' => 'setLocation(\''
+ . $this->getUrl('*/*/', array('store' => $this->getRequest()->getParam('store', 0))) . '\')',
+ 'class' => 'action-back'
+ ));
+ } else {
+ $this->addChild('back_button', 'Mage_Adminhtml_Block_Widget_Button', array(
+ 'label' => Mage::helper('Mage_Catalog_Helper_Data')->__('Close Window'),
+ 'onclick' => 'window.close()',
+ 'class' => 'cancel'
+ ));
+ }
+
+ if (!$this->getProduct()->isReadonly()) {
+ $this->addChild('reset_button', 'Mage_Adminhtml_Block_Widget_Button', array(
+ 'label' => Mage::helper('Mage_Catalog_Helper_Data')->__('Reset'),
+ 'onclick' => 'setLocation(\'' . $this->getUrl('*/*/*', array('_current' => true)) . '\')'
+ ));
+ }
+
+ if (!$this->getRequest()->getParam('popup')) {
+ if ($this->getProduct()->isDeleteable()) {
+ $this->addChild('delete_button', 'Mage_Adminhtml_Block_Widget_Button', array(
+ 'label' => Mage::helper('Mage_Catalog_Helper_Data')->__('Delete'),
+ 'onclick' => 'confirmSetLocation(\''
+ . Mage::helper('Mage_Catalog_Helper_Data')->__('Are you sure?') . '\', \'' . $this->getDeleteUrl() . '\')',
+ 'class' => 'delete'
+ ));
+ }
+ }
+ if (!$this->getProduct()->isReadonly()) {
+ $this->addChild('save-split-button', 'Mage_Backend_Block_Widget_Button_Split', array(
+ 'id' => 'save-split-button',
+ 'label' => Mage::helper('Mage_Catalog_Helper_Data')->__('Save'),
+ 'class_name' => 'Mage_Backend_Block_Widget_Button_Split',
+ 'button_class' => 'widget-button-save',
+ 'options' => $this->_getSaveSplitButtonOptions()
+ ));
+ }
+
+ return parent::_prepareLayout();
+ }
+
+ public function getBackButtonHtml()
+ {
+ return $this->getChildHtml('back_button');
+ }
+
+ public function getCancelButtonHtml()
+ {
+ return $this->getChildHtml('reset_button');
+ }
+
+ public function getSaveButtonHtml()
+ {
+ return $this->getChildHtml('save_button');
+ }
+
+ public function getSaveAndEditButtonHtml()
+ {
+ return $this->getChildHtml('save_and_edit_button');
+ }
+
+ public function getDeleteButtonHtml()
+ {
+ return $this->getChildHtml('delete_button');
+ }
+
+ public function getDuplicateButtonHtml()
+ {
+ return $this->getChildHtml('duplicate_button');
+ }
+
+ /**
+ * Get Save Split Button html
+ *
+ * @return string
+ */
+ public function getSaveSplitButtonHtml()
+ {
+ return $this->getChildHtml('save-split-button');
+ }
+
+ public function getValidationUrl()
+ {
+ return $this->getUrl('*/*/validate', array('_current'=>true));
+ }
+
+ public function getSaveUrl()
+ {
+ return $this->getUrl('*/*/save', array('_current'=>true, 'back'=>null));
+ }
+
+ public function getSaveAndContinueUrl()
+ {
+ return $this->getUrl('*/*/save', array(
+ '_current' => true,
+ 'back' => 'edit',
+ 'tab' => '{{tab_id}}',
+ 'active_tab' => null
+ ));
+ }
+
+ public function getProductId()
+ {
+ return $this->getProduct()->getId();
+ }
+
+ public function getProductSetId()
+ {
+ $setId = false;
+ if (!($setId = $this->getProduct()->getAttributeSetId()) && $this->getRequest()) {
+ $setId = $this->getRequest()->getParam('set', null);
+ }
+ return $setId;
+ }
+
+ public function getIsGrouped()
+ {
+ return $this->getProduct()->isGrouped();
+ }
+
+ public function getDeleteUrl()
+ {
+ return $this->getUrl('*/*/delete', array('_current'=>true));
+ }
+
+ public function getDuplicateUrl()
+ {
+ return $this->getUrl('*/*/duplicate', array('_current'=>true));
+ }
+
+ public function getHeader()
+ {
+ if ($this->getProduct()->getId()) {
+ $header = $this->escapeHtml($this->getProduct()->getName());
+ } else {
+ $header = Mage::helper('Mage_Catalog_Helper_Data')->__('New Product');
+ }
+ return $header;
+ }
+
+ public function getAttributeSetName()
+ {
+ if ($setId = $this->getProduct()->getAttributeSetId()) {
+ $set = Mage::getModel('Mage_Eav_Model_Entity_Attribute_Set')
+ ->load($setId);
+ return $set->getAttributeSetName();
+ }
+ return '';
+ }
+
+ public function getIsConfigured()
+ {
+ $result = true;
+
+ $product = $this->getProduct();
+ if ($product->isConfigurable()) {
+ $superAttributes = $product->getTypeInstance()->getUsedProductAttributeIds($product);
+ $result = !empty($superAttributes);
+ }
+
+ return $result;
+ }
+
+ public function getSelectedTabId()
+ {
+ return addslashes(htmlspecialchars($this->getRequest()->getParam('tab')));
+ }
+
+ /**
+ * Get fields masks from config
+ *
+ * @return array
+ */
+ public function getFieldsAutogenerationMasks()
+ {
+ return $this->helper('Mage_Catalog_Helper_Product')->getFieldsAutogenerationMasks();
+ }
+
+ /**
+ * Retrieve available placeholders
+ *
+ * @return array
+ */
+ public function getAttributesAllowedForAutogeneration()
+ {
+ return $this->helper('Mage_Catalog_Helper_Product')->getAttributesAllowedForAutogeneration();
+ }
+
+ /**
+ * Get data for JS (product type transition)
+ *
+ * @return string
+ */
+ public function getTypeSwitcherData()
+ {
+ return Mage::helper('Mage_Core_Helper_Data')->jsonEncode(array(
+ 'tab_id' => 'product_info_tabs_downloadable_items',
+ 'is_virtual_id' => Mage_Adminhtml_Block_Catalog_Product_Helper_Form_Weight::VIRTUAL_FIELD_HTML_ID,
+ 'weight_id' => 'weight',
+ 'current_type' => $this->getProduct()->getTypeId(),
+ 'attributes' => $this->_getAttributes(),
+ ));
+ }
+
+ /**
+ * Get formed array with attribute codes and Apply To property
+ *
+ * @return array
+ */
+ protected function _getAttributes()
+ {
+ /** @var $product Mage_Catalog_Model_Product */
+ $product = $this->getProduct();
+ $attributes = array();
+
+ foreach ($product->getAttributes() as $key => $attribute) {
+ $attributes[$key] = $attribute->getApplyTo();
+ }
+ return $attributes;
+ }
+
+ /**
+ * Get dropdown options for save split button
+ *
+ * @return array
+ */
+ protected function _getSaveSplitButtonOptions()
+ {
+ $options = array();
+ if (!$this->getRequest()->getParam('popup')) {
+ $options[] = array(
+ 'id' => 'edit-button',
+ 'label' => Mage::helper('Mage_Catalog_Helper_Data')->__('Save & Edit'),
+ 'data_attribute' => array(
+ 'mage-init' => array(
+ 'button' => array('event' => 'saveAndContinueEdit', 'target' => '#product-edit-form'),
+ ),
+ ),
+ 'default' => true,
+ );
+ }
+
+ /** @var $limitation Mage_Catalog_Model_Product_Limitation */
+ $limitation = Mage::getObjectManager()->get('Mage_Catalog_Model_Product_Limitation');
+ if ($this->_isProductNew()) {
+ $showAddNewButtons = !$limitation->isCreateRestricted(2);
+ } else {
+ $showAddNewButtons = !$limitation->isCreateRestricted();
+ }
+ if ($showAddNewButtons) {
+ $options[] = array(
+ 'id' => 'new-button',
+ 'label' => Mage::helper('Mage_Catalog_Helper_Data')->__('Save & New'),
+ 'data_attribute' => array(
+ 'mage-init' => array(
+ 'button' => array('event' => 'saveAndNew', 'target' => '#product-edit-form'),
+ ),
+ ),
+ );
+ if (!$this->getRequest()->getParam('popup') && $this->getProduct()->isDuplicable()) {
+ $options[] = array(
+ 'id' => 'duplicate-button',
+ 'label' => Mage::helper('Mage_Catalog_Helper_Data')->__('Save & Duplicate'),
+ 'data_attribute' => array(
+ 'mage-init' => array(
+ 'button' => array('event' => '', 'target' => '#product-edit-form'),
+ ),
+ ),
+ 'onclick' => $this->_isProductNew() ? '' : 'setLocation(\'' . $this->getDuplicateUrl() . '\')',
+ );
+ }
+ }
+ $options[] = array(
+ 'id' => 'close-button',
+ 'label' => Mage::helper('Mage_Catalog_Helper_Data')->__('Save & Close'),
+ 'data_attribute' => array(
+ 'mage-init' => array(
+ 'button' => array('event' => 'save', 'target' => '#product-edit-form'),
+ ),
+ ),
+ );
+ return $options;
+ }
+
+ /**
+ * Check whether new product is being created
+ *
+ * @return bool
+ */
+ protected function _isProductNew()
+ {
+ $product = $this->getProduct();
+ return !$product || !$product->getId();
+ }
+}
diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Action/Attribute.php b/app/code/Mage/Adminhtml/Block/Catalog/Product/Edit/Action/Attribute.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Action/Attribute.php
rename to app/code/Mage/Adminhtml/Block/Catalog/Product/Edit/Action/Attribute.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Action/Attribute/Tab/Attributes.php b/app/code/Mage/Adminhtml/Block/Catalog/Product/Edit/Action/Attribute/Tab/Attributes.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Action/Attribute/Tab/Attributes.php
rename to app/code/Mage/Adminhtml/Block/Catalog/Product/Edit/Action/Attribute/Tab/Attributes.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Action/Attribute/Tab/Inventory.php b/app/code/Mage/Adminhtml/Block/Catalog/Product/Edit/Action/Attribute/Tab/Inventory.php
similarity index 93%
rename from app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Action/Attribute/Tab/Inventory.php
rename to app/code/Mage/Adminhtml/Block/Catalog/Product/Edit/Action/Attribute/Tab/Inventory.php
index 85d2da9c5a37a..35b4a2a3b3150 100644
--- a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Action/Attribute/Tab/Inventory.php
+++ b/app/code/Mage/Adminhtml/Block/Catalog/Product/Edit/Action/Attribute/Tab/Inventory.php
@@ -82,12 +82,12 @@ public function getDefaultConfigValue($field)
*/
public function getTabLabel()
{
- return Mage::helper('Mage_Catalog_Helper_Data')->__('Inventory');
+ return Mage::helper('Mage_Catalog_Helper_Data')->__('Advanced Inventory');
}
public function getTabTitle()
{
- return Mage::helper('Mage_Catalog_Helper_Data')->__('Inventory');
+ return Mage::helper('Mage_Catalog_Helper_Data')->__('Advanced Inventory');
}
public function canShowTab()
diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Action/Attribute/Tab/Websites.php b/app/code/Mage/Adminhtml/Block/Catalog/Product/Edit/Action/Attribute/Tab/Websites.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Action/Attribute/Tab/Websites.php
rename to app/code/Mage/Adminhtml/Block/Catalog/Product/Edit/Action/Attribute/Tab/Websites.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Action/Attribute/Tabs.php b/app/code/Mage/Adminhtml/Block/Catalog/Product/Edit/Action/Attribute/Tabs.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Action/Attribute/Tabs.php
rename to app/code/Mage/Adminhtml/Block/Catalog/Product/Edit/Action/Attribute/Tabs.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/AttributeSet.php b/app/code/Mage/Adminhtml/Block/Catalog/Product/Edit/AttributeSet.php
similarity index 90%
rename from app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/AttributeSet.php
rename to app/code/Mage/Adminhtml/Block/Catalog/Product/Edit/AttributeSet.php
index f79a1eb4ab6f4..d8b09c5b92202 100644
--- a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/AttributeSet.php
+++ b/app/code/Mage/Adminhtml/Block/Catalog/Product/Edit/AttributeSet.php
@@ -44,11 +44,10 @@ public function getSelectorOptions()
return array(
'source' => $this->getUrl('*/catalog_product/suggestProductTemplates'),
'className' => 'category-select',
- 'template' => '#product-template-selector-template',
'showRecent' => true,
'storageKey' => 'product-template-key',
'minLength' => 0,
- 'ajaxData' => array('current_template_id' => Mage::registry('product')->getAttributeSetId()),
+ 'currentlySelected' => Mage::registry('product')->getAttributeSetId(),
);
}
}
diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Js.php b/app/code/Mage/Adminhtml/Block/Catalog/Product/Edit/Js.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Js.php
rename to app/code/Mage/Adminhtml/Block/Catalog/Product/Edit/Js.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/NewCategory.php b/app/code/Mage/Adminhtml/Block/Catalog/Product/Edit/NewCategory.php
similarity index 88%
rename from app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/NewCategory.php
rename to app/code/Mage/Adminhtml/Block/Catalog/Product/Edit/NewCategory.php
index cffde3ac48c01..8b27087349548 100644
--- a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/NewCategory.php
+++ b/app/code/Mage/Adminhtml/Block/Catalog/Product/Edit/NewCategory.php
@@ -61,6 +61,16 @@ protected function _prepareForm()
$this->setForm($form);
}
+ /**
+ * Category save action URL
+ *
+ * @return string
+ */
+ public function getSaveCategoryUrl()
+ {
+ return $this->getUrl('adminhtml/catalog_category/save');
+ }
+
/**
* Attach new category dialog widget initialization
*
@@ -73,14 +83,13 @@ public function getAfterElementHtml()
$widgetUrl = $coreHelper->jsonEncode($this->getViewFileUrl('Mage_Catalog::js/new-category-dialog.js'));
$widgetOptions = $coreHelper->jsonEncode(array(
'suggestOptions' => array(
- 'source' => $this->getUrl('*/catalog_category/suggestCategories'),
+ 'source' => $this->getUrl('adminhtml/catalog_category/suggestCategories'),
'valueField' => '#new_category_parent',
- 'template' => '#category_ids-template',
- 'control' => 'jstree',
- 'multiselect' => true,
'className' => 'category-select',
+ 'multiselect' => true,
+ 'showAll' => true,
),
- 'saveCategoryUrl' => $this->getUrl('*/catalog_category/save'),
+ 'saveCategoryUrl' => $this->getUrl('adminhtml/catalog_category/save'),
));
return <<
diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Ajax/Serializer.php b/app/code/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Ajax/Serializer.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Ajax/Serializer.php
rename to app/code/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Ajax/Serializer.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Alerts.php b/app/code/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Alerts.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Alerts.php
rename to app/code/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Alerts.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Alerts/Price.php b/app/code/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Alerts/Price.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Alerts/Price.php
rename to app/code/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Alerts/Price.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Alerts/Stock.php b/app/code/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Alerts/Stock.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Alerts/Stock.php
rename to app/code/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Alerts/Stock.php
diff --git a/app/code/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Attributes.php b/app/code/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Attributes.php
new file mode 100644
index 0000000000000..acdee5bc910c6
--- /dev/null
+++ b/app/code/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Attributes.php
@@ -0,0 +1,184 @@
+
+ */
+class Mage_Adminhtml_Block_Catalog_Product_Edit_Tab_Attributes extends Mage_Adminhtml_Block_Catalog_Form
+{
+ /**
+ * Load Wysiwyg on demand and prepare layout
+ */
+ protected function _prepareLayout()
+ {
+ parent::_prepareLayout();
+ if (Mage::helper('Mage_Catalog_Helper_Data')->isModuleEnabled('Mage_Cms')
+ && Mage::getSingleton('Mage_Cms_Model_Wysiwyg_Config')->isEnabled()
+ ) {
+ $this->getLayout()->getBlock('head')->setCanLoadTinyMce(true);
+ }
+ }
+
+ /**
+ * Prepare attributes form
+ *
+ * @return null
+ */
+ protected function _prepareForm()
+ {
+ /** @var $group Mage_Eav_Model_Entity_Attribute_Group */
+ $group = $this->getGroup();
+ if ($group) {
+ $form = new Varien_Data_Form();
+ $product = Mage::registry('product');
+ $isWrapped = Mage::registry('use_wrapper');
+ if (!isset($isWrapped)) {
+ $isWrapped = true;
+ }
+ $isCollapsable = $isWrapped && $group->getAttributeGroupCode() == 'product-details';
+ $legend = $isWrapped ? Mage::helper('Mage_Catalog_Helper_Data')->__($group->getAttributeGroupName()) : null;
+ // Initialize product object as form property to use it during elements generation
+ $form->setDataObject($product);
+
+ $fieldset = $form->addFieldset(
+ 'group-fields-' .$group->getAttributeGroupCode(),
+ array(
+ 'class' => 'user-defined',
+ 'legend' => $legend,
+ 'collapsable' => $isCollapsable
+ )
+ );
+
+ $attributes = $this->getGroupAttributes();
+
+ $this->_setFieldset($attributes, $fieldset, array('gallery'));
+
+ $urlKey = $form->getElement('url_key');
+ if ($urlKey) {
+ $urlKey->setRenderer(
+ $this->getLayout()->createBlock('Mage_Adminhtml_Block_Catalog_Form_Renderer_Attribute_Urlkey')
+ );
+ }
+
+ $tierPrice = $form->getElement('tier_price');
+ if ($tierPrice) {
+ $tierPrice->setRenderer(
+ $this->getLayout()->createBlock('Mage_Adminhtml_Block_Catalog_Product_Edit_Tab_Price_Tier')
+ );
+ }
+
+ $groupPrice = $form->getElement('group_price');
+ if ($groupPrice) {
+ $groupPrice->setRenderer(
+ $this->getLayout()->createBlock('Mage_Adminhtml_Block_Catalog_Product_Edit_Tab_Price_Group')
+ );
+ }
+
+ $recurringProfile = $form->getElement('recurring_profile');
+ if ($recurringProfile) {
+ $recurringProfile->setRenderer(
+ $this->getLayout()->createBlock('Mage_Adminhtml_Block_Catalog_Product_Edit_Tab_Price_Recurring')
+ );
+ }
+
+ // Add new attribute button if it is not an image tab
+ if (!$form->getElement('media_gallery')
+ && Mage::getSingleton('Mage_Core_Model_Authorization')->isAllowed('Mage_Catalog::attributes_attributes')
+ && $isWrapped
+ ) {
+ $headerBar = $this->getLayout()
+ ->createBlock('Mage_Adminhtml_Block_Catalog_Product_Edit_Tab_Attributes_Create');
+
+ $headerBar->getConfig()
+ ->setTabId('group_' . $group->getId())
+ ->setGroupId($group->getId())
+ ->setStoreId($form->getDataObject()->getStoreId())
+ ->setAttributeSetId($form->getDataObject()->getAttributeSetId())
+ ->setTypeId($form->getDataObject()->getTypeId())
+ ->setProductId($form->getDataObject()->getId());
+
+ $fieldset->setHeaderBar($headerBar->toHtml());
+ }
+
+ $values = $product->getData();
+
+ // Set default attribute values for new product or on attribute set change
+ if (!$product->getId() || $product->dataHasChangedFor('attribute_set_id')) {
+ foreach ($attributes as $attribute) {
+ if (!isset($values[$attribute->getAttributeCode()])) {
+ $values[$attribute->getAttributeCode()] = $attribute->getDefaultValue();
+ }
+ }
+ }
+
+ if ($product->hasLockedAttributes()) {
+ foreach ($product->getLockedAttributes() as $attribute) {
+ $element = $form->getElement($attribute);
+ if ($element) {
+ $element->setReadonly(true, true);
+ }
+ }
+ }
+ $form->addValues($values);
+ $form->setFieldNameSuffix('product');
+
+ Mage::dispatchEvent('adminhtml_catalog_product_edit_prepare_form', array('form' => $form));
+
+ $this->setForm($form);
+ }
+ }
+
+ /**
+ * Retrieve additional element types
+ *
+ * @return array
+ */
+ protected function _getAdditionalElementTypes()
+ {
+ $result = array(
+ 'price' => 'Mage_Adminhtml_Block_Catalog_Product_Helper_Form_Price',
+ 'weight' => 'Mage_Adminhtml_Block_Catalog_Product_Helper_Form_Weight',
+ 'gallery' => 'Mage_Adminhtml_Block_Catalog_Product_Helper_Form_Gallery',
+ 'image' => 'Mage_Adminhtml_Block_Catalog_Product_Helper_Form_Image',
+ 'boolean' => 'Mage_Adminhtml_Block_Catalog_Product_Helper_Form_Boolean',
+ 'textarea' => 'Mage_Adminhtml_Block_Catalog_Helper_Form_Wysiwyg',
+ );
+
+ $response = new Varien_Object();
+ $response->setTypes(array());
+ Mage::dispatchEvent('adminhtml_catalog_product_edit_element_types', array('response' => $response));
+
+ foreach ($response->getTypes() as $typeName => $typeClass) {
+ $result[$typeName] = $typeClass;
+ }
+
+ return $result;
+ }
+}
diff --git a/app/code/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Attributes/Create.php b/app/code/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Attributes/Create.php
new file mode 100644
index 0000000000000..389f898b584a1
--- /dev/null
+++ b/app/code/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Attributes/Create.php
@@ -0,0 +1,113 @@
+
+ */
+class Mage_Adminhtml_Block_Catalog_Product_Edit_Tab_Attributes_Create extends Mage_Adminhtml_Block_Widget_Button
+{
+ /**
+ * Config of create new attribute
+ *
+ * @var Varien_Object
+ */
+ protected $_config = null;
+
+ /**
+ * Retrive config of new attribute creation
+ *
+ * @return Varien_Object
+ */
+ public function getConfig()
+ {
+ if (is_null($this->_config)) {
+ $this->_config = new Varien_Object();
+ }
+
+ return $this->_config;
+ }
+
+ protected function _beforeToHtml()
+ {
+ $this->setId('create_attribute_' . $this->getConfig()->getGroupId())
+ ->setType('button')
+ ->setClass('action-add')
+ ->setLabel(Mage::helper('Mage_Adminhtml_Helper_Data')->__('Add Attribute'))
+ ->setDataAttribute(array('mage-init' =>
+ array('productAttributes' =>
+ array(
+ 'url' => $this->getUrl(
+ '*/catalog_product_attribute/new',
+ array(
+ 'group' => $this->getConfig()->getGroupId(),
+ 'product_tab' => $this->getConfig()->getTabId(),
+ 'store' => $this->getConfig()->getStoreId(),
+ 'product' => $this->getConfig()->getProductId(),
+ 'type' => $this->getConfig()->getTypeId(),
+ 'popup' => 1
+ )
+ )
+ )
+ )
+ ));
+
+ $this->getConfig()
+ ->setUrl($this->getUrl(
+ '*/catalog_product_attribute/new',
+ array(
+ 'group' => $this->getConfig()->getGroupId(),
+ 'product_tab' => $this->getConfig()->getTabId(),
+ 'store' => $this->getConfig()->getStoreId(),
+ 'product' => $this->getConfig()->getProductId(),
+ 'set' => $this->getConfig()->getAttributeSetId(),
+ 'type' => $this->getConfig()->getTypeId(),
+ 'popup' => 1
+ )
+ ));
+
+ return parent::_beforeToHtml();
+ }
+
+ protected function _toHtml()
+ {
+ $this->setCanShow(true);
+ Mage::dispatchEvent('adminhtml_catalog_product_edit_tab_attributes_create_html_before', array('block' => $this));
+ if (!$this->getCanShow()) {
+ return '';
+ }
+
+ return parent::_toHtml();
+ }
+
+ public function getJsObjectName()
+ {
+ return $this->getId() . 'JsObject';
+ }
+} // Class Mage_Adminhtml_Block_Catalog_Product_Edit_Tab_Attributes_Create End
diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Crosssell.php b/app/code/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Crosssell.php
similarity index 87%
rename from app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Crosssell.php
rename to app/code/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Crosssell.php
index c9dbed15a64d5..236e759a9ed36 100644
--- a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Crosssell.php
+++ b/app/code/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Crosssell.php
@@ -134,33 +134,38 @@ protected function _prepareColumns()
{
if (!$this->isReadonly()) {
$this->addColumn('in_products', array(
- 'header_css_class' => 'a-center',
'type' => 'checkbox',
'name' => 'in_products',
'values' => $this->_getSelectedProducts(),
'align' => 'center',
- 'index' => 'entity_id'
+ 'index' => 'entity_id',
+ 'header_css_class' => 'col-select',
+ 'column_css_class' => 'col-select'
));
}
$this->addColumn('entity_id', array(
'header' => Mage::helper('Mage_Catalog_Helper_Data')->__('ID'),
'sortable' => true,
- 'width' => 60,
- 'index' => 'entity_id'
+ 'index' => 'entity_id',
+ 'header_css_class' => 'col-id',
+ 'column_css_class' => 'col-id'
));
$this->addColumn('name', array(
'header' => Mage::helper('Mage_Catalog_Helper_Data')->__('Name'),
- 'index' => 'name'
+ 'index' => 'name',
+ 'header_css_class' => 'col-name',
+ 'column_css_class' => 'col-name'
));
$this->addColumn('type', array(
'header' => Mage::helper('Mage_Catalog_Helper_Data')->__('Type'),
- 'width' => 100,
'index' => 'type_id',
'type' => 'options',
'options' => Mage::getSingleton('Mage_Catalog_Model_Product_Type')->getOptionArray(),
+ 'header_css_class' => 'col-type',
+ 'column_css_class' => 'col-type'
));
$sets = Mage::getResourceModel('Mage_Eav_Model_Resource_Entity_Attribute_Set_Collection')
@@ -170,51 +175,58 @@ protected function _prepareColumns()
$this->addColumn('set_name', array(
'header' => Mage::helper('Mage_Catalog_Helper_Data')->__('Attrib. Set Name'),
- 'width' => 130,
'index' => 'attribute_set_id',
'type' => 'options',
'options' => $sets,
+ 'header_css_class' => 'col-attr-name',
+ 'column_css_class' => 'col-attr-name'
));
$this->addColumn('status', array(
'header' => Mage::helper('Mage_Catalog_Helper_Data')->__('Status'),
- 'width' => 90,
'index' => 'status',
'type' => 'options',
'options' => Mage::getSingleton('Mage_Catalog_Model_Product_Status')->getOptionArray(),
+ 'header_css_class' => 'col-status',
+ 'column_css_class' => 'col-status'
));
$this->addColumn('visibility', array(
'header' => Mage::helper('Mage_Catalog_Helper_Data')->__('Visibility'),
- 'width' => 90,
'index' => 'visibility',
'type' => 'options',
'options' => Mage::getSingleton('Mage_Catalog_Model_Product_Visibility')->getOptionArray(),
+ 'header_css_class' => 'col-visibility',
+ 'column_css_class' => 'col-visibility'
));
$this->addColumn('sku', array(
'header' => Mage::helper('Mage_Catalog_Helper_Data')->__('SKU'),
- 'width' => 80,
- 'index' => 'sku'
+ 'index' => 'sku',
+ 'header_css_class' => 'col-sku',
+ 'column_css_class' => 'col-sku'
));
$this->addColumn('price', array(
'header' => Mage::helper('Mage_Catalog_Helper_Data')->__('Price'),
'type' => 'currency',
'currency_code' => (string) Mage::getStoreConfig(Mage_Directory_Model_Currency::XML_PATH_CURRENCY_BASE),
- 'index' => 'price'
+ 'index' => 'price',
+ 'header_css_class' => 'col-price',
+ 'column_css_class' => 'col-price'
));
$this->addColumn('position', array(
'header' => Mage::helper('Mage_Catalog_Helper_Data')->__('Position'),
'name' => 'position',
- 'width' => 60,
'type' => 'number',
'validate_class' => 'validate-number',
'index' => 'position',
'editable' => !$this->isReadonly(),
- 'edit_only' => !$this->_getProduct()->getId()
+ 'edit_only' => !$this->_getProduct()->getId(),
+ 'header_css_class' => 'col-position',
+ 'column_css_class' => 'col-position'
));
return parent::_prepareColumns();
diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Inventory.php b/app/code/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Inventory.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Inventory.php
rename to app/code/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Inventory.php
diff --git a/app/code/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Options.php b/app/code/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Options.php
new file mode 100644
index 0000000000000..87e4008b9129b
--- /dev/null
+++ b/app/code/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Options.php
@@ -0,0 +1,67 @@
+
+ */
+
+class Mage_Adminhtml_Block_Catalog_Product_Edit_Tab_Options extends Mage_Adminhtml_Block_Widget
+{
+ protected $_template = 'catalog/product/edit/options.phtml';
+
+ protected function _prepareLayout()
+ {
+ $this->addChild('add_button', 'Mage_Adminhtml_Block_Widget_Button', array(
+ 'label' => Mage::helper('Mage_Catalog_Helper_Data')->__('Add New Option'),
+ 'class' => 'add',
+ 'id' => 'add_new_defined_option'
+ ));
+
+ $this->addChild('options_box', 'Mage_Adminhtml_Block_Catalog_Product_Edit_Tab_Options_Option');
+
+ $this->addChild('import_button', 'Mage_Adminhtml_Block_Widget_Button', array(
+ 'label' => Mage::helper('Mage_Catalog_Helper_Data')->__('Import Options'),
+ 'class' => 'add',
+ 'id' => 'import_new_defined_option'
+ ));
+
+ return parent::_prepareLayout();
+ }
+
+ public function getAddButtonHtml()
+ {
+ return $this->getChildHtml('add_button');
+ }
+
+ public function getOptionsBoxHtml()
+ {
+ return $this->getChildHtml('options_box');
+ }
+}
diff --git a/app/code/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Options/Option.php b/app/code/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Options/Option.php
new file mode 100644
index 0000000000000..43a51e670a636
--- /dev/null
+++ b/app/code/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Options/Option.php
@@ -0,0 +1,352 @@
+
+ */
+
+class Mage_Adminhtml_Block_Catalog_Product_Edit_Tab_Options_Option extends Mage_Adminhtml_Block_Widget
+{
+ protected $_product;
+
+ protected $_productInstance;
+
+ protected $_values;
+
+ protected $_itemCount = 1;
+
+ protected $_template = 'catalog/product/edit/options/option.phtml';
+
+ /**
+ * Class constructor
+ */
+ protected function _construct()
+ {
+ parent::_construct();
+
+ $this->setCanReadPrice(true);
+ $this->setCanEditPrice(true);
+ }
+
+ public function getItemCount()
+ {
+ return $this->_itemCount;
+ }
+
+ public function setItemCount($itemCount)
+ {
+ $this->_itemCount = max($this->_itemCount, $itemCount);
+ return $this;
+ }
+
+ /**
+ * Get Product
+ *
+ * @return Mage_Catalog_Model_Product
+ */
+ public function getProduct()
+ {
+ if (!$this->_productInstance) {
+ if ($product = Mage::registry('product')) {
+ $this->_productInstance = $product;
+ } else {
+ $this->_productInstance = Mage::getSingleton('Mage_Catalog_Model_Product');
+ }
+ }
+
+ return $this->_productInstance;
+ }
+
+ public function setProduct($product)
+ {
+ $this->_productInstance = $product;
+ return $this;
+ }
+
+ /**
+ * Retrieve options field name prefix
+ *
+ * @return string
+ */
+ public function getFieldName()
+ {
+ return 'product[options]';
+ }
+
+ /**
+ * Retrieve options field id prefix
+ *
+ * @return string
+ */
+ public function getFieldId()
+ {
+ return 'product_option';
+ }
+
+ /**
+ * Check block is readonly
+ *
+ * @return boolean
+ */
+ public function isReadonly()
+ {
+ return $this->getProduct()->getOptionsReadonly();
+ }
+
+ protected function _prepareLayout()
+ {
+ $path = 'global/catalog/product/options/custom/groups';
+
+ foreach (Mage::getConfig()->getNode($path)->children() as $group) {
+ $this->addChild(
+ $group->getName() . '_option_type',
+ (string)Mage::getConfig()->getNode($path . '/' . $group->getName() . '/render')
+ );
+ }
+
+ return parent::_prepareLayout();
+ }
+
+ public function getAddButtonId()
+ {
+ $buttonId = $this->getLayout()
+ ->getBlock('admin.product.options')
+ ->getChildBlock('add_button')->getId();
+ return $buttonId;
+ }
+
+ public function getTypeSelectHtml()
+ {
+ $select = $this->getLayout()->createBlock('Mage_Adminhtml_Block_Html_Select')
+ ->setData(array(
+ 'id' => $this->getFieldId() . '_${id}_type',
+ 'class' => 'select select-product-option-type required-option-select',
+ ))
+ ->setName($this->getFieldName() . '[${id}][type]')
+ ->setOptions(Mage::getSingleton('Mage_Catalog_Model_Config_Source_Product_Options_Type')->toOptionArray());
+
+ return $select->getHtml();
+ }
+
+ public function getRequireSelectHtml()
+ {
+ $select = $this->getLayout()->createBlock('Mage_Adminhtml_Block_Html_Select')
+ ->setData(array(
+ 'id' => $this->getFieldId() . '_${id}_is_require',
+ 'class' => 'select'
+ ))
+ ->setName($this->getFieldName() . '[${id}][is_require]')
+ ->setOptions(Mage::getSingleton('Mage_Backend_Model_Config_Source_Yesno')->toOptionArray());
+
+ return $select->getHtml();
+ }
+
+ /**
+ * Retrieve html templates for different types of product custom options
+ *
+ * @return string
+ */
+ public function getTemplatesHtml()
+ {
+ $canEditPrice = $this->getCanEditPrice();
+ $canReadPrice = $this->getCanReadPrice();
+ $this->getChildBlock('select_option_type')
+ ->setCanReadPrice($canReadPrice)
+ ->setCanEditPrice($canEditPrice);
+
+ $this->getChildBlock('file_option_type')
+ ->setCanReadPrice($canReadPrice)
+ ->setCanEditPrice($canEditPrice);
+
+ $this->getChildBlock('date_option_type')
+ ->setCanReadPrice($canReadPrice)
+ ->setCanEditPrice($canEditPrice);
+
+ $this->getChildBlock('text_option_type')
+ ->setCanReadPrice($canReadPrice)
+ ->setCanEditPrice($canEditPrice);
+
+ $templates = $this->getChildHtml('text_option_type') . "\n" .
+ $this->getChildHtml('file_option_type') . "\n" .
+ $this->getChildHtml('select_option_type') . "\n" .
+ $this->getChildHtml('date_option_type');
+
+ return $templates;
+ }
+
+ public function getOptionValues()
+ {
+ $optionsArr = $this->getProduct()->getOptions();
+
+ if (!$this->_values || $this->getIgnoreCaching()) {
+ $showPrice = $this->getCanReadPrice();
+ $values = array();
+ $scope = (int)Mage::app()->getStore()->getConfig(Mage_Core_Model_Store::XML_PATH_PRICE_SCOPE);
+ foreach ($optionsArr as $option) {
+ /* @var $option Mage_Catalog_Model_Product_Option */
+
+ $this->setItemCount($option->getOptionId());
+
+ $value = array();
+
+ $value['id'] = $option->getOptionId();
+ $value['item_count'] = $this->getItemCount();
+ $value['option_id'] = $option->getOptionId();
+ $value['title'] = $this->escapeHtml($option->getTitle());
+ $value['type'] = $option->getType();
+ $value['is_require'] = $option->getIsRequire();
+ $value['sort_order'] = $option->getSortOrder();
+ $value['can_edit_price'] = $this->getCanEditPrice();
+
+ if ($this->getProduct()->getStoreId() != '0') {
+ $value['checkboxScopeTitle'] = $this->getCheckboxScopeHtml($option->getOptionId(), 'title',
+ is_null($option->getStoreTitle()));
+ $value['scopeTitleDisabled'] = is_null($option->getStoreTitle()) ? 'disabled' : null;
+ }
+
+ if ($option->getGroupByType() == Mage_Catalog_Model_Product_Option::OPTION_GROUP_SELECT) {
+ $i = 0;
+ $itemCount = 0;
+ foreach ($option->getValues() as $_value) {
+ /* @var $_value Mage_Catalog_Model_Product_Option_Value */
+ $value['optionValues'][$i] = array(
+ 'item_count' => max($itemCount, $_value->getOptionTypeId()),
+ 'option_id' => $_value->getOptionId(),
+ 'option_type_id' => $_value->getOptionTypeId(),
+ 'title' => $this->escapeHtml($_value->getTitle()),
+ 'price' => ($showPrice)
+ ? $this->getPriceValue($_value->getPrice(), $_value->getPriceType()) : '',
+ 'price_type' => ($showPrice) ? $_value->getPriceType() : 0,
+ 'sku' => $this->escapeHtml($_value->getSku()),
+ 'sort_order' => $_value->getSortOrder(),
+ );
+
+ if ($this->getProduct()->getStoreId() != '0') {
+ $value['optionValues'][$i]['checkboxScopeTitle'] = $this->getCheckboxScopeHtml(
+ $_value->getOptionId(), 'title', is_null($_value->getStoreTitle()),
+ $_value->getOptionTypeId());
+ $value['optionValues'][$i]['scopeTitleDisabled'] = is_null($_value->getStoreTitle())
+ ? 'disabled' : null;
+ if ($scope == Mage_Core_Model_Store::PRICE_SCOPE_WEBSITE) {
+ $value['optionValues'][$i]['checkboxScopePrice'] = $this->getCheckboxScopeHtml(
+ $_value->getOptionId(), 'price', is_null($_value->getstorePrice()),
+ $_value->getOptionTypeId());
+ $value['optionValues'][$i]['scopePriceDisabled'] = is_null($_value->getStorePrice())
+ ? 'disabled' : null;
+ }
+ }
+ $i++;
+ }
+ } else {
+ $value['price'] = ($showPrice)
+ ? $this->getPriceValue($option->getPrice(), $option->getPriceType()) : '';
+ $value['price_type'] = $option->getPriceType();
+ $value['sku'] = $this->escapeHtml($option->getSku());
+ $value['max_characters'] = $option->getMaxCharacters();
+ $value['file_extension'] = $option->getFileExtension();
+ $value['image_size_x'] = $option->getImageSizeX();
+ $value['image_size_y'] = $option->getImageSizeY();
+ if ($this->getProduct()->getStoreId() != '0'
+ && $scope == Mage_Core_Model_Store::PRICE_SCOPE_WEBSITE
+ ) {
+ $value['checkboxScopePrice'] = $this->getCheckboxScopeHtml($option->getOptionId(), 'price',
+ is_null($option->getStorePrice()));
+ $value['scopePriceDisabled'] = is_null($option->getStorePrice()) ? 'disabled' : null;
+ }
+ }
+ $values[] = new Varien_Object($value);
+ }
+ $this->_values = $values;
+ }
+
+ return $this->_values;
+ }
+
+ /**
+ * Retrieve html of scope checkbox
+ *
+ * @param string $id
+ * @param string $name
+ * @param boolean $checked
+ * @param string $select_id
+ * @return string
+ */
+ public function getCheckboxScopeHtml($id, $name, $checked = true, $select_id = '-1')
+ {
+ $checkedHtml = '';
+ if ($checked) {
+ $checkedHtml = ' checked="checked"';
+ }
+ $selectNameHtml = '';
+ $selectIdHtml = '';
+ if ($select_id != '-1') {
+ $selectNameHtml = '[values][' . $select_id . ']';
+ $selectIdHtml = 'select_' . $select_id . '_';
+ }
+ $useDefault = ''
+ . ''
+ . ' getFieldName() . '[' . $id . ']' . $selectNameHtml . '[scope][' . $name . ']"'
+ . 'id="' . $this->getFieldId() . '_' . $id . '_' . $selectIdHtml . $name . '_use_default"' . $checkedHtml
+ .' />' . Mage::helper('Mage_Catalog_Helper_Data')->__('Use Default')
+ . '
';
+
+ return $useDefault;
+ }
+
+ public function getPriceValue($value, $type)
+ {
+ if ($type == 'percent') {
+ return number_format($value, 2, null, '');
+ } elseif ($type == 'fixed') {
+ return number_format($value, 2, null, '');
+ }
+ }
+
+ /**
+ * Return product grid url for custom options import popup
+ *
+ * @return string
+ */
+ public function getProductGridUrl()
+ {
+ return $this->getUrl('*/*/optionsImportGrid');
+ }
+
+ /**
+ * Return custom options getter URL for ajax queries
+ *
+ * @return string
+ */
+ public function getCustomOptionsUrl()
+ {
+ return $this->getUrl('*/*/customOptions');
+ }
+}
diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Options/Popup/Grid.php b/app/code/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Options/Popup/Grid.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Options/Popup/Grid.php
rename to app/code/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Options/Popup/Grid.php
diff --git a/app/code/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Options/Type/Abstract.php b/app/code/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Options/Type/Abstract.php
new file mode 100644
index 0000000000000..1bbe4db94d669
--- /dev/null
+++ b/app/code/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Options/Type/Abstract.php
@@ -0,0 +1,69 @@
+
+ */
+
+class Mage_Adminhtml_Block_Catalog_Product_Edit_Tab_Options_Type_Abstract extends Mage_Adminhtml_Block_Widget
+{
+ protected $_name = 'abstract';
+
+ protected function _prepareLayout()
+ {
+ $this->setChild('option_price_type',
+ $this->getLayout()->addBlock('Mage_Adminhtml_Block_Html_Select', '', $this->getNameInLayout())
+ ->setData(array(
+ 'id' => 'product_option_${option_id}_price_type',
+ 'class' => 'select product-option-price-type'
+ ))
+ );
+
+ $this->getChildBlock('option_price_type')
+ ->setName('product[options][${option_id}][price_type]')
+ ->setOptions(Mage::getSingleton('Mage_Catalog_Model_Config_Source_Product_Options_Price')->toOptionArray());
+
+ return parent::_prepareLayout();
+ }
+
+ /**
+ * Get html of Price Type select element
+ *
+ * @return string
+ */
+ public function getPriceTypeSelectHtml()
+ {
+ if ($this->getCanEditPrice() === false) {
+ $this->getChildBlock('option_price_type')->setExtraParams('disabled="disabled"');
+ }
+ return $this->getChildHtml('option_price_type');
+ }
+
+}
diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Options/Type/Date.php b/app/code/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Options/Type/Date.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Options/Type/Date.php
rename to app/code/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Options/Type/Date.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Options/Type/File.php b/app/code/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Options/Type/File.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Options/Type/File.php
rename to app/code/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Options/Type/File.php
diff --git a/app/code/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Options/Type/Select.php b/app/code/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Options/Type/Select.php
new file mode 100644
index 0000000000000..6ebde3a9d46bc
--- /dev/null
+++ b/app/code/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Options/Type/Select.php
@@ -0,0 +1,87 @@
+
+ */
+
+class Mage_Adminhtml_Block_Catalog_Product_Edit_Tab_Options_Type_Select extends
+ Mage_Adminhtml_Block_Catalog_Product_Edit_Tab_Options_Type_Abstract
+{
+
+ protected $_template = 'catalog/product/edit/options/type/select.phtml';
+
+ /**
+ * Class constructor
+ */
+ protected function _construct()
+ {
+ parent::_construct();
+
+ $this->setCanEditPrice(true);
+ $this->setCanReadPrice(true);
+ }
+
+ protected function _prepareLayout()
+ {
+ $this->addChild('add_select_row_button', 'Mage_Adminhtml_Block_Widget_Button', array(
+ 'label' => Mage::helper('Mage_Catalog_Helper_Data')->__('Add New Row'),
+ 'class' => 'add add-select-row',
+ 'id' => 'product_option_${option_id}_add_select_row'
+ ));
+
+ $this->addChild('delete_select_row_button', 'Mage_Adminhtml_Block_Widget_Button', array(
+ 'label' => Mage::helper('Mage_Catalog_Helper_Data')->__('Delete Row'),
+ 'class' => 'delete delete-select-row icon-btn',
+ 'id' => 'product_option_${id}_select_${select_id}_delete'
+ ));
+
+ return parent::_prepareLayout();
+ }
+
+ public function getAddButtonHtml()
+ {
+ return $this->getChildHtml('add_select_row_button');
+ }
+
+ public function getDeleteButtonHtml()
+ {
+ return $this->getChildHtml('delete_select_row_button');
+ }
+
+ public function getPriceTypeSelectHtml()
+ {
+ $this->getChildBlock('option_price_type')
+ ->setData('id', 'product_option_${id}_select_${select_id}_price_type')
+ ->setName('product[options][${id}][values][${select_id}][price_type]');
+
+ return parent::getPriceTypeSelectHtml();
+ }
+}
diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Options/Type/Text.php b/app/code/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Options/Type/Text.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Options/Type/Text.php
rename to app/code/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Options/Type/Text.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Price.php b/app/code/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Price.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Price.php
rename to app/code/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Price.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Price/Group.php b/app/code/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Price/Group.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Price/Group.php
rename to app/code/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Price/Group.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Price/Group/Abstract.php b/app/code/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Price/Group/Abstract.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Price/Group/Abstract.php
rename to app/code/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Price/Group/Abstract.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Price/Recurring.php b/app/code/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Price/Recurring.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Price/Recurring.php
rename to app/code/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Price/Recurring.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Price/Tier.php b/app/code/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Price/Tier.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Price/Tier.php
rename to app/code/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Price/Tier.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Related.php b/app/code/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Related.php
similarity index 87%
rename from app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Related.php
rename to app/code/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Related.php
index 6b2e35556cb14..655d55dc5000a 100644
--- a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Related.php
+++ b/app/code/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Related.php
@@ -131,33 +131,38 @@ protected function _prepareColumns()
{
if (!$this->isReadonly()) {
$this->addColumn('in_products', array(
- 'header_css_class' => 'a-center',
'type' => 'checkbox',
'name' => 'in_products',
'values' => $this->_getSelectedProducts(),
'align' => 'center',
- 'index' => 'entity_id'
+ 'index' => 'entity_id',
+ 'header_css_class' => 'col-select',
+ 'column_css_class' => 'col-select'
));
}
$this->addColumn('entity_id', array(
'header' => Mage::helper('Mage_Catalog_Helper_Data')->__('ID'),
'sortable' => true,
- 'width' => 60,
- 'index' => 'entity_id'
+ 'index' => 'entity_id',
+ 'header_css_class' => 'col-id',
+ 'column_css_class' => 'col-id'
));
$this->addColumn('name', array(
'header' => Mage::helper('Mage_Catalog_Helper_Data')->__('Name'),
- 'index' => 'name'
+ 'index' => 'name',
+ 'header_css_class' => 'col-name',
+ 'column_css_class' => 'col-name'
));
$this->addColumn('type', array(
'header' => Mage::helper('Mage_Catalog_Helper_Data')->__('Type'),
- 'width' => 100,
'index' => 'type_id',
'type' => 'options',
'options' => Mage::getSingleton('Mage_Catalog_Model_Product_Type')->getOptionArray(),
+ 'header_css_class' => 'col-type',
+ 'column_css_class' => 'col-type'
));
$sets = Mage::getResourceModel('Mage_Eav_Model_Resource_Entity_Attribute_Set_Collection')
@@ -167,39 +172,45 @@ protected function _prepareColumns()
$this->addColumn('set_name', array(
'header' => Mage::helper('Mage_Catalog_Helper_Data')->__('Attrib. Set Name'),
- 'width' => 130,
'index' => 'attribute_set_id',
'type' => 'options',
'options' => $sets,
+ 'header_css_class' => 'col-attr-name',
+ 'column_css_class' => 'col-attr-name'
));
$this->addColumn('status', array(
'header' => Mage::helper('Mage_Catalog_Helper_Data')->__('Status'),
- 'width' => 90,
'index' => 'status',
'type' => 'options',
'options' => Mage::getSingleton('Mage_Catalog_Model_Product_Status')->getOptionArray(),
+ 'header_css_class' => 'col-status',
+ 'column_css_class' => 'col-status'
));
$this->addColumn('visibility', array(
'header' => Mage::helper('Mage_Catalog_Helper_Data')->__('Visibility'),
- 'width' => 90,
'index' => 'visibility',
'type' => 'options',
'options' => Mage::getSingleton('Mage_Catalog_Model_Product_Visibility')->getOptionArray(),
+ 'header_css_class' => 'col-visibility',
+ 'column_css_class' => 'col-visibility'
));
$this->addColumn('sku', array(
'header' => Mage::helper('Mage_Catalog_Helper_Data')->__('SKU'),
- 'width' => 80,
- 'index' => 'sku'
+ 'index' => 'sku',
+ 'header_css_class' => 'col-sku',
+ 'column_css_class' => 'col-sku'
));
$this->addColumn('price', array(
'header' => Mage::helper('Mage_Catalog_Helper_Data')->__('Price'),
'type' => 'currency',
'currency_code' => (string) Mage::getStoreConfig(Mage_Directory_Model_Currency::XML_PATH_CURRENCY_BASE),
- 'index' => 'price'
+ 'index' => 'price',
+ 'header_css_class' => 'col-price',
+ 'column_css_class' => 'col-price'
));
$this->addColumn('position', array(
@@ -208,9 +219,10 @@ protected function _prepareColumns()
'type' => 'number',
'validate_class' => 'validate-number',
'index' => 'position',
- 'width' => 60,
'editable' => !$this->_getProduct()->getRelatedReadonly(),
- 'edit_only' => !$this->_getProduct()->getId()
+ 'edit_only' => !$this->_getProduct()->getId(),
+ 'header_css_class' => 'col-position',
+ 'column_css_class' => 'col-position'
));
return parent::_prepareColumns();
diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Reviews.php b/app/code/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Reviews.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Reviews.php
rename to app/code/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Reviews.php
diff --git a/app/code/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Super/Config.php b/app/code/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Super/Config.php
new file mode 100644
index 0000000000000..1940b4f5a47c7
--- /dev/null
+++ b/app/code/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Super/Config.php
@@ -0,0 +1,383 @@
+
+ */
+class Mage_Adminhtml_Block_Catalog_Product_Edit_Tab_Super_Config extends Mage_Adminhtml_Block_Widget
+ implements Mage_Adminhtml_Block_Widget_Tab_Interface
+{
+
+ protected $_template = 'catalog/product/edit/super/config.phtml';
+
+ /**
+ * Initialize block
+ *
+ */
+ protected function _construct()
+ {
+ parent::_construct();
+ $this->setProductId($this->getRequest()->getParam('id'));
+
+ $this->setId('config_super_product');
+ $this->setCanEditPrice(true);
+ $this->setCanReadPrice(true);
+ }
+
+ /**
+ * Retrieve Tab class (for loading)
+ *
+ * @return string
+ */
+ public function getTabClass()
+ {
+ return 'ajax';
+ }
+
+ /**
+ * Check block is readonly
+ *
+ * @return boolean
+ */
+ public function isReadonly()
+ {
+ return (bool) $this->getProduct()->getCompositeReadonly();
+ }
+
+ /**
+ * Check whether attributes of configurable products can be editable
+ *
+ * @return boolean
+ */
+ public function isAttributesConfigurationReadonly()
+ {
+ return (bool) $this->getProduct()->getAttributesConfigurationReadonly();
+ }
+
+ /**
+ * Get configurable product type
+ *
+ * @return Mage_Catalog_Model_Product_Type_Configurable
+ */
+ protected function _getProductType()
+ {
+ return Mage::getModel('Mage_Catalog_Model_Product_Type_Configurable');
+ }
+
+ /**
+ * Check whether prices of configurable products can be editable
+ *
+ * @return boolean
+ */
+ public function isAttributesPricesReadonly()
+ {
+ return $this->getProduct()->getAttributesConfigurationReadonly() ||
+ (Mage::helper('Mage_Catalog_Helper_Data')->isPriceGlobal() && $this->isReadonly());
+ }
+
+ /**
+ * Prepare Layout data
+ *
+ * @return Mage_Adminhtml_Block_Catalog_Product_Edit_Tab_Super_Config
+ */
+ protected function _prepareLayout()
+ {
+ $this->addChild('create_empty', 'Mage_Adminhtml_Block_Widget_Button', array(
+ 'label' => Mage::helper('Mage_Catalog_Helper_Data')->__('Create Empty'),
+ 'class' => 'add',
+ 'onclick' => 'superProduct.createEmptyProduct()'
+ ));
+ $this->addChild('super_settings', 'Mage_Adminhtml_Block_Catalog_Product_Edit_Tab_Super_Settings');
+
+ if ($this->getProduct()->getId()) {
+ $this->setChild('simple',
+ $this->getLayout()->createBlock('Mage_Adminhtml_Block_Catalog_Product_Edit_Tab_Super_Config_Simple',
+ 'catalog.product.edit.tab.super.config.simple')
+ );
+
+ $this->addChild('create_from_configurable', 'Mage_Adminhtml_Block_Widget_Button', array(
+ 'label' => Mage::helper('Mage_Catalog_Helper_Data')->__('Copy From Configurable'),
+ 'class' => 'add',
+ 'onclick' => 'superProduct.createNewProduct()'
+ ));
+ }
+
+ $this->addChild(
+ 'generate',
+ 'Mage_Backend_Block_Widget_Button',
+ array(
+ 'id' => 'generate-variations-button',
+ 'label' => Mage::helper('Mage_Catalog_Helper_Data')->__('Generate Variations'),
+ 'data_attribute' => array(
+ 'mage-init' => array(
+ 'button' => array(
+ 'event' => 'generate',
+ 'target' => '#product-variations-matrix',
+ 'eventData' => array(
+ 'url' => $this->getUrl('*/*/variationsMatrix', array('_current' => true)),
+ ),
+ ),
+ ),
+ ),
+ )
+ );
+
+ return parent::_prepareLayout();
+ }
+
+ /**
+ * Retrieve currently edited product object
+ *
+ * @return Mage_Catalog_Model_Product
+ */
+ public function getProduct()
+ {
+ return Mage::registry('current_product');
+ }
+
+ /**
+ * Retrieve attributes data
+ *
+ * @return array
+ */
+ public function getAttributes()
+ {
+ if (!$this->hasData('attributes')) {
+ $attributes = (array)$this->_getProductType()->getConfigurableAttributesAsArray($this->getProduct());
+ $productData = (array)$this->getRequest()->getParam('product');
+ if (isset($productData['configurable_attributes_data'])) {
+ $configurableData = $productData['configurable_attributes_data'];
+ foreach ($attributes as $key => &$attribute) {
+ if (isset($configurableData[$key])) {
+ $attribute['values'] = array_merge(
+ isset($attribute['values']) ? $attribute['values'] : array(),
+ isset($configurableData[$key]['values'])
+ ? array_filter($configurableData[$key]['values'])
+ : array()
+ );
+ }
+ }
+ }
+
+ foreach ($attributes as &$attribute) {
+ if (isset($attribute['values']) && is_array($attribute['values'])) {
+ foreach ($attribute['values'] as &$attributeValue) {
+ if (!$this->getCanReadPrice()) {
+ $attributeValue['pricing_value'] = '';
+ $attributeValue['is_percent'] = 0;
+ }
+ $attributeValue['can_edit_price'] = $this->getCanEditPrice();
+ $attributeValue['can_read_price'] = $this->getCanReadPrice();
+ }
+ }
+ }
+ $this->setData('attributes', $attributes);
+ }
+ return $this->getData('attributes');
+ }
+
+ /**
+ * Retrieve Links in JSON format
+ *
+ * @return string
+ */
+ public function getLinksJson()
+ {
+ $products = $this->_getProductType()
+ ->getUsedProducts($this->getProduct());
+ if(!$products) {
+ return '{}';
+ }
+ $data = array();
+ foreach ($products as $product) {
+ $data[$product->getId()] = $this->getConfigurableSettings($product);
+ }
+ return Mage::helper('Mage_Core_Helper_Data')->jsonEncode($data);
+ }
+
+ /**
+ * Retrieve configurable settings
+ *
+ * @param Mage_Catalog_Model_Product $product
+ * @return array
+ */
+ public function getConfigurableSettings($product) {
+ $data = array();
+ $attributes = $this->_getProductType()
+ ->getUsedProductAttributes($this->getProduct());
+ foreach ($attributes as $attribute) {
+ $data[] = array(
+ 'attribute_id' => $attribute->getId(),
+ 'label' => $product->getAttributeText($attribute->getAttributeCode()),
+ 'value_index' => $product->getData($attribute->getAttributeCode())
+ );
+ }
+
+ return $data;
+ }
+
+ /**
+ * Retrieve Grid child HTML
+ *
+ * @return string
+ */
+ public function getGridHtml()
+ {
+ return $this->getChildHtml('grid');
+ }
+
+ /**
+ * Retrieve Grid JavaScript object name
+ *
+ * @return string
+ */
+ public function getGridJsObject()
+ {
+ return $this->getChildBlock('grid')->getJsObjectName();
+ }
+
+ /**
+ * Retrieve Create New Empty Product URL
+ *
+ * @return string
+ */
+ public function getNewEmptyProductUrl()
+ {
+ return $this->getUrl(
+ '*/*/new',
+ array(
+ 'set' => $this->getProduct()->getAttributeSetId(),
+ 'type' => Mage_Catalog_Model_Product_Type::TYPE_SIMPLE,
+ 'required' => $this->_getRequiredAttributesIds(),
+ 'popup' => 1
+ )
+ );
+ }
+
+ /**
+ * Retrieve Create New Product URL
+ *
+ * @return string
+ */
+ public function getNewProductUrl()
+ {
+ return $this->getUrl(
+ '*/*/new',
+ array(
+ 'set' => $this->getProduct()->getAttributeSetId(),
+ 'type' => Mage_Catalog_Model_Product_Type::TYPE_SIMPLE,
+ 'required' => $this->_getRequiredAttributesIds(),
+ 'popup' => 1,
+ 'product' => $this->getProduct()->getId()
+ )
+ );
+ }
+
+ /**
+ * Retrieve Required attributes Ids (comma separated)
+ *
+ * @return string
+ */
+ protected function _getRequiredAttributesIds()
+ {
+ $attributesIds = array();
+ $configurableAttributes = $this->getProduct()
+ ->getTypeInstance()->getConfigurableAttributes($this->getProduct());
+ foreach ($configurableAttributes as $attribute) {
+ $attributesIds[] = $attribute->getProductAttribute()->getId();
+ }
+
+ return implode(',', $attributesIds);
+ }
+
+ /**
+ * Retrieve Tab label
+ *
+ * @return string
+ */
+ public function getTabLabel()
+ {
+ return Mage::helper('Mage_Catalog_Helper_Data')->__('Associated Products');
+ }
+
+ /**
+ * Retrieve Tab title
+ *
+ * @return string
+ */
+ public function getTabTitle()
+ {
+ return Mage::helper('Mage_Catalog_Helper_Data')->__('Associated Products');
+ }
+
+ /**
+ * Can show tab flag
+ *
+ * @return bool
+ */
+ public function canShowTab()
+ {
+ return true;
+ }
+
+ /**
+ * Check is a hidden tab
+ *
+ * @return bool
+ */
+ public function isHidden()
+ {
+ return false;
+ }
+
+ /**
+ * Show "Use default price" checkbox
+ *
+ * @return bool
+ */
+ public function getShowUseDefaultPrice()
+ {
+ return !Mage::helper('Mage_Catalog_Helper_Data')->isPriceGlobal()
+ && $this->getProduct()->getStoreId();
+ }
+
+ /**
+ * Get list of used attributes
+ *
+ * @return array
+ */
+ public function getSelectedAttributes()
+ {
+ return $this->getProduct()->isConfigurable()
+ ? array_filter($this->_getProductType()->getUsedProductAttributes($this->getProduct()))
+ : array();
+ }
+}
diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Super/Config/Attribute.php b/app/code/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Super/Config/Attribute.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Super/Config/Attribute.php
rename to app/code/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Super/Config/Attribute.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Super/Config/Grid/Filter/Inventory.php b/app/code/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Super/Config/Grid/Filter/Inventory.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Super/Config/Grid/Filter/Inventory.php
rename to app/code/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Super/Config/Grid/Filter/Inventory.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Super/Config/Grid/Renderer/Checkbox.php b/app/code/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Super/Config/Grid/Renderer/Checkbox.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Super/Config/Grid/Renderer/Checkbox.php
rename to app/code/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Super/Config/Grid/Renderer/Checkbox.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Super/Config/Grid/Renderer/Inventory.php b/app/code/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Super/Config/Grid/Renderer/Inventory.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Super/Config/Grid/Renderer/Inventory.php
rename to app/code/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Super/Config/Grid/Renderer/Inventory.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Super/Config/Matrix.php b/app/code/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Super/Config/Matrix.php
similarity index 94%
rename from app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Super/Config/Matrix.php
rename to app/code/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Super/Config/Matrix.php
index ec2c229d3ebfc..bc7feea65f4be 100644
--- a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Super/Config/Matrix.php
+++ b/app/code/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Super/Config/Matrix.php
@@ -49,7 +49,7 @@ protected function _getProductType()
*
* @return Mage_Catalog_Model_Product
*/
- protected function _getProduct()
+ public function getProduct()
{
return Mage::registry('current_product');
}
@@ -136,7 +136,7 @@ public function getEditProductUrl($id)
public function getAttributes()
{
if (!$this->hasData('attributes')) {
- $attributes = (array)$this->_getProductType()->getConfigurableAttributesAsArray($this->_getProduct());
+ $attributes = (array)$this->_getProductType()->getConfigurableAttributesAsArray($this->getProduct());
$productData = (array)$this->getRequest()->getParam('product');
if (isset($productData['configurable_attributes_data'])) {
$configurableData = $productData['configurable_attributes_data'];
@@ -164,7 +164,7 @@ public function getAttributes()
*/
public function getUsedAttributes()
{
- return $this->_getProductType()->getUsedProductAttributes($this->_getProduct());
+ return $this->_getProductType()->getUsedProductAttributes($this->getProduct());
}
/**
@@ -194,8 +194,8 @@ public function getAssociatedProducts()
*/
protected function _getAssociatedProducts()
{
- $product = $this->_getProduct();
- $ids = $this->_getProduct()->getAssociatedProductIds();
+ $product = $this->getProduct();
+ $ids = $this->getProduct()->getAssociatedProductIds();
if ($ids === null) { // form data overrides any relations stored in database
return $this->_getProductType()->getUsedProducts($product);
}
@@ -226,4 +226,14 @@ public function getAttributeFrontendClass($code)
? $attribute->getFrontend()->getClass()
: '';
}
+
+ /**
+ * Get url to upload files
+ *
+ * @return string
+ */
+ protected function getImageUploadUrl()
+ {
+ return $this->getUrl('*/catalog_product_gallery/upload');
+ }
}
diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Super/Config/Simple.php b/app/code/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Super/Config/Simple.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Super/Config/Simple.php
rename to app/code/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Super/Config/Simple.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Super/Settings.php b/app/code/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Super/Settings.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Super/Settings.php
rename to app/code/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Super/Settings.php
diff --git a/app/code/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Upsell.php b/app/code/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Upsell.php
new file mode 100644
index 0000000000000..b8e6d55bbbd95
--- /dev/null
+++ b/app/code/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Upsell.php
@@ -0,0 +1,269 @@
+
+ */
+class Mage_Adminhtml_Block_Catalog_Product_Edit_Tab_Upsell extends Mage_Adminhtml_Block_Widget_Grid
+{
+
+ /**
+ * Set grid params
+ *
+ */
+ protected function _construct()
+ {
+ parent::_construct();
+ $this->setId('up_sell_product_grid');
+ $this->setDefaultSort('entity_id');
+ $this->setUseAjax(true);
+ if ($this->_getProduct() && $this->_getProduct()->getId()) {
+ $this->setDefaultFilter(array('in_products'=>1));
+ }
+ if ($this->isReadonly()) {
+ $this->setFilterVisibility(false);
+ }
+ }
+
+ /**
+ * Retirve currently edited product model
+ *
+ * @return Mage_Catalog_Model_Product
+ */
+ protected function _getProduct()
+ {
+ return Mage::registry('current_product');
+ }
+
+ /**
+ * Add filter
+ *
+ * @param object $column
+ * @return Mage_Adminhtml_Block_Catalog_Product_Edit_Tab_Upsell
+ */
+ protected function _addColumnFilterToCollection($column)
+ {
+ // Set custom filter for in product flag
+ if ($column->getId() == 'in_products') {
+ $productIds = $this->_getSelectedProducts();
+ if (empty($productIds)) {
+ $productIds = 0;
+ }
+ if ($column->getFilter()->getValue()) {
+ $this->getCollection()->addFieldToFilter('entity_id', array('in'=>$productIds));
+ } else {
+ if($productIds) {
+ $this->getCollection()->addFieldToFilter('entity_id', array('nin'=>$productIds));
+ }
+ }
+ } else {
+ parent::_addColumnFilterToCollection($column);
+ }
+ return $this;
+ }
+
+ /**
+ * Checks when this block is readonly
+ *
+ * @return boolean
+ */
+ public function isReadonly()
+ {
+ return $this->_getProduct() && $this->_getProduct()->getUpsellReadonly();
+ }
+
+ /**
+ * Prepare collection
+ *
+ * @return Mage_Adminhtml_Block_Widget_Grid
+ */
+ protected function _prepareCollection()
+ {
+ $collection = Mage::getModel('Mage_Catalog_Model_Product_Link')->useUpSellLinks()
+ ->getProductCollection()
+ ->setProduct($this->_getProduct())
+ ->addAttributeToSelect('*');
+
+ if ($this->isReadonly()) {
+ $productIds = $this->_getSelectedProducts();
+ if (empty($productIds)) {
+ $productIds = array(0);
+ }
+ $collection->addFieldToFilter('entity_id', array('in'=>$productIds));
+ }
+
+ $this->setCollection($collection);
+ return parent::_prepareCollection();
+ }
+
+ /**
+ * Add columns to grid
+ *
+ * @return Mage_Adminhtml_Block_Widget_Grid
+ */
+ protected function _prepareColumns()
+ {
+ if (!$this->_getProduct()->getUpsellReadonly()) {
+ $this->addColumn('in_products', array(
+ 'type' => 'checkbox',
+ 'name' => 'in_products',
+ 'values' => $this->_getSelectedProducts(),
+ 'align' => 'center',
+ 'index' => 'entity_id',
+ 'header_css_class' => 'col-select',
+ 'column_css_class' => 'col-select'
+ ));
+ }
+
+ $this->addColumn('entity_id', array(
+ 'header' => Mage::helper('Mage_Catalog_Helper_Data')->__('ID'),
+ 'sortable' => true,
+ 'index' => 'entity_id',
+ 'header_css_class' => 'col-id',
+ 'column_css_class' => 'col-id'
+ ));
+ $this->addColumn('name', array(
+ 'header' => Mage::helper('Mage_Catalog_Helper_Data')->__('Name'),
+ 'index' => 'name',
+ 'header_css_class' => 'col-name',
+ 'column_css_class' => 'col-name'
+ ));
+
+ $this->addColumn('type', array(
+ 'header' => Mage::helper('Mage_Catalog_Helper_Data')->__('Type'),
+ 'index' => 'type_id',
+ 'type' => 'options',
+ 'options' => Mage::getSingleton('Mage_Catalog_Model_Product_Type')->getOptionArray(),
+ 'header_css_class' => 'col-type',
+ 'column_css_class' => 'col-type'
+ ));
+
+ $sets = Mage::getResourceModel('Mage_Eav_Model_Resource_Entity_Attribute_Set_Collection')
+ ->setEntityTypeFilter(Mage::getModel('Mage_Catalog_Model_Product')->getResource()->getTypeId())
+ ->load()
+ ->toOptionHash();
+
+ $this->addColumn('set_name', array(
+ 'header' => Mage::helper('Mage_Catalog_Helper_Data')->__('Attrib. Set Name'),
+ 'index' => 'attribute_set_id',
+ 'type' => 'options',
+ 'options' => $sets,
+ 'header_css_class' => 'col-attr-name',
+ 'column_css_class' => 'col-attr-name'
+ ));
+
+ $this->addColumn('status', array(
+ 'header' => Mage::helper('Mage_Catalog_Helper_Data')->__('Status'),
+ 'index' => 'status',
+ 'type' => 'options',
+ 'options' => Mage::getSingleton('Mage_Catalog_Model_Product_Status')->getOptionArray(),
+ 'header_css_class' => 'col-status',
+ 'column_css_class' => 'col-status'
+ ));
+
+ $this->addColumn('visibility', array(
+ 'header' => Mage::helper('Mage_Catalog_Helper_Data')->__('Visibility'),
+ 'index' => 'visibility',
+ 'type' => 'options',
+ 'options' => Mage::getSingleton('Mage_Catalog_Model_Product_Visibility')->getOptionArray(),
+ 'header_css_class' => 'col-visibility',
+ 'column_css_class' => 'col-visibility'
+ ));
+
+ $this->addColumn('sku', array(
+ 'header' => Mage::helper('Mage_Catalog_Helper_Data')->__('SKU'),
+ 'index' => 'sku',
+ 'header_css_class' => 'col-sku',
+ 'column_css_class' => 'col-sku'
+ ));
+
+ $this->addColumn('price', array(
+ 'header' => Mage::helper('Mage_Catalog_Helper_Data')->__('Price'),
+ 'type' => 'currency',
+ 'currency_code' => (string) Mage::getStoreConfig(Mage_Directory_Model_Currency::XML_PATH_CURRENCY_BASE),
+ 'index' => 'price',
+ 'header_css_class' => 'col-price',
+ 'column_css_class' => 'col-price'
+ ));
+
+ $this->addColumn('position', array(
+ 'header' => Mage::helper('Mage_Catalog_Helper_Data')->__('Position'),
+ 'name' => 'position',
+ 'type' => 'number',
+ 'validate_class' => 'validate-number',
+ 'index' => 'position',
+ 'editable' => !$this->_getProduct()->getUpsellReadonly(),
+ 'edit_only' => !$this->_getProduct()->getId(),
+ 'header_css_class' => 'col-position',
+ 'column_css_class' => 'col-position'
+ ));
+
+ return parent::_prepareColumns();
+ }
+
+ /**
+ * Rerieve grid URL
+ *
+ * @return string
+ */
+ public function getGridUrl()
+ {
+ return $this->_getData('grid_url') ? $this->_getData('grid_url') : $this->getUrl('*/*/upsellGrid', array('_current'=>true));
+ }
+
+ /**
+ * Retrieve selected upsell products
+ *
+ * @return array
+ */
+ protected function _getSelectedProducts()
+ {
+ $products = $this->getProductsUpsell();
+ if (!is_array($products)) {
+ $products = array_keys($this->getSelectedUpsellProducts());
+ }
+ return $products;
+ }
+
+ /**
+ * Retrieve upsell products
+ *
+ * @return array
+ */
+ public function getSelectedUpsellProducts()
+ {
+ $products = array();
+ foreach (Mage::registry('current_product')->getUpSellProducts() as $product) {
+ $products[$product->getId()] = array('position' => $product->getPosition());
+ }
+ return $products;
+ }
+
+}
diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Websites.php b/app/code/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Websites.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Websites.php
rename to app/code/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Websites.php
diff --git a/app/code/Mage/Adminhtml/Block/Catalog/Product/Edit/Tabs.php b/app/code/Mage/Adminhtml/Block/Catalog/Product/Edit/Tabs.php
new file mode 100644
index 0000000000000..73279db842f76
--- /dev/null
+++ b/app/code/Mage/Adminhtml/Block/Catalog/Product/Edit/Tabs.php
@@ -0,0 +1,260 @@
+
+ */
+class Mage_Adminhtml_Block_Catalog_Product_Edit_Tabs extends Mage_Adminhtml_Block_Widget_Tabs
+{
+ const BASIC_TAB_GROUP_CODE = 'basic';
+ const ADVANCED_TAB_GROUP_CODE = 'advanced';
+
+ /** @var string */
+ protected $_attributeTabBlock = 'Mage_Adminhtml_Block_Catalog_Product_Edit_Tab_Attributes';
+
+ /** @var string */
+ protected $_template = 'Mage_Catalog::product/edit/tabs.phtml';
+
+ protected function _construct()
+ {
+ parent::_construct();
+ $this->setId('product_info_tabs');
+ $this->setDestElementId('product-edit-form-tabs');
+ }
+
+ protected function _prepareLayout()
+ {
+ $product = $this->getProduct();
+
+ if (!($setId = $product->getAttributeSetId())) {
+ $setId = $this->getRequest()->getParam('set', null);
+ }
+
+ if ($setId) {
+ $groupCollection = Mage::getResourceModel('Mage_Eav_Model_Resource_Entity_Attribute_Group_Collection')
+ ->setAttributeSetFilter($setId)
+ ->setSortOrder()
+ ->load();
+
+ $tabAttributesBlock = $this->getLayout()->createBlock(
+ $this->getAttributeTabBlock(), $this->getNameInLayout() . '_attributes_tab'
+ );
+ $advancedGroups = array();
+ foreach ($groupCollection as $group) {
+ /** @var $group Mage_Eav_Model_Entity_Attribute_Group*/
+ $attributes = $product->getAttributes($group->getId(), true);
+
+ foreach ($attributes as $key => $attribute) {
+ if (!$attribute->getIsVisible()) {
+ unset($attributes[$key]);
+ }
+ }
+
+ if ($attributes) {
+ $tabData = array(
+ 'label' => Mage::helper('Mage_Catalog_Helper_Data')->__($group->getAttributeGroupName()),
+ 'content' => $this->_translateHtml(
+ $tabAttributesBlock->setGroup($group)
+ ->setGroupAttributes($attributes)
+ ->toHtml()
+ ),
+ 'class' => 'user-defined',
+ 'group_code' => $group->getTabGroupCode() ?: self::BASIC_TAB_GROUP_CODE
+ );
+
+ if ($group->getAttributeGroupCode() === 'recurring-profile') {
+ $tabData['parent_tab'] = 'advanced-pricing';
+ }
+
+ if ($tabData['group_code'] === self::BASIC_TAB_GROUP_CODE) {
+ $this->addTab($group->getAttributeGroupCode(), $tabData);
+ } else {
+ $advancedGroups[$group->getAttributeGroupCode()] = $tabData;
+ }
+ }
+ }
+
+ /* Don't display website tab for single mode */
+ if (!Mage::app()->isSingleStoreMode()) {
+ $this->addTab('websites', array(
+ 'label' => Mage::helper('Mage_Catalog_Helper_Data')->__('Websites'),
+ 'content' => $this->_translateHtml($this->getLayout()
+ ->createBlock('Mage_Adminhtml_Block_Catalog_Product_Edit_Tab_Websites')->toHtml()),
+ 'group_code' => self::BASIC_TAB_GROUP_CODE,
+ ));
+ }
+
+ if (isset($advancedGroups['advanced-pricing'])) {
+ $this->addTab('advanced-pricing', $advancedGroups['advanced-pricing']);
+ unset($advancedGroups['advanced-pricing']);
+ }
+
+ if (Mage::helper('Mage_Core_Helper_Data')->isModuleEnabled('Mage_CatalogInventory')) {
+ $this->addTab('advanced-inventory', array(
+ 'label' => Mage::helper('Mage_Catalog_Helper_Data')->__('Advanced Inventory'),
+ 'content' => $this->_translateHtml($this->getLayout()
+ ->createBlock('Mage_Adminhtml_Block_Catalog_Product_Edit_Tab_Inventory')->toHtml()),
+ 'group_code' => self::ADVANCED_TAB_GROUP_CODE,
+ ));
+ }
+
+ /**
+ * Do not change this tab id
+ * @see Mage_Adminhtml_Block_Catalog_Product_Edit_Tabs_Configurable
+ * @see Mage_Bundle_Block_Adminhtml_Catalog_Product_Edit_Tabs
+ */
+ if (!$product->isGrouped()) {
+ $this->addTab('customer_options', array(
+ 'label' => Mage::helper('Mage_Catalog_Helper_Data')->__('Custom Options'),
+ 'url' => $this->getUrl('*/*/options', array('_current' => true)),
+ 'class' => 'ajax',
+ 'group_code' => self::ADVANCED_TAB_GROUP_CODE,
+ ));
+ }
+
+ $this->addTab('related', array(
+ 'label' => Mage::helper('Mage_Catalog_Helper_Data')->__('Related Products'),
+ 'url' => $this->getUrl('*/*/related', array('_current' => true)),
+ 'class' => 'ajax',
+ 'group_code' => self::ADVANCED_TAB_GROUP_CODE,
+ ));
+
+ $this->addTab('upsell', array(
+ 'label' => Mage::helper('Mage_Catalog_Helper_Data')->__('Up-sells'),
+ 'url' => $this->getUrl('*/*/upsell', array('_current' => true)),
+ 'class' => 'ajax',
+ 'group_code' => self::ADVANCED_TAB_GROUP_CODE,
+ ));
+
+ $this->addTab('crosssell', array(
+ 'label' => Mage::helper('Mage_Catalog_Helper_Data')->__('Cross-sells'),
+ 'url' => $this->getUrl('*/*/crosssell', array('_current' => true)),
+ 'class' => 'ajax',
+ 'group_code' => self::ADVANCED_TAB_GROUP_CODE,
+ ));
+
+ if (isset($advancedGroups['design'])) {
+ $this->addTab('design', $advancedGroups['design']);
+ unset($advancedGroups['design']);
+ }
+
+ $alertPriceAllow = Mage::getStoreConfig('catalog/productalert/allow_price');
+ $alertStockAllow = Mage::getStoreConfig('catalog/productalert/allow_stock');
+ if (($alertPriceAllow || $alertStockAllow) && !$product->isGrouped()) {
+ $this->addTab('product-alerts', array(
+ 'label' => Mage::helper('Mage_Catalog_Helper_Data')->__('Product Alerts'),
+ 'content' => $this->_translateHtml($this->getLayout()
+ ->createBlock('Mage_Adminhtml_Block_Catalog_Product_Edit_Tab_Alerts', 'admin.alerts.products')
+ ->toHtml()
+ ),
+ 'group_code' => self::ADVANCED_TAB_GROUP_CODE,
+ ));
+ }
+
+ if ($this->getRequest()->getParam('id')) {
+ if (Mage::helper('Mage_Catalog_Helper_Data')->isModuleEnabled('Mage_Review')) {
+ if (Mage::getSingleton('Mage_Core_Model_Authorization')->isAllowed('Mage_Review::reviews_all')){
+ $this->addTab('product-reviews', array(
+ 'label' => Mage::helper('Mage_Catalog_Helper_Data')->__('Product Reviews'),
+ 'url' => $this->getUrl('*/*/reviews', array('_current' => true)),
+ 'class' => 'ajax',
+ 'group_code' => self::ADVANCED_TAB_GROUP_CODE,
+ ));
+ }
+ }
+ }
+
+ if (isset($advancedGroups['autosettings'])) {
+ $this->addTab('autosettings', $advancedGroups['autosettings']);
+ unset($advancedGroups['autosettings']);
+ }
+
+ foreach ($advancedGroups as $groupCode => $group) {
+ $this->addTab($groupCode, $group);
+ }
+ }
+
+ return parent::_prepareLayout();
+ }
+
+ /**
+ * Check whether active tab belong to advanced group
+ *
+ * @return bool
+ */
+ public function isAdvancedTabGroupActive()
+ {
+ return $this->_tabs[$this->_activeTab]->getGroupCode() == self::ADVANCED_TAB_GROUP_CODE;
+ }
+
+ /**
+ * Retrieve product object from object if not from registry
+ *
+ * @return Mage_Catalog_Model_Product
+ */
+ public function getProduct()
+ {
+ if (!($this->getData('product') instanceof Mage_Catalog_Model_Product)) {
+ $this->setData('product', Mage::registry('product'));
+ }
+ return $this->getData('product');
+ }
+
+ /**
+ * Getting attribute block name for tabs
+ *
+ * @return string
+ */
+ public function getAttributeTabBlock()
+ {
+ if (is_null(Mage::helper('Mage_Adminhtml_Helper_Catalog')->getAttributeTabBlock())) {
+ return $this->_attributeTabBlock;
+ }
+ return Mage::helper('Mage_Adminhtml_Helper_Catalog')->getAttributeTabBlock();
+ }
+
+ public function setAttributeTabBlock($attributeTabBlock)
+ {
+ $this->_attributeTabBlock = $attributeTabBlock;
+ return $this;
+ }
+
+ /**
+ * Translate html content
+ *
+ * @param string $html
+ * @return string
+ */
+ protected function _translateHtml($html)
+ {
+ Mage::getSingleton('Mage_Core_Model_Translate_Inline')->processResponseBody($html);
+ return $html;
+ }
+}
diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tabs/Configurable.php b/app/code/Mage/Adminhtml/Block/Catalog/Product/Edit/Tabs/Configurable.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tabs/Configurable.php
rename to app/code/Mage/Adminhtml/Block/Catalog/Product/Edit/Tabs/Configurable.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tabs/Grouped.php b/app/code/Mage/Adminhtml/Block/Catalog/Product/Edit/Tabs/Grouped.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tabs/Grouped.php
rename to app/code/Mage/Adminhtml/Block/Catalog/Product/Edit/Tabs/Grouped.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Frontend/Product/Watermark.php b/app/code/Mage/Adminhtml/Block/Catalog/Product/Frontend/Product/Watermark.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Catalog/Product/Frontend/Product/Watermark.php
rename to app/code/Mage/Adminhtml/Block/Catalog/Product/Frontend/Product/Watermark.php
diff --git a/app/code/Mage/Adminhtml/Block/Catalog/Product/Grid.php b/app/code/Mage/Adminhtml/Block/Catalog/Product/Grid.php
new file mode 100644
index 0000000000000..a353a70322bde
--- /dev/null
+++ b/app/code/Mage/Adminhtml/Block/Catalog/Product/Grid.php
@@ -0,0 +1,353 @@
+
+ */
+class Mage_Adminhtml_Block_Catalog_Product_Grid extends Mage_Adminhtml_Block_Widget_Grid
+{
+
+ protected function _construct()
+ {
+ parent::_construct();
+ $this->setId('productGrid');
+ $this->setDefaultSort('entity_id');
+ $this->setDefaultDir('DESC');
+ $this->setSaveParametersInSession(true);
+ $this->setUseAjax(true);
+ $this->setVarNameFilter('product_filter');
+
+ }
+
+ protected function _getStore()
+ {
+ $storeId = (int) $this->getRequest()->getParam('store', 0);
+ return Mage::app()->getStore($storeId);
+ }
+
+ protected function _prepareCollection()
+ {
+ $store = $this->_getStore();
+ $collection = Mage::getModel('Mage_Catalog_Model_Product')->getCollection()
+ ->addAttributeToSelect('sku')
+ ->addAttributeToSelect('name')
+ ->addAttributeToSelect('attribute_set_id')
+ ->addAttributeToSelect('type_id');
+
+ if (Mage::helper('Mage_Catalog_Helper_Data')->isModuleEnabled('Mage_CatalogInventory')) {
+ $collection->joinField('qty',
+ 'cataloginventory_stock_item',
+ 'qty',
+ 'product_id=entity_id',
+ '{{table}}.stock_id=1',
+ 'left');
+ }
+ if ($store->getId()) {
+ //$collection->setStoreId($store->getId());
+ $adminStore = Mage_Core_Model_AppInterface::ADMIN_STORE_ID;
+ $collection->addStoreFilter($store);
+ $collection->joinAttribute(
+ 'name',
+ 'catalog_product/name',
+ 'entity_id',
+ null,
+ 'inner',
+ $adminStore
+ );
+ $collection->joinAttribute(
+ 'custom_name',
+ 'catalog_product/name',
+ 'entity_id',
+ null,
+ 'inner',
+ $store->getId()
+ );
+ $collection->joinAttribute(
+ 'status',
+ 'catalog_product/status',
+ 'entity_id',
+ null,
+ 'inner',
+ $store->getId()
+ );
+ $collection->joinAttribute(
+ 'visibility',
+ 'catalog_product/visibility',
+ 'entity_id',
+ null,
+ 'inner',
+ $store->getId()
+ );
+ $collection->joinAttribute(
+ 'price',
+ 'catalog_product/price',
+ 'entity_id',
+ null,
+ 'left',
+ $store->getId()
+ );
+ }
+ else {
+ $collection->addAttributeToSelect('price');
+ $collection->joinAttribute('status', 'catalog_product/status', 'entity_id', null, 'inner');
+ $collection->joinAttribute('visibility', 'catalog_product/visibility', 'entity_id', null, 'inner');
+ }
+
+ $this->setCollection($collection);
+
+ parent::_prepareCollection();
+ $this->getCollection()->addWebsiteNamesToResult();
+ return $this;
+ }
+
+ protected function _addColumnFilterToCollection($column)
+ {
+ if ($this->getCollection()) {
+ if ($column->getId() == 'websites') {
+ $this->getCollection()->joinField('websites',
+ 'catalog_product_website',
+ 'website_id',
+ 'product_id=entity_id',
+ null,
+ 'left');
+ }
+ }
+ return parent::_addColumnFilterToCollection($column);
+ }
+
+ protected function _prepareColumns()
+ {
+ $this->addColumn('entity_id',
+ array(
+ 'header'=> Mage::helper('Mage_Catalog_Helper_Data')->__('ID'),
+ 'width' => '50px',
+ 'type' => 'number',
+ 'index' => 'entity_id',
+ 'header_css_class' => 'col-id',
+ 'column_css_class' => 'col-id'
+ ));
+ $this->addColumn('name',
+ array(
+ 'header'=> Mage::helper('Mage_Catalog_Helper_Data')->__('Name'),
+ 'index' => 'name',
+ 'class' => 'xxx',
+ 'header_css_class' => 'col-name',
+ 'column_css_class' => 'col-name'
+ ));
+
+ $store = $this->_getStore();
+ if ($store->getId()) {
+ $this->addColumn('custom_name',
+ array(
+ 'header'=> Mage::helper('Mage_Catalog_Helper_Data')->__('Name in %s', $store->getName()),
+ 'index' => 'custom_name',
+ 'header_css_class' => 'col-name',
+ 'column_css_class' => 'col-name'
+ ));
+ }
+
+ $this->addColumn('type',
+ array(
+ 'header'=> Mage::helper('Mage_Catalog_Helper_Data')->__('Type'),
+ 'width' => '60px',
+ 'index' => 'type_id',
+ 'type' => 'options',
+ 'options' => Mage::getSingleton('Mage_Catalog_Model_Product_Type')->getOptionArray(),
+ 'header_css_class' => 'col-type',
+ 'column_css_class' => 'col-type'
+ ));
+
+ $sets = Mage::getResourceModel('Mage_Eav_Model_Resource_Entity_Attribute_Set_Collection')
+ ->setEntityTypeFilter(Mage::getModel('Mage_Catalog_Model_Product')->getResource()->getTypeId())
+ ->load()
+ ->toOptionHash();
+
+ $this->addColumn('set_name',
+ array(
+ 'header'=> Mage::helper('Mage_Catalog_Helper_Data')->__('Attrib. Set Name'),
+ 'width' => '100px',
+ 'index' => 'attribute_set_id',
+ 'type' => 'options',
+ 'options' => $sets,
+ 'header_css_class' => 'col-attr-name',
+ 'column_css_class' => 'col-attr-name'
+ ));
+
+ $this->addColumn('sku',
+ array(
+ 'header'=> Mage::helper('Mage_Catalog_Helper_Data')->__('SKU'),
+ 'width' => '80px',
+ 'index' => 'sku',
+ 'header_css_class' => 'col-sku',
+ 'column_css_class' => 'col-sku'
+ ));
+
+ $store = $this->_getStore();
+ $this->addColumn('price',
+ array(
+ 'header'=> Mage::helper('Mage_Catalog_Helper_Data')->__('Price'),
+ 'type' => 'price',
+ 'currency_code' => $store->getBaseCurrency()->getCode(),
+ 'index' => 'price',
+ 'header_css_class' => 'col-price',
+ 'column_css_class' => 'col-price'
+ ));
+
+ if (Mage::helper('Mage_Catalog_Helper_Data')->isModuleEnabled('Mage_CatalogInventory')) {
+ $this->addColumn('qty',
+ array(
+ 'header'=> Mage::helper('Mage_Catalog_Helper_Data')->__('Qty'),
+ 'width' => '100px',
+ 'type' => 'number',
+ 'index' => 'qty',
+ 'header_css_class' => 'col-qty',
+ 'column_css_class' => 'col-qty'
+ ));
+ }
+
+ $this->addColumn('visibility',
+ array(
+ 'header'=> Mage::helper('Mage_Catalog_Helper_Data')->__('Visibility'),
+ 'width' => '70px',
+ 'index' => 'visibility',
+ 'type' => 'options',
+ 'options' => Mage::getModel('Mage_Catalog_Model_Product_Visibility')->getOptionArray(),
+ 'header_css_class' => 'col-visibility',
+ 'column_css_class' => 'col-visibility'
+ ));
+
+ $this->addColumn('status',
+ array(
+ 'header'=> Mage::helper('Mage_Catalog_Helper_Data')->__('Status'),
+ 'width' => '70px',
+ 'index' => 'status',
+ 'type' => 'options',
+ 'options' => Mage::getSingleton('Mage_Catalog_Model_Product_Status')->getOptionArray(),
+ 'header_css_class' => 'col-status',
+ 'column_css_class' => 'col-status'
+ ));
+
+ if (!Mage::app()->isSingleStoreMode()) {
+ $this->addColumn('websites',
+ array(
+ 'header'=> Mage::helper('Mage_Catalog_Helper_Data')->__('Websites'),
+ 'width' => '100px',
+ 'sortable' => false,
+ 'index' => 'websites',
+ 'type' => 'options',
+ 'options' => Mage::getModel('Mage_Core_Model_Website')->getCollection()->toOptionHash(),
+ 'header_css_class' => 'col-websites',
+ 'column_css_class' => 'col-websites'
+ ));
+ }
+
+ $this->addColumn('edit',
+ array(
+ 'header' => Mage::helper('Mage_Catalog_Helper_Data')->__('Edit'),
+ 'width' => '50px',
+ 'type' => 'action',
+ 'getter' => 'getId',
+ 'actions' => array(
+ array(
+ 'caption' => Mage::helper('Mage_Catalog_Helper_Data')->__('Edit'),
+ 'url' => array(
+ 'base'=>'*/*/edit',
+ 'params'=>array('store'=>$this->getRequest()->getParam('store'))
+ ),
+ 'field' => 'id'
+ )
+ ),
+ 'filter' => false,
+ 'sortable' => false,
+ 'index' => 'stores',
+ 'header_css_class' => 'col-action',
+ 'column_css_class' => 'col-action'
+ ));
+
+ if (Mage::helper('Mage_Catalog_Helper_Data')->isModuleEnabled('Mage_Rss')) {
+ $this->addRssList('rss/catalog/notifystock', Mage::helper('Mage_Catalog_Helper_Data')->__('Notify Low Stock RSS'));
+ }
+
+ return parent::_prepareColumns();
+ }
+
+ protected function _prepareMassaction()
+ {
+ $this->setMassactionIdField('entity_id');
+ $this->getMassactionBlock()->setTemplate('Mage_Catalog::product/grid/massaction_extended.phtml');
+ $this->getMassactionBlock()->setFormFieldName('product');
+
+ $this->getMassactionBlock()->addItem('delete', array(
+ 'label'=> Mage::helper('Mage_Catalog_Helper_Data')->__('Delete'),
+ 'url' => $this->getUrl('*/*/massDelete'),
+ 'confirm' => Mage::helper('Mage_Catalog_Helper_Data')->__('Are you sure?')
+ ));
+
+ $statuses = Mage::getSingleton('Mage_Catalog_Model_Product_Status')->getOptionArray();
+
+ array_unshift($statuses, array('label'=>'', 'value'=>''));
+ $this->getMassactionBlock()->addItem('status', array(
+ 'label'=> Mage::helper('Mage_Catalog_Helper_Data')->__('Change status'),
+ 'url' => $this->getUrl('*/*/massStatus', array('_current'=>true)),
+ 'additional' => array(
+ 'visibility' => array(
+ 'name' => 'status',
+ 'type' => 'select',
+ 'class' => 'required-entry',
+ 'label' => Mage::helper('Mage_Catalog_Helper_Data')->__('Status'),
+ 'values' => $statuses
+ )
+ )
+ ));
+
+ if (Mage::getSingleton('Mage_Core_Model_Authorization')->isAllowed('Mage_Catalog::update_attributes')){
+ $this->getMassactionBlock()->addItem('attributes', array(
+ 'label' => Mage::helper('Mage_Catalog_Helper_Data')->__('Update Attributes'),
+ 'url' => $this->getUrl('*/catalog_product_action_attribute/edit', array('_current'=>true))
+ ));
+ }
+
+ Mage::dispatchEvent('adminhtml_catalog_product_grid_prepare_massaction', array('block' => $this));
+ return $this;
+ }
+
+ public function getGridUrl()
+ {
+ return $this->getUrl('*/*/grid', array('_current'=>true));
+ }
+
+ public function getRowUrl($row)
+ {
+ return $this->getUrl('*/*/edit', array(
+ 'store'=>$this->getRequest()->getParam('store'),
+ 'id'=>$row->getId())
+ );
+ }
+}
diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Helper/Form/Apply.php b/app/code/Mage/Adminhtml/Block/Catalog/Product/Helper/Form/Apply.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Catalog/Product/Helper/Form/Apply.php
rename to app/code/Mage/Adminhtml/Block/Catalog/Product/Helper/Form/Apply.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Helper/Form/BaseImage.php b/app/code/Mage/Adminhtml/Block/Catalog/Product/Helper/Form/BaseImage.php
similarity index 81%
rename from app/code/core/Mage/Adminhtml/Block/Catalog/Product/Helper/Form/BaseImage.php
rename to app/code/Mage/Adminhtml/Block/Catalog/Product/Helper/Form/BaseImage.php
index a9f3d8ee9235a..b963468465f7a 100644
--- a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Helper/Form/BaseImage.php
+++ b/app/code/Mage/Adminhtml/Block/Catalog/Product/Helper/Form/BaseImage.php
@@ -103,6 +103,7 @@ public function getElementHtml()
{
$htmlId = $this->_coreHelper->escapeHtml($this->getHtmlId());
$uploadUrl = $this->_coreHelper->escapeHtml($this->_getUploadUrl());
+ $spacerImage = Mage::getDesign()->getViewFileUrl('images/spacer.gif');
/** @var $product Mage_Catalog_Model_Product */
$html = <<
+
+ {$this->helper('Mage_Catalog_Helper_Data')->__('Image Management')}
+
+
+
HTML;
return $html;
}
@@ -139,7 +156,7 @@ public function getElementHtml()
*/
protected function _getUploadUrl()
{
- return $this->_url->getUrl('*/catalog_product_gallery/upload');
+ return $this->_url->getUrl('adminhtml/catalog_product_gallery/upload');
}
/**
diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Helper/Form/Boolean.php b/app/code/Mage/Adminhtml/Block/Catalog/Product/Helper/Form/Boolean.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Catalog/Product/Helper/Form/Boolean.php
rename to app/code/Mage/Adminhtml/Block/Catalog/Product/Helper/Form/Boolean.php
diff --git a/app/code/Mage/Adminhtml/Block/Catalog/Product/Helper/Form/Category.php b/app/code/Mage/Adminhtml/Block/Catalog/Product/Helper/Form/Category.php
new file mode 100644
index 0000000000000..a020e825e41d8
--- /dev/null
+++ b/app/code/Mage/Adminhtml/Block/Catalog/Product/Helper/Form/Category.php
@@ -0,0 +1,111 @@
+
+ */
+class Mage_Adminhtml_Block_Catalog_Product_Helper_Form_Category extends Varien_Data_Form_Element_Multiselect
+{
+ /**
+ * Get values for select
+ * @return array
+ */
+ public function getValues()
+ {
+ $collection = $this->_getCategoriesCollection();
+ $values = $this->getValue();
+ if (!is_array($values)) {
+ $values = explode(',', $values);
+ }
+ $collection->addAttributeToSelect('name');
+ $collection->addIdFilter($values);
+
+ $options = array();
+
+ foreach ($collection as $category) {
+ $options[] = array(
+ 'label' => $category->getName(),
+ 'value' => $category->getId()
+ );
+ }
+ return $options;
+ }
+
+ /**
+ * Get categories collection
+ * @return Mage_Catalog_Model_Resource_Category_Collection
+ */
+ protected function _getCategoriesCollection()
+ {
+ return Mage::getResourceModel('Mage_Catalog_Model_Resource_Category_Collection');
+ }
+
+ /**
+ * Attach category suggest widget initialization
+ *
+ * @return string
+ */
+ public function getAfterElementHtml()
+ {
+ /** @var $coreHelper Mage_Core_Helper_Data */
+ $coreHelper = Mage::helper('Mage_Core_Helper_Data');
+ $htmlId = $this->getHtmlId();
+ $suggestPlaceholder = Mage::helper('Mage_Catalog_Helper_Data')->__('start typing to search category');
+ $selectorOptions = $coreHelper->jsonEncode($this->_getSelectorOptions());
+ $newCategoryCaption = Mage::helper('Mage_Catalog_Helper_Data')->__('New Category');
+
+ return <<
+
+
+ {$newCategoryCaption}
+
+HTML;
+ }
+
+ /**
+ * Get selector options
+ *
+ * @return array
+ */
+ protected function _getSelectorOptions()
+ {
+ return array(
+ 'source' => Mage::helper('Mage_Backend_Helper_Data')
+ ->getUrl('adminhtml/catalog_category/suggestCategories'),
+ 'valueField' => '#' . $this->getHtmlId(),
+ 'className' => 'category-select',
+ 'multiselect' => true,
+ 'showAll' => true
+ );
+ }
+}
diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Helper/Form/Config.php b/app/code/Mage/Adminhtml/Block/Catalog/Product/Helper/Form/Config.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Catalog/Product/Helper/Form/Config.php
rename to app/code/Mage/Adminhtml/Block/Catalog/Product/Helper/Form/Config.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Helper/Form/Gallery.php b/app/code/Mage/Adminhtml/Block/Catalog/Product/Helper/Form/Gallery.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Catalog/Product/Helper/Form/Gallery.php
rename to app/code/Mage/Adminhtml/Block/Catalog/Product/Helper/Form/Gallery.php
diff --git a/app/code/Mage/Adminhtml/Block/Catalog/Product/Helper/Form/Gallery/Content.php b/app/code/Mage/Adminhtml/Block/Catalog/Product/Helper/Form/Gallery/Content.php
new file mode 100644
index 0000000000000..7148ee69421a4
--- /dev/null
+++ b/app/code/Mage/Adminhtml/Block/Catalog/Product/Helper/Form/Gallery/Content.php
@@ -0,0 +1,175 @@
+
+ *
+ * @method Varien_Data_Form_Element_Abstract getElement()
+ */
+class Mage_Adminhtml_Block_Catalog_Product_Helper_Form_Gallery_Content extends Mage_Adminhtml_Block_Widget
+{
+ protected $_template = 'catalog/product/helper/gallery.phtml';
+
+ protected function _prepareLayout()
+ {
+ $this->addChild('uploader', 'Mage_Adminhtml_Block_Media_Uploader');
+
+ $this->getUploader()->getConfig()
+ ->setUrl(
+ Mage::getModel('Mage_Backend_Model_Url')
+ ->addSessionParam()
+ ->getUrl('adminhtml/catalog_product_gallery/upload')
+ )
+ ->setFileField('image')
+ ->setFilters(array(
+ 'images' => array(
+ 'label' => Mage::helper('Mage_Adminhtml_Helper_Data')->__('Images (.gif, .jpg, .png)'),
+ 'files' => array('*.gif', '*.jpg','*.jpeg', '*.png')
+ )
+ ));
+
+ Mage::dispatchEvent('catalog_product_gallery_prepare_layout', array('block' => $this));
+
+ return parent::_prepareLayout();
+ }
+
+
+ /**
+ * Retrive uploader block
+ *
+ * @return Mage_Adminhtml_Block_Media_Uploader
+ */
+ public function getUploader()
+ {
+ return $this->getChildBlock('uploader');
+ }
+
+ /**
+ * Retrive uploader block html
+ *
+ * @return string
+ */
+ public function getUploaderHtml()
+ {
+ return $this->getChildHtml('uploader');
+ }
+
+ public function getJsObjectName()
+ {
+ return $this->getHtmlId() . 'JsObject';
+ }
+
+ public function getAddImagesButton()
+ {
+ return $this->getButtonHtml(
+ Mage::helper('Mage_Catalog_Helper_Data')->__('Add New Images'),
+ $this->getJsObjectName() . '.showUploader()',
+ 'add',
+ $this->getHtmlId() . '_add_images_button'
+ );
+ }
+
+ public function getImagesJson()
+ {
+ if (is_array($this->getElement()->getValue())) {
+ $value = $this->getElement()->getValue();
+ if (is_array($value['images']) && count($value['images']) > 0) {
+ foreach ($value['images'] as &$image) {
+ $image['url'] = Mage::getSingleton('Mage_Catalog_Model_Product_Media_Config')
+ ->getMediaUrl($image['file']);
+ $image['label'] = substr($image['file'], strrpos($image['file'], '/') + 1);
+ }
+ return Mage::helper('Mage_Core_Helper_Data')->jsonEncode($value['images']);
+ }
+ }
+ return '[]';
+ }
+
+ public function getImagesValuesJson()
+ {
+ $values = array();
+ foreach ($this->getMediaAttributes() as $attribute) {
+ /* @var $attribute Mage_Eav_Model_Entity_Attribute */
+ $values[$attribute->getAttributeCode()] = $this->getElement()->getDataObject()->getData(
+ $attribute->getAttributeCode()
+ );
+ }
+ return Mage::helper('Mage_Core_Helper_Data')->jsonEncode($values);
+ }
+
+ /**
+ * Get image types data
+ *
+ * @return array
+ */
+ public function getImageTypes()
+ {
+ $imageTypes = array();
+ foreach ($this->getMediaAttributes() as $attribute) {
+ /* @var $attribute Mage_Eav_Model_Entity_Attribute */
+ $imageTypes[$attribute->getAttributeCode()] = array(
+ 'code' => $attribute->getAttributeCode(),
+ 'value' => $this->getElement()->getDataObject()->getData($attribute->getAttributeCode()),
+ 'label' => $attribute->getFrontend()->getLabel(),
+ 'scope' => Mage::helper('Mage_Catalog_Helper_Data')->__($this->getElement()->getScopeLabel($attribute)),
+ 'name' => $this->getElement()->getAttributeFieldName($attribute)
+ );
+ }
+ return $imageTypes;
+ }
+
+ public function hasUseDefault()
+ {
+ foreach ($this->getMediaAttributes() as $attribute) {
+ if($this->getElement()->canDisplayUseDefault($attribute)) {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ /**
+ * Enter description here...
+ *
+ * @return array
+ */
+ public function getMediaAttributes()
+ {
+ return $this->getElement()->getDataObject()->getMediaAttributes();
+ }
+
+ public function getImageTypesJson()
+ {
+ return Mage::helper('Mage_Core_Helper_Data')->jsonEncode($this->getImageTypes());
+ }
+
+}
diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Helper/Form/Image.php b/app/code/Mage/Adminhtml/Block/Catalog/Product/Helper/Form/Image.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Catalog/Product/Helper/Form/Image.php
rename to app/code/Mage/Adminhtml/Block/Catalog/Product/Helper/Form/Image.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Helper/Form/Msrp/Enabled.php b/app/code/Mage/Adminhtml/Block/Catalog/Product/Helper/Form/Msrp/Enabled.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Catalog/Product/Helper/Form/Msrp/Enabled.php
rename to app/code/Mage/Adminhtml/Block/Catalog/Product/Helper/Form/Msrp/Enabled.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Helper/Form/Msrp/Price.php b/app/code/Mage/Adminhtml/Block/Catalog/Product/Helper/Form/Msrp/Price.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Catalog/Product/Helper/Form/Msrp/Price.php
rename to app/code/Mage/Adminhtml/Block/Catalog/Product/Helper/Form/Msrp/Price.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Helper/Form/Price.php b/app/code/Mage/Adminhtml/Block/Catalog/Product/Helper/Form/Price.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Catalog/Product/Helper/Form/Price.php
rename to app/code/Mage/Adminhtml/Block/Catalog/Product/Helper/Form/Price.php
diff --git a/app/code/Mage/Adminhtml/Block/Catalog/Product/Helper/Form/Weight.php b/app/code/Mage/Adminhtml/Block/Catalog/Product/Helper/Form/Weight.php
new file mode 100644
index 0000000000000..ce9e91d6efa3b
--- /dev/null
+++ b/app/code/Mage/Adminhtml/Block/Catalog/Product/Helper/Form/Weight.php
@@ -0,0 +1,95 @@
+
+ */
+class Mage_Adminhtml_Block_Catalog_Product_Helper_Form_Weight extends Varien_Data_Form_Element_Text
+{
+ const VIRTUAL_FIELD_HTML_ID = 'weight_and_type_switcher';
+
+ /**
+ * Is virtual checkbox element
+ *
+ * @var Varien_Data_Form_Element_Checkbox
+ */
+ protected $_virtual;
+
+ /**
+ * Catalog helper
+ *
+ * @var Mage_Catalog_Helper_Product
+ */
+ protected $_helper;
+
+ public function __construct(array $data = array())
+ {
+ $this->_helper = isset($data['helper']) ? $data['helper'] : Mage::helper('Mage_Catalog_Helper_Product');
+ $this->_virtual = isset($data['element'])
+ ? $data['element']
+ : Mage::getModel('Varien_Data_Form_Element_Checkbox');
+ $this->_virtual->setId(self::VIRTUAL_FIELD_HTML_ID)->setName('is_virtual')
+ ->setLabel($this->_helper->getTypeSwitcherControlLabel());
+ $data['class'] = 'validate-number validate-zero-or-greater validate-number-range number-range-0-99999999.9999';
+ parent::__construct($data);
+ }
+
+ /**
+ * Add Is Virtual checkbox html to weight field
+ *
+ * @return string
+ */
+ public function getElementHtml()
+ {
+ if (!$this->getForm()->getDataObject()->getTypeInstance()->hasWeight()) {
+ $this->_virtual->setChecked('checked');
+ }
+ return ''
+ . parent::getElementHtml()
+ . ''. Mage::helper('Mage_Adminhtml_Helper_Data')->__('lbs') .' '
+ . '
'
+ . $this->_virtual->getElementHtml() . $this->_virtual->getLabelHtml()
+ . '
';
+ }
+
+ /**
+ * Set form for both fields
+ *
+ * @param Varien_Data_Form $form
+ * @return Varien_Data_Form
+ */
+ public function setForm($form)
+ {
+ $this->_virtual->setForm($form);
+ return parent::setForm($form);
+ }
+}
diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Options/Ajax.php b/app/code/Mage/Adminhtml/Block/Catalog/Product/Options/Ajax.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Catalog/Product/Options/Ajax.php
rename to app/code/Mage/Adminhtml/Block/Catalog/Product/Options/Ajax.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Price.php b/app/code/Mage/Adminhtml/Block/Catalog/Product/Price.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Catalog/Product/Price.php
rename to app/code/Mage/Adminhtml/Block/Catalog/Product/Price.php
diff --git a/app/code/Mage/Adminhtml/Block/Catalog/Product/Widget/Chooser.php b/app/code/Mage/Adminhtml/Block/Catalog/Product/Widget/Chooser.php
new file mode 100644
index 0000000000000..9bcaaecc4d86c
--- /dev/null
+++ b/app/code/Mage/Adminhtml/Block/Catalog/Product/Widget/Chooser.php
@@ -0,0 +1,296 @@
+
+ */
+class Mage_Adminhtml_Block_Catalog_Product_Widget_Chooser extends Mage_Adminhtml_Block_Widget_Grid
+{
+ protected $_selectedProducts = array();
+
+ /**
+ * Block construction, prepare grid params
+ */
+ protected function _construct()
+ {
+ parent::_construct();
+ $this->setDefaultSort('name');
+ $this->setUseAjax(true);
+ }
+
+ /**
+ * Prepare chooser element HTML
+ *
+ * @param Varien_Data_Form_Element_Abstract $element Form Element
+ * @return Varien_Data_Form_Element_Abstract
+ */
+ public function prepareElementHtml(Varien_Data_Form_Element_Abstract $element)
+ {
+ $uniqId = Mage::helper('Mage_Core_Helper_Data')->uniqHash($element->getId());
+ $sourceUrl = $this->getUrl('*/catalog_product_widget/chooser', array(
+ 'uniq_id' => $uniqId,
+ 'use_massaction' => false,
+ ));
+
+ $chooser = $this->getLayout()->createBlock('Mage_Widget_Block_Adminhtml_Widget_Chooser')
+ ->setElement($element)
+ ->setTranslationHelper($this->getTranslationHelper())
+ ->setConfig($this->getConfig())
+ ->setFieldsetId($this->getFieldsetId())
+ ->setSourceUrl($sourceUrl)
+ ->setUniqId($uniqId);
+
+ if ($element->getValue()) {
+ $value = explode('/', $element->getValue());
+ $productId = false;
+ if (isset($value[0]) && isset($value[1]) && $value[0] == 'product') {
+ $productId = $value[1];
+ }
+ $categoryId = isset($value[2]) ? $value[2] : false;
+ $label = '';
+ if ($categoryId) {
+ $label = Mage::getResourceSingleton('Mage_Catalog_Model_Resource_Category')
+ ->getAttributeRawValue($categoryId, 'name', Mage::app()->getStore()) . '/';
+ }
+ if ($productId) {
+ $label .= Mage::getResourceSingleton('Mage_Catalog_Model_Resource_Product')
+ ->getAttributeRawValue($productId, 'name', Mage::app()->getStore());
+ }
+ $chooser->setLabel($label);
+ }
+
+ $element->setData('after_element_html', $chooser->toHtml());
+ return $element;
+ }
+
+ /**
+ * Checkbox Check JS Callback
+ *
+ * @return string
+ */
+ public function getCheckboxCheckCallback()
+ {
+ if ($this->getUseMassaction()) {
+ return "function (grid, element) {
+ $(grid.containerId).fire('product:changed', {element: element});
+ }";
+ }
+ }
+
+ /**
+ * Grid Row JS Callback
+ *
+ * @return string
+ */
+ public function getRowClickCallback()
+ {
+ if (!$this->getUseMassaction()) {
+ $chooserJsObject = $this->getId();
+ return '
+ function (grid, event) {
+ var trElement = Event.findElement(event, "tr");
+ var productId = trElement.down("td").innerHTML;
+ var productName = trElement.down("td").next().next().innerHTML;
+ var optionLabel = productName;
+ var optionValue = "product/" + productId.replace(/^\s+|\s+$/g,"");
+ if (grid.categoryId) {
+ optionValue += "/" + grid.categoryId;
+ }
+ if (grid.categoryName) {
+ optionLabel = grid.categoryName + " / " + optionLabel;
+ }
+ '.$chooserJsObject.'.setElementValue(optionValue);
+ '.$chooserJsObject.'.setElementLabel(optionLabel);
+ '.$chooserJsObject.'.close();
+ }
+ ';
+ }
+ }
+
+ /**
+ * Category Tree node onClick listener js function
+ *
+ * @return string
+ */
+ public function getCategoryClickListenerJs()
+ {
+ $js = '
+ function (node, e) {
+ {jsObject}.addVarToUrl("category_id", node.attributes.id);
+ {jsObject}.reload({jsObject}.url);
+ {jsObject}.categoryId = node.attributes.id != "none" ? node.attributes.id : false;
+ {jsObject}.categoryName = node.attributes.id != "none" ? node.text : false;
+ }
+ ';
+ $js = str_replace('{jsObject}', $this->getJsObjectName(), $js);
+ return $js;
+ }
+
+ /**
+ * Filter checked/unchecked rows in grid
+ *
+ * @param Mage_Adminhtml_Block_Widget_Grid_Column $column
+ * @return Mage_Adminhtml_Block_Catalog_Product_Widget_Chooser
+ */
+ protected function _addColumnFilterToCollection($column)
+ {
+ if ($column->getId() == 'in_products') {
+ $selected = $this->getSelectedProducts();
+ if ($column->getFilter()->getValue()) {
+ $this->getCollection()->addFieldToFilter('entity_id', array('in'=>$selected));
+ } else {
+ $this->getCollection()->addFieldToFilter('entity_id', array('nin'=>$selected));
+ }
+ } else {
+ parent::_addColumnFilterToCollection($column);
+ }
+ return $this;
+ }
+
+ /**
+ * Prepare products collection, defined collection filters (category, product type)
+ *
+ * @return Mage_Adminhtml_Block_Widget_Grid
+ */
+ protected function _prepareCollection()
+ {
+ /* @var $collection Mage_Catalog_Model_Resource_Product_Collection */
+ $collection = Mage::getResourceModel('Mage_Catalog_Model_Resource_Product_Collection')
+ ->setStoreId(0)
+ ->addAttributeToSelect('name');
+
+ if ($categoryId = $this->getCategoryId()) {
+ $category = Mage::getModel('Mage_Catalog_Model_Category')->load($categoryId);
+ if ($category->getId()) {
+ // $collection->addCategoryFilter($category);
+ $productIds = $category->getProductsPosition();
+ $productIds = array_keys($productIds);
+ if (empty($productIds)) {
+ $productIds = 0;
+ }
+ $collection->addFieldToFilter('entity_id', array('in' => $productIds));
+ }
+ }
+
+ if ($productTypeId = $this->getProductTypeId()) {
+ $collection->addAttributeToFilter('type_id', $productTypeId);
+ }
+
+ $this->setCollection($collection);
+ return parent::_prepareCollection();
+ }
+
+ /**
+ * Prepare columns for products grid
+ *
+ * @return Mage_Adminhtml_Block_Widget_Grid
+ */
+ protected function _prepareColumns()
+ {
+ if ($this->getUseMassaction()) {
+ $this->addColumn('in_products', array(
+ 'header_css_class' => 'a-center',
+ 'type' => 'checkbox',
+ 'name' => 'in_products',
+ 'inline_css' => 'checkbox entities',
+ 'field_name' => 'in_products',
+ 'values' => $this->getSelectedProducts(),
+ 'align' => 'center',
+ 'index' => 'entity_id',
+ 'use_index' => true,
+ ));
+ }
+
+ $this->addColumn('entity_id', array(
+ 'header' => Mage::helper('Mage_Catalog_Helper_Data')->__('ID'),
+ 'sortable' => true,
+ 'index' => 'entity_id',
+ 'header_css_class' => 'col-id',
+ 'column_css_class' => 'col-id'
+ ));
+ $this->addColumn('chooser_sku', array(
+ 'header' => Mage::helper('Mage_Catalog_Helper_Data')->__('SKU'),
+ 'name' => 'chooser_sku',
+ 'index' => 'sku',
+ 'header_css_class' => 'col-sku',
+ 'column_css_class' => 'col-sku'
+ ));
+ $this->addColumn('chooser_name', array(
+ 'header' => Mage::helper('Mage_Catalog_Helper_Data')->__('Product Name'),
+ 'name' => 'chooser_name',
+ 'index' => 'name',
+ 'header_css_class' => 'col-product',
+ 'column_css_class' => 'col-product'
+ ));
+
+ return parent::_prepareColumns();
+ }
+
+ /**
+ * Adds additional parameter to URL for loading only products grid
+ *
+ * @return string
+ */
+ public function getGridUrl()
+ {
+ return $this->getUrl('*/catalog_product_widget/chooser', array(
+ 'products_grid' => true,
+ '_current' => true,
+ 'uniq_id' => $this->getId(),
+ 'use_massaction' => $this->getUseMassaction(),
+ 'product_type_id' => $this->getProductTypeId()
+ ));
+ }
+
+ /**
+ * Setter
+ *
+ * @param array $selectedProducts
+ * @return Mage_Adminhtml_Block_Catalog_Product_Widget_Chooser
+ */
+ public function setSelectedProducts($selectedProducts)
+ {
+ $this->_selectedProducts = $selectedProducts;
+ return $this;
+ }
+
+ /**
+ * Getter
+ *
+ * @return array
+ */
+ public function getSelectedProducts()
+ {
+ if ($selectedProducts = $this->getRequest()->getParam('selected_products', null)) {
+ $this->setSelectedProducts($selectedProducts);
+ }
+ return $this->_selectedProducts;
+ }
+}
diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Widget/Chooser/Container.php b/app/code/Mage/Adminhtml/Block/Catalog/Product/Widget/Chooser/Container.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Catalog/Product/Widget/Chooser/Container.php
rename to app/code/Mage/Adminhtml/Block/Catalog/Product/Widget/Chooser/Container.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Search.php b/app/code/Mage/Adminhtml/Block/Catalog/Search.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Catalog/Search.php
rename to app/code/Mage/Adminhtml/Block/Catalog/Search.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Search/Edit.php b/app/code/Mage/Adminhtml/Block/Catalog/Search/Edit.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Catalog/Search/Edit.php
rename to app/code/Mage/Adminhtml/Block/Catalog/Search/Edit.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Search/Edit/Form.php b/app/code/Mage/Adminhtml/Block/Catalog/Search/Edit/Form.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Catalog/Search/Edit/Form.php
rename to app/code/Mage/Adminhtml/Block/Catalog/Search/Edit/Form.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Checkout/Agreement.php b/app/code/Mage/Adminhtml/Block/Checkout/Agreement.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Checkout/Agreement.php
rename to app/code/Mage/Adminhtml/Block/Checkout/Agreement.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Checkout/Agreement/Edit.php b/app/code/Mage/Adminhtml/Block/Checkout/Agreement/Edit.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Checkout/Agreement/Edit.php
rename to app/code/Mage/Adminhtml/Block/Checkout/Agreement/Edit.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Checkout/Agreement/Edit/Form.php b/app/code/Mage/Adminhtml/Block/Checkout/Agreement/Edit/Form.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Checkout/Agreement/Edit/Form.php
rename to app/code/Mage/Adminhtml/Block/Checkout/Agreement/Edit/Form.php
diff --git a/app/code/Mage/Adminhtml/Block/Checkout/Agreement/Grid.php b/app/code/Mage/Adminhtml/Block/Checkout/Agreement/Grid.php
new file mode 100644
index 0000000000000..cbc69d329b746
--- /dev/null
+++ b/app/code/Mage/Adminhtml/Block/Checkout/Agreement/Grid.php
@@ -0,0 +1,116 @@
+setDefaultSort('agreement_id');
+ $this->setId('agreementGrid');
+ $this->setDefaultDir('asc');
+ $this->setSaveParametersInSession(true);
+ }
+
+ protected function _prepareCollection()
+ {
+ $collection = Mage::getModel('Mage_Checkout_Model_Agreement')
+ ->getCollection();
+ $this->setCollection($collection);
+ return parent::_prepareCollection();
+ }
+
+ protected function _prepareColumns()
+ {
+ $this->addColumn('agreement_id',
+ array(
+ 'header'=>Mage::helper('Mage_Checkout_Helper_Data')->__('ID'),
+ 'index' => 'agreement_id',
+ 'header_css_class' => 'col-id',
+ 'column_css_class' => 'col-id'
+ )
+ );
+
+ $this->addColumn('name',
+ array(
+ 'header'=>Mage::helper('Mage_Checkout_Helper_Data')->__('Condition Name'),
+ 'index' => 'name',
+ 'header_css_class' => 'col-name',
+ 'column_css_class' => 'col-name'
+ )
+ );
+
+ if (!Mage::app()->isSingleStoreMode()) {
+ $this->addColumn('store_id', array(
+ 'header' => Mage::helper('Mage_Adminhtml_Helper_Data')->__('Store View'),
+ 'index' => 'store_id',
+ 'type' => 'store',
+ 'store_all' => true,
+ 'store_view' => true,
+ 'sortable' => false,
+ 'filter_condition_callback'
+ => array($this, '_filterStoreCondition'),
+ 'header_css_class' => 'col-store-view',
+ 'column_css_class' => 'col-store-view'
+ ));
+ }
+
+ $this->addColumn('is_active', array(
+ 'header' => Mage::helper('Mage_Adminhtml_Helper_Data')->__('Status'),
+ 'index' => 'is_active',
+ 'type' => 'options',
+ 'options' => array(
+ 0 => Mage::helper('Mage_Adminhtml_Helper_Data')->__('Disabled'),
+ 1 => Mage::helper('Mage_Adminhtml_Helper_Data')->__('Enabled')
+ ),
+ 'header_css_class' => 'col-status',
+ 'column_css_class' => 'col-status'
+ ));
+
+ return parent::_prepareColumns();
+ }
+
+ protected function _afterLoadCollection()
+ {
+ $this->getCollection()->walk('afterLoad');
+ parent::_afterLoadCollection();
+ }
+
+ protected function _filterStoreCondition($collection, $column)
+ {
+ if (!$value = $column->getFilter()->getValue()) {
+ return;
+ }
+
+ $this->getCollection()->addStoreFilter($value);
+ }
+
+ public function getRowUrl($row)
+ {
+ return $this->getUrl('*/*/edit', array('id' => $row->getId()));
+ }
+
+}
diff --git a/app/code/core/Mage/Adminhtml/Block/Cms/Block.php b/app/code/Mage/Adminhtml/Block/Cms/Block.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Cms/Block.php
rename to app/code/Mage/Adminhtml/Block/Cms/Block.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Cms/Block/Edit.php b/app/code/Mage/Adminhtml/Block/Cms/Block/Edit.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Cms/Block/Edit.php
rename to app/code/Mage/Adminhtml/Block/Cms/Block/Edit.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Cms/Block/Edit/Form.php b/app/code/Mage/Adminhtml/Block/Cms/Block/Edit/Form.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Cms/Block/Edit/Form.php
rename to app/code/Mage/Adminhtml/Block/Cms/Block/Edit/Form.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Cms/Block/Grid.php b/app/code/Mage/Adminhtml/Block/Cms/Block/Grid.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Cms/Block/Grid.php
rename to app/code/Mage/Adminhtml/Block/Cms/Block/Grid.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Cms/Block/Widget/Chooser.php b/app/code/Mage/Adminhtml/Block/Cms/Block/Widget/Chooser.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Cms/Block/Widget/Chooser.php
rename to app/code/Mage/Adminhtml/Block/Cms/Block/Widget/Chooser.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Cms/Page.php b/app/code/Mage/Adminhtml/Block/Cms/Page.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Cms/Page.php
rename to app/code/Mage/Adminhtml/Block/Cms/Page.php
diff --git a/app/code/Mage/Adminhtml/Block/Cms/Page/Edit.php b/app/code/Mage/Adminhtml/Block/Cms/Page/Edit.php
new file mode 100644
index 0000000000000..661863f9e0000
--- /dev/null
+++ b/app/code/Mage/Adminhtml/Block/Cms/Page/Edit.php
@@ -0,0 +1,155 @@
+
+ */
+class Mage_Adminhtml_Block_Cms_Page_Edit extends Mage_Adminhtml_Block_Widget_Form_Container
+{
+ /**
+ * Initialize cms page edit block
+ *
+ * @return void
+ */
+ protected function _construct()
+ {
+ $this->_objectId = 'page_id';
+ $this->_controller = 'cms_page';
+
+ parent::_construct();
+
+ if ($this->_isAllowedAction('Mage_Cms::save')) {
+ $this->_updateButton('save', 'label', Mage::helper('Mage_Cms_Helper_Data')->__('Save Page'));
+ $this->_addButton('saveandcontinue', array(
+ 'label' => Mage::helper('Mage_Adminhtml_Helper_Data')->__('Save and Continue Edit'),
+ 'class' => 'save',
+ 'data_attribute' => array(
+ 'mage-init' => array(
+ 'button' => array('event' => 'saveAndContinueEdit', 'target' => '#edit_form'),
+ ),
+ ),
+ ), -100);
+ } else {
+ $this->_removeButton('save');
+ }
+
+ if ($this->_isAllowedAction('Mage_Cms::page_delete')) {
+ $this->_updateButton('delete', 'label', Mage::helper('Mage_Cms_Helper_Data')->__('Delete Page'));
+ } else {
+ $this->_removeButton('delete');
+ }
+ }
+
+ /**
+ * Retrieve text for header element depending on loaded page
+ *
+ * @return string
+ */
+ public function getHeaderText()
+ {
+ if (Mage::registry('cms_page')->getId()) {
+ return Mage::helper('Mage_Cms_Helper_Data')->__("Edit Page '%s'", $this->escapeHtml(Mage::registry('cms_page')->getTitle()));
+ }
+ else {
+ return Mage::helper('Mage_Cms_Helper_Data')->__('New Page');
+ }
+ }
+
+ /**
+ * Check permission for passed action
+ *
+ * @param string $resourceId
+ * @return bool
+ */
+ protected function _isAllowedAction($resourceId)
+ {
+ return Mage::getSingleton('Mage_Core_Model_Authorization')->isAllowed($resourceId);
+ }
+
+ /**
+ * Getter of url for "Save and Continue" button
+ * tab_id will be replaced by desired by JS later
+ *
+ * @return string
+ */
+ protected function _getSaveAndContinueUrl()
+ {
+ return $this->getUrl('*/*/save', array(
+ '_current' => true,
+ 'back' => 'edit',
+ 'active_tab' => '{{tab_id}}'
+ ));
+ }
+
+ /**
+ * Prepare layout
+ *
+ * @return Mage_Core_Block_Abstract
+ */
+ protected function _prepareLayout()
+ {
+ $tabsBlock = $this->getLayout()->getBlock('cms_page_edit_tabs');
+ if ($tabsBlock) {
+ $tabsBlockJsObject = $tabsBlock->getJsObjectName();
+ $tabsBlockPrefix = $tabsBlock->getId() . '_';
+ } else {
+ $tabsBlockJsObject = 'page_tabsJsTabs';
+ $tabsBlockPrefix = 'page_tabs_';
+ }
+
+ $this->_formScripts[] = "
+ function toggleEditor() {
+ if (tinyMCE.getInstanceById('page_content') == null) {
+ tinyMCE.execCommand('mceAddControl', false, 'page_content');
+ } else {
+ tinyMCE.execCommand('mceRemoveControl', false, 'page_content');
+ }
+ }
+ (function($) {
+ 'use strict';
+
+ head.js('{$this->getViewFileUrl('mage/backend/tabs.js')}', function() {
+ $(\"#{$tabsBlock->getId()}\")
+ .tabs('option', 'tabsBlockPrefix', '" . $tabsBlockPrefix . "')
+ .tabs('option', 'tabIdArgument', 'active_tab');
+ });
+ })(jQuery);
+ jQuery(function() {
+ var tabsElement = jQuery(\"#" . $tabsBlock->getId() ."\");
+ tabsElement.on('tabscreate', function() {
+ tabsElement
+ .tabs('option', 'tabsBlockPrefix', '" . $tabsBlockPrefix . "')
+ .tabs('option', 'tabIdArgument', 'active_tab');
+ });
+ });
+ ";
+ return parent::_prepareLayout();
+ }
+}
diff --git a/app/code/core/Mage/Adminhtml/Block/Cms/Page/Edit/Form.php b/app/code/Mage/Adminhtml/Block/Cms/Page/Edit/Form.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Cms/Page/Edit/Form.php
rename to app/code/Mage/Adminhtml/Block/Cms/Page/Edit/Form.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Cms/Page/Edit/Tab/Content.php b/app/code/Mage/Adminhtml/Block/Cms/Page/Edit/Tab/Content.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Cms/Page/Edit/Tab/Content.php
rename to app/code/Mage/Adminhtml/Block/Cms/Page/Edit/Tab/Content.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Cms/Page/Edit/Tab/Design.php b/app/code/Mage/Adminhtml/Block/Cms/Page/Edit/Tab/Design.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Cms/Page/Edit/Tab/Design.php
rename to app/code/Mage/Adminhtml/Block/Cms/Page/Edit/Tab/Design.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Cms/Page/Edit/Tab/Main.php b/app/code/Mage/Adminhtml/Block/Cms/Page/Edit/Tab/Main.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Cms/Page/Edit/Tab/Main.php
rename to app/code/Mage/Adminhtml/Block/Cms/Page/Edit/Tab/Main.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Cms/Page/Edit/Tab/Meta.php b/app/code/Mage/Adminhtml/Block/Cms/Page/Edit/Tab/Meta.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Cms/Page/Edit/Tab/Meta.php
rename to app/code/Mage/Adminhtml/Block/Cms/Page/Edit/Tab/Meta.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Cms/Page/Edit/Tabs.php b/app/code/Mage/Adminhtml/Block/Cms/Page/Edit/Tabs.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Cms/Page/Edit/Tabs.php
rename to app/code/Mage/Adminhtml/Block/Cms/Page/Edit/Tabs.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Cms/Page/Grid.php b/app/code/Mage/Adminhtml/Block/Cms/Page/Grid.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Cms/Page/Grid.php
rename to app/code/Mage/Adminhtml/Block/Cms/Page/Grid.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Cms/Page/Grid/Renderer/Action.php b/app/code/Mage/Adminhtml/Block/Cms/Page/Grid/Renderer/Action.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Cms/Page/Grid/Renderer/Action.php
rename to app/code/Mage/Adminhtml/Block/Cms/Page/Grid/Renderer/Action.php
diff --git a/app/code/Mage/Adminhtml/Block/Cms/Page/Widget/Chooser.php b/app/code/Mage/Adminhtml/Block/Cms/Page/Widget/Chooser.php
new file mode 100644
index 0000000000000..c73a441175cfc
--- /dev/null
+++ b/app/code/Mage/Adminhtml/Block/Cms/Page/Widget/Chooser.php
@@ -0,0 +1,169 @@
+
+ */
+class Mage_Adminhtml_Block_Cms_Page_Widget_Chooser extends Mage_Adminhtml_Block_Widget_Grid
+{
+ /**
+ * Block construction, prepare grid params
+ *
+ * @param array $arguments Object data
+ */
+ protected function _construct()
+ {
+ parent::_construct();
+ //$this->setDefaultSort('name');
+ $this->setUseAjax(true);
+ $this->setDefaultFilter(array('chooser_is_active' => '1'));
+ }
+
+ /**
+ * Prepare chooser element HTML
+ *
+ * @param Varien_Data_Form_Element_Abstract $element Form Element
+ * @return Varien_Data_Form_Element_Abstract
+ */
+ public function prepareElementHtml(Varien_Data_Form_Element_Abstract $element)
+ {
+ $uniqId = Mage::helper('Mage_Core_Helper_Data')->uniqHash($element->getId());
+ $sourceUrl = $this->getUrl('*/cms_page_widget/chooser', array('uniq_id' => $uniqId));
+
+ $chooser = $this->getLayout()->createBlock('Mage_Widget_Block_Adminhtml_Widget_Chooser')
+ ->setElement($element)
+ ->setTranslationHelper($this->getTranslationHelper())
+ ->setConfig($this->getConfig())
+ ->setFieldsetId($this->getFieldsetId())
+ ->setSourceUrl($sourceUrl)
+ ->setUniqId($uniqId);
+
+
+ if ($element->getValue()) {
+ $page = Mage::getModel('Mage_Cms_Model_Page')->load((int)$element->getValue());
+ if ($page->getId()) {
+ $chooser->setLabel($page->getTitle());
+ }
+ }
+
+ $element->setData('after_element_html', $chooser->toHtml());
+ return $element;
+ }
+
+ /**
+ * Grid Row JS Callback
+ *
+ * @return string
+ */
+ public function getRowClickCallback()
+ {
+ $chooserJsObject = $this->getId();
+ $js = '
+ function (grid, event) {
+ var trElement = Event.findElement(event, "tr");
+ var pageTitle = trElement.down("td").next().innerHTML;
+ var pageId = trElement.down("td").innerHTML.replace(/^\s+|\s+$/g,"");
+ '.$chooserJsObject.'.setElementValue(pageId);
+ '.$chooserJsObject.'.setElementLabel(pageTitle);
+ '.$chooserJsObject.'.close();
+ }
+ ';
+ return $js;
+ }
+
+ /**
+ * Prepare pages collection
+ *
+ * @return Mage_Adminhtml_Block_Widget_Grid
+ */
+ protected function _prepareCollection()
+ {
+ $collection = Mage::getModel('Mage_Cms_Model_Page')->getCollection();
+ /* @var $collection Mage_Cms_Model_Resource_Page_Collection */
+ $collection->setFirstStoreFlag(true);
+ $this->setCollection($collection);
+
+ return parent::_prepareCollection();
+ }
+
+ /**
+ * Prepare columns for pages grid
+ *
+ * @return Mage_Adminhtml_Block_Widget_Grid
+ */
+ protected function _prepareColumns()
+ {
+ $this->addColumn('chooser_id', array(
+ 'header' => Mage::helper('Mage_Cms_Helper_Data')->__('ID'),
+ 'index' => 'page_id',
+ 'header_css_class' => 'col-id',
+ 'column_css_class' => 'col-id'
+ ));
+
+ $this->addColumn('chooser_title', array(
+ 'header' => Mage::helper('Mage_Cms_Helper_Data')->__('Title'),
+ 'index' => 'title',
+ 'header_css_class' => 'col-title',
+ 'column_css_class' => 'col-title'
+ ));
+
+ $this->addColumn('chooser_identifier', array(
+ 'header' => Mage::helper('Mage_Cms_Helper_Data')->__('URL Key'),
+ 'index' => 'identifier',
+ 'header_css_class' => 'col-url',
+ 'column_css_class' => 'col-url'
+ ));
+
+ $this->addColumn('chooser_root_template', array(
+ 'header' => Mage::helper('Mage_Cms_Helper_Data')->__('Layout'),
+ 'index' => 'root_template',
+ 'type' => 'options',
+ 'options' => Mage::getSingleton('Mage_Page_Model_Source_Layout')->getOptions(),
+ 'header_css_class' => 'col-layout',
+ 'column_css_class' => 'col-layout'
+ ));
+
+ $this->addColumn('chooser_is_active', array(
+ 'header' => Mage::helper('Mage_Cms_Helper_Data')->__('Status'),
+ 'index' => 'is_active',
+ 'type' => 'options',
+ 'options' => Mage::getModel('Mage_Cms_Model_Page')->getAvailableStatuses(),
+ 'header_css_class' => 'col-status',
+ 'column_css_class' => 'col-status'
+ ));
+
+ return parent::_prepareColumns();
+ }
+
+ public function getGridUrl()
+ {
+ return $this->getUrl('*/cms_page_widget/chooser', array('_current' => true));
+ }
+}
diff --git a/app/code/Mage/Adminhtml/Block/Cms/Wysiwyg/Images/Content.php b/app/code/Mage/Adminhtml/Block/Cms/Wysiwyg/Images/Content.php
new file mode 100644
index 0000000000000..9f6109d1a463e
--- /dev/null
+++ b/app/code/Mage/Adminhtml/Block/Cms/Wysiwyg/Images/Content.php
@@ -0,0 +1,161 @@
+
+ */
+class Mage_Adminhtml_Block_Cms_Wysiwyg_Images_Content extends Mage_Adminhtml_Block_Widget_Container
+{
+ /**
+ * Block construction
+ */
+ protected function _construct()
+ {
+ parent::_construct();
+ $this->_headerText = $this->helper('Mage_Cms_Helper_Data')->__('Media Storage');
+ $this->_removeButton('back')->_removeButton('edit');
+ $this->_addButton('newfolder', array(
+ 'class' => 'save',
+ 'label' => $this->helper('Mage_Cms_Helper_Data')->__('Create Folder...'),
+ 'type' => 'button',
+ 'onclick' => 'MediabrowserInstance.newFolder();'
+ ));
+
+ $this->_addButton('delete_folder', array(
+ 'class' => 'delete no-display',
+ 'label' => $this->helper('Mage_Cms_Helper_Data')->__('Delete Folder'),
+ 'type' => 'button',
+ 'onclick' => 'MediabrowserInstance.deleteFolder();',
+ 'id' => 'button_delete_folder'
+ ));
+
+ $this->_addButton('delete_files', array(
+ 'class' => 'delete no-display',
+ 'label' => $this->helper('Mage_Cms_Helper_Data')->__('Delete File'),
+ 'type' => 'button',
+ 'onclick' => 'MediabrowserInstance.deleteFiles();',
+ 'id' => 'button_delete_files'
+ ));
+
+ $this->_addButton('insert_files', array(
+ 'class' => 'save no-display primary',
+ 'label' => $this->helper('Mage_Cms_Helper_Data')->__('Insert File'),
+ 'type' => 'button',
+ 'onclick' => 'MediabrowserInstance.insert();',
+ 'id' => 'button_insert_files'
+ ));
+ }
+
+ /**
+ * Files action source URL
+ *
+ * @return string
+ */
+ public function getContentsUrl()
+ {
+ return $this->getUrl('*/*/contents', array('type' => $this->getRequest()->getParam('type')));
+ }
+
+ /**
+ * Javascript setup object for filebrowser instance
+ *
+ * @return string
+ */
+ public function getFilebrowserSetupObject()
+ {
+ $setupObject = new Varien_Object();
+
+ $setupObject->setData(array(
+ 'newFolderPrompt' => $this->helper('Mage_Cms_Helper_Data')->__('New Folder Name:'),
+ 'deleteFolderConfirmationMessage' => $this->helper('Mage_Cms_Helper_Data')->__('Are you sure you want to delete current folder?'),
+ 'deleteFileConfirmationMessage' => $this->helper('Mage_Cms_Helper_Data')->__('Are you sure you want to delete the selected file?'),
+ 'targetElementId' => $this->getTargetElementId(),
+ 'contentsUrl' => $this->getContentsUrl(),
+ 'onInsertUrl' => $this->getOnInsertUrl(),
+ 'newFolderUrl' => $this->getNewfolderUrl(),
+ 'deleteFolderUrl' => $this->getDeletefolderUrl(),
+ 'deleteFilesUrl' => $this->getDeleteFilesUrl(),
+ 'headerText' => $this->getHeaderText()
+ ));
+
+ return Mage::helper('Mage_Core_Helper_Data')->jsonEncode($setupObject);
+ }
+
+ /**
+ * New directory action target URL
+ *
+ * @return string
+ */
+ public function getNewfolderUrl()
+ {
+ return $this->getUrl('*/*/newFolder');
+ }
+
+ /**
+ * Delete directory action target URL
+ *
+ * @return string
+ */
+ protected function getDeletefolderUrl()
+ {
+ return $this->getUrl('*/*/deleteFolder');
+ }
+
+ /**
+ * Description goes here...
+ *
+ * @param none
+ * @return void
+ */
+ public function getDeleteFilesUrl()
+ {
+ return $this->getUrl('*/*/deleteFiles');
+ }
+
+ /**
+ * New directory action target URL
+ *
+ * @return string
+ */
+ public function getOnInsertUrl()
+ {
+ return $this->getUrl('*/*/onInsert');
+ }
+
+ /**
+ * Target element ID getter
+ *
+ * @return string
+ */
+ public function getTargetElementId()
+ {
+ return $this->getRequest()->getParam('target_element_id');
+ }
+}
diff --git a/app/code/core/Mage/Adminhtml/Block/Cms/Wysiwyg/Images/Content/Files.php b/app/code/Mage/Adminhtml/Block/Cms/Wysiwyg/Images/Content/Files.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Cms/Wysiwyg/Images/Content/Files.php
rename to app/code/Mage/Adminhtml/Block/Cms/Wysiwyg/Images/Content/Files.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Cms/Wysiwyg/Images/Content/Newfolder.php b/app/code/Mage/Adminhtml/Block/Cms/Wysiwyg/Images/Content/Newfolder.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Cms/Wysiwyg/Images/Content/Newfolder.php
rename to app/code/Mage/Adminhtml/Block/Cms/Wysiwyg/Images/Content/Newfolder.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Cms/Wysiwyg/Images/Content/Uploader.php b/app/code/Mage/Adminhtml/Block/Cms/Wysiwyg/Images/Content/Uploader.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Cms/Wysiwyg/Images/Content/Uploader.php
rename to app/code/Mage/Adminhtml/Block/Cms/Wysiwyg/Images/Content/Uploader.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Cms/Wysiwyg/Images/Tree.php b/app/code/Mage/Adminhtml/Block/Cms/Wysiwyg/Images/Tree.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Cms/Wysiwyg/Images/Tree.php
rename to app/code/Mage/Adminhtml/Block/Cms/Wysiwyg/Images/Tree.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Customer.php b/app/code/Mage/Adminhtml/Block/Customer.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Customer.php
rename to app/code/Mage/Adminhtml/Block/Customer.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Customer/Edit.php b/app/code/Mage/Adminhtml/Block/Customer/Edit.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Customer/Edit.php
rename to app/code/Mage/Adminhtml/Block/Customer/Edit.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Customer/Edit/Form.php b/app/code/Mage/Adminhtml/Block/Customer/Edit/Form.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Customer/Edit/Form.php
rename to app/code/Mage/Adminhtml/Block/Customer/Edit/Form.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Customer/Edit/Renderer/Attribute/Group.php b/app/code/Mage/Adminhtml/Block/Customer/Edit/Renderer/Attribute/Group.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Customer/Edit/Renderer/Attribute/Group.php
rename to app/code/Mage/Adminhtml/Block/Customer/Edit/Renderer/Attribute/Group.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Customer/Edit/Renderer/Newpass.php b/app/code/Mage/Adminhtml/Block/Customer/Edit/Renderer/Newpass.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Customer/Edit/Renderer/Newpass.php
rename to app/code/Mage/Adminhtml/Block/Customer/Edit/Renderer/Newpass.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Customer/Edit/Renderer/Region.php b/app/code/Mage/Adminhtml/Block/Customer/Edit/Renderer/Region.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Customer/Edit/Renderer/Region.php
rename to app/code/Mage/Adminhtml/Block/Customer/Edit/Renderer/Region.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Customer/Edit/Tab/Account.php b/app/code/Mage/Adminhtml/Block/Customer/Edit/Tab/Account.php
similarity index 98%
rename from app/code/core/Mage/Adminhtml/Block/Customer/Edit/Tab/Account.php
rename to app/code/Mage/Adminhtml/Block/Customer/Edit/Tab/Account.php
index e7d1dc2e46dff..54111b9169c58 100644
--- a/app/code/core/Mage/Adminhtml/Block/Customer/Edit/Tab/Account.php
+++ b/app/code/Mage/Adminhtml/Block/Customer/Edit/Tab/Account.php
@@ -250,15 +250,13 @@ protected function _addNewCustomerFormFields($form, $fieldset)
''
diff --git a/app/code/core/Mage/Adminhtml/Block/Customer/Edit/Tab/Addresses.php b/app/code/Mage/Adminhtml/Block/Customer/Edit/Tab/Addresses.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Customer/Edit/Tab/Addresses.php
rename to app/code/Mage/Adminhtml/Block/Customer/Edit/Tab/Addresses.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Customer/Edit/Tab/Cart.php b/app/code/Mage/Adminhtml/Block/Customer/Edit/Tab/Cart.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Customer/Edit/Tab/Cart.php
rename to app/code/Mage/Adminhtml/Block/Customer/Edit/Tab/Cart.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Customer/Edit/Tab/Carts.php b/app/code/Mage/Adminhtml/Block/Customer/Edit/Tab/Carts.php
similarity index 96%
rename from app/code/core/Mage/Adminhtml/Block/Customer/Edit/Tab/Carts.php
rename to app/code/Mage/Adminhtml/Block/Customer/Edit/Tab/Carts.php
index d7ca61cbb6c59..dfe4758de717c 100644
--- a/app/code/core/Mage/Adminhtml/Block/Customer/Edit/Tab/Carts.php
+++ b/app/code/Mage/Adminhtml/Block/Customer/Edit/Tab/Carts.php
@@ -42,7 +42,7 @@ protected function _prepareLayout()
foreach ($sharedWebsiteIds as $websiteId) {
$blockName = 'customer_cart_' . $websiteId;
$block = $this->getLayout()->createBlock('Mage_Adminhtml_Block_Customer_Edit_Tab_Cart',
- $blockName, array('website_id' => $websiteId));
+ $blockName, array('data' => array('website_id' => $websiteId)));
if ($isShared) {
$block->setCartHeader($this->__('Shopping Cart from %s', Mage::app()->getWebsite($websiteId)->getName()));
}
diff --git a/app/code/core/Mage/Adminhtml/Block/Customer/Edit/Tab/Newsletter.php b/app/code/Mage/Adminhtml/Block/Customer/Edit/Tab/Newsletter.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Customer/Edit/Tab/Newsletter.php
rename to app/code/Mage/Adminhtml/Block/Customer/Edit/Tab/Newsletter.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Customer/Edit/Tab/Newsletter/Grid.php b/app/code/Mage/Adminhtml/Block/Customer/Edit/Tab/Newsletter/Grid.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Customer/Edit/Tab/Newsletter/Grid.php
rename to app/code/Mage/Adminhtml/Block/Customer/Edit/Tab/Newsletter/Grid.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Customer/Edit/Tab/Newsletter/Grid/Filter/Status.php b/app/code/Mage/Adminhtml/Block/Customer/Edit/Tab/Newsletter/Grid/Filter/Status.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Customer/Edit/Tab/Newsletter/Grid/Filter/Status.php
rename to app/code/Mage/Adminhtml/Block/Customer/Edit/Tab/Newsletter/Grid/Filter/Status.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Customer/Edit/Tab/Newsletter/Grid/Renderer/Action.php b/app/code/Mage/Adminhtml/Block/Customer/Edit/Tab/Newsletter/Grid/Renderer/Action.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Customer/Edit/Tab/Newsletter/Grid/Renderer/Action.php
rename to app/code/Mage/Adminhtml/Block/Customer/Edit/Tab/Newsletter/Grid/Renderer/Action.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Customer/Edit/Tab/Newsletter/Grid/Renderer/Status.php b/app/code/Mage/Adminhtml/Block/Customer/Edit/Tab/Newsletter/Grid/Renderer/Status.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Customer/Edit/Tab/Newsletter/Grid/Renderer/Status.php
rename to app/code/Mage/Adminhtml/Block/Customer/Edit/Tab/Newsletter/Grid/Renderer/Status.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Customer/Edit/Tab/Orders.php b/app/code/Mage/Adminhtml/Block/Customer/Edit/Tab/Orders.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Customer/Edit/Tab/Orders.php
rename to app/code/Mage/Adminhtml/Block/Customer/Edit/Tab/Orders.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Customer/Edit/Tab/Reviews.php b/app/code/Mage/Adminhtml/Block/Customer/Edit/Tab/Reviews.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Customer/Edit/Tab/Reviews.php
rename to app/code/Mage/Adminhtml/Block/Customer/Edit/Tab/Reviews.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Customer/Edit/Tab/View.php b/app/code/Mage/Adminhtml/Block/Customer/Edit/Tab/View.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Customer/Edit/Tab/View.php
rename to app/code/Mage/Adminhtml/Block/Customer/Edit/Tab/View.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Customer/Edit/Tab/View/Accordion.php b/app/code/Mage/Adminhtml/Block/Customer/Edit/Tab/View/Accordion.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Customer/Edit/Tab/View/Accordion.php
rename to app/code/Mage/Adminhtml/Block/Customer/Edit/Tab/View/Accordion.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Customer/Edit/Tab/View/Cart.php b/app/code/Mage/Adminhtml/Block/Customer/Edit/Tab/View/Cart.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Customer/Edit/Tab/View/Cart.php
rename to app/code/Mage/Adminhtml/Block/Customer/Edit/Tab/View/Cart.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Customer/Edit/Tab/View/Grid/Renderer/Item.php b/app/code/Mage/Adminhtml/Block/Customer/Edit/Tab/View/Grid/Renderer/Item.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Customer/Edit/Tab/View/Grid/Renderer/Item.php
rename to app/code/Mage/Adminhtml/Block/Customer/Edit/Tab/View/Grid/Renderer/Item.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Customer/Edit/Tab/View/Orders.php b/app/code/Mage/Adminhtml/Block/Customer/Edit/Tab/View/Orders.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Customer/Edit/Tab/View/Orders.php
rename to app/code/Mage/Adminhtml/Block/Customer/Edit/Tab/View/Orders.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Customer/Edit/Tab/View/Sales.php b/app/code/Mage/Adminhtml/Block/Customer/Edit/Tab/View/Sales.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Customer/Edit/Tab/View/Sales.php
rename to app/code/Mage/Adminhtml/Block/Customer/Edit/Tab/View/Sales.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Customer/Edit/Tab/View/Wishlist.php b/app/code/Mage/Adminhtml/Block/Customer/Edit/Tab/View/Wishlist.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Customer/Edit/Tab/View/Wishlist.php
rename to app/code/Mage/Adminhtml/Block/Customer/Edit/Tab/View/Wishlist.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Customer/Edit/Tab/Wishlist/Grid/Renderer/Description.php b/app/code/Mage/Adminhtml/Block/Customer/Edit/Tab/Wishlist/Grid/Renderer/Description.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Customer/Edit/Tab/Wishlist/Grid/Renderer/Description.php
rename to app/code/Mage/Adminhtml/Block/Customer/Edit/Tab/Wishlist/Grid/Renderer/Description.php
diff --git a/app/code/Mage/Adminhtml/Block/Customer/Edit/Tabs.php b/app/code/Mage/Adminhtml/Block/Customer/Edit/Tabs.php
new file mode 100644
index 0000000000000..865a567f8eaa7
--- /dev/null
+++ b/app/code/Mage/Adminhtml/Block/Customer/Edit/Tabs.php
@@ -0,0 +1,129 @@
+
+ */
+class Mage_Adminhtml_Block_Customer_Edit_Tabs extends Mage_Adminhtml_Block_Widget_Tabs
+{
+
+ protected function _construct()
+ {
+ parent::_construct();
+ $this->setId('customer_info_tabs');
+ $this->setDestElementId('edit_form');
+ $this->setTitle(Mage::helper('Mage_Customer_Helper_Data')->__('Customer Information'));
+ }
+
+ protected function _beforeToHtml()
+ {
+ Magento_Profiler::start('customer/tabs');
+
+ /*
+ if (Mage::registry('current_customer')->getId()) {
+ $this->addTab('view', array(
+ 'label' => Mage::helper('Mage_Customer_Helper_Data')->__('Customer View'),
+ 'content' => $this->getLayout()
+ ->createBlock('Mage_Adminhtml_Block_Customer_Edit_Tab_View')->toHtml(),
+ 'active' => true
+ ));
+ }
+ */
+ $this->addTab('account', array(
+ 'label' => Mage::helper('Mage_Customer_Helper_Data')->__('Account Information'),
+ 'content' => $this->getLayout()
+ ->createBlock('Mage_Adminhtml_Block_Customer_Edit_Tab_Account')->initForm()->toHtml(),
+ 'active' => Mage::registry('current_customer')->getId() ? false : true
+ ));
+
+ $this->addTab('addresses', array(
+ 'label' => Mage::helper('Mage_Customer_Helper_Data')->__('Addresses'),
+ 'content' => $this->getLayout()
+ ->createBlock('Mage_Adminhtml_Block_Customer_Edit_Tab_Addresses')->initForm()->toHtml(),
+ ));
+
+
+ // load: Orders, Shopping Cart, Wishlist, Product Reviews, Product Tags - with ajax
+
+ if (Mage::registry('current_customer')->getId()) {
+
+ if (Mage::getSingleton('Mage_Core_Model_Authorization')->isAllowed('Mage_Sales::actions_view')) {
+ $this->addTab('orders', array(
+ 'label' => Mage::helper('Mage_Customer_Helper_Data')->__('Orders'),
+ 'class' => 'ajax',
+ 'url' => $this->getUrl('*/*/orders', array('_current' => true)),
+ ));
+ }
+
+ $this->addTab('cart', array(
+ 'label' => Mage::helper('Mage_Customer_Helper_Data')->__('Shopping Cart'),
+ 'class' => 'ajax',
+ 'url' => $this->getUrl('*/*/carts', array('_current' => true)),
+ ));
+
+ $this->addTab('wishlist', array(
+ 'label' => Mage::helper('Mage_Customer_Helper_Data')->__('Wishlist'),
+ 'class' => 'ajax',
+ 'url' => $this->getUrl('*/*/wishlist', array('_current' => true)),
+ ));
+
+ if (Mage::getSingleton('Mage_Core_Model_Authorization')->isAllowed('Mage_Newsletter::subscriber')) {
+ $this->addTab('newsletter', array(
+ 'label' => Mage::helper('Mage_Customer_Helper_Data')->__('Newsletter'),
+ 'content' => $this->getLayout()
+ ->createBlock('Mage_Adminhtml_Block_Customer_Edit_Tab_Newsletter')->initForm()->toHtml()
+ ));
+ }
+
+ if (Mage::getSingleton('Mage_Core_Model_Authorization')->isAllowed('Mage_Review::reviews_all')) {
+ $this->addTab('reviews', array(
+ 'label' => Mage::helper('Mage_Customer_Helper_Data')->__('Product Reviews'),
+ 'class' => 'ajax',
+ 'url' => $this->getUrl('*/*/productReviews', array('_current' => true)),
+ ));
+ }
+ }
+
+ $this->_updateActiveTab();
+ Magento_Profiler::stop('customer/tabs');
+ return parent::_beforeToHtml();
+ }
+
+ protected function _updateActiveTab()
+ {
+ $tabId = $this->getRequest()->getParam('tab');
+ if ($tabId) {
+ $tabId = preg_replace("#{$this->getId()}_#", '', $tabId);
+ if ($tabId) {
+ $this->setActiveTab($tabId);
+ }
+ }
+ }
+}
diff --git a/app/code/core/Mage/Adminhtml/Block/Customer/Form/Element/Boolean.php b/app/code/Mage/Adminhtml/Block/Customer/Form/Element/Boolean.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Customer/Form/Element/Boolean.php
rename to app/code/Mage/Adminhtml/Block/Customer/Form/Element/Boolean.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Customer/Form/Element/File.php b/app/code/Mage/Adminhtml/Block/Customer/Form/Element/File.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Customer/Form/Element/File.php
rename to app/code/Mage/Adminhtml/Block/Customer/Form/Element/File.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Customer/Form/Element/Image.php b/app/code/Mage/Adminhtml/Block/Customer/Form/Element/Image.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Customer/Form/Element/Image.php
rename to app/code/Mage/Adminhtml/Block/Customer/Form/Element/Image.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Customer/Grid.php b/app/code/Mage/Adminhtml/Block/Customer/Grid.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Customer/Grid.php
rename to app/code/Mage/Adminhtml/Block/Customer/Grid.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Customer/Grid/Filter/Country.php b/app/code/Mage/Adminhtml/Block/Customer/Grid/Filter/Country.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Customer/Grid/Filter/Country.php
rename to app/code/Mage/Adminhtml/Block/Customer/Grid/Filter/Country.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Customer/Grid/Renderer/Multiaction.php b/app/code/Mage/Adminhtml/Block/Customer/Grid/Renderer/Multiaction.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Customer/Grid/Renderer/Multiaction.php
rename to app/code/Mage/Adminhtml/Block/Customer/Grid/Renderer/Multiaction.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Customer/Group.php b/app/code/Mage/Adminhtml/Block/Customer/Group.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Customer/Group.php
rename to app/code/Mage/Adminhtml/Block/Customer/Group.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Customer/Group/Edit.php b/app/code/Mage/Adminhtml/Block/Customer/Group/Edit.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Customer/Group/Edit.php
rename to app/code/Mage/Adminhtml/Block/Customer/Group/Edit.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Customer/Group/Edit/Form.php b/app/code/Mage/Adminhtml/Block/Customer/Group/Edit/Form.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Customer/Group/Edit/Form.php
rename to app/code/Mage/Adminhtml/Block/Customer/Group/Edit/Form.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Customer/Group/Grid.php b/app/code/Mage/Adminhtml/Block/Customer/Group/Grid.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Customer/Group/Grid.php
rename to app/code/Mage/Adminhtml/Block/Customer/Group/Grid.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Customer/Online.php b/app/code/Mage/Adminhtml/Block/Customer/Online.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Customer/Online.php
rename to app/code/Mage/Adminhtml/Block/Customer/Online.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Customer/Online/Filter.php b/app/code/Mage/Adminhtml/Block/Customer/Online/Filter.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Customer/Online/Filter.php
rename to app/code/Mage/Adminhtml/Block/Customer/Online/Filter.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Customer/Online/Grid.php b/app/code/Mage/Adminhtml/Block/Customer/Online/Grid.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Customer/Online/Grid.php
rename to app/code/Mage/Adminhtml/Block/Customer/Online/Grid.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Customer/Online/Grid/Renderer/Ip.php b/app/code/Mage/Adminhtml/Block/Customer/Online/Grid/Renderer/Ip.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Customer/Online/Grid/Renderer/Ip.php
rename to app/code/Mage/Adminhtml/Block/Customer/Online/Grid/Renderer/Ip.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Customer/Online/Grid/Renderer/Type.php b/app/code/Mage/Adminhtml/Block/Customer/Online/Grid/Renderer/Type.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Customer/Online/Grid/Renderer/Type.php
rename to app/code/Mage/Adminhtml/Block/Customer/Online/Grid/Renderer/Type.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Customer/Online/Grid/Renderer/Url.php b/app/code/Mage/Adminhtml/Block/Customer/Online/Grid/Renderer/Url.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Customer/Online/Grid/Renderer/Url.php
rename to app/code/Mage/Adminhtml/Block/Customer/Online/Grid/Renderer/Url.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Customer/Sales/Order/Address/Form/Renderer/Vat.php b/app/code/Mage/Adminhtml/Block/Customer/Sales/Order/Address/Form/Renderer/Vat.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Customer/Sales/Order/Address/Form/Renderer/Vat.php
rename to app/code/Mage/Adminhtml/Block/Customer/Sales/Order/Address/Form/Renderer/Vat.php
diff --git a/app/code/Mage/Adminhtml/Block/Customer/System/Config/Validatevat.php b/app/code/Mage/Adminhtml/Block/Customer/System/Config/Validatevat.php
new file mode 100644
index 0000000000000..544b9f18692fb
--- /dev/null
+++ b/app/code/Mage/Adminhtml/Block/Customer/System/Config/Validatevat.php
@@ -0,0 +1,158 @@
+
+ */
+class Mage_Adminhtml_Block_Customer_System_Config_Validatevat extends Mage_Backend_Block_System_Config_Form_Field
+{
+ /**
+ * Merchant Country Field Name
+ *
+ * @var string
+ */
+ protected $_merchantCountry = 'general_store_information_country_id';
+
+ /**
+ * Merchant VAT Number Field
+ *
+ * @var string
+ */
+ protected $_merchantVatNumber = 'general_store_information_merchant_vat_number';
+
+ /**
+ * Validate VAT Button Label
+ *
+ * @var string
+ */
+ protected $_vatButtonLabel = 'Validate VAT Number';
+
+ /**
+ * Set Merchant Country Field Name
+ *
+ * @param string $countryField
+ * @return Mage_Adminhtml_Block_Customer_System_Config_Validatevat
+ */
+ public function setMerchantCountryField($countryField)
+ {
+ $this->_merchantCountry = $countryField;
+ return $this;
+ }
+
+ /**
+ * Get Merchant Country Field Name
+ *
+ * @return string
+ */
+ public function getMerchantCountryField()
+ {
+ return $this->_merchantCountry;
+ }
+
+ /**
+ * Set Merchant VAT Number Field
+ *
+ * @param string $vatNumberField
+ * @return Mage_Adminhtml_Block_Customer_System_Config_Validatevat
+ */
+ public function setMerchantVatNumberField($vatNumberField)
+ {
+ $this->_merchantVatNumber = $vatNumberField;
+ return $this;
+ }
+
+ /**
+ * Get Merchant VAT Number Field
+ *
+ * @return string
+ */
+ public function getMerchantVatNumberField()
+ {
+ return $this->_merchantVatNumber;
+ }
+
+ /**
+ * Set Validate VAT Button Label
+ *
+ * @param string $vatButtonLabel
+ * @return Mage_Adminhtml_Block_Customer_System_Config_Validatevat
+ */
+ public function setVatButtonLabel($vatButtonLabel)
+ {
+ $this->_vatButtonLabel = $vatButtonLabel;
+ return $this;
+ }
+
+ /**
+ * Set template to itself
+ *
+ * @return Mage_Adminhtml_Block_Customer_System_Config_Validatevat
+ */
+ protected function _prepareLayout()
+ {
+ parent::_prepareLayout();
+ if (!$this->getTemplate()) {
+ $this->setTemplate('customer/system/config/validatevat.phtml');
+ }
+ return $this;
+ }
+
+ /**
+ * Unset some non-related element parameters
+ *
+ * @param Varien_Data_Form_Element_Abstract $element
+ * @return string
+ */
+ public function render(Varien_Data_Form_Element_Abstract $element)
+ {
+ $element->unsScope()->unsCanUseWebsiteValue()->unsCanUseDefaultValue();
+ return parent::render($element);
+ }
+
+ /**
+ * Get the button and scripts contents
+ *
+ * @param Varien_Data_Form_Element_Abstract $element
+ * @return string
+ */
+ protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
+ {
+ $originalData = $element->getOriginalData();
+ $buttonLabel = !empty($originalData['button_label']) ? $originalData['button_label'] : $this->_vatButtonLabel;
+ $this->addData(array(
+ 'button_label' => Mage::helper('Mage_Customer_Helper_Data')->__($buttonLabel),
+ 'html_id' => $element->getHtmlId(),
+ 'ajax_url' => Mage::getSingleton('Mage_Backend_Model_Url')
+ ->getUrl('adminhtml/customer_system_config_validatevat/validate')
+ ));
+
+ return $this->_toHtml();
+ }
+}
diff --git a/app/code/Mage/Adminhtml/Block/Customer/System/Config/ValidatevatFactory.php b/app/code/Mage/Adminhtml/Block/Customer/System/Config/ValidatevatFactory.php
new file mode 100644
index 0000000000000..07f8ab3c44728
--- /dev/null
+++ b/app/code/Mage/Adminhtml/Block/Customer/System/Config/ValidatevatFactory.php
@@ -0,0 +1,45 @@
+
+ */
+class Mage_Adminhtml_Block_Customer_System_Config_ValidatevatFactory
+{
+ /**
+ * Create new VAT validator
+ *
+ * @return Mage_Adminhtml_Block_Customer_System_Config_Validatevat
+ */
+ public function createVatValidator()
+ {
+ return Mage::getBlockSingleton('Mage_Adminhtml_Block_Customer_System_Config_Validatevat');
+ }
+}
diff --git a/app/code/core/Mage/Adminhtml/Block/Dashboard.php b/app/code/Mage/Adminhtml/Block/Dashboard.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Dashboard.php
rename to app/code/Mage/Adminhtml/Block/Dashboard.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Dashboard/Abstract.php b/app/code/Mage/Adminhtml/Block/Dashboard/Abstract.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Dashboard/Abstract.php
rename to app/code/Mage/Adminhtml/Block/Dashboard/Abstract.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Dashboard/Bar.php b/app/code/Mage/Adminhtml/Block/Dashboard/Bar.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Dashboard/Bar.php
rename to app/code/Mage/Adminhtml/Block/Dashboard/Bar.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Dashboard/Diagrams.php b/app/code/Mage/Adminhtml/Block/Dashboard/Diagrams.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Dashboard/Diagrams.php
rename to app/code/Mage/Adminhtml/Block/Dashboard/Diagrams.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Dashboard/Graph.php b/app/code/Mage/Adminhtml/Block/Dashboard/Graph.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Dashboard/Graph.php
rename to app/code/Mage/Adminhtml/Block/Dashboard/Graph.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Dashboard/Grid.php b/app/code/Mage/Adminhtml/Block/Dashboard/Grid.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Dashboard/Grid.php
rename to app/code/Mage/Adminhtml/Block/Dashboard/Grid.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Dashboard/Grids.php b/app/code/Mage/Adminhtml/Block/Dashboard/Grids.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Dashboard/Grids.php
rename to app/code/Mage/Adminhtml/Block/Dashboard/Grids.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Dashboard/Orders/Grid.php b/app/code/Mage/Adminhtml/Block/Dashboard/Orders/Grid.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Dashboard/Orders/Grid.php
rename to app/code/Mage/Adminhtml/Block/Dashboard/Orders/Grid.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Dashboard/Sales.php b/app/code/Mage/Adminhtml/Block/Dashboard/Sales.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Dashboard/Sales.php
rename to app/code/Mage/Adminhtml/Block/Dashboard/Sales.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Dashboard/Searches/Last.php b/app/code/Mage/Adminhtml/Block/Dashboard/Searches/Last.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Dashboard/Searches/Last.php
rename to app/code/Mage/Adminhtml/Block/Dashboard/Searches/Last.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Dashboard/Searches/Renderer/Searchquery.php b/app/code/Mage/Adminhtml/Block/Dashboard/Searches/Renderer/Searchquery.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Dashboard/Searches/Renderer/Searchquery.php
rename to app/code/Mage/Adminhtml/Block/Dashboard/Searches/Renderer/Searchquery.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Dashboard/Searches/Top.php b/app/code/Mage/Adminhtml/Block/Dashboard/Searches/Top.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Dashboard/Searches/Top.php
rename to app/code/Mage/Adminhtml/Block/Dashboard/Searches/Top.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Dashboard/Tab/Amounts.php b/app/code/Mage/Adminhtml/Block/Dashboard/Tab/Amounts.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Dashboard/Tab/Amounts.php
rename to app/code/Mage/Adminhtml/Block/Dashboard/Tab/Amounts.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Dashboard/Tab/Customers/Most.php b/app/code/Mage/Adminhtml/Block/Dashboard/Tab/Customers/Most.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Dashboard/Tab/Customers/Most.php
rename to app/code/Mage/Adminhtml/Block/Dashboard/Tab/Customers/Most.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Dashboard/Tab/Customers/Newest.php b/app/code/Mage/Adminhtml/Block/Dashboard/Tab/Customers/Newest.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Dashboard/Tab/Customers/Newest.php
rename to app/code/Mage/Adminhtml/Block/Dashboard/Tab/Customers/Newest.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Dashboard/Tab/Orders.php b/app/code/Mage/Adminhtml/Block/Dashboard/Tab/Orders.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Dashboard/Tab/Orders.php
rename to app/code/Mage/Adminhtml/Block/Dashboard/Tab/Orders.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Dashboard/Tab/Products/Ordered.php b/app/code/Mage/Adminhtml/Block/Dashboard/Tab/Products/Ordered.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Dashboard/Tab/Products/Ordered.php
rename to app/code/Mage/Adminhtml/Block/Dashboard/Tab/Products/Ordered.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Dashboard/Tab/Products/Viewed.php b/app/code/Mage/Adminhtml/Block/Dashboard/Tab/Products/Viewed.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Dashboard/Tab/Products/Viewed.php
rename to app/code/Mage/Adminhtml/Block/Dashboard/Tab/Products/Viewed.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Dashboard/Totals.php b/app/code/Mage/Adminhtml/Block/Dashboard/Totals.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Dashboard/Totals.php
rename to app/code/Mage/Adminhtml/Block/Dashboard/Totals.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Denied.php b/app/code/Mage/Adminhtml/Block/Denied.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Denied.php
rename to app/code/Mage/Adminhtml/Block/Denied.php
diff --git a/app/code/Mage/Adminhtml/Block/Html/Date.php b/app/code/Mage/Adminhtml/Block/Html/Date.php
new file mode 100644
index 0000000000000..8f4c953f4498c
--- /dev/null
+++ b/app/code/Mage/Adminhtml/Block/Html/Date.php
@@ -0,0 +1,36 @@
+
+ */
+class Mage_Adminhtml_Block_Html_Date extends Mage_Core_Block_Html_Date
+{
+}
diff --git a/app/code/Mage/Adminhtml/Block/Html/Select.php b/app/code/Mage/Adminhtml/Block/Html/Select.php
new file mode 100644
index 0000000000000..7b0c63018b2a0
--- /dev/null
+++ b/app/code/Mage/Adminhtml/Block/Html/Select.php
@@ -0,0 +1,36 @@
+
+ */
+class Mage_Adminhtml_Block_Html_Select extends Mage_Core_Block_Html_Select
+{
+}
diff --git a/app/code/core/Mage/Adminhtml/Block/Media/Uploader.php b/app/code/Mage/Adminhtml/Block/Media/Uploader.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Media/Uploader.php
rename to app/code/Mage/Adminhtml/Block/Media/Uploader.php
diff --git a/app/code/Mage/Adminhtml/Block/Messages.php b/app/code/Mage/Adminhtml/Block/Messages.php
new file mode 100644
index 0000000000000..caf9d102ca50c
--- /dev/null
+++ b/app/code/Mage/Adminhtml/Block/Messages.php
@@ -0,0 +1,37 @@
+
+ */
+class Mage_Adminhtml_Block_Messages extends Mage_Core_Block_Messages
+{
+}
diff --git a/app/code/core/Mage/Adminhtml/Block/Newsletter/Problem.php b/app/code/Mage/Adminhtml/Block/Newsletter/Problem.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Newsletter/Problem.php
rename to app/code/Mage/Adminhtml/Block/Newsletter/Problem.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Newsletter/Problem/Grid/Filter/Checkbox.php b/app/code/Mage/Adminhtml/Block/Newsletter/Problem/Grid/Filter/Checkbox.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Newsletter/Problem/Grid/Filter/Checkbox.php
rename to app/code/Mage/Adminhtml/Block/Newsletter/Problem/Grid/Filter/Checkbox.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Newsletter/Problem/Grid/Renderer/Checkbox.php b/app/code/Mage/Adminhtml/Block/Newsletter/Problem/Grid/Renderer/Checkbox.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Newsletter/Problem/Grid/Renderer/Checkbox.php
rename to app/code/Mage/Adminhtml/Block/Newsletter/Problem/Grid/Renderer/Checkbox.php
diff --git a/app/code/Mage/Adminhtml/Block/Newsletter/Queue/Edit.php b/app/code/Mage/Adminhtml/Block/Newsletter/Queue/Edit.php
new file mode 100644
index 0000000000000..eae03306425a6
--- /dev/null
+++ b/app/code/Mage/Adminhtml/Block/Newsletter/Queue/Edit.php
@@ -0,0 +1,259 @@
+
+ */
+
+class Mage_Adminhtml_Block_Newsletter_Queue_Edit extends Mage_Adminhtml_Block_Template
+{
+ protected $_template = 'newsletter/queue/edit.phtml';
+
+ protected function _construct()
+ {
+ parent::_construct();
+ $templateId = $this->getRequest()->getParam('template_id');
+ if ($templateId) {
+ $this->setTemplateId($templateId);
+ }
+ }
+
+ /**
+ * Retrieve current Newsletter Queue Object
+ *
+ * @return Mage_Newsletter_Model_Queue
+ */
+ public function getQueue()
+ {
+ return Mage::registry('current_queue');
+ }
+
+ protected function _beforeToHtml() {
+
+
+
+ $this->setChild('form',
+ $this->getLayout()->createBlock('Mage_Adminhtml_Block_Newsletter_Queue_Edit_Form','form')
+ );
+
+ return parent::_beforeToHtml();
+ }
+
+ public function getSaveUrl()
+ {
+ if ($this->getTemplateId()) {
+ $params = array('template_id' => $this->getTemplateId());
+ } else {
+ $params = array('id' => $this->getRequest()->getParam('id'));
+ }
+ return $this->getUrl('*/*/save', $params);
+ }
+
+ protected function _prepareLayout()
+ {
+ // Load Wysiwyg on demand and Prepare layout
+ if (Mage::getSingleton('Mage_Cms_Model_Wysiwyg_Config')->isEnabled()) {
+ $this->getLayout()->getBlock('head')->setCanLoadTinyMce(true);
+ }
+
+ $this->addChild('preview_button', 'Mage_Adminhtml_Block_Widget_Button', array(
+ 'label' => Mage::helper('Mage_Newsletter_Helper_Data')->__('Preview Template'),
+ 'onclick' => 'queueControl.preview();',
+ 'class' => 'preview'
+ ));
+
+ $this->addChild('save_button', 'Mage_Adminhtml_Block_Widget_Button', array(
+ 'label' => Mage::helper('Mage_Newsletter_Helper_Data')->__('Save Newsletter'),
+ 'class' => 'save primary',
+ 'data_attribute' => array(
+ 'mage-init' => array(
+ 'button' => array('event' => 'save', 'target' => '#queue_edit_form'),
+ ),
+ ),
+ ));
+
+ $this->addChild('save_and_resume', 'Mage_Adminhtml_Block_Widget_Button', array(
+ 'label' => Mage::helper('Mage_Newsletter_Helper_Data')->__('Save and Resume'),
+ 'class' => 'save',
+ 'data_attribute' => array(
+ 'mage-init' => array(
+ 'button' => array(
+ 'event' => 'save',
+ 'target' => '#queue_edit_form',
+ 'eventData' => array(
+ 'action' => array(
+ 'args' => array('_resume' => 1),
+ ),
+ ),
+ ),
+ ),
+ ),
+ ));
+
+ $this->addChild('reset_button', 'Mage_Adminhtml_Block_Widget_Button', array(
+ 'label' => Mage::helper('Mage_Newsletter_Helper_Data')->__('Reset'),
+ 'onclick' => 'window.location = window.location'
+ ));
+
+ $this->addChild('back_button','Mage_Adminhtml_Block_Widget_Button', array(
+ 'label' => Mage::helper('Mage_Newsletter_Helper_Data')->__('Back'),
+ 'onclick' => "window.location.href = '" . $this->getUrl((
+ $this->getTemplateId() ? '*/newsletter_template/' : '*/*')) . "'",
+ 'class' => 'action-back'
+ ));
+
+ return parent::_prepareLayout();
+ }
+
+ /**
+ * Return preview action url for form
+ *
+ * @return string
+ */
+ public function getPreviewUrl()
+ {
+ return $this->getUrl('*/*/preview');
+ }
+
+ /**
+ * Retrieve Preview Button HTML
+ *
+ * @return string
+ */
+ public function getPreviewButtonHtml()
+ {
+ return $this->getChildHtml('preview_button');
+ }
+
+ /**
+ * Retrieve Save Button HTML
+ *
+ * @return string
+ */
+ public function getSaveButtonHtml()
+ {
+ return $this->getChildHtml('save_button');
+ }
+
+ /**
+ * Retrieve Reset Button HTML
+ *
+ * @return string
+ */
+ public function getResetButtonHtml()
+ {
+ return $this->getChildHtml('reset_button');
+ }
+
+ /**
+ * Retrieve Back Button HTML
+ *
+ * @return string
+ */
+ public function getBackButtonHtml()
+ {
+ return $this->getChildHtml('back_button');
+ }
+
+ /**
+ * Retrieve Resume Button HTML
+ *
+ * @return string
+ */
+ public function getResumeButtonHtml()
+ {
+ return $this->getChildHtml('save_and_resume');
+ }
+
+ /**
+ * Getter for availability preview mode
+ *
+ * @return boolean
+ */
+ public function getIsPreview()
+ {
+ return !in_array($this->getQueue()->getQueueStatus(), array(
+ Mage_Newsletter_Model_Queue::STATUS_NEVER,
+ Mage_Newsletter_Model_Queue::STATUS_PAUSE
+ ));
+ }
+
+ /**
+ * Getter for single store mode check
+ *
+ * @return boolean
+ */
+ protected function isSingleStoreMode()
+ {
+ return Mage::app()->isSingleStoreMode();
+ }
+
+ /**
+ * Getter for id of current store (the only one in single-store mode and current in multi-stores mode)
+ *
+ * @return boolean
+ */
+ protected function getStoreId()
+ {
+ return Mage::app()->getStore(true)->getId();
+ }
+
+ /**
+ * Getter for check is this newsletter the plain text.
+ *
+ * @return boolean
+ */
+ public function getIsTextType()
+ {
+ return $this->getQueue()->isPlain();
+ }
+
+ /**
+ * Getter for availability resume action
+ *
+ * @return boolean
+ */
+ public function getCanResume()
+ {
+ return in_array($this->getQueue()->getQueueStatus(), array(
+ Mage_Newsletter_Model_Queue::STATUS_PAUSE
+ ));
+ }
+
+ /**
+ * Getter for header text
+ *
+ * @return boolean
+ */
+ public function getHeaderText()
+ {
+ return ( $this->getIsPreview() ? Mage::helper('Mage_Newsletter_Helper_Data')->__('View Newsletter') : Mage::helper('Mage_Newsletter_Helper_Data')->__('Edit Newsletter'));
+ }
+}
diff --git a/app/code/core/Mage/Adminhtml/Block/Newsletter/Queue/Edit/Form.php b/app/code/Mage/Adminhtml/Block/Newsletter/Queue/Edit/Form.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Newsletter/Queue/Edit/Form.php
rename to app/code/Mage/Adminhtml/Block/Newsletter/Queue/Edit/Form.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Newsletter/Queue/Grid/Renderer/Action.php b/app/code/Mage/Adminhtml/Block/Newsletter/Queue/Grid/Renderer/Action.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Newsletter/Queue/Grid/Renderer/Action.php
rename to app/code/Mage/Adminhtml/Block/Newsletter/Queue/Grid/Renderer/Action.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Newsletter/Queue/Preview.php b/app/code/Mage/Adminhtml/Block/Newsletter/Queue/Preview.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Newsletter/Queue/Preview.php
rename to app/code/Mage/Adminhtml/Block/Newsletter/Queue/Preview.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Newsletter/Queue/Preview/Form.php b/app/code/Mage/Adminhtml/Block/Newsletter/Queue/Preview/Form.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Newsletter/Queue/Preview/Form.php
rename to app/code/Mage/Adminhtml/Block/Newsletter/Queue/Preview/Form.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Newsletter/Subscriber.php b/app/code/Mage/Adminhtml/Block/Newsletter/Subscriber.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Newsletter/Subscriber.php
rename to app/code/Mage/Adminhtml/Block/Newsletter/Subscriber.php
diff --git a/app/code/Mage/Adminhtml/Block/Newsletter/Subscriber/Grid.php b/app/code/Mage/Adminhtml/Block/Newsletter/Subscriber/Grid.php
new file mode 100644
index 0000000000000..6bd9fce3204ca
--- /dev/null
+++ b/app/code/Mage/Adminhtml/Block/Newsletter/Subscriber/Grid.php
@@ -0,0 +1,237 @@
+
+ */
+class Mage_Adminhtml_Block_Newsletter_Subscriber_Grid extends Mage_Adminhtml_Block_Widget_Grid
+{
+ /**
+ * Application instance
+ *
+ * @var Mage_Core_Model_App
+ */
+ protected $_app;
+
+ /**
+ * Constructor
+ *
+ * Set main configuration of grid
+ */
+ protected function _construct()
+ {
+ $this->_app = Mage::app();
+
+ parent::_construct();
+ $this->setId('subscriberGrid');
+ $this->setUseAjax(true);
+ $this->setDefaultSort('subscriber_id', 'desc');
+ }
+
+ /**
+ * Prepare collection for grid
+ *
+ * @return Mage_Adminhtml_Block_Widget_Grid
+ */
+ protected function _prepareCollection()
+ {
+ $collection = Mage::getResourceSingleton('Mage_Newsletter_Model_Resource_Subscriber_Collection');
+ /* @var $collection Mage_Newsletter_Model_Resource_Subscriber_Collection */
+ $collection
+ ->showCustomerInfo(true)
+ ->addSubscriberTypeField()
+ ->showStoreInfo();
+
+ if($this->getRequest()->getParam('queue', false)) {
+ $collection->useQueue(Mage::getModel('Mage_Newsletter_Model_Queue')
+ ->load($this->getRequest()->getParam('queue')));
+ }
+
+ $this->setCollection($collection);
+
+ return parent::_prepareCollection();
+ }
+
+ protected function _prepareColumns()
+ {
+
+ $this->addColumn('subscriber_id', array(
+ 'header' => Mage::helper('Mage_Newsletter_Helper_Data')->__('ID'),
+ 'index' => 'subscriber_id',
+ 'header_css_class' => 'col-id',
+ 'column_css_class' => 'col-id'
+ ));
+
+ $this->addColumn('email', array(
+ 'header' => Mage::helper('Mage_Newsletter_Helper_Data')->__('Email'),
+ 'index' => 'subscriber_email',
+ 'header_css_class' => 'col-email',
+ 'column_css_class' => 'col-email'
+ ));
+
+ $this->addColumn('type', array(
+ 'header' => Mage::helper('Mage_Newsletter_Helper_Data')->__('Type'),
+ 'index' => 'type',
+ 'type' => 'options',
+ 'options' => array(
+ 1 => Mage::helper('Mage_Newsletter_Helper_Data')->__('Guest'),
+ 2 => Mage::helper('Mage_Newsletter_Helper_Data')->__('Customer')
+ ),
+ 'header_css_class' => 'col-type',
+ 'column_css_class' => 'col-type'
+ ));
+
+ $this->addColumn('firstname', array(
+ 'header' => Mage::helper('Mage_Newsletter_Helper_Data')->__('Customer First Name'),
+ 'index' => 'customer_firstname',
+ 'default' => '----',
+ 'header_css_class' => 'col-first-name',
+ 'column_css_class' => 'col-first-name'
+ ));
+
+ $this->addColumn('lastname', array(
+ 'header' => Mage::helper('Mage_Newsletter_Helper_Data')->__('Customer Last Name'),
+ 'index' => 'customer_lastname',
+ 'default' => '----',
+ 'header_css_class' => 'col-last-name',
+ 'column_css_class' => 'col-last-name'
+ ));
+
+ $this->addColumn('status', array(
+ 'header' => Mage::helper('Mage_Newsletter_Helper_Data')->__('Status'),
+ 'index' => 'subscriber_status',
+ 'type' => 'options',
+ 'options' => array(
+ Mage_Newsletter_Model_Subscriber::STATUS_NOT_ACTIVE => Mage::helper('Mage_Newsletter_Helper_Data')->__('Not Activated'),
+ Mage_Newsletter_Model_Subscriber::STATUS_SUBSCRIBED => Mage::helper('Mage_Newsletter_Helper_Data')->__('Subscribed'),
+ Mage_Newsletter_Model_Subscriber::STATUS_UNSUBSCRIBED => Mage::helper('Mage_Newsletter_Helper_Data')->__('Unsubscribed'),
+ Mage_Newsletter_Model_Subscriber::STATUS_UNCONFIRMED => Mage::helper('Mage_Newsletter_Helper_Data')->__('Unconfirmed'),
+ ),
+ 'header_css_class' => 'col-status',
+ 'column_css_class' => 'col-status'
+ ));
+
+ if (!$this->_app->isSingleStoreMode()) {
+ $this->addColumn('website', array(
+ 'header' => Mage::helper('Mage_Newsletter_Helper_Data')->__('Website'),
+ 'index' => 'website_id',
+ 'type' => 'options',
+ 'options' => $this->_getWebsiteOptions(),
+ 'header_css_class' => 'col-website',
+ 'column_css_class' => 'col-website'
+ ));
+
+ $this->addColumn('group', array(
+ 'header' => Mage::helper('Mage_Newsletter_Helper_Data')->__('Store'),
+ 'index' => 'group_id',
+ 'type' => 'options',
+ 'options' => $this->_getStoreGroupOptions(),
+ 'header_css_class' => 'col-store',
+ 'column_css_class' => 'col-store'
+ ));
+
+ $this->addColumn('store', array(
+ 'header' => Mage::helper('Mage_Newsletter_Helper_Data')->__('Store View'),
+ 'index' => 'store_id',
+ 'type' => 'options',
+ 'options' => $this->_getStoreOptions(),
+ 'header_css_class' => 'col-store-view',
+ 'column_css_class' => 'col-store-view'
+ ));
+ }
+
+ $this->addExportType('*/*/exportCsv', Mage::helper('Mage_Customer_Helper_Data')->__('CSV'));
+ $this->addExportType('*/*/exportXml', Mage::helper('Mage_Customer_Helper_Data')->__('Excel XML'));
+ return parent::_prepareColumns();
+ }
+
+ /**
+ * Convert OptionsValue array to Options array
+ *
+ * @param array $optionsArray
+ * @return array
+ */
+ protected function _getOptions($optionsArray)
+ {
+ $options = array();
+ foreach ($optionsArray as $option) {
+ $options[$option['value']] = $option['label'];
+ }
+ return $options;
+ }
+
+ /**
+ * Retrieve Website Options array
+ *
+ * @return array
+ */
+ protected function _getWebsiteOptions()
+ {
+ return Mage::getModel('Mage_Core_Model_System_Store')->getWebsiteOptionHash();
+ }
+
+ /**
+ * Retrieve Store Group Options array
+ *
+ * @return array
+ */
+ protected function _getStoreGroupOptions()
+ {
+ return Mage::getModel('Mage_Core_Model_System_Store')->getStoreGroupOptionHash();
+ }
+
+ /**
+ * Retrieve Store Options array
+ *
+ * @return array
+ */
+ protected function _getStoreOptions()
+ {
+ return Mage::getModel('Mage_Core_Model_System_Store')->getStoreOptionHash();
+ }
+
+ protected function _prepareMassaction()
+ {
+ $this->setMassactionIdField('subscriber_id');
+ $this->getMassactionBlock()->setFormFieldName('subscriber');
+
+ $this->getMassactionBlock()->addItem('unsubscribe', array(
+ 'label' => Mage::helper('Mage_Newsletter_Helper_Data')->__('Unsubscribe'),
+ 'url' => $this->getUrl('*/*/massUnsubscribe')
+ ));
+
+ $this->getMassactionBlock()->addItem('delete', array(
+ 'label' => Mage::helper('Mage_Newsletter_Helper_Data')->__('Delete'),
+ 'url' => $this->getUrl('*/*/massDelete')
+ ));
+
+ return $this;
+ }
+}
diff --git a/app/code/core/Mage/Adminhtml/Block/Newsletter/Subscriber/Grid/Filter/Checkbox.php b/app/code/Mage/Adminhtml/Block/Newsletter/Subscriber/Grid/Filter/Checkbox.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Newsletter/Subscriber/Grid/Filter/Checkbox.php
rename to app/code/Mage/Adminhtml/Block/Newsletter/Subscriber/Grid/Filter/Checkbox.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Newsletter/Subscriber/Grid/Filter/Website.php b/app/code/Mage/Adminhtml/Block/Newsletter/Subscriber/Grid/Filter/Website.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Newsletter/Subscriber/Grid/Filter/Website.php
rename to app/code/Mage/Adminhtml/Block/Newsletter/Subscriber/Grid/Filter/Website.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Newsletter/Subscriber/Grid/Renderer/Checkbox.php b/app/code/Mage/Adminhtml/Block/Newsletter/Subscriber/Grid/Renderer/Checkbox.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Newsletter/Subscriber/Grid/Renderer/Checkbox.php
rename to app/code/Mage/Adminhtml/Block/Newsletter/Subscriber/Grid/Renderer/Checkbox.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Newsletter/Template.php b/app/code/Mage/Adminhtml/Block/Newsletter/Template.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Newsletter/Template.php
rename to app/code/Mage/Adminhtml/Block/Newsletter/Template.php
diff --git a/app/code/Mage/Adminhtml/Block/Newsletter/Template/Edit.php b/app/code/Mage/Adminhtml/Block/Newsletter/Template/Edit.php
new file mode 100644
index 0000000000000..b80a9c22791f2
--- /dev/null
+++ b/app/code/Mage/Adminhtml/Block/Newsletter/Template/Edit.php
@@ -0,0 +1,327 @@
+
+ */
+class Mage_Adminhtml_Block_Newsletter_Template_Edit extends Mage_Adminhtml_Block_Widget
+{
+ /**
+ * Edit Block model
+ *
+ * @var bool
+ */
+ protected $_editMode = false;
+
+ /**
+ * Retrieve template object
+ *
+ * @return Mage_Newsletter_Model_Template
+ */
+ public function getModel()
+ {
+ return Mage::registry('_current_template');
+ }
+
+ /**
+ * Preparing block layout
+ *
+ * @return Mage_Adminhtml_Block_Newsletter_Template_Edit
+ */
+ protected function _prepareLayout()
+ {
+ // Load Wysiwyg on demand and Prepare layout
+ if (Mage::getSingleton('Mage_Cms_Model_Wysiwyg_Config')->isEnabled() && ($block = $this->getLayout()->getBlock('head'))) {
+ $block->setCanLoadTinyMce(true);
+ }
+
+ $this->addChild('back_button', 'Mage_Adminhtml_Block_Widget_Button', array(
+ 'label' => Mage::helper('Mage_Newsletter_Helper_Data')->__('Back'),
+ 'onclick' => "window.location.href = '" . $this->getUrl('*/*') . "'",
+ 'class' => 'action-back'
+ ));
+
+ $this->addChild('reset_button', 'Mage_Adminhtml_Block_Widget_Button', array(
+ 'label' => Mage::helper('Mage_Newsletter_Helper_Data')->__('Reset'),
+ 'onclick' => 'window.location.href = window.location.href',
+ 'class' => 'reset'
+ ));
+
+ $this->addChild('to_plain_button', 'Mage_Adminhtml_Block_Widget_Button', array(
+ 'label' => Mage::helper('Mage_Newsletter_Helper_Data')->__('Convert to Plain Text'),
+ 'onclick' => 'templateControl.stripTags();',
+ 'id' => 'convert_button',
+ 'class' => 'convert'
+ ));
+
+ $this->addChild('to_html_button', 'Mage_Adminhtml_Block_Widget_Button', array(
+ 'label' => Mage::helper('Mage_Newsletter_Helper_Data')->__('Return HTML Version'),
+ 'onclick' => 'templateControl.unStripTags();',
+ 'id' => 'convert_button_back',
+ 'style' => 'display:none',
+ 'class' => 'return'
+ ));
+
+ $this->addChild('save_button', 'Mage_Adminhtml_Block_Widget_Button', array(
+ 'label' => Mage::helper('Mage_Newsletter_Helper_Data')->__('Save Template'),
+ 'onclick' => 'templateControl.save();',
+ 'class' => 'save primary'
+ ));
+
+ $this->addChild('save_as_button', 'Mage_Adminhtml_Block_Widget_Button', array(
+ 'label' => Mage::helper('Mage_Newsletter_Helper_Data')->__('Save As'),
+ 'onclick' => 'templateControl.saveAs();',
+ 'class' => 'save-as'
+ ));
+
+ $this->addChild('preview_button', 'Mage_Adminhtml_Block_Widget_Button', array(
+ 'label' => Mage::helper('Mage_Newsletter_Helper_Data')->__('Preview Template'),
+ 'onclick' => 'templateControl.preview();',
+ 'class' => 'preview'
+ ));
+
+ $this->addChild('delete_button', 'Mage_Adminhtml_Block_Widget_Button', array(
+ 'label' => Mage::helper('Mage_Newsletter_Helper_Data')->__('Delete Template'),
+ 'onclick' => 'templateControl.deleteTemplate();',
+ 'class' => 'delete'
+ ));
+
+ return parent::_prepareLayout();
+ }
+
+ /**
+ * Retrieve Back Button HTML
+ *
+ * @return string
+ */
+ public function getBackButtonHtml()
+ {
+ return $this->getChildHtml('back_button');
+ }
+
+ /**
+ * Retrieve Reset Button HTML
+ *
+ * @return string
+ */
+ public function getResetButtonHtml()
+ {
+ return $this->getChildHtml('reset_button');
+ }
+
+ /**
+ * Retrieve Convert To Plain Button HTML
+ *
+ * @return string
+ */
+ public function getToPlainButtonHtml()
+ {
+ return $this->getChildHtml('to_plain_button');
+ }
+
+ /**
+ * Retrieve Convert to HTML Button HTML
+ *
+ * @return string
+ */
+ public function getToHtmlButtonHtml()
+ {
+ return $this->getChildHtml('to_html_button');
+ }
+
+ /**
+ * Retrieve Save Button HTML
+ *
+ * @return string
+ */
+ public function getSaveButtonHtml()
+ {
+ return $this->getChildHtml('save_button');
+ }
+
+ /**
+ * Retrieve Preview Button HTML
+ *
+ * @return string
+ */
+ public function getPreviewButtonHtml()
+ {
+ return $this->getChildHtml('preview_button');
+ }
+
+ /**
+ * Retrieve Delete Button HTML
+ *
+ * @return string
+ */
+ public function getDeleteButtonHtml()
+ {
+ return $this->getChildHtml('delete_button');
+ }
+
+ /**
+ * Retrieve Save as Button HTML
+ *
+ * @return string
+ */
+ public function getSaveAsButtonHtml()
+ {
+ return $this->getChildHtml('save_as_button');
+ }
+
+ /**
+ * Set edit flag for block
+ *
+ * @param boolean $value
+ * @return Mage_Adminhtml_Block_Newsletter_Template_Edit
+ */
+ public function setEditMode($value = true)
+ {
+ $this->_editMode = (bool)$value;
+ return $this;
+ }
+
+ /**
+ * Return edit flag for block
+ *
+ * @return boolean
+ */
+ public function getEditMode()
+ {
+ return $this->_editMode;
+ }
+
+ /**
+ * Return header text for form
+ *
+ * @return string
+ */
+ public function getHeaderText()
+ {
+ if ($this->getEditMode()) {
+ return Mage::helper('Mage_Newsletter_Helper_Data')->__('Edit Newsletter Template');
+ }
+
+ return Mage::helper('Mage_Newsletter_Helper_Data')->__('New Newsletter Template');
+ }
+
+ /**
+ * Return form block HTML
+ *
+ * @return string
+ */
+ public function getForm()
+ {
+ return $this->getLayout()
+ ->createBlock('Mage_Adminhtml_Block_Newsletter_Template_Edit_Form')
+ ->toHtml();
+ }
+
+ /**
+ * Return return template name for JS
+ *
+ * @return string
+ */
+ public function getJsTemplateName()
+ {
+ return addcslashes($this->getModel()->getTemplateCode(), "\"\r\n\\");
+ }
+
+ /**
+ * Return action url for form
+ *
+ * @return string
+ */
+ public function getSaveUrl()
+ {
+ return $this->getUrl('*/*/save');
+ }
+
+ /**
+ * Return preview action url for form
+ *
+ * @return string
+ */
+ public function getPreviewUrl()
+ {
+ return $this->getUrl('*/*/preview');
+ }
+
+ /**
+ * Check Template Type is Plain Text
+ *
+ * @return bool
+ */
+ public function isTextType()
+ {
+ return $this->getModel()->isPlain();
+ }
+
+ /**
+ * Return delete url for customer group
+ *
+ * @return string
+ */
+ public function getDeleteUrl()
+ {
+ return $this->getUrl('*/*/delete', array('id' => $this->getRequest()->getParam('id')));
+ }
+
+ /**
+ * Retrieve Save As Flag
+ *
+ * @return int
+ */
+ public function getSaveAsFlag()
+ {
+ return $this->getRequest()->getParam('_save_as_flag') ? '1' : '';
+ }
+
+ /**
+ * Getter for single store mode check
+ *
+ * @return boolean
+ */
+ protected function isSingleStoreMode()
+ {
+ return Mage::app()->isSingleStoreMode();
+ }
+
+ /**
+ * Getter for id of current store (the only one in single-store mode and current in multi-stores mode)
+ *
+ * @return boolean
+ */
+ protected function getStoreId()
+ {
+ return Mage::app()->getStore(true)->getId();
+ }
+}
diff --git a/app/code/core/Mage/Adminhtml/Block/Newsletter/Template/Edit/Form.php b/app/code/Mage/Adminhtml/Block/Newsletter/Template/Edit/Form.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Newsletter/Template/Edit/Form.php
rename to app/code/Mage/Adminhtml/Block/Newsletter/Template/Edit/Form.php
diff --git a/app/code/Mage/Adminhtml/Block/Newsletter/Template/Grid.php b/app/code/Mage/Adminhtml/Block/Newsletter/Template/Grid.php
new file mode 100644
index 0000000000000..21336ffa0bfbe
--- /dev/null
+++ b/app/code/Mage/Adminhtml/Block/Newsletter/Template/Grid.php
@@ -0,0 +1,139 @@
+
+ */
+class Mage_Adminhtml_Block_Newsletter_Template_Grid extends Mage_Adminhtml_Block_Widget_Grid
+{
+ protected function _construct()
+ {
+ $this->setEmptyText(Mage::helper('Mage_Newsletter_Helper_Data')->__('No Templates Found'));
+ }
+
+ protected function _prepareCollection()
+ {
+ $collection = Mage::getResourceSingleton('Mage_Newsletter_Model_Resource_Template_Collection')
+ ->useOnlyActual();
+
+ $this->setCollection($collection);
+
+ return parent::_prepareCollection();
+ }
+
+ protected function _prepareColumns()
+ {
+ $this->addColumn('template_code',
+ array(
+ 'header' => Mage::helper('Mage_Newsletter_Helper_Data')->__('ID'),
+ 'index' => 'template_id',
+ 'header_css_class' => 'col-id',
+ 'column_css_class' => 'col-id'
+ ));
+ $this->addColumn('code',
+ array(
+ 'header' => Mage::helper('Mage_Newsletter_Helper_Data')->__('Template Name'),
+ 'index' => 'template_code',
+ 'header_css_class' => 'col-template',
+ 'column_css_class' => 'col-template'
+ ));
+
+ $this->addColumn('added_at',
+ array(
+ 'header' => Mage::helper('Mage_Newsletter_Helper_Data')->__('Date Added'),
+ 'index' => 'added_at',
+ 'gmtoffset' => true,
+ 'type' => 'datetime',
+ 'header_css_class' => 'col-added',
+ 'column_css_class' => 'col-added'
+ ));
+
+ $this->addColumn('modified_at',
+ array(
+ 'header' => Mage::helper('Mage_Newsletter_Helper_Data')->__('Date Updated'),
+ 'index' => 'modified_at',
+ 'gmtoffset' => true,
+ 'type' => 'datetime',
+ 'header_css_class' => 'col-updated',
+ 'column_css_class' => 'col-updated'
+ ));
+
+ $this->addColumn('subject',
+ array(
+ 'header' => Mage::helper('Mage_Newsletter_Helper_Data')->__('Subject'),
+ 'index' => 'template_subject',
+ 'header_css_class' => 'col-subject',
+ 'column_css_class' => 'col-subject'
+ ));
+
+ $this->addColumn('sender',
+ array(
+ 'header' => Mage::helper('Mage_Newsletter_Helper_Data')->__('Sender'),
+ 'index' => 'template_sender_email',
+ 'renderer' => 'Mage_Adminhtml_Block_Newsletter_Template_Grid_Renderer_Sender',
+ 'header_css_class' => 'col-sender',
+ 'column_css_class' => 'col-sender'
+ ));
+
+ $this->addColumn('type',
+ array(
+ 'header' => Mage::helper('Mage_Newsletter_Helper_Data')->__('Template Type'),
+ 'index' => 'template_type',
+ 'type' => 'options',
+ 'options' => array(
+ Mage_Newsletter_Model_Template::TYPE_HTML => 'html',
+ Mage_Newsletter_Model_Template::TYPE_TEXT => 'text'
+ ),
+ 'header_css_class' => 'col-type',
+ 'column_css_class' => 'col-type'
+ ));
+
+ $this->addColumn('action',
+ array(
+ 'header' => Mage::helper('Mage_Newsletter_Helper_Data')->__('Action'),
+ 'index' => 'template_id',
+ 'sortable' => false,
+ 'filter' => false,
+ 'no_link' => true,
+ 'renderer' => 'Mage_Adminhtml_Block_Newsletter_Template_Grid_Renderer_Action',
+ 'header_css_class' => 'col-actions',
+ 'column_css_class' => 'col-actions'
+ ));
+
+ return $this;
+ }
+
+ public function getRowUrl($row)
+ {
+ return $this->getUrl('*/*/edit', array('id'=>$row->getId()));
+ }
+
+}
+
diff --git a/app/code/core/Mage/Adminhtml/Block/Newsletter/Template/Grid/Renderer/Action.php b/app/code/Mage/Adminhtml/Block/Newsletter/Template/Grid/Renderer/Action.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Newsletter/Template/Grid/Renderer/Action.php
rename to app/code/Mage/Adminhtml/Block/Newsletter/Template/Grid/Renderer/Action.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Newsletter/Template/Grid/Renderer/Sender.php b/app/code/Mage/Adminhtml/Block/Newsletter/Template/Grid/Renderer/Sender.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Newsletter/Template/Grid/Renderer/Sender.php
rename to app/code/Mage/Adminhtml/Block/Newsletter/Template/Grid/Renderer/Sender.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Newsletter/Template/Preview.php b/app/code/Mage/Adminhtml/Block/Newsletter/Template/Preview.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Newsletter/Template/Preview.php
rename to app/code/Mage/Adminhtml/Block/Newsletter/Template/Preview.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Newsletter/Template/Preview/Form.php b/app/code/Mage/Adminhtml/Block/Newsletter/Template/Preview/Form.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Newsletter/Template/Preview/Form.php
rename to app/code/Mage/Adminhtml/Block/Newsletter/Template/Preview/Form.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Notification/Baseurl.php b/app/code/Mage/Adminhtml/Block/Notification/Baseurl.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Notification/Baseurl.php
rename to app/code/Mage/Adminhtml/Block/Notification/Baseurl.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Notification/Grid.php b/app/code/Mage/Adminhtml/Block/Notification/Grid.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Notification/Grid.php
rename to app/code/Mage/Adminhtml/Block/Notification/Grid.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Notification/Grid/Renderer/Actions.php b/app/code/Mage/Adminhtml/Block/Notification/Grid/Renderer/Actions.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Notification/Grid/Renderer/Actions.php
rename to app/code/Mage/Adminhtml/Block/Notification/Grid/Renderer/Actions.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Notification/Grid/Renderer/Notice.php b/app/code/Mage/Adminhtml/Block/Notification/Grid/Renderer/Notice.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Notification/Grid/Renderer/Notice.php
rename to app/code/Mage/Adminhtml/Block/Notification/Grid/Renderer/Notice.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Notification/Grid/Renderer/Severity.php b/app/code/Mage/Adminhtml/Block/Notification/Grid/Renderer/Severity.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Notification/Grid/Renderer/Severity.php
rename to app/code/Mage/Adminhtml/Block/Notification/Grid/Renderer/Severity.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Notification/Inbox.php b/app/code/Mage/Adminhtml/Block/Notification/Inbox.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Notification/Inbox.php
rename to app/code/Mage/Adminhtml/Block/Notification/Inbox.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Notification/Security.php b/app/code/Mage/Adminhtml/Block/Notification/Security.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Notification/Security.php
rename to app/code/Mage/Adminhtml/Block/Notification/Security.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Notification/Survey.php b/app/code/Mage/Adminhtml/Block/Notification/Survey.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Notification/Survey.php
rename to app/code/Mage/Adminhtml/Block/Notification/Survey.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Notification/Toolbar.php b/app/code/Mage/Adminhtml/Block/Notification/Toolbar.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Notification/Toolbar.php
rename to app/code/Mage/Adminhtml/Block/Notification/Toolbar.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Notification/Window.php b/app/code/Mage/Adminhtml/Block/Notification/Window.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Notification/Window.php
rename to app/code/Mage/Adminhtml/Block/Notification/Window.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Page.php b/app/code/Mage/Adminhtml/Block/Page.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Page.php
rename to app/code/Mage/Adminhtml/Block/Page.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Page/Footer.php b/app/code/Mage/Adminhtml/Block/Page/Footer.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Page/Footer.php
rename to app/code/Mage/Adminhtml/Block/Page/Footer.php
diff --git a/app/code/Mage/Adminhtml/Block/Page/Head.php b/app/code/Mage/Adminhtml/Block/Page/Head.php
new file mode 100644
index 0000000000000..177241055b120
--- /dev/null
+++ b/app/code/Mage/Adminhtml/Block/Page/Head.php
@@ -0,0 +1,47 @@
+
+ */
+class Mage_Adminhtml_Block_Page_Head extends Mage_Page_Block_Html_Head
+{
+ protected $_template = 'page/head.phtml';
+
+ /**
+ * Retrieve Session Form Key
+ *
+ * @return string
+ */
+ public function getFormKey()
+ {
+ return Mage::getSingleton('Mage_Core_Model_Session')->getFormKey();
+ }
+}
diff --git a/app/code/core/Mage/Adminhtml/Block/Page/Header.php b/app/code/Mage/Adminhtml/Block/Page/Header.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Page/Header.php
rename to app/code/Mage/Adminhtml/Block/Page/Header.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Page/Notices.php b/app/code/Mage/Adminhtml/Block/Page/Notices.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Page/Notices.php
rename to app/code/Mage/Adminhtml/Block/Page/Notices.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Page/System/Config/Robots/Reset.php b/app/code/Mage/Adminhtml/Block/Page/System/Config/Robots/Reset.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Page/System/Config/Robots/Reset.php
rename to app/code/Mage/Adminhtml/Block/Page/System/Config/Robots/Reset.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Poll/Answer/Edit.php b/app/code/Mage/Adminhtml/Block/Poll/Answer/Edit.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Poll/Answer/Edit.php
rename to app/code/Mage/Adminhtml/Block/Poll/Answer/Edit.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Poll/Answer/Edit/Form.php b/app/code/Mage/Adminhtml/Block/Poll/Answer/Edit/Form.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Poll/Answer/Edit/Form.php
rename to app/code/Mage/Adminhtml/Block/Poll/Answer/Edit/Form.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Poll/Edit.php b/app/code/Mage/Adminhtml/Block/Poll/Edit.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Poll/Edit.php
rename to app/code/Mage/Adminhtml/Block/Poll/Edit.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Poll/Edit/Form.php b/app/code/Mage/Adminhtml/Block/Poll/Edit/Form.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Poll/Edit/Form.php
rename to app/code/Mage/Adminhtml/Block/Poll/Edit/Form.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Poll/Edit/Tab/Answers.php b/app/code/Mage/Adminhtml/Block/Poll/Edit/Tab/Answers.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Poll/Edit/Tab/Answers.php
rename to app/code/Mage/Adminhtml/Block/Poll/Edit/Tab/Answers.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Poll/Edit/Tab/Answers/Form.php b/app/code/Mage/Adminhtml/Block/Poll/Edit/Tab/Answers/Form.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Poll/Edit/Tab/Answers/Form.php
rename to app/code/Mage/Adminhtml/Block/Poll/Edit/Tab/Answers/Form.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Poll/Edit/Tab/Answers/Grid.php b/app/code/Mage/Adminhtml/Block/Poll/Edit/Tab/Answers/Grid.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Poll/Edit/Tab/Answers/Grid.php
rename to app/code/Mage/Adminhtml/Block/Poll/Edit/Tab/Answers/Grid.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Poll/Edit/Tab/Answers/List.php b/app/code/Mage/Adminhtml/Block/Poll/Edit/Tab/Answers/List.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Poll/Edit/Tab/Answers/List.php
rename to app/code/Mage/Adminhtml/Block/Poll/Edit/Tab/Answers/List.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Poll/Edit/Tab/Form.php b/app/code/Mage/Adminhtml/Block/Poll/Edit/Tab/Form.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Poll/Edit/Tab/Form.php
rename to app/code/Mage/Adminhtml/Block/Poll/Edit/Tab/Form.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Poll/Edit/Tabs.php b/app/code/Mage/Adminhtml/Block/Poll/Edit/Tabs.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Poll/Edit/Tabs.php
rename to app/code/Mage/Adminhtml/Block/Poll/Edit/Tabs.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Poll/Grid.php b/app/code/Mage/Adminhtml/Block/Poll/Grid.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Poll/Grid.php
rename to app/code/Mage/Adminhtml/Block/Poll/Grid.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Poll/Poll.php b/app/code/Mage/Adminhtml/Block/Poll/Poll.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Poll/Poll.php
rename to app/code/Mage/Adminhtml/Block/Poll/Poll.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Promo/Catalog.php b/app/code/Mage/Adminhtml/Block/Promo/Catalog.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Promo/Catalog.php
rename to app/code/Mage/Adminhtml/Block/Promo/Catalog.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Promo/Catalog/Edit.php b/app/code/Mage/Adminhtml/Block/Promo/Catalog/Edit.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Promo/Catalog/Edit.php
rename to app/code/Mage/Adminhtml/Block/Promo/Catalog/Edit.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Promo/Catalog/Edit/Form.php b/app/code/Mage/Adminhtml/Block/Promo/Catalog/Edit/Form.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Promo/Catalog/Edit/Form.php
rename to app/code/Mage/Adminhtml/Block/Promo/Catalog/Edit/Form.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Promo/Catalog/Edit/Js.php b/app/code/Mage/Adminhtml/Block/Promo/Catalog/Edit/Js.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Promo/Catalog/Edit/Js.php
rename to app/code/Mage/Adminhtml/Block/Promo/Catalog/Edit/Js.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Promo/Catalog/Edit/Tab/Actions.php b/app/code/Mage/Adminhtml/Block/Promo/Catalog/Edit/Tab/Actions.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Promo/Catalog/Edit/Tab/Actions.php
rename to app/code/Mage/Adminhtml/Block/Promo/Catalog/Edit/Tab/Actions.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Promo/Catalog/Edit/Tab/Conditions.php b/app/code/Mage/Adminhtml/Block/Promo/Catalog/Edit/Tab/Conditions.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Promo/Catalog/Edit/Tab/Conditions.php
rename to app/code/Mage/Adminhtml/Block/Promo/Catalog/Edit/Tab/Conditions.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Promo/Catalog/Edit/Tab/Main.php b/app/code/Mage/Adminhtml/Block/Promo/Catalog/Edit/Tab/Main.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Promo/Catalog/Edit/Tab/Main.php
rename to app/code/Mage/Adminhtml/Block/Promo/Catalog/Edit/Tab/Main.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Promo/Catalog/Edit/Tabs.php b/app/code/Mage/Adminhtml/Block/Promo/Catalog/Edit/Tabs.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Promo/Catalog/Edit/Tabs.php
rename to app/code/Mage/Adminhtml/Block/Promo/Catalog/Edit/Tabs.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Promo/Catalog/Grid.php b/app/code/Mage/Adminhtml/Block/Promo/Catalog/Grid.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Promo/Catalog/Grid.php
rename to app/code/Mage/Adminhtml/Block/Promo/Catalog/Grid.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Promo/Quote.php b/app/code/Mage/Adminhtml/Block/Promo/Quote.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Promo/Quote.php
rename to app/code/Mage/Adminhtml/Block/Promo/Quote.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Promo/Quote/Edit.php b/app/code/Mage/Adminhtml/Block/Promo/Quote/Edit.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Promo/Quote/Edit.php
rename to app/code/Mage/Adminhtml/Block/Promo/Quote/Edit.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Promo/Quote/Edit/Form.php b/app/code/Mage/Adminhtml/Block/Promo/Quote/Edit/Form.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Promo/Quote/Edit/Form.php
rename to app/code/Mage/Adminhtml/Block/Promo/Quote/Edit/Form.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Promo/Quote/Edit/Tab/Actions.php b/app/code/Mage/Adminhtml/Block/Promo/Quote/Edit/Tab/Actions.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Promo/Quote/Edit/Tab/Actions.php
rename to app/code/Mage/Adminhtml/Block/Promo/Quote/Edit/Tab/Actions.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Promo/Quote/Edit/Tab/Conditions.php b/app/code/Mage/Adminhtml/Block/Promo/Quote/Edit/Tab/Conditions.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Promo/Quote/Edit/Tab/Conditions.php
rename to app/code/Mage/Adminhtml/Block/Promo/Quote/Edit/Tab/Conditions.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Promo/Quote/Edit/Tab/Coupons.php b/app/code/Mage/Adminhtml/Block/Promo/Quote/Edit/Tab/Coupons.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Promo/Quote/Edit/Tab/Coupons.php
rename to app/code/Mage/Adminhtml/Block/Promo/Quote/Edit/Tab/Coupons.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Promo/Quote/Edit/Tab/Coupons/Form.php b/app/code/Mage/Adminhtml/Block/Promo/Quote/Edit/Tab/Coupons/Form.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Promo/Quote/Edit/Tab/Coupons/Form.php
rename to app/code/Mage/Adminhtml/Block/Promo/Quote/Edit/Tab/Coupons/Form.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Promo/Quote/Edit/Tab/Coupons/Grid.php b/app/code/Mage/Adminhtml/Block/Promo/Quote/Edit/Tab/Coupons/Grid.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Promo/Quote/Edit/Tab/Coupons/Grid.php
rename to app/code/Mage/Adminhtml/Block/Promo/Quote/Edit/Tab/Coupons/Grid.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Promo/Quote/Edit/Tab/Coupons/Grid/Column/Renderer/Used.php b/app/code/Mage/Adminhtml/Block/Promo/Quote/Edit/Tab/Coupons/Grid/Column/Renderer/Used.php
old mode 100755
new mode 100644
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Promo/Quote/Edit/Tab/Coupons/Grid/Column/Renderer/Used.php
rename to app/code/Mage/Adminhtml/Block/Promo/Quote/Edit/Tab/Coupons/Grid/Column/Renderer/Used.php
diff --git a/app/code/Mage/Adminhtml/Block/Promo/Quote/Edit/Tab/Labels.php b/app/code/Mage/Adminhtml/Block/Promo/Quote/Edit/Tab/Labels.php
new file mode 100644
index 0000000000000..75a79610b41ec
--- /dev/null
+++ b/app/code/Mage/Adminhtml/Block/Promo/Quote/Edit/Tab/Labels.php
@@ -0,0 +1,166 @@
+_storeManager = $storeManager;
+ parent::__construct($context, $data);
+ }
+
+ /**
+ * Prepare content for tab
+ *
+ * @return string
+ */
+ public function getTabLabel()
+ {
+ return Mage::helper('Mage_SalesRule_Helper_Data')->__('Labels');
+ }
+
+ /**
+ * Prepare title for tab
+ *
+ * @return string
+ */
+ public function getTabTitle()
+ {
+ return Mage::helper('Mage_SalesRule_Helper_Data')->__('Labels');
+ }
+
+ /**
+ * Returns status flag about this tab can be showen or not
+ *
+ * @return bool
+ */
+ public function canShowTab()
+ {
+ return true;
+ }
+
+ /**
+ * Returns status flag about this tab hidden or not
+ *
+ * @return bool
+ */
+ public function isHidden()
+ {
+ return false;
+ }
+
+ protected function _prepareForm()
+ {
+ $rule = Mage::registry('current_promo_quote_rule');
+ $form = new Varien_Data_Form();
+ $form->setHtmlIdPrefix('rule_');
+
+ $fieldset = $form->addFieldset('default_label_fieldset', array(
+ 'legend' => Mage::helper('Mage_SalesRule_Helper_Data')->__('Default Label')
+ ));
+ $labels = $rule->getStoreLabels();
+
+ $fieldset->addField('store_default_label', 'text', array(
+ 'name' => 'store_labels[0]',
+ 'required' => false,
+ 'label' => Mage::helper('Mage_SalesRule_Helper_Data')->__('Default Rule Label for All Store Views'),
+ 'value' => isset($labels[0]) ? $labels[0] : '',
+ ));
+
+ if (!$this->_storeManager->isSingleStoreMode()) {
+ $fieldset = $this->_createStoreSpecificFieldset($form, $labels);
+ }
+
+ if ($rule->isReadonly()) {
+ foreach ($fieldset->getElements() as $element) {
+ $element->setReadonly(true, true);
+ }
+ }
+
+ $this->setForm($form);
+ return parent::_prepareForm();
+ }
+
+ /**
+ * Create store specific fieldset
+ *
+ * @param Varien_Data_Form $form
+ * @param array $labels
+ * @return Varien_Data_Form_Element_Fieldset mixed
+ */
+ protected function _createStoreSpecificFieldset($form, $labels)
+ {
+ $fieldset = $form->addFieldset('store_labels_fieldset', array(
+ 'legend' => Mage::helper('Mage_SalesRule_Helper_Data')->__('Store View Specific Labels'),
+ 'table_class' => 'form-list stores-tree',
+ ));
+ $renderer = $this->getLayout()->createBlock('Mage_Backend_Block_Store_Switcher_Form_Renderer_Fieldset');
+ $fieldset->setRenderer($renderer);
+
+ foreach (Mage::app()->getWebsites() as $website) {
+ $fieldset->addField("w_{$website->getId()}_label", 'note', array(
+ 'label' => $website->getName(),
+ 'fieldset_html_class' => 'website',
+ ));
+ foreach ($website->getGroups() as $group) {
+ $stores = $group->getStores();
+ if (count($stores) == 0) {
+ continue;
+ }
+ $fieldset->addField("sg_{$group->getId()}_label", 'note', array(
+ 'label' => $group->getName(),
+ 'fieldset_html_class' => 'store-group',
+ ));
+ foreach ($stores as $store) {
+ $fieldset->addField("s_{$store->getId()}", 'text', array(
+ 'name' => 'store_labels[' . $store->getId() . ']',
+ 'required' => false,
+ 'label' => $store->getName(),
+ 'value' => isset($labels[$store->getId()]) ? $labels[$store->getId()] : '',
+ 'fieldset_html_class' => 'store',
+ ));
+ }
+ }
+ }
+ return $fieldset;
+ }
+}
diff --git a/app/code/core/Mage/Adminhtml/Block/Promo/Quote/Edit/Tab/Main.php b/app/code/Mage/Adminhtml/Block/Promo/Quote/Edit/Tab/Main.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Promo/Quote/Edit/Tab/Main.php
rename to app/code/Mage/Adminhtml/Block/Promo/Quote/Edit/Tab/Main.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Promo/Quote/Edit/Tab/Main/Renderer/Checkbox.php b/app/code/Mage/Adminhtml/Block/Promo/Quote/Edit/Tab/Main/Renderer/Checkbox.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Promo/Quote/Edit/Tab/Main/Renderer/Checkbox.php
rename to app/code/Mage/Adminhtml/Block/Promo/Quote/Edit/Tab/Main/Renderer/Checkbox.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Promo/Quote/Edit/Tabs.php b/app/code/Mage/Adminhtml/Block/Promo/Quote/Edit/Tabs.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Promo/Quote/Edit/Tabs.php
rename to app/code/Mage/Adminhtml/Block/Promo/Quote/Edit/Tabs.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Promo/Quote/Grid.php b/app/code/Mage/Adminhtml/Block/Promo/Quote/Grid.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Promo/Quote/Grid.php
rename to app/code/Mage/Adminhtml/Block/Promo/Quote/Grid.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Promo/Widget/Chooser.php b/app/code/Mage/Adminhtml/Block/Promo/Widget/Chooser.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Promo/Widget/Chooser.php
rename to app/code/Mage/Adminhtml/Block/Promo/Widget/Chooser.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Promo/Widget/Chooser/Daterange.php b/app/code/Mage/Adminhtml/Block/Promo/Widget/Chooser/Daterange.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Promo/Widget/Chooser/Daterange.php
rename to app/code/Mage/Adminhtml/Block/Promo/Widget/Chooser/Daterange.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Promo/Widget/Chooser/Sku.php b/app/code/Mage/Adminhtml/Block/Promo/Widget/Chooser/Sku.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Promo/Widget/Chooser/Sku.php
rename to app/code/Mage/Adminhtml/Block/Promo/Widget/Chooser/Sku.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Rating/Edit.php b/app/code/Mage/Adminhtml/Block/Rating/Edit.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Rating/Edit.php
rename to app/code/Mage/Adminhtml/Block/Rating/Edit.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Rating/Edit/Form.php b/app/code/Mage/Adminhtml/Block/Rating/Edit/Form.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Rating/Edit/Form.php
rename to app/code/Mage/Adminhtml/Block/Rating/Edit/Form.php
diff --git a/app/code/Mage/Adminhtml/Block/Rating/Edit/Tab/Form.php b/app/code/Mage/Adminhtml/Block/Rating/Edit/Tab/Form.php
new file mode 100644
index 0000000000000..6a81fce0765de
--- /dev/null
+++ b/app/code/Mage/Adminhtml/Block/Rating/Edit/Tab/Form.php
@@ -0,0 +1,190 @@
+
+ */
+
+class Mage_Adminhtml_Block_Rating_Edit_Tab_Form extends Mage_Backend_Block_Widget_Form
+{
+ /**
+ * Store manager instance
+ *
+ * @var Mage_Core_Model_StoreManager
+ */
+ protected $_storeManager;
+
+ /**
+ * @param Mage_Core_Block_Template_Context $context
+ * @param Mage_Core_Model_StoreManager $storeManager
+ * @param array $data
+ */
+ public function __construct(
+ Mage_Core_Block_Template_Context $context,
+ Mage_Core_Model_StoreManager $storeManager,
+ array $data = array()
+ ) {
+ $this->_storeManager = $storeManager;
+ parent::__construct($context, $data);
+ }
+
+
+ /**
+ * Prepare rating edit form
+ *
+ * @return Mage_Adminhtml_Block_Rating_Edit_Tab_Form
+ */
+ protected function _prepareForm()
+ {
+ $form = new Varien_Data_Form();
+ $this->setForm($form);
+
+ $fieldset = $form->addFieldset('rating_form', array(
+ 'legend'=>Mage::helper('Mage_Rating_Helper_Data')->__('Rating Title')
+ ));
+
+ $fieldset->addField('rating_code', 'text', array(
+ 'name' => 'rating_code',
+ 'label' => Mage::helper('Mage_Rating_Helper_Data')->__('Default Value'),
+ 'class' => 'required-entry',
+ 'required' => true,
+ ));
+
+ foreach (Mage::getSingleton('Mage_Core_Model_System_Store')->getStoreCollection() as $store) {
+ $fieldset->addField('rating_code_' . $store->getId(), 'text', array(
+ 'label' => $store->getName(),
+ 'name' => 'rating_codes[' . $store->getId() . ']',
+ ));
+ }
+
+ if (Mage::getSingleton('Mage_Adminhtml_Model_Session')->getRatingData()) {
+ $form->setValues(Mage::getSingleton('Mage_Adminhtml_Model_Session')->getRatingData());
+ $data = Mage::getSingleton('Mage_Adminhtml_Model_Session')->getRatingData();
+ if (isset($data['rating_codes'])) {
+ $this->_setRatingCodes($data['rating_codes']);
+ }
+ Mage::getSingleton('Mage_Adminhtml_Model_Session')->setRatingData(null);
+ } elseif (Mage::registry('rating_data')) {
+ $form->setValues(Mage::registry('rating_data')->getData());
+ if (Mage::registry('rating_data')->getRatingCodes()) {
+ $this->_setRatingCodes(Mage::registry('rating_data')->getRatingCodes());
+ }
+ }
+
+ if (Mage::registry('rating_data')) {
+ $collection = Mage::getModel('Mage_Rating_Model_Rating_Option')
+ ->getResourceCollection()
+ ->addRatingFilter(Mage::registry('rating_data')->getId())
+ ->load();
+
+ $i = 1;
+ foreach ($collection->getItems() as $item) {
+ $fieldset->addField('option_code_' . $item->getId() , 'hidden', array(
+ 'required' => true,
+ 'name' => 'option_title[' . $item->getId() . ']',
+ 'value' => ($item->getCode()) ? $item->getCode() : $i,
+ ));
+
+ $i ++;
+ }
+ } else {
+ for ($i = 1; $i <= 5; $i++) {
+ $fieldset->addField('option_code_' . $i, 'hidden', array(
+ 'required' => true,
+ 'name' => 'option_title[add_' . $i . ']',
+ 'value' => $i,
+ ));
+ }
+ }
+
+ $fieldset = $form->addFieldset('visibility_form', array(
+ 'legend' => Mage::helper('Mage_Rating_Helper_Data')->__('Rating Visibility')
+ ));
+ if (!$this->_storeManager->isSingleStoreMode()) {
+ $field = $fieldset->addField('stores', 'multiselect', array(
+ 'label' => Mage::helper('Mage_Rating_Helper_Data')->__('Visible In'),
+ 'name' => 'stores[]',
+ 'values' => Mage::getSingleton('Mage_Core_Model_System_Store')->getStoreValuesForForm(),
+ ));
+ $renderer = $this->getLayout()->createBlock('Mage_Backend_Block_Store_Switcher_Form_Renderer_Fieldset_Element');
+ $field->setRenderer($renderer);
+
+ if (Mage::registry('rating_data')) {
+ $form->getElement('stores')->setValue(Mage::registry('rating_data')->getStores());
+ }
+ }
+
+ $fieldset->addField('is_active', 'checkbox', array(
+ 'label' => Mage::helper('Mage_Rating_Helper_Data')->__('Is Active'),
+ 'name' => 'is_active',
+ 'value' => 1,
+ ));
+
+ $fieldset->addField('position', 'text', array(
+ 'label' => Mage::helper('Mage_Rating_Helper_Data')->__('Sort Order'),
+ 'name' => 'position',
+ ));
+
+ if (Mage::registry('rating_data')) {
+ $form->getElement('position')->setValue(Mage::registry('rating_data')->getPosition());
+ $form->getElement('is_active')->setIsChecked(Mage::registry('rating_data')->getIsActive());
+ }
+
+ return parent::_prepareForm();
+ }
+
+ protected function _setRatingCodes($ratingCodes) {
+ foreach($ratingCodes as $store=>$value) {
+ if($element = $this->getForm()->getElement('rating_code_' . $store)) {
+ $element->setValue($value);
+ }
+ }
+ }
+
+ protected function _toHtml()
+ {
+ return $this->_getWarningHtml() . parent::_toHtml();
+ }
+
+ protected function _getWarningHtml()
+ {
+ return '
+
+
+
+ '.Mage::helper('Mage_Rating_Helper_Data')->__('If you do not specify a rating title for a store, the default value will be used.').'
+
+
+
+
';
+ }
+
+
+}
diff --git a/app/code/core/Mage/Adminhtml/Block/Rating/Edit/Tab/Options.php b/app/code/Mage/Adminhtml/Block/Rating/Edit/Tab/Options.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Rating/Edit/Tab/Options.php
rename to app/code/Mage/Adminhtml/Block/Rating/Edit/Tab/Options.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Rating/Edit/Tabs.php b/app/code/Mage/Adminhtml/Block/Rating/Edit/Tabs.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Rating/Edit/Tabs.php
rename to app/code/Mage/Adminhtml/Block/Rating/Edit/Tabs.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Rating/Rating.php b/app/code/Mage/Adminhtml/Block/Rating/Rating.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Rating/Rating.php
rename to app/code/Mage/Adminhtml/Block/Rating/Rating.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Report/Config/Form/Field/MtdStart.php b/app/code/Mage/Adminhtml/Block/Report/Config/Form/Field/MtdStart.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Report/Config/Form/Field/MtdStart.php
rename to app/code/Mage/Adminhtml/Block/Report/Config/Form/Field/MtdStart.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Report/Config/Form/Field/YtdStart.php b/app/code/Mage/Adminhtml/Block/Report/Config/Form/Field/YtdStart.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Report/Config/Form/Field/YtdStart.php
rename to app/code/Mage/Adminhtml/Block/Report/Config/Form/Field/YtdStart.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Report/Filter/Form.php b/app/code/Mage/Adminhtml/Block/Report/Filter/Form.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Report/Filter/Form.php
rename to app/code/Mage/Adminhtml/Block/Report/Filter/Form.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Report/Grid/Abstract.php b/app/code/Mage/Adminhtml/Block/Report/Grid/Abstract.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Report/Grid/Abstract.php
rename to app/code/Mage/Adminhtml/Block/Report/Grid/Abstract.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Report/Grid/Column/Renderer/Blanknumber.php b/app/code/Mage/Adminhtml/Block/Report/Grid/Column/Renderer/Blanknumber.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Report/Grid/Column/Renderer/Blanknumber.php
rename to app/code/Mage/Adminhtml/Block/Report/Grid/Column/Renderer/Blanknumber.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Report/Grid/Column/Renderer/Currency.php b/app/code/Mage/Adminhtml/Block/Report/Grid/Column/Renderer/Currency.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Report/Grid/Column/Renderer/Currency.php
rename to app/code/Mage/Adminhtml/Block/Report/Grid/Column/Renderer/Currency.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Report/Grid/Column/Renderer/Customer.php b/app/code/Mage/Adminhtml/Block/Report/Grid/Column/Renderer/Customer.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Report/Grid/Column/Renderer/Customer.php
rename to app/code/Mage/Adminhtml/Block/Report/Grid/Column/Renderer/Customer.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Report/Grid/Column/Renderer/Product.php b/app/code/Mage/Adminhtml/Block/Report/Grid/Column/Renderer/Product.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Report/Grid/Column/Renderer/Product.php
rename to app/code/Mage/Adminhtml/Block/Report/Grid/Column/Renderer/Product.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Report/Grid/Shopcart.php b/app/code/Mage/Adminhtml/Block/Report/Grid/Shopcart.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Report/Grid/Shopcart.php
rename to app/code/Mage/Adminhtml/Block/Report/Grid/Shopcart.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Report/Product.php b/app/code/Mage/Adminhtml/Block/Report/Product.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Report/Product.php
rename to app/code/Mage/Adminhtml/Block/Report/Product.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Report/Product/Downloads.php b/app/code/Mage/Adminhtml/Block/Report/Product/Downloads.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Report/Product/Downloads.php
rename to app/code/Mage/Adminhtml/Block/Report/Product/Downloads.php
diff --git a/app/code/Mage/Adminhtml/Block/Report/Product/Downloads/Grid.php b/app/code/Mage/Adminhtml/Block/Report/Product/Downloads/Grid.php
new file mode 100644
index 0000000000000..9b558e7e2ce89
--- /dev/null
+++ b/app/code/Mage/Adminhtml/Block/Report/Product/Downloads/Grid.php
@@ -0,0 +1,122 @@
+
+ */
+class Mage_Adminhtml_Block_Report_Product_Downloads_Grid extends Mage_Adminhtml_Block_Widget_Grid
+{
+ protected function _construct()
+ {
+ parent::_construct();
+ $this->setId('downloadsGrid');
+ $this->setUseAjax(false);
+ }
+
+ protected function _prepareCollection()
+ {
+ if ($this->getRequest()->getParam('website')) {
+ $storeIds = Mage::app()->getWebsite($this->getRequest()->getParam('website'))->getStoreIds();
+ $storeId = array_pop($storeIds);
+ } else if ($this->getRequest()->getParam('group')) {
+ $storeIds = Mage::app()->getGroup($this->getRequest()->getParam('group'))->getStoreIds();
+ $storeId = array_pop($storeIds);
+ } else if ($this->getRequest()->getParam('store')) {
+ $storeId = (int)$this->getRequest()->getParam('store');
+ } else {
+ $storeId = '';
+ }
+
+ $collection = Mage::getResourceModel('Mage_Reports_Model_Resource_Product_Downloads_Collection')
+ ->addAttributeToSelect('*')
+ ->setStoreId($storeId)
+ ->addAttributeToFilter('type_id', array(Mage_Downloadable_Model_Product_Type::TYPE_DOWNLOADABLE))
+ ->addSummary();
+
+ if( $storeId ) {
+ $collection->addStoreFilter($storeId);
+ }
+
+ $this->setCollection($collection);
+ return parent::_prepareCollection();
+ }
+
+ protected function _prepareColumns()
+ {
+ $this->addColumn('name', array(
+ 'header' => Mage::helper('Mage_Reports_Helper_Data')->__('Product Name'),
+ 'index' => 'name',
+ 'header_css_class' => 'col-product',
+ 'column_css_class' => 'col-product'
+ ));
+
+ $this->addColumn('link_title', array(
+ 'header' => Mage::helper('Mage_Reports_Helper_Data')->__('Link'),
+ 'index' => 'link_title',
+ 'header_css_class' => 'col-link',
+ 'column_css_class' => 'col-link'
+ ));
+
+ $this->addColumn('sku', array(
+ 'header' =>Mage::helper('Mage_Reports_Helper_Data')->__('Product SKU'),
+ 'index' =>'sku',
+ 'header_css_class' => 'col-sku',
+ 'column_css_class' => 'col-sku'
+ ));
+
+ $this->addColumn('purchases', array(
+ 'header' => Mage::helper('Mage_Reports_Helper_Data')->__('Purchases'),
+ 'width' => '215px',
+ 'align' => 'right',
+ 'filter' => false,
+ 'index' => 'purchases',
+ 'type' => 'number',
+ 'renderer' => 'Mage_Adminhtml_Block_Report_Product_Downloads_Renderer_Purchases',
+ 'header_css_class' => 'col-purchases',
+ 'column_css_class' => 'col-purchases'
+ ));
+
+ $this->addColumn('downloads', array(
+ 'header' => Mage::helper('Mage_Reports_Helper_Data')->__('Downloads'),
+ 'width' => '215px',
+ 'align' => 'right',
+ 'filter' => false,
+ 'index' => 'downloads',
+ 'type' => 'number',
+ 'header_css_class' => 'col-qty',
+ 'column_css_class' => 'col-qty'
+ ));
+
+ $this->addExportType('*/*/exportDownloadsCsv', Mage::helper('Mage_Reports_Helper_Data')->__('CSV'));
+ $this->addExportType('*/*/exportDownloadsExcel', Mage::helper('Mage_Reports_Helper_Data')->__('Excel XML'));
+
+ return parent::_prepareColumns();
+ }
+}
diff --git a/app/code/core/Mage/Adminhtml/Block/Report/Product/Downloads/Renderer/Purchases.php b/app/code/Mage/Adminhtml/Block/Report/Product/Downloads/Renderer/Purchases.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Report/Product/Downloads/Renderer/Purchases.php
rename to app/code/Mage/Adminhtml/Block/Report/Product/Downloads/Renderer/Purchases.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Report/Product/Grid.php b/app/code/Mage/Adminhtml/Block/Report/Product/Grid.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Report/Product/Grid.php
rename to app/code/Mage/Adminhtml/Block/Report/Product/Grid.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Report/Product/Lowstock.php b/app/code/Mage/Adminhtml/Block/Report/Product/Lowstock.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Report/Product/Lowstock.php
rename to app/code/Mage/Adminhtml/Block/Report/Product/Lowstock.php
diff --git a/app/code/Mage/Adminhtml/Block/Report/Product/Lowstock/Grid.php b/app/code/Mage/Adminhtml/Block/Report/Product/Lowstock/Grid.php
new file mode 100644
index 0000000000000..18b091089b663
--- /dev/null
+++ b/app/code/Mage/Adminhtml/Block/Report/Product/Lowstock/Grid.php
@@ -0,0 +1,110 @@
+
+ */
+class Mage_Adminhtml_Block_Report_Product_Lowstock_Grid extends Mage_Adminhtml_Block_Widget_Grid
+{
+// protected $_saveParametersInSession = true;
+
+ protected function _construct()
+ {
+ parent::_construct();
+ $this->setId('gridLowstock');
+ $this->setUseAjax(false);
+ }
+
+ protected function _prepareCollection()
+ {
+ if ($this->getRequest()->getParam('website')) {
+ $storeIds = Mage::app()->getWebsite($this->getRequest()->getParam('website'))->getStoreIds();
+ $storeId = array_pop($storeIds);
+ } else if ($this->getRequest()->getParam('group')) {
+ $storeIds = Mage::app()->getGroup($this->getRequest()->getParam('group'))->getStoreIds();
+ $storeId = array_pop($storeIds);
+ } else if ($this->getRequest()->getParam('store')) {
+ $storeId = (int)$this->getRequest()->getParam('store');
+ } else {
+ $storeId = '';
+ }
+
+ /** @var $collection Mage_Reports_Model_Resource_Product_Lowstock_Collection */
+ $collection = Mage::getResourceModel('Mage_Reports_Model_Resource_Product_Lowstock_Collection')
+ ->addAttributeToSelect('*')
+ ->setStoreId($storeId)
+ ->filterByIsQtyProductTypes()
+ ->joinInventoryItem('qty')
+ ->useManageStockFilter($storeId)
+ ->useNotifyStockQtyFilter($storeId)
+ ->setOrder('qty', Varien_Data_Collection::SORT_ORDER_ASC);
+
+ if( $storeId ) {
+ $collection->addStoreFilter($storeId);
+ }
+
+ $this->setCollection($collection);
+ return parent::_prepareCollection();
+ }
+
+ protected function _prepareColumns()
+ {
+ $this->addColumn('name', array(
+ 'header' =>Mage::helper('Mage_Reports_Helper_Data')->__('Product Name'),
+ 'sortable' =>false,
+ 'index' =>'name',
+ 'header_css_class' => 'col-product',
+ 'column_css_class' => 'col-product'
+ ));
+
+ $this->addColumn('sku', array(
+ 'header' =>Mage::helper('Mage_Reports_Helper_Data')->__('Product SKU'),
+ 'sortable' =>false,
+ 'index' =>'sku',
+ 'header_css_class' => 'col-sku',
+ 'column_css_class' => 'col-sku'
+ ));
+
+ $this->addColumn('qty', array(
+ 'header' =>Mage::helper('Mage_Reports_Helper_Data')->__('Stock Qty'),
+ 'sortable' =>false,
+ 'filter' =>'Mage_Adminhtml_Block_Widget_Grid_Column_Filter_Range',
+ 'index' =>'qty',
+ 'type' =>'number',
+ 'header_css_class' => 'col-qty',
+ 'column_css_class' => 'col-qty'
+ ));
+
+ $this->addExportType('*/*/exportLowstockCsv', Mage::helper('Mage_Reports_Helper_Data')->__('CSV'));
+ $this->addExportType('*/*/exportLowstockExcel', Mage::helper('Mage_Reports_Helper_Data')->__('Excel XML'));
+
+ return parent::_prepareColumns();
+ }
+}
diff --git a/app/code/core/Mage/Adminhtml/Block/Report/Product/Viewed.php b/app/code/Mage/Adminhtml/Block/Report/Product/Viewed.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Report/Product/Viewed.php
rename to app/code/Mage/Adminhtml/Block/Report/Product/Viewed.php
diff --git a/app/code/Mage/Adminhtml/Block/Report/Product/Viewed/Grid.php b/app/code/Mage/Adminhtml/Block/Report/Product/Viewed/Grid.php
new file mode 100644
index 0000000000000..4dcedf48b6133
--- /dev/null
+++ b/app/code/Mage/Adminhtml/Block/Report/Product/Viewed/Grid.php
@@ -0,0 +1,132 @@
+
+ */
+class Mage_Adminhtml_Block_Report_Product_Viewed_Grid extends Mage_Adminhtml_Block_Report_Grid_Abstract
+{
+ /**
+ * Column for grid to be grouped by
+ *
+ * @var string
+ */
+ protected $_columnGroupBy = 'period';
+
+ /**
+ * Grid resource collection name
+ *
+ * @var string
+ */
+ protected $_resourceCollectionName = 'Mage_Reports_Model_Resource_Report_Product_Viewed_Collection';
+
+ /**
+ * Init grid parameters
+ */
+ protected function _construct()
+ {
+ parent::_construct();
+ $this->setCountTotals(true);
+ }
+
+ /**
+ * Custom columns preparation
+ *
+ * @return Mage_Adminhtml_Block_Widget_Grid
+ */
+ protected function _prepareColumns()
+ {
+ $this->addColumn('period', array(
+ 'header' => Mage::helper('Mage_Adminhtml_Helper_Data')->__('Period'),
+ 'index' => 'period',
+ 'width' => 100,
+ 'sortable' => false,
+ 'period_type' => $this->getPeriodType(),
+ 'renderer' => 'Mage_Adminhtml_Block_Report_Sales_Grid_Column_Renderer_Date',
+ 'totals_label' => Mage::helper('Mage_Adminhtml_Helper_Data')->__('Total'),
+ 'html_decorators' => array('nobr'),
+ 'header_css_class' => 'col-period',
+ 'column_css_class' => 'col-period'
+ ));
+
+ $this->addColumn('product_name', array(
+ 'header' => Mage::helper('Mage_Adminhtml_Helper_Data')->__('Product Name'),
+ 'index' => 'product_name',
+ 'type' => 'string',
+ 'sortable' => false,
+ 'header_css_class' => 'col-name',
+ 'column_css_class' => 'col-name'
+ ));
+
+ if ($this->getFilterData()->getStoreIds()) {
+ $this->setStoreIds(explode(',', $this->getFilterData()->getStoreIds()));
+ }
+ $currencyCode = $this->getCurrentCurrencyCode();
+
+ $this->addColumn('product_price', array(
+ 'header' => Mage::helper('Mage_Adminhtml_Helper_Data')->__('Price'),
+ 'type' => 'currency',
+ 'currency_code' => $currencyCode,
+ 'index' => 'product_price',
+ 'sortable' => false,
+ 'rate' => $this->getRate($currencyCode),
+ 'header_css_class' => 'col-price',
+ 'column_css_class' => 'col-price'
+ ));
+
+ $this->addColumn('views_num', array(
+ 'header' => Mage::helper('Mage_Adminhtml_Helper_Data')->__('Number of Views'),
+ 'index' => 'views_num',
+ 'type' => 'number',
+ 'total' => 'sum',
+ 'sortable' => false,
+ 'header_css_class' => 'col-qty',
+ 'column_css_class' => 'col-qty'
+ ));
+
+
+ $this->addExportType('*/*/exportViewedCsv', Mage::helper('Mage_Adminhtml_Helper_Data')->__('CSV'));
+ $this->addExportType('*/*/exportViewedExcel', Mage::helper('Mage_Adminhtml_Helper_Data')->__('Excel XML'));
+
+ return parent::_prepareColumns();
+ }
+
+ /**
+ * Don't use orders in collection
+ *
+ * @param Mage_Reports_Model_Resource_Report_Collection_Abstract $collection
+ * @param Varien_Object $filterData
+ * @return Mage_Adminhtml_Block_Report_Grid_Abstract
+ */
+ protected function _addOrderStatusFilter($collection, $filterData)
+ {
+ return $this;
+ }
+}
diff --git a/app/code/core/Mage/Adminhtml/Block/Report/Review/Customer.php b/app/code/Mage/Adminhtml/Block/Report/Review/Customer.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Report/Review/Customer.php
rename to app/code/Mage/Adminhtml/Block/Report/Review/Customer.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Report/Review/Detail.php b/app/code/Mage/Adminhtml/Block/Report/Review/Detail.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Report/Review/Detail.php
rename to app/code/Mage/Adminhtml/Block/Report/Review/Detail.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Report/Review/Detail/Grid.php b/app/code/Mage/Adminhtml/Block/Report/Review/Detail/Grid.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Report/Review/Detail/Grid.php
rename to app/code/Mage/Adminhtml/Block/Report/Review/Detail/Grid.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Report/Review/Product.php b/app/code/Mage/Adminhtml/Block/Report/Review/Product.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Report/Review/Product.php
rename to app/code/Mage/Adminhtml/Block/Report/Review/Product.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Report/Sales/Bestsellers.php b/app/code/Mage/Adminhtml/Block/Report/Sales/Bestsellers.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Report/Sales/Bestsellers.php
rename to app/code/Mage/Adminhtml/Block/Report/Sales/Bestsellers.php
diff --git a/app/code/Mage/Adminhtml/Block/Report/Sales/Bestsellers/Grid.php b/app/code/Mage/Adminhtml/Block/Report/Sales/Bestsellers/Grid.php
new file mode 100644
index 0000000000000..48cf762924ae5
--- /dev/null
+++ b/app/code/Mage/Adminhtml/Block/Report/Sales/Bestsellers/Grid.php
@@ -0,0 +1,104 @@
+
+ */
+class Mage_Adminhtml_Block_Report_Sales_Bestsellers_Grid extends Mage_Adminhtml_Block_Report_Grid_Abstract
+{
+ protected $_columnGroupBy = 'period';
+
+ protected function _construct()
+ {
+ parent::_construct();
+ $this->setCountTotals(true);
+ }
+
+ public function getResourceCollectionName()
+ {
+ return 'Mage_Sales_Model_Resource_Report_Bestsellers_Collection';
+ }
+
+ protected function _prepareColumns()
+ {
+ $this->addColumn('period', array(
+ 'header' => Mage::helper('Mage_Sales_Helper_Data')->__('Period'),
+ 'index' => 'period',
+ 'sortable' => false,
+ 'period_type' => $this->getPeriodType(),
+ 'renderer' => 'Mage_Adminhtml_Block_Report_Sales_Grid_Column_Renderer_Date',
+ 'totals_label' => Mage::helper('Mage_Adminhtml_Helper_Data')->__('Total'),
+ 'html_decorators' => array('nobr'),
+ 'header_css_class' => 'col-period',
+ 'column_css_class' => 'col-period'
+ ));
+
+ $this->addColumn('product_name', array(
+ 'header' => Mage::helper('Mage_Sales_Helper_Data')->__('Product Name'),
+ 'index' => 'product_name',
+ 'type' => 'string',
+ 'sortable' => false,
+ 'header_css_class' => 'col-product',
+ 'column_css_class' => 'col-product'
+ ));
+
+ if ($this->getFilterData()->getStoreIds()) {
+ $this->setStoreIds(explode(',', $this->getFilterData()->getStoreIds()));
+ }
+ $currencyCode = $this->getCurrentCurrencyCode();
+
+ $this->addColumn('product_price', array(
+ 'header' => Mage::helper('Mage_Sales_Helper_Data')->__('Price'),
+ 'type' => 'currency',
+ 'currency_code' => $currencyCode,
+ 'index' => 'product_price',
+ 'sortable' => false,
+ 'rate' => $this->getRate($currencyCode),
+ 'header_css_class' => 'col-price',
+ 'column_css_class' => 'col-price'
+ ));
+
+ $this->addColumn('qty_ordered', array(
+ 'header' => Mage::helper('Mage_Sales_Helper_Data')->__('Quantity Ordered'),
+ 'index' => 'qty_ordered',
+ 'type' => 'number',
+ 'total' => 'sum',
+ 'sortable' => false,
+ 'header_css_class' => 'col-qty',
+ 'column_css_class' => 'col-qty'
+ ));
+
+
+ $this->addExportType('*/*/exportBestsellersCsv', Mage::helper('Mage_Adminhtml_Helper_Data')->__('CSV'));
+ $this->addExportType('*/*/exportBestsellersExcel', Mage::helper('Mage_Adminhtml_Helper_Data')->__('Excel XML'));
+
+ return parent::_prepareColumns();
+ }
+}
diff --git a/app/code/core/Mage/Adminhtml/Block/Report/Sales/Coupons.php b/app/code/Mage/Adminhtml/Block/Report/Sales/Coupons.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Report/Sales/Coupons.php
rename to app/code/Mage/Adminhtml/Block/Report/Sales/Coupons.php
diff --git a/app/code/Mage/Adminhtml/Block/Report/Sales/Coupons/Grid.php b/app/code/Mage/Adminhtml/Block/Report/Sales/Coupons/Grid.php
new file mode 100644
index 0000000000000..1ee65bb3b2ea4
--- /dev/null
+++ b/app/code/Mage/Adminhtml/Block/Report/Sales/Coupons/Grid.php
@@ -0,0 +1,198 @@
+
+ */
+class Mage_Adminhtml_Block_Report_Sales_Coupons_Grid extends Mage_Adminhtml_Block_Report_Grid_Abstract
+{
+ protected $_columnGroupBy = 'period';
+
+ protected function _construct()
+ {
+ parent::_construct();
+ $this->setCountTotals(true);
+ $this->setCountSubTotals(true);
+ }
+
+ public function getResourceCollectionName()
+ {
+ if (($this->getFilterData()->getData('report_type') == 'updated_at_order')) {
+ return 'Mage_SalesRule_Model_Resource_Report_Updatedat_Collection';
+ } else {
+ return 'Mage_SalesRule_Model_Resource_Report_Collection';
+ }
+ }
+
+ protected function _prepareColumns()
+ {
+ $this->addColumn('period', array(
+ 'header' => Mage::helper('Mage_SalesRule_Helper_Data')->__('Period'),
+ 'index' => 'period',
+ 'sortable' => false,
+ 'period_type' => $this->getPeriodType(),
+ 'renderer' => 'Mage_Adminhtml_Block_Report_Sales_Grid_Column_Renderer_Date',
+ 'totals_label' => Mage::helper('Mage_SalesRule_Helper_Data')->__('Total'),
+ 'subtotals_label' => Mage::helper('Mage_SalesRule_Helper_Data')->__('Subtotal'),
+ 'html_decorators' => array('nobr'),
+ 'header_css_class' => 'col-period',
+ 'column_css_class' => 'col-period'
+ ));
+
+ $this->addColumn('coupon_code', array(
+ 'header' => Mage::helper('Mage_SalesRule_Helper_Data')->__('Coupon Code'),
+ 'sortable' => false,
+ 'index' => 'coupon_code',
+ 'header_css_class' => 'col-code',
+ 'column_css_class' => 'col-code'
+ ));
+
+ $this->addColumn('rule_name', array(
+ 'header' => Mage::helper('Mage_SalesRule_Helper_Data')->__('Shopping Cart Price Rule'),
+ 'sortable' => false,
+ 'index' => 'rule_name',
+ 'header_css_class' => 'col-rule',
+ 'column_css_class' => 'col-rule'
+ ));
+
+ $this->addColumn('coupon_uses', array(
+ 'header' => Mage::helper('Mage_SalesRule_Helper_Data')->__('Number of Uses'),
+ 'sortable' => false,
+ 'index' => 'coupon_uses',
+ 'total' => 'sum',
+ 'type' => 'number',
+ 'header_css_class' => 'col-users',
+ 'column_css_class' => 'col-users'
+ ));
+
+ if ($this->getFilterData()->getStoreIds()) {
+ $this->setStoreIds(explode(',', $this->getFilterData()->getStoreIds()));
+ }
+ $currencyCode = $this->getCurrentCurrencyCode();
+ $rate = $this->getRate($currencyCode);
+
+ $this->addColumn('subtotal_amount', array(
+ 'header' => Mage::helper('Mage_SalesRule_Helper_Data')->__('Sales Subtotal Amount'),
+ 'sortable' => false,
+ 'type' => 'currency',
+ 'currency_code' => $currencyCode,
+ 'total' => 'sum',
+ 'index' => 'subtotal_amount',
+ 'rate' => $rate,
+ 'header_css_class' => 'col-sales',
+ 'column_css_class' => 'col-sales'
+ ));
+
+ $this->addColumn('discount_amount', array(
+ 'header' => Mage::helper('Mage_SalesRule_Helper_Data')->__('Sales Discount Amount'),
+ 'sortable' => false,
+ 'type' => 'currency',
+ 'currency_code' => $currencyCode,
+ 'total' => 'sum',
+ 'index' => 'discount_amount',
+ 'rate' => $rate,
+ 'header_css_class' => 'col-sales-discount',
+ 'column_css_class' => 'col-sales-discount'
+ ));
+
+ $this->addColumn('total_amount', array(
+ 'header' => Mage::helper('Mage_SalesRule_Helper_Data')->__('Sales Total Amount'),
+ 'sortable' => false,
+ 'type' => 'currency',
+ 'currency_code' => $currencyCode,
+ 'total' => 'sum',
+ 'index' => 'total_amount',
+ 'rate' => $rate,
+ 'header_css_class' => 'col-total-amount',
+ 'column_css_class' => 'col-total-amount'
+ ));
+
+ $this->addColumn('subtotal_amount_actual', array(
+ 'header' => Mage::helper('Mage_SalesRule_Helper_Data')->__('Subtotal Amount'),
+ 'sortable' => false,
+ 'type' => 'currency',
+ 'currency_code' => $currencyCode,
+ 'total' => 'sum',
+ 'index' => 'subtotal_amount_actual',
+ 'rate' => $rate,
+ 'header_css_class' => 'col-subtotal',
+ 'column_css_class' => 'col-subtotal'
+ ));
+
+ $this->addColumn('discount_amount_actual', array(
+ 'header' => Mage::helper('Mage_SalesRule_Helper_Data')->__('Discount Amount'),
+ 'sortable' => false,
+ 'type' => 'currency',
+ 'currency_code' => $currencyCode,
+ 'total' => 'sum',
+ 'index' => 'discount_amount_actual',
+ 'rate' => $rate,
+ 'header_css_class' => 'col-discount',
+ 'column_css_class' => 'col-discount'
+ ));
+
+ $this->addColumn('total_amount_actual', array(
+ 'header' => Mage::helper('Mage_SalesRule_Helper_Data')->__('Total Amount'),
+ 'sortable' => false,
+ 'type' => 'currency',
+ 'currency_code' => $currencyCode,
+ 'total' => 'sum',
+ 'index' => 'total_amount_actual',
+ 'rate' => $rate,
+ 'header_css_class' => 'col-total',
+ 'column_css_class' => 'col-total'
+ ));
+
+ $this->addExportType('*/*/exportCouponsCsv', Mage::helper('Mage_Adminhtml_Helper_Data')->__('CSV'));
+ $this->addExportType('*/*/exportCouponsExcel', Mage::helper('Mage_Adminhtml_Helper_Data')->__('Excel XML'));
+
+ return parent::_prepareColumns();
+ }
+
+ /**
+ * Add price rule filter
+ *
+ * @param Mage_Reports_Model_Resource_Report_Collection_Abstract $collection
+ * @param Varien_Object $filterData
+ * @return Mage_Adminhtml_Block_Report_Grid_Abstract
+ */
+ protected function _addCustomFilter($collection, $filterData)
+ {
+ if ($filterData->getPriceRuleType()) {
+ $rulesList = $filterData->getData('rules_list');
+ if (isset($rulesList[0])) {
+ $rulesIds = explode(',', $rulesList[0]);
+ $collection->addRuleFilter($rulesIds);
+ }
+ }
+
+ return parent::_addCustomFilter($filterData, $collection);
+ }
+}
diff --git a/app/code/core/Mage/Adminhtml/Block/Report/Sales/Grid/Column/Renderer/Date.php b/app/code/Mage/Adminhtml/Block/Report/Sales/Grid/Column/Renderer/Date.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Report/Sales/Grid/Column/Renderer/Date.php
rename to app/code/Mage/Adminhtml/Block/Report/Sales/Grid/Column/Renderer/Date.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Report/Sales/Invoiced.php b/app/code/Mage/Adminhtml/Block/Report/Sales/Invoiced.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Report/Sales/Invoiced.php
rename to app/code/Mage/Adminhtml/Block/Report/Sales/Invoiced.php
diff --git a/app/code/Mage/Adminhtml/Block/Report/Sales/Invoiced/Grid.php b/app/code/Mage/Adminhtml/Block/Report/Sales/Invoiced/Grid.php
new file mode 100644
index 0000000000000..646a9bf726fb5
--- /dev/null
+++ b/app/code/Mage/Adminhtml/Block/Report/Sales/Invoiced/Grid.php
@@ -0,0 +1,132 @@
+
+ */
+class Mage_Adminhtml_Block_Report_Sales_Invoiced_Grid extends Mage_Adminhtml_Block_Report_Grid_Abstract
+{
+ protected $_columnGroupBy = 'period';
+
+ protected function _construct()
+ {
+ parent::_construct();
+ $this->setCountTotals(true);
+ }
+
+ public function getResourceCollectionName()
+ {
+ return ($this->getFilterData()->getData('report_type') == 'created_at_invoice')
+ ? 'Mage_Sales_Model_Resource_Report_Invoiced_Collection_Invoiced'
+ : 'Mage_Sales_Model_Resource_Report_Invoiced_Collection_Order';
+ }
+
+ protected function _prepareColumns()
+ {
+ $this->addColumn('period', array(
+ 'header' => Mage::helper('Mage_Sales_Helper_Data')->__('Period'),
+ 'index' => 'period',
+ 'sortable' => false,
+ 'period_type' => $this->getPeriodType(),
+ 'renderer' => 'Mage_Adminhtml_Block_Report_Sales_Grid_Column_Renderer_Date',
+ 'totals_label' => Mage::helper('Mage_Sales_Helper_Data')->__('Total'),
+ 'html_decorators' => array('nobr'),
+ 'header_css_class' => 'col-period',
+ 'column_css_class' => 'col-period'
+ ));
+
+ $this->addColumn('orders_count', array(
+ 'header' => Mage::helper('Mage_Sales_Helper_Data')->__('Number of Orders'),
+ 'index' => 'orders_count',
+ 'type' => 'number',
+ 'total' => 'sum',
+ 'sortable' => false,
+ 'header_css_class' => 'col-qty',
+ 'column_css_class' => 'col-qty'
+ ));
+
+ $this->addColumn('orders_invoiced', array(
+ 'header' => Mage::helper('Mage_Sales_Helper_Data')->__('Number of Invoiced Orders'),
+ 'index' => 'orders_invoiced',
+ 'type' => 'number',
+ 'total' => 'sum',
+ 'sortable' => false,
+ 'header_css_class' => 'col-invoiced',
+ 'column_css_class' => 'col-invoiced'
+ ));
+
+ if ($this->getFilterData()->getStoreIds()) {
+ $this->setStoreIds(explode(',', $this->getFilterData()->getStoreIds()));
+ }
+ $currencyCode = $this->getCurrentCurrencyCode();
+ $rate = $this->getRate($currencyCode);
+
+ $this->addColumn('invoiced', array(
+ 'header' => Mage::helper('Mage_Sales_Helper_Data')->__('Total Invoiced'),
+ 'type' => 'currency',
+ 'currency_code' => $currencyCode,
+ 'index' => 'invoiced',
+ 'total' => 'sum',
+ 'sortable' => false,
+ 'rate' => $rate,
+ 'header_css_class' => 'col-total-invoiced',
+ 'column_css_class' => 'col-total-invoiced'
+ ));
+
+ $this->addColumn('invoiced_captured', array(
+ 'header' => Mage::helper('Mage_Sales_Helper_Data')->__('Total Invoiced Paid'),
+ 'type' => 'currency',
+ 'currency_code' => $currencyCode,
+ 'index' => 'invoiced_captured',
+ 'total' => 'sum',
+ 'sortable' => false,
+ 'rate' => $rate,
+ 'header_css_class' => 'col-total-invoiced-paid',
+ 'column_css_class' => 'col-total-invoiced-paid'
+ ));
+
+ $this->addColumn('invoiced_not_captured', array(
+ 'header' => Mage::helper('Mage_Sales_Helper_Data')->__('Total Invoiced not Paid'),
+ 'type' => 'currency',
+ 'currency_code' => $currencyCode,
+ 'index' => 'invoiced_not_captured',
+ 'total' => 'sum',
+ 'sortable' => false,
+ 'rate' => $rate,
+ 'header_css_class' => 'col-total-invoiced-not-paid',
+ 'column_css_class' => 'col-total-invoiced-not-paid'
+ ));
+
+ $this->addExportType('*/*/exportInvoicedCsv', Mage::helper('Mage_Adminhtml_Helper_Data')->__('CSV'));
+ $this->addExportType('*/*/exportInvoicedExcel', Mage::helper('Mage_Adminhtml_Helper_Data')->__('Excel XML'));
+
+ return parent::_prepareColumns();
+ }
+}
diff --git a/app/code/core/Mage/Adminhtml/Block/Report/Sales/Refunded.php b/app/code/Mage/Adminhtml/Block/Report/Sales/Refunded.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Report/Sales/Refunded.php
rename to app/code/Mage/Adminhtml/Block/Report/Sales/Refunded.php
diff --git a/app/code/Mage/Adminhtml/Block/Report/Sales/Refunded/Grid.php b/app/code/Mage/Adminhtml/Block/Report/Sales/Refunded/Grid.php
new file mode 100644
index 0000000000000..85a214d9e42e0
--- /dev/null
+++ b/app/code/Mage/Adminhtml/Block/Report/Sales/Refunded/Grid.php
@@ -0,0 +1,122 @@
+
+ */
+class Mage_Adminhtml_Block_Report_Sales_Refunded_Grid extends Mage_Adminhtml_Block_Report_Grid_Abstract
+{
+ protected $_columnGroupBy = 'period';
+
+ protected function _construct()
+ {
+ parent::_construct();
+ $this->setCountTotals(true);
+ }
+
+ public function getResourceCollectionName()
+ {
+ return ($this->getFilterData()->getData('report_type') == 'created_at_refunded')
+ ? 'Mage_Sales_Model_Resource_Report_Refunded_Collection_Refunded'
+ : 'Mage_Sales_Model_Resource_Report_Refunded_Collection_Order';
+ }
+
+ protected function _prepareColumns()
+ {
+ $this->addColumn('period', array(
+ 'header' => Mage::helper('Mage_Sales_Helper_Data')->__('Period'),
+ 'index' => 'period',
+ 'sortable' => false,
+ 'period_type' => $this->getPeriodType(),
+ 'renderer' => 'Mage_Adminhtml_Block_Report_Sales_Grid_Column_Renderer_Date',
+ 'totals_label' => Mage::helper('Mage_Sales_Helper_Data')->__('Total'),
+ 'html_decorators' => array('nobr'),
+ 'header_css_class' => 'col-period',
+ 'column_css_class' => 'col-period'
+ ));
+
+ $this->addColumn('orders_count', array(
+ 'header' => Mage::helper('Mage_Sales_Helper_Data')->__('Number of Refunded Orders'),
+ 'index' => 'orders_count',
+ 'type' => 'number',
+ 'total' => 'sum',
+ 'sortable' => false,
+ 'header_css_class' => 'col-qty',
+ 'column_css_class' => 'col-qty'
+ ));
+
+ if ($this->getFilterData()->getStoreIds()) {
+ $this->setStoreIds(explode(',', $this->getFilterData()->getStoreIds()));
+ }
+ $currencyCode = $this->getCurrentCurrencyCode();
+ $rate = $this->getRate($currencyCode);
+
+ $this->addColumn('refunded', array(
+ 'header' => Mage::helper('Mage_Sales_Helper_Data')->__('Total Refunded'),
+ 'type' => 'currency',
+ 'currency_code' => $currencyCode,
+ 'index' => 'refunded',
+ 'total' => 'sum',
+ 'sortable' => false,
+ 'rate' => $rate,
+ 'header_css_class' => 'col-ref-total',
+ 'column_css_class' => 'col-ref-total'
+ ));
+
+ $this->addColumn('online_refunded', array(
+ 'header' => Mage::helper('Mage_Sales_Helper_Data')->__('Online Refunded'),
+ 'type' => 'currency',
+ 'currency_code' => $currencyCode,
+ 'index' => 'online_refunded',
+ 'total' => 'sum',
+ 'sortable' => false,
+ 'rate' => $rate,
+ 'header_css_class' => 'col-ref-online',
+ 'column_css_class' => 'col-ref-online'
+ ));
+
+ $this->addColumn('offline_refunded', array(
+ 'header' => Mage::helper('Mage_Sales_Helper_Data')->__('Offline Refunded'),
+ 'type' => 'currency',
+ 'currency_code' => $currencyCode,
+ 'index' => 'offline_refunded',
+ 'total' => 'sum',
+ 'sortable' => false,
+ 'rate' => $rate,
+ 'header_css_class' => 'col-ref-offline',
+ 'column_css_class' => 'col-ref-offline'
+ ));
+
+ $this->addExportType('*/*/exportRefundedCsv', Mage::helper('Mage_Adminhtml_Helper_Data')->__('CSV'));
+ $this->addExportType('*/*/exportRefundedExcel', Mage::helper('Mage_Adminhtml_Helper_Data')->__('Excel XML'));
+
+ return parent::_prepareColumns();
+ }
+}
diff --git a/app/code/core/Mage/Adminhtml/Block/Report/Sales/Sales.php b/app/code/Mage/Adminhtml/Block/Report/Sales/Sales.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Report/Sales/Sales.php
rename to app/code/Mage/Adminhtml/Block/Report/Sales/Sales.php
diff --git a/app/code/Mage/Adminhtml/Block/Report/Sales/Sales/Grid.php b/app/code/Mage/Adminhtml/Block/Report/Sales/Sales/Grid.php
new file mode 100644
index 0000000000000..c9f7ec8dbc8f4
--- /dev/null
+++ b/app/code/Mage/Adminhtml/Block/Report/Sales/Sales/Grid.php
@@ -0,0 +1,270 @@
+
+ */
+class Mage_Adminhtml_Block_Report_Sales_Sales_Grid extends Mage_Adminhtml_Block_Report_Grid_Abstract
+{
+ protected $_columnGroupBy = 'period';
+
+ protected function _construct()
+ {
+ parent::_construct();
+ $this->setCountTotals(true);
+ }
+
+ public function getResourceCollectionName()
+ {
+ return ($this->getFilterData()->getData('report_type') == 'updated_at_order')
+ ? 'Mage_Sales_Model_Resource_Report_Order_Updatedat_Collection'
+ : 'Mage_Sales_Model_Resource_Report_Order_Collection';
+ }
+
+ protected function _prepareColumns()
+ {
+ $this->addColumn('period', array(
+ 'header' => Mage::helper('Mage_Sales_Helper_Data')->__('Period'),
+ 'index' => 'period',
+ 'sortable' => false,
+ 'period_type' => $this->getPeriodType(),
+ 'renderer' => 'Mage_Adminhtml_Block_Report_Sales_Grid_Column_Renderer_Date',
+ 'totals_label' => Mage::helper('Mage_Sales_Helper_Data')->__('Total'),
+ 'html_decorators' => array('nobr'),
+ 'header_css_class' => 'col-period',
+ 'column_css_class' => 'col-period'
+ ));
+
+ $this->addColumn('orders_count', array(
+ 'header' => Mage::helper('Mage_Sales_Helper_Data')->__('Orders'),
+ 'index' => 'orders_count',
+ 'type' => 'number',
+ 'total' => 'sum',
+ 'sortable' => false,
+ 'header_css_class' => 'col-orders',
+ 'column_css_class' => 'col-orders'
+ ));
+
+ $this->addColumn('total_qty_ordered', array(
+ 'header' => Mage::helper('Mage_Sales_Helper_Data')->__('Sales Items'),
+ 'index' => 'total_qty_ordered',
+ 'type' => 'number',
+ 'total' => 'sum',
+ 'sortable' => false,
+ 'header_css_class' => 'col-sales-items',
+ 'column_css_class' => 'col-sales-items'
+ ));
+
+ $this->addColumn('total_qty_invoiced', array(
+ 'header' => Mage::helper('Mage_Sales_Helper_Data')->__('Items'),
+ 'index' => 'total_qty_invoiced',
+ 'type' => 'number',
+ 'total' => 'sum',
+ 'sortable' => false,
+ 'visibility_filter' => array('show_actual_columns'),
+ 'header_css_class' => 'col-items',
+ 'column_css_class' => 'col-items'
+ ));
+
+ if ($this->getFilterData()->getStoreIds()) {
+ $this->setStoreIds(explode(',', $this->getFilterData()->getStoreIds()));
+ }
+ $currencyCode = $this->getCurrentCurrencyCode();
+ $rate = $this->getRate($currencyCode);
+
+ $this->addColumn('total_income_amount', array(
+ 'header' => Mage::helper('Mage_Sales_Helper_Data')->__('Sales Total'),
+ 'type' => 'currency',
+ 'currency_code' => $currencyCode,
+ 'index' => 'total_income_amount',
+ 'total' => 'sum',
+ 'sortable' => false,
+ 'rate' => $rate,
+ 'header_css_class' => 'col-sales-total',
+ 'column_css_class' => 'col-sales-total'
+ ));
+
+ $this->addColumn('total_revenue_amount', array(
+ 'header' => Mage::helper('Mage_Sales_Helper_Data')->__('Revenue'),
+ 'type' => 'currency',
+ 'currency_code' => $currencyCode,
+ 'index' => 'total_revenue_amount',
+ 'total' => 'sum',
+ 'sortable' => false,
+ 'visibility_filter' => array('show_actual_columns'),
+ 'rate' => $rate,
+ 'header_css_class' => 'col-revenue',
+ 'column_css_class' => 'col-revenue'
+ ));
+
+ $this->addColumn('total_profit_amount', array(
+ 'header' => Mage::helper('Mage_Sales_Helper_Data')->__('Profit'),
+ 'type' => 'currency',
+ 'currency_code' => $currencyCode,
+ 'index' => 'total_profit_amount',
+ 'total' => 'sum',
+ 'sortable' => false,
+ 'visibility_filter' => array('show_actual_columns'),
+ 'rate' => $rate,
+ 'header_css_class' => 'col-profit',
+ 'column_css_class' => 'col-profit'
+ ));
+
+ $this->addColumn('total_invoiced_amount', array(
+ 'header' => Mage::helper('Mage_Sales_Helper_Data')->__('Invoiced'),
+ 'type' => 'currency',
+ 'currency_code' => $currencyCode,
+ 'index' => 'total_invoiced_amount',
+ 'total' => 'sum',
+ 'sortable' => false,
+ 'rate' => $rate,
+ 'header_css_class' => 'col-invoiced',
+ 'column_css_class' => 'col-invoiced'
+ ));
+
+ $this->addColumn('total_paid_amount', array(
+ 'header' => Mage::helper('Mage_Sales_Helper_Data')->__('Paid'),
+ 'type' => 'currency',
+ 'currency_code' => $currencyCode,
+ 'index' => 'total_paid_amount',
+ 'total' => 'sum',
+ 'sortable' => false,
+ 'visibility_filter' => array('show_actual_columns'),
+ 'rate' => $rate,
+ 'header_css_class' => 'col-paid',
+ 'column_css_class' => 'col-paid'
+ ));
+
+ $this->addColumn('total_refunded_amount', array(
+ 'header' => Mage::helper('Mage_Sales_Helper_Data')->__('Refunded'),
+ 'type' => 'currency',
+ 'currency_code' => $currencyCode,
+ 'index' => 'total_refunded_amount',
+ 'total' => 'sum',
+ 'sortable' => false,
+ 'rate' => $rate,
+ 'header_css_class' => 'col-refunded',
+ 'column_css_class' => 'col-refunded'
+ ));
+
+ $this->addColumn('total_tax_amount', array(
+ 'header' => Mage::helper('Mage_Sales_Helper_Data')->__('Sales Tax'),
+ 'type' => 'currency',
+ 'currency_code' => $currencyCode,
+ 'index' => 'total_tax_amount',
+ 'total' => 'sum',
+ 'sortable' => false,
+ 'rate' => $rate,
+ 'header_css_class' => 'col-sales-tax',
+ 'column_css_class' => 'col-sales-tax'
+ ));
+
+ $this->addColumn('total_tax_amount_actual', array(
+ 'header' => Mage::helper('Mage_Sales_Helper_Data')->__('Tax'),
+ 'type' => 'currency',
+ 'currency_code' => $currencyCode,
+ 'index' => 'total_tax_amount_actual',
+ 'total' => 'sum',
+ 'sortable' => false,
+ 'visibility_filter' => array('show_actual_columns'),
+ 'rate' => $rate,
+ 'header_css_class' => 'col-tax',
+ 'column_css_class' => 'col-tax'
+ ));
+
+ $this->addColumn('total_shipping_amount', array(
+ 'header' => Mage::helper('Mage_Sales_Helper_Data')->__('Sales Shipping'),
+ 'type' => 'currency',
+ 'currency_code' => $currencyCode,
+ 'index' => 'total_shipping_amount',
+ 'total' => 'sum',
+ 'sortable' => false,
+ 'rate' => $rate,
+ 'header_css_class' => 'col-sales-shipping',
+ 'column_css_class' => 'col-sales-shipping'
+ ));
+
+ $this->addColumn('total_shipping_amount_actual', array(
+ 'header' => Mage::helper('Mage_Sales_Helper_Data')->__('Shipping'),
+ 'type' => 'currency',
+ 'currency_code' => $currencyCode,
+ 'index' => 'total_shipping_amount_actual',
+ 'total' => 'sum',
+ 'sortable' => false,
+ 'visibility_filter' => array('show_actual_columns'),
+ 'rate' => $rate,
+ 'header_css_class' => 'col-shipping',
+ 'column_css_class' => 'col-shipping'
+ ));
+
+ $this->addColumn('total_discount_amount', array(
+ 'header' => Mage::helper('Mage_Sales_Helper_Data')->__('Sales Discount'),
+ 'type' => 'currency',
+ 'currency_code' => $currencyCode,
+ 'index' => 'total_discount_amount',
+ 'total' => 'sum',
+ 'sortable' => false,
+ 'rate' => $rate,
+ 'header_css_class' => 'col-sales-discount',
+ 'column_css_class' => 'col-sales-discount'
+ ));
+
+ $this->addColumn('total_discount_amount_actual', array(
+ 'header' => Mage::helper('Mage_Sales_Helper_Data')->__('Discount'),
+ 'type' => 'currency',
+ 'currency_code' => $currencyCode,
+ 'index' => 'total_discount_amount_actual',
+ 'total' => 'sum',
+ 'sortable' => false,
+ 'visibility_filter' => array('show_actual_columns'),
+ 'rate' => $rate,
+ 'header_css_class' => 'col-discount',
+ 'column_css_class' => 'col-discount'
+ ));
+
+ $this->addColumn('total_canceled_amount', array(
+ 'header' => Mage::helper('Mage_Sales_Helper_Data')->__('Canceled'),
+ 'type' => 'currency',
+ 'currency_code' => $currencyCode,
+ 'index' => 'total_canceled_amount',
+ 'total' => 'sum',
+ 'sortable' => false,
+ 'rate' => $rate,
+ 'header_css_class' => 'col-canceled',
+ 'column_css_class' => 'col-canceled'
+ ));
+
+
+ $this->addExportType('*/*/exportSalesCsv', Mage::helper('Mage_Adminhtml_Helper_Data')->__('CSV'));
+ $this->addExportType('*/*/exportSalesExcel', Mage::helper('Mage_Adminhtml_Helper_Data')->__('Excel XML'));
+
+ return parent::_prepareColumns();
+ }
+}
diff --git a/app/code/core/Mage/Adminhtml/Block/Report/Sales/Shipping.php b/app/code/Mage/Adminhtml/Block/Report/Sales/Shipping.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Report/Sales/Shipping.php
rename to app/code/Mage/Adminhtml/Block/Report/Sales/Shipping.php
diff --git a/app/code/Mage/Adminhtml/Block/Report/Sales/Shipping/Grid.php b/app/code/Mage/Adminhtml/Block/Report/Sales/Shipping/Grid.php
new file mode 100644
index 0000000000000..1f4b5edda756e
--- /dev/null
+++ b/app/code/Mage/Adminhtml/Block/Report/Sales/Shipping/Grid.php
@@ -0,0 +1,124 @@
+
+ */
+class Mage_Adminhtml_Block_Report_Sales_Shipping_Grid extends Mage_Adminhtml_Block_Report_Grid_Abstract
+{
+ protected $_columnGroupBy = 'period';
+
+ protected function _construct()
+ {
+ parent::_construct();
+ $this->setCountTotals(true);
+ $this->setCountSubTotals(true);
+ }
+
+ public function getResourceCollectionName()
+ {
+ return ($this->getFilterData()->getData('report_type') == 'created_at_shipment')
+ ? 'Mage_Sales_Model_Resource_Report_Shipping_Collection_Shipment'
+ : 'Mage_Sales_Model_Resource_Report_Shipping_Collection_Order';
+ }
+
+ protected function _prepareColumns()
+ {
+ $this->addColumn('period', array(
+ 'header' => Mage::helper('Mage_Sales_Helper_Data')->__('Period'),
+ 'index' => 'period',
+ 'sortable' => false,
+ 'period_type' => $this->getPeriodType(),
+ 'renderer' => 'Mage_Adminhtml_Block_Report_Sales_Grid_Column_Renderer_Date',
+ 'totals_label' => Mage::helper('Mage_Sales_Helper_Data')->__('Total'),
+ 'subtotals_label' => Mage::helper('Mage_Sales_Helper_Data')->__('Subtotal'),
+ 'html_decorators' => array('nobr'),
+ 'header_css_class' => 'col-period',
+ 'column_css_class' => 'col-period'
+ ));
+
+ $this->addColumn('shipping_description', array(
+ 'header' => Mage::helper('Mage_Sales_Helper_Data')->__('Carrier/Method'),
+ 'index' => 'shipping_description',
+ 'sortable' => false,
+ 'header_css_class' => 'col-method',
+ 'column_css_class' => 'col-method'
+ ));
+
+ $this->addColumn('orders_count', array(
+ 'header' => Mage::helper('Mage_Sales_Helper_Data')->__('Number of Orders'),
+ 'index' => 'orders_count',
+ 'total' => 'sum',
+ 'type' => 'number',
+ 'sortable' => false,
+ 'header_css_class' => 'col-qty',
+ 'column_css_class' => 'col-qty'
+ ));
+
+ if ($this->getFilterData()->getStoreIds()) {
+ $this->setStoreIds(explode(',', $this->getFilterData()->getStoreIds()));
+ }
+
+ $currencyCode = $this->getCurrentCurrencyCode();
+ $rate = $this->getRate($currencyCode);
+
+ $this->addColumn('total_shipping', array(
+ 'header' => Mage::helper('Mage_Sales_Helper_Data')->__('Total Sales Shipping'),
+ 'type' => 'currency',
+ 'currency_code' => $currencyCode,
+ 'index' => 'total_shipping',
+ 'total' => 'sum',
+ 'sortable' => false,
+ 'rate' => $rate,
+ 'header_css_class' => 'col-total-sales-shipping',
+ 'column_css_class' => 'col-total-sales-shipping'
+ ));
+
+ $this->addColumn('total_shipping_actual', array(
+ 'header' => Mage::helper('Mage_Sales_Helper_Data')->__('Total Shipping'),
+ 'type' => 'currency',
+ 'currency_code' => $currencyCode,
+ 'index' => 'total_shipping_actual',
+ 'total' => 'sum',
+ 'sortable' => false,
+ 'rate' => $rate,
+ 'header_css_class' => 'col-total-shipping',
+ 'column_css_class' => 'col-total-shipping'
+ ));
+
+ $this->addExportType('*/*/exportShippingCsv', Mage::helper('Mage_Adminhtml_Helper_Data')->__('CSV'));
+ $this->addExportType('*/*/exportShippingExcel', Mage::helper('Mage_Adminhtml_Helper_Data')->__('Excel XML'));
+
+ return parent::_prepareColumns();
+ }
+}
+
+
+
diff --git a/app/code/core/Mage/Adminhtml/Block/Report/Sales/Tax.php b/app/code/Mage/Adminhtml/Block/Report/Sales/Tax.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Report/Sales/Tax.php
rename to app/code/Mage/Adminhtml/Block/Report/Sales/Tax.php
diff --git a/app/code/Mage/Adminhtml/Block/Report/Sales/Tax/Grid.php b/app/code/Mage/Adminhtml/Block/Report/Sales/Tax/Grid.php
new file mode 100644
index 0000000000000..69fb25689d1a6
--- /dev/null
+++ b/app/code/Mage/Adminhtml/Block/Report/Sales/Tax/Grid.php
@@ -0,0 +1,140 @@
+
+ */
+class Mage_Adminhtml_Block_Report_Sales_Tax_Grid extends Mage_Adminhtml_Block_Report_Grid_Abstract
+{
+ protected $_columnGroupBy = 'period';
+
+ protected function _construct()
+ {
+ parent::_construct();
+ $this->setCountTotals(true);
+ $this->setCountSubTotals(true);
+ }
+
+ public function getResourceCollectionName()
+ {
+ return ($this->getFilterData()->getData('report_type') == 'updated_at_order')
+ ? 'Mage_Tax_Model_Resource_Report_Updatedat_Collection'
+ : 'Mage_Tax_Model_Resource_Report_Collection';
+ }
+
+ protected function _prepareColumns()
+ {
+ $this->addColumn('period', array(
+ 'header' => Mage::helper('Mage_Sales_Helper_Data')->__('Period'),
+ 'index' => 'period',
+ 'sortable' => false,
+ 'period_type' => $this->getPeriodType(),
+ 'renderer' => 'Mage_Adminhtml_Block_Report_Sales_Grid_Column_Renderer_Date',
+ 'totals_label' => Mage::helper('Mage_Sales_Helper_Data')->__('Total'),
+ 'subtotals_label' => Mage::helper('Mage_Sales_Helper_Data')->__('Subtotal'),
+ 'html_decorators' => array('nobr'),
+ 'header_css_class' => 'col-period',
+ 'column_css_class' => 'col-period'
+ ));
+
+ $this->addColumn('code', array(
+ 'header' => Mage::helper('Mage_Sales_Helper_Data')->__('Tax'),
+ 'index' => 'code',
+ 'type' => 'string',
+ 'sortable' => false,
+ 'header_css_class' => 'col-tax-name',
+ 'column_css_class' => 'col-tax-name'
+ ));
+
+ $this->addColumn('percent', array(
+ 'header' => Mage::helper('Mage_Sales_Helper_Data')->__('Rate'),
+ 'index' => 'percent',
+ 'type' => 'number',
+ 'sortable' => false,
+ 'header_css_class' => 'col-rate',
+ 'column_css_class' => 'col-rate'
+ ));
+
+ $this->addColumn('orders_count', array(
+ 'header' => Mage::helper('Mage_Sales_Helper_Data')->__('Number of Orders'),
+ 'index' => 'orders_count',
+ 'total' => 'sum',
+ 'type' => 'number',
+ 'sortable' => false,
+ 'header_css_class' => 'col-qty',
+ 'column_css_class' => 'col-qty'
+ ));
+
+ if ($this->getFilterData()->getStoreIds()) {
+ $this->setStoreIds(explode(',', $this->getFilterData()->getStoreIds()));
+ }
+ $currencyCode = $this->getCurrentCurrencyCode();
+
+ $this->addColumn('tax_base_amount_sum', array(
+ 'header' => Mage::helper('Mage_Sales_Helper_Data')->__('Tax Amount'),
+ 'type' => 'currency',
+ 'currency_code' => $currencyCode,
+ 'index' => 'tax_base_amount_sum',
+ 'total' => 'sum',
+ 'sortable' => false,
+ 'rate' => $this->getRate($currencyCode),
+ 'header_css_class' => 'col-tax-amount',
+ 'column_css_class' => 'col-tax-amount'
+ ));
+
+ $this->addExportType('*/*/exportTaxCsv', Mage::helper('Mage_Adminhtml_Helper_Data')->__('CSV'));
+ $this->addExportType('*/*/exportTaxExcel', Mage::helper('Mage_Adminhtml_Helper_Data')->__('Excel XML'));
+
+ return parent::_prepareColumns();
+ }
+
+ /**
+ * Preparing collection
+ * Filter canceled statuses for orders in taxes
+ *
+ *@return Mage_Adminhtml_Block_Report_Sales_Tax_Grid
+ */
+ protected function _prepareCollection()
+ {
+ $filterData = $this->getFilterData();
+ if(!$filterData->hasData('order_statuses')) {
+ $orderConfig = Mage::getModel('Mage_Sales_Model_Order_Config');
+ $statusValues = array();
+ $canceledStatuses = $orderConfig->getStateStatuses(Mage_Sales_Model_Order::STATE_CANCELED);
+ foreach ($orderConfig->getStatuses() as $code => $label) {
+ if (!isset($canceledStatuses[$code])) {
+ $statusValues[] = $code;
+ }
+ }
+ $filterData->setOrderStatuses($statusValues);
+ }
+ return parent::_prepareCollection();
+ }
+}
diff --git a/app/code/core/Mage/Adminhtml/Block/Report/Search.php b/app/code/Mage/Adminhtml/Block/Report/Search.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Report/Search.php
rename to app/code/Mage/Adminhtml/Block/Report/Search.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Report/Shopcart/Abandoned.php b/app/code/Mage/Adminhtml/Block/Report/Shopcart/Abandoned.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Report/Shopcart/Abandoned.php
rename to app/code/Mage/Adminhtml/Block/Report/Shopcart/Abandoned.php
diff --git a/app/code/Mage/Adminhtml/Block/Report/Shopcart/Abandoned/Grid.php b/app/code/Mage/Adminhtml/Block/Report/Shopcart/Abandoned/Grid.php
new file mode 100644
index 0000000000000..e217ed61baaa2
--- /dev/null
+++ b/app/code/Mage/Adminhtml/Block/Report/Shopcart/Abandoned/Grid.php
@@ -0,0 +1,183 @@
+
+ */
+class Mage_Adminhtml_Block_Report_Shopcart_Abandoned_Grid extends Mage_Adminhtml_Block_Report_Grid_Shopcart
+{
+
+ protected function _construct()
+ {
+ parent::_construct();
+ $this->setId('gridAbandoned');
+ }
+
+ protected function _prepareCollection()
+ {
+ /** @var $collection Mage_Reports_Model_Resource_Quote_Collection */
+ $collection = Mage::getResourceModel('Mage_Reports_Model_Resource_Quote_Collection');
+
+ $filter = $this->getParam($this->getVarNameFilter(), array());
+ if ($filter) {
+ $filter = base64_decode($filter);
+ parse_str(urldecode($filter), $data);
+ }
+
+ if (!empty($data)) {
+ $collection->prepareForAbandonedReport($this->_storeIds, $data);
+ } else {
+ $collection->prepareForAbandonedReport($this->_storeIds);
+ }
+
+ $this->setCollection($collection);
+ return parent::_prepareCollection();
+ }
+
+ protected function _addColumnFilterToCollection($column)
+ {
+ $field = ( $column->getFilterIndex() ) ? $column->getFilterIndex() : $column->getIndex();
+ $skip = array('subtotal', 'customer_name', 'email'/*, 'created_at', 'updated_at'*/);
+
+ if (in_array($field, $skip)) {
+ return $this;
+ }
+
+ parent::_addColumnFilterToCollection($column);
+ return $this;
+ }
+
+ protected function _prepareColumns()
+ {
+ $this->addColumn('customer_name', array(
+ 'header' => Mage::helper('Mage_Reports_Helper_Data')->__('Customer Name'),
+ 'index' => 'customer_name',
+ 'sortable' => false,
+ 'header_css_class' => 'col-name',
+ 'column_css_class' => 'col-name'
+ ));
+
+ $this->addColumn('email', array(
+ 'header' => Mage::helper('Mage_Reports_Helper_Data')->__('Email'),
+ 'index' => 'email',
+ 'sortable' => false,
+ 'header_css_class' => 'col-email',
+ 'column_css_class' => 'col-email'
+ ));
+
+ $this->addColumn('items_count', array(
+ 'header' => Mage::helper('Mage_Reports_Helper_Data')->__('Number of Items'),
+ 'index' => 'items_count',
+ 'sortable' => false,
+ 'type' => 'number',
+ 'header_css_class' => 'col-number',
+ 'column_css_class' => 'col-number'
+ ));
+
+ $this->addColumn('items_qty', array(
+ 'header' => Mage::helper('Mage_Reports_Helper_Data')->__('Quantity of Items'),
+ 'index' => 'items_qty',
+ 'sortable' => false,
+ 'type' => 'number',
+ 'header_css_class' => 'col-qty',
+ 'column_css_class' => 'col-qty'
+ ));
+
+ if ($this->getRequest()->getParam('website')) {
+ $storeIds = Mage::app()->getWebsite($this->getRequest()->getParam('website'))->getStoreIds();
+ } else if ($this->getRequest()->getParam('group')) {
+ $storeIds = Mage::app()->getGroup($this->getRequest()->getParam('group'))->getStoreIds();
+ } else if ($this->getRequest()->getParam('store')) {
+ $storeIds = array((int)$this->getRequest()->getParam('store'));
+ } else {
+ $storeIds = array();
+ }
+ $this->setStoreIds($storeIds);
+ $currencyCode = $this->getCurrentCurrencyCode();
+
+ $this->addColumn('subtotal', array(
+ 'header' => Mage::helper('Mage_Reports_Helper_Data')->__('Subtotal'),
+ 'type' => 'currency',
+ 'currency_code' => $currencyCode,
+ 'index' => 'subtotal',
+ 'sortable' => false,
+ 'renderer' => 'Mage_Adminhtml_Block_Report_Grid_Column_Renderer_Currency',
+ 'rate' => $this->getRate($currencyCode),
+ 'header_css_class' => 'col-subtotal',
+ 'column_css_class' => 'col-subtotal'
+ ));
+
+ $this->addColumn('coupon_code', array(
+ 'header' => Mage::helper('Mage_Reports_Helper_Data')->__('Applied Coupon'),
+ 'index' => 'coupon_code',
+ 'sortable' => false,
+ 'header_css_class' => 'col-coupon',
+ 'column_css_class' => 'col-coupon'
+ ));
+
+ $this->addColumn('created_at', array(
+ 'header' => Mage::helper('Mage_Reports_Helper_Data')->__('Created At'),
+ 'type' => 'datetime',
+ 'index' => 'created_at',
+ 'filter_index'=> 'main_table.created_at',
+ 'sortable' => false,
+ 'header_css_class' => 'col-created',
+ 'column_css_class' => 'col-created'
+ ));
+
+ $this->addColumn('updated_at', array(
+ 'header' => Mage::helper('Mage_Reports_Helper_Data')->__('Updated At'),
+ 'type' => 'datetime',
+ 'index' => 'updated_at',
+ 'filter_index'=> 'main_table.updated_at',
+ 'sortable' => false,
+ 'header_css_class' => 'col-updated',
+ 'column_css_class' => 'col-updated'
+ ));
+
+ $this->addColumn('remote_ip', array(
+ 'header' => Mage::helper('Mage_Reports_Helper_Data')->__('IP Address'),
+ 'index' => 'remote_ip',
+ 'sortable' => false,
+ 'header_css_class' => 'col-ip',
+ 'column_css_class' => 'col-ip'
+ ));
+
+ $this->addExportType('*/*/exportAbandonedCsv', Mage::helper('Mage_Reports_Helper_Data')->__('CSV'));
+ $this->addExportType('*/*/exportAbandonedExcel', Mage::helper('Mage_Reports_Helper_Data')->__('Excel XML'));
+
+ return parent::_prepareColumns();
+ }
+
+ public function getRowUrl($row)
+ {
+ return $this->getUrl('*/customer/edit', array('id'=>$row->getCustomerId(), 'active_tab'=>'cart'));
+ }
+}
diff --git a/app/code/core/Mage/Adminhtml/Block/Report/Shopcart/Customer.php b/app/code/Mage/Adminhtml/Block/Report/Shopcart/Customer.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Report/Shopcart/Customer.php
rename to app/code/Mage/Adminhtml/Block/Report/Shopcart/Customer.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Report/Shopcart/Customer/Grid.php b/app/code/Mage/Adminhtml/Block/Report/Shopcart/Customer/Grid.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Report/Shopcart/Customer/Grid.php
rename to app/code/Mage/Adminhtml/Block/Report/Shopcart/Customer/Grid.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Report/Shopcart/Product.php b/app/code/Mage/Adminhtml/Block/Report/Shopcart/Product.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Report/Shopcart/Product.php
rename to app/code/Mage/Adminhtml/Block/Report/Shopcart/Product.php
diff --git a/app/code/Mage/Adminhtml/Block/Report/Shopcart/Product/Grid.php b/app/code/Mage/Adminhtml/Block/Report/Shopcart/Product/Grid.php
new file mode 100644
index 0000000000000..06187cb4961c6
--- /dev/null
+++ b/app/code/Mage/Adminhtml/Block/Report/Shopcart/Product/Grid.php
@@ -0,0 +1,112 @@
+
+ */
+class Mage_Adminhtml_Block_Report_Shopcart_Product_Grid extends Mage_Adminhtml_Block_Report_Grid_Shopcart
+{
+
+ protected function _construct()
+ {
+ parent::_construct();
+ $this->setId('gridProducts');
+ }
+
+ protected function _prepareCollection()
+ {
+ /** @var $collection Mage_Reports_Model_Resource_Quote_Collection */
+ $collection = Mage::getResourceModel('Mage_Reports_Model_Resource_Quote_Collection');
+ $collection->prepareForProductsInCarts()
+ ->setSelectCountSqlType(Mage_Reports_Model_Resource_Quote_Collection::SELECT_COUNT_SQL_TYPE_CART);
+ $this->setCollection($collection);
+ return parent::_prepareCollection();
+ }
+
+ protected function _prepareColumns()
+ {
+ $this->addColumn('entity_id', array(
+ 'header' =>Mage::helper('Mage_Reports_Helper_Data')->__('ID'),
+ 'align' =>'right',
+ 'index' =>'entity_id',
+ 'header_css_class' => 'col-id',
+ 'column_css_class' => 'col-id'
+ ));
+
+ $this->addColumn('name', array(
+ 'header' =>Mage::helper('Mage_Reports_Helper_Data')->__('Product Name'),
+ 'index' =>'name',
+ 'header_css_class' => 'col-product',
+ 'column_css_class' => 'col-product'
+ ));
+
+ $currencyCode = $this->getCurrentCurrencyCode();
+
+ $this->addColumn('price', array(
+ 'header' =>Mage::helper('Mage_Reports_Helper_Data')->__('Price'),
+ 'type' =>'currency',
+ 'currency_code' => $currencyCode,
+ 'index' =>'price',
+ 'renderer' =>'Mage_Adminhtml_Block_Report_Grid_Column_Renderer_Currency',
+ 'rate' => $this->getRate($currencyCode),
+ 'header_css_class' => 'col-price',
+ 'column_css_class' => 'col-price'
+ ));
+
+ $this->addColumn('carts', array(
+ 'header' =>Mage::helper('Mage_Reports_Helper_Data')->__('Carts'),
+ 'align' =>'right',
+ 'index' =>'carts',
+ 'header_css_class' => 'col-carts',
+ 'column_css_class' => 'col-carts'
+ ));
+
+ $this->addColumn('orders', array(
+ 'header' =>Mage::helper('Mage_Reports_Helper_Data')->__('Orders'),
+ 'align' =>'right',
+ 'index' =>'orders',
+ 'header_css_class' => 'col-qty',
+ 'column_css_class' => 'col-qty'
+ ));
+
+ $this->setFilterVisibility(false);
+
+ $this->addExportType('*/*/exportProductCsv', Mage::helper('Mage_Reports_Helper_Data')->__('CSV'));
+ $this->addExportType('*/*/exportProductExcel', Mage::helper('Mage_Reports_Helper_Data')->__('Excel XML'));
+
+ return parent::_prepareColumns();
+ }
+
+ public function getRowUrl($row)
+ {
+ return $this->getUrl('*/catalog_product/edit', array('id'=>$row->getEntityId()));
+ }
+}
+
diff --git a/app/code/core/Mage/Adminhtml/Block/Report/Wishlist.php b/app/code/Mage/Adminhtml/Block/Report/Wishlist.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Report/Wishlist.php
rename to app/code/Mage/Adminhtml/Block/Report/Wishlist.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Report/Wishlist/Grid.php b/app/code/Mage/Adminhtml/Block/Report/Wishlist/Grid.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Report/Wishlist/Grid.php
rename to app/code/Mage/Adminhtml/Block/Report/Wishlist/Grid.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Review/Add.php b/app/code/Mage/Adminhtml/Block/Review/Add.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Review/Add.php
rename to app/code/Mage/Adminhtml/Block/Review/Add.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Review/Add/Form.php b/app/code/Mage/Adminhtml/Block/Review/Add/Form.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Review/Add/Form.php
rename to app/code/Mage/Adminhtml/Block/Review/Add/Form.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Review/Edit.php b/app/code/Mage/Adminhtml/Block/Review/Edit.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Review/Edit.php
rename to app/code/Mage/Adminhtml/Block/Review/Edit.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Review/Edit/Form.php b/app/code/Mage/Adminhtml/Block/Review/Edit/Form.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Review/Edit/Form.php
rename to app/code/Mage/Adminhtml/Block/Review/Edit/Form.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Review/Grid.php b/app/code/Mage/Adminhtml/Block/Review/Grid.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Review/Grid.php
rename to app/code/Mage/Adminhtml/Block/Review/Grid.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Review/Grid/Filter/Type.php b/app/code/Mage/Adminhtml/Block/Review/Grid/Filter/Type.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Review/Grid/Filter/Type.php
rename to app/code/Mage/Adminhtml/Block/Review/Grid/Filter/Type.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Review/Grid/Renderer/Type.php b/app/code/Mage/Adminhtml/Block/Review/Grid/Renderer/Type.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Review/Grid/Renderer/Type.php
rename to app/code/Mage/Adminhtml/Block/Review/Grid/Renderer/Type.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Review/Main.php b/app/code/Mage/Adminhtml/Block/Review/Main.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Review/Main.php
rename to app/code/Mage/Adminhtml/Block/Review/Main.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Review/Product/Grid.php b/app/code/Mage/Adminhtml/Block/Review/Product/Grid.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Review/Product/Grid.php
rename to app/code/Mage/Adminhtml/Block/Review/Product/Grid.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Review/Rating/Detailed.php b/app/code/Mage/Adminhtml/Block/Review/Rating/Detailed.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Review/Rating/Detailed.php
rename to app/code/Mage/Adminhtml/Block/Review/Rating/Detailed.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Review/Rating/Summary.php b/app/code/Mage/Adminhtml/Block/Review/Rating/Summary.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Review/Rating/Summary.php
rename to app/code/Mage/Adminhtml/Block/Review/Rating/Summary.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Creditmemo.php b/app/code/Mage/Adminhtml/Block/Sales/Creditmemo.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Sales/Creditmemo.php
rename to app/code/Mage/Adminhtml/Block/Sales/Creditmemo.php
diff --git a/app/code/Mage/Adminhtml/Block/Sales/Creditmemo/Grid.php b/app/code/Mage/Adminhtml/Block/Sales/Creditmemo/Grid.php
new file mode 100644
index 0000000000000..27c52140b692f
--- /dev/null
+++ b/app/code/Mage/Adminhtml/Block/Sales/Creditmemo/Grid.php
@@ -0,0 +1,181 @@
+
+ */
+class Mage_Adminhtml_Block_Sales_Creditmemo_Grid extends Mage_Adminhtml_Block_Widget_Grid
+{
+
+ protected function _construct()
+ {
+ parent::_construct();
+ $this->setId('sales_creditmemo_grid');
+ $this->setDefaultSort('created_at');
+ $this->setDefaultDir('DESC');
+ }
+
+ /**
+ * Retrieve collection class
+ *
+ * @return string
+ */
+ protected function _getCollectionClass()
+ {
+ return 'Mage_Sales_Model_Resource_Order_Creditmemo_Grid_Collection';
+ }
+
+ protected function _prepareCollection()
+ {
+ $collection = Mage::getResourceModel($this->_getCollectionClass());
+ $this->setCollection($collection);
+ return parent::_prepareCollection();
+ }
+
+
+ protected function _prepareColumns()
+ {
+ $this->addColumn('increment_id', array(
+ 'header' => Mage::helper('Mage_Sales_Helper_Data')->__('Credit Memo #'),
+ 'index' => 'increment_id',
+ 'type' => 'text',
+ 'header_css_class' => 'col-memo-number',
+ 'column_css_class' => 'col-memo-number'
+ ));
+
+ $this->addColumn('created_at', array(
+ 'header' => Mage::helper('Mage_Sales_Helper_Data')->__('Created At'),
+ 'index' => 'created_at',
+ 'type' => 'datetime',
+ 'header_css_class' => 'col-period',
+ 'column_css_class' => 'col-period'
+ ));
+
+ $this->addColumn('order_increment_id', array(
+ 'header' => Mage::helper('Mage_Sales_Helper_Data')->__('Order #'),
+ 'index' => 'order_increment_id',
+ 'type' => 'text',
+ 'header_css_class' => 'col-order-number',
+ 'column_css_class' => 'col-order-number'
+ ));
+
+ $this->addColumn('order_created_at', array(
+ 'header' => Mage::helper('Mage_Sales_Helper_Data')->__('Order Date'),
+ 'index' => 'order_created_at',
+ 'type' => 'datetime',
+ 'header_css_class' => 'col-period',
+ 'column_css_class' => 'col-period'
+ ));
+
+ $this->addColumn('billing_name', array(
+ 'header' => Mage::helper('Mage_Sales_Helper_Data')->__('Bill to Name'),
+ 'index' => 'billing_name',
+ 'header_css_class' => 'col-name',
+ 'column_css_class' => 'col-name'
+ ));
+
+ $this->addColumn('state', array(
+ 'header' => Mage::helper('Mage_Sales_Helper_Data')->__('Status'),
+ 'index' => 'state',
+ 'type' => 'options',
+ 'options' => Mage::getModel('Mage_Sales_Model_Order_Creditmemo')->getStates(),
+ 'header_css_class' => 'col-status',
+ 'column_css_class' => 'col-status'
+ ));
+
+ $this->addColumn('grand_total', array(
+ 'header' => Mage::helper('Mage_Customer_Helper_Data')->__('Refunded'),
+ 'index' => 'grand_total',
+ 'type' => 'currency',
+ 'currency' => 'order_currency_code',
+ 'header_css_class' => 'col-refunded',
+ 'column_css_class' => 'col-refunded'
+ ));
+
+ $this->addColumn('action',
+ array(
+ 'header' => Mage::helper('Mage_Sales_Helper_Data')->__('Action'),
+ 'type' => 'action',
+ 'getter' => 'getId',
+ 'actions' => array(
+ array(
+ 'caption' => Mage::helper('Mage_Sales_Helper_Data')->__('View'),
+ 'url' => array('base'=>'*/sales_creditmemo/view'),
+ 'field' => 'creditmemo_id'
+ )
+ ),
+ 'filter' => false,
+ 'sortable' => false,
+ 'is_system' => true,
+ 'header_css_class' => 'col-actions',
+ 'column_css_class' => 'col-actions'
+ ));
+
+ $this->addExportType('*/*/exportCsv', Mage::helper('Mage_Sales_Helper_Data')->__('CSV'));
+ $this->addExportType('*/*/exportExcel', Mage::helper('Mage_Sales_Helper_Data')->__('Excel XML'));
+
+ return parent::_prepareColumns();
+ }
+
+ protected function _prepareMassaction()
+ {
+ $this->setMassactionIdField('entity_id');
+ $this->getMassactionBlock()->setFormFieldName('creditmemo_ids');
+ $this->getMassactionBlock()->setUseSelectAll(false);
+
+ $this->getMassactionBlock()->addItem('pdfcreditmemos_order', array(
+ 'label'=> Mage::helper('Mage_Sales_Helper_Data')->__('PDF Credit Memos'),
+ 'url' => $this->getUrl('*/sales_creditmemo/pdfcreditmemos'),
+ ));
+
+ return $this;
+ }
+
+ public function getRowUrl($row)
+ {
+ if (!Mage::getSingleton('Mage_Core_Model_Authorization')
+ ->isAllowed(Mage_Backend_Model_Acl_Config::ACL_RESOURCE_ALL)
+ ) {
+ return false;
+ }
+
+ return $this->getUrl('*/sales_creditmemo/view',
+ array(
+ 'creditmemo_id'=> $row->getId(),
+ )
+ );
+ }
+
+ public function getGridUrl()
+ {
+ return $this->getUrl('*/*/*', array('_current' => true));
+ }
+
+
+
+}
diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Invoice.php b/app/code/Mage/Adminhtml/Block/Sales/Invoice.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Sales/Invoice.php
rename to app/code/Mage/Adminhtml/Block/Sales/Invoice.php
diff --git a/app/code/Mage/Adminhtml/Block/Sales/Invoice/Grid.php b/app/code/Mage/Adminhtml/Block/Sales/Invoice/Grid.php
new file mode 100644
index 0000000000000..950042b5e4059
--- /dev/null
+++ b/app/code/Mage/Adminhtml/Block/Sales/Invoice/Grid.php
@@ -0,0 +1,182 @@
+
+ */
+class Mage_Adminhtml_Block_Sales_Invoice_Grid extends Mage_Adminhtml_Block_Widget_Grid
+{
+
+ protected function _construct()
+ {
+ parent::_construct();
+ $this->setId('sales_invoice_grid');
+ $this->setUseAjax(true);
+ $this->setDefaultSort('created_at');
+ $this->setDefaultDir('DESC');
+ $this->setSaveParametersInSession(true);
+ }
+
+ /**
+ * Retrieve collection class
+ *
+ * @return string
+ */
+ protected function _getCollectionClass()
+ {
+ return 'Mage_Sales_Model_Resource_Order_Invoice_Grid_Collection';
+ }
+
+ protected function _prepareCollection()
+ {
+ $collection = Mage::getResourceModel($this->_getCollectionClass());
+ $this->setCollection($collection);
+ return parent::_prepareCollection();
+ }
+
+ protected function _prepareColumns()
+ {
+ $this->addColumn('increment_id', array(
+ 'header' => Mage::helper('Mage_Sales_Helper_Data')->__('Invoice #'),
+ 'index' => 'increment_id',
+ 'type' => 'text',
+ 'header_css_class' => 'col-invoice-number',
+ 'column_css_class' => 'col-invoice-number'
+ ));
+
+ $this->addColumn('created_at', array(
+ 'header' => Mage::helper('Mage_Sales_Helper_Data')->__('Invoice Date'),
+ 'index' => 'created_at',
+ 'type' => 'datetime',
+ 'header_css_class' => 'col-period',
+ 'column_css_class' => 'col-period'
+ ));
+
+ $this->addColumn('order_increment_id', array(
+ 'header' => Mage::helper('Mage_Sales_Helper_Data')->__('Order #'),
+ 'index' => 'order_increment_id',
+ 'type' => 'text',
+ 'header_css_class' => 'col-order-number',
+ 'column_css_class' => 'col-order-number'
+ ));
+
+ $this->addColumn('order_created_at', array(
+ 'header' => Mage::helper('Mage_Sales_Helper_Data')->__('Order Date'),
+ 'index' => 'order_created_at',
+ 'type' => 'datetime',
+ 'header_css_class' => 'col-period',
+ 'column_css_class' => 'col-period'
+ ));
+
+ $this->addColumn('billing_name', array(
+ 'header' => Mage::helper('Mage_Sales_Helper_Data')->__('Bill to Name'),
+ 'index' => 'billing_name',
+ 'header_css_class' => 'col-name',
+ 'column_css_class' => 'col-name'
+ ));
+
+ $this->addColumn('state', array(
+ 'header' => Mage::helper('Mage_Sales_Helper_Data')->__('Status'),
+ 'index' => 'state',
+ 'type' => 'options',
+ 'options' => Mage::getModel('Mage_Sales_Model_Order_Invoice')->getStates(),
+ 'header_css_class' => 'col-status',
+ 'column_css_class' => 'col-status'
+ ));
+
+ $this->addColumn('grand_total', array(
+ 'header' => Mage::helper('Mage_Customer_Helper_Data')->__('Amount'),
+ 'index' => 'grand_total',
+ 'type' => 'currency',
+ 'align' => 'right',
+ 'currency' => 'order_currency_code',
+ 'header_css_class' => 'col-qty',
+ 'column_css_class' => 'col-qty'
+ ));
+
+ $this->addColumn('action',
+ array(
+ 'header' => Mage::helper('Mage_Sales_Helper_Data')->__('Action'),
+ 'width' => '50px',
+ 'type' => 'action',
+ 'getter' => 'getId',
+ 'actions' => array(
+ array(
+ 'caption' => Mage::helper('Mage_Sales_Helper_Data')->__('View'),
+ 'url' => array('base'=>'*/sales_invoice/view'),
+ 'field' => 'invoice_id'
+ )
+ ),
+ 'filter' => false,
+ 'sortable' => false,
+ 'is_system' => true,
+ 'header_css_class' => 'col-actions',
+ 'column_css_class' => 'col-actions'
+ ));
+
+ $this->addExportType('*/*/exportCsv', Mage::helper('Mage_Sales_Helper_Data')->__('CSV'));
+ $this->addExportType('*/*/exportExcel', Mage::helper('Mage_Sales_Helper_Data')->__('Excel XML'));
+
+ return parent::_prepareColumns();
+ }
+
+ protected function _prepareMassaction()
+ {
+ $this->setMassactionIdField('entity_id');
+ $this->getMassactionBlock()->setFormFieldName('invoice_ids');
+ $this->getMassactionBlock()->setUseSelectAll(false);
+
+ $this->getMassactionBlock()->addItem('pdfinvoices_order', array(
+ 'label'=> Mage::helper('Mage_Sales_Helper_Data')->__('PDF Invoices'),
+ 'url' => $this->getUrl('*/sales_invoice/pdfinvoices'),
+ ));
+
+ return $this;
+ }
+
+ public function getRowUrl($row)
+ {
+ if (!Mage::getSingleton('Mage_Core_Model_Authorization')
+ ->isAllowed(Mage_Backend_Model_Acl_Config::ACL_RESOURCE_ALL)
+ ) {
+ return false;
+ }
+
+ return $this->getUrl('*/sales_invoice/view',
+ array(
+ 'invoice_id'=> $row->getId(),
+ )
+ );
+ }
+
+ public function getGridUrl()
+ {
+ return $this->getUrl('*/*/grid', array('_current' => true));
+ }
+
+}
diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Items/Abstract.php b/app/code/Mage/Adminhtml/Block/Sales/Items/Abstract.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Sales/Items/Abstract.php
rename to app/code/Mage/Adminhtml/Block/Sales/Items/Abstract.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Items/Column/Default.php b/app/code/Mage/Adminhtml/Block/Sales/Items/Column/Default.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Sales/Items/Column/Default.php
rename to app/code/Mage/Adminhtml/Block/Sales/Items/Column/Default.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Items/Column/Name.php b/app/code/Mage/Adminhtml/Block/Sales/Items/Column/Name.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Sales/Items/Column/Name.php
rename to app/code/Mage/Adminhtml/Block/Sales/Items/Column/Name.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Items/Column/Name/Grouped.php b/app/code/Mage/Adminhtml/Block/Sales/Items/Column/Name/Grouped.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Sales/Items/Column/Name/Grouped.php
rename to app/code/Mage/Adminhtml/Block/Sales/Items/Column/Name/Grouped.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Items/Column/Qty.php b/app/code/Mage/Adminhtml/Block/Sales/Items/Column/Qty.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Sales/Items/Column/Qty.php
rename to app/code/Mage/Adminhtml/Block/Sales/Items/Column/Qty.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Items/Renderer/Configurable.php b/app/code/Mage/Adminhtml/Block/Sales/Items/Renderer/Configurable.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Sales/Items/Renderer/Configurable.php
rename to app/code/Mage/Adminhtml/Block/Sales/Items/Renderer/Configurable.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Items/Renderer/Default.php b/app/code/Mage/Adminhtml/Block/Sales/Items/Renderer/Default.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Sales/Items/Renderer/Default.php
rename to app/code/Mage/Adminhtml/Block/Sales/Items/Renderer/Default.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order.php b/app/code/Mage/Adminhtml/Block/Sales/Order.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Sales/Order.php
rename to app/code/Mage/Adminhtml/Block/Sales/Order.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Abstract.php b/app/code/Mage/Adminhtml/Block/Sales/Order/Abstract.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Sales/Order/Abstract.php
rename to app/code/Mage/Adminhtml/Block/Sales/Order/Abstract.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Address.php b/app/code/Mage/Adminhtml/Block/Sales/Order/Address.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Sales/Order/Address.php
rename to app/code/Mage/Adminhtml/Block/Sales/Order/Address.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Address/Form.php b/app/code/Mage/Adminhtml/Block/Sales/Order/Address/Form.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Sales/Order/Address/Form.php
rename to app/code/Mage/Adminhtml/Block/Sales/Order/Address/Form.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Comments/View.php b/app/code/Mage/Adminhtml/Block/Sales/Order/Comments/View.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Sales/Order/Comments/View.php
rename to app/code/Mage/Adminhtml/Block/Sales/Order/Comments/View.php
diff --git a/app/code/Mage/Adminhtml/Block/Sales/Order/Create.php b/app/code/Mage/Adminhtml/Block/Sales/Order/Create.php
new file mode 100644
index 0000000000000..d7069fbb7e6c6
--- /dev/null
+++ b/app/code/Mage/Adminhtml/Block/Sales/Order/Create.php
@@ -0,0 +1,141 @@
+
+ */
+
+class Mage_Adminhtml_Block_Sales_Order_Create extends Mage_Adminhtml_Block_Widget_Form_Container
+{
+ protected function _construct()
+ {
+ $this->_objectId = 'order_id';
+ $this->_controller = 'sales_order';
+ $this->_mode = 'create';
+
+ parent::_construct();
+
+ $this->setId('sales_order_create');
+
+ $customerId = $this->_getSession()->getCustomerId();
+ $storeId = $this->_getSession()->getStoreId();
+
+
+ $this->_updateButton('save', 'label', Mage::helper('Mage_Sales_Helper_Data')->__('Submit Order'));
+ $this->_updateButton('save', 'onclick', "order.submit()");
+ $this->_updateButton('save', 'id', 'submit_order_top_button');
+ if (is_null($customerId) || !$storeId) {
+ $this->_updateButton('save', 'style', 'display:none');
+ }
+
+ $this->_updateButton('back', 'id', 'back_order_top_button');
+ $this->_updateButton('back', 'onclick', 'setLocation(\'' . $this->getBackUrl() . '\')');
+
+ $this->_updateButton('reset', 'id', 'reset_order_top_button');
+
+ if (is_null($customerId)) {
+ $this->_updateButton('reset', 'style', 'display:none');
+ } else {
+ $this->_updateButton('back', 'style', 'display:none');
+ }
+
+ $confirm = Mage::helper('Mage_Sales_Helper_Data')->__('Are you sure you want to cancel this order?');
+ $this->_updateButton('reset', 'label', Mage::helper('Mage_Sales_Helper_Data')->__('Cancel'));
+ $this->_updateButton('reset', 'class', 'cancel');
+ $this->_updateButton('reset', 'onclick', 'deleteConfirm(\''.$confirm.'\', \'' . $this->getCancelUrl() . '\')');
+
+ $pageTitle = $this->getLayout()->createBlock('Mage_Adminhtml_Block_Sales_Order_Create_Header')->toHtml();
+ if (is_object($this->getLayout()->getBlock('page-title'))) {
+ $this->getLayout()->getBlock('page-title')->setPageTitle($pageTitle);
+ }
+ }
+
+ /**
+ * Prepare header html
+ *
+ * @return string
+ */
+ public function getHeaderHtml()
+ {
+ $out = '';
+ return $out;
+ }
+
+ /**
+ * Prepare form html. Add block for configurable product modification interface
+ *
+ * @return string
+ */
+ public function getFormHtml()
+ {
+ $html = parent::getFormHtml();
+ return $html;
+ }
+
+ public function getHeaderWidth()
+ {
+ return 'width: 70%;';
+ }
+
+ /**
+ * Retrieve quote session object
+ *
+ * @return Mage_Adminhtml_Model_Session_Quote
+ */
+ protected function _getSession()
+ {
+ return Mage::getSingleton('Mage_Adminhtml_Model_Session_Quote');
+ }
+
+ public function getCancelUrl()
+ {
+ if ($this->_getSession()->getOrder()->getId()) {
+ $url = $this->getUrl('*/sales_order/view', array(
+ 'order_id' => Mage::getSingleton('Mage_Adminhtml_Model_Session_Quote')->getOrder()->getId()
+ ));
+ } else {
+ $url = $this->getUrl('*/*/cancel');
+ }
+
+ return $url;
+ }
+
+ /**
+ * Get URL for back (reset) button
+ *
+ * @return string
+ */
+ public function getBackUrl()
+ {
+ return $this->getUrl('*/' . $this->_controller . '/');
+ }
+}
diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Abstract.php b/app/code/Mage/Adminhtml/Block/Sales/Order/Create/Abstract.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Abstract.php
rename to app/code/Mage/Adminhtml/Block/Sales/Order/Create/Abstract.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Billing/Address.php b/app/code/Mage/Adminhtml/Block/Sales/Order/Create/Billing/Address.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Billing/Address.php
rename to app/code/Mage/Adminhtml/Block/Sales/Order/Create/Billing/Address.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Billing/Method.php b/app/code/Mage/Adminhtml/Block/Sales/Order/Create/Billing/Method.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Billing/Method.php
rename to app/code/Mage/Adminhtml/Block/Sales/Order/Create/Billing/Method.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Billing/Method/Form.php b/app/code/Mage/Adminhtml/Block/Sales/Order/Create/Billing/Method/Form.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Billing/Method/Form.php
rename to app/code/Mage/Adminhtml/Block/Sales/Order/Create/Billing/Method/Form.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Comment.php b/app/code/Mage/Adminhtml/Block/Sales/Order/Create/Comment.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Comment.php
rename to app/code/Mage/Adminhtml/Block/Sales/Order/Create/Comment.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Coupons.php b/app/code/Mage/Adminhtml/Block/Sales/Order/Create/Coupons.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Coupons.php
rename to app/code/Mage/Adminhtml/Block/Sales/Order/Create/Coupons.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Coupons/Form.php b/app/code/Mage/Adminhtml/Block/Sales/Order/Create/Coupons/Form.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Coupons/Form.php
rename to app/code/Mage/Adminhtml/Block/Sales/Order/Create/Coupons/Form.php
diff --git a/app/code/Mage/Adminhtml/Block/Sales/Order/Create/Customer.php b/app/code/Mage/Adminhtml/Block/Sales/Order/Create/Customer.php
new file mode 100644
index 0000000000000..0ad5c53b15735
--- /dev/null
+++ b/app/code/Mage/Adminhtml/Block/Sales/Order/Create/Customer.php
@@ -0,0 +1,59 @@
+
+ */
+
+class Mage_Adminhtml_Block_Sales_Order_Create_Customer extends Mage_Adminhtml_Block_Sales_Order_Create_Abstract
+{
+
+ protected function _construct()
+ {
+ parent::_construct();
+ $this->setId('sales_order_create_customer');
+ }
+
+ public function getHeaderText()
+ {
+ return Mage::helper('Mage_Sales_Helper_Data')->__('Please Select a Customer');
+ }
+
+ public function getButtonsHtml()
+ {
+ $addButtonData = array(
+ 'label' => Mage::helper('Mage_Sales_Helper_Data')->__('Create New Customer'),
+ 'onclick' => 'order.setCustomerId(false)',
+ 'class' => 'action-add',
+ );
+ return $this->getLayout()->createBlock('Mage_Adminhtml_Block_Widget_Button')->setData($addButtonData)->toHtml();
+ }
+
+}
diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Customer/Grid.php b/app/code/Mage/Adminhtml/Block/Sales/Order/Create/Customer/Grid.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Customer/Grid.php
rename to app/code/Mage/Adminhtml/Block/Sales/Order/Create/Customer/Grid.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Data.php b/app/code/Mage/Adminhtml/Block/Sales/Order/Create/Data.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Data.php
rename to app/code/Mage/Adminhtml/Block/Sales/Order/Create/Data.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Form.php b/app/code/Mage/Adminhtml/Block/Sales/Order/Create/Form.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Form.php
rename to app/code/Mage/Adminhtml/Block/Sales/Order/Create/Form.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Form/Abstract.php b/app/code/Mage/Adminhtml/Block/Sales/Order/Create/Form/Abstract.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Form/Abstract.php
rename to app/code/Mage/Adminhtml/Block/Sales/Order/Create/Form/Abstract.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Form/Account.php b/app/code/Mage/Adminhtml/Block/Sales/Order/Create/Form/Account.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Form/Account.php
rename to app/code/Mage/Adminhtml/Block/Sales/Order/Create/Form/Account.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Form/Address.php b/app/code/Mage/Adminhtml/Block/Sales/Order/Create/Form/Address.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Form/Address.php
rename to app/code/Mage/Adminhtml/Block/Sales/Order/Create/Form/Address.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Giftmessage.php b/app/code/Mage/Adminhtml/Block/Sales/Order/Create/Giftmessage.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Giftmessage.php
rename to app/code/Mage/Adminhtml/Block/Sales/Order/Create/Giftmessage.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Giftmessage/Form.php b/app/code/Mage/Adminhtml/Block/Sales/Order/Create/Giftmessage/Form.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Giftmessage/Form.php
rename to app/code/Mage/Adminhtml/Block/Sales/Order/Create/Giftmessage/Form.php
diff --git a/app/code/Mage/Adminhtml/Block/Sales/Order/Create/Header.php b/app/code/Mage/Adminhtml/Block/Sales/Order/Create/Header.php
new file mode 100644
index 0000000000000..eb20b71b77b52
--- /dev/null
+++ b/app/code/Mage/Adminhtml/Block/Sales/Order/Create/Header.php
@@ -0,0 +1,61 @@
+
+ */
+class Mage_Adminhtml_Block_Sales_Order_Create_Header extends Mage_Adminhtml_Block_Sales_Order_Create_Abstract
+{
+ protected function _toHtml()
+ {
+ if ($this->_getSession()->getOrder()->getId()) {
+ return Mage::helper('Mage_Sales_Helper_Data')->__('Edit Order #%s', $this->_getSession()->getOrder()->getIncrementId());
+ }
+
+ $customerId = $this->getCustomerId();
+ $storeId = $this->getStoreId();
+ $out = '';
+ if ($customerId && $storeId) {
+ $out.= Mage::helper('Mage_Sales_Helper_Data')->__('Create New Order for %s in %s', $this->getCustomer()->getName(), $this->getStore()->getName());
+ }
+ elseif (!is_null($customerId) && $storeId){
+ $out.= Mage::helper('Mage_Sales_Helper_Data')->__('Create New Order for New Customer in %s', $this->getStore()->getName());
+ }
+ elseif ($customerId) {
+ $out.= Mage::helper('Mage_Sales_Helper_Data')->__('Create New Order for %s', $this->getCustomer()->getName());
+ }
+ elseif (!is_null($customerId)){
+ $out.= Mage::helper('Mage_Sales_Helper_Data')->__('Create New Order for New Customer');
+ }
+ else {
+ $out.= Mage::helper('Mage_Sales_Helper_Data')->__('Create New Order');
+ }
+ $out = $this->escapeHtml($out);
+ return $out;
+ }
+}
diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Items.php b/app/code/Mage/Adminhtml/Block/Sales/Order/Create/Items.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Items.php
rename to app/code/Mage/Adminhtml/Block/Sales/Order/Create/Items.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Items/Grid.php b/app/code/Mage/Adminhtml/Block/Sales/Order/Create/Items/Grid.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Items/Grid.php
rename to app/code/Mage/Adminhtml/Block/Sales/Order/Create/Items/Grid.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Load.php b/app/code/Mage/Adminhtml/Block/Sales/Order/Create/Load.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Load.php
rename to app/code/Mage/Adminhtml/Block/Sales/Order/Create/Load.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Messages.php b/app/code/Mage/Adminhtml/Block/Sales/Order/Create/Messages.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Messages.php
rename to app/code/Mage/Adminhtml/Block/Sales/Order/Create/Messages.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Newsletter.php b/app/code/Mage/Adminhtml/Block/Sales/Order/Create/Newsletter.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Newsletter.php
rename to app/code/Mage/Adminhtml/Block/Sales/Order/Create/Newsletter.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Newsletter/Form.php b/app/code/Mage/Adminhtml/Block/Sales/Order/Create/Newsletter/Form.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Newsletter/Form.php
rename to app/code/Mage/Adminhtml/Block/Sales/Order/Create/Newsletter/Form.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Search.php b/app/code/Mage/Adminhtml/Block/Sales/Order/Create/Search.php
similarity index 98%
rename from app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Search.php
rename to app/code/Mage/Adminhtml/Block/Sales/Order/Create/Search.php
index 6d5888d66b9b2..06e79907ed75e 100644
--- a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Search.php
+++ b/app/code/Mage/Adminhtml/Block/Sales/Order/Create/Search.php
@@ -51,7 +51,7 @@ public function getButtonsHtml()
$addButtonData = array(
'label' => Mage::helper('Mage_Sales_Helper_Data')->__('Add Selected Product(s) to Order'),
'onclick' => 'order.productGridAddSelected()',
- 'class' => 'add',
+ 'class' => 'action-add',
);
return $this->getLayout()->createBlock('Mage_Adminhtml_Block_Widget_Button')->setData($addButtonData)->toHtml();
}
diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Search/Grid.php b/app/code/Mage/Adminhtml/Block/Sales/Order/Create/Search/Grid.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Search/Grid.php
rename to app/code/Mage/Adminhtml/Block/Sales/Order/Create/Search/Grid.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Search/Grid/Renderer/Price.php b/app/code/Mage/Adminhtml/Block/Sales/Order/Create/Search/Grid/Renderer/Price.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Search/Grid/Renderer/Price.php
rename to app/code/Mage/Adminhtml/Block/Sales/Order/Create/Search/Grid/Renderer/Price.php
diff --git a/app/code/Mage/Adminhtml/Block/Sales/Order/Create/Search/Grid/Renderer/Product.php b/app/code/Mage/Adminhtml/Block/Sales/Order/Create/Search/Grid/Renderer/Product.php
new file mode 100644
index 0000000000000..def2ec6e6052b
--- /dev/null
+++ b/app/code/Mage/Adminhtml/Block/Sales/Order/Create/Search/Grid/Renderer/Product.php
@@ -0,0 +1,51 @@
+
+ */
+class Mage_Adminhtml_Block_Sales_Order_Create_Search_Grid_Renderer_Product extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Text
+{
+ /**
+ * Render product name to add Configure link
+ *
+ * @param Varien_Object $row
+ * @return string
+ */
+ public function render(Varien_Object $row)
+ {
+ $rendered = parent::render($row);
+ $isConfigurable = $row->canConfigure();
+ $style = $isConfigurable ? '' : 'disabled';
+ $prodAttributes = $isConfigurable ? sprintf('list_type = "product_to_add" product_id = %s', $row->getId()) : 'disabled="disabled"';
+ return sprintf('%s ',
+ $style, $prodAttributes, Mage::helper('Mage_Sales_Helper_Data')->__('Configure')) . $rendered;
+ }
+}
diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Search/Grid/Renderer/Qty.php b/app/code/Mage/Adminhtml/Block/Sales/Order/Create/Search/Grid/Renderer/Qty.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Search/Grid/Renderer/Qty.php
rename to app/code/Mage/Adminhtml/Block/Sales/Order/Create/Search/Grid/Renderer/Qty.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Shipping/Address.php b/app/code/Mage/Adminhtml/Block/Sales/Order/Create/Shipping/Address.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Shipping/Address.php
rename to app/code/Mage/Adminhtml/Block/Sales/Order/Create/Shipping/Address.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Shipping/Method.php b/app/code/Mage/Adminhtml/Block/Sales/Order/Create/Shipping/Method.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Shipping/Method.php
rename to app/code/Mage/Adminhtml/Block/Sales/Order/Create/Shipping/Method.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Shipping/Method/Form.php b/app/code/Mage/Adminhtml/Block/Sales/Order/Create/Shipping/Method/Form.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Shipping/Method/Form.php
rename to app/code/Mage/Adminhtml/Block/Sales/Order/Create/Shipping/Method/Form.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Sidebar.php b/app/code/Mage/Adminhtml/Block/Sales/Order/Create/Sidebar.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Sidebar.php
rename to app/code/Mage/Adminhtml/Block/Sales/Order/Create/Sidebar.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Sidebar/Abstract.php b/app/code/Mage/Adminhtml/Block/Sales/Order/Create/Sidebar/Abstract.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Sidebar/Abstract.php
rename to app/code/Mage/Adminhtml/Block/Sales/Order/Create/Sidebar/Abstract.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Sidebar/Cart.php b/app/code/Mage/Adminhtml/Block/Sales/Order/Create/Sidebar/Cart.php
similarity index 98%
rename from app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Sidebar/Cart.php
rename to app/code/Mage/Adminhtml/Block/Sales/Order/Create/Sidebar/Cart.php
index 55e679877d3c6..8785ed4e59f76 100644
--- a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Sidebar/Cart.php
+++ b/app/code/Mage/Adminhtml/Block/Sales/Order/Create/Sidebar/Cart.php
@@ -107,8 +107,7 @@ protected function _prepareLayout()
$deleteAllConfirmString = Mage::helper('Mage_Sales_Helper_Data')->__('Are you sure you want to delete all items from shopping cart?');
$this->addChild('empty_customer_cart_button', 'Mage_Adminhtml_Block_Widget_Button', array(
'label' => Mage::helper('Mage_Sales_Helper_Data')->__('Clear Shopping Cart'),
- 'onclick' => 'order.clearShoppingCart(\'' . $deleteAllConfirmString . '\')',
- 'style' => 'float: right;'
+ 'onclick' => 'order.clearShoppingCart(\'' . $deleteAllConfirmString . '\')'
));
return parent::_prepareLayout();
diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Sidebar/Compared.php b/app/code/Mage/Adminhtml/Block/Sales/Order/Create/Sidebar/Compared.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Sidebar/Compared.php
rename to app/code/Mage/Adminhtml/Block/Sales/Order/Create/Sidebar/Compared.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Sidebar/Pcompared.php b/app/code/Mage/Adminhtml/Block/Sales/Order/Create/Sidebar/Pcompared.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Sidebar/Pcompared.php
rename to app/code/Mage/Adminhtml/Block/Sales/Order/Create/Sidebar/Pcompared.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Sidebar/Pviewed.php b/app/code/Mage/Adminhtml/Block/Sales/Order/Create/Sidebar/Pviewed.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Sidebar/Pviewed.php
rename to app/code/Mage/Adminhtml/Block/Sales/Order/Create/Sidebar/Pviewed.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Sidebar/Reorder.php b/app/code/Mage/Adminhtml/Block/Sales/Order/Create/Sidebar/Reorder.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Sidebar/Reorder.php
rename to app/code/Mage/Adminhtml/Block/Sales/Order/Create/Sidebar/Reorder.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Sidebar/Viewed.php b/app/code/Mage/Adminhtml/Block/Sales/Order/Create/Sidebar/Viewed.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Sidebar/Viewed.php
rename to app/code/Mage/Adminhtml/Block/Sales/Order/Create/Sidebar/Viewed.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Sidebar/Wishlist.php b/app/code/Mage/Adminhtml/Block/Sales/Order/Create/Sidebar/Wishlist.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Sidebar/Wishlist.php
rename to app/code/Mage/Adminhtml/Block/Sales/Order/Create/Sidebar/Wishlist.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Store.php b/app/code/Mage/Adminhtml/Block/Sales/Order/Create/Store.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Store.php
rename to app/code/Mage/Adminhtml/Block/Sales/Order/Create/Store.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Store/Select.php b/app/code/Mage/Adminhtml/Block/Sales/Order/Create/Store/Select.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Store/Select.php
rename to app/code/Mage/Adminhtml/Block/Sales/Order/Create/Store/Select.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Totals.php b/app/code/Mage/Adminhtml/Block/Sales/Order/Create/Totals.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Totals.php
rename to app/code/Mage/Adminhtml/Block/Sales/Order/Create/Totals.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Totals/Default.php b/app/code/Mage/Adminhtml/Block/Sales/Order/Create/Totals/Default.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Totals/Default.php
rename to app/code/Mage/Adminhtml/Block/Sales/Order/Create/Totals/Default.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Totals/Discount.php b/app/code/Mage/Adminhtml/Block/Sales/Order/Create/Totals/Discount.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Totals/Discount.php
rename to app/code/Mage/Adminhtml/Block/Sales/Order/Create/Totals/Discount.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Totals/Grandtotal.php b/app/code/Mage/Adminhtml/Block/Sales/Order/Create/Totals/Grandtotal.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Totals/Grandtotal.php
rename to app/code/Mage/Adminhtml/Block/Sales/Order/Create/Totals/Grandtotal.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Totals/Shipping.php b/app/code/Mage/Adminhtml/Block/Sales/Order/Create/Totals/Shipping.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Totals/Shipping.php
rename to app/code/Mage/Adminhtml/Block/Sales/Order/Create/Totals/Shipping.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Totals/Subtotal.php b/app/code/Mage/Adminhtml/Block/Sales/Order/Create/Totals/Subtotal.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Totals/Subtotal.php
rename to app/code/Mage/Adminhtml/Block/Sales/Order/Create/Totals/Subtotal.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Totals/Table.php b/app/code/Mage/Adminhtml/Block/Sales/Order/Create/Totals/Table.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Totals/Table.php
rename to app/code/Mage/Adminhtml/Block/Sales/Order/Create/Totals/Table.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Totals/Tax.php b/app/code/Mage/Adminhtml/Block/Sales/Order/Create/Totals/Tax.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Totals/Tax.php
rename to app/code/Mage/Adminhtml/Block/Sales/Order/Create/Totals/Tax.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Creditmemo/Create.php b/app/code/Mage/Adminhtml/Block/Sales/Order/Creditmemo/Create.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Sales/Order/Creditmemo/Create.php
rename to app/code/Mage/Adminhtml/Block/Sales/Order/Creditmemo/Create.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Creditmemo/Create/Adjustments.php b/app/code/Mage/Adminhtml/Block/Sales/Order/Creditmemo/Create/Adjustments.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Sales/Order/Creditmemo/Create/Adjustments.php
rename to app/code/Mage/Adminhtml/Block/Sales/Order/Creditmemo/Create/Adjustments.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Creditmemo/Create/Form.php b/app/code/Mage/Adminhtml/Block/Sales/Order/Creditmemo/Create/Form.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Sales/Order/Creditmemo/Create/Form.php
rename to app/code/Mage/Adminhtml/Block/Sales/Order/Creditmemo/Create/Form.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Creditmemo/Create/Items.php b/app/code/Mage/Adminhtml/Block/Sales/Order/Creditmemo/Create/Items.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Sales/Order/Creditmemo/Create/Items.php
rename to app/code/Mage/Adminhtml/Block/Sales/Order/Creditmemo/Create/Items.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Creditmemo/Totals.php b/app/code/Mage/Adminhtml/Block/Sales/Order/Creditmemo/Totals.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Sales/Order/Creditmemo/Totals.php
rename to app/code/Mage/Adminhtml/Block/Sales/Order/Creditmemo/Totals.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Creditmemo/View.php b/app/code/Mage/Adminhtml/Block/Sales/Order/Creditmemo/View.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Sales/Order/Creditmemo/View.php
rename to app/code/Mage/Adminhtml/Block/Sales/Order/Creditmemo/View.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Creditmemo/View/Comments.php b/app/code/Mage/Adminhtml/Block/Sales/Order/Creditmemo/View/Comments.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Sales/Order/Creditmemo/View/Comments.php
rename to app/code/Mage/Adminhtml/Block/Sales/Order/Creditmemo/View/Comments.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Creditmemo/View/Form.php b/app/code/Mage/Adminhtml/Block/Sales/Order/Creditmemo/View/Form.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Sales/Order/Creditmemo/View/Form.php
rename to app/code/Mage/Adminhtml/Block/Sales/Order/Creditmemo/View/Form.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Creditmemo/View/Items.php b/app/code/Mage/Adminhtml/Block/Sales/Order/Creditmemo/View/Items.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Sales/Order/Creditmemo/View/Items.php
rename to app/code/Mage/Adminhtml/Block/Sales/Order/Creditmemo/View/Items.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Grid.php b/app/code/Mage/Adminhtml/Block/Sales/Order/Grid.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Sales/Order/Grid.php
rename to app/code/Mage/Adminhtml/Block/Sales/Order/Grid.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Invoice/Create.php b/app/code/Mage/Adminhtml/Block/Sales/Order/Invoice/Create.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Sales/Order/Invoice/Create.php
rename to app/code/Mage/Adminhtml/Block/Sales/Order/Invoice/Create.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Invoice/Create/Form.php b/app/code/Mage/Adminhtml/Block/Sales/Order/Invoice/Create/Form.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Sales/Order/Invoice/Create/Form.php
rename to app/code/Mage/Adminhtml/Block/Sales/Order/Invoice/Create/Form.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Invoice/Create/Items.php b/app/code/Mage/Adminhtml/Block/Sales/Order/Invoice/Create/Items.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Sales/Order/Invoice/Create/Items.php
rename to app/code/Mage/Adminhtml/Block/Sales/Order/Invoice/Create/Items.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Invoice/Create/Tracking.php b/app/code/Mage/Adminhtml/Block/Sales/Order/Invoice/Create/Tracking.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Sales/Order/Invoice/Create/Tracking.php
rename to app/code/Mage/Adminhtml/Block/Sales/Order/Invoice/Create/Tracking.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Invoice/Totals.php b/app/code/Mage/Adminhtml/Block/Sales/Order/Invoice/Totals.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Sales/Order/Invoice/Totals.php
rename to app/code/Mage/Adminhtml/Block/Sales/Order/Invoice/Totals.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Invoice/View.php b/app/code/Mage/Adminhtml/Block/Sales/Order/Invoice/View.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Sales/Order/Invoice/View.php
rename to app/code/Mage/Adminhtml/Block/Sales/Order/Invoice/View.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Invoice/View/Comments.php b/app/code/Mage/Adminhtml/Block/Sales/Order/Invoice/View/Comments.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Sales/Order/Invoice/View/Comments.php
rename to app/code/Mage/Adminhtml/Block/Sales/Order/Invoice/View/Comments.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Invoice/View/Form.php b/app/code/Mage/Adminhtml/Block/Sales/Order/Invoice/View/Form.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Sales/Order/Invoice/View/Form.php
rename to app/code/Mage/Adminhtml/Block/Sales/Order/Invoice/View/Form.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Invoice/View/Items.php b/app/code/Mage/Adminhtml/Block/Sales/Order/Invoice/View/Items.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Sales/Order/Invoice/View/Items.php
rename to app/code/Mage/Adminhtml/Block/Sales/Order/Invoice/View/Items.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Payment.php b/app/code/Mage/Adminhtml/Block/Sales/Order/Payment.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Sales/Order/Payment.php
rename to app/code/Mage/Adminhtml/Block/Sales/Order/Payment.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Shipment/Create.php b/app/code/Mage/Adminhtml/Block/Sales/Order/Shipment/Create.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Sales/Order/Shipment/Create.php
rename to app/code/Mage/Adminhtml/Block/Sales/Order/Shipment/Create.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Shipment/Create/Form.php b/app/code/Mage/Adminhtml/Block/Sales/Order/Shipment/Create/Form.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Sales/Order/Shipment/Create/Form.php
rename to app/code/Mage/Adminhtml/Block/Sales/Order/Shipment/Create/Form.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Shipment/Create/Items.php b/app/code/Mage/Adminhtml/Block/Sales/Order/Shipment/Create/Items.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Sales/Order/Shipment/Create/Items.php
rename to app/code/Mage/Adminhtml/Block/Sales/Order/Shipment/Create/Items.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Shipment/Create/Tracking.php b/app/code/Mage/Adminhtml/Block/Sales/Order/Shipment/Create/Tracking.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Sales/Order/Shipment/Create/Tracking.php
rename to app/code/Mage/Adminhtml/Block/Sales/Order/Shipment/Create/Tracking.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Shipment/Packaging.php b/app/code/Mage/Adminhtml/Block/Sales/Order/Shipment/Packaging.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Sales/Order/Shipment/Packaging.php
rename to app/code/Mage/Adminhtml/Block/Sales/Order/Shipment/Packaging.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Shipment/Packaging/Grid.php b/app/code/Mage/Adminhtml/Block/Sales/Order/Shipment/Packaging/Grid.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Sales/Order/Shipment/Packaging/Grid.php
rename to app/code/Mage/Adminhtml/Block/Sales/Order/Shipment/Packaging/Grid.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Shipment/Tracking/Info.php b/app/code/Mage/Adminhtml/Block/Sales/Order/Shipment/Tracking/Info.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Sales/Order/Shipment/Tracking/Info.php
rename to app/code/Mage/Adminhtml/Block/Sales/Order/Shipment/Tracking/Info.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Shipment/View.php b/app/code/Mage/Adminhtml/Block/Sales/Order/Shipment/View.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Sales/Order/Shipment/View.php
rename to app/code/Mage/Adminhtml/Block/Sales/Order/Shipment/View.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Shipment/View/Comments.php b/app/code/Mage/Adminhtml/Block/Sales/Order/Shipment/View/Comments.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Sales/Order/Shipment/View/Comments.php
rename to app/code/Mage/Adminhtml/Block/Sales/Order/Shipment/View/Comments.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Shipment/View/Form.php b/app/code/Mage/Adminhtml/Block/Sales/Order/Shipment/View/Form.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Sales/Order/Shipment/View/Form.php
rename to app/code/Mage/Adminhtml/Block/Sales/Order/Shipment/View/Form.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Shipment/View/Items.php b/app/code/Mage/Adminhtml/Block/Sales/Order/Shipment/View/Items.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Sales/Order/Shipment/View/Items.php
rename to app/code/Mage/Adminhtml/Block/Sales/Order/Shipment/View/Items.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Shipment/View/Tracking.php b/app/code/Mage/Adminhtml/Block/Sales/Order/Shipment/View/Tracking.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Sales/Order/Shipment/View/Tracking.php
rename to app/code/Mage/Adminhtml/Block/Sales/Order/Shipment/View/Tracking.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Status.php b/app/code/Mage/Adminhtml/Block/Sales/Order/Status.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Sales/Order/Status.php
rename to app/code/Mage/Adminhtml/Block/Sales/Order/Status.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Status/Assign.php b/app/code/Mage/Adminhtml/Block/Sales/Order/Status/Assign.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Sales/Order/Status/Assign.php
rename to app/code/Mage/Adminhtml/Block/Sales/Order/Status/Assign.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Status/Assign/Form.php b/app/code/Mage/Adminhtml/Block/Sales/Order/Status/Assign/Form.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Sales/Order/Status/Assign/Form.php
rename to app/code/Mage/Adminhtml/Block/Sales/Order/Status/Assign/Form.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Status/Edit.php b/app/code/Mage/Adminhtml/Block/Sales/Order/Status/Edit.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Sales/Order/Status/Edit.php
rename to app/code/Mage/Adminhtml/Block/Sales/Order/Status/Edit.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Status/Edit/Form.php b/app/code/Mage/Adminhtml/Block/Sales/Order/Status/Edit/Form.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Sales/Order/Status/Edit/Form.php
rename to app/code/Mage/Adminhtml/Block/Sales/Order/Status/Edit/Form.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Status/Grid.php b/app/code/Mage/Adminhtml/Block/Sales/Order/Status/Grid.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Sales/Order/Status/Grid.php
rename to app/code/Mage/Adminhtml/Block/Sales/Order/Status/Grid.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Status/New.php b/app/code/Mage/Adminhtml/Block/Sales/Order/Status/New.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Sales/Order/Status/New.php
rename to app/code/Mage/Adminhtml/Block/Sales/Order/Status/New.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Status/New/Form.php b/app/code/Mage/Adminhtml/Block/Sales/Order/Status/New/Form.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Sales/Order/Status/New/Form.php
rename to app/code/Mage/Adminhtml/Block/Sales/Order/Status/New/Form.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Totalbar.php b/app/code/Mage/Adminhtml/Block/Sales/Order/Totalbar.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Sales/Order/Totalbar.php
rename to app/code/Mage/Adminhtml/Block/Sales/Order/Totalbar.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Totals.php b/app/code/Mage/Adminhtml/Block/Sales/Order/Totals.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Sales/Order/Totals.php
rename to app/code/Mage/Adminhtml/Block/Sales/Order/Totals.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Totals/Item.php b/app/code/Mage/Adminhtml/Block/Sales/Order/Totals/Item.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Sales/Order/Totals/Item.php
rename to app/code/Mage/Adminhtml/Block/Sales/Order/Totals/Item.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Totals/Tax.php b/app/code/Mage/Adminhtml/Block/Sales/Order/Totals/Tax.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Sales/Order/Totals/Tax.php
rename to app/code/Mage/Adminhtml/Block/Sales/Order/Totals/Tax.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/View.php b/app/code/Mage/Adminhtml/Block/Sales/Order/View.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Sales/Order/View.php
rename to app/code/Mage/Adminhtml/Block/Sales/Order/View.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/View/Form.php b/app/code/Mage/Adminhtml/Block/Sales/Order/View/Form.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Sales/Order/View/Form.php
rename to app/code/Mage/Adminhtml/Block/Sales/Order/View/Form.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/View/Giftmessage.php b/app/code/Mage/Adminhtml/Block/Sales/Order/View/Giftmessage.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Sales/Order/View/Giftmessage.php
rename to app/code/Mage/Adminhtml/Block/Sales/Order/View/Giftmessage.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/View/History.php b/app/code/Mage/Adminhtml/Block/Sales/Order/View/History.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Sales/Order/View/History.php
rename to app/code/Mage/Adminhtml/Block/Sales/Order/View/History.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/View/Info.php b/app/code/Mage/Adminhtml/Block/Sales/Order/View/Info.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Sales/Order/View/Info.php
rename to app/code/Mage/Adminhtml/Block/Sales/Order/View/Info.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/View/Items.php b/app/code/Mage/Adminhtml/Block/Sales/Order/View/Items.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Sales/Order/View/Items.php
rename to app/code/Mage/Adminhtml/Block/Sales/Order/View/Items.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/View/Items/Renderer/Default.php b/app/code/Mage/Adminhtml/Block/Sales/Order/View/Items/Renderer/Default.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Sales/Order/View/Items/Renderer/Default.php
rename to app/code/Mage/Adminhtml/Block/Sales/Order/View/Items/Renderer/Default.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/View/Messages.php b/app/code/Mage/Adminhtml/Block/Sales/Order/View/Messages.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Sales/Order/View/Messages.php
rename to app/code/Mage/Adminhtml/Block/Sales/Order/View/Messages.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/View/Tab/Creditmemos.php b/app/code/Mage/Adminhtml/Block/Sales/Order/View/Tab/Creditmemos.php
similarity index 90%
rename from app/code/core/Mage/Adminhtml/Block/Sales/Order/View/Tab/Creditmemos.php
rename to app/code/Mage/Adminhtml/Block/Sales/Order/View/Tab/Creditmemos.php
index 091484b9add41..eda1256cef9f8 100644
--- a/app/code/core/Mage/Adminhtml/Block/Sales/Order/View/Tab/Creditmemos.php
+++ b/app/code/Mage/Adminhtml/Block/Sales/Order/View/Tab/Creditmemos.php
@@ -76,19 +76,24 @@ protected function _prepareColumns()
{
$this->addColumn('increment_id', array(
'header' => Mage::helper('Mage_Sales_Helper_Data')->__('Credit Memo #'),
- 'width' => '120px',
'index' => 'increment_id',
+ 'header_css_class' => 'col-memo',
+ 'column_css_class' => 'col-memo'
));
$this->addColumn('billing_name', array(
'header' => Mage::helper('Mage_Sales_Helper_Data')->__('Bill to Name'),
'index' => 'billing_name',
+ 'header_css_class' => 'col-name',
+ 'column_css_class' => 'col-name'
));
$this->addColumn('created_at', array(
'header' => Mage::helper('Mage_Sales_Helper_Data')->__('Created At'),
'index' => 'created_at',
'type' => 'datetime',
+ 'header_css_class' => 'col-period',
+ 'column_css_class' => 'col-period'
));
$this->addColumn('state', array(
@@ -96,6 +101,8 @@ protected function _prepareColumns()
'index' => 'state',
'type' => 'options',
'options' => Mage::getModel('Mage_Sales_Model_Order_Creditmemo')->getStates(),
+ 'header_css_class' => 'col-status',
+ 'column_css_class' => 'col-status'
));
$this->addColumn('base_grand_total', array(
@@ -103,6 +110,8 @@ protected function _prepareColumns()
'index' => 'base_grand_total',
'type' => 'currency',
'currency' => 'base_currency_code',
+ 'header_css_class' => 'col-refunded',
+ 'column_css_class' => 'col-refunded'
));
return parent::_prepareColumns();
diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/View/Tab/History.php b/app/code/Mage/Adminhtml/Block/Sales/Order/View/Tab/History.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Sales/Order/View/Tab/History.php
rename to app/code/Mage/Adminhtml/Block/Sales/Order/View/Tab/History.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/View/Tab/Info.php b/app/code/Mage/Adminhtml/Block/Sales/Order/View/Tab/Info.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Sales/Order/View/Tab/Info.php
rename to app/code/Mage/Adminhtml/Block/Sales/Order/View/Tab/Info.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/View/Tab/Invoices.php b/app/code/Mage/Adminhtml/Block/Sales/Order/View/Tab/Invoices.php
similarity index 90%
rename from app/code/core/Mage/Adminhtml/Block/Sales/Order/View/Tab/Invoices.php
rename to app/code/Mage/Adminhtml/Block/Sales/Order/View/Tab/Invoices.php
index 63e393f62df2d..a3e0596df0d9d 100644
--- a/app/code/core/Mage/Adminhtml/Block/Sales/Order/View/Tab/Invoices.php
+++ b/app/code/Mage/Adminhtml/Block/Sales/Order/View/Tab/Invoices.php
@@ -77,18 +77,23 @@ protected function _prepareColumns()
$this->addColumn('increment_id', array(
'header' => Mage::helper('Mage_Sales_Helper_Data')->__('Invoice #'),
'index' => 'increment_id',
- 'width' => '120px',
+ 'header_css_class' => 'col-invoice-number',
+ 'column_css_class' => 'col-invoice-number'
));
$this->addColumn('billing_name', array(
'header' => Mage::helper('Mage_Sales_Helper_Data')->__('Bill to Name'),
'index' => 'billing_name',
+ 'header_css_class' => 'col-name',
+ 'column_css_class' => 'col-name'
));
$this->addColumn('created_at', array(
'header' => Mage::helper('Mage_Sales_Helper_Data')->__('Invoice Date'),
'index' => 'created_at',
'type' => 'datetime',
+ 'header_css_class' => 'col-period',
+ 'column_css_class' => 'col-period'
));
$this->addColumn('state', array(
@@ -96,6 +101,8 @@ protected function _prepareColumns()
'index' => 'state',
'type' => 'options',
'options' => Mage::getModel('Mage_Sales_Model_Order_Invoice')->getStates(),
+ 'header_css_class' => 'col-status',
+ 'column_css_class' => 'col-status'
));
$this->addColumn('base_grand_total', array(
@@ -103,6 +110,8 @@ protected function _prepareColumns()
'index' => 'base_grand_total',
'type' => 'currency',
'currency' => 'base_currency_code',
+ 'header_css_class' => 'col-qty',
+ 'column_css_class' => 'col-qty'
));
return parent::_prepareColumns();
diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/View/Tab/Shipments.php b/app/code/Mage/Adminhtml/Block/Sales/Order/View/Tab/Shipments.php
similarity index 91%
rename from app/code/core/Mage/Adminhtml/Block/Sales/Order/View/Tab/Shipments.php
rename to app/code/Mage/Adminhtml/Block/Sales/Order/View/Tab/Shipments.php
index dd73813c98d0e..5391e5c0f170e 100644
--- a/app/code/core/Mage/Adminhtml/Block/Sales/Order/View/Tab/Shipments.php
+++ b/app/code/Mage/Adminhtml/Block/Sales/Order/View/Tab/Shipments.php
@@ -71,23 +71,31 @@ protected function _prepareColumns()
$this->addColumn('increment_id', array(
'header' => Mage::helper('Mage_Sales_Helper_Data')->__('Shipment #'),
'index' => 'increment_id',
+ 'header_css_class' => 'col-memo',
+ 'column_css_class' => 'col-memo'
));
$this->addColumn('shipping_name', array(
'header' => Mage::helper('Mage_Sales_Helper_Data')->__('Ship to Name'),
'index' => 'shipping_name',
+ 'header_css_class' => 'col-name',
+ 'column_css_class' => 'col-name'
));
$this->addColumn('created_at', array(
'header' => Mage::helper('Mage_Sales_Helper_Data')->__('Date Shipped'),
'index' => 'created_at',
'type' => 'datetime',
+ 'header_css_class' => 'col-period',
+ 'column_css_class' => 'col-period'
));
$this->addColumn('total_qty', array(
'header' => Mage::helper('Mage_Sales_Helper_Data')->__('Total Qty'),
'index' => 'total_qty',
'type' => 'number',
+ 'header_css_class' => 'col-qty',
+ 'column_css_class' => 'col-qty'
));
return parent::_prepareColumns();
diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/View/Tab/Transactions.php b/app/code/Mage/Adminhtml/Block/Sales/Order/View/Tab/Transactions.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Sales/Order/View/Tab/Transactions.php
rename to app/code/Mage/Adminhtml/Block/Sales/Order/View/Tab/Transactions.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/View/Tabs.php b/app/code/Mage/Adminhtml/Block/Sales/Order/View/Tabs.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Sales/Order/View/Tabs.php
rename to app/code/Mage/Adminhtml/Block/Sales/Order/View/Tabs.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Reorder/Renderer/Action.php b/app/code/Mage/Adminhtml/Block/Sales/Reorder/Renderer/Action.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Sales/Reorder/Renderer/Action.php
rename to app/code/Mage/Adminhtml/Block/Sales/Reorder/Renderer/Action.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Shipment.php b/app/code/Mage/Adminhtml/Block/Sales/Shipment.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Sales/Shipment.php
rename to app/code/Mage/Adminhtml/Block/Sales/Shipment.php
diff --git a/app/code/Mage/Adminhtml/Block/Sales/Shipment/Grid.php b/app/code/Mage/Adminhtml/Block/Sales/Shipment/Grid.php
new file mode 100644
index 0000000000000..1524e07d0d593
--- /dev/null
+++ b/app/code/Mage/Adminhtml/Block/Sales/Shipment/Grid.php
@@ -0,0 +1,202 @@
+
+ */
+class Mage_Adminhtml_Block_Sales_Shipment_Grid extends Mage_Adminhtml_Block_Widget_Grid
+{
+
+ /**
+ * Initialization
+ */
+ protected function _construct()
+ {
+ parent::_construct();
+ $this->setId('sales_shipment_grid');
+ $this->setDefaultSort('created_at');
+ $this->setDefaultDir('DESC');
+ }
+
+ /**
+ * Retrieve collection class
+ *
+ * @return string
+ */
+ protected function _getCollectionClass()
+ {
+ return 'Mage_Sales_Model_Resource_Order_Shipment_Grid_Collection';
+ }
+
+ /**
+ * Prepare and set collection of grid
+ *
+ * @return Mage_Adminhtml_Block_Widget_Grid
+ */
+ protected function _prepareCollection()
+ {
+ $collection = Mage::getResourceModel($this->_getCollectionClass());
+ $this->setCollection($collection);
+ return parent::_prepareCollection();
+ }
+
+ /**
+ * Prepare and add columns to grid
+ *
+ * @return Mage_Adminhtml_Block_Widget_Grid
+ */
+ protected function _prepareColumns()
+ {
+ $this->addColumn('increment_id', array(
+ 'header' => Mage::helper('Mage_Sales_Helper_Data')->__('Shipment #'),
+ 'index' => 'increment_id',
+ 'type' => 'text',
+ 'header_css_class' => 'col-shipment-number',
+ 'column_css_class' => 'col-shipment-number'
+ ));
+
+ $this->addColumn('created_at', array(
+ 'header' => Mage::helper('Mage_Sales_Helper_Data')->__('Date Shipped'),
+ 'index' => 'created_at',
+ 'type' => 'datetime',
+ 'header_css_class' => 'col-period',
+ 'column_css_class' => 'col-period'
+ ));
+
+ $this->addColumn('order_increment_id', array(
+ 'header' => Mage::helper('Mage_Sales_Helper_Data')->__('Order #'),
+ 'index' => 'order_increment_id',
+ 'type' => 'text',
+ 'header_css_class' => 'col-order-number',
+ 'column_css_class' => 'col-order-number'
+ ));
+
+ $this->addColumn('order_created_at', array(
+ 'header' => Mage::helper('Mage_Sales_Helper_Data')->__('Order Date'),
+ 'index' => 'order_created_at',
+ 'type' => 'datetime',
+ 'header_css_class' => 'col-period',
+ 'column_css_class' => 'col-period'
+ ));
+
+ $this->addColumn('shipping_name', array(
+ 'header' => Mage::helper('Mage_Sales_Helper_Data')->__('Ship to Name'),
+ 'index' => 'shipping_name',
+ 'header_css_class' => 'col-memo',
+ 'column_css_class' => 'col-memo'
+ ));
+
+ $this->addColumn('total_qty', array(
+ 'header' => Mage::helper('Mage_Sales_Helper_Data')->__('Total Qty'),
+ 'index' => 'total_qty',
+ 'type' => 'number',
+ 'header_css_class' => 'col-qty',
+ 'column_css_class' => 'col-qty'
+ ));
+
+ $this->addColumn('action',
+ array(
+ 'header' => Mage::helper('Mage_Sales_Helper_Data')->__('Action'),
+ 'type' => 'action',
+ 'getter' => 'getId',
+ 'actions' => array(
+ array(
+ 'caption' => Mage::helper('Mage_Sales_Helper_Data')->__('View'),
+ 'url' => array('base'=>'*/sales_shipment/view'),
+ 'field' => 'shipment_id'
+ )
+ ),
+ 'filter' => false,
+ 'sortable' => false,
+ 'is_system' => true,
+ 'header_css_class' => 'col-actions',
+ 'column_css_class' => 'col-actions'
+ ));
+
+ $this->addExportType('*/*/exportCsv', Mage::helper('Mage_Sales_Helper_Data')->__('CSV'));
+ $this->addExportType('*/*/exportExcel', Mage::helper('Mage_Sales_Helper_Data')->__('Excel XML'));
+
+ return parent::_prepareColumns();
+ }
+
+ /**
+ * Get url for row
+ *
+ * @param string $row
+ * @return string
+ */
+ public function getRowUrl($row)
+ {
+ if (!Mage::getSingleton('Mage_Core_Model_Authorization')
+ ->isAllowed(Mage_Backend_Model_Acl_Config::ACL_RESOURCE_ALL)
+ ) {
+ return false;
+ }
+
+ return $this->getUrl('*/sales_shipment/view',
+ array(
+ 'shipment_id'=> $row->getId(),
+ )
+ );
+ }
+
+ /**
+ * Prepare and set options for massaction
+ *
+ * @return Mage_Adminhtml_Block_Sales_Shipment_Grid
+ */
+ protected function _prepareMassaction()
+ {
+ $this->setMassactionIdField('entity_id');
+ $this->getMassactionBlock()->setFormFieldName('shipment_ids');
+ $this->getMassactionBlock()->setUseSelectAll(false);
+
+ $this->getMassactionBlock()->addItem('pdfshipments_order', array(
+ 'label'=> Mage::helper('Mage_Sales_Helper_Data')->__('PDF Packing Slips'),
+ 'url' => $this->getUrl('*/sales_shipment/pdfshipments'),
+ ));
+
+ $this->getMassactionBlock()->addItem('print_shipping_label', array(
+ 'label'=> Mage::helper('Mage_Sales_Helper_Data')->__('Print Shipping Labels'),
+ 'url' => $this->getUrl('*/sales_order_shipment/massPrintShippingLabel'),
+ ));
+
+ return $this;
+ }
+
+ /**
+ * Get url of grid
+ *
+ * @return string
+ */
+ public function getGridUrl()
+ {
+ return $this->getUrl('*/*/*', array('_current' => true));
+ }
+
+}
diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Totals.php b/app/code/Mage/Adminhtml/Block/Sales/Totals.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Sales/Totals.php
rename to app/code/Mage/Adminhtml/Block/Sales/Totals.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Transactions.php b/app/code/Mage/Adminhtml/Block/Sales/Transactions.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Sales/Transactions.php
rename to app/code/Mage/Adminhtml/Block/Sales/Transactions.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Transactions/Child/Grid.php b/app/code/Mage/Adminhtml/Block/Sales/Transactions/Child/Grid.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Sales/Transactions/Child/Grid.php
rename to app/code/Mage/Adminhtml/Block/Sales/Transactions/Child/Grid.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Transactions/Detail.php b/app/code/Mage/Adminhtml/Block/Sales/Transactions/Detail.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Sales/Transactions/Detail.php
rename to app/code/Mage/Adminhtml/Block/Sales/Transactions/Detail.php
diff --git a/app/code/Mage/Adminhtml/Block/Sales/Transactions/Detail/Grid.php b/app/code/Mage/Adminhtml/Block/Sales/Transactions/Detail/Grid.php
new file mode 100644
index 0000000000000..0fbd22617c75d
--- /dev/null
+++ b/app/code/Mage/Adminhtml/Block/Sales/Transactions/Detail/Grid.php
@@ -0,0 +1,104 @@
+
+ */
+class Mage_Adminhtml_Block_Sales_Transactions_Detail_Grid extends Mage_Adminhtml_Block_Widget_Grid
+{
+ /**
+ * Initialize default sorting and html ID
+ */
+ protected function _construct()
+ {
+ $this->setId('transactionDetailsGrid');
+ $this->setPagerVisibility(false);
+ $this->setFilterVisibility(false);
+ }
+
+ /**
+ * Prepare collection for grid
+ *
+ * @return Mage_Adminhtml_Block_Widget_Grid
+ */
+ protected function _prepareCollection()
+ {
+ $collection = new Varien_Data_Collection();
+ foreach ($this->getTransactionAdditionalInfo() as $key => $value) {
+ $data = new Varien_Object(array('key' => $key, 'value' => $value));
+ $collection->addItem($data);
+ }
+
+ $this->setCollection($collection);
+ return parent::_prepareCollection();
+ }
+
+ /**
+ * Add columns to grid
+ *
+ * @return Mage_Adminhtml_Block_Widget_Grid
+ */
+ protected function _prepareColumns()
+ {
+ $this->addColumn('key', array(
+ 'header' => Mage::helper('Mage_Sales_Helper_Data')->__('Key'),
+ 'index' => 'key',
+ 'sortable' => false,
+ 'type' => 'text',
+ 'header_css_class' => 'col-key',
+ 'column_css_class' => 'col-key'
+ ));
+
+ $this->addColumn('value', array(
+ 'header' => Mage::helper('Mage_Sales_Helper_Data')->__('Value'),
+ 'index' => 'value',
+ 'sortable' => false,
+ 'type' => 'text',
+ 'escape' => true,
+ 'header_css_class' => 'col-value',
+ 'column_css_class' => 'col-value'
+ ));
+
+ return parent::_prepareColumns();
+ }
+
+ /**
+ * Retrieve Transaction addtitional info
+ *
+ * @return array
+ */
+ public function getTransactionAdditionalInfo()
+ {
+ $info = Mage::registry('current_transaction')->getAdditionalInformation(
+ Mage_Sales_Model_Order_Payment_Transaction::RAW_DETAILS
+ );
+ return (is_array($info)) ? $info : array();
+ }
+}
diff --git a/app/code/Mage/Adminhtml/Block/Sales/Transactions/Grid.php b/app/code/Mage/Adminhtml/Block/Sales/Transactions/Grid.php
new file mode 100644
index 0000000000000..82b293e6cb9bb
--- /dev/null
+++ b/app/code/Mage/Adminhtml/Block/Sales/Transactions/Grid.php
@@ -0,0 +1,177 @@
+
+ */
+class Mage_Adminhtml_Block_Sales_Transactions_Grid extends Mage_Adminhtml_Block_Widget_Grid
+{
+ /**
+ * Set grid params
+ *
+ */
+ protected function _construct()
+ {
+ parent::_construct();
+ $this->setId('order_transactions');
+ $this->setUseAjax(true);
+ $this->setDefaultSort('created_at');
+ $this->setDefaultDir('DESC');
+ $this->setSaveParametersInSession(true);
+ }
+
+ /**
+ * Prepare collection for grid
+ *
+ * @return Mage_Adminhtml_Block_Widget_Grid
+ */
+ protected function _prepareCollection()
+ {
+ $collection = $this->getCollection();
+ if (!$collection) {
+ $collection = Mage::getResourceModel('Mage_Sales_Model_Resource_Order_Payment_Transaction_Collection');
+ }
+ $order = Mage::registry('current_order');
+ if ($order) {
+ $collection->addOrderIdFilter($order->getId());
+ }
+ $collection->addOrderInformation(array('increment_id'));
+ $collection->addPaymentInformation(array('method'));
+ $this->setCollection($collection);
+ return parent::_prepareCollection();
+ }
+
+ /**
+ * Add columns to grid
+ *
+ * @return Mage_Adminhtml_Block_Widget_Grid
+ */
+ protected function _prepareColumns()
+ {
+ $this->addColumn('transaction_id', array(
+ 'header' => Mage::helper('Mage_Sales_Helper_Data')->__('ID #'),
+ 'index' => 'transaction_id',
+ 'type' => 'number',
+ 'header_css_class' => 'col-id',
+ 'column_css_class' => 'col-id'
+ ));
+
+ $this->addColumn('increment_id', array(
+ 'header' => Mage::helper('Mage_Sales_Helper_Data')->__('Order ID'),
+ 'index' => 'increment_id',
+ 'type' => 'text',
+ 'header_css_class' => 'col-order-id',
+ 'column_css_class' => 'col-order-id'
+ ));
+
+ $this->addColumn('txn_id', array(
+ 'header' => Mage::helper('Mage_Sales_Helper_Data')->__('Transaction ID'),
+ 'index' => 'txn_id',
+ 'type' => 'text',
+ 'header_css_class' => 'col-transaction-id',
+ 'column_css_class' => 'col-transaction-id'
+ ));
+
+ $this->addColumn('parent_txn_id', array(
+ 'header' => Mage::helper('Mage_Sales_Helper_Data')->__('Parent Transaction ID'),
+ 'index' => 'parent_txn_id',
+ 'type' => 'text',
+ 'header_css_class' => 'col-parent-transaction-id',
+ 'column_css_class' => 'col-parent-transaction-id'
+ ));
+
+ $this->addColumn('method', array(
+ 'header' => Mage::helper('Mage_Sales_Helper_Data')->__('Payment Method Name'),
+ 'index' => 'method',
+ 'type' => 'options',
+ 'options' => Mage::helper('Mage_Payment_Helper_Data')->getPaymentMethodList(true),
+ 'option_groups' => Mage::helper('Mage_Payment_Helper_Data')->getPaymentMethodList(true, true, true),
+ 'header_css_class' => 'col-method',
+ 'column_css_class' => 'col-method'
+ ));
+
+ $this->addColumn('txn_type', array(
+ 'header' => Mage::helper('Mage_Sales_Helper_Data')->__('Transaction Type'),
+ 'index' => 'txn_type',
+ 'type' => 'options',
+ 'options' => Mage::getSingleton('Mage_Sales_Model_Order_Payment_Transaction')->getTransactionTypes(),
+ 'header_css_class' => 'col-transaction-type',
+ 'column_css_class' => 'col-transaction-type'
+ ));
+
+ $this->addColumn('is_closed', array(
+ 'header' => Mage::helper('Mage_Sales_Helper_Data')->__('Is Closed'),
+ 'index' => 'is_closed',
+ 'width' => 1,
+ 'type' => 'options',
+ 'align' => 'center',
+ 'options' => array(
+ 1 => Mage::helper('Mage_Sales_Helper_Data')->__('Yes'),
+ 0 => Mage::helper('Mage_Sales_Helper_Data')->__('No'),
+ ),
+ 'header_css_class' => 'col-closed',
+ 'column_css_class' => 'col-closed'
+ ));
+
+ $this->addColumn('created_at', array(
+ 'header' => Mage::helper('Mage_Sales_Helper_Data')->__('Created At'),
+ 'index' => 'created_at',
+ 'width' => 1,
+ 'type' => 'datetime',
+ 'align' => 'center',
+ 'default' => $this->__('N/A'),
+ 'html_decorators' => array('nobr'),
+ 'header_css_class' => 'col-period',
+ 'column_css_class' => 'col-period'
+ ));
+
+ return parent::_prepareColumns();
+ }
+
+ /**
+ * Retrieve grid url
+ *
+ * @return string
+ */
+ public function getGridUrl()
+ {
+ return $this->getUrl('*/*/grid', array('_current' => true));
+ }
+
+ /**
+ * Retrieve row url
+ *
+ * @return string
+ */
+ public function getRowUrl($item)
+ {
+ return $this->getUrl('*/*/view', array('txn_id' => $item->getId()));
+ }
+}
diff --git a/app/code/core/Mage/Adminhtml/Block/Shipping/Carrier/Tablerate/Grid.php b/app/code/Mage/Adminhtml/Block/Shipping/Carrier/Tablerate/Grid.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Shipping/Carrier/Tablerate/Grid.php
rename to app/code/Mage/Adminhtml/Block/Shipping/Carrier/Tablerate/Grid.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Sitemap.php b/app/code/Mage/Adminhtml/Block/Sitemap.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Sitemap.php
rename to app/code/Mage/Adminhtml/Block/Sitemap.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Sitemap/Edit.php b/app/code/Mage/Adminhtml/Block/Sitemap/Edit.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Sitemap/Edit.php
rename to app/code/Mage/Adminhtml/Block/Sitemap/Edit.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Sitemap/Edit/Form.php b/app/code/Mage/Adminhtml/Block/Sitemap/Edit/Form.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Sitemap/Edit/Form.php
rename to app/code/Mage/Adminhtml/Block/Sitemap/Edit/Form.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Sitemap/Grid/Renderer/Action.php b/app/code/Mage/Adminhtml/Block/Sitemap/Grid/Renderer/Action.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Sitemap/Grid/Renderer/Action.php
rename to app/code/Mage/Adminhtml/Block/Sitemap/Grid/Renderer/Action.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Sitemap/Grid/Renderer/Link.php b/app/code/Mage/Adminhtml/Block/Sitemap/Grid/Renderer/Link.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Sitemap/Grid/Renderer/Link.php
rename to app/code/Mage/Adminhtml/Block/Sitemap/Grid/Renderer/Link.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Sitemap/Grid/Renderer/Time.php b/app/code/Mage/Adminhtml/Block/Sitemap/Grid/Renderer/Time.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Sitemap/Grid/Renderer/Time.php
rename to app/code/Mage/Adminhtml/Block/Sitemap/Grid/Renderer/Time.php
diff --git a/app/code/core/Mage/Adminhtml/Block/System/Account/Edit.php b/app/code/Mage/Adminhtml/Block/System/Account/Edit.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/System/Account/Edit.php
rename to app/code/Mage/Adminhtml/Block/System/Account/Edit.php
diff --git a/app/code/core/Mage/Adminhtml/Block/System/Account/Edit/Form.php b/app/code/Mage/Adminhtml/Block/System/Account/Edit/Form.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/System/Account/Edit/Form.php
rename to app/code/Mage/Adminhtml/Block/System/Account/Edit/Form.php
diff --git a/app/code/core/Mage/Adminhtml/Block/System/Cache/Edit.php b/app/code/Mage/Adminhtml/Block/System/Cache/Edit.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/System/Cache/Edit.php
rename to app/code/Mage/Adminhtml/Block/System/Cache/Edit.php
diff --git a/app/code/core/Mage/Adminhtml/Block/System/Cache/Form.php b/app/code/Mage/Adminhtml/Block/System/Cache/Form.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/System/Cache/Form.php
rename to app/code/Mage/Adminhtml/Block/System/Cache/Form.php
diff --git a/app/code/core/Mage/Adminhtml/Block/System/Currency.php b/app/code/Mage/Adminhtml/Block/System/Currency.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/System/Currency.php
rename to app/code/Mage/Adminhtml/Block/System/Currency.php
diff --git a/app/code/core/Mage/Adminhtml/Block/System/Currency/Edit/Form.php b/app/code/Mage/Adminhtml/Block/System/Currency/Edit/Form.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/System/Currency/Edit/Form.php
rename to app/code/Mage/Adminhtml/Block/System/Currency/Edit/Form.php
diff --git a/app/code/core/Mage/Adminhtml/Block/System/Currency/Edit/Tab/Main.php b/app/code/Mage/Adminhtml/Block/System/Currency/Edit/Tab/Main.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/System/Currency/Edit/Tab/Main.php
rename to app/code/Mage/Adminhtml/Block/System/Currency/Edit/Tab/Main.php
diff --git a/app/code/core/Mage/Adminhtml/Block/System/Currency/Edit/Tab/Rates.php b/app/code/Mage/Adminhtml/Block/System/Currency/Edit/Tab/Rates.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/System/Currency/Edit/Tab/Rates.php
rename to app/code/Mage/Adminhtml/Block/System/Currency/Edit/Tab/Rates.php
diff --git a/app/code/core/Mage/Adminhtml/Block/System/Currency/Edit/Tabs.php b/app/code/Mage/Adminhtml/Block/System/Currency/Edit/Tabs.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/System/Currency/Edit/Tabs.php
rename to app/code/Mage/Adminhtml/Block/System/Currency/Edit/Tabs.php
diff --git a/app/code/core/Mage/Adminhtml/Block/System/Currency/Rate/Matrix.php b/app/code/Mage/Adminhtml/Block/System/Currency/Rate/Matrix.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/System/Currency/Rate/Matrix.php
rename to app/code/Mage/Adminhtml/Block/System/Currency/Rate/Matrix.php
diff --git a/app/code/core/Mage/Adminhtml/Block/System/Currency/Rate/Services.php b/app/code/Mage/Adminhtml/Block/System/Currency/Rate/Services.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/System/Currency/Rate/Services.php
rename to app/code/Mage/Adminhtml/Block/System/Currency/Rate/Services.php
diff --git a/app/code/Mage/Adminhtml/Block/System/Design.php b/app/code/Mage/Adminhtml/Block/System/Design.php
new file mode 100644
index 0000000000000..4cd3d49734a94
--- /dev/null
+++ b/app/code/Mage/Adminhtml/Block/System/Design.php
@@ -0,0 +1,44 @@
+setTemplate('system/design/index.phtml');
+
+ $this->addChild('add_new_button', 'Mage_Adminhtml_Block_Widget_Button', array(
+ 'label' => Mage::helper('Mage_Catalog_Helper_Data')->__('Add Design Change'),
+ 'onclick' => "setLocation('".$this->getUrl('*/*/new')."')",
+ 'class' => 'add'
+ ));
+
+ $this->getLayout()->getBlock('page-title')->setPageTitle('Schedule');
+
+ return parent::_prepareLayout();
+ }
+}
diff --git a/app/code/core/Mage/Adminhtml/Block/System/Design/Edit.php b/app/code/Mage/Adminhtml/Block/System/Design/Edit.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/System/Design/Edit.php
rename to app/code/Mage/Adminhtml/Block/System/Design/Edit.php
diff --git a/app/code/core/Mage/Adminhtml/Block/System/Design/Edit/Tab/General.php b/app/code/Mage/Adminhtml/Block/System/Design/Edit/Tab/General.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/System/Design/Edit/Tab/General.php
rename to app/code/Mage/Adminhtml/Block/System/Design/Edit/Tab/General.php
diff --git a/app/code/core/Mage/Adminhtml/Block/System/Design/Edit/Tabs.php b/app/code/Mage/Adminhtml/Block/System/Design/Edit/Tabs.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/System/Design/Edit/Tabs.php
rename to app/code/Mage/Adminhtml/Block/System/Design/Edit/Tabs.php
diff --git a/app/code/core/Mage/Adminhtml/Block/System/Email/Template.php b/app/code/Mage/Adminhtml/Block/System/Email/Template.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/System/Email/Template.php
rename to app/code/Mage/Adminhtml/Block/System/Email/Template.php
diff --git a/app/code/Mage/Adminhtml/Block/System/Email/Template/Edit.php b/app/code/Mage/Adminhtml/Block/System/Email/Template/Edit.php
new file mode 100644
index 0000000000000..81a4bb11edad2
--- /dev/null
+++ b/app/code/Mage/Adminhtml/Block/System/Email/Template/Edit.php
@@ -0,0 +1,466 @@
+
+ * @method array getTemplateOptions()
+ */
+class Mage_Adminhtml_Block_System_Email_Template_Edit extends Mage_Adminhtml_Block_Widget
+{
+ /**
+ * @var Mage_Core_Model_Registry
+ */
+ protected $_registryManager;
+
+ /**
+ * @var Mage_Backend_Model_Menu_Config
+ */
+ protected $_menuConfig;
+
+ /**
+ * @var Mage_Backend_Model_Config_Structure
+ */
+ protected $_configStructure;
+
+ /**
+ * Template file
+ *
+ * @var string
+ */
+ protected $_template = 'system/email/template/edit.phtml';
+
+ /**
+ * @param Mage_Core_Block_Template_Context $context
+ * @param Mage_Core_Model_Registry $registry
+ * @param Mage_Backend_Model_Menu_Config $menuConfig
+ * @param Mage_Backend_Model_Config_Structure $configStructure
+ * @param array $data
+ */
+ public function __construct(
+ Mage_Core_Block_Template_Context $context,
+ Mage_Core_Model_Registry $registry,
+ Mage_Backend_Model_Menu_Config $menuConfig,
+ Mage_Backend_Model_Config_Structure $configStructure,
+ array $data = array()
+ )
+ {
+ parent::__construct($context, $data);
+ $this->_registryManager = $registry;
+ $this->_menuConfig = $menuConfig;
+ $this->_configStructure = $configStructure;
+ }
+
+ protected function _prepareLayout()
+ {
+ $this->setChild('back_button',
+ $this->getLayout()->createBlock('Mage_Adminhtml_Block_Widget_Button')
+ ->setData(
+ array(
+ 'label' => Mage::helper('Mage_Adminhtml_Helper_Data')->__('Back'),
+ 'onclick' => "window.location.href = '" . $this->getUrl('*/*') . "'",
+ 'class' => 'back'
+ )
+ )
+ );
+
+
+ $this->setChild('reset_button',
+ $this->getLayout()->createBlock('Mage_Adminhtml_Block_Widget_Button')
+ ->setData(
+ array(
+ 'label' => Mage::helper('Mage_Adminhtml_Helper_Data')->__('Reset'),
+ 'onclick' => 'window.location.href = window.location.href'
+ )
+ )
+ );
+
+
+ $this->setChild('delete_button',
+ $this->getLayout()->createBlock('Mage_Adminhtml_Block_Widget_Button')
+ ->setData(
+ array(
+ 'label' => Mage::helper('Mage_Adminhtml_Helper_Data')->__('Delete Template'),
+ 'onclick' => 'templateControl.deleteTemplate();',
+ 'class' => 'delete'
+ )
+ )
+ );
+
+ $this->setChild('to_plain_button',
+ $this->getLayout()->createBlock('Mage_Adminhtml_Block_Widget_Button')
+ ->setData(
+ array(
+ 'label' => Mage::helper('Mage_Adminhtml_Helper_Data')->__('Convert to Plain Text'),
+ 'onclick' => 'templateControl.stripTags();',
+ 'id' => 'convert_button'
+ )
+ )
+ );
+
+
+ $this->setChild('to_html_button',
+ $this->getLayout()->createBlock('Mage_Adminhtml_Block_Widget_Button')
+ ->setData(
+ array(
+ 'label' => Mage::helper('Mage_Adminhtml_Helper_Data')->__('Return Html Version'),
+ 'onclick' => 'templateControl.unStripTags();',
+ 'id' => 'convert_button_back',
+ 'style' => 'display:none'
+ )
+ )
+ );
+
+ $this->setChild('toggle_button',
+ $this->getLayout()->createBlock('Mage_Adminhtml_Block_Widget_Button')
+ ->setData(
+ array(
+ 'label' => Mage::helper('Mage_Adminhtml_Helper_Data')->__('Toggle Editor'),
+ 'onclick' => 'templateControl.toggleEditor();',
+ 'id' => 'toggle_button'
+ )
+ )
+ );
+
+
+ $this->setChild('preview_button',
+ $this->getLayout()->createBlock('Mage_Adminhtml_Block_Widget_Button')
+ ->setData(
+ array(
+ 'label' => Mage::helper('Mage_Adminhtml_Helper_Data')->__('Preview Template'),
+ 'onclick' => 'templateControl.preview();'
+ )
+ )
+ );
+
+ $this->setChild('save_button',
+ $this->getLayout()->createBlock('Mage_Adminhtml_Block_Widget_Button')
+ ->setData(
+ array(
+ 'label' => Mage::helper('Mage_Adminhtml_Helper_Data')->__('Save Template'),
+ 'onclick' => 'templateControl.save();',
+ 'class' => 'save'
+ )
+ )
+ );
+
+ $this->setChild('load_button',
+ $this->getLayout()->createBlock('Mage_Adminhtml_Block_Widget_Button')
+ ->setData(
+ array(
+ 'label' => Mage::helper('Mage_Adminhtml_Helper_Data')->__('Load Template'),
+ 'onclick' => 'templateControl.load();',
+ 'type' => 'button',
+ 'class' => 'save'
+ )
+ )
+ );
+
+
+ $this->addChild('form', 'Mage_Adminhtml_Block_System_Email_Template_Edit_Form');
+ return parent::_prepareLayout();
+ }
+
+ /**
+ * Collect, sort and set template options
+ *
+ * @return Mage_Adminhtml_Block_System_Email_Template_Edit
+ */
+ protected function _beforeToHtml()
+ {
+ $groupedOptions = array();
+ foreach (Mage_Core_Model_Email_Template::getDefaultTemplatesAsOptionsArray() as $option) {
+ $groupedOptions[$option['group']][] = $option;
+ }
+ ksort($groupedOptions);
+ $this->setData('template_options', $groupedOptions);
+
+ return parent::_beforeToHtml();
+ }
+
+ public function getBackButtonHtml()
+ {
+ return $this->getChildHtml('back_button');
+ }
+
+ public function getToggleButtonHtml()
+ {
+ return $this->getChildHtml('toggle_button');
+ }
+
+
+ public function getResetButtonHtml()
+ {
+ return $this->getChildHtml('reset_button');
+ }
+
+ public function getToPlainButtonHtml()
+ {
+ return $this->getChildHtml('to_plain_button');
+ }
+
+ public function getToHtmlButtonHtml()
+ {
+ return $this->getChildHtml('to_html_button');
+ }
+
+ public function getSaveButtonHtml()
+ {
+ return $this->getChildHtml('save_button');
+ }
+
+ public function getPreviewButtonHtml()
+ {
+ return $this->getChildHtml('preview_button');
+ }
+
+ public function getDeleteButtonHtml()
+ {
+ return $this->getChildHtml('delete_button');
+ }
+
+ public function getLoadButtonHtml()
+ {
+ return $this->getChildHtml('load_button');
+ }
+
+ /**
+ * Return edit flag for block
+ *
+ * @return boolean
+ */
+ public function getEditMode()
+ {
+ return $this->getEmailTemplate()->getId();
+ }
+
+ /**
+ * Return header text for form
+ *
+ * @return string
+ */
+ public function getHeaderText()
+ {
+ if($this->getEditMode()) {
+ return Mage::helper('Mage_Adminhtml_Helper_Data')->__('Edit Email Template');
+ }
+
+ return Mage::helper('Mage_Adminhtml_Helper_Data')->__('New Email Template');
+ }
+
+
+ /**
+ * Return form block HTML
+ *
+ * @return string
+ */
+ public function getFormHtml()
+ {
+ return $this->getChildHtml('form');
+ }
+
+ /**
+ * Return action url for form
+ *
+ * @return string
+ */
+ public function getSaveUrl()
+ {
+ return $this->getUrl('*/*/save', array('_current' => true));
+ }
+
+ /**
+ * Return preview action url for form
+ *
+ * @return string
+ */
+ public function getPreviewUrl()
+ {
+ return $this->getUrl('*/*/preview');
+ }
+
+ public function isTextType()
+ {
+ return $this->getEmailTemplate()->isPlain();
+ }
+
+ /**
+ * Return delete url for customer group
+ *
+ * @return string
+ */
+ public function getDeleteUrl()
+ {
+ return $this->getUrl('*/*/delete', array('_current' => true));
+ }
+
+ /**
+ * Retrive email template model
+ *
+ * @return Mage_Core_Model_Email_Template
+ */
+ public function getEmailTemplate()
+ {
+ return $this->_registryManager->registry('current_email_template');
+ }
+
+ /**
+ * Load template url
+ *
+ * @return string
+ */
+ public function getLoadUrl()
+ {
+ return $this->getUrl('*/*/defaultTemplate');
+ }
+
+ /**
+ * Get paths of where current template is used as default
+ *
+ * @param bool $asJSON
+ * @return string
+ */
+ public function getUsedDefaultForPaths($asJSON = true)
+ {
+ /** @var $template Mage_Adminhtml_Model_Email_Template */
+ $template = $this->getEmailTemplate();
+ $paths = $template->getSystemConfigPathsWhereUsedAsDefault();
+ $pathsParts = $this->_getSystemConfigPathsParts($paths);
+ if($asJSON){
+ return $this->helper('Mage_Core_Helper_Data')->jsonEncode($pathsParts);
+ }
+ return $pathsParts;
+ }
+
+ /**
+ * Get paths of where current template is currently used
+ *
+ * @param bool $asJSON
+ * @return string
+ */
+ public function getUsedCurrentlyForPaths($asJSON = true)
+ {
+ /** @var $template Mage_Adminhtml_Model_Email_Template */
+ $template = $this->getEmailTemplate();
+ $paths = $template->getSystemConfigPathsWhereUsedCurrently();
+ $pathsParts = $this->_getSystemConfigPathsParts($paths);
+ if($asJSON){
+ return Mage::helper('Mage_Core_Helper_Data')->jsonEncode($pathsParts);
+ }
+ return $pathsParts;
+ }
+
+ /**
+ * Convert xml config pathes to decorated names
+ *
+ * @param array $paths
+ * @return array
+ */
+ protected function _getSystemConfigPathsParts($paths)
+ {
+ $result = $urlParams = $prefixParts = array();
+ $scopeLabel = $this->helper('Mage_Backend_Helper_Data')->__('GLOBAL');
+ if ($paths) {
+ /** @var $menu Mage_Backend_Model_Menu */
+ $menu = $this->_menuConfig->getMenu();
+ $item = $menu->get('Mage_Adminhtml::system');
+ // create prefix path parts
+ $prefixParts[] = array(
+ 'title' => $item->getModuleHelper()->__($item->getTitle()),
+ );
+ $item = $menu->get('Mage_Adminhtml::system_config');
+ $prefixParts[] = array(
+ 'title' => $item->getModuleHelper()->__($item->getTitle()),
+ 'url' => $this->getUrl('adminhtml/system_config/'),
+ );
+
+ $pathParts = $prefixParts;
+ foreach ($paths as $pathData) {
+ $pathDataParts = explode('/', $pathData['path']);
+ $sectionName = array_shift($pathDataParts);
+
+ $urlParams = array('section' => $sectionName);
+ if (isset($pathData['scope']) && isset($pathData['scope_id'])) {
+ switch ($pathData['scope']) {
+ case 'stores':
+ $store = Mage::app()->getStore($pathData['scope_id']);
+ if ($store) {
+ $urlParams['website'] = $store->getWebsite()->getCode();
+ $urlParams['store'] = $store->getCode();
+ $scopeLabel = $store->getWebsite()->getName() . '/' . $store->getName();
+ }
+ break;
+ case 'websites':
+ $website = Mage::app()->getWebsite($pathData['scope_id']);
+ if ($website) {
+ $urlParams['website'] = $website->getCode();
+ $scopeLabel = $website->getName();
+ }
+ break;
+ default:
+ break;
+ }
+ }
+ $pathParts[] = array(
+ 'title' => $this->_configStructure->getElement($sectionName)->getLabel(),
+ 'url' => $this->getUrl('adminhtml/system_config/edit', $urlParams),
+ );
+ $elementPathParts = array($sectionName);
+ while (count($pathDataParts) != 1) {
+ $elementPathParts[] = array_shift($pathDataParts);
+ $pathParts[] = array(
+ 'title' => $this->_configStructure
+ ->getElementByPathParts($elementPathParts)
+ ->getLabel()
+ );
+ }
+ $elementPathParts[] = array_shift($pathDataParts);
+ $pathParts[] = array(
+ 'title' => $this->_configStructure
+ ->getElementByPathParts($elementPathParts)
+ ->getLabel(),
+ 'scope' => $scopeLabel
+ );
+ $result[] = $pathParts;
+ $pathParts = $prefixParts;
+ }
+ }
+ return $result;
+ }
+
+ /**
+ * Return original template code of current template
+ *
+ * @return string
+ */
+ public function getOrigTemplateCode()
+ {
+ return $this->getEmailTemplate()->getOrigTemplateCode();
+ }
+}
diff --git a/app/code/Mage/Adminhtml/Block/System/Email/Template/Edit/Form.php b/app/code/Mage/Adminhtml/Block/System/Email/Template/Edit/Form.php
new file mode 100644
index 0000000000000..52938193a56da
--- /dev/null
+++ b/app/code/Mage/Adminhtml/Block/System/Email/Template/Edit/Form.php
@@ -0,0 +1,191 @@
+
+ */
+
+class Mage_Adminhtml_Block_System_Email_Template_Edit_Form extends Mage_Adminhtml_Block_Widget_Form
+{
+ /**
+ * Prepare layout.
+ * Add files to use dialog windows
+ *
+ * @return Mage_Adminhtml_Block_System_Email_Template_Edit_Form
+ */
+ protected function _prepareLayout()
+ {
+ if ($head = $this->getLayout()->getBlock('head')) {
+ $head->addJs('prototype/window.js')
+ ->addCss('prototype/windows/themes/default.css')
+ ->addCss('Mage_Core::prototype/magento.css')
+ ->addJs('Mage_Adminhtml::variables.js');
+ }
+ return parent::_prepareLayout();
+ }
+
+ /**
+ * Add fields to form and create template info form
+ *
+ * @return Mage_Adminhtml_Block_Widget_Form
+ */
+ protected function _prepareForm()
+ {
+ $form = new Varien_Data_Form();
+
+ $fieldset = $form->addFieldset('base_fieldset', array(
+ 'legend' => Mage::helper('Mage_Adminhtml_Helper_Data')->__('Template Information'),
+ 'class' => 'fieldset-wide'
+ ));
+
+ $templateId = $this->getEmailTemplate()->getId();
+ if ($templateId) {
+ $fieldset->addField('used_currently_for', 'label', array(
+ 'label' => Mage::helper('Mage_Adminhtml_Helper_Data')->__('Used Currently For'),
+ 'container_id' => 'used_currently_for',
+ 'after_element_html' =>
+ '',
+ ));
+ }
+
+ if (!$templateId) {
+ $fieldset->addField('used_default_for', 'label', array(
+ 'label' => Mage::helper('Mage_Adminhtml_Helper_Data')->__('Used as Default For'),
+ 'container_id' => 'used_default_for',
+ 'after_element_html' =>
+ '',
+ ));
+ }
+
+ $fieldset->addField('template_code', 'text', array(
+ 'name'=>'template_code',
+ 'label' => Mage::helper('Mage_Adminhtml_Helper_Data')->__('Template Name'),
+ 'required' => true
+
+ ));
+
+ $fieldset->addField('template_subject', 'text', array(
+ 'name'=>'template_subject',
+ 'label' => Mage::helper('Mage_Adminhtml_Helper_Data')->__('Template Subject'),
+ 'required' => true
+ ));
+
+ $fieldset->addField('orig_template_variables', 'hidden', array(
+ 'name' => 'orig_template_variables',
+ ));
+
+ $fieldset->addField('variables', 'hidden', array(
+ 'name' => 'variables',
+ 'value' => Zend_Json::encode($this->getVariables())
+ ));
+
+ $fieldset->addField('template_variables', 'hidden', array(
+ 'name' => 'template_variables',
+ ));
+
+ $insertVariableButton = $this->getLayout()
+ ->createBlock('Mage_Adminhtml_Block_Widget_Button', '', array('data' => array(
+ 'type' => 'button',
+ 'label' => Mage::helper('Mage_Adminhtml_Helper_Data')->__('Insert Variable...'),
+ 'onclick' => 'templateControl.openVariableChooser();return false;'
+ )));
+
+ $fieldset->addField('insert_variable', 'note', array(
+ 'text' => $insertVariableButton->toHtml()
+ ));
+
+ $fieldset->addField('template_text', 'textarea', array(
+ 'name'=>'template_text',
+ 'label' => Mage::helper('Mage_Adminhtml_Helper_Data')->__('Template Content'),
+ 'title' => Mage::helper('Mage_Adminhtml_Helper_Data')->__('Template Content'),
+ 'required' => true,
+ 'style' => 'height:24em;',
+ ));
+
+ if (!$this->getEmailTemplate()->isPlain()) {
+ $fieldset->addField('template_styles', 'textarea', array(
+ 'name'=>'template_styles',
+ 'label' => Mage::helper('Mage_Adminhtml_Helper_Data')->__('Template Styles'),
+ 'container_id' => 'field_template_styles'
+ ));
+ }
+
+ if ($templateId) {
+ $form->addValues($this->getEmailTemplate()->getData());
+ }
+
+ if ($values = Mage::getSingleton('Mage_Adminhtml_Model_Session')->getData('email_template_form_data', true)) {
+ $form->setValues($values);
+ }
+
+ $this->setForm($form);
+
+ return parent::_prepareForm();
+ }
+
+ /**
+ * Return current email template model
+ *
+ * @return Mage_Core_Model_Email_Template
+ */
+ public function getEmailTemplate()
+ {
+ return Mage::registry('current_email_template');
+ }
+
+ /**
+ * Retrieve variables to insert into email
+ *
+ * @return array
+ */
+ public function getVariables()
+ {
+ $variables = array();
+ $variables[] = Mage::getModel('Mage_Core_Model_Source_Email_Variables')
+ ->toOptionArray(true);
+ $customVariables = Mage::getModel('Mage_Core_Model_Variable')
+ ->getVariablesOptionArray(true);
+ if ($customVariables) {
+ $variables[] = $customVariables;
+ }
+ /* @var $template Mage_Core_Model_Email_Template */
+ $template = Mage::registry('current_email_template');
+ if ($template->getId() && $templateVariables = $template->getVariablesOptionArray(true)) {
+ $variables[] = $templateVariables;
+ }
+ return $variables;
+ }
+}
diff --git a/app/code/core/Mage/Adminhtml/Block/System/Email/Template/Grid/Filter/Type.php b/app/code/Mage/Adminhtml/Block/System/Email/Template/Grid/Filter/Type.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/System/Email/Template/Grid/Filter/Type.php
rename to app/code/Mage/Adminhtml/Block/System/Email/Template/Grid/Filter/Type.php
diff --git a/app/code/core/Mage/Adminhtml/Block/System/Email/Template/Grid/Renderer/Action.php b/app/code/Mage/Adminhtml/Block/System/Email/Template/Grid/Renderer/Action.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/System/Email/Template/Grid/Renderer/Action.php
rename to app/code/Mage/Adminhtml/Block/System/Email/Template/Grid/Renderer/Action.php
diff --git a/app/code/core/Mage/Adminhtml/Block/System/Email/Template/Grid/Renderer/Sender.php b/app/code/Mage/Adminhtml/Block/System/Email/Template/Grid/Renderer/Sender.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/System/Email/Template/Grid/Renderer/Sender.php
rename to app/code/Mage/Adminhtml/Block/System/Email/Template/Grid/Renderer/Sender.php
diff --git a/app/code/core/Mage/Adminhtml/Block/System/Email/Template/Grid/Renderer/Type.php b/app/code/Mage/Adminhtml/Block/System/Email/Template/Grid/Renderer/Type.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/System/Email/Template/Grid/Renderer/Type.php
rename to app/code/Mage/Adminhtml/Block/System/Email/Template/Grid/Renderer/Type.php
diff --git a/app/code/core/Mage/Adminhtml/Block/System/Email/Template/Preview.php b/app/code/Mage/Adminhtml/Block/System/Email/Template/Preview.php
similarity index 88%
rename from app/code/core/Mage/Adminhtml/Block/System/Email/Template/Preview.php
rename to app/code/Mage/Adminhtml/Block/System/Email/Template/Preview.php
index 8dd9329866fd1..8678f812e63bd 100644
--- a/app/code/core/Mage/Adminhtml/Block/System/Email/Template/Preview.php
+++ b/app/code/Mage/Adminhtml/Block/System/Email/Template/Preview.php
@@ -42,7 +42,7 @@ protected function _toHtml()
{
/** @var $template Mage_Core_Model_Email_Template */
$template = Mage::getModel('Mage_Core_Model_Email_Template',
- array('area' => Mage_Core_Model_App_Area::AREA_FRONTEND));
+ array('data' => array('area' => Mage_Core_Model_App_Area::AREA_FRONTEND)));
$id = (int)$this->getRequest()->getParam('id');
if ($id) {
$template->load($id);
@@ -62,6 +62,12 @@ protected function _toHtml()
Magento_Profiler::start("email_template_proccessing");
$vars = array();
+ $template->setDesignConfig(
+ array(
+ 'area' => Mage::getDesign()->getArea(),
+ 'store' => Mage::getSingleton('Mage_Core_Model_StoreManager')->getDefaultStoreView()->getId()
+ )
+ );
$templateProcessed = $template->getProcessedTemplate($vars, true);
if ($template->isPlain()) {
diff --git a/app/code/core/Mage/Adminhtml/Block/System/Store/Delete.php b/app/code/Mage/Adminhtml/Block/System/Store/Delete.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/System/Store/Delete.php
rename to app/code/Mage/Adminhtml/Block/System/Store/Delete.php
diff --git a/app/code/core/Mage/Adminhtml/Block/System/Store/Delete/Form.php b/app/code/Mage/Adminhtml/Block/System/Store/Delete/Form.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/System/Store/Delete/Form.php
rename to app/code/Mage/Adminhtml/Block/System/Store/Delete/Form.php
diff --git a/app/code/core/Mage/Adminhtml/Block/System/Store/Delete/Group.php b/app/code/Mage/Adminhtml/Block/System/Store/Delete/Group.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/System/Store/Delete/Group.php
rename to app/code/Mage/Adminhtml/Block/System/Store/Delete/Group.php
diff --git a/app/code/core/Mage/Adminhtml/Block/System/Store/Delete/Website.php b/app/code/Mage/Adminhtml/Block/System/Store/Delete/Website.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/System/Store/Delete/Website.php
rename to app/code/Mage/Adminhtml/Block/System/Store/Delete/Website.php
diff --git a/app/code/core/Mage/Adminhtml/Block/System/Store/Edit.php b/app/code/Mage/Adminhtml/Block/System/Store/Edit.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/System/Store/Edit.php
rename to app/code/Mage/Adminhtml/Block/System/Store/Edit.php
diff --git a/app/code/core/Mage/Adminhtml/Block/System/Store/Edit/Form/Group.php b/app/code/Mage/Adminhtml/Block/System/Store/Edit/Form/Group.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/System/Store/Edit/Form/Group.php
rename to app/code/Mage/Adminhtml/Block/System/Store/Edit/Form/Group.php
diff --git a/app/code/core/Mage/Adminhtml/Block/System/Store/Edit/Form/Store.php b/app/code/Mage/Adminhtml/Block/System/Store/Edit/Form/Store.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/System/Store/Edit/Form/Store.php
rename to app/code/Mage/Adminhtml/Block/System/Store/Edit/Form/Store.php
diff --git a/app/code/core/Mage/Adminhtml/Block/System/Store/Edit/Form/Website.php b/app/code/Mage/Adminhtml/Block/System/Store/Edit/Form/Website.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/System/Store/Edit/Form/Website.php
rename to app/code/Mage/Adminhtml/Block/System/Store/Edit/Form/Website.php
diff --git a/app/code/core/Mage/Adminhtml/Block/System/Store/Edit/FormAbstract.php b/app/code/Mage/Adminhtml/Block/System/Store/Edit/FormAbstract.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/System/Store/Edit/FormAbstract.php
rename to app/code/Mage/Adminhtml/Block/System/Store/Edit/FormAbstract.php
diff --git a/app/code/core/Mage/Adminhtml/Block/System/Store/Grid/Render/Group.php b/app/code/Mage/Adminhtml/Block/System/Store/Grid/Render/Group.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/System/Store/Grid/Render/Group.php
rename to app/code/Mage/Adminhtml/Block/System/Store/Grid/Render/Group.php
diff --git a/app/code/core/Mage/Adminhtml/Block/System/Store/Grid/Render/Store.php b/app/code/Mage/Adminhtml/Block/System/Store/Grid/Render/Store.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/System/Store/Grid/Render/Store.php
rename to app/code/Mage/Adminhtml/Block/System/Store/Grid/Render/Store.php
diff --git a/app/code/core/Mage/Adminhtml/Block/System/Store/Grid/Render/Website.php b/app/code/Mage/Adminhtml/Block/System/Store/Grid/Render/Website.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/System/Store/Grid/Render/Website.php
rename to app/code/Mage/Adminhtml/Block/System/Store/Grid/Render/Website.php
diff --git a/app/code/core/Mage/Adminhtml/Block/System/Store/Store.php b/app/code/Mage/Adminhtml/Block/System/Store/Store.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/System/Store/Store.php
rename to app/code/Mage/Adminhtml/Block/System/Store/Store.php
diff --git a/app/code/core/Mage/Adminhtml/Block/System/Variable.php b/app/code/Mage/Adminhtml/Block/System/Variable.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/System/Variable.php
rename to app/code/Mage/Adminhtml/Block/System/Variable.php
diff --git a/app/code/core/Mage/Adminhtml/Block/System/Variable/Edit.php b/app/code/Mage/Adminhtml/Block/System/Variable/Edit.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/System/Variable/Edit.php
rename to app/code/Mage/Adminhtml/Block/System/Variable/Edit.php
diff --git a/app/code/core/Mage/Adminhtml/Block/System/Variable/Edit/Form.php b/app/code/Mage/Adminhtml/Block/System/Variable/Edit/Form.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/System/Variable/Edit/Form.php
rename to app/code/Mage/Adminhtml/Block/System/Variable/Edit/Form.php
diff --git a/app/code/Mage/Adminhtml/Block/Tax/Rate/Form.php b/app/code/Mage/Adminhtml/Block/Tax/Rate/Form.php
new file mode 100644
index 0000000000000..d5828e52357a5
--- /dev/null
+++ b/app/code/Mage/Adminhtml/Block/Tax/Rate/Form.php
@@ -0,0 +1,197 @@
+
+ */
+
+class Mage_Adminhtml_Block_Tax_Rate_Form extends Mage_Adminhtml_Block_Widget_Form
+{
+ const FORM_ELEMENT_ID = 'rate-form';
+
+ protected $_titles = null;
+
+ protected $_template = 'tax/rate/form.phtml';
+
+
+ protected function _construct()
+ {
+ parent::_construct();
+ $this->setDestElementId(self::FORM_ELEMENT_ID);
+
+ }
+
+ protected function _prepareForm()
+ {
+ $rateObject = new Varien_Object(Mage::getSingleton('Mage_Tax_Model_Calculation_Rate')->getData());
+ $form = new Varien_Data_Form();
+
+ $countries = Mage::getModel('Mage_Directory_Model_Config_Source_Country')->toOptionArray();
+ unset($countries[0]);
+
+ if (!$rateObject->hasTaxCountryId()) {
+ $rateObject->setTaxCountryId(Mage::getStoreConfig(Mage_Tax_Model_Config::CONFIG_XML_PATH_DEFAULT_COUNTRY));
+ }
+
+ if (!$rateObject->hasTaxRegionId()) {
+ $rateObject->setTaxRegionId(Mage::getStoreConfig(Mage_Tax_Model_Config::CONFIG_XML_PATH_DEFAULT_REGION));
+ }
+
+ $regionCollection = Mage::getModel('Mage_Directory_Model_Region')
+ ->getCollection()
+ ->addCountryFilter($rateObject->getTaxCountryId());
+
+ $regions = $regionCollection->toOptionArray();
+ if ($regions) {
+ $regions[0]['label'] = '*';
+ } else {
+ $regions = array(array('value' => '', 'label' => '*'));
+ }
+
+ $fieldset = $form->addFieldset('base_fieldset', array('legend' => Mage::helper('Mage_Tax_Helper_Data')->__('Tax Rate Information')));
+
+ if ($rateObject->getTaxCalculationRateId() > 0) {
+ $fieldset->addField('tax_calculation_rate_id', 'hidden', array(
+ 'name' => 'tax_calculation_rate_id',
+ 'value' => $rateObject->getTaxCalculationRateId()
+ ));
+ }
+
+ $fieldset->addField('code', 'text', array(
+ 'name' => 'code',
+ 'label' => Mage::helper('Mage_Tax_Helper_Data')->__('Tax Identifier'),
+ 'title' => Mage::helper('Mage_Tax_Helper_Data')->__('Tax Identifier'),
+ 'class' => 'required-entry',
+ 'required' => true,
+ ));
+
+ $fieldset->addField('tax_country_id', 'select', array(
+ 'name' => 'tax_country_id',
+ 'label' => Mage::helper('Mage_Tax_Helper_Data')->__('Country'),
+ 'required' => true,
+ 'values' => $countries
+ ));
+
+ $fieldset->addField('tax_region_id', 'select', array(
+ 'name' => 'tax_region_id',
+ 'label' => Mage::helper('Mage_Tax_Helper_Data')->__('State'),
+ 'values' => $regions
+ ));
+
+ $fieldset->addField('zip_is_range', 'checkbox', array(
+ 'name' => 'zip_is_range',
+ 'label' => Mage::helper('Mage_Tax_Helper_Data')->__('Zip/Post is Range'),
+ 'value' => '1'
+ ));
+
+ if (!$rateObject->hasTaxPostcode()) {
+ $rateObject->setTaxPostcode(Mage::getStoreConfig(Mage_Tax_Model_Config::CONFIG_XML_PATH_DEFAULT_POSTCODE));
+ }
+
+ $fieldset->addField('tax_postcode', 'text', array(
+ 'name' => 'tax_postcode',
+ 'label' => Mage::helper('Mage_Tax_Helper_Data')->__('Zip/Post Code'),
+ 'note' => Mage::helper('Mage_Tax_Helper_Data')->__("'*' - matches any; 'xyz*' - matches any that begins on 'xyz' and not longer than %d.", Mage::helper('Mage_Tax_Helper_Data')->getPostCodeSubStringLength()),
+ ));
+
+ $fieldset->addField('zip_from', 'text', array(
+ 'name' => 'zip_from',
+ 'label' => Mage::helper('Mage_Tax_Helper_Data')->__('Range From'),
+ 'required' => true,
+ 'maxlength' => 9,
+ 'class' => 'validate-digits',
+ 'css_class' => 'hidden',
+ ));
+
+ $fieldset->addField('zip_to', 'text', array(
+ 'name' => 'zip_to',
+ 'label' => Mage::helper('Mage_Tax_Helper_Data')->__('Range To'),
+ 'required' => true,
+ 'maxlength' => 9,
+ 'class' => 'validate-digits',
+ 'css_class' => 'hidden',
+ ));
+
+ $fieldset->addField('rate', 'text', array(
+ 'name' => 'rate',
+ 'label' => Mage::helper('Mage_Tax_Helper_Data')->__('Rate Percent'),
+ 'title' => Mage::helper('Mage_Tax_Helper_Data')->__('Rate Percent'),
+ 'required' => true,
+ 'class' => 'validate-not-negative-number'
+ ));
+
+ $form->setAction($this->getUrl('adminhtml/tax_rate/save'));
+ $form->setUseContainer(true);
+ $form->setId(self::FORM_ELEMENT_ID);
+ $form->setMethod('post');
+
+ if (!Mage::app()->hasSingleStore()) {
+ $form->addElement(
+ Mage::getBlockSingleton('Mage_Adminhtml_Block_Tax_Rate_Title_Fieldset')
+ ->setLegend(Mage::helper('Mage_Tax_Helper_Data')
+ ->__('Tax Titles'))
+ );
+ }
+
+ $rateData = $rateObject->getData();
+ if ($rateObject->getZipIsRange()) {
+ list($rateData['zip_from'], $rateData['zip_to']) = explode('-', $rateData['tax_postcode']);
+ }
+ $form->setValues($rateData);
+ $this->setForm($form);
+
+ return parent::_prepareForm();
+ }
+
+ /**
+ * Get Tax Rates Collection
+ *
+ * @return array
+ */
+ public function getRateCollection()
+ {
+ if ($this->getData('rate_collection') == null) {
+ $rateCollection = Mage::getModel('Mage_Tax_Model_Calculation_Rate')->getCollection()
+ ->joinRegionTable();
+ $rates = array();
+
+ foreach ($rateCollection as $rate) {
+ $item = $rate->getData();
+ foreach ($rate->getTitles() as $title) {
+ $item['title[' . $title->getStoreId() . ']'] = $title->getValue();
+ }
+ $rates[] = $item;
+ }
+
+ $this->setRateCollection($rates);
+ }
+ return $this->getData('rate_collection');
+ }
+}
diff --git a/app/code/core/Mage/Adminhtml/Block/Tax/Rate/Grid/Renderer/Country.php b/app/code/Mage/Adminhtml/Block/Tax/Rate/Grid/Renderer/Country.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Tax/Rate/Grid/Renderer/Country.php
rename to app/code/Mage/Adminhtml/Block/Tax/Rate/Grid/Renderer/Country.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Tax/Rate/Grid/Renderer/Data.php b/app/code/Mage/Adminhtml/Block/Tax/Rate/Grid/Renderer/Data.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Tax/Rate/Grid/Renderer/Data.php
rename to app/code/Mage/Adminhtml/Block/Tax/Rate/Grid/Renderer/Data.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Tax/Rate/ImportExport.php b/app/code/Mage/Adminhtml/Block/Tax/Rate/ImportExport.php
similarity index 79%
rename from app/code/core/Mage/Adminhtml/Block/Tax/Rate/ImportExport.php
rename to app/code/Mage/Adminhtml/Block/Tax/Rate/ImportExport.php
index cf378054cded3..b96a45dca3584 100644
--- a/app/code/core/Mage/Adminhtml/Block/Tax/Rate/ImportExport.php
+++ b/app/code/Mage/Adminhtml/Block/Tax/Rate/ImportExport.php
@@ -28,4 +28,16 @@
class Mage_Adminhtml_Block_Tax_Rate_ImportExport extends Mage_Adminhtml_Block_Widget
{
protected $_template = 'tax/importExport.phtml';
+
+ /**
+ * @param Mage_Core_Block_Template_Context $context
+ * @param array $data
+ */
+ public function __construct(Mage_Core_Block_Template_Context $context, array $data = array())
+ {
+ parent::__construct($context, $data);
+ $this->setUseContainer(true);
+ }
+
+
}
diff --git a/app/code/core/Mage/Adminhtml/Block/Tax/Rate/ImportExportHeader.php b/app/code/Mage/Adminhtml/Block/Tax/Rate/ImportExportHeader.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Tax/Rate/ImportExportHeader.php
rename to app/code/Mage/Adminhtml/Block/Tax/Rate/ImportExportHeader.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Tax/Rate/Title.php b/app/code/Mage/Adminhtml/Block/Tax/Rate/Title.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Tax/Rate/Title.php
rename to app/code/Mage/Adminhtml/Block/Tax/Rate/Title.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Tax/Rate/Title/Fieldset.php b/app/code/Mage/Adminhtml/Block/Tax/Rate/Title/Fieldset.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Tax/Rate/Title/Fieldset.php
rename to app/code/Mage/Adminhtml/Block/Tax/Rate/Title/Fieldset.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Tax/Rate/Toolbar/Add.php b/app/code/Mage/Adminhtml/Block/Tax/Rate/Toolbar/Add.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Tax/Rate/Toolbar/Add.php
rename to app/code/Mage/Adminhtml/Block/Tax/Rate/Toolbar/Add.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Tax/Rate/Toolbar/Save.php b/app/code/Mage/Adminhtml/Block/Tax/Rate/Toolbar/Save.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Tax/Rate/Toolbar/Save.php
rename to app/code/Mage/Adminhtml/Block/Tax/Rate/Toolbar/Save.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Tax/Rule.php b/app/code/Mage/Adminhtml/Block/Tax/Rule.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Tax/Rule.php
rename to app/code/Mage/Adminhtml/Block/Tax/Rule.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Tax/Rule/Edit.php b/app/code/Mage/Adminhtml/Block/Tax/Rule/Edit.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Tax/Rule/Edit.php
rename to app/code/Mage/Adminhtml/Block/Tax/Rule/Edit.php
diff --git a/app/code/Mage/Adminhtml/Block/Tax/Rule/Edit/Form.php b/app/code/Mage/Adminhtml/Block/Tax/Rule/Edit/Form.php
new file mode 100644
index 0000000000000..fc557699d3067
--- /dev/null
+++ b/app/code/Mage/Adminhtml/Block/Tax/Rule/Edit/Form.php
@@ -0,0 +1,233 @@
+
+ */
+
+class Mage_Adminhtml_Block_Tax_Rule_Edit_Form extends Mage_Backend_Block_Widget_Form
+{
+ /**
+ * Init class
+ *
+ */
+ protected function _construct()
+ {
+ parent::_construct();
+
+ $this->setId('taxRuleForm');
+ $this->setTitle(Mage::helper('Mage_Tax_Helper_Data')->__('Tax Rule Information'));
+ $this->setUseContainer(true);
+ }
+
+ /**
+ *
+ * return Mage_Adminhtml_Block_Widget_Form
+ */
+ protected function _prepareForm()
+ {
+ $model = Mage::registry('tax_rule');
+ $form = new Varien_Data_Form(array(
+ 'id' => 'edit_form',
+ 'action' => $this->getData('action'),
+ 'method' => 'post'
+ ));
+
+ $fieldset = $form->addFieldset('base_fieldset', array(
+ 'legend' => Mage::helper('Mage_Tax_Helper_Data')->__('Tax Rule Information')
+ ));
+
+ $rates = Mage::getModel('Mage_Tax_Model_Calculation_Rate')
+ ->getCollection()
+ ->toOptionArray();
+
+ $fieldset->addField('code', 'text',
+ array(
+ 'name' => 'code',
+ 'label' => Mage::helper('Mage_Tax_Helper_Data')->__('Name'),
+ 'class' => 'required-entry',
+ 'required' => true,
+ )
+ );
+
+ // Editable multiselect for customer tax class
+ $selectConfig = $this->getTaxClassSelectConfig(Mage_Tax_Model_Class::TAX_CLASS_TYPE_CUSTOMER);
+ $selectedCustomerTax = $model->getId()
+ ? $model->getCustomerTaxClasses()
+ : $model->getCustomerTaxClassWithDefault();
+ $fieldset->addField($this->getTaxClassSelectHtmlId(Mage_Tax_Model_Class::TAX_CLASS_TYPE_CUSTOMER),
+ 'editablemultiselect',
+ array(
+ 'name' => $this->getTaxClassSelectHtmlId(Mage_Tax_Model_Class::TAX_CLASS_TYPE_CUSTOMER),
+ 'label' => Mage::helper('Mage_Tax_Helper_Data')->__('Customer Tax Class'),
+ 'class' => 'required-entry',
+ 'values' => $model->getAllOptionsForClass(Mage_Tax_Model_Class::TAX_CLASS_TYPE_CUSTOMER),
+ 'value' => $selectedCustomerTax,
+ 'required' => true,
+ 'select_config' => $selectConfig,
+ ),
+ false,
+ true
+ );
+
+ // Editable multiselect for product tax class
+ $selectConfig = $this->getTaxClassSelectConfig(Mage_Tax_Model_Class::TAX_CLASS_TYPE_PRODUCT);
+ $selectedProductTax = $model->getId()
+ ? $model->getProductTaxClasses()
+ : $model->getProductTaxClassWithDefault();
+ $fieldset->addField($this->getTaxClassSelectHtmlId(Mage_Tax_Model_Class::TAX_CLASS_TYPE_PRODUCT),
+ 'editablemultiselect',
+ array(
+ 'name' => $this->getTaxClassSelectHtmlId(Mage_Tax_Model_Class::TAX_CLASS_TYPE_PRODUCT),
+ 'label' => Mage::helper('Mage_Tax_Helper_Data')->__('Product Tax Class'),
+ 'class' => 'required-entry',
+ 'values' => $model->getAllOptionsForClass(Mage_Tax_Model_Class::TAX_CLASS_TYPE_PRODUCT),
+ 'value' => $selectedProductTax,
+ 'required' => true,
+ 'select_config' => $selectConfig
+ ),
+ false,
+ true
+ );
+
+ $fieldset->addField('tax_rate',
+ 'editablemultiselect',
+ array(
+ 'name' => 'tax_rate',
+ 'label' => Mage::helper('Mage_Tax_Helper_Data')->__('Tax Rate'),
+ 'class' => 'required-entry',
+ 'values' => $rates,
+ 'value' => $model->getRates(),
+ 'required' => true,
+ 'element_js_class' => 'TaxRateEditableMultiselect',
+ 'select_config' => array('is_entity_editable' => true),
+ )
+ );
+
+ $fieldset->addField('priority', 'text',
+ array(
+ 'name' => 'priority',
+ 'label' => Mage::helper('Mage_Tax_Helper_Data')->__('Priority'),
+ 'class' => 'validate-not-negative-number',
+ 'value' => (int) $model->getPriority(),
+ 'required' => true,
+ 'note' => Mage::helper('Mage_Tax_Helper_Data')->__('Tax rates at the same priority are added, others are compounded.'),
+ ),
+ false,
+ true
+ );
+ $fieldset->addField('position', 'text',
+ array(
+ 'name' => 'position',
+ 'label' => Mage::helper('Mage_Tax_Helper_Data')->__('Sort Order'),
+ 'class' => 'validate-not-negative-number',
+ 'value' => (int) $model->getPosition(),
+ 'required' => true,
+ ),
+ false,
+ true
+ );
+
+ if ($model->getId() > 0 ) {
+ $fieldset->addField('tax_calculation_rule_id', 'hidden',
+ array(
+ 'name' => 'tax_calculation_rule_id',
+ 'value' => $model->getId(),
+ 'no_span' => true
+ )
+ );
+ }
+
+ $form->addValues($model->getData());
+ $form->setAction($this->getUrl('*/tax_rule/save'));
+ $form->setUseContainer($this->getUseContainer());
+ $this->setForm($form);
+
+ return parent::_prepareForm();
+ }
+
+ /**
+ * Retrieve HTML element ID for corresponding tax class selector
+ *
+ * @param string $classType
+ * @return string
+ */
+ public function getTaxClassSelectHtmlId($classType)
+ {
+ return 'tax_' . strtolower($classType) . '_class';
+ }
+
+
+ /**
+ * Retrieve configuration options for tax class editable multiselect
+ *
+ * @param string $classType
+ * @return array
+ */
+ public function getTaxClassSelectConfig($classType)
+ {
+ $config = array(
+ 'new_url' => $this->getUrl('adminhtml/tax_class/ajaxSave/'),
+ 'save_url' => $this->getUrl('adminhtml/tax_class/ajaxSave/'),
+ 'delete_url' => $this->getUrl('adminhtml/tax_class/ajaxDelete/'),
+ 'delete_confirm_message' => Mage::helper('Mage_Tax_Helper_Data')->__('Do you really want to delete this tax class?'),
+ 'target_select_id' => $this->getTaxClassSelectHtmlId($classType),
+ 'add_button_caption' => Mage::helper('Mage_Tax_Helper_Data')->__('Add New Tax Class'),
+ 'submit_data' => array(
+ 'class_type' => $classType,
+ 'form_key' => Mage::getSingleton('Mage_Core_Model_Session')->getFormKey(),
+ ),
+ 'entity_id_name' => 'class_id',
+ 'entity_value_name' => 'class_name',
+ 'is_entity_editable' => true
+ );
+ return $config;
+ }
+
+ /**
+ * Retrieve Tax Rate delete URL
+ *
+ * @return string
+ */
+ public function getTaxRateDeleteUrl()
+ {
+ return $this->getUrl('admin/tax_rate/ajaxDelete/');
+ }
+
+ /**
+ * Retrieve Tax Rate save URL
+ *
+ * @return string
+ */
+ public function getTaxRateSaveUrl()
+ {
+ return $this->getUrl('admin/tax_rate/ajaxSave/');
+ }
+}
diff --git a/app/code/core/Mage/Adminhtml/Block/Tax/Rule/Grid.php b/app/code/Mage/Adminhtml/Block/Tax/Rule/Grid.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Tax/Rule/Grid.php
rename to app/code/Mage/Adminhtml/Block/Tax/Rule/Grid.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Template.php b/app/code/Mage/Adminhtml/Block/Template.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Template.php
rename to app/code/Mage/Adminhtml/Block/Template.php
diff --git a/app/code/Mage/Adminhtml/Block/Text/List.php b/app/code/Mage/Adminhtml/Block/Text/List.php
new file mode 100644
index 0000000000000..7f40dc8d11337
--- /dev/null
+++ b/app/code/Mage/Adminhtml/Block/Text/List.php
@@ -0,0 +1,37 @@
+
+ */
+class Mage_Adminhtml_Block_Text_List extends Mage_Core_Block_Text_List
+{
+}
diff --git a/app/code/core/Mage/Adminhtml/Block/Urlrewrite.php b/app/code/Mage/Adminhtml/Block/Urlrewrite.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Urlrewrite.php
rename to app/code/Mage/Adminhtml/Block/Urlrewrite.php
diff --git a/app/code/Mage/Adminhtml/Block/Urlrewrite/Catalog/Category/Edit.php b/app/code/Mage/Adminhtml/Block/Urlrewrite/Catalog/Category/Edit.php
new file mode 100644
index 0000000000000..ddb8de3a58851
--- /dev/null
+++ b/app/code/Mage/Adminhtml/Block/Urlrewrite/Catalog/Category/Edit.php
@@ -0,0 +1,112 @@
+
+ */
+class Mage_Adminhtml_Block_Urlrewrite_Catalog_Category_Edit extends Mage_Adminhtml_Block_Urlrewrite_Edit
+{
+ /**
+ * Prepare layout for URL rewrite creating for category
+ */
+ protected function _prepareLayoutFeatures()
+ {
+ /** @var $helper Mage_Adminhtml_Helper_Data */
+ $helper = Mage::helper('Mage_Adminhtml_Helper_Data');
+
+ if ($this->_getUrlRewrite()->getId()) {
+ $this->_headerText = Mage::helper('Mage_Adminhtml_Helper_Data')->__('Edit URL Rewrite for a Category');
+ } else {
+ $this->_headerText = Mage::helper('Mage_Adminhtml_Helper_Data')->__('Add URL Rewrite for a Category');
+ }
+
+ if ($this->_getCategory()->getId()) {
+ $this->_addCategoryLinkBlock();
+ $this->_addEditFormBlock();
+ $this->_updateBackButtonLink($helper->getUrl('*/*/edit') . 'category');
+ } else {
+ $this->_addUrlRewriteSelectorBlock();
+ $this->_addCategoryTreeBlock();
+ }
+ }
+
+ /**
+ * Get or create new instance of category
+ *
+ * @return Mage_Catalog_Model_Product
+ */
+ private function _getCategory()
+ {
+ if (!$this->hasData('category')) {
+ $this->setCategory(Mage::getModel('Mage_Catalog_Model_Category'));
+ }
+ return $this->getCategory();
+ }
+
+ /**
+ * Add child category link block
+ */
+ private function _addCategoryLinkBlock()
+ {
+ /** @var $helper Mage_Adminhtml_Helper_Data */
+ $helper = Mage::helper('Mage_Adminhtml_Helper_Data');
+ $this->addChild('category_link', 'Mage_Adminhtml_Block_Urlrewrite_Link', array(
+ 'item_url' => $helper->getUrl('*/*/*') . 'category',
+ 'item_name' => $this->_getCategory()->getName(),
+ 'label' => Mage::helper('Mage_Adminhtml_Helper_Data')->__('Category:')
+ ));
+ }
+
+ /**
+ * Add child category tree block
+ */
+ private function _addCategoryTreeBlock()
+ {
+ $this->addChild('categories_tree', 'Mage_Adminhtml_Block_Urlrewrite_Catalog_Category_Tree');
+ }
+
+ /**
+ * Creates edit form block
+ *
+ * @return Mage_Adminhtml_Block_Urlrewrite_Catalog_Edit_Form
+ */
+ protected function _createEditFormBlock()
+ {
+ return $this->getLayout()->createBlock('Mage_Adminhtml_Block_Urlrewrite_Catalog_Edit_Form', '', array(
+ 'data' => array(
+ 'category' => $this->_getCategory(),
+ 'url_rewrite' => $this->_getUrlRewrite()
+ )
+ ));
+ }
+}
diff --git a/app/code/core/Mage/Adminhtml/Block/Urlrewrite/Catalog/Category/Tree.php b/app/code/Mage/Adminhtml/Block/Urlrewrite/Catalog/Category/Tree.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Urlrewrite/Catalog/Category/Tree.php
rename to app/code/Mage/Adminhtml/Block/Urlrewrite/Catalog/Category/Tree.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Urlrewrite/Catalog/Edit/Form.php b/app/code/Mage/Adminhtml/Block/Urlrewrite/Catalog/Edit/Form.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Urlrewrite/Catalog/Edit/Form.php
rename to app/code/Mage/Adminhtml/Block/Urlrewrite/Catalog/Edit/Form.php
diff --git a/app/code/Mage/Adminhtml/Block/Urlrewrite/Catalog/Product/Edit.php b/app/code/Mage/Adminhtml/Block/Urlrewrite/Catalog/Product/Edit.php
new file mode 100644
index 0000000000000..f5833b97b85a6
--- /dev/null
+++ b/app/code/Mage/Adminhtml/Block/Urlrewrite/Catalog/Product/Edit.php
@@ -0,0 +1,183 @@
+
+ */
+class Mage_Adminhtml_Block_Urlrewrite_Catalog_Product_Edit extends Mage_Adminhtml_Block_Urlrewrite_Edit
+{
+ /**
+ * Prepare layout for URL rewrite creating for product
+ */
+ protected function _prepareLayoutFeatures()
+ {
+ /** @var $helper Mage_Adminhtml_Helper_Data */
+ $helper = Mage::helper('Mage_Adminhtml_Helper_Data');
+
+ if ($this->_getUrlRewrite()->getId()) {
+ $this->_headerText = Mage::helper('Mage_Adminhtml_Helper_Data')->__('Edit URL Rewrite for a Product');
+ } else {
+ $this->_headerText = Mage::helper('Mage_Adminhtml_Helper_Data')->__('Add URL Rewrite for a Product');
+ }
+
+ if ($this->_getProduct()->getId()) {
+ $this->_addProductLinkBlock($this->_getProduct());
+ }
+
+ if ($this->_getCategory()->getId()) {
+ $this->_addCategoryLinkBlock();
+ }
+
+ if ($this->_getProduct()->getId()) {
+ if ($this->_getCategory()->getId() || !$this->getIsCategoryMode()) {
+ $this->_addEditFormBlock();
+ $this->_updateBackButtonLink(
+ $helper->getUrl('*/*/edit', array('product' => $this->_getProduct()->getId())) . 'category'
+ );
+ } else {
+ // categories selector & skip categories button
+ $this->_addCategoriesTreeBlock();
+ $this->_addSkipCategoriesBlock();
+ $this->_updateBackButtonLink($helper->getUrl('*/*/edit') . 'product');
+ }
+ } else {
+ $this->_addUrlRewriteSelectorBlock();
+ $this->_addProductsGridBlock();
+ }
+ }
+
+ /**
+ * Get or create new instance of product
+ *
+ * @return Mage_Catalog_Model_Product
+ */
+ private function _getProduct()
+ {
+ if (!$this->hasData('product')) {
+ $this->setProduct(Mage::getModel('Mage_Catalog_Model_Product'));
+ }
+ return $this->getProduct();
+ }
+
+ /**
+ * Get or create new instance of category
+ *
+ * @return Mage_Catalog_Model_Category
+ */
+ private function _getCategory()
+ {
+ if (!$this->hasData('category')) {
+ $this->setCategory(Mage::getModel('Mage_Catalog_Model_Category'));
+ }
+ return $this->getCategory();
+ }
+
+ /**
+ * Add child product link block
+ */
+ private function _addProductLinkBlock()
+ {
+ /** @var $helper Mage_Adminhtml_Helper_Data */
+ $helper = Mage::helper('Mage_Adminhtml_Helper_Data');
+ $this->addChild('product_link', 'Mage_Adminhtml_Block_Urlrewrite_Link', array(
+ 'item_url' => $helper->getUrl('*/*/*') . 'product',
+ 'item_name' => $this->_getProduct()->getName(),
+ 'label' => Mage::helper('Mage_Adminhtml_Helper_Data')->__('Product:')
+ ));
+ }
+
+ /**
+ * Add child category link block
+ */
+ private function _addCategoryLinkBlock()
+ {
+ /** @var $helper Mage_Adminhtml_Helper_Data */
+ $helper = Mage::helper('Mage_Adminhtml_Helper_Data');
+ $this->addChild('category_link', 'Mage_Adminhtml_Block_Urlrewrite_Link', array(
+ 'item_url' => $helper->getUrl('*/*/*', array('product' => $this->_getProduct()->getId())) . 'category',
+ 'item_name' => $this->_getCategory()->getName(),
+ 'label' => Mage::helper('Mage_Adminhtml_Helper_Data')->__('Category:')
+ ));
+ }
+
+ /**
+ * Add child products grid block
+ */
+ private function _addProductsGridBlock()
+ {
+ $this->addChild('products_grid', 'Mage_Adminhtml_Block_Urlrewrite_Catalog_Product_Grid');
+ }
+
+ /**
+ * Add child Categories Tree block
+ */
+ private function _addCategoriesTreeBlock()
+ {
+ $this->addChild('categories_tree', 'Mage_Adminhtml_Block_Urlrewrite_Catalog_Category_Tree');
+ }
+
+ /**
+ * Add child Skip Categories block
+ */
+ private function _addSkipCategoriesBlock()
+ {
+ /** @var $helper Mage_Adminhtml_Helper_Data */
+ $helper = Mage::helper('Mage_Adminhtml_Helper_Data');
+ $this->addChild('skip_categories', 'Mage_Adminhtml_Block_Widget_Button', array(
+ 'label' => Mage::helper('Mage_Adminhtml_Helper_Data')->__('Skip Category Selection'),
+ 'onclick' => 'window.location = \''
+ . $helper->getUrl('*/*/*', array('product' => $this->_getProduct()->getId())) . '\'',
+ 'class' => 'save',
+ 'level' => -1
+ ));
+ }
+
+ /**
+ * Creates edit form block
+ *
+ * @return Mage_Adminhtml_Block_Urlrewrite_Catalog_Edit_Form
+ */
+ protected function _createEditFormBlock()
+ {
+ return $this->getLayout()->createBlock('Mage_Adminhtml_Block_Urlrewrite_Catalog_Edit_Form', '', array(
+ 'data' => array(
+ 'product' => $this->_getProduct(),
+ 'category' => $this->_getCategory(),
+ 'url_rewrite' => $this->_getUrlRewrite()
+ )
+ ));
+ }
+}
diff --git a/app/code/core/Mage/Adminhtml/Block/Urlrewrite/Catalog/Product/Grid.php b/app/code/Mage/Adminhtml/Block/Urlrewrite/Catalog/Product/Grid.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Urlrewrite/Catalog/Product/Grid.php
rename to app/code/Mage/Adminhtml/Block/Urlrewrite/Catalog/Product/Grid.php
diff --git a/app/code/Mage/Adminhtml/Block/Urlrewrite/Cms/Page/Edit.php b/app/code/Mage/Adminhtml/Block/Urlrewrite/Cms/Page/Edit.php
new file mode 100644
index 0000000000000..b4ed207897ed3
--- /dev/null
+++ b/app/code/Mage/Adminhtml/Block/Urlrewrite/Cms/Page/Edit.php
@@ -0,0 +1,112 @@
+
+ */
+class Mage_Adminhtml_Block_Urlrewrite_Cms_Page_Edit extends Mage_Adminhtml_Block_Urlrewrite_Edit
+{
+ /**
+ * Prepare layout for URL rewrite creating for CMS page
+ */
+ protected function _prepareLayoutFeatures()
+ {
+ /** @var $helper Mage_Adminhtml_Helper_Data */
+ $helper = Mage::helper('Mage_Adminhtml_Helper_Data');
+
+ if ($this->_getUrlRewrite()->getId()) {
+ $this->_headerText = Mage::helper('Mage_Adminhtml_Helper_Data')->__('Edit URL Rewrite for CMS page');
+ } else {
+ $this->_headerText = Mage::helper('Mage_Adminhtml_Helper_Data')->__('Add URL Rewrite for CMS page');
+ }
+
+ if ($this->_getCmsPage()->getId()) {
+ $this->_addCmsPageLinkBlock();
+ $this->_addEditFormBlock();
+ $this->_updateBackButtonLink($helper->getUrl('*/*/edit') . 'cms_page');
+ } else {
+ $this->_addUrlRewriteSelectorBlock();
+ $this->_addCmsPageGridBlock();
+ }
+ }
+
+ /**
+ * Get or create new instance of CMS page
+ *
+ * @return Mage_Cms_Model_Page
+ */
+ private function _getCmsPage()
+ {
+ if (!$this->hasData('cms_page')) {
+ $this->setCmsPage(Mage::getModel('Mage_Cms_Model_Page'));
+ }
+ return $this->getCmsPage();
+ }
+
+ /**
+ * Add child CMS page link block
+ */
+ private function _addCmsPageLinkBlock()
+ {
+ /** @var $helper Mage_Adminhtml_Helper_Data */
+ $helper = Mage::helper('Mage_Adminhtml_Helper_Data');
+ $this->addChild('cms_page_link', 'Mage_Adminhtml_Block_Urlrewrite_Link', array(
+ 'item_url' => $helper->getUrl('*/*/*') . 'cms_page',
+ 'item_name' => $this->getCmsPage()->getTitle(),
+ 'label' => Mage::helper('Mage_Adminhtml_Helper_Data')->__('CMS page:')
+ ));
+ }
+
+ /**
+ * Add child CMS page block
+ */
+ private function _addCmsPageGridBlock()
+ {
+ $this->addChild('cms_pages_grid', 'Mage_Adminhtml_Block_Urlrewrite_Cms_Page_Grid');
+ }
+
+ /**
+ * Creates edit form block
+ *
+ * @return Mage_Adminhtml_Block_Urlrewrite_Cms_Page_Edit_Form
+ */
+ protected function _createEditFormBlock()
+ {
+ return $this->getLayout()->createBlock('Mage_Adminhtml_Block_Urlrewrite_Cms_Page_Edit_Form', '', array(
+ 'data' => array(
+ 'cms_page' => $this->_getCmsPage(),
+ 'url_rewrite' => $this->_getUrlRewrite()
+ )
+ ));
+ }
+}
diff --git a/app/code/core/Mage/Adminhtml/Block/Urlrewrite/Cms/Page/Edit/Form.php b/app/code/Mage/Adminhtml/Block/Urlrewrite/Cms/Page/Edit/Form.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Urlrewrite/Cms/Page/Edit/Form.php
rename to app/code/Mage/Adminhtml/Block/Urlrewrite/Cms/Page/Edit/Form.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Urlrewrite/Cms/Page/Grid.php b/app/code/Mage/Adminhtml/Block/Urlrewrite/Cms/Page/Grid.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Urlrewrite/Cms/Page/Grid.php
rename to app/code/Mage/Adminhtml/Block/Urlrewrite/Cms/Page/Grid.php
diff --git a/app/code/Mage/Adminhtml/Block/Urlrewrite/Edit.php b/app/code/Mage/Adminhtml/Block/Urlrewrite/Edit.php
new file mode 100644
index 0000000000000..4884666f2ffd4
--- /dev/null
+++ b/app/code/Mage/Adminhtml/Block/Urlrewrite/Edit.php
@@ -0,0 +1,251 @@
+
+ */
+class Mage_Adminhtml_Block_Urlrewrite_Edit extends Mage_Adminhtml_Block_Widget_Container
+{
+ /**
+ * @var Mage_Adminhtml_Block_Urlrewrite_Selector
+ */
+ private $_selectorBlock;
+
+ /**
+ * Part for building some blocks names
+ *
+ * @var string
+ */
+ protected $_controller = 'urlrewrite';
+
+ /**
+ * Generated buttons html cache
+ *
+ * @var string
+ */
+ protected $_buttonsHtml;
+
+ /**
+ * Prepare URL rewrite editing layout
+ *
+ * @return Mage_Adminhtml_Block_Urlrewrite_Edit
+ */
+ protected function _prepareLayout()
+ {
+ $this->setTemplate('urlrewrite/edit.phtml');
+
+ $this->_addBackButton();
+ $this->_prepareLayoutFeatures();
+
+ return parent::_prepareLayout();
+ }
+
+ /**
+ * Prepare featured blocks for layout of URL rewrite editing
+ */
+ protected function _prepareLayoutFeatures()
+ {
+ /** @var $helper Mage_Adminhtml_Helper_Data */
+ $helper = Mage::helper('Mage_Adminhtml_Helper_Data');
+
+ if ($this->_getUrlRewrite()->getId()) {
+ $this->_headerText = Mage::helper('Mage_Adminhtml_Helper_Data')->__('Edit URL Rewrite');
+ } else {
+ $this->_headerText = Mage::helper('Mage_Adminhtml_Helper_Data')->__('Add New URL Rewrite');
+ }
+
+ $this->_updateBackButtonLink($helper->getUrl('*/*/edit') . $this->_getSelectorBlock()->getDefaultMode());
+ $this->_addUrlRewriteSelectorBlock();
+ $this->_addEditFormBlock();
+ }
+
+ /**
+ * Add child edit form block
+ */
+ protected function _addEditFormBlock()
+ {
+ $this->setChild('form', $this->_createEditFormBlock());
+
+ if ($this->_getUrlRewrite()->getId()) {
+ $this->_addResetButton();
+ $this->_addDeleteButton();
+ }
+
+ $this->_addSaveButton();
+ }
+
+ /**
+ * Add reset button
+ */
+ protected function _addResetButton()
+ {
+ $this->_addButton('reset', array(
+ 'label' => Mage::helper('Mage_Adminhtml_Helper_Data')->__('Reset'),
+ 'onclick' => '$(\'edit_form\').reset()',
+ 'class' => 'scalable',
+ 'level' => -1
+ ));
+ }
+
+ /**
+ * Add back button
+ */
+ protected function _addBackButton()
+ {
+ /** @var $helper Mage_Adminhtml_Helper_Data */
+ $helper = Mage::helper('Mage_Adminhtml_Helper_Data');
+
+ $this->_addButton('back', array(
+ 'label' => Mage::helper('Mage_Adminhtml_Helper_Data')->__('Back'),
+ 'onclick' => 'setLocation(\'' . $helper->getUrl('*/*/') . '\')',
+ 'class' => 'back',
+ 'level' => -1
+ ));
+ }
+
+ /**
+ * Update Back button location link
+ *
+ * @param string $link
+ */
+ protected function _updateBackButtonLink($link)
+ {
+ $this->_updateButton('back', 'onclick', 'setLocation(\'' . $link . '\')');
+ }
+
+ /**
+ * Add delete button
+ */
+ protected function _addDeleteButton()
+ {
+ /** @var $helper Mage_Adminhtml_Helper_Data */
+ $helper = Mage::helper('Mage_Adminhtml_Helper_Data');
+
+ $this->_addButton('delete', array(
+ 'label' => Mage::helper('Mage_Adminhtml_Helper_Data')->__('Delete'),
+ 'onclick' => 'deleteConfirm(\''
+ . addslashes(Mage::helper('Mage_Adminhtml_Helper_Data')->__('Are you sure you want to do this?'))
+ . '\', \'' . $helper->getUrl('*/*/delete', array('id' => $this->getUrlRewrite()->getId())) . '\')',
+ 'class' => 'scalable delete',
+ 'level' => -1
+ ));
+ }
+
+ /**
+ * Add save button
+ */
+ protected function _addSaveButton()
+ {
+ $this->_addButton('save', array(
+ 'label' => Mage::helper('Mage_Adminhtml_Helper_Data')->__('Save'),
+ 'class' => 'save',
+ 'level' => -1,
+ 'data_attribute' => array(
+ 'mage-init' => array(
+ 'button' => array('event' => 'save', 'target' => '#edit_form'),
+ ),
+ ),
+ ));
+ }
+
+ /**
+ * Creates edit form block
+ *
+ * @return Mage_Adminhtml_Block_Urlrewrite_Edit_Form
+ */
+ protected function _createEditFormBlock()
+ {
+ return $this->getLayout()->createBlock('Mage_Adminhtml_Block_Urlrewrite_Edit_Form', '', array('data' => array(
+ 'url_rewrite' => $this->_getUrlRewrite()
+ )));
+ }
+
+ /**
+ * Add child URL rewrite selector block
+ */
+ protected function _addUrlRewriteSelectorBlock()
+ {
+ $this->setChild('selector', $this->_getSelectorBlock());
+ }
+
+ /**
+ * Get selector block
+ *
+ * @return Mage_Adminhtml_Block_Urlrewrite_Selector
+ */
+ private function _getSelectorBlock()
+ {
+ if (!$this->_selectorBlock) {
+ $this->_selectorBlock = $this->getLayout()->createBlock('Mage_Adminhtml_Block_Urlrewrite_Selector');
+ }
+ return $this->_selectorBlock;
+ }
+
+ /**
+ * Get container buttons HTML
+ *
+ * Since buttons are set as children, we remove them as children after generating them
+ * not to duplicate them in future
+ *
+ * @param null $area
+ * @return string
+ * @SuppressWarnings(PHPMD.UnusedFormalParameter)
+ */
+ public function getButtonsHtml($area = null)
+ {
+ if (null === $this->_buttonsHtml) {
+ $this->_buttonsHtml = parent::getButtonsHtml();
+ $layout = $this->getLayout();
+ foreach ($this->getChildNames() as $name) {
+ $alias = $layout->getElementAlias($name);
+ if (false !== strpos($alias, '_button')) {
+ $layout->unsetChild($this->getNameInLayout(), $alias);
+ }
+ }
+ }
+ return $this->_buttonsHtml;
+ }
+
+ /**
+ * Get or create new instance of URL rewrite
+ *
+ * @return Mage_Core_Model_Url_Rewrite
+ */
+ protected function _getUrlRewrite()
+ {
+ if (!$this->hasData('url_rewrite')) {
+ $this->setUrlRewrite(Mage::getModel('Mage_Core_Model_Url_Rewrite'));
+ }
+ return $this->getUrlRewrite();
+ }
+}
diff --git a/app/code/core/Mage/Adminhtml/Block/Urlrewrite/Edit/Form.php b/app/code/Mage/Adminhtml/Block/Urlrewrite/Edit/Form.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Urlrewrite/Edit/Form.php
rename to app/code/Mage/Adminhtml/Block/Urlrewrite/Edit/Form.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Urlrewrite/Link.php b/app/code/Mage/Adminhtml/Block/Urlrewrite/Link.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Urlrewrite/Link.php
rename to app/code/Mage/Adminhtml/Block/Urlrewrite/Link.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Urlrewrite/Selector.php b/app/code/Mage/Adminhtml/Block/Urlrewrite/Selector.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Urlrewrite/Selector.php
rename to app/code/Mage/Adminhtml/Block/Urlrewrite/Selector.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Widget.php b/app/code/Mage/Adminhtml/Block/Widget.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Widget.php
rename to app/code/Mage/Adminhtml/Block/Widget.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Widget/Accordion.php b/app/code/Mage/Adminhtml/Block/Widget/Accordion.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Widget/Accordion.php
rename to app/code/Mage/Adminhtml/Block/Widget/Accordion.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Widget/Accordion/Item.php b/app/code/Mage/Adminhtml/Block/Widget/Accordion/Item.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Widget/Accordion/Item.php
rename to app/code/Mage/Adminhtml/Block/Widget/Accordion/Item.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Widget/Breadcrumbs.php b/app/code/Mage/Adminhtml/Block/Widget/Breadcrumbs.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Widget/Breadcrumbs.php
rename to app/code/Mage/Adminhtml/Block/Widget/Breadcrumbs.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Widget/Button.php b/app/code/Mage/Adminhtml/Block/Widget/Button.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Widget/Button.php
rename to app/code/Mage/Adminhtml/Block/Widget/Button.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Widget/Container.php b/app/code/Mage/Adminhtml/Block/Widget/Container.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Widget/Container.php
rename to app/code/Mage/Adminhtml/Block/Widget/Container.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Widget/Form.php b/app/code/Mage/Adminhtml/Block/Widget/Form.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Widget/Form.php
rename to app/code/Mage/Adminhtml/Block/Widget/Form.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Widget/Form/Container.php b/app/code/Mage/Adminhtml/Block/Widget/Form/Container.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Widget/Form/Container.php
rename to app/code/Mage/Adminhtml/Block/Widget/Form/Container.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Widget/Form/Element.php b/app/code/Mage/Adminhtml/Block/Widget/Form/Element.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Widget/Form/Element.php
rename to app/code/Mage/Adminhtml/Block/Widget/Form/Element.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Widget/Form/Element/Dependence.php b/app/code/Mage/Adminhtml/Block/Widget/Form/Element/Dependence.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Widget/Form/Element/Dependence.php
rename to app/code/Mage/Adminhtml/Block/Widget/Form/Element/Dependence.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Widget/Form/Element/Gallery.php b/app/code/Mage/Adminhtml/Block/Widget/Form/Element/Gallery.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Widget/Form/Element/Gallery.php
rename to app/code/Mage/Adminhtml/Block/Widget/Form/Element/Gallery.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Widget/Form/Renderer/Element.php b/app/code/Mage/Adminhtml/Block/Widget/Form/Renderer/Element.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Widget/Form/Renderer/Element.php
rename to app/code/Mage/Adminhtml/Block/Widget/Form/Renderer/Element.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Widget/Form/Renderer/Fieldset.php b/app/code/Mage/Adminhtml/Block/Widget/Form/Renderer/Fieldset.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Widget/Form/Renderer/Fieldset.php
rename to app/code/Mage/Adminhtml/Block/Widget/Form/Renderer/Fieldset.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Widget/Form/Renderer/Fieldset/Element.php b/app/code/Mage/Adminhtml/Block/Widget/Form/Renderer/Fieldset/Element.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Widget/Form/Renderer/Fieldset/Element.php
rename to app/code/Mage/Adminhtml/Block/Widget/Form/Renderer/Fieldset/Element.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Widget/Grid.php b/app/code/Mage/Adminhtml/Block/Widget/Grid.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Widget/Grid.php
rename to app/code/Mage/Adminhtml/Block/Widget/Grid.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column.php b/app/code/Mage/Adminhtml/Block/Widget/Grid/Column.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column.php
rename to app/code/Mage/Adminhtml/Block/Widget/Grid/Column.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Filter/Abstract.php b/app/code/Mage/Adminhtml/Block/Widget/Grid/Column/Filter/Abstract.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Filter/Abstract.php
rename to app/code/Mage/Adminhtml/Block/Widget/Grid/Column/Filter/Abstract.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Filter/Checkbox.php b/app/code/Mage/Adminhtml/Block/Widget/Grid/Column/Filter/Checkbox.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Filter/Checkbox.php
rename to app/code/Mage/Adminhtml/Block/Widget/Grid/Column/Filter/Checkbox.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Filter/Country.php b/app/code/Mage/Adminhtml/Block/Widget/Grid/Column/Filter/Country.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Filter/Country.php
rename to app/code/Mage/Adminhtml/Block/Widget/Grid/Column/Filter/Country.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Filter/Date.php b/app/code/Mage/Adminhtml/Block/Widget/Grid/Column/Filter/Date.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Filter/Date.php
rename to app/code/Mage/Adminhtml/Block/Widget/Grid/Column/Filter/Date.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Filter/Datetime.php b/app/code/Mage/Adminhtml/Block/Widget/Grid/Column/Filter/Datetime.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Filter/Datetime.php
rename to app/code/Mage/Adminhtml/Block/Widget/Grid/Column/Filter/Datetime.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Filter/Interface.php b/app/code/Mage/Adminhtml/Block/Widget/Grid/Column/Filter/Interface.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Filter/Interface.php
rename to app/code/Mage/Adminhtml/Block/Widget/Grid/Column/Filter/Interface.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Filter/Massaction.php b/app/code/Mage/Adminhtml/Block/Widget/Grid/Column/Filter/Massaction.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Filter/Massaction.php
rename to app/code/Mage/Adminhtml/Block/Widget/Grid/Column/Filter/Massaction.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Filter/Price.php b/app/code/Mage/Adminhtml/Block/Widget/Grid/Column/Filter/Price.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Filter/Price.php
rename to app/code/Mage/Adminhtml/Block/Widget/Grid/Column/Filter/Price.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Filter/Radio.php b/app/code/Mage/Adminhtml/Block/Widget/Grid/Column/Filter/Radio.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Filter/Radio.php
rename to app/code/Mage/Adminhtml/Block/Widget/Grid/Column/Filter/Radio.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Filter/Range.php b/app/code/Mage/Adminhtml/Block/Widget/Grid/Column/Filter/Range.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Filter/Range.php
rename to app/code/Mage/Adminhtml/Block/Widget/Grid/Column/Filter/Range.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Filter/Select.php b/app/code/Mage/Adminhtml/Block/Widget/Grid/Column/Filter/Select.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Filter/Select.php
rename to app/code/Mage/Adminhtml/Block/Widget/Grid/Column/Filter/Select.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Filter/Store.php b/app/code/Mage/Adminhtml/Block/Widget/Grid/Column/Filter/Store.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Filter/Store.php
rename to app/code/Mage/Adminhtml/Block/Widget/Grid/Column/Filter/Store.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Filter/Text.php b/app/code/Mage/Adminhtml/Block/Widget/Grid/Column/Filter/Text.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Filter/Text.php
rename to app/code/Mage/Adminhtml/Block/Widget/Grid/Column/Filter/Text.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Filter/Theme.php b/app/code/Mage/Adminhtml/Block/Widget/Grid/Column/Filter/Theme.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Filter/Theme.php
rename to app/code/Mage/Adminhtml/Block/Widget/Grid/Column/Filter/Theme.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Abstract.php b/app/code/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Abstract.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Abstract.php
rename to app/code/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Abstract.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Action.php b/app/code/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Action.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Action.php
rename to app/code/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Action.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Checkbox.php b/app/code/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Checkbox.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Checkbox.php
rename to app/code/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Checkbox.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Concat.php b/app/code/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Concat.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Concat.php
rename to app/code/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Concat.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Country.php b/app/code/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Country.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Country.php
rename to app/code/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Country.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Currency.php b/app/code/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Currency.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Currency.php
rename to app/code/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Currency.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Date.php b/app/code/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Date.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Date.php
rename to app/code/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Date.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Datetime.php b/app/code/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Datetime.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Datetime.php
rename to app/code/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Datetime.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Input.php b/app/code/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Input.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Input.php
rename to app/code/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Input.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Interface.php b/app/code/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Interface.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Interface.php
rename to app/code/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Interface.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Ip.php b/app/code/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Ip.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Ip.php
rename to app/code/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Ip.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Longtext.php b/app/code/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Longtext.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Longtext.php
rename to app/code/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Longtext.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Massaction.php b/app/code/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Massaction.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Massaction.php
rename to app/code/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Massaction.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Number.php b/app/code/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Number.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Number.php
rename to app/code/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Number.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Options.php b/app/code/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Options.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Options.php
rename to app/code/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Options.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Price.php b/app/code/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Price.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Price.php
rename to app/code/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Price.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Radio.php b/app/code/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Radio.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Radio.php
rename to app/code/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Radio.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Select.php b/app/code/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Select.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Select.php
rename to app/code/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Select.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Store.php b/app/code/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Store.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Store.php
rename to app/code/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Store.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Text.php b/app/code/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Text.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Text.php
rename to app/code/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Text.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Wrapline.php b/app/code/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Wrapline.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Wrapline.php
rename to app/code/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Wrapline.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Container.php b/app/code/Mage/Adminhtml/Block/Widget/Grid/Container.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Widget/Grid/Container.php
rename to app/code/Mage/Adminhtml/Block/Widget/Grid/Container.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Massaction.php b/app/code/Mage/Adminhtml/Block/Widget/Grid/Massaction.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Widget/Grid/Massaction.php
rename to app/code/Mage/Adminhtml/Block/Widget/Grid/Massaction.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Massaction/Abstract.php b/app/code/Mage/Adminhtml/Block/Widget/Grid/Massaction/Abstract.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Widget/Grid/Massaction/Abstract.php
rename to app/code/Mage/Adminhtml/Block/Widget/Grid/Massaction/Abstract.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Massaction/Item.php b/app/code/Mage/Adminhtml/Block/Widget/Grid/Massaction/Item.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Widget/Grid/Massaction/Item.php
rename to app/code/Mage/Adminhtml/Block/Widget/Grid/Massaction/Item.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Massaction/Item/Additional/Default.php b/app/code/Mage/Adminhtml/Block/Widget/Grid/Massaction/Item/Additional/Default.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Widget/Grid/Massaction/Item/Additional/Default.php
rename to app/code/Mage/Adminhtml/Block/Widget/Grid/Massaction/Item/Additional/Default.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Massaction/Item/Additional/Interface.php b/app/code/Mage/Adminhtml/Block/Widget/Grid/Massaction/Item/Additional/Interface.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Widget/Grid/Massaction/Item/Additional/Interface.php
rename to app/code/Mage/Adminhtml/Block/Widget/Grid/Massaction/Item/Additional/Interface.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Serializer.php b/app/code/Mage/Adminhtml/Block/Widget/Grid/Serializer.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Widget/Grid/Serializer.php
rename to app/code/Mage/Adminhtml/Block/Widget/Grid/Serializer.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Widget/Tab/Interface.php b/app/code/Mage/Adminhtml/Block/Widget/Tab/Interface.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Widget/Tab/Interface.php
rename to app/code/Mage/Adminhtml/Block/Widget/Tab/Interface.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Widget/Tabs.php b/app/code/Mage/Adminhtml/Block/Widget/Tabs.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Widget/Tabs.php
rename to app/code/Mage/Adminhtml/Block/Widget/Tabs.php
diff --git a/app/code/core/Mage/Adminhtml/Block/Widget/View/Container.php b/app/code/Mage/Adminhtml/Block/Widget/View/Container.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Block/Widget/View/Container.php
rename to app/code/Mage/Adminhtml/Block/Widget/View/Container.php
diff --git a/app/code/core/Mage/Adminhtml/Controller/Action.php b/app/code/Mage/Adminhtml/Controller/Action.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Controller/Action.php
rename to app/code/Mage/Adminhtml/Controller/Action.php
diff --git a/app/code/core/Mage/Adminhtml/Controller/Report/Abstract.php b/app/code/Mage/Adminhtml/Controller/Report/Abstract.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Controller/Report/Abstract.php
rename to app/code/Mage/Adminhtml/Controller/Report/Abstract.php
diff --git a/app/code/core/Mage/Adminhtml/Controller/Sales/Creditmemo.php b/app/code/Mage/Adminhtml/Controller/Sales/Creditmemo.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Controller/Sales/Creditmemo.php
rename to app/code/Mage/Adminhtml/Controller/Sales/Creditmemo.php
diff --git a/app/code/core/Mage/Adminhtml/Controller/Sales/Invoice.php b/app/code/Mage/Adminhtml/Controller/Sales/Invoice.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Controller/Sales/Invoice.php
rename to app/code/Mage/Adminhtml/Controller/Sales/Invoice.php
diff --git a/app/code/core/Mage/Adminhtml/Controller/Sales/Shipment.php b/app/code/Mage/Adminhtml/Controller/Sales/Shipment.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Controller/Sales/Shipment.php
rename to app/code/Mage/Adminhtml/Controller/Sales/Shipment.php
diff --git a/app/code/core/Mage/Adminhtml/Exception.php b/app/code/Mage/Adminhtml/Exception.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Exception.php
rename to app/code/Mage/Adminhtml/Exception.php
diff --git a/app/code/core/Mage/Adminhtml/Helper/Addresses.php b/app/code/Mage/Adminhtml/Helper/Addresses.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Helper/Addresses.php
rename to app/code/Mage/Adminhtml/Helper/Addresses.php
diff --git a/app/code/core/Mage/Adminhtml/Helper/Catalog.php b/app/code/Mage/Adminhtml/Helper/Catalog.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Helper/Catalog.php
rename to app/code/Mage/Adminhtml/Helper/Catalog.php
diff --git a/app/code/core/Mage/Adminhtml/Helper/Catalog/Product/Composite.php b/app/code/Mage/Adminhtml/Helper/Catalog/Product/Composite.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Helper/Catalog/Product/Composite.php
rename to app/code/Mage/Adminhtml/Helper/Catalog/Product/Composite.php
diff --git a/app/code/core/Mage/Adminhtml/Helper/Catalog/Product/Edit/Action/Attribute.php b/app/code/Mage/Adminhtml/Helper/Catalog/Product/Edit/Action/Attribute.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Helper/Catalog/Product/Edit/Action/Attribute.php
rename to app/code/Mage/Adminhtml/Helper/Catalog/Product/Edit/Action/Attribute.php
diff --git a/app/code/core/Mage/Adminhtml/Helper/Dashboard/Abstract.php b/app/code/Mage/Adminhtml/Helper/Dashboard/Abstract.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Helper/Dashboard/Abstract.php
rename to app/code/Mage/Adminhtml/Helper/Dashboard/Abstract.php
diff --git a/app/code/core/Mage/Adminhtml/Helper/Dashboard/Data.php b/app/code/Mage/Adminhtml/Helper/Dashboard/Data.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Helper/Dashboard/Data.php
rename to app/code/Mage/Adminhtml/Helper/Dashboard/Data.php
diff --git a/app/code/core/Mage/Adminhtml/Helper/Dashboard/Order.php b/app/code/Mage/Adminhtml/Helper/Dashboard/Order.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Helper/Dashboard/Order.php
rename to app/code/Mage/Adminhtml/Helper/Dashboard/Order.php
diff --git a/app/code/core/Mage/Adminhtml/Helper/Data.php b/app/code/Mage/Adminhtml/Helper/Data.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Helper/Data.php
rename to app/code/Mage/Adminhtml/Helper/Data.php
diff --git a/app/code/core/Mage/Adminhtml/Helper/Js.php b/app/code/Mage/Adminhtml/Helper/Js.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Helper/Js.php
rename to app/code/Mage/Adminhtml/Helper/Js.php
diff --git a/app/code/Mage/Adminhtml/Helper/Media/Js.php b/app/code/Mage/Adminhtml/Helper/Media/Js.php
new file mode 100644
index 0000000000000..336e1e16a79c3
--- /dev/null
+++ b/app/code/Mage/Adminhtml/Helper/Media/Js.php
@@ -0,0 +1,74 @@
+
+ */
+class Mage_Adminhtml_Helper_Media_Js extends Mage_Core_Helper_Js
+{
+ /**
+ * @param Mage_Core_Helper_Context $context
+ * @param Mage_Core_Model_Config_Modules_Reader $configReader
+ */
+ public function __construct(
+ Mage_Core_Helper_Context $context,
+ Mage_Core_Model_Config_Modules_Reader $configReader
+ ) {
+ parent::__construct($context, $configReader);
+
+ $this->_translateData = array(
+ 'Complete' => $this->__('Complete'),
+ 'File size should be more than 0 bytes' => $this->__('File size should be more than 0 bytes'),
+ 'Upload Security Error' => $this->__('Upload Security Error'),
+ 'Upload HTTP Error' => $this->__('Upload HTTP Error'),
+ 'Upload I/O Error' => $this->__('Upload I/O Error'),
+ 'SSL Error: Invalid or self-signed certificate' => $this->__('SSL Error: Invalid or self-signed certificate'),
+ 'Tb' => $this->__('Tb'),
+ 'Gb' => $this->__('Gb'),
+ 'Mb' => $this->__('Mb'),
+ 'Kb' => $this->__('Kb'),
+ 'b' => $this->__('b')
+ );
+ }
+
+ /**
+ * Retrieve JS translator initialization javascript
+ *
+ * @return string
+ */
+ public function getTranslatorScript()
+ {
+ $script = '(function($) {$.mage.translate.add(' . $this->getTranslateJson() . ')})(jQuery);';
+ return $this->getScript($script);
+ }
+
+}
diff --git a/app/code/core/Mage/Adminhtml/Helper/Sales.php b/app/code/Mage/Adminhtml/Helper/Sales.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Helper/Sales.php
rename to app/code/Mage/Adminhtml/Helper/Sales.php
diff --git a/app/code/core/Mage/Adminhtml/Model/Customer/Renderer/Region.php b/app/code/Mage/Adminhtml/Model/Customer/Renderer/Region.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Model/Customer/Renderer/Region.php
rename to app/code/Mage/Adminhtml/Model/Customer/Renderer/Region.php
diff --git a/app/code/core/Mage/Adminhtml/Model/Email/Template.php b/app/code/Mage/Adminhtml/Model/Email/Template.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Model/Email/Template.php
rename to app/code/Mage/Adminhtml/Model/Email/Template.php
diff --git a/app/code/core/Mage/Adminhtml/Model/Giftmessage/Save.php b/app/code/Mage/Adminhtml/Model/Giftmessage/Save.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Model/Giftmessage/Save.php
rename to app/code/Mage/Adminhtml/Model/Giftmessage/Save.php
diff --git a/app/code/core/Mage/Adminhtml/Model/LayoutUpdate/Validator.php b/app/code/Mage/Adminhtml/Model/LayoutUpdate/Validator.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Model/LayoutUpdate/Validator.php
rename to app/code/Mage/Adminhtml/Model/LayoutUpdate/Validator.php
diff --git a/app/code/core/Mage/Adminhtml/Model/Newsletter/Renderer/Text.php b/app/code/Mage/Adminhtml/Model/Newsletter/Renderer/Text.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Model/Newsletter/Renderer/Text.php
rename to app/code/Mage/Adminhtml/Model/Newsletter/Renderer/Text.php
diff --git a/app/code/core/Mage/Adminhtml/Model/Observer.php b/app/code/Mage/Adminhtml/Model/Observer.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Model/Observer.php
rename to app/code/Mage/Adminhtml/Model/Observer.php
diff --git a/app/code/core/Mage/Adminhtml/Model/Report/Item.php b/app/code/Mage/Adminhtml/Model/Report/Item.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Model/Report/Item.php
rename to app/code/Mage/Adminhtml/Model/Report/Item.php
diff --git a/app/code/core/Mage/Adminhtml/Model/Sales/Order.php b/app/code/Mage/Adminhtml/Model/Sales/Order.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Model/Sales/Order.php
rename to app/code/Mage/Adminhtml/Model/Sales/Order.php
diff --git a/app/code/core/Mage/Adminhtml/Model/Sales/Order/Create.php b/app/code/Mage/Adminhtml/Model/Sales/Order/Create.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Model/Sales/Order/Create.php
rename to app/code/Mage/Adminhtml/Model/Sales/Order/Create.php
diff --git a/app/code/core/Mage/Adminhtml/Model/Sales/Order/Random.php b/app/code/Mage/Adminhtml/Model/Sales/Order/Random.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Model/Sales/Order/Random.php
rename to app/code/Mage/Adminhtml/Model/Sales/Order/Random.php
diff --git a/app/code/core/Mage/Adminhtml/Model/Search/Catalog.php b/app/code/Mage/Adminhtml/Model/Search/Catalog.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Model/Search/Catalog.php
rename to app/code/Mage/Adminhtml/Model/Search/Catalog.php
diff --git a/app/code/core/Mage/Adminhtml/Model/Search/Customer.php b/app/code/Mage/Adminhtml/Model/Search/Customer.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Model/Search/Customer.php
rename to app/code/Mage/Adminhtml/Model/Search/Customer.php
diff --git a/app/code/core/Mage/Adminhtml/Model/Search/Order.php b/app/code/Mage/Adminhtml/Model/Search/Order.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Model/Search/Order.php
rename to app/code/Mage/Adminhtml/Model/Search/Order.php
diff --git a/app/code/core/Mage/Adminhtml/Model/Session.php b/app/code/Mage/Adminhtml/Model/Session.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Model/Session.php
rename to app/code/Mage/Adminhtml/Model/Session.php
diff --git a/app/code/core/Mage/Adminhtml/Model/Session/Quote.php b/app/code/Mage/Adminhtml/Model/Session/Quote.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Model/Session/Quote.php
rename to app/code/Mage/Adminhtml/Model/Session/Quote.php
diff --git a/app/code/core/Mage/Adminhtml/Model/UrlRewriteOptions.php b/app/code/Mage/Adminhtml/Model/UrlRewriteOptions.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/Model/UrlRewriteOptions.php
rename to app/code/Mage/Adminhtml/Model/UrlRewriteOptions.php
diff --git a/app/code/core/Mage/Adminhtml/controllers/AjaxController.php b/app/code/Mage/Adminhtml/controllers/AjaxController.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/controllers/AjaxController.php
rename to app/code/Mage/Adminhtml/controllers/AjaxController.php
diff --git a/app/code/core/Mage/Adminhtml/controllers/Api/RoleController.php b/app/code/Mage/Adminhtml/controllers/Api/RoleController.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/controllers/Api/RoleController.php
rename to app/code/Mage/Adminhtml/controllers/Api/RoleController.php
diff --git a/app/code/core/Mage/Adminhtml/controllers/Api/UserController.php b/app/code/Mage/Adminhtml/controllers/Api/UserController.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/controllers/Api/UserController.php
rename to app/code/Mage/Adminhtml/controllers/Api/UserController.php
diff --git a/app/code/Mage/Adminhtml/controllers/CacheController.php b/app/code/Mage/Adminhtml/controllers/CacheController.php
new file mode 100644
index 0000000000000..d6ab267ef4f7c
--- /dev/null
+++ b/app/code/Mage/Adminhtml/controllers/CacheController.php
@@ -0,0 +1,304 @@
+_cache = $cache;
+ $this->_cacheTypes = $cacheTypes;
+ $this->_cacheFrontendPool = $cacheFrontendPool;
+ }
+
+ /**
+ * Retrieve session model
+ *
+ * @return Mage_Adminhtml_Model_Session
+ */
+ protected function _getSession()
+ {
+ return Mage::getSingleton('Mage_Adminhtml_Model_Session');
+ }
+
+ /**
+ * Display cache management grid
+ */
+ public function indexAction()
+ {
+ $this->_title($this->__('System'))->_title($this->__('Cache Management'));
+
+ $this->loadLayout()
+ ->_setActiveMenu('Mage_Adminhtml::system_cache')
+ ->renderLayout();
+ }
+
+ /**
+ * Flush cache storage
+ */
+ public function flushAllAction()
+ {
+ Mage::dispatchEvent('adminhtml_cache_flush_all');
+ /** @var $cacheFrontend Magento_Cache_FrontendInterface */
+ foreach ($this->_cacheFrontendPool as $cacheFrontend) {
+ $cacheFrontend->clean();
+ }
+ $this->_getSession()->addSuccess(
+ Mage::helper('Mage_Adminhtml_Helper_Data')->__("The cache storage has been flushed.")
+ );
+ $this->_redirect('*/*');
+ }
+
+ /**
+ * Flush all magento cache
+ */
+ public function flushSystemAction()
+ {
+ $markerCacheTag = Mage_Core_Model_AppInterface::CACHE_TAG;
+ /** @var $cacheFrontend Magento_Cache_FrontendInterface */
+ foreach ($this->_cacheFrontendPool as $cacheFrontend) {
+ $cacheFrontend->clean(Zend_Cache::CLEANING_MODE_MATCHING_TAG, array($markerCacheTag));
+ }
+ Mage::dispatchEvent('adminhtml_cache_flush_system');
+ $this->_getSession()->addSuccess(
+ Mage::helper('Mage_Adminhtml_Helper_Data')->__("The Magento cache storage has been flushed.")
+ );
+ $this->_redirect('*/*');
+ }
+
+ /**
+ * Mass action for cache enabling
+ */
+ public function massEnableAction()
+ {
+ try {
+ $types = $this->getRequest()->getParam('types');
+ $updatedTypes = 0;
+ $this->_validateTypes($types);
+ foreach ($types as $code) {
+ if (!$this->_cacheTypes->isEnabled($code)) {
+ $this->_cacheTypes->setEnabled($code, true);
+ $updatedTypes++;
+ }
+ }
+ if ($updatedTypes > 0) {
+ $this->_cacheTypes->persist();
+ $this->_getSession()->addSuccess(
+ Mage::helper('Mage_Adminhtml_Helper_Data')->__("%s cache type(s) enabled.", $updatedTypes)
+ );
+ }
+ } catch (Mage_Core_Exception $e) {
+ $this->_getSession()->addError($e->getMessage());
+ }
+ catch (Exception $e) {
+ $this->_getSession()->addException(
+ $e,
+ Mage::helper('Mage_Adminhtml_Helper_Data')->__('An error occurred while enabling cache.')
+ );
+ }
+ $this->_redirect('*/*');
+ }
+
+ /**
+ * Mass action for cache disabling
+ */
+ public function massDisableAction()
+ {
+ try {
+ $types = $this->getRequest()->getParam('types');
+ $updatedTypes = 0;
+ $this->_validateTypes($types);
+ foreach ($types as $code) {
+ if ($this->_cacheTypes->isEnabled($code)) {
+ $this->_cacheTypes->setEnabled($code, false);
+ $updatedTypes++;
+ }
+ $this->_cache->cleanType($code);
+ }
+ if ($updatedTypes > 0) {
+ $this->_cacheTypes->persist();
+ $this->_getSession()->addSuccess(
+ Mage::helper('Mage_Adminhtml_Helper_Data')->__("%s cache type(s) disabled.", $updatedTypes)
+ );
+ }
+ } catch (Mage_Core_Exception $e) {
+ $this->_getSession()->addError($e->getMessage());
+ }
+ catch (Exception $e) {
+ $this->_getSession()->addException(
+ $e,
+ Mage::helper('Mage_Adminhtml_Helper_Data')->__('An error occurred while disabling cache.')
+ );
+ }
+ $this->_redirect('*/*');
+ }
+
+ /**
+ * Mass action for cache refresh
+ */
+ public function massRefreshAction()
+ {
+ try {
+ $types = $this->getRequest()->getParam('types');
+ $updatedTypes = 0;
+ $this->_validateTypes($types);
+ foreach ($types as $type) {
+ $this->_cache->cleanType($type);
+ Mage::dispatchEvent('adminhtml_cache_refresh_type', array('type' => $type));
+ $updatedTypes++;
+ }
+ if ($updatedTypes > 0) {
+ $this->_getSession()->addSuccess(
+ Mage::helper('Mage_Adminhtml_Helper_Data')->__("%s cache type(s) refreshed.", $updatedTypes)
+ );
+ }
+ } catch (Mage_Core_Exception $e) {
+ $this->_getSession()->addError($e->getMessage());
+ }
+ catch (Exception $e) {
+ $this->_getSession()->addException(
+ $e,
+ Mage::helper('Mage_Adminhtml_Helper_Data')->__('An error occurred while refreshing cache.')
+ );
+ }
+ $this->_redirect('*/*');
+ }
+
+ /**
+ * Check whether specified cache types exist
+ *
+ * @param array $types
+ */
+ protected function _validateTypes(array $types)
+ {
+ if (empty($types)) {
+ return;
+ }
+ $allTypes = array_keys($this->_cache->getTypes());
+ $invalidTypes = array_diff($types, $allTypes);
+ if (count($invalidTypes) > 0) {
+ Mage::throwException(Mage::helper('Mage_Adminhtml_Helper_Data')
+ ->__("Specified cache type(s) don't exist: " . join(', ', $invalidTypes)));
+ }
+ }
+
+ /**
+ * Clean JS/css files cache
+ */
+ public function cleanMediaAction()
+ {
+ try {
+ Mage::getModel('Mage_Core_Model_Design_Package')->cleanMergedJsCss();
+ Mage::dispatchEvent('clean_media_cache_after');
+ $this->_getSession()->addSuccess(
+ Mage::helper('Mage_Adminhtml_Helper_Data')->__('The JavaScript/CSS cache has been cleaned.')
+ );
+ }
+ catch (Exception $e) {
+ $this->_getSession()->addException(
+ $e,
+ Mage::helper('Mage_Adminhtml_Helper_Data')->__('An error occurred while clearing the JavaScript/CSS cache.')
+ );
+ }
+ catch (Mage_Core_Exception $e) {
+ $this->_getSession()->addError($e->getMessage());
+ }
+ $this->_redirect('*/*');
+ }
+
+ /**
+ * Clean JS/css files cache
+ */
+ public function cleanImagesAction()
+ {
+ try {
+ Mage::getModel('Mage_Catalog_Model_Product_Image')->clearCache();
+ Mage::dispatchEvent('clean_catalog_images_cache_after');
+ $this->_getSession()->addSuccess(
+ Mage::helper('Mage_Adminhtml_Helper_Data')->__('The image cache was cleaned.')
+ );
+ }
+ catch (Mage_Core_Exception $e) {
+ $this->_getSession()->addError($e->getMessage());
+ }
+ catch (Exception $e) {
+ $this->_getSession()->addException(
+ $e,
+ Mage::helper('Mage_Adminhtml_Helper_Data')->__('An error occurred while clearing the image cache.')
+ );
+ }
+ $this->_redirect('*/*');
+ }
+
+ /**
+ * Check if cache management is allowed
+ *
+ * @return bool
+ */
+ protected function _isAllowed()
+ {
+ return Mage::getSingleton('Mage_Core_Model_Authorization')->isAllowed('Mage_Adminhtml::cache');
+ }
+}
diff --git a/app/code/Mage/Adminhtml/controllers/Catalog/Category/WidgetController.php b/app/code/Mage/Adminhtml/controllers/Catalog/Category/WidgetController.php
new file mode 100644
index 0000000000000..13a10e67f73d8
--- /dev/null
+++ b/app/code/Mage/Adminhtml/controllers/Catalog/Category/WidgetController.php
@@ -0,0 +1,74 @@
+
+ */
+class Mage_Adminhtml_Catalog_Category_WidgetController extends Mage_Adminhtml_Controller_Action
+{
+ /**
+ * Chooser Source action
+ */
+ public function chooserAction()
+ {
+ $this->getResponse()->setBody(
+ $this->_getCategoryTreeBlock()->toHtml()
+ );
+ }
+
+ /**
+ * Categories tree node (Ajax version)
+ */
+ public function categoriesJsonAction()
+ {
+ if ($categoryId = (int) $this->getRequest()->getPost('id')) {
+
+ $category = Mage::getModel('Mage_Catalog_Model_Category')->load($categoryId);
+ if ($category->getId()) {
+ Mage::register('category', $category);
+ Mage::register('current_category', $category);
+ }
+ $this->getResponse()->setBody(
+ $this->_getCategoryTreeBlock()->getTreeJson($category)
+ );
+ }
+ }
+
+ protected function _getCategoryTreeBlock()
+ {
+ return $this->getLayout()->createBlock('Mage_Adminhtml_Block_Catalog_Category_Widget_Chooser', '', array(
+ 'data' => array(
+ 'id' => $this->getRequest()->getParam('uniq_id'),
+ 'use_massaction' => $this->getRequest()->getParam('use_massaction', false)
+ )
+ ));
+ }
+}
diff --git a/app/code/Mage/Adminhtml/controllers/Catalog/CategoryController.php b/app/code/Mage/Adminhtml/controllers/Catalog/CategoryController.php
new file mode 100644
index 0000000000000..b7d7149e7f112
--- /dev/null
+++ b/app/code/Mage/Adminhtml/controllers/Catalog/CategoryController.php
@@ -0,0 +1,529 @@
+_title($this->__('Catalog'))
+ ->_title($this->__('Categories'))
+ ->_title($this->__('Manage Categories'));
+
+ $categoryId = (int)$this->getRequest()->getParam('id', false);
+ $storeId = (int)$this->getRequest()->getParam('store');
+ $category = $this->_objectManager->create('Mage_Catalog_Model_Category');
+ $category->setStoreId($storeId);
+
+ if ($categoryId) {
+ $category->load($categoryId);
+ if ($storeId) {
+ $rootId = $this->_objectManager->get('Mage_Core_Model_StoreManager')->getStore($storeId)
+ ->getRootCategoryId();
+ if (!in_array($rootId, $category->getPathIds())) {
+ // load root category instead wrong one
+ if ($getRootInstead) {
+ $category->load($rootId);
+ } else {
+ $this->_redirect('*/*/', array('_current'=>true, 'id'=>null));
+ return false;
+ }
+ }
+ }
+ }
+
+ $activeTabId = (string)$this->getRequest()->getParam('active_tab_id');
+ if ($activeTabId) {
+ $this->_objectManager->get('Mage_Backend_Model_Auth_Session')->setActiveTabId($activeTabId);
+ }
+ $this->_objectManager->get('Mage_Core_Model_Registry')->register('category', $category);
+ $this->_objectManager->get('Mage_Core_Model_Registry')->register('current_category', $category);
+ $this->_objectManager->get('Mage_Cms_Model_Wysiwyg_Config')->setStoreId($this->getRequest()->getParam('store'));
+ return $category;
+ }
+ /**
+ * Catalog categories index action
+ */
+ public function indexAction()
+ {
+ $this->_forward('edit');
+ }
+
+ /**
+ * Add new category form
+ */
+ public function addAction()
+ {
+ $this->_objectManager->get('Mage_Backend_Model_Auth_Session')->unsActiveTabId();
+ $this->_forward('edit');
+ }
+
+ /**
+ * Edit category page
+ */
+ public function editAction()
+ {
+ $params['_current'] = true;
+ $redirect = false;
+
+ $storeId = (int)$this->getRequest()->getParam('store');
+ $parentId = (int)$this->getRequest()->getParam('parent');
+ $prevStoreId = $this->_objectManager->get('Mage_Backend_Model_Auth_Session')
+ ->getLastViewedStore(true);
+
+ if (!empty($prevStoreId) && !$this->getRequest()->getQuery('isAjax')) {
+ $params['store'] = $prevStoreId;
+ $redirect = true;
+ }
+
+ $categoryId = (int)$this->getRequest()->getParam('id');
+ $_prevCategoryId = $this->_objectManager->get('Mage_Backend_Model_Auth_Session')
+ ->getLastEditedCategory(true);
+
+ if ($_prevCategoryId
+ && !$this->getRequest()->getQuery('isAjax')
+ && !$this->getRequest()->getParam('clear')
+ ) {
+ $this->getRequest()->setParam('id', $_prevCategoryId);
+ }
+
+ if ($redirect) {
+ $this->_redirect('*/*/edit', $params);
+ return;
+ }
+
+ if ($storeId && !$categoryId && !$parentId) {
+ $store = $this->_objectManager->get('Mage_Core_Model_StoreManager')->getStore($storeId);
+ $_prevCategoryId = (int) $store->getRootCategoryId();
+ $this->getRequest()->setParam('id', $_prevCategoryId);
+ }
+
+ $category = $this->_initCategory(true);
+ if (!$category) {
+ return;
+ }
+
+ $this->_title($categoryId ? $category->getName() : $this->__('Categories'));
+
+ /**
+ * Check if we have data in session (if during category save was exception)
+ */
+ $data = $this->_getSession()->getCategoryData(true);
+ if (isset($data['general'])) {
+ $category->addData($data['general']);
+ }
+
+ /**
+ * Build response for ajax request
+ */
+ if ($this->getRequest()->getQuery('isAjax')) {
+ // prepare breadcrumbs of selected category, if any
+ $breadcrumbsPath = $category->getPath();
+ if (empty($breadcrumbsPath)) {
+ // but if no category, and it is deleted - prepare breadcrumbs from path, saved in session
+ $breadcrumbsPath = $this->_objectManager->get('Mage_Backend_Model_Auth_Session')->getDeletedPath(true);
+ if (!empty($breadcrumbsPath)) {
+ $breadcrumbsPath = explode('/', $breadcrumbsPath);
+ // no need to get parent breadcrumbs if deleting category level 1
+ if (count($breadcrumbsPath) <= 1) {
+ $breadcrumbsPath = '';
+ } else {
+ array_pop($breadcrumbsPath);
+ $breadcrumbsPath = implode('/', $breadcrumbsPath);
+ }
+ }
+ }
+
+ $this->_objectManager->get('Mage_Backend_Model_Auth_Session')
+ ->setLastViewedStore($this->getRequest()->getParam('store'));
+ $this->_objectManager->get('Mage_Backend_Model_Auth_Session')
+ ->setLastEditedCategory($category->getId());
+ $this->loadLayout();
+
+ $eventResponse = new Varien_Object(array(
+ 'content' => $this->getLayout()->getBlock('category.edit')->getFormHtml()
+ . $this->getLayout()->getBlock('category.tree')
+ ->getBreadcrumbsJavascript($breadcrumbsPath, 'editingCategoryBreadcrumbs'),
+ 'messages' => $this->getLayout()->getMessagesBlock()->getGroupedHtml(),
+ ));
+ $this->_objectManager->get('Mage_Core_Model_Event_Manager')->dispatch(
+ 'category_prepare_ajax_response',
+ array(
+ 'response' => $eventResponse,
+ 'controller' => $this
+ ));
+ $this->getResponse()->setHeader('Content-type', 'application/json', true);
+ $this->getResponse()->setBody(
+ $this->_objectManager->get('Mage_Core_Helper_Data')->jsonEncode($eventResponse->getData())
+ );
+ return;
+ }
+
+ $this->loadLayout();
+ $this->_setActiveMenu('Mage_Catalog::catalog_categories');
+ $this->getLayout()->getBlock('head')->setCanLoadExtJs(true)->setContainerCssClass('catalog-categories');
+
+ $this->_addBreadcrumb($this->__('Manage Catalog Categories'), $this->__('Manage Categories'));
+
+ $block = $this->getLayout()->getBlock('catalog.wysiwyg.js');
+ if ($block) {
+ $block->setStoreId($storeId);
+ }
+
+ $this->renderLayout();
+ }
+
+ /**
+ * WYSIWYG editor action for ajax request
+ *
+ */
+ public function wysiwygAction()
+ {
+ $elementId = $this->getRequest()->getParam('element_id', md5(microtime()));
+ $storeId = $this->getRequest()->getParam('store_id', 0);
+ $storeMediaUrl = $this->_objectManager->get('Mage_Core_Model_StoreManager')->getStore($storeId)
+ ->getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA);
+
+ $content = $this->getLayout()->createBlock(
+ 'Mage_Adminhtml_Block_Catalog_Helper_Form_Wysiwyg_Content',
+ '',
+ array(
+ 'data' => array(
+ 'editor_element_id' => $elementId,
+ 'store_id' => $storeId,
+ 'store_media_url' => $storeMediaUrl,
+ )
+ )
+ );
+
+ $this->getResponse()->setBody($content->toHtml());
+ }
+
+ /**
+ * Get tree node (Ajax version)
+ */
+ public function categoriesJsonAction()
+ {
+ if ($this->getRequest()->getParam('expand_all')) {
+ $this->_objectManager->get('Mage_Backend_Model_Auth_Session')->setIsTreeWasExpanded(true);
+ } else {
+ $this->_objectManager->get('Mage_Backend_Model_Auth_Session')->setIsTreeWasExpanded(false);
+ }
+ $categoryId = (int)$this->getRequest()->getPost('id');
+ if ($categoryId) {
+ $this->getRequest()->setParam('id', $categoryId);
+
+ if (!$category = $this->_initCategory()) {
+ return;
+ }
+ $this->getResponse()->setBody(
+ $this->getLayout()->createBlock('Mage_Adminhtml_Block_Catalog_Category_Tree')
+ ->getTreeJson($category)
+ );
+ }
+ }
+
+ /**
+ * Category save
+ */
+ public function saveAction()
+ {
+ if (!$category = $this->_initCategory()) {
+ return;
+ }
+
+ $storeId = $this->getRequest()->getParam('store');
+ $refreshTree = 'false';
+ $data = $this->getRequest()->getPost();
+ if ($data) {
+ $category->addData($data['general']);
+ if (!$category->getId()) {
+ $parentId = $this->getRequest()->getParam('parent');
+ if (!$parentId) {
+ if ($storeId) {
+ $parentId = $this->_objectManager->get('Mage_Core_Model_StoreManager')
+ ->getStore($storeId)->getRootCategoryId();
+ } else {
+ $parentId = Mage_Catalog_Model_Category::TREE_ROOT_ID;
+ }
+ }
+ $parentCategory = $this->_objectManager->create('Mage_Catalog_Model_Category')->load($parentId);
+ $category->setPath($parentCategory->getPath());
+ }
+
+ /**
+ * Process "Use Config Settings" checkboxes
+ */
+ $useConfig = $this->getRequest()->getPost('use_config');
+ if ($useConfig) {
+ foreach ($useConfig as $attributeCode) {
+ $category->setData($attributeCode, null);
+ }
+ }
+
+ /**
+ * Create Permanent Redirect for old URL key
+ */
+ // && $category->getOrigData('url_key') != $category->getData('url_key')
+ if ($category->getId() && isset($data['general']['url_key_create_redirect'])) {
+ $category->setData('save_rewrites_history', (bool)$data['general']['url_key_create_redirect']);
+ }
+
+ $category->setAttributeSetId($category->getDefaultAttributeSetId());
+
+ if (isset($data['category_products']) && !$category->getProductsReadonly()) {
+ $products = array();
+ parse_str($data['category_products'], $products);
+ $category->setPostedProducts($products);
+ }
+ $this->_objectManager->get('Mage_Core_Model_Event_Manager')->dispatch(
+ 'catalog_category_prepare_save',
+ array(
+ 'category' => $category,
+ 'request' => $this->getRequest()
+ ));
+
+ /**
+ * Check "Use Default Value" checkboxes values
+ */
+ $useDefaults = $this->getRequest()->getPost('use_default');
+ if ($useDefaults) {
+ foreach ($useDefaults as $attributeCode) {
+ $category->setData($attributeCode, false);
+ }
+ }
+
+ /**
+ * Proceed with $_POST['use_config']
+ * set into category model for processing through validation
+ */
+ $category->setData('use_post_data_config', $this->getRequest()->getPost('use_config'));
+
+ try {
+ $validate = $category->validate();
+ if ($validate !== true) {
+ foreach ($validate as $code => $error) {
+ if ($error === true) {
+ $attribute = $category->getResource()->getAttribute($code)->getFrontend()->getLabel();
+ throw new Mage_Core_Exception(
+ $this->__('Attribute "%s" is required.', $attribute)
+ );
+ } else {
+ throw new Mage_Core_Exception($error);
+ }
+ }
+ }
+
+ $category->unsetData('use_post_data_config');
+ if (isset($data['general']['entity_id'])) {
+ throw new Mage_Core_Exception($this->__('Unable to save the category'));
+ }
+
+ $category->save();
+ $this->_getSession()->addSuccess($this->__('The category has been saved.'));
+ $refreshTree = 'true';
+ } catch (Exception $e){
+ $this->_getSession()->addError($e->getMessage())->setCategoryData($data);
+ $refreshTree = 'false';
+ }
+ }
+
+ if ($this->getRequest()->getPost('return_session_messages_only')) {
+ $category->load($category->getId()); // to obtain truncated category name
+
+ /** @var $block Mage_Core_Block_Messages */
+ $block = $this->_objectManager->get('Mage_Core_Block_Messages');
+ $block->setMessages($this->_getSession()->getMessages(true));
+ $body = $this->_objectManager->get('Mage_Core_Helper_Data')->jsonEncode(array(
+ 'messages' => $block->getGroupedHtml(),
+ 'error' => $refreshTree !== 'true',
+ 'category' => $category->toArray(),
+ ));
+ } else {
+ $url = $this->getUrl('*/*/edit', array('_current' => true, 'id' => $category->getId()));
+ $body = '';
+ }
+
+ $this->getResponse()->setBody($body);
+ }
+
+ /**
+ * Move category action
+ */
+ public function moveAction()
+ {
+ $category = $this->_initCategory();
+ if (!$category) {
+ $this->getResponse()->setBody($this->__('Category move error'));
+ return;
+ }
+ /**
+ * New parent category identifier
+ */
+ $parentNodeId = $this->getRequest()->getPost('pid', false);
+ /**
+ * Category id after which we have put our category
+ */
+ $prevNodeId = $this->getRequest()->getPost('aid', false);
+
+ try {
+ $category->move($parentNodeId, $prevNodeId);
+ $this->getResponse()->setBody('SUCCESS');
+ } catch (Mage_Core_Exception $e) {
+ $this->getResponse()->setBody($e->getMessage());
+ } catch (Exception $e){
+ $this->getResponse()->setBody($this->__('Category move error %s', $e));
+ $this->_objectManager->get('Mage_Core_Model_Logger')->logException($e);
+ }
+
+ }
+
+ /**
+ * Delete category action
+ */
+ public function deleteAction()
+ {
+ $categoryId = (int)$this->getRequest()->getParam('id');
+ if ($categoryId) {
+ try {
+ $category = $this->_objectManager->create('Mage_Catalog_Model_Category')->load($categoryId);
+ $this->_objectManager->get('Mage_Core_Model_Event_Manager')->dispatch(
+ 'catalog_controller_category_delete', array('category' => $category)
+ );
+
+ $this->_objectManager->get('Mage_Backend_Model_Auth_Session')->setDeletedPath($category->getPath());
+
+ $category->delete();
+ $this->_getSession()->addSuccess($this->__('The category has been deleted.'));
+ } catch (Mage_Core_Exception $e){
+ $this->_getSession()->addError($e->getMessage());
+ $this->getResponse()->setRedirect($this->getUrl('*/*/edit', array('_current' => true)));
+ return;
+ } catch (Exception $e){
+ $this->_getSession()->addError($this->__('An error occurred while trying to delete the category.'));
+ $this->getResponse()->setRedirect($this->getUrl('*/*/edit', array('_current' => true)));
+ return;
+ }
+ }
+ $this->getResponse()->setRedirect($this->getUrl('*/*/', array('_current' => true, 'id' => null)));
+ }
+
+ /**
+ * Grid Action
+ * Display list of products related to current category
+ */
+ public function gridAction()
+ {
+ $category = $this->_initCategory(true);
+ if (!$category) {
+ return;
+ }
+ $this->getResponse()->setBody($this->getLayout()->createBlock(
+ 'Mage_Adminhtml_Block_Catalog_Category_Tab_Product', 'category.product.grid'
+ )->toHtml());
+ }
+
+ /**
+ * Tree Action
+ * Retrieve category tree
+ */
+ public function treeAction()
+ {
+ $storeId = (int)$this->getRequest()->getParam('store');
+ $categoryId = (int)$this->getRequest()->getParam('id');
+
+ if ($storeId) {
+ if (!$categoryId) {
+ $store = $this->_objectManager->get('Mage_Core_Model_StoreManager')->getStore($storeId);
+ $rootId = $store->getRootCategoryId();
+ $this->getRequest()->setParam('id', $rootId);
+ }
+ }
+
+ $category = $this->_initCategory(true);
+
+ $block = $this->getLayout()->createBlock('Mage_Adminhtml_Block_Catalog_Category_Tree');
+ $root = $block->getRoot();
+ $this->getResponse()->setBody($this->_objectManager->get('Mage_Core_Helper_Data')->jsonEncode(array(
+ 'data' => $block->getTree(),
+ 'parameters' => array(
+ 'text' => $block->buildNodeName($root),
+ 'draggable' => false,
+ 'allowDrop' => (bool)$root->getIsVisible(),
+ 'id' => (int)$root->getId(),
+ 'expanded' => (int)$block->getIsWasExpanded(),
+ 'store_id' => (int)$block->getStore()->getId(),
+ 'category_id' => (int)$category->getId(),
+ 'root_visible'=> (int)$root->getIsVisible()
+ ))));
+ }
+
+ /**
+ * Build response for refresh input element 'path' in form
+ */
+ public function refreshPathAction()
+ {
+ $categoryId = (int)$this->getRequest()->getParam('id');
+ if ($categoryId) {
+ $category = $this->_objectManager->create('Mage_Catalog_Model_Category')->load($categoryId);
+ $this->getResponse()->setBody(
+ $this->_objectManager->get('Mage_Core_Helper_Data')->jsonEncode(array(
+ 'id' => $categoryId,
+ 'path' => $category->getPath(),
+ ))
+ );
+ }
+ }
+
+ /**
+ * Category list suggestion based on already entered symbols
+ */
+ public function suggestCategoriesAction()
+ {
+ $this->getResponse()->setBody($this->getLayout()->createBlock('Mage_Adminhtml_Block_Catalog_Category_Tree')
+ ->getSuggestedCategoriesJson($this->getRequest()->getParam('label_part')));
+ }
+
+ /**
+ * Check if admin has permissions to visit related pages
+ *
+ * @return boolean
+ */
+ protected function _isAllowed()
+ {
+ return $this->_objectManager->get('Mage_Core_Model_Authorization')->isAllowed('Mage_Catalog::categories');
+ }
+}
diff --git a/app/code/core/Mage/Adminhtml/controllers/Catalog/Product/Action/AttributeController.php b/app/code/Mage/Adminhtml/controllers/Catalog/Product/Action/AttributeController.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/controllers/Catalog/Product/Action/AttributeController.php
rename to app/code/Mage/Adminhtml/controllers/Catalog/Product/Action/AttributeController.php
diff --git a/app/code/core/Mage/Adminhtml/controllers/Catalog/Product/AttributeController.php b/app/code/Mage/Adminhtml/controllers/Catalog/Product/AttributeController.php
similarity index 97%
rename from app/code/core/Mage/Adminhtml/controllers/Catalog/Product/AttributeController.php
rename to app/code/Mage/Adminhtml/controllers/Catalog/Product/AttributeController.php
index 72790cf7d52c3..317ca5eefae5a 100644
--- a/app/code/core/Mage/Adminhtml/controllers/Catalog/Product/AttributeController.php
+++ b/app/code/Mage/Adminhtml/controllers/Catalog/Product/AttributeController.php
@@ -54,7 +54,6 @@ protected function _initAction()
$this->loadLayout('popup');
} else {
$this->loadLayout()
- ->_setActiveMenu('Mage_Catalog::catalog_attributes')
->_addBreadcrumb(Mage::helper('Mage_Catalog_Helper_Data')->__('Catalog'), Mage::helper('Mage_Catalog_Helper_Data')->__('Catalog'))
->_addBreadcrumb(
Mage::helper('Mage_Catalog_Helper_Data')->__('Manage Product Attributes'),
@@ -68,6 +67,7 @@ public function indexAction()
{
$this->_initAction()
->_addContent($this->getLayout()->createBlock('Mage_Adminhtml_Block_Catalog_Product_Attribute'))
+ ->_setActiveMenu('Mage_Catalog::catalog_attributes_attributes')
->renderLayout();
}
@@ -135,11 +135,10 @@ public function validateAction()
->loadByCode($this->_entityTypeId, $attributeCode);
if ($attribute->getId() && !$attributeId) {
- Mage::getSingleton('Mage_Adminhtml_Model_Session')->addError(
- Mage::helper('Mage_Catalog_Helper_Data')->__('Attribute with the same code already exists'));
- $this->_initLayoutMessages('Mage_Adminhtml_Model_Session');
+ $response->setAttributes(array(
+ 'attribute_code' => Mage::helper('Mage_Catalog_Helper_Data')->__('Attribute with the same code already exists')
+ ));
$response->setError(true);
- $response->setMessage($this->getLayout()->getMessagesBlock()->getGroupedHtml());
}
$this->getResponse()->setBody($response->toJson());
diff --git a/app/code/core/Mage/Adminhtml/controllers/Catalog/Product/DatafeedsController.php b/app/code/Mage/Adminhtml/controllers/Catalog/Product/DatafeedsController.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/controllers/Catalog/Product/DatafeedsController.php
rename to app/code/Mage/Adminhtml/controllers/Catalog/Product/DatafeedsController.php
diff --git a/app/code/core/Mage/Adminhtml/controllers/Catalog/Product/GalleryController.php b/app/code/Mage/Adminhtml/controllers/Catalog/Product/GalleryController.php
similarity index 98%
rename from app/code/core/Mage/Adminhtml/controllers/Catalog/Product/GalleryController.php
rename to app/code/Mage/Adminhtml/controllers/Catalog/Product/GalleryController.php
index ff78cc884d07d..eaf47d29f3b4a 100644
--- a/app/code/core/Mage/Adminhtml/controllers/Catalog/Product/GalleryController.php
+++ b/app/code/Mage/Adminhtml/controllers/Catalog/Product/GalleryController.php
@@ -36,7 +36,7 @@ class Mage_Adminhtml_Catalog_Product_GalleryController extends Mage_Adminhtml_Co
public function uploadAction()
{
try {
- $uploader = Mage::getModel('Mage_Core_Model_File_Uploader', array('image'));
+ $uploader = Mage::getModel('Mage_Core_Model_File_Uploader', array('fileId' => 'image'));
$uploader->setAllowedExtensions(array('jpg','jpeg','gif','png'));
$uploader->addValidateCallback('catalog_product_image',
Mage::helper('Mage_Catalog_Helper_Image'), 'validateUploadFile');
diff --git a/app/code/core/Mage/Adminhtml/controllers/Catalog/Product/GroupController.php b/app/code/Mage/Adminhtml/controllers/Catalog/Product/GroupController.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/controllers/Catalog/Product/GroupController.php
rename to app/code/Mage/Adminhtml/controllers/Catalog/Product/GroupController.php
diff --git a/app/code/Mage/Adminhtml/controllers/Catalog/Product/ReviewController.php b/app/code/Mage/Adminhtml/controllers/Catalog/Product/ReviewController.php
new file mode 100644
index 0000000000000..99ff511ff7516
--- /dev/null
+++ b/app/code/Mage/Adminhtml/controllers/Catalog/Product/ReviewController.php
@@ -0,0 +1,390 @@
+
+ */
+
+class Mage_Adminhtml_Catalog_Product_ReviewController extends Mage_Adminhtml_Controller_Action
+{
+ /**
+ * Array of actions which can be processed without secret key validation
+ *
+ * @var array
+ */
+ protected $_publicActions = array('edit');
+
+ public function indexAction()
+ {
+ $this->_title($this->__('Catalog'))
+ ->_title($this->__('Reviews and Ratings'))
+ ->_title($this->__('Customer Reviews'));
+
+ $this->_title($this->__('All Reviews'));
+
+ if ($this->getRequest()->getParam('ajax')) {
+ return $this->_forward('reviewGrid');
+ }
+
+ $this->loadLayout();
+ $this->_setActiveMenu('Mage_Review::catalog_reviews_ratings_reviews_all');
+
+ $this->_addContent($this->getLayout()->createBlock('Mage_Adminhtml_Block_Review_Main'));
+
+ $this->renderLayout();
+ }
+
+ public function pendingAction()
+ {
+ $this->_title($this->__('Catalog'))
+ ->_title($this->__('Reviews and Ratings'))
+ ->_title($this->__('Customer Reviews'));
+
+ $this->_title($this->__('Pending Reviews'));
+
+ if ($this->getRequest()->getParam('ajax')) {
+ Mage::register('usePendingFilter', true);
+ return $this->_forward('reviewGrid');
+ }
+
+ $this->loadLayout();
+
+ Mage::register('usePendingFilter', true);
+ $this->_addContent($this->getLayout()->createBlock('Mage_Adminhtml_Block_Review_Main'));
+
+ $this->renderLayout();
+ }
+
+ public function editAction()
+ {
+ $this->_title($this->__('Catalog'))
+ ->_title($this->__('Reviews and Ratings'))
+ ->_title($this->__('Customer Reviews'));
+
+ $this->_title($this->__('Edit Review'));
+
+ $this->loadLayout();
+ $this->_setActiveMenu('Mage_Review::catalog_reviews_ratings_reviews_all');
+
+ $this->_addContent($this->getLayout()->createBlock('Mage_Adminhtml_Block_Review_Edit'));
+
+ $this->renderLayout();
+ }
+
+ public function newAction()
+ {
+ $this->_title($this->__('Catalog'))
+ ->_title($this->__('Reviews and Ratings'))
+ ->_title($this->__('Customer Reviews'));
+
+ $this->_title($this->__('New Review'));
+
+ $this->loadLayout();
+ $this->_setActiveMenu('Mage_Review::catalog_reviews_ratings_reviews_all');
+
+ $this->getLayout()->getBlock('head')->setCanLoadExtJs(true);
+
+ $this->_addContent($this->getLayout()->createBlock('Mage_Adminhtml_Block_Review_Add'));
+ $this->_addContent($this->getLayout()->createBlock('Mage_Adminhtml_Block_Review_Product_Grid'));
+
+ $this->renderLayout();
+ }
+
+ public function saveAction()
+ {
+ if (($data = $this->getRequest()->getPost()) && ($reviewId = $this->getRequest()->getParam('id'))) {
+ $review = Mage::getModel('Mage_Review_Model_Review')->load($reviewId);
+ $session = Mage::getSingleton('Mage_Adminhtml_Model_Session');
+ if (! $review->getId()) {
+ $session->addError(Mage::helper('Mage_Catalog_Helper_Data')->__('The review was removed by another user or does not exist.'));
+ } else {
+ try {
+ $review->addData($data)->save();
+
+ $arrRatingId = $this->getRequest()->getParam('ratings', array());
+ $votes = Mage::getModel('Mage_Rating_Model_Rating_Option_Vote')
+ ->getResourceCollection()
+ ->setReviewFilter($reviewId)
+ ->addOptionInfo()
+ ->load()
+ ->addRatingOptions();
+ foreach ($arrRatingId as $ratingId=>$optionId) {
+ if($vote = $votes->getItemByColumnValue('rating_id', $ratingId)) {
+ Mage::getModel('Mage_Rating_Model_Rating')
+ ->setVoteId($vote->getId())
+ ->setReviewId($review->getId())
+ ->updateOptionVote($optionId);
+ } else {
+ Mage::getModel('Mage_Rating_Model_Rating')
+ ->setRatingId($ratingId)
+ ->setReviewId($review->getId())
+ ->addOptionVote($optionId, $review->getEntityPkValue());
+ }
+ }
+
+ $review->aggregate();
+
+ $session->addSuccess(Mage::helper('Mage_Catalog_Helper_Data')->__('The review has been saved.'));
+ } catch (Mage_Core_Exception $e) {
+ $session->addError($e->getMessage());
+ } catch (Exception $e){
+ $session->addException($e, Mage::helper('Mage_Catalog_Helper_Data')->__('An error occurred while saving this review.'));
+ }
+ }
+
+ $nextId = (int) $this->getRequest()->getParam('next_item');
+ $url = $this->getUrl($this->getRequest()->getParam('ret') == 'pending' ? '*/*/pending' : '*/*/');
+ if ($nextId) {
+ $url = $this->getUrl('*/*/edit', array('id' => $nextId));
+ }
+ return $this->getResponse()->setRedirect($url);
+ }
+ $this->_redirect('*/*/');
+ }
+
+ public function deleteAction()
+ {
+ $reviewId = $this->getRequest()->getParam('id', false);
+ $session = Mage::getSingleton('Mage_Adminhtml_Model_Session');
+
+ try {
+ Mage::getModel('Mage_Review_Model_Review')->setId($reviewId)
+ ->aggregate()
+ ->delete();
+
+ $session->addSuccess(Mage::helper('Mage_Catalog_Helper_Data')->__('The review has been deleted'));
+ if( $this->getRequest()->getParam('ret') == 'pending' ) {
+ $this->getResponse()->setRedirect($this->getUrl('*/*/pending'));
+ } else {
+ $this->getResponse()->setRedirect($this->getUrl('*/*/'));
+ }
+ return;
+ } catch (Mage_Core_Exception $e) {
+ $session->addError($e->getMessage());
+ } catch (Exception $e){
+ $session->addException($e, Mage::helper('Mage_Catalog_Helper_Data')->__('An error occurred while deleting this review.'));
+ }
+
+ $this->_redirect('*/*/edit/',array('id'=>$reviewId));
+ }
+
+ public function massDeleteAction()
+ {
+ $reviewsIds = $this->getRequest()->getParam('reviews');
+ $session = Mage::getSingleton('Mage_Adminhtml_Model_Session');
+
+ if(!is_array($reviewsIds)) {
+ $session->addError(Mage::helper('Mage_Adminhtml_Helper_Data')->__('Please select review(s).'));
+ } else {
+ try {
+ foreach ($reviewsIds as $reviewId) {
+ $model = Mage::getModel('Mage_Review_Model_Review')->load($reviewId);
+ $model->delete();
+ }
+ Mage::getSingleton('Mage_Adminhtml_Model_Session')->addSuccess(
+ Mage::helper('Mage_Adminhtml_Helper_Data')->__('Total of %d record(s) have been deleted.', count($reviewsIds))
+ );
+ } catch (Mage_Core_Exception $e) {
+ $session->addError($e->getMessage());
+ } catch (Exception $e){
+ $session->addException($e, Mage::helper('Mage_Adminhtml_Helper_Data')->__('An error occurred while deleting record(s).'));
+ }
+ }
+
+ $this->_redirect('*/*/' . $this->getRequest()->getParam('ret', 'index'));
+ }
+
+ public function massUpdateStatusAction()
+ {
+ $reviewsIds = $this->getRequest()->getParam('reviews');
+ $session = Mage::getSingleton('Mage_Adminhtml_Model_Session');
+
+ if(!is_array($reviewsIds)) {
+ $session->addError(Mage::helper('Mage_Adminhtml_Helper_Data')->__('Please select review(s).'));
+ } else {
+ /* @var $session Mage_Adminhtml_Model_Session */
+ try {
+ $status = $this->getRequest()->getParam('status');
+ foreach ($reviewsIds as $reviewId) {
+ $model = Mage::getModel('Mage_Review_Model_Review')->load($reviewId);
+ $model->setStatusId($status)
+ ->save()
+ ->aggregate();
+ }
+ $session->addSuccess(
+ Mage::helper('Mage_Adminhtml_Helper_Data')->__('Total of %d record(s) have been updated.', count($reviewsIds))
+ );
+ } catch (Mage_Core_Exception $e) {
+ $session->addError($e->getMessage());
+ } catch (Exception $e) {
+ $session->addException($e, Mage::helper('Mage_Adminhtml_Helper_Data')->__('An error occurred while updating the selected review(s).'));
+ }
+ }
+
+ $this->_redirect('*/*/' . $this->getRequest()->getParam('ret', 'index'));
+ }
+
+ public function massVisibleInAction()
+ {
+ $reviewsIds = $this->getRequest()->getParam('reviews');
+ $session = Mage::getSingleton('Mage_Adminhtml_Model_Session');
+
+ if(!is_array($reviewsIds)) {
+ $session->addError(Mage::helper('Mage_Adminhtml_Helper_Data')->__('Please select review(s).'));
+ } else {
+ $session = Mage::getSingleton('Mage_Adminhtml_Model_Session');
+ /* @var $session Mage_Adminhtml_Model_Session */
+ try {
+ $stores = $this->getRequest()->getParam('stores');
+ foreach ($reviewsIds as $reviewId) {
+ $model = Mage::getModel('Mage_Review_Model_Review')->load($reviewId);
+ $model->setSelectStores($stores);
+ $model->save();
+ }
+ $session->addSuccess(
+ Mage::helper('Mage_Adminhtml_Helper_Data')->__('Total of %d record(s) have been updated.', count($reviewsIds))
+ );
+ } catch (Mage_Core_Exception $e) {
+ $session->addError($e->getMessage());
+ } catch (Exception $e) {
+ $session->addException($e, Mage::helper('Mage_Adminhtml_Helper_Data')->__('An error occurred while updating the selected review(s).'));
+ }
+ }
+
+ $this->_redirect('*/*/pending');
+ }
+
+ public function productGridAction()
+ {
+ $this->getResponse()->setBody(
+ $this->getLayout()->createBlock('Mage_Adminhtml_Block_Review_Product_Grid')->toHtml()
+ );
+ }
+
+ public function reviewGridAction()
+ {
+ $this->getResponse()->setBody(
+ $this->getLayout()->createBlock('Mage_Adminhtml_Block_Review_Grid')->toHtml()
+ );
+ }
+
+ public function jsonProductInfoAction()
+ {
+ $response = new Varien_Object();
+ $id = $this->getRequest()->getParam('id');
+ if( intval($id) > 0 ) {
+ $product = Mage::getModel('Mage_Catalog_Model_Product')
+ ->load($id);
+
+ $response->setId($id);
+ $response->addData($product->getData());
+ $response->setError(0);
+ } else {
+ $response->setError(1);
+ $response->setMessage(Mage::helper('Mage_Catalog_Helper_Data')->__('Unable to get the product ID.'));
+ }
+ $this->getResponse()->setBody($response->toJSON());
+ }
+
+ public function postAction()
+ {
+ $productId = $this->getRequest()->getParam('product_id', false);
+ $session = Mage::getSingleton('Mage_Adminhtml_Model_Session');
+
+ if ($data = $this->getRequest()->getPost()) {
+ if (Mage::app()->hasSingleStore()) {
+ $data['stores'] = array(Mage::app()->getStore(true)->getId());
+ } else if (isset($data['select_stores'])) {
+ $data['stores'] = $data['select_stores'];
+ }
+
+ $review = Mage::getModel('Mage_Review_Model_Review')->setData($data);
+
+ $product = Mage::getModel('Mage_Catalog_Model_Product')
+ ->load($productId);
+
+ try {
+ $review->setEntityId(1) // product
+ ->setEntityPkValue($productId)
+ ->setStoreId($product->getStoreId())
+ ->setStatusId($data['status_id'])
+ ->setCustomerId(null)//null is for administrator only
+ ->save();
+
+ $arrRatingId = $this->getRequest()->getParam('ratings', array());
+ foreach ($arrRatingId as $ratingId=>$optionId) {
+ Mage::getModel('Mage_Rating_Model_Rating')
+ ->setRatingId($ratingId)
+ ->setReviewId($review->getId())
+ ->addOptionVote($optionId, $productId);
+ }
+
+ $review->aggregate();
+
+ $session->addSuccess(Mage::helper('Mage_Catalog_Helper_Data')->__('The review has been saved.'));
+ if( $this->getRequest()->getParam('ret') == 'pending' ) {
+ $this->getResponse()->setRedirect($this->getUrl('*/*/pending'));
+ } else {
+ $this->getResponse()->setRedirect($this->getUrl('*/*/'));
+ }
+
+ return;
+ } catch (Mage_Core_Exception $e) {
+ $session->addError($e->getMessage());
+ } catch (Exception $e) {
+ $session->addException($e, Mage::helper('Mage_Adminhtml_Helper_Data')->__('An error occurred while saving review.'));
+ }
+ }
+ $this->getResponse()->setRedirect($this->getUrl('*/*/'));
+ return;
+ }
+
+ public function ratingItemsAction()
+ {
+ $this->getResponse()->setBody(
+ $this->getLayout()
+ ->createBlock('Mage_Adminhtml_Block_Review_Rating_Detailed')
+ ->setIndependentMode()
+ ->toHtml()
+ );
+ }
+
+ protected function _isAllowed()
+ {
+ switch ($this->getRequest()->getActionName()) {
+ case 'pending':
+ return Mage::getSingleton('Mage_Core_Model_Authorization')->isAllowed('Mage_Review::pending');
+ break;
+ default:
+ return Mage::getSingleton('Mage_Core_Model_Authorization')->isAllowed('Mage_Review::reviews_all');
+ break;
+ }
+ }
+}
diff --git a/app/code/core/Mage/Adminhtml/controllers/Catalog/Product/SetController.php b/app/code/Mage/Adminhtml/controllers/Catalog/Product/SetController.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/controllers/Catalog/Product/SetController.php
rename to app/code/Mage/Adminhtml/controllers/Catalog/Product/SetController.php
diff --git a/app/code/Mage/Adminhtml/controllers/Catalog/Product/WidgetController.php b/app/code/Mage/Adminhtml/controllers/Catalog/Product/WidgetController.php
new file mode 100644
index 0000000000000..1cac995c52ebc
--- /dev/null
+++ b/app/code/Mage/Adminhtml/controllers/Catalog/Product/WidgetController.php
@@ -0,0 +1,82 @@
+
+ */
+class Mage_Adminhtml_Catalog_Product_WidgetController extends Mage_Adminhtml_Controller_Action
+{
+ /**
+ * Chooser Source action
+ */
+ public function chooserAction()
+ {
+ $uniqId = $this->getRequest()->getParam('uniq_id');
+ $massAction = $this->getRequest()->getParam('use_massaction', false);
+ $productTypeId = $this->getRequest()->getParam('product_type_id', null);
+
+ $productsGrid = $this->getLayout()->createBlock(
+ 'Mage_Adminhtml_Block_Catalog_Product_Widget_Chooser',
+ '',
+ array(
+ 'data' => array(
+ 'id' => $uniqId,
+ 'use_massaction' => $massAction,
+ 'product_type_id' => $productTypeId,
+ 'category_id' => $this->getRequest()->getParam('category_id')
+ )
+ )
+ );
+
+ $html = $productsGrid->toHtml();
+
+ if (!$this->getRequest()->getParam('products_grid')) {
+ $categoriesTree = $this->getLayout()->createBlock(
+ 'Mage_Adminhtml_Block_Catalog_Category_Widget_Chooser',
+ '',
+ array(
+ 'data' => array(
+ 'id' => $uniqId . 'Tree',
+ 'node_click_listener' => $productsGrid->getCategoryClickListenerJs(),
+ 'with_empty_node' => true
+ )
+ )
+ );
+
+ $html = $this->getLayout()->createBlock('Mage_Adminhtml_Block_Catalog_Product_Widget_Chooser_Container')
+ ->setTreeHtml($categoriesTree->toHtml())
+ ->setGridHtml($html)
+ ->toHtml();
+ }
+
+ $this->getResponse()->setBody($html);
+ }
+}
diff --git a/app/code/Mage/Adminhtml/controllers/Catalog/ProductController.php b/app/code/Mage/Adminhtml/controllers/Catalog/ProductController.php
new file mode 100644
index 0000000000000..d2ef8708c1bfc
--- /dev/null
+++ b/app/code/Mage/Adminhtml/controllers/Catalog/ProductController.php
@@ -0,0 +1,1056 @@
+
+ */
+class Mage_Adminhtml_Catalog_ProductController extends Mage_Adminhtml_Controller_Action
+{
+ /**
+ * The greatest value which could be stored in CatalogInventory Qty field
+ */
+ const MAX_QTY_VALUE = 99999999.9999;
+
+ /**
+ * Array of actions which can be processed without secret key validation
+ *
+ * @var array
+ */
+ protected $_publicActions = array('edit');
+
+ protected function _construct()
+ {
+ // Define module dependent translate
+ $this->setUsedModuleName('Mage_Catalog');
+ }
+
+ /**
+ * Initialize product from request parameters
+ *
+ * @return Mage_Catalog_Model_Product
+ */
+ protected function _initProduct()
+ {
+ $this->_title($this->__('Catalog'))
+ ->_title($this->__('Manage Products'));
+
+ $productId = (int) $this->getRequest()->getParam('id');
+ /** @var $product Mage_Catalog_Model_Product */
+ $product = Mage::getModel('Mage_Catalog_Model_Product')
+ ->setStoreId($this->getRequest()->getParam('store', 0));
+
+ if (!$productId) {
+ if ($typeId = $this->getRequest()->getParam('type')) {
+ $product->setTypeId($typeId);
+ }
+ }
+
+ $product->setData('_edit_mode', true);
+ if ($productId) {
+ try {
+ $product->load($productId);
+ } catch (Exception $e) {
+ $product->setTypeId(Mage_Catalog_Model_Product_Type::DEFAULT_TYPE);
+ Mage::logException($e);
+ }
+ }
+
+ $setId = (int)$this->getRequest()->getParam('set');
+ if ($setId) {
+ $product->setAttributeSetId($setId);
+ }
+
+ if ($this->getRequest()->has('attributes')) {
+ $attributes = $this->getRequest()->getParam('attributes');
+ if (!empty($attributes)) {
+ $product->setTypeId(Mage_Catalog_Model_Product_Type::TYPE_CONFIGURABLE);
+ $this->_objectManager->get('Mage_Catalog_Model_Product_Type_Configurable')->setUsedProductAttributeIds(
+ $attributes,
+ $product
+ );
+ } else {
+ $product->setTypeId(Mage_Catalog_Model_Product_Type::TYPE_SIMPLE);
+ }
+ }
+
+ // Required attributes of simple product for configurable creation
+ if ($this->getRequest()->getParam('popup')
+ && $requiredAttributes = $this->getRequest()->getParam('required')) {
+ $requiredAttributes = explode(",", $requiredAttributes);
+ foreach ($product->getAttributes() as $attribute) {
+ if (in_array($attribute->getId(), $requiredAttributes)) {
+ $attribute->setIsRequired(1);
+ }
+ }
+ }
+
+ if ($this->getRequest()->getParam('popup')
+ && $this->getRequest()->getParam('product')
+ && !is_array($this->getRequest()->getParam('product'))
+ && $this->getRequest()->getParam('id', false) === false) {
+
+ $configProduct = Mage::getModel('Mage_Catalog_Model_Product')
+ ->setStoreId(0)
+ ->load($this->getRequest()->getParam('product'))
+ ->setTypeId($this->getRequest()->getParam('type'));
+
+ /* @var $configProduct Mage_Catalog_Model_Product */
+ $data = array();
+ foreach ($configProduct->getTypeInstance()->getEditableAttributes($configProduct) as $attribute) {
+ /* @var $attribute Mage_Catalog_Model_Resource_Eav_Attribute */
+ if(!$attribute->getIsUnique()
+ && $attribute->getFrontend()->getInputType()!='gallery'
+ && $attribute->getAttributeCode() != 'required_options'
+ && $attribute->getAttributeCode() != 'has_options'
+ && $attribute->getAttributeCode() != $configProduct->getIdFieldName()) {
+ $data[$attribute->getAttributeCode()] = $configProduct->getData($attribute->getAttributeCode());
+ }
+ }
+ $product->addData($data)
+ ->setWebsiteIds($configProduct->getWebsiteIds());
+ }
+
+ Mage::register('product', $product);
+ Mage::register('current_product', $product);
+ Mage::getSingleton('Mage_Cms_Model_Wysiwyg_Config')->setStoreId($this->getRequest()->getParam('store'));
+ return $product;
+ }
+
+ /**
+ * Create serializer block for a grid
+ *
+ * @param string $inputName
+ * @param Mage_Adminhtml_Block_Widget_Grid $gridBlock
+ * @param array $productsArray
+ * @return Mage_Adminhtml_Block_Catalog_Product_Edit_Tab_Ajax_Serializer
+ */
+ protected function _createSerializerBlock($inputName, Mage_Adminhtml_Block_Widget_Grid $gridBlock, $productsArray)
+ {
+ return $this->getLayout()->createBlock('Mage_Adminhtml_Block_Catalog_Product_Edit_Tab_Ajax_Serializer')
+ ->setGridBlock($gridBlock)
+ ->setProducts($productsArray)
+ ->setInputElementName($inputName)
+ ;
+ }
+
+ /**
+ * Output specified blocks as a text list
+ */
+ protected function _outputBlocks()
+ {
+ $blocks = func_get_args();
+ $output = $this->getLayout()->createBlock('Mage_Adminhtml_Block_Text_List');
+ foreach ($blocks as $block) {
+ $output->insert($block, '', true);
+ }
+ $this->getResponse()->setBody($output->toHtml());
+ }
+
+ /**
+ * Product list page
+ */
+ public function indexAction()
+ {
+ $this->_title($this->__('Catalog'))
+ ->_title($this->__('Manage Products'));
+ /** @var $limitation Mage_Catalog_Model_Product_Limitation */
+ $limitation = Mage::getObjectManager()->get('Mage_Catalog_Model_Product_Limitation');
+ if ($limitation->isCreateRestricted()) {
+ $this->_getSession()->addNotice($limitation->getCreateRestrictedMessage());
+ }
+ $this->loadLayout();
+ $this->renderLayout();
+ }
+
+ /**
+ * Create new product page
+ */
+ public function newAction()
+ {
+ if (!$this->getRequest()->getParam('set')) {
+ $this->_forward('noroute');
+ return;
+ }
+ $product = $this->_initProduct();
+
+ $productData = $this->getRequest()->getPost('product');
+ if ($productData) {
+ $this->_filterStockData($productData['stock_data']);
+ $product->addData($productData);
+ }
+
+ $this->_title($this->__('New Product'));
+
+ Mage::dispatchEvent('catalog_product_new_action', array('product' => $product));
+
+ if ($this->getRequest()->getParam('popup')) {
+ $this->loadLayout('popup');
+ } else {
+ $_additionalLayoutPart = '';
+ if ($product->getTypeId() == Mage_Catalog_Model_Product_Type::TYPE_CONFIGURABLE
+ && !($product->getTypeInstance()->getUsedProductAttributeIds($product))
+ ) {
+ $_additionalLayoutPart = '_new';
+ }
+ $this->loadLayout(array(
+ 'default',
+ strtolower($this->getFullActionName()),
+ 'adminhtml_catalog_product_' . $product->getTypeId() . $_additionalLayoutPart
+ ));
+ $this->_setActiveMenu('Mage_Catalog::catalog_products');
+ }
+
+ $this->getLayout()->getBlock('head')->setCanLoadExtJs(false);
+
+ $block = $this->getLayout()->getBlock('catalog.wysiwyg.js');
+ if ($block) {
+ $block->setStoreId($product->getStoreId());
+ }
+
+ $this->renderLayout();
+ }
+
+ /**
+ * Product edit form
+ */
+ public function editAction()
+ {
+ /** @var $limitation Mage_Catalog_Model_Product_Limitation */
+ $limitation = Mage::getObjectManager()->get('Mage_Catalog_Model_Product_Limitation');
+ if ($limitation->isCreateRestricted()) {
+ $this->_getSession()->addNotice($limitation->getCreateRestrictedMessage());
+ }
+
+ $productId = (int) $this->getRequest()->getParam('id');
+ $product = $this->_initProduct();
+
+ if ($productId && !$product->getId()) {
+ $this->_getSession()->addError(Mage::helper('Mage_Catalog_Helper_Data')->__('This product no longer exists.'));
+ $this->_redirect('*/*/');
+ return;
+ }
+
+ $this->_title($product->getName());
+
+ Mage::dispatchEvent('catalog_product_edit_action', array('product' => $product));
+
+ $_additionalLayoutPart = '';
+ if ($product->getTypeId() == Mage_Catalog_Model_Product_Type::TYPE_CONFIGURABLE
+ && !($product->getTypeInstance()->getUsedProductAttributeIds($product))
+ ) {
+ $_additionalLayoutPart = '_new';
+ }
+
+ $this->loadLayout(array(
+ 'default',
+ strtolower($this->getFullActionName()),
+ 'adminhtml_catalog_product_'.$product->getTypeId() . $_additionalLayoutPart
+ ));
+
+ $this->_setActiveMenu('Mage_Catalog::catalog_products');
+
+ if (!Mage::app()->isSingleStoreMode() && ($switchBlock = $this->getLayout()->getBlock('store_switcher'))) {
+ $switchBlock->setDefaultStoreName($this->__('Default Values'))
+ ->setWebsiteIds($product->getWebsiteIds())
+ ->setSwitchUrl(
+ $this->getUrl('*/*/*', array('_current'=>true, 'active_tab'=>null, 'tab' => null, 'store'=>null))
+ );
+ }
+
+ $this->getLayout()->getBlock('head')->setCanLoadExtJs(false);
+
+ $block = $this->getLayout()->getBlock('catalog.wysiwyg.js');
+ if ($block) {
+ $block->setStoreId($product->getStoreId());
+ }
+
+ $this->renderLayout();
+ }
+
+ /**
+ * WYSIWYG editor action for ajax request
+ *
+ */
+ public function wysiwygAction()
+ {
+ $elementId = $this->getRequest()->getParam('element_id', md5(microtime()));
+ $storeId = $this->getRequest()->getParam('store_id', 0);
+ $storeMediaUrl = Mage::app()->getStore($storeId)->getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA);
+
+ $content = $this->getLayout()->createBlock(
+ 'Mage_Adminhtml_Block_Catalog_Helper_Form_Wysiwyg_Content',
+ '',
+ array(
+ 'data' => array(
+ 'editor_element_id' => $elementId,
+ 'store_id' => $storeId,
+ 'store_media_url' => $storeMediaUrl,
+ )
+ )
+ );
+ $this->getResponse()->setBody($content->toHtml());
+ }
+
+ /**
+ * Product grid for AJAX request
+ */
+ public function gridAction()
+ {
+ $this->loadLayout();
+ $this->renderLayout();
+ }
+
+ /**
+ * Get specified tab grid
+ */
+ public function gridOnlyAction()
+ {
+ $this->_initProduct();
+ $this->loadLayout();
+
+ $block = $this->getRequest()->getParam('gridOnlyBlock');
+ $blockClassSuffix = str_replace(' ', '_', ucwords(str_replace('_', ' ', $block)));
+
+ $this->getResponse()->setBody(
+ $this->getLayout()
+ ->createBlock('Mage_Adminhtml_Block_Catalog_Product_Edit_Tab_' . $blockClassSuffix)
+ ->toHtml()
+ );
+ }
+
+ /**
+ * Get variations matrix block
+ *
+ */
+ public function variationsMatrixAction()
+ {
+ $this->_initProductSave($this->_initProduct());
+ $this->loadLayout();
+ $this->renderLayout();
+ }
+
+ /**
+ * Get categories fieldset block
+ *
+ */
+ public function categoriesAction()
+ {
+ $this->_initProduct();
+ $this->loadLayout();
+ $this->renderLayout();
+ }
+
+ /**
+ * Get options fieldset block
+ *
+ */
+ public function optionsAction()
+ {
+ $this->_initProduct();
+ $this->loadLayout();
+ $this->renderLayout();
+ }
+
+ /**
+ * Get related products grid and serializer block
+ */
+ public function relatedAction()
+ {
+ $this->_initProduct();
+ $this->loadLayout();
+ $this->getLayout()->getBlock('catalog.product.edit.tab.related')
+ ->setProductsRelated($this->getRequest()->getPost('products_related', null));
+ $this->renderLayout();
+ }
+
+ /**
+ * Get upsell products grid and serializer block
+ */
+ public function upsellAction()
+ {
+ $this->_initProduct();
+ $this->loadLayout();
+ $this->getLayout()->getBlock('catalog.product.edit.tab.upsell')
+ ->setProductsUpsell($this->getRequest()->getPost('products_upsell', null));
+ $this->renderLayout();
+ }
+
+ /**
+ * Get crosssell products grid and serializer block
+ */
+ public function crosssellAction()
+ {
+ $this->_initProduct();
+ $this->loadLayout();
+ $this->getLayout()->getBlock('catalog.product.edit.tab.crosssell')
+ ->setProductsCrossSell($this->getRequest()->getPost('products_crosssell', null));
+ $this->renderLayout();
+ }
+
+ /**
+ * Get related products grid
+ */
+ public function relatedGridAction()
+ {
+ $this->_initProduct();
+ $this->loadLayout();
+ $this->getLayout()->getBlock('catalog.product.edit.tab.related')
+ ->setProductsRelated($this->getRequest()->getPost('products_related', null));
+ $this->renderLayout();
+ }
+
+ /**
+ * Get upsell products grid
+ */
+ public function upsellGridAction()
+ {
+ $this->_initProduct();
+ $this->loadLayout();
+ $this->getLayout()->getBlock('catalog.product.edit.tab.upsell')
+ ->setProductsRelated($this->getRequest()->getPost('products_upsell', null));
+ $this->renderLayout();
+ }
+
+ /**
+ * Get crosssell products grid
+ */
+ public function crosssellGridAction()
+ {
+ $this->_initProduct();
+ $this->loadLayout();
+ $this->getLayout()->getBlock('catalog.product.edit.tab.crosssell')
+ ->setProductsRelated($this->getRequest()->getPost('products_crosssell', null));
+ $this->renderLayout();
+ }
+
+ /**
+ * Get associated grouped products grid
+ */
+ public function superGroupAction()
+ {
+ $this->loadLayout(false);
+ $this->renderLayout();
+ }
+
+ /**
+ * Get associated grouped products grid popup
+ */
+ public function superGroupPopupAction()
+ {
+ $this->_initProduct();
+ $this->loadLayout(false);
+ $this->renderLayout();
+ }
+
+ /**
+ * Get product reviews grid
+ *
+ */
+ public function reviewsAction()
+ {
+ $this->_initProduct();
+ $this->loadLayout();
+ $this->getLayout()->getBlock('admin.product.reviews')
+ ->setProductId(Mage::registry('product')->getId())
+ ->setUseAjax(true);
+ $this->renderLayout();
+ }
+
+ /**
+ * Get super config grid
+ *
+ */
+ public function superConfigAction()
+ {
+ $this->_initProduct();
+ $this->loadLayout(false);
+ $this->renderLayout();
+ }
+
+ /**
+ * Validate product
+ *
+ */
+ public function validateAction()
+ {
+ $response = new Varien_Object();
+ $response->setError(false);
+
+ try {
+ $productData = $this->getRequest()->getPost('product');
+
+ if ($productData && !isset($productData['stock_data']['use_config_manage_stock'])) {
+ $productData['stock_data']['use_config_manage_stock'] = 0;
+ }
+ /* @var $product Mage_Catalog_Model_Product */
+ $product = Mage::getModel('Mage_Catalog_Model_Product');
+ $product->setData('_edit_mode', true);
+ if ($storeId = $this->getRequest()->getParam('store')) {
+ $product->setStoreId($storeId);
+ }
+ if ($setId = $this->getRequest()->getParam('set')) {
+ $product->setAttributeSetId($setId);
+ }
+ if ($typeId = $this->getRequest()->getParam('type')) {
+ $product->setTypeId($typeId);
+ }
+ if ($productId = $this->getRequest()->getParam('id')) {
+ $product->load($productId);
+ }
+
+ $dateFields = array();
+ $attributes = $product->getAttributes();
+ foreach ($attributes as $attrKey => $attribute) {
+ if ($attribute->getBackend()->getType() == 'datetime') {
+ if (array_key_exists($attrKey, $productData) && $productData[$attrKey] != '') {
+ $dateFields[] = $attrKey;
+ }
+ }
+ }
+ $productData = $this->_filterDates($productData, $dateFields);
+ $product->addData($productData);
+
+ /* set restrictions for date ranges */
+ $resource = $product->getResource();
+ $resource->getAttribute('special_from_date')
+ ->setMaxValue($product->getSpecialToDate());
+ $resource->getAttribute('news_from_date')
+ ->setMaxValue($product->getNewsToDate());
+ $resource->getAttribute('custom_design_from')
+ ->setMaxValue($product->getCustomDesignTo());
+
+ if ($products = $this->getRequest()->getPost('variations-matrix')) {
+ $validationResult = $this->_validateProductVariations($product, $products);
+ if (!empty($validationResult)) {
+ $response->setError(true)
+ ->setMessage(Mage::helper('Mage_Catalog_Helper_Data')->__('Some product variations fields are not valid.'))
+ ->setAttributes($validationResult);
+ }
+ }
+ $product->validate();
+ /**
+ * @todo implement full validation process with errors returning which are ignoring now
+ */
+// if (is_array($errors = $product->validate())) {
+// foreach ($errors as $code => $error) {
+// if ($error === true) {
+// Mage::throwException(Mage::helper('Mage_Catalog_Helper_Data')->__('Attribute "%s" is invalid.', $product->getResource()->getAttribute($code)->getFrontend()->getLabel()));
+// }
+// else {
+// Mage::throwException($error);
+// }
+// }
+// }
+ }
+ catch (Mage_Eav_Model_Entity_Attribute_Exception $e) {
+ $response->setError(true);
+ $response->setAttribute($e->getAttributeCode());
+ $response->setMessage($e->getMessage());
+ } catch (Mage_Core_Exception $e) {
+ $response->setError(true);
+ $response->setMessage($e->getMessage());
+ } catch (Exception $e) {
+ $this->_getSession()->addError($e->getMessage());
+ $this->_initLayoutMessages('Mage_Adminhtml_Model_Session');
+ $response->setError(true);
+ $response->setMessage($this->getLayout()->getMessagesBlock()->getGroupedHtml());
+ }
+
+ $this->getResponse()->setBody($response->toJson());
+ }
+
+ /**
+ * Product variations attributes validation
+ *
+ * @param Mage_Catalog_Model_Product $parentProduct
+ * @param array $products
+ *
+ * @return array
+ */
+ protected function _validateProductVariations($parentProduct, $products)
+ {
+ $validationResult = array();
+ foreach ($products as $productData) {
+ $product = $this->_objectManager->create('Mage_Catalog_Model_Product');
+ $product->setData('_edit_mode', true);
+ if ($storeId = $this->getRequest()->getParam('store')) {
+ $product->setStoreId($storeId);
+ }
+ $product->setAttributeSetId($parentProduct->getAttributeSetId());
+
+ $product->addData($productData);
+ $product->setCollectExceptionMessages(true);
+ $configurableAttribute = Mage::helper('Mage_Core_Helper_Data')
+ ->jsonDecode($productData['configurable_attribute']);
+ $configurableAttribute = implode('-', $configurableAttribute);
+ foreach ($product->validate() as $attributeCode => $result) {
+ if (is_string($result)) {
+ $validationResult['variations-matrix-' . $configurableAttribute . '-' . $attributeCode] = $result;
+ }
+ }
+ }
+
+ return $validationResult;
+ }
+
+ /**
+ * Initialize product before saving
+ *
+ * @param $product Mage_Catalog_Model_Product
+ * @return Mage_Catalog_Model_Product
+ */
+ protected function _initProductSave($product)
+ {
+ $productData = $this->getRequest()->getPost('product');
+ if ($productData) {
+ $this->_filterStockData($productData['stock_data']);
+ }
+
+ /**
+ * Websites
+ */
+ if (!isset($productData['website_ids'])) {
+ $productData['website_ids'] = array();
+ }
+
+ $wasLockedMedia = false;
+ if ($product->isLockedAttribute('media')) {
+ $product->unlockAttribute('media');
+ $wasLockedMedia = true;
+ }
+
+ $product->addData($productData);
+
+ if ($wasLockedMedia) {
+ $product->lockAttribute('media');
+ }
+
+ if (Mage::app()->hasSingleStore()) {
+ $product->setWebsiteIds(array(Mage::app()->getStore(true)->getWebsite()->getId()));
+ }
+
+ /**
+ * Create Permanent Redirect for old URL key
+ */
+ if ($product->getId() && isset($productData['url_key_create_redirect']))
+ // && $product->getOrigData('url_key') != $product->getData('url_key')
+ {
+ $product->setData('save_rewrites_history', (bool)$productData['url_key_create_redirect']);
+ }
+
+ /**
+ * Check "Use Default Value" checkboxes values
+ */
+ if ($useDefaults = $this->getRequest()->getPost('use_default')) {
+ foreach ($useDefaults as $attributeCode) {
+ $product->setData($attributeCode, false);
+ }
+ }
+
+ /**
+ * Init product links data (related, upsell, crosssel)
+ */
+ $links = $this->getRequest()->getPost('links');
+ if (isset($links['related']) && !$product->getRelatedReadonly()) {
+ $product->setRelatedLinkData(
+ Mage::helper('Mage_Adminhtml_Helper_Js')->decodeGridSerializedInput($links['related'])
+ );
+ }
+ if (isset($links['upsell']) && !$product->getUpsellReadonly()) {
+ $product->setUpSellLinkData(
+ Mage::helper('Mage_Adminhtml_Helper_Js')->decodeGridSerializedInput($links['upsell'])
+ );
+ }
+ if (isset($links['crosssell']) && !$product->getCrosssellReadonly()) {
+ $product->setCrossSellLinkData(Mage::helper('Mage_Adminhtml_Helper_Js')
+ ->decodeGridSerializedInput($links['crosssell']));
+ }
+ if (isset($links['grouped']) && !$product->getGroupedReadonly()) {
+ $product->setGroupedLinkData(
+ Mage::helper('Mage_Core_Helper_Data')->jsonDecode($links['grouped'])
+ );
+ }
+
+ /**
+ * Initialize data for configurable product
+ */
+
+ $attributes = $this->getRequest()->getParam('attributes');
+ if (!empty($attributes)) {
+ $this->_objectManager->get('Mage_Catalog_Model_Product_Type_Configurable')->setUsedProductAttributeIds(
+ $attributes,
+ $product
+ );
+
+ $product->setNewVariationsAttributeSetId($this->getRequest()->getPost('new-variations-attribute-set-id'));
+ $associatedProductIds = $this->getRequest()->getPost('associated_product_ids', array());
+ if ($this->getRequest()->getActionName() != 'variationsMatrix') {
+ $generatedProductIds = $this->_objectManager->get('Mage_Catalog_Model_Product_Type_Configurable')
+ ->generateSimpleProducts($product, $this->getRequest()->getPost('variations-matrix', array()));
+ $associatedProductIds = array_merge($associatedProductIds, $generatedProductIds);
+ }
+ $product->setAssociatedProductIds(array_filter($associatedProductIds));
+
+ $product->setCanSaveConfigurableAttributes(
+ (bool)$this->getRequest()->getPost('affect_configurable_product_attributes')
+ );
+ }
+
+ /**
+ * Initialize product options
+ */
+ if (isset($productData['options']) && !$product->getOptionsReadonly()) {
+ $product->setProductOptions($productData['options']);
+ }
+
+ $product->setCanSaveCustomOptions(
+ (bool)$this->getRequest()->getPost('affect_product_custom_options')
+ && !$product->getOptionsReadonly()
+ );
+
+ Mage::dispatchEvent(
+ 'catalog_product_prepare_save',
+ array('product' => $product, 'request' => $this->getRequest())
+ );
+
+ return $product;
+ }
+
+ /**
+ * Filter product stock data
+ *
+ * @param array $stockData
+ */
+ protected function _filterStockData(&$stockData) {
+ if (!isset($stockData['use_config_manage_stock'])) {
+ $stockData['use_config_manage_stock'] = 0;
+ }
+ if (isset($stockData['qty']) && (float)$stockData['qty'] > self::MAX_QTY_VALUE) {
+ $stockData['qty'] = self::MAX_QTY_VALUE;
+ }
+ if (isset($stockData['min_qty']) && (int)$stockData['min_qty'] < 0) {
+ $stockData['min_qty'] = 0;
+ }
+ if (!isset($stockData['is_decimal_divided']) || $stockData['is_qty_decimal'] == 0) {
+ $stockData['is_decimal_divided'] = 0;
+ }
+ }
+
+ /**
+ * Save product action
+ */
+ public function saveAction()
+ {
+ $storeId = $this->getRequest()->getParam('store');
+ $redirectBack = $this->getRequest()->getParam('back', false);
+ $productId = $this->getRequest()->getParam('id');
+ $isEdit = (int)($this->getRequest()->getParam('id') != null);
+
+ $data = $this->getRequest()->getPost();
+ if ($data) {
+ $this->_filterStockData($data['product']['stock_data']);
+
+ $product = $this->_initProductSave($this->_initProduct());
+ Mage::dispatchEvent(
+ 'catalog_product_transition_product_type',
+ array('product' => $product, 'request' => $this->getRequest())
+ );
+
+ try {
+ if (isset($data['product'][$product->getIdFieldName()])) {
+ throw new Mage_Core_Exception($this->__('Unable to save product'));
+ }
+
+ $originalSku = $product->getSku();
+ $product->save();
+ $productId = $product->getId();
+
+ /**
+ * Do copying data to stores
+ */
+ if (isset($data['copy_to_stores'])) {
+ foreach ($data['copy_to_stores'] as $storeTo=>$storeFrom) {
+ Mage::getModel('Mage_Catalog_Model_Product')
+ ->setStoreId($storeFrom)
+ ->load($productId)
+ ->setStoreId($storeTo)
+ ->save();
+ }
+ }
+
+ Mage::getModel('Mage_CatalogRule_Model_Rule')->applyAllRulesToProduct($productId);
+
+ $this->_getSession()->addSuccess($this->__('The product has been saved.'));
+ if ($product->getSku() != $originalSku) {
+ $this->_getSession()->addNotice(
+ $this->__('SKU for product %s has been changed to %s.', Mage::helper('Mage_Core_Helper_Data')
+ ->escapeHtml($product->getName()),
+ Mage::helper('Mage_Core_Helper_Data')->escapeHtml($product->getSku()))
+ );
+ }
+ } catch (Mage_Core_Exception $e) {
+ $this->_getSession()->addError($e->getMessage())
+ ->setProductData($data);
+ $redirectBack = true;
+ } catch (Exception $e) {
+ Mage::logException($e);
+ $this->_getSession()->addError($e->getMessage());
+ $redirectBack = true;
+ }
+ }
+
+ if ($redirectBack === 'new') {
+ $this->_redirect('*/*/new', array(
+ 'set' => $product->getAttributeSetId(),
+ 'type' => $product->getTypeId()
+ ));
+ } elseif ($redirectBack) {
+ $this->_redirect('*/*/edit', array(
+ 'id' => $productId,
+ '_current' => true
+ ));
+ } elseif ($this->getRequest()->getParam('popup')) {
+ $this->_redirect('*/*/created', array(
+ '_current' => true,
+ 'id' => $productId,
+ 'edit' => $isEdit
+ ));
+ } else {
+ $this->_redirect('*/*/', array('store'=>$storeId));
+ }
+ }
+
+ /**
+ * Create product duplicate
+ */
+ public function duplicateAction()
+ {
+ $product = $this->_initProduct();
+ try {
+ $newProduct = $product->duplicate();
+ $this->_getSession()->addSuccess($this->__('The product has been duplicated.'));
+ $this->_redirect('*/*/edit', array('_current'=>true, 'id'=>$newProduct->getId()));
+ } catch (Exception $e) {
+ Mage::logException($e);
+ $this->_getSession()->addError($e->getMessage());
+ $this->_redirect('*/*/edit', array('_current'=>true));
+ }
+ }
+
+ /**
+ * Delete product action
+ */
+ public function deleteAction()
+ {
+ if ($id = $this->getRequest()->getParam('id')) {
+ $product = Mage::getModel('Mage_Catalog_Model_Product')
+ ->load($id);
+ $sku = $product->getSku();
+ try {
+ $product->delete();
+ $this->_getSession()->addSuccess($this->__('The product has been deleted.'));
+ } catch (Exception $e) {
+ $this->_getSession()->addError($e->getMessage());
+ }
+ }
+ $this->getResponse()
+ ->setRedirect($this->getUrl('*/*/', array('store'=>$this->getRequest()->getParam('store'))));
+ }
+
+ /**
+ * Get alerts price grid
+ */
+ public function alertsPriceGridAction()
+ {
+ $this->loadLayout(false);
+ $this->renderLayout();
+ }
+
+ /**
+ * Get alerts stock grid
+ */
+ public function alertsStockGridAction()
+ {
+ $this->loadLayout(false);
+ $this->renderLayout();
+ }
+
+ public function addAttributeAction()
+ {
+ $this->loadLayout('popup');
+ $this->_initProduct();
+ $this->_addContent(
+ $this->getLayout()->createBlock('Mage_Adminhtml_Block_Catalog_Product_Attribute_New_Product_Created')
+ );
+ $this->renderLayout();
+ }
+
+ public function createdAction()
+ {
+ $this->loadLayout('popup');
+ $this->_addContent(
+ $this->getLayout()->createBlock('Mage_Adminhtml_Block_Catalog_Product_Created')
+ );
+ $this->renderLayout();
+ }
+
+ public function massDeleteAction()
+ {
+ $productIds = $this->getRequest()->getParam('product');
+ if (!is_array($productIds)) {
+ $this->_getSession()->addError($this->__('Please select product(s).'));
+ } else {
+ if (!empty($productIds)) {
+ try {
+ foreach ($productIds as $productId) {
+ $product = Mage::getSingleton('Mage_Catalog_Model_Product')->load($productId);
+ $product->delete();
+ }
+ $this->_getSession()->addSuccess(
+ $this->__('Total of %d record(s) have been deleted.', count($productIds))
+ );
+ } catch (Exception $e) {
+ $this->_getSession()->addError($e->getMessage());
+ }
+ }
+ }
+ $this->_redirect('*/*/index');
+ }
+
+ /**
+ * Update product(s) status action
+ *
+ */
+ public function massStatusAction()
+ {
+ $productIds = (array)$this->getRequest()->getParam('product');
+ $storeId = (int)$this->getRequest()->getParam('store', 0);
+ $status = (int)$this->getRequest()->getParam('status');
+
+ try {
+ $this->_validateMassStatus($productIds, $status);
+ Mage::getSingleton('Mage_Catalog_Model_Product_Action')
+ ->updateAttributes($productIds, array('status' => $status), $storeId);
+
+ $this->_getSession()->addSuccess(
+ $this->__('Total of %d record(s) have been updated.', count($productIds))
+ );
+ }
+ catch (Mage_Core_Model_Exception $e) {
+ $this->_getSession()->addError($e->getMessage());
+ } catch (Mage_Core_Exception $e) {
+ $this->_getSession()->addError($e->getMessage());
+ } catch (Exception $e) {
+ $this->_getSession()
+ ->addException($e, $this->__('An error occurred while updating the product(s) status.'));
+ }
+
+ $this->_redirect('*/*/', array('store'=> $storeId));
+ }
+
+ /**
+ * Validate batch of products before theirs status will be set
+ *
+ * @throws Mage_Core_Exception
+ * @param array $productIds
+ * @param int $status
+ * @return void
+ */
+ public function _validateMassStatus(array $productIds, $status)
+ {
+ if ($status == Mage_Catalog_Model_Product_Status::STATUS_ENABLED) {
+ if (!Mage::getModel('Mage_Catalog_Model_Product')->isProductsHasSku($productIds)) {
+ throw new Mage_Core_Exception(
+ $this->__('Some of the processed products have no SKU value defined. Please fill it prior to performing operations on these products.')
+ );
+ }
+ }
+ }
+
+ /**
+ * Check for is allowed
+ *
+ * @return boolean
+ */
+ protected function _isAllowed()
+ {
+ return Mage::getSingleton('Mage_Core_Model_Authorization')->isAllowed('Mage_Catalog::products');
+ }
+
+ /**
+ * Show item update result from updateAction
+ * in Wishlist and Cart controllers.
+ *
+ */
+ public function showUpdateResultAction()
+ {
+ $session = Mage::getSingleton('Mage_Adminhtml_Model_Session');
+ if ($session->hasCompositeProductResult() && $session->getCompositeProductResult() instanceof Varien_Object){
+ /* @var $helper Mage_Adminhtml_Helper_Catalog_Product_Composite */
+ $helper = Mage::helper('Mage_Adminhtml_Helper_Catalog_Product_Composite');
+ $helper->renderUpdateResult($this, $session->getCompositeProductResult());
+ $session->unsCompositeProductResult();
+ } else {
+ $session->unsCompositeProductResult();
+ return false;
+ }
+ }
+
+ /**
+ * Show product grid for custom options import popup
+ */
+ public function optionsImportGridAction()
+ {
+ $this->loadLayout();
+ $this->renderLayout();
+ }
+
+ /**
+ * Show custom options in JSON format for specified products
+ */
+ public function customOptionsAction()
+ {
+ Mage::register('import_option_products', $this->getRequest()->getPost('products'));
+ $this->loadLayout();
+ $this->renderLayout();
+ }
+
+ /**
+ * Action for product template selector
+ */
+ public function suggestProductTemplatesAction()
+ {
+ $this->_initProduct();
+ $this->getResponse()->setBody(Mage::helper('Mage_Core_Helper_Data')->jsonEncode(
+ $this->getLayout()->createBlock('Mage_Catalog_Block_Product_TemplateSelector')
+ ->getSuggestedTemplates($this->getRequest()->getParam('label_part'))
+ ));
+ }
+}
diff --git a/app/code/core/Mage/Adminhtml/controllers/Catalog/SearchController.php b/app/code/Mage/Adminhtml/controllers/Catalog/SearchController.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/controllers/Catalog/SearchController.php
rename to app/code/Mage/Adminhtml/controllers/Catalog/SearchController.php
diff --git a/app/code/core/Mage/Adminhtml/controllers/Checkout/AgreementController.php b/app/code/Mage/Adminhtml/controllers/Checkout/AgreementController.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/controllers/Checkout/AgreementController.php
rename to app/code/Mage/Adminhtml/controllers/Checkout/AgreementController.php
diff --git a/app/code/Mage/Adminhtml/controllers/Cms/Block/WidgetController.php b/app/code/Mage/Adminhtml/controllers/Cms/Block/WidgetController.php
new file mode 100644
index 0000000000000..ce4f074f4e3df
--- /dev/null
+++ b/app/code/Mage/Adminhtml/controllers/Cms/Block/WidgetController.php
@@ -0,0 +1,48 @@
+
+ */
+class Mage_Adminhtml_Cms_Block_WidgetController extends Mage_Adminhtml_Controller_Action
+{
+ /**
+ * Chooser Source action
+ */
+ public function chooserAction()
+ {
+ $uniqId = $this->getRequest()->getParam('uniq_id');
+ $pagesGrid = $this->getLayout()->createBlock('Mage_Adminhtml_Block_Cms_Block_Widget_Chooser', '', array(
+ 'data' => array('id' => $uniqId)
+ ));
+ $this->getResponse()->setBody($pagesGrid->toHtml());
+ }
+}
diff --git a/app/code/core/Mage/Adminhtml/controllers/Cms/BlockController.php b/app/code/Mage/Adminhtml/controllers/Cms/BlockController.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/controllers/Cms/BlockController.php
rename to app/code/Mage/Adminhtml/controllers/Cms/BlockController.php
diff --git a/app/code/Mage/Adminhtml/controllers/Cms/Page/WidgetController.php b/app/code/Mage/Adminhtml/controllers/Cms/Page/WidgetController.php
new file mode 100644
index 0000000000000..403fb9673d6ff
--- /dev/null
+++ b/app/code/Mage/Adminhtml/controllers/Cms/Page/WidgetController.php
@@ -0,0 +1,48 @@
+
+ */
+class Mage_Adminhtml_Cms_Page_WidgetController extends Mage_Adminhtml_Controller_Action
+{
+ /**
+ * Chooser Source action
+ */
+ public function chooserAction()
+ {
+ $uniqId = $this->getRequest()->getParam('uniq_id');
+ $pagesGrid = $this->getLayout()->createBlock('Mage_Adminhtml_Block_Cms_Page_Widget_Chooser', '', array(
+ 'data' => array('id' => $uniqId)
+ ));
+ $this->getResponse()->setBody($pagesGrid->toHtml());
+ }
+}
diff --git a/app/code/core/Mage/Adminhtml/controllers/Cms/PageController.php b/app/code/Mage/Adminhtml/controllers/Cms/PageController.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/controllers/Cms/PageController.php
rename to app/code/Mage/Adminhtml/controllers/Cms/PageController.php
diff --git a/app/code/core/Mage/Adminhtml/controllers/Cms/Wysiwyg/ImagesController.php b/app/code/Mage/Adminhtml/controllers/Cms/Wysiwyg/ImagesController.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/controllers/Cms/Wysiwyg/ImagesController.php
rename to app/code/Mage/Adminhtml/controllers/Cms/Wysiwyg/ImagesController.php
diff --git a/app/code/core/Mage/Adminhtml/controllers/Cms/WysiwygController.php b/app/code/Mage/Adminhtml/controllers/Cms/WysiwygController.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/controllers/Cms/WysiwygController.php
rename to app/code/Mage/Adminhtml/controllers/Cms/WysiwygController.php
diff --git a/app/code/core/Mage/Adminhtml/controllers/Customer/Cart/Product/Composite/CartController.php b/app/code/Mage/Adminhtml/controllers/Customer/Cart/Product/Composite/CartController.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/controllers/Customer/Cart/Product/Composite/CartController.php
rename to app/code/Mage/Adminhtml/controllers/Customer/Cart/Product/Composite/CartController.php
diff --git a/app/code/core/Mage/Adminhtml/controllers/Customer/GroupController.php b/app/code/Mage/Adminhtml/controllers/Customer/GroupController.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/controllers/Customer/GroupController.php
rename to app/code/Mage/Adminhtml/controllers/Customer/GroupController.php
diff --git a/app/code/core/Mage/Adminhtml/controllers/Customer/OnlineController.php b/app/code/Mage/Adminhtml/controllers/Customer/OnlineController.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/controllers/Customer/OnlineController.php
rename to app/code/Mage/Adminhtml/controllers/Customer/OnlineController.php
diff --git a/app/code/core/Mage/Adminhtml/controllers/Customer/System/Config/ValidatevatController.php b/app/code/Mage/Adminhtml/controllers/Customer/System/Config/ValidatevatController.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/controllers/Customer/System/Config/ValidatevatController.php
rename to app/code/Mage/Adminhtml/controllers/Customer/System/Config/ValidatevatController.php
diff --git a/app/code/core/Mage/Adminhtml/controllers/Customer/Wishlist/Product/Composite/WishlistController.php b/app/code/Mage/Adminhtml/controllers/Customer/Wishlist/Product/Composite/WishlistController.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/controllers/Customer/Wishlist/Product/Composite/WishlistController.php
rename to app/code/Mage/Adminhtml/controllers/Customer/Wishlist/Product/Composite/WishlistController.php
diff --git a/app/code/core/Mage/Adminhtml/controllers/CustomerController.php b/app/code/Mage/Adminhtml/controllers/CustomerController.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/controllers/CustomerController.php
rename to app/code/Mage/Adminhtml/controllers/CustomerController.php
diff --git a/app/code/core/Mage/Adminhtml/controllers/DashboardController.php b/app/code/Mage/Adminhtml/controllers/DashboardController.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/controllers/DashboardController.php
rename to app/code/Mage/Adminhtml/controllers/DashboardController.php
diff --git a/app/code/core/Mage/Adminhtml/controllers/IndexController.php b/app/code/Mage/Adminhtml/controllers/IndexController.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/controllers/IndexController.php
rename to app/code/Mage/Adminhtml/controllers/IndexController.php
diff --git a/app/code/core/Mage/Adminhtml/controllers/JsonController.php b/app/code/Mage/Adminhtml/controllers/JsonController.php
similarity index 79%
rename from app/code/core/Mage/Adminhtml/controllers/JsonController.php
rename to app/code/Mage/Adminhtml/controllers/JsonController.php
index 8fbccee99308d..23035c687f497 100644
--- a/app/code/core/Mage/Adminhtml/controllers/JsonController.php
+++ b/app/code/Mage/Adminhtml/controllers/JsonController.php
@@ -43,17 +43,18 @@ public function countryRegionAction()
$arrRes = array();
$countryId = $this->getRequest()->getParam('parent');
- $arrRegions = Mage::getResourceModel('Mage_Directory_Model_Resource_Region_Collection')
- ->addCountryFilter($countryId)
- ->load()
- ->toOptionArray();
+ if (!empty($countryId)) {
+ $arrRegions = Mage::getResourceModel('Mage_Directory_Model_Resource_Region_Collection')
+ ->addCountryFilter($countryId)
+ ->load()
+ ->toOptionArray();
- if (!empty($arrRegions)) {
- foreach ($arrRegions as $region) {
- $arrRes[] = $region;
+ if (!empty($arrRegions)) {
+ foreach ($arrRegions as $region) {
+ $arrRes[] = $region;
+ }
}
}
-
$this->getResponse()->setBody(Mage::helper('Mage_Core_Helper_Data')->jsonEncode($arrRes));
}
}
diff --git a/app/code/core/Mage/Adminhtml/controllers/Newsletter/ProblemController.php b/app/code/Mage/Adminhtml/controllers/Newsletter/ProblemController.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/controllers/Newsletter/ProblemController.php
rename to app/code/Mage/Adminhtml/controllers/Newsletter/ProblemController.php
diff --git a/app/code/core/Mage/Adminhtml/controllers/Newsletter/QueueController.php b/app/code/Mage/Adminhtml/controllers/Newsletter/QueueController.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/controllers/Newsletter/QueueController.php
rename to app/code/Mage/Adminhtml/controllers/Newsletter/QueueController.php
diff --git a/app/code/core/Mage/Adminhtml/controllers/Newsletter/SubscriberController.php b/app/code/Mage/Adminhtml/controllers/Newsletter/SubscriberController.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/controllers/Newsletter/SubscriberController.php
rename to app/code/Mage/Adminhtml/controllers/Newsletter/SubscriberController.php
diff --git a/app/code/core/Mage/Adminhtml/controllers/Newsletter/TemplateController.php b/app/code/Mage/Adminhtml/controllers/Newsletter/TemplateController.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/controllers/Newsletter/TemplateController.php
rename to app/code/Mage/Adminhtml/controllers/Newsletter/TemplateController.php
diff --git a/app/code/core/Mage/Adminhtml/controllers/NotificationController.php b/app/code/Mage/Adminhtml/controllers/NotificationController.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/controllers/NotificationController.php
rename to app/code/Mage/Adminhtml/controllers/NotificationController.php
diff --git a/app/code/core/Mage/Adminhtml/controllers/Poll/AnswerController.php b/app/code/Mage/Adminhtml/controllers/Poll/AnswerController.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/controllers/Poll/AnswerController.php
rename to app/code/Mage/Adminhtml/controllers/Poll/AnswerController.php
diff --git a/app/code/core/Mage/Adminhtml/controllers/PollController.php b/app/code/Mage/Adminhtml/controllers/PollController.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/controllers/PollController.php
rename to app/code/Mage/Adminhtml/controllers/PollController.php
diff --git a/app/code/core/Mage/Adminhtml/controllers/Promo/CatalogController.php b/app/code/Mage/Adminhtml/controllers/Promo/CatalogController.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/controllers/Promo/CatalogController.php
rename to app/code/Mage/Adminhtml/controllers/Promo/CatalogController.php
diff --git a/app/code/core/Mage/Adminhtml/controllers/Promo/QuoteController.php b/app/code/Mage/Adminhtml/controllers/Promo/QuoteController.php
similarity index 99%
rename from app/code/core/Mage/Adminhtml/controllers/Promo/QuoteController.php
rename to app/code/Mage/Adminhtml/controllers/Promo/QuoteController.php
index 21133f219ec5b..334ce0ed74751 100644
--- a/app/code/core/Mage/Adminhtml/controllers/Promo/QuoteController.php
+++ b/app/code/Mage/Adminhtml/controllers/Promo/QuoteController.php
@@ -400,7 +400,7 @@ public function chooserAction()
{
$uniqId = $this->getRequest()->getParam('uniq_id');
$chooserBlock = $this->getLayout()->createBlock('Mage_Adminhtml_Block_Promo_Widget_Chooser', '', array(
- 'id' => $uniqId
+ 'data' => array('id' => $uniqId)
));
$this->getResponse()->setBody($chooserBlock->toHtml());
}
diff --git a/app/code/Mage/Adminhtml/controllers/Promo/WidgetController.php b/app/code/Mage/Adminhtml/controllers/Promo/WidgetController.php
new file mode 100644
index 0000000000000..a133e666794fa
--- /dev/null
+++ b/app/code/Mage/Adminhtml/controllers/Promo/WidgetController.php
@@ -0,0 +1,133 @@
+getRequest();
+
+ switch ($request->getParam('attribute')) {
+ case 'sku':
+ $block = $this->getLayout()->createBlock(
+ 'Mage_Adminhtml_Block_Promo_Widget_Chooser_Sku', 'promo_widget_chooser_sku',
+ array('data' => array('js_form_object' => $request->getParam('form')),
+ ));
+ break;
+
+ case 'category_ids':
+ $ids = $request->getParam('selected', array());
+ if (is_array($ids)) {
+ foreach ($ids as $key => &$id) {
+ $id = (int) $id;
+ if ($id <= 0) {
+ unset($ids[$key]);
+ }
+ }
+
+ $ids = array_unique($ids);
+ } else {
+ $ids = array();
+ }
+
+
+ $block = $this->getLayout()->createBlock(
+ 'Mage_Adminhtml_Block_Catalog_Category_Checkboxes_Tree', 'promo_widget_chooser_category_ids',
+ array('data' => array('js_form_object' => $request->getParam('form')))
+ )
+ ->setCategoryIds($ids)
+ ;
+ break;
+
+ default:
+ $block = false;
+ break;
+ }
+
+ if ($block) {
+ $this->getResponse()->setBody($block->toHtml());
+ }
+ }
+
+ protected function _isAllowed()
+ {
+ return Mage::getSingleton('Mage_Core_Model_Authorization')->isAllowed('Mage_CatalogRule::promo_catalog');
+ }
+
+ /**
+ * Get tree node (Ajax version)
+ */
+ public function categoriesJsonAction()
+ {
+ if ($categoryId = (int) $this->getRequest()->getPost('id')) {
+ $this->getRequest()->setParam('id', $categoryId);
+
+ if (!$category = $this->_initCategory()) {
+ return;
+ }
+ $this->getResponse()->setBody(
+ $this->getLayout()->createBlock('Mage_Adminhtml_Block_Catalog_Category_Tree')
+ ->getTreeJson($category)
+ );
+ }
+ }
+
+ /**
+ * Initialize category object in registry
+ *
+ * @return Mage_Catalog_Model_Category
+ */
+ protected function _initCategory()
+ {
+ $categoryId = (int) $this->getRequest()->getParam('id',false);
+ $storeId = (int) $this->getRequest()->getParam('store');
+
+ $category = Mage::getModel('Mage_Catalog_Model_Category');
+ $category->setStoreId($storeId);
+
+ if ($categoryId) {
+ $category->load($categoryId);
+ if ($storeId) {
+ $rootId = Mage::app()->getStore($storeId)->getRootCategoryId();
+ if (!in_array($rootId, $category->getPathIds())) {
+ $this->_redirect('*/*/', array('_current'=>true, 'id'=>null));
+ return false;
+ }
+ }
+ }
+
+ Mage::register('category', $category);
+ Mage::register('current_category', $category);
+
+ return $category;
+ }
+}
diff --git a/app/code/core/Mage/Adminhtml/controllers/PromoController.php b/app/code/Mage/Adminhtml/controllers/PromoController.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/controllers/PromoController.php
rename to app/code/Mage/Adminhtml/controllers/PromoController.php
diff --git a/app/code/core/Mage/Adminhtml/controllers/RatingController.php b/app/code/Mage/Adminhtml/controllers/RatingController.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/controllers/RatingController.php
rename to app/code/Mage/Adminhtml/controllers/RatingController.php
diff --git a/app/code/core/Mage/Adminhtml/controllers/Report/CustomerController.php b/app/code/Mage/Adminhtml/controllers/Report/CustomerController.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/controllers/Report/CustomerController.php
rename to app/code/Mage/Adminhtml/controllers/Report/CustomerController.php
diff --git a/app/code/core/Mage/Adminhtml/controllers/Report/ProductController.php b/app/code/Mage/Adminhtml/controllers/Report/ProductController.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/controllers/Report/ProductController.php
rename to app/code/Mage/Adminhtml/controllers/Report/ProductController.php
diff --git a/app/code/Mage/Adminhtml/controllers/Report/ReviewController.php b/app/code/Mage/Adminhtml/controllers/Report/ReviewController.php
new file mode 100644
index 0000000000000..d3126c33c9e2b
--- /dev/null
+++ b/app/code/Mage/Adminhtml/controllers/Report/ReviewController.php
@@ -0,0 +1,178 @@
+
+ */
+class Mage_Adminhtml_Report_ReviewController extends Mage_Adminhtml_Controller_Action
+{
+ public function _initAction()
+ {
+ $this->loadLayout()
+ ->_addBreadcrumb(
+ Mage::helper('Mage_Reports_Helper_Data')->__('Reports'),
+ Mage::helper('Mage_Reports_Helper_Data')->__('Reports')
+ )
+ ->_addBreadcrumb(
+ Mage::helper('Mage_Reports_Helper_Data')->__('Review'),
+ Mage::helper('Mage_Reports_Helper_Data')->__('Reviews')
+ );
+ return $this;
+ }
+
+ public function customerAction()
+ {
+ $this->_title($this->__('Reports'))
+ ->_title($this->__('Reviews'))
+ ->_title($this->__('Customers Reviews'));
+
+ $this->_initAction()
+ ->_setActiveMenu('Mage_Review::report_review_customer')
+ ->_addBreadcrumb(
+ Mage::helper('Mage_Reports_Helper_Data')->__('Customers Report'),
+ Mage::helper('Mage_Reports_Helper_Data')->__('Customers Report')
+ );
+ $this->renderLayout();
+ }
+
+ /**
+ * Export review customer report to CSV format
+ */
+ public function exportCustomerCsvAction()
+ {
+ $this->loadLayout(false);
+ $fileName = 'review_customer.csv';
+ $exportBlock = $this->getLayout()->getChildBlock('adminhtml.block.report.review.customer.grid','grid.export');
+ $this->_prepareDownloadResponse($fileName, $exportBlock->getCsvFile());
+ }
+
+ /**
+ * Export review customer report to Excel XML format
+ */
+ public function exportCustomerExcelAction()
+ {
+ $this->loadLayout(false);
+ $fileName = 'review_customer.xml';
+ $exportBlock = $this->getLayout()->getChildBlock('adminhtml.block.report.review.customer.grid','grid.export');
+ $this->_prepareDownloadResponse($fileName, $exportBlock->getExcelFile());
+
+ }
+
+ public function productAction()
+ {
+ $this->_title($this->__('Reports'))
+ ->_title($this->__('Reviews'))
+ ->_title($this->__('Products Reviews'));
+
+ $this->_initAction()
+ ->_setActiveMenu('Mage_Review::report_review_product')
+ ->_addBreadcrumb(
+ Mage::helper('Mage_Reports_Helper_Data')->__('Products Report'),
+ Mage::helper('Mage_Reports_Helper_Data')->__('Products Report')
+ );
+ $this->renderLayout();
+ }
+
+ /**
+ * Export review product report to CSV format
+ */
+ public function exportProductCsvAction()
+ {
+ $this->loadLayout(false);
+ $fileName = 'review_product.csv';
+ $exportBlock = $this->getLayout()->getChildBlock('adminhtml.block.report.review.product.grid','grid.export');
+ $this->_prepareDownloadResponse($fileName, $exportBlock->getCsvFile());
+ }
+
+ /**
+ * Export review product report to Excel XML format
+ */
+ public function exportProductExcelAction()
+ {
+ $this->loadLayout(false);
+ $fileName = 'review_product.xml';
+ $exportBlock = $this->getLayout()->getChildBlock('adminhtml.block.report.review.product.grid','grid.export');
+ $this->_prepareDownloadResponse($fileName, $exportBlock->getExcelFile());
+ }
+
+ public function productDetailAction()
+ {
+ $this->_title($this->__('Reports'))
+ ->_title($this->__('Reviews'))
+ ->_title($this->__('Product Reviews'))
+ ->_title($this->__('Details'));
+
+ $this->_initAction()
+ ->_setActiveMenu('Mage_Review::report_review')
+ ->_addBreadcrumb(Mage::helper('Mage_Reports_Helper_Data')->__('Products Report'), Mage::helper('Mage_Reports_Helper_Data')->__('Products Report'))
+ ->_addBreadcrumb(Mage::helper('Mage_Reports_Helper_Data')->__('Product Reviews'), Mage::helper('Mage_Reports_Helper_Data')->__('Product Reviews'))
+ ->_addContent($this->getLayout()->createBlock('Mage_Adminhtml_Block_Report_Review_Detail'))
+ ->renderLayout();
+ }
+
+ /**
+ * Export review product detail report to CSV format
+ */
+ public function exportProductDetailCsvAction()
+ {
+ $fileName = 'review_product_detail.csv';
+ $content = $this->getLayout()->createBlock('Mage_Adminhtml_Block_Report_Review_Detail_Grid')
+ ->getCsv();
+
+ $this->_prepareDownloadResponse($fileName, $content);
+ }
+
+ /**
+ * Export review product detail report to ExcelXML format
+ */
+ public function exportProductDetailExcelAction()
+ {
+ $fileName = 'review_product_detail.xml';
+ $content = $this->getLayout()->createBlock('Mage_Adminhtml_Block_Report_Review_Detail_Grid')
+ ->getExcel($fileName);
+
+ $this->_prepareDownloadResponse($fileName, $content);
+ }
+
+ protected function _isAllowed()
+ {
+ switch ($this->getRequest()->getActionName()) {
+ case 'customer':
+ return Mage::getSingleton('Mage_Core_Model_Authorization')->isAllowed('Mage_Reports::review_customer');
+ break;
+ case 'product':
+ return Mage::getSingleton('Mage_Core_Model_Authorization')->isAllowed('Mage_Reports::review_product');
+ break;
+ default:
+ return Mage::getSingleton('Mage_Core_Model_Authorization')->isAllowed('Mage_Reports::review');
+ break;
+ }
+ }
+}
diff --git a/app/code/core/Mage/Adminhtml/controllers/Report/SalesController.php b/app/code/Mage/Adminhtml/controllers/Report/SalesController.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/controllers/Report/SalesController.php
rename to app/code/Mage/Adminhtml/controllers/Report/SalesController.php
diff --git a/app/code/core/Mage/Adminhtml/controllers/Report/ShopcartController.php b/app/code/Mage/Adminhtml/controllers/Report/ShopcartController.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/controllers/Report/ShopcartController.php
rename to app/code/Mage/Adminhtml/controllers/Report/ShopcartController.php
diff --git a/app/code/core/Mage/Adminhtml/controllers/Report/StatisticsController.php b/app/code/Mage/Adminhtml/controllers/Report/StatisticsController.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/controllers/Report/StatisticsController.php
rename to app/code/Mage/Adminhtml/controllers/Report/StatisticsController.php
diff --git a/app/code/core/Mage/Adminhtml/controllers/ReportController.php b/app/code/Mage/Adminhtml/controllers/ReportController.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/controllers/ReportController.php
rename to app/code/Mage/Adminhtml/controllers/ReportController.php
diff --git a/app/code/core/Mage/Adminhtml/controllers/Sales/Billing/AgreementController.php b/app/code/Mage/Adminhtml/controllers/Sales/Billing/AgreementController.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/controllers/Sales/Billing/AgreementController.php
rename to app/code/Mage/Adminhtml/controllers/Sales/Billing/AgreementController.php
diff --git a/app/code/core/Mage/Adminhtml/controllers/Sales/CreditmemoController.php b/app/code/Mage/Adminhtml/controllers/Sales/CreditmemoController.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/controllers/Sales/CreditmemoController.php
rename to app/code/Mage/Adminhtml/controllers/Sales/CreditmemoController.php
diff --git a/app/code/core/Mage/Adminhtml/controllers/Sales/InvoiceController.php b/app/code/Mage/Adminhtml/controllers/Sales/InvoiceController.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/controllers/Sales/InvoiceController.php
rename to app/code/Mage/Adminhtml/controllers/Sales/InvoiceController.php
diff --git a/app/code/core/Mage/Adminhtml/controllers/Sales/Order/CreateController.php b/app/code/Mage/Adminhtml/controllers/Sales/Order/CreateController.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/controllers/Sales/Order/CreateController.php
rename to app/code/Mage/Adminhtml/controllers/Sales/Order/CreateController.php
diff --git a/app/code/core/Mage/Adminhtml/controllers/Sales/Order/CreditmemoController.php b/app/code/Mage/Adminhtml/controllers/Sales/Order/CreditmemoController.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/controllers/Sales/Order/CreditmemoController.php
rename to app/code/Mage/Adminhtml/controllers/Sales/Order/CreditmemoController.php
diff --git a/app/code/core/Mage/Adminhtml/controllers/Sales/Order/EditController.php b/app/code/Mage/Adminhtml/controllers/Sales/Order/EditController.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/controllers/Sales/Order/EditController.php
rename to app/code/Mage/Adminhtml/controllers/Sales/Order/EditController.php
diff --git a/app/code/core/Mage/Adminhtml/controllers/Sales/Order/InvoiceController.php b/app/code/Mage/Adminhtml/controllers/Sales/Order/InvoiceController.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/controllers/Sales/Order/InvoiceController.php
rename to app/code/Mage/Adminhtml/controllers/Sales/Order/InvoiceController.php
diff --git a/app/code/core/Mage/Adminhtml/controllers/Sales/Order/ShipmentController.php b/app/code/Mage/Adminhtml/controllers/Sales/Order/ShipmentController.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/controllers/Sales/Order/ShipmentController.php
rename to app/code/Mage/Adminhtml/controllers/Sales/Order/ShipmentController.php
diff --git a/app/code/core/Mage/Adminhtml/controllers/Sales/Order/StatusController.php b/app/code/Mage/Adminhtml/controllers/Sales/Order/StatusController.php
similarity index 98%
rename from app/code/core/Mage/Adminhtml/controllers/Sales/Order/StatusController.php
rename to app/code/Mage/Adminhtml/controllers/Sales/Order/StatusController.php
index b245ee796d17d..93faeb299e17a 100644
--- a/app/code/core/Mage/Adminhtml/controllers/Sales/Order/StatusController.php
+++ b/app/code/Mage/Adminhtml/controllers/Sales/Order/StatusController.php
@@ -64,7 +64,7 @@ protected function _initStatus()
public function indexAction()
{
$this->_title($this->__('Sales'))->_title($this->__('Order Statuses'));
- $this->loadLayout()->_setActiveMenu('Mage_Adminhtml::system')->renderLayout();
+ $this->loadLayout()->_setActiveMenu('Mage_Sales::system_order_statuses')->renderLayout();
}
/**
diff --git a/app/code/core/Mage/Adminhtml/controllers/Sales/Order/View/GiftmessageController.php b/app/code/Mage/Adminhtml/controllers/Sales/Order/View/GiftmessageController.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/controllers/Sales/Order/View/GiftmessageController.php
rename to app/code/Mage/Adminhtml/controllers/Sales/Order/View/GiftmessageController.php
diff --git a/app/code/core/Mage/Adminhtml/controllers/Sales/OrderController.php b/app/code/Mage/Adminhtml/controllers/Sales/OrderController.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/controllers/Sales/OrderController.php
rename to app/code/Mage/Adminhtml/controllers/Sales/OrderController.php
diff --git a/app/code/core/Mage/Adminhtml/controllers/Sales/Recurring/ProfileController.php b/app/code/Mage/Adminhtml/controllers/Sales/Recurring/ProfileController.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/controllers/Sales/Recurring/ProfileController.php
rename to app/code/Mage/Adminhtml/controllers/Sales/Recurring/ProfileController.php
diff --git a/app/code/core/Mage/Adminhtml/controllers/Sales/ShipmentController.php b/app/code/Mage/Adminhtml/controllers/Sales/ShipmentController.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/controllers/Sales/ShipmentController.php
rename to app/code/Mage/Adminhtml/controllers/Sales/ShipmentController.php
diff --git a/app/code/core/Mage/Adminhtml/controllers/Sales/TransactionsController.php b/app/code/Mage/Adminhtml/controllers/Sales/TransactionsController.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/controllers/Sales/TransactionsController.php
rename to app/code/Mage/Adminhtml/controllers/Sales/TransactionsController.php
diff --git a/app/code/core/Mage/Adminhtml/controllers/SitemapController.php b/app/code/Mage/Adminhtml/controllers/SitemapController.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/controllers/SitemapController.php
rename to app/code/Mage/Adminhtml/controllers/SitemapController.php
diff --git a/app/code/core/Mage/Adminhtml/controllers/SurveyController.php b/app/code/Mage/Adminhtml/controllers/SurveyController.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/controllers/SurveyController.php
rename to app/code/Mage/Adminhtml/controllers/SurveyController.php
diff --git a/app/code/Mage/Adminhtml/controllers/System/AccountController.php b/app/code/Mage/Adminhtml/controllers/System/AccountController.php
new file mode 100644
index 0000000000000..56229b02dfd0e
--- /dev/null
+++ b/app/code/Mage/Adminhtml/controllers/System/AccountController.php
@@ -0,0 +1,90 @@
+
+ */
+
+class Mage_Adminhtml_System_AccountController extends Mage_Adminhtml_Controller_Action
+{
+ public function indexAction()
+ {
+ $this->_title($this->__('System'))->_title($this->__('My Account'));
+
+ $this->loadLayout();
+ $this->_addContent($this->getLayout()->createBlock('Mage_Adminhtml_Block_System_Account_Edit'));
+ $this->renderLayout();
+ }
+
+ /**
+ * Saving edited user information
+ */
+ public function saveAction()
+ {
+ $userId = Mage::getSingleton('Mage_Backend_Model_Auth_Session')->getUser()->getId();
+ $password = (string)$this->getRequest()->getParam('password');
+ $passwordConfirmation = (string)$this->getRequest()->getParam('password_confirmation');
+
+ /** @var $user Mage_User_Model_User */
+ $user = Mage::getModel('Mage_User_Model_User')->load($userId);
+
+ $user->setId($userId)
+ ->setUsername($this->getRequest()->getParam('username', false))
+ ->setFirstname($this->getRequest()->getParam('firstname', false))
+ ->setLastname($this->getRequest()->getParam('lastname', false))
+ ->setEmail(strtolower($this->getRequest()->getParam('email', false)));
+
+ if ($password !== '') {
+ $user->setPassword($password);
+ }
+ if ($passwordConfirmation !== '') {
+ $user->setPasswordConfirmation($passwordConfirmation);
+ }
+
+ try {
+ $user->save();
+ $this->_getSession()->addSuccess(
+ Mage::helper('Mage_Adminhtml_Helper_Data')->__('The account has been saved.')
+ );
+ } catch (Mage_Core_Exception $e) {
+ $this->_getSession()->addMessages($e->getMessages());
+ } catch (Exception $e) {
+ $this->_getSession()->addError(
+ Mage::helper('Mage_Adminhtml_Helper_Data')->__('An error occurred while saving account.')
+ );
+ }
+ $this->getResponse()->setRedirect($this->getUrl("*/*/"));
+ }
+
+ protected function _isAllowed()
+ {
+ return Mage::getSingleton('Mage_Core_Model_Authorization')->isAllowed('Mage_Adminhtml::myaccount');
+ }
+}
diff --git a/app/code/core/Mage/Adminhtml/controllers/System/BackupController.php b/app/code/Mage/Adminhtml/controllers/System/BackupController.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/controllers/System/BackupController.php
rename to app/code/Mage/Adminhtml/controllers/System/BackupController.php
diff --git a/app/code/core/Mage/Adminhtml/controllers/System/Config/System/StorageController.php b/app/code/Mage/Adminhtml/controllers/System/Config/System/StorageController.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/controllers/System/Config/System/StorageController.php
rename to app/code/Mage/Adminhtml/controllers/System/Config/System/StorageController.php
diff --git a/app/code/core/Mage/Adminhtml/controllers/System/CurrencyController.php b/app/code/Mage/Adminhtml/controllers/System/CurrencyController.php
similarity index 98%
rename from app/code/core/Mage/Adminhtml/controllers/System/CurrencyController.php
rename to app/code/Mage/Adminhtml/controllers/System/CurrencyController.php
index 21f839006529d..09849fa50d0bf 100644
--- a/app/code/core/Mage/Adminhtml/controllers/System/CurrencyController.php
+++ b/app/code/Mage/Adminhtml/controllers/System/CurrencyController.php
@@ -56,7 +56,7 @@ public function indexAction()
$this->_title($this->__('System'))->_title($this->__('Manage Currency Rates'));
$this->loadLayout();
- $this->_setActiveMenu('Mage_Adminhtml::system_currency');
+ $this->_setActiveMenu('Mage_CurrencySymbol::system_currency_rates');
$this->_addContent($this->getLayout()->createBlock('Mage_Adminhtml_Block_System_Currency'));
$this->renderLayout();
}
diff --git a/app/code/core/Mage/Adminhtml/controllers/System/DesignController.php b/app/code/Mage/Adminhtml/controllers/System/DesignController.php
similarity index 98%
rename from app/code/core/Mage/Adminhtml/controllers/System/DesignController.php
rename to app/code/Mage/Adminhtml/controllers/System/DesignController.php
index b75c9819f5450..0e4646481232d 100644
--- a/app/code/core/Mage/Adminhtml/controllers/System/DesignController.php
+++ b/app/code/Mage/Adminhtml/controllers/System/DesignController.php
@@ -31,7 +31,7 @@ public function indexAction()
{
$this->_title($this->__('System'))->_title($this->__('Design'));
$this->loadLayout();
- $this->_setActiveMenu('Mage_Adminhtml::system');
+ $this->_setActiveMenu('Mage_Adminhtml::system_design_schedule');
$this->renderLayout();
}
diff --git a/app/code/core/Mage/Adminhtml/controllers/System/Email/TemplateController.php b/app/code/Mage/Adminhtml/controllers/System/Email/TemplateController.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/controllers/System/Email/TemplateController.php
rename to app/code/Mage/Adminhtml/controllers/System/Email/TemplateController.php
diff --git a/app/code/core/Mage/Adminhtml/controllers/System/StoreController.php b/app/code/Mage/Adminhtml/controllers/System/StoreController.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/controllers/System/StoreController.php
rename to app/code/Mage/Adminhtml/controllers/System/StoreController.php
diff --git a/app/code/core/Mage/Adminhtml/controllers/System/VariableController.php b/app/code/Mage/Adminhtml/controllers/System/VariableController.php
similarity index 98%
rename from app/code/core/Mage/Adminhtml/controllers/System/VariableController.php
rename to app/code/Mage/Adminhtml/controllers/System/VariableController.php
index 3ce338cfdd689..1ca3b49513fb4 100644
--- a/app/code/core/Mage/Adminhtml/controllers/System/VariableController.php
+++ b/app/code/Mage/Adminhtml/controllers/System/VariableController.php
@@ -101,7 +101,7 @@ public function editAction()
$this->_initLayout()
->_addContent($this->getLayout()->createBlock('Mage_Adminhtml_Block_System_Variable_Edit'))
->_addJs($this->getLayout()->createBlock('Mage_Core_Block_Template', '', array(
- 'template' => 'Mage_Adminhtml::system/variable/js.phtml'
+ 'data' => array('template' => 'Mage_Adminhtml::system/variable/js.phtml')
)))
->renderLayout();
}
diff --git a/app/code/core/Mage/Adminhtml/controllers/Tax/ClassController.php b/app/code/Mage/Adminhtml/controllers/Tax/ClassController.php
similarity index 97%
rename from app/code/core/Mage/Adminhtml/controllers/Tax/ClassController.php
rename to app/code/Mage/Adminhtml/controllers/Tax/ClassController.php
index 68cade209c47a..029ed6b44f114 100644
--- a/app/code/core/Mage/Adminhtml/controllers/Tax/ClassController.php
+++ b/app/code/Mage/Adminhtml/controllers/Tax/ClassController.php
@@ -50,7 +50,6 @@ public function ajaxSaveAction()
->save();
$responseContent = Mage::helper('Mage_Core_Helper_Data')->jsonEncode(array(
'success' => true,
- 'error' => false,
'error_message' => '',
'class_id' => $class->getId(),
'class_name' => $class->getClassName()
@@ -58,7 +57,6 @@ public function ajaxSaveAction()
} catch (Mage_Core_Exception $e) {
$responseContent = Mage::helper('Mage_Core_Helper_Data')->jsonEncode(array(
'success' => false,
- 'error' => true,
'error_message' => $e->getMessage(),
'class_id' => '',
'class_name' => ''
@@ -66,7 +64,6 @@ public function ajaxSaveAction()
} catch (Exception $e) {
$responseContent = Mage::helper('Mage_Core_Helper_Data')->jsonEncode(array(
'success' => false,
- 'error' => true,
'error_message' => Mage::helper('Mage_Tax_Helper_Data') ->__('There was an error saving tax class.'),
'class_id' => '',
'class_name' => ''
@@ -88,19 +85,16 @@ public function ajaxDeleteAction()
$classModel->delete();
$responseContent = Mage::helper('Mage_Core_Helper_Data')->jsonEncode(array(
'success' => true,
- 'error' => false,
'error_message' => ''
));
} catch (Mage_Core_Exception $e) {
$responseContent = Mage::helper('Mage_Core_Helper_Data')->jsonEncode(array(
'success' => false,
- 'error' => true,
'error_message' => $e->getMessage()
));
} catch (Exception $e) {
$responseContent = Mage::helper('Mage_Core_Helper_Data')->jsonEncode(array(
'success' => false,
- 'error' => true,
'error_message' => Mage::helper('Mage_Tax_Helper_Data')->__('An error occurred while deleting this tax class.')
));
}
diff --git a/app/code/core/Mage/Adminhtml/controllers/Tax/RateController.php b/app/code/Mage/Adminhtml/controllers/Tax/RateController.php
similarity index 77%
rename from app/code/core/Mage/Adminhtml/controllers/Tax/RateController.php
rename to app/code/Mage/Adminhtml/controllers/Tax/RateController.php
index 516b781a255c5..b12790dd8f396 100644
--- a/app/code/core/Mage/Adminhtml/controllers/Tax/RateController.php
+++ b/app/code/Mage/Adminhtml/controllers/Tax/RateController.php
@@ -134,7 +134,6 @@ public function ajaxSaveAction()
->save();
$responseContent = Mage::helper('Mage_Core_Helper_Data')->jsonEncode(array(
'success' => true,
- 'error' => false,
'error_message' => '',
'tax_calculation_rate_id' => $rate->getId(),
'code' => $rate->getCode(),
@@ -142,7 +141,6 @@ public function ajaxSaveAction()
} catch (Mage_Core_Exception $e) {
$responseContent = Mage::helper('Mage_Core_Helper_Data')->jsonEncode(array(
'success' => false,
- 'error' => true,
'error_message' => $e->getMessage(),
'tax_calculation_rate_id' => '',
'code' => '',
@@ -150,7 +148,6 @@ public function ajaxSaveAction()
} catch (Exception $e) {
$responseContent = Mage::helper('Mage_Core_Helper_Data')->jsonEncode(array(
'success' => false,
- 'error' => true,
'error_message' => Mage::helper('Mage_Tax_Helper_Data') ->__('There was an error saving tax rate.'),
'tax_calculation_rate_id' => '',
'code' => '',
@@ -263,19 +260,16 @@ public function ajaxDeleteAction()
$rate->delete();
$responseContent = Mage::helper('Mage_Core_Helper_Data')->jsonEncode(array(
'success' => true,
- 'error' => false,
'error_message' => ''
));
} catch (Mage_Core_Exception $e) {
$responseContent = Mage::helper('Mage_Core_Helper_Data')->jsonEncode(array(
'success' => false,
- 'error' => true,
'error_message' => $e->getMessage()
));
} catch (Exception $e) {
$responseContent = Mage::helper('Mage_Core_Helper_Data')->jsonEncode(array(
'success' => false,
- 'error' => true,
'error_message' => Mage::helper('Mage_Tax_Helper_Data')->__('An error occurred while deleting this tax rate.')
));
}
@@ -344,7 +338,9 @@ public function importPostAction()
{
if ($this->getRequest()->isPost() && !empty($_FILES['import_rates_file']['tmp_name'])) {
try {
- $this->_importRates();
+ /** @var $importHandler Mage_Tax_Model_Rate_CsvImportHandler */
+ $importHandler = $this->_objectManager->create('Mage_Tax_Model_Rate_CsvImportHandler');
+ $importHandler->importFromCsvFile($this->getRequest()->getFiles('import_rates_file'));
Mage::getSingleton('Mage_Adminhtml_Model_Session')->addSuccess(Mage::helper('Mage_Tax_Helper_Data')->__('The tax rate has been imported.'));
} catch (Mage_Core_Exception $e) {
@@ -358,124 +354,6 @@ public function importPostAction()
$this->_redirectReferer();
}
- protected function _importRates()
- {
- $fileName = $_FILES['import_rates_file']['tmp_name'];
- $csvObject = new Varien_File_Csv();
- $csvData = $csvObject->getData($fileName);
-
- /** checks columns */
- $csvFields = array(
- 0 => Mage::helper('Mage_Tax_Helper_Data')->__('Code'),
- 1 => Mage::helper('Mage_Tax_Helper_Data')->__('Country'),
- 2 => Mage::helper('Mage_Tax_Helper_Data')->__('State'),
- 3 => Mage::helper('Mage_Tax_Helper_Data')->__('Zip/Post Code'),
- 4 => Mage::helper('Mage_Tax_Helper_Data')->__('Rate'),
- 5 => Mage::helper('Mage_Tax_Helper_Data')->__('Zip/Post is Range'),
- 6 => Mage::helper('Mage_Tax_Helper_Data')->__('Range From'),
- 7 => Mage::helper('Mage_Tax_Helper_Data')->__('Range To')
- );
-
-
- $stores = array();
- $unset = array();
- $storeCollection = Mage::getModel('Mage_Core_Model_Store')->getCollection()->setLoadDefault(false);
- $cvsFieldsNum = count($csvFields);
- $cvsDataNum = count($csvData[0]);
- for ($i = $cvsFieldsNum; $i < $cvsDataNum; $i++) {
- $header = $csvData[0][$i];
- $found = false;
- foreach ($storeCollection as $store) {
- if ($header == $store->getCode()) {
- $csvFields[$i] = $store->getCode();
- $stores[$i] = $store->getId();
- $found = true;
- }
- }
- if (!$found) {
- $unset[] = $i;
- }
-
- }
-
- $regions = array();
-
- if ($unset) {
- foreach ($unset as $u) {
- unset($csvData[0][$u]);
- }
- }
- if ($csvData[0] == $csvFields) {
- /** @var $helper Mage_Adminhtml_Helper_Data */
- $helper = Mage::helper('Mage_Adminhtml_Helper_Data');
-
- foreach ($csvData as $k => $v) {
- if ($k == 0) {
- continue;
- }
-
- //end of file has more then one empty lines
- if (count($v) <= 1 && !strlen($v[0])) {
- continue;
- }
- if ($unset) {
- foreach ($unset as $u) {
- unset($v[$u]);
- }
- }
-
- if (count($csvFields) != count($v)) {
- Mage::getSingleton('Mage_Adminhtml_Model_Session')->addError(Mage::helper('Mage_Tax_Helper_Data')->__('Invalid file upload attempt'));
- }
-
- $country = Mage::getModel('Mage_Directory_Model_Country')->loadByCode($v[1], 'iso2_code');
- if (!$country->getId()) {
- Mage::getSingleton('Mage_Adminhtml_Model_Session')->addError(Mage::helper('Mage_Tax_Helper_Data')->__('One of the country has invalid code.'));
- continue;
- }
-
- if (!isset($regions[$v[1]])) {
- $regions[$v[1]]['*'] = '*';
- $regionCollection = Mage::getModel('Mage_Directory_Model_Region')->getCollection()
- ->addCountryFilter($v[1]);
- if ($regionCollection->getSize()) {
- foreach ($regionCollection as $region) {
- $regions[$v[1]][$region->getCode()] = $region->getRegionId();
- }
- }
- }
-
- if (!empty($regions[$v[1]][$v[2]])) {
- $rateData = array(
- 'code' => $v[0],
- 'tax_country_id' => $v[1],
- 'tax_region_id' => ($regions[$v[1]][$v[2]] == '*') ? 0 : $regions[$v[1]][$v[2]],
- 'tax_postcode' => (empty($v[3]) || $v[3]=='*') ? null : $v[3],
- 'rate' => $v[4],
- 'zip_is_range' => $v[5],
- 'zip_from' => $v[6],
- 'zip_to' => $v[7]
- );
-
- $rateModel = Mage::getModel('Mage_Tax_Model_Calculation_Rate')->loadByCode($rateData['code']);
- foreach($rateData as $dataName => $dataValue) {
- $rateModel->setData($dataName, $dataValue);
- }
-
- $titles = array();
- foreach ($stores as $field=>$id) {
- $titles[$id] = $v[$field];
- }
-
- $rateModel->setTitle($titles);
- $rateModel->save();
- }
- }
- } else {
- Mage::throwException(Mage::helper('Mage_Tax_Helper_Data')->__('Invalid file format upload attempt'));
- }
- }
-
/**
* export action from import/export tax
*
diff --git a/app/code/core/Mage/Adminhtml/controllers/Tax/RuleController.php b/app/code/Mage/Adminhtml/controllers/Tax/RuleController.php
similarity index 100%
rename from app/code/core/Mage/Adminhtml/controllers/Tax/RuleController.php
rename to app/code/Mage/Adminhtml/controllers/Tax/RuleController.php
diff --git a/app/code/core/Mage/Adminhtml/controllers/UrlrewriteController.php b/app/code/Mage/Adminhtml/controllers/UrlrewriteController.php
similarity index 96%
rename from app/code/core/Mage/Adminhtml/controllers/UrlrewriteController.php
rename to app/code/Mage/Adminhtml/controllers/UrlrewriteController.php
index eac20412852fd..9535aeffc0a03 100644
--- a/app/code/core/Mage/Adminhtml/controllers/UrlrewriteController.php
+++ b/app/code/Mage/Adminhtml/controllers/UrlrewriteController.php
@@ -86,30 +86,34 @@ public function editAction()
switch ($mode) {
case self::PRODUCT_MODE:
$editBlock = $this->getLayout()
- ->createBlock('Mage_Adminhtml_Block_Urlrewrite_Catalog_Product_Edit', '', array(
+ ->createBlock('Mage_Adminhtml_Block_Urlrewrite_Catalog_Product_Edit', '', array('data' => array(
'category' => $this->_getCategory(),
'product' => $this->_getProduct(),
'is_category_mode' => $this->getRequest()->has('category'),
'url_rewrite' => $this->_getUrlRewrite()
- ));
+ )));
break;
case self::CATEGORY_MODE:
$editBlock = $this->getLayout()
- ->createBlock('Mage_Adminhtml_Block_Urlrewrite_Catalog_Category_Edit', '', array(
+ ->createBlock('Mage_Adminhtml_Block_Urlrewrite_Catalog_Category_Edit', '', array('data' => array(
'category' => $this->_getCategory(),
'url_rewrite' => $this->_getUrlRewrite()
- ));
+ )));
break;
case self::CMS_PAGE_MODE:
- $editBlock = $this->getLayout()->createBlock('Mage_Adminhtml_Block_Urlrewrite_Cms_Page_Edit', '', array(
- 'cms_page' => $this->_getCmsPage(),
- 'url_rewrite' => $this->_getUrlRewrite()
- ));
+ $editBlock = $this->getLayout()->createBlock('Mage_Adminhtml_Block_Urlrewrite_Cms_Page_Edit', '',
+ array(
+ 'data' => array(
+ 'cms_page' => $this->_getCmsPage(),
+ 'url_rewrite' => $this->_getUrlRewrite(),
+ ),
+ )
+ );
break;
case self::ID_MODE:
default:
$editBlock = $this->getLayout()->createBlock('Mage_Adminhtml_Block_Urlrewrite_Edit', '', array(
- 'url_rewrite' => $this->_getUrlRewrite()
+ 'data' => array('url_rewrite' => $this->_getUrlRewrite())
));
break;
}
diff --git a/app/code/Mage/Adminhtml/etc/adminhtml/acl.xml b/app/code/Mage/Adminhtml/etc/adminhtml/acl.xml
new file mode 100644
index 0000000000000..717ab4d948d89
--- /dev/null
+++ b/app/code/Mage/Adminhtml/etc/adminhtml/acl.xml
@@ -0,0 +1,84 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/code/Mage/Adminhtml/etc/adminhtml/menu.xml b/app/code/Mage/Adminhtml/etc/adminhtml/menu.xml
new file mode 100644
index 0000000000000..6f2bed0091e2d
--- /dev/null
+++ b/app/code/Mage/Adminhtml/etc/adminhtml/menu.xml
@@ -0,0 +1,60 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/code/Mage/Adminhtml/etc/config.xml b/app/code/Mage/Adminhtml/etc/config.xml
new file mode 100644
index 0000000000000..065f4bc8e07c2
--- /dev/null
+++ b/app/code/Mage/Adminhtml/etc/config.xml
@@ -0,0 +1,247 @@
+
+
+
+
+
+ 0.7.1
+ true
+
+
+
+
+
+
+
+ Mage_Adminhtml_Model_Observer
+ massactionPrepareKey
+
+
+
+
+
+
+ Mage_Adminhtml_Model_Observer
+ clearCacheConfigurationFilesAccessLevelVerification
+
+
+
+
+
+
+
+
+ admin
+
+
+ Mage_Adminhtml
+
+
+
+
+
+
+
+
+
+
+ Mage_Adminhtml_Model_Observer
+ bindLocale
+
+
+
+
+
+
+ Mage_Backend_Model_Config_Backend_Admin_Observer
+ afterCustomUrlChanged
+
+
+
+
+
+
+ Mage_Adminhtml_Model_Search_Catalog
+ Mage_Catalog::catalog
+
+
+ Mage_Adminhtml_Model_Search_Customer
+ Mage_Customer::customer
+
+
+ Mage_Adminhtml_Model_Search_Order
+ Mage_Sales::sales
+
+
+
+
+
+
+ Mage_Adminhtml.csv
+
+
+
+
+
+
+
+ admin.xml
+
+
+ main.xml
+
+
+ adminnotification.xml
+
+
+ backup.xml
+
+
+ catalog.xml
+
+
+ cms.xml
+
+
+ customer.xml
+
+
+ system/design/design.xml
+
+
+ newsletter.xml
+
+
+ promo.xml
+
+
+ rating.xml
+
+
+ report.xml
+
+
+ sales.xml
+
+
+ system/store/store.xml
+
+
+ system/email/template.xml
+
+
+ tax.xml
+
+
+ urlrewrite.xml
+
+
+ variable.xml
+
+
+ search.xml
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ email
+
+
+
+ system_emails_forgot_email_template
+ general
+
+
+ 1
+
+
+
+
+
+
+ /*/sitemap.xml
+
+
+
+
+
+ price
+ media_image
+ gallery
+
+
+
+
+
+
+ 1
+
+
+
+
+
+
+
+ default
+
+
+ default
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+ admin/index/noRoute
+
+
+
+
+
diff --git a/app/code/core/Mage/Adminhtml/etc/jstranslator.xml b/app/code/Mage/Adminhtml/etc/jstranslator.xml
similarity index 100%
rename from app/code/core/Mage/Adminhtml/etc/jstranslator.xml
rename to app/code/Mage/Adminhtml/etc/jstranslator.xml
diff --git a/app/code/core/Mage/Adminhtml/locale/de_DE/Mage_Adminhtml.csv b/app/code/Mage/Adminhtml/locale/de_DE/Mage_Adminhtml.csv
similarity index 100%
rename from app/code/core/Mage/Adminhtml/locale/de_DE/Mage_Adminhtml.csv
rename to app/code/Mage/Adminhtml/locale/de_DE/Mage_Adminhtml.csv
diff --git a/app/code/core/Mage/Adminhtml/locale/en_US/Mage_Adminhtml.csv b/app/code/Mage/Adminhtml/locale/en_US/Mage_Adminhtml.csv
similarity index 100%
rename from app/code/core/Mage/Adminhtml/locale/en_US/Mage_Adminhtml.csv
rename to app/code/Mage/Adminhtml/locale/en_US/Mage_Adminhtml.csv
diff --git a/app/code/core/Mage/Adminhtml/locale/es_ES/Mage_Adminhtml.csv b/app/code/Mage/Adminhtml/locale/es_ES/Mage_Adminhtml.csv
similarity index 100%
rename from app/code/core/Mage/Adminhtml/locale/es_ES/Mage_Adminhtml.csv
rename to app/code/Mage/Adminhtml/locale/es_ES/Mage_Adminhtml.csv
diff --git a/app/code/core/Mage/Adminhtml/locale/fr_FR/Mage_Adminhtml.csv b/app/code/Mage/Adminhtml/locale/fr_FR/Mage_Adminhtml.csv
similarity index 100%
rename from app/code/core/Mage/Adminhtml/locale/fr_FR/Mage_Adminhtml.csv
rename to app/code/Mage/Adminhtml/locale/fr_FR/Mage_Adminhtml.csv
diff --git a/app/code/core/Mage/Adminhtml/locale/nl_NL/Mage_Adminhtml.csv b/app/code/Mage/Adminhtml/locale/nl_NL/Mage_Adminhtml.csv
similarity index 100%
rename from app/code/core/Mage/Adminhtml/locale/nl_NL/Mage_Adminhtml.csv
rename to app/code/Mage/Adminhtml/locale/nl_NL/Mage_Adminhtml.csv
diff --git a/app/code/core/Mage/Adminhtml/locale/pt_BR/Mage_Adminhtml.csv b/app/code/Mage/Adminhtml/locale/pt_BR/Mage_Adminhtml.csv
similarity index 100%
rename from app/code/core/Mage/Adminhtml/locale/pt_BR/Mage_Adminhtml.csv
rename to app/code/Mage/Adminhtml/locale/pt_BR/Mage_Adminhtml.csv
diff --git a/app/code/core/Mage/Adminhtml/locale/zh_CN/Mage_Adminhtml.csv b/app/code/Mage/Adminhtml/locale/zh_CN/Mage_Adminhtml.csv
similarity index 100%
rename from app/code/core/Mage/Adminhtml/locale/zh_CN/Mage_Adminhtml.csv
rename to app/code/Mage/Adminhtml/locale/zh_CN/Mage_Adminhtml.csv
diff --git a/app/code/core/Mage/Adminhtml/view/adminhtml/admin.xml b/app/code/Mage/Adminhtml/view/adminhtml/admin.xml
similarity index 95%
rename from app/code/core/Mage/Adminhtml/view/adminhtml/admin.xml
rename to app/code/Mage/Adminhtml/view/adminhtml/admin.xml
index 3dd1faf2bb3c2..5bfe69286086f 100644
--- a/app/code/core/Mage/Adminhtml/view/adminhtml/admin.xml
+++ b/app/code/Mage/Adminhtml/view/adminhtml/admin.xml
@@ -30,6 +30,7 @@
+
0
diff --git a/app/code/core/Mage/Adminhtml/view/adminhtml/admin/access_denied.phtml b/app/code/Mage/Adminhtml/view/adminhtml/admin/access_denied.phtml
similarity index 100%
rename from app/code/core/Mage/Adminhtml/view/adminhtml/admin/access_denied.phtml
rename to app/code/Mage/Adminhtml/view/adminhtml/admin/access_denied.phtml
diff --git a/app/code/core/Mage/Adminhtml/view/adminhtml/admin/formkey.phtml b/app/code/Mage/Adminhtml/view/adminhtml/admin/formkey.phtml
similarity index 100%
rename from app/code/core/Mage/Adminhtml/view/adminhtml/admin/formkey.phtml
rename to app/code/Mage/Adminhtml/view/adminhtml/admin/formkey.phtml
diff --git a/app/code/core/Mage/Adminhtml/view/adminhtml/admin/overlay_popup.phtml b/app/code/Mage/Adminhtml/view/adminhtml/admin/overlay_popup.phtml
similarity index 100%
rename from app/code/core/Mage/Adminhtml/view/adminhtml/admin/overlay_popup.phtml
rename to app/code/Mage/Adminhtml/view/adminhtml/admin/overlay_popup.phtml
diff --git a/app/code/Mage/Adminhtml/view/adminhtml/admin/page.phtml b/app/code/Mage/Adminhtml/view/adminhtml/admin/page.phtml
new file mode 100644
index 0000000000000..c3b14b7640378
--- /dev/null
+++ b/app/code/Mage/Adminhtml/view/adminhtml/admin/page.phtml
@@ -0,0 +1,80 @@
+
+
+
+
+
+
+ getChildHtml('head') ?>
+
+
+getBodyClass() ? ' class="' . $this->getBodyClass() . '"' : ''; ?>>
+
+ getChildHtml('notification_window'); ?>
+ getChildHtml('global_notices') ?>
+ getChildHtml('header') ?>
+ getChildHtml('menu') ?>
+ getChildHtml('notifications'); ?>
+
+
+ getChildHtml('main-top'); ?>
+
+ getMessagesBlock()->getGroupedHtml() ?>
+
+
+ getChildHtml('left')): ?>
+
+
+
+ getChildHtml('content') ?>
+
+
+
+ getChildHtml('left') ?>
+
+
+
+
+
+ getChildHtml('content') ?>
+
+
+
+
+ getChildHtml('js') ?>
+
+
+
+ getChildHtml('before_body_end') ?>
+
+
+
+
diff --git a/app/code/core/Mage/Adminhtml/view/adminhtml/admin/popup.phtml b/app/code/Mage/Adminhtml/view/adminhtml/admin/popup.phtml
similarity index 100%
rename from app/code/core/Mage/Adminhtml/view/adminhtml/admin/popup.phtml
rename to app/code/Mage/Adminhtml/view/adminhtml/admin/popup.phtml
diff --git a/app/code/core/Mage/Adminhtml/view/adminhtml/adminnotification.xml b/app/code/Mage/Adminhtml/view/adminhtml/adminnotification.xml
similarity index 100%
rename from app/code/core/Mage/Adminhtml/view/adminhtml/adminnotification.xml
rename to app/code/Mage/Adminhtml/view/adminhtml/adminnotification.xml
diff --git a/app/code/core/Mage/Adminhtml/view/adminhtml/api/role_users_grid_js.phtml b/app/code/Mage/Adminhtml/view/adminhtml/api/role_users_grid_js.phtml
similarity index 100%
rename from app/code/core/Mage/Adminhtml/view/adminhtml/api/role_users_grid_js.phtml
rename to app/code/Mage/Adminhtml/view/adminhtml/api/role_users_grid_js.phtml
diff --git a/app/code/Mage/Adminhtml/view/adminhtml/api/roleinfo.phtml b/app/code/Mage/Adminhtml/view/adminhtml/api/roleinfo.phtml
new file mode 100644
index 0000000000000..3109a6c86f6fd
--- /dev/null
+++ b/app/code/Mage/Adminhtml/view/adminhtml/api/roleinfo.phtml
@@ -0,0 +1,43 @@
+
+
+
+ getBackButtonHtml() ?>
+ getResetButtonHtml() ?>
+ getDeleteButtonHtml() ?>
+ getSaveButtonHtml() ?>
+
+
+
+
+
diff --git a/app/code/Mage/Adminhtml/view/adminhtml/api/roles.phtml b/app/code/Mage/Adminhtml/view/adminhtml/api/roles.phtml
new file mode 100644
index 0000000000000..0b3c6fa3aafb2
--- /dev/null
+++ b/app/code/Mage/Adminhtml/view/adminhtml/api/roles.phtml
@@ -0,0 +1,32 @@
+
+
+
+ __('Add New Role') ?>
+
+
+getGridHtml() ?>
diff --git a/app/code/core/Mage/Adminhtml/view/adminhtml/api/rolesedit.phtml b/app/code/Mage/Adminhtml/view/adminhtml/api/rolesedit.phtml
similarity index 100%
rename from app/code/core/Mage/Adminhtml/view/adminhtml/api/rolesedit.phtml
rename to app/code/Mage/Adminhtml/view/adminhtml/api/rolesedit.phtml
diff --git a/app/code/core/Mage/Adminhtml/view/adminhtml/api/rolesusers.phtml b/app/code/Mage/Adminhtml/view/adminhtml/api/rolesusers.phtml
similarity index 96%
rename from app/code/core/Mage/Adminhtml/view/adminhtml/api/rolesusers.phtml
rename to app/code/Mage/Adminhtml/view/adminhtml/api/rolesusers.phtml
index 38fd74195f7ce..f0a18829607a1 100644
--- a/app/code/core/Mage/Adminhtml/view/adminhtml/api/rolesusers.phtml
+++ b/app/code/Mage/Adminhtml/view/adminhtml/api/rolesusers.phtml
@@ -25,4 +25,4 @@
*/
?>
-_getGridHtml() ?>
+getGridHtml() ?>
diff --git a/app/code/core/Mage/Adminhtml/view/adminhtml/api/user_roles_grid_js.phtml b/app/code/Mage/Adminhtml/view/adminhtml/api/user_roles_grid_js.phtml
similarity index 97%
rename from app/code/core/Mage/Adminhtml/view/adminhtml/api/user_roles_grid_js.phtml
rename to app/code/Mage/Adminhtml/view/adminhtml/api/user_roles_grid_js.phtml
index a632e48c7bf0e..d537f1a03423b 100644
--- a/app/code/core/Mage/Adminhtml/view/adminhtml/api/user_roles_grid_js.phtml
+++ b/app/code/Mage/Adminhtml/view/adminhtml/api/user_roles_grid_js.phtml
@@ -30,7 +30,7 @@
getJsObjectName()): ?>
var radioBoxes = $H({});
var warning = false;
- var userRoles = $H(_getSelectedRoles(true) ?>);
+ var userRoles = $H(getSelectedRoles(true) ?>);
if (userRoles.size() > 0) warning = true;
$('user_user_roles').value = userRoles.toQueryString();
diff --git a/app/code/core/Mage/Adminhtml/view/adminhtml/api/userinfo.phtml b/app/code/Mage/Adminhtml/view/adminhtml/api/userinfo.phtml
similarity index 100%
rename from app/code/core/Mage/Adminhtml/view/adminhtml/api/userinfo.phtml
rename to app/code/Mage/Adminhtml/view/adminhtml/api/userinfo.phtml
diff --git a/app/code/core/Mage/Adminhtml/view/adminhtml/api/usernroles.phtml b/app/code/Mage/Adminhtml/view/adminhtml/api/usernroles.phtml
similarity index 100%
rename from app/code/core/Mage/Adminhtml/view/adminhtml/api/usernroles.phtml
rename to app/code/Mage/Adminhtml/view/adminhtml/api/usernroles.phtml
diff --git a/app/code/core/Mage/Adminhtml/view/adminhtml/backup.xml b/app/code/Mage/Adminhtml/view/adminhtml/backup.xml
similarity index 100%
rename from app/code/core/Mage/Adminhtml/view/adminhtml/backup.xml
rename to app/code/Mage/Adminhtml/view/adminhtml/backup.xml
diff --git a/app/code/core/Mage/Adminhtml/view/adminhtml/backup/dialogs.phtml b/app/code/Mage/Adminhtml/view/adminhtml/backup/dialogs.phtml
similarity index 95%
rename from app/code/core/Mage/Adminhtml/view/adminhtml/backup/dialogs.phtml
rename to app/code/Mage/Adminhtml/view/adminhtml/backup/dialogs.phtml
index 68f1ffcdcca6c..043c5a08f515a 100644
--- a/app/code/core/Mage/Adminhtml/view/adminhtml/backup/dialogs.phtml
+++ b/app/code/Mage/Adminhtml/view/adminhtml/backup/dialogs.phtml
@@ -69,7 +69,7 @@
@@ -108,7 +108,7 @@
__('This action cannot be undone.')?>
__('Are you sure you want to proceed?')?>
-
- __('OK')?>
+ __('OK')?>
__('Cancel')?>
diff --git a/app/code/core/Mage/Adminhtml/view/adminhtml/backup/left.phtml b/app/code/Mage/Adminhtml/view/adminhtml/backup/left.phtml
similarity index 100%
rename from app/code/core/Mage/Adminhtml/view/adminhtml/backup/left.phtml
rename to app/code/Mage/Adminhtml/view/adminhtml/backup/left.phtml
diff --git a/app/code/core/Mage/Adminhtml/view/adminhtml/backup/list.phtml b/app/code/Mage/Adminhtml/view/adminhtml/backup/list.phtml
similarity index 100%
rename from app/code/core/Mage/Adminhtml/view/adminhtml/backup/list.phtml
rename to app/code/Mage/Adminhtml/view/adminhtml/backup/list.phtml
diff --git a/app/code/core/Mage/Adminhtml/view/adminhtml/catalog.xml b/app/code/Mage/Adminhtml/view/adminhtml/catalog.xml
similarity index 94%
rename from app/code/core/Mage/Adminhtml/view/adminhtml/catalog.xml
rename to app/code/Mage/Adminhtml/view/adminhtml/catalog.xml
index ce4806b341f5b..21d1b14cc5886 100644
--- a/app/code/core/Mage/Adminhtml/view/adminhtml/catalog.xml
+++ b/app/code/Mage/Adminhtml/view/adminhtml/catalog.xml
@@ -49,9 +49,9 @@
Mage_Adminhtml::jquery/fileUploader/load-image.min.js
Mage_Adminhtml::jquery/fileUploader/canvas-to-blob.min.js
Mage_Adminhtml::jquery/fileUploader/jquery.fileupload-fp.js
+ mage/proxy-event.js
Mage_Adminhtml::catalog/category-selector.css
- Mage_Adminhtml::catalog/category-selector.js
Mage_Adminhtml::json2.js
Mage_Adminhtml::mage/backend/suggest.js
Mage_Adminhtml::jquery/jstree/jquery.hotkeys.js
@@ -61,6 +61,9 @@
Mage_Adminhtml::catalog/product-variation.js
Mage_Adminhtml::catalog/base-image-uploader.js
Mage_Catalog::js/product-gallery.js
+ Mage_Catalog::product/product.css
+ Mage_Catalog::js/custom-options.js
+ mage/backend/menu.js
@@ -92,7 +95,7 @@
-
+
@@ -171,7 +174,7 @@
entity_id
0
1
- associated-product-id
+ Mage_Catalog_Block_Product_Configurable_AssociatedSelector_Renderer_Id
@@ -183,7 +186,6 @@
name
0
1
- associated-product-name
@@ -194,7 +196,6 @@
price
0
1
- associated-product-price
@@ -206,7 +207,6 @@
sku
0
1
- associated-product-sku
@@ -217,7 +217,6 @@
weight
0
1
- associated-product-weight
@@ -343,7 +342,7 @@ Layout handle for grouped products
-
+
@@ -365,6 +364,7 @@ Layout handle for grouped products
<_current>1
+ data-table
@@ -375,15 +375,15 @@ Layout handle for grouped products
grip
entity_id
- 5px
0
- ui-icon ui-icon-grip-dotted-vertical
+ draggable-handle
+ col-draggable
+ col-draggable
- grouped-product-name
text
name
1
@@ -394,10 +394,8 @@ Layout handle for grouped products
- grouped-product-sku
text
sku
- 80px
0
1
@@ -405,22 +403,16 @@ Layout handle for grouped products
- grouped-product-price
currency
price
- 110px
- right
0
- grouped-product-qty
number
qty
- 110px
- right
1
0
@@ -431,10 +423,10 @@ Layout handle for grouped products
button
button
grouped-product-delete
- 60px
Mage_Backend_Block_Widget_Grid_Column_Renderer_Button
- right
0
+ col-actions
+ col-actions
@@ -473,17 +465,14 @@ Layout handle for grouped products
checkbox
- a-center
- selected-products
- 60px
- center
entity_id
+ col-select
+ col-select
- associated-product-name
text
name
1
@@ -493,21 +482,16 @@ Layout handle for grouped products
- associated-product-sku
text
sku
- 80px
1
- associated-product-price
currency
price
- 110px
- right
diff --git a/app/code/core/Mage/Adminhtml/view/adminhtml/catalog/base-image-uploader.js b/app/code/Mage/Adminhtml/view/adminhtml/catalog/base-image-uploader.js
similarity index 86%
rename from app/code/core/Mage/Adminhtml/view/adminhtml/catalog/base-image-uploader.js
rename to app/code/Mage/Adminhtml/view/adminhtml/catalog/base-image-uploader.js
index 8fb8fda72980c..0187a42c1174a 100644
--- a/app/code/core/Mage/Adminhtml/view/adminhtml/catalog/base-image-uploader.js
+++ b/app/code/Mage/Adminhtml/view/adminhtml/catalog/base-image-uploader.js
@@ -22,10 +22,8 @@
* @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com)
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
*/
-/*jshint jquery:true*/
-/*global alert*/
+/*global alert:true*/
(function ($) {
- "use strict";
$.widget('mage.baseImage', {
/**
* Button creation
@@ -41,7 +39,7 @@
var findElement = function(data) {
return $container.find('.image:not(.image-placeholder)').filter(function() {
- return $(this).data('image').file === data.file;
+ return $(this).data('image').file == data.file;
}).first();
};
var updateVisibility = function() {
@@ -49,11 +47,11 @@
elementsList.each(function(index) {
$(this)[index < maximumImageCount ? 'show' : 'hide']();
});
- $dropPlaceholder[elementsList.length >= maximumImageCount ? 'hide' : 'show']();
+ $dropPlaceholder[elementsList.length > maximumImageCount ? 'hide' : 'show']();
};
$galleryContainer.on('setImageType', function(event, data) {
- if (data.type === 'image') {
+ if (data.type == 'image') {
$container.find('.' + mainClass).removeClass(mainClass);
if (data.imageData) {
findElement(data.imageData).addClass(mainClass);
@@ -87,13 +85,13 @@
$container.on('click', '[data-role="make-main-button"]', function(event) {
event.preventDefault();
- var data = $(this.target).closest('.image').data('image');
+ var data = $(event.target).closest('.image').data('image');
$galleryContainer.productGallery('setMain', data);
});
$container.on('click', '[data-role="delete-button"]', function(event) {
event.preventDefault();
- $galleryContainer.trigger('removeItem', $(this.target).closest('.image').data('image'));
+ $galleryContainer.trigger('removeItem', $(event.target).closest('.image').data('image'));
});
$container.sortable({
@@ -134,6 +132,16 @@
progress: function(e, data) {
var progress = parseInt(data.loaded / data.total * 100, 10);
$dropPlaceholder.find('.progress-bar').addClass('in-progress').text(progress + '%');
+ },
+ start: function(event) {
+ var uploaderContainer = $(event.target).closest('.image-placeholder');
+
+ uploaderContainer.addClass('loading');
+ },
+ stop: function(event) {
+ var uploaderContainer = $(event.target).closest('.image-placeholder');
+
+ uploaderContainer.removeClass('loading');
}
});
}
diff --git a/app/code/Mage/Adminhtml/view/adminhtml/catalog/category-selector.css b/app/code/Mage/Adminhtml/view/adminhtml/catalog/category-selector.css
new file mode 100644
index 0000000000000..1b963e32f4d85
--- /dev/null
+++ b/app/code/Mage/Adminhtml/view/adminhtml/catalog/category-selector.css
@@ -0,0 +1,176 @@
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Academic Free License (AFL 3.0)
+ * that is bundled with this package in the file LICENSE_AFL.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/afl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @category Mage
+ * @package Mage_Adminhtml
+ * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
+ */
+
+.field-category_ids .category-select {
+ margin: 0 0 6px 0;
+ padding: 2px;
+ width: 67.999999997%;
+}
+
+.mage-new-category-dialog .category-select {
+ width: 100%;
+ padding: 0;
+}
+
+.field-category_ids .mage-suggest-inner {
+ padding-right: 27px;
+}
+
+.field-category_ids .addon > button {
+ float: right;
+ margin-left: 2.127659574%;
+ width: 28.4%;
+}
+
+.field-category_ids .category-select:after,
+.mage-new-category-dialog .category-select:after {
+ position: absolute;
+ top: 0;
+ right: 5px;
+ font-family: 'MUI-Icons';
+ font-style: normal;
+ speak: none;
+ font-weight: normal;
+ -webkit-font-smoothing: antialiased;
+ content: '\e013'; /* unordered list icon */
+ font-size: 20px;
+ color: #b2b2b2;
+}
+
+/* Category Selector in "Create New Category" popup */
+.mage-new-category-dialog .mage-suggest {
+ border: none;
+ box-shadow: none;
+}
+.mage-new-category-dialog .mage-suggest .mage-suggest-inner {
+ padding: 0;
+}
+
+.mage-new-category-dialog .mage-suggest-choices {
+ position: relative;
+ padding: 2px 22px 2px 2px;
+ background-color: #fff;
+ border: 1px solid #ccc;
+ border-radius: 3px;
+ -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
+ -moz-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
+ box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
+}
+
+.mage-new-category-dialog .mage-suggest-dropdown {
+ position: relative;
+ margin: 3px 1px 0;
+}
+
+.mage-new-category-dialog .mage-suggest-inner {
+ padding: 2px 22px 2px 2px;
+}
+
+.mage-suggest-choices {
+ margin: 0;
+ padding: 0;
+ list-style: none;
+}
+
+.mage-suggest-choices > li {
+ display: inline-block;
+}
+
+.mage-suggest-search-field {
+ width: 100%;
+ white-space: nowrap;
+ margin: 0;
+ padding: 0;
+}
+
+.mage-suggest-search-field > input,
+.mage-suggest-search-field > input:focus,
+.mage-suggest-search-field > input:active {
+ width: 100%;
+ height: 22px;
+ line-height: 22px;
+ outline: 0 none;
+ border: 0 none;
+ box-shadow: none;
+ padding: 0 3px;
+}
+
+.mage-suggest-search-field > input.mage-suggest-state-loading {
+ background: #fff url('images/spinner.gif') no-repeat 100%;
+ padding-right: 18px;
+}
+
+.mage-suggest-choice {
+ position: relative;
+ background: #cdecf6;
+ border: 1px solid #a7cedb;
+ border-radius: 3px;
+ padding: 2px 22px 1px 9px;
+ margin: 1px 2px 1px 0;
+ vertical-align: top;
+ cursor: default;
+ -moz-transition: background .3s;
+ -webkit-transition: background .3s;
+ transition: background .3s;
+}
+
+.mage-suggest-choice:hover {
+ background: #aae3f5;
+}
+
+.mage-suggest-choice-close {
+ position: absolute;
+ top: 0;
+ right: 0;
+ bottom: 0;
+ width: 20px;
+ line-height: 16px;
+ text-align: center;
+ color: #7b94a1;
+ cursor: pointer;
+}
+
+.mage-suggest-choice-close:hover {
+ color: #000;
+}
+
+.mage-suggest-choice-close:before {
+ font-family: 'MUI-Icons';
+ font-style: normal;
+ speak: none;
+ font-weight: normal;
+ -webkit-font-smoothing: antialiased;
+ content: '\e07d'; /* close icon */
+ font-size: 6px;
+}
+
+.mage-suggest-no-records {
+ display: inline-block;
+ padding: 10px;
+}
+
+.ui-helper-hidden-accessible {
+ display: none;
+}
diff --git a/app/code/core/Mage/Adminhtml/view/adminhtml/catalog/category/checkboxes/tree.phtml b/app/code/Mage/Adminhtml/view/adminhtml/catalog/category/checkboxes/tree.phtml
similarity index 100%
rename from app/code/core/Mage/Adminhtml/view/adminhtml/catalog/category/checkboxes/tree.phtml
rename to app/code/Mage/Adminhtml/view/adminhtml/catalog/category/checkboxes/tree.phtml
diff --git a/app/code/core/Mage/Adminhtml/view/adminhtml/catalog/category/edit.js b/app/code/Mage/Adminhtml/view/adminhtml/catalog/category/edit.js
similarity index 100%
rename from app/code/core/Mage/Adminhtml/view/adminhtml/catalog/category/edit.js
rename to app/code/Mage/Adminhtml/view/adminhtml/catalog/category/edit.js
diff --git a/app/code/Mage/Adminhtml/view/adminhtml/catalog/category/edit.phtml b/app/code/Mage/Adminhtml/view/adminhtml/catalog/category/edit.phtml
new file mode 100644
index 0000000000000..d3d50574336c8
--- /dev/null
+++ b/app/code/Mage/Adminhtml/view/adminhtml/catalog/category/edit.phtml
@@ -0,0 +1,174 @@
+
+
+
+
+ getChildHtml('form') ?>
+
+
diff --git a/app/code/core/Mage/Adminhtml/view/adminhtml/catalog/category/edit/form.phtml b/app/code/Mage/Adminhtml/view/adminhtml/catalog/category/edit/form.phtml
similarity index 100%
rename from app/code/core/Mage/Adminhtml/view/adminhtml/catalog/category/edit/form.phtml
rename to app/code/Mage/Adminhtml/view/adminhtml/catalog/category/edit/form.phtml
diff --git a/app/code/core/Mage/Adminhtml/view/adminhtml/catalog/category/form.js b/app/code/Mage/Adminhtml/view/adminhtml/catalog/category/form.js
similarity index 100%
rename from app/code/core/Mage/Adminhtml/view/adminhtml/catalog/category/form.js
rename to app/code/Mage/Adminhtml/view/adminhtml/catalog/category/form.js
diff --git a/app/code/core/Mage/Adminhtml/view/adminhtml/catalog/category/tree.phtml b/app/code/Mage/Adminhtml/view/adminhtml/catalog/category/tree.phtml
similarity index 100%
rename from app/code/core/Mage/Adminhtml/view/adminhtml/catalog/category/tree.phtml
rename to app/code/Mage/Adminhtml/view/adminhtml/catalog/category/tree.phtml
diff --git a/app/code/core/Mage/Adminhtml/view/adminhtml/catalog/category/widget/tree.phtml b/app/code/Mage/Adminhtml/view/adminhtml/catalog/category/widget/tree.phtml
similarity index 100%
rename from app/code/core/Mage/Adminhtml/view/adminhtml/catalog/category/widget/tree.phtml
rename to app/code/Mage/Adminhtml/view/adminhtml/catalog/category/widget/tree.phtml
diff --git a/app/code/core/Mage/Adminhtml/view/adminhtml/catalog/configurable-product.css b/app/code/Mage/Adminhtml/view/adminhtml/catalog/configurable-product.css
similarity index 100%
rename from app/code/core/Mage/Adminhtml/view/adminhtml/catalog/configurable-product.css
rename to app/code/Mage/Adminhtml/view/adminhtml/catalog/configurable-product.css
diff --git a/app/code/Mage/Adminhtml/view/adminhtml/catalog/form/renderer/fieldset/element.phtml b/app/code/Mage/Adminhtml/view/adminhtml/catalog/form/renderer/fieldset/element.phtml
new file mode 100644
index 0000000000000..15cd2cbdd3285
--- /dev/null
+++ b/app/code/Mage/Adminhtml/view/adminhtml/catalog/form/renderer/fieldset/element.phtml
@@ -0,0 +1,91 @@
+
+
+getElement();
+$note = $element->getNote() ? '' . $element->getNote() . '
' : '';
+$elementBeforeLabel = $element->getExtType() == 'checkbox' || $element->getExtType() == 'radio';
+$addOn = $element->getBeforeElementHtml() || $element->getAfterElementHtml();
+$fieldId = ($element->getHtmlId()) ? ' id="attribute-' . $element->getHtmlId() . '-container"' : '';
+$fieldClass = "field field-{$element->getId()} {$element->getCssClass()}";
+$fieldClass .= ($elementBeforeLabel) ? ' choice' : '';
+$fieldClass .= ($addOn) ? ' with-addon' : '';
+$fieldClass .= ($element->getRequired()) ? ' required' : '';
+$fieldClass .= ($note) ? ' with-note' : '';
+
+$fieldAttributes = $fieldId . ' class="' . $fieldClass . '" '
+ . $this->getUiId('form-field', $element->getId());
+?>
+
+checkFieldDisable() ?>
+getToggleCode() ? $element->getToggleCode()
+ : 'toggleValueElements(this, this.parentNode.parentNode.parentNode)';
+?>
+getNoDisplay()): ?>
+ getType() == 'hidden'): ?>
+ getElementHtml() ?>
+
+ data-element-id="getHtmlId() ?>"
+ data-apply-to="escapeHtml($this->helper('Mage_Core_Helper_Data')->jsonEncode(
+ $element->hasEntityAttribute() ? $element->getEntityAttribute()->getApplyTo() : array()
+ ))?>"
+ >
+
+ getElementHtml() ?>
+ getLabelHtml() ?>
+
+
+ getLabelHtml() ?>
+
+ ' . $this->getElementHtml() . '
' : $this->getElementHtml(); ?>
+
+
+
+
+ canDisplayUseDefault()): ?>
+
+ getReadonly()):?> disabled="disabled"
+ type="checkbox"
+ name="use_default[]"
+ class="use-default-control"
+ id="getHtmlId() ?>_default"
+ usedDefault()): ?> checked="checked"
+ onclick=""
+ value="getAttributeCode() ?>"/>
+ __('Use Default Value') ?>
+
+
+
+
+
+
diff --git a/app/code/core/Mage/Adminhtml/view/adminhtml/catalog/images/select2.png b/app/code/Mage/Adminhtml/view/adminhtml/catalog/images/select2.png
similarity index 100%
rename from app/code/core/Mage/Adminhtml/view/adminhtml/catalog/images/select2.png
rename to app/code/Mage/Adminhtml/view/adminhtml/catalog/images/select2.png
diff --git a/app/code/core/Mage/Adminhtml/view/adminhtml/catalog/images/select2x2.png b/app/code/Mage/Adminhtml/view/adminhtml/catalog/images/select2x2.png
similarity index 100%
rename from app/code/core/Mage/Adminhtml/view/adminhtml/catalog/images/select2x2.png
rename to app/code/Mage/Adminhtml/view/adminhtml/catalog/images/select2x2.png
diff --git a/app/code/core/Mage/Adminhtml/view/adminhtml/catalog/images/spinner.gif b/app/code/Mage/Adminhtml/view/adminhtml/catalog/images/spinner.gif
similarity index 100%
rename from app/code/core/Mage/Adminhtml/view/adminhtml/catalog/images/spinner.gif
rename to app/code/Mage/Adminhtml/view/adminhtml/catalog/images/spinner.gif
diff --git a/app/code/core/Mage/Adminhtml/view/adminhtml/catalog/product-variation.js b/app/code/Mage/Adminhtml/view/adminhtml/catalog/product-variation.js
similarity index 99%
rename from app/code/core/Mage/Adminhtml/view/adminhtml/catalog/product-variation.js
rename to app/code/Mage/Adminhtml/view/adminhtml/catalog/product-variation.js
index 60ba2b4ea7ba9..543499ff52099 100644
--- a/app/code/core/Mage/Adminhtml/view/adminhtml/catalog/product-variation.js
+++ b/app/code/Mage/Adminhtml/view/adminhtml/catalog/product-variation.js
@@ -28,6 +28,7 @@
this.element.sortable({
axis: 'y',
handle: '.draggable-handle',
+ tolerance: 'pointer',
update: function () {
$(this).find('[name$="[position]"]').each(function (index) {
$(this).val(index);
diff --git a/app/code/Mage/Adminhtml/view/adminhtml/catalog/product.js b/app/code/Mage/Adminhtml/view/adminhtml/catalog/product.js
new file mode 100644
index 0000000000000..2ed823f37663d
--- /dev/null
+++ b/app/code/Mage/Adminhtml/view/adminhtml/catalog/product.js
@@ -0,0 +1,122 @@
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Academic Free License (AFL 3.0)
+ * that is bundled with this package in the file LICENSE_AFL.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/afl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @category Mage
+ * @package Mage_Adminhtml
+ * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
+ */
+
+var Product = {};
+
+(function ($) {
+ $.widget("mage.productAttributes", {
+ _create: function () {
+ this._on({'click':'_showPopup'});
+ },
+ _showPopup: function (event) {
+ var wrapper = $('
').appendTo('body').dialog({
+ title: 'New Attribute',
+ minWidth: 980,
+ minHeight: 700,
+ modal: true,
+ resizeStop: function(event, ui) {
+ iframe.height($(this).outerHeight() + 'px');
+ iframe.width($(this).outerWidth() + 'px');
+ }
+ });
+ wrapper.mage('loader', {showOnInit: true});
+ var iframe = $('