ResolvedCloud order printing
- This topic has 2 replies, 3 voices, and was last updated 3 years, 2 months ago by
Althemist.
- AuthorPosts
- October 2, 2020 at 6:49 pm #26163
admin-7592
ParticipantHi,
I’m using Star Cloud-print to print the orders. All works, but is not printing the variations of Lafka global addon.
Here is the code of cloud print
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, ‘.’, ”);$printer->set_text_emphasized();
$printer->add_text_line(str_replace(‘–’, ‘-‘, $product_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));
}
}How I can add the customs variations?
Thanks
October 3, 2020 at 2:34 pm #26167zeli.armel
ParticipantHi,
I’m using also the Star CloudPRNT for WooCommerce plugin, see the solution here : https://wordpress.org/support/topic/add-on-and-custom-field/ (this is my own topic)
Kind regards
October 5, 2020 at 5:23 pm #26179Althemist
KeymasterHi zeli.armel,
Thanks for sharing such valuable information with other fellow users. 🙂
Best regards,
Dimitar - AuthorPosts
You must be logged in and have valid license to reply to this topic.