• Resolved vitalseeds

    (@vitalseeds)


    Hello
    Love the plug-in.

    However…. recently we have been getting a timeout message “Gateway Timeout
    The gateway did not receive a timely response from the upstream server or application.” when we try to make multiple invoices. We used to be able to do at least 30 at once but now the site times out when we do more than 4, which is really annoying for us.

    Any ideas on why this might be happening?

    Thanks

    Fred

    The page I need help with: [log in to see the link]

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

    (@kluver)

    Hi @vitalseeds,

    That’s unfortunate. There can be several reasons for a timeout, usually it is related to the fact that PDF creation can be somewhat memory intensive.

    Are the orders for these PDFs unusually large and/or do they contain high resolution thumbnails or a high resolution logo? If you are working with heavy images this can slow down the PDF creation and result in a timeout.

    You can check for fatal errors in your logs (WooCommerce > Status > Logs) and see if you are getting a memory error. If so, you can try to reduce the size of your files by making sure images are not too big. And you can upgrade your WordPress memory limit. More information on that here: Solving memory issues

    Thread Starter vitalseeds

    (@vitalseeds)

    Hi

    Thanks for your reply – you were right it was a large logo file causing the problem. I changed it from a jpeg to a png a while ago and must have not made it in the right size. Thanks for the tip.

    On another note, is there a way of making the line item bold when the number of items is more than one?

    Cheers

    Fred

    Plugin Contributor kluver

    (@kluver)

    Hi @vitalseeds,

    Glad you’ve found the culprit. ??

    You can add an additional class to your rows when the item has a quantity larger than one with the following code snippet:

    add_filter( 'wpo_wcpdf_item_row_class', 'wpo_wcpdf_item_row_class', 10, 4 );
    function wpo_wcpdf_item_row_class( $item_id, $template_type, $order, $item_id_extra ) {
    	$item = $order->get_item($item_id);
    	if ( $item['quantity'] > 1 ) {
    		echo "multiple ";
    	}
    	return $item_id;
    }

    You can then use that class to target the td elements of that row and make the text inside them bold with the following snippet:

    add_action( 'wpo_wcpdf_custom_styles', 'wpo_wcpdf_custom_styles' );
    function wpo_wcpdf_custom_styles () {
    	?>
    	tr.multiple td { font-weight:bold; }
    	<?php
    }

    These code snippets should be placed in the functions.php of your child theme. If you haven’t worked with code snippets or functions.php before please read this: How to use filters

    Thread Starter vitalseeds

    (@vitalseeds)

    Thanks i used the second code snippet but got a fatal error, do you know why this would be?:

    The code snippet you are trying to save produced a fatal error on line 6:

    Cannot redeclare wpo_wcpdf_custom_styles() (previously declared in /home/vitalsee/public_html/wp-content/themes/vitalseeds-II-storefront-child/functions.php:57)

    Plugin Contributor Ewout

    (@pomegranate)

    This means that you already have a filter for custom styles, and you can simply add the line

    
    	tr.multiple td { font-weight:bold; }
    

    to that function (wpo_wcpdf_custom_styles)

    Thread Starter vitalseeds

    (@vitalseeds)

    thanks! Can you tell me exactly where i would add this line to the following from our functions.php file:

    add_action( ‘wpo_wcpdf_custom_styles’, ‘wpo_wcpdf_custom_styles’, 10, 2 );
    function wpo_wcpdf_custom_styles ( $document_type, $document ) {
    ?>
    .sku { display: none; }
    }
    <?php
    }

    Plugin Contributor Ewout

    (@pomegranate)

    
    add_action( ‘wpo_wcpdf_custom_styles’, ‘wpo_wcpdf_custom_styles’, 10, 2 );
    function wpo_wcpdf_custom_styles ( $document_type, $document ) {
        ?>
        .sku { display: none; }
        tr.multiple td { font-weight:bold; }
        <?php
    }
    
Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Gateway timeout when making multiple packing slips (4+)’ is closed to new replies.