HEX
Server: Apache
System: Linux beta.alfanet.ee 4.18.0-553.54.1.lve.el8.x86_64 #1 SMP Wed Jun 4 13:01:13 UTC 2025 x86_64
User: busines1 (1252)
PHP: 8.2.29
Disabled: NONE
Upload Files
File: //proc/thread-self/cwd/wp-content/plugins/woo-mailerlite/includes/models/WooMailerLiteProduct.php
<?php

class WooMailerLiteProduct extends WooMailerLiteModel
{
    protected $casts = [
        'resource_id',
        'name',
        'price',
        'description',
        'short_description',
        'image',
        'category_ids',
        'created_at',
        'status',
        'updated_at',
        'url',
        'tracked',
        'ignored'
    ];

    protected $isResource = true;

    protected $format = [
        'tracked' => 'boolean',
        'image' => 'string',
    ];

    protected $removeEmpty = [
      'description',
      'short_description',
      'image',
    ];

    public static function tracked()
    {
        return self::setArgs([
            'metaQuery' => [
                [
                    'key' => '_woo_ml_product_tracked',
                    'value' => true,
                ]
            ]
        ]);
    }

    public static function untracked()
    {
        return self::setArgs([
            'metaQuery' => [
                'relation' => 'OR', // Ensures at least one condition matches
                [
                    'key'     => '_woo_ml_product_tracked',
                    'value'   => false,
                    'compare' => '=', // Looks for products where _woo_ml_product_tracked is explicitly false
                ],
                [
                    'key'     => '_woo_ml_product_tracked',
                    'compare' => 'NOT EXISTS', // Includes products where this key is missing
                ],
            ]
        ]);
    }

    public static function getTrackedProductsCount()
    {
        return self::tracked()->count();
    }

    public static function getUntrackedProductsCount()
    {
        return self::untracked()->count();
    }
}