Index: app/Mage.php
===================================================================
--- app/Mage.php (revision 44104)
+++ app/Mage.php (revision 44105)
@@ -84,7 +84,7 @@
public static function getVersion()
{
- return '1.3.2.1';
+ return '1.3.2.2';
}
/**
@@ -596,7 +596,7 @@
return;
}
$file = Mage::getStoreConfig('dev/log/exception_file');
- self::log("\n".$e->getTraceAsString(), Zend_Log::ERR, $file);
+ self::log("\n".(string)$e, Zend_Log::ERR, $file);
}
/**
Index: app/locale/en_US/Mage_Reports.csv
===================================================================
--- app/locale/en_US/Mage_Reports.csv (revision 44104)
+++ app/locale/en_US/Mage_Reports.csv (revision 44105)
@@ -35,6 +35,7 @@
"Guest","Guest"
"Hits","Hits"
"ID","ID"
+"Index model name must be defined","Index model name must be defined"
"Invalid date specified","Invalid date specified"
"Invoiced","Invoiced"
"Items Ordered","Items Ordered"
@@ -80,12 +81,12 @@
"Price","Price"
"Product Name","Product Name"
"Product Reviews","Product Reviews"
-"Product Sku","Product Sku"
+"Product SKU","Product SKU"
"Product Tags","Product Tags"
"Products","Products"
+"Products Ordered","Products Ordered"
"Products Report","Products Report"
"Products Reviews","Products Reviews"
-"Products Sold","Products Sold"
"Products Tags","Products Tags"
"Products in carts","Products in carts"
"Purchases","Purchases"
Index: app/locale/en_US/Mage_Customer.csv
===================================================================
--- app/locale/en_US/Mage_Customer.csv (revision 44104)
+++ app/locale/en_US/Mage_Customer.csv (revision 44105)
@@ -78,6 +78,7 @@
"Customer doesn't have primary billing address","Customer doesn't have primary billing address"
"Customer email already exists","Customer email already exists"
"Customer website id must be specified, when using website scope.","Customer website id must be specified, when using website scope."
+"Customer will stay on the current page if ""No"" is selected","Customer will stay on the current page if ""No"" is selected"
"Customers","Customers"
"Customers Only","Customers Only"
"Customers Section","Customers Section"
@@ -170,6 +171,7 @@
"Log in or Create an Account","Log in or Create an Account"
"Login","Login"
"Login Information","Login Information"
+"Login Options","Login Options"
"Login and password are required","Login and password are required"
"Login or Create an Account","Login or Create an Account"
"M.I.","M.I."
@@ -266,6 +268,7 @@
"Qty","Qty"
"Recent Orders","Recent Orders"
"Records for ""","Records for """
+"Redirect Customer to Account Dashboard after Logging in","Redirect Customer to Account Dashboard after Logging in"
"Refunded","Refunded"
"Registered Customers","Registered Customers"
"Remove","Remove"
@@ -274,9 +277,9 @@
"Retrieve address info","Retrieve address info"
"Retrieve customer addresses","Retrieve customer addresses"
"Retrieve customer data","Retrieve customer data"
-"Retrieve customer's groups","Retrieve customer's groups"
+"Retrieve customer groups","Retrieve customer groups"
+"Retrieve customer info","Retrieve customer info"
"Retrieve customers","Retrieve customers"
-"Retrieve customers info","Retrieve customers info"
"Retrieve your confirmation link here","Retrieve your confirmation link here"
"Retrieve your password here","Retrieve your password here"
"SKU","SKU"
@@ -289,6 +292,7 @@
"Save Password","Save Password"
"Saved ","Saved "
"Semicolon (;) separated values. Put semicolon in the beginning for empty first option. Leave empty for open text field.","Semicolon (;) separated values. Put semicolon in the beginning for empty first option. Leave empty for open text field."
+"Send From","Send From"
"Send Welcome Email after Confirmation","Send Welcome Email after Confirmation"
"Send auto-generated password","Send auto-generated password"
"Send confirmation link","Send confirmation link"
@@ -299,8 +303,6 @@
"Set as Default Billing Address","Set as Default Billing Address"
"Set as Default Shipping Address","Set as Default Shipping Address"
"Share Customer Accounts","Share Customer Accounts"
-"Ship to First name","Ship to First name"
-"Ship to Last name","Ship to Last name"
"Shipped to First Name","Shipped to First Name"
"Shipped to Last Name","Shipped to Last Name"
"Shipped to Name","Shipped to Name"
Index: app/locale/en_US/Mage_CatalogRule.csv
===================================================================
--- app/locale/en_US/Mage_CatalogRule.csv (revision 44104)
+++ app/locale/en_US/Mage_CatalogRule.csv (revision 44105)
@@ -55,7 +55,6 @@
"Start at: %s","Start at: %s"
"Status","Status"
"Stop further rules processing","Stop further rules processing"
-"The page you are trying to save no longer exists","The page you are trying to save no longer exists"
"There are rules that have been changed but not applied. Please, click Apply Rules in order to see immediate effect in catalog.","There are rules that have been changed but not applied. Please, click Apply Rules in order to see immediate effect in catalog."
"This rule no longer exists","This rule no longer exists"
"To Date","To Date"
@@ -63,4 +62,5 @@
"Unable to find a page to delete","Unable to find a page to delete"
"Update product's %s %s: %s","Update product's %s %s: %s"
"Websites","Websites"
+"Wrong rule specified.","Wrong rule specified."
"Yes","Yes"
Index: app/locale/en_US/Mage_Backup.csv
===================================================================
--- app/locale/en_US/Mage_Backup.csv (revision 44104)
+++ app/locale/en_US/Mage_Backup.csv (revision 44105)
@@ -1,5 +1,4 @@
"Action","Action"
-"All types","All types"
"Backup file ""%s"" can\'t read or write","Backup file ""%s"" can\'t read or write"
"Backup file ""%s"" doesn\'t exist","Backup file ""%s"" doesn\'t exist"
"Backup file doesn't exist","Backup file doesn't exist"
Index: app/locale/en_US/Mage_Sales.csv
===================================================================
--- app/locale/en_US/Mage_Sales.csv (revision 44104)
+++ app/locale/en_US/Mage_Sales.csv (revision 44105)
@@ -1,5 +1,6 @@
" The customer doesn\'t exist in the system anymore"," The customer doesn\'t exist in the system anymore"
"""%s"" coupon code is not valid.","""%s"" coupon code is not valid."
+"%s","%s"
"%s / %s rate:","%s / %s rate:"
"%s for %s","%s for %s"
"%s order(s) successfully canceled","%s order(s) successfully canceled"
@@ -28,10 +29,10 @@
"Add new tracking number","Add new tracking number"
"Add to Cart","Add to Cart"
"Address","Address"
+"Address model is not defined","Address model is not defined"
+"Address total model should be extended from Mage_Sales_Model_Quote_Address_Total_Abstract","Address total model should be extended from Mage_Sales_Model_Quote_Address_Total_Abstract"
"Adjustment Fee","Adjustment Fee"
-"Adjustment Fee:","Adjustment Fee:"
"Adjustment Refund","Adjustment Refund"
-"Adjustment Refund:","Adjustment Refund:"
"Allow Reorder","Allow Reorder"
"Amount","Amount"
"Append Comments","Append Comments"
@@ -48,7 +49,6 @@
"Billing Address","Billing Address"
"Buy %s for price %s","Buy %s for price %s"
"Can not add order history.","Can not add order history."
-"Can not create block ""%s""","Can not create block ""%s"""
"Can not do invoice for order.","Can not do invoice for order."
"Can not do shipment for order.","Can not do shipment for order."
"Can not register existing creditmemo","Can not register existing creditmemo"
@@ -151,7 +151,6 @@
"Gift Message for this Order","Gift Message for this Order"
"Grand Total","Grand Total"
"Grand Total to be charged","Grand Total to be charged"
-"Grand Total:","Grand Total:"
"Guest","Guest"
"Hold","Hold"
"Hold action is not available","Hold action is not available"
@@ -161,7 +160,9 @@
"If empty, the default error above will be used","If empty, the default error above will be used"
"Incl. Tax","Incl. Tax"
"Information","Information"
+"Invalid block: %s","Invalid block: %s"
"Invalid carrier specified.","Invalid carrier specified."
+"Invalid draw line data. Please define ""lines"" array","Invalid draw line data. Please define ""lines"" array"
"Invalid item option format","Invalid item option format"
"Invalid qty to invoice item ""%s""","Invalid qty to invoice item ""%s"""
"Invalid qty to refund item ""%s""","Invalid qty to refund item ""%s"""
@@ -205,7 +206,6 @@
"Items Refunded","Items Refunded"
"Items Shipped","Items Shipped"
"Items options declare error.","Items options declare error."
-"Items to Invoice","Items to Invoice"
"Items to Refund","Items to Refund"
"Items to Ship","Items to Ship"
"Last ordered items","Last ordered items"
@@ -239,6 +239,7 @@
"New Order for Guest","New Order for Guest"
"New Shipment","New Shipment"
"New Shipment for Guest","New Shipment for Guest"
+"New Shipment for Order #%s","New Shipment for Order #%s"
"New Status","New Status"
"Newsletter Subscription","Newsletter Subscription"
"No Items","No Items"
@@ -280,7 +281,6 @@
"Order Shipments","Order Shipments"
"Order Status","Order Status"
"Order Subtotal","Order Subtotal"
-"Order Subtotal:","Order Subtotal:"
"Order Total","Order Total"
"Order Totals","Order Totals"
"Order Update","Order Update"
@@ -314,10 +314,12 @@
"Payment Information","Payment Information"
"Payment Method","Payment Method"
"Payment Method:","Payment Method:"
+"Pdf total model should extend Mage_Sales_Model_Order_Pdf_Total_Default","Pdf total model should extend Mage_Sales_Model_Order_Pdf_Total_Default"
"Pending","Pending"
"Pending PayPal","Pending PayPal"
"Pending Payment","Pending Payment"
"Placed from IP","Placed from IP"
+"Please define PDF object before using","Please define PDF object before using"
"Please enter positive number in this field.","Please enter positive number in this field."
"Please select a customer","Please select a customer"
"Please select a store","Please select a store"
@@ -414,6 +416,7 @@
"Shipment","Shipment"
"Shipment #","Shipment #"
"Shipment #%s","Shipment #%s"
+"Shipment #%s (%s)","Shipment #%s (%s)"
"Shipment Comment Email Sender","Shipment Comment Email Sender"
"Shipment Comment Email Template","Shipment Comment Email Template"
"Shipment Comment Email Template for Guest","Shipment Comment Email Template for Guest"
@@ -430,7 +433,6 @@
"Shipped By","Shipped By"
"Shipping","Shipping"
"Shipping & Handling","Shipping & Handling"
-"Shipping & Handling:","Shipping & Handling:"
"Shipping & Handling","Shipping & Handling"
"Shipping & Handling Information","Shipping & Handling Information"
"Shipping Address","Shipping Address"
@@ -462,7 +464,6 @@
"Subtotal:","Subtotal:"
"TAX/VAT Number","TAX/VAT Number"
"Tax","Tax"
-"Tax :","Tax :"
"Tax Amount","Tax Amount"
"Tax Percent","Tax Percent"
"Telephone","Telephone"
Index: app/locale/en_US/Mage_ProductAlert.csv
===================================================================
--- app/locale/en_US/Mage_ProductAlert.csv (revision 44104)
+++ app/locale/en_US/Mage_ProductAlert.csv (revision 44105)
@@ -18,6 +18,7 @@
"Product not found","Product not found"
"Product price alert","Product price alert"
"Product stock alert","Product stock alert"
+"Regular Price:","Regular Price:"
"Sign up for price alert","Sign up for price alert"
"Sign up to get notified when this product is back in stock","Sign up to get notified when this product is back in stock"
"Special price:","Special price:"
Index: app/locale/en_US/Mage_Page.csv
===================================================================
--- app/locale/en_US/Mage_Page.csv (revision 44104)
+++ app/locale/en_US/Mage_Page.csv (revision 44105)
@@ -8,6 +8,10 @@
"- Use the %s, %s buttons to select year","- Use the %s, %s buttons to select year"
"- or Shift-click to decrease it","- or Shift-click to decrease it"
"- or click and drag for faster selection.","- or click and drag for faster selection."
+"1 column","1 column"
+"2 columns with left bar","2 columns with left bar"
+"2 columns with right bar","2 columns with right bar"
+"3 columns","3 columns"
"About the calendar","About the calendar"
"Click here if nothing has happened","Click here if nothing has happened"
"Close","Close"
@@ -19,6 +23,7 @@
"Display %s first","Display %s first"
"Distributed under GNU LGPL. See %s for details.","Distributed under GNU LGPL. See %s for details."
"Drag to move","Drag to move"
+"Empty","Empty"
"For latest version visit: %s","For latest version visit: %s"
"Go Today","Go Today"
"Help Us to Keep Magento Healthy","Help Us to Keep Magento Healthy"
@@ -43,7 +48,9 @@
"This is a demo store. Any orders placed through this store will not be honored or fulfilled.","This is a demo store. Any orders placed through this store will not be honored or fulfilled."
"Time selection:","Time selection:"
"Time:","Time:"
+"We detected that your JavaScript seem to be disabled.","We detected that your JavaScript seem to be disabled."
"Welcome, %s!","Welcome, %s!"
+"You must have JavaScript enabled in your browser to utilize the functionality of this website.","You must have JavaScript enabled in your browser to utilize the functionality of this website."
"You're currently on:","You're currently on:"
"Your Language","Your Language"
"Your Language:","Your Language:"
Index: app/locale/en_US/Mage_Cms.csv
===================================================================
--- app/locale/en_US/Mage_Cms.csv (revision 44104)
+++ app/locale/en_US/Mage_Cms.csv (revision 44105)
@@ -9,6 +9,7 @@
"Block was successfully saved","Block was successfully saved"
"CMS","CMS"
"CMS Home Page","CMS Home Page"
+"CMS No Cookies Page","CMS No Cookies Page"
"CMS No Route Page","CMS No Route Page"
"Content","Content"
"Custom Design","Custom Design"
@@ -49,10 +50,12 @@
"Page was successfully saved","Page was successfully saved"
"Poll Manager","Poll Manager"
"Product Tax Class Information","Product Tax Class Information"
+"Redirect to CMS-page if cookies are disabled","Redirect to CMS-page if cookies are disabled"
"SEF URL Identifier","SEF URL Identifier"
"Save Block","Save Block"
"Save Page","Save Page"
"Show breadcrumbs for CMS pages","Show breadcrumbs for CMS pages"
+"Show notice if JavaScipt is disabled","Show notice if JavaScipt is disabled"
"Static Blocks","Static Blocks"
"Status","Status"
"Store View","Store View"
Index: app/locale/en_US/Mage_Paypal.csv
===================================================================
--- app/locale/en_US/Mage_Paypal.csv (revision 44104)
+++ app/locale/en_US/Mage_Paypal.csv (revision 44105)
@@ -1,10 +1,3 @@
-"
- Example: https://www.paypal.com/au/cgi-bin/webscr?cmd=_express-checkout&useraction=&token=
- Where <user_action> is 'commit' or 'continue', depending on your preference of commit button text.
- ","
- Example: https://www.paypal.com/au/cgi-bin/webscr?cmd=_express-checkout&useraction=&token=
- Where <user_action> is 'commit' or 'continue', depending on your preference of commit button text.
- "
"API Password","API Password"
"API Signature","API Signature"
"API User Name","API User Name"
@@ -29,6 +22,7 @@
"Enabled","Enabled"
"Error in creating an invoice","Error in creating an invoice"
"Error in refunding the payment","Error in refunding the payment"
+"Example: https://www.paypal.com/au/cgi-bin/webscr?cmd=_express-checkout&useraction=&token= Where <user_action> is 'commit' or 'continue', depending on your preference of commit button text.","Example: https://www.paypal.com/au/cgi-bin/webscr?cmd=_express-checkout&useraction=&token= Where <user_action> is 'commit' or 'continue', depending on your preference of commit button text."
"Expiration Date","Expiration Date"
"Expiration Date: %s/%s","Expiration Date: %s/%s"
"Incl. Tax","Incl. Tax"
Index: app/locale/en_US/Mage_Core.csv
===================================================================
--- app/locale/en_US/Mage_Core.csv (revision 44104)
+++ app/locale/en_US/Mage_Core.csv (revision 44105)
@@ -22,11 +22,13 @@
"Before modifying the website code please make sure that it is not used in index.php","Before modifying the website code please make sure that it is not used in index.php"
"Block with name ""%s"" already exists","Block with name ""%s"" already exists"
"Blocks HTML output","Blocks HTML output"
+"Browser Capabilities Detection","Browser Capabilities Detection"
"Can't retrieve request object","Can't retrieve request object"
"Can\'t retrieve entity config: %s","Can\'t retrieve entity config: %s"
"Cancel","Cancel"
"Cannot Delete Email Template","Cannot Delete Email Template"
"Cannot complete this operation from non-admin area.","Cannot complete this operation from non-admin area."
+"Card type doesn\'t match credit card number","Card type doesn\'t match credit card number"
"Category object is required for determining product request path","Category object is required for determining product request path"
"Code","Code"
"Collections Data","Collections Data"
@@ -40,6 +42,7 @@
"Create Store","Create Store"
"Create Store View","Create Store View"
"Create Website","Create Website"
+"Credit card number doesn\'t match credit card type","Credit card number doesn\'t match credit card type"
"Current package name","Current package name"
"Custom Design","Custom Design"
"Custom admin URL","Custom admin URL"
@@ -72,6 +75,7 @@
"Developer Client Restrictions","Developer Client Restrictions"
"Disable email communications","Disable email communications"
"Disable modules output","Disable modules output"
+"Display demo store notice","Display demo store notice"
"Duplicate Of Template Code","Duplicate Of Template Code"
"Edit Design Change","Edit Design Change"
"Edit Store","Edit Store"
@@ -79,6 +83,7 @@
"Edit Website","Edit Website"
"Empty identifier field name","Empty identifier field name"
"Empty main table name","Empty main table name"
+"Enable Prototype Deprecation Log","Enable Prototype Deprecation Log"
"Enabled","Enabled"
"Enabled for Admin","Enabled for Admin"
"Enabled for Frontend","Enabled for Frontend"
@@ -108,6 +113,7 @@
"Invalid messages storage ""%s"" for layout messages initialization","Invalid messages storage ""%s"" for layout messages initialization"
"Invalid transactional email code: ","Invalid transactional email code: "
"Invalid websites configuration path: %s","Invalid websites configuration path: %s"
+"JavaScript Settings","JavaScript Settings"
"Layout","Layout"
"Layouts","Layouts"
"Leave empty for access from any location","Leave empty for access from any location"
@@ -120,6 +126,8 @@
"Logo Image Src","Logo Image Src"
"Manage Stores","Manage Stores"
"Match expressions in the same order as displayed in the configuration.","Match expressions in the same order as displayed in the configuration."
+"Maximum length exceeded.","Maximum length exceeded."
+"Merge JavaScript Files","Merge JavaScript Files"
"Miscellaneous HTML","Miscellaneous HTML"
"Miscellaneous scripts","Miscellaneous scripts"
"Model class does not exist: %s","Model class does not exist: %s"
@@ -142,6 +150,7 @@
"Please enter a valid URL. For example http://www.example.com or www.example.com","Please enter a valid URL. For example http://www.example.com or www.example.com"
"Please enter a valid URL. http:// is required","Please enter a valid URL. http:// is required"
"Please enter a valid credit card number.","Please enter a valid credit card number."
+"Please enter a valid credit card verification number.","Please enter a valid credit card verification number."
"Please enter a valid date.","Please enter a valid date."
"Please enter a valid email address. For example johndoe@domain.com.","Please enter a valid email address. For example johndoe@domain.com."
"Please enter a valid number in this field.","Please enter a valid number in this field."
@@ -150,6 +159,7 @@
"Please enter a valid zip code.","Please enter a valid zip code."
"Please enter a valid zip code. For example 90602 or 90602-1234.","Please enter a valid zip code. For example 90602 or 90602-1234."
"Please enter valid password.","Please enter valid password."
+"Please input a valid CSS-length. For example 100px or 77pt or 20em or .5ex or 50%","Please input a valid CSS-length. For example 100px or 77pt or 20em or .5ex or 50%"
"Please make sure that Base URL ends with '/' (slash), e.g. http://yourdomain/magento/","Please make sure that Base URL ends with '/' (slash), e.g. http://yourdomain/magento/"
"Please make sure your passwords match.","Please make sure your passwords match."
"Please select State/Province.","Please select State/Province."
@@ -161,6 +171,7 @@
"Please use letters only (a-z or A-Z) in this field.","Please use letters only (a-z or A-Z) in this field."
"Please use letters only (a-z) in this field.","Please use letters only (a-z) in this field."
"Please use numbers only in this field. please avoid spaces or other characters such as dots or commas.","Please use numbers only in this field. please avoid spaces or other characters such as dots or commas."
+"Please use only letters (a-z or A-Z), numbers (0-9) or underscore(_) in this field, first character should be a letter.","Please use only letters (a-z or A-Z), numbers (0-9) or underscore(_) in this field, first character should be a letter."
"Please use only letters (a-z) or numbers (0-9) only in this field. No spaces or other characters are allowed.","Please use only letters (a-z) or numbers (0-9) only in this field. No spaces or other characters are allowed."
"Please use only letters (a-z) or numbers (0-9) or spaces and # only in this field.","Please use only letters (a-z) or numbers (0-9) or spaces and # only in this field."
"Please use only letters (a-z), numbers (0-9) or underscore(_) in this field, first character should be a letter.","Please use only letters (a-z), numbers (0-9) or underscore(_) in this field, first character should be a letter."
@@ -169,7 +180,6 @@
"Polls","Polls"
"Port (25)","Port (25)"
"Profiler","Profiler"
-"Prototype Deprecation Log","Prototype Deprecation Log"
"Request path for specified store","Request path for specified store"
"Requested invalid store ""%s""","Requested invalid store ""%s"""
"Resource is not set","Resource is not set"
@@ -188,7 +198,7 @@
"Sender name","Sender name"
"Services","Services"
"Session Cookie management","Session Cookie management"
-"Session Lifetime, Seconds","Session Lifetime, Seconds"
+"Session Lifetime (seconds)","Session Lifetime (seconds)"
"Session Validation Settings","Session Validation Settings"
"Set as default","Set as default"
"Skin (Images / CSS)","Skin (Images / CSS)"
@@ -268,6 +278,7 @@
"Welcome Text","Welcome Text"
"Wrong number of arguments for %s","Wrong number of arguments for %s"
"Yes","Yes"
+"Your design change for the specified store intersects with another one, please specify another date range","Your design change for the specified store intersects with another one, please specify another date range"
"Your order can not be completed at this time as there is no payment methods available for it.","Your order can not be completed at this time as there is no payment methods available for it."
"Your order can not be completed at this time as there is no shipping methods available for it. Please make necessary changes in your shipping address.","Your order can not be completed at this time as there is no shipping methods available for it. Please make necessary changes in your shipping address."
"Your session has been expired, you will be relogged in now.","Your session has been expired, you will be relogged in now."
Index: app/locale/en_US/Mage_Tax.csv
===================================================================
--- app/locale/en_US/Mage_Tax.csv (revision 44104)
+++ app/locale/en_US/Mage_Tax.csv (revision 44105)
@@ -13,7 +13,6 @@
"Class Name","Class Name"
"Code","Code"
"Country","Country"
-"Country/Region/Postal code combination","Country/Region/Postal code combination"
"County","County"
"Custom price if available","Custom price if available"
"Customer Tax Class","Customer Tax Class"
@@ -22,7 +21,7 @@
"Default Country","Default Country"
"Default Post Code","Default Post Code"
"Default State","Default State"
-"Default Tax Origin Calculation","Default Tax Origin Calculation"
+"Default Tax Destination Calculation","Default Tax Destination Calculation"
"Delete Class","Delete Class"
"Delete Rate","Delete Rate"
"Delete Rule","Delete Rule"
@@ -30,6 +29,7 @@
"Display Cart/Order Prices","Display Cart/Order Prices"
"Display Product Prices","Display Product Prices"
"Display Shipping Prices","Display Shipping Prices"
+"Display Subtotal","Display Subtotal"
"Display Zero Tax Subtotal","Display Zero Tax Subtotal"
"Display full tax summary","Display full tax summary"
"Edit Class","Edit Class"
@@ -44,7 +44,6 @@
"Error while saving this tax class. Class with the same name ","Error while saving this tax class. Class with the same name "
"Error while saving this tax class. Please try again later.","Error while saving this tax class. Please try again later."
"Error while saving this tax rule. Please try again later.","Error while saving this tax rule. Please try again later."
-"Error while saving this tax rule. This product tax class, customer tax class and tax rate combination","Error while saving this tax rule. This product tax class, customer tax class and tax rate combination"
"Excl. Tax","Excl. Tax"
"Excl. Tax:","Excl. Tax:"
"Excluding tax","Excluding tax"
@@ -57,8 +56,6 @@
"Incl. Tax:","Incl. Tax:"
"Including and excluding tax","Including and excluding tax"
"Including tax","Including tax"
-"Incorrect rate Data","Incorrect rate Data"
-"Invalid data for tax rate calculation","Invalid data for tax rate calculation"
"Invalid file format upload attempt","Invalid file format upload attempt"
"Invalid file upload attempt","Invalid file upload attempt"
"Manage Customer Tax Classes","Manage Customer Tax Classes"
@@ -82,6 +79,7 @@
"Product Tax Classes","Product Tax Classes"
"Rate","Rate"
"Reset","Reset"
+"Row Total","Row Total"
"Sales","Sales"
"Save Class","Save Class"
"Save Rate","Save Rate"
@@ -90,8 +88,11 @@
"Sort Order","Sort Order"
"State","State"
"State/Region","State/Region"
+"Subtotal (Excl. Tax)","Subtotal (Excl. Tax)"
+"Subtotal (Incl. Tax)","Subtotal (Incl. Tax)"
"Tax","Tax"
"Tax Based On","Tax Based On"
+"Tax Calculation Method Based On","Tax Calculation Method Based On"
"Tax Class for Shipping","Tax Class for Shipping"
"Tax Classes","Tax Classes"
"Tax Identifier","Tax Identifier"
@@ -111,6 +112,8 @@
"Tax rule was successfully saved","Tax rule was successfully saved"
"This class no longer exists","This class no longer exists"
"This rule no longer exists","This rule no longer exists"
+"Total","Total"
+"Unit Price","Unit Price"
"XML","XML"
"You cannot delete this tax class as it is used for %d customer groups.","You cannot delete this tax class as it is used for %d customer groups."
"You cannot delete this tax class as it is used for %d products.","You cannot delete this tax class as it is used for %d products."
Index: app/locale/en_US/Mage_Newsletter.csv
===================================================================
--- app/locale/en_US/Mage_Newsletter.csv (revision 44104)
+++ app/locale/en_US/Mage_Newsletter.csv (revision 44105)
@@ -1,4 +1,5 @@
" Copy"," Copy"
+" Follow this link to unsubscribe {{var subscriber.getUnsubscriptionLink()}} "," Follow this link to unsubscribe {{var subscriber.getUnsubscriptionLink()}} "
"Action","Action"
"Add New Template","Add New Template"
"Add to Queue","Add to Queue"
@@ -8,7 +9,6 @@
"Cancel","Cancel"
"Cancelled","Cancelled"
"Cannot delete subscriber","Cannot delete subscriber"
-"Cannot delete template","Cannot delete template"
"Cannot mark as received subscriber","Cannot mark as received subscriber"
"Cannot save your subscription: %s","Cannot save your subscription: %s"
"Confirmation Email Sender","Confirmation Email Sender"
@@ -73,7 +73,7 @@
"Queue Date Start","Queue Date Start"
"Queue Finish","Queue Finish"
"Queue Information","Queue Information"
-"Queue Newsletter","Queue Newsletter"
+"Queue Newsletter...","Queue Newsletter..."
"Queue Start","Queue Start"
"Queue Subject","Queue Subject"
"Recipients","Recipients"
Index: app/locale/en_US/Mage_SalesRule.csv
===================================================================
--- app/locale/en_US/Mage_SalesRule.csv (revision 44104)
+++ app/locale/en_US/Mage_SalesRule.csv (revision 44105)
@@ -71,7 +71,6 @@
"Status","Status"
"Stop further rules processing","Stop further rules processing"
"Subtotal","Subtotal"
-"The page you are trying to save no longer exists","The page you are trying to save no longer exists"
"This rule no longer exists","This rule no longer exists"
"To Date","To Date"
"To Fixed Amount","To Fixed Amount"
@@ -86,4 +85,5 @@
"Update the Product","Update the Product"
"Uses per coupon","Uses per coupon"
"Uses per customer","Uses per customer"
+"Wrong rule specified.","Wrong rule specified."
"Yes","Yes"
Index: app/locale/en_US/Mage_Checkout.csv
===================================================================
--- app/locale/en_US/Mage_Checkout.csv (revision 44104)
+++ app/locale/en_US/Mage_Checkout.csv (revision 44105)
@@ -140,7 +140,6 @@
"Please continue shopping .","Please continue shopping ."
"Please agree to all Terms and Conditions before placing the order.","Please agree to all Terms and Conditions before placing the order."
"Please agree to all Terms and Conditions before placing the orders.","Please agree to all Terms and Conditions before placing the orders."
-"Please enter a valid zip code. For example 90602 or 90602-1234.","Please enter a valid zip code. For example 90602 or 90602-1234."
"Please log in below:","Please log in below:"
"Please select region, state or province","Please select region, state or province"
"Please select shipping address for applicable items","Please select shipping address for applicable items"
Index: app/locale/en_US/Mage_Install.csv
===================================================================
--- app/locale/en_US/Mage_Install.csv (revision 44104)
+++ app/locale/en_US/Mage_Install.csv (revision 44105)
@@ -58,6 +58,7 @@
"Installation","Installation"
"Installation Guide","Installation Guide"
"Last Name","Last Name"
+"License Agreement","License Agreement"
"Locale","Locale"
"Locale settings","Locale settings"
"Localization","Localization"
@@ -110,3 +111,4 @@
"You can specify server port, ex.: localhost:3307 If you are not using default UNIX socket, you can specify it here instead of host, ex.: /var/run/mysqld/mysqld.sock","You can specify server port, ex.: localhost:3307 If you are not using default UNIX socket, you can specify it here instead of host, ex.: /var/run/mysqld/mysqld.sock"
"You could enable this option to use web server rewrites functionality for improved search engines optimization.","You could enable this option to use web server rewrites functionality for improved search engines optimization."
"You're All Set","You're All Set"
+"You're All Set!","You're All Set!"
Index: app/locale/en_US/Mage_Wishlist.csv
===================================================================
--- app/locale/en_US/Mage_Wishlist.csv (revision 44104)
+++ app/locale/en_US/Mage_Wishlist.csv (revision 44105)
@@ -9,11 +9,13 @@
"Are you sure you want to remove this product from your wishlist?","Are you sure you want to remove this product from your wishlist?"
"Are you sure you would like to remove this item from the wishlist?","Are you sure you would like to remove this item from the wishlist?"
"Back","Back"
+"Can not add item to shopping cart","Can not add item to shopping cart"
"Can\'t save description %s","Can\'t save description %s"
"Cannot create wishlist","Cannot create wishlist"
"Cannot specify product","Cannot specify product"
"Check this checkbox if you want to add a link to an rss feed to your wishlist.","Check this checkbox if you want to add a link to an rss feed to your wishlist."
"Comment","Comment"
+"Comment:","Comment:"
"Email Sender","Email Sender"
"Email Template","Email Template"
"Email address can\'t be empty.","Email address can\'t be empty."
Index: app/locale/en_US/Mage_GoogleBase.csv
===================================================================
--- app/locale/en_US/Mage_GoogleBase.csv (revision 44104)
+++ app/locale/en_US/Mage_GoogleBase.csv (revision 44105)
@@ -1,3 +1,4 @@
+"Account Type","Account Type"
"Account login","Account login"
"Account password","Account password"
"Active","Active"
@@ -22,7 +23,6 @@
"Confirm","Confirm"
"Current Mapping will be reloaded. Continue?","Current Mapping will be reloaded. Continue?"
"Custom attribute, no mapping","Custom attribute, no mapping"
-"Default Store (%s)","Default Store (%s)"
"Delete","Delete"
"Delete Mapping","Delete Mapping"
"Edit Item Type","Edit Item Type"
@@ -31,6 +31,7 @@
"Euro","Euro"
"Expires","Expires"
"Germany","Germany"
+"Google","Google"
"Google Base","Google Base"
"Google Base Attribute","Google Base Attribute"
"Google Base ID","Google Base ID"
@@ -38,6 +39,8 @@
"Google Base Item type","Google Base Item type"
"Google Base Items","Google Base Items"
"Hide","Hide"
+"Hosted","Hosted"
+"Hosted or Google","Hosted or Google"
"Impr.","Impr."
"Invalid Product Model for Google Base Item","Invalid Product Model for Google Base Item"
"Item Type was deleted","Item Type was deleted"
@@ -72,6 +75,7 @@
"Total of %d product(s) were successfully added to Google Base","Total of %d product(s) were successfully added to Google Base"
"US Dollar","US Dollar"
"Unable to connect to Google Base. Please, check Account settings in configuration.","Unable to connect to Google Base. Please, check Account settings in configuration."
+"Unable to select a Store View","Unable to select a Store View"
"United Kingdom","United Kingdom"
"United States","United States"
"Update Google Base item when product is updated","Update Google Base item when product is updated"
Index: app/locale/en_US/Mage_Api.csv
===================================================================
--- app/locale/en_US/Mage_Api.csv (revision 44104)
+++ app/locale/en_US/Mage_Api.csv (revision 44105)
@@ -26,6 +26,7 @@
"Add","Add"
"Add Contents Path","Add Contents Path"
"Add Field with URL:","Add Field with URL:"
+"Add Gift Card","Add Gift Card"
"Add Maintainer","Add Maintainer"
"Add New Role","Add New Role"
"Add New Template","Add New Template"
@@ -34,7 +35,6 @@
"Add Package dependency","Add Package dependency"
"Add Subpackage dependency","Add Subpackage dependency"
"Add new store view map","Add new store view map"
-"Add new website map","Add new website map"
"Address Type:","Address Type:"
"All","All"
"All Websites","All Websites"
@@ -60,11 +60,11 @@
"Comments History","Comments History"
"Confirmed email:","Confirmed email:"
"Connect with the Magento Community","Connect with the Magento Community"
+"Content","Content"
"Contents","Contents"
"Country:","Country:"
"Create New Staging Store View","Create New Staging Store View"
"Create a backup","Create a backup"
-"Created %s items","Created %s items"
"Credit Card Number","Credit Card Number"
"Credit Card Number: xxxx-%s","Credit Card Number: xxxx-%s"
"Credit Card Type","Credit Card Type"
@@ -119,7 +119,6 @@
"File Information","File Information"
"File name:","File name:"
"Final Price","Final Price"
-"Finished items creation.","Finished items creation."
"First Name:","First Name:"
"For latest version visit: %s","For latest version visit: %s"
"From","From"
@@ -148,7 +147,6 @@
"Invoice Totals","Invoice Totals"
"Issue Number","Issue Number"
"Issuer: %s","Issuer: %s"
-"Items to merge","Items to merge"
"Last 5 Orders","Last 5 Orders"
"Last 5 Search Terms","Last 5 Search Terms"
"Last Logged In (%s):","Last Logged In (%s):"
@@ -171,11 +169,9 @@
"Magento™ is a trademark of Irubin Consulting Inc. DBA Varien. Copyright © %s Irubin Consulting Inc.","Magento™ is a trademark of Irubin Consulting Inc. DBA Varien. Copyright © %s Irubin Consulting Inc."
"Maintainers","Maintainers"
"Manage Stores","Manage Stores"
-"Mapping Configuration","Mapping Configuration"
"Max","Max"
"Merge Now","Merge Now"
"Min","Min"
-"Module version conflict!","Module version conflict!"
"N/A","N/A"
"Name","Name"
"Name on Card","Name on Card"
@@ -244,7 +240,6 @@
"Price","Price"
"Price:","Price:"
"Primary Billing Address","Primary Billing Address"
-"Processed %s%% %s/%d items","Processed %s%% %s/%d items"
"Product","Product"
"Products","Products"
"Profile Information","Profile Information"
@@ -258,6 +253,7 @@
"Resource Access","Resource Access"
"Resources","Resources"
"Role","Role"
+"Role Scopes","Role Scopes"
"Role Users","Role Users"
"Roles","Roles"
"Roles Resources","Roles Resources"
@@ -269,7 +265,6 @@
"Select Range","Select Range"
"Select Visible","Select Visible"
"Select date","Select date"
-"Select website from map","Select website from map"
"Select website to map","Select website to map"
"Shipment Comments","Shipment Comments"
"Shipment History","Shipment History"
@@ -282,12 +277,14 @@
"Sort Order","Sort Order"
"Spreadsheet Name:","Spreadsheet Name:"
"Staging Store: ","Staging Store: "
+"Staging Website - Merge Configuration","Staging Website - Merge Configuration"
"Staging Website: ","Staging Website: "
"Start Date","Start Date"
"State/Province:","State/Province:"
"Status","Status"
"Status:","Status:"
"Stock Quantity:","Stock Quantity:"
+"Store Credit","Store Credit"
"Store:","Store:"
"Store: ","Store: "
"Subpackage","Subpackage"
@@ -300,6 +297,7 @@
"Switch/Solo/Maestro(UK Domestic) card issue number: %s","Switch/Solo/Maestro(UK Domestic) card issue number: %s"
"Switch/Solo/Maestro(UK Domestic) card start Date: %s/%s","Switch/Solo/Maestro(UK Domestic) card start Date: %s/%s"
"The information in this tab has been changed.","The information in this tab has been changed."
+"This is a demo store. Any orders placed through this store will not be honored or fulfilled.","This is a demo store. Any orders placed through this store will not be honored or fulfilled."
"This is a required field.","This is a required field."
"This tab contains invalid data. Please solve the problem before saving.","This tab contains invalid data. Please solve the problem before saving."
"Thumbnail","Thumbnail"
@@ -319,6 +317,7 @@
"Upload Local File","Upload Local File"
"Upload local file:","Upload local file:"
"Use Default Value","Use Default Value"
+"Use Store Credit (%s available)","Use Store Credit (%s available)"
"User","User"
"User Name","User Name"
"User Roles","User Roles"
@@ -332,14 +331,14 @@
"Warning! Empty value can cause problems with CSV format.","Warning! Empty value can cause problems with CSV format."
"Warning!\r\nThis action will remove this user from already assigned role\r\nAre you sure?","Warning!\r\nThis action will remove this user from already assigned role\r\nAre you sure?"
"Warning!\r\nThis action will remove those users from already assigned roles\r\nAre you sure?","Warning!\r\nThis action will remove those users from already assigned roles\r\nAre you sure?"
+"We detected that your JavaScript seem to be disabled.","We detected that your JavaScript seem to be disabled."
"Web Services","Web Services"
"Web Services Configuration","Web Services Configuration"
"Website: ","Website: "
-"Websites","Websites"
-"Websites / Stores","Websites / Stores"
"What is this?","What is this?"
"Yes","Yes"
"You have","You have"
+"You must have JavaScript enabled in your browser to utilize the functionality of this website.","You must have JavaScript enabled in your browser to utilize the functionality of this website."
"Your Account has been deactivated.","Your Account has been deactivated."
"Your server PHP settings allow you to upload files not more than %s at a time. Please modify post_max_size (currently is %s) and upload_max_filesize (currently is %s) values in php.ini if you want to upload larger files.","Your server PHP settings allow you to upload files not more than %s at a time. Please modify post_max_size (currently is %s) and upload_max_filesize (currently is %s) values in php.ini if you want to upload larger files."
"Zip/Postal Code:","Zip/Postal Code:"
Index: app/locale/en_US/Mage_Catalog.csv
===================================================================
--- app/locale/en_US/Mage_Catalog.csv (revision 44104)
+++ app/locale/en_US/Mage_Catalog.csv (revision 44105)
@@ -32,7 +32,6 @@
"Add Tier","Add Tier"
"Add to Cart","Add to Cart"
"Add to Compare","Add to Compare"
-"Add to My Wishlist","Add to My Wishlist"
"Add to Wishlist","Add to Wishlist"
"Additional Information","Additional Information"
"All","All"
@@ -56,6 +55,7 @@
"Assigned Products","Assigned Products"
"Associated Products","Associated Products"
"Attrib. Set Name","Attrib. Set Name"
+"Attribute ""%s"" is required","Attribute ""%s"" is required"
"Attribute Code","Attribute Code"
"Attribute Information","Attribute Information"
"Attribute Label","Attribute Label"
@@ -182,6 +182,7 @@
"Double click on above image to view full picture","Double click on above image to view full picture"
"Dropdown","Dropdown"
"Duplicate","Duplicate"
+"Duplicate amount found.","Duplicate amount found."
"Duplicate website tier price customer group and quantity.","Duplicate website tier price customer group and quantity."
"Duplicate website, country and state tax found.","Duplicate website, country and state tax found."
"Edit","Edit"
@@ -191,6 +192,8 @@
"Edit Search","Edit Search"
"Edit Search '%s'","Edit Search '%s'"
"Email","Email"
+"Email template is not specified by administrator","Email template is not specified by administrator"
+"Email to %s was not sent","Email to %s was not sent"
"Email to a Friend","Email to a Friend"
"Empty","Empty"
"Enabled","Enabled"
@@ -258,6 +261,8 @@
"Invalid product type specified, skipping the record","Invalid product type specified, skipping the record"
"Invalid store specified","Invalid store specified"
"Invalid store specified, skipping the record","Invalid store specified, skipping the record"
+"Invalid tier prices. Product is not associated to the requested website.","Invalid tier prices. Product is not associated to the requested website."
+"Invalid transactional email code","Invalid transactional email code"
"Inventory","Inventory"
"Is Default","Is Default"
"Is Required","Is Required"
@@ -352,7 +357,8 @@
"Please select product(s)","Please select product(s)"
"Please select products for attributes update","Please select products for attributes update"
"Please select static block ...","Please select static block ..."
-"Please set up merge date/time .","Please set up merge date/time ."
+"Please set up merge date/time","Please set up merge date/time"
+"Please set up merge date/time later then present date","Please set up merge date/time later then present date"
"Please specify date required option(s)","Please specify date required option(s)"
"Please specify the product option(s)","Please specify the product option(s)"
"Please specify the product required option(s)","Please specify the product required option(s)"
@@ -543,6 +549,7 @@
"There was an error while removing products from websites","There was an error while removing products from websites"
"There was an error while updating product(s) attributes","There was an error while updating product(s) attributes"
"There was an error while updating product(s) status","There was an error while updating product(s) status"
+"This attribute is used in configurable products. You cannot remove it from the attribute set.","This attribute is used in configurable products. You cannot remove it from the attribute set."
"This attribute no longer exists","This attribute no longer exists"
"This group contains attributes, used in configurable products. Please move these attributes to another group and try again.","This group contains attributes, used in configurable products. Please move these attributes to another group and try again."
"This group contains system attributes. Please move system attributes to another group and try again.","This group contains system attributes. Please move system attributes to another group and try again."
@@ -559,6 +566,8 @@
"Total of %d record(s) were successfully deleted","Total of %d record(s) were successfully deleted"
"Total of %d record(s) were successfully updated","Total of %d record(s) were successfully updated"
"Type","Type"
+"URL Rewrite Management","URL Rewrite Management"
+"URL rewrite save problem.","URL rewrite save problem."
"Unable to complete request. Please try again later.","Unable to complete request. Please try again later."
"Unable to find a search term to delete","Unable to find a search term to delete"
"Unable to find an attribute to delete","Unable to find an attribute to delete"
@@ -581,7 +590,6 @@
"Upload new product image ","Upload new product image "
"Url","Url"
"Url Rewrite Management","Url Rewrite Management"
-"Url rewrie save problem.","Url rewrie save problem."
"Use Config Settings","Use Config Settings"
"Use Default Value","Use Default Value"
"Use Flat Catalog Category","Use Flat Catalog Category"
@@ -593,6 +601,7 @@
"Use To Create Configurable Product","Use To Create Configurable Product"
"Use Tree Like Category Sitemap","Use Tree Like Category Sitemap"
"Use categories path for product URLs","Use categories path for product URLs"
+"Use for Price Rule Conditions","Use for Price Rule Conditions"
"Use in advanced search","Use in advanced search"
"Use in quick search","Use in quick search"
"Used for sorting in product listing","Used for sorting in product listing"
@@ -609,14 +618,15 @@
"Watermark Default Size","Watermark Default Size"
"Watermark Position","Watermark Position"
"We Also Recommend","We Also Recommend"
-"Web Site Item Must be checked","Web Site Item Must be checked"
-"Web Site Store Must be checked","Web Site Store Must be checked"
"Website","Website"
+"Website Item Must be checked","Website Item Must be checked"
+"Website Store Must be checked","Website Store Must be checked"
"Websites","Websites"
"Wrong BuyRequest instance in options group","Wrong BuyRequest instance in options group"
"Wrong option instance type in options group","Wrong option instance type in options group"
"Wrong option type to get group instance.","Wrong option type to get group instance."
"Wrong product instance type in options group","Wrong product instance type in options group"
+"Wrong product type filter specified","Wrong product type filter specified"
"Wrong quote item instance in options group","Wrong quote item instance in options group"
"Wrong quote item option instance in options group","Wrong quote item option instance in options group"
"Year Range","Year Range"
@@ -624,9 +634,13 @@
"Yes/No","Yes/No"
"You cannot delete this attribute","You cannot delete this attribute"
"You cannot edit this attribute","You cannot edit this attribute"
+"You cannot email this product to a friend","You cannot email this product to a friend"
"You cannot remove system attribute from this set.","You cannot remove system attribute from this set."
+"You cannot send more than %d emails at a time","You cannot send more than %d emails at a time"
"You cannot update this attribute","You cannot update this attribute"
+"You have exceeded limit of %d sends in an hour","You have exceeded limit of %d sends in an hour"
"You have no items to compare.","You have no items to compare."
+"You have to specify at least one recipient","You have to specify at least one recipient"
"You may also be interested in the following product(s)","You may also be interested in the following product(s)"
"Zoom In","Zoom In"
"Zoom Out","Zoom Out"
Index: app/locale/en_US/Mage_Compiler.csv
===================================================================
--- app/locale/en_US/Mage_Compiler.csv (revision 0)
+++ app/locale/en_US/Mage_Compiler.csv (revision 44105)
@@ -0,0 +1,21 @@
+"Collected Files Count","Collected Files Count"
+"Compilation","Compilation"
+"Compilation (Beta)","Compilation (Beta)"
+"Compilation State","Compilation State"
+"Compilation error","Compilation error"
+"Compilation successfully finished","Compilation successfully finished"
+"Compiled","Compiled"
+"Compiled Scopes Count","Compiled Scopes Count"
+"Compiler Status","Compiler Status"
+"Compiler include path disabled","Compiler include path disabled"
+"Compiler include path enabled","Compiler include path enabled"
+"Compiler module is now in Beta (not to be used in production environment)","Compiler module is now in Beta (not to be used in production environment)"
+"Directory ""%s"" must be writeable","Directory ""%s"" must be writeable"
+"Disable","Disable"
+"Disabled","Disabled"
+"Enable","Enable"
+"Enabled","Enabled"
+"File ""%s"" must be writeable","File ""%s"" must be writeable"
+"Not Compiled","Not Compiled"
+"Run Compilation Process","Run Compilation Process"
+"Scopes Compilation Settings","Scopes Compilation Settings"
Index: app/locale/en_US/Mage_Adminhtml.csv
===================================================================
--- app/locale/en_US/Mage_Adminhtml.csv (revision 44104)
+++ app/locale/en_US/Mage_Adminhtml.csv (revision 44105)
@@ -30,7 +30,6 @@
"2YTD","2YTD"
"6 Hours","6 Hours"
"
404 Error Page not found.
","404 Error Page not found.
"
-"Access denied Access denied.
","Access denied Access denied.
"
"A new password was sent to your email address. Please check your email and click Back to Login.","A new password was sent to your email address. Please check your email and click Back to Login."
"API Stability","API Stability"
"API Version","API Version"
@@ -38,6 +37,8 @@
"About the calendar","About the calendar"
"Access Denied.","Access Denied."
"Access Deny","Access Deny"
+"Access denied","Access denied"
+"Access denied.","Access denied."
"Account Created in:","Account Created in:"
"Account Created on (%s):","Account Created on (%s):"
"Account Created on:","Account Created on:"
@@ -53,24 +54,24 @@
"Add Exception","Add Exception"
"Add Field Mapping","Add Field Mapping"
"Add Field with URL:","Add Field with URL:"
+"Add Gift Card","Add Gift Card"
"Add Maintainer","Add Maintainer"
"Add New Image","Add New Image"
"Add New Profile","Add New Profile"
"Add New Role","Add New Role"
"Add New Template","Add New Template"
-"Add New Urlrewrite","Add New Urlrewrite"
+"Add New URL Rewrite","Add New URL Rewrite"
"Add New User","Add New User"
"Add New osCommerce Profile","Add New osCommerce Profile"
"Add PHP Extension dependency","Add PHP Extension dependency"
"Add Package dependency","Add Package dependency"
"Add Subpackage dependency","Add Subpackage dependency"
-"Add Urlrewrite","Add Urlrewrite"
-"Add Urlrewrite for a Category","Add Urlrewrite for a Category"
-"Add Urlrewrite for a Product","Add Urlrewrite for a Product"
+"Add URL Rewrite","Add URL Rewrite"
+"Add URL Rewrite for a Category","Add URL Rewrite for a Category"
+"Add URL Rewrite for a Product","Add URL Rewrite for a Product"
"Add after","Add after"
"Add new Role","Add new Role"
"Add new store view map","Add new store view map"
-"Add new website map","Add new website map"
"Address Type:","Address Type:"
"Admin","Admin"
"Advanced Admin Section","Advanced Admin Section"
@@ -147,6 +148,7 @@
"Can not delete tracking number.","Can not delete tracking number."
"Can not do credit memo for order","Can not do credit memo for order"
"Can not do invoice for order","Can not do invoice for order"
+"Can not do shipment for order separate from invoice.","Can not do shipment for order separate from invoice."
"Can not do shipment for order.","Can not do shipment for order."
"Can not initialize shipment for adding tracking number.","Can not initialize shipment for adding tracking number."
"Can not initialize shipment for delete tracking number.","Can not initialize shipment for delete tracking number."
@@ -162,6 +164,8 @@
"Cancel","Cancel"
"Card Verification Number","Card Verification Number"
"Catalog","Catalog"
+"Catalog Index rebuild error. Please try again later","Catalog Index rebuild error. Please try again later"
+"Catalog Index was rebuilt successfully","Catalog Index was rebuilt successfully"
"Catalog Rewrites","Catalog Rewrites"
"Catalog Rewrites was refreshed successfully","Catalog Rewrites was refreshed successfully"
"Catalog Rewrites were refreshed successfully","Catalog Rewrites were refreshed successfully"
@@ -185,6 +189,7 @@
"Confirmed email:","Confirmed email:"
"Conflicts","Conflicts"
"Connect with the Magento Community","Connect with the Magento Community"
+"Content","Content"
"Contents","Contents"
"Convert to Plain Text","Convert to Plain Text"
"Cookie (Unsafe)","Cookie (Unsafe)"
@@ -197,9 +202,8 @@
"Create Extension Package","Create Extension Package"
"Create New Attribute","Create New Attribute"
"Create New Staging Store View","Create New Staging Store View"
-"Create Urlrewrite:","Create Urlrewrite:"
+"Create URL Rewrite:","Create URL Rewrite:"
"Create a backup","Create a backup"
-"Created %s items","Created %s items"
"Created At","Created At"
"Credit Card Number","Credit Card Number"
"Credit Card Number: xxxx-%s","Credit Card Number: xxxx-%s"
@@ -288,7 +292,7 @@
"Edit System Template","Edit System Template"
"Edit Tag","Edit Tag"
"Edit Template","Edit Template"
-"Edit Urlrewrite","Edit Urlrewrite"
+"Edit URL Rewrite","Edit URL Rewrite"
"Edit User","Edit User"
"Edit User '%s'","Edit User '%s'"
"Edit Website","Edit Website"
@@ -308,6 +312,7 @@
"Error while create backup. Please try again later","Error while create backup. Please try again later"
"Error while deleting this role. Please try again later.","Error while deleting this role. Please try again later."
"Error while deleting this set.","Error while deleting this set."
+"Error while deleting this template. Please try again later.","Error while deleting this template. Please try again later."
"Error while finished process. Please refresh cache","Error while finished process. Please refresh cache"
"Error while refreshed Catalog Rewrites. Please try again later","Error while refreshed Catalog Rewrites. Please try again later"
"Error while refreshed Layered Navigation Indices. Please try again later","Error while refreshed Layered Navigation Indices. Please try again later"
@@ -315,6 +320,7 @@
"Error while saving account. Please try again later","Error while saving account. Please try again later"
"Error while saving this configuration: ","Error while saving this configuration: "
"Error while saving this role. Please try again later.","Error while saving this role. Please try again later."
+"Error while saving this template. Please try again later.","Error while saving this template. Please try again later."
"Error while updating selected review(s). Please try again later.","Error while updating selected review(s). Please try again later."
"Excl. Tax","Excl. Tax"
"Exclude","Exclude"
@@ -339,7 +345,6 @@
"File name:","File name:"
"File size should be more than 0 bytes","File size should be more than 0 bytes"
"Final Price","Final Price"
-"Finished items creation.","Finished items creation."
"Finished profile execution.","Finished profile execution."
"First Name","First Name"
"First Name:","First Name:"
@@ -349,6 +354,7 @@
"Flat Catalog Category was rebuilt successfully","Flat Catalog Category was rebuilt successfully"
"Flat Catalog Product rebuild error. Please try again later","Flat Catalog Product rebuild error. Please try again later"
"Flat Catalog Product was rebuilt successfully","Flat Catalog Product was rebuilt successfully"
+"Folder","Folder"
"For category","For category"
"For latest version visit: %s","For latest version visit: %s"
"For product","For product"
@@ -378,6 +384,7 @@
"ID","ID"
"ID Path","ID Path"
"IP Address","IP Address"
+"If this message persists, please contact the store owner.","If this message persists, please contact the store owner."
"Ignore","Ignore"
"Image cache was cleared successfully","Image cache was cleared successfully"
"Images","Images"
@@ -414,11 +421,13 @@
"Invalid URL","Invalid URL"
"Invalid Username or Password.","Invalid Username or Password."
"Invalid directory: %s","Invalid directory: %s"
+"Invalid email address ""%s""","Invalid email address ""%s"""
"Invalid file: %s","Invalid file: %s"
"Invalid input data for %s => %s rate","Invalid input data for %s => %s rate"
"Invalid input:","Invalid input:"
"Invalid parrent block for this block","Invalid parrent block for this block"
"Invalid section value","Invalid section value"
+"Invalid sender name ""%s""","Invalid sender name ""%s"""
"Invalid store value","Invalid store value"
"Invalid website value","Invalid website value"
"Inventory Stock Status","Inventory Stock Status"
@@ -437,7 +446,6 @@
"Issue Number","Issue Number"
"Issuer: %s","Issuer: %s"
"Items","Items"
-"Items to merge","Items to merge"
"Kb","Kb"
"Last 24 hours","Last 24 hours"
"Last 5 Orders","Last 5 Orders"
@@ -496,7 +504,6 @@
"Manage Stores","Manage Stores"
"Manage osCommerce Orders","Manage osCommerce Orders"
"Manage osCommerce Profiles","Manage osCommerce Profiles"
-"Mapping Configuration","Mapping Configuration"
"Matched expression","Matched expression"
"Max","Max"
"Maximum","Maximum"
@@ -506,7 +513,6 @@
"Messages Inbox","Messages Inbox"
"Min","Min"
"Minimum","Minimum"
-"Module version conflict!","Module version conflict!"
"Month","Month"
"Most Viewed Products","Most Viewed Products"
"Multiple Select","Multiple Select"
@@ -591,6 +597,8 @@
"Path:","Path:"
"PayPal Email","PayPal Email"
"Payment Data Transfer (PDT)","Payment Data Transfer (PDT)"
+"Payment method instance is not available","Payment method instance is not available"
+"Payment method is not available","Payment method is not available"
"Payment method must be specified","Payment method must be specified"
"Pending Tags","Pending Tags"
"Pending installation...","Pending installation..."
@@ -636,6 +644,7 @@
"Please select tag(s)","Please select tag(s)"
"Please specify admin custom URL","Please specify admin custom URL"
"Please specify at least start or end date.","Please specify at least start or end date."
+"Please try to logout and sign in again.","Please try to logout and sign in again."
"Please use in this field only ""a-z,0-9,_"".","Please use in this field only ""a-z,0-9,_""."
"Please use letters only (a-z) in this field.","Please use letters only (a-z) in this field."
"Please use numbers only in this field. please avoid spaces or other characters such as dots or commas.","Please use numbers only in this field. please avoid spaces or other characters such as dots or commas."
@@ -662,7 +671,6 @@
"Price alert subscription was saved successfully","Price alert subscription was saved successfully"
"Price:","Price:"
"Primary Billing Address","Primary Billing Address"
-"Processed %s%% %s/%d items","Processed %s%% %s/%d items"
"Processed %s%% %s/%d records","Processed %s%% %s/%d records"
"Product","Product"
"Product Thumbnail Itself","Product Thumbnail Itself"
@@ -691,6 +699,7 @@
"Rating was successfully saved","Rating was successfully saved"
"Read details","Read details"
"Rebuild","Rebuild"
+"Rebuild Catalog Index","Rebuild Catalog Index"
"Rebuild Flat Catalog Category","Rebuild Flat Catalog Category"
"Rebuild Flat Catalog Product","Rebuild Flat Catalog Product"
"Recent Orders","Recent Orders"
@@ -726,6 +735,7 @@
"Role Information","Role Information"
"Role Name","Role Name"
"Role Resources","Role Resources"
+"Role Scopes","Role Scopes"
"Role Users","Role Users"
"Role successfully deleted.","Role successfully deleted."
"Role successfully saved.","Role successfully saved."
@@ -747,6 +757,7 @@
"Samples","Samples"
"Save","Save"
"Save & Generate","Save & Generate"
+"Save & Send Email","Save & Send Email"
"Save Account","Save Account"
"Save And Continue Edit","Save And Continue Edit"
"Save As...","Save As..."
@@ -775,7 +786,6 @@
"Select Range","Select Range"
"Select Visible","Select Visible"
"Select date","Select date"
-"Select website from map","Select website from map"
"Select website to map","Select website to map"
"Selected allow currency ""%s"" is not available in installed currencies","Selected allow currency ""%s"" is not available in installed currencies"
"Selected base currency is not available in installed currencies","Selected base currency is not available in installed currencies"
@@ -812,6 +822,7 @@
"Spreadsheet Name:","Spreadsheet Name:"
"Stability","Stability"
"Staging Store: ","Staging Store: "
+"Staging Website - Merge Configuration","Staging Website - Merge Configuration"
"Staging Website: ","Staging Website: "
"Start Date","Start Date"
"Starting profile execution, please wait...","Starting profile execution, please wait..."
@@ -821,6 +832,7 @@
"Stock Quantity:","Stock Quantity:"
"Stock notification was saved successfully","Stock notification was saved successfully"
"Store","Store"
+"Store Credit","Store Credit"
"Store Email Addresses Section","Store Email Addresses Section"
"Store View","Store View"
"Store:","Store:"
@@ -862,6 +874,7 @@
"This account is inactive.","This account is inactive."
"This attribute set don\'t have attributes which we can use for configurable product","This attribute set don\'t have attributes which we can use for configurable product"
"This attribute shares the same value in all the stores","This attribute shares the same value in all the stores"
+"This is a demo store. Any orders placed through this store will not be honored or fulfilled.","This is a demo store. Any orders placed through this store will not be honored or fulfilled."
"This is a required field.","This is a required field."
"This product is currently disabled","This product is currently disabled"
"This section is not allowed.","This section is not allowed."
@@ -890,6 +903,10 @@
"Transactional Emails","Transactional Emails"
"Type","Type"
"Type:","Type:"
+"URL Rewrite Information","URL Rewrite Information"
+"URL Rewrite Management","URL Rewrite Management"
+"URL Rewrite has been successfully deleted","URL Rewrite has been successfully deleted"
+"URL Rewrite has been successfully saved","URL Rewrite has been successfully saved"
"Unable to find a poll to delete","Unable to find a poll to delete"
"Unable to find a tag to delete","Unable to find a tag to delete"
"Unable to find a user to delete","Unable to find a user to delete"
@@ -900,6 +917,7 @@
"Uninstalling selected packages, please wait...","Uninstalling selected packages, please wait..."
"Unknown","Unknown"
"Unknown error","Unknown error"
+"Unlimited","Unlimited"
"Unselect All","Unselect All"
"Unselect Visible","Unselect Visible"
"Update","Update"
@@ -921,10 +939,9 @@
"Upload and Install","Upload and Install"
"Upload import file","Upload import file"
"Upload local file:","Upload local file:"
-"Url Rewrite Management","Url Rewrite Management"
-"Urlrewrite Information","Urlrewrite Information"
"Use Config Settings","Use Config Settings"
"Use Default Value","Use Default Value"
+"Use Store Credit (%s available)","Use Store Credit (%s available)"
"Use default","Use default"
"Use website","Use website"
"User","User"
@@ -955,17 +972,17 @@
"Warning!\r\nThis action will remove those users from already assigned roles\r\nAre you sure?","Warning!\r\nThis action will remove those users from already assigned roles\r\nAre you sure?"
"Warning: Please don't close window during importing/exporting data","Warning: Please don't close window during importing/exporting data"
"Watermark File for %s","Watermark File for %s"
+"We detected that your JavaScript seem to be disabled.","We detected that your JavaScript seem to be disabled."
"We\'re in our typing table, coding away more features for Magento. Thank you for your patience.","We\'re in our typing table, coding away more features for Magento. Thank you for your patience."
"Web Section","Web Section"
"Web Services","Web Services"
"Web services","Web services"
"Website","Website"
"Website: ","Website: "
-"Websites","Websites"
-"Websites / Stores","Websites / Stores"
"What is this?","What is this?"
"Wishlist Report","Wishlist Report"
"Wrong column format","Wrong column format"
+"Wrong newsletter template.","Wrong newsletter template."
"Wrong tab configuration","Wrong tab configuration"
"XML","XML"
"YTD","YTD"
@@ -977,6 +994,7 @@
"You have","You have"
"You have not enought permissions to login.","You have not enought permissions to login."
"You have not enought permissions to use this functionality.","You have not enought permissions to use this functionality."
+"You must have JavaScript enabled in your browser to utilize the functionality of this website.","You must have JavaScript enabled in your browser to utilize the functionality of this website."
"You need specify carrier.","You need specify carrier."
"You need to specify order items","You need to specify order items"
"You successfully logged out.","You successfully logged out."
@@ -1004,4 +1022,4 @@
"store(%s) scope","store(%s) scope"
"to","to"
"website(%s) scope","website(%s) scope"
-"{{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 .","{{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 ."
+"{{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 .","{{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 ."
Index: app/locale/en_US/Mage_Sendfriend.csv
===================================================================
--- app/locale/en_US/Mage_Sendfriend.csv (revision 44104)
+++ app/locale/en_US/Mage_Sendfriend.csv (revision 44105)
@@ -1,5 +1,6 @@
"Add Recipient","Add Recipient"
"Allow for Guests","Allow for Guests"
+"Back","Back"
"Email Address","Email Address"
"Email Address:","Email Address:"
"Email templates","Email templates"
Index: app/locale/en_US/Mage_Shipping.csv
===================================================================
--- app/locale/en_US/Mage_Shipping.csv (revision 44104)
+++ app/locale/en_US/Mage_Shipping.csv (revision 44105)
@@ -22,6 +22,7 @@
"Free Shipping","Free Shipping"
"Handling Fee","Handling Fee"
"Import","Import"
+"Include Virtual products in Price calculation","Include Virtual products in Price calculation"
"Info:","Info:"
"Invalid %s ""%s"" in the Row #%s","Invalid %s ""%s"" in the Row #%s"
"Invalid Country ""%s"" in the Row #%s","Invalid Country ""%s"" in the Row #%s"
@@ -62,6 +63,7 @@
"Store Pickup","Store Pickup"
"Table rates","Table rates"
"The shipping module is not available for selected delivery country","The shipping module is not available for selected delivery country"
+"The shipping module is not available.","The shipping module is not available."
"There is no tracking available for this shipment.","There is no tracking available for this shipment."
"There is no tracking available.","There is no tracking available."
"This shipping method is currently unavailable. If you would like to ship using this shipping method, please contact us.","This shipping method is currently unavailable. If you would like to ship using this shipping method, please contact us."
Index: app/design/frontend/default/iphone/template/checkout/cart/shipping.phtml
===================================================================
--- app/design/frontend/default/iphone/template/checkout/cart/shipping.phtml (revision 44104)
+++ app/design/frontend/default/iphone/template/checkout/cart/shipping.phtml (revision 44105)
@@ -77,16 +77,5 @@
\ No newline at end of file
Index: app/design/frontend/default/default/template/email/order/items.phtml
===================================================================
--- app/design/frontend/default/default/template/email/order/items.phtml (revision 44104)
+++ app/design/frontend/default/default/template/email/order/items.phtml (revision 44105)
@@ -46,7 +46,7 @@
getGiftMessageId() && $_giftMessage = $this->helper('giftmessage/message')->getGiftMessage($_order->getGiftMessageId())): ?>
- __('Gift Message') ?>
+ __('Gift Message for this Order') ?>
__('From:'); ?> htmlEscape($_giftMessage->getSender()) ?>
__('To:'); ?> htmlEscape($_giftMessage->getRecipient()) ?>
__('Message:'); ?> htmlEscape($_giftMessage->getMessage()) ?>
@@ -81,4 +81,4 @@
-
\ No newline at end of file
+
Index: app/design/frontend/default/default/template/checkout/cart/shipping.phtml
===================================================================
--- app/design/frontend/default/default/template/checkout/cart/shipping.phtml (revision 44104)
+++ app/design/frontend/default/default/template/checkout/cart/shipping.phtml (revision 44105)
@@ -98,18 +98,5 @@
\ No newline at end of file
Index: app/design/frontend/default/modern/template/checkout/cart/shipping.phtml
===================================================================
--- app/design/frontend/default/modern/template/checkout/cart/shipping.phtml (revision 44104)
+++ app/design/frontend/default/modern/template/checkout/cart/shipping.phtml (revision 44105)
@@ -92,19 +92,6 @@
\ No newline at end of file
Index: app/design/frontend/default/blank/template/checkout/cart/shipping.phtml
===================================================================
--- app/design/frontend/default/blank/template/checkout/cart/shipping.phtml (revision 44104)
+++ app/design/frontend/default/blank/template/checkout/cart/shipping.phtml (revision 44105)
@@ -113,19 +113,6 @@
Index: app/design/adminhtml/default/default/template/downloadable/sales/order/creditmemo/create/items/renderer/downloadable.phtml
===================================================================
--- app/design/adminhtml/default/default/template/downloadable/sales/order/creditmemo/create/items/renderer/downloadable.phtml (revision 44104)
+++ app/design/adminhtml/default/default/template/downloadable/sales/order/creditmemo/create/items/renderer/downloadable.phtml (revision 44105)
@@ -70,8 +70,12 @@
getColumnHtml($_item, 'qty') ?>
- canReturnToStock()) : ?>
- getBackToStock()):?> checked/>
+ canParentReturnToStock($_item)) : ?>
+
+ canReturnItemToStock($_item)) : ?>
+ getBackToStock()):?> checked/>
+
+
canEditQty()) : ?>
@@ -132,4 +136,4 @@
$_item->getRowTotal()+$_item->getTaxAmount()-$_item->getDiscountAmount()+$_item->getWeeeTaxAppliedAmount()
) ?>
-
\ No newline at end of file
+
Index: app/design/adminhtml/default/default/template/sales/order/creditmemo/create/items/renderer/configurable.phtml
===================================================================
--- app/design/adminhtml/default/default/template/sales/order/creditmemo/create/items/renderer/configurable.phtml (revision 44104)
+++ app/design/adminhtml/default/default/template/sales/order/creditmemo/create/items/renderer/configurable.phtml (revision 44105)
@@ -125,8 +125,12 @@
getColumnHtml($_item, 'qty') ?>
- canReturnToStock()) : ?>
- getBackToStock()):?> checked/>
+ canParentReturnToStock($_item)) : ?>
+
+ canReturnItemToStock($_item)) : ?>
+ getBackToStock()):?> checked/>
+
+
canEditQty()) : ?>
@@ -239,4 +243,4 @@
$_item->getRowTotal()+$_item->getTaxAmount()-$_item->getDiscountAmount()+$_item->getWeeeTaxAppliedRowAmount()
) ?>
-
\ No newline at end of file
+
Index: app/design/adminhtml/default/default/template/sales/order/creditmemo/create/items/renderer/default.phtml
===================================================================
--- app/design/adminhtml/default/default/template/sales/order/creditmemo/create/items/renderer/default.phtml (revision 44104)
+++ app/design/adminhtml/default/default/template/sales/order/creditmemo/create/items/renderer/default.phtml (revision 44105)
@@ -125,8 +125,12 @@
getColumnHtml($_item, 'qty') ?>
- canReturnToStock()) : ?>
- getBackToStock()):?> checked/>
+ canParentReturnToStock($_item)) : ?>
+
+ canReturnItemToStock($_item)) : ?>
+ getBackToStock()):?> checked/>
+
+
canEditQty()) : ?>
@@ -239,4 +243,4 @@
$_item->getRowTotal()+$_item->getTaxAmount()-$_item->getDiscountAmount()+$_item->getWeeeTaxAppliedRowAmount()
) ?>
-
\ No newline at end of file
+
Index: app/design/adminhtml/default/default/template/dashboard/index.phtml
===================================================================
--- app/design/adminhtml/default/default/template/dashboard/index.phtml (revision 44104)
+++ app/design/adminhtml/default/default/template/dashboard/index.phtml (revision 44105)
@@ -32,10 +32,27 @@
getChild('diagrams')->getTabsIds() as $tabId): ?>
ajaxBlockParam = 'block/tab_/';
ajaxBlockUrl = 'getUrl('*/*/ajaxBlock', array('_current' => true, 'block' => '', 'period' => '')) ?>' + ajaxBlockParam + periodParam;
- tabContentElementId = 'getChild('diagrams')->getId() ?>__content';
- new Ajax.Updater(tabContentElementId, ajaxBlockUrl, {
- method: 'post',
- parameters: {isAjax: 'true', form_key: FORM_KEY}
+ new Ajax.Request(ajaxBlockUrl, {
+ parameters: {isAjax: 'true', form_key: FORM_KEY},
+ onSuccess: function(transport) {
+ tabContentElementId = 'getChild('diagrams')->getId() ?>__content';
+ try {
+ if (transport.responseText.isJSON()) {
+ var response = transport.responseText.evalJSON()
+ if (response.error) {
+ alert(response.message);
+ }
+ if(response.ajaxExpired && response.ajaxRedirect) {
+ setLocation(response.ajaxRedirect);
+ }
+ } else {
+ $(tabContentElementId).update(transport.responseText);
+ }
+ }
+ catch (e) {
+ $(tabContentElementId).update(transport.responseText);
+ }
+ }
});
}
Index: app/design/adminhtml/default/default/template/access_denied.phtml
===================================================================
--- app/design/adminhtml/default/default/template/access_denied.phtml (revision 0)
+++ app/design/adminhtml/default/default/template/access_denied.phtml (revision 44105)
@@ -0,0 +1,40 @@
+
+
+helper('adminhtml')->__('Access denied') ?>
+hasAvailaleResources()): ?>
+
+helper('adminhtml')->__('Please try to logout and sign in again.') ?>
+helper('adminhtml')->__('If this message persists, please contact the store owner.') ?>
+
+
+helper('adminhtml')->__('Access denied.') ?>
+
\ No newline at end of file
Index: app/design/adminhtml/default/default/template/bundle/sales/creditmemo/create/items/renderer.phtml
===================================================================
--- app/design/adminhtml/default/default/template/bundle/sales/creditmemo/create/items/renderer.phtml (revision 44104)
+++ app/design/adminhtml/default/default/template/bundle/sales/creditmemo/create/items/renderer.phtml (revision 44105)
@@ -222,15 +222,17 @@
+ canParentReturnToStock($_item)) : ?>
canShowPriceInfo($_item)): ?>
- canReturnToStock()) : ?>
+ canReturnItemToStock($_item)) : ?>
getBackToStock()):?> checked="checked" />
+
canShowPriceInfo($_item)): ?>
canEditQty()) : ?>
Index: app/design/adminhtml/default/default/template/catalog/product/attribute/set/main.phtml
===================================================================
--- app/design/adminhtml/default/default/template/catalog/product/attribute/set/main.phtml (revision 44104)
+++ app/design/adminhtml/default/default/template/catalog/product/attribute/set/main.phtml (revision 44105)
@@ -52,8 +52,12 @@
- getAddGroupButton() ?> getDeleteGroupButton() ?>
- __('Double click on a group to rename it') ?>
+
+ getIsReadOnly()): ?>
+ getAddGroupButton() ?> getDeleteGroupButton() ?>
+ __('Double click on a group to rename it') ?>
+
+
getSetsFilterHtml() ?>
getGroupTreeHtml() ?>
@@ -70,6 +74,9 @@
\ No newline at end of file
Index: app/design/adminhtml/default/default/template/catalog/category/edit.phtml
===================================================================
--- app/design/adminhtml/default/default/template/catalog/category/edit.phtml (revision 44104)
+++ app/design/adminhtml/default/default/template/catalog/category/edit.phtml (revision 44105)
@@ -96,6 +96,12 @@
}
}
});
+ var headers = $$('div.content-header-floating');
+ for(var i=0; i
-
\ No newline at end of file
+
Index: app/design/adminhtml/default/default/layout/main.xml
===================================================================
--- app/design/adminhtml/default/default/layout/main.xml (revision 44104)
+++ app/design/adminhtml/default/default/layout/main.xml (revision 44105)
@@ -147,9 +147,7 @@
-
- Access deniedAccess denied.
]]>
-
+
Index: app/code/core/Mage/Log/Model/Visitor.php
===================================================================
--- app/code/core/Mage/Log/Model/Visitor.php (revision 44104)
+++ app/code/core/Mage/Log/Model/Visitor.php (revision 44105)
@@ -63,18 +63,20 @@
*/
public function initServerData()
{
- $s = $_SERVER;
+ /* @var $helper Mage_Core_Helper_Http */
+ $helper = Mage::helper('core/http');
+
$this->addData(array(
- 'server_addr' => empty($s['SERVER_ADDR']) ? '' : ip2long($s['SERVER_ADDR']),
- 'remote_addr' => empty($s['REMOTE_ADDR']) ? '' : ip2long($s['REMOTE_ADDR']),
- 'http_secure' => Mage::app()->getStore()->isCurrentlySecure(),
- 'http_host' => empty($s['HTTP_HOST']) ? '' : $s['HTTP_HOST'],
- 'http_user_agent' => empty($s['HTTP_USER_AGENT']) ? '' : $s['HTTP_USER_AGENT'],
- 'http_accept_language'=> empty($s['HTTP_ACCEPT_LANGUAGE']) ? '' : $s['HTTP_ACCEPT_LANGUAGE'],
- 'http_accept_charset'=> empty($s['HTTP_ACCEPT_CHARSET']) ? '' : $s['HTTP_ACCEPT_CHARSET'],
- 'request_uri' => empty($s['REQUEST_URI']) ? '' : $s['REQUEST_URI'],
- 'session_id' => $this->_getSession()->getSessionId(),
- 'http_referer' => empty($s['HTTP_REFERER']) ? '' : $s['HTTP_REFERER'],
+ 'server_addr' => $helper->getServerAddr(true),
+ 'remote_addr' => $helper->getRemoteAddr(true),
+ 'http_secure' => Mage::app()->getStore()->isCurrentlySecure(),
+ 'http_host' => $helper->getHttpHost(true),
+ 'http_user_agent' => $helper->getHttpUserAgent(true),
+ 'http_accept_language' => $helper->getHttpAcceptLanguage(true),
+ 'http_accept_charset' => $helper->getHttpAcceptCharset(true),
+ 'request_uri' => $helper->getRequestUri(true),
+ 'session_id' => $this->_getSession()->getSessionId(),
+ 'http_referer' => $helper->getHttpReferer(true),
));
return $this;
Index: app/code/core/Mage/Log/Model/Mysql4/Visitor/Online/Collection.php
===================================================================
--- app/code/core/Mage/Log/Model/Mysql4/Visitor/Online/Collection.php (revision 44104)
+++ app/code/core/Mage/Log/Model/Mysql4/Visitor/Online/Collection.php (revision 44105)
@@ -35,6 +35,13 @@
class Mage_Log_Model_Mysql4_Visitor_Online_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
{
/**
+ * joined fields array
+ *
+ * @var array
+ */
+ protected $_fields = array();
+
+ /**
* Initialize collection model
*
*/
@@ -70,6 +77,8 @@
sprintf('%s.entity_id=main_table.customer_id', $tableAlias),
array($alias => $attribute->getAttributeCode())
);
+
+ $this->_fields[$alias] = sprintf('%s.%s', $tableAlias, $attribute->getAttributeCode());
}
else {
$tableAlias = 'customer_' . $attribute->getAttributeCode();
@@ -84,6 +93,8 @@
join(' AND ', $joinConds),
array($alias => 'value')
);
+
+ $this->_fields[$alias] = sprintf('%s.value', $tableAlias);
}
}
@@ -105,4 +116,27 @@
}
return $this;
}
+
+ /**
+ * Add field filter to collection
+ *
+ * If $attribute is an array will add OR condition with following format:
+ * array(
+ * array('attribute'=>'firstname', 'like'=>'test%'),
+ * array('attribute'=>'lastname', 'like'=>'test%'),
+ * )
+ *
+ * @see self::_getConditionSql for $condition
+ * @param string|array $attribute
+ * @param null|string|array $condition
+ * @return Mage_Eav_Model_Entity_Collection_Abstract
+ */
+ public function addFieldToFilter($field, $condition=null)
+ {
+ if (isset($this->_fields[$field])) {
+ $field = $this->_fields[$field];
+ }
+
+ return parent::addFieldToFilter($field, $condition);
+ }
}
Index: app/code/core/Mage/Log/Model/Mysql4/Visitor.php
===================================================================
--- app/code/core/Mage/Log/Model/Mysql4/Visitor.php (revision 44104)
+++ app/code/core/Mage/Log/Model/Mysql4/Visitor.php (revision 44105)
@@ -99,15 +99,27 @@
*/
protected function _saveVisitorInfo($visitor)
{
+ /* @var $stringHelper Mage_Core_Helper_String */
+ $stringHelper = Mage::helper('core/string');
+
+ $referer = $stringHelper->cleanString($visitor->getHttpReferer());
+ $referer = $stringHelper->substr($referer, 0, 255);
+ $userAgent = $stringHelper->cleanString($visitor->getHttpUserAgent());
+ $userAgent = $stringHelper->substr($userAgent, 0, 255);
+ $charset = $stringHelper->cleanString($visitor->getHttpAcceptCharset());
+ $charset = $stringHelper->substr($charset, 0, 255);
+ $language = $stringHelper->cleanString($visitor->getHttpAcceptLanguage());
+ $language = $stringHelper->substr($language, 0, 255);
+
$write = $this->_getWriteAdapter();
$data = array(
- 'visitor_id' => $visitor->getId(),
- 'http_referer' => Mage::helper('core/string')->substr($visitor->getHttpReferer(), 0, 250),
- 'http_user_agent' => $visitor->getHttpUserAgent(),
- 'http_accept_charset'=>$visitor->getHttpAcceptCharset(),
- 'http_accept_language'=>$visitor->getHttpAcceptLanguage(),
- 'server_addr' => $visitor->getServerAddr(),
- 'remote_addr' => $visitor->getRemoteAddr(),
+ 'visitor_id' => $visitor->getId(),
+ 'http_referer' => $stringHelper->substr($visitor->getHttpReferer(), 0, 255),
+ 'http_user_agent' => $stringHelper->substr($visitor->getHttpUserAgent(), 0, 255),
+ 'http_accept_charset' => $stringHelper->substr($visitor->getHttpAcceptCharset(), 0, 255),
+ 'http_accept_language' => $stringHelper->substr($visitor->getHttpAcceptLanguage(), 0, 255),
+ 'server_addr' => $visitor->getServerAddr(),
+ 'remote_addr' => $visitor->getRemoteAddr(),
);
$write->insert($this->getTable('log/visitor_info'), $data);
Index: app/code/core/Mage/Sendfriend/etc/config.xml
===================================================================
--- app/code/core/Mage/Sendfriend/etc/config.xml (revision 44104)
+++ app/code/core/Mage/Sendfriend/etc/config.xml (revision 44105)
@@ -98,11 +98,11 @@
-
+
singleton
sendfriend/sendfriend
register
-
+
Index: app/code/core/Mage/Shipping/Model/Carrier/Flatrate.php
===================================================================
--- app/code/core/Mage/Shipping/Model/Carrier/Flatrate.php (revision 44104)
+++ app/code/core/Mage/Shipping/Model/Carrier/Flatrate.php (revision 44105)
@@ -1,103 +1,114 @@
-
- */
-class Mage_Shipping_Model_Carrier_Flatrate
- extends Mage_Shipping_Model_Carrier_Abstract
- implements Mage_Shipping_Model_Carrier_Interface
-{
-
- protected $_code = 'flatrate';
-
- /**
- * Enter description here...
- *
- * @param Mage_Shipping_Model_Rate_Request $data
- * @return Mage_Shipping_Model_Rate_Result
- */
- public function collectRates(Mage_Shipping_Model_Rate_Request $request)
- {
- if (!$this->getConfigFlag('active')) {
- return false;
- }
-
- $freeBoxes = 0;
- if ($request->getAllItems()) {
- foreach ($request->getAllItems() as $item) {
- if ($item->getFreeShipping() && !$item->getProduct()->isVirtual()) {
- $freeBoxes+=$item->getQty();
- }
- }
- }
- $this->setFreeBoxes($freeBoxes);
-
- $result = Mage::getModel('shipping/rate_result');
- if ($this->getConfigData('type') == 'O') { // per order
- $shippingPrice = $this->getConfigData('price');
- } elseif ($this->getConfigData('type') == 'I') { // per item
- $shippingPrice = ($request->getPackageQty() * $this->getConfigData('price')) - ($this->getFreeBoxes() * $this->getConfigData('price'));
- } else {
- $shippingPrice = false;
- }
-
- $shippingPrice = $this->getFinalPriceWithHandlingFee($shippingPrice);
-
- if ($shippingPrice !== false) {
- $method = Mage::getModel('shipping/rate_result_method');
-
- $method->setCarrier('flatrate');
- $method->setCarrierTitle($this->getConfigData('title'));
-
- $method->setMethod('flatrate');
- $method->setMethodTitle($this->getConfigData('name'));
-
- if ($request->getFreeShipping() === true || $request->getPackageQty() == $this->getFreeBoxes()) {
- $shippingPrice = '0.00';
- }
-
-
- $method->setPrice($shippingPrice);
- $method->setCost($shippingPrice);
-
- $result->append($method);
- }
-
- return $result;
- }
-
- public function getAllowedMethods()
- {
- return array('flatrate'=>$this->getConfigData('name'));
- }
-
-}
+
+ */
+class Mage_Shipping_Model_Carrier_Flatrate
+ extends Mage_Shipping_Model_Carrier_Abstract
+ implements Mage_Shipping_Model_Carrier_Interface
+{
+
+ protected $_code = 'flatrate';
+
+ /**
+ * Enter description here...
+ *
+ * @param Mage_Shipping_Model_Rate_Request $data
+ * @return Mage_Shipping_Model_Rate_Result
+ */
+ public function collectRates(Mage_Shipping_Model_Rate_Request $request)
+ {
+ if (!$this->getConfigFlag('active')) {
+ return false;
+ }
+
+ $freeBoxes = 0;
+ if ($request->getAllItems()) {
+ foreach ($request->getAllItems() as $item) {
+
+ if ($item->getProduct()->isVirtual() || $item->getParentItem()) {
+ continue;
+ }
+
+ if ($item->getHasChildren() && $item->isShipSeparately()) {
+ foreach ($item->getChildren() as $child) {
+ if ($child->getFreeShipping() && !$child->getProduct()->isVirtual()) {
+ $freeBoxes += $item->getQty() * $child->getQty();
+ }
+ }
+ } elseif ($item->getFreeShipping()) {
+ $freeBoxes += $item->getQty();
+ }
+ }
+ }
+ $this->setFreeBoxes($freeBoxes);
+
+ $result = Mage::getModel('shipping/rate_result');
+ if ($this->getConfigData('type') == 'O') { // per order
+ $shippingPrice = $this->getConfigData('price');
+ } elseif ($this->getConfigData('type') == 'I') { // per item
+ $shippingPrice = ($request->getPackageQty() * $this->getConfigData('price')) - ($this->getFreeBoxes() * $this->getConfigData('price'));
+ } else {
+ $shippingPrice = false;
+ }
+
+ $shippingPrice = $this->getFinalPriceWithHandlingFee($shippingPrice);
+
+ if ($shippingPrice !== false) {
+ $method = Mage::getModel('shipping/rate_result_method');
+
+ $method->setCarrier('flatrate');
+ $method->setCarrierTitle($this->getConfigData('title'));
+
+ $method->setMethod('flatrate');
+ $method->setMethodTitle($this->getConfigData('name'));
+
+ if ($request->getFreeShipping() === true || $request->getPackageQty() == $this->getFreeBoxes()) {
+ $shippingPrice = '0.00';
+ }
+
+
+ $method->setPrice($shippingPrice);
+ $method->setCost($shippingPrice);
+
+ $result->append($method);
+ }
+
+ return $result;
+ }
+
+ public function getAllowedMethods()
+ {
+ return array('flatrate'=>$this->getConfigData('name'));
+ }
+
+}
Index: app/code/core/Mage/PaypalUk/Model/Express.php
===================================================================
--- app/code/core/Mage/PaypalUk/Model/Express.php (revision 44104)
+++ app/code/core/Mage/PaypalUk/Model/Express.php (revision 44105)
@@ -316,8 +316,7 @@
$payment->setLastTransId($api->getTransactionId());
}
} else {
- $e = $api->getError();
- die($e['message']);
+ $this->throwError();
}
return $this;
}
Index: app/code/core/Mage/PaypalUk/controllers/ExpressController.php
===================================================================
--- app/code/core/Mage/PaypalUk/controllers/ExpressController.php (revision 44104)
+++ app/code/core/Mage/PaypalUk/controllers/ExpressController.php (revision 44105)
@@ -166,6 +166,15 @@
return;
}
}
+
+ $customer = $this->getReview()->getQuote()->getCustomer();
+ if (!$customer || !$customer->getId()) {
+ $this->getReview()->getQuote()
+ ->setCustomerIsGuest(true)
+ ->setCustomerGroupId(Mage_Customer_Model_Group::NOT_LOGGED_IN_ID);
+ }
+ unset($customer); // for backward compatibility, see logic after place order
+
$billing = $this->getReview()->getQuote()->getBillingAddress();
$shipping = $this->getReview()->getQuote()->getShippingAddress();
Index: app/code/core/Mage/PaypalUk/etc/config.xml
===================================================================
--- app/code/core/Mage/PaypalUk/etc/config.xml (revision 44104)
+++ app/code/core/Mage/PaypalUk/etc/config.xml (revision 44105)
@@ -138,13 +138,13 @@
- Authorization
+ authorize
paypaluk/express
PaypalUk Express
0
- Authorization
+ authorize
paypaluk/direct
PaypalUk Direct
AE,VI,MC,DI
Index: app/code/core/Mage/Admin/Model/Acl/Assert/Ip.php
===================================================================
--- app/code/core/Mage/Admin/Model/Acl/Assert/Ip.php (revision 44104)
+++ app/code/core/Mage/Admin/Model/Acl/Assert/Ip.php (revision 44105)
@@ -27,12 +27,12 @@
/**
* IP assertion for admin acl
- *
+ *
* @category Mage
* @package Mage_Admin
* @author Magento Core Team
*/
-class Mage_Admin_Model_Acl_Assert_Ip implements Zend_Acl_Assert_Interface
+class Mage_Admin_Model_Acl_Assert_Ip implements Zend_Acl_Assert_Interface
{
/**
* Check whether ip is allowed
@@ -46,7 +46,7 @@
public function assert(Mage_Admin_Model_Acl $acl, Mage_Admin_Model_Acl_Role $role = null,
Mage_Admin_Model_Acl_Resource $resource = null, $privilege = null)
{
- return $this->_isCleanIP($_SERVER['REMOTE_ADDR']);
+ return $this->_isCleanIP(Mage::helper('core/http')->getRemoteAddr());
}
protected function _isCleanIP($ip)
Index: app/code/core/Mage/Admin/Model/User.php
===================================================================
--- app/code/core/Mage/Admin/Model/User.php (revision 44104)
+++ app/code/core/Mage/Admin/Model/User.php (revision 44105)
@@ -44,6 +44,8 @@
*/
protected $_role;
+ protected $_hasAvailableResources = true;
+
/**
* Varien constructor
*/
@@ -333,9 +335,21 @@
}
}
}
+ $this->_hasAvailableResources = false;
+ return '*/*/denied';
}
/**
+ * Check if user has available resources
+ *
+ * @return bool
+ */
+ public function hasAvailableResources()
+ {
+ return $this->_hasAvailableResources;
+ }
+
+ /**
* Find admin start page url
*
* @deprecated Please use getStartupPageUrl() method instead
Index: app/code/core/Mage/Usa/Model/Shipping/Carrier/Usps.php
===================================================================
--- app/code/core/Mage/Usa/Model/Shipping/Carrier/Usps.php (revision 44104)
+++ app/code/core/Mage/Usa/Model/Shipping/Carrier/Usps.php (revision 44105)
@@ -179,7 +179,11 @@
$package = $xml->addChild('Package');
$package->addAttribute('ID', 0);
- $package->addChild('Service', $r->getService());
+ $service = $this->getCode('service_to_code', $r->getService());
+ if (!$service) {
+ $service = $r->getService();
+ }
+ $package->addChild('Service', $service);
// no matter Letter, Flat or Parcel, use Parcel
if ($r->getService() == 'FIRST CLASS') {
@@ -192,7 +196,12 @@
$package->addChild('Ounces', $r->getWeightOunces());
// $package->addChild('Pounds', '0');
// $package->addChild('Ounces', '3');
- $package->addChild('Container', $r->getContainer());
+
+ // Because some methods don't accept VARIABLE and (NON)RECTANGULAR containers
+ if (strtoupper($r->getContainer()) == 'FLAT RATE ENVELOPE' || strtoupper($r->getContainer()) == 'FLAT RATE BOX') {
+ $package->addChild('Container', $r->getContainer());
+ }
+
$package->addChild('Size', $r->getSize());
$package->addChild('Machinable', $r->getMachinable());
Index: app/code/core/Mage/Paygate/Model/Authorizenet.php
===================================================================
--- app/code/core/Mage/Paygate/Model/Authorizenet.php (revision 44104)
+++ app/code/core/Mage/Paygate/Model/Authorizenet.php (revision 44105)
@@ -432,7 +432,8 @@
->setTransactionType($r[11])
->setCustomerId($r[12])
->setMd5Hash($r[37])
- ->setCardCodeResponseCode($r[39]);
+ ->setCardCodeResponseCode($r[38])
+ ->setCAVVResponseCode($r[39]);
} else {
Mage::throwException(
Mage::helper('paygate')->__('Error in payment gateway')
Index: app/code/core/Mage/Tax/sql/tax_setup/mysql4-upgrade-0.7.6-0.7.7.php
===================================================================
--- app/code/core/Mage/Tax/sql/tax_setup/mysql4-upgrade-0.7.6-0.7.7.php (revision 44104)
+++ app/code/core/Mage/Tax/sql/tax_setup/mysql4-upgrade-0.7.6-0.7.7.php (revision 44105)
@@ -24,9 +24,10 @@
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/
+/* @var $installer Mage_Tax_Model_Mysql4_Setup */
$installer = $this;
-/* @var $installer Mage_Core_Model_Resource_Setup */
+
$installer->startSetup();
$installer->run("
@@ -40,7 +41,7 @@
PRIMARY KEY ( `tax_calculation_rate_id` ),
KEY `IDX_TAX_CALCULATION_RATE` (`tax_country_id`, `tax_region_id`, `tax_postcode`),
KEY `IDX_TAX_CALCULATION_RATE_CODE` (`code`)
-) ENGINE = InnoDB;
+) ENGINE = InnoDB DEFAULT CHARSET = utf8;
CREATE TABLE `{$installer->getTable('tax_calculation_rate_title')}` (
`tax_calculation_rate_title_id` INT NOT NULL AUTO_INCREMENT ,
@@ -51,7 +52,7 @@
KEY `IDX_TAX_CALCULATION_RATE_TITLE` (`tax_calculation_rate_id`, `store_id`),
KEY `FK_TAX_CALCULATION_RATE_TITLE_RATE` (`tax_calculation_rate_id`),
KEY `FK_TAX_CALCULATION_RATE_TITLE_STORE` (`store_id`)
-) ENGINE = InnoDB;
+) ENGINE = InnoDB DEFAULT CHARSET = utf8;
CREATE TABLE `{$installer->getTable('tax_calculation_rule')}` (
`tax_calculation_rule_id` INT NOT NULL AUTO_INCREMENT ,
@@ -61,7 +62,7 @@
PRIMARY KEY ( `tax_calculation_rule_id` ),
KEY `IDX_TAX_CALCULATION_RULE` (`priority`, `position`, `tax_calculation_rule_id`),
KEY `IDX_TAX_CALCULATION_RULE_CODE` (`code`)
-) ENGINE = InnoDB;
+) ENGINE = InnoDB DEFAULT CHARSET = utf8;
CREATE TABLE `{$installer->getTable('tax_calculation')}` (
`tax_calculation_rate_id` INT NOT NULL,
@@ -73,7 +74,7 @@
KEY `FK_TAX_CALCULATION_CTC` (`customer_tax_class_id`),
KEY `FK_TAX_CALCULATION_PTC` (`product_tax_class_id`),
KEY `IDX_TAX_CALCULATION` (`tax_calculation_rate_id`, `customer_tax_class_id`, `product_tax_class_id`)
-) ENGINE = InnoDB;
+) ENGINE = InnoDB DEFAULT CHARSET = utf8;
");
@@ -86,9 +87,8 @@
$installer->getConnection()->addConstraint('FK_TAX_CALCULATION_PTC', $installer->getTable('tax_calculation'), 'product_tax_class_id', $installer->getTable('tax_class'), 'class_id');
-$this->convertOldTaxData();
+$installer->convertOldTaxData();
-
$installer->run("
DROP TABLE `{$installer->getTable('tax_rule')}`;
DROP TABLE `{$installer->getTable('tax_rate_type')}`;
@@ -96,5 +96,4 @@
DROP TABLE `{$installer->getTable('tax_rate')}`;
");
-
-$installer->endSetup();
\ No newline at end of file
+$installer->endSetup();
Index: app/code/core/Mage/Tax/Model/Mysql4/Setup.php
===================================================================
--- app/code/core/Mage/Tax/Model/Mysql4/Setup.php (revision 44104)
+++ app/code/core/Mage/Tax/Model/Mysql4/Setup.php (revision 44105)
@@ -18,19 +18,25 @@
* 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_Tax
- * @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_Tax
+ * @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)
*/
/**
- * Tax Setup Model
+ * Tax Setup Resource Model
*
- * @author Magento Core Team
+ * @category Mage
+ * @package Mage_Tax
+ * @author Magento Core Team
*/
class Mage_Tax_Model_Mysql4_Setup extends Mage_Core_Model_Resource_Setup
{
+ /**
+ * Convert old Tax data
+ *
+ */
public function convertOldTaxData()
{
$oldRules = $this->_loadTableData('tax_rule');
@@ -54,18 +60,18 @@
continue;
}
- $region = Mage::getModel('directory/region')->load($rate['tax_region_id']);
+ $region = Mage::getModel('directory/region')->load($rate['tax_region_id']);
$regionName = $region->getCode() ? $region->getCode() : '*';
- $code = "{$rate['tax_country_id']}-{$regionName}-{$rate['tax_postcode']}-{$type['type_name']}";
+ $code = "{$rate['tax_country_id']}-{$regionName}-{$rate['tax_postcode']}-{$type['type_name']}";
if ($rateValue > 0) {
$insertData = array(
- 'tax_country_id'=>$rate['tax_country_id'],
- 'tax_region_id'=>$rate['tax_region_id'],
- 'tax_postcode'=>$rate['tax_postcode'],
- 'code'=>$code,
- 'rate'=>$rateValue,
- );
+ 'tax_country_id' => $rate['tax_country_id'],
+ 'tax_region_id' => $rate['tax_region_id'],
+ 'tax_postcode' => $rate['tax_postcode'],
+ 'code' => $code,
+ 'rate' => $rateValue,
+ );
$newRateModel = Mage::getModel('tax/calculation_rate');
@@ -77,32 +83,37 @@
}
foreach ($oldRules as $rule) {
- if (!isset($ratesByType[$rule['tax_rate_type_id']]) || !count($ratesByType[$rule['tax_rate_type_id']])){
+ if (!isset($ratesByType[$rule['tax_rate_type_id']]) || !count($ratesByType[$rule['tax_rate_type_id']])) {
continue;
}
$customerTaxClasses = array($rule['tax_customer_class_id']);
$productTaxClasses = array($rule['tax_product_class_id']);
- $ctc = Mage::getModel('tax/class')->load($rule['tax_customer_class_id']);
- $ptc = Mage::getModel('tax/class')->load($rule['tax_product_class_id']);
- $type = $rateById[$rule['tax_rate_type_id']];
+ $ctc = Mage::getModel('tax/class')->load($rule['tax_customer_class_id']);
+ $ptc = Mage::getModel('tax/class')->load($rule['tax_product_class_id']);
+ $type = $rateById[$rule['tax_rate_type_id']];
- $rates = $ratesByType[$rule['tax_rate_type_id']];
- $code = "{$ctc->getClassName()}-{$ptc->getClassName()}-{$type}";
+ $rates = $ratesByType[$rule['tax_rate_type_id']];
+ $code = "{$ctc->getClassName()}-{$ptc->getClassName()}-{$type}";
$ruleData = array(
- 'tax_rate'=>$rates,
- 'tax_product_class'=>$productTaxClasses,
- 'tax_customer_class'=>$customerTaxClasses,
- 'code'=>$code,
- 'priority'=>1,
- 'position'=>1
- );
+ 'tax_rate' => $rates,
+ 'tax_product_class' => $productTaxClasses,
+ 'tax_customer_class' => $customerTaxClasses,
+ 'code' => $code,
+ 'priority' => 1,
+ 'position' => 1
+ );
Mage::getModel('tax/calculation_rule')->setData($ruleData)->save();
}
}
+ /**
+ * Load Tax Table Data
+ *
+ * @return array
+ */
protected function _loadTableData($table)
{
$table = $this->getTable($table);
@@ -111,20 +122,24 @@
return $this->_conn->fetchAll($select);
}
+ /**
+ * Load Old Rate Data
+ *
+ * @return array
+ */
protected function _loadOldRates($oldRateTypes)
{
-
- $table = $this->getTable('tax_rate');
- $select = $this->_conn->select();
- $select->from(array('main_table'=>$table));
+ $table = $this->getTable('tax_rate');
+ $select = $this->_conn->select()
+ ->from(array('main_table'=>$table));
foreach ($oldRateTypes as $type){
$id = $type['type_id'];
$select->joinLeft(
- array("data_{$id}"=>$this->getTable('tax_rate_data')),
- "data_{$id}.rate_type_id = {$id} AND data_{$id}.tax_rate_id = main_table.tax_rate_id",
- array("data_{$id}"=>'rate_value')
- );
+ array("data_{$id}"=>$this->getTable('tax_rate_data')),
+ "data_{$id}.rate_type_id = {$id} AND data_{$id}.tax_rate_id = main_table.tax_rate_id",
+ array("data_{$id}"=>'rate_value')
+ );
}
return $this->_conn->fetchAll($select);
}
-}
\ No newline at end of file
+}
Index: app/code/core/Mage/Tax/Model/Calculation/Rate.php
===================================================================
--- app/code/core/Mage/Tax/Model/Calculation/Rate.php (revision 44104)
+++ app/code/core/Mage/Tax/Model/Calculation/Rate.php (revision 44105)
@@ -127,4 +127,17 @@
Mage::dispatchEvent('tax_settings_change_after');
return $this;
}
+
+ /**
+ * Load rate model by code
+ *
+ * @param string $code
+ * @return Mage_Tax_Model_Calculation_Rate
+ */
+ public function loadByCode($code)
+ {
+ $this->load($code, 'code');
+ return $this;
+ }
+
}
\ No newline at end of file
Index: app/code/core/Mage/GiftMessage/Block/Message/Inline.php
===================================================================
--- app/code/core/Mage/GiftMessage/Block/Message/Inline.php (revision 44104)
+++ app/code/core/Mage/GiftMessage/Block/Message/Inline.php (revision 44105)
@@ -111,6 +111,9 @@
if(!$this->getData('items')) {
$items = array();
foreach ($this->getEntity()->getAllItems() as $item) {
+ if ($item->getParentItem()) {
+ continue;
+ }
if($this->helper('giftmessage/message')->isMessagesAvailable( substr($this->getType(), 0, 5)=='multi' ? 'address_item' : 'item', $item)) {
$items[] = $item;
}
Index: app/code/core/Mage/SalesRule/Model/Rule.php
===================================================================
--- app/code/core/Mage/SalesRule/Model/Rule.php (revision 44104)
+++ app/code/core/Mage/SalesRule/Model/Rule.php (revision 44105)
@@ -87,10 +87,10 @@
{
$arr = $this->_convertFlatToRecursive($rule);
if (isset($arr['conditions'])) {
- $this->getConditions()->loadArray($arr['conditions'][1]);
+ $this->getConditions()->setConditions(array())->loadArray($arr['conditions'][1]);
}
if (isset($arr['actions'])) {
- $this->getActions()->loadArray($arr['actions'][1], 'actions');
+ $this->getActions()->setActions(array())->loadArray($arr['actions'][1], 'actions');
}
return $this;
Index: app/code/core/Mage/CatalogSearch/Helper/Data.php
===================================================================
--- app/code/core/Mage/CatalogSearch/Helper/Data.php (revision 44104)
+++ app/code/core/Mage/CatalogSearch/Helper/Data.php (revision 44105)
@@ -116,6 +116,8 @@
$this->_queryText = null;
}
$this->_queryText = trim($this->_queryText);
+ $this->_queryText = Mage::helper('core/string')->cleanString($this->_queryText);
+
if (Mage::helper('core/string')->strlen($this->_queryText) > $this->getMaxQueryLength()) {
$this->_queryText = Mage::helper('core/string')->substr(
$this->_queryText,
Index: app/code/core/Mage/CatalogSearch/controllers/ResultController.php
===================================================================
--- app/code/core/Mage/CatalogSearch/controllers/ResultController.php (revision 44104)
+++ app/code/core/Mage/CatalogSearch/controllers/ResultController.php (revision 44105)
@@ -76,6 +76,7 @@
$this->loadLayout();
$this->_initLayoutMessages('catalog/session');
+ $this->_initLayoutMessages('checkout/session');
$this->renderLayout();
if (!Mage::helper('catalogSearch')->isMinQueryLength()) {
Index: app/code/core/Mage/Review/Model/Mysql4/Review/Summary.php
===================================================================
--- app/code/core/Mage/Review/Model/Mysql4/Review/Summary.php (revision 44104)
+++ app/code/core/Mage/Review/Model/Mysql4/Review/Summary.php (revision 44105)
@@ -45,4 +45,35 @@
$select->where('store_id = ?', (int)$object->getStoreId());
return $select;
}
+
+ /**
+ * Reaggregate all data by rating summary
+ *
+ * @param array $summary
+ * @return Mage_Review_Model_Mysql4_Review_Summary
+ */
+ public function reAggregate($summary)
+ {
+ $select = $this->_getWriteAdapter()->select()
+ ->from($this->getMainTable())
+ ->group(array('entity_pk_value', 'store_id'));
+ foreach ($this->_getWriteAdapter()->fetchAll($select) as $row) {
+ if (isset($summary[$row['store_id']]) && isset($summary[$row['store_id']][$row['entity_pk_value']])) {
+ $summaryItem = $summary[$row['store_id']][$row['entity_pk_value']];
+ if ($summaryItem->getCount()) {
+ $ratingSummary = round($summaryItem->getSum() / $summaryItem->getCount());
+ } else {
+ $ratingSummary = $summaryItem->getSum();
+ }
+ } else {
+ $ratingSummary = 0;
+ }
+ $this->_getWriteAdapter()->update(
+ $this->getMainTable(),
+ array('rating_summary' => $ratingSummary),
+ $this->_getWriteAdapter()->quoteInto('primary_id = ?', $row['primary_id'])
+ );
+ }
+ return $this;
+ }
}
\ No newline at end of file
Index: app/code/core/Mage/Customer/Helper/Data.php
===================================================================
--- app/code/core/Mage/Customer/Helper/Data.php (revision 44104)
+++ app/code/core/Mage/Customer/Helper/Data.php (revision 44105)
@@ -35,6 +35,11 @@
class Mage_Customer_Helper_Data extends Mage_Core_Helper_Abstract
{
/**
+ * Query param name for last url visited
+ */
+ const REFERER_QUERY_PARAM_NAME = 'referer';
+
+ /**
* Customer groups collection
*
* @var Mage_Customer_Model_Entity_Group_Collection
@@ -120,7 +125,21 @@
*/
public function getLoginUrl()
{
- return $this->_getUrl('customer/account/login');
+ $params = array();
+
+ $referer = $this->_getRequest()->getParam(self::REFERER_QUERY_PARAM_NAME);
+
+ if (!$referer && !Mage::getStoreConfigFlag('customer/startup/redirect_dashboard')) {
+ if (!Mage::getSingleton('customer/session')->getNoReferer()) {
+ $referer = Mage::getUrl('*/*/*', array('_current' => true));
+ $referer = Mage::helper('core')->urlEncode($referer);
+ }
+ }
+ if ($referer) {
+ $params = array(self::REFERER_QUERY_PARAM_NAME => $referer);
+ }
+
+ return $this->_getUrl('customer/account/login', $params);
}
/**
@@ -130,7 +149,11 @@
*/
public function getLoginPostUrl()
{
- return $this->_getUrl('customer/account/loginPost');
+ $params = array();
+ if ($this->_getRequest()->getParam(self::REFERER_QUERY_PARAM_NAME)) {
+ $params = array(self::REFERER_QUERY_PARAM_NAME => $this->_getRequest()->getParam(self::REFERER_QUERY_PARAM_NAME));
+ }
+ return $this->_getUrl('customer/account/loginPost', $params);
}
/**
Index: app/code/core/Mage/Customer/sql/customer_setup/mysql4-upgrade-0.8.10-0.8.11.php
===================================================================
--- app/code/core/Mage/Customer/sql/customer_setup/mysql4-upgrade-0.8.10-0.8.11.php (revision 0)
+++ app/code/core/Mage/Customer/sql/customer_setup/mysql4-upgrade-0.8.10-0.8.11.php (revision 44105)
@@ -0,0 +1,35 @@
+startSetup();
+
+$installer->getConnection()->dropKey($installer->getTable('customer_address_entity_text'), 'IDX_VALUE');
+$installer->getConnection()->dropKey($installer->getTable('customer_entity_text'), 'IDX_VALUE');
+
+$installer->endSetup();
Index: app/code/core/Mage/Customer/Model/Customer.php
===================================================================
--- app/code/core/Mage/Customer/Model/Customer.php (revision 44104)
+++ app/code/core/Mage/Customer/Model/Customer.php (revision 44105)
@@ -650,6 +650,7 @@
public function setStore(Mage_Core_Model_Store $store)
{
$this->setStoreId($store->getId());
+ $this->setWebsiteId($store->getWebsite()->getId());
return $this;
}
@@ -1041,4 +1042,15 @@
return $this->getId() && $this->hasSkipConfirmationIfEmail()
&& strtolower($this->getSkipConfirmationIfEmail()) === strtolower($this->getEmail());
}
+
+ public function __clone()
+ {
+ $newAddressCollection = $this->getPrimaryAddresses();
+ $newAddressCollection = array_merge($newAddressCollection, $this->getAdditionalAddresses());
+ $this->setId(null);
+ $this->cleanAllAddresses();
+ foreach ($newAddressCollection as $address) {
+ $this->addAddress(clone $address);
+ }
+ }
}
Index: app/code/core/Mage/Customer/Model/Address.php
===================================================================
--- app/code/core/Mage/Customer/Model/Address.php (revision 44104)
+++ app/code/core/Mage/Customer/Model/Address.php (revision 44105)
@@ -43,22 +43,23 @@
/**
* Retrieve address customer identifier
*
- * @return int
+ * @return integer
*/
public function getCustomerId()
{
- return $this->_getResource()->getCustomerId($this);
+ return $this->_getData('customer_id') ? $this->_getData('customer_id') : $this->getParentId();
}
/**
* Declare address customer identifier
*
- * @param unknown_type $id
- * @return unknown
+ * @param integer $id
+ * @return Mage_Customer_Model_Address
*/
public function setCustomerId($id)
{
- $this->_getResource()->setCustomerId($this, $id);
+ $this->setParentId($id);
+ $this->setData('customer_id', $id);
return $this;
}
@@ -86,7 +87,7 @@
*/
public function delete()
{
- $this->_getResource()->delete($this);
+ parent::delete();
$this->setData(array());
return $this;
}
Index: app/code/core/Mage/Customer/Model/Entity/Customer.php
===================================================================
--- app/code/core/Mage/Customer/Model/Entity/Customer.php (revision 44104)
+++ app/code/core/Mage/Customer/Model/Entity/Customer.php (revision 44105)
@@ -126,13 +126,35 @@
{
foreach ($customer->getAddresses() as $address) {
if ($address->getData('_deleted')) {
+ if ($address->getId() == $customer->getData('default_billing')) {
+ $customer->setData('default_billing', null);
+ }
+ if ($address->getId() == $customer->getData('default_shipping')) {
+ $customer->setData('default_shipping', null);
+ }
$address->delete();
}
else {
$address->setParentId($customer->getId())
->setStoreId($customer->getStoreId())
->save();
+ if ($address->getIsPrimaryBilling()
+ && $address->getId() != $customer->getData('default_billing'))
+ {
+ $customer->setData('default_billing', $address->getId());
+ }
+ if ($address->getIsPrimaryShipping()
+ && $address->getId() != $customer->getData('default_shipping'))
+ {
+ $customer->setData('default_shipping', $address->getId());
+ }
}
+ if ($customer->dataHasChangedFor('default_billing')) {
+ $this->saveAttribute($customer, 'default_billing');
+ }
+ if ($customer->dataHasChangedFor('default_shipping')) {
+ $this->saveAttribute($customer, 'default_shipping');
+ }
}
return $this;
}
Index: app/code/core/Mage/Customer/Model/Entity/Address.php
===================================================================
--- app/code/core/Mage/Customer/Model/Entity/Address.php (revision 44104)
+++ app/code/core/Mage/Customer/Model/Entity/Address.php (revision 44105)
@@ -59,11 +59,26 @@
return $this;
}
+ /**
+ * Return customer id
+ *
+ * @deprecated
+ * @param Mage_Customer_Model_Address $object
+ * @return integer
+ */
public function getCustomerId($object)
{
return $object->getData('customer_id') ? $object->getData('customer_id') :$object->getParentId();
}
+ /**
+ * Set customer id
+ *
+ * @deprecated
+ * @param Mage_Customer_Model_Address $object
+ * @param integer $id
+ * @return Mage_Customer_Model_Address
+ */
public function setCustomerId($object, $id)
{
$object->setParentId($id);
Index: app/code/core/Mage/Customer/controllers/AccountController.php
===================================================================
--- app/code/core/Mage/Customer/controllers/AccountController.php (revision 44104)
+++ app/code/core/Mage/Customer/controllers/AccountController.php (revision 44105)
@@ -70,10 +70,23 @@
if (!$this->_getSession()->authenticate($this)) {
$this->setFlag('', 'no-dispatch', true);
}
+ } else {
+ $this->_getSession()->setNoReferer(true);
}
}
/**
+ * Action postdispatch
+ *
+ * Remove No-referer flag from customer session after each action
+ */
+ public function postDispatch()
+ {
+ parent::postDispatch();
+ $this->_getSession()->unsNoReferer(false);
+ }
+
+ /**
* Default customer account page
*/
public function indexAction()
@@ -145,9 +158,38 @@
$session->addError($this->__('Login and password are required'));
}
}
+
+ $this->_loginPostRedirect();
+ }
+
+ /**
+ * Define target URL and redirect customer after logging in
+ */
+ protected function _loginPostRedirect()
+ {
+ $session = $this->_getSession();
+
if (!$session->getBeforeAuthUrl() || $session->getBeforeAuthUrl() == Mage::getBaseUrl() ) {
+
+ // Set default URL to redirect customer to
$session->setBeforeAuthUrl(Mage::helper('customer')->getAccountUrl());
+
+ // Redirect customer to the last page visited after logging in
+ if ($session->isLoggedIn())
+ {
+ if (!Mage::getStoreConfigFlag('customer/startup/redirect_dashboard')) {
+ if ($referer = $this->getRequest()->getParam(Mage_Customer_Helper_Data::REFERER_QUERY_PARAM_NAME)) {
+ $referer = Mage::helper('core')->urlDecode($referer);
+ if ($this->_isUrlInternal($referer)) {
+ $session->setBeforeAuthUrl($referer);
+ }
+ }
+ }
+ } else {
+ $session->setBeforeAuthUrl(Mage::helper('customer')->getLoginUrl());
+ }
}
+
$this->_redirectUrl($session->getBeforeAuthUrl(true));
}
Index: app/code/core/Mage/Customer/etc/system.xml
===================================================================
--- app/code/core/Mage/Customer/etc/system.xml (revision 44104)
+++ app/code/core/Mage/Customer/etc/system.xml (revision 44105)
@@ -262,7 +262,26 @@
+
+ Login Options
+ 90
+ 1
+ 1
+ 1
+
+
+ Redirect Customer to Account Dashboard after Logging in
+ select
+ adminhtml/system_config_source_yesno
+ Customer will stay on the current page if "No" is selected
+ 1
+ 1
+ 1
+ 0
+
+
+
-
\ No newline at end of file
+
Index: app/code/core/Mage/Customer/etc/config.xml
===================================================================
--- app/code/core/Mage/Customer/etc/config.xml (revision 44104)
+++ app/code/core/Mage/Customer/etc/config.xml (revision 44105)
@@ -28,7 +28,7 @@
- 0.8.10
+ 0.8.11
@@ -378,6 +378,9 @@
+
+ 1
+
\ No newline at end of file
Index: app/code/core/Mage/CatalogIndex/Model/Observer.php
===================================================================
--- app/code/core/Mage/CatalogIndex/Model/Observer.php (revision 44104)
+++ app/code/core/Mage/CatalogIndex/Model/Observer.php (revision 44105)
@@ -184,7 +184,7 @@
/**
* @todo add flag to attribute model which will notify what options was changed
*/
- $attribute = $observer->getAttribute();
+ $attribute = $observer->getEvent()->getAttribute();
$tags = array(
Mage_Eav_Model_Entity_Attribute::CACHE_TAG.':'.$attribute->getId()
);
@@ -269,6 +269,9 @@
public function catalogCategorySaveAfter(Varien_Event_Observer $observer)
{
$category = $observer->getEvent()->getCategory();
+ if ($category->getInitialSetupFlag()) {
+ return $this;
+ }
$tags = array(
Mage_Catalog_Model_Category::CACHE_TAG.':'.$category->getPath()
);
Index: app/code/core/Mage/Backup/Model/Fs/Collection.php
===================================================================
--- app/code/core/Mage/Backup/Model/Fs/Collection.php (revision 44104)
+++ app/code/core/Mage/Backup/Model/Fs/Collection.php (revision 44105)
@@ -31,200 +31,55 @@
* @package Mage_Backup
* @author Magento Core Team
*/
-
-class Mage_Backup_Model_Fs_Collection extends Varien_Data_Collection
+class Mage_Backup_Model_Fs_Collection extends Varien_Data_Collection_Filesystem
{
/**
- * Is loaded data flag
- * @var boolean
+ * Folder, where all backups are stored
+ *
+ * @var string
*/
- protected $_isLoaded = false;
+ protected $_baseDir;
-
/**
- * Constructor
- *
- * Sets default item object class and default sort order.
+ * Set collection specific parameters and make sure backups folder will exist
*/
public function __construct()
{
parent::__construct();
- $this->setItemObjectClass(Mage::getConfig()->getModelClassName('backup/backup'))
- ->setOrder('time','desc');
- }
+ $this->_baseDir = Mage::getBaseDir('var') . DS . 'backups';
- /**
- * Loads data from backup directory
- *
- * @return Mage_Backup_Model_Fs_Collection
- */
- public function getSize()
- {
- $this->_loadFiles();
- return $this->_totalRecords;
- }
-
- public function load($printQuery = false, $logQuery = false)
- {
- if (!$this->_isLoaded) {
- $this->_loadFiles();
- if($this->getPageSize()) {
- $this->_items = array_slice($this->_items, ($this->getCurPage()-1)*$this->getPageSize(), $this->getPageSize());
- }
+ // check for valid base dir
+ $ioProxy = new Varien_Io_File();
+ $ioProxy->mkdir($this->_baseDir);
+ if (!is_file($this->_baseDir . DS . '.htaccess')) {
+ $ioProxy->open(array('path' => $this->_baseDir));
+ $ioProxy->write('.htaccess', 'deny from all', 0644);
}
- return $this;
+ // set collection specific params
+ $this
+ ->setOrder('time', self::SORT_ORDER_DESC)
+ ->addTargetDir($this->_baseDir)
+ ->setFilesFilter('/^[a-z0-9\-\_]+\.' . preg_quote(Mage_Backup_Model_Backup::BACKUP_EXTENSION, '/') . '$/')
+ ->setCollectRecursively(false)
+ ;
}
- protected function _loadFiles()
- {
- if (!$this->_isLoaded) {
-
- $readPath = Mage::getBaseDir('var') . DS . "backups";
-
- $ioProxy = new Varien_Io_File();
-
- try {
- $ioProxy->open(array('path'=>$readPath));
- }
- catch (Exception $e) {
- $ioProxy->mkdir($readPath, 0777);
- $ioProxy->chmod($readPath, 0777);
- $ioProxy->open(array('path'=>$readPath));
- }
-
- if (!is_file($readPath . DS . ".htaccess")) {
- // Deny from reading in browser
- $ioProxy->write(".htaccess","deny from all", 0644);
- }
-
-
- $list = $ioProxy->ls(Varien_Io_File::GREP_FILES);
-
- $fileExtension = constant($this->_itemObjectClass . "::BACKUP_EXTENSION");
-
- foreach ($list as $entry) {
- if ($entry['filetype'] == $fileExtension) {
- $item = new $this->_itemObjectClass();
- $item->load($entry['text'], $readPath);
- $item->setSize($entry['size']);
- if ($this->_checkCondition($item)) {
- $this->addItem($item);
- }
- }
- }
-
-
- $this->_totalRecords = count($this->_items);
-
- if ($this->_totalRecords > 1) {
- usort($this->_items, array(&$this, 'compareByTypeOrDate'));
- }
-
- $this->_isLoaded = true;
- }
-
- return $this;
- }
-
/**
- * Set sort order for items
+ * Get backup-specific data from model for each row
*
- * @param string $field
- * @param string $direction
- * @return Mage_Backup_Model_Fs_Collection
+ * @param string $filename
+ * @return array
*/
- public function setOrder($field, $direction = 'desc')
+ protected function _generateRow($filename)
{
- $direction = (strtoupper($direction)=='ASC') ? 1 : -1;
- $this->_orders = array($field, $direction);
- return $this;
- }
-
- /**
- * Function for comparing two items in collection
- *
- * @param Varien_Object $item1
- * @param Varien_Object $item2
- * @return boolean
- */
- public function compareByTypeOrDate(Varien_Object $item1,Varien_Object $item2)
- {
- if (is_string($item1->getData($this->_orders[0]))) {
- return strcmp($item1->getData($this->_orders[0]),$item2->getData($this->_orders[0]))*(-1*$this->_orders[1]);
- } else if ($item1->getData($this->_orders[0]) < $item2->getData($this->_orders[0])) {
- return 1*(-1*$this->_orders[1]);
- } else if ($item1->getData($this->_orders[0]) > $item2->getData($this->_orders[0])) {
- return -1*(-1*$this->_orders[1]);
- } else {
- return 0;
+ $row = parent::_generateRow($filename);
+ foreach (Mage::getSingleton('backup/backup')->load($row['basename'], $this->_baseDir)
+ ->getData() as $key => $value) {
+ $row[$key] = $value;
}
+ $row['size'] = filesize($filename);
+ return $row;
}
-
- public function addFieldToFilter($fieldName, $condition)
- {
- $this->_filters[$fieldName] = $condition;
- return $this;
- }
-
- protected function _checkCondition($item)
- {
- foreach ($this->_filters as $field => $condition) {
- if (is_array($condition)) {
- if (isset($condition['from']) || isset($condition['to'])) {
- if ($field == 'time_formated') {
- $format = Mage::app()->getLocale()->getDateTimeFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT);
- if (isset($condition['from'])) {
- $condition['from'] = Mage::app()->getLocale()->date($condition['from'], $format)->getTimestamp()
- + Mage::app()->getLocale()->date($condition['from'], $format)->getGmtOffset();
- }
- if (isset($condition['to'])) {
- $condition['to'] = Mage::app()->getLocale()->date($condition['to'], $format)->getTimestamp()
- + Mage::app()->getLocale()->date($condition['to'], $format)->getGmtOffset();
- }
- $field = 'time';
- }
-
- if (isset($condition['from']) && $item->getData($field) < $condition['from']) {
- return false;
- }
- if (isset($condition['to']) && $item->getData($field) > $condition['to']) {
- return false;
- }
- }
- elseif (!empty($condition['neq']) && $item->getData($field) == $condition['neq']) {
- return false;
- }
- elseif (!empty($condition['like']) && strpos($item->getData($field), trim($condition['like'], '%')) === false) {
- return false;
- }
- elseif (!empty($condition['nlike']) && strpos($item->getData($field), trim($condition['nlike'], '%')) !== false) {
- return false;
- }
- elseif (!empty($condition['in'])) {
- $values = $condition['in'];
- if(!is_array($values)) {
- $values = array($values);
- }
- if(!in_array($item->getData($field), $values)) {
- return false;
- }
- }
- elseif (!empty($condition['nin'])) {
- $values = $condition['in'];
- if(!is_array($values)) {
- $values = array($values);
- }
- if(in_array($item->getData($field), $values)) {
- return false;
- }
- }
- } else if($item->getData($field) != $condition) {
- return false;
- }
- }
-
- return true;
- }
}
\ No newline at end of file
Index: app/code/core/Mage/Backup/Model/Backup.php
===================================================================
--- app/code/core/Mage/Backup/Model/Backup.php (revision 44104)
+++ app/code/core/Mage/Backup/Model/Backup.php (revision 44105)
@@ -70,8 +70,8 @@
'id' => $filePath . DS . $fileName,
'time' => (int)$time,
'path' => $filePath,
- 'time_formated' => date('Y-m-d H:i:s', (int)$time))
- );
+ 'date_object' => new Zend_Date((int)$time)
+ ));
$this->setType($type);
return $this;
}
Index: app/code/core/Mage/Poll/Model/Poll.php
===================================================================
--- app/code/core/Mage/Poll/Model/Poll.php (revision 44104)
+++ app/code/core/Mage/Poll/Model/Poll.php (revision 44105)
@@ -118,7 +118,7 @@
}
// check by ip
- if (count($this->_getResource()->getVotedPollIdsByIp($_SERVER['REMOTE_ADDR'], $pollId))) {
+ if (count($this->_getResource()->getVotedPollIdsByIp(Mage::helper('core/http')->getRemoteAddr(), $pollId))) {
return true;
}
@@ -194,7 +194,7 @@
}
// load from db for this ip
- foreach ($this->_getResource()->getVotedPollIdsByIp($_SERVER['REMOTE_ADDR']) as $pollId) {
+ foreach ($this->_getResource()->getVotedPollIdsByIp(Mage::helper('core/http')->getRemoteAddr()) as $pollId) {
$idsArray[$pollId] = $pollId;
}
Index: app/code/core/Mage/Poll/controllers/VoteController.php
===================================================================
--- app/code/core/Mage/Poll/controllers/VoteController.php (revision 44104)
+++ app/code/core/Mage/Poll/controllers/VoteController.php (revision 44105)
@@ -53,7 +53,7 @@
if ($poll->getId() && !$poll->getClosed() && !$poll->isVoted()) {
$vote = Mage::getModel('poll/poll_vote')
->setPollAnswerId($answerId)
- ->setIpAddress(ip2long($this->getRequest()->getServer('REMOTE_ADDR')))
+ ->setIpAddress(Mage::helper('core/http')->getRemoteAddr(true))
->setCustomerId(Mage::getSingleton('customer/session')->getCustomerId());
$poll->addVote($vote);
Index: app/code/core/Mage/Rule/Model/Rule.php
===================================================================
--- app/code/core/Mage/Rule/Model/Rule.php (revision 44104)
+++ app/code/core/Mage/Rule/Model/Rule.php (revision 44105)
@@ -150,10 +150,10 @@
{
$arr = $this->_convertFlatToRecursive($rule);
if (isset($arr['conditions'])) {
- $this->getConditions()->loadArray($arr['conditions'][1]);
+ $this->getConditions()->setConditions(array())->loadArray($arr['conditions'][1]);
}
if (isset($arr['actions'])) {
- $this->getActions()->loadArray($arr['actions'][1]);
+ $this->getActions()->setActions(array())->loadArray($arr['actions'][1]);
}
return $this;
Index: app/code/core/Mage/ProductAlert/Model/Email.php
===================================================================
--- app/code/core/Mage/ProductAlert/Model/Email.php (revision 44104)
+++ app/code/core/Mage/ProductAlert/Model/Email.php (revision 44105)
@@ -20,7 +20,7 @@
*
* @category Mage
* @package Mage_ProductAlert
- * @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
+ * @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)
*/
@@ -30,7 +30,7 @@
*
* @category Mage
* @package Mage_ProductAlert
- * @author Magento Core Team
+ * @author Magento Core Team
*/
class Mage_ProductAlert_Model_Email extends Mage_Core_Model_Abstract
{
@@ -247,15 +247,23 @@
return false;
}
- Mage::getDesign()->setStore($storeId);
- Mage::getDesign()->setArea('frontend');
+ // set design parameters, required for email (remember current)
+ $currentDesign = Mage::getDesign()->setAllGetOld(array(
+ 'store' => $storeId,
+ 'area' => 'frontend',
+ 'package' => Mage::getStoreConfig('design/package/name', $storeId),
+ ));
+ Mage::app()->getLocale()->emulate($storeId);
+
$translate = Mage::getSingleton('core/translate');
/* @var $translate Mage_Core_Model_Translate */
$translate->setTranslateInline(false);
if ($this->_type == 'price') {
- $this->_getPriceBlock()->setStore($store);
+ $this->_getPriceBlock()
+ ->setStore($store)
+ ->reset();
foreach ($this->_priceProducts as $product) {
$product->setCustomerGroupId($this->_customer->getGroupId());
$this->_getPriceBlock()->addProduct($product);
@@ -264,7 +272,9 @@
$templateId = Mage::getStoreConfig(self::XML_PATH_EMAIL_PRICE_TEMPLATE, $storeId);
}
elseif ($this->_type == 'stock') {
- $this->_getStockBlock()->setStore($store);
+ $this->_getStockBlock()
+ ->setStore($store)
+ ->reset();
foreach ($this->_stockProducts as $product) {
$product->setCustomerGroupId($this->_customer->getGroupId());
$this->_getStockBlock()->addProduct($product);
@@ -273,6 +283,7 @@
$templateId = Mage::getStoreConfig(self::XML_PATH_EMAIL_STOCK_TEMPLATE, $storeId);
}
else {
+ Mage::app()->getLocale()->revert();
return false;
}
@@ -293,6 +304,10 @@
$translate->setTranslateInline(true);
+ // revert current design
+ Mage::getDesign()->setAllGetOld($currentDesign);
+ Mage::app()->getLocale()->revert();
+
return true;
}
-}
\ No newline at end of file
+}
Index: app/code/core/Mage/ProductAlert/Block/Email/Abstract.php
===================================================================
--- app/code/core/Mage/ProductAlert/Block/Email/Abstract.php (revision 44104)
+++ app/code/core/Mage/ProductAlert/Block/Email/Abstract.php (revision 44105)
@@ -52,7 +52,7 @@
* Set Store scope
*
* @param int|string|Mage_Core_Model_Website|Mage_Core_Model_Store $store
- * @param Mage_ProductAlert_Block_Email_Price
+ * @return Mage_ProductAlert_Block_Email_Abstract
*/
public function setStore($store)
{
Index: app/code/core/Mage/Bundle/Model/Sales/Order/Pdf/Items/Invoice.php
===================================================================
--- app/code/core/Mage/Bundle/Model/Sales/Order/Pdf/Items/Invoice.php (revision 44104)
+++ app/code/core/Mage/Bundle/Model/Sales/Order/Pdf/Items/Invoice.php (revision 44105)
@@ -54,7 +54,8 @@
foreach ($items as $_item) {
$line = array();
- if ($attributes = $this->getSelectionAttributes($_item)) {
+ $attributes = $this->getSelectionAttributes($_item);
+ if (is_array($attributes)) {
$optionId = $attributes['option_id'];
}
else {
@@ -72,7 +73,7 @@
if ($_prevOptionId != $attributes['option_id']) {
$line[0] = array(
'font' => 'italic',
- 'text' => $attributes['option_label'],
+ 'text' => Mage::helper('core/string')->str_split($attributes['option_label'], 70, true, true),
'feed' => 35
);
@@ -95,13 +96,8 @@
$feed = 35;
$name = $_item->getName();
}
- $text = array();
- foreach (Mage::helper('core/string')->str_split($name, 55, true, true) as $part) {
- $text[] = $part;
- }
-
$line[] = array(
- 'text' => $text,
+ 'text' => Mage::helper('core/string')->str_split($name, 55, true, true),
'feed' => $feed
);
@@ -152,33 +148,29 @@
$drawItems[$optionId]['lines'][] = $line;
}
- if ($item->getOrderItem()->getProductOptions()) {
- $options = $item->getOrderItem()->getProductOptions();
+ // custom options
+ $options = $item->getOrderItem()->getProductOptions();
+ if ($options) {
if (isset($options['options'])) {
foreach ($options['options'] as $option) {
$lines = array();
- $text = array();
- foreach (Mage::helper('core/string')->str_split(strip_tags($option['label']), 60, false, true) as $_option) {
- $text[] = $_option;
- }
-
- $lines = array(array(
- 'text' => $text,
+ $lines[][] = array(
+ 'text' => Mage::helper('core/string')->str_split(strip_tags($option['label']), 70, true, true),
'font' => 'italic',
'feed' => 35
- ));
+ );
if ($option['value']) {
$text = array();
$_printValue = isset($option['print_value']) ? $option['print_value'] : strip_tags($option['value']);
$values = explode(', ', $_printValue);
foreach ($values as $value) {
- foreach (Mage::helper('core/string')->str_split($value, 70, true, true) as $_value) {
+ foreach (Mage::helper('core/string')->str_split($value, 50, true, true) as $_value) {
$text[] = $_value;
}
}
- $lines[] = array(
+ $lines[][] = array(
'text' => $text,
'feed' => 40
);
@@ -196,4 +188,4 @@
$this->setPage($page);
}
-}
\ No newline at end of file
+}
Index: app/code/core/Mage/Bundle/Model/Sales/Order/Pdf/Items/Abstract.php
===================================================================
--- app/code/core/Mage/Bundle/Model/Sales/Order/Pdf/Items/Abstract.php (revision 44104)
+++ app/code/core/Mage/Bundle/Model/Sales/Order/Pdf/Items/Abstract.php (revision 44105)
@@ -20,7 +20,7 @@
*
* @category Mage
* @package Mage_Bundle
- * @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
+ * @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)
*/
@@ -54,7 +54,8 @@
if ($_items) {
foreach ($_items as $_item) {
- if ($parentItem = $_item->getOrderItem()->getParentItem()) {
+ $parentItem = $_item->getOrderItem()->getParentItem();
+ if ($parentItem) {
$_itemsArray[$parentItem->getId()][$_item->getOrderItemId()] = $_item;
} else {
$_itemsArray[$_item->getOrderItem()->getId()][$_item->getOrderItemId()] = $_item;
@@ -81,17 +82,23 @@
if ($item->getOrderItem()) {
$item = $item->getOrderItem();
}
- if ($parentItem = $item->getParentItem()) {
- if ($options = $parentItem->getProductOptions()) {
- if (isset($options['shipment_type']) && $options['shipment_type'] == Mage_Catalog_Model_Product_Type_Abstract::SHIPMENT_SEPARATELY) {
+
+ $parentItem = $item->getParentItem();
+ if ($parentItem) {
+ $options = $parentItem->getProductOptions();
+ if ($options) {
+ if (isset($options['shipment_type'])
+ && $options['shipment_type'] == Mage_Catalog_Model_Product_Type_Abstract::SHIPMENT_SEPARATELY) {
return true;
} else {
return false;
}
}
} else {
- if ($options = $item->getProductOptions()) {
- if (isset($options['shipment_type']) && $options['shipment_type'] == Mage_Catalog_Model_Product_Type_Abstract::SHIPMENT_SEPARATELY) {
+ $options = $item->getProductOptions();
+ if ($options) {
+ if (isset($options['shipment_type'])
+ && $options['shipment_type'] == Mage_Catalog_Model_Product_Type_Abstract::SHIPMENT_SEPARATELY) {
return false;
} else {
return true;
@@ -100,8 +107,10 @@
}
}
- if ($options = $this->getOrderItem()->getProductOptions()) {
- if (isset($options['shipment_type']) && $options['shipment_type'] == Mage_Catalog_Model_Product_Type_Abstract::SHIPMENT_SEPARATELY) {
+ $options = $this->getOrderItem()->getProductOptions();
+ if ($options) {
+ if (isset($options['shipment_type'])
+ && $options['shipment_type'] == Mage_Catalog_Model_Product_Type_Abstract::SHIPMENT_SEPARATELY) {
return true;
}
}
@@ -120,8 +129,11 @@
if ($item->getOrderItem()) {
$item = $item->getOrderItem();
}
- if ($parentItem = $item->getParentItem()) {
- if ($options = $parentItem->getProductOptions()) {
+
+ $parentItem = $item->getParentItem();
+ if ($parentItem) {
+ $options = $parentItem->getProductOptions();
+ if ($options) {
if (isset($options['product_calculations']) && $options['product_calculations'] == Mage_Catalog_Model_Product_Type_Abstract::CALCULATE_CHILD) {
return true;
} else {
@@ -129,7 +141,8 @@
}
}
} else {
- if ($options = $item->getProductOptions()) {
+ $options = $item->getProductOptions();
+ if ($options) {
if (isset($options['product_calculations']) && $options['product_calculations'] == Mage_Catalog_Model_Product_Type_Abstract::CALCULATE_CHILD) {
return false;
} else {
@@ -139,7 +152,8 @@
}
}
- if ($options = $this->getOrderItem()->getProductOptions()) {
+ $options = $this->getOrderItem()->getProductOptions();
+ if ($options) {
if (isset($options['product_calculations'])
&& $options['product_calculations'] == Mage_Catalog_Model_Product_Type_Abstract::CALCULATE_CHILD) {
return true;
@@ -156,7 +170,8 @@
*/
public function getBundleOptions($item = null)
{
- if ($options = $this->getOrderItem()->getProductOptions()) {
+ $options = $this->getOrderItem()->getProductOptions();
+ if ($options) {
if (isset($options['bundle_options'])) {
return $options['bundle_options'];
}
@@ -193,7 +208,8 @@
{
$result = array();
- if ($options = $this->getOrderItem()->getProductOptions()) {
+ $options = $this->getOrderItem()->getProductOptions();
+ if ($options) {
if (isset($options['options'])) {
$result = array_merge($result, $options['options']);
}
@@ -231,12 +247,14 @@
{
$result = strip_tags($item->getName());
if (!$this->isShipmentSeparately($item)) {
- if ($attributes = $this->getSelectionAttributes($item)) {
+ $attributes = $this->getSelectionAttributes($item);
+ if ($attributes) {
$result = sprintf('%d', $attributes['qty']) . ' x ' . $result;
}
}
if (!$this->isChildCalculated($item)) {
- if ($attributes = $this->getSelectionAttributes($item)) {
+ $attributes = $this->getSelectionAttributes($item);
+ if ($attributes) {
$result .= " " . strip_tags($this->getOrderItem()->getOrder()->formatPrice($attributes['price']));
}
}
Index: app/code/core/Mage/Bundle/Model/Sales/Order/Pdf/Items/Shipment.php
===================================================================
--- app/code/core/Mage/Bundle/Model/Sales/Order/Pdf/Items/Shipment.php (revision 44104)
+++ app/code/core/Mage/Bundle/Model/Sales/Order/Pdf/Items/Shipment.php (revision 44105)
@@ -40,7 +40,6 @@
*/
public function draw()
{
- $order = $this->getOrder();
$item = $this->getItem();
$pdf = $this->getPdf();
$page = $this->getPage();
@@ -56,7 +55,8 @@
foreach ($items as $_item) {
$line = array();
- if ($attributes = $this->getSelectionAttributes($_item)) {
+ $attributes = $this->getSelectionAttributes($_item);
+ if (is_array($attributes)) {
$optionId = $attributes['option_id'];
}
else {
@@ -74,7 +74,7 @@
if ($_prevOptionId != $attributes['option_id']) {
$line[0] = array(
'font' => 'italic',
- 'text' => $attributes['option_label'],
+ 'text' => Mage::helper('core/string')->str_split($attributes['option_label'],60, true, true),
'feed' => 60
);
@@ -84,6 +84,8 @@
);
$line = array();
+
+ $_prevOptionId = $attributes['option_id'];
}
}
@@ -134,33 +136,29 @@
$drawItems[$optionId]['lines'][] = $line;
}
- if ($item->getOrderItem()->getProductOptions()) {
- $options = $item->getOrderItem()->getProductOptions();
+ // custom options
+ $options = $item->getOrderItem()->getProductOptions();
+ if ($options) {
if (isset($options['options'])) {
foreach ($options['options'] as $option) {
$lines = array();
- $text = array();
- foreach (Mage::helper('core/string')->str_split(strip_tags($option['label']), 60, false, true) as $_option) {
- $text[] = $_option;
- }
-
- $lines = array(array(
- 'text' => $text,
+ $lines[][] = array(
+ 'text' => Mage::helper('core/string')->str_split(strip_tags($option['label']), 70, true, true),
'font' => 'italic',
'feed' => 60
- ));
+ );
if ($option['value']) {
$text = array();
$_printValue = isset($option['print_value']) ? $option['print_value'] : strip_tags($option['value']);
$values = explode(', ', $_printValue);
foreach ($values as $value) {
- foreach (Mage::helper('core/string')->str_split($value, 70, true, true) as $_value) {
+ foreach (Mage::helper('core/string')->str_split($value, 50, true, true) as $_value) {
$text[] = $_value;
}
}
- $lines[] = array(
+ $lines[][] = array(
'text' => $text,
'feed' => 65
);
Index: app/code/core/Mage/Bundle/Model/Sales/Order/Pdf/Items/Creditmemo.php
===================================================================
--- app/code/core/Mage/Bundle/Model/Sales/Order/Pdf/Items/Creditmemo.php (revision 44104)
+++ app/code/core/Mage/Bundle/Model/Sales/Order/Pdf/Items/Creditmemo.php (revision 44105)
@@ -55,7 +55,8 @@
$x = $leftBound;
$line = array();
- if ($attributes = $this->getSelectionAttributes($_item)) {
+ $attributes = $this->getSelectionAttributes($_item);
+ if (is_array($attributes)) {
$optionId = $attributes['option_id'];
}
else {
@@ -74,7 +75,7 @@
if ($_prevOptionId != $attributes['option_id']) {
$line[0] = array(
'font' => 'italic',
- 'text' => $attributes['option_label'],
+ 'text' => Mage::helper('core/string')->str_split($attributes['option_label'],60, true, true),
'feed' => $x
);
@@ -178,21 +179,17 @@
}
- if ($item->getOrderItem()->getProductOptions()) {
- $options = $item->getOrderItem()->getProductOptions();
+ // custom options
+ $options = $item->getOrderItem()->getProductOptions();
+ if ($options) {
if (isset($options['options'])) {
foreach ($options['options'] as $option) {
$lines = array();
- $text = array();
- foreach (Mage::helper('core/string')->str_split(strip_tags($option['label']), 60, false, true) as $_option) {
- $text[] = $_option;
- }
-
- $lines = array(array(
- 'text' => $text,
+ $lines[][] = array(
+ 'text' => Mage::helper('core/string')->str_split(strip_tags($option['label']), 70, true, true),
'font' => 'italic',
'feed' => $leftBound
- ));
+ );
if ($option['value']) {
$text = array();
@@ -204,7 +201,7 @@
}
}
- $lines[] = array(
+ $lines[][] = array(
'text' => $text,
'feed' => $leftBound + 5
);
@@ -221,4 +218,4 @@
$page = $pdf->drawLineBlocks($page, $drawItems, array('table_header' => true));
$this->setPage($page);
}
-}
\ No newline at end of file
+}
Index: app/code/core/Mage/Bundle/Model/Mysql4/Price/Index.php
===================================================================
--- app/code/core/Mage/Bundle/Model/Mysql4/Price/Index.php (revision 44104)
+++ app/code/core/Mage/Bundle/Model/Mysql4/Price/Index.php (revision 44105)
@@ -275,8 +275,11 @@
array('selection_table' => $this->getTable('bundle/selection')),
'selection_table.option_id=option_table.option_id',
array('selection_id', 'product_id', 'selection_price_type',
- 'selection_price_value', 'selection_qty', 'selection_can_change_qty')
- )
+ 'selection_price_value', 'selection_qty', 'selection_can_change_qty'))
+ ->join(
+ array('e' => $this->getTable('catalog/product')),
+ 'e.entity_id=selection_table.product_id AND e.required_options=0',
+ array())
->where('option_table.parent_id=?', $productId);
$query = $this->_getReadAdapter()->query($select);
while ($row = $query->fetch()) {
@@ -674,6 +677,7 @@
$productId, $priceType, $basePrice, $priceData, $priceIndex, $website, $group)
{
$minPrice = $maxPrice = $basePrice;
+ $optPrice = 0;
foreach ($options as $option) {
$optionPrices = array();
@@ -725,6 +729,9 @@
if ($option['required']) {
$minPrice += min($optionPrices);
}
+ else {
+ $optPrice = $optPrice && $optPrice < min($optionPrices) ? $optPrice : min($optionPrices);
+ }
if (in_array($option['type'], array('multi', 'checkbox'))) {
$maxPrice += array_sum($optionPrices);
}
@@ -733,6 +740,10 @@
}
}
}
+
+ if ($minPrice == 0) {
+ $minPrice = $optPrice;
+ }
return array($minPrice, $maxPrice);
}
Index: app/code/core/Mage/Bundle/Model/Mysql4/Selection.php
===================================================================
--- app/code/core/Mage/Bundle/Model/Mysql4/Selection.php (revision 44104)
+++ app/code/core/Mage/Bundle/Model/Mysql4/Selection.php (revision 44105)
@@ -151,6 +151,9 @@
}
}
}
+ if (!$childrenIds) {
+ $childrenIds = array(array());
+ }
}
return $childrenIds;
Index: app/code/core/Mage/Api/Model/Acl/Assert/Ip.php
===================================================================
--- app/code/core/Mage/Api/Model/Acl/Assert/Ip.php (revision 44104)
+++ app/code/core/Mage/Api/Model/Acl/Assert/Ip.php (revision 44105)
@@ -46,7 +46,7 @@
public function assert(Mage_Api_Model_Acl $acl, Mage_Api_Model_Acl_Role $role = null,
Mage_Api_Model_Acl_Resource $resource = null, $privilege = null)
{
- return $this->_isCleanIP($_SERVER['REMOTE_ADDR']);
+ return $this->_isCleanIP(Mage::helper('core/http')->getRemoteAddr());
}
protected function _isCleanIP($ip)
Index: app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-install-0.7.0.php
===================================================================
--- app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-install-0.7.0.php (revision 44104)
+++ app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-install-0.7.0.php (revision 44105)
@@ -500,8 +500,6 @@
insert into {$this->getTable('catalog_product_visibility')}(`visibility_id`,`visibility_code`) values (1,'Nowhere'),(2,'Catalog'),(3,'Search'),(4,'Catalog, Search');
-insert into {$this->getTable('core_email_template')}(`template_id`,`template_code`,`template_text`,`template_type`,`template_subject`,`template_sender_name`,`template_sender_email`,`added_at`,`modified_at`) values (NULL,'Send product to a friend','Welcome, {{var name}} Please look at {{var product.name}} Here is message: {{var message}} ',2,'Welcome, {{var name}}',NULL,NULL,NOW(),NOW());
-
ALTER TABLE `{$this->getTable('catalog_category_entity')}` ADD `path` VARCHAR( 255 ) NOT NULL, ADD `position` INT NOT NULL;
ALTER TABLE `{$installer->getTable('catalog_category_entity')}` ADD `level` INT NOT NULL;
Index: app/code/core/Mage/Catalog/Model/Product/Attribute/Media/Api/V2.php
===================================================================
--- app/code/core/Mage/Catalog/Model/Product/Attribute/Media/Api/V2.php (revision 44104)
+++ app/code/core/Mage/Catalog/Model/Product/Attribute/Media/Api/V2.php (revision 44105)
@@ -88,12 +88,12 @@
$tmpDirectory = Mage::getBaseDir('var') . DS . 'api' . DS . $this->_getSession()->getSessionId();
- if (isset($data['file']['name']) && $data['file']['name']) {
- $fileName = $data['file']['name'];
+ if (isset($data->file->name) && $data->file->name) {
+ $fileName = $data->file->name;
} else {
$fileName = 'image';
}
- $fileName .= '.' . $this->_mimeTypes[$data['file']['mime']];
+ $fileName .= '.' . $this->_mimeTypes[$data->file->mime];
$ioAdapter = new Varien_Io_File();
try {
Index: app/code/core/Mage/Catalog/Model/Product/Attribute/Backend/Tierprice.php
===================================================================
--- app/code/core/Mage/Catalog/Model/Product/Attribute/Backend/Tierprice.php (revision 44104)
+++ app/code/core/Mage/Catalog/Model/Product/Attribute/Backend/Tierprice.php (revision 44105)
@@ -149,9 +149,9 @@
$data = $this->_getResource()
->loadProductPrices($object, $this->getAttribute());
foreach ($data as $k => $v) {
+ $data[$k]['website_price'] = $v['price'];
if ($v['all_groups']) {
$data[$k]['cust_group'] = Mage_Customer_Model_Group::CUST_GROUP_ALL;
- $data[$k]['website_price'] = $v['price'];
}
}
Index: app/code/core/Mage/Catalog/Model/Product/Image.php
===================================================================
--- app/code/core/Mage/Catalog/Model/Product/Image.php (revision 44104)
+++ app/code/core/Mage/Catalog/Model/Product/Image.php (revision 44105)
@@ -187,6 +187,9 @@
$imageInfo = getimagesize($file);
+ if (!isset($imageInfo[0]) || !isset($imageInfo[1])) {
+ return 0;
+ }
if (!isset($imageInfo['channels'])) {
// if there is no info about this parameter lets set it for maximum
$imageInfo['channels'] = 4;
Index: app/code/core/Mage/Catalog/Model/Product/Option/Type/Date.php
===================================================================
--- app/code/core/Mage/Catalog/Model/Product/Option/Type/Date.php (revision 44104)
+++ app/code/core/Mage/Catalog/Model/Product/Option/Type/Date.php (revision 44105)
@@ -131,7 +131,7 @@
}
$date = new Zend_Date($timestamp);
- $result = $date->toString(Varien_date::DATETIME_INTERNAL_FORMAT);
+ $result = $date->toString(Varien_Date::DATETIME_INTERNAL_FORMAT);
// Save date in internal format to avoid locale date bugs
$this->_setInternalInRequest($result);
Index: app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Category.php
===================================================================
--- app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Category.php (revision 44104)
+++ app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Category.php (revision 44105)
@@ -560,6 +560,93 @@
}
/**
+ * Refresh Category Product Index for Store Root Catgory
+ *
+ * @param array|int $productIds
+ * @param array|int $storeIds
+ * @return Mage_Catalog_Model_Resource_Eav_Mysql4_Category
+ */
+ protected function _refreshRootCategoryProductIndex($productIds = array(), $storeIds = array())
+ {
+ if (is_numeric($storeIds)) {
+ $storeIds = array($storeIds);
+ }
+ elseif (!is_array($storeIds) || empty($storeIds)) {
+ $storeIds = array();
+ foreach (Mage::app()->getStores() as $store) {
+ $storeIds[] = $store->getId();
+ }
+ }
+
+ /**
+ * Prepare visibility and status attributes information
+ */
+ $status = Mage::getSingleton('eav/config')->getAttribute('catalog_product', 'status');
+ $visibility = Mage::getSingleton('eav/config')->getAttribute('catalog_product', 'visibility');
+ $statusTable = $status->getBackend()->getTable();
+ $visibilityTable = $visibility->getBackend()->getTable();
+
+ $indexTable = $this->getTable('catalog/category_product_index');
+
+ foreach ($storeIds as $storeId) {
+ $store = Mage::app()->getStore($storeId);
+ $categoryId = $store->getRootCategoryId();
+
+ $select = $this->_getWriteAdapter()->select()
+ ->from(array('e' => $this->getTable('catalog/product')), null)
+ ->joinLeft(
+ array('i' => $indexTable),
+ 'e.entity_id=i.product_id AND i.category_id=' . (int)$categoryId
+ . ' AND i.store_id=' . (int) $storeId,
+ array())
+ ->joinInner(
+ array('pw' => $this->getTable('catalog/product_website')),
+ 'e.entity_id=pw.product_id AND pw.website_id=' . (int)$store->getWebsiteId(),
+ array())
+ ->join(
+ array('t_v_default' => $visibilityTable),
+ 't_v_default.entity_id=e.entity_id'
+ . ' AND t_v_default.attribute_id=' . (int)$visibility->getAttributeId()
+ . ' AND t_v_default.store_id=0',
+ array())
+ ->joinLeft(
+ array('t_v' => $visibilityTable),
+ 't_v.entity_id=e.entity_id'
+ . ' AND t_v.attribute_id=' . (int)$visibility->getAttributeId()
+ . ' AND t_v.store_id='. (int)$storeId,
+ array())
+ ->join(
+ array('t_s_default' => $statusTable),
+ 't_s_default.entity_id=e.entity_id'
+ . ' AND t_s_default.attribute_id=' . (int)$status->getAttributeId()
+ . ' AND t_s_default.store_id=0',
+ array())
+ ->joinLeft(
+ array('t_s' => $statusTable),
+ 't_s.entity_id=e.entity_id'
+ . ' AND t_s.attribute_id=' . (int)$status->getAttributeId()
+ . ' AND t_s.store_id='. (int)$storeId,
+ array())
+ ->where('i.product_id IS NULL')
+ ->where('IFNULL(t_s.value, t_s_default.value)=?', Mage_Catalog_Model_Product_Status::STATUS_ENABLED);
+
+ $select->columns(new Zend_Db_Expr($categoryId));
+ $select->columns('e.entity_id');
+ $select->columns(new Zend_Db_Expr(0));
+ $select->columns(new Zend_Db_Expr(0));
+ $select->columns(new Zend_Db_Expr($storeId));
+ $select->columns(new Zend_Db_Expr('IFNULL(t_v.value, t_v_default.value)'));
+
+ if (!empty($productIds)) {
+ $select->where('e.entity_id IN(?)', $productIds);
+ }
+
+ $this->_getWriteAdapter()->query($select->insertFromSelect($indexTable));
+ }
+ return $this;
+ }
+
+ /**
* Rebuild associated products index
*
* @param array $categoryIds
@@ -683,6 +770,8 @@
$this->_getWriteAdapter()->query($query);
}
+
+ $this->_refreshRootCategoryProductIndex($productIds, array($storeId));
}
return $this;
}
Index: app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Product.php
===================================================================
--- app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Product.php (revision 44104)
+++ app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Product.php (revision 44105)
@@ -136,7 +136,7 @@
->refreshIndex($product);
parent::_afterSave($product);
- return $this;
+ return $this;
}
/**
@@ -234,6 +234,12 @@
return $this;
}
+ /**
+ * Refresh Product Enabled Index
+ *
+ * @param Mage_Catalog_Model_Product $product
+ * @return Mage_Catalog_Model_Resource_Eav_Mysql4_Product
+ */
public function refreshIndex($product)
{
/**
@@ -265,8 +271,21 @@
$indexCategoryIds = array_unique($indexCategoryIds);
$indexProductIds = array($product->getId());
- Mage::getResourceSingleton('catalog/category')->refreshProductIndex($indexCategoryIds, $indexProductIds);
+ Mage::getResourceSingleton('catalog/category')
+ ->refreshProductIndex($indexCategoryIds, $indexProductIds);
}
+ else {
+ $websites = $product->getWebsiteIds();
+ if ($websites) {
+ $storeIds = array();
+ foreach ($websites as $websiteId) {
+ $website = Mage::app()->getWebsite($websiteId);
+ $storeIds = array_merge($storeIds, $website->getStoreIds());
+ }
+ Mage::getResourceSingleton('catalog/category')
+ ->refreshProductIndex(array(), array($product->getId()), $storeIds);
+ }
+ }
/**
* Refresh enabled products index (visibility state)
@@ -311,8 +330,8 @@
);
$deleteCondition = $this->_getWriteAdapter()->quoteInto(' AND product_id IN (?)', $product);
}
- $this->_getWriteAdapter()->delete($indexTable, 'store_id='.$storeId.$deleteCondition);
- $query = "INSERT INTO $indexTable
+ $this->_getWriteAdapter()->delete($indexTable, 'store_id='.$storeId.$deleteCondition);
+ $query = "INSERT INTO $indexTable
SELECT
t_v_default.entity_id, {$storeId}, IFNULL(t_v.value, t_v_default.value)
FROM
@@ -335,12 +354,12 @@
t_v_default.attribute_id='{$visibilityAttributeId}'
AND t_v_default.store_id=0{$productsCondition}
AND (IFNULL(t_s.value, t_s_default.value)=".Mage_Catalog_Model_Product_Status::STATUS_ENABLED.")";
- $this->_getWriteAdapter()->query($query);
+ $this->_getWriteAdapter()->query($query);
}
elseif (is_null($store)) {
foreach ($product->getStoreIds() as $storeId) {
- $store = Mage::app()->getStore($storeId);
- $this->refreshEnabledIndex($store, $product);
+ $store = Mage::app()->getStore($storeId);
+ $this->refreshEnabledIndex($store, $product);
}
}
else {
Index: app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Category/Flat.php
===================================================================
--- app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Category/Flat.php (revision 44104)
+++ app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Category/Flat.php (revision 44105)
@@ -401,22 +401,22 @@
*/
public function rebuild()
{
- $_read = $this->_getReadAdapter();
+ $_conn = $this->_getWriteAdapter();
if ($this->getUseStoreTables()) {
$stores = array();
- $selectStores = $_read->select()
+ $selectStores = $_conn->select()
->from($this->getTable('core/store'), 'store_id');
$stores = array();
- foreach ($_read->fetchAll($selectStores) as $store) {
+ foreach ($_conn->fetchAll($selectStores) as $store) {
$stores[] = $store['store_id'];
}
$this->_createTable($stores);
} else {
$this->_createTable(0);
}
- $select = $this->_getReadAdapter()->select()
+ $select = $_conn->select()
->from($this->getTable('catalog/category'), 'entity_id');
- $_categories = $this->_getReadAdapter()->fetchAll($select);
+ $_categories = $_conn->fetchAll($select);
foreach ($_categories as $_category) {
foreach ($stores as $store) {
$_tmpCategory = Mage::getModel('catalog/category')
@@ -453,18 +453,17 @@
if (!is_array($stores)) {
$stores = (int) $stores;
}
- $_read = $this->_getReadAdapter();
- $_write = $this->_getWriteAdapter();
+ $_conn = $this->_getWriteAdapter();
if ($this->getUseStoreTables() && is_array($stores)) {
foreach ($stores as $store) {
- $_read->query("DROP TABLE IF EXISTS `{$this->getMainStoreTable($store)}`");
- $_read->query($this->_getTableSqlSchema($store));
+ $_conn->query("DROP TABLE IF EXISTS `{$this->getMainStoreTable($store)}`");
+ $_conn->query($this->_getTableSqlSchema($store));
}
} else {
- $_read->query("DROP TABLE IF EXISTS `{$this->getMainStoreTable($stores)}`");
- $_read->query($this->_getTableSqlSchema($stores));
+ $_conn->query("DROP TABLE IF EXISTS `{$this->getMainStoreTable($stores)}`");
+ $_conn->query($this->_getTableSqlSchema($stores));
}
- $selectAttribute = $_read->select()
+ $selectAttribute = $_conn->select()
->from($this->getTable('eav/entity_type'), array())
->join(
$this->getTable('eav/attribute'),
@@ -472,7 +471,7 @@
$this->getTable('eav/attribute').'.*'
)
->where($this->getTable('eav/entity_type').'.entity_type_code=?', 'catalog_category');
- $resultAttribute = $_read->fetchAll($selectAttribute);
+ $resultAttribute = $_conn->fetchAll($selectAttribute);
foreach ($resultAttribute as $attribute) {
$type = '';
switch ($attribute['backend_type']) {
@@ -495,10 +494,10 @@
if ($type) {
if ($this->getUseStoreTables() && is_array($stores)) {
foreach ($stores as $store) {
- $_write->addColumn($this->getMainStoreTable($store), $attribute['attribute_code'], $type);
+ $_conn->addColumn($this->getMainStoreTable($store), $attribute['attribute_code'], $type);
}
} else {
- $_write->addColumn($this->getMainStoreTable($stores), $attribute['attribute_code'], $type);
+ $_conn->addColumn($this->getMainStoreTable($stores), $attribute['attribute_code'], $type);
}
}
}
@@ -529,7 +528,7 @@
$stores = array($stores);
}
foreach ($stores as $store) {
- $_tableExist = $this->_getReadAdapter()->query(
+ $_tableExist = $this->_getWriteAdapter()->query(
"DROP TABLE IF EXISTS `{$this->getMainStoreTable($store)}`"
);
}
@@ -546,10 +545,10 @@
protected function _synchronize($category, $action = null)
{
if (is_null($action)) {
- $select = $this->_getReadAdapter()->select()
+ $select = $this->_getWriteAdapter()->select()
->from($this->getMainStoreTable($category->getStoreId()), 'entity_id')
->where('entity_id = ?', $category->getId());
- if ($result = $this->_getReadAdapter()->fetchOne($select)) {
+ if ($result = $this->_getWriteAdapter()->fetchOne($select)) {
$action = 'update';
} else {
$action = 'insert';
@@ -561,7 +560,7 @@
$this->_getWriteAdapter()->update(
$this->getMainStoreTable($category->getStoreId()),
$this->_prepareDataForAllFields($category),
- $this->_getReadAdapter()->quoteInto('entity_id = ?', $category->getId())
+ $this->_getWriteAdapter()->quoteInto('entity_id = ?', $category->getId())
);
} elseif ($action == 'insert') {
// insert
@@ -591,9 +590,9 @@
'children_count',
'updated_at'
);
- $select = $this->_getReadAdapter()->select()
+ $select = $this->_getWriteAdapter()->select()
->from($this->getTable('core/store'), 'store_id');
- $stores = $this->_getReadAdapter()->fetchAll($select);
+ $stores = $this->_getWriteAdapter()->fetchAll($select);
foreach ($stores as $store) {
$update = "UPDATE {$this->getMainStoreTable($store['store_id'])}, {$this->getTable('catalog/category')} SET";
foreach ($_staticFields as $field) {
@@ -620,11 +619,11 @@
if (is_null($category)) {
$storesCondition = '';
if (!empty($storeIds)) {
- $storesCondition = $this->_getReadAdapter()->quoteInto(
+ $storesCondition = $this->_getWriteAdapter()->quoteInto(
' AND s.store_id IN (?)', $storeIds
);
}
- $stores = $this->_getReadAdapter()->fetchAll("
+ $stores = $this->_getWriteAdapter()->fetchAll("
SELECT
s.store_id, s.website_id, c.path AS root_path
FROM
@@ -637,17 +636,17 @@
{$storesCondition}
");
foreach ($stores as $store) {
- $select = $this->_getReadAdapter()->select()
+ $select = $this->_getWriteAdapter()->select()
->from($this->getTable('catalog/category'), 'entity_id')
->where('path LIKE ?', "{$store['root_path']}/%")
->orWhere('path = ?', $store['root_path']);
- $_categories = $this->_getReadAdapter()->fetchAll($select);
- if (!$this->_getReadAdapter()->showTableStatus($this->getMainStoreTable($store['store_id']))) {
+ $_categories = $this->_getWriteAdapter()->fetchAll($select);
+ if (!$this->_getWriteAdapter()->showTableStatus($this->getMainStoreTable($store['store_id']))) {
$this->_createTable($store['store_id']);
}
$this->_getWriteAdapter()->delete(
$this->getMainStoreTable($store['store_id']),
- $this->_getReadAdapter()->quoteInto('store_id = ?', $store['store_id'])
+ $this->_getWriteAdapter()->quoteInto('store_id = ?', $store['store_id'])
);
foreach ($_categories as $_category) {
$_tmpCategory = Mage::getModel('catalog/category')
@@ -700,10 +699,10 @@
foreach ($prevParent->getStoreIds() as $storeId) {
$this->_getWriteAdapter()->delete(
$this->getMainStoreTable($storeId),
- $this->_getReadAdapter()->quoteInto('entity_id = ?', $categoryId)
+ $this->_getWriteAdapter()->quoteInto('entity_id = ?', $categoryId)
);
}
- $categoryPath = $this->_getReadAdapter()->fetchOne("
+ $categoryPath = $this->_getWriteAdapter()->fetchOne("
SELECT
path
FROM
@@ -711,11 +710,11 @@
WHERE
entity_id = '$categoryId'
");
- $select = $this->_getReadAdapter()->select()
+ $select = $this->_getWriteAdapter()->select()
->from($this->getTable('catalog/category'), 'entity_id')
->where('path LIKE ?', "$categoryPath/%")
->orWhere('path = ?', $categoryPath);
- $_categories = $this->_getReadAdapter()->fetchAll($select);
+ $_categories = $this->_getWriteAdapter()->fetchAll($select);
foreach ($_categories as $_category) {
foreach ($parent->getStoreIds() as $storeId) {
$_tmpCategory = Mage::getModel('catalog/category')
@@ -757,7 +756,7 @@
*/
protected function _prepareDataForAllFields($category, $replaceFields = array())
{
- $table = $this->_getReadAdapter()->describeTable($this->getMainStoreTable($category->getStoreId()));
+ $table = $this->_getWriteAdapter()->describeTable($this->getMainStoreTable($category->getStoreId()));
$data = array();
foreach ($table as $column=>$columnData) {
if (null !== $category->getData($column)) {
Index: app/code/core/Mage/Catalog/Model/Category.php
===================================================================
--- app/code/core/Mage/Catalog/Model/Category.php (revision 44104)
+++ app/code/core/Mage/Catalog/Model/Category.php (revision 44105)
@@ -810,4 +810,15 @@
return $sortBy;
}
+
+ /**
+ * Validate attribute values
+ *
+ * @throws Mage_Eav_Model_Entity_Attribute_Exception
+ * @return bool|array
+ */
+ public function validate()
+ {
+ return $this->_getResource()->validate($this);
+ }
}
Index: app/code/core/Mage/Catalog/Model/Product.php
===================================================================
--- app/code/core/Mage/Catalog/Model/Product.php (revision 44104)
+++ app/code/core/Mage/Catalog/Model/Product.php (revision 44105)
@@ -149,7 +149,9 @@
*/
public function validate()
{
+ Mage::dispatchEvent($this->_eventPrefix.'_validate_before', array($this->_eventObject=>$this));
$this->_getResource()->validate($this);
+ Mage::dispatchEvent($this->_eventPrefix.'_validate_after', array($this->_eventObject=>$this));
return $this;
}
Index: app/code/core/Mage/Catalog/Model/Layer/Filter/Abstract.php
===================================================================
--- app/code/core/Mage/Catalog/Model/Layer/Filter/Abstract.php (revision 44104)
+++ app/code/core/Mage/Catalog/Model/Layer/Filter/Abstract.php (revision 44105)
@@ -80,6 +80,16 @@
}
/**
+ * Retrieve filter value for Clear All Items filter state
+ *
+ * @return mixed
+ */
+ public function getCleanValue()
+ {
+ return null;
+ }
+
+ /**
* Apply filter to collection
*
* @param Zend_Controller_Request_Abstract $request
Index: app/code/core/Mage/Catalog/Model/Category/Api.php
===================================================================
--- app/code/core/Mage/Catalog/Model/Category/Api.php (revision 44104)
+++ app/code/core/Mage/Catalog/Model/Category/Api.php (revision 44105)
@@ -236,13 +236,10 @@
*/
public function create($parentId, $categoryData, $store = null)
{
- $parent_category = $this->_initCategory($parentId);
-
+ $parent_category = $this->_initCategory($parentId);
$category = Mage::getModel('catalog/category')
->setStoreId($this->_getStoreId($store));
-
-
$category->addData(array('path'=>implode('/',$parent_category->getPathIds())));
$category ->setAttributeSetId($category->getDefaultAttributeSetId());
@@ -257,10 +254,25 @@
);
}
}
+
$category->setParentId($parent_category->getId());
+
try {
+ $validate = $category->validate();
+ if ($validate !== true) {
+ foreach ($validate as $code => $error) {
+ if ($error === true) {
+ Mage::throwException(Mage::helper('catalog')->__('Attribute "%s" is required', $code));
+ }
+ else {
+ Mage::throwException($error);
+ }
+ }
+ }
+
$category->save();
- } catch (Mage_Core_Exception $e) {
+ }
+ catch (Mage_Core_Exception $e) {
$this->_fault('data_invalid', $e->getMessage());
}
@@ -290,8 +302,21 @@
}
try {
+ $validate = $category->validate();
+ if ($validate !== true) {
+ foreach ($validate as $code => $error) {
+ if ($error === true) {
+ Mage::throwException(Mage::helper('catalog')->__('Attribute "%s" is required', $code));
+ }
+ else {
+ Mage::throwException($error);
+ }
+ }
+ }
+
$category->save();
- } catch (Mage_Core_Exception $e) {
+ }
+ catch (Mage_Core_Exception $e) {
$this->_fault('data_invalid', $e->getMessage());
}
Index: app/code/core/Mage/Catalog/Model/Category/Api/V2.php
===================================================================
--- app/code/core/Mage/Catalog/Model/Category/Api/V2.php (revision 44104)
+++ app/code/core/Mage/Catalog/Model/Category/Api/V2.php (revision 44105)
@@ -96,8 +96,21 @@
}
$category->setParentId($parent_category->getId());
try {
+ $validate = $category->validate();
+ if ($validate !== true) {
+ foreach ($validate as $code => $error) {
+ if ($error === true) {
+ Mage::throwException(Mage::helper('catalog')->__('Attribute "%s" is required', $code));
+ }
+ else {
+ Mage::throwException($error);
+ }
+ }
+ }
+
$category->save();
- } catch (Mage_Core_Exception $e) {
+ }
+ catch (Mage_Core_Exception $e) {
$this->_fault('data_invalid', $e->getMessage());
}
@@ -128,8 +141,20 @@
}
try {
+ $validate = $category->validate();
+ if ($validate !== true) {
+ foreach ($validate as $code => $error) {
+ if ($error === true) {
+ Mage::throwException(Mage::helper('catalog')->__('Attribute "%s" is required', $code));
+ }
+ else {
+ Mage::throwException($error);
+ }
+ }
+ }
$category->save();
- } catch (Mage_Core_Exception $e) {
+ }
+ catch (Mage_Core_Exception $e) {
$this->_fault('data_invalid', $e->getMessage());
}
Index: app/code/core/Mage/Catalog/Block/Product/List/Toolbar.php
===================================================================
--- app/code/core/Mage/Catalog/Block/Product/List/Toolbar.php (revision 44104)
+++ app/code/core/Mage/Catalog/Block/Product/List/Toolbar.php (revision 44105)
@@ -20,10 +20,11 @@
*
* @category Mage
* @package Mage_Catalog
- * @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
+ * @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)
*/
+
/**
* Product list toolbar
*
@@ -198,16 +199,27 @@
*/
public function getCurrentOrder()
{
+ $orders = $this->getAvailableOrders();
$order = $this->getRequest()->getParam($this->getOrderVarName());
- $orders = $this->getAvailableOrders();
if ($order && isset($orders[$order])) {
- return $order;
+ Mage::getSingleton('catalog/session')->setSortOrder($order);
}
- if ($this->_orderField && isset($orders[$this->_orderField])) {
- return $this->_orderField;
+ else {
+ $order = Mage::getSingleton('catalog/session')->getSortOrder();
}
- $keys = array_keys($orders);
- return $keys[0];
+
+ // validate session value
+ if (!isset($orders[$order])) {
+ $order = $this->_orderField;
+ }
+
+ // validate has order value
+ if (!isset($orders[$order])) {
+ $keys = array_keys($orders);
+ $order = $keys[0];
+ }
+
+ return $order;
}
/**
@@ -217,13 +229,21 @@
*/
public function getCurrentDirection()
{
- if ($dir = (string) $this->getRequest()->getParam($this->getDirectionVarName())) {
- $dir = strtolower($dir);
- if (in_array($dir, array('asc', 'desc'))) {
- return $dir;
- }
+ $directions = array('asc', 'desc');
+ $dir = strtolower($this->getRequest()->getParam($this->getDirectionVarName()));
+ if ($dir && in_array($dir, $directions)) {
+ Mage::getSingleton('catalog/session')->setSortDirection($dir);
}
- return $this->_direction;
+ else {
+ $dir = Mage::getSingleton('catalog/session')->getSortDirection();
+ }
+
+ // validate direction
+ if (!$dir || !in_array($dir, $directions)) {
+ $dir = $this->_direction;
+ }
+
+ return $dir;
}
/**
Index: app/code/core/Mage/Catalog/Block/Layer/State.php
===================================================================
--- app/code/core/Mage/Catalog/Block/Layer/State.php (revision 44104)
+++ app/code/core/Mage/Catalog/Block/Layer/State.php (revision 44105)
@@ -66,7 +66,7 @@
{
$filterState = array();
foreach ($this->getActiveFilters() as $item) {
- $filterState[$item->getFilter()->getRequestVar()] = $item->getFilter()->getResetValue();
+ $filterState[$item->getFilter()->getRequestVar()] = $item->getFilter()->getCleanValue();
}
$params['_current'] = true;
$params['_use_rewrite'] = true;
Index: app/code/core/Mage/Catalog/etc/wsdl.xml
===================================================================
--- app/code/core/Mage/Catalog/etc/wsdl.xml (revision 44104)
+++ app/code/core/Mage/Catalog/etc/wsdl.xml (revision 44105)
@@ -319,6 +319,7 @@
+
Index: app/code/core/Mage/Page/Model/Config.php
===================================================================
--- app/code/core/Mage/Page/Model/Config.php (revision 44104)
+++ app/code/core/Mage/Page/Model/Config.php (revision 44105)
@@ -1,111 +1,129 @@
-
- */
-class Mage_Page_Model_Config
-{
- const XML_PATH_PAGE_LAYOUTS = 'global/page/layouts';
-
- /**
- * Available page layouts
- *
- * @var array
- */
- protected $_pageLayouts = null;
-
- /**
- * Initialize page layouts list
- *
- * @return Mage_Page_Model_Config
- */
- protected function _initPageLayouts()
- {
- if ($this->_pageLayouts === null) {
- $this->_pageLayouts = array();
-
- foreach (Mage::getConfig()->getNode(self::XML_PATH_PAGE_LAYOUTS)->children() as $layoutCode => $layoutConfig) {
- $this->_pageLayouts[$layoutCode] = new Varien_Object(array(
- 'label' => Mage::helper('page')->__((string)$layoutConfig->label),
- 'code' => $layoutCode,
- 'template' => (string) $layoutConfig->template,
- 'layout_handle' => (string) $layoutConfig->layout_handle
- ));
- }
- }
-
- return $this;
- }
-
- /**
- * Retrieve available page layouts
- *
- * @return array
- */
- public function getPageLayouts()
- {
- $this->_initPageLayouts();
- return $this->_pageLayouts;
- }
-
- /**
- * Retrieve page layout by code
- *
- * @param string $layoutCode
- * @return Varien_Object|boolean
- */
- public function getPageLayout($layoutCode)
- {
- $this->_initPageLayouts();
-
- if (isset($this->_pageLayouts[$layoutCode])) {
- return $this->_pageLayouts[$layoutCode];
- }
-
- return false;
- }
-
- /**
- * Retrieve page layout handles
- *
- * @return array
- */
- public function getPageLayoutHandles()
- {
- $handles = array();
-
- foreach ($this->getPageLayouts() as $layout) {
- $handles[$layout->getCode()] = $layout->getLayoutHandle();
- }
-
- return $handles;
- }
-}
+
+ */
+class Mage_Page_Model_Config
+{
+ const XML_PATH_PAGE_LAYOUTS = 'global/page/layouts';
+ const XML_PATH_CMS_LAYOUTS = 'global/cms/layouts';
+
+ /**
+ * Available page layouts
+ *
+ * @var array
+ */
+ protected $_pageLayouts = null;
+
+ /**
+ * Initialize page layouts list
+ *
+ * @return Mage_Page_Model_Config
+ */
+ protected function _initPageLayouts()
+ {
+ if ($this->_pageLayouts === null) {
+ $this->_pageLayouts = array();
+ $this->_appendPageLayouts(self::XML_PATH_CMS_LAYOUTS);
+ $this->_appendPageLayouts(self::XML_PATH_PAGE_LAYOUTS);
+ }
+ return $this;
+ }
+
+ /**
+ * Fill in $_pageLayouts by reading layouts from config
+ *
+ * @param string $xmlPath XML path to layouts root
+ * @return Mage_Page_Model_Config
+ */
+ protected function _appendPageLayouts($xmlPath)
+ {
+ if (!Mage::getConfig()->getNode($xmlPath)) {
+ return $this;
+ }
+ if (!is_array($this->_pageLayouts)) {
+ $this->_pageLayouts = array();
+ }
+ foreach (Mage::getConfig()->getNode($xmlPath)->children() as $layoutCode => $layoutConfig) {
+ $this->_pageLayouts[$layoutCode] = new Varien_Object(array(
+ 'label' => Mage::helper('page')->__((string)$layoutConfig->label),
+ 'code' => $layoutCode,
+ 'template' => (string) $layoutConfig->template,
+ 'layout_handle' => (string) $layoutConfig->layout_handle
+ ));
+ }
+ return $this;
+ }
+
+ /**
+ * Retrieve available page layouts
+ *
+ * @return array
+ */
+ public function getPageLayouts()
+ {
+ $this->_initPageLayouts();
+ return $this->_pageLayouts;
+ }
+
+ /**
+ * Retrieve page layout by code
+ *
+ * @param string $layoutCode
+ * @return Varien_Object|boolean
+ */
+ public function getPageLayout($layoutCode)
+ {
+ $this->_initPageLayouts();
+
+ if (isset($this->_pageLayouts[$layoutCode])) {
+ return $this->_pageLayouts[$layoutCode];
+ }
+
+ return false;
+ }
+
+ /**
+ * Retrieve page layout handles
+ *
+ * @return array
+ */
+ public function getPageLayoutHandles()
+ {
+ $handles = array();
+
+ foreach ($this->getPageLayouts() as $layout) {
+ $handles[$layout->getCode()] = $layout->getLayoutHandle();
+ }
+
+ return $handles;
+ }
+}
Index: app/code/core/Mage/Adminhtml/Model/Session/Quote.php
===================================================================
--- app/code/core/Mage/Adminhtml/Model/Session/Quote.php (revision 44104)
+++ app/code/core/Mage/Adminhtml/Model/Session/Quote.php (revision 44105)
@@ -99,14 +99,30 @@
}
/**
+ * Set customer model object
+ * To enable quick switch of preconfigured customer
+ * @param Mage_Customer_Model_Customer $customer
+ * @return Mage_Adminhtml_Model_Session_Quote
+ */
+ public function setCustomer(Mage_Customer_Model_Customer $customer)
+ {
+ $this->_customer = $customer;
+ return $this;
+ }
+
+/**
* Retrieve customer model object
- *
+ * @param bool $forceReload
+ * @param bool $useSetStore
* @return Mage_Customer_Model_Customer
*/
- public function getCustomer()
+ public function getCustomer($forceReload=false, $useSetStore=false)
{
- if (is_null($this->_customer)) {
+ if (is_null($this->_customer) || $forceReload) {
$this->_customer = Mage::getModel('customer/customer');
+ if ($useSetStore && $this->getStore()->getId()) {
+ $this->_customer->setStore($this->getStore());
+ }
if ($customerId = $this->getCustomerId()) {
$this->_customer->load($customerId);
}
Index: app/code/core/Mage/Adminhtml/Model/Sales/Order/Create.php
===================================================================
--- app/code/core/Mage/Adminhtml/Model/Sales/Order/Create.php (revision 44104)
+++ app/code/core/Mage/Adminhtml/Model/Sales/Order/Create.php (revision 44105)
@@ -155,8 +155,16 @@
$this->getSession()->setReordered($order->getId());
}
+ /**
+ * Check if we edit quest order
+ */
$this->getSession()->setCurrencyId($order->getOrderCurrencyCode());
- $this->getSession()->setCustomerId($order->getCustomerId());
+ if ($order->getCustomerId()) {
+ $this->getSession()->setCustomerId($order->getCustomerId());
+ } else {
+ $this->getSession()->setCustomerId(false);
+ }
+
$this->getSession()->setStoreId($order->getStoreId());
foreach ($order->getItemsCollection(
@@ -1132,9 +1140,24 @@
if (!$this->getQuote()->getShippingAddress()->getShippingMethod()) {
$errors[] = Mage::helper('adminhtml')->__('Shipping method must be specified');
}
+ }
- if (!$this->getQuote()->getPayment()->getMethod()) {
- $errors[] = Mage::helper('adminhtml')->__('Payment method must be specified');
+ if (!$this->getQuote()->getPayment()->getMethod()) {
+ $errors[] = Mage::helper('adminhtml')->__('Payment method must be specified');
+ } else {
+ $method = $this->getQuote()->getPayment()->getMethodInstance();
+ if (!$method) {
+ $errors[] = Mage::helper('adminhtml')->__('Payment method instance is not available');
+ } else {
+ if (!$method->isAvailable($this->getQuote())) {
+ $errors[] = Mage::helper('adminhtml')->__('Payment method is not available');
+ } else {
+ try {
+ $method->validate();
+ } catch (Mage_Core_Exception $e) {
+ $errors[] = $e->getMessage();
+ }
+ }
}
}
@@ -1177,8 +1200,16 @@
->setDefaultBilling($billingAddress->getId())
->setDefaultShipping($shippingAddress->getId());
}
- else {
- $customer = $this->getSession()->getCustomer();
+ elseif (($customer = $this->getSession()->getCustomer()) && $customer->getId()
+ && !$this->getSession()->getCustomer(true,true)->getId())
+ {
+ $customer = clone $customer;
+ $customer->setStore($this->getSession()->getStore())
+ ->save();
+ $this->getSession()->setCustomer($customer);
+ $customer->addData($this->getData('account'));
+ }
+ else { $customer = $this->getSession()->getCustomer();
$customer->addData($this->getData('account'));
}
$this->getQuote()->setCustomer($customer);
Index: app/code/core/Mage/Adminhtml/Model/Extension/Collection.php
===================================================================
--- app/code/core/Mage/Adminhtml/Model/Extension/Collection.php (revision 44104)
+++ app/code/core/Mage/Adminhtml/Model/Extension/Collection.php (revision 44105)
@@ -28,83 +28,72 @@
* Extension packages files collection
*
*/
-class Mage_Adminhtml_Model_Extension_Collection extends Mage_Adminhtml_Model_Extension_Collection_Abstract
+class Mage_Adminhtml_Model_Extension_Collection extends Varien_Data_Collection_Filesystem
{
- public static $allowDirs = '/^[a-z0-9\.\-]+$/i';
- public static $allowFiles = '/^[a-z0-9\.\-\_]+\.(xml|ser)$/i';
- public static $disallowFiles = '/^package\.xml$/i';
+ /**
+ * Files and folders regexsp
+ *
+ * @var string
+ */
+ protected $_allowedDirsMask = '/^[a-z0-9\.\-]+$/i';
+ protected $_allowedFilesMask = '/^[a-z0-9\.\-\_]+\.(xml|ser)$/i';
+ protected $_disallowedFilesMask = '/^package\.xml$/i';
/**
- * Get all packages identifiers
+ * Base dir where packages are located
*
+ * @var string
+ */
+ protected $_baseDir = '';
+
+ /**
+ * Set base dir
+ */
+ public function __construct()
+ {
+ $this->_baseDir = Mage::getBaseDir('var') . DS . 'pear';
+ $this->addTargetDir($this->_baseDir);
+ }
+
+ /**
+ * Row generator
+ *
+ * @param string $filename
* @return array
*/
- protected function _fetchPackages()
+ protected function _generateRow($filename)
{
- $baseDir = Mage::getBaseDir('var') . DS . 'pear';
- $files = array();
- $this->_collectRecursive($baseDir, $files);
- $result = array();
- foreach ($files as $file) {
- $file = preg_replace(array('/^' . preg_quote($baseDir . DS, '/') . '/', '/\.(xml|ser)$/'), '', $file);
- $result[] = array(
- 'filename' => $file,
- 'filename_id' => $file
- );
+ $row = parent::_generateRow($filename);
+ $row['package'] = preg_replace('/\.(xml|ser)$/', '', str_replace($this->_baseDir . DS, '', $filename));
+ $row['filename_id'] = $row['package'];
+ $folder = explode(DS, $row['package']);
+ array_pop($folder);
+ $row['folder'] = DS;
+ if (!empty($folder)) {
+ $row['folder'] = implode(DS, $folder) . DS;
}
- return $result;
+ return $row;
}
/**
- * Get package files from directory recursively
+ * Get all folders as options array
*
- * @param string $dir
- * @param array &$result
- * @param bool $dirsFirst
+ * @return array
*/
- protected function _collectRecursive($dir, &$result, $dirsFirst = true)
+ public function collectFolders()
{
- $_result = glob($dir . DS . '*');
+ $collectFiles = $this->_collectFiles;
+ $collectDirs = $this->_collectDirs;
+ $this->setCollectFiles(false)->setCollectDirs(true);
- if (!is_array($_result)) {
- return;
+ $this->_collectRecursive($this->_baseDir);
+ $result = array(DS => DS);
+ foreach ($this->_collectedDirs as $dir) {
+ $dir = str_replace($this->_baseDir . DS, '', $dir) . DS;
+ $result[$dir] = $dir;
}
- if (!$dirsFirst) {
- // collect all the stuff recursively
- foreach ($_result as $item) {
- if (is_dir($item) && preg_match(self::$allowDirs, basename($item))) {
- $this->_collectRecursive($item, $result, $dirsFirst);
- }
- elseif (is_file($item)
- && preg_match(self::$allowFiles, basename($item))
- && !preg_match(self::$disallowFiles, basename($item))) {
- $result[] = $item;
- }
- }
- }
- else {
- // collect directories first
- $dirs = array();
- $files = array();
- foreach ($_result as $item) {
- if (is_dir($item) && preg_match(self::$allowDirs, basename($item))) {
- $dirs[] = $item;
- }
- elseif (is_file($item)
- && preg_match(self::$allowFiles, basename($item))
- && !preg_match(self::$disallowFiles, basename($item))) {
- $files[] = $item;
- }
- }
- // search directories recursively
- foreach ($dirs as $item) {
- $this->_collectRecursive($item, $result, $dirsFirst);
- }
- // add files
- foreach ($files as $item) {
- $result[] = $item;
- }
- }
+ $this->setCollectFiles($collectFiles)->setCollectDirs($collectDirs);
+ return $result;
}
}
Index: app/code/core/Mage/Adminhtml/Model/Extension/Collection/Abstract.php
===================================================================
--- app/code/core/Mage/Adminhtml/Model/Extension/Collection/Abstract.php (revision 44104)
+++ app/code/core/Mage/Adminhtml/Model/Extension/Collection/Abstract.php (revision 44105)
@@ -1,149 +0,0 @@
-isLoaded()) {
- return $this;
- }
-
- // fetch packages specific to source
- $packages = $this->_fetchPackages();
-
- // apply filters
- if (!empty($this->_filters)) {
- foreach ($packages as $i=>$pkg) {
- if (!$this->validateRow($pkg)) {
- unset($packages[$i]);
- }
- }
- }
-
- // find totals
- $this->_totalRecords = sizeof($packages);
- $this->_setIsLoaded();
-
- // sort packages
- if (!empty($this->_orders)) {
- usort($packages, array($this, 'sortPackages'));
- }
-
- // pagination and add to collection
- $from = ($this->getCurPage() - 1) * $this->getPageSize();
- $to = $from + $this->getPageSize() - 1;
-
- $cnt = 0;
- foreach ($packages as $pkg) {
- $cnt++;
- if ($cnt<$from || $cnt>$to) {
- continue;
- }
- $item = new $this->_itemObjectClass();
- $item->addData($pkg);
- $this->addItem($item);
- }
-
- return $this;
- }
-
- abstract protected function _fetchPackages();
-
- public function setOrder($field, $dir)
- {
- $this->_orders[] = array('field'=>$field, 'dir'=>$dir);
- return $this;
- }
-
- public function sortPackages($a, $b)
- {
- $field = $this->_orders[0]['field'];
- $dir = $this->_orders[0]['dir'];
-
- $cmp = $a[$field] > $b[$field] ? 1 : ($a[$field] < $b[$field] ? -1 : 0);
-
- return ('asc'===$dir) ? $cmp : -$cmp;
- }
-
- public function addFieldToFilter($field, $condition)
- {
- $this->_filters[$field] = $condition;
- return $this;
- }
-
- public function validateRow($row)
- {
- if (empty($this->_filters)) {
- return true;
- }
- foreach ($this->_filters as $field=>$filter) {
- if (!isset($row[$field])) {
- return false;
- }
- if (isset($filter['eq'])) {
- if ($filter['eq']!=$row[$field]) {
- return false;
- }
- }
- if (isset($filter['like'])) {
- $query = preg_replace('#(^%|%$)#', '', $filter['like']);
- if (strpos(strtolower($row[$field]), strtolower($query))===false) {
- return false;
- }
- }
- if ('version'===$field) {
- if (isset($filter['from'])) {
- if (!version_compare($filter['from'], $row[$field], '<=')) {
- return false;
- }
- }
- if (isset($filter['to'])) {
- if (!version_compare($filter['to'], $row[$field], '>=')) {
- return false;
- }
- }
- }
- }
- return true;
- }
-
- public function getAllIds()
- {
- $this->load();
-
- $ids = array();
- foreach ($this->getIterator() as $item) {
- $ids[] = $item->getId();
- }
- return $ids;
- }
-
-}
Index: app/code/core/Mage/Adminhtml/controllers/Tax/RateController.php
===================================================================
--- app/code/core/Mage/Adminhtml/controllers/Tax/RateController.php (revision 44104)
+++ app/code/core/Mage/Adminhtml/controllers/Tax/RateController.php (revision 44105)
@@ -279,11 +279,7 @@
unset($csvData[0][$u]);
}
}
-
-
if ($csvData[0] == $csvFields) {
- Mage::getModel('tax/calculation_rate')->deleteAllRates();
-
foreach ($csvData as $k => $v) {
if ($k == 0) {
continue;
@@ -329,8 +325,11 @@
'rate'=>$v[4],
);
- $rateModel = Mage::getModel('tax/calculation_rate')
- ->setData($rateData);
+ $rateModel = Mage::getModel('tax/calculation_rate')->loadByCode($rateData['code']);
+ foreach($rateData as $dataName => $dataValue) {
+ $rateModel->setData($dataName, $dataValue);
+ }
+
$titles = array();
foreach ($stores as $field=>$id) {
$titles[$id]=$v[$field];
Index: app/code/core/Mage/Adminhtml/controllers/Newsletter/TemplateController.php
===================================================================
--- app/code/core/Mage/Adminhtml/controllers/Newsletter/TemplateController.php (revision 44104)
+++ app/code/core/Mage/Adminhtml/controllers/Newsletter/TemplateController.php (revision 44105)
@@ -188,28 +188,6 @@
}
/**
- * Queue Newsletter
- *
- */
- public function toqueueAction ()
- {
- $template = Mage::getModel('newsletter/template')
- ->load($this->getRequest()->getParam('id'));
- if (!$template->getIsSystem()) {
- $template->preprocess();
- $queue = Mage::getModel('newsletter/queue')
- ->setTemplateId($template->getId())
- ->setQueueStatus(Mage_Newsletter_Model_Queue::STATUS_NEVER)
- ->save();
- $template->save();
- $this->_redirect('*/newsletter_queue/edit', array('id' => $queue->getId()));
- }
- else {
- $this->_redirect('*/*');
- }
- }
-
- /**
* Check is allowed access
*
* @return bool
Index: app/code/core/Mage/Adminhtml/controllers/Newsletter/QueueController.php
===================================================================
--- app/code/core/Mage/Adminhtml/controllers/Newsletter/QueueController.php (revision 44104)
+++ app/code/core/Mage/Adminhtml/controllers/Newsletter/QueueController.php (revision 44105)
@@ -66,168 +66,192 @@
public function startAction()
{
- $queue = Mage::getModel('newsletter/queue')
- ->load($this->getRequest()->getParam('id'));
- if ($queue->getId()) {
- if (!in_array($queue->getQueueStatus(),
- array(Mage_Newsletter_Model_Queue::STATUS_NEVER,
- Mage_Newsletter_Model_Queue::STATUS_PAUSE))) {
- $this->_redirect('*/*');
- return;
- }
+ $queue = Mage::getModel('newsletter/queue')
+ ->load($this->getRequest()->getParam('id'));
+ if ($queue->getId()) {
+ if (!in_array($queue->getQueueStatus(),
+ array(Mage_Newsletter_Model_Queue::STATUS_NEVER,
+ Mage_Newsletter_Model_Queue::STATUS_PAUSE))) {
+ $this->_redirect('*/*');
+ return;
+ }
- $queue->setQueueStartAt(Mage::getSingleton('core/date')->gmtDate())
- ->setQueueStatus(Mage_Newsletter_Model_Queue::STATUS_SENDING)
- ->save();
- }
+ $queue->setQueueStartAt(Mage::getSingleton('core/date')->gmtDate())
+ ->setQueueStatus(Mage_Newsletter_Model_Queue::STATUS_SENDING)
+ ->save();
+ }
- $this->_redirect('*/*');
+ $this->_redirect('*/*');
}
public function pauseAction()
{
- $queue = Mage::getSingleton('newsletter/queue')
- ->load($this->getRequest()->getParam('id'));
+ $queue = Mage::getSingleton('newsletter/queue')
+ ->load($this->getRequest()->getParam('id'));
- if (!in_array($queue->getQueueStatus(),
- array(Mage_Newsletter_Model_Queue::STATUS_SENDING))) {
- $this->_redirect('*/*');
- return;
- }
+ if (!in_array($queue->getQueueStatus(),
+ array(Mage_Newsletter_Model_Queue::STATUS_SENDING))) {
+ $this->_redirect('*/*');
+ return;
+ }
- $queue->setQueueStatus(Mage_Newsletter_Model_Queue::STATUS_PAUSE);
- $queue->save();
+ $queue->setQueueStatus(Mage_Newsletter_Model_Queue::STATUS_PAUSE);
+ $queue->save();
- $this->_redirect('*/*');
+ $this->_redirect('*/*');
}
public function resumeAction()
{
- $queue = Mage::getSingleton('newsletter/queue')
- ->load($this->getRequest()->getParam('id'));
+ $queue = Mage::getSingleton('newsletter/queue')
+ ->load($this->getRequest()->getParam('id'));
- if (!in_array($queue->getQueueStatus(),
- array(Mage_Newsletter_Model_Queue::STATUS_PAUSE))) {
- $this->_redirect('*/*');
- return;
- }
+ if (!in_array($queue->getQueueStatus(),
+ array(Mage_Newsletter_Model_Queue::STATUS_PAUSE))) {
+ $this->_redirect('*/*');
+ return;
+ }
- $queue->setQueueStatus(Mage_Newsletter_Model_Queue::STATUS_SENDING);
- $queue->save();
+ $queue->setQueueStatus(Mage_Newsletter_Model_Queue::STATUS_SENDING);
+ $queue->save();
- $this->_redirect('*/*');
+ $this->_redirect('*/*');
}
public function cancelAction()
{
- $queue = Mage::getSingleton('newsletter/queue')
- ->load($this->getRequest()->getParam('id'));
+ $queue = Mage::getSingleton('newsletter/queue')
+ ->load($this->getRequest()->getParam('id'));
- if (!in_array($queue->getQueueStatus(),
- array(Mage_Newsletter_Model_Queue::STATUS_SENDING))) {
- $this->_redirect('*/*');
- return;
- }
+ if (!in_array($queue->getQueueStatus(),
+ array(Mage_Newsletter_Model_Queue::STATUS_SENDING))) {
+ $this->_redirect('*/*');
+ return;
+ }
- $queue->setQueueStatus(Mage_Newsletter_Model_Queue::STATUS_CANCEL);
- $queue->save();
+ $queue->setQueueStatus(Mage_Newsletter_Model_Queue::STATUS_CANCEL);
+ $queue->save();
- $this->_redirect('*/*');
+ $this->_redirect('*/*');
}
public function sendingAction()
{
- // Todo: put it somewhere in config!
- $countOfQueue = 3;
- $countOfSubscritions = 20;
+ // Todo: put it somewhere in config!
+ $countOfQueue = 3;
+ $countOfSubscritions = 20;
- $collection = Mage::getResourceModel('newsletter/queue_collection')
- ->setPageSize($countOfQueue)
- ->setCurPage(1)
- ->addOnlyForSendingFilter()
- ->load();
+ $collection = Mage::getResourceModel('newsletter/queue_collection')
+ ->setPageSize($countOfQueue)
+ ->setCurPage(1)
+ ->addOnlyForSendingFilter()
+ ->load();
$collection->walk('sendPerSubscriber', array($countOfSubscritions));
}
-
public function editAction()
{
- $queue = Mage::getSingleton('newsletter/queue')
- ->load($this->getRequest()->getParam('id'));
+ Mage::register('current_queue', Mage::getSingleton('newsletter/queue'));
+ $id = $this->getRequest()->getParam('id');
+ $templateId = $this->getRequest()->getParam('template_id');
+ if ($id) {
+ Mage::registry('current_queue')->load($id);
+ } elseif ($templateId) {
+ $template = Mage::getModel('newsletter/template')->load($templateId)->preprocess();
+ Mage::registry('current_queue')->setTemplateId($template->getId());
+ }
- Mage::register('current_queue', $queue);
+ $this->loadLayout();
- $this->loadLayout();
+ $this->_setActiveMenu('newsletter/queue');
- $this->_setActiveMenu('newsletter/queue');
-
$this->_addBreadcrumb(Mage::helper('newsletter')->__('Newsletter Queue'), Mage::helper('newsletter')->__('Newsletter Queue'), $this->getUrl('*/newsletter_queue'));
$this->_addBreadcrumb(Mage::helper('newsletter')->__('Edit Queue'), Mage::helper('newsletter')->__('Edit Queue'));
$this->_addContent(
- $this->getLayout()->createBlock('adminhtml/newsletter_queue_edit', 'queue.edit')
+ $this->getLayout()->createBlock('adminhtml/newsletter_queue_edit', 'queue.edit')
);
- $this->renderLayout();
+ $this->renderLayout();
}
public function saveAction()
{
- $queue = Mage::getSingleton('newsletter/queue')
- ->load($this->getRequest()->getParam('id'));
+ try {
+ // create new queue from template, if specified
+ $templateId = $this->getRequest()->getParam('template_id');
+ if ($templateId) {
+ $template = Mage::getModel('newsletter/template')->load($templateId);
+ if (!$template->getId() || $template->getIsSystem()) {
+ Mage::throwException($this->__('Wrong newsletter template.'));
+ }
+ $template->preprocess();
+ $queue = Mage::getModel('newsletter/queue')
+ ->setTemplateId($template->getId())
+ ->setQueueStatus(Mage_Newsletter_Model_Queue::STATUS_NEVER);
+ $template->save();
+ }
+ else {
+ $queue = Mage::getSingleton('newsletter/queue')
+ ->load($this->getRequest()->getParam('id'));
+ }
- if (!in_array($queue->getQueueStatus(),
- array(Mage_Newsletter_Model_Queue::STATUS_NEVER,
- Mage_Newsletter_Model_Queue::STATUS_PAUSE))) {
- $this->_redirect('*/*');
- return;
- }
+ if (!in_array($queue->getQueueStatus(),
+ array(Mage_Newsletter_Model_Queue::STATUS_NEVER,
+ Mage_Newsletter_Model_Queue::STATUS_PAUSE))) {
+ $this->_redirect('*/*');
+ return;
+ }
- $format = Mage::app()->getLocale()->getDateTimeFormat(
- Mage_Core_Model_Locale::FORMAT_TYPE_MEDIUM
- );
+ $format = Mage::app()->getLocale()->getDateTimeFormat(
+ Mage_Core_Model_Locale::FORMAT_TYPE_MEDIUM
+ );
- if ($queue->getQueueStatus()==Mage_Newsletter_Model_Queue::STATUS_NEVER) {
- if ($this->getRequest()->getParam('start_at')) {
- $date = Mage::app()->getLocale()->date($this->getRequest()->getParam('start_at'), $format);
- $time = $date->getTimestamp();
- $queue->setQueueStartAt(
- Mage::getModel('core/date')->gmtDate(null, $time)
- );
- } else {
- $queue->setQueueStartAt(null);
- }
- }
+ if ($queue->getQueueStatus()==Mage_Newsletter_Model_Queue::STATUS_NEVER) {
+ if ($this->getRequest()->getParam('start_at')) {
+ $date = Mage::app()->getLocale()->date($this->getRequest()->getParam('start_at'), $format);
+ $time = $date->getTimestamp();
+ $queue->setQueueStartAt(
+ Mage::getModel('core/date')->gmtDate(null, $time)
+ );
+ } else {
+ $queue->setQueueStartAt(null);
+ }
+ }
- $queue->setStores($this->getRequest()->getParam('stores', array()));
+ $queue->setStores($this->getRequest()->getParam('stores', array()));
- $queue->addTemplateData($queue);
- $queue->getTemplate()
- ->setTemplateSubject($this->getRequest()->getParam('subject'))
- ->setTemplateSenderName($this->getRequest()->getParam('sender_name'))
- ->setTemplateSenderEmail($this->getRequest()->getParam('sender_email'))
- ->setTemplateTextPreprocessed($this->getRequest()->getParam('text'));
+ $queue->addTemplateData($queue);
+ $queue->getTemplate()
+ ->setTemplateSubject($this->getRequest()->getParam('subject'))
+ ->setTemplateSenderName($this->getRequest()->getParam('sender_name'))
+ ->setTemplateSenderEmail($this->getRequest()->getParam('sender_email'))
+ ->setTemplateTextPreprocessed($this->getRequest()->getParam('text'));
- if ($queue->getQueueStatus() == Mage_Newsletter_Model_Queue::STATUS_PAUSE
- && $this->getRequest()->getParam('_resume', false)) {
- $queue->setQueueStatus(Mage_Newsletter_Model_Queue::STATUS_SENDING);
- }
+ if ($queue->getQueueStatus() == Mage_Newsletter_Model_Queue::STATUS_PAUSE
+ && $this->getRequest()->getParam('_resume', false)) {
+ $queue->setQueueStatus(Mage_Newsletter_Model_Queue::STATUS_SENDING);
+ }
- $queue->setSaveTemplateFlag(true);
-
- try {
- $queue->save();
- }
- catch (Exception $e) {
- echo $e->getMessage();
- exit;
- }
- $this->_redirect('*/*');
+ $queue->setSaveTemplateFlag(true);
+ $queue->save();
+ $this->_redirect('*/*');
+ }
+ catch (Mage_Core_Exception $e) {
+ $this->_getSession()->addError($e->getMessage());
+ $id = $this->getRequest()->getParam('id');
+ if ($id) {
+ $this->_redirect('*/*/edit', array('id' => $id));
+ }
+ else {
+ $this->_redirectReferer();
+ }
+ }
}
protected function _isAllowed()
{
- return Mage::getSingleton('admin/session')->isAllowed('newsletter/queue');
+ return Mage::getSingleton('admin/session')->isAllowed('newsletter/queue');
}
}
Index: app/code/core/Mage/Adminhtml/controllers/UrlrewriteController.php
===================================================================
--- app/code/core/Mage/Adminhtml/controllers/UrlrewriteController.php (revision 44104)
+++ app/code/core/Mage/Adminhtml/controllers/UrlrewriteController.php (revision 44105)
@@ -63,9 +63,9 @@
*/
public function indexAction()
{
+ $this->_initRegistry();
$this->loadLayout();
$this->_setActiveMenu('catalog/urlrewrite');
- $this->_initRegistry();
$this->_addContent(
$this->getLayout()->createBlock('adminhtml/urlrewrite')
);
@@ -78,9 +78,9 @@
*/
public function editAction()
{
+ $this->_initRegistry();
$this->loadLayout();
$this->_setActiveMenu('catalog/urlrewrite');
- $this->_initRegistry();
$this->_addContent($this->getLayout()->createBlock('adminhtml/urlrewrite_edit'));
$this->getLayout()->getBlock('head')->setCanLoadExtJs(true);
$this->renderLayout();
@@ -150,9 +150,9 @@
// save and redirect
$model->save();
- Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('adminhtml')->__(
- 'Urlrewrite has been successfully saved'
- ));
+ Mage::getSingleton('adminhtml/session')->addSuccess(
+ Mage::helper('adminhtml')->__('Urlrewrite has been successfully saved')
+ );
$this->_redirect('*/*/');
return;
}
@@ -178,9 +178,9 @@
if (Mage::registry('current_urlrewrite')->getId()) {
try {
Mage::registry('current_urlrewrite')->delete();
- Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('adminhtml')->__(
- 'Urlrewrite has been successfully deleted'
- ));
+ Mage::getSingleton('adminhtml/session')->addSuccess(
+ Mage::helper('adminhtml')->__('Urlrewrite has been successfully deleted')
+ );
}
catch (Exception $e) {
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
Index: app/code/core/Mage/Adminhtml/controllers/Sales/OrderController.php
===================================================================
--- app/code/core/Mage/Adminhtml/controllers/Sales/OrderController.php (revision 44104)
+++ app/code/core/Mage/Adminhtml/controllers/Sales/OrderController.php (revision 44105)
@@ -198,8 +198,8 @@
$order->addStatusToHistory($data['status'], $data['comment'], $notify);
$comment = trim(strip_tags($data['comment']));
+ $order->save();
$order->sendOrderUpdateEmail($notify, $comment);
- $order->save();
$this->loadLayout('empty');
$this->renderLayout();
Index: app/code/core/Mage/Adminhtml/controllers/Catalog/Product/AttributeController.php
===================================================================
--- app/code/core/Mage/Adminhtml/controllers/Catalog/Product/AttributeController.php (revision 44104)
+++ app/code/core/Mage/Adminhtml/controllers/Catalog/Product/AttributeController.php (revision 44105)
@@ -155,6 +155,10 @@
$data['frontend_input'] = $model->getFrontendInput();
}
+ if (!isset($data['is_configurable'])) {
+ $data['is_configurable'] = 0;
+ }
+
if (is_null($model->getIsUserDefined()) || $model->getIsUserDefined() != 0) {
$data['backend_type'] = $model->getBackendTypeByInput($data['frontend_input']);
}
Index: app/code/core/Mage/Adminhtml/controllers/Catalog/ProductController.php
===================================================================
--- app/code/core/Mage/Adminhtml/controllers/Catalog/ProductController.php (revision 44104)
+++ app/code/core/Mage/Adminhtml/controllers/Catalog/ProductController.php (revision 44105)
@@ -427,6 +427,10 @@
$response->setAttribute($e->getAttributeCode());
$response->setMessage($e->getMessage());
}
+ catch (Mage_Core_Exception $e) {
+ $response->setError(true);
+ $response->setMessage($e->getMessage());
+ }
catch (Exception $e) {
$this->_getSession()->addError($e->getMessage());
$this->_initLayoutMessages('adminhtml/session');
Index: app/code/core/Mage/Adminhtml/Block/Customer/Edit/Tab/View/Cart.php
===================================================================
--- app/code/core/Mage/Adminhtml/Block/Customer/Edit/Tab/View/Cart.php (revision 44104)
+++ app/code/core/Mage/Adminhtml/Block/Customer/Edit/Tab/View/Cart.php (revision 44105)
@@ -60,6 +60,8 @@
else {
$collection = new Varien_Data_Collection();
}
+
+ $collection->addFieldToFilter('parent_item_id', array('null' => true));
$this->setCollection($collection);
return parent::_prepareCollection();
Index: app/code/core/Mage/Adminhtml/Block/Customer/Edit/Tab/View/Accordion.php
===================================================================
--- app/code/core/Mage/Adminhtml/Block/Customer/Edit/Tab/View/Accordion.php (revision 44104)
+++ app/code/core/Mage/Adminhtml/Block/Customer/Edit/Tab/View/Accordion.php (revision 44105)
@@ -1,84 +1,88 @@
-
- */
-class Mage_Adminhtml_Block_Customer_Edit_Tab_View_Accordion extends Mage_Adminhtml_Block_Widget_Accordion
-{
- protected function _prepareLayout()
- {
- $customer = Mage::registry('current_customer');
-
- $this->setId('customerViewAccordion');
-
- $this->addItem('lastOrders', array(
- 'title' => Mage::helper('customer')->__('Recent Orders'),
- 'ajax' => true,
- 'content_url' => $this->getUrl('*/*/lastOrders', array('_current' => true)),
- ));
-
- // add shopping cart block of each website
- foreach (Mage::registry('current_customer')->getSharedWebsiteIds() as $websiteId) {
- $website = Mage::app()->getWebsite($websiteId);
-
- // count cart items
- $cartItemsCount = Mage::getModel('sales/quote')
- ->setWebsite($website)->loadByCustomer($customer)
- ->getItemsCollection(false)->getSize();
- // prepare title for cart
- $title = Mage::helper('customer')->__('Shopping Cart - %d item(s)', $cartItemsCount);
- if (count($customer->getSharedWebsiteIds()) > 1) {
- $title = Mage::helper('customer')->__('Shopping Cart of %1$s - %2$d item(s)',
- $website->getName(), $cartItemsCount
- );
- }
-
- // add cart ajax accordion
- $this->addItem('shopingCart' . $websiteId, array(
- 'title' => $title,
- 'ajax' => true,
- 'content_url' => $this->getUrl('*/*/viewCart', array('_current' => true, 'website_id' => $websiteId)),
- ));
- }
-
- // count wishlist items
- $wishlistCount = Mage::getModel('wishlist/wishlist')->loadByCustomer($customer)
- ->getProductCollection()
- ->addStoreData()
- ->getSize();
- // add wishlist ajax accordion
- $this->addItem('wishlist', array(
- 'title' => Mage::helper('customer')->__('Wishlist - %d item(s)', $wishlistCount),
- 'ajax' => true,
- 'content_url' => $this->getUrl('*/*/viewWishlist', array('_current' => true)),
- ));
- }
-}
+
+ */
+class Mage_Adminhtml_Block_Customer_Edit_Tab_View_Accordion extends Mage_Adminhtml_Block_Widget_Accordion
+{
+ protected function _prepareLayout()
+ {
+ $customer = Mage::registry('current_customer');
+
+ $this->setId('customerViewAccordion');
+
+ $this->addItem('lastOrders', array(
+ 'title' => Mage::helper('customer')->__('Recent Orders'),
+ 'ajax' => true,
+ 'content_url' => $this->getUrl('*/*/lastOrders', array('_current' => true)),
+ ));
+
+ // add shopping cart block of each website
+ foreach (Mage::registry('current_customer')->getSharedWebsiteIds() as $websiteId) {
+ $website = Mage::app()->getWebsite($websiteId);
+
+ // count cart items
+ $cartItemsCount = Mage::getModel('sales/quote')
+ ->setWebsite($website)->loadByCustomer($customer)
+ ->getItemsCollection(false)
+ ->addFieldToFilter('parent_item_id', array('null' => true))
+ ->getSize();
+ // prepare title for cart
+ $title = Mage::helper('customer')->__('Shopping Cart - %d item(s)', $cartItemsCount);
+ if (count($customer->getSharedWebsiteIds()) > 1) {
+ $title = Mage::helper('customer')->__('Shopping Cart of %1$s - %2$d item(s)',
+ $website->getName(), $cartItemsCount
+ );
+ }
+
+ // add cart ajax accordion
+ $this->addItem('shopingCart' . $websiteId, array(
+ 'title' => $title,
+ 'ajax' => true,
+ 'content_url' => $this->getUrl('*/*/viewCart', array('_current' => true, 'website_id' => $websiteId)),
+ ));
+ }
+
+ // count wishlist items
+ $wishlist = Mage::getModel('wishlist/wishlist');
+ $wishlistCount = $wishlist->loadByCustomer($customer)
+ ->setSharedStoreIds($wishlist->getSharedStoreIds(false))
+ ->getProductCollection()
+ ->addStoreData()
+ ->getSize();
+ // add wishlist ajax accordion
+ $this->addItem('wishlist', array(
+ 'title' => Mage::helper('customer')->__('Wishlist - %d item(s)', $wishlistCount),
+ 'ajax' => true,
+ 'content_url' => $this->getUrl('*/*/viewWishlist', array('_current' => true)),
+ ));
+ }
+}
Index: app/code/core/Mage/Adminhtml/Block/Customer/Edit/Tab/View/Wishlist.php
===================================================================
--- app/code/core/Mage/Adminhtml/Block/Customer/Edit/Tab/View/Wishlist.php (revision 44104)
+++ app/code/core/Mage/Adminhtml/Block/Customer/Edit/Tab/View/Wishlist.php (revision 44105)
@@ -46,7 +46,9 @@
protected function _prepareCollection()
{
- $collection = Mage::getModel('wishlist/wishlist')->loadByCustomer(Mage::registry('current_customer'))
+ $wishlist = Mage::getModel('wishlist/wishlist');
+ $collection = $wishlist->loadByCustomer(Mage::registry('current_customer'))
+ ->setSharedStoreIds($wishlist->getSharedStoreIds(false))
->getProductCollection()
->addAttributeToSelect('name')
->addStoreData();
Index: app/code/core/Mage/Adminhtml/Block/Customer/Edit/Tab/Wishlist.php
===================================================================
--- app/code/core/Mage/Adminhtml/Block/Customer/Edit/Tab/Wishlist.php (revision 44104)
+++ app/code/core/Mage/Adminhtml/Block/Customer/Edit/Tab/Wishlist.php (revision 44105)
@@ -72,9 +72,9 @@
*/
protected function _prepareCollection()
{
- $collection = Mage::getModel('wishlist/wishlist')
- ->loadByCustomer($this->_getCustomer())
- ->setSharedStoreIds($this->_getCustomer()->getSharedStoreIds())
+ $wishlist = Mage::getModel('wishlist/wishlist');
+ $collection = $wishlist->loadByCustomer($this->_getCustomer())
+ ->setSharedStoreIds($wishlist->getSharedStoreIds(false))
->getProductCollection()
->addAttributeToSelect('name')
->addAttributeToSelect('price')
Index: app/code/core/Mage/Adminhtml/Block/Template.php
===================================================================
--- app/code/core/Mage/Adminhtml/Block/Template.php (revision 44104)
+++ app/code/core/Mage/Adminhtml/Block/Template.php (revision 44105)
@@ -69,4 +69,15 @@
}
return !Mage::getStoreConfigFlag('advanced/modules_disable_output/' . $moduleName);
}
+
+ /**
+ * Prepare html output
+ *
+ * @return string
+ */
+ protected function _toHtml()
+ {
+ Mage::dispatchEvent('adminhtml_block_html_before', array('block' => $this));
+ return parent::_toHtml();
+ }
}
Index: app/code/core/Mage/Adminhtml/Block/Backup/Grid.php
===================================================================
--- app/code/core/Mage/Adminhtml/Block/Backup/Grid.php (revision 44104)
+++ app/code/core/Mage/Adminhtml/Block/Backup/Grid.php (revision 44105)
@@ -60,8 +60,8 @@
$this->addColumn('time', array(
'header' => Mage::helper('backup')->__('Time'),
- 'index' => 'time_formated',
- 'type' => 'datetime'
+ 'index' => 'date_object',
+ 'type' => 'datetime',
));
$this->addColumn('size', array(
@@ -74,8 +74,8 @@
$this->addColumn('type', array(
'header' => Mage::helper('backup')->__('Type'),
- 'filter' => 'adminhtml/backup_grid_filter_type',
- 'renderer' => 'adminhtml/backup_grid_renderer_type',
+ 'type' => 'options',
+ 'options' => array('db' => Mage::helper('backup')->__('DB')),
'index' =>'type'
));
Index: app/code/core/Mage/Adminhtml/Block/Catalog/Product/Attribute/Edit/Tab/Main.php
===================================================================
--- app/code/core/Mage/Adminhtml/Block/Catalog/Product/Attribute/Edit/Tab/Main.php (revision 44104)
+++ app/code/core/Mage/Adminhtml/Block/Catalog/Product/Attribute/Edit/Tab/Main.php (revision 44105)
@@ -53,8 +53,17 @@
'url_key' => array(
'is_unique',
),
+ 'status' => array(
+ 'is_configurable'
+ )
);
+ $rewriteAttributeValue = array(
+ 'status' => array(
+ 'is_configurable' => 0
+ )
+ );
+
$fieldset = $form->addFieldset('base_fieldset',
array('legend'=>Mage::helper('catalog')->__('Attribute Properties'))
);
@@ -385,6 +394,12 @@
$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()) {
Index: app/code/core/Mage/Adminhtml/Block/Catalog/Product/Attribute/Set/Toolbar/Main.php
===================================================================
--- app/code/core/Mage/Adminhtml/Block/Catalog/Product/Attribute/Set/Toolbar/Main.php (revision 44104)
+++ app/code/core/Mage/Adminhtml/Block/Catalog/Product/Attribute/Set/Toolbar/Main.php (revision 44105)
@@ -62,4 +62,10 @@
{
return Mage::helper('catalog')->__('Manage Attribute Sets');
}
+
+ protected function _toHtml()
+ {
+ Mage::dispatchEvent('adminhtml_catalog_product_attribute_set_toolbar_main_html_before', array('block' => $this));
+ return parent::_toHtml();
+ }
}
\ No newline at end of file
Index: app/code/core/Mage/Adminhtml/Block/Catalog/Product/Attribute/Set/Main.php
===================================================================
--- app/code/core/Mage/Adminhtml/Block/Catalog/Product/Attribute/Set/Main.php (revision 44104)
+++ app/code/core/Mage/Adminhtml/Block/Catalog/Product/Attribute/Set/Main.php (revision 44105)
@@ -292,4 +292,10 @@
{
return Mage::getModel('eav/entity_attribute_set')->load( $this->_getSetId() );
}
+
+ 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
Index: app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Attributes/Create.php
===================================================================
--- app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Attributes/Create.php (revision 44104)
+++ app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Attributes/Create.php (revision 44105)
@@ -81,6 +81,12 @@
protected function _toHtml()
{
+ $this->setCanShow(true);
+ Mage::dispatchEvent('adminhtml_catalog_product_edit_tab_attributes_create_html_before', array('block' => $this));
+ if (!$this->getCanShow()) {
+ return '';
+ }
+
$html = parent::_toHtml();
$html .= Mage::helper('adminhtml/js')->getScript(
"var {$this->getJsObjectName()} = new Product.Attributes('{$this->getId()}');\n"
Index: app/code/core/Mage/Adminhtml/Block/Catalog/Category/Edit/Form.php
===================================================================
--- app/code/core/Mage/Adminhtml/Block/Catalog/Category/Edit/Form.php (revision 44104)
+++ app/code/core/Mage/Adminhtml/Block/Catalog/Category/Edit/Form.php (revision 44105)
@@ -87,24 +87,6 @@
return parent::_prepareLayout();
}
- /**
- * Return array of root categories ids
- *
- * @return array
- */
- public function getRootIds()
- {
- $ids = $this->getData('root_ids');
- if (is_null($ids)) {
- $ids = array();
- foreach (Mage::app()->getStores() as $store) {
- $ids[] = $store->getRootCategoryId();
- }
- $this->setData('root_ids', $ids);
- }
- return $ids;
- }
-
public function getStoreConfigurationUrl()
{
$storeId = (int) $this->getRequest()->getParam('store');
Index: app/code/core/Mage/Adminhtml/Block/Catalog/Category/Tree.php
===================================================================
--- app/code/core/Mage/Adminhtml/Block/Catalog/Category/Tree.php (revision 44104)
+++ app/code/core/Mage/Adminhtml/Block/Catalog/Category/Tree.php (revision 44105)
@@ -178,19 +178,6 @@
return $json;
}
- public function getRootIds()
- {
- $ids = $this->getData('root_ids');
- if (is_null($ids)) {
- $ids = array();
- foreach (Mage::app()->getStores() as $store) {
- $ids[] = $store->getRootCategoryId();
- }
- $this->setData('root_ids', $ids);
- }
- return $ids;
- }
-
/**
* Get JSON of array of categories, that are breadcrumbs for specified category path
*
Index: app/code/core/Mage/Adminhtml/Block/Catalog/Category/Abstract.php
===================================================================
--- app/code/core/Mage/Adminhtml/Block/Catalog/Category/Abstract.php (revision 44104)
+++ app/code/core/Mage/Adminhtml/Block/Catalog/Category/Abstract.php (revision 44105)
@@ -181,4 +181,22 @@
{
return $this->getUrl("*/catalog_category/edit", array('_current'=>true, 'store'=>null, '_query'=>false, 'id'=>null, 'parent'=>null));
}
+
+ /**
+ * Return ids of root categories as array
+ *
+ * @return array
+ */
+ public function getRootIds()
+ {
+ $ids = $this->getData('root_ids');
+ if (is_null($ids)) {
+ $ids = array();
+ foreach (Mage::app()->getGroups() as $store) {
+ $ids[] = $store->getRootCategoryId();
+ }
+ $this->setData('root_ids', $ids);
+ }
+ return $ids;
+ }
}
\ No newline at end of file
Index: app/code/core/Mage/Adminhtml/Block/Denied.php
===================================================================
--- app/code/core/Mage/Adminhtml/Block/Denied.php (revision 0)
+++ app/code/core/Mage/Adminhtml/Block/Denied.php (revision 44105)
@@ -0,0 +1,37 @@
+getUser();
+ if ($user && $user->hasAvailableResources()) {
+ return true;
+ }
+ return false;
+ }
+}
\ No newline at end of file
Index: app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Filter/Price.php
===================================================================
--- app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Filter/Price.php (revision 44104)
+++ app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Filter/Price.php (revision 44105)
@@ -134,7 +134,7 @@
protected function _getRate($from, $to)
{
- return Mage::getModel('directory/currency')->load($from)->getRate($to);
+ return Mage::getModel('directory/currency')->load($from)->getAnyRate($to);
}
public function prepareRates($displayCurrency)
Index: app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Ip.php
===================================================================
--- app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Ip.php (revision 0)
+++ app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Ip.php (revision 44105)
@@ -0,0 +1,43 @@
+getData($this->getColumn()->getIndex()));
+ }
+}
Index: app/code/core/Mage/Adminhtml/Block/System/Convert/Profile/Run.php
===================================================================
--- app/code/core/Mage/Adminhtml/Block/System/Convert/Profile/Run.php (revision 44104)
+++ app/code/core/Mage/Adminhtml/Block/System/Convert/Profile/Run.php (revision 44105)
@@ -29,7 +29,7 @@
*
* @category Mage
* @package Mage_Adminhtml
- * @author Magento Core Team
+ * @author Magento Core Team
*/
class Mage_Adminhtml_Block_System_Convert_Profile_Run extends Mage_Adminhtml_Block_Abstract
{
@@ -43,6 +43,7 @@
$profile = $this->getProfile();
echo '';
+ echo ' ';
echo '';
$headBlock = $this->getLayout()->createBlock('page/html_head');
Index: app/code/core/Mage/Adminhtml/Block/System/Config/Form/Fieldset.php
===================================================================
--- app/code/core/Mage/Adminhtml/Block/System/Config/Form/Fieldset.php (revision 44104)
+++ app/code/core/Mage/Adminhtml/Block/System/Config/Form/Fieldset.php (revision 44105)
@@ -47,7 +47,7 @@
{
$html = $this->_getHeaderHtml($element);
- foreach ($element->getElements() as $field) {
+ foreach ($element->getSortedElements() as $field) {
$html.= $field->toHtml();
}
Index: app/code/core/Mage/Adminhtml/Block/System/Config/Form.php
===================================================================
--- app/code/core/Mage/Adminhtml/Block/System/Config/Form.php (revision 44104)
+++ app/code/core/Mage/Adminhtml/Block/System/Config/Form.php (revision 44105)
@@ -206,7 +206,14 @@
foreach ($group->fields as $elements) {
$elements = (array)$elements;
- usort($elements, array($this, '_sortForm'));
+ // sort either by sort_order or by child node values bypassing the sort_order
+ if ($group->sort_fields && $group->sort_fields->by) {
+ $fieldset->setSortElementsByAttribute((string)$group->sort_fields->by,
+ ($group->sort_fields->direction_desc ? SORT_DESC : SORT_ASC)
+ );
+ } else {
+ usort($elements, array($this, '_sortForm'));
+ }
foreach ($elements as $e) {
if (!$this->_canShowField($e)) {
Index: app/code/core/Mage/Adminhtml/Block/Notification/Window.php
===================================================================
--- app/code/core/Mage/Adminhtml/Block/Notification/Window.php (revision 44104)
+++ app/code/core/Mage/Adminhtml/Block/Notification/Window.php (revision 44105)
@@ -79,6 +79,11 @@
*/
public function canShow()
{
+ if (!Mage::getSingleton('admin/session')->isFirstPageAfterLogin()) {
+ $this->_available = false;
+ return false;
+ }
+
if (!$this->isOutputEnabled('Mage_AdminNotification')) {
$this->_available = false;
return false;
@@ -95,10 +100,6 @@
}
if (is_null($this->_available)) {
- if (!Mage::getSingleton('admin/session')->isFirstPageAfterLogin()) {
- $this->_available = false;
- return false;
- }
$this->_available = $this->isShow();
}
return $this->_available;
Index: app/code/core/Mage/Adminhtml/Block/Newsletter/Queue/Edit.php
===================================================================
--- app/code/core/Mage/Adminhtml/Block/Newsletter/Queue/Edit.php (revision 44104)
+++ app/code/core/Mage/Adminhtml/Block/Newsletter/Queue/Edit.php (revision 44105)
@@ -35,6 +35,19 @@
class Mage_Adminhtml_Block_Newsletter_Queue_Edit extends Mage_Adminhtml_Block_Template
{
/**
+ * Check for template Id in request
+ *
+ */
+ protected function _construct()
+ {
+ parent::_construct();
+ $templateId = $this->getRequest()->getParam('template_id');
+ if ($templateId) {
+ $this->setTemplateId($templateId);
+ }
+ }
+
+ /**
* Retrieve current Newsletter Queue Object
*
* @return Mage_Newsletter_Model_Queue
@@ -57,7 +70,12 @@
public function getSaveUrl()
{
- return $this->getUrl('*/*/save',array('id'=>$this->getRequest()->getParam('id')));
+ if ($this->getTemplateId()) {
+ $params = array('template_id' => $this->getTemplateId());
+ } else {
+ $params = array('id' => $this->getRequest()->getParam('id'));
+ }
+ return $this->getUrl('*/*/save', $params);
}
protected function _prepareLayout()
@@ -93,8 +111,9 @@
->setData(
array(
'label' => Mage::helper('newsletter')->__('Back'),
- 'onclick' => "window.location.href = '" . $this->getUrl('*/*') . "'",
- 'class' => 'back'
+ 'onclick' => "window.location.href = '" . $this->getUrl((
+ $this->getTemplateId() ? '*/newsletter_template/' : '*/*')) . "'",
+ 'class' => 'back'
)
)
);
Index: app/code/core/Mage/Adminhtml/Block/Newsletter/Template/Grid/Renderer/Action.php
===================================================================
--- app/code/core/Mage/Adminhtml/Block/Newsletter/Template/Grid/Renderer/Action.php (revision 44104)
+++ app/code/core/Mage/Adminhtml/Block/Newsletter/Template/Grid/Renderer/Action.php (revision 44105)
@@ -36,23 +36,21 @@
{
public function render(Varien_Object $row)
{
- $actions = array();
+ if($row->isValidForSend()) {
+ $actions[] = array(
+ 'url' => $this->getUrl('*/newsletter_queue/edit', array('template_id' => $row->getId())),
+ 'caption' => Mage::helper('newsletter')->__('Queue Newsletter...')
+ );
+ }
- if($row->isValidForSend()) {
- $actions[] = array(
- 'url' => $this->getUrl('*/*/toqueue', array('id'=>$row->getId())),
- 'caption' => Mage::helper('newsletter')->__('Queue Newsletter')
- );
- }
+ $actions[] = array(
+ 'url' => $this->getUrl('*/*/preview', array('id'=>$row->getId())),
+ 'popup' => true,
+ 'caption' => Mage::helper('newsletter')->__('Preview')
+ );
- $actions[] = array(
- 'url' => $this->getUrl('*/*/preview', array('id'=>$row->getId())),
- 'popup' => true,
- 'caption' => Mage::helper('newsletter')->__('Preview')
- );
-
$this->getColumn()->setActions($actions);
- return parent::render($row);
+ return parent::render($row);
}
}
Index: app/code/core/Mage/Adminhtml/Block/Extensions/Custom/Edit/Tab/Grid.php
===================================================================
--- app/code/core/Mage/Adminhtml/Block/Extensions/Custom/Edit/Tab/Grid.php (revision 44104)
+++ app/code/core/Mage/Adminhtml/Block/Extensions/Custom/Edit/Tab/Grid.php (revision 44105)
@@ -33,40 +33,64 @@
*/
class Mage_Adminhtml_Block_Extensions_Custom_Edit_Tab_Grid extends Mage_Adminhtml_Block_Widget_Grid
{
+ /**
+ * Default collection limit
+ *
+ * @var int
+ */
protected $_defaultLimit = 200;
+ /**
+ * Initialize collection and grid
+ */
public function __construct()
{
parent::__construct();
$this->setId('extensions_custom_edit_grid');
$this->setUseAjax(true);
+ $this->setCollection(Mage::getModel('adminhtml/extension_collection'));
}
- protected function _prepareCollection()
- {
- // take a look at Mage_Adminhtml_Model_Extension_Collection_Abstract
- $collection = Mage::getSingleton('adminhtml/extension_collection');
- $this->setCollection($collection);
- return parent::_prepareCollection();
- }
-
+ /**
+ * Prepare grid columns
+ *
+ * @return Mage_Adminhtml_Block_Extensions_Custom_Edit_Tab_Grid
+ */
protected function _prepareColumns()
{
$baseUrl = $this->getUrl();
- $this->addColumn('filename', array(
- 'header' => Mage::helper('adminhtml')->__('Package'),
- 'index' => 'filename',
+ $this->addColumn('folder', array(
+ 'header' => Mage::helper('adminhtml')->__('Folder'),
+ 'index' => 'folder',
+ 'width' => 100,
+ 'type' => 'options',
+ 'options' => $this->getCollection()->collectFolders()
));
+ $this->addColumn('package', array(
+ 'header' => Mage::helper('adminhtml')->__('Package'),
+ 'index' => 'package',
+ ));
+
return parent::_prepareColumns();
}
+ /**
+ * Self URL getter
+ *
+ * @return string
+ */
public function getCurrentUrl($params=array())
{
return $this->getUrl('*/*/grid', array('_current'=>true));
}
+ /**
+ * Row URL getter
+ *
+ * @return string
+ */
public function getRowUrl($row)
{
return $this->getUrl('*/*/load') . '?id=' . urlencode($row->getFilenameId());
Index: app/code/core/Mage/Adminhtml/Block/Sales/Items/Abstract.php
===================================================================
--- app/code/core/Mage/Adminhtml/Block/Sales/Items/Abstract.php (revision 44104)
+++ app/code/core/Mage/Adminhtml/Block/Sales/Items/Abstract.php (revision 44105)
@@ -443,7 +443,7 @@
/**
* CREDITMEMO
*/
-
+
public function canReturnToStock() {
$canReturnToStock = Mage::getStoreConfig(Mage_CatalogInventory_Model_Stock_Item::XML_PATH_CAN_SUBTRACT);
if (Mage::getStoreConfig(Mage_CatalogInventory_Model_Stock_Item::XML_PATH_CAN_SUBTRACT)) {
@@ -452,6 +452,45 @@
return false;
}
}
+
+ /**
+ * Whether to show 'Return to stock' checkbox for item
+ * @param Mage_Sales_Model_Order_Creditmemo_Item $item
+ * @return bool
+ */
+ public function canReturnItemToStock($item=null) {
+ $canReturnToStock = Mage::getStoreConfig(Mage_CatalogInventory_Model_Stock_Item::XML_PATH_CAN_SUBTRACT);
+ if (!is_null($item)) {
+ if (!$item->hasCanReturnToStock()) {
+ $product = Mage::getModel('catalog/product')->load($item->getOrderItem()->getProductId());
+ if ( $product->getId() && $product->getStockItem()->getManageStock() ) {
+ $item->setCanReturnToStock(true);
+ }
+ else {
+ $item->setCanReturnToStock(false);
+ }
+ }
+ $canReturnToStock = $item->getCanReturnToStock();
+ }
+ return $canReturnToStock;
+ }
+ /**
+ * Whether to show 'Return to stock' column for item parent
+ * @param Mage_Sales_Model_Order_Creditmemo_Item $item
+ * @return bool
+ */
+ public function canParentReturnToStock($item = null)
+ {
+ $canReturnToStock = Mage::getStoreConfig(Mage_CatalogInventory_Model_Stock_Item::XML_PATH_CAN_SUBTRACT);
+ if (!is_null($item)) {
+ if ( $item->getCreditmemo()->getOrder()->hasCanReturnToStock() ) {
+ $canReturnToStock = $item->getCreditmemo()->getOrder()->getCanReturnToStock();
+ }
+ } elseif ( $this->getOrder()->hasCanReturnToStock() ) {
+ $canReturnToStock = $this->getOrder()->getCanReturnToStock();
+ }
+ return $canReturnToStock;
+ }
/**
* Return true if can ship partially
Index: app/code/core/Mage/Adminhtml/Block/Sales/Order/Shipment/Create/Items.php
===================================================================
--- app/code/core/Mage/Adminhtml/Block/Sales/Order/Shipment/Create/Items.php (revision 44104)
+++ app/code/core/Mage/Adminhtml/Block/Sales/Order/Shipment/Create/Items.php (revision 44105)
@@ -96,32 +96,6 @@
return $this->getUrl('*/*/updateQty', array('order_id'=>$this->getShipment()->getOrderId()));
}
- public function canShipPartially()
- {
- $value = Mage::registry('current_shipment')->getOrder()->getCanShipPartially();
- if (!is_null($value) && !$value) {
- return false;
- }
- return true;
- }
-
- public function canShipPartiallyItem()
- {
- $value = Mage::registry('current_shipment')->getOrder()->getCanShipPartiallyItem();
- if (!is_null($value) && !$value) {
- return false;
- }
- return true;
- }
-
- public function isShipmentRegular()
- {
- if (!$this->canShipPartiallyItem() || !$this->canShipPartially()) {
- return false;
- }
- return true;
- }
-
public function canSendShipmentEmail()
{
return Mage::helper('sales')->canSendNewShipmentEmail($this->getOrder()->getStore()->getId());
Index: app/code/core/Mage/Adminhtml/Block/Sales/Order/Creditmemo/Create/Items.php
===================================================================
--- app/code/core/Mage/Adminhtml/Block/Sales/Order/Creditmemo/Create/Items.php (revision 44104)
+++ app/code/core/Mage/Adminhtml/Block/Sales/Order/Creditmemo/Create/Items.php (revision 44105)
@@ -34,6 +34,7 @@
class Mage_Adminhtml_Block_Sales_Order_Creditmemo_Create_Items extends Mage_Adminhtml_Block_Sales_Items_Abstract
{
+ protected $_canReturnToStock;
/**
* Prepare child blocks
*
@@ -168,8 +169,8 @@
));
}
- public function canReturnToStock() {
-
+ public function canReturnToStock()
+ {
$canReturnToStock = Mage::getStoreConfig(Mage_CatalogInventory_Model_Stock_Item::XML_PATH_CAN_SUBTRACT);
if (Mage::getStoreConfig(Mage_CatalogInventory_Model_Stock_Item::XML_PATH_CAN_SUBTRACT)) {
return true;
@@ -177,6 +178,29 @@
return false;
}
}
+
+ /**
+ * Whether to show 'Return to stock' column in creaditmemo grid
+ * @return bool
+ */
+ public function canReturnItemsToStock()
+ {
+ if (is_null($this->_canReturnToStock)) {
+ if ($this->_canReturnToStock = Mage::getStoreConfig(Mage_CatalogInventory_Model_Stock_Item::XML_PATH_CAN_SUBTRACT)) {
+ $canReturnToStock = false;
+ foreach ($this->getCreditmemo()->getAllItems() as $item) {
+ $product = Mage::getModel('catalog/product')->load($item->getOrderItem()->getProductId());
+ if ( $product->getId() && $product->getStockItem()->getManageStock() ) {
+ $item->setCanReturnToStock($canReturnToStock = true);
+ } else {
+ $item->setCanReturnToStock(false);
+ }
+ }
+ $this->getCreditmemo()->getOrder()->setCanReturnToStock($this->_canReturnToStock = $canReturnToStock);
+ }
+ }
+ return $this->_canReturnToStock;
+ }
public function canSendCreditmemoEmail()
{
Index: app/code/core/Mage/Adminhtml/Block/Sales/Order/View/Items/Renderer/Default.php
===================================================================
--- app/code/core/Mage/Adminhtml/Block/Sales/Order/View/Items/Renderer/Default.php (revision 44104)
+++ app/code/core/Mage/Adminhtml/Block/Sales/Order/View/Items/Renderer/Default.php (revision 44105)
@@ -199,6 +199,9 @@
*/
public function canDisplayGiftmessage()
{
+ if (!$this->getItem()->getOrder()->canInvoice()) {
+ return false;
+ }
return $this->helper('giftmessage/message')->getIsMessagesAvailable(
'order_item', $this->getItem(), $this->getItem()->getOrder()->getStoreId()
);
Index: app/code/core/Mage/Adminhtml/Block/Sales/Order/View/Tab/Info.php
===================================================================
--- app/code/core/Mage/Adminhtml/Block/Sales/Order/View/Tab/Info.php (revision 44104)
+++ app/code/core/Mage/Adminhtml/Block/Sales/Order/View/Tab/Info.php (revision 44105)
@@ -93,6 +93,9 @@
*/
public function getGiftmessageHtml()
{
+ if (!$this->getOrder()->canInvoice()) {
+ return '';
+ }
return $this->getChildHtml('order_giftmessage');
}
Index: app/code/core/Mage/Adminhtml/Block/Report/Product/Lowstock/Grid.php
===================================================================
--- app/code/core/Mage/Adminhtml/Block/Report/Product/Lowstock/Grid.php (revision 44104)
+++ app/code/core/Mage/Adminhtml/Block/Report/Product/Lowstock/Grid.php (revision 44105)
@@ -56,19 +56,13 @@
$storeId = '';
}
- $collection = Mage::getModel('catalog/product')->getCollection()
+ $collection = Mage::getResourceModel('reports/product_lowstock_collection')
->addAttributeToSelect('*')
->setStoreId($storeId)
- ->addAttributeToFilter('type_id', array(
- Mage_Catalog_Model_Product_Type::TYPE_SIMPLE,
- Mage_Catalog_Model_Product_Type::TYPE_VIRTUAL
- ))
- ->joinField('qty',
- 'cataloginventory/stock_item',
- 'qty',
- 'product_id=entity_id',
- '{{table}}.stock_id=1',
- 'left')
+ ->filterByIsQtyProductTypes()
+ ->joinInventoryItem('qty')
+ ->useManageStockFilter($storeId)
+ ->useNotifyStockQtyFilter($storeId)
->setOrder('qty', 'asc');
if( $storeId ) {
Index: app/code/core/Mage/Adminhtml/Block/Report/Grid.php
===================================================================
--- app/code/core/Mage/Adminhtml/Block/Report/Grid.php (revision 44104)
+++ app/code/core/Mage/Adminhtml/Block/Report/Grid.php (revision 44105)
@@ -362,7 +362,7 @@
if ($to == '') {
$to = $this->getFilter('report_to');
}
- $totalObj = new Mage_Reports_Model_Totals();
+ $totalObj = Mage::getModel('reports/totals');
$this->setTotals($totalObj->countTotals($this, $from, $to));
$this->addGrandTotals($this->getTotals());
return $this->getCollection()->getReport($from, $to);
Index: app/code/core/Mage/Rating/Model/Mysql4/Rating/Option.php
===================================================================
--- app/code/core/Mage/Rating/Model/Mysql4/Rating/Option.php (revision 44104)
+++ app/code/core/Mage/Rating/Model/Mysql4/Rating/Option.php (revision 44105)
@@ -91,8 +91,8 @@
);
if( !$option->getDoUpdate() ) {
- $data['remote_ip'] = $action->getRequest()->getServer('REMOTE_ADDR');
- $data['remote_ip_long'] = ip2long($action->getRequest()->getServer('REMOTE_ADDR'));
+ $data['remote_ip'] = Mage::helper('core/http')->getRemoteAddr();
+ $data['remote_ip_long'] = Mage::helper('core/http')->getRemoteAddr(true);
$data['customer_id'] = Mage::getSingleton('customer/session')->getCustomerId();
$data['entity_pk_value'] = $option->getEntityPkValue();
$data['rating_id'] = $option->getRatingId();
Index: app/code/core/Mage/Rating/Model/Mysql4/Rating.php
===================================================================
--- app/code/core/Mage/Rating/Model/Mysql4/Rating.php (revision 44104)
+++ app/code/core/Mage/Rating/Model/Mysql4/Rating.php (revision 44105)
@@ -143,36 +143,38 @@
return $this;
}
+ /**
+ * Perform actions after object delete
+ * Prepare rating data for reaggregate all data for reviews
+ *
+ * @param Mage_Core_Model_Abstract $object
+ * @return Mage_Rating_Model_Mysql4_Rating
+ */
+ protected function _afterDelete(Mage_Core_Model_Abstract $object)
+ {
+ parent::_afterDelete($object);
+ $data = $this->_getEntitySummaryData($object);
+ $summary = array();
+ foreach ($data as $row) {
+ $clone = clone $object;
+ $clone->addData( $row );
+ $summary[$clone->getStoreId()][$clone->getEntityPkValue()] = $clone;
+ }
+ Mage::getResourceModel('review/review_summary')->reAggregate($summary);
+ return $this;
+ }
+
+ /**
+ * Return array of rating summary
+ *
+ * @param Mage_Rating_Model_Rating $object
+ * @param boolean $onlyForCurrentStore
+ * @return array
+ */
public function getEntitySummary($object, $onlyForCurrentStore = true)
{
- $read = $this->_getReadAdapter();
- $sql = "SELECT
- SUM({$this->getTable('rating_vote')}.percent) as sum,
- COUNT(*) as count,
- {$this->getTable('review/review_store')}.store_id
- FROM
- {$this->getTable('rating_vote')}
- INNER JOIN
- {$this->getTable('review/review')}
- ON {$this->getTable('rating_vote')}.review_id={$this->getTable('review/review')}.review_id
- LEFT JOIN
- {$this->getTable('review/review_store')}
- ON {$this->getTable('rating_vote')}.review_id={$this->getTable('review/review_store')}.review_id
- INNER JOIN
- {$this->getTable('rating/rating_store')} AS rst
- ON rst.rating_id = {$this->getTable('rating_vote')}.rating_id AND rst.store_id = {$this->getTable('review/review_store')}.store_id
- INNER JOIN
- {$this->getTable('review/review_status')} AS review_status
- ON {$this->getTable('review/review')}.status_id = review_status.status_id
- WHERE
- {$read->quoteInto($this->getTable('rating_vote').'.entity_pk_value=?', $object->getEntityPkValue())}
- AND review_status.status_code = 'approved'
- GROUP BY
- {$this->getTable('rating_vote')}.entity_pk_value, {$this->getTable('review/review_store')}.store_id";
+ $data = $this->_getEntitySummaryData($object);
- $data = $read->fetchAll($sql);
-
-
if($onlyForCurrentStore) {
foreach ($data as $row) {
if($row['store_id']==Mage::app()->getStore()->getId()) {
@@ -205,9 +207,46 @@
}
}
+ return array_values($result);
+ }
+ /**
+ * Return data of rating summary
+ *
+ * @param Mage_Rating_Model_Rating $object
+ * @return array
+ */
+ protected function _getEntitySummaryData($object)
+ {
+ $read = $this->_getReadAdapter();
+ $sql = "SELECT
+ {$this->getTable('rating_vote')}.entity_pk_value as entity_pk_value,
+ SUM({$this->getTable('rating_vote')}.percent) as sum,
+ COUNT(*) as count,
+ {$this->getTable('review/review_store')}.store_id
+ FROM
+ {$this->getTable('rating_vote')}
+ INNER JOIN
+ {$this->getTable('review/review')}
+ ON {$this->getTable('rating_vote')}.review_id={$this->getTable('review/review')}.review_id
+ LEFT JOIN
+ {$this->getTable('review/review_store')}
+ ON {$this->getTable('rating_vote')}.review_id={$this->getTable('review/review_store')}.review_id
+ INNER JOIN
+ {$this->getTable('rating/rating_store')} AS rst
+ ON rst.rating_id = {$this->getTable('rating_vote')}.rating_id AND rst.store_id = {$this->getTable('review/review_store')}.store_id
+ INNER JOIN
+ {$this->getTable('review/review_status')} AS review_status
+ ON {$this->getTable('review/review')}.status_id = review_status.status_id
+ WHERE ";
+ if ($object->getEntityPkValue()) {
+ $sql .= "{$read->quoteInto($this->getTable('rating_vote').'.entity_pk_value=?', $object->getEntityPkValue())} AND ";
+ }
+ $sql .= "review_status.status_code = 'approved'
+ GROUP BY
+ {$this->getTable('rating_vote')}.entity_pk_value, {$this->getTable('review/review_store')}.store_id";
- return array_values($result);
+ return $read->fetchAll($sql);
}
public function getReviewSummary($object, $onlyForCurrentStore = true)
Index: app/code/core/Mage/Paypal/Model/Standard.php
===================================================================
--- app/code/core/Mage/Paypal/Model/Standard.php (revision 44104)
+++ app/code/core/Mage/Paypal/Model/Standard.php (revision 44105)
@@ -36,6 +36,8 @@
const PAYMENT_TYPE_AUTH = 'AUTHORIZATION';
const PAYMENT_TYPE_SALE = 'SALE';
+ const DATA_CHARSET = 'utf-8';
+
protected $_code = 'paypal_standard';
protected $_formBlockType = 'paypal/standard_form';
protected $_allowCurrencyCode = array('AUD', 'CAD', 'CZK', 'DKK', 'EUR', 'HKD', 'HUF', 'ILS', 'JPY', 'MXN', 'NOK', 'NZD', 'PLN', 'GBP', 'SGD', 'SEK', 'CHF', 'USD');
@@ -144,7 +146,7 @@
public function canCapture()
{
- return true;
+ return false;
}
public function getOrderPlaceRedirectUrl()
@@ -176,6 +178,7 @@
*/
$sArr = array(
+ 'charset' => self::DATA_CHARSET,
'business' => Mage::getStoreConfig('paypal/wps/business_account'),
'return' => Mage::getUrl('paypal/standard/success',array('_secure' => true)),
'cancel_return' => Mage::getUrl('paypal/standard/cancel',array('_secure' => false)),
@@ -416,7 +419,7 @@
->addObject($invoice->getOrder())
->save();
$order->setState(
- Mage_Sales_Model_Order::STATE_PROCESSING, $newOrderStatus,
+ Mage_Sales_Model_Order::STATE_COMPLETE, true,
Mage::helper('paypal')->__('Invoice #%s created', $invoice->getIncrementId()),
$notified = true
);
Index: app/code/core/Mage/Paypal/controllers/ExpressController.php
===================================================================
--- app/code/core/Mage/Paypal/controllers/ExpressController.php (revision 44104)
+++ app/code/core/Mage/Paypal/controllers/ExpressController.php (revision 44105)
@@ -171,6 +171,14 @@
}
}
+ $customer = $this->getReview()->getQuote()->getCustomer();
+ if (!$customer || !$customer->getId()) {
+ $this->getReview()->getQuote()
+ ->setCustomerIsGuest(true)
+ ->setCustomerGroupId(Mage_Customer_Model_Group::NOT_LOGGED_IN_ID);
+ }
+ unset($customer); // for backward compatibility, see logic after place order
+
$billing = $this->getReview()->getQuote()->getBillingAddress();
$shipping = $this->getReview()->getQuote()->getShippingAddress();
Index: app/code/core/Mage/Core/Helper/Data.php
===================================================================
--- app/code/core/Mage/Core/Helper/Data.php (revision 44104)
+++ app/code/core/Mage/Core/Helper/Data.php (revision 44105)
@@ -284,10 +284,11 @@
$allow = true;
$allowedIps = Mage::getStoreConfig('dev/restrict/allow_ips', $storeId);
- if (!empty($allowedIps) && isset($_SERVER['REMOTE_ADDR'])) {
+ $remoteAddr = Mage::helper('core/http')->getRemoteAddr();
+ if (!empty($allowedIps) && !empty($remoteAddr)) {
$allowedIps = preg_split('#\s*,\s*#', $allowedIps, null, PREG_SPLIT_NO_EMPTY);
- if (array_search($_SERVER['REMOTE_ADDR'], $allowedIps)===false
- && array_search($_SERVER['HTTP_HOST'], $allowedIps)===false) {
+ if (array_search($remoteAddr, $allowedIps) === false
+ && array_search(Mage::helper('core/http')->getHttpHost(), $allowedIps) === false) {
$allow = false;
}
}
Index: app/code/core/Mage/Core/Helper/Http.php
===================================================================
--- app/code/core/Mage/Core/Helper/Http.php (revision 44104)
+++ app/code/core/Mage/Core/Helper/Http.php (revision 44105)
@@ -18,20 +18,36 @@
* 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_Rss
- * @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_Core
+ * @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)
*/
/**
- * Default rss helper
+ * Core Http Helper
*
+ * @category Mage
+ * @package Mage_Core
* @author Magento Core Team
*/
class Mage_Core_Helper_Http extends Mage_Core_Helper_Abstract
{
- public function authValidate($headers=null)
+ const XML_NODE_REMOTE_ADDR_HEADERS = 'global/remote_addr_headers';
+
+ /**
+ * Remote address cache
+ *
+ * @var string
+ */
+ protected $_remoteAddr;
+
+ /**
+ * Validate and retrieve user and password from HTTP
+ *
+ * @return array
+ */
+ public function authValidate($headers = null)
{
if(!is_null($headers)) {
$_SERVER = $headers;
@@ -39,6 +55,7 @@
$user = '';
$pass = '';
+
// moshe's fix for CGI
if (empty($_SERVER['HTTP_AUTHORIZATION'])) {
foreach ($_SERVER as $k=>$v) {
@@ -64,13 +81,17 @@
list($user, $pass) = explode(':', base64_decode(substr($auth, strpos($auth, " ") + 1)));
}
- if(!$user || !$pass) {
+ if (!$user || !$pass) {
$this->authFailed();
}
return array($user, $pass);
}
+ /**
+ * Send auth failed Headers and exit
+ *
+ */
public function authFailed()
{
Mage::app()->getResponse()
@@ -80,4 +101,165 @@
->sendResponse();
exit;
}
-}
\ No newline at end of file
+
+ /**
+ * Retrieve Remote Addresses Additional check Headers
+ *
+ * @return array
+ */
+ public function getRemoteAddrHeaders()
+ {
+ $headers = array();
+ $element = Mage::getConfig()->getNode(self::XML_NODE_REMOTE_ADDR_HEADERS);
+ if ($element instanceof Mage_Core_Model_Config_Element) {
+ foreach ($element->children() as $node) {
+ $headers[] = (string)$node;
+ }
+ }
+
+ return $headers;
+ }
+
+ /**
+ * Retrieve Client Remote Address
+ *
+ * @param bool $ipToLong converting IP to long format
+ * @return string IPv4|long
+ */
+ public function getRemoteAddr($ipToLong = false)
+ {
+ if (is_null($this->_remoteAddr)) {
+ $headers = $this->getRemoteAddrHeaders();
+ foreach ($headers as $var) {
+ if ($this->_getRequest()->getServer($var, false)) {
+ $this->_remoteAddr = $_SERVER[$var];
+ break;
+ }
+ }
+
+ if (!$this->_remoteAddr) {
+ $this->_remoteAddr = $this->_getRequest()->getServer('REMOTE_ADDR');
+ }
+ }
+
+ if (!$this->_remoteAddr) {
+ return false;
+ }
+
+ return $ipToLong ? ip2long($this->_remoteAddr) : $this->_remoteAddr;
+ }
+
+ /**
+ * Retrieve Server IP address
+ *
+ * @param bool $ipToLong converting IP to long format
+ * @return string IPv4|long
+ */
+ public function getServerAddr($ipToLong = false)
+ {
+ $address = $this->_getRequest()->getServer('SERVER_ADDR');
+ if (!$address) {
+ return false;
+ }
+ return $ipToLong ? ip2long($address) : $address;
+ }
+
+ /**
+ * Retrieve HTTP "clean" value
+ *
+ * @param string $var
+ * @param boolean $clean clean non UTF-8 characters
+ * @return string
+ */
+ protected function _getHttpCleanValue($var, $clean = true)
+ {
+ $value = $this->_getRequest()->getServer($var, '');
+ if ($clean) {
+ $value = Mage::helper('core/string')->cleanString($value);
+ }
+
+ return $value;
+ }
+
+ /**
+ * Retrieve HTTP HOST
+ *
+ * @param boolean $clean clean non UTF-8 characters
+ * @return string
+ */
+ public function getHttpHost($clean = true)
+ {
+ return $this->_getHttpCleanValue('HTTP_HOST', $clean);
+ }
+
+ /**
+ * Retrieve HTTP USER AGENT
+ *
+ * @param boolean $clean clean non UTF-8 characters
+ * @return string
+ */
+ public function getHttpUserAgent($clean = true)
+ {
+ return $this->_getHttpCleanValue('HTTP_USER_AGENT', $clean);
+ }
+
+ /**
+ * Retrieve HTTP ACCEPT LANGUAGE
+ *
+ * @param boolean $clean clean non UTF-8 characters
+ * @return string
+ */
+ public function getHttpAcceptLanguage($clean = true)
+ {
+ return $this->_getHttpCleanValue('HTTP_ACCEPT_LANGUAGE', $clean);
+ }
+
+ /**
+ * Retrieve HTTP ACCEPT CHARSET
+ *
+ * @param boolean $clean clean non UTF-8 characters
+ * @return string
+ */
+ public function getHttpAcceptCharset($clean = true)
+ {
+ return $this->_getHttpCleanValue('HTTP_ACCEPT_CHARSET', $clean);
+ }
+
+ /**
+ * Retrieve HTTP REFERER
+ *
+ * @param boolean $clean clean non UTF-8 characters
+ * @return string
+ */
+ public function getHttpReferer($clean = true)
+ {
+ return $this->_getHttpCleanValue('HTTP_REFERER', $clean);
+ }
+
+ /**
+ * Returns the REQUEST_URI taking into account
+ * platform differences between Apache and IIS
+ *
+ * @param boolean $clean clean non UTF-8 characters
+ * @return string
+ */
+ public function getRequestUri($clean = false)
+ {
+ $uri = $this->_getRequest()->getRequestUri();
+ if ($clean) {
+ $uri = Mage::helper('core/string')->cleanString($uri);
+ }
+ return $uri;
+ }
+
+ /**
+ * Validate IP address
+ *
+ * @param string $address
+ * @return boolean
+ */
+ public function validateIpAddr($address)
+ {
+ return preg_match('#^(1?\d{1,2}|2([0-4]\d|5[0-5]))(\.(1?\d{1,2}|2([0-4]\d|5[0-5]))){3}$#', $address);
+ }
+}
Index: app/code/core/Mage/Core/Helper/String.php
===================================================================
--- app/code/core/Mage/Core/Helper/String.php (revision 44104)
+++ app/code/core/Mage/Core/Helper/String.php (revision 44105)
@@ -254,4 +254,15 @@
}
return $result;
}
+
+ /**
+ * Clean non UTF-8 characters
+ *
+ * @param string $string
+ * @return string
+ */
+ public function cleanString($string)
+ {
+ return iconv(self::ICONV_CHARSET, self::ICONV_CHARSET . '//IGNORE', $string);
+ }
}
Index: app/code/core/Mage/Core/Model/Session/Abstract/Varien.php
===================================================================
--- app/code/core/Mage/Core/Model/Session/Abstract/Varien.php (revision 44104)
+++ app/code/core/Mage/Core/Model/Session/Abstract/Varien.php (revision 44105)
@@ -384,8 +384,8 @@
);
// collect ip data
- if (isset($_SERVER['REMOTE_ADDR'])) {
- $parts[self::VALIDATOR_REMOTE_ADDR_KEY] = (string)$_SERVER['REMOTE_ADDR'];
+ if (Mage::helper('core/http')->getRemoteAddr()) {
+ $parts[self::VALIDATOR_REMOTE_ADDR_KEY] = Mage::helper('core/http')->getRemoteAddr();
}
if (isset($_ENV['HTTP_VIA'])) {
$parts[self::VALIDATOR_HTTP_VIA_KEY] = (string)$_ENV['HTTP_VIA'];
Index: app/code/core/Mage/Core/Model/Mysql4/Collection/Abstract.php
===================================================================
--- app/code/core/Mage/Core/Model/Mysql4/Collection/Abstract.php (revision 44104)
+++ app/code/core/Mage/Core/Model/Mysql4/Collection/Abstract.php (revision 44105)
@@ -192,9 +192,21 @@
Mage::dispatchEvent('core_collection_abstract_load_before', array('collection' => $this));
}
parent::load($printQuery, $logQuery);
+ return $this;
+ }
+
+ /**
+ * Redeclare after load method for specifying collection items original data
+ *
+ * @return Mage_Core_Model_Mysql4_Collection_Abstract
+ */
+ protected function _afterLoad()
+ {
+ parent::_afterLoad();
foreach ($this->_items as $item) {
$item->setOrigData();
}
+ Mage::dispatchEvent('core_collection_abstract_load_after', array('collection' => $this));
return $this;
}
Index: app/code/core/Mage/Core/Model/Abstract.php
===================================================================
--- app/code/core/Mage/Core/Model/Abstract.php (revision 44104)
+++ app/code/core/Mage/Core/Model/Abstract.php (revision 44105)
@@ -377,4 +377,4 @@
{
return $this->_getData('entity_id');
}
-}
\ No newline at end of file
+}
Index: app/code/core/Mage/Core/Model/App.php
===================================================================
--- app/code/core/Mage/Core/Model/App.php (revision 44104)
+++ app/code/core/Mage/Core/Model/App.php (revision 44105)
@@ -704,7 +704,8 @@
{
foreach ($this->getWebsites() as $_website) {
if ($_website->getIsDefault()) {
- if ($_defaultStore = $this->getGroup($_website->getDefaultGroupId())->getDefaultStore()) {
+ $_defaultStore = $this->getGroup($_website->getDefaultGroupId())->getDefaultStore();
+ if ($_defaultStore) {
return $_defaultStore;
}
}
@@ -954,7 +955,8 @@
{
if (!$this->_cache) {
$backend = strtolower((string)Mage::getConfig()->getNode('global/cache/backend'));
- if (!$cachePrefix = (string)Mage::getConfig()->getNode('global/cache/prefix')) {
+ $cachePrefix = (string)Mage::getConfig()->getNode('global/cache/prefix');
+ if (!$cachePrefix) {
$cachePrefix = md5(Mage::getConfig()->getBaseDir());
}
if (extension_loaded('apc') && ini_get('apc.enabled') && $backend == 'apc') {
@@ -1001,13 +1003,18 @@
else {
$lifetime = 7200;
}
- $this->_cache = Zend_Cache::factory('Core', $backend,
+ $this->_cache = Zend_Cache::factory(
+ 'Core',
+ $backend,
array(
'caching' => true,
'lifetime' => $lifetime,
'automatic_cleaning_factor' => 0,
),
- $backendAttributes
+ $backendAttributes,
+ false,
+ false,
+ true
);
}
return $this->_cache;
@@ -1133,7 +1140,8 @@
//Mage::app()->saveCache(serialize($cacheData), 'use_cache', array(), null);
$filename = $this->getUseCacheFilename();
- if (!$fp = @fopen($filename, 'w')) {
+ $fp = @fopen($filename, 'w');
+ if (!$fp) {
Mage::throwException($filename.' is not writable, unable to save cache settings');
}
@fwrite($fp, serialize($data));
@@ -1288,7 +1296,8 @@
*/
public function getAnyStoreView()
{
- if ($store = $this->getDefaultStoreView()) {
+ $store = $this->getDefaultStoreView();
+ if ($store) {
return $store;
}
foreach ($this->getStores() as $store) {
@@ -1329,4 +1338,34 @@
$this->_isSingleStoreAllowed = (bool)$value;
return $this;
}
+
+ /**
+ * Prepare array of store groups
+ * can be filtered to contain default store group or not by $withDefault flag
+ * depending on flag $codeKey array keys can be group id or group code
+ *
+ * @param bool $withDefault
+ * @param bool $codeKey
+ * @return array
+ */
+ public function getGroups($withDefault = false, $codeKey = false)
+ {
+ $groups = array();
+ if (is_array($this->_groups)) {
+ foreach ($this->_groups as $group) {
+ if (!$withDefault && $group->getId() == 0) {
+ continue;
+ }
+ if ($codeKey) {
+ $groups[$group->getCode()] = $group;
+ }
+ else {
+ $groups[$group->getId()] = $group;
+ }
+ }
+ }
+
+ return $groups;
+ }
+
}
Index: app/code/core/Mage/Core/Model/Email/Template/Filter.php
===================================================================
--- app/code/core/Mage/Core/Model/Email/Template/Filter.php (revision 44104)
+++ app/code/core/Mage/Core/Model/Email/Template/Filter.php (revision 44105)
@@ -56,6 +56,22 @@
protected static $_urlInstance;
/**
+ * Modifier Callbacks
+ *
+ * @var array
+ */
+ protected $_modifiers = array('nl2br' => '');
+
+ /**
+ * Setup callbacks for filters
+ *
+ */
+ public function __construct()
+ {
+ $this->_modifiers['escape'] = array($this, 'modifierEscape');
+ }
+
+ /**
* Set use absolute links flag
*
* @param bool $flag
@@ -285,4 +301,76 @@
return Mage::helper('core')->htmlEscape($params['var'], $allowedTags);
}
+
+ /**
+ * Var directive with modifiers support
+ *
+ * @param array $construction
+ * @return string
+ */
+ public function varDirective($construction)
+ {
+ if (count($this->_templateVars)==0) {
+ // If template preprocessing
+ return $construction[0];
+ }
+
+ $parts = explode('|', $construction[2], 2);
+ if (2 === count($parts)) {
+ list($variableName, $modifiersString) = $parts;
+ return $this->_amplifyModifiers($this->_getVariable($variableName, ''), $modifiersString);
+ }
+ return $this->_getVariable($construction[2], '');
+ }
+
+ /**
+ * Apply modifiers one by one, with specified params
+ *
+ * Modifier syntax: modifier1[:param1:param2:...][|modifier2:...]
+ *
+ * @param string $value
+ * @param string $modifiers
+ * @return string
+ */
+ protected function _amplifyModifiers($value, $modifiers)
+ {
+ foreach (explode('|', $modifiers) as $part) {
+ if (empty($part)) {
+ continue;
+ }
+ $params = explode(':', $part);
+ $modifier = array_shift($params);
+ if (isset($this->_modifiers[$modifier])) {
+ $callback = $this->_modifiers[$modifier];
+ if (!$callback) {
+ $callback = $modifier;
+ }
+ array_unshift($params, $value);
+ $value = call_user_func_array($callback, $params);
+ }
+ }
+ return $value;
+ }
+
+ /**
+ * Escape specified string
+ *
+ * @param string $value
+ * @param string $type
+ * @return string
+ */
+ public function modifierEscape($value, $type = 'html')
+ {
+ switch ($type) {
+ case 'html':
+ return htmlspecialchars($value, ENT_QUOTES);
+
+ case 'htmlentities':
+ return htmlentities($value, ENT_QUOTES);
+
+ case 'url':
+ return rawurlencode($value);
+ }
+ return $value;
+ }
}
Index: app/code/core/Mage/Core/Model/Url.php
===================================================================
--- app/code/core/Mage/Core/Model/Url.php (revision 44104)
+++ app/code/core/Mage/Core/Model/Url.php (revision 44105)
@@ -342,7 +342,7 @@
$route = array_shift($a);
if ('*'===$route) {
- $route = $this->getRequest()->getRouteName();
+ $route = $this->getRequest()->getRequestedRouteName();
}
$this->setRouteName($route);
$routePath = $route.'/';
@@ -350,7 +350,7 @@
if (!empty($a)) {
$controller = array_shift($a);
if ('*'===$controller) {
- $controller = $this->getRequest()->getControllerName();
+ $controller = $this->getRequest()->getRequestedControllerName();
}
$this->setControllerName($controller);
$routePath .= $controller.'/';
@@ -359,7 +359,7 @@
if (!empty($a)) {
$action = array_shift($a);
if ('*'===$action) {
- $action = $this->getRequest()->getActionName();
+ $action = $this->getRequest()->getRequestedActionName();
}
$this->setActionName($action);
$routePath .= $action.'/';
@@ -570,8 +570,8 @@
) {
$this->setQueryParam('___store', $this->getStore()->getCode());
}
- unset($data['_store_to_url']);
}
+ unset($data['_store_to_url']);
foreach ($data as $k=>$v) {
$this->setRouteParam($k, $v);
Index: app/code/core/Mage/Core/Controller/Varien/Action.php
===================================================================
--- app/code/core/Mage/Core/Controller/Varien/Action.php (revision 44104)
+++ app/code/core/Mage/Core/Controller/Varien/Action.php (revision 44105)
@@ -185,9 +185,9 @@
*/
public function getFullActionName($delimiter='_')
{
- return $this->getRequest()->getRouteName().$delimiter.
- $this->getRequest()->getControllerName().$delimiter.
- $this->getRequest()->getActionName();
+ return $this->getRequest()->getRequestedRouteName().$delimiter.
+ $this->getRequest()->getRequestedControllerName().$delimiter.
+ $this->getRequest()->getRequestedActionName();
}
/**
Index: app/code/core/Mage/Core/Controller/Varien/Front.php
===================================================================
--- app/code/core/Mage/Core/Controller/Varien/Front.php (revision 44104)
+++ app/code/core/Mage/Core/Controller/Varien/Front.php (revision 44105)
@@ -214,6 +214,11 @@
return $router;
}
+ /**
+ * Apply configuration rewrites to current url
+ *
+ * @return Mage_Core_Controller_Varien_Front
+ */
public function rewrite()
{
$request = $this->getRequest();
@@ -227,8 +232,37 @@
if (empty($from) || empty($to)) {
continue;
}
+ $from = $this->_processRewriteUrl($from);
+ $to = $this->_processRewriteUrl($to);
+
$pathInfo = preg_replace($from, $to, $request->getPathInfo());
- $request->setPathInfo($pathInfo);
+
+ if (isset($rewrite->complete)) {
+ $request->setPathInfo($pathInfo);
+ } else {
+ $request->rewritePathInfo($pathInfo);
+ }
}
}
+
+ /**
+ * Replace route name placeholders in url to front name
+ *
+ * @param string $url
+ * @return string
+ */
+ protected function _processRewriteUrl($url)
+ {
+ $startPos = strpos($url, '{');
+ if ($startPos!==false) {
+ $endPos = strpos($url, '}');
+ $routeName = substr($url, $startPos+1, $endPos-$startPos-1);
+ $router = $this->getRouterByRoute($routeName);
+ if ($router) {
+ $fronName = $router->getFrontNameByRoute($routeName);
+ $url = str_replace('{'.$routeName.'}', $fronName, $url);
+ }
+ }
+ return $url;
+ }
}
\ No newline at end of file
Index: app/code/core/Mage/Core/Controller/Front/Action.php
===================================================================
--- app/code/core/Mage/Core/Controller/Front/Action.php (revision 44104)
+++ app/code/core/Mage/Core/Controller/Front/Action.php (revision 44105)
@@ -55,7 +55,7 @@
{
parent::postDispatch();
if (!$this->getFlag('', self::FLAG_NO_START_SESSION )) {
- Mage::getSingleton('core/session')->setLastUrl(Mage::getUrl('*/*/*'), array('_current'=>true));
+ Mage::getSingleton('core/session')->setLastUrl(Mage::getUrl('*/*/*', array('_current'=>true)));
}
return $this;
}
Index: app/code/core/Mage/Core/Controller/Request/Http.php
===================================================================
--- app/code/core/Mage/Core/Controller/Request/Http.php (revision 44104)
+++ app/code/core/Mage/Core/Controller/Request/Http.php (revision 44105)
@@ -44,6 +44,14 @@
protected $_storeCode = null;
protected $_requestString = '';
+ /**
+ * Path info array used before applying rewrite from config
+ *
+ * @var null || array
+ */
+ protected $_rewritedPathInfo= null;
+ protected $_requestedRouteName = null;
+
protected $_route;
protected $_directFrontNames = array();
@@ -116,7 +124,8 @@
}
// Remove the query string from REQUEST_URI
- if ($pos = strpos($requestUri, '?')) {
+ $pos = strpos($requestUri, '?');
+ if ($pos) {
$requestUri = substr($requestUri, 0, $pos);
}
@@ -155,6 +164,22 @@
}
/**
+ * Specify new path info
+ * It happen when occur rewrite based on configuration
+ *
+ * @param string $pathInfo
+ * @return Mage_Core_Controller_Request_Http
+ */
+ public function rewritePathInfo($pathInfo)
+ {
+ if (($pathInfo != $this->getPathInfo()) && ($this->_rewritedPathInfo === null)) {
+ $this->_rewritedPathInfo = explode('/', trim($this->getPathInfo(), '/'));
+ }
+ $this->setPathInfo($pathInfo);
+ return $this;
+ }
+
+ /**
* Check if can be store code as part of url
*
* @return bool
@@ -292,4 +317,78 @@
{
return $this->_controllerModule;
}
+
+ /**
+ * Retrieve the module name
+ *
+ * @return string
+ */
+ public function getModuleName()
+ {
+ return $this->_module;
+ }
+ /**
+ * Retrieve the controller name
+ *
+ * @return string
+ */
+ public function getControllerName()
+ {
+ return $this->_controller;
+ }
+ /**
+ * Retrieve the action name
+ *
+ * @return string
+ */
+ public function getActionName()
+ {
+ return $this->_action;
+ }
+
+ /**
+ * Get route name used in request (ignore rewrite)
+ *
+ * @return string
+ */
+ public function getRequestedRouteName()
+ {
+ if ($this->_requestedRouteName === null) {
+ if ($this->_rewritedPathInfo !== null && isset($this->_rewritedPathInfo[0])) {
+ $fronName = $this->_rewritedPathInfo[0];
+ $router = Mage::app()->getFrontController()->getRouterByFrontName($fronName);
+ $this->_requestedRouteName = $router->getRouteByFrontName($fronName);
+ } else {
+ // no rewritten path found, use default route name
+ return $this->getRouteName();
+ }
+ }
+ return $this->_requestedRouteName;
+ }
+
+ /**
+ * Get controller name used in request (ignore rewrite)
+ *
+ * @return string
+ */
+ public function getRequestedControllerName()
+ {
+ if (($this->_rewritedPathInfo !== null) && isset($this->_rewritedPathInfo[1])) {
+ return $this->_rewritedPathInfo[1];
+ }
+ return $this->getControllerName();
+ }
+
+ /**
+ * Get action name used in request (ignore rewrite)
+ *
+ * @return string
+ */
+ public function getRequestedActionName()
+ {
+ if (($this->_rewritedPathInfo !== null) && isset($this->_rewritedPathInfo[2])) {
+ return $this->_rewritedPathInfo[2];
+ }
+ return $this->getActionName();
+ }
}
\ No newline at end of file
Index: app/code/core/Mage/Core/Controller/Response/Http.php
===================================================================
--- app/code/core/Mage/Core/Controller/Response/Http.php (revision 44104)
+++ app/code/core/Mage/Core/Controller/Response/Http.php (revision 44105)
@@ -74,4 +74,10 @@
}
parent::sendHeaders();
}
+
+ public function sendResponse()
+ {
+ Mage::dispatchEvent('http_response_send_before', array('response'=>$this));
+ return parent::sendResponse();
+ }
}
\ No newline at end of file
Index: app/code/core/Mage/Downloadable/Model/Sales/Order/Pdf/Items/Invoice.php
===================================================================
--- app/code/core/Mage/Downloadable/Model/Sales/Order/Pdf/Items/Invoice.php (revision 44104)
+++ app/code/core/Mage/Downloadable/Model/Sales/Order/Pdf/Items/Invoice.php (revision 44105)
@@ -34,88 +34,108 @@
*/
class Mage_Downloadable_Model_Sales_Order_Pdf_Items_Invoice extends Mage_Downloadable_Model_Sales_Order_Pdf_Items_Abstract
{
+ /**
+ * Draw item line
+ *
+ */
public function draw()
{
$order = $this->getOrder();
$item = $this->getItem();
$pdf = $this->getPdf();
$page = $this->getPage();
- $shift = array(0, 10, 0);
- $leftBound = 35;
+ $lines = array();
- $this->_setFontRegular();
+ // draw Product name
+ $lines[0] = array(array(
+ 'text' => Mage::helper('core/string')->str_split($item->getName(), 64, true, true),
+ 'feed' => 35,
+ ));
- $page->drawText($item->getQty()*1, 435, $pdf->y, 'UTF-8');
+ // draw SKU
+ $lines[0][] = array(
+ 'text' => Mage::helper('core/string')->str_split($this->getSku($item), 25),
+ 'feed' => 255
+ );
- /* in case Product name is longer than 80 chars - it is written in a few lines */
- foreach (Mage::helper('core/string')->str_split($item->getName(), 60, true, true) as $key => $part) {
- $page->drawText($part, 35, $pdf->y-$shift[0], 'UTF-8');
- $shift[0] += 10;
- }
+ // draw QTY
+ $lines[0][] = array(
+ 'text' => $item->getQty()*1,
+ 'feed' => 435
+ );
+ // draw Price
+ $lines[0][] = array(
+ 'text' => $order->formatPriceTxt($item->getPrice()),
+ 'feed' => 395,
+ 'font' => 'bold',
+ 'align' => 'right'
+ );
+
+ // draw Tax
+ $lines[0][] = array(
+ 'text' => $order->formatPriceTxt($item->getTaxAmount()),
+ 'feed' => 495,
+ 'font' => 'bold',
+ 'align' => 'right'
+ );
+
+ // draw Subtotal
+ $lines[0][] = array(
+ 'text' => $order->formatPriceTxt($item->getRowTotal()),
+ 'feed' => 565,
+ 'font' => 'bold',
+ 'align' => 'right'
+ );
+
+ // custom options
$options = $this->getItemOptions();
- if (isset($options)) {
+ if ($options) {
foreach ($options as $option) {
// draw options label
- $this->_setFontItalic();
- foreach (Mage::helper('core/string')->str_split(strip_tags($option['label']), 60, false, true) as $_option) {
- $page->drawText($_option, 35, $pdf->y-$shift[0], 'UTF-8');
- $shift[0] += 10;
- }
- // draw options value
- $this->_setFontRegular();
+ $lines[][] = array(
+ 'text' => Mage::helper('core/string')->str_split(strip_tags($option['label']), 70, true, true),
+ 'font' => 'italic',
+ 'feed' => 35
+ );
+
if ($option['value']) {
$_printValue = isset($option['print_value']) ? $option['print_value'] : strip_tags($option['value']);
$values = explode(', ', $_printValue);
foreach ($values as $value) {
- foreach (Mage::helper('core/string')->str_split($value, 60,true,true) as $_value) {
- $page->drawText($_value, 40, $pdf->y-$shift[0], 'UTF-8');
- $shift[0] += 10;
- }
+ $lines[][] = array(
+ 'text' => Mage::helper('core/string')->str_split($value, 50, true, true),
+ 'feed' => 40
+ );
}
}
}
}
- foreach ($this->_parseDescription() as $description){
- $page->drawText(strip_tags($description), 65, $pdf->y-$shift[1], 'UTF-8');
- $shift[1] += 10;
- }
+ // downloadable Items
+ $_purchasedItems = $this->getLinks()->getPurchasedItems();
- /* in case Product SKU is longer than 36 chars - it is written in a few lines */
- foreach (Mage::helper('core/string')->str_split($this->getSku($item), 25) as $key => $part) {
- if ($key > 0) {
- $shift[2] += 10;
- }
- $page->drawText($part, 240, $pdf->y-$shift[2], 'UTF-8');
- }
+ // draw Links title
+ $lines[][] = array(
+ 'text' => Mage::helper('core/string')->str_split($this->getLinksTitle(), 70, true, true),
+ 'font' => 'italic',
+ 'feed' => 35
+ );
- $font = $this->_setFontBold();
-
- $row_total = $order->formatPriceTxt($item->getRowTotal());
- $page->drawText($row_total, 565-$pdf->widthForStringUsingFontSize($row_total, $font, 7), $pdf->y, 'UTF-8');
-
- $price = $order->formatPriceTxt($item->getPrice());
- $page->drawText($price, 395-$pdf->widthForStringUsingFontSize($price, $font, 7), $pdf->y, 'UTF-8');
-
- $tax = $order->formatPriceTxt($item->getTaxAmount());
- $page->drawText($tax, 495-$pdf->widthForStringUsingFontSize($tax, $font, 7), $pdf->y, 'UTF-8');
-
- // draw Links Section Title
- $this->_setFontItalic();
- $pdf->y -= 10;
- $x = $leftBound;
- $_purchasedItems = $this->getLinks()->getPurchasedItems();
- $page->drawText($this->getLinksTitle(), $x, $pdf->y, 'UTF-8');
-
// draw Links
- $this->_setFontRegular();
foreach ($_purchasedItems as $_link) {
- $pdf->y -= 10;
-// $text = $_link->getLinkTitle() . ' ('.$_link->getNumberOfDownloadsUsed() . ' / ' . ($_link->getNumberOfDownloadsBought()?$_link->getNumberOfDownloadsBought():'U').')';
- $text = $_link->getLinkTitle();
- $page->drawText($text, $x+10, $pdf->y, 'UTF-8');
+ $lines[][] = array(
+ 'text' => Mage::helper('core/string')->str_split($_link->getLinkTitle(), 50, true, true),
+ 'feed' => 40
+ );
}
- $pdf->y -= 15;
+
+ $lineBlock = array(
+ 'lines' => $lines,
+ 'height' => 10
+ );
+
+ $page = $pdf->drawLineBlocks($page, array($lineBlock), array('table_header' => true));
+ $this->setPage($page);
}
-}
\ No newline at end of file
+}
Index: app/code/core/Mage/Downloadable/Model/Sales/Order/Pdf/Items/Abstract.php
===================================================================
--- app/code/core/Mage/Downloadable/Model/Sales/Order/Pdf/Items/Abstract.php (revision 44104)
+++ app/code/core/Mage/Downloadable/Model/Sales/Order/Pdf/Items/Abstract.php (revision 44105)
@@ -32,8 +32,13 @@
* @package Mage_Downloadable
* @author Magento Core Team
*/
-class Mage_Downloadable_Model_Sales_Order_Pdf_Items_Abstract extends Mage_Sales_Model_Order_Pdf_Items_Abstract
+abstract class Mage_Downloadable_Model_Sales_Order_Pdf_Items_Abstract extends Mage_Sales_Model_Order_Pdf_Items_Abstract
{
+ /**
+ * Downloadable links purchased model
+ *
+ * @var Mage_Downloadable_Model_Link_Purchased
+ */
protected $_purchasedLinks = null;
/**
@@ -64,6 +69,4 @@
}
return Mage::getStoreConfig(Mage_Downloadable_Model_Link::XML_PATH_LINKS_TITLE);
}
-
- public function draw(){}
-}
\ No newline at end of file
+}
Index: app/code/core/Mage/Downloadable/Model/Sales/Order/Pdf/Items/Creditmemo.php
===================================================================
--- app/code/core/Mage/Downloadable/Model/Sales/Order/Pdf/Items/Creditmemo.php (revision 44104)
+++ app/code/core/Mage/Downloadable/Model/Sales/Order/Pdf/Items/Creditmemo.php (revision 44105)
@@ -34,105 +34,130 @@
*/
class Mage_Downloadable_Model_Sales_Order_Pdf_Items_Creditmemo extends Mage_Downloadable_Model_Sales_Order_Pdf_Items_Abstract
{
+ /**
+ * Draw item line
+ *
+ */
public function draw()
{
$order = $this->getOrder();
$item = $this->getItem();
$pdf = $this->getPdf();
$page = $this->getPage();
+ $lines = array();
-// Mage::getModel('sales/order_pdf_items_creditmemo_default')
-// ->setOrder($this->getOrder())
-// ->setItem($this->getItem())
-// ->setPdf($this->getPdf())
-// ->setPage($this->getPage())
-// ->draw();
-
- $shift = array(0, 10, 0);
$leftBound = 35;
$rightBound = 565;
- // draw name
- $this->_setFontRegular();
$x = $leftBound;
- foreach (Mage::helper('core/string')->str_split($item->getName(), $x, true, true) as $key => $part) {
- $page->drawText($part, $x, $pdf->y - $shift[0], 'UTF-8');
- $shift[0] += 10;
- }
- // draw options
- $options = $this->getItemOptions();
- if (isset($options)) {
- foreach ($options as $option) {
- // draw options label
- $this->_setFontItalic();
- foreach (Mage::helper('core/string')->str_split(strip_tags($option['label']), $x, false, true) as $_option) {
- $page->drawText($_option, $x, $pdf->y - $shift[0], 'UTF-8');
- $shift[0] += 10;
- }
- // draw options value
- $this->_setFontRegular();
- $_printValue = isset($option['print_value']) ? $option['print_value'] : strip_tags($option['value']);
- foreach (Mage::helper('core/string')->str_split($_printValue, $x, true, true) as $_value) {
- $page->drawText($_value, $x + 5, $pdf->y - $shift[0], 'UTF-8');
- $shift[0] += 10;
- }
- }
- }
- // draw product description
- foreach ($this->_parseDescription() as $description){
- $page->drawText(strip_tags($description), $x + 5, $pdf->y - $shift[1], 'UTF-8');
- $shift[1] += 10;
- }
+ // draw Product name
+ $lines[0] = array(array(
+ 'text' => Mage::helper('core/string')->str_split($item->getName(), 60, true, true),
+ 'feed' => $x,
+ ));
+
$x += 220;
+ // draw SKU
+ $lines[0][] = array(
+ 'text' => Mage::helper('core/string')->str_split($this->getSku($item), 25),
+ 'feed' => $x
+ );
- // draw SKU
- foreach (Mage::helper('core/string')->str_split($this->getSku($item), 25) as $key => $part) {
- $page->drawText($part, $x, $pdf->y - $shift[2], 'UTF-8');
- $shift[2] += 10;
- }
$x += 100;
+ // draw Total (ex)
+ $lines[0][] = array(
+ 'text' => $order->formatPriceTxt($item->getRowTotal()),
+ 'feed' => $x,
+ 'font' => 'bold',
+ 'align' => 'right',
+ 'width' => 50,
+ );
- $font = $this->_setFontBold();
-
- // draw Total(ex)
- $text = $order->formatPriceTxt($item->getRowTotal());
- $page->drawText($text, $pdf->getAlignRight($text, $x, 50, $font, 7), $pdf->y, 'UTF-8');
$x += 50;
+ // draw Discount
+ $lines[0][] = array(
+ 'text' => $order->formatPriceTxt(-$item->getDiscountAmount()),
+ 'feed' => $x,
+ 'font' => 'bold',
+ 'align' => 'right',
+ 'width' => 50,
+ );
- // draw Discount
- $text = $order->formatPriceTxt(-$item->getDiscountAmount());
- $page->drawText($text, $pdf->getAlignRight($text, $x, 50, $font, 7), $pdf->y, 'UTF-8');
$x += 50;
+ // draw QTY
+ $lines[0][] = array(
+ 'text' => $item->getQty()*1,
+ 'feed' => $x,
+ 'font' => 'bold',
+ 'align' => 'center',
+ 'width' => 30,
+ );
- // draw QTY
- $text = $item->getQty() * 1;
- $page->drawText($text, $pdf->getAlignCenter($text, $x, 30, $font, 7), $pdf->y, 'UTF-8');
$x += 30;
+ // draw Tax
+ $lines[0][] = array(
+ 'text' => $order->formatPriceTxt($item->getTaxAmount()),
+ 'feed' => $x,
+ 'font' => 'bold',
+ 'align' => 'right',
+ 'width' => 45,
+ );
- // draw Tax
- $text = $order->formatPriceTxt($item->getTaxAmount());
- $page->drawText($text, $pdf->getAlignRight($text, $x, 45, $font, 7, 10), $pdf->y, 'UTF-8');
$x += 45;
+ // draw Subtotal
+ $lines[0][] = array(
+ 'text' => $order->formatPriceTxt($item->getRowTotal() + $item->getTaxAmount() - $item->getDiscountAmount()),
+ 'feed' => $rightBound,
+ 'font' => 'bold',
+ 'align' => 'right'
+ );
- // draw Total(inc)
- $text = $order->formatPriceTxt($item->getRowTotal() + $item->getTaxAmount() - $item->getDiscountAmount());
- $page->drawText($text, $pdf->getAlignRight($text, $x, $rightBound - $x, $font, 7, 0), $pdf->y, 'UTF-8');
+ // draw options
+ $options = $this->getItemOptions();
+ if ($options) {
+ foreach ($options as $option) {
+ // draw options label
+ $lines[][] = array(
+ 'text' => Mage::helper('core/string')->str_split(strip_tags($option['label']), 70, true, true),
+ 'font' => 'italic',
+ 'feed' => $leftBound
+ );
- // draw Links Section Title
- $this->_setFontItalic();
- $pdf->y -= 10;
- $x = $leftBound;
+ // draw options value
+ $_printValue = isset($option['print_value'])
+ ? $option['print_value']
+ : strip_tags($option['value']);
+ $lines[][] = array(
+ 'text' => Mage::helper('core/string')->str_split($_printValue, 50, true, true),
+ 'feed' => $leftBound + 5
+ );
+ }
+ }
+
+ // downloadable Items
$_purchasedItems = $this->getLinks()->getPurchasedItems();
- $page->drawText($this->getLinksTitle(), $x, $pdf->y, 'UTF-8');
+ // draw Links title
+ $lines[][] = array(
+ 'text' => Mage::helper('core/string')->str_split($this->getLinksTitle(), 70, true, true),
+ 'font' => 'italic',
+ 'feed' => 35
+ );
+
// draw Links
- $this->_setFontRegular();
foreach ($_purchasedItems as $_link) {
- $pdf->y -= 10;
-// $text = $_link->getLinkTitle() . ' ('.$_link->getNumberOfDownloadsUsed() . ' / ' . ($_link->getNumberOfDownloadsBought()?$_link->getNumberOfDownloadsBought():'U').')';
- $text = $_link->getLinkTitle();
- $page->drawText($text, $x+10, $pdf->y, 'UTF-8');
+ $lines[][] = array(
+ 'text' => Mage::helper('core/string')->str_split($_link->getLinkTitle(), 50, true, true),
+ 'feed' => 40
+ );
}
- $pdf->y -= 15;
+
+ $lineBlock = array(
+ 'lines' => $lines,
+ 'height' => 10
+ );
+
+ $page = $pdf->drawLineBlocks($page, array($lineBlock), array('table_header' => true));
+ $this->setPage($page);
}
-}
\ No newline at end of file
+}
Index: app/code/core/Mage/Downloadable/Model/Observer.php
===================================================================
--- app/code/core/Mage/Downloadable/Model/Observer.php (revision 44104)
+++ app/code/core/Mage/Downloadable/Model/Observer.php (revision 44105)
@@ -155,7 +155,7 @@
/* @var $order Mage_Sales_Model_Order */
$status = '';
$orderItemsIds = array();
- $orderItemStatusToEnable = Mage::getStoreConfig(Mage_Downloadable_Model_Link_Purchased_Item::XML_PATH_ORDER_ITEM_STATUS);
+ $orderItemStatusToEnable = Mage::getStoreConfig(Mage_Downloadable_Model_Link_Purchased_Item::XML_PATH_ORDER_ITEM_STATUS, $order->getStoreId());
if ($order->getState() == Mage_Sales_Model_Order::STATE_HOLDED) {
$status = Mage_Downloadable_Model_Link_Purchased_Item::LINK_STATUS_PENDING;
} elseif ($order->getState() == Mage_Sales_Model_Order::STATE_CANCELED
Index: app/code/core/Mage/Downloadable/etc/config.xml
===================================================================
--- app/code/core/Mage/Downloadable/etc/config.xml (revision 44104)
+++ app/code/core/Mage/Downloadable/etc/config.xml (revision 44105)
@@ -846,7 +846,7 @@
- downloadable/customer/
+ /downloadable/customer/
Index: app/code/core/Mage/Reports/Model/Mysql4/Product/Lowstock/Collection.php
===================================================================
--- app/code/core/Mage/Reports/Model/Mysql4/Product/Lowstock/Collection.php (revision 0)
+++ app/code/core/Mage/Reports/Model/Mysql4/Product/Lowstock/Collection.php (revision 44105)
@@ -0,0 +1,174 @@
+
+ */
+
+class Mage_Reports_Model_Mysql4_Product_Lowstock_Collection extends Mage_Reports_Model_Mysql4_Product_Collection
+{
+ protected $_inventoryItemResource = null;
+ protected $_inventoryItemJoined = false;
+ protected $_inventoryItemTableAlias = 'lowstock_inventory_item';
+
+ /**
+ * @return string
+ */
+ protected function _getInventoryItemResource()
+ {
+ if (is_null($this->_inventoryItemResource)) {
+ $this->_inventoryItemResource = Mage::getResourceSingleton('cataloginventory/stock_item');
+ }
+ return $this->_inventoryItemResource;
+ }
+
+ /**
+ * @return string
+ */
+ protected function _getInventoryItemTable()
+ {
+ return $this->_getInventoryItemResource()->getMainTable();
+ }
+
+ /**
+ * @return string
+ */
+ protected function _getInventoryItemIdField()
+ {
+ return $this->_getInventoryItemResource()->getIdFieldName();
+ }
+
+ /**
+ * @return string
+ */
+ protected function _getInventoryItemTableAlias()
+ {
+ return $this->_inventoryItemTableAlias;
+ }
+
+ /**
+ * @param array|string $fields
+ * @return string
+ */
+ protected function _processInventoryItemFields($fields)
+ {
+ if (is_array($fields)) {
+ $aliasArr = array();
+ foreach ($fields as &$field) {
+ if ( is_string($field) && strpos($field, '(') === false ) {
+ $field = sprintf('%s.%s', $this->_getInventoryItemTableAlias(), $field);
+ }
+ }
+ unset($field);
+ return $fields;
+ }
+ return sprintf('%s.%s', $this->_getInventoryItemTableAlias(), $fields);
+ }
+
+ /**
+ * Join cataloginventory_stock_item table for further
+ * stock_item values filters
+ * @return Mage_Reports_Model_Mysql4_Product_Collection
+ */
+ public function joinInventoryItem($fields=array()) {
+ if ( !$this->_inventoryItemJoined ) {
+ $this->getSelect()->join(
+ array($this->_getInventoryItemTableAlias() => $this->_getInventoryItemTable()),
+ sprintf('e.%s=%s.product_id',
+ $this->getEntity()->getEntityIdField(),
+ $this->_getInventoryItemTableAlias()
+ ),
+ array()
+ );
+ $this->_inventoryItemJoined = true;
+ }
+ if (is_string($fields)) {
+ $fields = array($fields);
+ }
+ if (!empty($fields)) {
+ $this->getSelect()->columns($this->_processInventoryItemFields($fields));
+ }
+ return $this;
+ }
+
+ /**
+ * @param array|string $typeFilter
+ * @return Mage_Reports_Model_Mysql4_Product_Collection
+ */
+ public function filterByProductType($typeFilter)
+ {
+ if (!is_string($typeFilter) && !is_array($typeFilter)) {
+ Mage::throwException(
+ Mage::helper('catalog')->__('Wrong product type filter specified')
+ );
+ }
+ $this->addAttributeToFilter('type_id', $typeFilter);
+ return $this;
+ }
+
+ /**
+ * @return Mage_Reports_Model_Mysql4_Product_Collection
+ */
+ public function filterByIsQtyProductTypes()
+ {
+ $this->filterByProductType(
+ array_keys(array_filter(Mage::helper('cataloginventory')->getIsQtyTypeIds()))
+ );
+ return $this;
+ }
+
+ /**
+ * @param int|null $storeId
+ * @return Mage_Reports_Model_Mysql4_Product_Collection
+ */
+ public function useManageStockFilter($storeId=null)
+ {
+ $this->joinInventoryItem();
+ $this->getSelect()->where(sprintf('IF(%s,%d,%s)=1',
+ $this->_processInventoryItemFields('use_config_manage_stock'),
+ (int) Mage::getStoreConfig(Mage_CatalogInventory_Model_Stock_Item::XML_PATH_MANAGE_STOCK,$storeId),
+ $this->_processInventoryItemFields('manage_stock')));
+ return $this;
+ }
+
+ /**
+ * @param int|null $storeId
+ * @return Mage_Reports_Model_Mysql4_Product_Collection
+ */
+ public function useNotifyStockQtyFilter($storeId=null)
+ {
+ $this->joinInventoryItem(array('qty'));
+ $this->getSelect()->where(sprintf('qty < IF(%s,%d,%s)',
+ $this->_processInventoryItemFields('use_config_notify_stock_qty'),
+ (int) Mage::getStoreConfig(Mage_CatalogInventory_Model_Stock_Item::XML_PATH_NOTIFY_STOCK_QTY,$storeId),
+ $this->_processInventoryItemFields('notify_stock_qty')));
+ return $this;
+ }
+}
Index: app/code/core/Mage/Reports/Model/Totals.php
===================================================================
--- app/code/core/Mage/Reports/Model/Totals.php (revision 44104)
+++ app/code/core/Mage/Reports/Model/Totals.php (revision 44105)
@@ -33,18 +33,30 @@
*/
class Mage_Reports_Model_Totals
{
+ /**
+ * Retrieve count totals
+ *
+ * @param Mage_Adminhtml_Block_Report_Grid $grid
+ * @param string $from
+ * @param string $to
+ * @return Varien_Object
+ */
public function countTotals($grid, $from, $to)
{
$columns = array();
- foreach ($grid->getColumns() as $col)
+ foreach ($grid->getColumns() as $col) {
$columns[$col->getIndex()] = array("total" => $col->getTotal(), "value" => 0);
+ }
$count = 0;
$report = $grid->getCollection()->getReportFull($from, $to);
- foreach ($report as $item)
- {
+ foreach ($report as $item) {
+ if ($grid->getSubReportSize() && $count >= $grid->getSubReportSize()) {
+ continue;
+ }
$data = $item->getData();
- foreach ($columns as $field=>$a){
+
+ foreach ($columns as $field=>$a) {
if ($field !== '') {
$columns[$field]['value'] = $columns[$field]['value'] + (isset($data[$field]) ? $data[$field] : 0);
}
@@ -52,8 +64,7 @@
$count++;
}
$data = array();
- foreach ($columns as $field=>$a)
- {
+ foreach ($columns as $field => $a) {
if ($a['total'] == 'avg') {
if ($field !== '') {
if ($count != 0) {
@@ -74,7 +85,6 @@
}
$totals = new Varien_Object();
-
$totals->setData($data);
return $totals;
Index: app/code/core/Mage/CatalogRule/Model/Observer.php
===================================================================
--- app/code/core/Mage/CatalogRule/Model/Observer.php (revision 44104)
+++ app/code/core/Mage/CatalogRule/Model/Observer.php (revision 44105)
@@ -87,19 +87,19 @@
$storeId = $product->getStoreId();
if ($observer->hasDate()) {
- $date = $observer->getDate();
+ $date = $observer->getEvent()->getDate();
} else {
$date = Mage::app()->getLocale()->storeTimeStamp($storeId);
}
if ($observer->hasWebsiteId()) {
- $wId = $observer->getWebsiteId();
+ $wId = $observer->getEvent()->getWebsiteId();
} else {
$wId = Mage::app()->getStore($storeId)->getWebsiteId();
}
if ($observer->hasCustomerGroupId()) {
- $gId = $observer->getCustomerGroupId();
+ $gId = $observer->getEvent()->getCustomerGroupId();
} else {
$gId = Mage::getSingleton('customer/session')->getCustomerGroupId();
}
Index: app/code/core/Mage/Sitemap/Model/Sitemap.php
===================================================================
--- app/code/core/Mage/Sitemap/Model/Sitemap.php (revision 44104)
+++ app/code/core/Mage/Sitemap/Model/Sitemap.php (revision 44105)
@@ -100,6 +100,16 @@
}
/**
+ * Return full file name with path
+ *
+ * @return string
+ */
+ public function getPreparedFilename()
+ {
+ return $this->getPath() . $this->getSitemapFilename();
+ }
+
+ /**
* Generate XML file
*
* @return Mage_Sitemap_Model_Sitemap
Index: app/code/core/Mage/Sitemap/Model/Mysql4/Catalog/Category.php
===================================================================
--- app/code/core/Mage/Sitemap/Model/Mysql4/Catalog/Category.php (revision 44104)
+++ app/code/core/Mage/Sitemap/Model/Mysql4/Catalog/Category.php (revision 44105)
@@ -168,21 +168,22 @@
$this->_select->where('e.' . $attributeCode . $conditionRule, $value);
}
else {
+ $this->_select->join(
+ array('t1_'.$attributeCode => $attribute['table']),
+ 'e.entity_id=t1_'.$attributeCode.'.entity_id AND t1_'.$attributeCode.'.store_id=0',
+ array()
+ )
+ ->where('t1_'.$attributeCode.'.attribute_id=?', $attribute['attribute_id']);
+
if ($attribute['is_global']) {
-
+ $this->_select->where('t1_'.$attributeCode.'.value'.$conditionRule, $value);
}
else {
- $this->_select->join(
- array('t1_'.$attributeCode => $attribute['table']),
- 'e.entity_id=t1_'.$attributeCode.'.entity_id AND t1_'.$attributeCode.'.store_id=0',
- array()
- )
- ->joinLeft(
+ $this->_select->joinLeft(
array('t2_'.$attributeCode => $attribute['table']),
$this->_getWriteAdapter()->quoteInto('t1_'.$attributeCode.'.entity_id = t2_'.$attributeCode.'.entity_id AND t1_'.$attributeCode.'.attribute_id = t2_'.$attributeCode.'.attribute_id AND t2_'.$attributeCode.'.store_id=?', $storeId),
array()
)
- ->where('t1_'.$attributeCode.'.attribute_id=?', $attribute['attribute_id'])
->where('IFNULL(t2_'.$attributeCode.'.value, t1_'.$attributeCode.'.value)'.$conditionRule, $value);
}
}
Index: app/code/core/Mage/Sitemap/Model/Mysql4/Catalog/Product.php
===================================================================
--- app/code/core/Mage/Sitemap/Model/Mysql4/Catalog/Product.php (revision 44104)
+++ app/code/core/Mage/Sitemap/Model/Mysql4/Catalog/Product.php (revision 44105)
@@ -102,21 +102,22 @@
$this->_select->where('e.' . $attributeCode . $conditionRule, $value);
}
else {
+ $this->_select->join(
+ array('t1_'.$attributeCode => $attribute['table']),
+ 'e.entity_id=t1_'.$attributeCode.'.entity_id AND t1_'.$attributeCode.'.store_id=0',
+ array()
+ )
+ ->where('t1_'.$attributeCode.'.attribute_id=?', $attribute['attribute_id']);
+
if ($attribute['is_global']) {
-
+ $this->_select->where('t1_'.$attributeCode.'.value'.$conditionRule, $value);
}
else {
- $this->_select->join(
- array('t1_'.$attributeCode => $attribute['table']),
- 'e.entity_id=t1_'.$attributeCode.'.entity_id AND t1_'.$attributeCode.'.store_id=0',
- array()
- )
- ->joinLeft(
+ $this->_select->joinLeft(
array('t2_'.$attributeCode => $attribute['table']),
$this->_getWriteAdapter()->quoteInto('t1_'.$attributeCode.'.entity_id = t2_'.$attributeCode.'.entity_id AND t1_'.$attributeCode.'.attribute_id = t2_'.$attributeCode.'.attribute_id AND t2_'.$attributeCode.'.store_id=?', $storeId),
array()
)
- ->where('t1_'.$attributeCode.'.attribute_id=?', $attribute['attribute_id'])
->where('IFNULL(t2_'.$attributeCode.'.value, t1_'.$attributeCode.'.value)'.$conditionRule, $value);
}
}
Index: app/code/core/Mage/Directory/sql/directory_setup/mysql4-upgrade-0.8.4-0.8.5.php
===================================================================
--- app/code/core/Mage/Directory/sql/directory_setup/mysql4-upgrade-0.8.4-0.8.5.php (revision 0)
+++ app/code/core/Mage/Directory/sql/directory_setup/mysql4-upgrade-0.8.4-0.8.5.php (revision 44105)
@@ -0,0 +1,39 @@
+startSetup();
+
+$installer->run("
+ UPDATE {$installer->getTable('directory/country_region')}
+ SET code = 'GR'
+ WHERE region_id = 113
+");
+
+$installer->endSetup();
Index: app/code/core/Mage/Directory/Model/Currency.php
===================================================================
--- app/code/core/Mage/Directory/Model/Currency.php (revision 44104)
+++ app/code/core/Mage/Directory/Model/Currency.php (revision 44105)
@@ -107,7 +107,7 @@
}
/**
- * Get currency rate
+ * Get currency rate (only base=>allowed)
*
* @param string $toCurrency
* @return double
@@ -128,6 +128,29 @@
}
return $rates[$code];
}
+
+ /**
+ * Get currency rate (base=>allowed or allowed=>base)
+ *
+ * @param string $toCurrency
+ * @return double
+ */
+ public function getAnyRate($toCurrency)
+ {
+ if (is_string($toCurrency)) {
+ $code = $toCurrency;
+ } elseif ($toCurrency instanceof Mage_Directory_Model_Currency) {
+ $code = $toCurrency->getCurrencyCode();
+ } else {
+ throw Mage::exception('Mage_Directory', Mage::helper('directory')->__('Invalid target currency'));
+ }
+ $rates = $this->getRates();
+ if (!isset($rates[$code])) {
+ $rates[$code] = $this->_getResource()->getAnyRate($this->getCode(), $toCurrency);
+ $this->setRates($rates);
+ }
+ return $rates[$code];
+ }
/**
* Convert price to currency format
Index: app/code/core/Mage/Directory/Model/Mysql4/Currency.php
===================================================================
--- app/code/core/Mage/Directory/Model/Mysql4/Currency.php (revision 44104)
+++ app/code/core/Mage/Directory/Model/Mysql4/Currency.php (revision 44105)
@@ -61,7 +61,7 @@
}
/**
- * Retrieve currency rate
+ * Retrieve currency rate (only base=>allowed)
*
* @param string $currencyFrom
* @param string $currencyTo
@@ -93,7 +93,43 @@
return self::$_rateCache[$currencyFrom][$currencyTo];
}
+
+ /**
+ * Retrieve currency rate (base=>allowed or allowed=>base)
+ *
+ * @param string $currencyFrom
+ * @param string $currencyTo
+ * @return float
+ */
+ public function getAnyRate($currencyFrom, $currencyTo)
+ {
+ if ($currencyFrom instanceof Mage_Directory_Model_Currency) {
+ $currencyFrom = $currencyFrom->getCode();
+ }
+ if ($currencyTo instanceof Mage_Directory_Model_Currency) {
+ $currencyTo = $currencyTo->getCode();
+ }
+
+ if ($currencyFrom == $currencyTo) {
+ return 1;
+ }
+
+ if (!isset(self::$_rateCache[$currencyFrom][$currencyTo])) {
+ $read = $this->_getReadAdapter();
+ $select = $read->select()
+ ->from($this->_currencyRateTable, new Zend_Db_Expr($read->quoteInto('if(currency_from=?,rate,1/rate)', strtoupper($currencyFrom))))
+ ->where('currency_from=?', strtoupper($currencyFrom))
+ ->where('currency_to=?', strtoupper($currencyTo))
+ ->orWhere('currency_from=?', strtoupper($currencyTo))
+ ->where('currency_to=?', strtoupper($currencyFrom));
+
+ self::$_rateCache[$currencyFrom][$currencyTo] = $read->fetchOne($select);
+ }
+
+ return self::$_rateCache[$currencyFrom][$currencyTo];
+ }
+
/**
* Saving currency rates
*
Index: app/code/core/Mage/Directory/etc/config.xml
===================================================================
--- app/code/core/Mage/Directory/etc/config.xml (revision 44104)
+++ app/code/core/Mage/Directory/etc/config.xml (revision 44105)
@@ -28,7 +28,7 @@
- 0.8.4
+ 0.8.5
Index: app/code/core/Mage/Checkout/Model/Session.php
===================================================================
--- app/code/core/Mage/Checkout/Model/Session.php (revision 44104)
+++ app/code/core/Mage/Checkout/Model/Session.php (revision 44105)
@@ -82,8 +82,8 @@
$this->_quote = $quote;
}
- if (isset($_SERVER['REMOTE_ADDR'])) {
- $this->_quote->setRemoteIp($_SERVER['REMOTE_ADDR']);
+ if ($remoteAddr = Mage::helper('core/http')->getRemoteAddr()) {
+ $this->_quote->setRemoteIp($remoteAddr);
}
return $this->_quote;
}
Index: app/code/core/Mage/Checkout/controllers/OnepageController.php
===================================================================
--- app/code/core/Mage/Checkout/controllers/OnepageController.php (revision 44104)
+++ app/code/core/Mage/Checkout/controllers/OnepageController.php (revision 44105)
@@ -27,6 +27,12 @@
class Mage_Checkout_OnepageController extends Mage_Checkout_Controller_Action
{
+ protected $_sectionUpdateFunctions = array(
+ 'payment-method' => '_getPaymentMethodsHtml',
+ 'shipping-method' => '_getShippingMethodsHtml',
+ 'review' => '_getReviewHtml',
+ );
+
/**
* @return Mage_Checkout_OnepageController
*/
@@ -100,6 +106,11 @@
return $output;
}
+ protected function _getReviewHtml()
+ {
+ return $this->getLayout()->getBlock('root')->toHtml();
+ }
+
/**
* Enter description here...
*
@@ -349,7 +360,7 @@
$result['goto_section'] = 'review';
$result['update_section'] = array(
'name' => 'review',
- 'html' => $this->getLayout()->getBlock('root')->toHtml()
+ 'html' => $this->_getReviewHtml()
);
// $result['review_html'] = $this->getLayout()->getBlock('root')->toHtml();
@@ -393,6 +404,23 @@
$result['success'] = false;
$result['error'] = true;
$result['error_messages'] = $e->getMessage();
+
+ if ($gotoSection = $this->getOnepage()->getCheckout()->getGotoSection()) {
+ $result['goto_section'] = $gotoSection;
+ $this->getOnepage()->getCheckout()->setGotoSection(null);
+ }
+
+ if ($updateSection = $this->getOnepage()->getCheckout()->getUpdateSection()) {
+ if (isset($this->_sectionUpdateFunctions[$updateSection])) {
+ $updateSectionFunction = $this->_sectionUpdateFunctions[$updateSection];
+ $result['update_section'] = array(
+ 'name' => $updateSection,
+ 'html' => $this->$updateSectionFunction()
+ );
+ }
+ $this->getOnepage()->getCheckout()->setUpdateSection(null);
+ }
+
$this->getOnepage()->getQuote()->save();
}
catch (Exception $e) {
Index: app/code/core/Mage/Wishlist/Model/Wishlist.php
===================================================================
--- app/code/core/Mage/Wishlist/Model/Wishlist.php (revision 44104)
+++ app/code/core/Mage/Wishlist/Model/Wishlist.php (revision 44105)
@@ -205,14 +205,23 @@
}
/**
- * Retrieve shared store ids
+ * Retrieve shared store ids for current website or all stores if $current is false
*
+ * @param bool $current Use current website or not
* @return array
*/
- public function getSharedStoreIds()
+ public function getSharedStoreIds($current = true)
{
if (is_null($this->_storeIds)) {
- $this->_storeIds = $this->getStore()->getWebsite()->getStoreIds();
+ if ($current) {
+ $this->_storeIds = $this->getStore()->getWebsite()->getStoreIds();
+ } else {
+ $_storeIds = array();
+ foreach (Mage::app()->getStores() as $store) {
+ $_storeIds[] = $store->getId();
+ }
+ $this->_storeIds = $_storeIds;
+ }
}
return $this->_storeIds;
}
Index: app/code/core/Mage/Wishlist/Model/Observer.php
===================================================================
--- app/code/core/Mage/Wishlist/Model/Observer.php (revision 44104)
+++ app/code/core/Mage/Wishlist/Model/Observer.php (revision 44105)
@@ -86,7 +86,7 @@
public function processAddToCart($observer)
{
- $request = $observer->getRequest();
+ $request = $observer->getEvent()->getRequest();
$sharedWishlist = Mage::getSingleton('checkout/session')->getSharedWishlist();
$messages = Mage::getSingleton('checkout/session')->getWishlistPendingMessages();
$urls = Mage::getSingleton('checkout/session')->getWishlistPendingUrls();
@@ -129,7 +129,7 @@
Mage::getSingleton('checkout/session')->addError($message);
- $observer->getResponse()->setRedirect($url);
+ $observer->getEvent()->getResponse()->setRedirect($url);
Mage::getSingleton('checkout/session')->setNoCartRedirect(true);
}
}
Index: app/code/core/Mage/Wishlist/etc/system.xml
===================================================================
--- app/code/core/Mage/Wishlist/etc/system.xml (revision 44104)
+++ app/code/core/Mage/Wishlist/etc/system.xml (revision 44105)
@@ -34,7 +34,7 @@
140
1
1
- 0
+ 1
Share options
Index: app/code/core/Mage/GoogleBase/Model/Service/Item.php
===================================================================
--- app/code/core/Mage/GoogleBase/Model/Service/Item.php (revision 44104)
+++ app/code/core/Mage/GoogleBase/Model/Service/Item.php (revision 44105)
@@ -280,6 +280,8 @@
$entry->setContent($content);
}
+ $this->_setAttributePrice(false, $object->getPrice());
+
if ($object->getQuantity()) {
$quantity = $object->getQuantity() ? max(1, (int)$object->getQuantity()) : 1;
$this->_setAttribute('quantity', $quantity, 'int');
@@ -329,12 +331,15 @@
*/
protected function _setAttributePrice($attribute, $value, $type = 'text')
{
- $targetCountry = $this->getConfig()->getTargetCountry($this->getStoreId());
- $this->_setAttribute(
- $this->getConfig()->getCountryInfo($targetCountry, 'price_attribute_name', $this->getStoreId()),
- sprintf('%.2f', $value),
- 'floatUnit'
- );
+ if (!$this->getData('price_assigned')) {
+ $targetCountry = $this->getConfig()->getTargetCountry($this->getStoreId());
+ $this->_setAttribute(
+ $this->getConfig()->getCountryInfo($targetCountry, 'price_attribute_name', $this->getStoreId()),
+ sprintf('%.2f', $value),
+ 'floatUnit'
+ );
+ $this->setData('price_assigned', true);
+ }
}
/**
Index: app/code/core/Mage/GoogleBase/Model/Source/Accounttype.php
===================================================================
--- app/code/core/Mage/GoogleBase/Model/Source/Accounttype.php (revision 0)
+++ app/code/core/Mage/GoogleBase/Model/Source/Accounttype.php (revision 44105)
@@ -0,0 +1,44 @@
+
+ */
+class Mage_GoogleBase_Model_Source_Accounttype
+{
+ public function toOptionArray()
+ {
+ return array(
+ array('value' => 'HOSTED_OR_GOOGLE', 'label' => Mage::helper('googlebase')->__('Hosted or Google')),
+ array('value' => 'GOOGLE', 'label' => Mage::helper('googlebase')->__('Google')),
+ array('value' => 'HOSTED', 'label' => Mage::helper('googlebase')->__('Hosted'))
+ );
+ }
+}
\ No newline at end of file
Index: app/code/core/Mage/GoogleBase/Model/Service.php
===================================================================
--- app/code/core/Mage/GoogleBase/Model/Service.php (revision 44104)
+++ app/code/core/Mage/GoogleBase/Model/Service.php (revision 44105)
@@ -42,11 +42,16 @@
{
$user = $this->getConfig()->getAccountLogin($storeId);
$pass = $this->getConfig()->getAccountPassword($storeId);
+ $type = $this->getConfig()->getAccountType($storeId);
// Create an authenticated HTTP client
$errorMsg = Mage::helper('googlebase')->__('Unable to connect to Google Base. Please, check Account settings in configuration.');
try {
- $client = Zend_Gdata_ClientLogin::getHttpClient($user, $pass, Zend_Gdata_Gbase::AUTH_SERVICE_NAME, null, '', $loginToken, $loginCaptcha);
+ $client = Zend_Gdata_ClientLogin::getHttpClient($user, $pass, Zend_Gdata_Gbase::AUTH_SERVICE_NAME, null, '',
+ $loginToken, $loginCaptcha,
+ Zend_Gdata_ClientLogin::CLIENTLOGIN_URI,
+ $type
+ );
} catch (Zend_Gdata_App_CaptchaRequiredException $e) {
throw $e;
} catch (Zend_Gdata_App_HttpException $e) {
Index: app/code/core/Mage/GoogleBase/Model/Config.php
===================================================================
--- app/code/core/Mage/GoogleBase/Model/Config.php (revision 44104)
+++ app/code/core/Mage/GoogleBase/Model/Config.php (revision 44105)
@@ -72,6 +72,17 @@
}
/**
+ * Google Account type
+ *
+ * @param int $storeId
+ * @return string
+ */
+ public function getAccountType($storeId = null)
+ {
+ return $this->getConfigData('account_type', $storeId);
+ }
+
+ /**
* Google Account target country info
*
* @param int $storeId
Index: app/code/core/Mage/GoogleBase/controllers/ItemsController.php
===================================================================
--- app/code/core/Mage/GoogleBase/controllers/ItemsController.php (revision 44104)
+++ app/code/core/Mage/GoogleBase/controllers/ItemsController.php (revision 44105)
@@ -364,14 +364,21 @@
$result[] = $row;
continue;
}
- try {
- $xml = new Varien_Simplexml_Element($row);
- $error = $xml->getAttribute('reason');
- $result[] = $error;
- } catch (Exception $e) {
- continue;
+
+ // parse not well-formatted xml
+ preg_match_all('/(reason|field|type)=\"([^\"]+)\"/', $row, $matches);
+
+ if (is_array($matches) && count($matches) == 3) {
+ if (is_array($matches[1]) && count($matches[1]) > 0) {
+ $c = count($matches[1]);
+ for ($i = 0; $i < $c; $i++) {
+ if (isset($matches[2][$i])) {
+ $result[] = ucfirst($matches[1][$i]) . ': ' . $matches[2][$i];
+ }
+ }
+ }
}
}
- return implode(" ", $result);
+ return implode(". ", $result);
}
}
Index: app/code/core/Mage/GoogleBase/Block/Adminhtml/Types/Grid.php
===================================================================
--- app/code/core/Mage/GoogleBase/Block/Adminhtml/Types/Grid.php (revision 44104)
+++ app/code/core/Mage/GoogleBase/Block/Adminhtml/Types/Grid.php (revision 44105)
@@ -54,14 +54,12 @@
$this->addColumn('attribute_set_name',
array(
'header' => $this->__('Attributes Set'),
- 'width' => '150px',
'index' => 'attribute_set_name',
));
$this->addColumn('gbase_itemtype',
array(
'header' => $this->__('Google Base Item type'),
- 'width' => '150px',
'index' => 'gbase_itemtype',
));
Index: app/code/core/Mage/GoogleBase/etc/system.xml
===================================================================
--- app/code/core/Mage/GoogleBase/etc/system.xml (revision 44104)
+++ app/code/core/Mage/GoogleBase/etc/system.xml (revision 44105)
@@ -53,11 +53,20 @@
1
1
+
+ Account Type
+ select
+ googlebase/source_accounttype
+ 3
+ 1
+ 1
+ 1
+
Target Country
select
googlebase/source_country
- 3
+ 90
1
1
1
Index: app/code/core/Mage/GoogleBase/etc/config.xml
===================================================================
--- app/code/core/Mage/GoogleBase/etc/config.xml (revision 44104)
+++ app/code/core/Mage/GoogleBase/etc/config.xml (revision 44105)
@@ -193,6 +193,7 @@
US
+ HOSTED_OR_GOOGLE
United States
Index: app/code/core/Mage/Sales/Model/Mysql4/Sale/Collection.php
===================================================================
--- app/code/core/Mage/Sales/Model/Mysql4/Sale/Collection.php (revision 44104)
+++ app/code/core/Mage/Sales/Model/Mysql4/Sale/Collection.php (revision 44105)
@@ -95,6 +95,8 @@
->where('sales.customer_id=?', $this->_customer->getId());
}
+ Mage::dispatchEvent('sales_sale_collection_query_before', array('collection' => $this));
+
$this->printLogQuery($printQuery, $logQuery);
try {
$values = $this->_read->fetchAll($this->getSelect()->__toString());
@@ -123,6 +125,12 @@
return $this;
}
+ public function addStoreFilter($storeIds)
+ {
+ $this->getSelect()->where('store_id IN (?)', $storeIds);
+ return $this;
+ }
+
/**
* Print and/or log query
*
Index: app/code/core/Mage/Sales/Model/Order/Api.php
===================================================================
--- app/code/core/Mage/Sales/Model/Order/Api.php (revision 44104)
+++ app/code/core/Mage/Sales/Model/Order/Api.php (revision 44105)
@@ -163,8 +163,8 @@
Mage::getDesign()->setArea('frontend');
}
+ $order->save();
$order->sendOrderUpdateEmail($notify, $comment);
- $order->save();
if ($notify && $comment) {
Mage::getDesign()->setStore($oldStore);
Mage::getDesign()->setArea($oldArea);
Index: app/code/core/Mage/Sales/Model/Order/Pdf/Items/Shipment/Default.php
===================================================================
--- app/code/core/Mage/Sales/Model/Order/Pdf/Items/Shipment/Default.php (revision 44104)
+++ app/code/core/Mage/Sales/Model/Order/Pdf/Items/Shipment/Default.php (revision 44105)
@@ -20,7 +20,7 @@
*
* @category Mage
* @package Mage_Sales
- * @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
+ * @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)
*/
@@ -40,7 +40,6 @@
*/
public function draw()
{
- $order = $this->getOrder();
$item = $this->getItem();
$pdf = $this->getPdf();
$page = $this->getPage();
@@ -58,21 +57,30 @@
'feed' => 35
);
- if ($options = $this->getItemOptions()) {
+ // draw SKU
+ $lines[0][] = array(
+ 'text' => Mage::helper('core/string')->str_split($this->getSku($item), 25),
+ 'feed' => 440
+ );
+
+ // Custom options
+ $options = $this->getItemOptions();
+ if ($options) {
foreach ($options as $option) {
// draw options label
$lines[][] = array(
- 'text' => Mage::helper('core/string')->str_split(strip_tags($option['label']), 60, false, true),
+ 'text' => Mage::helper('core/string')->str_split(strip_tags($option['label']), 70, true, true),
'font' => 'italic',
'feed' => 60
);
+
// draw options value
if ($option['value']) {
$_printValue = isset($option['print_value']) ? $option['print_value'] : strip_tags($option['value']);
$values = explode(', ', $_printValue);
foreach ($values as $value) {
$lines[][] = array(
- 'text' => Mage::helper('core/string')->str_split($value, 55, true, true),
+ 'text' => Mage::helper('core/string')->str_split($value, 50, true, true),
'feed' => 65
);
}
@@ -80,12 +88,6 @@
}
}
- // draw SKU
- $lines[0][] = array(
- 'text' => Mage::helper('core/string')->str_split($this->getSku($item), 25),
- 'feed' => 440
- );
-
$lineBlock = array(
'lines' => $lines,
'height' => 10
Index: app/code/core/Mage/Sales/Model/Order/Pdf/Items/Creditmemo/Default.php
===================================================================
--- app/code/core/Mage/Sales/Model/Order/Pdf/Items/Creditmemo/Default.php (revision 44104)
+++ app/code/core/Mage/Sales/Model/Order/Pdf/Items/Creditmemo/Default.php (revision 44105)
@@ -40,67 +40,26 @@
$item = $this->getItem();
$pdf = $this->getPdf();
$page = $this->getPage();
- $shift = array(0, 10, 0);
+ $lines = array();
+
$leftBound = 35;
$rightBound = 565;
- // draw name
-// $this->_setFontRegular();
$x = $leftBound;
// draw Product name
$lines[0] = array(array(
'text' => Mage::helper('core/string')->str_split($item->getName(), 60, true, true),
'feed' => $x,
));
-// foreach (Mage::helper('core/string')->str_split($item->getName(), $x, true, true) as $key => $part) {
-// $page->drawText($part, $x, $pdf->y - $shift[0], 'UTF-8');
-// $shift[0] += 10;
-// }
- // draw options
- if ($options = $this->getItemOptions()) {
- foreach ($options as $option) {
- // draw options label
- // draw options label
- $lines[][] = array(
- 'text' => Mage::helper('core/string')->str_split(strip_tags($option['label']), 60, false, true),
- 'font' => 'italic',
- 'feed' => $x
- );
-//
-// $this->_setFontItalic();
-// foreach (Mage::helper('core/string')->str_split(strip_tags($option['label']), $x, false, true) as $_option) {
-// $page->drawText($_option, $x, $pdf->y - $shift[0], 'UTF-8');
-// $shift[0] += 10;
-// }
- // draw options value
-
-// $this->_setFontRegular();
- $_printValue = isset($option['print_value']) ? $option['print_value'] : strip_tags($option['value']);
- $lines[][] = array(
- 'text' => Mage::helper('core/string')->str_split($_printValue, 55, true, true),
- 'feed' => $x + 5
- );
-// foreach (Mage::helper('core/string')->str_split($_printValue, $x, true, true) as $_value) {
-// $page->drawText($_value, $x + 5, $pdf->y - $shift[0], 'UTF-8');
-// $shift[0] += 10;
-// }
- }
- }
-
$x += 220;
-
// draw SKU
$lines[0][] = array(
'text' => Mage::helper('core/string')->str_split($this->getSku($item), 25),
'feed' => $x
);
-// foreach (Mage::helper('core/string')->str_split($this->getSku($item), 25) as $key => $part) {
-// $page->drawText($part, $x, $pdf->y - $shift[2], 'UTF-8');
-// $shift[2] += 10;
-// }
- $x += 100;
+ $x += 100;
// draw Total (ex)
$lines[0][] = array(
'text' => $order->formatPriceTxt($item->getRowTotal()),
@@ -109,8 +68,8 @@
'align' => 'right',
'width' => 50,
);
- $x += 50;
+ $x += 50;
// draw Discount
$lines[0][] = array(
'text' => $order->formatPriceTxt(-$item->getDiscountAmount()),
@@ -119,8 +78,8 @@
'align' => 'right',
'width' => 50,
);
- $x += 50;
+ $x += 50;
// draw QTY
$lines[0][] = array(
'text' => $item->getQty()*1,
@@ -129,8 +88,8 @@
'align' => 'center',
'width' => 30,
);
- $x += 30;
+ $x += 30;
// draw Tax
$lines[0][] = array(
'text' => $order->formatPriceTxt($item->getTaxAmount()),
@@ -139,8 +98,8 @@
'align' => 'right',
'width' => 45,
);
- $x += 45;
+ $x += 45;
// draw Subtotal
$lines[0][] = array(
'text' => $order->formatPriceTxt($item->getRowTotal() + $item->getTaxAmount() - $item->getDiscountAmount()),
@@ -149,33 +108,26 @@
'align' => 'right'
);
-// $font = $this->_setFontBold();
+ // draw options
+ $options = $this->getItemOptions();
+ if ($options) {
+ foreach ($options as $option) {
+ // draw options label
+ $lines[][] = array(
+ 'text' => Mage::helper('core/string')->str_split(strip_tags($option['label']), 70, true, true),
+ 'font' => 'italic',
+ 'feed' => $leftBound
+ );
- // draw Total(ex)
-// $text = $order->formatPriceTxt($item->getRowTotal());
-// $page->drawText($text, $pdf->getAlignRight($text, $x, 50, $font, 7), $pdf->y, 'UTF-8');
-// $x += 50;
-//
-// // draw Discount
-// $text = $order->formatPriceTxt(-$item->getDiscountAmount());
-// $page->drawText($text, $pdf->getAlignRight($text, $x, 50, $font, 7), $pdf->y, 'UTF-8');
-// $x += 50;
-//
-// // draw QTY
-// $text = $item->getQty() * 1;
-// $page->drawText($text, $pdf->getAlignCenter($text, $x, 30, $font, 7), $pdf->y, 'UTF-8');
-// $x += 30;
-//
-// // draw Tax
-// $text = $order->formatPriceTxt($item->getTaxAmount());
-// $page->drawText($text, $pdf->getAlignRight($text, $x, 45, $font, 7, 10), $pdf->y, 'UTF-8');
-// $x += 45;
-//
-// // draw Total(inc)
-// $text = $order->formatPriceTxt($item->getRowTotal() + $item->getTaxAmount() - $item->getDiscountAmount());
-// $page->drawText($text, $pdf->getAlignRight($text, $x, $rightBound - $x, $font, 7, 0), $pdf->y, 'UTF-8');
-//
-// $pdf->y -= max($shift) + 10;
+ // draw options value
+ $_printValue = isset($option['print_value']) ? $option['print_value'] : strip_tags($option['value']);
+ $lines[][] = array(
+ 'text' => Mage::helper('core/string')->str_split($_printValue, 50, true, true),
+ 'feed' => $leftBound + 5
+ );
+ }
+ }
+
$lineBlock = array(
'lines' => $lines,
'height' => 10
@@ -184,4 +136,4 @@
$page = $pdf->drawLineBlocks($page, array($lineBlock), array('table_header' => true));
$this->setPage($page);
}
-}
\ No newline at end of file
+}
Index: app/code/core/Mage/Sales/Model/Order/Pdf/Items/Abstract.php
===================================================================
--- app/code/core/Mage/Sales/Model/Order/Pdf/Items/Abstract.php (revision 44104)
+++ app/code/core/Mage/Sales/Model/Order/Pdf/Items/Abstract.php (revision 44105)
@@ -226,6 +226,11 @@
}
}
+ /**
+ * @deprecated To be Removed on next release
+ *
+ * @return array
+ */
protected function _parseDescription()
{
$description = $this->getItem()->getDescription();
Index: app/code/core/Mage/Sales/Model/Order/Pdf/Items/Invoice/Default.php
===================================================================
--- app/code/core/Mage/Sales/Model/Order/Pdf/Items/Invoice/Default.php (revision 44104)
+++ app/code/core/Mage/Sales/Model/Order/Pdf/Items/Invoice/Default.php (revision 44105)
@@ -55,7 +55,7 @@
// draw SKU
$lines[0][] = array(
'text' => Mage::helper('core/string')->str_split($this->getSku($item), 25),
- 'feed' => 240
+ 'feed' => 255
);
// draw QTY
@@ -64,28 +64,6 @@
'feed' => 435
);
- if ($options = $this->getItemOptions()) {
- foreach ($options as $option) {
- // draw options label
- $lines[][] = array(
- 'text' => Mage::helper('core/string')->str_split(strip_tags($option['label']), 60, false, true),
- 'font' => 'italic',
- 'feed' => 35
- );
-
- if ($option['value']) {
- $_printValue = isset($option['print_value']) ? $option['print_value'] : strip_tags($option['value']);
- $values = explode(', ', $_printValue);
- foreach ($values as $value) {
- $lines[][] = array(
- 'text' => Mage::helper('core/string')->str_split($value, 55, true, true),
- 'feed' => 40
- );
- }
- }
- }
- }
-
// draw Price
$lines[0][] = array(
'text' => $order->formatPriceTxt($item->getPrice()),
@@ -110,6 +88,30 @@
'align' => 'right'
);
+ // custom options
+ $options = $this->getItemOptions();
+ if ($options) {
+ foreach ($options as $option) {
+ // draw options label
+ $lines[][] = array(
+ 'text' => Mage::helper('core/string')->str_split(strip_tags($option['label']), 70, true, true),
+ 'font' => 'italic',
+ 'feed' => 35
+ );
+
+ if ($option['value']) {
+ $_printValue = isset($option['print_value']) ? $option['print_value'] : strip_tags($option['value']);
+ $values = explode(', ', $_printValue);
+ foreach ($values as $value) {
+ $lines[][] = array(
+ 'text' => Mage::helper('core/string')->str_split($value, 50, true, true),
+ 'feed' => 40
+ );
+ }
+ }
+ }
+ }
+
$lineBlock = array(
'lines' => $lines,
'height' => 10
Index: app/code/core/Mage/Sales/Model/Order/Pdf/Invoice.php
===================================================================
--- app/code/core/Mage/Sales/Model/Order/Pdf/Invoice.php (revision 44104)
+++ app/code/core/Mage/Sales/Model/Order/Pdf/Invoice.php (revision 44105)
@@ -77,8 +77,8 @@
/* Add table head */
$page->setFillColor(new Zend_Pdf_Color_RGB(0.4, 0.4, 0.4));
- $page->drawText(Mage::helper('sales')->__('Product'), 35, $this->y, 'UTF-8');
- $page->drawText(Mage::helper('sales')->__('SKU'), 240, $this->y, 'UTF-8');
+ $page->drawText(Mage::helper('sales')->__('Products'), 35, $this->y, 'UTF-8');
+ $page->drawText(Mage::helper('sales')->__('SKU'), 255, $this->y, 'UTF-8');
$page->drawText(Mage::helper('sales')->__('Price'), 380, $this->y, 'UTF-8');
$page->drawText(Mage::helper('sales')->__('QTY'), 430, $this->y, 'UTF-8');
$page->drawText(Mage::helper('sales')->__('Tax'), 480, $this->y, 'UTF-8');
@@ -138,7 +138,7 @@
$page->setFillColor(new Zend_Pdf_Color_RGB(0.4, 0.4, 0.4));
$page->drawText(Mage::helper('sales')->__('Product'), 35, $this->y, 'UTF-8');
- $page->drawText(Mage::helper('sales')->__('SKU'), 240, $this->y, 'UTF-8');
+ $page->drawText(Mage::helper('sales')->__('SKU'), 255, $this->y, 'UTF-8');
$page->drawText(Mage::helper('sales')->__('Price'), 380, $this->y, 'UTF-8');
$page->drawText(Mage::helper('sales')->__('QTY'), 430, $this->y, 'UTF-8');
$page->drawText(Mage::helper('sales')->__('Tax'), 480, $this->y, 'UTF-8');
Index: app/code/core/Mage/Sales/Model/Order/Pdf/Abstract.php
===================================================================
--- app/code/core/Mage/Sales/Model/Order/Pdf/Abstract.php (revision 44104)
+++ app/code/core/Mage/Sales/Model/Order/Pdf/Abstract.php (revision 44105)
@@ -166,7 +166,7 @@
protected function _formatAddress($address)
{
$return = array();
- foreach (split("\|", $address) as $str) {
+ foreach (split('\|', $address) as $str) {
foreach (Mage::helper('core/string')->str_split($str, 65, true, true) as $part) {
if (empty($part)) {
continue;
Index: app/code/core/Mage/Sales/Model/Order/Shipment.php
===================================================================
--- app/code/core/Mage/Sales/Model/Order/Shipment.php (revision 44104)
+++ app/code/core/Mage/Sales/Model/Order/Shipment.php (revision 44105)
@@ -471,6 +471,7 @@
Mage::helper('sales')->__('Cannot create an empty shipment.')
);
}
+ return parent::_beforeSave();
}
protected function _beforeDelete()
Index: app/code/core/Mage/Sales/Model/Quote/Payment.php
===================================================================
--- app/code/core/Mage/Sales/Model/Quote/Payment.php (revision 44104)
+++ app/code/core/Mage/Sales/Model/Quote/Payment.php (revision 44105)
@@ -107,7 +107,7 @@
}
$method->prepareSave();
if ($this->getQuote()) {
- $this->setParentId($this->getQuote()->getId());
+ $this->setQuoteId($this->getQuote()->getId());
}
return parent::_beforeSave();
}
Index: app/code/core/Mage/Sales/Model/Quote/Item.php
===================================================================
--- app/code/core/Mage/Sales/Model/Quote/Item.php (revision 44104)
+++ app/code/core/Mage/Sales/Model/Quote/Item.php (revision 44105)
@@ -288,6 +288,10 @@
$itemOptions = $this->getOptions();
$productOptions = $product->getCustomOptions();
+ if (count($itemOptions) != count($productOptions)) {
+ return false;
+ }
+
foreach ($itemOptions as $option) {
$code = $option->getCode();
if (in_array($code, $this->_notRepresentOptions )) {
Index: app/code/core/Mage/Sales/Model/Quote/Address/Total/Discount.php
===================================================================
--- app/code/core/Mage/Sales/Model/Quote/Address/Total/Discount.php (revision 44104)
+++ app/code/core/Mage/Sales/Model/Quote/Address/Total/Discount.php (revision 44105)
@@ -75,11 +75,6 @@
*/
if ($item->getHasChildren() && $item->isChildrenCalculated()) {
- $eventArgs['item'] = $item;
- Mage::dispatchEvent('sales_quote_address_discount_item', $eventArgs);
- if ($item->getDiscountAmount() || $item->getFreeShipping()) {
- $hasDiscount = true;
- }
foreach ($item->getChildren() as $child) {
$eventArgs['item'] = $child;
Mage::dispatchEvent('sales_quote_address_discount_item', $eventArgs);
Index: app/code/core/Mage/Sales/Model/Quote/Item/Abstract.php
===================================================================
--- app/code/core/Mage/Sales/Model/Quote/Item/Abstract.php (revision 44104)
+++ app/code/core/Mage/Sales/Model/Quote/Item/Abstract.php (revision 44105)
@@ -359,6 +359,26 @@
}
/**
+ * Get item base tax amount
+ *
+ * @return decimal
+ */
+ public function getBaseTaxAmount()
+ {
+ $priceType = $this->getProduct()->getPriceType();
+ if ($this->getHasChildren() && (null !== $priceType) && (int)$priceType === Mage_Catalog_Model_Product_Type_Abstract::CALCULATE_CHILD) {
+ $baseAmount = 0;
+ foreach ($this->getChildren() as $child) {
+ $baseAmount+= $child->getBaseTaxAmount();
+ }
+ return $baseAmount;
+ }
+ else {
+ return $this->_getData('base_tax_amount');
+ }
+ }
+
+ /**
* Get item price (item price always exclude price)
*
* @return decimal
Index: app/code/core/Mage/Compiler/Model/Process.php
===================================================================
--- app/code/core/Mage/Compiler/Model/Process.php (revision 44104)
+++ app/code/core/Mage/Compiler/Model/Process.php (revision 44105)
@@ -41,6 +41,8 @@
protected $_includePaths = array();
protected $_processedClasses= array();
+ protected $_controllerFolders = array();
+
public function __construct($options=array())
{
if (isset($options['compile_dir'])) {
@@ -102,6 +104,7 @@
}
$sourceFile = $source . DS . $file;
if ($file == 'controllers') {
+ $this->_controllerFolders[] = $sourceFile;
continue;
}
@@ -144,6 +147,57 @@
}
/**
+ * Copy controllers with folders structure
+ *
+ * @param string $basePath base include path where files are located
+ * @return Mage_Compiler_Model_Process
+ */
+ protected function _copyControllers($basePath)
+ {
+ foreach ($this->_controllerFolders as $path) {
+ $relPath = str_replace($basePath, '', $path);
+ $relPath = trim($relPath, DS);
+ $arrDirs = explode(DS, $relPath);
+ $destPath = $this->_includeDir;
+ foreach ($arrDirs as $dir) {
+ $destPath.= DS.$dir;
+ $this->_mkdir($destPath);
+ }
+ $this->_copyAll($path, $destPath);
+ }
+ return $this;
+ }
+
+ /**
+ * Copy all files and subfolders
+ *
+ * @param string $source
+ * @param string $target
+ * @return Mage_Compiler_Model_Process
+ */
+ protected function _copyAll($source, $target)
+ {
+ if (is_dir($source)) {
+ $this->_mkdir($target);
+ $dir = dir($source);
+ while (false !== ($file = $dir->read())) {
+ if (($file[0] == '.')) {
+ continue;
+ }
+ $sourceFile = $source . DS . $file;
+ $targetFile = $target . DS . $file;
+ $this->_copyAll($sourceFile, $targetFile);
+ }
+ } else {
+ if (!in_array(substr($source, strlen($source)-4, 4), array('.php'))) {
+ return $this;
+ }
+ copy($source, $target);
+ }
+ return $this;
+ }
+
+ /**
* Create directory if not exist
*
* @param string $dir
@@ -159,7 +213,8 @@
}
/**
- * Copy files from all include directories to one
+ * Copy files from all include directories to one.
+ * Lib files and controllers files will be copied as is
*
* @return Mage_Compiler_Model_Process
*/
@@ -168,10 +223,16 @@
$paths = $this->_getIncludePaths();
$paths = array_reverse($paths);
$destDir= $this->_includeDir;
+ $libDir = Mage::getBaseDir('lib');
$this->_mkdir($destDir);
foreach ($paths as $path) {
+ $this->_controllerFolders = array();
$this->_copy($path, $destDir);
+ $this->_copyControllers($path);
+ if ($path == $libDir) {
+ $this->_copyAll($libDir, $destDir);
+ }
}
$destDir.= DS.'Data';
@@ -370,7 +431,7 @@
{
$result = array();
if (!is_writeable($this->_compileDir)) {
- $result[] = Mage::helper('compiler')->__('Directory "%s" must be writeable', $this->_includeDir);
+ $result[] = Mage::helper('compiler')->__('Directory "%s" must be writeable', $this->_compileDir);
}
$file = $this->_compileDir.DS.'config.php';
if (!is_writeable($file)) {
Index: app/code/core/Mage/Compiler/controllers/ProcessController.php
===================================================================
--- app/code/core/Mage/Compiler/controllers/ProcessController.php (revision 44104)
+++ app/code/core/Mage/Compiler/controllers/ProcessController.php (revision 44105)
@@ -105,6 +105,6 @@
protected function _isAllowed()
{
- return Mage::getSingleton('admin/session')->isAllowed('compiler');
+ return Mage::getSingleton('admin/session')->isAllowed('system/tools/compiler');
}
}
\ No newline at end of file
Index: app/code/core/Mage/Eav/Model/Mysql4/Entity/Store.php
===================================================================
--- app/code/core/Mage/Eav/Model/Mysql4/Entity/Store.php (revision 44104)
+++ app/code/core/Mage/Eav/Model/Mysql4/Entity/Store.php (revision 44105)
@@ -25,13 +25,13 @@
*/
-class Mage_Eav_Model_Mysql4_Entity_Store extends Mage_Core_Model_Mysql4_Abstract
+class Mage_Eav_Model_Mysql4_Entity_Store extends Mage_Core_Model_Mysql4_Abstract
{
protected function _construct()
{
$this->_init('eav/entity_store', 'entity_store_id');
}
-
+
/**
* Load an object by entity type and store
*
@@ -42,9 +42,10 @@
*/
public function loadByEntityStore(Mage_Core_Model_Abstract $object, $entityTypeId, $storeId)
{
- $read = $this->_getReadAdapter();
+ $read = $this->_getWriteAdapter();
$select = $read->select()->from($this->getMainTable())
+ ->forUpdate(true)
->where('entity_type_id=?', $entityTypeId)
->where('store_id=?', $storeId);
$data = $read->fetchRow($select);
Index: app/code/core/Mage/Eav/Model/Entity/Attribute/Set.php
===================================================================
--- app/code/core/Mage/Eav/Model/Entity/Attribute/Set.php (revision 44104)
+++ app/code/core/Mage/Eav/Model/Entity/Attribute/Set.php (revision 44105)
@@ -153,12 +153,16 @@
*
* @param string $name
* @throws Mage_Core_Exception
+ * @return bool
*/
- public function validate($name)
+ public function validate()
{
- if (!$this->_getResource()->validate($this, $name)) {
- Mage::throwException(Mage::helper('eav')->__('Attribute set with the "%s" name already exists',$name));
+ if (!$this->_getResource()->validate($this, $this->getAttributeSetName())) {
+ Mage::throwException(
+ Mage::helper('eav')->__('Attribute set with the "%s" name already exists', $this->getAttributeSetName())
+ );
}
+ return true;
}
/**
Index: app/code/core/Mage/Eav/Model/Entity/Attribute/Backend/Abstract.php
===================================================================
--- app/code/core/Mage/Eav/Model/Entity/Attribute/Backend/Abstract.php (revision 44104)
+++ app/code/core/Mage/Eav/Model/Entity/Attribute/Backend/Abstract.php (revision 44105)
@@ -176,10 +176,11 @@
public function validate($object)
{
$attrCode = $this->getAttribute()->getAttributeCode();
- if ($this->getAttribute()->getIsRequired() && !$object->getData($attrCode)) {
+ $value = $object->getData($attrCode);
+ if ($this->getAttribute()->getIsRequired() && $this->getAttribute()->isValueEmpty($value)) {
return false;
}
- $value = $object->getData($this->getAttribute()->getAttributeCode());
+
if ($this->getAttribute()->getIsUnique() && !$this->getAttribute()->getIsRequired() && ($value == '' || $this->getAttribute()->isValueEmpty($value))) {
return true;
}
Index: app/code/core/Mage/Eav/Model/Entity/Setup.php
===================================================================
--- app/code/core/Mage/Eav/Model/Entity/Setup.php (revision 44104)
+++ app/code/core/Mage/Eav/Model/Entity/Setup.php (revision 44105)
@@ -540,6 +540,7 @@
'frontend_input' => $this->_getValue($attr, 'input', 'text'),
'frontend_input_renderer' => $this->_getValue($attr, 'input_renderer', ''),
'frontend_label' => $this->_getValue($attr, 'label', ''),
+ 'frontend_class' => $this->_getValue($attr, 'frontend_class', ''),
'source_model' => $this->_getValue($attr, 'source', ''),
'is_global' => $this->_getValue($attr, 'global', 1),
'is_visible' => $this->_getValue($attr, 'visible', 1),
Index: app/code/core/Mage/Eav/Model/Entity/Type.php
===================================================================
--- app/code/core/Mage/Eav/Model/Entity/Type.php (revision 44104)
+++ app/code/core/Mage/Eav/Model/Entity/Type.php (revision 44105)
@@ -155,6 +155,9 @@
//throw Mage::exception('Mage_Eav', Mage::helper('eav')->__('Valid store_id is expected!'));
}
+ // Start transaction to run SELECT ... FOR UPDATE
+ $this->_getResource()->beginTransaction();
+
$entityStoreConfig = Mage::getModel('eav/entity_store')
->loadByEntityStore($this->getId(), $storeId);
@@ -182,6 +185,9 @@
$entityStoreConfig->setIncrementLastId($incrementId);
$entityStoreConfig->save();
+ // Commit increment_last_id changes
+ $this->_getResource()->commit();
+
return $incrementId;
}
Index: app/code/core/Mage/Eav/Model/Entity/Abstract.php
===================================================================
--- app/code/core/Mage/Eav/Model/Entity/Abstract.php (revision 44104)
+++ app/code/core/Mage/Eav/Model/Entity/Abstract.php (revision 44105)
@@ -711,14 +711,27 @@
* Validate all object's attributes against configuration
*
* @param Varien_Object $object
- * @return Varien_Object
+ * @throws Mage_Eav_Model_Entity_Attribute_Exception
+ * @return bool|array
*/
public function validate($object)
{
$this->loadAllAttributes($object);
- $this->walkAttributes('backend/validate', array($object));
+ $result = $this->walkAttributes('backend/validate', array($object));
+ $errors = array();
+ foreach ($result as $attributeCode => $error) {
+ if ($error === false) {
+ $errors[$attributeCode] = true;
+ }
+ elseif (is_string($error)) {
+ $errors[$attributeCode] = $error;
+ }
+ }
+ if (!$errors) {
+ return true;
+ }
- return $this;
+ return $errors;
}
/**
Index: app/code/core/Mage/Tag/Model/Mysql4/Tag/Relation.php
===================================================================
--- app/code/core/Mage/Tag/Model/Mysql4/Tag/Relation.php (revision 44104)
+++ app/code/core/Mage/Tag/Model/Mysql4/Tag/Relation.php (revision 44105)
@@ -34,51 +34,72 @@
class Mage_Tag_Model_Mysql4_Tag_Relation extends Mage_Core_Model_Mysql4_Abstract
{
+ /**
+ * Initialize resource connection and define table resource
+ *
+ */
protected function _construct()
{
$this->_init('tag/relation', 'tag_relation_id');
}
+ /**
+ * Load by Tag and Customer
+ *
+ * @param Mage_Tag_Model_Tag_Relation $model
+ * @return Mage_Tag_Model_Mysql4_Tag_Relation
+ */
public function loadByTagCustomer($model)
{
- if( $model->getTagId() && $model->getCustomerId() ) {
+ if ($model->getTagId() && $model->getCustomerId()) {
$read = $this->_getReadAdapter();
- $select = $read->select();
-
- $select->from($this->getMainTable())
+ $select = $read->select()
+ ->from($this->getMainTable())
->join($this->getTable('tag/tag'), "{$this->getTable('tag/tag')}.tag_id = {$this->getMainTable()}.tag_id")
->where("{$this->getMainTable()}.tag_id = ?", $model->getTagId())
->where('customer_id = ?', $model->getCustomerId());
- if( $model->getProductId() ) {
+ if ($model->getProductId()) {
$select->where("{$this->getMainTable()}.product_id = ?", $model->getProductId());
}
- if( $model->hasStoreId() ) {
+ if ($model->hasStoreId()) {
$select->where("{$this->getMainTable()}.store_id = ?", $model->getStoreId());
}
$data = $read->fetchRow($select);
$model->setData( ( is_array($data) ) ? $data : array() );
- return $this;
- } else {
- return $this;
}
+
+ return $this;
}
+ /**
+ * Retrieve Tagged Products
+ *
+ * @param Mage_Tag_Model_Tag_Relation $model
+ * @return array
+ */
public function getProductIds($model)
{
$select = $this->_getReadAdapter()->select()
->from($this->getMainTable(), 'product_id')
- ->where("tag_id = ?", $model->getTagId())
+ ->where("tag_id=?", $model->getTagId())
->where('customer_id=?', $model->getCustomerId())
->where('active=1');
- if( $model->hasStoreId() ) {
+ if ($model->hasStoreId()) {
$select->where('store_id = ?', $model->getStoreId());
}
return $this->_getReadAdapter()->fetchCol($select);
}
+ /**
+ * Deactivate tag relations by tag and customer
+ *
+ * @param int $tagId
+ * @param int $customerId
+ * @return Mage_Tag_Model_Mysql4_Tag_Relation
+ */
public function deactivate($tagId, $customerId)
{
$condition = $this->_getWriteAdapter()->quoteInto('tag_id = ?', $tagId) . ' AND ';
@@ -87,4 +108,4 @@
$this->_getWriteAdapter()->update($this->getMainTable(), $data, $condition);
return $this;
}
-}
\ No newline at end of file
+}
Index: app/code/core/Mage/Tag/Model/Tag/Relation.php
===================================================================
--- app/code/core/Mage/Tag/Model/Tag/Relation.php (revision 44104)
+++ app/code/core/Mage/Tag/Model/Tag/Relation.php (revision 44105)
@@ -20,27 +20,50 @@
*
* @category Mage
* @package Mage_Tag
- * @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
+ * @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)
*/
+
/**
* Tag relation model
*
* @category Mage
* @package Mage_Tag
- * @author Magento Core Team
+ * @author Magento Core Team
*/
-
class Mage_Tag_Model_Tag_Relation extends Mage_Core_Model_Abstract
{
const STATUS_ACTIVE = 1;
+ /**
+ * Initialize resource model
+ *
+ */
protected function _construct()
{
$this->_init('tag/tag_relation');
}
+ /**
+ * Retrieve Resource Instance wrapper
+ *
+ * @return Mage_Tag_Model_Mysql4_Tag_Relation
+ */
+ protected function _getResource()
+ {
+ return parent::_getResource();
+ }
+
+ /**
+ * Load relation by Product (optional), tag, customer and store
+ *
+ * @param int $productId
+ * @param int $tagId
+ * @param int $customerId
+ * @param int $storeId
+ * @return Mage_Tag_Model_Tag_Relation
+ */
public function loadByTagCustomer($productId=null, $tagId, $customerId, $storeId=null)
{
$this->setProductId($productId);
@@ -53,6 +76,11 @@
return $this;
}
+ /**
+ * Retrieve Relation Product Ids
+ *
+ * @return array
+ */
public function getProductIds()
{
$ids = $this->getData('product_ids');
@@ -63,9 +91,14 @@
return $ids;
}
+ /**
+ * Deactivate tag relations (using current settings)
+ *
+ * @return Mage_Tag_Model_Tag_Relation
+ */
public function deactivate()
{
$this->_getResource()->deactivate($this->getTagId(), $this->getCustomerId());
return $this;
}
-}
\ No newline at end of file
+}
Index: app/code/core/Mage/Tag/controllers/CustomerController.php
===================================================================
--- app/code/core/Mage/Tag/controllers/CustomerController.php (revision 44104)
+++ app/code/core/Mage/Tag/controllers/CustomerController.php (revision 44105)
@@ -159,24 +159,29 @@
return;
}
- if($tagId) {
+ if ($tagId) {
try {
$productId = 0;
- $isNew = false;
$message = false;
$storeId = Mage::app()->getStore()->getId();
$tagModel = Mage::getModel('tag/tag');
$tagModel->load($tagId);
- if( $tagModel->getName() != $tagName ) {
+ /* @var $tagRelationModel Mage_Tag_Model_Tag_Relation */
+ $tagRelationModel = Mage::getModel('tag/tag_relation');
+ // rename isset tag
+ if ($tagModel->getName() != $tagName) {
+ // deactivate old tagged products
+ $tagRelationModel->loadByTagCustomer(null, $tagModel->getId(), $customerId, $storeId)
+ ->deactivate();
+
$tagModel->loadByName($tagName);
if($tagModel->getId()) {
$status = $tagModel->getStatus();
}
else {
- $isNew = true;
$message= Mage::helper('tag')->__('Thank you. Your tag has been accepted for moderation.');
$status = $tagModel->getPendingStatus();
}
@@ -187,19 +192,18 @@
->save();
}
- $tagRalationModel = Mage::getModel('tag/tag_relation');
- $tagRalationModel->loadByTagCustomer(null, $tagId, $customerId, $storeId);
+ $tagRelationModel->loadByTagCustomer(null, $tagId, $customerId, $storeId);
- if ($tagRalationModel->getCustomerId() == $customerId ) {
- $productIds = $tagRalationModel->getProductIds();
- if ($tagRalationModel->getTagId()!=$tagModel->getId()) {
- $tagRalationModel->deactivate();
+ if ($tagRelationModel->getCustomerId() == $customerId ) {
+ $productIds = $tagRelationModel->getProductIds();
+ if ($tagRelationModel->getTagId()!=$tagModel->getId()) {
+ $tagRelationModel->deactivate();
} else {
- $tagRalationModel->delete();
+ $tagRelationModel->delete();
}
foreach ($productIds as $productId) {
- $newTagRalationModel = Mage::getModel('tag/tag_relation')
+ Mage::getModel('tag/tag_relation')
->setTagId($tagModel->getId())
->setCustomerId($customerId)
->setStoreId($storeId)
@@ -209,16 +213,21 @@
}
}
- if( $tagModel->getId() ) {
+ if ($tagModel->getId()) {
$tagModel->aggregate();
$this->getResponse()->setRedirect(Mage::getUrl('*/*/'));
}
+
$message = ($message) ? $message : Mage::helper('tag')->__('Your tag was successfully saved');
Mage::getSingleton('tag/session')->addSuccess($message);
$this->_redirect('*/*/');
return;
- } catch (Exception $e) {
- Mage::getSingleton('tag/session')->addError(
+ }
+ catch (Mage_Core_Exception $e) {
+ Mage::getSingleton('tag/session')->addError($e->getMessage());
+ }
+ catch (Exception $e) {
+ Mage::getSingleton('tag/session')->addException($e,
Mage::helper('tag')->__('Unable to save your tag. Please, try again later.')
);
}
Index: app/code/core/Mage/Tag/Block/Product/Result.php
===================================================================
--- app/code/core/Mage/Tag/Block/Product/Result.php (revision 44104)
+++ app/code/core/Mage/Tag/Block/Product/Result.php (revision 44105)
@@ -85,7 +85,8 @@
->addTagFilter($this->getTag()->getId())
->addStoreFilter()
->addMinimalPrice()
- ->addUrlRewrite();
+ ->addUrlRewrite()
+ ->setActiveFilter();
Mage::getSingleton('catalog/product_status')->addSaleableFilterToCollection($this->_productCollection);
Mage::getSingleton('catalog/product_visibility')->addVisibleInSiteFilterToCollection($this->_productCollection);
}
Index: app/etc/local.xml.additional
===================================================================
--- app/etc/local.xml.additional (revision 44104)
+++ app/etc/local.xml.additional (revision 44105)
@@ -51,5 +51,9 @@
-
+
+ HTTP_X_REAL_IP
+ HTTP_X_FORWARDED_FOR
+
+
Index: app/etc/local.xml.template
===================================================================
--- app/etc/local.xml.template (revision 44104)
+++ app/etc/local.xml.template (revision 44105)
@@ -49,8 +49,8 @@
{{session_save}}
-
-
+
+
@@ -58,5 +58,5 @@
-
+
Index: app/etc/modules/Mage_All.xml
===================================================================
--- app/etc/modules/Mage_All.xml (revision 44104)
+++ app/etc/modules/Mage_All.xml (revision 44105)
@@ -110,22 +110,31 @@
-
+
true
core
+
+
-
-
+
+
true
core
-
-
+
+
-
+
+
+ true
+ core
+
+
+
+
true
core
@@ -365,15 +374,6 @@
-
- true
- core
-
-
-
-
-
-
true
core
Index: downloader/Maged/Controller.php
===================================================================
--- downloader/Maged/Controller.php (revision 44104)
+++ downloader/Maged/Controller.php (revision 44105)
@@ -374,7 +374,7 @@
public function isWritable()
{
if (is_null($this->_writable)) {
- $this->_writable = is_writable($this->getMageDir())
+ $this->_writable = is_writable($this->getMageDir() . DIRECTORY_SEPARATOR)
&& is_writable($this->filepath())
&& (!file_exists($this->filepath('config.ini') || is_writable($this->filepath('config.ini'))))
&& (!file_exists($this->filepath('pearlib/config.ini') || is_writable($this->filepath('pearlib/pear.ini'))))
Index: skin/frontend/default/iphone/js/opcheckout.js
===================================================================
--- skin/frontend/default/iphone/js/opcheckout.js (revision 44104)
+++ skin/frontend/default/iphone/js/opcheckout.js (revision 44105)
@@ -772,6 +772,16 @@
}
alert(msg);
}
+
+ if (response.update_section) {
+ $('checkout-'+response.update_section.name+'-load').update(response.update_section.html);
+ response.update_section.html.evalScripts();
+ }
+
+ if (response.goto_section) {
+ checkout.gotoSection(response.goto_section);
+ checkout.reloadProgressBlock();
+ }
}
},
Index: skin/frontend/default/default/js/opcheckout.js
===================================================================
--- skin/frontend/default/default/js/opcheckout.js (revision 44104)
+++ skin/frontend/default/default/js/opcheckout.js (revision 44105)
@@ -777,6 +777,16 @@
}
alert(msg);
}
+
+ if (response.update_section) {
+ $('checkout-'+response.update_section.name+'-load').update(response.update_section.html);
+ response.update_section.html.evalScripts();
+ }
+
+ if (response.goto_section) {
+ checkout.gotoSection(response.goto_section);
+ checkout.reloadProgressBlock();
+ }
}
},
Index: skin/frontend/default/modern/js/opcheckout.js
===================================================================
--- skin/frontend/default/modern/js/opcheckout.js (revision 44104)
+++ skin/frontend/default/modern/js/opcheckout.js (revision 44105)
@@ -793,6 +793,16 @@
}
alert(msg);
}
+
+ if (response.update_section) {
+ $('checkout-'+response.update_section.name+'-load').update(response.update_section.html);
+ response.update_section.html.evalScripts();
+ }
+
+ if (response.goto_section) {
+ checkout.gotoSection(response.goto_section);
+ checkout.reloadProgressBlock();
+ }
}
},
Index: skin/frontend/default/blank/js/opcheckout.js
===================================================================
--- skin/frontend/default/blank/js/opcheckout.js (revision 44104)
+++ skin/frontend/default/blank/js/opcheckout.js (revision 44105)
@@ -776,6 +776,16 @@
}
alert(msg);
}
+
+ if (response.update_section) {
+ $('checkout-'+response.update_section.name+'-load').update(response.update_section.html);
+ response.update_section.html.evalScripts();
+ }
+
+ if (response.goto_section) {
+ checkout.gotoSection(response.goto_section);
+ checkout.reloadProgressBlock();
+ }
}
},
Index: skin/frontend/default/blue/js/opcheckout.js
===================================================================
--- skin/frontend/default/blue/js/opcheckout.js (revision 44104)
+++ skin/frontend/default/blue/js/opcheckout.js (revision 44105)
@@ -777,6 +777,16 @@
}
alert(msg);
}
+
+ if (response.update_section) {
+ $('checkout-'+response.update_section.name+'-load').update(response.update_section.html);
+ response.update_section.html.evalScripts();
+ }
+
+ if (response.goto_section) {
+ checkout.gotoSection(response.goto_section);
+ checkout.reloadProgressBlock();
+ }
}
},
Index: lib/Zend/Gdata/App.php
===================================================================
--- lib/Zend/Gdata/App.php (revision 44104)
+++ lib/Zend/Gdata/App.php (revision 44105)
@@ -935,7 +935,7 @@
$foundClassName = null;
foreach ($this->_registeredPackages as $name) {
try {
- @#Zend_Loader::loadClass("${name}_${class}");
+ @Zend_Loader::loadClass("${name}_${class}");
$foundClassName = "${name}_${class}";
break;
} catch (Zend_Exception $e) {
Index: lib/Varien/Autoload.php
===================================================================
--- lib/Varien/Autoload.php (revision 44104)
+++ lib/Varien/Autoload.php (revision 44105)
@@ -103,7 +103,7 @@
static public function registerScope($code)
{
self::$_scope = $code;
- @include self::SCOPE_FILE_PREFIX.$code.'.php';
+ @include_once self::SCOPE_FILE_PREFIX.$code.'.php';
}
/**
Index: lib/Varien/Data/Collection.php
===================================================================
--- lib/Varien/Data/Collection.php (revision 44104)
+++ lib/Varien/Data/Collection.php (revision 44105)
@@ -455,7 +455,7 @@
* @param string $direction
* @return Varien_Data_Collection
*/
- public function setOrder($field, $direction = 'desc')
+ public function setOrder($field, $direction = self::SORT_ORDER_DESC)
{
$this->_orders[$field] = $direction;
return $this;
Index: lib/Varien/Data/Form/Element/Fieldset.php
===================================================================
--- lib/Varien/Data/Form/Element/Fieldset.php (revision 44104)
+++ lib/Varien/Data/Form/Element/Fieldset.php (revision 44105)
@@ -34,8 +34,21 @@
*/
class Varien_Data_Form_Element_Fieldset extends Varien_Data_Form_Element_Abstract
{
+ /**
+ * Sort child elements by specified data key
+ *
+ * @var string
+ */
+ protected $_sortChildrenByKey = '';
/**
+ * Children sort direction
+ *
+ * @var int
+ */
+ protected $_sortChildrenDirection = SORT_ASC;
+
+ /**
* Enter description here...
*
* @param array $attributes
@@ -72,7 +85,7 @@
public function getChildrenHtml()
{
$html = '';
- foreach ($this->getElements() as $element) {
+ foreach ($this->getSortedElements() as $element) {
if ($element->getType() != 'fieldset') {
$html.= $element->toHtml();
}
@@ -88,7 +101,7 @@
public function getSubFieldsetHtml()
{
$html = '';
- foreach ($this->getElements() as $element) {
+ foreach ($this->getSortedElements() as $element) {
if ($element->getType() == 'fieldset') {
$html.= $element->toHtml();
}
@@ -126,4 +139,48 @@
return $element;
}
+ /**
+ * Commence sorting elements by values by specified data key
+ *
+ * @param string $key
+ * @param int $direction
+ * @return Varien_Data_Form_Element_Fieldset
+ */
+ public function setSortElementsByAttribute($key, $direction = SORT_ASC)
+ {
+ $this->_sortChildrenByKey = $key;
+ $this->_sortDirection = $direction;
+ return $this;
+ }
+
+ /**
+ * Get sorted elements as array
+ *
+ * @return array
+ */
+ public function getSortedElements()
+ {
+ $elements = array();
+ // sort children by value by specified key
+ if ($this->_sortChildrenByKey) {
+ $sortKey = $this->_sortChildrenByKey;
+ $uniqueIncrement = 0; // in case if there are elements with same values
+ foreach ($this->getElements() as $e) {
+ $key = '_' . $uniqueIncrement;
+ if ($e->hasData($sortKey)) {
+ $key = $e->getDataUsingMethod($sortKey) . $key;
+ }
+ $elements[$key] = $e;
+ $uniqueIncrement++;
+ }
+ ksort($elements, $this->_sortChildrenDirection);
+ $elements = array_values($elements);
+ }
+ else {
+ foreach ($this->getElements() as $element) {
+ $elements[] = $element;
+ }
+ }
+ return $elements;
+ }
}
Index: lib/Varien/Data/Collection/Filesystem.php
===================================================================
--- lib/Varien/Data/Collection/Filesystem.php (revision 0)
+++ lib/Varien/Data/Collection/Filesystem.php (revision 44105)
@@ -0,0 +1,697 @@
+_allowedDirsMask = (string)$regex;
+ return $this;
+ }
+
+ /**
+ * Allowed files mask setter
+ * Set empty to not filter
+ *
+ * @param string $regex
+ * @return Varien_Data_Collection_Files
+ */
+ public function setFilesFilter($regex)
+ {
+ $this->_allowedFilesMask = (string)$regex;
+ return $this;
+ }
+
+ /**
+ * Disallowed files mask setter
+ * Set empty value to not use this filter
+ *
+ * @param string $regex
+ * @return Varien_Data_Collection_Files
+ */
+ public function setDisallowedFilesFilter($regex)
+ {
+ $this->_disallowedFilesMask = (string)$regex;
+ return $this;
+ }
+
+ /**
+ * Set whether to collect dirs
+ *
+ * @param bool $value
+ * @return Varien_Data_Collection_Filesystem
+ */
+ public function setCollectDirs($value)
+ {
+ $this->_collectDirs = (bool)$value;
+ return $this;
+ }
+
+ /**
+ * Set whether to collect files
+ *
+ * @param bool $value
+ * @return Varien_Data_Collection_Filesystem
+ */
+ public function setCollectFiles($value)
+ {
+ $this->_collectDirs = (bool)$value;
+ return $this;
+ }
+
+ /**
+ * Set whether to collect recursively
+ *
+ * @param bool $value
+ * @return Varien_Data_Collection_Filesystem
+ */
+ public function setCollectRecursively($value)
+ {
+ $this->_collectRecursively = (bool)$value;
+ return $this;
+ }
+
+ /**
+ * Target directory setter. Adds directory to be scanned
+ *
+ * @param string $value
+ * @return Varien_Data_Collection_Filesystem
+ */
+ public function addTargetDir($value)
+ {
+ $value = (string)$value;
+ if (!is_dir($value)) {
+ throw new Exception('Unable to set target directory.');
+ }
+ $this->_targetDirs[$value] = $value;
+ return $this;
+ }
+
+ /**
+ * Set whether to collect directories before files
+ * Works *before* sorting.
+ *
+ * @param bool $value
+ * @return Varien_Data_Collection_Filesystem
+ */
+ public function setDirsFirst($value)
+ {
+ $this->_dirsFirst = (bool)$value;
+ return $this;
+ }
+
+ /**
+ * Get files from specified directory recursively (if needed)
+ *
+ * @param string|array $dir
+ */
+ protected function _collectRecursive($dir)
+ {
+ $collectedResult = array();
+ if (!is_array($dir)) {
+ $dir = array($dir);
+ }
+ foreach ($dir as $folder) {
+ foreach (glob($folder . DIRECTORY_SEPARATOR . '*') as $node) {
+ $collectedResult[] = $node;
+ }
+ }
+ if (!is_array($collectedResult)) {
+ return;
+ }
+
+ foreach ($collectedResult as $item) {
+ if (is_dir($item) && (!$this->_allowedDirsMask || preg_match($this->_allowedDirsMask, basename($item)))) {
+ if ($this->_collectDirs) {
+ if ($this->_dirsFirst) {
+ $this->_collectedDirs[] = $item;
+ }
+ else {
+ $this->_collectedFiles[] = $item;
+ }
+ }
+ if ($this->_collectRecursively) {
+ $this->_collectRecursive($item);
+ }
+ }
+ elseif ($this->_collectFiles && is_file($item)
+ && (!$this->_allowedFilesMask || preg_match($this->_allowedFilesMask, basename($item)))
+ && (!$this->_disallowedFilesMask || !preg_match($this->_disallowedFilesMask, basename($item)))) {
+ $this->_collectedFiles[] = $item;
+ }
+ }
+ }
+
+ /**
+ * Lauch data collecting
+ *
+ * @param bool $printQuery
+ * @param bool $logQuery
+ * @return Varien_Data_Collection_Filesystem
+ */
+ public function loadData($printQuery = false, $logQuery = false)
+ {
+ if ($this->isLoaded()) {
+ return $this;
+ }
+ if (empty($this->_targetDirs)) {
+ throw new Exception('Please specify at least one target directory.');
+ }
+
+ $this->_collectedFiles = array();
+ $this->_collectedDirs = array();
+ $this->_collectRecursive($this->_targetDirs);
+ $this->_generateAndFilterAndSort('_collectedFiles');
+ if ($this->_dirsFirst) {
+ $this->_generateAndFilterAndSort('_collectedDirs');
+ $this->_collectedFiles = array_merge($this->_collectedDirs, $this->_collectedFiles);
+ }
+
+ // calculate totals
+ $this->_totalRecords = count($this->_collectedFiles);
+ $this->_setIsLoaded();
+
+ // paginate and add items
+ $from = ($this->getCurPage() - 1) * $this->getPageSize();
+ $to = $from + $this->getPageSize() - 1;
+ $cnt = 0;
+ foreach ($this->_collectedFiles as $row) {
+ $cnt++;
+ if ($cnt < $from || $cnt > $to) {
+ continue;
+ }
+ $item = new $this->_itemObjectClass();
+ $this->addItem($item->addData($row));
+ if (!$item->hasId()) {
+ $item->setId($cnt);
+ }
+ }
+
+ return $this;
+ }
+
+ /**
+ * With specified collected items:
+ * - generate data
+ * - apply filters
+ * - sort
+ *
+ * @param string $attributeName '_collectedFiles' | '_collectedDirs'
+ */
+ private function _generateAndFilterAndSort($attributeName)
+ {
+ // generate custom data (as rows with columns) basing on the filenames
+ foreach ($this->$attributeName as $key => $filename) {
+ $this->{$attributeName}[$key] = $this->_generateRow($filename);
+ }
+
+ // apply filters on generated data
+ if (!empty($this->_filters)) {
+ foreach ($this->$attributeName as $key => $row) {
+ if (!$this->_filterRow($row)) {
+ unset($this->{$attributeName}[$key]);
+ }
+ }
+ }
+
+ // sort (keys are lost!)
+ if (!empty($this->_orders)) {
+ usort($this->$attributeName, array($this, '_usort'));
+ }
+ }
+
+ /**
+ * Callback for sorting items
+ * Currently supports only sorting by one column
+ *
+ * @param array $a
+ * @param array $b
+ * @return int
+ */
+ protected function _usort($a, $b)
+ {
+ foreach ($this->_orders as $key => $direction) {
+ $result = $a[$key] > $b[$key] ? 1 : ($a[$key] < $b[$key] ? -1 : 0);
+ return (self::SORT_ORDER_ASC === strtoupper($direction) ? $result : -$result);
+ break;
+ }
+ }
+
+ /**
+ * Set select order
+ * Currently supports only sorting by one column
+ *
+ * @param string $field
+ * @param string $direction
+ * @return Varien_Data_Collection
+ */
+ public function setOrder($field, $direction = self::SORT_ORDER_DESC)
+ {
+ $this->_orders = array($field => $direction);
+ return $this;
+ }
+
+ /**
+ * Generate item row basing on the filename
+ *
+ * @param string $filename
+ * @return array
+ */
+ protected function _generateRow($filename)
+ {
+ return array(
+ 'filename' => $filename,
+ 'basename' => basename($filename),
+ );
+ }
+
+ /**
+ * Set a custom filter with callback
+ * The callback must take 3 params:
+ * string $field - field key,
+ * mixed $filterValue - value to filter by,
+ * array $row - a generated row (before generaring varien objects)
+ *
+ * @param string $field
+ * @param mixed $value
+ * @param string $type 'and'|'or'
+ * @param callback $callback
+ * @param bool $isInverted
+ * @return Varien_Data_Collection_Filesystem
+ */
+ public function addCallbackFilter($field, $value, $type, $callback, $isInverted = false)
+ {
+ $this->_filters[$this->_filterIncrement] = array(
+ 'field' => $field,
+ 'value' => $value,
+ 'is_and' => 'and' === $type,
+ 'callback' => $callback,
+ 'is_inverted' => $isInverted
+ );
+ $this->_filterIncrement++;
+ return $this;
+ }
+
+ /**
+ * The filters renderer and caller
+ * Aplies to each row, renders once.
+ *
+ * @param array $row
+ * @return bool
+ */
+ protected function _filterRow($row)
+ {
+ // render filters once
+ if (!$this->_isFiltersRendered) {
+ $eval = '';
+ for ($i = 0; $i < $this->_filterIncrement; $i++) {
+ if (isset($this->_filterBrackets[$i])) {
+ $eval .= $this->_renderConditionBeforeFilterElement($i, $this->_filterBrackets[$i]['is_and'])
+ . $this->_filterBrackets[$i]['value'];
+ }
+ else {
+ $f = '$this->_filters[' . $i . ']';
+ $eval .= $this->_renderConditionBeforeFilterElement($i, $this->_filters[$i]['is_and'])
+ . ($this->_filters[$i]['is_inverted'] ? '!' : '')
+ . '$this->_invokeFilter(' . "{$f}['callback'], array({$f}['field'], {$f}['value'], " . '$row))';
+ }
+ }
+ $this->_filterEvalRendered = $eval;
+ $this->_isFiltersRendered = true;
+ }
+ $result = false;
+ if ($this->_filterEvalRendered) {
+ eval('$result = ' . $this->_filterEvalRendered . ';');
+ }
+ return $result;
+ }
+
+ /**
+ * Invokes specified callback
+ * Skips, if there is no filtered key in the row
+ *
+ * @param callback $callback
+ * @param array $callbackParams
+ * @return bool
+ */
+ protected function _invokeFilter($callback, $callbackParams)
+ {
+ list($field, $value, $row) = $callbackParams;
+ if (!array_key_exists($field, $row)) {
+ return false;
+ }
+ return call_user_func_array($callback, $callbackParams);
+ }
+
+ /**
+ * Fancy field filter
+ *
+ * @param string $field
+ * @param mixed $cond
+ * @param string $type 'and' | 'or'
+ * @see Varien_Data_Collection_Db::addFieldToFilter()
+ * @return Varien_Data_Collection_Filesystem
+ */
+ public function addFieldToFilter($field, $cond, $type = 'and')
+ {
+ $inverted = true;
+
+ // simply check whether equals
+ if (!is_array($cond)) {
+ return $this->addCallbackFilter($field, $cond, $type, array($this, 'filterCallbackEq'));
+ }
+
+ // versatile filters
+ if (isset($cond['from']) || isset($cond['to'])) {
+ $this->_addFilterBracket('(', 'and' === $type);
+ if (isset($cond['from'])) {
+ $this->addCallbackFilter($field, $cond['from'], 'and', array($this, 'filterCallbackIsLessThan'), $inverted);
+ }
+ if (isset($cond['to'])) {
+ $this->addCallbackFilter($field, $cond['to'], 'and', array($this, 'filterCallbackIsMoreThan'), $inverted);
+ }
+ return $this->_addFilterBracket(')');
+ }
+ if (isset($cond['eq'])) {
+ return $this->addCallbackFilter($field, $cond['eq'], $type, array($this, 'filterCallbackEq'));
+ }
+ if (isset($cond['neq'])) {
+ return $this->addCallbackFilter($field, $cond['neq'], $type, array($this, 'filterCallbackEq'), $inverted);
+ }
+ if (isset($cond['like'])) {
+ return $this->addCallbackFilter($field, $cond['like'], $type, array($this, 'filterCallbackLike'));
+ }
+ if (isset($cond['nlike'])) {
+ return $this->addCallbackFilter($field, $cond['nlike'], $type, array($this, 'filterCallbackLike'), $inverted);
+ }
+ if (isset($cond['in'])) {
+ return $this->addCallbackFilter($field, $cond['in'], $type, array($this, 'filterCallbackInArray'));
+ }
+ if (isset($cond['nin'])) {
+ return $this->addCallbackFilter($field, $cond['nin'], $type, array($this, 'filterCallbackIn'), $inverted);
+ }
+ if (isset($cond['notnull'])) {
+ return $this->addCallbackFilter($field, $cond['notnull'], $type, array($this, 'filterCallbackIsNull'), $inverted);
+ }
+ if (isset($cond['null'])) {
+ return $this->addCallbackFilter($field, $cond['null'], $type, array($this, 'filterCallbackIsNull'));
+ }
+ if (isset($cond['moreq'])) {
+ return $this->addCallbackFilter($field, $cond['moreq'], $type, array($this, 'filterCallbackIsLessThan'), $inverted);
+ }
+ if (isset($cond['gt'])) {
+ return $this->addCallbackFilter($field, $cond['gt'], $type, array($this, 'filterCallbackIsMoreThan'));
+ }
+ if (isset($cond['lt'])) {
+ return $this->addCallbackFilter($field, $cond['lt'], $type, array($this, 'filterCallbackIsLessThan'));
+ }
+ if (isset($cond['gteq'])) {
+ return $this->addCallbackFilter($field, $cond['gteq'], $type, array($this, 'filterCallbackIsLessThan'), $inverted);
+ }
+ if (isset($cond['lteq'])) {
+ return $this->addCallbackFilter($field, $cond['lteq'], $type, array($this, 'filterCallbackIsMoreThan'), $inverted);
+ }
+ if (isset($cond['finset'])) {
+ $filterValue = ($cond['finset'] ? explode(',', $cond['finset']) : array());
+ return $this->addCallbackFilter($field, $filterValue, $type, array($this, 'filterCallbackInArray'));
+ }
+
+ // add OR recursively
+ foreach ($cond as $orCond) {
+ $this->_addFilterBracket('(', 'and' === $type);
+ $this->addFieldToFilter($field, $orCond, 'or');
+ $this->_addFilterBracket(')');
+ }
+ return $this;
+ }
+
+ /**
+ * Prepare a bracket into filters
+ *
+ * @param string $bracket
+ * @param bool $isAnd
+ * @return Varien_Data_Collection_Filesystem
+ */
+ protected function _addFilterBracket($bracket = '(', $isAnd = true)
+ {
+ $this->_filterBrackets[$this->_filterIncrement] = array(
+ 'value' => $bracket === ')' ? ')' : '(',
+ 'is_and' => $isAnd,
+ );
+ $this->_filterIncrement++;
+ return $this;
+ }
+
+ /**
+ * Render condition sign before element, if required
+ *
+ * @param int $increment
+ * @param bool $isAnd
+ * @return string
+ */
+ protected function _renderConditionBeforeFilterElement($increment, $isAnd)
+ {
+ if (isset($this->_filterBrackets[$increment]) && ')' === $this->_filterBrackets[$increment]['value']) {
+ return '';
+ }
+ $prevIncrement = $increment - 1;
+ $prevBracket = false;
+ if (isset($this->_filterBrackets[$prevIncrement])) {
+ $prevBracket = $this->_filterBrackets[$prevIncrement]['value'];
+ }
+ if ($prevIncrement < 0 || $prevBracket === '(') {
+ return '';
+ }
+ return ($isAnd ? ' && ' : ' || ');
+ }
+
+ /**
+ * Does nothing. Intentionally disabled parent method
+ *
+ * @return Varien_Data_Collection_Filesystem
+ */
+ public function addFilter($field, $value, $type = 'and')
+ {
+ return $this;
+ }
+
+ /**
+ * Get all ids of collected items
+ *
+ * @return array
+ */
+ public function getAllIds()
+ {
+ return array_keys($this->_items);
+ }
+
+ /**
+ * Callback method for 'like' fancy filter
+ *
+ * @param string $field
+ * @param mixed $filterValue
+ * @param array $row
+ * @return bool
+ * @see addFieldToFilter()
+ * @see addCallbackFilter()
+ */
+ public function filterCallbackLike($field, $filterValue, $row)
+ {
+ $filterValueRegex = str_replace('%', '(.*?)', preg_quote($filterValue, '/'));
+ return (bool)preg_match("/^{$filterValueRegex}$/i", $row[$field]);
+ }
+
+ /**
+ * Callback method for 'eq' fancy filter
+ *
+ * @param string $field
+ * @param mixed $filterValue
+ * @param array $row
+ * @return bool
+ * @see addFieldToFilter()
+ * @see addCallbackFilter()
+ */
+ public function filterCallbackEq($field, $filterValue, $row)
+ {
+ return $filterValue == $row[$field];
+ }
+
+ /**
+ * Callback method for 'in' fancy filter
+ *
+ * @param string $field
+ * @param mixed $filterValue
+ * @param array $row
+ * @return bool
+ * @see addFieldToFilter()
+ * @see addCallbackFilter()
+ */
+ public function filterCallbackInArray($field, $filterValue, $row)
+ {
+ return in_array($row[$field], $filterValue);
+ }
+
+ /**
+ * Callback method for 'isnull' fancy filter
+ *
+ * @param string $field
+ * @param mixed $filterValue
+ * @param array $row
+ * @return bool
+ * @see addFieldToFilter()
+ * @see addCallbackFilter()
+ */
+ public function filterCallbackIsNull($field, $filterValue, $row)
+ {
+ return null === $row[$field];
+ }
+
+ /**
+ * Callback method for 'moreq' fancy filter
+ *
+ * @param string $field
+ * @param mixed $filterValue
+ * @param array $row
+ * @return bool
+ * @see addFieldToFilter()
+ * @see addCallbackFilter()
+ */
+ public function filterCallbackIsMoreThan($field, $filterValue, $row)
+ {
+ return $row[$field] > $filterValue;
+ }
+
+ /**
+ * Callback method for 'leq' fancy filter
+ *
+ * @param string $field
+ * @param mixed $filterValue
+ * @param array $row
+ * @return bool
+ * @see addFieldToFilter()
+ * @see addCallbackFilter()
+ */
+ public function filterCallbackIsLessThan($field, $filterValue, $row)
+ {
+ return $row[$field] < $filterValue;
+ }
+}
Index: lib/Varien/Data/Collection/Db.php
===================================================================
--- lib/Varien/Data/Collection/Db.php (revision 44104)
+++ lib/Varien/Data/Collection/Db.php (revision 44105)
@@ -373,6 +373,9 @@
$sql = '';
$fieldName = $this->_getConditionFieldName($fieldName);
+ if (is_array($condition) && isset($condition['field_expr'])) {
+ $fieldName = str_replace('#?', $this->getConnection()->quoteIdentifier($fieldName), $condition['field_expr']);
+ }
if (is_array($condition)) {
if (isset($condition['from']) || isset($condition['to'])) {
if (isset($condition['from'])) {
Index: js/mage/adminhtml/rules.js
===================================================================
--- js/mage/adminhtml/rules.js (revision 44104)
+++ js/mage/adminhtml/rules.js (revision 44105)
@@ -308,7 +308,7 @@
this.chooserSelectedItems.set(element.value,1);
}
} else {
- this.chooserSelectedItems.remove(element.value);
+ this.chooserSelectedItems.unset(element.value);
}
grid.reloadParams = {'selected[]':this.chooserSelectedItems.keys()};
this.updateElement.value = this.chooserSelectedItems.keys().join(', ');
Index: js/mage/adminhtml/tools.js
===================================================================
--- js/mage/adminhtml/tools.js (revision 44104)
+++ js/mage/adminhtml/tools.js (revision 44105)
@@ -181,8 +181,12 @@
if (!navigator.appVersion.match('MSIE 6.')) {
var header, header_offset, header_copy;
+ Event.observe(window, 'load', function() {
+ createTopButtonToolbarToggle();
+ });
- Event.observe(window, 'load', function() {
+ function createTopButtonToolbarToggle()
+ {
var headers = $$('.content-header');
for(var i=0; i