Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rewrite $notice to split display and alt text #10

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

CodingHerbivore
Copy link

Aside from fixing a minor spelling mistake, I changed the $notice variable to hold an array rather than a really long string. The dp_alt_products function then wraps the first array item (the display text) in an h4, and checks the array's length to see if a second array item (the alt product text) exists. If so, it wraps that in another h4 with a different class and includes it in the $dp_display_notice variable, which is echoed to the page.

Aside from fixing a minor spelling mistake, I changed the $notice variable to hold an array rather than a really long string. The dp_alt_products function then wraps the first array item (the display text) in an h4, and checks the array's length to see if a second array item (the alt product text) exists. If so, it wraps that in another h4 with a different class and includes it in the $dp_display_notice variable, which is echoed to the page.
BrianHenryIE added a commit to BrianHenryIE/woocommerce-discontinued-products that referenced this pull request Aug 4, 2022
```
Uncaught TypeError: implode(): Argument twoelevenjay#2 ($array) must be of type ?array, string given in /path/to/wp-content/plugins/woocommerce-discontinued-products/includes/class-dp-csv-import-export.php:156
Stack trace:
#0 /path/to/wp-content/plugins/woocommerce-discontinued-products/includes/class-dp-csv-import-export.php(156): implode(', ', '')
twoelevenjay#1 /path/to/wp-includes/class-wp-hook.php(309): DP_CSV_Import_Export->add_export_data_alt_products('', Object(WC_Product_Simple))
twoelevenjay#2 /path/to/wp-includes/plugin.php(191): WP_Hook->apply_filters('', Array)
twoelevenjay#3 /path/to/wp-content/plugins/woocommerce/includes/export/class-wc-product-csv-exporter.php(232): apply_filters('woocommerce_pro...', '', Object(WC_Product_Simple), 'alt_products')
twoelevenjay#4 /path/to/wp-content/plugins/woocommerce/includes/export/class-wc-product-csv-exporter.php(185): WC_Product_CSV_Exporter->generate_row_data(Object(WC_Product_Simple))
twoelevenjay#5 /path/to/wp-content/plugins/woocommerce/includes/export/abstract-wc-csv-batch-exporter.php(117): WC_Product_CSV_Exporter->prepare_data_to_export()
twoelevenjay#6 /path/to/wp-content/plugins/woocommerce/includes/admin/class-wc-admin-exporters.php(165): WC_CSV_Batch_Exporter->generate_file()
twoelevenjay#7 /path/to/wp-includes/class-wp-hook.php(307): WC_Admin_Exporters->do_ajax_product_export('')
twoelevenjay#8 /path/to/wp-includes/class-wp-hook.php(331): WP_Hook->apply_filters('', Array)
twoelevenjay#9 /path/to/wp-includes/plugin.php(476): WP_Hook->do_action(Array)
twoelevenjay#10 /path/to/wp-admin/admin-ajax.php(187): do_action('wp_ajax_woocomm...')
twoelevenjay#11 {main}
  thrown
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant