Skip to content

Commit 5c95914

Browse files
authored
Merge pull request #142 from MultinetInteractive/feature-moreprices
1.0.28
2 parents 7186b1a + 85715c0 commit 5c95914

3 files changed

Lines changed: 51 additions & 3 deletions

File tree

eduadmin.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
* Plugin URI: http://www.eduadmin.se
99
* Description: EduAdmin plugin to allow visitors to book courses at your website
1010
* Tags: booking, participants, courses, events, eduadmin, lega online
11-
* Version: 1.0.27
11+
* Version: 1.0.28
1212
* GitHub Plugin URI: multinetinteractive/eduadmin-wordpress
1313
* GitHub Plugin URI: https://github.com/multinetinteractive/eduadmin-wordpress
1414
* Requires at least: 4.7

includes/_shortcodes.php

Lines changed: 49 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -410,6 +410,54 @@ function eduadmin_get_detailinfo( $attributes ) {
410410
foreach ( $prices as $price ) {
411411
$uniquePrices[ $price->Description ] = $price;
412412
}
413+
414+
if ( count( $uniquePrices ) == 0 ) {
415+
$filtering = new XFiltering();
416+
$f = new XFilter( 'ObjectID', '=', $selectedCourse->ObjectID );
417+
$filtering->AddItem( $f );
418+
419+
$f = new XFilter( 'PublicPriceName', '=', "True" );
420+
$filtering->AddItem( $f );
421+
422+
$sorting = new XSorting();
423+
$customOrder = null;
424+
$customOrderBy = null;
425+
if ( !empty( $attributes['order'] ) ) {
426+
$customOrder = $attributes['order'];
427+
}
428+
429+
if ( !empty( $attributes['orderby'] ) ) {
430+
$customOrderBy = $attributes['orderby'];
431+
}
432+
433+
if ( $customOrderBy != null ) {
434+
$orderby = explode( ' ', $customOrderBy );
435+
$sortorder = explode( ' ', $customOrder );
436+
foreach ( $orderby as $od => $v ) {
437+
if ( isset( $sortorder[ $od ] ) ) {
438+
$or = $sortorder[ $od ];
439+
} else {
440+
$or = "ASC";
441+
}
442+
443+
$s = new XSort( $v, $or );
444+
$sorting->AddItem( $s );
445+
}
446+
} else {
447+
$s = new XSort( 'PriceNameID', $customOrder != null ? $customOrder : 'ASC' );
448+
$sorting->AddItem( $s );
449+
}
450+
451+
$edo = get_transient( 'eduadmin-objectpublicpricename_' . $selectedCourse->ObjectID );
452+
if ( !$edo ) {
453+
$edo = EDU()->api->GetObjectPriceName( EDU()->get_token(), $sorting->ToString(), $filtering->ToString() );
454+
set_transient( 'eduadmin-objectpublicpricename_' . $selectedCourse->ObjectID, $edo, 10 );
455+
}
456+
457+
foreach ( $edo as $price ) {
458+
$uniquePrices[ $price->Description ] = $price;
459+
}
460+
}
413461

414462
$currency = get_option( 'eduadmin-currency', 'SEK' );
415463
if ( 1 == count( $uniquePrices ) ) {
@@ -721,4 +769,4 @@ function eduadmin_get_login_view( $attributes ) {
721769
add_shortcode( 'eduadmin-objectinterest', 'eduadmin_get_object_interest' );
722770
add_shortcode( 'eduadmin-eventinterest', 'eduadmin_get_event_interest' );
723771
add_shortcode( 'eduadmin-coursepublicpricename', 'eduadmin_get_course_public_pricename' );
724-
}
772+
}

readme.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Contributors: mnchga
33
Tags: booking, participants, courses, events, eduadmin, lega online
44
Requires at least: 4.7
55
Tested up to: 4.9.2
6-
Stable tag: 1.0.27
6+
Stable tag: 1.0.28
77
Requires PHP: 5.2
88
License: GPL3
99
License-URI: https://www.gnu.org/licenses/gpl-3.0.en.html

0 commit comments

Comments
 (0)