Fix single agency properties

This commit is contained in:
Hoang Huu 2020-03-23 11:13:53 +07:00
parent 9245035bda
commit 73fb75c3fd
7 changed files with 132 additions and 70 deletions

View File

@ -225,7 +225,7 @@ jQuery( document ).ready( function ( $ ) {
var window_width = $( window ).width(); var window_width = $( window ).width();
if ( window_width < 768 ) { if ( window_width < 768 ) {
$(".opalestate-sticky-column").trigger("sticky_kit:detach"); $( '.opalestate-sticky-column' ).trigger( 'sticky_kit:detach' );
} else { } else {
make_sticky(); make_sticky();
} }
@ -235,7 +235,7 @@ jQuery( document ).ready( function ( $ ) {
window_width = $( window ).width(); window_width = $( window ).width();
if ( window_width < 768 ) { if ( window_width < 768 ) {
$(".opalestate-sticky-column").trigger("sticky_kit:detach"); $( '.opalestate-sticky-column' ).trigger( 'sticky_kit:detach' );
} else { } else {
make_sticky(); make_sticky();
} }
@ -243,7 +243,7 @@ jQuery( document ).ready( function ( $ ) {
} ); } );
function make_sticky() { function make_sticky() {
$(".opalestate-sticky-column").stick_in_parent(); $( '.opalestate-sticky-column' ).stick_in_parent();
} }
//// ////
@ -577,6 +577,8 @@ jQuery( document ).ready( function ( $ ) {
$( '.ajax-load-properties' ).delegate( '.pagination li', 'click', function () { $( '.ajax-load-properties' ).delegate( '.pagination li', 'click', function () {
var $content = $( this ).parents( '.ajax-load-properties' ); var $content = $( this ).parents( '.ajax-load-properties' );
var type = $( this ).parents( '.ajax-load-properties' ).data( 'type' );
if ( type === 'agent' ) {
$.ajax( { $.ajax( {
type: 'POST', type: 'POST',
url: opalesateJS.ajaxurl, url: opalesateJS.ajaxurl,
@ -588,6 +590,20 @@ jQuery( document ).ready( function ( $ ) {
} }
} }
} ); } );
} else if ( type === 'agency' ) {
$.ajax( {
type: 'POST',
url: opalesateJS.ajaxurl,
data: location.search.substr( 1 ) + '&action=get_agency_property&paged=' + $( this ).data( 'paged' ) +
'&id=' + $content.data( 'id' ),
success: function ( data ) {
if ( data ) {
$content.html( data );
}
}
} );
}
return false; return false;
} ); } );

View File

@ -1,3 +1,6 @@
= 1.3.9.1 - 2020-03-23 =
* Fixes - Single agency properties load more
= 1.3.9 - 2020-03-17 = = 1.3.9 - 2020-03-17 =
* Fixes - Pending properties review * Fixes - Pending properties review
* Fixes - Search form default value * Fixes - Search form default value

View File

@ -227,36 +227,36 @@ function opalestate_toggle_featured_property() {
/** /**
* load more properties by agency * load more properties by agency
*/ */
add_action( 'wp_ajax_get_agency_property', 'opalestate_load_more_agency_property' ); // add_action( 'wp_ajax_get_agency_property', 'opalestate_load_more_agency_property' );
add_action( 'wp_ajax_nopriv_get_agency_property', 'opalestate_load_more_agency_property' ); // add_action( 'wp_ajax_nopriv_get_agency_property', 'opalestate_load_more_agency_property' );
//
function opalestate_load_more_agency_property() { // function opalestate_load_more_agency_property() {
//
//
$post = [ // $post = [
'post_id' => 0, // 'post_id' => 0,
'paged' => 1, // 'paged' => 1,
'user_id' => 13, // 'user_id' => 13,
'related' => '', // 'related' => '',
'limit' => apply_filters( 'opalesate_agency_properties_limit', 5 ), // 'limit' => apply_filters( 'opalesate_agency_properties_limit', 5 ),
]; // ];
//
$post = array_merge( $post, $_POST ); // $post = array_merge( $post, $_POST );
extract( $post ); // extract( $post );
//
$user_id = get_post_meta( absint( $post_id ), OPALESTATE_AGENCY_PREFIX . 'user_id', true ); // $user_id = get_post_meta( absint( $post_id ), OPALESTATE_AGENCY_PREFIX . 'user_id', true );
$query = Opalestate_Query::get_agency_property( absint( $post_id ), absint( $user_id ), absint( $limit ), absint( $paged ) ); // $query = Opalestate_Query::get_agency_property( absint( $post_id ), absint( $user_id ), absint( $limit ), absint( $paged ) );
//
if ( $query->have_posts() ) : // if ( $query->have_posts() ) :
while ( $query->have_posts() ) : $query->the_post(); ?> // while ( $query->have_posts() ) : $query->the_post(); ?>
<div class="col-lg-12 col-md-12 col-sm-12"> <!-- <div class="col-lg-12 col-md-12 col-sm-12">-->
<?php echo opalestate_load_template_path( 'content-property-list-v2' ); ?> <!-- --><?php //echo opalestate_load_template_path( 'content-property-list-v2' ); ?>
</div> <!-- </div>-->
<?php endwhile; <!-- --><?php //endwhile;
endif; // endif;
wp_reset_postdata(); // wp_reset_postdata();
exit; // exit;
} // }
/** /**
@ -271,7 +271,7 @@ function opalestate_get_agent_property() {
'paged' => 1, 'paged' => 1,
'id' => 13, 'id' => 13,
'limit' => apply_filters( 'opalesate_agent_properties_limit', 1 ), 'limit' => apply_filters( 'opalesate_agent_properties_limit', 6 ),
]; ];
$post = array_merge( $post, $_POST ); $post = array_merge( $post, $_POST );
@ -280,13 +280,57 @@ function opalestate_get_agent_property() {
set_query_var( 'paged', $post['paged'] ); set_query_var( 'paged', $post['paged'] );
$query = Opalestate_Query::get_agent_property( null, absint( $post['id'] ), absint( $limit ) ); $query = Opalestate_Query::get_agent_property( null, absint( $post['id'] ), absint( $limit ) );
$paged = absint( $post['paged'] );
if ( $query->have_posts() ) : ?>
<div class="opalestate-rows">
<div class="<?php echo apply_filters( 'opalestate_row_container_class', 'opal-row' ); ?>">
<?php while ( $query->have_posts() ) : $query->the_post(); ?>
<div class="col-lg-6 col-md-6 col-sm-12">
<?php echo opalestate_load_template_path( 'content-property-grid' ); ?>
</div>
<?php endwhile; ?>
</div>
</div>
<?php if ( $query->max_num_pages > 1 ): ?>
<div class="w-pagination"><?php opalestate_pagination( $query->max_num_pages ); ?></div>
<?php endif; ?>
<?php
endif;
wp_reset_postdata();
exit;
}
/**
* load more properties by agency
*/
add_action( 'wp_ajax_get_agency_property', 'opalestate_get_agency_property' );
add_action( 'wp_ajax_nopriv_get_agency_property', 'opalestate_get_agency_property' );
function opalestate_get_agency_property() {
global $paged;
$post = [
'id' => 0,
'paged' => 1,
'user_id' => 13,
'related' => '',
'limit' => apply_filters( 'opalesate_agency_properties_limit', 5 ),
];
$post = array_merge( $post, $_POST );
extract( $post );
$user_id = get_post_meta( absint( $id ), OPALESTATE_AGENCY_PREFIX . 'user_id', true );
$user_id = $user_id ? $user_id : null;
$query = Opalestate_Query::get_agency_property( absint( $id ), absint( $user_id ), absint( $limit ), absint( $paged ) );
$paged = absint( $post['paged'] ); $paged = absint( $post['paged'] );
if ( $query->have_posts() ) : ?> if ( $query->have_posts() ) : ?>
<div class="opalestate-rows"> <div class="opalestate-rows">
<div class="<?php echo apply_filters( 'opalestate_row_container_class', 'row opal-row' ); ?>"> <div class="<?php echo apply_filters( 'opalestate_row_container_class', 'row opal-row' ); ?>">
<?php while ( $query->have_posts() ) : $query->the_post(); ?> <?php while ( $query->have_posts() ) : $query->the_post(); ?>
<div class="col-lg-12 col-md-12 col-sm-12"> <div class="col-lg-12 col-md-12 col-sm-12">
<?php echo opalestate_load_template_path( 'content-property-list' ); ?> <?php echo opalestate_load_template_path( 'content-property-list-v2' ); ?>
</div> </div>
<?php endwhile; ?> <?php endwhile; ?>
</div> </div>

View File

@ -3,7 +3,7 @@
* Plugin Name: Opal Estate Pro * Plugin Name: Opal Estate Pro
* Plugin URI: https://wpdocs.gitbook.io/opal-estate/ * Plugin URI: https://wpdocs.gitbook.io/opal-estate/
* Description: Opal Real Estate Plugin is an ideal solution and brilliant choice for you to set up a professional estate website. * Description: Opal Real Estate Plugin is an ideal solution and brilliant choice for you to set up a professional estate website.
* Version: 1.3.9 * Version: 1.3.9.1
* Author: WPOPAL * Author: WPOPAL
* Author URI: http://www.wpopal.com * Author URI: http://www.wpopal.com
* Requires at least: 4.9 * Requires at least: 4.9

View File

@ -4,7 +4,7 @@ Donate link: https://wpdocs.gitbook.io/opal-estate/
Tags: estate, property, opalestate, house for rent, agency for lease, estate submission, agents estate property, property marketplace Tags: estate, property, opalestate, house for rent, agency for lease, estate submission, agents estate property, property marketplace
Requires at least: 4.9 Requires at least: 4.9
Tested up to: 5.3.2 Tested up to: 5.3.2
Stable tag: 1.3.9 Stable tag: 1.3.9.1
License: GPLv3 License: GPLv3
License URI: http://www.gnu.org/licenses/gpl-3.0.html License URI: http://www.gnu.org/licenses/gpl-3.0.html
@ -156,6 +156,9 @@ This section describes how to install the plugin and get it working.
* System tickets support 24/7 available : [free support](https://wpopal.ticksy.com/ "Visit the Plugin support Page") * System tickets support 24/7 available : [free support](https://wpopal.ticksy.com/ "Visit the Plugin support Page")
== Changelog == == Changelog ==
= 1.3.9.1 - 2020-03-23 =
* Fixes - Single agency properties load more
= 1.3.9 - 2020-03-17 = = 1.3.9 - 2020-03-17 =
* Fixes - Pending properties review * Fixes - Pending properties review
* Fixes - Search form default value * Fixes - Search form default value

View File

@ -13,6 +13,7 @@ if ( $query->have_posts() ) :
<div class="clearfix clear"></div> <div class="clearfix clear"></div>
<div class="opalestate-box-inner property-agency-section"> <div class="opalestate-box-inner property-agency-section">
<h4 class="box-heading hide"><?php echo sprintf( esc_html__( 'My Properties', 'opalestate-pro' ), $query->found_posts ); ?></h4> <h4 class="box-heading hide"><?php echo sprintf( esc_html__( 'My Properties', 'opalestate-pro' ), $query->found_posts ); ?></h4>
<div class="ajax-load-properties" data-paged="1" data-type="agency" data-id="<?php echo get_the_ID(); ?>">
<div class="opalestate-rows"> <div class="opalestate-rows">
<div class="<?php echo apply_filters( 'opalestate_row_container_class', 'opal-row' ); ?>" id="<?php echo esc_attr( $id ); ?>"> <div class="<?php echo apply_filters( 'opalestate_row_container_class', 'opal-row' ); ?>" id="<?php echo esc_attr( $id ); ?>">
<?php while ( $query->have_posts() ) : $query->the_post(); ?> <?php while ( $query->have_posts() ) : $query->the_post(); ?>
@ -22,19 +23,14 @@ if ( $query->have_posts() ) :
<?php endwhile; ?> <?php endwhile; ?>
</div> </div>
<?php if ( $query->max_num_pages > 1 ): ?> <?php if ( $query->max_num_pages > 1 ): ?>
<div class="w-pagination"><?php // echo $query->max_num_pages; // opalestate_pagination( $query->max_num_pages ); ?></div> <div class="w-pagination"><?php opalestate_pagination( $query->max_num_pages ); ?></div>
<div class="opalestate-load-more text-center" data-post_id="<?php echo $agency_id; ?>" data-action="get_agency_property" data-related="<?php echo esc_attr( $id ); ?>"
data-numpage="<?php echo
$query->max_num_pages; ?>" data-paged="2">
<button class="btn btn-primary btn-3d"> <?php esc_html_e( 'Load More', 'opalestate-pro' ); ?></button>
</div>
<?php endif; ?> <?php endif; ?>
</div>
</div> </div>
</div> </div>
<?php else : ?> <?php else : ?>
<div class="opalestate-message"> <div class="opalestate-message">
<?php esc_html_e( 'My Agency has not any property yet.', 'opalestate-pro' ); ?> <?php esc_html_e( 'The agency has not any property yet.', 'opalestate-pro' ); ?>
</div> </div>
<?php endif; ?> <?php endif; ?>

View File

@ -1,7 +1,7 @@
<?php <?php
global $post; global $post;
$limit = apply_filters( 'opalesate_agent_properties_limit', 10 ); $limit = apply_filters( 'opalesate_agent_properties_limit', 5 );
$query = Opalestate_Query::get_agent_property( null, get_the_ID(), $limit ); $query = Opalestate_Query::get_agent_property( null, get_the_ID(), $limit );
if ( $query->have_posts() ) : ?> if ( $query->have_posts() ) : ?>