• mellow1

    (@cdsigns)


    We are very grateful that this plugin is available, thank you for that!

    Do have 2 questions about using it:

    Buzzer
    Our client uses the printer in a kitchen and we have purchased a buzzer to go off when orders prints. This buzzer can be set up to buzz’ through the printer settings when you link the printer to a computer. We’ve managed to upload the logo to the printers’ FlashROM and are hoping to do the same with the buzzer-settings. We’d also be comfortable by using terminal but can’t find the instructions anywhere. If we activate the buzzer through the laptop’s printer settings, these settings are not used when the prints through plugin run.

    Could you please help us set up the buzzer?

    Product variations
    For the restaurants, several items have variations. We’ve added some minor changes like hardcoded translations and this works fine for us. But we have a question about the display of variations on the receipt.
    For example you can select a small or a large portion. Currently the receipt looks like this:
    Fries – small
    Sizing: small

    Meaning: the variation is repeated in the bold title on the receipt and also visible on a new line.

    We hope to make it like this:
    Fries
    Sizing: small

    When looking at: order-handler.php we see that $product_name is printed and on a new line $exploded_variation but this is not what the receipt is showing. Because on the first line the variation is also printed.

    What change to the code do we need to make so the first line is only $product_name and does not include the chosen variation?

    Thank you very much for your reply, we have a test-environment available and can provide login if that would help.

Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Contributor lawrenceowen

    (@lawrenceowen)

    Hi, I think that you have already been talking with our UK technical support is that right? I just need to check that it belongs to the same support ticket.

    It’s good to know that the plugin is working ok for you. I think that it is possible to adapt as you need, we will verify the tweaks and let you know today.

    Could you just confirm which printer model you are using? Currently the plugin does not include buzzer support – it’s definitely a feature we should consider adding as standard. But even so, we can help you get it working, the easiest way to enable it may depend a little on the printer model that you have. Also, would you prefer it to buzz before printing starts or when printing is completed?

    Thread Starter mellow1

    (@cdsigns)

    Hi Lawrence,

    Thank you for the very fast response. I did sent an email to support as well, but that was mainly about the firmware update for the printer itself.

    We have a Star TSP654II set up.

    It would be amazing if you could help us or send an instruction so we can add it. Would be more than okay to just get an overview of how to add it through terminal or something like that.

    We would like the buzzer to go off at the start of the document. With the normal settings we can also control the number of times the buzz is and the pauze. Would that also be possible to set here? Maybe like: buzz #1 500milliseconds, pauze 200milliseconds, buzz #2 500milliseconds

    If that is not possible we understand, any buzz will be great for the kitchen.

    Also looking forward to seeing if there is a possibility regarding the repetition of variations on the receipt.

    thank you!

    Plugin Contributor lawrenceowen

    (@lawrenceowen)

    Hi,

    Thanks for confirming, your question about the buzzer support had also arrived to me yesterday via support, so I just wanted to make sure that I can keep them updated too. Thanks for confirming the product details.

    Frustratingly, I have to admit that I’ve managed to get myselt working from home on Covid-19 lockdown without a buzzer. So I’m not able to verify the code changes here, although out printer buzzer support is quite simple, it should be fine.

    To trigger the buzzer at the start of a print job, please add the line:
    $printer->add_hex("07");
    to the star_cloudprnt_print_order_summary() function in order-handler.php.

    Ideally, this needs to be placed immediately before the line that calls $printer->set_codepage() (around like 207).

    This is a simple printer instruction that sounds the buzzer for 200ms, followed by a delay of 200ms. You can sound it multiple times just by adding the same line a few times or in a small loop. If it all works and you’d like a little more creativity then let me know and I’ll explain the command sequence for controlling the pulse/delay timing.

    I’ve had other requests for multi-copy printing so this is a feature that I’m likely to add soon. If you can accept a simple solution, without variations then I can help you to modify the current plugin quite easily.

    I’ll update you when I have a sample showing how to adjust the layout as you wanted.

    Thread Starter mellow1

    (@cdsigns)

    Hi,

    The buzzer code works like a charm, perfect!

    So for our other questions. We have a receipt, and already adjusted the display of some elements to make it better appropriate for our kitchen. But we are struggling with the product variations and display of that. I hope my wordpress-system translations are correct because the site is in Dutch.

    In the WordPress site we have a product attributes set up. It is in Dutch but it says: do you want a bun? (broodje)
    ja +0,60 (yes)
    nee (no)

    As you can see in the first image: Product-Variations-And-Terms

    So currently our receipt displays on the print:
    qty item name – attribute term
    attribute: term

    as you can see in this image:
    Current

    But we want to remove the attribute term on the first line so it will be:
    qty item name
    attribute: term
    Desired-Receipt

    We understand we need to change something in order-handler.php but do not understand what. Because the first line of code only requests product_name, but is also displays the chosen variation.

    Looking forward to your reply.

    Plugin Contributor lawrenceowen

    (@lawrenceowen)

    Hi, great to know that the buzzer is working!

    I’ve been looking into your other issue, and I have to admit I’m not a WooCommerce/Wordpress expert, so there maybe a more complete answer. However, the Star plugin doesn’t format this way intentionally, it seems that this product naming is created automatically by WooCommerce when implementing product variations. On my test installation, these product names are shown on the final order confirmation page to the customer too.

    So, the simplest fix is just to parse the product name string, taking the part before ” – “. This seems to be safe as long as none of your product names contain ” – “.

    I suggest modifying the star_cloudprnt_create_receipt_items() function as:

    function star_cloudprnt_create_receipt_items($order, &$printer, $max_chars)
    {
        $order_items = $order->get_items();
        foreach ($order_items as $item_id => $item_data)
        {
            $product_name = $item_data['name'];
            $product_id = $item_data['product_id'];
            $variation_id = $item_data['variation_id'];
            
            $item_qty = $order->get_item_meta($item_id, "_qty", true);
            $item_total_price = floatval($order->get_item_meta($item_id, "_line_total", true))
                            +floatval($order->get_item_meta($item_id, "_line_tax", true));
            $item_price = floatval($item_total_price) / intval($item_qty);
            $currencyHex = star_cloudprnt_get_codepage_currency_symbol();
            $formatted_item_price = number_format($item_price, 2, '.', '');
            $formatted_total_price = number_format($item_total_price, 2, '.', '');
            
            $short_name = explode(" - ", $product_name)[0];
            
            $printer->set_text_emphasized();
            $printer->add_text_line(str_replace('–', '-', $short_name)." - ID: ".$product_id."");
            $printer->cancel_text_emphasized();
            
            if ($variation_id != 0)
            {
                $product_variation = new WC_Product_Variation( $variation_id );
                $variation_data = $product_variation->get_variation_attributes();
                $variation_detail = star_cloudprnt_get_formatted_variation($variation_data, $order, $item_id); 
                $exploded = explode("||", $variation_detail);
                foreach($exploded as $exploded_variation)
                {
                    $printer->add_text_line(" ".ucwords($exploded_variation));
                }
            }
            $printer->add_text_line(star_cloudprnt_get_column_separated_data(array(" Qty: ".
                        $item_qty." x Cost: ".$currencyHex.$formatted_item_price,
                        $currencyHex.$formatted_total_price), $max_chars));
        }
    }

    Note the $short_name = explode(" - ", $product_name)[0]; part.

    Thread Starter mellow1

    (@cdsigns)

    Hi Lawrence,

    Thank you so much! we’ll have a look at all the code you’ve provided. We’ve been busy setting up all of our restaurants with the print plugin and have not been able to test it just yet because of the transition.

    Unfortunately several restaurants are showing issues a day after successfully installing the plugin and doing some test orders on the first day. On day 1 it works like a charm, within seconds the receipt is printed, with the buzzer and 2 copies, this is amazing!

    But on the second day print jobs are no longer showing up on the counter. If we check the settings page in WordPress, the “selected printer” dropdown is empty on day 2. After inspection we’ve found out that the orders are not visible in the ‘order_history’. There is also nothing in the ‘queue’-file or the ‘pending’ folder if we look at the plugin files.

    We set our STAR TSP 654 printers with a static IP and connect them, just like you advise in the ‘installation’ of the plugin. But on the second day the printer is gone from the backend and (off course) the orders are no longer printed.

    We’re trying to figure out what causes this problem, because the printer still can be reached, that next day, through the original IP and if we login on the printer, through the browser, the cloud settings with the shop-url are also still present and cloud print is enabled.

    Do you know of any other printer settings we might need to adjust or change to keep the printer connected? The thermal printers have loads of options like keep alive and much more we just keep on the defaults normally.

    Any ideas or suggestions are highly appreciated.

    Plugin Contributor lawrenceowen

    (@lawrenceowen)

    Hi, hopefully we can resolve this as quickly as possible.

    I can immediately imagine three possibilities.

    First possibility, is an issue that we have encountered with some web server TLS (https security) implementations. Most servers will negotiate a Session Ticket with the printer, which speeds up later communication between the server and printer. But when that ticket expires (depends on the server configuration, but usually after around a day) then it fails to re-negotiate and so effectively blocks communication. You can test this by switching the printer off and back on to force a renegotiation, if that resolves the issue then it almost certainly the cause. Later versions of the printer interface firmware work around this by detecting the issue and forcing a re-negotiation from the printer side. If you update your interface firmware (from memory, I think 1.5 or later should include this fix) then it should be resolved.

    The second possibility is harder to resolve. If your hosting is sitting behind a traffic filter (such as Cloudflare) then those filters can misinterpret the regular printer connection to your server as something malicious (it is unusual looking traffic, compared with typical web browsing) and may block the connection. This can also a hard issue to fully diagnose, depending on your traffic filter, but if cycling the printer power does not resolve the issue then it is a strong possibility. If this is the issue, then you need to find a way to whitelist either the printer, or the CloudPRNT URL with your traffic filter.

    Thirdly, since you mentioned that the “selected printer” dropdown is empty, I am concerned that something may be interfering with the settings of your plugin. The dropdown list is populated from some local files which are stored when a printer connects to your server. These are stored (including print jobs) in your web sites “wp-content/star-cloudprnt” folder on your server. Please make sure that your web server has full read/write access to this folder, and that there is no other service that may delete or modify it (perhaps a security plugin that is removing unknown folders?). In particular, deleting this folder or the files that it contains would cause the dropdown list to become empty and no jobs to be created.

    Thread Starter mellow1

    (@cdsigns)

    Might there be a possibility to send screenshots of the server settings through a private upload / email? I would prefer them to not be open on this forum but not sure how that might be possible.

    Plugin Contributor lawrenceowen

    (@lawrenceowen)

    Yes, of course. unfortunately this forum doesn’t seem to offer a direct message option, so please email [email protected] directly and ask for the mail for be forwarded to Lawrence Owen.
    I will respond to you directly, and can provide a secure private upload area if needed.

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

The topic ‘Use buzzer when order prints & variations’ is closed to new replies.