Changeset 2331126
- Timestamp:
- 06/26/2020 08:43:23 AM (6 years ago)
- Location:
- woo-sale-countdown/trunk
- Files:
-
- 3 edited
-
assets/js/actions.js (modified) (1 diff)
-
settings.php (modified) (2 diffs)
-
woo-sale-countdown.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
woo-sale-countdown/trunk/assets/js/actions.js
r2330521 r2331126 5 5 6 6 if ( WCSC_ajax_data.stillValid && null !== WCSC_ajax_data.endDate ) { 7 var startTime = new Date( WCSC_ajax_data.currentDate ); 8 var FlipDownTime = new Date( WCSC_ajax_data.endDate ); 9 $('.wcsc-product-countdown-timer').FlipClock( ( FlipDownTime.getTime() - startTime.getTime() ) / 1000, { 7 $('.wcsc-product-countdown-timer').FlipClock( ( WCSC_ajax_data.endDate - WCSC_ajax_data.currentDate ), { 10 8 clockFace: 'DailyCounter', 11 9 countdown: true, -
woo-sale-countdown/trunk/settings.php
r2330747 r2331126 82 82 */ 83 83 public $stock_color; 84 85 /**86 * Time Zone.87 *88 * @var int.89 */90 public $time_zone;91 84 92 85 /** … … 179 172 $sale_date = $product_due_date_obj->date_i18n( 'Y-m-d H:i:s' ); 180 173 if ( 'back' === $side ) { 181 $timezone = (int) get_option( WCSC_PREFIX . '_timezone', 0 ); 182 $time_zone = $timezone > 0 ? -$timezone : abs( $timezone ); 183 $sale_date = date( 'Y-m-d H:i:s', strtotime( $sale_date ) + ( $time_zone * MINUTE_IN_SECONDS ) ); 174 $sale_date = date( 'Y-m-d H:i:s', strtotime( $sale_date ) ); 184 175 } 185 176 -
woo-sale-countdown/trunk/woo-sale-countdown.php
r2331100 r2331126 124 124 'ajaxUrl' => admin_url( 'admin-ajax.php' ), 125 125 'nonce' => wp_create_nonce( WCSC_PREFIX . '_nonce' ), 126 'currentDate' => gmdate( 'm/d/y H:i:s'),127 'endDate' => $this->is_sale_valid ? gmdate( 'm/d/y H:i:s', strtotime( $this->settings->get_product_sale_time( 'to', 'front' )) ) : null,126 'currentDate' => current_time( 'timestamp', false ), 127 'endDate' => $this->is_sale_valid ? strtotime( $this->settings->get_product_sale_time( 'to', 'front' ), current_time( 'timestamp', false ) ) : null, 128 128 ) 129 129 ); … … 224 224 // Check if sale to is bigger than current time. 225 225 if ( ! empty( $product->get_date_on_sale_to() ) ) { 226 if ( strtotime( $product->get_date_on_sale_to()->format( 'Y-m-d H:i:s' ) ) <= strtotime( gmdate( 'Y-m-d H:i' ) ) ) {226 if ( strtotime( $product->get_date_on_sale_to()->format( 'Y-m-d H:i:s' ) ) <= strtotime( date( 'Y-m-d H:i' ) ) ) { 227 227 update_post_meta( $product->get_id(), '_price', $product->get_regular_price( 'edit' ) ); 228 228 $regular_price = $product->get_regular_price(); … … 232 232 $product->set_date_on_sale_from( '' ); 233 233 $product->save(); 234 } elseif ( strtotime( $product->get_date_on_sale_to()->format( 'Y-m-d H:i:s' ) ) > strtotime( gmdate( 'Y-m-d H:i' ) ) ) {234 } elseif ( strtotime( $product->get_date_on_sale_to()->format( 'Y-m-d H:i:s' ) ) > strtotime( date( 'Y-m-d H:i' ) ) ) { 235 235 add_filter( 'woocommerce_product_is_on_sale', array( $this, 'filter_is_on_sale' ), 1000, 2 ); 236 236
Note: See TracChangeset
for help on using the changeset viewer.