How to configure and adapt Aimeos based shops as developer
Forum rules: Always add your Aimeos and PHP version as well as your environment (Linux/Mac/Win)
#6010 by mohal_04
11 Apr 2018, 12:18
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-jqadm/blob/master/admin/jqadm/templates/product/item-price-standard.php#L11

2.) Copy the form line and replace "price.value" by your new key:
https://github.com/aimeos/ai-admin-jqadm/blob/master/admin/jqadm/templates/product/item-price-standard.php#L70

3.) Check if your new key/value is listed there (use the web inspector for example):
https://github.com/aimeos/ai-admin-jqadm/blob/master/admin/jqadm/templates/product/item-price-standard.php#L23


Hi,

So, what to do if point 3 fails? Where does "data-items=" get populated?

Thanks!
#6013 by tenkraD
11 Apr 2018, 23:17
aimeos wrote:Your new value isn't set in the item there:
https://github.com/aimeos/ai-admin-jqadm/blob/2017.10/admin/jqadm/src/Admin/JQAdm/Product/Price/Standard.php#L357

-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/Core/admin/jqadm/product/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.
#6014 by tenkraD
11 Apr 2018, 23:27
aimeos wrote:Your new value isn't set in the item there:
https://github.com/aimeos/ai-admin-jqadm/blob/2017.10/admin/jqadm/src/Admin/JQAdm/Product/Price/Standard.php#L357

-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/Core/admin/jqadm/product/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.
#6015 by aimeos
12 Apr 2018, 07:14
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
#6016 by mohal_04
12 Apr 2018, 07:54
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 allpublic 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!
#6017 by aimeos
12 Apr 2018, 08:03
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 allclass 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 alladmin/jqadm/product/price/name = Mystandard


e.g. for Laravel in config/shop.php:

Code: Select all'admin' => [
    'jqadm' => [
        'product' => [
            'price' => [
                'name' => 'Mystandard'
            ]
        ]
    ]
]
#6019 by mohal_04
12 Apr 2018, 08:19
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!
#6021 by mohal_04
12 Apr 2018, 09:35
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!