Home › Forums › Ticket Products › Event Tickets Plus › Ticket sale prices dont show in single event or list views
- This topic has 4 replies, 2 voices, and was last updated 10 years, 5 months ago by
Josh.
-
AuthorPosts
-
October 15, 2015 at 3:39 am #1014798
dpeschio
ParticipantHello,
We are using wootickets and we offer early-bird sale pricing on tickets. In the list view the full ticket price shows, not the sale price. At the top of the single event it’s the same, but in the ticket purchase area at the bottom of the single event page the full price shows with s strike-through and the sale price is visible. This is how it should show everywhere.
I’ve dug into it a bit and it looks like the prices are called via different functions. The one we want is used in tickets.php and is
$this->get_price_html( $product ). Single-event.php usestribe_get_cost( null, true )on line 44 which only shows the regular cost.How can I get sale pricing to show everywhere?
October 15, 2015 at 6:21 am #1014845Josh
ParticipantHey dpeschio,
Thanks for reaching out to us!
You can follow our Themer’s Guide to move those template files that have the lines that you would like to replace into your theme and replace those lines.
I’ll also do some further research, it sounds like there may possibly be a bug in our “tribe_get_cost” function since it should be pulling any sales prices if they are set.
Let me know if this helps.
Thanks!
October 16, 2015 at 10:16 am #1015357dpeschio
ParticipantHi and thanks for the quick response.
I have those files moved – we are adding Sold Out notices, tickets remaining and some css so I have them in my child theme folder. Simply changing those lines won’t do it or I wouldn’t be asking for guidance.
I believe that get_price is using a different way of retrieving the price. It’s always correct. tribe_get_cost sometimes shows the sales price and discounts, but more often doesn’t. I haven’t been able to track down why it works on some products and not others. I have looked at the event tickets as woo products and in the editor for the event and I can see no differences between a product that is displaying prices correctly and one that isn’t. That’s why I want to go the route of using the method of displaying prices that is working.
The crux of my problem is when I add
echo $this->get_price_html( $product )in place oftribe_get_cost( null, true )the page stops loading at that point. I tried adding variations of the code from tickets.php to get it to pull all the necessary functions but haven’t gotten it to work. I thinks it it related to $this variable needing to have functions from a class that isn’t available.Any ideas?
October 19, 2015 at 3:33 pm #1016003dpeschio
ParticipantThis was way more complicated than I expected. I consider what I did was fixing a bug.
The bug: tribe_get_cost was not pulling sale pricing
My fix: I bypassed tribe_get_cost and used the woocommerce function get_price_html. To do that I first had to retrieve the variables for the particular product. I used tickets.php as a kind of template and added the following inside the first php group:
//sets variables for fetching correct price $wootickets = TribeWooTickets::get_instance(); $ticket_ids = $wootickets->get_Tickets_ids( get_the_ID()); $product = new WC_Product_Simple($ticket_ids[0]);In the event cost section I then added
<?php if ( $price_html = $product->get_price_html() ) : ?> <div class="tribe-events-event-cost"> <?php echo $price_html; ?> </div> <?php endif; ?>This gave me the regular price with a strikethrough
and the sale price <ins></ins>. Both have the class “amount” and were stacked on top of one another with the same look. I wanted to accentuate the sale price so I had to differentiate them and apply my styles. I added a span and some text by adding this to functions.phpadd_filter( 'woocommerce_get_price_html', 'add_before_price', 100, 2 ); function add_before_price( $price, $product ){ return '' . str_replace( '<ins>', '<span class="ct-onsale"> ON SALE: <ins>', $price ); return '' . str_replace( '</ins>', '</ins> <span class="ct-onsale">', $price ); }and a little css to highlight the sale price
.ct-onsale { background:none !important; color:#4d75a6; font-size:larger; }I hope this helps some people.
October 20, 2015 at 12:15 pm #1016347Josh
ParticipantHey,
Thanks for following up! I’m glad you were able to come t a solution and thanks for providing your steps here for others to follow if needed.
As I mentioned before, it sounds like there is a bug with that price function and I’ve created an internal ticket for tracking this and should be addressed in an upcoming release.
I apologize for the inconvenience but definitely glad you were able to get it working the way you would like now.
Thanks!
-
AuthorPosts
- The topic ‘Ticket sale prices dont show in single event or list views’ is closed to new replies.
