Plugin Directory

Changeset 3105284


Ignore:
Timestamp:
06/20/2024 05:57:44 PM (22 months ago)
Author:
productfeeder
Message:

Updated to version 2.4.6

Location:
product-feeder/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • product-feeder/trunk/includes/product-feeder.php

    r3104111 r3105284  
    99
    1010        private $WPMLActive = false;
     11        private $AttributeValues = array();
    1112        private $AttributeTaxonomies = NULL;
    1213        private $AttributeDisplayValues = array();
     
    501502        }
    502503
    503         private function GetCustomFields($ID, $type) {
     504        private function GetCustomFields($Product, $type) {
    504505            $CustomFields = array();
    505506            if ($this->AttributeTaxonomies === NULL) {
     
    507508                foreach ($all_attribute_taxonomies as $attribute_taxonomy) $this->AttributeTaxonomies[$attribute_taxonomy->attribute_name] = $attribute_taxonomy->attribute_label;
    508509            }
    509             $product_meta = get_post_meta($ID);
     510            $product_meta = get_post_meta($Product->get_id());
    510511            foreach ($product_meta as $meta_key => $meta_value) {
    511512                if (!empty($meta_value[0])) {
    512513                    if ($meta_key == '_product_attributes') {
    513                         $_product_attributes = unserialize($meta_value[0]);
    514                         foreach ($_product_attributes as $_product_attribute) {
    515                             $product_attribute_name = str_replace('pa_', '', $_product_attribute['name']);
    516                             if (isset($this->AttributeTaxonomies[$product_attribute_name])) {
    517                                 if (empty($CustomFields['Attributes'])) $CustomFields['Attributes'] = array();
    518                                 $CustomFields['Attributes'][$product_attribute_name] = $this->AttributeTaxonomies[$product_attribute_name];
     514                        foreach ($Product->get_attributes() as $attr_name => $attr_data) {
     515                            $attr_data = $attr_data->get_data();
     516                            if (!empty($attr_data['options'])) {
     517                                $attr_name_short = str_replace('pa_', '', $attr_name);
     518                                if (isset($this->AttributeTaxonomies[$attr_name_short])) {
     519                                    if (empty($CustomFields['Attributes'])) $CustomFields['Attributes'] = array();
     520                                    $CustomFields['Attributes'][$this->AttributeTaxonomies[$attr_name_short]] = array();
     521                                    foreach ($attr_data['options'] as $term_id) {
     522                                        if (!isset($this->AttributeValues[$term_id])) $this->AttributeValues[$term_id] = get_term($term_id);
     523                                        if (isset($this->AttributeValues[$term_id]) && isset($this->AttributeValues[$term_id]->name)) $CustomFields['Attributes'][$this->AttributeTaxonomies[$attr_name_short]][] = $this->AttributeValues[$term_id]->name;
     524                                    }
     525                                }
    519526                            }
    520527                        }
     
    528535            if ($this->WPMLActive) {
    529536                if ($type == 'product') {
    530                     $LanguageDetails = apply_filters('wpml_post_language_details', NULL, $ID);
     537                    $LanguageDetails = apply_filters('wpml_post_language_details', NULL, $Product->get_id());
    531538                    if (isset($LanguageDetails['language_code'])) {
    532539                        foreach ($LanguageDetails as $WPMLKey => $WPMLValue) {
     
    594601                            "Categories" => $this->GetCategoryPaths($ProductID),
    595602                            "Variations" => array(),
    596                             "CustomFields" => $this->GetCustomFields($ProductID, 'product'),
     603                            "CustomFields" => $this->GetCustomFields($Product, 'product'),
    597604                            "Updated" => get_the_modified_date('Y-m-d\TH:i:sT', $ProductID),
    598605                        );
     
    709716                                        "Stock" => (int)$variation_data['stock_quantity'],
    710717                                        "Images" => $ImageLinks,
    711                                         "CustomFields" => $this->GetCustomFields($VariationID, 'variation'),
     718                                        "CustomFields" => $this->GetCustomFields($Variation, 'variation'),
    712719                                        "Updated" => get_the_modified_date('Y-m-d\TH:i:sT', $VariationID),
    713720                                    );
     
    788795                                "Stock" => (int)$Product->get_stock_quantity(),
    789796                                "Images" => $ProductData['Images'],
    790                                 "CustomFields" => $this->GetCustomFields($ProductData['ID'], 'product'),
     797                                "CustomFields" => $this->GetCustomFields($Product, 'product'),
    791798                                "Updated" => $ProductData['Updated'],
    792799                            );
  • product-feeder/trunk/product-feeder.php

    r3104111 r3105284  
    33    * Plugin Name:      Product Feeder
    44    * Description:      Connect to the marketplace(s) of your choice to increase sales, synchronize orders & returns, rule-based product selection, and much more!
    5     * Version:          2.4.5
     5    * Version:          2.4.6
    66    * Author:           Product Feeder
    77    * Author URI:       https://product-feeder.com
  • product-feeder/trunk/readme.txt

    r3104111 r3105284  
    55Requires at least: 6.0
    66Tested up to: 6.4
    7 Stable tag: 2.4.5
     7Stable tag: 2.4.6
    88Requires PHP: 7.4
    99License: GPLv2 or later
     
    123123= 2.4.5 =
    124124* Updated season support
     125
     126= 2.4.6 =
     127* Updated taxonomy support
Note: See TracChangeset for help on using the changeset viewer.