Plugin Directory

Changeset 3130143


Ignore:
Timestamp:
08/02/2024 03:38:37 PM (20 months ago)
Author:
weboneco
Message:

fix product custom and advance attribute problem

Location:
gholab/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • gholab/trunk/gholab.php

    r3130067 r3130143  
    44Plugin URI:        https://webone.co/
    55Description:       قلاب، افزونه همگام سازی محصولات فروشگاه وردپرسی با سابت قلاب
    6 Version:           1.1.0
     6Version:           1.1.1
    77Requires at least: 6.4
    88Requires PHP:      7.4
     
    1818}
    1919
    20 define('GHOLAB_PLUGIN_VERSION', '1.1.0');
     20define('GHOLAB_PLUGIN_VERSION', '1.1.1');
    2121define('GHOLAB_PLUGIN_FILE', __FILE__);
    2222define('GHOLAB_PLUGIN_DIR_PATH', plugin_dir_path(GHOLAB_PLUGIN_FILE));
  • gholab/trunk/readme.txt

    r3130067 r3130143  
    55Requires at least: 6.4
    66Tested up to:      6.6
    7 Stable tag:        1.1.0
     7Stable tag:        1.1.1
    88Requires PHP:      7.4
    99License:           GPLv2 or later
  • gholab/trunk/src/Helpers/Helpers.php

    r3130058 r3130143  
    138138        $productData['attributes'] = [];
    139139        foreach ($product->get_attributes() as $attr) {
    140             $productData['attributes'][] = [
    141                 'name'    => $attr->get_name(),
    142                 'options' => $attr->get_options()
    143             ];
     140            if ("pa_" === substr($attr->get_name(), 0, 3)) {
     141                $attribute = [
     142                    'name'     => substr($attr->get_name(), 3),
     143                    'label'    => wc_attribute_label($attr->get_name()),
     144                    'options'  => wc_get_product_terms($product->id, $attr->get_name(), ['fields' => 'names'])
     145                ];
     146            } else {
     147                $attribute = [
     148                    'name'    => $attr->get_name(),
     149                    'label'   => wc_attribute_label($attr->get_name()),
     150                    'options' => $attr->get_options()
     151                ];
     152            }
     153            $productData['attributes'][] = $attribute;
    144154        }
    145155
Note: See TracChangeset for help on using the changeset viewer.