Forum Replies Created

Viewing 5 replies - 1 through 5 (of 5 total)
  • Hey Rhett,

    Yep, that seems to work for me on both versions MySQL 8.0.27 and Mysql 5.7.23.

    Thanks!

    Hey Rhett,

    I encountered the issue using MySQL 8.0.27
    It works fine with MySQL 5.7.23

    Thanks for this awesome plugin!

    Mattia

    I’ve created and used this patch on my project.

    diff --git a/wac_functions.php b/wac_functions.php
    index 6e26b11..1e120e5 100644
    --- a/wac_functions.php
    +++ b/wac_functions.php
    @@ -139,7 +139,7 @@ function wac_apply_coupons() {
       }
       
       if($trb<1) {
    -    $req.=" AND IFNULL(NULLIF(FROM_UNIXTIME(x.meta_value),''),NOW())>=NOW()";
    +    $req.=" AND IFNULL(FROM_UNIXTIME(x.meta_value),NOW())>=NOW()";
         $req2.=" WHERE(individual='yes' OR apply IS NOT NULL)";
       }
    

    Just as test I’ve created another DB using MySQL 5.7.23 and imported the same DB. This works fine, the coupon are added correctly and the “[Incorrect DATETIME value: ”]” error is gone.

    Hi Rhett,

    I’m having the same problem:

    [Incorrect DATETIME value: '']
    SELECT * -- ,(SELECT GROUP_CONCAT(DISTINCT post_title) FROM wp_posts WHERE FIND_IN_SET(ID,product_ids)>0)product FROM ( SELECT p.ID post_id,post_title coupon_code ,(SELECT meta_value FROM wp_postmeta WHERE post_id=p.ID AND meta_key='product_ids' LIMIT 1)product_ids ,(SELECT meta_value FROM wp_postmeta WHERE post_id=p.ID AND meta_key='exclude_product_ids')exc_prds ,(SELECT meta_value FROM wp_postmeta WHERE post_id=p.ID AND meta_key='product_categories')cats ,(SELECT meta_value FROM wp_postmeta WHERE post_id=p.ID AND meta_key='exclude_product_categories')exc_cats ,(SELECT meta_value FROM wp_postmeta WHERE post_id=p.ID AND meta_key='individual_use' LIMIT 1)individual ,(SELECT meta_value FROM wp_postmeta WHERE post_id=p.ID AND meta_key='coupon_amount' LIMIT 1)coupon_amount ,(SELECT meta_value FROM wp_postmeta WHERE post_id=p.ID AND meta_key='_wc_min_qty' LIMIT 1)min_qty ,(SELECT meta_value FROM wp_postmeta WHERE post_id=p.ID AND meta_key='_wc_max_qty' LIMIT 1)max_qty ,(SELECT meta_value FROM wp_postmeta WHERE post_id=p.ID AND meta_key='_wc_qty_ntf' LIMIT 1)qty_ntf ,(SELECT meta_key FROM wp_postmeta WHERE post_id=p.ID AND meta_key LIKE '_wc_%_apply' AND meta_value='yes' LIMIT 1)apply ,DATE_FORMAT(FROM_UNIXTIME(x.meta_value),'%m-%d-%Y')exp_date ,CASE WHEN FROM_UNIXTIME(x.meta_value)<NOW() THEN 1 ELSE 0 END exp FROM wp_posts p LEFT JOIN wp_postmeta x ON x.post_id=p.ID AND x.meta_key='date_expires' AND LENGTH(x.meta_value)=10 AND x.meta_value REGEXP '[0-9]' WHERE post_type='shop_coupon' AND post_status='publish' AND IFNULL(NULLIF(FROM_UNIXTIME(x.meta_value),''),NOW())>=NOW() )a WHERE(individual='yes' OR apply IS NOT NULL) ORDER BY exp,individual DESC,CAST(coupon_amount AS SIGNED) DESC;

    Currently on MySQL 8.0.27

Viewing 5 replies - 1 through 5 (of 5 total)