Forum Replies Created

Viewing 15 replies - 1 through 15 (of 16 total)
  • Hello,
    I think I have this problem too. Does any version already fix this?

    Thread Starter levke21

    (@levke21)

    The code section above does not work well from v6.1.7 for some reason. Worked fine v6.1.6

    Thread Starter levke21

    (@levke21)

    Unfortunately I don’t think reading the session is a good idea.

    Perhaps you need to modify the code so that it requests the currently displayed products from the API instead. I tried to do this but it didn’t work. The code still seems to count in the original way. (public.js / pulblic.mini.js)

    // Get wishlist data from REST API.
    var tinvwl_products = [],
      tinvwl_counter = false;
    $('.wishlist_products_counter_number').each(function () {
      tinvwl_counter = true;
    });
    var get_data_ajax = function get_data_ajax(refresh) {
      var current_products = [];
      $('a.tinvwl_add_to_wishlist_button').each(function () {
        if ('undefined' !== $(this).data('tinv-wl-product') && $(this).data('tinv-wl-product')) {
          current_products.push($(this).data('tinv-wl-product'));
        }
      });
      if ((current_products.length > 0 || tinvwl_counter) && tinvwl_add_to_wishlist.user_interacted) {
        tinvwl_products = current_products;
        var data = {
          'tinvwl-action': 'get_data',
          'tinvwl-security': tinvwl_add_to_wishlist.nonce
        };
        if ('refresh' === refresh) {
          var form = $('div.tinv-wishlist.woocommerce.tinv-wishlist-clear form[data-tinvwl_sharekey]');
          if (form.length) {
            $('div.tinv-wishlist.woocommerce.tinv-wishlist-clear').block({
              message: null,
              overlayCSS: {
                background: '#fff',
                opacity: 0.6
              }
            });
            data['tinvwl-paged'] = form.data('tinvwl_paged');
            data['tinvwl-per-page'] = form.data('tinvwl_per_page');
            data['tinvwl-sharekey'] = form.data('tinvwl_sharekey');
          }
        }
        if (tinvwl_add_to_wishlist.wpml) {
          data.lang = tinvwl_add_to_wishlist.wpml;
        }
        if (tinvwl_add_to_wishlist.wpml_default) {
          data.lang_default = tinvwl_add_to_wishlist.wpml_default;
        }
        if (tinvwl_add_to_wishlist.stats) {
          data.stats = tinvwl_add_to_wishlist.stats;
        }
        $.ajax({
          url: tinvwl_add_to_wishlist.wc_ajax_url,
          method: 'POST',
          cache: false,
          data: data,
          beforeSend: function beforeSend(xhr) {
            xhr.setRequestHeader('X-WP-Nonce', tinvwl_add_to_wishlist.nonce);
          }
        }).done(function (response) {
          if ('refresh' === refresh) {
            $('div.tinv-wishlist.woocommerce.tinv-wishlist-clear').unblock();
            $(document.body).trigger('wc_fragment_refresh');
            $('div.tinv-wishlist.woocommerce.tinv-wishlist-clear').replaceWith(response.content);
            localStorage.setItem(hash_key + '_refresh', '');
          }
          if (response.wishlists_data) {
            set_hash(JSON.stringify(response.wishlists_data));
          }
          $('body').trigger('tinvwl_wishlist_ajax_response', [this, response]);
        });
      }
    };
    $.fn.tinvwl_get_wishlist_data = function (refresh) {
      if ('refresh' === refresh) {
        get_data_ajax(refresh);
        return;
      }
      if ($supports_html5_storage) {
        if ('undefined' !== typeof Cookies && Cookies.get('tinvwl_update_data') !== undefined) {
          Cookies.set('tinvwl_update_data', 0, {
            expires: -1
          });
          localStorage.setItem(hash_key, '');
        }
        if (localStorage.getItem(hash_key)) {
          var data = JSON.parse(localStorage.getItem(hash_key));
          if ('object' === _typeof(data) && null !== data && (data.hasOwnProperty('products') || data.hasOwnProperty('counter'))) {
            if (!data.hasOwnProperty('lang') && !tinvwl_add_to_wishlist.wpml || tinvwl_add_to_wishlist.wpml && data.lang === tinvwl_add_to_wishlist.wpml) {
              if ('undefined' !== typeof Cookies && Cookies.get('tinvwl_wishlists_data_counter') === undefined) {
                mark_products(data);
                return;
              }
              if ('undefined' !== typeof Cookies && Cookies.get('tinvwl_wishlists_data_counter') == data.counter && (!data.hasOwnProperty('stats_count') || Cookies.get('tinvwl_wishlists_data_stats') == data.stats_count)) {
                mark_products(data);
                return;
              }
            }
          }
        }
      }
      if (tinvwl_add_to_wishlist.block_ajax_wishlists_data) {
        setTimeout(function () {
          mark_products(data);
        }, 500);
        return;
      }
      get_data_ajax();
    };
    tinvwl_add_to_wishlist.user_interacted = false;
    $.fn.tinvwl_get_wishlist_data();
    $(document).one('click keydown scroll', function () {
      tinvwl_add_to_wishlist.user_interacted = true;
      $.fn.tinvwl_get_wishlist_data();
    });
    Thread Starter levke21

    (@levke21)

    Hi,
    Thank you for the response, since then I have tried approaching the thing in several different ways. I concluded that without modifying the IT Wishlist plugin, perhaps reading the product identifiers from the “session file” would be a good solution for achieving my goal. I wrote a code for this (shown below) but it is probably incorrect, because it does not return the appropriate value.

    It would be best if I could somehow modify the original IT Wishlist code to work for me appropriately. I will gladly get a subscription if necessary to get sure help with this matter.

    I asked several developers in my environment, but no one could help me meaningfully with this. I hope you can. This feature is unique in itself, as I didn’t find any extension that could do this.

    The essence of the feature would be for the wishlist to be able to work as a “Collection or Collection” for those users who do not want to buy the product but have already purchased the product (possibly not from my webshop but from elsewhere). And they see this throughout the entire website with a concrete counter that can also be filtered by attributes.

    // Session file prefix
    $session_file_prefix = 'ti_wishlist_data_';
    // Session file suffix - this contains the blog id and URL
    $session_file_suffix = md5(get_current_blog_id() . '_' . get_site_url(get_current_blog_id(), '/') . get_template());
    // Full session file path
    $wishlist_data_file = WP_CONTENT_DIR . '/sessions/' .
    $session_file_prefix . $session_file_suffix . '.dat';
    // Check if the file exists
    if(file_exists($wishlist_data_file)) {
    // Decode the contents
    $session_data = unserialize(file_get_contents($session_file));
    // Check if the session data is empty
    if(empty($session_data)) {
    error_log('Empty session data');
    }
    error_log(print_r($session_data, true));
    // Check the products part
    if(!isset($session_data['products'])) {
    error_log('No products');
    }
    // Create an empty array
    
    $product_id = [];
    // Take out the products part
    $products = $session_data['products'];
    foreach($products as $key => $product){
    error_log("Product: $key");
    $product_id[] = array_keys($product)[0];
    }
    } else {
    error_log("Failed to load session file");
    // File does not exist or is not readable
    // handle the error
    }
    function my_collection_shortcode() {
    global $product_id;
    if(empty($product_id)) {
    $count = 'ures a globalis valtozo';
    } else {
    $count = count($product_id);
    }
    return 'Number of products: ' . $count;
    }
    add_shortcode('my_collection_shortcode', 'my_collection_shortcode');
    
    
    Thread Starter levke21

    (@levke21)

    In the meantime I solved the task.
    1. Edit the “frontend.js” file of the plugin.
    2. The following lines need to be replaced:

     woosc_remove_product(id);
            if (woosc_vars.button_action === 'show_message') {
              $.notiny({
                theme: 'woosc',
                position: woosc_vars.message_position,
                image: product_image,
                text: woosc_vars.message_removed.replace('{name}',
                    '<strong>' + product_name + '</strong>'),
              });
            }
       }

    TO:

      if ((woosc_vars.page_url !== '') && (woosc_vars.page_url !== '#')) {
              window.location.href = woosc_vars.page_url;
            }
          } 
    1. Save frontend.js file
    2. In the plugin settings, modify this setting: “Remove when clicking again = YES”
    3. Save settings
    4. Clear cache (all device)
    5. Test
    • This reply was modified 2 years, 6 months ago by levke21.
    • This reply was modified 2 years, 6 months ago by levke21.
    • This reply was modified 2 years, 6 months ago by levke21.
    • This reply was modified 2 years, 6 months ago by levke21.
    Thread Starter levke21

    (@levke21)

    Yes, it works. Just had to clear the cache. Thanks.

    Thread Starter levke21

    (@levke21)

    Thanks for the reply. I’m sorry. Don’t we misunderstand each other? I knew about the function. My question was different. I would like to accept the privacy policy with product evaluators.

    Thread Starter levke21

    (@levke21)

    Thanks for the reply.

    Thread Starter levke21

    (@levke21)

    Hi,

    Unfortunately the issue has reappeared / Or persists.

    I’m sending two videos of it:
    https://drive.google.com/file/d/11isrcJM470TtPqCY98K6A1yYHHZtMqsl/view?usp=sharing

    https://drive.google.com/file/d/1Af9YhWy5FgmQGHR4ezksqz6CMHpiznTS/view?usp=drivesdk

    Regards,
    Levente

    • This reply was modified 4 years, 10 months ago by levke21.
    Thread Starter levke21

    (@levke21)

    Hi,

    I am using a Samsung S21 phone with the latest Chrome browser. But I tried iPhone 8 and iPhone XR phone and Samsung S10e devices but the problem is same.

    Ok. I will write for commercial version platform. Thank you.

    Regards

    • This reply was modified 4 years, 11 months ago by levke21.
    Thread Starter levke21

    (@levke21)

    In function code which character corrects the position of the any characters? Thank you.

    • This reply was modified 5 years, 6 months ago by levke21.
    Thread Starter levke21

    (@levke21)

    Szia,

    Köszönöm, ez logikus.

    I update plugin the latest version but the issue is same like this. What should I do?
    My test website with issue:
    https://ovek.lookz.hu/product/noi-mubor-ov/

    Thank you.

    Regards,
    Levente

    • This reply was modified 5 years, 9 months ago by levke21.

    Hello,

    Yes I have.

    I think there is a compatibility issue with plugin called Variation Swatches for WooCommerce.

    Plugin link: https://wordpress.org/plugins/variation-swatches-for-woocommerce/

    Link to my webpage:
    http://poshhungary.com/

    Regards,
    Levi

    • This reply was modified 5 years, 9 months ago by levke21.

    Hello,
    Thank you for update. The problem is solved. But maybe another issue has developed. After pressing the add to cart button on the wislist page, the wishlist button does not work well on the product page. I try to add to wishlist product on the product page but the icon not changed just when I refresh the page.

    Regards,
    Levente

Viewing 15 replies - 1 through 15 (of 16 total)