The WooCommerce site for Ben Lido
This is the latest way for us to set up our environment so that we do not have to worry about how to set up nginx (or apapche), mysql (or mariadb), php (or php-fpm).
Here is the documentation: https://varyingvagrantvagrants.org/docs/en-US/installation/
Need (more info: https://varyingvagrantvagrants.org/docs/en-US/installation/software-requirements/):
- VirtualBox 5.x+ (6.+ is also okay) [ https://www.virtualbox.org/wiki/Downloads ]
- Vagrant 2.1+ [ https://www.vagrantup.com/downloads.html ]
NOTE!!!!! YOU WILL NEED TO Re-Check Out this code after setting up VVV.
Basically, you set up VVV and everything first, then, you will need to check out this repo inside the VVV www directory. Then, you need to create a "provision" profile to provision and run this code from inside the www directory. When you change code inside the newly checked out code.
For example, line #2 below will create a directory in your home directory called vagrant-local. Inside the vagrant-local, you will see a directory called www. cd into that www directory, then do the git clone there.
If this is not the first time you are running vvv, then you should already have a vvv-custom.yml file. Skip steps #1 to #5. Start with Step #6.
- Install VirtualBox and Vagrant
- Install VVV: git clone -b master git://github.com/Varying-Vagrant-Vagrants/VVV.git ~/vagrant-local
- cd ~/vagrant-local
- install required vagrant plugin:
vagrant plugin install vagrant-hostsupdater
- copy vvv-config.yml to vvv-custom.yml (
cp vvv-config.yml vvv-custom.yml
) in the same directory (NOTE: only do this once. If you have already created a vvv-custom.yml, then just copy the site config lines to here) - copy the site config lines from below into the vvv-custom.yml
- run
vagrant up
cd www
git clone https://{YOUR_USERNAME}@bitbucket.org/urbanpixels/ben-lido.git
cd ben-lido
git checkout basel-base
cd ~/vagrant-local
vagrant provision --provision-with site-ben-lido
you will need to enter your password to allow the script to update the /etc/hosts file for you- view site in your browser at http://local.benlido.test/
Below is the configuration that needs to go into the vvv-custom.yml file.. make sure it goes below the "sites:" line. Also, DO NOT USE TABS.. because it's YAML, it needs to be spaces. Save it before you continue with step #6.
If this is not the first time you are setting up vvv, then just add the lines to your existing vvv-custom.yml and proceed with step 6
ben-lido:
hosts:
- local.benlido.test
custom:
db_name: ben_lido
orig_host: dev.benlido.com
wp_admin: admin
wp_pass: aftertenthwave
http_user: benlido
http_passwd: benlido2018
get_database: 1
get_files: 1
Since there are over 400MB of images, we optimized it by compressing it down to 50%. The quality is not the best, but for local development, it's sufficient. If you need higher quality images, please ask directly.
If you feel comfortable, you can also just use your existing method: XAMPP, MAMPP, or native Apache, MySQL, etc.
Below are things you should know:
- DocumentRoot is wordpress/
- Easiest is to use this hostname: benlido.urbanpixels.localhost
- in config/db/ben_lido.sql (uncompress first), do a global search and replace for benlido.urbanpixels.localhost => to whatever your hostname is. If you are not sure what the hostname already in the DB is, just open the file and search for "siteurl". NOTE: you can also use wp-cli. See below.
- create wp-content/uploads folder and give it write permission
- create wp-content/cache folder and gie it write permission
- the wp-config.php currently has the localhost config using the root user and no password. If you want to change this, please add another environment (maybe something like LOCAL_{YOUR_NAME})
NOTE: YOU DO NOT NEED TO DO THIS. THIS IS HERE FOR REFERENCE Using wp-cli: http://wp-cli.org/
wp core download
wp core config --dbname=ben_lido --dbuser=root
wp core install --url="benlido.urbanpixels.localhost" --admin_user="admin" --admin_password="aftertenthwave" --admin_email="dave@urbanpixels.com" --title="Ben Lido"
wp db import wordpress_sql_file.sql
wp search-replace benlido.urbanpixels.localhost your-hostname.urbanpixels.localhost
wp option set woocommerce_force_ssl_checkout 'no'
wp check-update
It also uses composer: https://getcomposer.org/ to manage the plugins.
once you have composer set up, just go to
cd wordpress
composer update --prefer-dist
It uses the wordpress/composer.json and the wordpress/composer.lock file to manage the free plugins. Just add the plugin name (make sure it's available in: http://wpackagist.org before adding) into the composer.json file.
For custom-built plugins, just add directly into the wp-content/plugins/ directory.
NOTE: we cannot manage paid plugins this way because it usually requires login walls. We will need to download the plugin and manually update. IMPORTANT make sure you use the --prefer-dist flag. Otherwise, any plugins that are in a git repo will have their .git directory copied over, and will collide with this repo.
do somethig like this:
<Directory /Users/dave/Sites/ben-lido/wordpress>
Require all granted
Options Includes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
Below are instructions for data related stuff
-- Remove all attributes from WooCommerce
DELETE FROM wp_terms WHERE term_id IN (SELECT term_id FROM wp_term_taxonomy WHERE taxonomy LIKE 'pa_%');
DELETE FROM wp_term_taxonomy WHERE taxonomy LIKE 'pa_%';
DELETE FROM wp_term_relationships WHERE term_taxonomy_id not IN (SELECT term_taxonomy_id FROM wp_term_taxonomy);
-- Delete all WooCommerce products
DELETE FROM wp_term_relationships WHERE object_id IN (SELECT ID FROM wp_posts WHERE post_type IN ('product','product_variation'));
DELETE FROM wp_postmeta WHERE post_id IN (SELECT ID FROM wp_posts WHERE post_type IN ('product','product_variation'));
DELETE FROM wp_posts WHERE post_type IN ('product','product_variation');
-- Delete orphaned postmeta
DELETE pm
FROM wp_postmeta pm
LEFT JOIN wp_posts wp ON wp.ID = pm.post_id
WHERE wp.ID IS NULL;
Current theme: Ben Lido Basel Child Theme Settings:
- Header:
- Upload logo image
- Header Layout (Simplified)
- Main menu align (Center)
- Other -> Display wishlist icon (Off)
- Footer:
- Footer layout (Four Column)
- Copyrights (Off)
AJAX Add to cart: /themes/basel/js/functions.js