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

add README.md #19

Merged
merged 2 commits into from
Jan 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
118 changes: 59 additions & 59 deletions esprit-woo/README.md
Original file line number Diff line number Diff line change
@@ -1,65 +1,65 @@
## Setup
# Run the Plugin on a Local WordPress Website

**1. Install XAMPP**

### Install XAMPP
1. Download XAMPP in C:\ - https://www.apachefriends.org/
1. go to mysql folder
1. rename data folder as dataold, copy the folder and rename copy as data
1. copy database folders from dataold to data
1. copy log files from dataold to data
1. restart server in control panel
1. ensure port 3306 not used (if you installed MySQL previously)
2. Start Apache and MySQL in XAMPP Control Panel
3. ensure port 3306 not used (if you installed MySQL previously)
4. If MySQL keeps stopping, try:
- go to `mysql` folder
- rename `data` folder as `dataold`, copy the folder and rename the copy as `data`
- copy database folders from `dataold` to `data`
- copy log files from `dataold` to `data`
- restart server in control panel

**2. Create local WordPress site**

1. Set up local project folder
1. download WordPress core (https://wordpress.org/download/)
2. extract wordpress folder into C:\xampp\htdocs
3. copy "wordpress" folder
4. rename folder as project name (e.g., "esprit")
2. Connect project to a database
1. open xampp control and activate apache and mysql
2. click "Admin" next to MySQL
3. click "New" (left menu)
4. Give database a name and click "Create"
5. (one time set up) set username/password
- username is "root"
- leave password blank
3. Sign into local Wordpress
1. go to http://localhost/`<foldername>`
2. choose language
3. enter credentials
- username: root
- password: leave empty
4. click "Run the installation"
5. Input settings
- Site Title
- Username
- Password
- Email
6. click "Install Wordpress"
7. login with username and password chosen above

**3. Download your hosted Wordpress website**

### Create local WordPress site
#### Set up local project folder
1. download WordPress core (https://wordpress.org/download/)
1. extract wordpress folder into C:\xampp\htdocs
1. copy "wordpress" folder
1. rename folder as project name (“esprit”)
#### Connect project to a database
1. open xampp control and activate apache and mysql
1.click "Admin" next to MySQL
1.click "New" (left menu)
1.Give database a name and click "Create"
1.(one time set up) set username/password
1.username is "root"
1.leave password blank
#### Sign into local Wordpress
1. go to http://localhost/<foldername>
1. choose language
1. enter credentials
1. username: root
1. password: leave empty
1. click "Run the installation"
1. Input settings
* Site Title
* Username
* Password
* Email
8. click "Install Wordpress"
#### login with username and password chosen above
********************************ask Brian for file if you want it*******************************
1. Download your hosted Wordpress website
1. go to plugins > add plugin > install and activate "wp all-in-one migration"
1. Export and download file
********************************************************************************************************
#### Import above file into the local WordPress core
2. Export and download file

- this requires you have a live WordPress site installed with the WooCommerce Plugin. If you don't have a live site, email jonwayhuang@gmail.com for a file

**4. Import above file into the local WordPress core**

1. Go to http://localhost/<foldername>/wp-admin/. Go to Plugins > add plugin > install and activate "wp all-in-one migration"
1. increase import file site by adding these line to and of .htaccess file (in the project folder)
1. php_value upload_max_filesize 500M
1. php_value post_max_size 500M
1. php_value memory_limit 256M
1. php_value max_execution_time 1800
1. php_value max_input_time 1800
#### In the migration plugin menu, import the file you downloaded in Step 4
#### Install plugin
2. Increase import file site by adding these line to and of .htaccess file (in the project folder)
php_value upload_max_filesize 500M
php_value post_max_size 500M
php_value memory_limit 256M
php_value max_execution_time 1800
php_value max_input_time 1800
3. In the migration plugin menu, import the file you downloaded in Step 4

**5. Install plugin**

1. Copy and paste the “esprit-woo” folder (in Github) into c:\xampp\htdocs\<projectfoldername>\wp-content\plugins
#### Activate plugin
1. Go to your local WordPress site at localhost/<projectfoldername>
1. Go to Plugins (left menu) > activate Esprit Pay plugin
1. Go to WooComerce (left menu) > Settings
1. Enter merchant address > save
1. Save
### Test it out
1. Select an item for checkout
1. Click Esprit Pay
1. Scan
6 changes: 3 additions & 3 deletions esprit-woo/esprit-pay.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,15 @@ public function __construct() {
add_action( 'wp_enqueue_scripts', function() {
global $woocommerce;
$cart_order_total = $woocommerce->cart->total;
wp_enqueue_style('style', plugin_dir_url(__FILE__)."src/style.css", [], "1.6");
wp_enqueue_style('style', plugin_dir_url(__FILE__)."src/style.css", [], "1.8");
// $script_path = plugin_dir_url(__FILE__)."src/index.js";
$script_path = plugin_dir_url(__FILE__)."build/index.js";
wp_register_script('script_handler', $script_path, [], "1.6", true); // change version if script cached and loading old script
wp_register_script('script_handler', $script_path, [], "1.8", true); // change version if script cached and loading old script
wp_localize_script('script_handler', 'data', [
'amount' => $cart_order_total,
'address' => $this->evmaddress,
]);
wp_enqueue_script('script_handler', plugin_dir_url(__FILE__)."build/index.js", [], "1.6", true);
wp_enqueue_script('script_handler', plugin_dir_url(__FILE__)."build/index.js", [], "1.8", true);
});

add_filter('woocommerce_gateway_description', function($description, $payment_id) {
Expand Down