• Resolved mhmtn

    (@mhmtn)


    Hi there,

    i customized your awesome plugin for our government calculate method. In html view everything seems normal: http://prntscr.com/luh13l

    But when i look at pdf, 1 area changing please check: http://prntscr.com/luh4ii

    Can you please tell me how am i solve that problem.

    My invoice.php file is here:

    <?php if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly ?>
    <?php do_action( 'wpo_wcpdf_before_document', $this->type, $this->order ); ?>
    
    <?php do_action( 'wpo_wcpdf_after_document_label', $this->type, $this->order ); ?>
    
    <table class="order-data-addresses">
    	<tr>
    		<td class="address billing-address">
    			<!-- <h3><?php _e( 'Billing Address:', 'woocommerce-pdf-invoices-packing-slips' ); ?></h3> -->
    			<?php do_action( 'wpo_wcpdf_before_billing_address', $this->type, $this->order ); ?>
    			<?php $this->billing_address(); ?>
    			<?php do_action( 'wpo_wcpdf_after_billing_address', $this->type, $this->order ); ?>
    			<?php if ( isset($this->settings['display_email']) ) { ?>
    			<div class="billing-email"><?php $this->billing_email(); ?></div>
    			<?php } ?>
    			<?php if ( isset($this->settings['display_phone']) ) { ?>
    			<div class="billing-phone"><?php $this->billing_phone(); ?></div>
    			<?php } ?>
    		</td>
    		<td class="address shipping-address">
    			<?php if ( isset($this->settings['display_shipping_address']) && $this->ships_to_different_address()) { ?>
    			<h3><?php _e( 'Ship To:', 'woocommerce-pdf-invoices-packing-slips' ); ?></h3>
    			<?php do_action( 'wpo_wcpdf_before_shipping_address', $this->type, $this->order ); ?>
    			<?php $this->shipping_address(); ?>
    			<?php do_action( 'wpo_wcpdf_after_shipping_address', $this->type, $this->order ); ?>
    			<?php } ?>
    		</td>
    		<td class="order-data">
    			<table>
    				<?php do_action( 'wpo_wcpdf_before_order_data', $this->type, $this->order ); ?>
    
    				<?php if ( isset($this->settings['display_date']) ) { ?>
    				<tr class="invoice-date">
    					<td><?php $this->invoice_date(); ?></td>
    				</tr>
    				<?php } ?>
    
    				<?php do_action( 'wpo_wcpdf_after_order_data', $this->type, $this->order ); ?>
    			</table>			
    		</td>
    	</tr>
    </table>
    
    <?php do_action( 'wpo_wcpdf_before_order_details', $this->type, $this->order ); ?>
    
    <table class="order-details">
    	
    	<tbody>
    		<?php $items = $this->get_order_items(); if( sizeof( $items ) > 0 ) : foreach( $items as $item_id => $item ) : ?>
    		<tr class="<?php echo apply_filters( 'wpo_wcpdf_item_row_class', $item_id, $this->type, $this->order, $item_id ); ?>">
    			<td class="product">
    				<?php $description_label = __( 'Description', 'woocommerce-pdf-invoices-packing-slips' ); // registering alternate label translation ?>
    				<span class="item-name"><?php echo $item['name']; ?></span>
    				<?php do_action( 'wpo_wcpdf_before_item_meta', $this->type, $item, $this->order  ); ?>
    				<span class="item-meta"><?php echo $item['meta']; ?></span>
    				<dl class="meta">
    					<?php $description_label = __( 'SKU', 'woocommerce-pdf-invoices-packing-slips' ); // registering alternate label translation ?>
    					<?php if( !empty( $item['sku'] ) ) : ?><dt class="sku"><?php _e( 'SKU:', 'woocommerce-pdf-invoices-packing-slips' ); ?></dt><dd class="sku"><?php echo $item['sku']; ?></dd><?php endif; ?>
    					<?php if( !empty( $item['weight'] ) ) : ?><dt class="weight"><?php _e( 'Weight:', 'woocommerce-pdf-invoices-packing-slips' ); ?></dt><dd class="weight"><?php echo $item['weight']; ?><?php echo get_option('woocommerce_weight_unit'); ?></dd><?php endif; ?>
    				</dl>
    				<?php do_action( 'wpo_wcpdf_after_item_meta', $this->type, $item, $this->order  ); ?>
    			</td>
    			<td class="quantity"><?php echo $item['quantity']; ?></td>
    			<td><?php 
    			$fiyat = $item['order_price'];
    			$fiyattemiz =  substr($fiyat,107,-7); 
    			$hesap = str_replace(",",".",$fiyattemiz);
    			$sonuc = $hesap - ($hesap * 18 /100);
    
    			?> 
    			<?php echo $sonuc; ?> TL</td></tr>
    				<?php endforeach; endif; ?>
    		<tr>
    			<td>MNG KARGO</td>
    			<td>1</td>
    			<td><?php 
    			$kargo = $order->get_shipping_total(); 
    			$kargovergi = $kargo * 18 / 100;
    			$kargovergisiz = $kargo - $kargovergi;
    			echo $kargovergisiz;
    			?> TL</td>
    		</tr>
    
    	</tbody>
    	<tfoot>
    		<tr class="no-borders">
    			<td class="no-borders">
    				<div class="customer-notes">
    					<?php do_action( 'wpo_wcpdf_before_customer_notes', $this->type, $this->order ); ?>
    					<?php if ( $this->get_shipping_notes() ) : ?>
    						<h3><?php _e( 'Customer Notes', 'woocommerce-pdf-invoices-packing-slips' ); ?></h3>
    						<?php $this->shipping_notes(); ?>
    					<?php endif; ?>
    					<?php do_action( 'wpo_wcpdf_after_customer_notes', $this->type, $this->order ); ?>
    				</div>				
    			</td>
    			<td class="no-borders" colspan="2">
    				<table class="totals">
    					<tfoot>
    						<tr class="<?php echo $key; ?>">
    							<td class="no-borders"></td>
    							<td class="price"><span class="totals-price"><span class="woocommerce-Price-currencySymbol"></span> <?php 
    							$toplam = $order->get_total();
    							$kdv =  $toplam * 18 / 100;
    							$yuvarla = 0.10;
    							$hesap = $toplam - $kdv;
    							echo $hesap;
    							 ?> TL</span></td>
    						</tr>
    												<tr class="<?php echo $key; ?>">
    							<td class="no-borders"></td>
    							<td class="price"><span class="totals-price"><span class="woocommerce-Price-currencySymbol"></span><?php echo $kdv ?> TL</span></td>
    						</tr>
    												<tr class="<?php echo $key; ?>">
    							<td class="no-borders"></td>
    							<td class="price"><span class="totals-price"><span class="woocommerce-Price-currencySymbol"></span><?php echo $hesap + $kdv ?> TL</span></td>
    						</tr>
    					</tfoot>
    				</table>
    			</td>
    		</tr>
    	</tfoot>
    </table>
    
    <?php do_action( 'wpo_wcpdf_after_order_details', $this->type, $this->order ); ?>
    
    <?php if ( $this->get_footer() ): ?>
    <div id="footer">
    	<?php $this->footer(); ?>
    </div><!-- #letter-footer -->
    <?php endif; ?>
    <?php do_action( 'wpo_wcpdf_after_document', $this->type, $this->order ); ?>
    

    Thank You.

    • This topic was modified 7 years, 3 months ago by mhmtn.
    • This topic was modified 7 years, 3 months ago by mhmtn.
Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Contributor kluver

    (@kluver)

    Hi @mhmtn,

    It looks like you are trying to change the price in a bit of a strange way. Can you tell me what it is you would like to achieve?

    If you are looking for a way to show product prices or taxes I would recommend purchasing our Premium Templates extension. This will give you access to the customizer that will let you add all kinds of order data and give you a lot more control over you PDF layout.

    Thread Starter mhmtn

    (@mhmtn)

    Hi kluver,

    Our government have required invoices shape, and we must calculate item price without tax. I dont use premium templates extension because you dont have this feature.

    I want to calculate order price without tax, i try to use: $item[‘order_price’] but data come to me with currency caracter.

    How am i replace currency caracter from $item[‘order_price’].

    Thank for your help.

    Plugin Contributor Ewout

    (@pomegranate)

    Actually, the Premium Templates let you do just that: show prices excluding tax, including tax, tax separately, per item or for the total quantity, etc:

    The method you have currently used for removing stripping the currency from the price is quite hacky and not recommended. This HTML is not static and can be formatted differentely when processed to be converted into the PDF.

    Thread Starter mhmtn

    (@mhmtn)

    Thank you Ewout.

    I wonder that, how am i take unformatted price in invoices.php? is that a way to take this data?

    If you are answer my questions, i will be very happy.

    Regards.

    hocam bir goruselim, incesuali01@gmail.com ,dokan kullaniyoruz bizde

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘After Customization PDF/HTML view problem’ is closed to new replies.