getshopped
25
Oct
2011
In getshopped
hack
php
WordPress
WordPress 3.0
WordPress Development
WordPress Plugins
wp e-commerce
By Andy
Getshopped – Add more details to sales CSV
On 25, Oct 2011 | 2 Comments | In getshopped, hack, php, WordPress, WordPress 3.0, WordPress Development, WordPress Plugins, wp e-commerce | By Andy
I have previously showed I added shipping columns to the sales logs page in a getshopped (Wp-Ecommerce) installation. This was fine but now we need that data to show up in the csv download.
Here’s how to do it-
Open wp-content/plugins/wp-e-commerce/wpsc-admin/ajax-and-init.php and find the function wpsc_purchase_log_csv();
Find this-
$headers = ""Purchase ID","Purchase Total","; //capture the headers
And replace it with this-
$headers = "Purchase ID, Item Price, Item Shipping, Item Total,"; //capture the headers
A few lines under that you will find the beginning of the foreach loop, which looks like this-
foreach ( (array)$data as $purchase ) {
Right after that add this-
$purch_item_price = $purchase['totalprice'];
$price_wo_shipping = $purch_item_price - (float)preg_replace('/[^0-9.]/', '', $purchase['base_shipping']);
And then below that should be this-
$form_headers = ''; $output .= """ . $purchase['id'] . "","; //Purchase ID $output .= """ . $purchase['totalprice'] . "","; //Purchase Total
Replace it with this-
$form_headers = ''; $output .= """ . $purchase['id'] . "","; //Purchase ID $output .= """ . $price_wo_shipping . "","; //Item w/o shipping $output .= """ . $purchase['base_shipping'] . "","; //Shipping $output .= """ . $purchase['totalprice'] . "","; //Purchase Total
And you’re done!
Have fun!
Comments
-
You just saved me having to find an alternative e-commerce plugin… THANK YOU!










Submit a Comment