Showing posts with label Database. Show all posts
Showing posts with label Database. Show all posts

Tuesday, 9 June 2015

WooCommerce tax not displaying ($0)

Had an annoying little problem with taxes not showing in WooCommerce recently. Despite my best efforts to configure the Tax pages correctly, all I was getting was $0 for taxes. I had specified an address in the checkout but the tax amount would consistently come back as $0. This was on two separate, new installs of Wordpress v4.2.4 + WooCommerce v2.3.10 and I had no other tax plugins installed.

Thankfully, a response to my post to the Wordpress support forums got me back on track. It was suggested I may be missing the wp_woocommerce_tax_rate_locations table in the database, and sure enough, upon inspection I had no such table.

I created the table using the following SQL from another post describing an identical problem:

CREATE TABLE wp_woocommerce_tax_rate_locations (
location_id bigint(20) NOT NULL,
location_code varchar(255) NOT NULL,
tax_rate_id bigint(20) NOT NULL,
location_type varchar(40) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

Next, I clicked Save on the WooCommerce/Settings/Tax/Tax Options screen before taxes would show.

Thanks lorro! Read the full thread here: https://wordpress.org/support/topic/tax-displays-as-0

Wednesday, 3 June 2015

Can’t access Wordpress wp-admin after changing the site URL

I’m in the process of pointing a domain root to a Wordpress install that resides in a /wordpress folder below the root. I’m following these instructions—or rather trying to!

I first modified the Site address (URL) from https://store.mydomain.com to https://store/mydomain.com/wordpress, moved (instead of copying) the /wordpress/.htaccess and index.php files to the root, cleaned up those files how they should have been in the first place (!), and then promptly lost access to wp-admin.

I backed up the site content before starting all of this but, naturally, elected not to back up the Wordpress database. Which was a bit silly.

Fortunately, I was able to roll back to the start—without access to wp-admin, by modifying the value of the siteurl row in the wp_options table (in the MySQL database via phpMyAdmin).

This article also has some great options to get you up and running again without modifying the database: http://codex.wordpress.org/Changing_The_Site_URL

Thursday, 2 September 2010

Testing database connectivity

Developer that I am, I've gone so far as to write throwaway console apps to test connectivity to a database server as a different user; hopefully I'll never have to do that again after learning about this really cool trick:

  • Create a new text file and change the extension to .udl
  • Double-click it
  • Select a provider, configure the options to connect and hit Test Connection (note the Use a specific user name and password option means SQL authentication; entering an AD account here will fail).
  • Start a console window as another user and execute the .udl file to connect as someone else using integrated security if necessary
  • Having ruled a security issue in or out, fix the problem!

UDL-database-connection 

A massive shout out to Todd Klindt for sharing this in one of his recent netcasts!!!

Ps. "OK" through to persist the connection details in the form of a connection string to your text file. Kinda helpful!

If you found this post helpful, please support my advertisers.

Thursday, 20 May 2010

Disable the Output Cache Programmatically with PowerShell

Restoring a content database from a production environment to a development machine for dev purposes can sometimes get a little bit interesting.

Our production environments generally have output caching enabled for performance reasons(see /_Layouts/sitecachesettings.aspx in your own environment) but developing or troubleshooting an issue in dev normally requires output caching be disabled to you can view the results of your work. Of course the output cache settings are stored within the site collection so using a production backup will normally bring the output cache setting along with everything else.

Of course you can manually disable output caching but that means remembering to do so. As our attach process is scripted in a batch file for repeatability and automation purposes, I recently added a step to disable the output cache programmatically. To do this, I wrote a little PowerShell script and call it from the batch file:

Param($Url)

write-host "User must be a site collection administrator or have full control within web application policy!"

[System.Reflection.Assembly]::LoadWithPartialName(“Microsoft.SharePoint”)
[System.Reflection.Assembly]::LoadWithPartialName(“Microsoft.SharePoint.Publishing”)

$cacheSettings = new-object Microsoft.SharePoint.Publishing.SiteCacheSettingsWriter($Url);
$cacheSettings.EnableCache = $false;

$cacheSettings.Update();

The script takes a single named parameter (Url) which specifies the site collection URL. As you can see, I'm working with the SiteCacheSettingsWriter class to set the EnableCache property to false before sending through an Update() command; of course the same thing can easily be accomplished in C#.

I call the script like so from my batch script:

powershell "& ./DisableOutputCache.ps1 -Url http://dev-moss"

I've parameterised this script since I restore content databases from multiple sites and didn't want the URL hard-coded.

As per my note, the account used to execute this script must be a site collection owner or have rights configured the web application policy or you'll encounter an access denied error.

 

Monday, 16 March 2009

Presenting at the next SharePoint User Group Presentation

Just a reminder I’ll be delivering part two of my two-part presentation on how we do web content management on MOSS 2007 this Tuesday at 12:30pm. We had a great turnout for the first presentation so it will be interesting to see who comes back!! Honestly, it’s amazing how many of you SharePoint/MOSS guys I’ve met through the first presentation and I’m really looking forward to bumping into a few more of you—please come up and say hello!

The blurb on the user group site is a straight copy of the part one blurb so here’s what I’ll be talking about tomorrow:

westernaustralia.com was one of the first public-facing MOSS 2007-based internet sites launched in Australia and is billed as the Western Australia Tourism Commission’s flagship web site. Two years on and thirty MCMS 2002-based tourism sites are now being migrated to the MOSS 2007 platform. In the second segment of this two part presentation, Michael Hanes, the Development Coordinator/Tech Lead at Tourism WA, talks about the backend MOSS environments. In this presentation Michael presents the existing and replacement hardware environments, virtualisation, environment structure, farm configuration, security, site collection structure and variations, performance, tooling, content delivery (Akamai), and content deployment.

Jeremy’s aiming to record the presentation again so, all being well, the part two webcast will be available after the event in case you’re unable to come along.

Here’s part one in case you missed it. See you down there for part two!!

[Update: a vodcast of the presentation is now available here with a PDF of the slides and notes here.]

[Update: the original PowerPoint deck is now available.]

Friday, 1 February 2008

How to identify your SQL Server version and edition

This article tells you how to determine the version and service pack level for a given SQL Server and, at the time of posting, includes everything from SQL Server 6.5 to 2005 SP2.

http://support.microsoft.com/default.aspx?scid=kb;en-us;q321185