public function defaultPlainEmailMessage($order) { $msg = __("ORDER NUMBER", "cart66") . ": " . $order->trans_id . "\n\n"; $hasDigital = false; $product = new Cart66Product(); foreach ($order->getItems() as $item) { $product->load($item->product_id); if ($hasDigital == false) { $hasDigital = $product->isDigital(); } $price = $item->product_price * $item->quantity; // $msg .= "Item: " . $item->item_number . ' ' . $item->description . "\n"; $msg .= __("Item", "cart66") . ": " . $item->description . "\n"; if ($hasDigital) { $receiptPage = get_page_by_path('store/receipt'); $receiptPageLink = get_permalink($receiptPage); $receiptPageLink .= strstr($receiptPageLink, '?') ? '&duid=' . $item->duid : '?duid=' . $item->duid; $msg .= "\n" . $receiptPageLink . "\n"; } if ($item->quantity > 1) { $msg .= __("Quantity", "cart66") . ": " . $item->quantity . "\n"; } $msg .= __("Item Price", "cart66") . ": " . Cart66Common::currency($item->product_price, false) . "\n"; $msg .= __("Item Total", "cart66") . ": " . Cart66Common::currency($item->product_price * $item->quantity, false) . "\n\n"; if ($product->isGravityProduct()) { $msg .= Cart66GravityReader::displayGravityForm($item->form_entry_ids, true); } } if ($order->shipping_method != 'None' && $order->shipping_method != 'Download') { $msg .= __("Shipping", "cart66") . ": " . Cart66Common::currency($order->shipping, false) . "\n"; } if (!empty($order->coupon) && $order->coupon != 'none') { $msg .= __("Coupon", "cart66") . ": " . $order->coupon . "\n"; } if ($order->tax > 0) { $msg .= __("Tax", "cart66") . ": " . Cart66Common::currency($order->tax, false) . "\n"; } $msg .= "\n" . __("TOTAL", "cart66") . ": " . Cart66Common::currency($order->total, false) . "\n"; if ($order->shipping_method != 'None' && $order->shipping_method != 'Download') { $msg .= "\n\n" . __("SHIPPING INFORMATION", "cart66") . "\n\n"; $msg .= $order->ship_first_name . ' ' . $order->ship_last_name . "\n"; $msg .= $order->ship_address . "\n"; if (!empty($order->ship_address2)) { $msg .= $order->ship_address2 . "\n"; } $msg .= $order->ship_city . ' ' . $order->ship_state . ' ' . $order->ship_zip . "\n" . $order->ship_country . "\n"; if (is_array($additional_fields = maybe_unserialize($order->additional_fields)) && isset($additional_fields['shipping'])) { foreach ($additional_fields['shipping'] as $af) { $msg .= html_entity_decode($af['label']) . ': ' . $af['value'] . "\n"; } } $msg .= "\n" . __("Delivery via", "cart66") . ": " . $order->shipping_method . "\n"; } $msg .= "\n\n" . __("BILLING INFORMATION", "cart66") . "\n\n"; $msg .= $order->bill_first_name . ' ' . $order->bill_last_name . "\n"; $msg .= $order->bill_address . "\n"; if (!empty($order->bill_address2)) { $msg .= $order->bill_address2 . "\n"; } $msg .= $order->bill_city . ' ' . $order->bill_state; $msg .= $order->bill_zip != null ? ', ' : ' '; $msg .= $order->bill_zip . "\n" . $order->bill_country . "\n"; if (is_array($additional_fields = maybe_unserialize($order->additional_fields)) && isset($additional_fields['billing'])) { foreach ($additional_fields['billing'] as $af) { $msg .= html_entity_decode($af['label']) . ': ' . $af['value'] . "\n"; } } if (!empty($order->phone)) { $phone = Cart66Common::formatPhone($order->phone); $msg .= "\n" . __("Phone", "cart66") . ": {$phone}\n"; } if (!empty($order->email)) { $msg .= __("Email", "cart66") . ': ' . $order->email . "\n"; } if (is_array($additional_fields = maybe_unserialize($order->additional_fields)) && isset($additional_fields['payment'])) { foreach ($additional_fields['payment'] as $af) { $msg .= html_entity_decode($af['label']) . ': ' . $af['value'] . "\n"; } } if (isset($order->custom_field) && $order->custom_field != '') { if (Cart66Setting::getValue('checkout_custom_field_label')) { $msg .= "\n" . Cart66Setting::getValue('checkout_custom_field_label'); } else { $msg .= "\n" . __('Enter any special instructions you have for this order:', 'cart66'); } $msg .= "\n" . $order->custom_field . "\n"; } $receiptPage = get_page_by_path('store/receipt'); $link = get_permalink($receiptPage->ID); if (strstr($link, "?")) { $link .= '&ouid=' . $order->ouid; } else { $link .= '?ouid=' . $order->ouid; } if ($hasDigital) { $msg .= "\n" . __('DOWNLOAD LINK', 'cart66') . "\n" . __('Click the link below to download your order.', 'cart66') . "\n{$link}"; } else { $msg .= "\n" . __('VIEW RECEIPT ONLINE', 'cart66') . "\n" . __('Click the link below to view your receipt online.', 'cart66') . "\n{$link}"; } $msgIntro = Cart66Setting::getValue('receipt_intro') && !Cart66Setting::getValue('enable_advanced_notifications') ? Cart66Setting::getValue('receipt_intro') : ''; $msgIntro .= Cart66Setting::getValue('receipt_message_intro') && Cart66Setting::getValue('enable_advanced_notifications') ? Cart66Setting::getValue('receipt_plain_email') : ''; $msg = $msgIntro . " \n----------------------------------\n\n" . $msg; return $msg; }
if ($hasDigital == false) { $hasDigital = $product->isDigital(); } $price = $item->product_price * $item->quantity; // $msg .= "Item: " . $item->item_number . ' ' . $item->description . "\n"; $msg .= __("Item", "cart66") . ": "; if (Cart66Setting::getValue('display_item_number_receipt')) { $msg .= $item->item_number . ' '; } $msg .= $item->description . "\n"; if ($item->quantity > 1) { $msg .= __("Quantity", "cart66") . ": " . $item->quantity . "\n"; } $msg .= __("Item Price", "cart66") . ": " . Cart66Common::currency($item->product_price, false) . "\n"; $msg .= __("Item Total", "cart66") . ": " . Cart66Common::currency($item->product_price * $item->quantity, false) . "\n\n"; if ($product->isGravityProduct()) { $msg .= Cart66GravityReader::displayGravityForm($item->form_entry_ids, true); } } if ($order->shipping_method != 'None' && $order->shipping_method != 'Download') { $msg .= __("Shipping", "cart66") . ": " . Cart66Common::currency($order->shipping, false) . "\n"; } if (!empty($order->coupon) && $order->coupon != 'none') { $msg .= __("Coupon", "cart66") . ": " . $order->coupon . "\n"; } if ($order->tax > 0) { $msg .= __("Tax", "cart66") . ": " . Cart66Common::currency($order->tax, false) . "\n"; } $msg .= "\n" . __("TOTAL", "cart66") . ": " . Cart66Common::currency($order->total, false) . "\n"; if ($order->shipping_method != 'None' && $order->shipping_method != 'Download') { $msg .= "\n\n" . __("SHIPPING INFORMATION", "cart66") . "\n\n";
public static function increaseInventory($id, $variation = '', $qty = 1) { Cart66Common::log("Increasing Inventory: line " . __LINE__); // Build varation ikey string component if (!empty($variation)) { $variation = self::scrubVaritationsForIkey(str_replace(', ', '~', $variation)); } $p = new Cart66Product($id); $is_gravity_form = false; $valid_options = array(); if ($p->isGravityProduct()) { $valid_options = Cart66GravityReader::getFormValuesArray($p->gravity_form_id); $is_gravity_form = true; } else { if (strlen($p->options_1) > 1) { $valid_options[] = explode(',', str_replace(' ', '', $p->options_1)); } if (strlen($p->options_2) > 1) { $valid_options[] = explode(',', str_replace(' ', '', $p->options_2)); } } $newVariation = ''; $options = explode(',', $variation); foreach ($options as $option) { if ($p->validate_option($valid_options, $option, $is_gravity_form)) { $newVariation .= $option; } } $ikey = $p->getInventoryKey($newVariation); $count = $p->getInventoryCount($ikey); $newCount = $count + $qty; $p->setInventoryLevel($ikey, $newCount); }