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

@ -195,7 +195,7 @@ jQuery( document ).ready( function ( $ ) {
} );
$( 'body' )
// Star ratings for comments
// Star ratings for comments
.on( 'click', '.comment-form-rating p.opalestate-stars a', function () {
var $star = $( this ),
$rating = $( this ).closest( '.comment-form-rating' ).find( '.opalestate_rating' ),
@ -224,26 +224,26 @@ jQuery( document ).ready( function ( $ ) {
var window_width = $( window ).width();
if (window_width < 768) {
$(".opalestate-sticky-column").trigger("sticky_kit:detach");
if ( window_width < 768 ) {
$( '.opalestate-sticky-column' ).trigger( 'sticky_kit:detach' );
} else {
make_sticky();
}
$( window ).resize(function() {
$( window ).resize( function () {
window_width = $( window ).width();
if (window_width < 768) {
$(".opalestate-sticky-column").trigger("sticky_kit:detach");
if ( window_width < 768 ) {
$( '.opalestate-sticky-column' ).trigger( 'sticky_kit:detach' );
} else {
make_sticky();
}
});
} );
function make_sticky() {
$(".opalestate-sticky-column").stick_in_parent();
$( '.opalestate-sticky-column' ).stick_in_parent();
}
////
@ -577,17 +577,33 @@ jQuery( document ).ready( function ( $ ) {
$( '.ajax-load-properties' ).delegate( '.pagination li', 'click', function () {
var $content = $( this ).parents( '.ajax-load-properties' );
$.ajax( {
type: 'POST',
url: opalesateJS.ajaxurl,
data: location.search.substr( 1 ) + '&action=get_agent_property&paged=' + $( this ).data( 'paged' ) +
'&id=' + $content.data( 'id' ),
success: function ( data ) {
if ( data ) {
$content.html( data );
var type = $( this ).parents( '.ajax-load-properties' ).data( 'type' );
if ( type === 'agent' ) {
$.ajax( {
type: 'POST',
url: opalesateJS.ajaxurl,
data: location.search.substr( 1 ) + '&action=get_agent_property&paged=' + $( this ).data( 'paged' ) +
'&id=' + $content.data( 'id' ),
success: function ( data ) {
if ( data ) {
$content.html( data );
}
}
}
} );
} );
} 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;
} );

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 =
* Fixes - Pending properties review
* Fixes - Search form default value

View File

@ -227,36 +227,36 @@ function opalestate_toggle_featured_property() {
/**
* load more properties by agency
*/
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' );
function opalestate_load_more_agency_property() {
$post = [
'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( $post_id ), OPALESTATE_AGENCY_PREFIX . 'user_id', true );
$query = Opalestate_Query::get_agency_property( absint( $post_id ), absint( $user_id ), absint( $limit ), absint( $paged ) );
if ( $query->have_posts() ) :
while ( $query->have_posts() ) : $query->the_post(); ?>
<div class="col-lg-12 col-md-12 col-sm-12">
<?php echo opalestate_load_template_path( 'content-property-list-v2' ); ?>
</div>
<?php endwhile;
endif;
wp_reset_postdata();
exit;
}
// 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' );
//
// function opalestate_load_more_agency_property() {
//
//
// $post = [
// '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( $post_id ), OPALESTATE_AGENCY_PREFIX . 'user_id', true );
// $query = Opalestate_Query::get_agency_property( absint( $post_id ), absint( $user_id ), absint( $limit ), absint( $paged ) );
//
// if ( $query->have_posts() ) :
// while ( $query->have_posts() ) : $query->the_post(); ?>
<!-- <div class="col-lg-12 col-md-12 col-sm-12">-->
<!-- --><?php //echo opalestate_load_template_path( 'content-property-list-v2' ); ?>
<!-- </div>-->
<!-- --><?php //endwhile;
// endif;
// wp_reset_postdata();
// exit;
// }
/**
@ -271,7 +271,7 @@ function opalestate_get_agent_property() {
'paged' => 1,
'id' => 13,
'limit' => apply_filters( 'opalesate_agent_properties_limit', 1 ),
'limit' => apply_filters( 'opalesate_agent_properties_limit', 6 ),
];
$post = array_merge( $post, $_POST );
@ -280,13 +280,57 @@ function opalestate_get_agent_property() {
set_query_var( 'paged', $post['paged'] );
$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'] );
if ( $query->have_posts() ) : ?>
<div class="opalestate-rows">
<div class="<?php echo apply_filters( 'opalestate_row_container_class', 'row opal-row' ); ?>">
<?php while ( $query->have_posts() ) : $query->the_post(); ?>
<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>
<?php endwhile; ?>
</div>

View File

@ -3,7 +3,7 @@
* Plugin Name: Opal Estate Pro
* 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.
* Version: 1.3.9
* Version: 1.3.9.1
* Author: WPOPAL
* Author URI: http://www.wpopal.com
* 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
Requires at least: 4.9
Tested up to: 5.3.2
Stable tag: 1.3.9
Stable tag: 1.3.9.1
License: GPLv3
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")
== Changelog ==
= 1.3.9.1 - 2020-03-23 =
* Fixes - Single agency properties load more
= 1.3.9 - 2020-03-17 =
* Fixes - Pending properties review
* Fixes - Search form default value

View File

@ -13,28 +13,24 @@ if ( $query->have_posts() ) :
<div class="clearfix clear"></div>
<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>
<div class="opalestate-rows">
<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(); ?>
<div class="col-lg-12 col-md-12 col-sm-12">
<?php echo opalestate_load_template_path( 'content-property-list-v2' ); ?>
</div>
<?php endwhile; ?>
</div>
<?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="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 class="ajax-load-properties" data-paged="1" data-type="agency" data-id="<?php echo get_the_ID(); ?>">
<div class="opalestate-rows">
<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(); ?>
<div class="col-lg-12 col-md-12 col-sm-12">
<?php echo opalestate_load_template_path( 'content-property-list-v2' ); ?>
</div>
<?php endwhile; ?>
</div>
<?php endif; ?>
<?php if ( $query->max_num_pages > 1 ): ?>
<div class="w-pagination"><?php opalestate_pagination( $query->max_num_pages ); ?></div>
<?php endif; ?>
</div>
</div>
</div>
<?php else : ?>
<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>
<?php endif; ?>

View File

@ -1,7 +1,7 @@
<?php
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 );
if ( $query->have_posts() ) : ?>