cj3wilso
Forum Replies Created
-
Forum: Plugins
In reply to: [WooCommerce] Warning: call_user_func_array()I have the Maya Shop too.. and this fix worked. Thanks! Located at /inc/woocommerce.php, line 27
Forum: Hacks
In reply to: help fix breadcrum function for custom post typesNot displaying any parent categories for my custom post type either. I have registered categories for this post type. Though the category name is unique (mycat_category), hierarchical is true.
Is it impossible to go through custom post types dynamically? Most queries I see use the name of the category to go through custom post type.. but I would rather use the Category ID so I can reuse the code!
Forum: Fixing WordPress
In reply to: Get rid of gophoto-link in image-urlsThanks!! I had the same problem. Found this plugin and deleted it. ??
Great. Let me know that it all works out. Glad to help! ??
Yeah sure. All I did was grab the st parameter in the transaction results URL. When you make a purchase in PayPal it should redirect back to your website.. the URL should look something like this:
/transaction-results/?sessionid=333&tx=rew6555&st=Completed&amt=100.00&cc=CAD&cm=&item_number=
I used the parameter “st” to check whether a purchase was made. Whatever page it redirects to, you could grab the page URL with PHP using this:
$_SERVER[“REQUEST_URI”]
This will grab the URL after the main domain… so “/test.php” NOT “www.apple.com/test.php”<?php
if ($_SERVER[“REQUEST_URI”]==”/test.php”) {
?>Glad I could help! Let me know if any problems ??
Hi,
If you’re going to do it the manual way I figured most of it out. Doesn’t track city or category, but everything else tracks.
Open wpsc-transaction_results.php in
/wp-content/plugins/wp-e-commerce/wpsc-theme/wpsc-transaction_results.php1. Purchase Tracking
At the bottom of the file add this code (Change UA-XXXXXXX-X to your UA code):
<!– GOOGLE ANALYTICS –>
<script type=”text/javascript”>var _gaq = _gaq || [];
_gaq.push([‘_setAccount’, ‘ UA-XXXXXXX-X ‘]);
_gaq.push([‘_trackPageview’]);<?php
if ($_GET[“st”]==”Completed”) {
?>
_gaq.push([‘_addTrans’,
‘<?php echo $purchase_log[‘id’]; ?>’, // order ID – required
‘<?php echo get_bloginfo(‘name’); ?>’, // affiliation or store name
‘<?php echo $purchase_log[‘totalprice’]; ?>’, // total – required
‘<?php echo $purchase_log[‘wpec_taxes_total’]; ?>’, // tax
‘<?php echo $purchase_log[‘base_shipping’]; ?>’, // shipping
‘<?php echo ‘NA’; ?>’, // city
‘<?php echo wpsc_get_region( $purchase_log[‘billing_region’] ); ?>’, // state or province
‘<?php echo wpsc_get_country( $purchase_log[‘billing_country’] ); ?>’ // country
]);<?php
$purchase_log_data_items_sql = mysql_query(“SELECT * FROM wp_wpsc_cart_contents WHERE purchaseid = “.$purchase_log[‘id’])or die(mysql_error());
//$purchase_log_data_items = mysql_fetch_array($purchase_log_data_items_sql);
while($purchase_log_data_item = mysql_fetch_array( $purchase_log_data_items_sql )){
//foreach( $purchase_log_data_items as $purchase_log_data_item ) {$purchase_log_sku_sql = mysql_query(“SELECT meta_value FROM wp_postmeta WHERE meta_key = ‘_wpsc_sku’ AND post_id = ‘”.$purchase_log_data_item[‘prodid’].”‘ LIMIT 1″)or die(mysql_error());
$sku = mysql_fetch_assoc($purchase_log_sku_sql);
if ($sku[‘meta_value’] == ”){
$sku[‘meta_value’] = “NA”;
}$purchase_log_data_item_parent_sql = mysql_query(“SELECT post_parent FROM wp_posts WHERE ID = ‘”.$purchase_log_data_item[‘prodid’].”‘ LIMIT 1″)or die(mysql_error());
$parent = mysql_fetch_assoc($purchase_log_data_item_parent_sql);$purchase_log_data_item_categoryid_sql = mysql_query(“SELECT term_taxonomy_id FROM wp_term_relationships WHERE object_id = ‘”.$purchase_log_data_item[‘post_parent’].”‘ LIMIT 1″)or die(mysql_error());
$categoryid = mysql_fetch_assoc($purchase_log_data_item_categoryid_sql);$purchase_log_data_item_category_sql = mysql_query(“SELECT name FROM wp_terms WHERE term_id = ‘”.$categoryid[‘term_taxonomy_id’].”‘ LIMIT 1″)or die(mysql_error());
$category = mysql_fetch_assoc($purchase_log_data_item_category_sql);
?>// add item might be called for every item in the shopping cart
// where your ecommerce engine loops through each item in the cart and
// prints out _addItem for each
_gaq.push([‘_addItem’,
‘<?php echo $purchase_log[‘id’]; ?>’, // order ID – required
‘<?php echo $sku[‘meta_value’]; ?>’, // SKU/code – required
‘<?php echo $purchase_log_data_item[‘name’]; ?>’, // product name
‘<?php echo $category[‘name’]; ?>’, // category or variation
‘<?php echo $purchase_log_data_item[‘price’]; ?>’, // unit price – required
‘<?php echo $purchase_log_data_item[‘quantity’]; ?>’ // quantity – required
]);
_gaq.push([‘_trackTrans’]); //submits transaction to the Analytics servers<?php
}
}
?>(function() {
var ga = document.createElement(‘script’); ga.type = ‘text/javascript’; ga.async = true;
ga.src = (‘https:’ == document.location.protocol ? ‘https://ssl’ : ‘https://www’) + ‘.google-analytics.com/ga.js’;
var s = document.getElementsByTagName(‘script’)[0]; s.parentNode.insertBefore(ga, s);
})();</script>
<!– END GOOGLE ANALYTICS –>2. General Tracking
For non-purchase tracking add this code to your theme header.php right after the opening body tag (Change UA-XXXXXXX-X to your UA code):
<?php
if ($_GET[“st”]!=”Completed”) {
?><!– GOOGLE ANALYTICS –>
<script type=”text/javascript”>var _gaq = _gaq || [];
_gaq.push([‘_setAccount’, ‘UA-XXXXXXX-X’]);
_gaq.push([‘_trackPageview’]);(function() {
var ga = document.createElement(‘script’); ga.type = ‘text/javascript’; ga.async = true;
ga.src = (‘https:’ == document.location.protocol ? ‘https://ssl’ : ‘https://www’) + ‘.google-analytics.com/ga.js’;
var s = document.getElementsByTagName(‘script’)[0]; s.parentNode.insertBefore(ga, s);
})();</script>
<!– END GOOGLE ANALYTICS –>
<?php
}
?>Having the same problem. If anyone figures this out let us know! Thanks ??