2 house numbers after update Myparcel plugin

  • Posts: 220
  • Thank you received: 8
1 year 3 months ago #348315

-- HikaShop version -- : 4.5.0
-- Joomla version -- : 3.10.11
-- PHP version -- : 8.0.25

Hi,
I've updated an outdated 2020 version of the Myparcel label and track plugin. Now we use version 1.1.4

In our address configuration street and house number have two seperate fields. The house number is in field address_street2.
To make that work in the old plugin we added custom code to myparcel.php like Nicolas suggested in the forum. That worked fine.

After the update this hack is unnecessary since Hikashop added a house number field in the settings of the plugin.
But now the house number shows twice in the labels! The number is displayed in the same line as the street name and once more in a new line.


See screen prints.

Please advise.
Udo

Attachments:

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

  • Posts: 81504
  • Thank you received: 13063
  • MODERATOR
1 year 3 months ago #348319

Hi,

You should:
- create a new custom field of the table "address" to store the house number
- change the "address format" setting in the HikaShop configuration to add the corresponding tag
- run an address mass action to copy the address_street2 to that new custom field for all the existing addresses
- run an address mass action to empty the address_street2 field
- change the settings of the MyParcel plugin to use that new field instead of the address_street2 field for the house number.
- optionnally, you can deactivate the address_street2 field or rename it to "additional information" or something like that so that the customers can provide extra information on the address.

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

  • Posts: 220
  • Thank you received: 8
1 year 3 months ago #348392

Hi Nicolas,

Thanks for the plan of action. However, it's quite a hassle. There are about 15,000 addresses.
And to be honest I don't know how to set up a mass action to copy the address_street2 to the new custom field.

For now I've applied a simple modification to myparcel.php that I used before in the old version of the plugin.
I've commented these 2 lines

// if(!empty($order->shipping_address->address_street2))
// $consignment->setStreetAdditionalInfo($order->shipping_address->address_street2);

That's certainly not the best solution, but the second house number is gone. I hope there are no drawbacks.

Regards,
Udo

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

  • Posts: 81504
  • Thank you received: 13063
  • MODERATOR
1 year 3 months ago #348395

Hi,

The mass action will allow you to process all the addresses at once, so whether you have 10 addresses or thousands, it shouldn't matter.
The mass action is not that complex. For the first mass action, you need just an action 'update the values' on the column XXX (where XXX is the column name of the new custom address field) with the mode "operation" and the value address.address_street2
You also need to increase the number of elements from 500 to 20000 in the "limitations" area so that it can handle all the addresses at once.
For the second mass action, you do the same but on the address_street2 column with the mode "string" and the value left empty.

You sure can modify the code of the plugin. No drawbacks. You'll just have to redo the modification each time you update the plugin.

The following user(s) said Thank You: Udo

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

Time to create page: 0.077 seconds
Powered by Kunena Forum