Plugin Directory

Changeset 3001295


Ignore:
Timestamp:
11/24/2023 03:02:47 PM (2 years ago)
Author:
oscomsupport
Message:

Fixing Category validation, thanks to Rsurfer.

Location:
agreeme-checkboxes-for-woocommerce
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • agreeme-checkboxes-for-woocommerce/tags/1.1.0/inc/classes/agrwc-frontend.php

    r2996245 r3001295  
    151151               
    152152                       
    153                        
     153                                       //Validate for limiting to specific products with specific cats in cart
     154                    if (is_array($l_cats) && count($l_cats)) {
     155                 
     156                        foreach (WC()->cart->get_cart() as $cart_item_key => $values) {
     157                            if (has_term($l_cats, 'product_cat', $values['product_id'])) {
     158                                $match_product = true;
     159                                break;
     160                            }
     161                        }
     162                    }else $match_product = true;
    154163                   
    155164                   
     
    430439                    $l_products = $cbx->get_limit_products();
    431440                    //$l_products=  explode(",",$cbx->get_limit_products());
     441                        $l_cats = $cbx->get_limit_categories();
    432442                    // Getting cart product ids
    433443                    $match_product = true;
     
    440450                        }
    441451                    }
     452                   
     453                           //Validate for limiting to specific products with specific cats in cart
     454                    if (is_array($l_cats) && count($l_cats)) {
     455                        $match_product = false;
     456                        foreach (WC()->cart->get_cart() as $cart_item_key => $values) {
     457                            if (has_term($l_cats, 'product_cat', $values['product_id'])) {
     458                                $match_product = true;
     459                                break;
     460                            }
     461                        }
     462                    }
     463                   
     464                   
     465                   
    442466                    //order total condition added, validate that also..
    443467                    $l_ordertotal = $cbx->get_limit_ordertotal();
  • agreeme-checkboxes-for-woocommerce/trunk/inc/classes/agrwc-frontend.php

    r2996245 r3001295  
    151151               
    152152                       
    153                        
     153                                       //Validate for limiting to specific products with specific cats in cart
     154                    if (is_array($l_cats) && count($l_cats)) {
     155                 
     156                        foreach (WC()->cart->get_cart() as $cart_item_key => $values) {
     157                            if (has_term($l_cats, 'product_cat', $values['product_id'])) {
     158                                $match_product = true;
     159                                break;
     160                            }
     161                        }
     162                    }else $match_product = true;
    154163                   
    155164                   
     
    430439                    $l_products = $cbx->get_limit_products();
    431440                    //$l_products=  explode(",",$cbx->get_limit_products());
     441                        $l_cats = $cbx->get_limit_categories();
    432442                    // Getting cart product ids
    433443                    $match_product = true;
     
    440450                        }
    441451                    }
     452                   
     453                           //Validate for limiting to specific products with specific cats in cart
     454                    if (is_array($l_cats) && count($l_cats)) {
     455                        $match_product = false;
     456                        foreach (WC()->cart->get_cart() as $cart_item_key => $values) {
     457                            if (has_term($l_cats, 'product_cat', $values['product_id'])) {
     458                                $match_product = true;
     459                                break;
     460                            }
     461                        }
     462                    }
     463                   
     464                   
     465                   
    442466                    //order total condition added, validate that also..
    443467                    $l_ordertotal = $cbx->get_limit_ordertotal();
Note: See TracChangeset for help on using the changeset viewer.