willgorham
Forum Replies Created
-
Forum: Plugins
In reply to: [Advanced Dynamic Pricing for WooCommerce] Critical error in log@algolplus Thank you for the quick response – I’ll look forward to the update ??
Forum: Plugins
In reply to: [Advanced Dynamic Pricing for WooCommerce] Critical error in logI am seeing the same error:
WC 3.6.2
WP 5.1.1Uncaught Error: Call to a member function get_id() on null in /www/wp-content/plugins/advanced-dynamic-pricing-for-woocommerce/classes/class-wdp-frontend.php:753 Stack trace: #0 /www/wp-content/plugins/advanced-dynamic-pricing-for-woocommerce/classes/class-wdp-frontend.php(724): WDP_Frontend::make_wdp_cart_context_from_wc() #1 /www/wp-content/plugins/advanced-dynamic-pricing-for-woocommerce/classes/class-wdp-frontend.php(572): WDP_Frontend::make_wdp_cart_from_wc() #2 /www/wp-content/plugins/advanced-dynamic-pricing-for-woocommerce/classes/class-wdp-frontend.php(241): WDP_Frontend->get_initial_and_discounted_price(Object(WC_Product_Simple), 1) #3 /www/wp-includes/class-wp-hook.php(286): WDP_Frontend->woocommerce_get_price_html('<span class="wo...', Object(WC_Product_Simple)) #4 /www/wp-includes/plugin.php(208): WP_Hook->apply_filters('<span class="wo...', Array) #5 /www/wp-content/plugins/woocommerce/includes/abstracts/abstract-wc-product.php(1740): apply_filters('woocommerce_get...', '<span class="wo...', Obj in /www/wp-content/plugins/advanced-dynamic-pricing-for-woocommerce/classes/class-wdp-frontend.php on line 753
Any updates on this issue?
Thank you,
Will- This reply was modified 5 years, 6 months ago by willgorham.
Thanks for the fast response here. The patch seems to work well in my testing – it would be great to get it released soon.
Thanks!
@gioni Awesome, thank you!
Just want to chime in that I’m seeing the same issue with the COOKIEPATH constant notices. Running a subdomain install on Cloudways.
Awesome, thank you! ??
Hi Tobias,
I just did a quick test for
json_decode()
to see if it behaves the same for escaped and unescaped slashes in JSON data – and it does! No difference, or need to change anything in the decoding process.Here is a simple example:
$data = array( "This is a plain string", "This is a URL: href=\"https://npr.org/\"", ); $encoded_data = json_encode( $data ); $encoded_data_unescaped_slashes = json_encode( $data, JSON_UNESCAPED_SLASHES ); $decoded_data = json_decode( $encoded_data ); $decoded_data_unescaped_slashes = json_decode( $encoded_data_unescaped_slashes ); // Same json_decode function for both types of encoded data print_r( $encoded_data ); //-> ["This is a plain string","This is a URL: href=\"https:\/\/npr.org\/\""] print_r( $decoded_data ); //-> Array ( [0] => This is a plain string [1] => This is a URL: href="https://npr.org/" ) print_r( $encoded_data_unescaped_slashes ); //-> ["This is a plain string","This is a URL: href=\"https://npr.org/\""] // Notice no escaped slashes here ^ print_r( $decoded_data_unescaped_slashes ); //-> Array ( [0] => This is a plain string [1] => This is a URL: href="https://npr.org/" ) // Same decoded data as before
If you want me to test anything else for you I’d be happy to.
Thanks,
Will- This reply was modified 6 years, 10 months ago by willgorham.
- This reply was modified 6 years, 10 months ago by willgorham. Reason: Code formatting
Forum: Plugins
In reply to: [Just-In-Time Sales Offers] Is this plugin dead?Ah, never mind – I just saw the notice on your website. Best of luck with new things!
My understanding is that json_decode will handle it either way, no need to add any options there. However, I will give it a quick test in the next day and let you know what I find.
Thanks,
WillHi,
I totally understand the concern with compatibility. What if you added a filter that defaulted to the current behavior, but could optionally be changed to allow for unescaped slashes?
For example, in models/model-table.php line 240 (I think this is where you would do it):
Currently:
'post_content' => wp_json_encode( $table['data'] )
You could change to:
'post_content' => wp_json_encode( $table['data'], apply_filters( 'tablepress_table_json_encode_unescaped_slashes', false ) ? JSON_UNESCAPED_SLASHES : 0 )
This would default to 0, the default second parameter of wp_json_encode(), and allow a user to enable the option if needed, e.g.
add_filter( 'tablepress_table_json_encode_unescaped_slashes', '__return_true' );
Another option, if you wanted to make it more flexible:
'post_content' => wp_json_encode( $table['data'], apply_filters( 'tablepress_table_json_encode_options', 0 ) )
This would allow a user to add different options, e.g.
add_filter( 'tablepress_table_json_encode_options', 'example_json_options', 10, 1 ); function example_json_options( $options ) { return JSON_UNESCAPED_SLASHES; }
I could repeat the search-replace, but the initial search-replace is done by the NS Cloner plugin and I have a client that clones sites often. I’d rather not have to tell my client to do a manual search-replace after each clone, ideally.
Thanks for your consideration,
Will- This reply was modified 6 years, 10 months ago by willgorham.
- This reply was modified 6 years, 10 months ago by willgorham.
- This reply was modified 6 years, 10 months ago by willgorham.
- This reply was modified 6 years, 10 months ago by willgorham.
- This reply was modified 6 years, 10 months ago by willgorham.
- This reply was modified 6 years, 10 months ago by willgorham.
Hi,
Thanks for the fast response here. It looks like this is an issue with PHP’s json_encode function. When using wp_json_encode(), would it be possible to add a filter to add a second options parameter, maybe just for the JSON_UNESCAPED_SLASHES option?
For reference:
https://developer.www.ads-software.com/reference/functions/wp_json_encode/
https://php.net/manual/en/function.json-encode.php
https://bugs.php.net/bug.php?id=49366Thanks,
Will- This reply was modified 6 years, 10 months ago by willgorham.
Forum: Plugins
In reply to: [NS Cloner - Site Copier] Tablepress supportHi Andrew,
Thanks for the detailed and quick response! Your argument makes complete sense to me, I’ll bring it up with Tablepress and see where I can get there.
Thanks again!
WillForum: Plugins
In reply to: [Jilt for WooCommerce] Breaks checkout shipping recalculationThanks Max! ??
Forum: Plugins
In reply to: [WooCommerce Hear About Us] Dropdown visible only for users NOT logged inHey,
Actually, the field only shows if the user hasn’t already answered the question. Doesn’t make much sense to ask them twice I don’t think (though I don’t know your exact use-case).
Right now there isn’t a way to change this without editing the plugin files directly – maybe the author can add a filter to turn this on/off if needed.
- This reply was modified 7 years, 4 months ago by willgorham.
Hi Okky,
Thanks for the response. It’s only a deprecated notice, so no problem on my end, I just figured I’d bring it up so it can be fixed in the future.
For what it’s worth, the replacement for
product->product_type
isproduct->get_type()
.Thanks,
Will- This reply was modified 7 years, 5 months ago by willgorham.