• Resolved skoz95

    (@skoz95)


    Hi there,

    I’m customer from France I have the
    star MCP20 printer and I would like to use your plugin to print the orders from my woocommerce website. My website use custom field (add-on) so I can have some trouble to print all the information on the receipt. Can you please provide me a link to your beta plugin or help me to integrate your email solution for thermal printer ?

    Kind regards,

Viewing 15 replies - 1 through 15 (of 21 total)
  • Hi @skoz95 here is the beta plugin you can use: https://vault.star-emea.com/s/WFEiKggj7sS3w39

    This version supports printing all meta-data attached to an order by enabling the Additional Order Fields option.
    This allows printing of custom order fields, and integration with other plugins that add information to the order meta-data.
    However it may print other metadata you don’t want printed too so it may need some tweaking in the code.

    Thread Starter skoz95

    (@skoz95)

    Hi there,

    Many thanks to your very fast reply !

    Mine is printing that extra data i dont want, how d i tweak to remove that data?

    Thread Starter skoz95

    (@skoz95)

    Hi,

    It’s working great many thanks. Last questions I would Like to remove some extra meta-data, can you explain where the code is located to add some custom code to remove them ?

    Plugin Contributor lawrenceowen

    (@lawrenceowen)

    @skoz95

    Alex is out of the office today so I’ll take over. For now removing the extra information requires a custom build of the plugin. Could you please list the id’s of the fields that you do want to print and I’ll make that custom build for you, and also show you where you can modify the list and formatting in the source.

    Thread Starter skoz95

    (@skoz95)

    Hi @lawrenceowen ,

    Thanks to your reply, so I need only some customs meta_data in the Additional Order Information section, here are their meta_key :

    • pi_delivery_date
    • pi_delivery_time
    • pi_delivery_type

    Be careful, I dont need change in other parts of the print out.

    Thank you so much

    Plugin Contributor lawrenceowen

    (@lawrenceowen)

    Hi @skoz95

    Please test the modified plugin from https://vault.star-emea.com/s/6pGYAYxqWDbsmem which I think should do what you need. It only changes the Additional Order Information part of the ticket.

    I don’t have the same order scheduling plugin so can’t test it perfectly, please keep a copy of the previously working plugin just in case there is a problem.

    You can modify the list of field keys that will be printed, and also what text will be used to output them (in case you want to translate to French) at line 196 or order-handler.php.

    For example:

    $fields = array(
        "pi_delivery_date" => "Delivery Date: [value]",
        "pi_delivery_time" => "Delivery Time: [value]",
        "pi_delivery_type" => "Delivery Type: [value]"
    );
    • This reply was modified 4 years, 2 months ago by lawrenceowen.
    • This reply was modified 4 years, 2 months ago by lawrenceowen.
    Thread Starter skoz95

    (@skoz95)

    Hi @lawrenceowen

    I’m sorry but the custom code it’s not working, indeed I get a 500 error which appears in the developer console.

    Thread Starter skoz95

    (@skoz95)

    Hi @lawrenceowen

    I found the mistake :

    
    2020-09-11T19:26:52+00:00 CRITICAL Uncaught Error: Call to a member function meta_exists() on null in /app/www/wp-content/plugins/star-cloudprnt-for-woocommerce/order-handler.php:227
    Plugin Contributor lawrenceowen

    (@lawrenceowen)

    @skoz95 I can not replicate the issue here, and the error you are seeing is a little unexpected. I’t all working for me on my development site, could you let me know what version of WordPress and WooCommerce you are using? I have tested with WP5.5.1 and WC 4.5.1.

    Also, did this error occur in response to an online order or another method of triggering the print? I ask, because the error indicates that the $order object is a null, in which case an error should have occurred at an earlier point.

    The only other thing I can think of, is did you update the whole plugin or just copy some parts? The way that star_cloudprnt_create_receipt_order_meta_data() is called was chanced slightly (specifically to pass in the $order object) and so updating only star_cloudprnt_create_receipt_order_meta_data() may cause an error similar to this.

    Thread Starter skoz95

    (@skoz95)

    Hi @lawrenceowen,

    Yes, I just copied this function star_cloudprnt_create_receipt_order_meta_data()

    Because I was afraid of losing the printer settings – the printer is in another location – if I updated the whole plugin.

    So today, I will update the whole plugin

    Plugin Contributor lawrenceowen

    (@lawrenceowen)

    @skoz95 Ok, good that makes sense, now I can understand the cause.
    WordPress should preserve plugin settings, but of course that is out of my control, I can’t promise it, and it is sensible to be careful when the printer is remote and a business is relying on it (that is honestly why I am quite slow to publish updates to WordPress).

    If you prefer to just make the modifications to the version on your site, then the extra changes are not much.

    Firstly, make sure that you have the full signature for the star_cloudprnt_create_receipt_order_meta_data() function:
    function star_cloudprnt_create_receipt_order_meta_data($meta_data, $order, &$printer, $max_chars)
    Note the additional $order parameter.

    Then, in the star_cloudprnt_print_order_summary() function, fine the existing line:
    star_cloudprnt_create_receipt_order_meta_data($meta_data, $printer, $selectedPrinter['columns']);

    and change it to:
    star_cloudprnt_create_receipt_order_meta_data($meta_data, $order, $printer, $selectedPrinter['columns']);

    Again, the difference is passing in the extra $order parameter so that it can call functions like $order->meta_exists() to check each meta data key is available before trying to print it.

    Thread Starter skoz95

    (@skoz95)

    Thank you so much @lawrenceowen and today I understand why you don’t publish many plugin update.

    I will test the modifications and I tell you after that the result.

    Plugin Contributor lawrenceowen

    (@lawrenceowen)

    Great, hopefully that all works ok.
    If you have any trouble, don’t be too worried to install the whole plugin from the ZIP package. Importantly, the CloudPRNT URL that is needed by your printer will not change (unless you change your server URL or the plugin path), so you will not need physical access to the printer.

    Thread Starter skoz95

    (@skoz95)

    Hi @lawrenceowen it’s working very well now.
    Many thanks and see you soon if I have another question.

Viewing 15 replies - 1 through 15 (of 21 total)
  • The topic ‘Add-on and custom field’ is closed to new replies.