Plugin Directory

Changeset 3324627


Ignore:
Timestamp:
07/09/2025 01:04:01 AM (7 months ago)
Author:
gplsaver
Message:

Fix issue with add to faves in RFQ mode

Location:
woo-rfq-for-woocommerce
Files:
124 added
6 edited

Legend:

Unmodified
Added
Removed
  • woo-rfq-for-woocommerce/trunk/changelog.txt

    r3320838 r3324627  
    11=== Changelog ==
     2
     3= 2.4.4 7/8/2025 =
     4Fix issue with add to faves in RFQ mode
    25
    36= 2.4.3 7/1/2025 =
  • woo-rfq-for-woocommerce/trunk/includes/classes/admin/settings/gpls_woo_rfq_settings.php

    r3320838 r3324627  
    505505                            ),
    506506
    507 
    508 
    509507                            'settings_gpls_woo_rfq_show_prices' => array(
    510508                                'name' => '2- ' . __('Always Show Product Prices With RFQ Checkout', 'woo-rfq-for-woocommerce'),
     
    514512                                'id' => 'settings_gpls_woo_rfq_show_prices'
    515513                            ),
    516 
    517514
    518515                            'settings_gpls_woo_rfq_normal_checkout_show_prices' => array(
     
    973970                                'type' => 'checkbox',
    974971                                'desc' => 'Enable feature',
    975                                 'default' => 'yes',
     972                                'default' => 'no',
    976973                                'id' => 'settings_gpls_woo_rfq_allow_favorites'
    977974                            ),
     975                            'settings_gpls_woo_rfq_allow_anon_favorites' => array(
     976                                'name' => '2- ' . __('Enable saving favorites for visitors', 'woo-rfq-for-woocommerce'),
     977                                'type' => 'checkbox',
     978                                'desc' => 'Enable feature for visitors',
     979                                'default' => 'no',
     980                                'id' => 'settings_gpls_woo_rfq_allow_anon_favorites'
     981                            ),
    978982                            'settings_gpls_woo_rfq_my_acct_favorites_label' => array(
    979                                 'name' => '2-' . __('Favorites Label', 'woo-rfq-for-woocommerce'),
     983                                'name' => '3-' . __('Favorites Label', 'woo-rfq-for-woocommerce'),
    980984                                'type' => 'text',
    981985                                'desc' => 'The label to use for favorites in "my account" section',
     
    985989                            ),
    986990                             'settings_rfq_favs_wordings_view_favs_cart' => array(
    987                     'name' => '3-' . __('View Favorites', 'woo-rfq-for-woocommerce'),
     991                    'name' => '4-' . __('View Favorites', 'woo-rfq-for-woocommerce'),
    988992                    'type' => 'text',
    989993                    'desc' => 'The label to use for link to favorites',
     
    994998
    995999                            'settings_gpls_woo_rfq_add_to_favorites_label' => array(
    996                                 'name' => '4-' . __('Add to Favorites', 'woo-rfq-for-woocommerce'),
     1000                                'name' => '5-' . __('Add to Favorites', 'woo-rfq-for-woocommerce'),
    9971001                                'type' => 'text',
    9981002                                'desc' => 'The label to use for "Add to Favorites" ',
     
    10021006                            ),
    10031007                            'rfq_cart_sc_section_link_to_favorites_page' => array(
    1004                                 'name' => '5- ' .__('Request for Favorites Page URL', 'woo-rfq-for-woocommerce'),
     1008                                'name' => '6- ' .__('Request for Favorites Page URL', 'woo-rfq-for-woocommerce'),
    10051009                                'type' => 'text',
    10061010                                'desc' => __('Favorites Page URL.Please show the full URL. Use the same domain/subdomain name as your site.<br />'
  • woo-rfq-for-woocommerce/trunk/includes/classes/cart/gpls_woo_rfq_cart.php

    r3320271 r3324627  
    3838            add_filter('woocommerce_loop_add_to_cart_link', array($this, 'gpls_woo_rfq_add_to_cart_link_shop'), 1000, 2);
    3939
    40             if ( get_option('settings_gpls_woo_rfq_allow_favorites','no')=='yes') {
     40            $allow_favs=get_option('settings_gpls_woo_rfq_allow_favorites','no');
     41            $allow_favs_anon=get_option('settings_gpls_woo_rfq_allow_anon_favorites','no');
     42
     43            if (($allow_favs=="yes" && is_user_logged_in()) ||
     44                (get_current_user_id() ==0 && $allow_favs_anon=='yes' && $allow_favs=="yes") )
     45            {
    4146                add_filter('woocommerce_loop_add_to_cart_link', array($this, 'gpls_woo_rfq_add_to_cart_link_shop_favorites'), 2000, 2);
    4247            }
     
    4752            add_action($hook_add_to_cart, array($this, 'gpls_woo_rfq_after_add_to_cart_button'), 100);
    4853
    49             //favorites
    50             if ( get_option('settings_gpls_woo_rfq_allow_favorites','no')=='yes') {
     54            $allow_favs=get_option('settings_gpls_woo_rfq_allow_favorites','no');
     55            $allow_favs_anon=get_option('settings_gpls_woo_rfq_allow_anon_favorites','no');
     56
     57            if (($allow_favs=="yes" && is_user_logged_in()) ||
     58                (get_current_user_id() ==0 && $allow_favs=="yes" && $allow_favs_anon=='yes') ) {
    5159                add_action('woocommerce_after_add_to_cart_form', array($this, 'gpls_woo_rfq_after_add_to_cart_favorites'), 200);
    5260            }
     
    683691            if (is_admin() || get_option('settings_gpls_woo_rfq_allow_favorites','no')=='no') return false;
    684692
    685             if(get_option('settings_gpls_woo_rfq_allow_favorites','no')=='yes') {
     693            $allow_favs=get_option('settings_gpls_woo_rfq_allow_favorites','no');
     694            $allow_favs_anon=get_option('settings_gpls_woo_rfq_allow_anon_favorites','no');
     695
     696            if (($allow_favs=="yes" && is_user_logged_in()) ||
     697                (get_current_user_id() ==0 && $allow_favs=="yes" && $allow_favs_anon=='yes') ) {
    686698                $link_to_fav_page = get_option('rfq_cart_sc_section_show_link_to_favorites_page','');
    687699
     
    10011013                    && $rfq_enable=="yes"
    10021014                ) {
    1003                     return ;
     1015
     1016                    $allow_favs=get_option('settings_gpls_woo_rfq_allow_favorites','no');
     1017                    $allow_favs_anon=get_option('settings_gpls_woo_rfq_allow_anon_favorites','no');
     1018
     1019                    if (($allow_favs=="yes" && is_user_logged_in()) ||
     1020                        (get_current_user_id() ==0 && $allow_favs=="yes" && $allow_favs_anon=='yes') ) {
     1021                        ob_start();
     1022                        wc_get_template('woo-rfq/add-to-favs-form.php',
     1023                            array('product' => $product,
     1024
     1025                            ), '', gpls_woo_rfq_WOO_PATH);
     1026
     1027                        $result_add_to_fav = ob_get_clean();
     1028                        echo '<div>' . $result_add_to_fav . '</div>';return ;
     1029                    }else{
     1030                        return ;
     1031                    }
     1032
     1033
     1034                 //   return ;
    10041035                }
    10051036            }
     
    11531184                        ), '', gpls_woo_rfq_WOO_PATH);
    11541185
    1155                     if(get_option('settings_gpls_woo_rfq_allow_favorites','no')=='yes')
    1156                     {
     1186                    $allow_favs=get_option('settings_gpls_woo_rfq_allow_favorites','no');
     1187                    $allow_favs_anon=get_option('settings_gpls_woo_rfq_allow_anon_favorites','no');
     1188
     1189                    if (($allow_favs=="yes" && is_user_logged_in()) ||
     1190                        (get_current_user_id() ==0 && $allow_favs=="yes" && $allow_favs_anon=='yes') ) {
    11571191
    11581192                        wc_get_template('woo-rfq/add-to-favs-form.php',
     
    13771411
    13781412
    1379                     if(get_option('settings_gpls_woo_rfq_allow_favorites','no')=='yes') {
     1413                    $allow_favs=get_option('settings_gpls_woo_rfq_allow_favorites','no');
     1414                    $allow_favs_anon=get_option('settings_gpls_woo_rfq_allow_anon_favorites','no');
     1415
     1416                    if (($allow_favs=="yes" && is_user_logged_in()) ||
     1417                        (get_current_user_id() ==0 && $allow_favs=="yes" && $allow_favs_anon=='yes') ) {
    13801418                        ob_start();
    13811419                        wc_get_template('woo-rfq/add-to-favs-form.php',
     
    14041442                    ), '', gpls_woo_rfq_WOO_PATH);
    14051443
    1406                 if(get_option('settings_gpls_woo_rfq_allow_favorites','no')=='yes') {
     1444                $allow_favs=get_option('settings_gpls_woo_rfq_allow_favorites','no');
     1445                $allow_favs_anon=get_option('settings_gpls_woo_rfq_allow_anon_favorites','no');
     1446
     1447                if (($allow_favs=="yes" && is_user_logged_in()) ||
     1448                    (get_current_user_id() ==0 && $allow_favs=="yes" && $allow_favs_anon=='yes') ) {
    14071449                    wc_get_template('woo-rfq/add-to-favs-form.php',
    14081450                        array('product' => $product,
     
    15391581                    && $rfq_enable=="yes"
    15401582                ) {
    1541                     return ;
     1583                    $allow_favs=get_option('settings_gpls_woo_rfq_allow_favorites','no');
     1584                    $allow_favs_anon=get_option('settings_gpls_woo_rfq_allow_anon_favorites','no');
     1585
     1586                    if (($allow_favs=="yes" && is_user_logged_in()) ||
     1587                        (get_current_user_id() ==0 && $allow_favs=="yes" && $allow_favs_anon=='yes') ) {
     1588                        ob_start();
     1589                        wc_get_template('woo-rfq/add-to-favs-form.php',
     1590                            array('product' => $product,
     1591
     1592                            ), '', gpls_woo_rfq_WOO_PATH);
     1593
     1594                        $result_add_to_fav = ob_get_clean();
     1595                        echo '<div>' . $result_add_to_fav . '</div>';return ;
     1596                    }else{
     1597                        return ;
     1598                    }
    15421599                }
    15431600            }
     
    19732030
    19742031
    1975         public function gpls_woo_rfq_add_to_cart_link_shop_favorites($link, $product){
     2032        public function gpls_woo_rfq_add_to_cart_link_shop_favorites($link, $product)
     2033        {
     2034
     2035
     2036
     2037             $rfq_check = false;
     2038            $normal_check = false;
     2039            //gpls_woo_rfq_get_mode($rfq_check, $normal_check);
     2040            $rfq_check = false;
     2041            $normal_check = false;
     2042
     2043            if (get_option('settings_gpls_woo_rfq_checkout_option', 'normal_checkout') == "rfq") {
     2044                add_filter('woocommerce_cart_needs_payment', 'gpls_woo_rfq_cart_needs_payment', 1000, 2);
     2045                $rfq_check = true;
     2046                $normal_check = false;
     2047            }
     2048
     2049            if (get_option('settings_gpls_woo_rfq_checkout_option', 'normal_checkout') == "normal_checkout") {
     2050                $rfq_check = false;
     2051                $normal_check = true;
     2052            }
     2053            if (function_exists('is_user_logged_in')) {
     2054                if (get_option('settings_gpls_woo_rfq_hide_visitor_prices', 'no') == 'yes' && !is_user_logged_in()) {
     2055                    $rfq_check = true;
     2056                    $normal_check = false;
     2057
     2058                }
     2059            }
     2060
    19762061            $rfq_enable = gpls_woo_get_rfq_enable($product);
    1977             if ($rfq_enable == 'yes') {
    1978 
    1979                 return '';
    1980             }
    1981 
    1982 
    1983             ob_start();
    1984             wc_get_template('woo-rfq/add-to-favs-form.php',
    1985                 array('product' => $product,
    1986 
    1987                 ), '', gpls_woo_rfq_WOO_PATH);
    1988             $result = ob_get_clean();
    1989 
    1990             return $link."<div style='display:block'>{$result}</div>";
     2062            if ($normal_check && $rfq_enable == 'yes') {
     2063                return $link;
     2064            }
     2065
     2066            $allow_favs=get_option('settings_gpls_woo_rfq_allow_favorites','no');
     2067            $allow_favs_anon=get_option('settings_gpls_woo_rfq_allow_anon_favorites','no');
     2068
     2069            if (
     2070                ($allow_favs=="yes" && is_user_logged_in())
     2071                ||
     2072                (get_current_user_id() ==0 && $allow_favs_anon=='yes' && $allow_favs=="yes")
     2073            )
     2074            {
     2075                ob_start();
     2076                wc_get_template('woo-rfq/add-to-favs-form.php',
     2077                    array('product' => $product,
     2078
     2079                    ), '', gpls_woo_rfq_WOO_PATH);
     2080                $result = ob_get_clean();
     2081                return $link."<div style='display:block'>{$result}</div>";
     2082            }else{
     2083                return $link;
     2084            }
     2085
     2086
    19912087        }
     2088
    19922089
    19932090
    19942091        public function gpls_woo_rfq_add_to_cart_link_shop($link, $product)
    19952092        {
    1996 
    1997 
    1998 
    1999 
    20002093
    20012094            if ($product->get_type() === 'external') {
  • woo-rfq-for-woocommerce/trunk/includes/classes/gpls_woo_rfq_functions.php

    r3320838 r3324627  
    956956            exit; // Exit if accessed directly
    957957        }
    958         if ( get_option('settings_gpls_woo_rfq_allow_favorites','no')=='yes') {
     958        $allow_favs=get_option('settings_gpls_woo_rfq_allow_favorites','no');
     959        $allow_favs_anon=get_option('settings_gpls_woo_rfq_allow_anon_favorites','no');
     960
     961        if (($allow_favs=="yes" && is_user_logged_in()) ||
     962            (get_current_user_id() ==0 && $allow_favs=="yes" && $allow_favs_anon=='yes') ) {
    959963            ob_start();
    960964
     
    21462150    {
    21472151
     2152        $product = wc_get_product();
     2153
    21482154        $rfq_enable = 'no';
    2149 
    21502155
    21512156        if (isset($product) && is_object($product)) {
     
    21632168            if ($rfq_enable == 'no') {
    21642169
    2165                 return $purchasable;;
     2170                return $purchasable;
    21662171
    21672172            }
     
    22582263        $allow_favorites = get_option('settings_gpls_woo_rfq_allow_favorites', 'no');
    22592264
    2260         if ($allow_favorites == "yes") {
     2265        $allow_favs=get_option('settings_gpls_woo_rfq_allow_favorites','no');
     2266        $allow_favs_anon=get_option('settings_gpls_woo_rfq_allow_anon_favorites','no');
     2267
     2268        if (($allow_favs=="yes" && is_user_logged_in()) ||
     2269            (get_current_user_id() ==0 && $allow_favs=="yes" && $allow_favs_anon=='yes') ) {
    22612270
    22622271            $create_page_once = get_option('gpls_woo_fav_qr_page_check');
     
    22992308    function gpls_woo_rfq_hide_rfq_page($items, $menu, $args)
    23002309    {
     2310
    23012311
    23022312
     
    23232333            $rfq_page = get_option('rfq_cart_sc_section_show_link_to_rfq_page', $home);
    23242334
    2325             if (isset($rfq_page)) {
     2335            if (isset($rfq_page) &&!is_admin()) {
    23262336
    23272337                $link_to_rfq_page_url = trim($rfq_page);
     
    23482358        }
    23492359
     2360        $allow_favs=get_option('settings_gpls_woo_rfq_allow_favorites','no');
     2361        $allow_favs_anon=get_option('settings_gpls_woo_rfq_allow_anon_favorites','no');
     2362
    23502363
    23512364        if (get_option('settings_gpls_woo_rfq_allow_favorites', 'no') == 'no'
    2352 
    2353         ||get_option('settings_gpls_woo_rfq_allow_menu', 'no') == 'no') {
    2354 
    2355             {
     2365        ||get_option('settings_gpls_woo_rfq_allow_menu', 'no') == 'no'
     2366        ||  (get_current_user_id() ==0 &&  $allow_favs_anon=='no')
     2367        )
     2368        {
    23562369
    23572370                $rfq_page = get_option('rfq_cart_sc_section_link_to_favorites_page', NULL);
     
    23712384
    23722385
    2373                     if ($page_post != null) {
     2386                    if ($page_post != null &&!is_admin()) {
    23742387
    23752388                        foreach ($items as $key => $item) {
     
    23802393                    }
    23812394                }
    2382             }
     2395
    23832396        }
    23842397
  • woo-rfq-for-woocommerce/trunk/readme.txt

    r3320838 r3324627  
    77Requires PHP: 7.4
    88WC tested up to: 9.9.5
    9 Stable tag: 2.4.3
     9Stable tag: 2.4.4
    1010License: GPLv2
    1111License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    212212== Changelog ==
    213213
    214 = 2.4.3 7/1/2025 =
    215 Reduced required PHP from 8.2 to 7.4
     214= 2.4.4 7/8/2025 =
     215Fix issue with add to faves in RFQ mode
    216216
    217217== Upgrade Notice ==
    218218
    219 = 2.4.3 7/1/2025 =
    220 Reduced required PHP from 8.2 to 7.4
    221 
    222 
    223 
     219= 2.4.4 7/8/2025 =
     220Fix issue with add to faves in RFQ mode
     221
     222
     223
  • woo-rfq-for-woocommerce/trunk/woo-rfq-for-woocommerce.php

    r3320838 r3324627  
    33 * Plugin Name: NP Quote Request for WooCommerce
    44 * Description: NP Quote Request for WooCommerce enables your customers to easily submit a quote request to your WooCommerce store. It is very flexible and can be used in a variety of store settings. NP Quote Request for WooCommerce enables you to generate leads and engage with your customers!
    5  * Version: 2.4.3
     5 * Version: 2.4.4
    66 * Contributors: Neah Plugins,gplsaver
    77 * Author: Neah Plugins
Note: See TracChangeset for help on using the changeset viewer.