Jump to content

codefantom

New Members
  • Posts

    2
  • Joined

  • Last visited

codefantom's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Sorry, I did some last minute mods to the php file. So to clarify I decided to show you how the pdf invoice looks. So if I decided to try the first option, would this be correct? if($items['Masquerade Ball Ticket']=='ticket') { $title = "This is a ticket"; } else { $title = "This is an invoice"; } //Use title in the code to generate the output And is there a specific location that I have to put the code for it to work? Or do I put it where I want the output to appear?
  2. I am trying to use a Wordpress module called WooCommerce PDF Invoices to make event tickets by modifying the layout of the invoice to create an online ticket to printout. I've successful reformatted the layout and it works like a charm except for one thing. The problem I have is that no matter what is bought the invoice reads "This is a ticket" which I hardcoded into the invoice design. What I would like is an if/then statement inserted into the invoice design that will print between "This is a ticket" or "This is a receipt" depending on if they purchase one of the 4 ticket items. I completely redesigned the woocommerce pdf invoice to look like an online ticket. The first half looks like an actual ticket. <?php global $wpo_wcpdf; ?> <table align="center" cellpadding="0" cellspacing="0" class="pdfbackground" style="width: 700px; height: 350px"> <tr> <td style="width: 20px"> </td> <td style="width: 285px"> </td> <td style="width: 300px"> </td> <td style="width: 75px"> </td> <td style="width: 20px"> </td> </tr> <tr> <td rowspan="4" style="width: 20px"> </td> <td class="pdflogo" rowspan="4" style="width: 285px"><br /><div id="container"><div><?php if( $wpo_wcpdf->get_header_logo_id() ) { $wpo_wcpdf->header_logo(); } else { _e( 'Ticket', 'wpo_wcpdf' ); } ?></div><div class="order-information"> <br /><br /><hr width=50% color=#0087E1><?php $date_setting = isset($wpo_wcpdf->settings->template_settings['display_date'])?$wpo_wcpdf->settings->template_settings['display_date']:'order_date'; $number_setting = isset($wpo_wcpdf->settings->template_settings['display_number'])?$wpo_wcpdf->settings->template_settings['display_number']:'order_number'; // set $display date & label to user setting if ( $date_setting == 'invoice_date' ) { $display_date = $wpo_wcpdf->get_invoice_date(); $display_date_label = __( 'Event Date:', 'wpo_wcpdf' ); } else { $display_date = $wpo_wcpdf->get_order_date(); $display_date_label = __( 'Order Date:', 'wpo_wcpdf' ); } // set $display number & label to user setting if ( $number_setting == 'invoice_number' ) { $display_number = $wpo_wcpdf->get_invoice_number(); $display_number_label = __( 'Transaction Number:', 'wpo_wcpdf' ); } else { $display_number = $wpo_wcpdf->get_order_number(); $display_number_label = __( 'Order Number:', 'wpo_wcpdf' ); } ?> <span class="order-date-label"><?php echo $display_date_label; ?></span> <span class="order-date"><?php echo $display_date; ?></span><br /> <span class="order-number-label"><?php echo $display_number_label; ?></span> <span class="order-number"><?php echo $display_number; ?></span><br /> <br /> <br /> </div></div></td> <td style="width: 300px"><div class="shop-name"><h3><?php $wpo_wcpdf->shop_name(); ?></h3><br /> SPONSORED BY: <br />SPONSOR 1 LOGO | SPONSOR 2 LOGO </div> </td> <td rowspan="4" style="width: 75"><br /><br /><br /><br /><br /><br /> <img alt="" height="126" src="http://www.3corlando.com/wp-content/uploads/2014/06/barcode.png" width="71" class="barcode" /></td> <td rowspan="4" style="width: 20px"> </td> </tr> <tr> <td style="width: 300px"><hr width=75% color=#0087E1><div class="shop-address"><?php $wpo_wcpdf->shop_address(); ?></div> </td> </tr> <tr> <td style="width: 300px"> </td> </tr> <tr> <td style="width: 300px"></td> </tr> <tr> <td class="pdfborder" style="width: 20px"> </td> <td class="pdfticket" colspan="3"><div class="pdfticket"><hr width=50% color=#0087E1>***This is a Receipt*** </div> </td> <td class="pdfborder" style="width: 20px"> </td> </tr> </table> And the second half looks like an invoice. <!-- head container --> <hr> <table class="order-details"> <thead> <tr> <th class="product-label"><?php _e('Shop Items', 'wpo_wcpdf'); ?></th> <th class="quantity-label"><?php _e('Quantity', 'wpo_wcpdf'); ?></th> <th class="price-label"><?php _e('Price', 'wpo_wcpdf'); ?></th> </tr> </thead> <tbody> <?php $items = $wpo_wcpdf->get_order_items(); if( sizeof( $items ) > 0 ) : foreach( $items as $item ) : ?><tr> <td class="description"> <?php $description_label = __( 'Description', 'wpo_wcpdf' ); // registering alternate label translation ?> <span class="item-name"><?php echo $item['name']; ?></span><span class="item-meta"><?php echo $item['meta']; ?></span> <dl class="meta"> <?php if( !empty( $item['sku'] ) ) : ?><dt><?php _e( 'SKU:', 'wpo_wcpdf' ); ?></dt><dd><?php echo $item['sku']; ?></dd><?php endif; ?> <?php if( !empty( $item['weight'] ) ) : ?><dt><?php _e( 'Weight:', 'wpo_wcpdf' ); ?></dt><dd><?php echo $item['weight']; ?><?php echo get_option('woocommerce_weight_unit'); ?></dd><?php endif; ?> </dl> </td> <td class="quantity"><?php echo $item['quantity']; ?></td> <td class="price"><?php echo $item['order_price']; ?></td> </tr><?php endforeach; endif; ?> </tbody> <tfoot> <tr class="no-borders"> <td class="no-borders" colspan="3"> <table class="totals"> <tfoot> <?php foreach( $wpo_wcpdf->get_woocommerce_totals() as $total ) : ?> <tr> <td class="no-borders"> </td> <th class="description"><?php echo $total['label']; ?></th> <td class="price"><span class="totals-price"><?php echo $total['value']; ?></span></td> </tr> <?php endforeach; ?> </tfoot> </table> </td> </tr> </tfoot> </table><!-- order-details --> <table class="notes container"> <tr> <td colspan="3"> <div class="notes-shipping"> <?php if ( $wpo_wcpdf->get_shipping_notes() ) : ?> <h3><?php _e( 'Customer Notes', 'wpo_wcpdf' ); ?></h3> <?php $wpo_wcpdf->shipping_notes(); ?> <?php endif; ?> </div> </td> </tr> </table><!-- notes container --> <?php if ( $wpo_wcpdf->get_footer() ): ?> <div id="footer"> <?php $wpo_wcpdf->footer(); ?> </div><!-- #letter-footer --> <?php endif; ?> I want to identify one of my 4 ticket items that may appear where the invoice prints the items and when one of them does appear it changes "This is a receipt" to "This is a ticket" in the first half. Is something like this possible? If so, can anyone give me a direction to find the coding for this? Can anybody give me an idea how to write this in php. I'm a pro at html but I've only taught myself how to modify existing php coding. I can't write it from scratch. Any help is appreciated.
×
×
  • 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.