Plugin Directory

Changeset 3116503


Ignore:
Timestamp:
07/11/2024 01:39:41 PM (20 months ago)
Author:
wpcommerz
Message:

1.1.7

  1. Improved: Performance Improved.
  2. Improved: Changed single filter to hide option to multiple
  3. Improved: Changed single attributes value select to multiple
  4. Fixed: minor bugs.
Location:
guidant
Files:
135 added
6 edited

Legend:

Unmodified
Added
Removed
  • guidant/trunk/assets/css/admin.css

    r3115032 r3116503  
    14981498
    14991499.guidant-main .guidant_form_group ul.select2-selection__rendered {
    1500     text-wrap: wrap;
    1501 }
     1500    text-wrap: wrap !important;
     1501}
  • guidant/trunk/assets/js/frontend.js

    r3115032 r3116503  
    172172jQuery(document).on("click", "[data-filter_to_show]", function () {
    173173
    174   if (jQuery(this).data("filter_to_show") == 1) {
     174  if (jQuery(this).data("filter_to_show") == 1 || jQuery(this).data("total_filter") == guidantguide_current_filter_position[unique_id]) {
    175175    jQuery(this)
    176176      .closest(".guidantguide_filter")
  • guidant/trunk/frontend/templates/views/single_card.php

    r3115032 r3116503  
    3636
    3737
    38 <div class="guidantguide_single_card guidantguide_element" data-element_id="<?php echo esc_attr($single_element['element_id']) ?>" data-filter_to_hide="<?php echo esc_attr($filter_to_hide_arr_str) ?>" data-filter_to_show="<?php echo esc_attr($filter_to_show[$element_id] ?? '') ?>">
     38<div class="guidantguide_single_card guidantguide_element" data-element_id="<?php echo esc_attr($single_element['element_id']) ?>" data-filter_to_hide="<?php echo esc_attr($filter_to_hide_arr_str) ?>" data-filter_to_show="<?php echo esc_attr($filter_to_show[$element_id] ?? '') ?>" data-total_filter="<?php echo esc_attr($total_filter_number) ?>">
    3939    <?php echo isset($card_image) ? $card_image : ""; ?>
    4040    <h4><?php echo esc_attr($this->settings->updateElementSettings($single_element['element_id'], "card_label")) ?></h4>
  • guidant/trunk/guidant.php

    r3115032 r3116503  
    44 * Plugin URI:        https://wpcommerz.com/guidant/
    55 * Description:       Build Multi-step Guided Selling Process & Smart Forms to Convert 10X More Traffic Into Leads & New Customers.
    6  * Version:           1.1.6
     6 * Version:           1.1.7
    77 * Author:            WPCommerz
    88 * Author URI:        https://wpcommerz.com/
     
    1919}
    2020
    21 define( 'GUIDANT_VERSION', '1.1.6' );
     21define( 'GUIDANT_VERSION', '1.1.7' );
    2222defined( 'GUIDANT_PATH' ) or define( 'GUIDANT_PATH', plugin_dir_path( __FILE__ ) );
    2323defined( 'GUIDANT_URL' ) or define( 'GUIDANT_URL', plugin_dir_url( __FILE__ ) );
  • guidant/trunk/includes/GuidantRenderer.php

    r3115032 r3116503  
    170170        {
    171171            global $wpdb;
    172             $post_id_str = implode("','", $post_id_arr);
    173             $limit_sql = $limit != -1 ? $wpdb->prepare(" LIMIT %d", $limit) : "";
    174             $sql = "SELECT ID FROM {$wpdb->posts} WHERE post_status = 'publish' AND ID IN ('{$post_id_str}') ORDER BY ID DESC {$limit_sql}";
     172            $post_id_str = implode(",", $post_id_arr);
     173            $limit_sql = $limit != -1 ? " LIMIT {$limit}" : "";
     174            $sql = "SELECT ID FROM {$wpdb->posts} WHERE post_status = 'publish' AND ID IN ({$post_id_str}) ORDER BY ID DESC {$limit_sql}";
    175175            $listPosts = $wpdb->get_results($sql, ARRAY_A);
    176176            return wp_list_pluck($listPosts, 'ID');
     
    179179        public function resultRender($post_id_arr, $list_result_attributes)
    180180        {
    181             global $wpdb;
    182             $post_id_str = implode("','", $post_id_arr);
    183 
    184181            $output = '';
    185182
    186             $sql = "SELECT * FROM {$wpdb->prefix}posts WHERE post_status = 'publish'
    187                                     AND ID IN ('{$post_id_str}') ORDER BY ID DESC";
    188             $listPosts = $wpdb->get_results($sql);
    189             if (!empty($listPosts)) {
    190                 foreach ($listPosts as $post) {
    191                     $output .= "<div class=\"single_post\">";
    192 
    193                     foreach ($list_result_attributes as $single_result_attribute) {
    194                         $attribute_name = $single_result_attribute['attribute_type'];
    195                         $prefix = isset($single_result_attribute['prefix']) ? trim($single_result_attribute['prefix']) . " " : " ";
    196 
    197                         // Default values for optional attributes
    198                         $button_text = isset($single_result_attribute['button_text']) ? $single_result_attribute['button_text'] : 'View';
    199                         $image_height = isset($single_result_attribute['image_height']) ? $single_result_attribute['image_height'] : '200';
    200                         $add_to_cart_btn_default_text = isset($single_result_attribute['add_to_cart_btn_default_text']) ? $single_result_attribute['add_to_cart_btn_default_text'] : 'Add to Cart';
    201                         $add_to_cart_btn_loading_text = isset($single_result_attribute['add_to_cart_btn_loading_text']) ? $single_result_attribute['add_to_cart_btn_loading_text'] : 'Adding...';
    202                         $add_to_cart_btn_added_text = isset($single_result_attribute['add_to_cart_btn_added_text']) ? $single_result_attribute['add_to_cart_btn_added_text'] : 'Added to Cart';
    203 
    204                         switch ($attribute_name) {
    205                             case 'post_category':
    206                                 $post_categories = get_the_terms($post->ID, 'category');
    207                                 if ($post_categories && !is_wp_error($post_categories)) {
    208                                     $post_categories_str = join(', ', wp_list_pluck($post_categories, 'name'));
    209                                     $output .= "<div class=\"post_category\">{$prefix}{$post_categories_str}</div>";
     183            foreach ($post_id_arr as $post_id) {
     184                $post = get_post($post_id);
     185                if (!$post) {
     186                    continue;
     187                }
     188
     189                $output .= "<div class=\"single_post\">";
     190
     191                foreach ($list_result_attributes as $single_result_attribute) {
     192                    $attribute_name = $single_result_attribute['attribute_type'];
     193                    $prefix = isset($single_result_attribute['prefix']) ? trim($single_result_attribute['prefix']) . " " : " ";
     194
     195                    // Default values for optional attributes
     196                    $button_text = isset($single_result_attribute['button_text']) ? $single_result_attribute['button_text'] : 'View';
     197                    $image_height = isset($single_result_attribute['image_height']) ? $single_result_attribute['image_height'] : '200';
     198                    $add_to_cart_btn_default_text = isset($single_result_attribute['add_to_cart_btn_default_text']) ? $single_result_attribute['add_to_cart_btn_default_text'] : 'Add to Cart';
     199                    $add_to_cart_btn_loading_text = isset($single_result_attribute['add_to_cart_btn_loading_text']) ? $single_result_attribute['add_to_cart_btn_loading_text'] : 'Adding...';
     200                    $add_to_cart_btn_added_text = isset($single_result_attribute['add_to_cart_btn_added_text']) ? $single_result_attribute['add_to_cart_btn_added_text'] : 'Added to Cart';
     201
     202                    switch ($attribute_name) {
     203                        case 'post_category':
     204                            $post_categories = get_the_terms($post->ID, 'category');
     205                            if ($post_categories && !is_wp_error($post_categories)) {
     206                                $post_categories_str = join(', ', wp_list_pluck($post_categories, 'name'));
     207                                $output .= "<div class=\"post_category\">{$prefix}{$post_categories_str}</div>";
     208                            }
     209                            break;
     210                        case 'post_title':
     211                            $output .= "<div class=\"post_title\">{$prefix}{$post->post_title}</div>";
     212                            break;
     213                        case 'post_date':
     214                            $output .= "<div class=\"post_date\">{$prefix}{$post->post_date}</div>";
     215                            break;
     216                        case 'post_modified':
     217                            $output .= "<div class=\"post_modified\">{$prefix}{$post->post_modified}</div>";
     218                            break;
     219                        case 'post_author':
     220                            $author_name = get_the_author_meta('display_name', $post->post_author);
     221                            $output .= "<div class=\"post_author\">{$prefix}" . esc_html($author_name) . "</div>";
     222                            break;
     223                        case 'post_thumbnail':
     224                            if (has_post_thumbnail($post->ID)) {
     225                                $image_url = get_the_post_thumbnail_url($post->ID, 'post-thumbnail');
     226                                $output .= "<div class=\"post_thumbnail\"><img style='height: {$image_height}px !important;' src=\"{$image_url}\"></div>";
     227                            }
     228                            break;
     229                        case 'post_excerpt':
     230                            $excerpt = get_the_excerpt($post);
     231                            $output .= "<div class=\"post_excerpt\">{$prefix}" . esc_html($excerpt) . "</div>";
     232                            break;
     233                        case 'post_permalink':
     234                            $permalink = get_permalink($post);
     235                            $output .= "<div class=\"post_permalink\"><a target='_blank' href=\"{$permalink}\">{$button_text}</a></div>";
     236                            break;
     237                        case 'woocommerce_category':
     238                            if (class_exists('WooCommerce')) {
     239                                $terms = wp_get_post_terms($post->ID, 'product_cat');
     240                                if (!empty($terms)) {
     241                                    $category_names = wp_list_pluck($terms, 'name');
     242                                    $output .= "<div class=\"woocommerce_category\">{$prefix}" . implode(', ', $category_names) . "</div>";
    210243                                }
    211                                 break;
    212                             case 'post_title':
    213                                 $output .= "<div class=\"post_title\">{$prefix}{$post->post_title}</div>";
    214                                 break;
    215                             case 'post_date':
    216                                 $output .= "<div class=\"post_date\">{$prefix}{$post->post_date}</div>";
    217                                 break;
    218                             case 'post_modified':
    219                                 $output .= "<div class=\"post_modified\">{$prefix}{$post->post_modified}</div>";
    220                                 break;
    221                             case 'post_author':
    222                                 $author_name = get_the_author_meta('display_name', $post->post_author);
    223                                 $output .= "<div class=\"post_author\">{$prefix}" . esc_html($author_name) . "</div>";
    224                                 break;
    225                             case 'post_thumbnail':
    226                                 if (has_post_thumbnail($post->ID)) {
    227                                     $image_url = get_the_post_thumbnail_url($post->ID, 'post-thumbnail');
    228                                     $output .= "<div class=\"post_thumbnail\"><img style='height: {$image_height}px !important;' src=\"{$image_url}\"></div>";
     244                            }
     245                            break;
     246                        case 'woocommerce_price':
     247                            if (class_exists('WooCommerce')) {
     248                                $price = get_post_meta($post->ID, '_price', true);
     249                                if (!empty($price)) {
     250                                    $output .= "<div class=\"woocommerce_price\">{$prefix}" . wc_price($price) . "</div>";
    229251                                }
    230                                 break;
    231                             case 'post_excerpt':
    232                                 $excerpt = get_the_excerpt($post);
    233                                 $output .= "<div class=\"post_excerpt\">{$prefix}" . esc_html($excerpt) . "</div>";
    234                                 break;
    235                             case 'post_permalink':
    236                                 $permalink = get_permalink($post);
    237                                 $output .= "<div class=\"post_permalink\"><a target='_blank' href=\"{$permalink}\">{$button_text}</a></div>";
    238                                 break;
    239                             case 'woocommerce_category':
    240                                 if (class_exists('WooCommerce')) {
    241                                     $terms = wp_get_post_terms($post->ID, 'product_cat');
    242                                     if (!empty($terms)) {
    243                                         $category_names = wp_list_pluck($terms, 'name');
    244                                         $output .= "<div class=\"woocommerce_category\">{$prefix}" . implode(', ', $category_names) . "</div>";
    245                                     }
     252                            }
     253                            break;
     254                        case 'woocommerce_add_to_cart':
     255                            if (class_exists('WooCommerce')) {
     256                                $product = wc_get_product($post->ID);
     257                                if ($product && $product->is_type('simple')) {
     258                                    $product_id = $product->get_id();
     259                                    $product_sku = $product->get_sku();
     260                                    $add_to_cart_url = $product->add_to_cart_url();
     261                                    $output .= "<div class=\"woocommerce_add_to_cart\" data-add_to_cart_btn_default_text=\"{$add_to_cart_btn_default_text}\" data-add_to_cart_btn_loading_text=\"{$add_to_cart_btn_loading_text}\" data-add_to_cart_btn_added_text=\"{$add_to_cart_btn_added_text}\"><a href=\"{$add_to_cart_url}\" data-product_id=\"{$product_id}\" data-product_sku=\"{$product_sku}\" class=\"ajax_add_to_cart add_to_cart_button\">{$add_to_cart_btn_default_text}</a></div>";
    246262                                }
    247                                 break;
    248                             case 'woocommerce_price':
    249                                 if (class_exists('WooCommerce')) {
    250                                     $price = get_post_meta($post->ID, '_price', true);
    251                                     if (!empty($price)) {
    252                                         $output .= "<div class=\"woocommerce_price\">{$prefix}" . wc_price($price) . "</div>";
    253                                     }
    254                                 }
    255                                 break;
    256                             case 'woocommerce_add_to_cart':
    257                                 if (class_exists('WooCommerce')) {
    258                                     $product = wc_get_product($post->ID);
    259                                     if ($product && $product->is_type('simple')) {
    260                                         $product_id = $product->get_id();
    261                                         $product_sku = $product->get_sku();
    262                                         $add_to_cart_url = $product->add_to_cart_url();
    263                                         $output .= "<div class=\"woocommerce_add_to_cart\" data-add_to_cart_btn_default_text=\"{$add_to_cart_btn_default_text}\" data-add_to_cart_btn_loading_text=\"{$add_to_cart_btn_loading_text}\" data-add_to_cart_btn_added_text=\"{$add_to_cart_btn_added_text}\"><a href=\"{$add_to_cart_url}\" data-product_id=\"{$product_id}\" data-product_sku=\"{$product_sku}\" class=\"ajax_add_to_cart add_to_cart_button\">{$add_to_cart_btn_default_text}</a></div>";
    264                                     }
    265                                 }
    266                                 break;
    267                             case 'custom_meta':
    268                                 if (strpos($attribute_name, 'post_meta_') !== false) {
    269                                     $meta_key = str_replace("post_meta_", "", $attribute_name);
    270                                     $post_meta = get_post_meta($post->ID, $meta_key, true);
    271                                     $output .= "<div class=\"custom_meta\">{$prefix}" . esc_html($post_meta) . "</div>";
    272                                 }
    273                                 break;
    274                             default:
    275                                 // Handle other attributes similarly
    276                                 break;
    277                         }
    278                     }
    279 
    280                     $output .= "</div>";
     263                            }
     264                            break;
     265                        case 'custom_meta':
     266                            if (strpos($attribute_name, 'post_meta_') !== false) {
     267                                $meta_key = str_replace("post_meta_", "", $attribute_name);
     268                                $post_meta = get_post_meta($post->ID, $meta_key, true);
     269                                $output .= "<div class=\"custom_meta\">{$prefix}" . esc_html($post_meta) . "</div>";
     270                            }
     271                            break;
     272                        default:
     273                            // Handle other attributes similarly
     274                            break;
     275                    }
    281276                }
    282             }
     277
     278                $output .= "</div>";
     279            }
     280
    283281            return $output;
    284282        }
  • guidant/trunk/readme.txt

    r3115046 r3116503  
    344344
    345345== Changelog ==
     346
     347= 1.1.7 =
     3481. Improved: Performance Improved.
     3492. Improved: Changed single filter to hide option to multiple
     3503. Improved: Changed single attributes value select to multiple
     3514. Fixed: minor bugs.
     352
    346353= 1.1.6 =
    3473541. Improved: overall performance with faster result filtration.
Note: See TracChangeset for help on using the changeset viewer.