Jump to content

Recommended Posts

Hello everyone,

 

I already have a thread regarding this topic featured within the 'Third Party Scripts' forum, but I think it may be better suited to this particular part of the forum given the nature of the enquiry.

 

I have a ticket counter featured on a website I work on that displays the number of tickets left available for a number of events. I have since 'commented out' the code that displays the counter as it was decided by management that we no longer wanted people to see how many tickets had sold for any of the venues.

 

However, I now need the script to work in such a way that the ticket counter does not shown until the number of tickets left reaches '40', ie, highlighting limited availability.

 

The below code displays what I have so far and how the counter currently works, but I'm not sure how to modify the below in order to make the counter behave as required above.

 

//echo "<div class='tickets'>" . ($v['tickets_left'] < 30 ? "<span class='tickets_low'>" . escape($v['tickets_left']) . "</span>" : "" . escape($v['tickets_left']) . "") . " tickets left to buy for this match</div>";
				
			if ($v['tickets_left'] > 0) {
				echo "
					<div class='tickets_buy'>
						<input type='hidden' name='venue[]' value='" . escape($v['id']) . "' />
						Select how many tickets you wish to buy
						<select name='quantity[]' id='venue_" . escape($venuecount) . "' onchange='update_tickets()' onkeyup='update_tickets()'>
							<option value='0'>No tickets</option>
							<option value='1'" . (isset($_SESSION['tickets'][$v['id']]) && $_SESSION['tickets'][$v['id']] == '1' ? " selected='selected'" : "") . ">1 ticket</option>
							" . ($v['tickets_left'] > 5 ? "
							<option value='2'" . (isset($_SESSION['tickets'][$v['id']]) && $_SESSION['tickets'][$v['id']] == '2' ? " selected='selected'" : "") . ">2 tickets</option>
							<option value='3'" . (isset($_SESSION['tickets'][$v['id']]) && $_SESSION['tickets'][$v['id']] == '3' ? " selected='selected'" : "") . ">3 tickets</option>
							<option value='4'" . (isset($_SESSION['tickets'][$v['id']]) && $_SESSION['tickets'][$v['id']] == '4' ? " selected='selected'" : "") . ">4 tickets</option>
							<option value='5'" . (isset($_SESSION['tickets'][$v['id']]) && $_SESSION['tickets'][$v['id']] == '5' ? " selected='selected'" : "") . ">5 tickets</option>" : "") . "
						</select>
						<a href='#buy'>Confirm Ticket</a>
					</div>
				";

 

If someone more knowledgeable than myself could help out I would be really grateful :)


Many thanks in advance,

 

Ben_1uk.


 

Link to comment
https://forums.phpfreaks.com/topic/274964-ticket-counting-script/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.