diff --git a/STATUS.txt b/STATUS.txt
deleted file mode 100644
index da8753d8a6..0000000000
--- a/STATUS.txt
+++ /dev/null
@@ -1,235 +0,0 @@
-This file tracks the status of Magento in the 1.2.x branch.
-
-FIXED BUGS:
-
- #6341: Duble subject line in e-mail
- #7162: Wrong div class used in 'mini compared products box
- #7400: In order view (admin panel) statuses history is different in tabs 'Information' and 'Comments History'
- #7423: Cart Rules - Condition Limit Error
- #7472: Invoices Report
- #7612: Products are displayed in categories they are not included in
- #7636: Catalog Product Attribute -> Catalog Input Type -> Dropdown
- #8020: Custom catalog attributes created as "price" not displaying correctly
- #8159: One page checkout :: doesn't work when inline translation was enabled
- #8366: Not possible to translate tax identifier for two store views
- #8411: (assign users to role)
- #8413: Mass Delete through product update screen does not work
- #8439: The checkout-process-page has no pagetitle
- #8452: Layout Update Problem (Mage_Core_Model_Config)
- #8492: Custom Options percentage Price Type: price rounded off unwantedly
- #8503: Bundle products and decimal places in options quantity
- #8523: Analytics does not show revenue with configurable products
- #8573: lifetime sale incorrect when refunding order with discount code applied
- #8595: Many numeric-only searches in Admin/Autocomplete
- #8657: Spelling mistake in error msg - "Selected currency code () is not compatabile with PayPal"
- #8674: User doesn't subscribed to newsletter.
- #8726: Mage_Core_Model_Resource_Setup::getAllAttributeSetIds() belongs in another class
- #8762: Filter settings on Sales - Orders not saved
- #8770: [MAC, Safari] Unable to create new order in the admin with new customer creating & #8771: [MAC, Safari] Unable to create new order in the admin
- #8784: Send product to a friend not under store configuration
- #8803: Remove "Yes, No, Any" dropdown filter on Google Base Items
- #8893: Trace error after clicking button "Search"
- #8896: Applying unable coupons in the empty shopping cart
- #8898: Free Shipping: 'For matching items only' cart rule doesn't work with UPS XML type method
- #8903: SQL error when sorting Online Customers by Type attribute
- #8925: Locale settings not applied after installation
- #8928: Unable to create rule for Not logged in customer.
- #8943: Import is not working in Safari
- #8966: Google Base API - Mass Insert / Update -> CAPTCHA challenge issued
- #8968: Category save process is very slow for big catalog
- #8974: Content type validation
- #8977: Google Analytics reports wrong URL when URL has no query string OR store resides in subfolder...
- #8980: Shopping cart discount error
- #8992: Mage_Sitemap / Varien_Io_File Bug - Destination not writeable error
- #8993: 'No Data Found' for Web Site
- #8995: Search does not return correct URL key for additional store view (e.g. 2nd language)
- #9109: Sales Report disregards currency rates
- #9135: Advanced search by price doesn't work at all
- #9139: Admin: menu items not readable when images are disabled
- #9166: Unable to add image to all types of product
- #9167: AJAX will freeze during 'quick simple product creation'
- #9171: Product's table doesn't hide after select products for adding SKU
- #9172: Free Shipping: 'For matching items only' cart rule doesn't work with DHL type method
- #9173: Calendar's button doesn't work in rules
- #9195: [admin - reports - sales - tax] - no data
- #9207: Field country is not marked as required
- #9208: Unable to add bundle items to bundle product
- #9228: cart error after product delete
- #9248: On admin page, search function does not work
- #9250: Import doesn't work
- #9278: Peruvian Nuevo Sol Shown as PES (Peruvian Sol)
- #9279: Catalog price rules do not apply when attribute selected has Catalog Input Type for Store Owner ='Multiple Select'
- #9296: Customer DOB saved not correctly
- #9324: Bad counting products
- #9326: Verification in "Contact Us"
- #9348: Sales Tax Reports Give False Results (No Results)
- #9354: Date Format
- #9358: Unable add products to Google Base after filtering
- #9359: Google Analytics Revenue Not Working
- #9375: Fatal error: Call to a member function getItemsCollection() in Address.php
- #9389: SQL-error while creating custom option forproduct
- #9390: In "Advanced Search" all text is not displayed
- #9392: The field is too broad insert text
- #9440: Error subscription to newsletter
- #9452: Email Reply Address
- #9468: The same group name in an attribute set can be created but it can NOT be saved
- #9470: Gift message is not moved over on an order edit
- #9479: Reorder / shipping method price doesn't displayed in the "Order Totals" area
- #9481: Broken design of the Expiration Date field for CC payment method
- #9492: Dataflow export doesn't recognize absolute path
- #9493: Buggy Sorting in Manage Tax Rates - Mantis
- #9505: Missing echo statement in blank/default/template/shipping/tracking/popup.phtml
- #9517: Impossible to set custom admin theme in configuration
- #9536: User permissions - Manage Attributes setup
- #9540: Google Base Adding SID to urls in multi domain environmnet
- #9544: Zero tax total folding/unfolding
- #9556: Fatal error during Store View creating
- #9566: table rate shipping uploading csv broken
- #9596: Store-specific payment method name not in order email
- #9611: Not correct message, when you remove the product.
- #9619: On front-end Serch is not working
- #9622: Unable to add Configurable product to the shopping cart
- #9639: Design crushing and SQL-error in admin Dashboard
- #9649: Fatal error after reordering orders that contains gift message
- #9651: Total revenu always 0 on Google Analytics
- #9657: Email to a friend -> User can send more than 5 emails in an hour
- #9659: Email to a Friend -> "Add Recipient" button doesn't work
- #9660: newsletter subscribers: "Select All" working as select visible
- #9665: Export action on Manage Customers and Newsletter Subscribers exports only visible page content
- #9683: Orders: Function "Move to shopping cart" does not work.
- #9684: Orders: Action "Hold" leads to fatal error.
- #9685: No tax data in Reports - Sales - Tax
- #9688: Incorrect update qty of the bundle product in the shopping cart
- #9695: Manage Attribute Sets: Does not create new group
- #9696: Unable to assign existing products to any web sites
- #9697: Enable/Disable status works incorrect
- #9699: Blank theme :: Pay Pal's Review page :: button doesn't work + products names doesn't shows
- #9700: Search synonym does not work
- #9707: Customers->Manage Customers->*user* - orders with DP doesn't displayed
- #9708: Manage Attribute Sets: Error when creating and deleting groups
- #9711: Google checkout are returning Comments History with HTML tags
- #9712: Parameter "Maximum Package Weight ", leads to error 404.
- #9716: Creating of Bundle Product -> SQLSTATE error
- #9717: "Shipment email not sent" status does not change when you send a letter.
- #9738: Downloadable product + Tax Rules = error 404
- #9742: Notice on products sitemap
- #9743: Wrong count of related products, upsells and crosssells in admin
- #9760: Free Shipping : 'For matching items only' incorrect works with USPS + FedEx method
-
- Fixed Bundle with custom options final price calculation
- Fixed CatalogSearch events
- Fixed EAV attribute save bug
- Fixed EAV use joinAttribute method in conditions addAttributeToFilter method
- Fixed MySQL 4.1 bug with NO_AUTO_VALUE_ON_ZERO mode and ALTER TABLE command
- Fixed Online customers
- Fixed REQUEST_URI for GA
- Fixed Varieb_Db_Select::resetJoinLeft (find tables in conditions)
- Fixed Varien_Data_Collection_Db::getSelectCountSql
- Fixed _joinAttributeToSelect for abstract catalog collection (using attribute in select result and filter condition)
- Fixed adding product to shopping cart
- Fixed admin notification window block ACL
- Fixed autobinding unescaped SQL variables
- Fixed bug with categories tree interface after switching store
- Fixed catalog price rule validation (case if rule is wrong: need to remove existing generated price changes)
- Fixed cleanup call in catalog index
- Fixed command line installation with index.php
- Fixed customer and product grid performance in admin
- Fixed cybersource payment for virtual order
- Fixed generate xml string for config cache (0 value was ignored)
- Fixed getting table names during installation
- Fixed refreshing catalog rewrites after save catalog configuration and url resource model for getting static attributes value
- Fixed reindex prices after saving catalog configuration section
- Fixed reorder of grouped products
- Fixed tax data joining (join tax classes just for special cases)
- Fixed tierprice rendering for different product types
- Fixed translations in permissions titles
- Fixed PayPalUk Redirect url wrong type
- Fixed create unique index in install
- Fixed catalog product index
- Fixed session validate and re-validate sent cookie
- Added customer group id for price condition in advanced search, replaced 'or' on 'in' for price layered navigation condition
- Fixed Google Checkout displaying of button when it is disabled
- Fixed PayPal css/html
- Fixed USPS Express Mail free shipping
- Fixed applying catalog price rule with empty from date
- Fixed catalog search in multistore setup
- Fixed checkout crosssell block: when there are no products in cart, the filter was working incorrect
- Fixed displaying of shipping name in orders history (if there are only downloadable or virtual products in orders)
- Fixed displaying of uploaded files; changed redirecting after log in action while trying to download is not shearable link
- Fixed downloadable products renderers for multishipping checkout
- Fixed fixed amount product taxes
- Fixed foreign key upgrade in core DB upgrade 0.8.10-0.8.11
- Fixed getting massaction_key from POST
- Fixed issues with applying coupon codes
- Fixed js error in manage rules interface
- Fixed downlodable products admin interface in IE
- Updated Flex-Javascript bridge, fixed IE/Safari issues
- Added applying frontend translation when sending emails from admin
- Fixed recreating new instances of Flex-Ajax bridges on hide/display flash objects
- Fixed category selection in URL-rewrites management form
- Fixed fatal error in downloader
- Fixed command line installer
- Fixed fixed amount product taxes for products without discounts
- Fixed hiding of flex uploader after removing row of downloadbale sample|link
- Fixed FPT editing for bundle products
- Fixed generatting filenames for create custom extensions interface in Windows
- Fixed calling final step of dataflow import
- Fixed bundle js for calculating children with FPT
- Fixed grid to select products SKU in price rules in IE6/7
- Fixed duplicate diplaying prices in bundle product price ranges
- Fixed displaying category image in blank theme
- Fixed cross sells issues on frontend
- Fixed serialized data checking when reading FPT data from order item
- Fixed checking order status for downloadable products to become available
- Fixed #9757: Paypal Payment Pro Direct not visible
-
-
-CHANGES:
-
- Upgraded ZF library to version 1.7.2 (r13445 from http://framework.zend.com/svn/framework/standard/trunk/library/Zend)
- Added downlodable product type
- Implented fulltext search
- Added layred navigation to search results
- Added option to disable google checkout for selected products
- Added fixed amount product taxes
- Moved information about product visibility to catalog_product_category_index
- Changed Mage::app()->isInstalled to Mage::isInstalled to prevent db upgrades
- Removed session ID encryption
- Changed catalogindex price to store prices per website
- Changed modules dependencies: Mage_Shipment and Mage_Payment now depend on Mage_Catalog, Mage_GoogleCheckout depends on Mage_Payment, Mage_CatalogInventory doesn't depend on Mage_Sales
- Added "Add Field with URL" option for product export
- Added configuration field to include some additional output on the HTML page before head closing tag
- Added Spanish - Costa Rica locale
- Extended Mage_Adminhtml_Controller_Action->_prepareDownloadResponse() to avoid copy-pasting in admin controllers
- Removed adding ?ft parameter in admin to prevent the issues it caused
- Made category URL suffix to be .html by default
- Added setting body class on
tag for admin pages (similar to frontend - full action name separated by dashes)
- Added local.xml.additional file to list/explain possible additional configuration nodes/values for local.xml
- Added currency rates into order info box in backend
- Added ability to display form buttons on bottom in admin container widget, fixed button levels
- Added ability to use memcached to store sessions and to be used as cache backend
- Added additional permissions to WS api, fixed bugs with custom permissions
- Added option "Disable Guest Checkout if cart contains downloadable items"
- Removed store view name from page titles on catalog pages
- Commented out required_once in lib/Zend
- Added permanent redirect option for URL Rewrites
- Added ability to display custom child blocks on success page
- Added collecting results of non-asynchronous event handlers in adminhtml/events.js
- Added confirmation dialog before switching from 'Images' and 'Downloadable Information' tabs in product edit form to prevent losing selected files
- Added firing 'tabChangeBefore' event before switching tab in adminhtml/tabs.js (event handler can return 'cannotchange' to prevent switching)
- Rewritten URL Rewrite Management interface
- Added checking of file size before uploading
- Added downloadable order items pdf renderers
- Added downloadable products templates to blank, iphone, modern theme
- Added flex uploader source code
- Added support of allowed tags into Mage_Core_Helper_Abstract->htmlEscape() method
- Added unquoting autobinded quoted values in SQL adapter
- Added validation for selected, but not uploaded files
- Updated downloader version to 1.2.0
- Changed app/etc/local.xml* license to AFL
- Added autoguessing mime type of a file if mimemagic extension is not installed
-
-
-NOTES:
-
- Please check the SVN log if you are looking for the changes that are not listed here.
diff --git a/app/Mage.php b/app/Mage.php
index 9b39268796..6702f50c6a 100644
--- a/app/Mage.php
+++ b/app/Mage.php
@@ -31,8 +31,8 @@
Mage::register('original_include_path', get_include_path());
if (defined('COMPILER_INCLUDE_PATH')) {
- $app_path = COMPILER_INCLUDE_PATH;
- set_include_path($app_path . PS . Mage::registry('original_include_path'));
+ $appPath = COMPILER_INCLUDE_PATH;
+ set_include_path($appPath . PS . Mage::registry('original_include_path'));
include_once "Mage_Core_functions.php";
include_once "Varien_Autoload.php";
} else {
@@ -44,8 +44,8 @@
$paths[] = BP . DS . 'app' . DS . 'code' . DS . 'core';
$paths[] = BP . DS . 'lib';
- $app_path = implode(PS, $paths);
- set_include_path($app_path . PS . Mage::registry('original_include_path'));
+ $appPath = implode(PS, $paths);
+ set_include_path($appPath . PS . Mage::registry('original_include_path'));
include_once "Mage/Core/functions.php";
include_once "Varien/Autoload.php";
}
@@ -57,13 +57,21 @@
*
* @author Magento Core Team
*/
-final class Mage {
+final class Mage
+{
/**
* Registry collection
*
* @var array
*/
- static private $_registry = array();
+ static private $_registry = array();
+
+ /**
+ * Application root absolute path
+ *
+ * @var string
+ */
+ static private $_appRoot;
/**
* Application model
@@ -72,19 +80,63 @@ final class Mage {
*/
static private $_app;
- static private $_useCache = array();
+ /**
+ * Config Model
+ *
+ * @var Mage_Core_Model_Config
+ */
+ static private $_config;
+
+ /**
+ * Event Collection Object
+ *
+ * @var Varien_Event_Collection
+ */
+ static private $_events;
+ /**
+ * Object cache instance
+ *
+ * @var Varien_Object_Cache
+ */
static private $_objects;
- static private $_isDownloader = false;
+ /**
+ * Is downloader flag
+ *
+ * @var bool
+ */
+ static private $_isDownloader = false;
- static private $_isDeveloperMode = false;
+ /**
+ * Is developer mode flag
+ *
+ * @var bool
+ */
+ static private $_isDeveloperMode = false;
- public static $headersSentThrowsException = true;
+ /**
+ * Is allow throw Exception about headers already sent
+ *
+ * @var bool
+ */
+ public static $headersSentThrowsException = true;
+ /**
+ * Is installed flag
+ *
+ * @var bool
+ */
+ static private $_isInstalled;
+
+ /**
+ * Retrieve current Magento version
+ *
+ * @return string
+ */
public static function getVersion()
{
- return '1.3.2.4';
+ return '1.4.0.0-alpha1';
}
/**
@@ -93,10 +145,11 @@ public static function getVersion()
*/
public static function reset()
{
- self::$_registry = array();
- self::$_app = null;
- self::$_useCache = array();
- self::$_objects = null;
+ self::$_registry = array();
+ self::$_app = null;
+ self::$_config = null;
+ self::$_events = null;
+ self::$_objects = null;
self::$_isDownloader = false;
self::$_isDeveloperMode = false;
// do not reset $headersSentThrowsException
@@ -108,22 +161,28 @@ public static function reset()
* @param string $key
* @param mixed $value
* @param bool $graceful
+ * @throws Mage_Core_Exception
*/
public static function register($key, $value, $graceful = false)
{
- if(isset(self::$_registry[$key])) {
+ if (isset(self::$_registry[$key])) {
if ($graceful) {
return;
}
- Mage::throwException('Mage registry key "'.$key.'" already exists');
+ self::throwException('Mage registry key "'.$key.'" already exists');
}
self::$_registry[$key] = $value;
}
+ /**
+ * Unregister a variable from register by key
+ *
+ * @param string $key
+ */
public static function unregister($key)
{
if (isset(self::$_registry[$key])) {
- if (is_object(self::$_registry[$key]) && (method_exists(self::$_registry[$key],'__destruct'))) {
+ if (is_object(self::$_registry[$key]) && (method_exists(self::$_registry[$key], '__destruct'))) {
self::$_registry[$key]->__destruct();
}
unset(self::$_registry[$key]);
@@ -148,13 +207,15 @@ public static function registry($key)
* Set application root absolute path
*
* @param string $appRoot
+ * @throws Mage_Core_Exception
*/
- public static function setRoot($appRoot='')
+ public static function setRoot($appRoot = '')
{
- if (self::registry('appRoot')) {
+ if (self::$_appRoot) {
return ;
}
- if (''===$appRoot) {
+
+ if ('' === $appRoot) {
// automagically find application root by dirname of Mage.php
$appRoot = dirname(__FILE__);
}
@@ -162,21 +223,30 @@ public static function setRoot($appRoot='')
$appRoot = realpath($appRoot);
if (is_dir($appRoot) and is_readable($appRoot)) {
- Mage::register('appRoot', $appRoot);
+ self::$_appRoot = $appRoot;
} else {
- Mage::throwException($appRoot.' is not a directory or not readable by this user');
+ self::throwException($appRoot . ' is not a directory or not readable by this user');
}
}
/**
- * Get application root absolute path
+ * Retrieve application root absolute path
*
* @return string
*/
-
public static function getRoot()
{
- return Mage::registry('appRoot');
+ return self::$_appRoot;
+ }
+
+ /**
+ * Retrieve Events Collection
+ *
+ * @return Varien_Event_Collection $collection
+ */
+ public static function getEvents()
+ {
+ return self::$_events;
}
/**
@@ -185,7 +255,7 @@ public static function getRoot()
* @param string $key optional, if specified will load this key
* @return Varien_Object_Cache
*/
- public static function objects($key=null)
+ public static function objects($key = null)
{
if (!self::$_objects) {
self::$_objects = new Varien_Object_Cache;
@@ -200,26 +270,48 @@ public static function objects($key=null)
/**
* Retrieve application root absolute path
*
+ * @param string $type
* @return string
*/
- public static function getBaseDir($type='base')
+ public static function getBaseDir($type = 'base')
{
- return Mage::getConfig()->getOptions()->getDir($type);
+ return self::getConfig()->getOptions()->getDir($type);
}
+ /**
+ * Retrieve module absolute path by directory type
+ *
+ * @param string $type
+ * @param string $moduleName
+ * @return string
+ */
public static function getModuleDir($type, $moduleName)
{
- return Mage::getConfig()->getModuleDir($type, $moduleName);
+ return self::getConfig()->getModuleDir($type, $moduleName);
}
- public static function getStoreConfig($path, $id=null)
+ /**
+ * Retrieve config value for store by path
+ *
+ * @param string $path
+ * @param mixed $store
+ * @return mixed
+ */
+ public static function getStoreConfig($path, $store = null)
{
- return self::app()->getStore($id)->getConfig($path);
+ return self::app()->getStore($store)->getConfig($path);
}
- public static function getStoreConfigFlag($path, $id=null)
+ /**
+ * Retrieve config flag for store by path
+ *
+ * @param string $path
+ * @param mixed $store
+ * @return bool
+ */
+ public static function getStoreConfigFlag($path, $store = null)
{
- $flag = strtolower(Mage::getStoreConfig($path, $id));
+ $flag = strtolower(self::getStoreConfig($path, $store));
if (!empty($flag) && 'false'!==$flag && '0'!==$flag) {
return true;
} else {
@@ -233,9 +325,9 @@ public static function getStoreConfigFlag($path, $id=null)
* @param string $type
* @return string
*/
- public static function getBaseUrl($type=Mage_Core_Model_Store::URL_TYPE_LINK, $secure=null)
+ public static function getBaseUrl($type = Mage_Core_Model_Store::URL_TYPE_LINK, $secure = null)
{
- return Mage::app()->getStore()->getBaseUrl($type, $secure);
+ return self::app()->getStore()->getBaseUrl($type, $secure);
}
/**
@@ -245,9 +337,9 @@ public static function getBaseUrl($type=Mage_Core_Model_Store::URL_TYPE_LINK, $s
* @param array $params
* @return string
*/
- public static function getUrl($route='', $params=array())
+ public static function getUrl($route = '', $params = array())
{
- return Mage::getModel('core/url')->getUrl($route, $params);
+ return self::getModel('core/url')->getUrl($route, $params);
}
/**
@@ -257,17 +349,17 @@ public static function getUrl($route='', $params=array())
*/
public static function getDesign()
{
- return Mage::getSingleton('core/design_package');
+ return self::getSingleton('core/design_package');
}
/**
- * Get a config object
+ * Retrieve a config instance
*
* @return Mage_Core_Model_Config
*/
public static function getConfig()
{
- return Mage::registry('config');
+ return self::$_config;
}
/**
@@ -278,14 +370,14 @@ public static function getConfig()
* @param array $arguments
* @param string $observerName
*/
- public static function addObserver($eventName, $callback, $data=array(), $observerName='', $observerClass='')
+ public static function addObserver($eventName, $callback, $data = array(), $observerName = '', $observerClass = '')
{
- if ($observerClass=='') {
+ if ($observerClass == '') {
$observerClass = 'Varien_Event_Observer';
}
$observer = new $observerClass();
$observer->setName($observerName)->addData($data)->setEventName($eventName)->setCallback($callback);
- return Mage::registry('events')->addObserver($observer);
+ return self::getEvents()->addObserver($observer);
}
/**
@@ -296,12 +388,13 @@ public static function addObserver($eventName, $callback, $data=array(), $observ
*
* @param string $name
* @param array $args
+ * @return Mage_Core_Model_App
*/
- public static function dispatchEvent($name, array $data=array())
+ public static function dispatchEvent($name, array $data = array())
{
Varien_Profiler::start('DISPATCH EVENT:'.$name);
- $result = Mage::app()->dispatchEvent($name, $data);
- #$result = Mage::registry('events')->dispatch($name, $data);
+ $result = self::app()->dispatchEvent($name, $data);
+ #$result = self::registry('events')->dispatch($name, $data);
Varien_Profiler::stop('DISPATCH EVENT:'.$name);
return $result;
}
@@ -314,9 +407,9 @@ public static function dispatchEvent($name, array $data=array())
* @param array $arguments
* @return Mage_Core_Model_Abstract
*/
- public static function getModel($modelClass='', $arguments=array())
+ public static function getModel($modelClass = '', $arguments = array())
{
- return Mage::getConfig()->getModelInstance($modelClass, $arguments);
+ return self::getConfig()->getModelInstance($modelClass, $arguments);
}
/**
@@ -329,10 +422,10 @@ public static function getModel($modelClass='', $arguments=array())
public static function getSingleton($modelClass='', array $arguments=array())
{
$registryKey = '_singleton/'.$modelClass;
- if (!Mage::registry($registryKey)) {
- Mage::register($registryKey, Mage::getModel($modelClass, $arguments));
+ if (!self::registry($registryKey)) {
+ self::register($registryKey, self::getModel($modelClass, $arguments));
}
- return Mage::registry($registryKey);
+ return self::registry($registryKey);
}
/**
@@ -342,9 +435,23 @@ public static function getSingleton($modelClass='', array $arguments=array())
* @param array $arguments
* @return Object
*/
- public static function getResourceModel($modelClass, $arguments=array())
+ public static function getResourceModel($modelClass, $arguments = array())
{
- return Mage::getConfig()->getResourceModelInstance($modelClass, $arguments);
+ return self::getConfig()->getResourceModelInstance($modelClass, $arguments);
+ }
+
+ /**
+ * Retrieve Controller instance by ClassName
+ *
+ * @param string $class
+ * @param Mage_Core_Controller_Request_Http $request
+ * @param Mage_Core_Controller_Response_Http $response
+ * @param array $invokeArgs
+ * @return Mage_Core_Controller_Front_Action
+ */
+ public static function getControllerInstance($class, $request, $response, array $invokeArgs = array())
+ {
+ return new $class($request, $response, $invokeArgs);
}
/**
@@ -354,36 +461,45 @@ public static function getResourceModel($modelClass, $arguments=array())
* @param array $arguments
* @return object
*/
- public static function getResourceSingleton($modelClass='', array $arguments=array())
+ public static function getResourceSingleton($modelClass = '', array $arguments = array())
{
$registryKey = '_resource_singleton/'.$modelClass;
- if (!Mage::registry($registryKey)) {
- Mage::register($registryKey, Mage::getResourceModel($modelClass, $arguments));
+ if (!self::registry($registryKey)) {
+ self::register($registryKey, self::getResourceModel($modelClass, $arguments));
}
- return Mage::registry($registryKey);
+ return self::registry($registryKey);
}
/**
- * Deprecated, use Mage::helper()
+ * Deprecated, use self::helper()
*
* @param string $type
* @return object
*/
public static function getBlockSingleton($type)
{
- $action = Mage::app()->getFrontController()->getAction();
+ $action = self::app()->getFrontController()->getAction();
return $action ? $action->getLayout()->getBlockSingleton($type) : false;
}
/**
* Retrieve helper object
*
- * @param helper name $name
- * @return Mage_Core_Helper_Abstract
+ * @param string $name the helper name
+ * @return Mage_Core_Helper_Abstract
*/
public static function helper($name)
{
- return Mage::app()->getHelper($name);
+ if (strpos($name, '/') === false) {
+ $name .= '/data';
+ }
+
+ $registryKey = '_helper/' . $name;
+ if (!self::registry($registryKey)) {
+ $helperClass = self::getConfig()->getHelperClassName($name);
+ self::register($registryKey, new $helperClass);
+ }
+ return self::registry($registryKey);
}
/**
@@ -392,16 +508,23 @@ public static function helper($name)
* @param string $module
* @param string $message
* @param integer $code
+ * @return Mage_Core_Exception
*/
- public static function exception($module='Mage_Core', $message='', $code=0)
+ public static function exception($module = 'Mage_Core', $message = '', $code = 0)
{
$className = $module.'_Exception';
return new $className($message, $code);
}
- public static function throwException($message, $messageStorage=null)
+ /**
+ * Throw Exception
+ *
+ * @param string $message
+ * @param string $messageStorage
+ */
+ public static function throwException($message, $messageStorage = null)
{
- if ($messageStorage && ($storage = Mage::getSingleton($messageStorage))) {
+ if ($messageStorage && ($storage = self::getSingleton($messageStorage))) {
$storage->addError($message);
}
throw new Mage_Core_Exception($message);
@@ -410,29 +533,29 @@ public static function throwException($message, $messageStorage=null)
/**
* Initialize and retrieve application
*
- * @param string $code
- * @param string $type
- * @param string|array $options
- * @return Mage_Core_Model_App
+ * @param string $code
+ * @param string $type
+ * @param string|array $options
+ * @return Mage_Core_Model_App
*/
- public static function app($code = '', $type = 'store', $options=array())
+ public static function app($code = '', $type = 'store', $options = array())
{
if (null === self::$_app) {
- Varien_Profiler::start('mage::app::construct');
+ Varien_Profiler::start('self::app::construct');
self::$_app = new Mage_Core_Model_App();
- Varien_Profiler::stop('mage::app::construct');
+ Varien_Profiler::stop('self::app::construct');
- Mage::setRoot();
- Mage::register('events', new Varien_Event_Collection());
+ self::setRoot();
+ self::$_events = new Varien_Event_Collection();
- Varien_Profiler::start('mage::app::register_config');
- Mage::register('config', new Mage_Core_Model_Config());
- Varien_Profiler::stop('mage::app::register_config');
+ Varien_Profiler::start('self::app::register_config');
+ self::$_config = new Mage_Core_Model_Config();
+ Varien_Profiler::stop('self::app::register_config');
- Varien_Profiler::start('mage::app::init');
+ Varien_Profiler::start('self::app::init');
self::$_app->init($code, $type, $options);
- Varien_Profiler::stop('mage::app::init');
+ Varien_Profiler::stop('self::app::init');
self::$_app->loadAreaPart(Mage_Core_Model_App_Area::AREA_GLOBAL, Mage_Core_Model_App_Area::PART_EVENTS);
}
@@ -451,26 +574,25 @@ public static function run($code = '', $type = 'store', $options=array())
try {
Varien_Profiler::start('mage');
- Varien_Profiler::start('mage::app');
+ Varien_Profiler::start('self::app');
self::app($code, $type, $options);
- Varien_Profiler::stop('mage::app');
+ Varien_Profiler::stop('self::app');
- Varien_Profiler::start('mage::dispatch');
+ Varien_Profiler::start('self::dispatch');
self::app()->getFrontController()->dispatch();
- Varien_Profiler::stop('mage::dispatch');
+ Varien_Profiler::stop('self::dispatch');
Varien_Profiler::stop('mage');
}
catch (Mage_Core_Model_Session_Exception $e) {
- header('Location: ' . Mage::getBaseUrl());
+ header('Location: ' . self::getBaseUrl());
die();
}
catch (Mage_Core_Model_Store_Exception $e) {
$baseUrl = self::getScriptSystemUrl('404');
if (!headers_sent()) {
header('Location: ' . rtrim($baseUrl, '/').'/404/');
- }
- else {
+ } else {
print '';
@@ -486,8 +608,7 @@ public static function run($code = '', $type = 'store', $options=array())
self::dispatchEvent('mage_run_exception', array('exception' => $e));
if (!headers_sent()) {
header('Location:'.self::getUrl('install'));
- }
- else {
+ } else {
self::printException($e);
}
}
@@ -505,8 +626,7 @@ public static function run($code = '', $type = 'store', $options=array())
*/
public static function isInstalled($options = array())
{
- $isInstalled = self::registry('_is_installed');
- if ($isInstalled === null) {
+ if (self::$_isInstalled === null) {
self::setRoot();
if (is_string($options)) {
@@ -520,18 +640,17 @@ public static function isInstalled($options = array())
}
$localConfigFile = self::getRoot() . DS . $etcDir . DS . 'local.xml';
- $isInstalled = false;
+ self::$_isInstalled = false;
if (is_readable($localConfigFile)) {
$localConfig = simplexml_load_file($localConfigFile);
date_default_timezone_set('UTC');
if (($date = $localConfig->global->install->date) && strtotime($date)) {
- $isInstalled = true;
+ self::$_isInstalled = true;
}
}
- self::register('_is_installed', $isInstalled);
}
- return $isInstalled;
+ return self::$_isInstalled;
}
/**
@@ -541,12 +660,12 @@ public static function isInstalled($options = array())
* @param integer $level
* @param string $file
*/
- public static function log($message, $level=null, $file = '')
+ public static function log($message, $level = null, $file = '')
{
if (!self::getConfig()) {
return;
}
- if (!Mage::getStoreConfig('dev/log/active')) {
+ if (!self::getStoreConfig('dev/log/active')) {
return;
}
@@ -554,21 +673,20 @@ public static function log($message, $level=null, $file = '')
$level = is_null($level) ? Zend_Log::DEBUG : $level;
if (empty($file)) {
- $file = Mage::getStoreConfig('dev/log/file');
+ $file = self::getStoreConfig('dev/log/file');
$file = empty($file) ? 'system.log' : $file;
}
try {
if (!isset($loggers[$file])) {
- $logFile = Mage::getBaseDir('var').DS.'log'.DS.$file;
- $logDir = Mage::getBaseDir('var').DS.'log';
+ $logFile = self::getBaseDir('var') . DS . 'log' . DS . $file;
- if (!is_dir(Mage::getBaseDir('var').DS.'log')) {
- mkdir(Mage::getBaseDir('var').DS.'log', 0777);
+ if (!is_dir(self::getBaseDir('var').DS.'log')) {
+ mkdir(self::getBaseDir('var').DS.'log', 0777);
}
if (!file_exists($logFile)) {
- file_put_contents($logFile,'');
+ file_put_contents($logFile, '');
chmod($logFile, 0777);
}
@@ -585,18 +703,22 @@ public static function log($message, $level=null, $file = '')
$loggers[$file]->log($message, $level);
}
- catch (Exception $e){
-
+ catch (Exception $e) {
}
}
+ /**
+ * Write exception to log
+ *
+ * @param Exception $e
+ */
public static function logException(Exception $e)
{
if (!self::getConfig()) {
return;
}
- $file = Mage::getStoreConfig('dev/log/exception_file');
- self::log("\n".(string)$e, Zend_Log::ERR, $file);
+ $file = self::getStoreConfig('dev/log/exception_file');
+ self::log("\n" . $e->__toString(), Zend_Log::ERR, $file);
}
/**
@@ -638,10 +760,9 @@ public static function printException(Exception $e, $extra = '')
print $e->getMessage() . "\n\n";
print $e->getTraceAsString();
print '';
- }
- else {
+ } else {
self::getConfig()->createDirIfNotExists(self::getBaseDir('var') . DS . 'report');
- $reportId = intval(microtime(true) * rand(100, 1000));
+ $reportId = abs(intval(microtime(true) * rand(100, 1000)));
$reportFile = self::getBaseDir('var') . DS . 'report' . DS . $reportId;
$reportData = array(
!empty($extra) ? $extra . "\n\n" : '' . $e->getMessage(),
@@ -656,7 +777,8 @@ public static function printException(Exception $e, $extra = '')
try {
$storeCode = self::app()->getStore()->getCode();
}
- catch (Exception $e) {}
+ catch (Exception $e) {
+ }
$baseUrl = self::getScriptSystemUrl('report', true);
$reportUrl = rtrim($baseUrl, '/') . '/report/?id='
@@ -664,8 +786,7 @@ public static function printException(Exception $e, $extra = '')
if (!headers_sent()) {
header('Location: ' . $reportUrl);
- }
- else {
+ } else {
print '';
@@ -693,8 +814,8 @@ public static function getScriptSystemUrl($folder, $exitIfNot = false)
$baseUrl = str_replace(DS, '/', $runDirUrl);
} else {
$runDirUrlArray = explode('/', $runDirUrl);
- $runDirArray = explode('/', $runDir);
- $count = count($runDirArray);
+ $runDirArray = explode('/', $runDir);
+ $count = count($runDirArray);
for ($i=0; $i < $count; $i++) {
array_pop($runDirUrlArray);
@@ -706,7 +827,7 @@ public static function getScriptSystemUrl($folder, $exitIfNot = false)
if (is_dir($_runDir.$folder)) {
$_runDirUrl = implode('/', $runDirUrlArray);
- $baseUrl = str_replace(DS, '/', $_runDirUrl);
+ $baseUrl = str_replace(DS, '/', $_runDirUrl);
break;
}
}
@@ -725,7 +846,12 @@ public static function getScriptSystemUrl($folder, $exitIfNot = false)
return $baseUrl;
}
- public static function setIsDownloader($flag=true)
+ /**
+ * Set is downloader flag
+ *
+ * @param bool $flag
+ */
+ public static function setIsDownloader($flag = true)
{
self::$_isDownloader = $flag;
}
diff --git a/app/code/core/Mage/Admin/Model/User.php b/app/code/core/Mage/Admin/Model/User.php
index 1c7d85ae06..aee3ccb533 100644
--- a/app/code/core/Mage/Admin/Model/User.php
+++ b/app/code/core/Mage/Admin/Model/User.php
@@ -36,6 +36,7 @@ class Mage_Admin_Model_User extends Mage_Core_Model_Abstract
const XML_PATH_FORGOT_EMAIL_TEMPLATE = 'admin/emails/forgot_email_template';
const XML_PATH_FORGOT_EMAIL_IDENTITY = 'admin/emails/forgot_email_identity';
const XML_PATH_STARTUP_PAGE = 'admin/startup/page';
+ const MIN_PASSWORD_LENGTH = 7;
protected $_eventPrefix = 'admin_user';
@@ -371,7 +372,7 @@ public function getStartupPageUrl()
$startupPage = Mage::getStoreConfig(self::XML_PATH_STARTUP_PAGE);
$aclResource = 'admin/' . $startupPage;
if (Mage::getSingleton('admin/session')->isAllowed($aclResource)) {
- $nodePath = 'adminhtml/menu/' . join('/children/', split('/', $startupPage)) . '/action';
+ $nodePath = 'adminhtml/menu/' . join('/children/', explode('/', $startupPage)) . '/action';
if ($url = Mage::getConfig()->getNode($nodePath)) {
return $url;
}
@@ -379,4 +380,54 @@ public function getStartupPageUrl()
return $this->findFirstAvailableMenu();
}
+ /**
+ * Validate user attribute values.
+ * Returns TRUE or array of errors.
+ *
+ * @return mixed
+ */
+ public function validate()
+ {
+ $errors = array();
+
+ if (!Zend_Validate::is($this->getUsername(), 'NotEmpty')) {
+ $errors[] = Mage::helper('adminhtml')->__('User Name is required field.');
+ }
+
+ if (!Zend_Validate::is($this->getFirstname(), 'NotEmpty')) {
+ $errors[] = Mage::helper('adminhtml')->__('First Name is required field.');
+ }
+
+ if (!Zend_Validate::is($this->getLastname(), 'NotEmpty')) {
+ $errors[] = Mage::helper('adminhtml')->__('Last Name is required field.');
+ }
+
+ if (!Zend_Validate::is($this->getEmail(), 'EmailAddress')) {
+ $errors[] = Mage::helper('adminhtml')->__('Please enter a valid email.');
+ }
+
+ if ($this->hasNewPassword()) {
+ if (Mage::helper('core/string')->strlen($this->getNewPassword()) < self::MIN_PASSWORD_LENGTH) {
+ $errors[] = Mage::helper('adminhtml')->__('Password must be at least of %d characters.', self::MIN_PASSWORD_LENGTH);
+ }
+
+ if (!preg_match('/[a-z]/iu', $this->getNewPassword()) || !preg_match('/[0-9]/u', $this->getNewPassword())) {
+ $errors[] = Mage::helper('adminhtml')->__('Password must include both numeric and alphabetic characters.');
+ }
+
+ if ($this->hasPasswordConfirmation() && $this->getNewPassword() != $this->getPasswordConfirmation()) {
+ $errors[] = Mage::helper('adminhtml')->__('Password confirmation must be same as password.');
+ }
+ }
+
+ if ($this->userExists()) {
+ $errors[] = Mage::helper('adminhtml')->__('User with the same User Name or Email aleady exists');
+ }
+
+ if (empty($errors)) {
+ return true;
+ }
+ return $errors;
+ }
+
}
diff --git a/app/code/core/Mage/Admin/etc/config.xml b/app/code/core/Mage/Admin/etc/config.xml
index b3ff73d82a..2a7e371ce3 100644
--- a/app/code/core/Mage/Admin/etc/config.xml
+++ b/app/code/core/Mage/Admin/etc/config.xml
@@ -28,7 +28,7 @@
- 0.7.1
+ 0.7.2
diff --git a/app/code/core/Mage/Admin/sql/admin_setup/mysql4-install-0.7.0.php b/app/code/core/Mage/Admin/sql/admin_setup/mysql4-install-0.7.0.php
index 00302615f2..5c5462f388 100644
--- a/app/code/core/Mage/Admin/sql/admin_setup/mysql4-install-0.7.0.php
+++ b/app/code/core/Mage/Admin/sql/admin_setup/mysql4-install-0.7.0.php
@@ -88,9 +88,6 @@
`is_active` tinyint(1) NOT NULL default '1',
PRIMARY KEY (`user_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Users';
-
-insert into {$this->getTable('admin_user')}(`user_id`,`firstname`,`lastname`,`email`,`username`,`password`,`created`,`modified`,`logdate`,`lognum`,`reload_acl_flag`,`is_active`) values (1,'admin','admin','admin@your_domain.com','admin','4297f44b13955235245b2497399d7a93',NOW(),NOW(),NOW(),1,0,1);
-
- ");
+");
$installer->endSetup();
diff --git a/app/code/core/Mage/Adminhtml/Block/Api/Role/Grid/User.php b/app/code/core/Mage/Adminhtml/Block/Api/Role/Grid/User.php
index e4ae7ae1ae..268bb661e6 100644
--- a/app/code/core/Mage/Adminhtml/Block/Api/Role/Grid/User.php
+++ b/app/code/core/Mage/Adminhtml/Block/Api/Role/Grid/User.php
@@ -165,7 +165,7 @@ protected function _getUsers($json=false)
if ( $json ) {
$jsonUsers = Array();
foreach($users as $usrid) $jsonUsers[$usrid] = 0;
- return Zend_Json::encode((object)$jsonUsers);
+ return Mage::helper('core')->jsonEncode((object)$jsonUsers);
} else {
return array_values($users);
}
diff --git a/app/code/core/Mage/Adminhtml/Block/Api/Tab/Rolesedit.php b/app/code/core/Mage/Adminhtml/Block/Api/Tab/Rolesedit.php
index da2bcbd835..522717b75e 100644
--- a/app/code/core/Mage/Adminhtml/Block/Api/Tab/Rolesedit.php
+++ b/app/code/core/Mage/Adminhtml/Block/Api/Tab/Rolesedit.php
@@ -63,7 +63,7 @@ public function getResTreeJson()
$rootArray = $this->_getNodeJson($resources,1);
- $json = Zend_Json::encode(isset($rootArray['children']) ? $rootArray['children'] : array());
+ $json = Mage::helper('core')->jsonEncode(isset($rootArray['children']) ? $rootArray['children'] : array());
return $json;
}
diff --git a/app/code/core/Mage/Adminhtml/Block/Api/User/Edit/Tab/Main.php b/app/code/core/Mage/Adminhtml/Block/Api/User/Edit/Tab/Main.php
index b02f24424c..54f186078e 100644
--- a/app/code/core/Mage/Adminhtml/Block/Api/User/Edit/Tab/Main.php
+++ b/app/code/core/Mage/Adminhtml/Block/Api/User/Edit/Tab/Main.php
@@ -94,7 +94,7 @@ protected function _prepareForm()
'label' => Mage::helper('adminhtml')->__('New Api Key'),
'id' => 'new_pass',
'title' => Mage::helper('adminhtml')->__('New Api Key'),
- 'class' => 'input-text validate-password',
+ 'class' => 'input-text validate-admin-password',
));
$fieldset->addField('confirmation', 'password', array(
@@ -110,7 +110,7 @@ protected function _prepareForm()
'label' => Mage::helper('adminhtml')->__('Api Key'),
'id' => 'customer_pass',
'title' => Mage::helper('adminhtml')->__('Api Key'),
- 'class' => 'input-text required-entry validate-password',
+ 'class' => 'input-text required-entry validate-admin-password',
'required' => true,
));
$fieldset->addField('confirmation', 'password', array(
diff --git a/app/code/core/Mage/Adminhtml/Block/Api/User/Edit/Tab/Roles.php b/app/code/core/Mage/Adminhtml/Block/Api/User/Edit/Tab/Roles.php
index cfd1335730..9e1e5f65a1 100644
--- a/app/code/core/Mage/Adminhtml/Block/Api/User/Edit/Tab/Roles.php
+++ b/app/code/core/Mage/Adminhtml/Block/Api/User/Edit/Tab/Roles.php
@@ -110,7 +110,7 @@ protected function _getSelectedRoles($json=false)
if ($json) {
$jsonRoles = Array();
foreach($uRoles as $urid) $jsonRoles[$urid] = 0;
- return Zend_Json::encode((object)$jsonRoles);
+ return Mage::helper('core')->jsonEncode((object)$jsonRoles);
} else {
return $uRoles;
}
diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Category/Abstract.php b/app/code/core/Mage/Adminhtml/Block/Catalog/Category/Abstract.php
index 40e90c125f..51c985d3e8 100644
--- a/app/code/core/Mage/Adminhtml/Block/Catalog/Category/Abstract.php
+++ b/app/code/core/Mage/Adminhtml/Block/Catalog/Category/Abstract.php
@@ -39,6 +39,11 @@ public function __construct()
parent::__construct();
}
+ /**
+ * Retrieve current category instance
+ *
+ * @return Mage_Catalog_Model_Category
+ */
public function getCategory()
{
return Mage::registry('category');
diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Category/Edit/Form.php b/app/code/core/Mage/Adminhtml/Block/Catalog/Category/Edit/Form.php
index 008d765080..c79ba06c52 100644
--- a/app/code/core/Mage/Adminhtml/Block/Catalog/Category/Edit/Form.php
+++ b/app/code/core/Mage/Adminhtml/Block/Catalog/Category/Edit/Form.php
@@ -75,11 +75,12 @@ protected function _prepareLayout()
}
if (!$this->getCategory()->isReadonly()) {
+ $resetPath = $this->getCategory()->getId() ? '*/*/edit' : '*/*/add';
$this->setChild('reset_button',
$this->getLayout()->createBlock('adminhtml/widget_button')
->setData(array(
'label' => Mage::helper('catalog')->__('Reset'),
- 'onclick' => "categoryReset('".$this->getUrl('*/*/edit', array('_current'=>true))."',true)"
+ 'onclick' => "categoryReset('".$this->getUrl($resetPath, array('_current'=>true))."',true)"
))
);
}
@@ -186,11 +187,24 @@ public function getDeleteUrl(array $args = array())
return $this->getUrl('*/*/delete', $params);
}
+ /**
+ * Return URL for refresh input element 'path' in form
+ *
+ * @param array $args
+ * @return string
+ */
+ public function getRefreshPathUrl(array $args = array())
+ {
+ $params = array('_current'=>true);
+ $params = array_merge($params, $args);
+ return $this->getUrl('*/*/refreshPath', $params);
+ }
+
public function getProductsJson()
{
$products = $this->getCategory()->getProductsPosition();
if (!empty($products)) {
- return Zend_Json::encode($products);
+ return Mage::helper('core')->jsonEncode($products);
}
return '{}';
}
diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Category/Helper/Sortby/Available.php b/app/code/core/Mage/Adminhtml/Block/Catalog/Category/Helper/Sortby/Available.php
index 24d0c40ce1..879bd77150 100644
--- a/app/code/core/Mage/Adminhtml/Block/Catalog/Category/Helper/Sortby/Available.php
+++ b/app/code/core/Mage/Adminhtml/Block/Catalog/Category/Helper/Sortby/Available.php
@@ -1,68 +1,67 @@
-
- */
-class Mage_Adminhtml_Block_Catalog_Category_Helper_Sortby_Available
- extends Varien_Data_Form_Element_Multiselect
-{
-/**
- * Retrieve Element HTML fragment
- *
- * @return string
- */
- public function getElementHtml()
- {
- $disabled = false;
- if (!$this->getValue()) {
- $this->setData('disabled', 'disabled');
- $disabled = true;
- }
- $html = parent::getElementHtml();
-
- $htmlId = 'use_config_' . $this->getHtmlId();
- $html .= 'getReadonly()) {
- $html .= ' disabled="disabled"';
- }
-
- $html .= 'onclick="toggleValueElements(this, this.parentNode);" class="checkbox" type="checkbox">';
-
- $html .= ' ';
- $html .= '';
-
- return $html;
- }
-}
+
+ */
+class Mage_Adminhtml_Block_Catalog_Category_Helper_Sortby_Available
+ extends Varien_Data_Form_Element_Multiselect
+{
+/**
+ * Retrieve Element HTML fragment
+ *
+ * @return string
+ */
+ public function getElementHtml()
+ {
+ $disabled = false;
+ if (!$this->getValue()) {
+ $this->setData('disabled', 'disabled');
+ $disabled = true;
+ }
+ $html = parent::getElementHtml();
+ $htmlId = 'use_config_' . $this->getHtmlId();
+ $html .= 'getReadonly()) {
+ $html .= ' disabled="disabled"';
+ }
+
+ $html .= 'onclick="toggleValueElements(this, this.parentNode);" class="checkbox" type="checkbox">';
+
+ $html .= ' ';
+ $html .= '';
+
+ return $html;
+ }
+}
diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Category/Helper/Sortby/Default.php b/app/code/core/Mage/Adminhtml/Block/Catalog/Category/Helper/Sortby/Default.php
index 9ed1bc3e84..6d5d74e9c9 100644
--- a/app/code/core/Mage/Adminhtml/Block/Catalog/Category/Helper/Sortby/Default.php
+++ b/app/code/core/Mage/Adminhtml/Block/Catalog/Category/Helper/Sortby/Default.php
@@ -1,68 +1,67 @@
-
- */
-class Mage_Adminhtml_Block_Catalog_Category_Helper_Sortby_Default
- extends Varien_Data_Form_Element_Select
-{
- /**
- * Retrieve Element HTML fragment
- *
- * @return string
- */
- public function getElementHtml()
- {
- $disabled = false;
- if (!$this->getValue()) {
- $this->setData('disabled', 'disabled');
- $disabled = true;
- }
- $html = parent::getElementHtml();
-
- $htmlId = 'use_config_' . $this->getHtmlId();
- $html .= 'getReadonly()) {
- $html .= ' disabled="disabled"';
- }
- $html .= 'onclick="toggleValueElements(this, this.parentNode);" class="checkbox" type="checkbox">';
-
-
-
- $html .= ' ';
- $html .= '';
-
- return $html;
- }
-}
+
+ */
+class Mage_Adminhtml_Block_Catalog_Category_Helper_Sortby_Default
+ extends Varien_Data_Form_Element_Select
+{
+ /**
+ * Retrieve Element HTML fragment
+ *
+ * @return string
+ */
+ public function getElementHtml()
+ {
+ $disabled = false;
+ if (!$this->getValue()) {
+ $this->setData('disabled', 'disabled');
+ $disabled = true;
+ }
+ $html = parent::getElementHtml();
+ $htmlId = 'use_config_' . $this->getHtmlId();
+ $html .= 'getReadonly()) {
+ $html .= ' disabled="disabled"';
+ }
+ $html .= 'onclick="toggleValueElements(this, this.parentNode);" class="checkbox" type="checkbox">';
+
+
+
+ $html .= ' ';
+ $html .= '';
+
+ return $html;
+ }
+}
diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Category/Tree.php b/app/code/core/Mage/Adminhtml/Block/Catalog/Category/Tree.php
index 24d482278f..993c5bbc67 100644
--- a/app/code/core/Mage/Adminhtml/Block/Catalog/Category/Tree.php
+++ b/app/code/core/Mage/Adminhtml/Block/Catalog/Category/Tree.php
@@ -174,7 +174,7 @@ public function getTree($parenNodeCategory=null)
public function getTreeJson($parenNodeCategory=null)
{
$rootArray = $this->_getNodeJson($this->getRoot($parenNodeCategory));
- $json = Zend_Json::encode(isset($rootArray['children']) ? $rootArray['children'] : array());
+ $json = Mage::helper('core')->jsonEncode(isset($rootArray['children']) ? $rootArray['children'] : array());
return $json;
}
@@ -190,7 +190,9 @@ public function getBreadcrumbsJavascript($path, $javascriptVarName)
if (empty($path)) {
return '';
}
- $categories = Mage::getResourceSingleton('catalog/category_tree')->loadBreadcrumbsArray($path);
+
+ $categories = Mage::getResourceSingleton('catalog/category_tree')
+ ->setStoreId($this->getStore()->getId())->loadBreadcrumbsArray($path);
if (empty($categories)) {
return '';
}
@@ -199,7 +201,7 @@ public function getBreadcrumbsJavascript($path, $javascriptVarName)
}
return
'';
}
diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Attribute/Edit.php b/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Attribute/Edit.php
index 67e7171cf5..8de5e13945 100644
--- a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Attribute/Edit.php
+++ b/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Attribute/Edit.php
@@ -53,18 +53,19 @@ public function __construct()
'level' => -1
)
);
+ } else {
+ $this->_addButton(
+ 'save_and_edit_button',
+ array(
+ 'label' => Mage::helper('catalog')->__('Save And Continue Edit'),
+ 'onclick' => 'saveAndContinueEdit()',
+ 'class' => 'save'
+ ),
+ 100
+ );
}
$this->_updateButton('save', 'label', Mage::helper('catalog')->__('Save Attribute'));
- $this->_addButton(
- 'save_and_edit_button',
- array(
- 'label' => Mage::helper('catalog')->__('Save And Continue Edit'),
- 'onclick' => 'saveAndContinueEdit()',
- 'class' => 'save'
- ),
- 100
- );
if (! Mage::registry('entity_attribute')->getIsUserDefined()) {
$this->_removeButton('delete');
diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Attribute/Edit/Tab/Main.php b/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Attribute/Edit/Tab/Main.php
index 06ea1114b2..8526e7d60b 100644
--- a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Attribute/Edit/Tab/Main.php
+++ b/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Attribute/Edit/Tab/Main.php
@@ -46,22 +46,23 @@ protected function _prepareForm()
));
$disableAttributeFields = array(
- 'sku' => array(
+ 'sku' => array(
'is_global',
'is_unique',
),
- 'url_key' => array(
+ 'url_key' => array(
'is_unique',
),
- 'status' => array(
- 'is_configurable'
- )
- );
-
- $rewriteAttributeValue = array(
- 'status' => array(
- 'is_configurable' => 0
- )
+ 'status' => array(
+ 'is_configurable',
+ 'is_filterable',
+ 'is_filterable_in_search'
+ ),
+ 'visibility' => array(
+ 'is_configurable',
+ 'is_filterable',
+ 'is_filterable_in_search'
+ ),
);
$fieldset = $form->addFieldset('base_fieldset',
@@ -141,16 +142,19 @@ protected function _prepareForm()
'value' => 'price',
'label' => Mage::helper('catalog')->__('Price')
),
- array(
- 'value' => 'gallery',
- 'label' => Mage::helper('catalog')->__('Gallery')
- ),
array(
'value' => 'media_image',
'label' => Mage::helper('catalog')->__('Media Image')
),
);
+ if ($model->getFrontendInput() == 'gallery') {
+ $inputTypes[] = array(
+ 'value' => 'gallery',
+ 'label' => Mage::helper('catalog')->__('Gallery')
+ );
+ }
+
$response = new Varien_Object();
$response->setTypes(array());
Mage::dispatchEvent('adminhtml_product_attribute_types', array('response'=>$response));
@@ -385,6 +389,7 @@ protected function _prepareForm()
if (isset($disableAttributeFields[$model->getAttributeCode()])) {
foreach ($disableAttributeFields[$model->getAttributeCode()] as $field) {
$form->getElement($field)->setDisabled(1);
+ $form->getElement($field)->setReadonly(1);
}
}
}
@@ -394,12 +399,6 @@ protected function _prepareForm()
$form->addValues($model->getData());
- if ($model->getId() && isset($rewriteAttributeValue[$model->getAttributeCode()])) {
- foreach ($rewriteAttributeValue[$model->getAttributeCode()] as $field => $value) {
- $form->getElement($field)->setValue($value);
- }
- }
-
$form->getElement('apply_to')->setSize(5);
if ($applyTo = $model->getApplyTo()) {
diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Attribute/New/Product/Created.php b/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Attribute/New/Product/Created.php
index f84cde7fd0..d621842598 100644
--- a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Attribute/New/Product/Created.php
+++ b/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Attribute/New/Product/Created.php
@@ -84,6 +84,6 @@ public function getAttributesBlockJson()
$this->getRequest()->getParam('tab') => $this->getChildHtml('attributes')
);
- return Zend_Json::encode($result);
+ return Mage::helper('core')->jsonEncode($result);
}
} // Class Mage_Adminhtml_Block_Catalog_Product_Attribute_New_Product_Created End
\ No newline at end of file
diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Attribute/Set/Main.php b/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Attribute/Set/Main.php
index a754e0a7e9..bca0c3bbcb 100644
--- a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Attribute/Set/Main.php
+++ b/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Attribute/Set/Main.php
@@ -18,25 +18,35 @@
* 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) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
+ * @category Mage
+ * @package Mage_Adminhtml
+ * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/
/**
- * @category Mage
- * @package Mage_Adminhtml
+ * Adminhtml Catalog Attribute Set Main Block
+ *
+ * @category Mage
+ * @package Mage_Adminhtml
* @author Magento Core Team
*/
-
class Mage_Adminhtml_Block_Catalog_Product_Attribute_Set_Main extends Mage_Adminhtml_Block_Template
{
+ /**
+ * Initialize template
+ *
+ */
protected function _construct()
{
$this->setTemplate('catalog/product/attribute/set/main.phtml');
}
+ /**
+ * Prepare Global Layout
+ *
+ * @return Mage_Adminhtml_Block_Catalog_Product_Attribute_Set_Main
+ */
protected function _prepareLayout()
{
$setId = $this->_getSetId();
@@ -50,203 +60,258 @@ protected function _prepareLayout()
);
$this->setChild('delete_group_button',
- $this->getLayout()->createBlock('adminhtml/widget_button')
- ->setData(array(
- 'label' => Mage::helper('catalog')->__('Delete Selected Group'),
- 'onclick' => 'editSet.submit();',
- 'class' => 'delete'
+ $this->getLayout()->createBlock('adminhtml/widget_button')->setData(array(
+ 'label' => Mage::helper('catalog')->__('Delete Selected Group'),
+ 'onclick' => 'editSet.submit();',
+ 'class' => 'delete'
)));
$this->setChild('add_group_button',
- $this->getLayout()->createBlock('adminhtml/widget_button')
- ->setData(array(
- 'label' => Mage::helper('catalog')->__('Add New'),
- 'onclick' => 'editSet.addGroup();',
- 'class' => 'add'
+ $this->getLayout()->createBlock('adminhtml/widget_button')->setData(array(
+ 'label' => Mage::helper('catalog')->__('Add New'),
+ 'onclick' => 'editSet.addGroup();',
+ 'class' => 'add'
)));
$this->setChild('back_button',
- $this->getLayout()->createBlock('adminhtml/widget_button')
- ->setData(array(
- 'label' => Mage::helper('catalog')->__('Back'),
- 'onclick' => 'setLocation(\''.$this->getUrl('*/*/').'\')',
- 'class' => 'back'
+ $this->getLayout()->createBlock('adminhtml/widget_button')->setData(array(
+ 'label' => Mage::helper('catalog')->__('Back'),
+ 'onclick' => 'setLocation(\''.$this->getUrl('*/*/').'\')',
+ 'class' => 'back'
)));
$this->setChild('reset_button',
- $this->getLayout()->createBlock('adminhtml/widget_button')
- ->setData(array(
- 'label' => Mage::helper('catalog')->__('Reset'),
- 'onclick' => 'window.location.reload()'
+ $this->getLayout()->createBlock('adminhtml/widget_button')->setData(array(
+ 'label' => Mage::helper('catalog')->__('Reset'),
+ 'onclick' => 'window.location.reload()'
)));
$this->setChild('save_button',
- $this->getLayout()->createBlock('adminhtml/widget_button')
- ->setData(array(
- 'label' => Mage::helper('catalog')->__('Save Attribute Set'),
- 'onclick' => 'editSet.save();',
- 'class' => 'save'
+ $this->getLayout()->createBlock('adminhtml/widget_button')->setData(array(
+ 'label' => Mage::helper('catalog')->__('Save Attribute Set'),
+ 'onclick' => 'editSet.save();',
+ 'class' => 'save'
)));
$this->setChild('delete_button',
- $this->getLayout()->createBlock('adminhtml/widget_button')
- ->setData(array(
- 'label' => Mage::helper('catalog')->__('Delete Attribute Set'),
- 'onclick' => 'deleteConfirm(\''. $this->jsQuoteEscape(Mage::helper('catalog')->__('All products of this set will be deleted! Are you sure you want to delete this attribute set?')) . '\', \'' . $this->getUrl('*/*/delete', array('id' => $setId)) . '\')',
- 'class' => 'delete'
+ $this->getLayout()->createBlock('adminhtml/widget_button')->setData(array(
+ 'label' => Mage::helper('catalog')->__('Delete Attribute Set'),
+ 'onclick' => 'deleteConfirm(\''. $this->jsQuoteEscape(Mage::helper('catalog')->__('All products of this set will be deleted! Are you sure you want to delete this attribute set?')) . '\', \'' . $this->getUrl('*/*/delete', array('id' => $setId)) . '\')',
+ 'class' => 'delete'
)));
$this->setChild('rename_button',
- $this->getLayout()->createBlock('adminhtml/widget_button')
- ->setData(array(
- 'label' => Mage::helper('catalog')->__('New Set Name'),
- 'onclick' => 'editSet.rename()'
- ))
- );
+ $this->getLayout()->createBlock('adminhtml/widget_button')->setData(array(
+ 'label' => Mage::helper('catalog')->__('New Set Name'),
+ 'onclick' => 'editSet.rename()'
+ )));
+
return parent::_prepareLayout();
}
+ /**
+ * Retrieve Attribute Set Group Tree HTML
+ *
+ * @return string
+ */
public function getGroupTreeHtml()
{
return $this->getChildHtml('group_tree');
}
+ /**
+ * Retrieve Attribute Set Edit Form HTML
+ *
+ * @return string
+ */
public function getSetFormHtml()
{
return $this->getChildHtml('edit_set_form');
}
+ /**
+ * Retrieve Block Header Text
+ *
+ * @return string
+ */
protected function _getHeader()
{
- return Mage::helper('catalog')->__("Edit Attribute Set '%s'", $this->_getSetData()->getAttributeSetName());
+ return Mage::helper('catalog')->__("Edit Attribute Set '%s'", $this->_getAttributeSet()->getAttributeSetName());
}
+ /**
+ * Retrieve Attribute Set Save URL
+ *
+ * @return string
+ */
public function getMoveUrl()
{
return $this->getUrl('*/catalog_product_set/save', array('id' => $this->_getSetId()));
}
+ /**
+ * Retrieve Attribute Set Group Save URL
+ *
+ * @return string
+ */
public function getGroupUrl()
{
return $this->getUrl('*/catalog_product_group/save', array('id' => $this->_getSetId()));
}
+ /**
+ * Retrieve Attribute Set Group Tree as JSON format
+ *
+ * @return string
+ */
public function getGroupTreeJson()
{
+ $items = array();
$setId = $this->_getSetId();
+ /* @var $groups Mage_Eav_Model_Mysql4_Entity_Attribute_Group_Collection */
$groups = Mage::getModel('eav/entity_attribute_group')
- ->getResourceCollection()
- ->setAttributeSetFilter($setId)
- ->load();
+ ->getResourceCollection()
+ ->setAttributeSetFilter($setId)
+ ->load();
- $items = array();
- foreach( $groups as $node ) {
+ $configurable = Mage::getResourceModel('catalog/product_type_configurable_attribute')
+ ->getUsedAttributes($setId);
+
+ /* @var $node Mage_Eav_Model_Entity_Attribute_Group */
+ foreach ($groups as $node) {
$item = array();
- $item['text']= $node->getAttributeGroupName();
- $item['id'] = $node->getAttributeGroupId();
- $item['cls'] = 'folder';
- $item['allowDrop'] = true;
- $item['allowDrag'] = true;
+ $item['text'] = $node->getAttributeGroupName();
+ $item['id'] = $node->getAttributeGroupId();
+ $item['cls'] = 'folder';
+ $item['allowDrop'] = true;
+ $item['allowDrag'] = true;
$nodeChildren = Mage::getModel('eav/entity_attribute')
- ->getResourceCollection()
- ->setAttributeGroupFilter($node->getAttributeGroupId())
- ->addVisibleFilter()
- /**
- * TODO: issue #5126
- * @see Mage_Eav_Model_Mysql4_Entity_Attribute_Collection
- */
- ->checkConfigurableProducts()
- ->load();
-
- if ( $nodeChildren->getSize() > 0 ) {
+ ->getResourceCollection()
+ ->setAttributeGroupFilter($node->getId())
+ ->addVisibleFilter()
+ ->checkConfigurableProducts()
+ ->load();
+
+ if ($nodeChildren->getSize() > 0) {
$item['children'] = array();
- foreach( $nodeChildren->getItems() as $child ) {
- $tmpArr = array();
- $tmpArr['text'] = $child->getAttributeCode();
- $tmpArr['id'] = $child->getAttributeId();
- $tmpArr['cls'] = ( $child->getIsUserDefined() == 0 ) ? 'system-leaf' : 'leaf';
- $tmpArr['allowDrop'] = false;
- $tmpArr['allowDrag'] = true;
- $tmpArr['leaf'] = true;
- $tmpArr['is_user_defined'] = $child->getIsUserDefined();
- // TODO: issue #5126. Template already has reuqired changes
- $tmpArr['is_used_in_configurable'] = false; // (bool)$child->getIsUsedInConfigurable(); // TODO: issue #5126
- $tmpArr['entity_id'] = $child->getEntityAttributeId();
-
- $item['children'][] = $tmpArr;
+ foreach ($nodeChildren->getItems() as $child) {
+ /* @var $child Mage_Eav_Model_Entity_Attribute */
+ $attr = array(
+ 'text' => $child->getAttributeCode(),
+ 'id' => $child->getAttributeId(),
+ 'cls' => (!$child->getIsUserDefined()) ? 'system-leaf' : 'leaf',
+ 'allowDrop' => false,
+ 'allowDrag' => true,
+ 'leaf' => true,
+ 'is_user_defined' => $child->getIsUserDefined(),
+ 'is_configurable' => (int)in_array($child->getAttributeId(), $configurable),
+ 'entity_id' => $child->getEntityId()
+ );
+
+ $item['children'][] = $attr;
}
}
$items[] = $item;
}
- return Zend_Json::encode($items);
+ return Mage::helper('core')->jsonEncode($items);
}
+ /**
+ * Retrieve Unused in Attribute Set Attribute Tree as JSON
+ *
+ * @return string
+ */
public function getAttributeTreeJson()
{
+ $items = array();
$setId = $this->_getSetId();
- $attributesIdsObj = Mage::getModel('eav/entity_attribute')
- ->getResourceCollection()
- ->setAttributeSetFilter($setId)
- ->load();
+ $collection = Mage::getModel('eav/entity_attribute')
+ ->getResourceCollection()
+ ->setAttributeSetFilter($setId)
+ ->load();
+
$attributesIds = array('0');
- foreach( $attributesIdsObj->getItems() as $item ) {
+ /* @var $item Mage_Eav_Model_Entity_Attribute */
+ foreach ($collection->getItems() as $item) {
$attributesIds[] = $item->getAttributeId();
}
- $attributes = Mage::getModel('eav/entity_attribute')
- ->getResourceCollection()
- ->setEntityTypeFilter(Mage::registry('entityType'))
- ->setAttributesExcludeFilter($attributesIds)
- ->addVisibleFilter()
- ->load();
- $items = array();
- foreach( $attributes as $node ) {
- $item = array();
- $item['text']= $node->getAttributeCode();
- $item['id'] = $node->getAttributeId();
- $item['cls'] = 'leaf';
- $item['allowDrop'] = false;
- $item['allowDrag'] = true;
- $item['leaf'] = true;
- $item['is_user_defined'] = $node->getIsUserDefined();
- $item['is_used_in_configurable'] = false;
+ $attributes = Mage::getModel('eav/entity_attribute')
+ ->getResourceCollection()
+ ->setEntityTypeFilter(Mage::registry('entityType'))
+ ->setAttributesExcludeFilter($attributesIds)
+ ->addVisibleFilter()
+ ->load();
+
+ foreach ($attributes as $child) {
+ $attr = array(
+ 'text' => $child->getAttributeCode(),
+ 'id' => $child->getAttributeId(),
+ 'cls' => 'leaf',
+ 'allowDrop' => false,
+ 'allowDrag' => true,
+ 'leaf' => true,
+ 'is_user_defined' => $child->getIsUserDefined(),
+ 'is_configurable' => false,
+ 'entity_id' => $child->getEntityId()
+ );
- $items[] = $item;
+ $items[] = $attr;
}
- if( count($items) == 0 ) {
+ if (count($items) == 0) {
$items[] = array(
- 'text' => Mage::helper('catalog')->__('Empty'),
- 'id' => 'empty',
- 'cls' => 'folder',
+ 'text' => Mage::helper('catalog')->__('Empty'),
+ 'id' => 'empty',
+ 'cls' => 'folder',
'allowDrop' => false,
'allowDrag' => false,
);
}
- return Zend_Json::encode($items);
+ return Mage::helper('core')->jsonEncode($items);
}
+ /**
+ * 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 Save Button HTML
+ *
+ * @return string
+ */
public function getSaveButtonHtml()
{
return $this->getChildHtml('save_button');
}
+ /**
+ * Retrieve Delete Button HTML
+ *
+ * @return string
+ */
public function getDeleteButtonHtml()
{
if ($this->getIsCurrentSetDefault()) {
@@ -255,26 +320,61 @@ public function getDeleteButtonHtml()
return $this->getChildHtml('delete_button');
}
+ /**
+ * Retrieve Delete Group Button HTML
+ *
+ * @return string
+ */
public function getDeleteGroupButton()
{
return $this->getChildHtml('delete_group_button');
}
+ /**
+ * Retrieve Add New Group Button HTML
+ *
+ * @return string
+ */
public function getAddGroupButton()
{
return $this->getChildHtml('add_group_button');
}
+ /**
+ * Retrieve Rename Button HTML
+ *
+ * @return string
+ */
public function getRenameButton()
{
return $this->getChildHtml('rename_button');
}
+ /**
+ * Retrieve current Attribute Set object
+ *
+ * @return Mage_Eav_Model_Entity_Attribute_Set
+ */
+ protected function _getAttributeSet()
+ {
+ return Mage::registry('current_attribute_set');
+ }
+
+ /**
+ * Retrieve current attribute set Id
+ *
+ * @return int
+ */
protected function _getSetId()
{
- return Mage::registry('current_attribute_set')->getId();
+ return $this->_getAttributeSet()->getId();
}
+ /**
+ * Check Current Attribute Set is a default
+ *
+ * @return bool
+ */
public function getIsCurrentSetDefault()
{
$isDefault = $this->getData('is_current_set_default');
@@ -288,14 +388,25 @@ public function getIsCurrentSetDefault()
return $isDefault;
}
+ /**
+ * Retrieve current Attribute Set object
+ *
+ * @deprecated use _getAttributeSet
+ * @return Mage_Eav_Model_Entity_Attribute_Set
+ */
protected function _getSetData()
{
- return Mage::getModel('eav/entity_attribute_set')->load( $this->_getSetId() );
+ return $this->_getAttributeSet();
}
+ /**
+ * Prepare HTML
+ *
+ * @return string
+ */
protected function _toHtml()
{
Mage::dispatchEvent('adminhtml_catalog_product_attribute_set_main_html_before', array('block' => $this));
return parent::_toHtml();
}
-}
\ No newline at end of file
+}
diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Created.php b/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Created.php
index 606f30e16d..318412ac26 100644
--- a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Created.php
+++ b/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Created.php
@@ -1,152 +1,152 @@
-
- */
-class Mage_Adminhtml_Block_Catalog_Product_Created extends Mage_Adminhtml_Block_Widget
-{
- protected $_configurableProduct;
- protected $_product;
-
- public function __construct()
- {
- parent::__construct();
- $this->setTemplate('catalog/product/created.phtml');
- }
-
-
- protected function _prepareLayout()
- {
- $this->setChild(
- 'close_button',
- $this->getLayout()->createBlock('adminhtml/widget_button')
- ->setData(array(
- 'label' => Mage::helper('catalog')->__('Close Window'),
- 'onclick' => 'addProduct(true)'
- ))
- );
- }
-
-
- public function getCloseButtonHtml()
- {
- return $this->getChildHtml('close_button');
- }
-
- public function getProductId()
- {
- return (int) $this->getRequest()->getParam('id');
- }
-
- /**
- * Indentifies edit mode of popup
- *
- * @return boolean
- */
- public function isEdit()
- {
- return (bool) $this->getRequest()->getParam('edit');
- }
-
- /**
- * Retrive serialized json with configurable attributes values of simple
- *
- * @return string
- */
- public function getAttributesJson()
- {
- $result = array();
- foreach ($this->getAttributes() as $attribute) {
- $value = $this->getProduct()->getAttributeText($attribute->getAttributeCode());
-
- $result[] = array(
- 'label' => $value,
- 'value_index' => $this->getProduct()->getData($attribute->getAttributeCode()),
- 'attribute_id' => $attribute->getId()
- );
- }
-
- return Zend_Json::encode($result);
- }
-
- public function getAttributes()
- {
- if ($this->getConfigurableProduct()->getId()) {
- return $this->getConfigurableProduct()->getTypeInstance(true)->getUsedProductAttributes($this->getConfigurableProduct());
- }
-
- $attributes = array();
-
- $attributesIds = $this->getRequest()->getParam('required');
- if ($attributesIds) {
- $attributesIds = explode(',', $attributesIds);
- foreach ($attributesIds as $attributeId) {
- $attribute = $this->getProduct()->getTypeInstance(true)->getAttributeById($attributeId, $this->getProduct());
- if (!$attribute) {
- continue;
- }
- $attributes[] = $attribute;
- }
- }
-
- return $attributes;
- }
-
- /**
- * Retrive configurable product for created/edited simple
- *
- * @return Mage_Catalog_Model_Product
- */
- public function getConfigurableProduct()
- {
- if (is_null($this->_configurableProduct)) {
- $this->_configurableProduct = Mage::getModel('catalog/product')
- ->setStore(0)
- ->load($this->getRequest()->getParam('product'));
- }
- return $this->_configurableProduct;
- }
-
- /**
- * Retrive product
- *
- * @return Mage_Catalog_Model_Product
- */
- public function getProduct()
- {
- if (is_null($this->_product)) {
- $this->_product = Mage::getModel('catalog/product')
- ->setStore(0)
- ->load($this->getRequest()->getParam('id'));
- }
- return $this->_product;
- }
+
+ */
+class Mage_Adminhtml_Block_Catalog_Product_Created extends Mage_Adminhtml_Block_Widget
+{
+ protected $_configurableProduct;
+ protected $_product;
+
+ public function __construct()
+ {
+ parent::__construct();
+ $this->setTemplate('catalog/product/created.phtml');
+ }
+
+
+ protected function _prepareLayout()
+ {
+ $this->setChild(
+ 'close_button',
+ $this->getLayout()->createBlock('adminhtml/widget_button')
+ ->setData(array(
+ 'label' => Mage::helper('catalog')->__('Close Window'),
+ 'onclick' => 'addProduct(true)'
+ ))
+ );
+ }
+
+
+ public function getCloseButtonHtml()
+ {
+ return $this->getChildHtml('close_button');
+ }
+
+ public function getProductId()
+ {
+ return (int) $this->getRequest()->getParam('id');
+ }
+
+ /**
+ * Indentifies edit mode of popup
+ *
+ * @return boolean
+ */
+ public function isEdit()
+ {
+ return (bool) $this->getRequest()->getParam('edit');
+ }
+
+ /**
+ * Retrive serialized json with configurable attributes values of simple
+ *
+ * @return string
+ */
+ public function getAttributesJson()
+ {
+ $result = array();
+ foreach ($this->getAttributes() as $attribute) {
+ $value = $this->getProduct()->getAttributeText($attribute->getAttributeCode());
+
+ $result[] = array(
+ 'label' => $value,
+ 'value_index' => $this->getProduct()->getData($attribute->getAttributeCode()),
+ 'attribute_id' => $attribute->getId()
+ );
+ }
+
+ return Mage::helper('core')->jsonEncode($result);
+ }
+
+ public function getAttributes()
+ {
+ if ($this->getConfigurableProduct()->getId()) {
+ return $this->getConfigurableProduct()->getTypeInstance(true)->getUsedProductAttributes($this->getConfigurableProduct());
+ }
+
+ $attributes = array();
+
+ $attributesIds = $this->getRequest()->getParam('required');
+ if ($attributesIds) {
+ $attributesIds = explode(',', $attributesIds);
+ foreach ($attributesIds as $attributeId) {
+ $attribute = $this->getProduct()->getTypeInstance(true)->getAttributeById($attributeId, $this->getProduct());
+ if (!$attribute) {
+ continue;
+ }
+ $attributes[] = $attribute;
+ }
+ }
+
+ return $attributes;
+ }
+
+ /**
+ * Retrive configurable product for created/edited simple
+ *
+ * @return Mage_Catalog_Model_Product
+ */
+ public function getConfigurableProduct()
+ {
+ if (is_null($this->_configurableProduct)) {
+ $this->_configurableProduct = Mage::getModel('catalog/product')
+ ->setStore(0)
+ ->load($this->getRequest()->getParam('product'));
+ }
+ return $this->_configurableProduct;
+ }
+
+ /**
+ * Retrive product
+ *
+ * @return Mage_Catalog_Model_Product
+ */
+ public function getProduct()
+ {
+ if (is_null($this->_product)) {
+ $this->_product = Mage::getModel('catalog/product')
+ ->setStore(0)
+ ->load($this->getRequest()->getParam('id'));
+ }
+ return $this->_product;
+ }
} // Class Mage_Adminhtml_Block_Catalog_Product_Created End
\ No newline at end of file
diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Attributes/Create.php b/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Attributes/Create.php
index bb71e28d03..ec7caee367 100644
--- a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Attributes/Create.php
+++ b/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Attributes/Create.php
@@ -90,7 +90,7 @@ protected function _toHtml()
$html = parent::_toHtml();
$html .= Mage::helper('adminhtml/js')->getScript(
"var {$this->getJsObjectName()} = new Product.Attributes('{$this->getId()}');\n"
- . "{$this->getJsObjectName()}.setConfig(" . Zend_Json::encode($this->getConfig()->getData()) . ");\n"
+ . "{$this->getJsObjectName()}.setConfig(" . Mage::helper('core')->jsonEncode($this->getConfig()->getData()) . ");\n"
);
return $html;
diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Categories.php b/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Categories.php
index 009f8efcc8..4d99e52969 100644
--- a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Categories.php
+++ b/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Categories.php
@@ -192,7 +192,7 @@ public function getCategoryChildrenJson($categoryId)
$children[] = $this->_getNodeJson($child);
}
- return Zend_Json::encode($children);
+ return Mage::helper('core')->jsonEncode($children);
}
public function getLoadTreeUrl($expanded=null)
diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Super/Config.php b/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Super/Config.php
index 29f90a807c..43bdf22d78 100644
--- a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Super/Config.php
+++ b/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Super/Config.php
@@ -126,7 +126,7 @@ public function getAttributesJson()
if(!$attributes) {
return '[]';
}
- return Zend_Json::encode($attributes);
+ return Mage::helper('core')->jsonEncode($attributes);
}
/**
@@ -145,7 +145,7 @@ public function getLinksJson()
foreach ($products as $product) {
$data[$product->getId()] = $this->getConfigurableSettings($product);
}
- return Zend_Json::encode($data);
+ return Mage::helper('core')->jsonEncode($data);
}
/**
diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Super/Config/Grid/Renderer/Checkbox.php b/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Super/Config/Grid/Renderer/Checkbox.php
index ab1c58aff6..49d14c62a2 100644
--- a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Super/Config/Grid/Renderer/Checkbox.php
+++ b/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Super/Config/Grid/Renderer/Checkbox.php
@@ -67,6 +67,6 @@ public function getAttributesJson(Varien_Object $row)
$result[] = $item;
}
- return Zend_Json::encode($result);
+ return Mage::helper('core')->jsonEncode($result);
}
}// Class Mage_Adminhtml_Block_Catalog_Product_Edit_Tab_Super_Config_Grid_Renderer_Checkbox END
\ No newline at end of file
diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Helper/Form/Gallery/Content.php b/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Helper/Form/Gallery/Content.php
index 83b36bc35c..6bd38b042a 100644
--- a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Helper/Form/Gallery/Content.php
+++ b/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Helper/Form/Gallery/Content.php
@@ -104,7 +104,7 @@ public function getImagesJson()
$image['url'] = Mage::getSingleton('catalog/product_media_config')
->getMediaUrl($image['file']);
}
- return Zend_Json::encode($value['images']);
+ return Mage::helper('core')->jsonEncode($value['images']);
}
}
return '[]';
@@ -119,7 +119,7 @@ public function getImagesValuesJson()
$attribute->getAttributeCode()
);
}
- return Zend_Json::encode($values);
+ return Mage::helper('core')->jsonEncode($values);
}
/**
@@ -164,7 +164,7 @@ public function getMediaAttributes()
public function getImageTypesJson()
{
- return Zend_Json::encode($this->getImageTypes());
+ return Mage::helper('core')->jsonEncode($this->getImageTypes());
}
}
diff --git a/app/code/core/Mage/Adminhtml/Block/Customer/Edit/Renderer/Region.php b/app/code/core/Mage/Adminhtml/Block/Customer/Edit/Renderer/Region.php
index bdffd13d39..586c120073 100644
--- a/app/code/core/Mage/Adminhtml/Block/Customer/Edit/Renderer/Region.php
+++ b/app/code/core/Mage/Adminhtml/Block/Customer/Edit/Renderer/Region.php
@@ -42,6 +42,7 @@ public function render(Varien_Data_Form_Element_Abstract $element)
}
$regionId = $element->getForm()->getElement('region_id')->getValue();
+ $postcode = $element->getForm()->getElement('postcode');
$html = '
';
$element->setClass('input-text');
@@ -54,9 +55,23 @@ public function render(Varien_Data_Form_Element_Abstract $element)
$html.= '';
$html.= '';
$html.= '';
$html.= '
'."\n";
return $html;
diff --git a/app/code/core/Mage/Adminhtml/Block/Customer/Edit/Tab/Account.php b/app/code/core/Mage/Adminhtml/Block/Customer/Edit/Tab/Account.php
index 2d17235dcd..bcde34a2d9 100644
--- a/app/code/core/Mage/Adminhtml/Block/Customer/Edit/Tab/Account.php
+++ b/app/code/core/Mage/Adminhtml/Block/Customer/Edit/Tab/Account.php
@@ -132,16 +132,24 @@ public function initForm()
'name' => 'sendemail',
'id' => 'sendemail',
));
+ if (!Mage::app()->isSingleStoreMode()) {
+ $fieldset->addField('store_id', 'select', array(
+ 'label' => $this->helper('customer')->__('Send From'),
+ 'name' => 'store_id',
+ 'values' => Mage::getSingleton('adminhtml/system_store')->getStoreValuesForForm()
+ ));
+ }
}
- // make sendemail disabled, if website_id has empty value
- if ($sendemail = $form->getElement('sendemail')) {
+ // make sendemail and store_id disabled, if website_id has empty value
+ if ($sendemail = $form->getElement('store_id')) {
$prefix = $form->getHtmlIdPrefix();
$sendemail->setAfterElementHtml(
'
';
+ echo '';
}
echo '';
//print $this->getUrl('*/*/batchFinish', array('id' => $batchModel->getId()));
diff --git a/app/code/core/Mage/Adminhtml/Block/Tax/Rule/Grid.php b/app/code/core/Mage/Adminhtml/Block/Tax/Rule/Grid.php
index 4ec551f2b1..c10efb02a5 100644
--- a/app/code/core/Mage/Adminhtml/Block/Tax/Rule/Grid.php
+++ b/app/code/core/Mage/Adminhtml/Block/Tax/Rule/Grid.php
@@ -90,6 +90,7 @@ protected function _prepareColumns()
'index' => 'customer_tax_classes',
'filter_index' => 'ctc.customer_tax_class_id',
'type' => 'options',
+ 'show_missing_option_values' => true,
'options' => Mage::getModel('tax/class')->getCollection()->setClassTypeFilter('CUSTOMER')->toOptionHash(),
)
);
@@ -102,6 +103,7 @@ protected function _prepareColumns()
'index' => 'product_tax_classes',
'filter_index' => 'ptc.product_tax_class_id',
'type' => 'options',
+ 'show_missing_option_values' => true,
'options' => Mage::getModel('tax/class')->getCollection()->setClassTypeFilter('PRODUCT')->toOptionHash(),
)
);
@@ -114,6 +116,7 @@ protected function _prepareColumns()
'index' => 'tax_rates',
'filter_index' => 'rate.tax_calculation_rate_id',
'type' => 'options',
+ 'show_missing_option_values' => true,
'options' => Mage::getModel('tax/calculation_rate')->getCollection()->toOptionHash(),
)
);
diff --git a/app/code/core/Mage/Adminhtml/Block/Urlrewrite.php b/app/code/core/Mage/Adminhtml/Block/Urlrewrite.php
index f26a6b94ef..eeaf3cb50a 100644
--- a/app/code/core/Mage/Adminhtml/Block/Urlrewrite.php
+++ b/app/code/core/Mage/Adminhtml/Block/Urlrewrite.php
@@ -46,8 +46,8 @@ class Mage_Adminhtml_Block_Urlrewrite extends Mage_Adminhtml_Block_Widget_Grid_C
*/
public function __construct()
{
- $this->_headerText = Mage::helper('adminhtml')->__('Url Rewrite Management');
- $this->_addButtonLabel = Mage::helper('adminhtml')->__('Add Urlrewrite');
+ $this->_headerText = Mage::helper('adminhtml')->__('URL Rewrite Management');
+ $this->_addButtonLabel = Mage::helper('adminhtml')->__('Add URL Rewrite');
parent::__construct();
}
diff --git a/app/code/core/Mage/Adminhtml/Block/Urlrewrite/Category/Tree.php b/app/code/core/Mage/Adminhtml/Block/Urlrewrite/Category/Tree.php
index b6548bb19a..163b2955fa 100644
--- a/app/code/core/Mage/Adminhtml/Block/Urlrewrite/Category/Tree.php
+++ b/app/code/core/Mage/Adminhtml/Block/Urlrewrite/Category/Tree.php
@@ -67,7 +67,7 @@ public function getTreeArray($parentId = null, $asJson = false, $recursionLevel
$result = $this->_getNodesArray($this->getRoot(null, $recursionLevel));
}
if ($asJson) {
- return Zend_Json::encode($result);
+ return Mage::helper('core')->jsonEncode($result);
}
return $result;
}
diff --git a/app/code/core/Mage/Adminhtml/Block/Urlrewrite/Edit.php b/app/code/core/Mage/Adminhtml/Block/Urlrewrite/Edit.php
index 141b7e0e84..a76a9ca295 100644
--- a/app/code/core/Mage/Adminhtml/Block/Urlrewrite/Edit.php
+++ b/app/code/core/Mage/Adminhtml/Block/Urlrewrite/Edit.php
@@ -87,15 +87,15 @@ protected function _prepareLayout()
);
}
- $this->_headerText = Mage::helper('adminhtml')->__('Add New Urlrewrite');
+ $this->_headerText = Mage::helper('adminhtml')->__('Add New URL Rewrite');
// edit form for existing urlrewrite
if ($this->getUrlrewriteId()) {
- $this->_headerText = Mage::helper('adminhtml')->__('Edit Urlrewrite');
+ $this->_headerText = Mage::helper('adminhtml')->__('Edit URL Rewrite');
$this->_setFormChild();
}
elseif ($this->getProductId()) {
- $this->_headerText = Mage::helper('adminhtml')->__('Add Urlrewrite for a Product');
+ $this->_headerText = Mage::helper('adminhtml')->__('Add URL Rewrite for a Product');
// edit form for product with or without category
if ($this->getCategoryId() || !$this->isMode('category')) {
@@ -119,7 +119,7 @@ protected function _prepareLayout()
}
// edit form for category
elseif ($this->getCategoryId()) {
- $this->_headerText = Mage::helper('adminhtml')->__('Add Urlrewrite for a Category');
+ $this->_headerText = Mage::helper('adminhtml')->__('Add URL Rewrite for a Category');
$this->_setFormChild();
}
// modes selector and products/categories selectors, as well as edit form for custom urlrewrite
diff --git a/app/code/core/Mage/Adminhtml/Block/Urlrewrite/Edit/Form.php b/app/code/core/Mage/Adminhtml/Block/Urlrewrite/Edit/Form.php
index fe982f7daa..eabf76556c 100644
--- a/app/code/core/Mage/Adminhtml/Block/Urlrewrite/Edit/Form.php
+++ b/app/code/core/Mage/Adminhtml/Block/Urlrewrite/Edit/Form.php
@@ -75,7 +75,7 @@ protected function _prepareForm()
}
$fieldset = $form->addFieldset('base_fieldset', array(
- 'legend' => Mage::helper('adminhtml')->__('Urlrewrite Information')
+ 'legend' => Mage::helper('adminhtml')->__('URL Rewrite Information')
));
$fieldset->addField('is_system', 'select', array(
diff --git a/app/code/core/Mage/Adminhtml/Block/Urlrewrite/Selector.php b/app/code/core/Mage/Adminhtml/Block/Urlrewrite/Selector.php
index f0b1e58b5b..c328c1266a 100644
--- a/app/code/core/Mage/Adminhtml/Block/Urlrewrite/Selector.php
+++ b/app/code/core/Mage/Adminhtml/Block/Urlrewrite/Selector.php
@@ -72,7 +72,7 @@ public function getModes()
*/
public function getSelectorLabel()
{
- return Mage::helper('adminhtml')->__('Create Urlrewrite:');
+ return Mage::helper('adminhtml')->__('Create URL Rewrite:');
}
/**
diff --git a/app/code/core/Mage/Adminhtml/Block/Widget/Button.php b/app/code/core/Mage/Adminhtml/Block/Widget/Button.php
index a54c0b1879..772cc66581 100644
--- a/app/code/core/Mage/Adminhtml/Block/Widget/Button.php
+++ b/app/code/core/Mage/Adminhtml/Block/Widget/Button.php
@@ -61,7 +61,7 @@ protected function _toHtml()
. ' onclick="'.$this->getOnClick().'"'
. ' style="'.$this->getStyle() .'"'
. ($this->getValue()?' value="'.$this->getValue() . '"':'')
- . ($this->getDisabled() ? 'disabled="disabled"' : '')
+ . ($this->getDisabled() ? ' disabled="disabled"' : '')
. '>' .$this->getLabel().''.$this->getAfterHtml();
return $html;
diff --git a/app/code/core/Mage/Adminhtml/Block/Widget/Grid.php b/app/code/core/Mage/Adminhtml/Block/Widget/Grid.php
index b37c891ce8..92051b521d 100644
--- a/app/code/core/Mage/Adminhtml/Block/Widget/Grid.php
+++ b/app/code/core/Mage/Adminhtml/Block/Widget/Grid.php
@@ -274,6 +274,38 @@ public function addColumn($columnId, $column)
return $this;
}
+ /**
+ * Add column to grid after specified column.
+ *
+ * @param string $columnId
+ * @param array|Varien_Object $column
+ * @param string $after
+ * @return Mage_Adminhtml_Block_Widget_Grid
+ */
+ public function addColumnAfter($columnId, $column, $after)
+ {
+ $this->addColumn($columnId, $column);
+ // Moving grid column
+ $keys = array_keys($this->_columns);
+ $values = array_values($this->_columns);
+ $positionCurrent = array_search($columnId, $keys);
+
+ if (array_search($after, $keys) === false || $positionCurrent === false) {
+ return $this;
+ }
+
+ $key = array_splice($keys, $positionCurrent, 1);
+ $value = array_splice($values, $positionCurrent, 1);
+ $positionTarget = array_search($after, $keys) + 1;
+ array_splice($keys, $positionTarget, 0, $key);
+ array_splice($values, $positionTarget, 0, $value);
+
+ $this->_columns = array_combine($keys, $values);
+ end($this->_columns);
+ $this->_lastColumnId = key($this->_columns);
+ return $this;
+ }
+
public function getLastColumnId()
{
return $this->_lastColumnId;
diff --git a/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column.php b/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column.php
index bbcf9a3b10..f690ece8ca 100644
--- a/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column.php
+++ b/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column.php
@@ -125,7 +125,21 @@ public function getHeaderHtmlProperty()
*/
public function getRowField(Varien_Object $row)
{
- return $this->getRenderer()->render($row);
+ $renderedValue = $this->getRenderer()->render($row);
+
+ /*
+ * if column has determined callback for framing call
+ * it before give away rendered value
+ *
+ * callback_function($renderedValue, $row, $column, $isExport)
+ * should return new version of rendered value
+ */
+ $frameCallback = $this->getFrameCallback();
+ if (is_array($frameCallback)) {
+ $renderedValue = call_user_func($frameCallback, $renderedValue, $row, $this, false);
+ }
+
+ return $renderedValue;
}
/**
@@ -136,7 +150,21 @@ public function getRowField(Varien_Object $row)
*/
public function getRowFieldExport(Varien_Object $row)
{
- return $this->getRenderer()->renderExport($row);
+ $renderedValue = $this->getRenderer()->renderExport($row);
+
+ /*
+ * if column has determined callback for framing call
+ * it before give away rendered value
+ *
+ * callback_function($renderedValue, $row, $column, $isExport)
+ * should return new version of rendered value
+ */
+ $frameCallback = $this->getFrameCallback();
+ if (is_array($frameCallback)) {
+ $renderedValue = call_user_func($frameCallback, $renderedValue, $row, $this, true);
+ }
+
+ return $renderedValue;
}
public function setRenderer($renderer)
@@ -328,4 +356,4 @@ public function getExportHeader()
}
return $this->getHeader();
}
-}
\ No newline at end of file
+}
diff --git a/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Action.php b/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Action.php
index e27a37e669..1865727c36 100644
--- a/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Action.php
+++ b/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Action.php
@@ -82,7 +82,7 @@ protected function _toOptionHtml($action, Varien_Object $row)
$actionCaption = '';
$this->_transformActionData($action, $actionCaption, $row);
- $htmlAttibutes = array('value'=>$this->htmlEscape(Zend_Json::encode($action)));
+ $htmlAttibutes = array('value'=>$this->htmlEscape(Mage::helper('core')->jsonEncode($action)));
$actionAttributes->setData($htmlAttibutes);
return '';
}
diff --git a/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Checkbox.php b/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Checkbox.php
index 23c6649b4d..bceadb0f60 100644
--- a/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Checkbox.php
+++ b/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Checkbox.php
@@ -59,18 +59,29 @@ public function render(Varien_Object $row)
else {
$checked = ($value === $this->getColumn()->getValue()) ? ' checked="checked"' : '';
}
- if ($this->getNoObjectId() || $this->getColumn()->getUseIndex()){
- //WTF: why getNoObjectId???
- $v = $value;
- } else {
+
+ $disabledValues = $this->getColumn()->getDisabledValues();
+ if (is_array($disabledValues)) {
+ $disabled = in_array($value, $disabledValues) ? ' disabled="disabled"' : '';
+ }
+ else {
+ $disabled = ($value === $this->getColumn()->getDisabledValue()) ? ' disabled="disabled"' : '';
+ }
+
+ $this->setDisabled($disabled);
+
+ if ($this->getNoObjectId() || $this->getColumn()->getUseIndex()){
+ $v = $value;
+ } else {
$v = ($row->getId() != "") ? $row->getId():$value;
- }
+ }
+
return $this->_getCheckboxHtml($v, $checked);
}
protected function _getCheckboxHtml($value, $checked)
{
- return '';
+ return 'getDisabled().'/>';
}
public function renderHeader()
@@ -81,8 +92,13 @@ public function renderHeader()
$checked = '';
if ($filter = $this->getColumn()->getFilter()) {
- $checked = $filter->getValue() ? 'checked="checked"' : '';
+ $checked = $filter->getValue() ? ' checked="checked"' : '';
+ }
+
+ $disabled = '';
+ if ($this->getColumn()->getDisabled()) {
+ $disabled = ' disabled="disabled"';
}
- return '';
+ return '';
}
}
diff --git a/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Massaction/Abstract.php b/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Massaction/Abstract.php
index d84e8d7ae7..5e505849b7 100644
--- a/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Massaction/Abstract.php
+++ b/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Massaction/Abstract.php
@@ -114,7 +114,7 @@ public function getItemsJson()
$result[$itemId] = $item->toArray();
}
- return Zend_Json::encode($result);
+ return Mage::helper('core')->jsonEncode($result);
}
/**
@@ -187,7 +187,7 @@ public function getSelectedJson()
if($selected = $this->getRequest()->getParam($this->getFormFieldNameInternal())) {
$selected = explode(',', $selected);
return join(',', $selected);
-// return Zend_Json::encode($selected);
+// return Mage::helper('core')->jsonEncode($selected);
} else {
return '';
// return '[]';
@@ -235,7 +235,7 @@ public function getGridIdsJson()
if(!empty($gridIds)) {
return join(",", $gridIds);
- //return Zend_Json::encode($gridIds);
+ //return Mage::helper('core')->jsonEncode($gridIds);
}
return '';
//return '[]';
diff --git a/app/code/core/Mage/Adminhtml/Block/Widget/Tabs.php b/app/code/core/Mage/Adminhtml/Block/Widget/Tabs.php
index 38044813b2..b7b92ca7d8 100644
--- a/app/code/core/Mage/Adminhtml/Block/Widget/Tabs.php
+++ b/app/code/core/Mage/Adminhtml/Block/Widget/Tabs.php
@@ -345,7 +345,7 @@ public function getAllShadowTabs($asJson = true)
}
}
if ($asJson) {
- return Zend_Json::encode($result);
+ return Mage::helper('core')->jsonEncode($result);
}
return $result;
}
diff --git a/app/code/core/Mage/Adminhtml/Controller/Action.php b/app/code/core/Mage/Adminhtml/Controller/Action.php
index 322582f8df..0b96c50644 100644
--- a/app/code/core/Mage/Adminhtml/Controller/Action.php
+++ b/app/code/core/Mage/Adminhtml/Controller/Action.php
@@ -144,7 +144,7 @@ public function preDispatch()
$this->setFlag('', self::FLAG_NO_DISPATCH, true);
$this->setFlag('', self::FLAG_NO_POST_DISPATCH, true);
if ($this->getRequest()->getQuery('isAjax', false) || $this->getRequest()->getQuery('ajax', false)) {
- $this->getResponse()->setBody(Zend_Json::encode(array(
+ $this->getResponse()->setBody(Mage::helper('core')->jsonEncode(array(
'error' => true,
'message' => $_keyErrorMsg
)));
@@ -192,7 +192,7 @@ protected function _checkUrlSettings()
if ($defaultSecure == '{{base_url}}' || $defaultUnsecure == '{{base_url}}') {
$this->_getSession()->addNotice(
- $this->__('{{base_url}} is not recommended to use in a production environment to declare the Base Unsecure Url / Base Secure Url. It is highly recommended to change this value in your Magento configuration.', $this->getUrl('adminhtml/system_config/edit', array('section'=>'web')))
+ $this->__('{{base_url}} is not recommended to use in a production environment to declare the Base Unsecure URL / Base Secure URL. It is highly recommended to change this value in your Magento configuration.', $this->getUrl('adminhtml/system_config/edit', array('section'=>'web')))
);
return $this;
}
@@ -213,7 +213,7 @@ protected function _checkUrlSettings()
if ($url) {
$this->_getSession()->addNotice(
- $this->__('{{base_url}} is not recommended to use in a production environment to declare the Base Unsecure Url / Base Secure Url. It is highly recommended to change this value in your Magento configuration.', $url)
+ $this->__('{{base_url}} is not recommended to use in a production environment to declare the Base Unsecure URL / Base Secure URL. It is highly recommended to change this value in your Magento configuration.', $url)
);
return $this;
}
diff --git a/app/code/core/Mage/Adminhtml/Helper/Dashboard/Data.php b/app/code/core/Mage/Adminhtml/Helper/Dashboard/Data.php
index b025f803e0..efa04da104 100644
--- a/app/code/core/Mage/Adminhtml/Helper/Dashboard/Data.php
+++ b/app/code/core/Mage/Adminhtml/Helper/Dashboard/Data.php
@@ -56,7 +56,7 @@ public function getDatePeriods()
return array(
'24h'=>$this->__('Last 24 hours'),
'7d'=>$this->__('Last 7 days'),
- '1m'=>$this->__('Last Month'),
+ '1m'=>$this->__('Month-To-Date'),
'1y'=>$this->__('YTD'),
'2y'=>$this->__('2YTD')
);
diff --git a/app/code/core/Mage/Adminhtml/Model/Observer.php b/app/code/core/Mage/Adminhtml/Model/Observer.php
index df4a9b41e8..4633ac3471 100644
--- a/app/code/core/Mage/Adminhtml/Model/Observer.php
+++ b/app/code/core/Mage/Adminhtml/Model/Observer.php
@@ -60,7 +60,7 @@ public function massactionPrepareKey()
{
$request = Mage::app()->getFrontController()->getRequest();
if ($key = $request->getPost('massaction_prepare_key')) {
- $value = is_array($request->getPost($key)) ? $request->getPost($key) : split(',', $request->getPost($key));
+ $value = is_array($request->getPost($key)) ? $request->getPost($key) : explode(',', $request->getPost($key));
$request->setPost($key, $value ? $value : null);
}
return $this;
diff --git a/app/code/core/Mage/Adminhtml/Model/Sales/Order/Create.php b/app/code/core/Mage/Adminhtml/Model/Sales/Order/Create.php
index aab7bd5e4c..e3e654c568 100644
--- a/app/code/core/Mage/Adminhtml/Model/Sales/Order/Create.php
+++ b/app/code/core/Mage/Adminhtml/Model/Sales/Order/Create.php
@@ -420,8 +420,6 @@ public function moveQuoteItem($item, $moveTo, $qty)
$product->unsSkipCheckRequiredOption();
$newItem->checkData();
$newItem->setQty($qty);
- $this->getQuote()->collectTotals()
- ->save();
break;
case 'cart':
if (($cart = $this->getCustomerCart()) && is_null($item->getOptionByCode('additional_options'))) {
@@ -1123,7 +1121,7 @@ protected function _validate()
{
$customerId = $this->getSession()->getCustomerId();
if (is_null($customerId)) {
- Mage::throwException(Mage::helper('adminhtml')->__('Please select a custmer'));
+ Mage::throwException(Mage::helper('adminhtml')->__('Please select a customer'));
}
if (!$this->getSession()->getStore()->getId()) {
diff --git a/app/code/core/Mage/Adminhtml/Model/Search/Catalog.php b/app/code/core/Mage/Adminhtml/Model/Search/Catalog.php
index 5b57b35d57..6070efa804 100644
--- a/app/code/core/Mage/Adminhtml/Model/Search/Catalog.php
+++ b/app/code/core/Mage/Adminhtml/Model/Search/Catalog.php
@@ -36,7 +36,7 @@ public function load()
return $this;
}
- $collection = Mage::helper('catalogSearch')->getQuery()->getResultCollection()
+ $collection = Mage::helper('catalogsearch')->getQuery()->getResultCollection()
->addAttributeToSelect('name')
->addAttributeToSelect('description')
->addSearchFilter($this->getQuery())
diff --git a/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Currency/Abstract.php b/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Currency/Abstract.php
index 1abd9e1602..75415d4c19 100644
--- a/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Currency/Abstract.php
+++ b/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Currency/Abstract.php
@@ -44,7 +44,7 @@ abstract class Mage_Adminhtml_Model_System_Config_Backend_Currency_Abstract exte
protected function _getAllowedCurrencies()
{
if ($this->getData('groups/options/fields/allow/inherit')) {
- return split(',', Mage::getConfig()->getNode('currency/options/allow', $this->getScope(), $this->getScopeId()));
+ return explode(',', Mage::getConfig()->getNode('currency/options/allow', $this->getScope(), $this->getScopeId()));
}
return $this->getData('groups/options/fields/allow/value');
}
@@ -56,7 +56,7 @@ protected function _getAllowedCurrencies()
*/
protected function _getInstalledCurrencies()
{
- return split(',', Mage::getStoreConfig('system/currency/installed'));
+ return explode(',', Mage::getStoreConfig('system/currency/installed'));
}
/**
diff --git a/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Currency/Cron.php b/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Currency/Cron.php
index cf26d3a998..9358402af3 100644
--- a/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Currency/Cron.php
+++ b/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Currency/Cron.php
@@ -41,7 +41,7 @@ protected function _afterSave()
$enabled = $this->getData('groups/import/fields/enabled/value');
$service = $this->getData('groups/import/fields/service/value');
$time = $this->getData('groups/import/fields/time/value');
- $frequncy = $this->getData('groups/import/fields/frequncy/value');
+ $frequency = $this->getData('groups/import/fields/frequency/value');
$errorEmail = $this->getData('groups/import/fields/error_email/value');
$frequencyDaily = Mage_Adminhtml_Model_System_Config_Source_Cron_Frequency::CRON_DAILY;
@@ -53,9 +53,9 @@ protected function _afterSave()
$cronExprArray = array(
intval($time[1]), # Minute
intval($time[0]), # Hour
- ($frequncy == $frequencyMonthly) ? '1' : '*', # Day of the Month
+ ($frequency == $frequencyMonthly) ? '1' : '*', # Day of the Month
'*', # Month of the Year
- ($frequncy == $frequencyWeekly) ? '1' : '*', # Day of the Week
+ ($frequency == $frequencyWeekly) ? '1' : '*', # Day of the Week
);
$cronExprString = join(' ', $cronExprArray);
diff --git a/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Email/Sender.php b/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Email/Sender.php
index 8e8e368af8..eb129ad66f 100644
--- a/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Email/Sender.php
+++ b/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Email/Sender.php
@@ -37,8 +37,8 @@ class Mage_Adminhtml_Model_System_Config_Backend_Email_Sender extends Mage_Core_
protected function _beforeSave()
{
$value = $this->getValue();
- if (!preg_match("/^[A-Za-z0-9_\s]+$/", $value)) {
- Mage::throwException(Mage::helper('adminhtml')->__('Invalid sender name "%s"', $value));
+ if (!preg_match("/^[\S ]+$/", $value)) {
+ Mage::throwException(Mage::helper('adminhtml')->__('Invalid sender name "%s". Please use only visible characters and spaces.', $value));
}
return $this;
}
diff --git a/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Locale.php b/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Locale.php
index fe48b7aa43..3cc42063e3 100644
--- a/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Locale.php
+++ b/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Locale.php
@@ -46,7 +46,7 @@ protected function _afterSave()
->getCollection()
->addPathFilter('currency/options');
- $values = split(',', $this->getValue());
+ $values = explode(',', $this->getValue());
$exceptions = array();
foreach ($collection as $data) {
$match = false;
diff --git a/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Checktype.php b/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Checktype.php
index 2a0240bce5..e3b27215b9 100644
--- a/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Checktype.php
+++ b/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Checktype.php
@@ -18,20 +18,38 @@
* 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) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
+ * @category Mage
+ * @package Mage_Adminhtml
+ * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/
+/**
+ * Send to a Friend Limit sending by Source
+ *
+ * @category Mage
+ * @package Mage_Adminhtml
+ * @author Magento Core Team
+ */
class Mage_Adminhtml_Model_System_Config_Source_Checktype
{
+ /**
+ * Retrieve Check Type Option array
+ *
+ * @return array
+ */
public function toOptionArray()
{
return array(
- array('value'=>0, 'label'=>Mage::helper('adminhtml')->__('IP Address')),
- array('value'=>1, 'label'=>Mage::helper('adminhtml')->__('Cookie (Unsafe)')),
+ array(
+ 'value' => Mage_Sendfriend_Helper_Data::CHECK_IP,
+ 'label' => Mage::helper('adminhtml')->__('IP Address')
+ ),
+ array(
+ 'value' => Mage_Sendfriend_Helper_Data::CHECK_COOKIE,
+ 'label' => Mage::helper('adminhtml')->__('Cookie (Unsafe)')
+ ),
);
}
-}
\ No newline at end of file
+}
diff --git a/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Watermark/Position.php b/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Watermark/Position.php
index db04ee4d7e..82e1d7c7f1 100644
--- a/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Watermark/Position.php
+++ b/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Watermark/Position.php
@@ -49,6 +49,7 @@ public function toOptionArray()
array('value' => 'top-right', 'label' => Mage::helper('catalog')->__('Top/Right')),
array('value' => 'bottom-left', 'label' => Mage::helper('catalog')->__('Bottom/Left')),
array('value' => 'bottom-right', 'label' => Mage::helper('catalog')->__('Bottom/Right')),
+ array('value' => 'center', 'label' => Mage::helper('catalog')->__('Center')),
);
}
diff --git a/app/code/core/Mage/Adminhtml/Model/Url.php b/app/code/core/Mage/Adminhtml/Model/Url.php
index c474df6183..2915ee133f 100644
--- a/app/code/core/Mage/Adminhtml/Model/Url.php
+++ b/app/code/core/Mage/Adminhtml/Model/Url.php
@@ -69,8 +69,13 @@ public function setRouteParams(array $data, $unsetOldParams=true)
*/
public function getUrl($routePath=null, $routeParams=null)
{
- $result = parent::getUrl($routePath, $routeParams);
+ $cacheSecretKey = false;
+ if (is_array($routeParams) && isset($routeParams['_cache_secret_key'])) {
+ unset($routeParams['_cache_secret_key']);
+ $cacheSecretKey = true;
+ }
+ $result = parent::getUrl($routePath, $routeParams);
if (!$this->useSecretKey()) {
return $result;
}
@@ -78,7 +83,13 @@ public function getUrl($routePath=null, $routeParams=null)
$_route = $this->getRouteName() ? $this->getRouteName() : '*';
$_controller = $this->getControllerName() ? $this->getControllerName() : $this->getDefaultControllerName();
$_action = $this->getActionName() ? $this->getActionName() : $this->getDefaultActionName();
- $secret = array(self::SECRET_KEY_PARAM_NAME => $this->getSecretKey($_controller, $_action));
+
+ if ($cacheSecretKey) {
+ $secret = array(self::SECRET_KEY_PARAM_NAME => "\${$_controller}/{$_action}\$");
+ }
+ else {
+ $secret = array(self::SECRET_KEY_PARAM_NAME => $this->getSecretKey($_controller, $_action));
+ }
if (is_array($routeParams)) {
$routeParams = array_merge($secret, $routeParams);
} else {
@@ -87,6 +98,7 @@ public function getUrl($routePath=null, $routeParams=null)
if (is_array($this->getRouteParams())) {
$routeParams = array_merge($this->getRouteParams(), $routeParams);
}
+
return parent::getUrl("{$_route}/{$_controller}/{$_action}", $routeParams);
}
diff --git a/app/code/core/Mage/Adminhtml/controllers/Catalog/CategoryController.php b/app/code/core/Mage/Adminhtml/controllers/Catalog/CategoryController.php
index 73ec707e44..b208cf163a 100644
--- a/app/code/core/Mage/Adminhtml/controllers/Catalog/CategoryController.php
+++ b/app/code/core/Mage/Adminhtml/controllers/Catalog/CategoryController.php
@@ -246,6 +246,15 @@ public function saveAction()
}
}
+ /**
+ * Process "Use Config Settings" checkboxes
+ */
+ if ($useConfig = $this->getRequest()->getPost('use_config')) {
+ foreach ($useConfig as $attributeCode) {
+ $category->setData($attributeCode, null);
+ }
+ }
+
$category->setAttributeSetId($category->getDefaultAttributeSetId());
if (isset($data['category_products']) &&
@@ -370,7 +379,7 @@ public function treeAction()
$block = $this->getLayout()->createBlock('adminhtml/catalog_category_tree');
$root = $block->getRoot();
- $this->getResponse()->setBody(Zend_Json::encode(array(
+ $this->getResponse()->setBody(Mage::helper('core')->jsonEncode(array(
'data' => $block->getTree(),
'parameters' => array(
'text' => $block->buildNodeName($root),
@@ -384,8 +393,24 @@ public function treeAction()
))));
}
+ /**
+ * Build response for refresh input element 'path' in form
+ */
+ public function refreshPathAction()
+ {
+ if ($id = (int) $this->getRequest()->getParam('id')) {
+ $category = Mage::getModel('catalog/category')->load($id);
+ $this->getResponse()->setBody(
+ Mage::helper('core')->jsonEncode(array(
+ 'id' => $id,
+ 'path' => $category->getPath(),
+ ))
+ );
+ }
+ }
+
protected function _isAllowed()
{
- return Mage::getSingleton('admin/session')->isAllowed('catalog/categories');
+ return Mage::getSingleton('admin/session')->isAllowed('catalog/categories');
}
}
diff --git a/app/code/core/Mage/Adminhtml/controllers/Catalog/Product/AttributeController.php b/app/code/core/Mage/Adminhtml/controllers/Catalog/Product/AttributeController.php
index d677c4e2a4..5a41353317 100644
--- a/app/code/core/Mage/Adminhtml/controllers/Catalog/Product/AttributeController.php
+++ b/app/code/core/Mage/Adminhtml/controllers/Catalog/Product/AttributeController.php
@@ -158,6 +158,12 @@ public function saveAction()
if (!isset($data['is_configurable'])) {
$data['is_configurable'] = 0;
}
+ if (!isset($data['is_filterable'])) {
+ $data['is_filterable'] = 0;
+ }
+ if (!isset($data['is_filterable_in_search'])) {
+ $data['is_filterable_in_search'] = 0;
+ }
if (is_null($model->getIsUserDefined()) || $model->getIsUserDefined() != 0) {
$data['backend_type'] = $model->getBackendTypeByInput($data['frontend_input']);
diff --git a/app/code/core/Mage/Adminhtml/controllers/Catalog/Product/GalleryController.php b/app/code/core/Mage/Adminhtml/controllers/Catalog/Product/GalleryController.php
index 362853bd20..21525943af 100644
--- a/app/code/core/Mage/Adminhtml/controllers/Catalog/Product/GalleryController.php
+++ b/app/code/core/Mage/Adminhtml/controllers/Catalog/Product/GalleryController.php
@@ -58,7 +58,7 @@ public function uploadAction()
$result = array('error'=>$e->getMessage(), 'errorcode'=>$e->getCode());
}
- $this->getResponse()->setBody(Zend_Json::encode($result));
+ $this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
}
protected function _isAllowed()
diff --git a/app/code/core/Mage/Adminhtml/controllers/Catalog/ProductController.php b/app/code/core/Mage/Adminhtml/controllers/Catalog/ProductController.php
index 7fb0d9ad2e..aaeec49e77 100644
--- a/app/code/core/Mage/Adminhtml/controllers/Catalog/ProductController.php
+++ b/app/code/core/Mage/Adminhtml/controllers/Catalog/ProductController.php
@@ -515,10 +515,10 @@ protected function _initProductSave()
* Initialize data for configurable product
*/
if (($data = $this->getRequest()->getPost('configurable_products_data')) && !$product->getConfigurableReadonly()) {
- $product->setConfigurableProductsData(Zend_Json::decode($data));
+ $product->setConfigurableProductsData(Mage::helper('core')->jsonDecode($data));
}
if (($data = $this->getRequest()->getPost('configurable_attributes_data')) && !$product->getConfigurableReadonly()) {
- $product->setConfigurableAttributesData(Zend_Json::decode($data));
+ $product->setConfigurableAttributesData(Mage::helper('core')->jsonDecode($data));
}
$product->setCanSaveConfigurableAttributes((bool)$this->getRequest()->getPost('affect_configurable_product_attributes') && !$product->getConfigurableReadonly());
@@ -893,7 +893,7 @@ public function quickCreateAction()
);
}
- $this->getResponse()->setBody(Zend_Json::encode($result));
+ $this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
}
protected function _isAllowed()
diff --git a/app/code/core/Mage/Adminhtml/controllers/CustomerController.php b/app/code/core/Mage/Adminhtml/controllers/CustomerController.php
index 9fd89d8fc1..ede6002828 100644
--- a/app/code/core/Mage/Adminhtml/controllers/CustomerController.php
+++ b/app/code/core/Mage/Adminhtml/controllers/CustomerController.php
@@ -203,15 +203,15 @@ public function saveAction()
);
$customer->save();
-
// send welcome email
if ($customer->getWebsiteId() && $customer->hasData('sendemail')) {
+ $store_id = $customer->getStoreId();
if ($isNewCustomer) {
- $customer->sendNewAccountEmail();
+ $customer->sendNewAccountEmail('registered', '', $store_id);
}
// confirm not confirmed customer
elseif ((!$customer->getConfirmation())) {
- $customer->sendNewAccountEmail('confirmed');
+ $customer->sendNewAccountEmail('confirmed', '', $store_id);
}
}
diff --git a/app/code/core/Mage/Adminhtml/controllers/IndexController.php b/app/code/core/Mage/Adminhtml/controllers/IndexController.php
index 88d9ab2124..e455fbec04 100644
--- a/app/code/core/Mage/Adminhtml/controllers/IndexController.php
+++ b/app/code/core/Mage/Adminhtml/controllers/IndexController.php
@@ -146,7 +146,7 @@ public function deniedJsonAction()
protected function _getDeniedJson()
{
- return Zend_Json::encode(
+ return Mage::helper('core')->jsonEncode(
array(
'ajaxExpired' => 1,
'ajaxRedirect' => $this->getUrl('*/index/login')
diff --git a/app/code/core/Mage/Adminhtml/controllers/JsonController.php b/app/code/core/Mage/Adminhtml/controllers/JsonController.php
index 3085026309..dcc5882875 100644
--- a/app/code/core/Mage/Adminhtml/controllers/JsonController.php
+++ b/app/code/core/Mage/Adminhtml/controllers/JsonController.php
@@ -47,6 +47,6 @@ public function countryRegionAction()
}
}
- $this->getResponse()->setBody(Zend_Json::encode($arrRes));
+ $this->getResponse()->setBody(Mage::helper('core')->jsonEncode($arrRes));
}
}
\ No newline at end of file
diff --git a/app/code/core/Mage/Adminhtml/controllers/Media/UploaderController.php b/app/code/core/Mage/Adminhtml/controllers/Media/UploaderController.php
index a8675a8e9d..c00ea66383 100644
--- a/app/code/core/Mage/Adminhtml/controllers/Media/UploaderController.php
+++ b/app/code/core/Mage/Adminhtml/controllers/Media/UploaderController.php
@@ -36,7 +36,7 @@ class Mage_Adminhtml_Media_UploaderController extends Mage_Adminhtml_Controller_
public function uploadAction()
{
- $this->getResponse()->setBody(Zend_Json::encode($_REQUEST));
+ $this->getResponse()->setBody(Mage::helper('core')->jsonEncode($_REQUEST));
}
public function indexAction()
diff --git a/app/code/core/Mage/Adminhtml/controllers/Newsletter/TemplateController.php b/app/code/core/Mage/Adminhtml/controllers/Newsletter/TemplateController.php
index 05e1e7c858..4fde237585 100644
--- a/app/code/core/Mage/Adminhtml/controllers/Newsletter/TemplateController.php
+++ b/app/code/core/Mage/Adminhtml/controllers/Newsletter/TemplateController.php
@@ -116,6 +116,9 @@ public function editAction ()
public function saveAction ()
{
$request = $this->getRequest();
+ if (!$request->isPost()) {
+ $this->getResponse()->setRedirect($this->getUrl('*/newsletter_template'));
+ }
$template = Mage::getModel('newsletter/template');
if ($id = (int)$request->getParam('id')) {
diff --git a/app/code/core/Mage/Adminhtml/controllers/Permissions/UserController.php b/app/code/core/Mage/Adminhtml/controllers/Permissions/UserController.php
index 569da7ed70..7968d8b88a 100644
--- a/app/code/core/Mage/Adminhtml/controllers/Permissions/UserController.php
+++ b/app/code/core/Mage/Adminhtml/controllers/Permissions/UserController.php
@@ -84,6 +84,17 @@ public function saveAction()
if ($data = $this->getRequest()->getPost()) {
$model = Mage::getModel('admin/user');
$model->setData($data);
+
+ $result = $model->validate();
+ if (is_array($result)) {
+ Mage::getSingleton('adminhtml/session')->setUserData($data);
+ foreach ($result as $message) {
+ Mage::getSingleton('adminhtml/session')->addError($message);
+ }
+ $this->_redirect('*/*/edit', array('_current' => true));
+ return $this;
+ }
+
try {
$model->save();
if ( $uRoles = $this->getRequest()->getParam('roles', false) ) {
@@ -105,7 +116,7 @@ public function saveAction()
Mage::getSingleton('adminhtml/session')->setUserData(false);
$this->_redirect('*/*/edit', array('user_id' => $model->getUserId()));
return;
- } catch (Exception $e) {
+ } catch (Mage_Core_Exception $e) {
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
Mage::getSingleton('adminhtml/session')->setUserData($data);
$this->_redirect('*/*/edit', array('user_id' => $model->getUserId()));
diff --git a/app/code/core/Mage/Adminhtml/controllers/Promo/QuoteController.php b/app/code/core/Mage/Adminhtml/controllers/Promo/QuoteController.php
index cf1d0477c5..a159239baa 100644
--- a/app/code/core/Mage/Adminhtml/controllers/Promo/QuoteController.php
+++ b/app/code/core/Mage/Adminhtml/controllers/Promo/QuoteController.php
@@ -101,11 +101,12 @@ public function editAction()
public function saveAction()
{
- if ($data = $this->getRequest()->getPost()) {
+ $data = $this->getRequest()->getPost();
+ if ($data) {
try {
$model = Mage::getModel('salesrule/rule');
-
- if ($id = $this->getRequest()->getParam('rule_id')) {
+ $id = $this->getRequest()->getParam('rule_id');
+ if ($id) {
$model->load($id);
if ($id != $model->getId()) {
Mage::throwException(Mage::helper('salesrule')->__('Wrong rule specified.'));
@@ -121,14 +122,14 @@ public function saveAction()
$data['actions'] = $data['rule']['actions'];
}
unset($data['rule']);
-
$model->loadPost($data);
- Mage::getSingleton('adminhtml/session')->setPageData($model->getData());
+ $session = Mage::getSingleton('adminhtml/session');
+ $session->setPageData($model->getData());
$model->save();
- Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('salesrule')->__('Rule was successfully saved'));
- Mage::getSingleton('adminhtml/session')->setPageData(false);
+ $session->addSuccess(Mage::helper('salesrule')->__('Rule was successfully saved'));
+ $session->setPageData(false);
$this->_redirect('*/*/');
return;
} catch (Exception $e) {
diff --git a/app/code/core/Mage/Adminhtml/controllers/Sales/Order/CreateController.php b/app/code/core/Mage/Adminhtml/controllers/Sales/Order/CreateController.php
index c8e00a5807..0c6f31d22f 100644
--- a/app/code/core/Mage/Adminhtml/controllers/Sales/Order/CreateController.php
+++ b/app/code/core/Mage/Adminhtml/controllers/Sales/Order/CreateController.php
@@ -175,7 +175,7 @@ protected function _processData()
* Adding products to quote from special grid and
*/
if ($data = $this->getRequest()->getPost('add_products')) {
- $this->_getOrderCreateModel()->addProducts(Zend_Json::decode($data));
+ $this->_getOrderCreateModel()->addProducts(Mage::helper('core')->jsonDecode($data));
}
/**
@@ -236,7 +236,7 @@ protected function _processData()
* Importing gift message allow items from specific product grid
*/
if ($data = $this->getRequest()->getPost('add_products')) {
- $this->_getGiftmessageSaveModel()->importAllowQuoteItemsFromProducts(Zend_Json::decode($data));
+ $this->_getGiftmessageSaveModel()->importAllowQuoteItemsFromProducts(Mage::helper('core')->jsonDecode($data));
}
/**
diff --git a/app/code/core/Mage/Adminhtml/controllers/Sales/Order/CreditmemoController.php b/app/code/core/Mage/Adminhtml/controllers/Sales/Order/CreditmemoController.php
index 0389e8dd32..605c6130e5 100644
--- a/app/code/core/Mage/Adminhtml/controllers/Sales/Order/CreditmemoController.php
+++ b/app/code/core/Mage/Adminhtml/controllers/Sales/Order/CreditmemoController.php
@@ -190,14 +190,9 @@ protected function _initCreditmemo($update = false)
}
if (isset($data['shipping_amount'])) {
- $creditmemo->setShippingAmount($data['shipping_amount']);
+ $creditmemo->setBaseShippingAmount((float)$data['shipping_amount']);
} elseif ($invoice) {
- $creditmemo->setShippingAmount($invoice->getShippingAmount());
- }
- else {
- $creditmemo->setShippingAmount(
- $order->getBaseShippingAmount()-$order->getBaseShippingRefunded()
- );
+ $creditmemo->setBaseShippingAmount($invoice->getBaseShippingAmount());
}
if (isset($data['adjustment_positive'])) {
@@ -295,14 +290,14 @@ public function updateQtyAction()
'error' => true,
'message' => $e->getMessage()
);
- $response = Zend_Json::encode($response);
+ $response = Mage::helper('core')->jsonEncode($response);
}
catch (Exception $e) {
$response = array(
'error' => true,
'message' => $this->__('Can not update item qty')
);
- $response = Zend_Json::encode($response);
+ $response = Mage::helper('core')->jsonEncode($response);
}
$this->getResponse()->setBody($response);
}
@@ -435,14 +430,14 @@ public function addCommentAction()
'error' => true,
'message' => $e->getMessage()
);
- $response = Zend_Json::encode($response);
+ $response = Mage::helper('core')->jsonEncode($response);
}
catch (Exception $e) {
$response = array(
'error' => true,
'message' => $this->__('Can not add new comment.')
);
- $response = Zend_Json::encode($response);
+ $response = Mage::helper('core')->jsonEncode($response);
}
$this->getResponse()->setBody($response);
}
diff --git a/app/code/core/Mage/Adminhtml/controllers/Sales/Order/InvoiceController.php b/app/code/core/Mage/Adminhtml/controllers/Sales/Order/InvoiceController.php
index 5350dc1741..e699c31544 100644
--- a/app/code/core/Mage/Adminhtml/controllers/Sales/Order/InvoiceController.php
+++ b/app/code/core/Mage/Adminhtml/controllers/Sales/Order/InvoiceController.php
@@ -271,14 +271,14 @@ public function updateQtyAction()
'error' => true,
'message' => $e->getMessage()
);
- $response = Zend_Json::encode($response);
+ $response = Mage::helper('core')->jsonEncode($response);
}
catch (Exception $e) {
$response = array(
'error' => true,
'message' => $this->__('Can not update item qty')
);
- $response = Zend_Json::encode($response);
+ $response = Mage::helper('core')->jsonEncode($response);
}
$this->getResponse()->setBody($response);
}
@@ -453,14 +453,14 @@ public function addCommentAction()
'error' => true,
'message' => $e->getMessage()
);
- $response = Zend_Json::encode($response);
+ $response = Mage::helper('core')->jsonEncode($response);
}
catch (Exception $e) {
$response = array(
'error' => true,
'message' => $this->__('Can not add new comment.')
);
- $response = Zend_Json::encode($response);
+ $response = Mage::helper('core')->jsonEncode($response);
}
$this->getResponse()->setBody($response);
}
diff --git a/app/code/core/Mage/Adminhtml/controllers/Sales/Order/ShipmentController.php b/app/code/core/Mage/Adminhtml/controllers/Sales/Order/ShipmentController.php
index b147784b6f..efdb56b9a6 100644
--- a/app/code/core/Mage/Adminhtml/controllers/Sales/Order/ShipmentController.php
+++ b/app/code/core/Mage/Adminhtml/controllers/Sales/Order/ShipmentController.php
@@ -288,7 +288,7 @@ public function addTrackAction()
);
}
if (is_array($response)) {
- $response = Zend_Json::encode($response);
+ $response = Mage::helper('core')->jsonEncode($response);
}
$this->getResponse()->setBody($response);
}
@@ -327,7 +327,7 @@ public function removeTrackAction()
);
}
if (is_array($response)) {
- $response = Zend_Json::encode($response);
+ $response = Mage::helper('core')->jsonEncode($response);
}
$this->getResponse()->setBody($response);
}
@@ -368,7 +368,7 @@ public function viewTrackAction()
}
else {
if (is_array($response)) {
- $response = Zend_Json::encode($response);
+ $response = Mage::helper('core')->jsonEncode($response);
}
$this->getResponse()->setBody($response);
@@ -399,14 +399,14 @@ public function addCommentAction()
'error' => true,
'message' => $e->getMessage()
);
- $response = Zend_Json::encode($response);
+ $response = Mage::helper('core')->jsonEncode($response);
}
catch (Exception $e) {
$response = array(
'error' => true,
'message' => $this->__('Can not add new comment.')
);
- $response = Zend_Json::encode($response);
+ $response = Mage::helper('core')->jsonEncode($response);
}
$this->getResponse()->setBody($response);
}
diff --git a/app/code/core/Mage/Adminhtml/controllers/Sales/OrderController.php b/app/code/core/Mage/Adminhtml/controllers/Sales/OrderController.php
index a5b8131838..79e8b926b0 100644
--- a/app/code/core/Mage/Adminhtml/controllers/Sales/OrderController.php
+++ b/app/code/core/Mage/Adminhtml/controllers/Sales/OrderController.php
@@ -217,7 +217,7 @@ public function addCommentAction()
);
}
if (is_array($response)) {
- $response = Zend_Json::encode($response);
+ $response = Mage::helper('core')->jsonEncode($response);
$this->getResponse()->setBody($response);
}
}
diff --git a/app/code/core/Mage/Adminhtml/controllers/System/AccountController.php b/app/code/core/Mage/Adminhtml/controllers/System/AccountController.php
index 00cd23b06a..43ec1f6313 100644
--- a/app/code/core/Mage/Adminhtml/controllers/System/AccountController.php
+++ b/app/code/core/Mage/Adminhtml/controllers/System/AccountController.php
@@ -42,6 +42,9 @@ public function indexAction()
$this->renderLayout();
}
+ /**
+ * Saving edited user information
+ */
public function saveAction()
{
$userId = Mage::getSingleton('admin/session')->getUser()->getId();
@@ -53,36 +56,33 @@ public function saveAction()
->setFirstname($this->getRequest()->getParam('firstname', false))
->setLastname($this->getRequest()->getParam('lastname', false))
->setEmail(strtolower($this->getRequest()->getParam('email', false)));
- if ( $this->getRequest()->getParam('password', false) ) {
- $user->setPassword($this->getRequest()->getParam('password', false));
+ if ( $this->getRequest()->getParam('new_password', false) ) {
+ $user->setNewPassword($this->getRequest()->getParam('new_password', false));
}
- try {
- try {
- $_isValid = Zend_Validate::is($user->getUsername(), 'NotEmpty')
- && Zend_Validate::is($user->getFirstname(), 'NotEmpty')
- && Zend_Validate::is($user->getLastname(), 'NotEmpty')
- && Zend_Validate::is($user->getEmail(), 'EmailAddress');
+ if ($this->getRequest()->getParam('password_confirmation', false)) {
+ $user->setPasswordConfirmation($this->getRequest()->getParam('password_confirmation', false));
+ }
- if (!$_isValid) {
- Mage::throwException(Mage::helper('adminhtml')->__('Error while saving account. Please check all required fields'));
- }
- if ($user->userExists()) {
- Mage::throwException(Mage::helper('adminhtml')->__('User with the same User Name or Email aleady exists'));
- }
- $user->save();
- Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('adminhtml')->__('Account successfully saved'));
- }
- catch (Mage_Core_Exception $e) {
- throw $e;
- }
- catch (Exception $e) {
- throw new Exception(Mage::helper('adminhtml')->__('Error while saving account. Please try again later'));
+ $result = $user->validate();
+ if (is_array($result)) {
+ foreach($result as $error) {
+ Mage::getSingleton('adminhtml/session')->addError($error);
}
+ $this->getResponse()->setRedirect($this->getUrl("*/*/"));
+ return;
}
- catch (Exception $e) {
+
+ try {
+ $user->save();
+ Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('adminhtml')->__('Account successfully saved'));
+ }
+ catch (Mage_Core_Exception $e) {
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
}
+ catch (Exception $e) {
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('adminhtml')->__('Error while saving account. Please try again later'));
+ }
$this->getResponse()->setRedirect($this->getUrl("*/*/"));
}
diff --git a/app/code/core/Mage/Adminhtml/controllers/System/ConfigController.php b/app/code/core/Mage/Adminhtml/controllers/System/ConfigController.php
index 959e271762..348e98a94d 100644
--- a/app/code/core/Mage/Adminhtml/controllers/System/ConfigController.php
+++ b/app/code/core/Mage/Adminhtml/controllers/System/ConfigController.php
@@ -151,7 +151,7 @@ public function saveAction()
$session->addSuccess(Mage::helper('adminhtml')->__('Configuration successfully saved'));
}
catch (Mage_Core_Exception $e) {
- foreach(split("\n", $e->getMessage()) as $message) {
+ foreach(explode("\n", $e->getMessage()) as $message) {
$session->addError($message);
}
}
diff --git a/app/code/core/Mage/Adminhtml/controllers/System/Convert/ProfileController.php b/app/code/core/Mage/Adminhtml/controllers/System/Convert/ProfileController.php
index dc01be85f5..bfcbe3bc73 100644
--- a/app/code/core/Mage/Adminhtml/controllers/System/Convert/ProfileController.php
+++ b/app/code/core/Mage/Adminhtml/controllers/System/Convert/ProfileController.php
@@ -256,7 +256,7 @@ public function batchRunAction()
'savedRows' => $saved,
'errors' => $errors
);
- $this->getResponse()->setBody(Zend_Json::encode($result));
+ $this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
}
}
@@ -278,7 +278,7 @@ public function batchFinishAction()
$result['error'] = Mage::helper('adminhtml')->__('Error while finished process. Please refresh cache');
}
$batchModel->delete();
- $this->getResponse()->setBody(Zend_Json::encode($result));
+ $this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
}
}
}
diff --git a/app/code/core/Mage/Adminhtml/controllers/System/Email/TemplateController.php b/app/code/core/Mage/Adminhtml/controllers/System/Email/TemplateController.php
index 83733c1149..c3822d0f27 100644
--- a/app/code/core/Mage/Adminhtml/controllers/System/Email/TemplateController.php
+++ b/app/code/core/Mage/Adminhtml/controllers/System/Email/TemplateController.php
@@ -143,7 +143,7 @@ public function defaultTemplateAction()
$template->loadDefault($this->getRequest()->getParam('code'), $this->getRequest()->getParam('locale'));
- $this->getResponse()->setBody(Zend_Json::encode($template->getData()));
+ $this->getResponse()->setBody(Mage::helper('core')->jsonEncode($template->getData()));
}
protected function _isAllowed()
diff --git a/app/code/core/Mage/Adminhtml/controllers/Tax/ClassController.php b/app/code/core/Mage/Adminhtml/controllers/Tax/ClassController.php
index f91050ffdd..8ec767ae1e 100644
--- a/app/code/core/Mage/Adminhtml/controllers/Tax/ClassController.php
+++ b/app/code/core/Mage/Adminhtml/controllers/Tax/ClassController.php
@@ -66,7 +66,9 @@ public function saveAction()
}
$this->_redirectReferer();
+ return;
}
+ $this->getResponse()->setRedirect($this->getUrl('*/tax_class'));
}
/**
diff --git a/app/code/core/Mage/Adminhtml/controllers/Tax/RateController.php b/app/code/core/Mage/Adminhtml/controllers/Tax/RateController.php
index c3311f5a54..44d978e1bb 100644
--- a/app/code/core/Mage/Adminhtml/controllers/Tax/RateController.php
+++ b/app/code/core/Mage/Adminhtml/controllers/Tax/RateController.php
@@ -97,7 +97,9 @@ public function saveAction()
}
$this->_redirectReferer();
+ return;
}
+ $this->getResponse()->setRedirect($this->getUrl('*/tax_rate'));
}
/**
diff --git a/app/code/core/Mage/Adminhtml/controllers/Tax/RuleController.php b/app/code/core/Mage/Adminhtml/controllers/Tax/RuleController.php
index 075ce23f2b..6e641a7d03 100644
--- a/app/code/core/Mage/Adminhtml/controllers/Tax/RuleController.php
+++ b/app/code/core/Mage/Adminhtml/controllers/Tax/RuleController.php
@@ -95,7 +95,9 @@ public function saveAction()
Mage::getSingleton('adminhtml/session')->setRuleData($postData);
$this->_redirectReferer();
+ return;
}
+ $this->getResponse()->setRedirect($this->getUrl('*/tax_rule'));
}
public function deleteAction()
diff --git a/app/code/core/Mage/Adminhtml/controllers/UrlrewriteController.php b/app/code/core/Mage/Adminhtml/controllers/UrlrewriteController.php
index 3ead699a4c..90e17e0b51 100644
--- a/app/code/core/Mage/Adminhtml/controllers/UrlrewriteController.php
+++ b/app/code/core/Mage/Adminhtml/controllers/UrlrewriteController.php
@@ -151,7 +151,7 @@ public function saveAction()
// save and redirect
$model->save();
Mage::getSingleton('adminhtml/session')->addSuccess(
- Mage::helper('adminhtml')->__('Urlrewrite has been successfully saved')
+ Mage::helper('adminhtml')->__('URL Rewrite has been successfully saved')
);
$this->_redirect('*/*/');
return;
@@ -179,7 +179,7 @@ public function deleteAction()
try {
Mage::registry('current_urlrewrite')->delete();
Mage::getSingleton('adminhtml/session')->addSuccess(
- Mage::helper('adminhtml')->__('Urlrewrite has been successfully deleted')
+ Mage::helper('adminhtml')->__('URL Rewrite has been successfully deleted')
);
}
catch (Exception $e) {
diff --git a/app/code/core/Mage/AmazonPayments/Block/Asp/Form.php b/app/code/core/Mage/AmazonPayments/Block/Asp/Form.php
index 4f0e2badd0..c616c5b0ad 100644
--- a/app/code/core/Mage/AmazonPayments/Block/Asp/Form.php
+++ b/app/code/core/Mage/AmazonPayments/Block/Asp/Form.php
@@ -41,4 +41,15 @@ protected function _construct()
$this->setTemplate('amazonpayments/asp/form.phtml');
parent::_construct();
}
+
+ /**
+ * Return method description message
+ *
+ * @return string
+ */
+ public function getDescriptionMessage()
+ {
+ return $this->getMethod()->getChoiceMethodDescription();
+ }
+
}
diff --git a/app/code/core/Mage/AmazonPayments/Block/Asp/Redirect.php b/app/code/core/Mage/AmazonPayments/Block/Asp/Redirect.php
index 74f19f342a..c6109f714c 100644
--- a/app/code/core/Mage/AmazonPayments/Block/Asp/Redirect.php
+++ b/app/code/core/Mage/AmazonPayments/Block/Asp/Redirect.php
@@ -33,6 +33,17 @@
*/
class Mage_AmazonPayments_Block_Asp_Redirect extends Mage_Core_Block_Template
{
+
+ /**
+ * Return Amazon Simple Pay payment model
+ *
+ * @return Mage_AmazonPayments_Model_Payment_Asp
+ */
+ public function getPayment()
+ {
+ return Mage::registry('amazonpayments_payment_asp');
+ }
+
/**
* Return Amazon Simple Pay payment url
*
@@ -40,7 +51,7 @@ class Mage_AmazonPayments_Block_Asp_Redirect extends Mage_Core_Block_Template
*/
public function getRedirectUrl()
{
- return Mage::registry('amazonpayments_payment_asp')->getPayRedirectUrl();
+ return $this->getPayment()->getPayRedirectUrl();
}
/**
@@ -50,6 +61,17 @@ public function getRedirectUrl()
*/
public function getRedirectParams()
{
- return Mage::registry('amazonpayments_payment_asp')->getPayRedirectParams();
+ return $this->getPayment()->getPayRedirectParams();
+ }
+
+ /**
+ * Return redirect message
+ *
+ * @return string
+ */
+ public function getRedirectMessage()
+ {
+ return $this->getPayment()->getRedirectMessage();
}
+
}
diff --git a/app/code/core/Mage/AmazonPayments/Model/Payment/Asp.php b/app/code/core/Mage/AmazonPayments/Model/Payment/Asp.php
index cc409cc7f4..9ab650d7c0 100644
--- a/app/code/core/Mage/AmazonPayments/Model/Payment/Asp.php
+++ b/app/code/core/Mage/AmazonPayments/Model/Payment/Asp.php
@@ -183,7 +183,27 @@ public function getPayRedirectUrl()
{
return $this->getApi()->getPayUrl();
}
+
+ /**
+ * Return choice method description
+ *
+ * @return string
+ */
+ public function getChoiceMethodDescription()
+ {
+ return $this->getConfig('choice_method_description');
+ }
+ /**
+ * Return redirect message
+ *
+ * @return string
+ */
+ public function getRedirectMessage()
+ {
+ return $this->getConfig('redirect_message');
+ }
+
/**
* Return pay params for current order
*
diff --git a/app/code/core/Mage/AmazonPayments/Model/Payment/Cba.php b/app/code/core/Mage/AmazonPayments/Model/Payment/Cba.php
index 5a6afc39cc..c8ec4a4b61 100644
--- a/app/code/core/Mage/AmazonPayments/Model/Payment/Cba.php
+++ b/app/code/core/Mage/AmazonPayments/Model/Payment/Cba.php
@@ -446,6 +446,8 @@ protected function _createNewOrder(array $newOrderDetails)
->setCustomerGroupId(Mage_Customer_Model_Group::NOT_LOGGED_IN_ID);
}
+ $order->save();
+
$quote->setIsActive(false);
$quote->save();
diff --git a/app/code/core/Mage/AmazonPayments/etc/config.xml b/app/code/core/Mage/AmazonPayments/etc/config.xml
index f31edee80a..a92a921461 100644
--- a/app/code/core/Mage/AmazonPayments/etc/config.xml
+++ b/app/code/core/Mage/AmazonPayments/etc/config.xml
@@ -210,6 +210,8 @@ Something like this is to be added to resolve bug #4890
https://authorize.payments.amazon.com/pba/paypipelinehttps://authorize.payments-sandbox.amazon.com/pba/paypipeline
+ Your billing address will be ignored and you will be redirected to Amazon Simple Pay website.
+ You will be redirected to Amazon Simple Pay in a few seconds.MAGENTO ASP PAYMENTMAGENTO ASP REFUNDMAGENTO ASP CANCEL
diff --git a/app/code/core/Mage/AmazonPayments/etc/system.xml b/app/code/core/Mage/AmazonPayments/etc/system.xml
index 7b3e835b67..bd91ba946b 100644
--- a/app/code/core/Mage/AmazonPayments/etc/system.xml
+++ b/app/code/core/Mage/AmazonPayments/etc/system.xml
@@ -36,12 +36,12 @@
Signing up with Checkout by Amazon
To configure Checkout by Amazon™ you will need to enter your Checkout by Amazon™ Merchant ID, Access Key ID, and Secret Access Key.
-
If you do not already have a Checkout by Amazon™ account, click here to create one now. Sign-Up
+
If you do not already have a Checkout by Amazon™ account, click here to create one now. Sign-Up
To locate your Merchant ID, sign in to your Seller Central Checkout by Amazon™ account and click Settings > Checkout Pipeline Settings.
To locate your Access Key ID and Secret Access Key, sign in to your Seller Central Checkout by Amazon™ account and click Integration > AWS Key. Click the link to read the Amazon Web Services Customer Agreement, and then click the check box, if you are setting up a new Access Key ID.
To enable XML Order Reports click Settings > Checkout Pipeline Settings, and then clicking Edit under the Order Report Settings section. Select Order Report Type as XML to get XML Order Reports using SOAP APIs. Configure your downloads for hourly.
For additional information on setting up your Checkout by Amazon account, Click Here - FAQ.
\ No newline at end of file
diff --git a/app/design/adminhtml/default/default/template/sales/order/creditmemo/view/items/renderer/configurable.phtml b/app/design/adminhtml/default/default/template/sales/order/creditmemo/view/items/renderer/configurable.phtml
index 62008c4e59..26a2b03a93 100644
--- a/app/design/adminhtml/default/default/template/sales/order/creditmemo/view/items/renderer/configurable.phtml
+++ b/app/design/adminhtml/default/default/template/sales/order/creditmemo/view/items/renderer/configurable.phtml
@@ -29,9 +29,9 @@
\ No newline at end of file
diff --git a/app/design/adminhtml/default/default/template/sales/order/invoice/view/items/renderer/configurable.phtml b/app/design/adminhtml/default/default/template/sales/order/invoice/view/items/renderer/configurable.phtml
index a50773b564..730aa38ade 100644
--- a/app/design/adminhtml/default/default/template/sales/order/invoice/view/items/renderer/configurable.phtml
+++ b/app/design/adminhtml/default/default/template/sales/order/invoice/view/items/renderer/configurable.phtml
@@ -29,9 +29,9 @@
- __('Your billing address will be ignored and you will be redirected to Amazon Simple Pay website.') ?>
+ getDescriptionMessage() ?>
\ No newline at end of file
diff --git a/app/design/frontend/default/default/template/amazonpayments/asp/redirect.phtml b/app/design/frontend/default/default/template/amazonpayments/asp/redirect.phtml
index 3fdb3f0a20..6b8e98fbad 100644
--- a/app/design/frontend/default/default/template/amazonpayments/asp/redirect.phtml
+++ b/app/design/frontend/default/default/template/amazonpayments/asp/redirect.phtml
@@ -26,11 +26,11 @@
?>
- __('You will be redirected to Amazon Simple Pay in a few seconds.')); ?>
+ getRedirectMessage()); ?>
diff --git a/app/design/frontend/default/default/template/bundle/email/order/items/creditmemo/default.phtml b/app/design/frontend/default/default/template/bundle/email/order/items/creditmemo/default.phtml
index 6fad54dc25..4d3414ab03 100644
--- a/app/design/frontend/default/default/template/bundle/email/order/items/creditmemo/default.phtml
+++ b/app/design/frontend/default/default/template/bundle/email/order/items/creditmemo/default.phtml
@@ -67,8 +67,8 @@
+ getChildHtml('creditmemo_totals');?>
\ No newline at end of file
diff --git a/app/design/frontend/default/default/template/email/order/invoice/items.phtml b/app/design/frontend/default/default/template/email/order/invoice/items.phtml
index 5cbc0ea033..c4f0550060 100644
--- a/app/design/frontend/default/default/template/email/order/invoice/items.phtml
+++ b/app/design/frontend/default/default/template/email/order/invoice/items.phtml
@@ -45,32 +45,7 @@
-
+ getChildHtml('invoice_totals')?>
\ No newline at end of file
diff --git a/app/design/frontend/default/default/template/email/order/items.phtml b/app/design/frontend/default/default/template/email/order/items.phtml
index bc8d188102..90e49848ed 100644
--- a/app/design/frontend/default/default/template/email/order/items.phtml
+++ b/app/design/frontend/default/default/template/email/order/items.phtml
@@ -53,32 +53,6 @@
\ No newline at end of file
diff --git a/app/design/frontend/default/default/template/sales/order/print.phtml b/app/design/frontend/default/default/template/sales/order/print.phtml
index f907751b10..e3627045a3 100644
--- a/app/design/frontend/default/default/template/sales/order/print.phtml
+++ b/app/design/frontend/default/default/template/sales/order/print.phtml
@@ -72,31 +72,8 @@