Clean custom table column from admin panel

Help for integrating the Laravel package
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!
mr.zherart
Posts: 27
Joined: 04 Jun 2020, 14:00

Clean custom table column from admin panel

Post by mr.zherart » 13 Apr 2021, 17:48

Hi, Aimeos. One more question.

Laravel 6. Aimeos 2020.10

I have extended the manager customer address through the easy way, add custom fields in admin panel, and all works fine except cleaning fields, it doesn`t delete content and keep previous. Please, advise, what I am doing wrong.

Сolumn (I tried with default => '' and just with length also)

Code: Select all

$table->addColumn( 'housing', 'string', array( 'length' => 200, 'notnull' => false ) );
Decorator fields (methods the same from instruction):

Code: Select all

'housing' => [
   'code' => 'housing',
    'internalcode' => 'lvuad."housing"',
    'label' => 'Address housing',
    'type' => 'string',
    'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR,
]
 
Admin panel field (also with item key ahed):

Code: Select all

<div class="form-group row optional">
	        <label class="col-sm-4 form-control-label help"><?= $enc->html( $this->translate( 'admin', 'Housing' ) ); ?></label>
		<div class="col-sm-8">
			<input class="form-control item-housing" type="text" tabindex="<?= $this->get( 'tabindex' ); ?>"
				v-bind:name="'<?= $enc->attr( $this->formparam( array( 'address', 'idx', 'housing' ) ) ); ?>'.replace('idx', idx)"
				placeholder="<?= $enc->attr( $this->translate( 'admin', 'Housing' ) ); ?>"
				v-bind:readonly="checkSite('customer.address.siteid', idx)"
				v-model="items[idx]['housing']" />
		</div>
		<div class="col-sm-12 form-text text-muted help-text">
			<?= $enc->html( $this->translate( 'admin', 'Address housing' ) ); ?>
		</div>
</div>
In debugger I see that housing has null during saving, but seems, it not saving by managers.

Thank you.

P.S. IMHO It is not obvious in docs that we need to create table columns exactly by php artisan aimeos:setup command, and will better to place it in documentation also in easy way chapter.

User avatar
aimeos
Administrator
Posts: 7906
Joined: 01 Jan 1970, 00:00

Re: Clean custom table column from admin panel

Post by aimeos » 15 Apr 2021, 07:01

mr.zherart wrote: 13 Apr 2021, 17:48 I have extended the manager customer address through the easy way, add custom fields in admin panel, and all works fine except cleaning fields, it doesn`t delete content and keep previous. Please, advise, what I am doing wrong.

Сolumn (I tried with default => '' and just with length also)

Code: Select all

$table->addColumn( 'housing', 'string', array( 'length' => 200, 'notnull' => false ) );
First of all, Aimeos already has an address field for storing additional address data (customer.address.address3). In fact, there are three generic address fields (address1, address2, address3) which you can use like you need them. They are not tied to any fixed schema because depending on the regions your customers are living in, the address format may be totally different. There's only a standard naming in Aimeos but you can change translations as you need.
mr.zherart wrote: 13 Apr 2021, 17:48 In debugger I see that housing has null during saving, but seems, it not saving by managers.
Which Aimeos version do you use?
Can you check what happens here:
- https://github.com/aimeos/aimeos-core/b ... #L388-L394
- https://github.com/aimeos/aimeos-core/b ... #L230-L242
mr.zherart wrote: 13 Apr 2021, 17:48 P.S. IMHO It is not obvious in docs that we need to create table columns exactly by php artisan aimeos:setup command, and will better to place it in documentation also in easy way chapter.
Ok, we will care about that.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

mr.zherart
Posts: 27
Joined: 04 Jun 2020, 14:00

Re: Clean custom table column from admin panel

Post by mr.zherart » 03 Jun 2021, 12:46

Hi, I`m sorry for the very late answer, only now I can and need to come back to debugging this.
Which Aimeos version do you use?
Can you check what happens here:
- https://github.com/aimeos/aimeos-core/b ... #L388-L394
- https://github.com/aimeos/aimeos-core/b ... #L230-L242
I used Aimeos 2020.10, now is 2021.04.

The bug is still there. I see from the debugger that the value goes to fromArray as null, and is_scalar does not pass it.

User avatar
aimeos
Administrator
Posts: 7906
Joined: 01 Jan 1970, 00:00

Re: Clean custom table column from admin panel

Post by aimeos » 04 Jun 2021, 05:51

mr.zherart wrote: 03 Jun 2021, 12:46 The bug is still there. I see from the debugger that the value goes to fromArray as null, and is_scalar does not pass it.
The problem should have been fixed with this commit:
https://github.com/aimeos/aimeos-core/c ... 9f51d970d1

It's available in aimeos/aimeos-core 2020.10.25 and 2021.04.7. Can you confirm that using these versions fixes the problem?
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

mr.zherart
Posts: 27
Joined: 04 Jun 2020, 14:00

Re: Clean custom table column from admin panel

Post by mr.zherart » 18 Aug 2021, 11:32

Sorry for the late feedback, the problem has been fixed. Thank you.

Post Reply