Support » Plugin: WooCommerce PDF Invoices & Packing Slips » get error on BACS payment method

  • Hi
    when customers use Bacs payment method they get woocommerce error “Internal Server Error”,
    it doesn’t appear like “500 Internal Server Error / blank page”, it’s just like other woocommerce checkout page errors. (Screenshot)
    but when they use online payment methods like paypal and… everything is fine.
    i increase memory limit as u say but doesn’t work. then i change my custom invoice theme to plugin default and problem solved,
    but i cant find the problem in my custome theme, especially that it has problem only on bacs payment.
    i check this with “Enable debug output” enabled to, but don’t get any extera error or information.
    can u help me on this pls, it’s very necessary for me. i send my custom invoice.php codes.

    
    <?php do_action( 'wpo_wcpdf_before_document', $this->type, $this->order ); ?>
    <div class="invWrapper">
    	<div class="invHeader head container">
    		<div class="invRow topbar dark-blue">
    			<div class="invIcons">
    				<a onclick="window.print()" title="Print"><span class="bg-printer-icon"></span></a>
    				<a title="PDF"><span class="bg-pdf-icon"></span></a>
    				<a title="save"><span class="bg-save-icon"></span></a>
    			</div>
    			<p class="gold">www.iLuxuryMarket.com</p>
    		</div>
    		<div class="invRow">
    			<div class="logoTitle">
    				<span class="bg-iLuxuryMarket-logo"></span>
    				<p>لاکچری مارکت گل شفا</p>
    			</div>
    			<div class="invDateNumber">
    				<?php do_action( 'wpo_wcpdf_before_order_data', $this->type, $this->order ); ?>
    				<?php if ( isset($this->settings['display_number']) ) { ?>
    				<div class="invoice-number">
    					<p><span>شماره فاکتور: </span><span><?php $this->invoice_number(); ?></span></p>
    				</div>
    				<?php } ?>
    				<?php if ( isset($this->settings['display_date']) ) { ?>
    				<div class="invoice-date">
    					<p><span>تاریخ سفارش: </span><span><?php $this->order_date(); ?></span></p>
    				</div>
    				<?php } ?>
    				<div class="order-number">
    					<p><span>شماره سفارش: </span><span><?php $this->order_number(); ?></span></p>
    				</div>
    				<?php do_action( 'wpo_wcpdf_after_order_data', $this->type, $this->order ); ?>
    			</div>
    		</div>
    		<?php
    		
    		$user = $this->order->get_user();
    		
    		/*$order_id = $order->get_id();
    		$order = wc_get_order( $order_id );*/
    		$order_data = $order->get_data();
    		
    		$order_billing_first_name = $order_data['billing']['first_name'];
    		$order_billing_last_name = $order_data['billing']['last_name'];
    		$order_billing_country_code = $order_data['billing']['country'];
    		$order_billing_state_code = $order_data['billing']['state'];
    		$order_billing_country = WC()->countries->countries[ $order_billing_country_code ];
    		$order_billing_state = WC()->countries->get_states( $order_billing_country_code )[$order_billing_state_code];
    		$order_billing_city = $order_data['billing']['city'];
    		$order_billing_address_1 = $order_data['billing']['address_1'];
    		$order_billing_address_2 = $order_data['billing']['address_2'];
    		$order_billing_postcode = $order_data['billing']['postcode'];
    		$order_billing_email = $order_data['billing']['email'];
    		$order_billing_phone = $order_data['billing']['phone'];
    		$order_payment_method_title = $order_data['payment_method_title'];
    		$order_payment_method = $order_data['payment_method'];
    		if($order_payment_method != "bacs"){
    			$order_transaction_id = $order->get_transaction_id();
    		}
    		
    		?>
    		<div class="invRow customerDetails">
    			<p>
    				<span>صورت حساب</span>
    				<span>آقای / خانم: </span>
    			</p>
    			<p>
    				<span><?php echo $order_billing_first_name.' '.$order_billing_last_name; ?></span>
    			</p>
    			<p>
    				<span>آدرس: </span>
    				<span><?php echo $order_billing_country.' - '.$order_billing_state.' - '.$order_billing_city.' - '.$order_billing_address_1.' - '.$order_billing_address_2.' - '.'تلفن: '.$order_billing_phone; ?></span>
    			</p>
    		</div>
    		<?php do_action( 'wpo_wcpdf_after_document_label', $this->type, $this->order ); ?>
    	</div>
    
    	<?php do_action( 'wpo_wcpdf_before_order_details', $this->type, $this->order ); ?>
    	<div class="invBody body container">
    		<div class="invRow order-details">
    			<div class="odHeader invRow dark-blue gold">
    				<div class="rowNum">ردیف</div>
    				<div class="product">نام محصول</div>
    				<div class="quantity">تعداد / مقدار</div>
    				<div class="price">قیمت</div>
    			</div>
    			<div class="odBody invRow">
    				<?php $i=0; ?> 
    				<?php $items = $this->get_order_items(); if( sizeof( $items ) > 0 ) : foreach( $items as $item_id => $item ) : ?>
    				<?php $i++ ?>
    				<div class="invPrdctRow invRow ">
    					<div class="rowNum"><?php echo $i; ?></div>
    					<div 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  ); ?>
    						<?php if( !empty( $item['meta'] ) ) : ?><span class="item-meta"><?php echo $item['meta']; ?></span><?php endif; ?>
    						<span class="meta">
    							<?php $description_label = __( 'SKU', 'woocommerce-pdf-invoices-packing-slips' ); // registering alternate label translation ?>
    							<?php if( !empty( $item['sku'] ) ) : ?><span class="sku">شناسه محصول: </span><span class="sku"><?php echo $item['sku']; ?></span><?php endif; ?>
    							<?php if( !empty( $item['weight'] ) ) : ?><span class="weight"><?php _e( 'Weight:', 'woocommerce-pdf-invoices-packing-slips' ); ?></span><span class="weight"><?php echo $item['weight']; ?><?php echo get_option('woocommerce_weight_unit'); ?></span><?php endif; ?>
    						</span>
    						<?php do_action( 'wpo_wcpdf_after_item_meta', $this->type, $item, $this->order  ); ?>
    					</div>
    					<div class="quantity"><?php echo $item['quantity']; ?></div>
    					<div class="price"><?php echo $item['order_price']; ?></div>
    				</div>
    				<?php endforeach; endif; ?>
    			</div>
    		</div>
    		<div class="invRow inv-total-details">
    			<div class="invRow inv-total-wrapper">
    				<div class="invTotal invRow">
    					<?php foreach( $this->get_woocommerce_totals() as $key => $total ) : ?>
    					<div class="<?php echo $key; ?>">
    						<span class="description"><?php echo $total['label']; ?>: </span>
    						<span class="price"><?php echo $total['value']; ?></span>
    					</div>
    					<?php endforeach; ?>
    				</div>
    			</div>
    		</div>
    		<div class="payment-method invRow">
    			<div class="payment-method-title invRow">
    				<div class="payment-title">روش پرداخت: </div>
    				<div class="payment-desc">
    					<?php if($order_payment_method == "bacs"){ ?>
    						<span class="totals-price"><?php echo $order_payment_method_title; ?></span>
    					<?php }else{ ?>
    						<span>درگاه آنلاین </span>
    						<span class="totals-price"><?php echo $order_payment_method_title; ?></span>
    						<span> - کد رهگیری تراکنش: </span><span><?php echo $order_transaction_id; ?></span>
    					<?php } ?>
    				</div>
    			</div>
    			<div id="inv-sep-line"></div>
    			<div id="inv-acc-numbers">
    			<?php if($order_payment_method == "bacs"){ ?>
    				<div class="inv-acc-num-row invRow">
    					<div class="inv-acc-name"><p>بانک ملت</p></div>
    					<div class="inv-acc-name"><p>احمد قائنی</p></div>
    					<div class="inv-acc-num"><p>شماره کارت:  &nbsp;<span>6104-3378-0438-7779</span></p></div>
    					<div class="inv-acc-num"><p>شماره حساب:  &nbsp;<span>355440/06</span></p></div>
    				</div>
    				<div class="inv-acc-num-row invRow">
    					<div class="inv-acc-name"><p>بانک سامان</p></div>
    					<div class="inv-acc-name"><p>احمد قائنی</p></div>
    					<div class="inv-acc-num"><p>شماره کارت:  &nbsp;<span>6219-8610-2964-7707</span></p></div>
    					<div class="inv-acc-num"><p>شماره حساب:  &nbsp;<span>9301 - 888 - 2442562 - 1</span></p></div>
    				</div>
    			<?php } ?>
    				<div class="inv-acc-num-row invRow">
    					<p>از انتخاب شما متشکریم.</p>
    					<p>اطلاعات فاکتور به ایمیل شما ارسال شد.</p>
    				</div>
    			</div>
    		</div>
    		<div class="invFooter invRow dark-blue gold"></div>
    	</div>
    
    	<?php do_action( 'wpo_wcpdf_after_order_details', $this->type, $this->order ); ?>
    
    <?php if ( $this->get_footer() ): ?>
    <div id="footer">
    	<div class="payment-method">
    		<p><?php _e( 'Payment Method:', 'woocommerce-pdf-invoices-packing-slips' ); ?><?php $this->payment_method(); ?></p>
    	</div>
    	<?php $this->footer(); ?>
    </div><!-- #letter-footer -->
    <?php endif; ?>
    <?php do_action( 'wpo_wcpdf_after_document', $this->type, $this->order ); ?>
    

    for more info:
    WP version: 4.9.8
    WC version: 3.4.5
    plugin version: 2.1.10

    • This topic was modified 1 year, 11 months ago by BahramElf.
Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Support kluver

    (@kluver)

    Hi @bahramelf,

    There is a small error in your template. On line 57 you are missing a ‘=’. It should be:

    if( $order_payment_method !== "bacs" ) {
        $order_transaction_id = $order->get_transaction_id();
    }

    Let me know if that solves your issue.

    Plugin Author Ewout

    (@pomegranate)

    In addition to the above message: If you get the internal server error on the front end, you will need to check your PHP error logs. If you don’t have access to the PHP error logs, you could also see if WooCommerce logged any fatal errors under WooCommerce > Status > Logs.

    Are you using the MPDF extension?

    Let us know what you find!

    Hi again
    First of all i want to say thank you so much! for quick response and helping me.
    I did not expect it in this fast 🙂
    @kluver
    I modified the code but it doesn’t make any changes.
    @pomegranate
    i send thicket to my hosting provider and asked them for send PHP error logs to me but unfortunately they behaved as if they did not know what I was talking about i don’t know maybe it is my bad.
    Then i go to check if WooCommerce logged any fatal errors under WooCommerce > Status > Logs, but there was’n any error.
    i go as customer and check order emails and pdf invoice attached to emails then see pdf invoices comes messed up. (Screenshot)
    as u saw in codes my native language is Persian and we use UTF8 encoding, i think pdf generator or maybe your plugin doesn’t support UTF8 encoding. when i see the pdf invoice messed up, disable attaching pdf invoices to emails from plugin settings and as i disable it, main problems “getting Internal Server Error on BACS payment method” solved!
    @pomegranate
    how can i check for using the MPDF extension? ask from hosting provider?
    and at last if u want to translate plugin in Persian. I’ll be happy for doing this.
    just email to me POT file.

    • This reply was modified 1 year, 11 months ago by BahramElf.
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘get error on BACS payment method’ is closed to new replies.