Changeset 1603451
- Timestamp:
- 02/25/2017 01:18:17 PM (9 years ago)
- Location:
- decorator-woocommerce-email-customizer/trunk
- Files:
-
- 3 edited
-
changelog (modified) (1 diff)
-
decorator.php (modified) (2 diffs)
-
includes/classes/rp-decorator-preview.class.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
decorator-woocommerce-email-customizer/trunk/changelog
r1556452 r1603451 1 Version 1.0.1, 25 February 2017 2 ------------------------------------------------------------------------------------ 3 * Tweak - Improved compatibility with WooCommerce 2.7 4 1 5 Version 1.0, 12 December 2016 2 6 ------------------------------------------------------------------------------------ -
decorator-woocommerce-email-customizer/trunk/decorator.php
r1556452 r1603451 5 5 * Plugin URI: http://www.rightpress.net/decorator 6 6 * Description: Use native WordPress Customizer to make WooCommerce emails match your brand 7 * Version: 1.0 7 * Version: 1.0.1 8 8 * Author: RightPress 9 9 * Author URI: http://www.rightpress.net … … 42 42 define('RP_DECORATOR_PLUGIN_PATH', plugin_dir_path(__FILE__)); 43 43 define('RP_DECORATOR_PLUGIN_URL', plugins_url(basename(plugin_dir_path(__FILE__)), basename(__FILE__))); 44 define('RP_DECORATOR_VERSION', '1.0 ');44 define('RP_DECORATOR_VERSION', '1.0.1'); 45 45 define('RP_DECORATOR_SUPPORT_PHP', '5.3'); 46 46 define('RP_DECORATOR_SUPPORT_WP', '4.4'); -
decorator-woocommerce-email-customizer/trunk/includes/classes/rp-decorator-preview.class.php
r1556452 r1603451 135 135 $email->find['order-date'] = '{order_date}'; 136 136 $email->find['order-number'] = '{order_number}'; 137 $email->replace['order-date'] = date_i18n(wc_date_format(), strtotime($email->object->order_date));137 $email->replace['order-date'] = date_i18n(wc_date_format(), (method_exists($email->object, 'get_date_created') ? $email->object->get_date_created() : strtotime($email->object->order_date))); 138 138 $email->replace['order-number'] = $email->object->get_order_number(); 139 139 140 140 // Other properties 141 $email->recipient = $email->object->billing_email;141 $email->recipient = method_exists($email->object, 'get_billing_email') ? $email->object->get_billing_email() : $email->object->billing_email; 142 142 143 143 // Get email content and apply styles … … 170 170 )); 171 171 172 // Use WooCommerceorder172 // Use real order 173 173 if (!empty($last_order_id)) { 174 174 $last_order_id = array_pop($last_order_id); 175 175 return wc_get_order($last_order_id); 176 176 } 177 // Use mockup order 177 // Use mockup order (WC 2.7+) 178 else if (RP_Decorator::wc_version_gte('2.7')) { 179 180 // Instantiate order object 181 $order = new WC_Order(); 182 183 // Other order properties 184 $order->set_props(array( 185 'id' => 1, 186 'status' => ($order_status === null ? 'processing' : $order_status), 187 'billing_first_name' => 'Sherlock', 188 'billing_last_name' => 'Holmes', 189 'billing_company' => 'Detectives Ltd.', 190 'billing_address_1' => '221B Baker Street', 191 'billing_city' => 'London', 192 'billing_postcode' => 'NW1 6XE', 193 'billing_country' => 'GB', 194 'billing_email' => 'sherlock@holmes.co.uk', 195 'billing_phone' => '02079304832', 196 'date_created' => date('Y-m-d H:i:s'), 197 'total' => 24.90, 198 )); 199 200 // Item #1 201 $order_item = new WC_Order_Item_Product(); 202 $order_item->set_props(array( 203 'name' => 'A Study in Scarlet', 204 'subtotal' => '9.95', 205 )); 206 $order->add_item($order_item); 207 208 // Item #2 209 $order_item = new WC_Order_Item_Product(); 210 $order_item->set_props(array( 211 'name' => 'The Hound of the Baskervilles', 212 'subtotal' => '14.95', 213 )); 214 $order->add_item($order_item); 215 216 // Return mockup order 217 return $order; 218 } 219 // Use mockup order (pre WC 2.7) 178 220 else { 179 221
Note: See TracChangeset
for help on using the changeset viewer.