Plugin Directory

Changeset 700610


Ignore:
Timestamp:
04/20/2013 07:06:16 AM (13 years ago)
Author:
Sanskript
Message:

Nightly Check in - Improved Sync Feature

Location:
soldpress/branches/0.9.5A
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • soldpress/branches/0.9.5A/adapter.php

    r700512 r700610  
    9090        $this->displaylog(var_dump($this->service->GetAllLookupValues("Property")));
    9191        $this->displaylog(var_dump($this->service->GetAllLookupValues("Office")));
    92         $this->displaylog(var_dump($this->service->GetAllLookupValues("Agent")));
     92            $this->displaylog(var_dump($this->service->GetAllLookupValues("Agent")));
    9393       
    9494        $this->displaylog(var_dump($this->service->GetMetadataObjects("Property")));
     
    100100    public function sync_residentialproperty($crit, $culture)
    101101    {   
     102        echo $crit;
     103
    102104        if($culture =='')
    103105        {
     
    105107        }
    106108
    107         $results = $this->service->SearchQuery("Property","Property",$crit,array("Limit" => 1,"Culture" => $culture)); 
     109        $results = $this->service->SearchQuery("Property","Property",$crit,array("Limit" => 'None',"Culture" => $culture));
    108110       
    109111        while ($rets = $this->service->FetchRow($results)) {
     112
     113            $ListingKey = $rets['ListingKey'];
     114            echo 'TheKeyIs' . $ListingKey .'<br>';
     115           
    110116            //Check And See If We Have A Post Mathing The Listing Key
    111117            $args = array(
     
    114120                    array(
    115121                        'key' => 'ListingKey',
    116                         'value' => '11937198',)
     122                        'value' => $ListingKey,)
    117123                )
    118124             );
     
    120126            $posts_array = get_posts( $args );
    121127           
    122             $title = $rets['ListingId'];
    123             $content = $rets['PublicRemarks'];
    124            
    125         //  $post_id = '-1';
    126 
     128            $title = $rets['UnparsedAddress'] .' (' . $rets['ListingId'] .')';
     129            $content = time();
     130       
    127131            if( $posts_array ) {
     132           
    128133                $post = $posts_array[0];
    129134                $post->post_title = $title;
    130                 $post->post_content  = $content;
     135                $post->post_content  = $content . 'Updated';
    131136                wp_update_post($post);
    132137                $post_id = $post->ID;
    133138            }
    134             else
    135             {              
     139            else{               
     140               
    136141                $post = array(
    137142                      'post_title'    => $title ,
     
    145150            }
    146151
    147             echo 'file1';
    148             //Let's Property Image
    149             //$this->getpropertyobject($rets['ListingKey'], 'ThumbnailPhoto',$post_id);
    150152            $this->sync_propertyobject($rets['ListingKey'], 'Photo',$post_id);
    151153       
    152             //If No Tempalte This Begins The Import Phase
    153             //  echo 'theid' . $post_id;
    154 
    155                 foreach($rets as $key => &$val) {
    156                    
    157                     update_post_meta($post_id,$key, $val);
    158 
    159                     if($val != NULL) {
    160                         $template .= $key . ":" . $val . "<br>" ;
    161                     }
    162                 }   
    163             }       
     154            foreach($rets as $key => &$val) {                   
     155                update_post_meta($post_id,$key, $val);
     156            }   
     157        }       
    164158           
    165159        $this->service->FreeResult($results);
     
    213207            //If attachement is already attached do nothing with the meta data just update the file.
    214208               
    215             echo "Attachmet" . $filePath;
     209        //  echo "Attachmet" . $filePath;
    216210           
    217211            $wp_filetype = wp_check_filetype(basename($filename), null );
  • soldpress/branches/0.9.5A/custom_field_types.php

    r700593 r700610  
    2323            'description'         => __( 'Property information pages', 'text_domain' ),
    2424            'labels'              => $labels,
    25             'supports'            => array( 'title', 'editor', 'excerpt', 'author', 'thumbnail', 'revisions', 'custom-fields', 'page-attributes', 'post-formats', ),
    26             'taxonomies'          => false;
     25            'supports'            => array( 'title', 'editor', 'excerpt', 'author', 'thumbnail', 'custom-fields', ),
     26            'taxonomies'          => false,
    2727            'hierarchical'        => false,
    2828            'public'              => true,
  • soldpress/branches/0.9.5A/soldpress.php

    r700512 r700610  
    4646    // do something every hour
    4747    update_option( 'sc-lastupdate', time() );
     48
     49    $adapter= new soldpress_adapter();
     50    if($adapter->connect())
     51    {
     52        return $adapter-> sync_residentialproperty("LastUpdated=2011-05-08T22:00:17Z","");  //HardCode Time For Testing
     53    }
     54
     55}
     56
     57add_filter( 'template_include', 'include_template_function', 1 );
     58
     59function include_template_function( $template_path ) {
     60    if ( get_post_type() == 'property' ) {
     61        if ( is_single() ) {
     62            // checks if the file exists in the theme first,
     63            // otherwise serve the file from the plugin
     64            if ( $theme_file = locate_template( array ( 'single-property.php' ) ) ) {
     65                $template_path = $theme_file;
     66            } else {
     67                $template_path = plugin_dir_path( __FILE__ ) . '/single-property.php';
     68            }
     69        }
     70    }
     71    return $template_path;
    4872}
    4973
Note: See TracChangeset for help on using the changeset viewer.