How to add additional fields to a customer
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!
Re: How to add additional fields to a customer
Hi,aimeos wrote:You can find documentation about Vue.JS there: https://vuejs.org/
You don't need that much knowledge about Vue.JS. There are only three important things:
1.) Add the new key in your new template there:
https://github.com/aimeos/ai-admin-jqad ... rd.php#L11
2.) Copy the form line and replace "price.value" by your new key:
https://github.com/aimeos/ai-admin-jqad ... rd.php#L70
3.) Check if your new key/value is listed there (use the web inspector for example):
https://github.com/aimeos/ai-admin-jqad ... rd.php#L23
So, what to do if point 3 fails? Where does "data-items=" get populated?
Thanks!
Re: How to add additional fields to a customer
-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.aimeos wrote:Your new value isn't set in the item there:
https://github.com/aimeos/ai-admin-jqad ... d.php#L357
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
Last edited by tenkraD on 12 Apr 2018, 08:13, edited 2 times in total.
Re: How to add additional fields to a customer
-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.aimeos wrote:Your new value isn't set in the item there:
https://github.com/aimeos/ai-admin-jqad ... d.php#L357
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
Last edited by tenkraD on 12 Apr 2018, 08:15, edited 1 time in total.
Re: How to add additional fields to a customer
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
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
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
Re: How to add additional fields to a customer
Hi,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
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;
}
Thanks!
Re: How to add additional fields to a customer
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:
and configure your new class using:
e.g. for Laravel in config/shop.php:
./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
}
}
Code: Select all
admin/jqadm/product/price/name = Mystandard
Code: Select all
'admin' => [
'jqadm' => [
'product' => [
'price' => [
'name' => 'Mystandard'
]
]
]
]
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
Re: How to add additional fields to a customer
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
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
Hi,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
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' ) );
Thanks!
Re: How to add additional fields to a customer
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.
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
Hi,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.
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!