Forum Replies Created

Viewing 8 replies - 1 through 8 (of 8 total)
  • Same issue here… have a custom template, never had issues with this plugin, now:

    Fatal error: Call to a member function get_header_logo_id() on null

    And it starts at the custom template ‘invoice.php’ line 6… which is this chunk of code:

                if( $wpo_wcpdf->get_header_logo_id() ) {
                        $wpo_wcpdf->header_logo();
                } else {
                        echo apply_filters( 'wpo_wcpdf_invoice_title', __( 'Tax Invoice', 'wpo_wcpdf' ) );
                }

    Looks like the new simple template (that works) has the following code instead here:

                if ( $this->has_header_logo() ) {
                        do_action( 'wpo_wcpdf_before_shop_logo', $this->get_type(), $this->order );
                        $this->header_logo();
                        do_action( 'wpo_wcpdf_after_shop_logo', $this->get_type(), $this->order );
                } else {
                        $this->title();
                }

    But then you hit another error:

    Fatal error: Call to a member function shop_name() on null

                <td class="shop-info">
                        <div class="shop-name"><h3><?php $wpo_wcpdf->shop_name(); ?></h3></div>
                        <div class="shop-address"><?php $wpo_wcpdf->shop_address(); ?></div>
                </td>

    Which you can replace with this code:

                <td class="shop-info">
                        <?php do_action( 'wpo_wcpdf_before_shop_name', $this->get_type(), $this->order ); ?>
                        <div class="shop-name"><h3><?php $this->shop_name(); ?></h3></div>
                        <?php do_action( 'wpo_wcpdf_after_shop_name', $this->get_type(), $this->order ); ?>
                        <?php do_action( 'wpo_wcpdf_before_shop_address', $this->get_type(), $this->order ); ?>
                        <div class="shop-address"><?php $this->shop_address(); ?></div>
                        <?php do_action( 'wpo_wcpdf_after_shop_address', $this->get_type(), $this->order ); ?>
                </td>

    Then you get this…

    Fatal error: Call to a member function get_header_logo_id() on null

    invoice.php (36)

    which is –

    get_header_logo_id() ) echo apply_filters( ‘wpo_wcpdf_invoice_title’, __( ‘Tax Invoice’, ‘wpo_wcpdf’ ) ); ?>

    and the cat and mouse game continues on if you decide you want to keep playing.

    In short looks like the latest update has some serious breaking changes for previous templates.

    In the end, I found the easiest (but still a bit painful) path was to just move my current template out of the way, copy over the latest simple template, and then start from scratch, re-customising it.

    I’ve also been getting these errors, and on disabling, deleting, and re-uploading the plugin, at first things seemed good, but I found all my rules were gone. On recreating rules based on gateways, the problems have returned.

    Now getting 500 errors on checkout, disabling the plugin (or the discount) on those gateways, and all becomes well.

    In our case, we are applying a 10% discount (Percent, -10) excluding shipping, if you pay by Credit Card, or PayPal (up front payment discount) instead of by direct deposit.

    This issue is happening with 2.10.1, woocommerce 7.8.1

    Thread Starter gmo81

    (@gmo81)

    Hi Joost,

    Thanks for the prompt response. In this case, a discount is being applied, but it is not at $0 or below $0 in total. It is a discount by 10% of the value of the order total, using a plugin.

    We do not offer free trial subscriptions either, I’m unclear why that’s important… although I’m sure there’s some assumption in the code there based on what you’re saying there.

    I’ll log a case. I’m happy to work with you to debug this. I’m a dev too, but haven’t poked at your code here just yet.

    Geoff

    Thread Starter gmo81

    (@gmo81)

    Yes, you can give a discount manually – but the whole point is the plugin is supposed to discount based on payment method.

    You cannot know for sure what that payment method is, for certain, it is a user decision.

    I raised this as I discovered through looking through the code that this is really a fundamental woocommerce issue.

    The issue was closed as there is another epic issue raised that plans on making changes woocommerce’s behaviour to the “order” workflow, so checkout is the same whether it be my cart or by order. It was scheduled for 2.7, then for 3.0, then 2.7 and now 3.0 again.

    So I’m guessing we are not going to see this fixed for a while unfortunately.

    Thread Starter gmo81

    (@gmo81)

    On further investigation – it may be the case that calculate_fees() is required to fire, but I am not sure that it does when an ‘order’ is being paid vs a ‘cart’ of items.

    See: https://docs.woocommerce.com/wc-apidocs/class-WC_Cart.html

    calculate_fees() method seems to allow for developers to calculate fees at checkout.

    However, ‘order’ doesn’t seem to have any such method –
    see: https://docs.woocommerce.com/wc-apidocs/class-WC_Order.html

    I am interested to know if ultimately this is the root cause, as it seems multiple plugins would rely on calculate_fees() firing, to be able to do things like calculate a fee / discount at checkout, or other fees based on certain characteristics.

    If this is true, perhaps this really means there is a fundamental issue in WooCommerce. If so.. any ideas on how we could get this sorted?

    GMO

    Thread Starter gmo81

    (@gmo81)

    Actually – checking further, it’s whenever there is an order created by an administrator and assigned to an account.

    ie. At the backend of WordPress, go to WooCommerce -> Orders -> Add order.

    Add some product, calc taxes, calc total, assign to someone’s account (put in the customer name), and save the order.

    Login as that person, go to ‘orders’, click on ‘pay’, then at checkout, select a payment method that should have a discount applied.

    This plugin does not apply a discount by payment method in this instance.

    Any ideas on how we can fix this?

    GMO

    • This reply was modified 8 years, 1 month ago by gmo81.
    • This reply was modified 8 years, 1 month ago by gmo81.

    G’day,

    Hah – nothing brilliant here ?? But it works.

    But yes – it’s a fair point re: PHP version – I didn’t actually realise this host defaulted to 5.4 – and as noted in the manual for the empty() function:

    https://php.net/manual/en/function.empty.php

    with PHP 5.5 or greater won’t have this issue – and if you’re using shared hosting, you may have an option to select a greater version – talk to your hosting provider.

    I’ve just tested with PHP 5.6 and can confirm that there isn’t an issue in that case – so maybe switch up your PHP version or talk to your provider to get this sorted relatively easily.

    -GMO

    Hi there,

    I hit the same problem – I put the following fix in place in that file (./wp-content/plugins/edwiser-bridge/admin/class-eb-admin-settings.php) at line 611 and reported the issue and the following fix to wisdmlabs:

    //$selectedVal= empty(trim($selectedVal))?”4″:$selectedVal;
    $tmpSelectedVal=trim($selectedVal);
    $selectedVal=empty($tmpSelectedVal)?”4″:$selectedVal;

    (ie comment out the current line that’s breaking and replace it with these two lines).

    An alternative, from reading the php manual would be to just use trim($selectedVal)?”4″:$selectedVal.

    Either way, I’ve asked for an official fix – but hopefully the above gets you going.

    -GMO

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