Plugin Directory

Changeset 2939992


Ignore:
Timestamp:
07/18/2023 04:06:34 PM (3 years ago)
Author:
wpfound
Message:

Add countdown timer of product archive page

Location:
wpf-product-countdown-timer
Files:
12 added
1 deleted
3 edited

Legend:

Unmodified
Added
Removed
  • wpf-product-countdown-timer/trunk/assets/css/style.css

    r2936118 r2939992  
    11.wpfound_countdown_wrap {
    2     margin: 30px 0;
     2    margin: 30px 0 16px;
     3
    34}
     5
    46.wpfound_countdown_timer {
    57    display: flex;
     
    911    background: #1f1e1e;
    1012    color: #fff;
    11     width: 60px;
    12     height: 55px;
     13    width: 55px;
     14    height: 50px;
    1315    display: flex;
    1416    align-items: center;
     
    3335    display: inline-block;
    3436    margin-bottom: 15px;
    35     font-size: 18px;
     37    font-size: 16px;
    3638    font-weight: 700;
    3739    color: red;
     
    3941
    4042.wpf-product-progress-bar-container {
    41     margin-bottom: 15px;
     43    margin-bottom: 20px;
    4244
    4345}
     
    5759
    5860}
     61
     62.offer-title {
     63    margin-bottom: 12px;
     64
     65}
     66
     67/*========================
     68Product page
     69========================*/
     70/* .wpfund-product-page-timer-wrap .wpfound_countdown_timer .date {
     71    background: none;
     72    color: #212121;
     73    width: 50px;
     74    height: 50px;
     75    font-size: 18px;
     76    border-radius: 50%;
     77    border: 1px solid #ececec;
     78} */
     79
     80.wpfund-product-page-timer-wrap .wpfound_countdown_wrap {
     81    margin: 15px 0;
     82}
     83
     84.wpfund-product-page-timer-wrap p {
     85    margin-bottom: 12px;
     86
     87}
     88
     89.wpfund-product-page-timer-wrap {
     90    text-align: center;
     91    padding: 15px 0;
     92
     93}
     94
     95.wpfund-product-page-timer-wrap .woo-sctr-progress-bar-message {
     96    font-size: 15px;
     97    margin-top: 2px;
     98}
  • wpf-product-countdown-timer/trunk/readme.txt

    r2936118 r2939992  
    33Donate link: https://github.com/ariful93/wpf-product-countdown-timer
    44Tags: woocommerce, products, sales, countdown, timer
    5 Requires at least: 6.1
    6 Tested up to: 5.8
    7 WC requires at least: 7.8.1
    8 WC tested up to: 5.5.2
    9 Requires PHP: 7.4
    10 Stable tag: 1.1.3
     5Requires at least: 5.4
     6Tested up to: 6.2.2
     7WC requires at least: 5.0.0
     8WC tested up to: 7.8.0
     9Requires PHP: 7.2
     10Stable tag: 1.1.4
    1111License: GPLv2 or later
    1212License URI: https://www.gnu.org/licenses/gpl-2.0.html
     
    2424* Choose the time and date from the visual calendar
    2525* Allow setting separate time & date range
    26 * Enable/disable progress bar
     26* Enable/disable product sold progress bar
    2727* Add progress bar of the product sold in single page
     28* Add product sold progress product archive page
     29* Add countdown timer product archive page
    2830
    2931== Installation ==
     
    40423. Timer Settings
    41434. Frontend Veiw
     444. Frontend Product Archive Veiw
    4245
    4346
  • wpf-product-countdown-timer/trunk/wpf-product-countdown-timer.php

    r2936131 r2939992  
    66 * Author:            WPFound
    77 * Author URI         https://github.com/ariful93
    8  * Version:           1.1.3
     8 * Version:           1.1.4
    99 * License:           GPL v2 or later
    1010 * License URI:       https://www.gnu.org/licenses/gpl-2.0.html
     
    8888        add_action( 'woocommerce_process_product_meta', [ $this, 'wpfpct_countdown_timer_save_fields' ] );
    8989        add_action( 'woocommerce_single_product_summary', [ $this, 'wpfpct_display_countdown_timer' ], 20);
    90         add_action( 'wp_enqueue_scripts', array( $this, 'wpfpct_load_enqueue' ) );
     90        add_action( 'woocommerce_after_shop_loop_item', [ $this, 'wpfpct_product_shop_loop_timer' ] );
     91        add_action( 'wp_enqueue_scripts', [ $this, 'wpfpct_load_enqueue' ] );
    9192   
    9293    }
     
    178179    }
    179180
     181    public function wpfpct_product_shop_loop_timer() {
     182        global $product;
     183
     184        $wpfound_date_range         = $product->get_meta( 'wpfound_date_range', true );
     185        $wpfound_date_time          = $product->get_meta( 'wpfound_date_time', true );
     186        $wpfound_timer_heading_text = $product->get_meta( 'wpfound_timer_heading_text', true );
     187        $wpfound_enable_timer       = $product->get_meta( 'wpfound_enable_timer', true );
     188        $wpfound_enable_progress_bar       = $product->get_meta( 'wpfound_enable_progress_bar', true );
     189       
     190        $total_sold = $product->get_total_sales();
     191        $total_stock = $product->get_stock_quantity();
     192
     193        if ( $total_stock > 0 ) {
     194            $sold_percentage = $total_sold / $total_stock * 100;
     195        }
     196
     197        ?>
     198           <?php if ( 'yes' === $wpfound_enable_timer && ! empty( $wpfound_date_range ) ) {
     199               ?>
     200             
     201               <div class="wpfund-product-page-timer-wrap">
     202
     203                    <p><?php echo esc_html( $wpfound_timer_heading_text ); ?></p>
     204
     205                    <div class="wpfound_shop_page_timer" data-date-range="<?php echo esc_attr( $wpfound_date_range .' '. $wpfound_date_time ); ?>"></div>
     206
     207                    <?php if ( 'yes' === $wpfound_enable_progress_bar ) { ?>
     208                        <div class="wpf-product-progress-bar-container">
     209                            <div class="wpf-product-progress-bar-wrap">
     210                                <div class="wpf-product-progress-bar-fill" style="width:<?php echo floor( $sold_percentage ); ?>%"></div>
     211                            </div>
     212                            <div class="woo-sctr-progress-bar-message"><?php echo $total_sold . '/' . $total_stock;  ?> sold</div>
     213                           
     214                        </div>
     215                    <?php } ?>
     216                </div>
     217               <?php
     218           } ?>
     219
     220        <?php
     221       
     222    }
     223
     224
    180225    /**
    181226     * Display Data Showing Function
     
    203248           <?php if ( 'yes' === $wpfound_enable_timer && ! empty( $wpfound_date_range ) ) {
    204249               ?>
    205                 <p id="wpfound_view_timer"></p>
     250                <div id="wpfound_view_timer"></div>
    206251                <?php if ( 'yes' === $wpfound_enable_progress_bar && $total_stock !== NULL ) { ?>
    207252                    <div class="wpf-product-progress-bar-container">
     
    214259                <?php } ?>
    215260               
    216                
    217 
    218261                <script>
    219262                    window.onload = () => {
     
    233276                                getTimerViewId.innerHTML =
    234277                                    `<div class="wpfound_countdown_wrap">
    235                                         <p><?php echo esc_html( $wpfound_timer_heading_text ); ?></p>
     278                                        <p class="offer-title""><?php echo esc_html( $wpfound_timer_heading_text ); ?></p>
    236279                                   
    237280                                        <div class="wpfound_countdown_timer">
     
    279322
    280323        wp_enqueue_style( 'wpfound-countdown-timer-style', WPFPCT_ASSETS . '/css/style.css' );
     324
     325        wp_enqueue_script( 'wpfound-campaign-timer-script', WPFPCT_ASSETS . '/js/campaign-timer.js', array('jquery'), '1.0', true );
    281326       
    282327    }
Note: See TracChangeset for help on using the changeset viewer.