Skip to content

Instantly share code, notes, and snippets.

@BHEADRICK
Last active June 17, 2019 14:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save BHEADRICK/cf719da690b38045b3210eca3bd5481a to your computer and use it in GitHub Desktop.
Save BHEADRICK/cf719da690b38045b3210eca3bd5481a to your computer and use it in GitHub Desktop.
WC Dropshipping issues
--- //wp-content/plugins/woocommerce-dropshipping/inc/class-wc-dropshipping-admin.php 2019-06-11 23:30:10.000000000 -0400
+++ //wp-content/plugins/woocommerce-dropshipping.new/inc/class-wc-dropshipping-admin.php 2019-06-17 09:57:01.000000000 -0400
@@ -221,7 +221,7 @@
foreach ($meta as $key => $val) {
if (isset($_POST[$key])) $meta[$key] = $_POST[$key];
}
/* update_woocommerce_term_meta is deprecated, use update_term_meta */
- $cterm = update_woocommerce_term_meta( $term_id, 'meta', $meta );
+ $cterm = update_term_meta( $term_id, 'meta', $meta );
/*Create New User When Create Term*/
if($cterm != ''){
@@ -279,7 +279,7 @@
if ( $taxonomy != 'product_cat' && ! taxonomy_is_product_attribute( $taxonomy ) )
return;
$meta_name = taxonomy_is_product_attribute( $taxonomy ) ? 'order_' . esc_attr( $taxonomy ) : 'order';
- update_woocommerce_term_meta( $term_id, $meta_name, 0 );
+ update_term_meta( $term_id, $meta_name, 0 );
}
/* When a term is deleted, delete its meta. */
--- //wp-content/plugins/woocommerce-dropshipping/inc/class-wc-dropshipping-orders.php 2019-06-11 23:30:10.000000000 -0400
+++ //wp-content/plugins/woocommerce-dropshipping.new/inc/class-wc-dropshipping-orders.php 2019-06-17 09:58:34.000000000 -0400
@@ -103,9 +103,8 @@
$info['imgurl'] = $thumbnail['0'];
$currency_symbol = get_woocommerce_currency_symbol();
-
- $item_data = $item->get_data();
- $info['price'] = '<span class="currency">'. $currency_symbol .'</span>'. $item_data['subtotal'];
+
+ $info['price'] = '<span class="currency">'. $currency_symbol .'</span>'. $item->get_subtotal();
/*$product_id = $item['product_id'];
$product_variation_id = $item['variation_id'];
@@ -191,11 +190,19 @@
return trim(preg_replace('/\(\$\d.*\)/','',$d));
}
-
+ /*private function get_addon_key_string($addon)
+ {
+ $key = $addon['name'];
+ if ( $addon['price'] > 0 && apply_filters( 'woocommerce_addons_add_price_to_name', true ) ) {
+ $key .= ' (' . strip_tags( wc_price( get_product_addon_price_for_display( $addon['price'], $values['data'], true ) ) ) . ')';
+ }
+ return $key;
+ }*/
+
public function get_order_info($order) {
// gather some of the basic order info
$order_info = array();
/* Order id and order number may be different. If they are, attempting to use the order number as the id will result in errors
The order# is the value that should be displayed, but the order id points to the record in the db
*/
- $order_info['id'] = $order->get_order_number();
+ $order_info['id'] = $order->get_id();
$order_info['number'] = $order->get_order_number();
$order_info['options'] = get_option( 'wc_dropship_manager' );
$order_info['shipping_info'] = $this->get_order_shipping_info($order);
@@ -503,11 +510,11 @@
$hdrs['From'] = $from_email;
$hdrs['To'] = $supplier_info['order_email_addresses'];
$hdrs['CC'] = $from_email;
- $order_status = $order->get_status();
- if ($order_status == 'completed') {
- $hdrs['Subject'] = 'Order #'.$order_info['id'].' is completed ';
+
+ if ($order->get_status() == 'completed') {
+ $hdrs['Subject'] = 'Order #'.$order_info['number'].' is completed ';
}else {
- $hdrs['Subject'] = 'New Order #'.$order_info['id'].' From '.$from_name;
+ $hdrs['Subject'] = 'New Order #'.$order_info['number'].' From '.$from_name;
}
$semi_rand = md5(time());
@@ -567,13 +574,13 @@
$pack_address = $order_info['options']['packing_slip_address'];
if( $fullinfo == '1' && $sup_companyname == '1' && $sup_address == '1') {
- $csv_name = $order_info['id'].'_'.$supplier_info['slug'].'_'.$pack_company.'_'.$pack_address.'.csv';
+ $csv_name = $order_info['number'].'_'.$supplier_info['slug'].'_'.$pack_company.'_'.$pack_address.'.csv';
}else if( $fullinfo == '1' && $sup_address == '1' ) {
- $csv_name = $order_info['id'].'_'.$supplier_info['slug'].'_'.$pack_address.'.csv';
+ $csv_name = $order_info['number'].'_'.$supplier_info['slug'].'_'.$pack_address.'.csv';
}else if( $fullinfo == '1' && $sup_companyname == '1' ){
- $csv_name = $order_info['id'].'_'.$supplier_info['slug'].'_'.$pack_company.'.csv';
+ $csv_name = $order_info['number'].'_'.$supplier_info['slug'].'_'.$pack_company.'.csv';
}else{
- $csv_name = $order_info['id'].'_'.$supplier_info['slug'].'.csv';
+ $csv_name = $order_info['number'].'_'.$supplier_info['slug'].'.csv';
}
$message .= "--{$mime_boundary_mixed}\n" .
@@ -606,8 +613,8 @@
public function send_order_attach_packingslip($attachments,$order_info,$supplier_info) {
$html = $this->get_packingslip_html($order_info,$supplier_info);
- $file_name = $order_info['id'].'_'.$supplier_info['slug'].'.pdf';
- $csv_name = $order_info['id'].'_'.$supplier_info['slug'].'.csv';
+ $file_name = $order_info['number'].'_'.$supplier_info['slug'].'.pdf';
+ $csv_name = $order_info['number'].'_'.$supplier_info['slug'].'.csv';
$attachments['pdf_packingslip'] = $this->make_pdf($order_info,$supplier_info,$html,$file_name); // create a pdf packing slip file
$options = get_option( 'wc_dropship_manager' );
if($options['csv_inmail'] == '1') {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment