Add custom field to Customer profile
Forum rules
Always add your Laravel, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
Always add your Laravel, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
Add custom field to Customer profile
Aimeos Package, directly from Composer.
PHP 7.3
Linux
I am running into some issues with my setup. Basically what I am attempting to do, is add a custom field to the database. However the layout is not at all like Laravel used to be, with Controllers etc. It probably follows a different standard. But I am not very familiar with this, and I have hit a wall.
1. I cannot seem to overwrite the templates. I already wrote in the HTML for the customers profile, which shows up correctly.
2. The actual customer data does hold the Agent ID as in the database, when I die Dump inside ext/ai-admin-jqadm/admin/jqadm/src/Admin/JQAdm/Customer/standard.php @ get() using but I cannot get it to pass the ToArray function and to the view.
3. I attempted to add it to ai-laravel/lib/custom/config/mshop/customer.php under search, mysql. but I got nothing from here.
4. I also added it to ai-laravel/lib/custom/src/MShop/Customer/Manager
I feel like the documentation could be alot better at this point. :/
PHP 7.3
Linux
I am running into some issues with my setup. Basically what I am attempting to do, is add a custom field to the database. However the layout is not at all like Laravel used to be, with Controllers etc. It probably follows a different standard. But I am not very familiar with this, and I have hit a wall.
1. I cannot seem to overwrite the templates. I already wrote in the HTML for the customers profile, which shows up correctly.
Code: Select all
<div class="col-sm-8">
<input class="form-control item-agent" type="text" tabindex="1"
name="<?= $enc->attr( $this->formparam( array( 'item', 'customer.agent_id' ) ) ); ?>"
placeholder="<?= $enc->attr( $this->translate( 'admin', 'Agent ID' ) ); ?>"
value="<?= $enc->attr( $this->get( 'itemData/customer.agent_id' ) ); ?>" />
</div>
Code: Select all
dd($view->item)
3. I attempted to add it to ai-laravel/lib/custom/config/mshop/customer.php under search, mysql.
Code: Select all
lvu."agent_id" AS "customer.agent_id"
4. I also added it to ai-laravel/lib/custom/src/MShop/Customer/Manager
Code: Select all
'customer.agent_id' => array(
'label' => 'Agent ID',
'code' => 'customer.agent_id',
'internalcode' => 'lvu."agent_id"',
'type' => 'integer',
'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_INT,
'public' => true,
),
Re: Add custom field to Customer profile
Do you use a decorator to add the new field?
https://aimeos.org/docs/latest/infrastr ... -managers/
If yes, make sure you use version 2020.10.x because I remember there was a commit which extends toArray() automatically.
In case you extended the manager and item classes via "extends", make sure you've implemented the fromArray() and toArray() methods like described here:
https://aimeos.org/docs/latest/infrastr ... ers/#items
https://aimeos.org/docs/latest/infrastr ... -managers/
If yes, make sure you use version 2020.10.x because I remember there was a commit which extends toArray() automatically.
In case you extended the manager and item classes via "extends", make sure you've implemented the fromArray() and toArray() methods like described here:
https://aimeos.org/docs/latest/infrastr ... ers/#items
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