OzRin
Feb 22nd, 2023
253
0
Never
This is comment for paste add zeroes (0) in front of ticket numbers
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. The best I found is:
  2.  
  3. add_filter( 'ticket_number_display_html' , 'custom_change_prefic_ticket_numbers', 10, 2 );
  4. function custom_change_prefic_ticket_numbers($data, $product) {
  5. $max_tickets = $product->get_max_tickets();
  6. $ticket_number = str_pad($data, strlen((string)$max_tickets), '0', STR_PAD_LEFT);
  7. return substr($ticket_number, -3); // Truncate to 3 digits
  8. }
  9.  
  10. "Chat-GPT Help"
  11.  
  12. This helps visually making the last number of the raffle "1,000" as 000 eliminating the extra 1 or digit space where 0 would have been filled in other lower numbers.
  13.  
  14. I still cannot make the raffle start at ticket Number 000 when max number is set to 1,000. This would be best as per our raffle needs. This way when visually looking at the numbers they will see 1st ticket as 000 and the last ticket as 999 Considering this raffle is for 1,000 total tickets.
  15.  
  16. Also this is for a particular raffle considering last 3 digits of National Raffle results.
  17.  
  18. But other raffles that I will be hosting will be considering the last 2 Digits and some even up to last 4 digits or 5 digits.
  19.  
  20. So how can this code be implemented in PARTICULAR LOTTERY PRODUCT Instead of all lottery products?
  21. Thanks for your response! 🤜🤛
Advertisement
Add Comment
Please, Sign In to add comment