Shipping Method Title Glitch

  • Posts: 31
  • Thank you received: 3
6 years 3 months ago #296490

-- url of the page with the problem -- : www.solarmade.com/
-- HikaShop version -- : 3.5.1
-- Joomla version -- : 3.8.5
-- PHP version -- : 5.6.30
-- Browser(s) name and version -- : Chrome 68.0.3440.84
-- Error-message(debug-mod must be tuned on) -- : N/A

Hey guys,

We've discovered an odd glitch occurring since a recent update. Items placed in different warehouses (to allow for different shipping methods on certain items) will show their shipping method title in the format [ 27-1@5 ] or [ 30-5@3 ] or [ 32-5@2 ] and so forth.The glitch is not present during checkout (since it does properly show the shipping method title then; USPS Priority Mail, UPS Ground, etc.) but occurs on the order summary emailed to us, the receipt emailed to the customer, and the order record in the backend of Hikashop. The really weird thing is it does not occur when items from the same warehouse are ordered, only items from different warehouses. It also does not do it with our free shipping plugin but only USPS/UPS shipments.

I have tried debug mode but did not discover much since the problem does not happen until after checkout when we receive the order summary with the odd shipping names. Pics attached of some of these of these glitchy multi-warehouse orders, as well as some normal single warehouse orders. Any idea what could be causing this?

Attachments:

Please Log in or Create an account to join the conversation.

  • Posts: 82868
  • Thank you received: 13376
  • MODERATOR
6 years 3 months ago #296545

Hi,

This is caused by some code missing to properly set the shipping method and shipping id in the hikashop_order_product table when the order is created with the new checkout of HikaShop 3 from what I could debug.
Because of that, the algorithm doesn't find the needed information to be able to get the name and so as the last fallback, the system just displays the ids : [id of the shipping method-id of the key of the service of the shipping method (in the code of the plugin in plugins/hikashopshipping/ups/ups.php in the big array at the top with the "key" parameter )@id of the warehouse]

So I spend the afternoon, reproducing, rewritting the code and testing. Change the code:

if(!empty($cart->shipping)) {
	$shipping_done = false;
	foreach($cart->shipping_groups as $group_key => $group_products) {
		if(!isset($shippings[$group_key]))
			continue;
		foreach($group_products->products as $group_product) {
			if((int)$group_product->cart_product_id == (int)$product->cart_product_id) {
				$orderProduct->order_product_shipping_id = $shippings[$group_key]['id'] . '@' . $group_key;
				$orderProduct->order_product_shipping_method = $shippings[$group_key]['name'];
				$shipping_done = true;
				break;
			}
		}
		if($shipping_done)
			break;
	}
}
to:
if(!empty($cart->shipping) && !empty($order->order_shipping_id)) {
	$shippings = explode(';', $order->order_shipping_id);
	$shipping_done = false;
	foreach($cart->shipping_groups as $group_key => $group_products) {
		foreach($group_products->products as $group_product) {
			// same product
			if((int)$group_product->cart_product_id == (int)$product->cart_product_id) {
				foreach( $shippings as $shipping) {
					list($shipping_id, $shipping_group_key) = explode('@', $shipping, 2);
					// same group key
					if($shipping_group_key == $group_key) {
						foreach($cart->shipping as $cart_shipping) {
							// same shipping method
							if($cart_shipping->shipping_id == $shipping_id) {
								$orderProduct->order_product_shipping_id = $shipping;
								$orderProduct->order_product_shipping_method = $cart_shipping->shipping_type;
								$shipping_done = true;
								break;
							}
						}
						if($shipping_done)
							break;
					}
				}
				if($shipping_done)
					break;
			}
		}
		if($shipping_done)
			break;
	}
}
in the file administrator/components/com_hikashop/classes/order.php and for new orders, it should now work properly again.
Please let us know how it goes.

Last edit: 6 years 3 months ago by Jerome. Reason: remove extra tabs

Please Log in or Create an account to join the conversation.

  • Posts: 31
  • Thank you received: 3
6 years 3 months ago #296625

Nicolas,

I replaced the block of code above but got a site-wide white screen of death. I switched back to the default order.php file for now and everything is working. PHP file with the replacement code attached in a .zip so we can be sure I modified it correctly.

Regards,
Ian

Attachments:
Last edit: 6 years 3 months ago by SolarMade.

Please Log in or Create an account to join the conversation.

  • Posts: 12953
  • Thank you received: 1778
6 years 3 months ago #296674

Hello,

Note that a blank page only means that an error occurred but can't be displayed because the Joomla debug mode and Error reporting are disabled, can you :
- Activate the Joomla debug mode ("Administration->Global configuration->System->Debug System/Language")
- Set the "error reporting" option of the Joomla configuration to "maximum"
- Test it again so that you can see if it display an error message which will help us to understand from what your issue is coming.

Thank you.

Please Log in or Create an account to join the conversation.

  • Posts: 31
  • Thank you received: 3
6 years 3 months ago #296738

Mohamed,

Here's the error I'm getting:

Parse error: syntax error, unexpected 'public' (T_PUBLIC) in /home3/solarmad/public_html/administrator/components/com_hikashop/classes/order.php on line 858

Please Log in or Create an account to join the conversation.

  • Posts: 82868
  • Thank you received: 13376
  • MODERATOR
6 years 3 months ago #296749

Hi,

I've done the change last week on our end and I did test the fix at that time. I didn't get the error and no one else on our end did either.
Also, I've checked the file you gave in www.hikashop.com/forum/install-update/89...e-glitch.html#296625 but I can't see any issue near the line 858 nor near the code change you did. So I don't see why you would get that error when doing that change.
I guess we'll need a backend access, a FTP access and precise instructions to reproduce the problem along with a link to this thread via our contact form so that we can look at that ourselves since we can't see why you would have that error:
www.hikashop.com/support/contact-us.html

Please Log in or Create an account to join the conversation.

  • Posts: 31
  • Thank you received: 3
6 years 3 months ago #296994

Nicolas,

Sent you the required info through the contact form. Looking forward to see what you can figure out, let me know if you need anything else.

Regards,
Ian

Please Log in or Create an account to join the conversation.

  • Posts: 12953
  • Thank you received: 1778
6 years 3 months ago #297023

Hello Ian,

I just correctly added the code that Nicolas gave you through his last post, and it should work fine with future orders (you can check it with the last order we created on your website).

Kind regards,
Mohamed Thelji.

Please Log in or Create an account to join the conversation.

  • Posts: 31
  • Thank you received: 3
6 years 3 months ago #297035

Mohamed,

Looks like it's resolved, thanks a bunch! What did the issue end up being?

Regards,
Ian

Please Log in or Create an account to join the conversation.

  • Posts: 12953
  • Thank you received: 1778
6 years 3 months ago #297036

Hello,

Well I think that the fix Nicolas gave you wasn't properly applied.

Best regards,
Mohamed Thelji.

Please Log in or Create an account to join the conversation.

Time to create page: 0.060 seconds
Powered by Kunena Forum