• Resolved sisterlarao

    (@sisterlarao)


    Hi there,

    I wanted to add some columns, so that the weight and the packaging (variable product) becomes an own column. Everything worked, but now the cart totals below the product table is centered and I don’t know why. When I am deleting the new colums, everything is fine.
    I changed the table head like this:

    table class="order-details">
    	<thead>
    		<tr>
    			<th class="product"><?php _e('Product', 'wpo_wcpdf'); ?></th>
    			<th class="quantity"><?php _e('Quantity', 'wpo_wcpdf'); ?></th>
                <th class="quantity"><?php _e('Inhalt', 'wpo_wcpdf'); ?></th>
                <th class="quantity"><?php _e('Verpackung', 'wpo_wcpdf'); ?></th>
    			<th class="price"><?php _e('Price', 'wpo_wcpdf'); ?></th>
    		</tr>
    	</thead>

    and the table content like this:

    <tbody>
    		<?php $items = $wpo_wcpdf->get_order_items(); if( sizeof( $items ) > 0 ) : foreach( $items as $item_id => $item ) : ?>
    		<tr>
    			<td class="product">
    				<?php $description_label = __( 'Description', 'wpo_wcpdf' ); // registering alternate label translation ?>
    				<span class="item-name"><?php echo $item['name']; ?></span>
    
    			</td>
    			<td class="quantity"><?php echo $item['quantity']; ?></td>
               <td class="quantity"> <dl class="meta">
    					<?php if( !empty( $item['weight'] ) ) : ?><dt class="weight"><?php _e( 'Weight:', 'wpo_wcpdf' ); ?></dt><dd class="weight"><?php echo $item['weight']; ?><?php echo get_option('woocommerce_weight_unit'); ?></dd><?php endif; ?>
    				</dl></td>
                       <td class="quantity"> <?php do_action( 'wpo_wcpdf_before_item_meta', $wpo_wcpdf->export->template_type, $item, $wpo_wcpdf->export->order  ); ?>
    				<span class="item-meta"><?php echo $item['meta']; ?></span>
    
    				<?php do_action( 'wpo_wcpdf_after_item_meta', $wpo_wcpdf->export->template_type, $item, $wpo_wcpdf->export->order  ); ?></td>
    
    			<td class="price"><?php echo $item['single_price']; ?></td>
    		</tr>
    		<?php endforeach; endif; ?>
    	</tbody>

    The tfoot is still the same. Is there a dependence between the columns and the cart total?

    And I want to have the price and below the price should be the unit-price in a smaller font. But I can only decrease the size of the whole price, not only for the unit 10,89/100g.

    May you can help?

    https://www.ads-software.com/plugins/woocommerce-pdf-invoices-packing-slips/

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Contributor Ewout

    (@pomegranate)

    Hi! You were on the right track, the tfoot needs to have the same number of columns as the tbody, otherwise it won’t line up.

    If you change the first cell of the tfoot from:

    <td class="no-borders">

    to:

    <td class="no-borders" colspan="2">

    that should fix this.

    To change the font size of a specific part of the invoice, you can either add an element with a class to it (like <span class="small-text">10,89/100g</span>) and add the styles in the style.css, or add the styles inline (like <span style="font-size: 7pt;">10,89/100g</span>).

    Hope that helps! Let me know if you have other questions, and leave me a review if you like the plugin :o)

    Thread Starter sisterlarao

    (@sisterlarao)

    Thank you. Colspan 3 worked ??

    But not the font-Size. You are calling it: order_price in your php and the price incl. the unit price are shown. So I can’t give it any class for defining it.

    When I have more than 4 products, there’s a sitebreak – no problem. But the footer isn’t fixed. So I have the footer on the second page and the first one is empty. How can I make it fix?

    Thank you!

    Plugin Contributor Ewout

    (@pomegranate)

    Hi! You can simply wrap that span around the PHP code like this:

    <span class="small-text"><?php echo $item['order_price']; ?></span>

    To get the footer to repeat on each page, check out the docs: Repeating headers/footers

    Hope that helps!

    Thread Starter sisterlarao

    (@sisterlarao)

    Then my whole price including the 5,90€ is small, not only the unit price.
    I only want the unit price to become smaller.

    Plugin Contributor Ewout

    (@pomegranate)

    I don’t quite understand what you mean. Can you show some screenshots of what you mean? It sounds like you have a plugin that adds the unit price to the price, because normally, ‘order_price’ only shows the total price!

    Thread Starter sisterlarao

    (@sisterlarao)

    Ah yes, I do have the germanized plugin. Maybe that collapses.

    Plugin Contributor Ewout

    (@pomegranate)

    That sounds very plausible.

    Just for your information: The premium templates extension comes with a drag & drop customizer that allows you to define all the columns to your hearts wishes (price including/excluding tax, single/total price, before/after discount), as well as the totals. This won’t have the issue you have with the modified prices that you have with the Germanized plugin.

    Let me know if you have any other questions!

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Adding a new column’ is closed to new replies.