Page 4 of 7
Re: How to add additional fields to a customer
Posted: 11 Apr 2018, 12:18
by mohal_04
Hi,
So, what to do if point 3 fails? Where does "data-items=" get populated?
Thanks!
Re: How to add additional fields to a customer
Posted: 11 Apr 2018, 23:17
by tenkraD
-you have to add youre setter from item class there in fromArray "setMinimumAdvertisedPrice($this->getValue( $data, 'price.minimumadvertisedprice' . $idx, ' 0.00' ))" . This is where the data is populated.
and that this new file instead of the standard is recognized u have to add this configuration value
*thanks to nos3 user*
https://aimeos.org/docs/Configuration/C ... price/name
See Extend Stock ==>
post6012.html#p6012
bye tenkraD
Re: How to add additional fields to a customer
Posted: 11 Apr 2018, 23:27
by tenkraD
-you have to add youre setter from item class there in fromArray "setMinimumAdvertisedPrice($this->getValue( $data, 'price.minimumadvertisedprice' . $idx, ' 0.00' ))" . This is where the data is populated.
and that this new file instead of the standard is recognized u have to add this configuration value
*thanks to nos3 user*
https://aimeos.org/docs/Configuration/C ... price/name
See Extend Stock ==>
post6012.html#p6012
bye tenkraD
Re: How to add additional fields to a customer
Posted: 12 Apr 2018, 07:14
by aimeos
All modifications must be done in your own extension. Never change the Aimeos Core!
If you need to store additional data from the admin interface, you have to extend the existing class using a new name, overwrite the fromArray() method and configure your new class name like @tenkraD said.
The data for the template is populated there:
https://github.com/aimeos/ai-admin-jqad ... d.php#L420
Re: How to add additional fields to a customer
Posted: 12 Apr 2018, 07:54
by mohal_04
aimeos wrote:All modifications must be done in your own extension. Never change the Aimeos Core!
If you need to store additional data from the admin interface, you have to extend the existing class using a new name, overwrite the fromArray() method and configure your new class name like @tenkraD said.
The data for the template is populated there:
https://github.com/aimeos/ai-admin-jqad ... d.php#L420
Hi,
But I have to make changes in
Standard.php file, otherwise, value of new field is not being saved.
Standard.php is in this directory:
./ext/ai-admin-jqadm/admin/jqadm/src/Admin/JQAdm/Product/Price/Standard.php
The
fromArray() method of my extension (see below) doesn't save data.
./ext/10buckonly/lib/custom/src/MShop/Price/Manager/Custompricefields.php
Code: Select all
public function fromArray(array $list)
{
$unknown = [];
$list = parent::fromArray($list);
foreach ($list as $key => $value) {
switch ($key) {
case 'price.minimumadvertisedprice':
$this->setMinimumAdvertisedPrice($value);
break;
case 'price.productioncost':
$this->setProductioncost($value);
break;
default:
$unknown[$key] = $value;
}
}
return $unknown;
}
This thing has made me pull my hairs out.
Thanks!
Re: How to add additional fields to a customer
Posted: 12 Apr 2018, 08:03
by aimeos
No, it's the same as for the managers: You have to extend from the standard class and create e.g.
./ext/myextendsion/admin/jqadm/src/Admin/JQAdm/Product/Price/Mystandard.php
which contains:
Code: Select all
class MyStandard extends Standard
{
protected function fromArray( \Aimeos\MShop\Product\Item\Iface $item, array $data )
{
// your modified code
}
}
and configure your new class using:
Code: Select all
admin/jqadm/product/price/name = Mystandard
e.g. for Laravel in config/shop.php:
Code: Select all
'admin' => [
'jqadm' => [
'product' => [
'price' => [
'name' => 'Mystandard'
]
]
]
]
Re: How to add additional fields to a customer
Posted: 12 Apr 2018, 08:04
by tenkraD
No not here "./ext/ai-admin-jqadm/admin/jqadm/src/Admin/JQAdm/Product/Price/Standard.php"
See Extend Stock for a full working example ==>
post6012.html#p6012
This should solve your problem. I done the same but with Stock Class instead of Price.
bye tenkraD
Re: How to add additional fields to a customer
Posted: 12 Apr 2018, 08:19
by mohal_04
aimeos wrote:All modifications must be done in your own extension. Never change the Aimeos Core!
If you need to store additional data from the admin interface, you have to extend the existing class using a new name, overwrite the fromArray() method and configure your new class name like @tenkraD said.
The data for the template is populated there:
https://github.com/aimeos/ai-admin-jqad ... d.php#L420
Hi,
The only way for me to save value of my new field is to add following two statements in
fromArray() method of
Standard class.
./ext/ai-admin-jqadm/admin/jqadm/src/Admin/JQAdm/Product/Price/Standard.php
Code: Select all
$priceItem->setMinimumadvertisedprice( $this->getValue( $data, 'price.minimumadvertisedprice/' . $idx, '0.00' ) );
$priceItem->setProductioncost( $this->getValue( $data, 'price.productioncost/' . $idx, '0.00' ) );
The
fromArray() method in my extension is not saving value. :'( :'( :'( :'( :'(
Thanks!
Re: How to add additional fields to a customer
Posted: 12 Apr 2018, 08:47
by tenkraD
C'mon mohal,
No not here "./ext/ai-admin-jqadm/admin/jqadm/src/Admin/JQAdm/Product/Price/Standard.php"
See Extend Stock for a full working example ==>
post6012.html#p6012
This should solve your problem. I done the same but with Stock Class instead of Price.
Re: How to add additional fields to a customer
Posted: 12 Apr 2018, 09:35
by mohal_04
tenkraD wrote:C'mon mohal,
No not here "./ext/ai-admin-jqadm/admin/jqadm/src/Admin/JQAdm/Product/Price/Standard.php"
See Extend Stock for a full working example ==>
post6012.html#p6012
This should solve your problem. I done the same but with Stock Class instead of Price.
Hi,
Thanks a lot buddy!!! Issue resolved!!! Blood Pressure dropping now!!! I hope this is the last complex issue that I faced. Thanks A LOT!!!
Thanks!