cybsys
Forum Replies Created
-
Forum: Plugins
In reply to: [DHL Shipping Germany for WooCommerce] Insurance Value Not Matching LabelThe shipping fee isn’t the problem. Read above what the problem is. I even shared the code so you know exactly what I did.
Forum: Plugins
In reply to: [DHL Shipping Germany for WooCommerce] Insurance Value Not Matching LabelYes.
Forum: Plugins
In reply to: [DHL Shipping Germany for WooCommerce] Customs Description Not Matching LabelI don’t know how to use the hook, so I just edited the core files. When you release an update, I will re-patch the core files as needed because I kept a personal log of the files I edited (that is, I will only need to do that if the core isn’t fixed so hopefully you make the necessary changes to the GitHub repo to fix this bug).
I’d highly recommend making this an option in the DHL plugin settings so users can select what they’d prefer to use as the description on the label.
Forum: Plugins
In reply to: [DHL Shipping Germany for WooCommerce] Insurance Value Not Matching LabelThe insurance value defaults to the total value (which is fine), but if I change it then it prints the total value. That doesn’t make any sense, so I forced it in the code to use the insurance value at all times because if the insurance value is less than the total value, we’d want to use that instead otherwise it defeats the purpose (you can’t declare a lower insurance value than the product total otherwise DHL won’t like that).
Forum: Plugins
In reply to: [DHL Shipping Germany for WooCommerce] Customs Description Not Matching LabelOkay, I fixed it myself. File to edit is
includes\REST_API\DHL_eCS_Asia\Client.php
In the function
item_info_to_request_data
, you need to edit theshipment_content
array:'description' => $item_info->shipment['description'], //$content['description'], 'descriptionExport' => $item_info->shipment['description'], //$content['descriptionExport'],
Forum: Plugins
In reply to: [DHL Shipping Germany for WooCommerce] Insurance Value Not Matching LabelOkay, the file to edit is
includes\REST_API\DHL_eCS_Asia\Client.php
.
The function to edit isitem_info_to_request_data
.You then want to edit the
shipment_item
array that is parsed:'insuranceValue' => $item_info->shipment['insuranceValue'], //items_value 'totalValue' => $item_info->shipment['insuranceValue'],
In this case, I made them both use the specified
insuranceValue
variable.You then need to also edit the
shipment_content
array below in the same function.'itemValue' => $item_info->shipment['insuranceValue'], //$content['value'],
- This reply was modified 3 years, 8 months ago by cybsys.
Forum: Plugins
In reply to: [DHL Shipping Germany for WooCommerce] Insurance Value Not Matching Label"insuranceValue":70,"totalValue":150.00,
It seems as if it is using the
totalValue
variable. This is a bug and needs to be fixed. Can you tell me which file I need to edit the PHP code on to fix it?Forum: Plugins
In reply to: [DHL Shipping Germany for WooCommerce] Error: Invalid file path!Your environment may not be using class-pr-dhl-api-ecs-asia.php. Some may use the REST or SOAP PHP files instead. You will have to just run tests like I did in my first post to figure out which PHP file triggers the label creation. From there, you can edit the functions and fix them as needed.
@shadim should really be working on fixing this plugin properly for public use with Windows Server though or at least mention that it’s for Unix servers only.
Forum: Plugins
In reply to: [DHL Shipping Germany for WooCommerce] Customs Description Not Matching LabelHow do I use
pr_shipping_dhl_label_args
so it doesn’t get the label name from the product title?Forum: Plugins
In reply to: [DHL Shipping Germany for WooCommerce] Error: Invalid file path!Dunno. I don’t want to waste any more time on this plugin. I’ve already spent several hours working on it. It’s working for me so I’ll leave it be. Best you setup a Windows Server on a localhost, get a quick database setup with WordPress and test it yourself to see the pain I had to go through to get it working.
Forum: Plugins
In reply to: [DHL Shipping Germany for WooCommerce] Error: Invalid file path!Okay, I got it working. File to edit is abstract-pr-dhl-wc-order.php. However, you need to refresh the page once you have created the label (which is very annoying). This is because of this code.
global $woocommerce, $post; $order_id = $post->ID;
To fix that, you need to edit the function
generate_download_url
in class-pr-dhl-wc-order-ecs-asia.php and class-pr-dhl-api-ecs-asia.php to have a second argument which is$order_id
so the order ID is parsed on execution since the page doesn’t pull that data after the page has loaded.Anyway, here is the updated function
public function generate_download_url( $endpoint_path ) { // used for Windows Server only global $woocommerce, $post; $order_id = $post->ID; // If we get a different URL addresses from the General settings then we're going to // construct the expected endpoint url for the download label feature manually if ( site_url() != home_url() ) { // You can use home_url() here as well, it really doesn't matter // as we're only after for the "scheme" and "host" info. $result = parse_url( site_url() ); if ( !empty( $result['scheme'] ) && !empty( $result['host'] ) ) { return $result['scheme'] . '://' . $result['host'] . $endpoint_path; } } // Defaults to the "Site Address URL" from the general settings along // with the the custom endpoint path (with parameters) //return home_url($endpoint_path); // Unix // Windows Server will generate "https://mysite.com/dhl_download_label/1234" so we will inject the path manually $label_tracking_info = $this->get_dhl_label_tracking($order_id); $label = substr($label_tracking_info['label_path'], 17); return home_url($label); }
Make the changes to your GitHub repo (but of course, don’t use the hardcoded
substr
code. Make it dynamic). This bug is horrid. You shouldn’t code projects for Unix only. A LOT of people use Windows Server.https://github.com/shadimanna/dhl-logistic-services-for-woocommerce
- This reply was modified 3 years, 9 months ago by cybsys.
- This reply was modified 3 years, 9 months ago by cybsys.
- This reply was modified 3 years, 9 months ago by cybsys.
- This reply was modified 3 years, 9 months ago by cybsys.
- This reply was modified 3 years, 9 months ago by cybsys.
- This reply was modified 3 years, 9 months ago by cybsys.
Forum: Plugins
In reply to: [DHL Shipping Germany for WooCommerce] Error: Invalid file path!Yes. Windows Server 2012. Did you design this plugin with only a Unix system in mind? If so, we’ll need to fix it. It’s better to do a string find and replace than to remove the first 3 chars in the string like I am and run a function which verifies if it’s a Windows system or not, but that can be done later. For now, I’m just trying to figure out why the file downloads are not working. Any advice? ??
Forum: Plugins
In reply to: [DHL Shipping Germany for WooCommerce] Error: Invalid file path!Small update. All changes above were reverted and this function needs to be edited (along with
get_dhl_close_out_label_file_info
). “C:” must be removed from the path otherwise it fails to create a label. However, after editing these two functions, I cannot download the label when I clock on ‘Download Label’. It downloads a file called “post.htm” which seems to just contain the entire webpage source.public function get_dhl_item_label_file_info( $barcode, $format = 'pdf' ) { $file_name = $this->get_dhl_item_label_file_name($barcode, $format); $folder_dir = PR_DHL()->get_dhl_label_folder_dir() . $file_name; $folder_url = PR_DHL()->get_dhl_label_folder_url() . $file_name; $folder_dir = substr($folder_dir, 2); // remove "C:" from the string /*if(1) { throw new Exception( __($folder_dir)); }*/ // debugging return (object) array( 'path' => $folder_dir, 'url' => $folder_url, ); }
Any ideas @shadim?
Forum: Plugins
In reply to: [DHL Shipping Germany for WooCommerce] Message Validation FailedSure, an email has been sent.
Forum: Plugins
In reply to: [DHL Shipping Germany for WooCommerce] Message Validation FailedOkay, I see. So there is the V1 API (which the old plugin versions use) and now you are using V2 of the API. I guess I cannot use my old credentials from V1 on V2.
Based on your new information and also looking at the logs again I can see that the URL it is requesting is returning back with a credentials failure response.
Anyway, I have since contacted my account manager and they said that WooCommerce doesn’t support the new version of the DHL plugin, so I’m not sure why they have told me that it’s not supported and I can’t get new (V2) API credentials.
I will try and contact my account manager again tomorrow and force them to generate me new credentials (even if they think they won’t work). Such a pain.
I appreciate the help Shadi.