woocommerce-plugin icon indicating copy to clipboard operation
woocommerce-plugin copied to clipboard

New settings page

Open ashthecoder05 opened this issue 1 year ago • 6 comments

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]image

ashthecoder05 avatar Oct 31 '23 19:10 ashthecoder05

https://github.com/blockonomics/woocommerce-plugin/assets/737092/395b8534-5291-4ed7-b1ce-18733b20fe1a

shivaenigma avatar Jan 09 '24 08:01 shivaenigma

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. WooCommerce-settings-‹-Wordpress-Woocommerce-Blocks-—-WordPress (6) 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 avatar Jan 10 '24 13:01 DarrenWestwood

@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

0 0 0 0_8000_wordpress_wp-admin_admin php_page=wc-settings tab=checkout section=blockonomics

ashthecoder05 avatar Jan 10 '24 22:01 ashthecoder05

On a fresh installation BTC should be enabled by default: WooCommerce-settings-‹-Wordpress-Woocommerce-Blocks-—-WordPress (7)

We should also remove the saved settings from the woocommerce storage on uninstall delete_option('woocommerce_blockonomics_settings')

DarrenWestwood avatar Jan 30 '24 10:01 DarrenWestwood

@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.

ashthecoder05 avatar Feb 08 '24 09:02 ashthecoder05

  • 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 image

shivaenigma avatar Apr 03 '24 07:04 shivaenigma

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) 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 image

image

  • Incorrect API is getting saved. It should give error seen in existing plugin image
image
  • 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.

anktd avatar May 30 '24 08:05 anktd

Changes with test setup are tested and working fine.

  1. 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. image

  2. 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. image

  3. 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.

anktd avatar Jun 03 '24 12:06 anktd

Thank you for the review @anktd !

  1. Empty API Key should not be saved since temp wallets are removed.

It's fixed now.

  1. 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

  1. Warning on uninstallation

This is also not related to settings. So will create an issue and a separate PR to fix it.

ashthecoder05 avatar Jun 04 '24 07:06 ashthecoder05

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 avatar Jun 04 '24 12:06 shivaenigma

@shivaenigma Updated the PR to not enable the plugin gateway by default.

ashthecoder05 avatar Jun 05 '24 07:06 ashthecoder05

Error on test setup page is wrong ``. It is saying avigate to Settings > Blockonomics > Currencies and click Test Setup

shivaenigma avatar Jun 06 '24 12:06 shivaenigma

Tested it by upgrading the plugin the api key is set and plugin is enabled.

ashthecoder05 avatar Jun 27 '24 06:06 ashthecoder05