Plugin Directory

Changeset 2751400


Ignore:
Timestamp:
07/04/2022 06:37:15 AM (4 years ago)
Author:
mycholan
Message:

Order fields on email issue - fix
Variation fields init issue - fix
Variation title issue on Target Product Select Box issue - fix

Location:
wc-fields-factory
Files:
103 added
6 edited

Legend:

Unmodified
Added
Removed
  • wc-fields-factory/trunk/assets/js/wcff-client-src.js

    r2750941 r2751400  
    11171117                $( '[data-has_field_rules="yes"]' ).trigger( "change" );
    11181118               
    1119                 self.update_negotiate_price();
     1119                //self.updateNegotiatePrice();
    11201120            }
    11211121        };
  • wc-fields-factory/trunk/includes/wcff_admin_fields.php

    r2750863 r2751400  
    271271        $custom_fields = $this->prepare_field_for_order_view($_order->get_id(), true);
    272272
    273         foreach( $custom_fields as $key => $field) {
    274             $send = isset($field["email_meta"]) ? $field["email_meta"] : "yes";
    275             if ($send == "yes") {
    276                 $_fields[] = array(
    277                     "label" => $field["label"],
    278                     "value" => get_post_meta($_order->get_id(), "_custom_". $key, true)
    279                 );
    280             }           
    281         }
     273        foreach( $custom_fields as $group ) {
     274               
     275            if (count($group["fields"]) > 0) {
     276                foreach ($group["fields"] as $field) {
     277                    if (is_array($field) && isset($field["label"]) && isset($field["key"])) {
     278                        $send = isset($field["email_meta"]) ? $field["email_meta"] : "yes";
     279                        if ($send == "yes") {
     280                            $_fields[] = array(
     281                                "label" => $field["label"],
     282                                "value" => get_post_meta($_order->get_id(), $field["key"], true)
     283                            );
     284                        }   
     285                    }
     286                }
     287
     288            }
     289        }
    282290       
    283291        return $_fields;
     
    287295    private function prepare_field_for_order_view($_post_id = 0, $_return = false) {   
    288296
    289         $post_id = 0;
    290297        $target_products = array();
    291298
     
    324331            $this->admin_fields_groups = $groups;
    325332           
    326         }   
     333        }      
    327334
    328335    }
  • wc-fields-factory/trunk/includes/wcff_dao.php

    r2750863 r2751400  
    552552        $variations = get_posts($arg);
    553553        foreach ($variations as $product) {
    554             $products_variation_list[] = array("id" => $product->ID, "title" => $product->post_title);
     554            $variation = new WC_Product_Variation($product->ID);
     555            $variationName = implode(" | ", $variation->get_variation_attributes());
     556            $products_variation_list[] = array("id" => $product->ID, "title" => $variationName);
    555557        }
    556558        return $products_variation_list;
     
    702704        $search = isset($_payload["search"]) ? $_payload["search"] : "";
    703705        $parent = isset($_payload["parent"]) ? $_payload["parent"] : 0;
    704         $qry = $wpdb->prepare("SELECT ID, post_title FROM $wpdb->posts mp WHERE post_type = 'product_variation' AND post_parent=%s AND post_status='publish' AND post_title LIKE '%s'", $parent, '%'. $wpdb->esc_like($search) .'%');       
     706        $qry = $wpdb->prepare("SELECT ID, post_name FROM $wpdb->posts mp WHERE post_type = 'product_variation' AND post_parent=%s AND post_status='publish' AND post_title LIKE '%s'", $parent, '%'. $wpdb->esc_like($search) .'%');       
    705707        return $this->prepare_search_response($page, $qry);
    706708
     
    17411743        if (is_array($posts)) {
    17421744            foreach ($posts as $post) {
    1743                 $res[] = array( "id" => $post->{"ID"}, "title" => $post->{"post_title"});
     1745                if (property_exists($post, "post_title")) {
     1746                    $res[] = array("id" => $post->ID, "title" => $post->post_title);
     1747                } else {
     1748                    $variation = new WC_Product_Variation($post->{"ID"});
     1749                    $variationName = implode(" | ", $variation->get_variation_attributes());
     1750                    $res[] = array("id" => $post->ID, "title" => $variationName);                   
     1751                }
    17441752            }
    17451753        } else {
  • wc-fields-factory/trunk/includes/wcff_injector.php

    r2750863 r2751400  
    693693     */
    694694    public function enqueue_wcff_client_side_meta($_echo = true) {
     695        Global $product;
    695696        $date_bucket = array();
    696697        $color_bucket = array(); 
     
    752753            <script type="text/javascript">
    753754            <?php
    754                 if (is_product() && $this->product) :?>
    755                     var wcff_is_variable = "<?php echo ($this->product->is_type('variable')) ? "yes" : "no"; ?>";
    756                     var wcff_product_price = <?php echo $this->product->get_price(); ?>;
     755                if (is_product() && $product) : ?>
     756                    var wcff_is_variable = "<?php echo ($product->is_type('variable')) ? "yes" : "no"; ?>";
     757                   var wcff_product_price = <?php echo $product->get_price(); ?>;
    757758                <?php endif; ?>
    758759                    var wcff_date_picker_meta = <?php echo json_encode($date_bucket); ?>;
  • wc-fields-factory/trunk/readme.txt

    r2750941 r2751400  
    44Requires at least: 3.5
    55Tested up to: 6.0
    6 Stable tag: 4.0.8
     6Stable tag: 4.0.9
    77License: GPLv2 or later
    88License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    109109
    110110== Changelog ==
     111
     112= 4.0.9 =
     113* Order fields on email issue - fix
     114* Variation fields init issue - fix
     115* Variation title issue on Target Product Select Box issue - fix
    111116
    112117= 4.0.8 =
  • wc-fields-factory/trunk/wcff.php

    r2750941 r2751400  
    55 * Plugin URI: http://sarkware.com/wc-fields-factory-a-wordpress-plugin-to-add-custom-fields-to-woocommerce-product-page/
    66 * Description: It allows you to add custom fields to your woocommerce product page. You can add custom fields and validations without tweaking any of your theme's code & templates, It also allows you to group the fields and add them to particular products or for particular product categories. Supported field types are text, numbers, email, textarea, checkbox, radio and select.
    7  * Version: 4.0.8
     7 * Version: 4.0.9
    88 * Author: Saravana Kumar K
    99 * Author URI: http://www.iamsark.com/
     
    7474            'inc'               => plugin_dir_path(__FILE__) ."includes",           
    7575            'basename'          => plugin_basename(__FILE__),
    76             'version'           => '4.0.8'
     76            'version'           => '4.0.9'
    7777        );
    7878
Note: See TracChangeset for help on using the changeset viewer.