woocommerce-plugin
woocommerce-plugin copied to clipboard
New settings page
This PR is to move our current setting page from Settings > Blockonomics to Woocomerce > Settings > Payement > Bitcoin.
This is to take advantage of woocommerce and bring all our settings in one place.
Figma: https://www.figma.com/proto/mIJb7FXCn5JXjGLuSoeP1v/Blockonomics---Wordpress-Plugin---Onboarding?kind=&node-id=2-60&scaling=scale-down&starting-point-node-id=82%3A668&t=U5FVpebRrEOil4gQ-0&type=design
![image]
https://github.com/blockonomics/woocommerce-plugin/assets/737092/395b8534-5291-4ed7-b1ce-18733b20fe1a
Let's use a uniform method for displaying settings and their titles. The setting title should always be in bold and placed above the setting, as we have done for some settings. eg.
Let's also ensure the inputs have the correct type, and the correct default value/placeholder text. Currently currency margin and slack % are using text type and api key and description do not have placeholder text.
@DarrenWestwood I've made the changes as suggested! I had to override some of the form fields because I didn't see an option to set it. Let me know when you have a chance to review it
On a fresh installation BTC should be enabled by default:
We should also remove the saved settings from the woocommerce storage on uninstall delete_option('woocommerce_blockonomics_settings')
@DarrenWestwood I've removed the custom divider and it's a good idea to add to generate_html methods.
About having a single settings I'll create another PR from this branch to keep the risk of breaking anything to minimal.
- Test setup is saying "Success" when there is a valid API Key / but no Wallet setup on blockonomics side
- Need to work on UI more
Tested this version. New settings page is looking good 👍 There are few things to be looked at:
- Getting php warning msg when activating the plugin (logs below image)
[30-May-2024 08:03:51 UTC] PHP Warning: Creating default object from empty value in /Applications/MAMP/htdocs/wpmore/wp-content/plugins/woocommerce-plugin-new-settings-page/php/Blockonomics.php on line 241
[30-May-2024 08:03:51 UTC] PHP Notice: Undefined property: stdClass::$message in /Applications/MAMP/htdocs/wpmore/wp-content/plugins/woocommerce-plugin-new-settings-page/blockonomics-woocommerce.php on line 239
[30-May-2024 08:04:46 UTC] PHP Warning: include_once(Blockonomics.php): failed to open stream: No such file or directory in /Applications/MAMP/htdocs/wpmore/wp-content/plugins/woocommerce-plugin-new-settings-page/blockonomics-woocommerce.php on line 100
[30-May-2024 08:04:46 UTC] PHP Warning: include_once(): Failed opening 'Blockonomics.php' for inclusion (include_path='.:/Applications/MAMP/bin/php/php7.4.33/lib/php') in /Applications/MAMP/htdocs/wpmore/wp-content/plugins/woocommerce-plugin-new-settings-page/blockonomics-woocommerce.php on line 100
[30-May-2024 08:05:00 UTC] PHP Warning: include_once(Blockonomics.php): failed to open stream: No such file or directory in /Applications/MAMP/htdocs/wpmore/wp-content/plugins/woocommerce-plugin-new-settings-page/blockonomics-woocommerce.php on line 100
[30-May-2024 08:05:00 UTC] PHP Warning: include_once(): Failed opening 'Blockonomics.php' for inclusion (include_path='.:/Applications/MAMP/bin/php/php7.4.33/lib/php') in /Applications/MAMP/htdocs/wpmore/wp-content/plugins/woocommerce-plugin-new-settings-page/blockonomics-woocommerce.php on line 100
- Test setup for BCH is showing success even though callback url is not same on plugin as on the store, which results in error on checkout page
- Incorrect API is getting saved. It should give error seen in existing plugin
- Description for Store row reads "To use your own wallet and start withdrawing fund,you can setup a Blockonomics store". Lets update this now that temp wallets are removed. It could something like "Setup a Blockonomics store to start accepting payments in your wallet"
We should also sync this with master branch as this branch is behind on the recent commits.
Changes with test setup are tested and working fine.
-
Empty API Key should not be saved since temp wallets are removed. Currently it is allowing user to save empty API key after fresh installation and displays the msg 'Your settings have been saved'. Once an API Key is added & saved, it is working as intended and not saving the empty API key again.
-
Checkout with No Javascript setting activated doesn't have centrally aligned QR Code and 'Click here if already paid' button. We can address this later if its not straightforward solution.
-
Uninstallation of plugin is giving a Php warning
PHP Notice: Function wpdb::prepare was called incorrectly. The query argument of wpdb::prepare() must have a placeholder.
Thank you for the review @anktd !
- Empty API Key should not be saved since temp wallets are removed.
It's fixed now.
- QR code misalignment for no javascript settings
This can be tackled in a separate PR. I'll create a separate issue and fix it differently
- Warning on uninstallation
This is also not related to settings. So will create an issue and a separate PR to fix it.
Looks good to one. One thing to fix is that we cannot enable the plugin until there is an APIKey set. Otherwise user is seeing the option and unecessary error of unable to generate address
@shivaenigma Updated the PR to not enable the plugin gateway by default.
Error on test setup page is wrong ``. It is saying avigate to Settings > Blockonomics > Currencies and click Test Setup
Tested it by upgrading the plugin the api key is set and plugin is enabled.