majeedraza1 / carousel-slider

A WordPress plugin to Create SEO friendly Image, Logo, Video, Post, WooCommerce Product and HTML Content Carousel.
https://wordpress.org/plugins/carousel-slider/
Other
12 stars 3 forks source link

ArgumentCountError #22

Closed Martje65 closed 1 year ago

Martje65 commented 1 year ago

Plugin version: 2.1.0 WooCommerce version: 6.9.2 WordPress version: 6.0.2 PHP version: 7.4 Astra theme version: 3.9.2

I have made a Product Carousel and when we enable the “Show Sale Tag” on the slider we get the next error on our website and in the log files.

2022-10-02T07:27:16+00:00 CRITICAL Uncaught ArgumentCountError: Too few arguments to function Astra_Woocommerce::sale_flash(), 2 passed in /test.be/wp-includes/class-wp-hook.php on line 307 and exactly 3 expected in /test.be/wp-content/themes/astra/inc/compatibility/woocommerce/class-astra-woocommerce.php:302 Stack trace:

0 /test.be/wp-includes/class-wp-hook.php(307): Astra_Woocommerce->sale_flash('<span class="on...', Object(WC_Product_Simple))

1 /test.be/wp-includes/plugin.php(191): WP_Hook->apply_filters('<span class="on...', Array)

2 /test.be/wp-content/plugins/carousel-slider/modules/ProductCarousel/View.php(173): apply_filters('woocommerce_sal...', '<span class="on...', Object(WC_Product_Simple))

3 /test.be/wp-content/plugins/carousel-slider/modules/ProductCarousel/View.php(117): Carous in /test.be/wp-content/themes/astra/inc/compatibility/woocommerce/class-astra-woocommerce.php op de lijn 302

Martje65 commented 1 year ago

Dear @sayful1 i have ask the astra theme provider it the can help me but its a problem within the Slider plugin.

Hello,

We have debugged this issue and it seems like this carousel plugin is not provided three parameters as per mention in the WooCommerce filter

Please refer to this link:- https://github.com/woocommerce/woocommerce/blob/3611d4643791bad87a0d3e6e73e031bb80447417/plugins/woocommerce/templates/single-product/sale-flash.php#L27

Screenshot:- https://share.bsf.io/xQuxqq9j

https://github.com/brainstormforce/astra/issues/4647

majeedraza1 commented 1 year ago

I already noticed this issue and going to be fixed on next version. The next version is also going to introduce some more new features. Maybe need some more testing before release. I will try to release as soon as possible.

majeedraza1 commented 1 year ago

Before release, you can manually fix it by editing plugin file.

File: modules/ProductCarousel/View.php Line: 173

Current code

echo apply_filters( 'woocommerce_sale_flash', '<span class="onsale">' . __( 'Sale!', 'carousel-slider' ) . '</span>', $product );

New Code

echo apply_filters( 'woocommerce_sale_flash', '<span class="onsale">' . __( 'Sale!', 'carousel-slider' ) . '</span>', get_post( $product->get_id() ), $product );
majeedraza1 commented 1 year ago

A new version (2.1.1) has been released fixing this issue.

Martje65 commented 1 year ago

Thanks for the update @sayful1 , it works oke now.

The only thing i am missing for now are the translations to Dutch, must we self download them from https://translate.wordpress.org/projects/wp-plugins/carousel-slider/ ?