Fixing your unique names problems
Note: While writing this post Instinct are working on a snazzy new Settings>Checkout Page which will allow you to associate your unique names (if they even exist by then) to checkout fields from there. This should be release in version 3.7.6 finger crossed
In 3.7 Paypal Pro was introduced and we needed a good way to identify certain checkout form fields to send the data to Paypal. Hence Unique Names were added. Since then we’ve used unique names in several places, the purchase logs use them for the Individual Purchase Page, and the checkout pages new ‘Same as billing’ Checkout box uses them to a small degree too.
For fresh Installs there seemed to be little problem, but for Upgrades there was a surge in reports of bugs, and they all tied down to the same problem. During the upgrade some people seemed to be able to ‘bypass’ the whole associate unique names with the corresponding checkout form field. Off the top of my head the bugs relating to unique names were:
- The Check Box ‘Same as billing’ did not work.
- Your purchase logs don’t have any shipping or billing details
- Paypal Pro doesn’t work
Saying that unique names are not the only causes for these problems for instance ,the check box ‘Same as billing’ not working could be due to a javascript error – use firebug if you get a JS error then it’s not the unique names, and as for Paypal Pro, if you don’t have all the necessary billing and shipping details, or have failed to accepted their usage agreement on their site then those could be the cause for the gateway failing.
Enough of a detour, basically I’m going to show you quickly how to re-open the Purchlogs Upgrade page to get a second chance at associating you unique names with your checkout fields allowing you to add the unique names without the hastle of doing it in phpMyAdmin. I’m working through this using a version of 3.7.4 I just upgraded it from 3.7RC1 and wiped the unique_names field through phpMyAdmin.
Round 1
First we have to get acces to the file: wp-e-commerce/wpsc-admin/inclused/setting-pages/purchlogs_upgrade.php
add this chunk of code:
$sql = "UPDATE `".WPSC_TABLE_CHECKOUT_FORMS."` SET `unique_name`='delivertoafriend' WHERE `name` = '2. Shipping details'";
$wpdb->query($sql);
After line 21 (which should look like this:
if(isset($_POST)){
So your code should look roughly like this:
if(isset($_POST)){
$sql = "UPDATE `".WPSC_TABLE_CHECKOUT_FORMS."` SET `unique_name`='delivertoafriend' WHERE `name` = '2. Shipping details'";
$wpdb->query($sql);
foreach($_POST as $key=>$value){
if($value != '-1'){
$sql = "UPDATE `".WPSC_TABLE_CHECKOUT_FORMS."` SET `unique_name`='".$value."' WHERE id=".$key;
$complete = $wpdb->query($sql);
}
$numChaged++;
$numQueries ++;
}
add_option('wpsc_purchaselogs_fixed',true);
}
Round 2
Login to wp-admin and navigate your way to the Sales Page. Your URL should look similar to this:
/wp-admin/admin.php?page=wpsc-sales-logs&subpage=upgrade-purchase-logs
add &subpage=upgrade-purchase-logs to make the URL look
/wp-admin/admin.php?page=wpsc-sales-logs&subpage=upgrade-purchase-logs&subpage=upgrade-purchase-logs
hit enter you should be taken to a screen like this:
The Upgrade Sales Page
Associate each form field with the corresponding unique name. Ta Da~ So this was for 3.7.4 If your on a later version it might be more complicated. Let me know if this helped or not.
Till next time
Less Screaming, More Coding