Pages

Monday 20 February 2012

Sharepoint 2010 Date Column Validation with [Today] Date

with new SP 2010 Column validation . 1st thought that came to my mind is date field validation with respect to today's date. then quickly create a date column TestDate and  and add the validation formula as below .
=[ TestDate ]>=[TODAY]

Then it will give you a error.
after some hit and trial I found actual expression should be
=[ TestDate ]>=TODAY()


Yapee......

Tuesday 14 February 2012

WP e-Commerce digital product Download link on google checkout

When you are working with WP e-Commerce plugin for word press linked with Google Checkout for payment .and your shop is for  Digital Product and you feel you need more from this plugin then you are in right place . I have many issues  while configuring this plugin for one of my shop
1. Unable to display download link for digital products  after checkout .
2. No links to download digital product after Google checkout .
3  WP e-Commerce  add multiple  entries to  for single transaction
 4.Google checkout send Pending for shipping mail to user which in confusing .

Solution:
the problem is plugin is not sending google information about the product . it just sends its pricing details.  to fix this go ahead and modify  phugins PHP files

Step 1 Go to Location "..\wp-e-commerce\wpsc-merchants"
Step2 . Open    GoogleCheckout-XML.php
Step 3. Go to Line number  182  ( just above   $cart->AddItem($cart_item); )
Step 4.Add below code to it just before  line $cart->AddItem($cart_item);
  
//Extra code  send media download url to google checkout  
   $siteurl = get_option('siteurl');
   $previous_download_ids = array(0);
   $product_id = wpsc_cart_item_product_id();
   $link = "";
   //$product_data = $wpdb->get_row("SELECT * FROM `".WPSC_TABLE_PRODUCT_LIST."` WHERE `id`='{$product_id}' LIMIT 1", ARRAY_A) ;
   $wpdb->query("UPDATE `".WPSC_TABLE_DOWNLOAD_STATUS."` SET `active`='1' WHERE `product_id` = '$product_id' AND `purchid` = '{$purchase_log[0]['id']}'");
   
   $download_data = $wpdb->get_results("SELECT * FROM `".WPSC_TABLE_DOWNLOAD_STATUS."`
       WHERE `".WPSC_TABLE_DOWNLOAD_STATUS."`.`active`='1'
       AND `".WPSC_TABLE_DOWNLOAD_STATUS."`.`purchid`='".$purchase_log[0]['id']."'
       AND `".WPSC_TABLE_DOWNLOAD_STATUS."`.`product_id` ='".$product_id."'
       AND `".WPSC_TABLE_DOWNLOAD_STATUS."`.`id` NOT IN ('".implode("','",$previous_download_ids)."')",ARRAY_A);
     
     $link=array();
     if(sizeof($download_data) != 0) {
      foreach($download_data as $single_download){
       if($single_download['uniqueid'] == null){// if the uniqueid is not equal to null, its "valid", regardless of what it is
        $link[] = array("url"=>$siteurl."?downloadid=".$single_download['id'], "name" =>$single_download["filename"]); 
       } else {
        $link[] = array("url"=>$siteurl."?downloadid=".$single_download['uniqueid'], "name" =>$single_download["filename"]);
       }
      }
     }
   foreach($link as $single_link)
   {
    // $product_list .= "\n\r ".$single_link["name"].": ".$single_link["url"]."\n\r";
    $cart_item->SetURLDigitalContent($single_link["url"], null, wpsc_cart_item_name());
    break;
   }
      //End of extra code  Vijay
Step 4. Now you are done .

What the above line of code will do ?
1. Create entry in WPSC_TABLE_DOWNLOAD_STATUS table unique id for download url .
2. Activate the URL
3. Send download URL information to Google to be displayed in Google checkout page after transaction complete. user really dont have to come back to your site to get the download link
4. Along with download URL Google will treat this product as digital digital product so no shipping issue  .
5. on top of all these this download  url information will be there in Google checkout mail send to buyer .

I hope wp-ecommerce will add this oprion to there code .