I could not find help (at least that I understood), in the User-guide, or on the forum, so I kindly ask if anyone could help me?
I have created a new Customer-Data-module (to be precise, I have copied the street-address and renamed every instance of "street_address"), meant for collecting the phone number of the delivery address, in case it is different from the billing address. The new field shows up, I can also see it in admin->customers, but I don't know how to make it appear on admin->orders, and prefferably also on the invoice and packingslip?
I'm assuming that I'm missing something obvious, but could anyone help me find it? I'm afraid I've stared myself blind.
I forgot to mention the first time around: The version I'm working on here is 1.0.7.12
//Daniel
Adding a new adress-field in orders.php
- Kofod95
- Senior Contributor
- Posts: 748
- Joined: Sat Feb 06, 2021 7:38 pm
- Phoenix Version: 1.0.8.20
- Has thanked: 99 times
- Been thanked: 179 times
Adding a new adress-field in orders.php
Last edited by Kofod95 on Thu Mar 18, 2021 9:46 am, edited 1 time in total.
I'm not smart, but sometimes even a blind chicken can find a corn.
Here are a lot of corns: Phoenix user guide
Here are a lot of corns: Phoenix user guide
-
heatherbell
- Senior Contributor
- Posts: 2540
- Joined: Mon Oct 07, 2019 4:39 am
- Phoenix Version:
- Has thanked: 35 times
- Been thanked: 243 times
Re: Adding a new adress-field in orders.php
That's a bit beyond the scope of the User Guide at present but well done for getting as far as you have.
Presumably you now have a new column in the address_book table in DB so I guess you need to edit orders.php, invoice.php to call and show it, may be a hook file to do that?
- Kofod95
- Senior Contributor
- Posts: 748
- Joined: Sat Feb 06, 2021 7:38 pm
- Phoenix Version: 1.0.8.20
- Has thanked: 99 times
- Been thanked: 179 times
Re: Adding a new adress-field in orders.php
I actually thought that orders.php called the customer data modules automaticly, and I just missed a setting to "activate" that call for my new module. That was why I looked in the User-guideheatherbell wrote: ↑Thu Mar 18, 2021 9:29 am That's a bit beyond the scope of the User Guide at present but well done for getting as far as you have.
Presumably you now have a new column in the address_book table in DB so I guess you need to edit orders.php, invoice.php to call and show it, may be a hook file to do that?
I have a new column, yes, so I will look into creating a hook for it, if my original assumption is wrong.
//Daniel
I'm not smart, but sometimes even a blind chicken can find a corn.
Here are a lot of corns: Phoenix user guide
Here are a lot of corns: Phoenix user guide
-
ecartz
- Core Team
- Posts: 3084
- Joined: Tue Nov 05, 2019 6:02 pm
- Phoenix Version:
- Has thanked: 4 times
- Been thanked: 208 times
Re: Adding a new adress-field in orders.php
No, it does not.
It may call the address module. Certainly the packing slip and invoice do. You could add a field to the address by creating a replacement address module. But I'm not sure if you want this field to appear everywhere the address does.
- Kofod95
- Senior Contributor
- Posts: 748
- Joined: Sat Feb 06, 2021 7:38 pm
- Phoenix Version: 1.0.8.20
- Has thanked: 99 times
- Been thanked: 179 times
Re: Adding a new adress-field in orders.php
Thank you for the answer, and for correcting me.
Just to clarify, I copied the street-address in the hope that it would be included on those pages, and added it to the "Delivery-Adress"-group. Do you mean something else with creating a replacement address module? Sorry for being stupid, I am a little bit smarter in Danish, but not much
I want it to appear everywhere with the address, as it is something that is needed by the courriers (is that the right word?)
//Daniel
I'm not smart, but sometimes even a blind chicken can find a corn.
Here are a lot of corns: Phoenix user guide
Here are a lot of corns: Phoenix user guide
-
ecartz
- Core Team
- Posts: 3084
- Joined: Tue Nov 05, 2019 6:02 pm
- Phoenix Version:
- Has thanked: 4 times
- Been thanked: 208 times
Re: Adding a new adress-field in orders.php
I mean copy cd_traditional_address.php (e.g. to cd_address_with_phone.php) and modify it to include what you need. Note that the shortest path might require editing the address_formats table in the database as well. Although you might look at how it handles the company field as an alternative. Note that this will make it expect the same field to exist for the billing and customer addresses as well. It doesn't know the difference between different types of addresses.
Courier is an English word. It's a little out of place in the context of package delivery over a distance. It's more commonly used, at least in the US, for local deliveries of small things. Delivery drivers would be a more common term for something like UPS or FedEx. Of course, perhaps you are using a courier service in your business. I'm more inclined to think in terms of UPS/FedEx.
Courier is an English word. It's a little out of place in the context of package delivery over a distance. It's more commonly used, at least in the US, for local deliveries of small things. Delivery drivers would be a more common term for something like UPS or FedEx. Of course, perhaps you are using a courier service in your business. I'm more inclined to think in terms of UPS/FedEx.
- Kofod95
- Senior Contributor
- Posts: 748
- Joined: Sat Feb 06, 2021 7:38 pm
- Phoenix Version: 1.0.8.20
- Has thanked: 99 times
- Been thanked: 179 times
Re: Adding a new adress-field in orders.php
Thank you very much!
I will do as you suggested, most likely some time tomorrow, and share my experience here when done. Your help is very appreciated, as I would never have come to that conclusion by myself, and even if I had, you have saved me hours og trial and error! I will look into the handling of the company-field, as that sounds like a possibility for the most elegant solution.
Delivery drivers sounds as what I meant, thank you for that clarification as well!
//Daniel
I will do as you suggested, most likely some time tomorrow, and share my experience here when done. Your help is very appreciated, as I would never have come to that conclusion by myself, and even if I had, you have saved me hours og trial and error! I will look into the handling of the company-field, as that sounds like a possibility for the most elegant solution.
Delivery drivers sounds as what I meant, thank you for that clarification as well!
//Daniel
I'm not smart, but sometimes even a blind chicken can find a corn.
Here are a lot of corns: Phoenix user guide
Here are a lot of corns: Phoenix user guide
-
heatherbell
- Senior Contributor
- Posts: 2540
- Joined: Mon Oct 07, 2019 4:39 am
- Phoenix Version:
- Has thanked: 35 times
- Been thanked: 243 times
Re: Adding a new adress-field in orders.php
Delivery companies in UK, including FedEx, commonly advertise themselves as 'couriers' so you weren't wrong. The words 'hauliers', 'carriers' and 'consigners' are also commonly used.
- Kofod95
- Senior Contributor
- Posts: 748
- Joined: Sat Feb 06, 2021 7:38 pm
- Phoenix Version: 1.0.8.20
- Has thanked: 99 times
- Been thanked: 179 times
Re: Adding a new adress-field in orders.php
English is confusing some times - especially when mixing American, British, other and foreign (people like me, who has english as a second language) 
Thank you for letting me feel a little smarter
//Daniel
Thank you for letting me feel a little smarter
//Daniel
I'm not smart, but sometimes even a blind chicken can find a corn.
Here are a lot of corns: Phoenix user guide
Here are a lot of corns: Phoenix user guide
- Kofod95
- Senior Contributor
- Posts: 748
- Joined: Sat Feb 06, 2021 7:38 pm
- Phoenix Version: 1.0.8.20
- Has thanked: 99 times
- Been thanked: 179 times
Re: Adding a new adress-field in orders.php
Okay, I copied and installed cd_traditional_address and added the phone field there, using the inclusion of company as a template - this was quite simple to do, big thank you ecartz! Both for the help to do it, and for the creation of customer data!
This makes my new field show up on the front-end with the delivery-address, so that's a start. However, in admin $address['recievers_phone'] is an illegal offset (I have included the ?? '' to make it not error, when a number is not present, but when one is on front-end, it's not included in admin). I have not added a field to any of the orders tables, and will try this next, unless someone can point out to me what I should do instead based on the info I provide here.
I think I will write a how-to on this, once I'm done, just in case others could find it useful. Untill now, it has required nothing but copy-paste and replace; Phoenix is awesome for making it simple to do things with no real knowledge of code!
//Daniel
This makes my new field show up on the front-end with the delivery-address, so that's a start. However, in admin $address['recievers_phone'] is an illegal offset (I have included the ?? '' to make it not error, when a number is not present, but when one is on front-end, it's not included in admin). I have not added a field to any of the orders tables, and will try this next, unless someone can point out to me what I should do instead based on the info I provide here.
I think I will write a how-to on this, once I'm done, just in case others could find it useful. Untill now, it has required nothing but copy-paste and replace; Phoenix is awesome for making it simple to do things with no real knowledge of code!
//Daniel
I'm not smart, but sometimes even a blind chicken can find a corn.
Here are a lot of corns: Phoenix user guide
Here are a lot of corns: Phoenix user guide