Look for proper way to add additional field in checkout/address page
Forum rules
Always add your Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
Always add your Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
- switch-cheehau
- Posts: 14
- Joined: 23 Jun 2021, 02:39
Look for proper way to add additional field in checkout/address page
Hi Aimeos,
Hope you can guide me on this:
I'm trying to add new field passport no. in the checkout process.
So in order to make the checkout process seamlessly:
Extend the table users and mshop_order_base_address with new column passport
adding in users table is to set a default passport number.
adapting client/html/templates/checkout/standard/address-partial-standard.php to add the new field
but i do not know how to pass in the value from customer.password into attr( $this->value( 'address', 'order.base.address.passport' ) ) ?>
adapting client/html/templates/common/summary/address-standard.php to display the new field in summary tab
Save the new field into order.base.address.passport
I'm refering to this doc:
https://aimeos.org/docs/2021.x/infrastr ... properties
But i'm having hard time to relate to my problem.
Can you shed some light over here?
I would be happy to help on documented the solution.
Hope you can guide me on this:
I'm trying to add new field passport no. in the checkout process.
So in order to make the checkout process seamlessly:
Extend the table users and mshop_order_base_address with new column passport
adding in users table is to set a default passport number.
adapting client/html/templates/checkout/standard/address-partial-standard.php to add the new field
but i do not know how to pass in the value from customer.password into attr( $this->value( 'address', 'order.base.address.passport' ) ) ?>
adapting client/html/templates/common/summary/address-standard.php to display the new field in summary tab
Save the new field into order.base.address.passport
I'm refering to this doc:
https://aimeos.org/docs/2021.x/infrastr ... properties
But i'm having hard time to relate to my problem.
Can you shed some light over here?
I would be happy to help on documented the solution.
Re: Look for proper way to add additional field in checkout/address page
You have added a new field in the address partial like for the email address?switch-cheehau wrote: ↑23 Jun 2021, 03:00 adapting client/html/templates/checkout/standard/address-partial-standard.php to add the new field
but i do not know how to pass in the value from customer.password into attr( $this->value( 'address', 'order.base.address.passport' ) ) ?>
https://github.com/aimeos/ai-client-htm ... #L286-L301
The values are automatcally passed to the template:
https://github.com/aimeos/ai-client-htm ... d.php#L255
But this doesn't exist as your field is named "passport" not "order.base.address.passport":
Code: Select all
$this->value( 'address', 'order.base.address.passport' )
Code: Select all
$this->value( 'address', 'passport' )
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, give us a star
If you like Aimeos, give us a star
- switch-cheehau
- Posts: 14
- Joined: 23 Jun 2021, 02:39
Re: Look for proper way to add additional field in checkout/address page
Hi Aimeos,
Thanks for the help. able to make it works.
Here's the things i've done.
added new column in users table:
lib/custom/setup/default/schema/customer.php
added new field:
client/html/templates/checkout/standard/address-partial-standard.php
Followed the instruction - easy-way
https://aimeos.org/docs/2021.x/infrastr ... /#easy-way
one last thing is config/shop.php, without this, it won't preserved in summary page.
Thanks for the help. able to make it works.
Here's the things i've done.
added new column in users table:
lib/custom/setup/default/schema/customer.php
Code: Select all
$table->addColumn( 'passport', 'string', array( 'length' => 32, 'default' => '' ) );
client/html/templates/checkout/standard/address-partial-standard.php
Code: Select all
<div class="row form-item form-group passport <?= $enc->attr( ( $this->value( 'error', 'passport' ) ? 'error ' : '' ) . join( ' ', $this->value( 'css', 'passport', [] ) ) ) ?>"
data-regex="<?= $enc->attr( $this->config( 'client/html/checkout/standard/address/validate/passport' ) ) ?>">
<label class="col-md-5" for="address-<?= $this->get( 'type', 'billing' ) ?>-passport-<?= $this->get( 'id' ) ?>">
<?= $enc->html( $this->translate( 'client', 'Passport' ), $enc::TRUST ) ?>
</label>
<div class="col-md-7">
<input class="form-control" type="tel"
id="address-<?= $this->get( 'type', 'billing' ) ?>-passport-<?= $this->get( 'id' ) ?>"
name="<?= $enc->attr( $this->formparam( array( $fname, 'passport' ) ) ) ?>"
value="<?= $enc->attr( $this->value( 'address', 'passport' ) ) ?>"
<?= $this->value( 'css', 'passport' ) ? '' : 'disabled' ?>
>
</div>
</div>
https://aimeos.org/docs/2021.x/infrastr ... /#easy-way
one last thing is config/shop.php, without this, it won't preserved in summary page.
Code: Select all
'client/html/checkout/standard/address/billing/mandatory' => [
'order.base.address.firstname',
'order.base.address.lastname',
'order.base.address.address1',
'order.base.address.postal',
'order.base.address.city',
'order.base.address.languageid',
'order.base.address.email',
'passport',
]