Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SL-205] Feat - Add support for ticket purchase limit filter with Seating ticket form. #3438

Merged
merged 13 commits into from
Dec 4, 2024
Merged
4 changes: 4 additions & 0 deletions changelog/feat-sl-205-purchase-limit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: minor
Type: feat

Add support for max ticket purchase limit filter with seating tickets. [SL-205]
10 changes: 8 additions & 2 deletions src/Tickets/Seating/Frontend.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
use Tribe__Main as Common;
use TEC\Tickets\Commerce\Checkout;
use TEC\Tickets\Seating\Orders\Cart;
use Tribe__Tickets__Tickets_Handler as Tickets_Handler;

/**
* Class Controller.
Expand Down Expand Up @@ -455,7 +456,8 @@ public function get_ticket_block_data( $post_id ): array {
* ticketId: string,
* name: string,
* price: string,
* description: string
* description: string,
* maxLimit: int
* }>
* } The Seat Type map.
*/
Expand Down Expand Up @@ -489,13 +491,17 @@ public function build_seat_type_map( ?int $post_id = null ): array {
'tickets' => [],
];
}


/** @var Tickets_Handler $tickets_handler */
$tickets_handler = tribe( 'tickets.handler' );

$seat_type_map[ $seat_type ]['tickets'][] = [
'ticketId' => $ticket_id,
'name' => $ticket->name,
'price' => $ticket->price,
'description' => $ticket->description,
'dateInRange' => $ticket->date_in_range(),
'maxLimit' => $tickets_handler->get_ticket_max_purchase( $ticket_id ),
];
}

Expand Down
1 change: 1 addition & 0 deletions src/Tickets/Seating/app/frontend/ticketsBlock/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ const confirmSelector =
* @property {string} name The ticket name.
* @property {number} price The ticket price.
* @property {string} description The ticket description.
* @property {number} maxLimit The maximum number of tickets that can be selected.
*/

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,16 @@
"name": "Test TC ticket for {{post_id}}",
"price": "20",
"description": "Test TC ticket description for {{post_id}}",
"dateInRange": true
"dateInRange": true,
"maxLimit": 100
},
{
"ticketId": {{ticket_4}},
"name": "Test TC ticket for {{post_id}}",
"price": "30",
"description": "Test TC ticket description for {{post_id}}",
"dateInRange": true
"dateInRange": true,
"maxLimit": 100
}
]
},
Expand All @@ -29,14 +31,16 @@
"name": "Test TC ticket for {{post_id}}",
"price": "50",
"description": "Test TC ticket description for {{post_id}}",
"dateInRange": true
"dateInRange": true,
"maxLimit": 100
},
{
"ticketId": {{ticket_5}},
"name": "Test TC ticket for {{post_id}}",
"price": "10",
"description": "Test TC ticket description for {{post_id}}",
"dateInRange": true
"dateInRange": true,
"maxLimit": 100
}
]
},
Expand All @@ -48,7 +52,8 @@
"name": "Test TC ticket for {{post_id}}",
"price": "10",
"description": "Test TC ticket description for {{post_id}}",
"dateInRange": true
"dateInRange": true,
"maxLimit": 100
}
]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
"name": "Test TC ticket for {{post_id}}",
"price": "20",
"description": "Test TC ticket description for {{post_id}}",
"dateInRange": true
"dateInRange": true,
"maxLimit": 100
}
]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
"name": "Test TC ticket for {{post_id}}",
"price": "20",
"description": "Test TC ticket description for {{post_id}}",
"dateInRange": true
"dateInRange": true,
"maxLimit": 0
}
]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
"name": "Test TC ticket for {{post_id}}",
"price": "20",
"description": "Test TC ticket description for {{post_id}}",
"dateInRange": false
"dateInRange": false,
"maxLimit": 100
}
]
},
Expand All @@ -22,7 +23,8 @@
"name": "Test TC ticket for {{post_id}}",
"price": "10",
"description": "Test TC ticket description for {{post_id}}",
"dateInRange": false
"dateInRange": false,
"maxLimit": 100
}
]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
"name": "Test TC ticket for {{post_id}}",
"price": "20",
"description": "Test TC ticket description for {{post_id}}",
"dateInRange": false
"dateInRange": false,
"maxLimit": 100
}
]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
"name": "Test TC ticket for {{post_id}}",
"price": "10",
"description": "Test TC ticket description for {{post_id}}",
"dateInRange": false
"dateInRange": false,
"maxLimit": 100
}
]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
"name": "Test TC ticket for {{post_id}}",
"price": "20",
"description": "Test TC ticket description for {{post_id}}",
"dateInRange": true
"dateInRange": true,
"maxLimit": 100
}
]
},
Expand All @@ -22,7 +23,8 @@
"name": "Test TC ticket for {{post_id}}",
"price": "50",
"description": "Test TC ticket description for {{post_id}}",
"dateInRange": true
"dateInRange": true,
"maxLimit": 100
}
]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,16 @@
"name": "Test TC ticket for {{post_id}}",
"price": "10",
"description": "Test TC ticket description for {{post_id}}",
"dateInRange": false
"dateInRange": false,
"maxLimit": 100
},
{
"ticketId": {{ticket_3}},
"name": "Test TC ticket for {{post_id}}",
"price": "30",
"description": "Test TC ticket description for {{post_id}}",
"dateInRange": true
"dateInRange": true,
"maxLimit": 100
}
]
},
Expand All @@ -29,7 +31,8 @@
"name": "Test TC ticket for {{post_id}}",
"price": "20",
"description": "Test TC ticket description for {{post_id}}",
"dateInRange": false
"dateInRange": false,
"maxLimit": 100
}
]
}
Expand Down
Loading