Plugin Directory

Changeset 3384241


Ignore:
Timestamp:
10/24/2025 09:25:42 PM (5 months ago)
Author:
nfusionsolutions
Message:

4.0.3

  • Fix legacy nFusion SKU metadata name during retrieval
Location:
precious-metals-automated-product-pricing-pro
Files:
51 added
11 edited

Legend:

Unmodified
Added
Removed
  • precious-metals-automated-product-pricing-pro/trunk/WooCommerce_Plugin_Nfusion.php

    r3378387 r3384241  
    1111 * License URI: https://www.gnu.org/licenses/gpl-2.0.html
    1212 
    13  * Version: 4.0.2
     13 * Version: 4.0.3
    1414*/
    1515
  • precious-metals-automated-product-pricing-pro/trunk/includes/admin/class-admin-product-meta.php

    r3374553 r3384241  
    152152            }
    153153        } else {
    154             // Search for product using nfs_sku or wc_sku giving priority to nfs_sku
    155             $connected = NFS_Catalog_Service::try_get_product([$product->get_meta('nfs_sku', true), $product->get_sku()]) !== false;
     154            // Search for product using nfs_catalog_plugin_sku or wc_sku giving priority to nfs_catalog_plugin_sku
     155            $connected = NFS_Catalog_Service::try_get_product([$product->get_meta('nfs_catalog_plugin_sku', true), $product->get_sku()]) !== false;
    156156            if ($connected) {
    157157                echo '<p><span class="dashicons dashicons-yes-alt" style="color:#46b450;"></span> <strong>' . esc_html__('Connected', 'precious-metals-automated-product-pricing-pro') . '</strong></p>';
     
    203203        global $post;
    204204        woocommerce_wp_text_input([
    205             'id' => 'nfs_sku',
     205            'id' => 'nfs_catalog_plugin_sku',
    206206            'label' => __('nFusion SKU', 'precious-metals-automated-product-pricing-pro'),
    207207            'desc_tip' => true,
    208208            'description' => __('This SKU should match the one in your Product Catalog.', 'your-textdomain'),
    209             'value' => get_post_meta($post->ID, 'nfs_sku', true),
     209            'value' => get_post_meta($post->ID, 'nfs_catalog_plugin_sku', true),
    210210        ]);
    211211    }
     
    213213    // Save nfusion sku field value
    214214    public static function save_nfusion_sku_field($post_id) {
    215         $sku = isset($_POST['nfs_sku']) ? sanitize_text_field($_POST['nfs_sku']) : '';
    216         update_post_meta($post_id, 'nfs_sku', $sku);
     215        $sku = isset($_POST['nfs_catalog_plugin_sku']) ? sanitize_text_field($_POST['nfs_catalog_plugin_sku']) : '';
     216        update_post_meta($post_id, 'nfs_catalog_plugin_sku', $sku);
    217217    }
    218218
  • precious-metals-automated-product-pricing-pro/trunk/includes/admin/class-admin-product-sync.php

    r3374553 r3384241  
    334334            if (!$product) continue;
    335335            $wc_sku = trim((string) $product->get_sku());
    336             $nfs_sku = trim((string) get_post_meta($product->get_id(), 'nfs_sku', true));
     336            $nfs_sku = trim((string) get_post_meta($product->get_id(), 'nfs_catalog_plugin_sku', true));
    337337            $effective = NFS_Catalog_Helpers::get_nfs_sku($product);
    338338
     
    475475            $product = $woo_products[$sku];
    476476            $wc_sku = strpos($sku, 'no_sku_') === 0 ? '' : trim((string) $product->get_sku());
    477             $nfs_sku = trim((string) get_post_meta($product->get_id(), 'nfs_sku', true));
     477            $nfs_sku = trim((string) $product->get_meta('nfs_catalog_plugin_sku', true));
    478478            $effective = NFS_Catalog_Helpers::get_nfs_sku($product);
    479479
     
    578578            $keys = [];
    579579            $wc = trim((string) $product->get_sku());
    580             $nfs = trim((string) get_post_meta($product->get_id(), 'nfs_sku', true));
     580            $nfs = trim((string) $product->get_meta('nfs_catalog_plugin_sku', true));
    581581            if ($wc !== '') $keys[] = $wc; if ($nfs !== '') $keys[] = $nfs;
    582582            foreach ($keys as $k) { if (isset($catalog[$k])) { $count++; break; } }
     
    594594        foreach ($woo_list as $product) {
    595595            $wc = trim((string) $product->get_sku());
    596             $nfs = trim((string) get_post_meta($product->get_id(), 'nfs_sku', true));
     596            $nfs = trim((string) $product->get_meta('nfs_catalog_plugin_sku', true));
    597597            if ($wc !== '' && isset($catalog[$wc])) { $matched_cat_keys[$wc] = true; }
    598598            if ($nfs !== '' && isset($catalog[$nfs])) { $matched_cat_keys[$nfs] = true; }
     
    615615            if (!$product) continue;
    616616            $wc = trim((string) $product->get_sku());
    617             $nfs = trim((string) get_post_meta($product->get_id(), 'nfs_sku', true));
     617            $nfs = trim((string) $product->get_meta('nfs_catalog_plugin_sku', true));
    618618            $matched = false;
    619619            if ($wc !== '' && isset($catalog[$wc])) $matched = true;
  • precious-metals-automated-product-pricing-pro/trunk/includes/admin/class-product-reindexing.php

    r3374553 r3384241  
    3737                        }
    3838                    } else {
    39                         $nfs_sku = $product->get_meta('nfs_sku', true);
     39                        $nfs_sku = trim((string) $product->get_meta('nfs_catalog_plugin_sku', true));
    4040                        $wc_sku = $product->get_sku();
    4141                        $nfsProduct = NFS_Catalog_Service::try_get_product(array($nfs_sku, $wc_sku));
  • precious-metals-automated-product-pricing-pro/trunk/includes/client/class-catalog-client.php

    r3374553 r3384241  
    180180        }
    181181
     182        $payload = (is_object($body) && method_exists($body, 'toArray')) ? $body->toArray() : $body;
     183
    182184        $response = wp_remote_post($url, [
    183185            'timeout' => defined('NFS_CATALOG_REMOTE_TIMEOUT_SECONDS') ? NFS_CATALOG_REMOTE_TIMEOUT_SECONDS : 20,
    184186            'headers' => $headers,
    185             'body' => json_encode($body),
     187            'body' => wp_json_encode($payload),
    186188            'sslverify'  => false, // Disable SSL verification for local development TODO: Remove in production
    187189        ]);
  • precious-metals-automated-product-pricing-pro/trunk/includes/constants.php

    r3378387 r3384241  
    11<?php
    2 define("NFS_CATALOG_PLUGIN_VERSION", "4.0.2");
     2define("NFS_CATALOG_PLUGIN_VERSION", "4.0.3");
    33define("NFS_CATALOG_PLUGIN_BASENAME", plugin_basename(__FILE__));
    44define("NFS_FEEDBACK_REQUEST_DISMISSED", "nfs_feedback_dismissed");
  • precious-metals-automated-product-pricing-pro/trunk/includes/frontend/class-frontend-product.php

    r3374553 r3384241  
    1818     */
    1919    public static function get_price($price, $product) {
    20         $nfs_sku = $product->get_meta('nfs_sku');
     20        $nfs_sku = trim((string) $product->get_meta('nfs_catalog_plugin_sku', true));
    2121        $wc_sku = $product->get_sku();
    2222        $nfsProduct = NFS_Catalog_Service::try_get_product([$nfs_sku, $wc_sku]);
  • precious-metals-automated-product-pricing-pro/trunk/includes/frontend/class-frontend-summary.php

    r3374553 r3384241  
    1111            return $priceHtml;
    1212        }
    13         $nfs_sku = $product->get_meta('nfs_sku');
     13        $nfs_sku = trim((string) $product->get_meta('nfs_catalog_plugin_sku', true));
    1414        $wc_sku = $product->get_sku();
    1515        $nfsProduct = NFS_Catalog_Service::try_get_product([$nfs_sku, $wc_sku]);
     
    6666            }
    6767        } else {
    68             $nfs_sku = $product->get_meta('nfs_sku');
     68            $nfs_sku = trim((string) $product->get_meta('nfs_catalog_plugin_sku', true));
    6969            $wc_sku = $product->get_sku();
    7070            $nfsProduct = NFS_Catalog_Service::try_get_product([$nfs_sku, $wc_sku]);
  • precious-metals-automated-product-pricing-pro/trunk/includes/helpers.php

    r3374553 r3384241  
    110110     *
    111111     * For variations, it always uses the WooCommerce SKU.
    112      * For simple products, it prefers the 'nfs_sku' meta if set, otherwise uses the WooCommerce SKU.
     112     * For simple products, it prefers the legacy 'nfs_catalog_plugin_sku' meta if set, otherwise uses the WooCommerce SKU.
    113113     *
    114114     * @param WC_Product $product The product object.
     
    123123            return trim($wc_sku);
    124124        }
    125         // For simple/parent products, prefer nfs_sku if set, otherwise WooCommerce SKU
    126         $product_id = method_exists($product, 'get_id') ? $product->get_id() : 0;
    127         $nfs_sku = trim((string) get_post_meta($product_id, 'nfs_sku', true));
     125        // For simple/parent products, prefer nfs_catalog_plugin_sku if set, otherwise WooCommerce SKU
     126        $nfs_sku = method_exists($product, 'get_meta') ? trim((string) $product->get_meta('nfs_catalog_plugin_sku', true)) : '';
    128127        if ($nfs_sku !== '') { return $nfs_sku; }
    129128        $wc_sku = method_exists($product, 'get_sku') ? trim((string) $product->get_sku()) : '';
    130129        return $wc_sku;
    131     }   
     130    }
    132131
    133132    /**
  • precious-metals-automated-product-pricing-pro/trunk/includes/model/class-settings-api-request.php

    r3374553 r3384241  
    11<?php
    22
    3 class NFS_Settings_Api_Request implements JsonSerializable {
     3class NFS_Settings_Api_Request {
    44    /** @var string */
    55    public $token;
     
    1313
    1414    /**
    15      * This tells json_encode() how to turn this object into JSON.
    16      * We return an associative array with exactly the keys we want.
     15     * Build the payload array for API requests.
    1716     */
    18     public function jsonSerialize(): mixed {
     17    public function toArray(): array {
    1918        return [
    2019            'Token' => $this->token,
    2120            'Items' => array_map(
    22                 fn($item) => is_array($item) ? $item : $item->toPascalArray(),
     21                fn($item) => is_array($item) ? $item : (method_exists($item, 'toPascalArray') ? $item->toPascalArray() : $item),
    2322                $this->items
    2423            ),
  • precious-metals-automated-product-pricing-pro/trunk/readme.txt

    r3378387 r3384241  
    77Tested up to: 6.8.3
    88Requires at least: 3.5.0
    9 Stable tag: 4.0.2
     9Stable tag: 4.0.3
    1010
    1111Automated realtime metals spot and futures data dynamically updates product prices in your store for Gold, Silver, Platinum, and Palladium
     
    8282
    8383== Changelog ==
     84= 4.0.3 =
     85* Fix legacy nFusion SKU metadata name during retrieval
    8486
    8587= 4.0.2 =
Note: See TracChangeset for help on using the changeset viewer.