store data in site table

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)
Spam and unrelated posts will be removed immediately!
khizar
Posts: 99
Joined: 19 Jan 2021, 09:51

store data in site table

Post by khizar » 21 Jan 2021, 08:12

Hi,

i am a laravel developer and using laravel8.i have integrated aimeos in laravel successfully.i was given a task to add another
field in site form which i achieved successfully by adding a field in front end
Image
also i added a field named city in mshop_locale_site(table) by adding a locale.php file in directory
ext\ai-moudhah\lib\custom\setup\default\schema
and that file contains following code

Code: Select all

return [
  'table' => [
    'mshop_locale_site' => function ( \Doctrine\DBAL\Schema\Schema $schema ) {

        $table = $schema->getTable( 'mshop_locale_site' );

        $table->addColumn(  'city', 'string', ['length' => 255] );
       

        return $schema;
    }
]
];
and that was done successfully.now in order to store data in the table i made a decorator Myproject.php in the directory
ext\ai-moudhah\lib\custom\src\MShop\Locale\Manager\Site\Decorator
and that file contains following code

Code: Select all

namespace Aimeos\MShop\Locale\Manager\Site\Decorator;
 
class Myproject extends \Aimeos\MShop\Common\Manager\Decorator\Base
{
    private $attr = [
        'city' => [
            'code' => 'city',
            'internalcode' => 'city',
            'label' => 'My new column',
            'type' => 'string',
            'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR,
        ],
    ];
 
    public function getSaveAttributes()
    {
        return $this->createAttributes( $this->attr );
        return parent::getSaveAttributes() + $this->createAttributes( $this->attr );
    }
 
    public function getSearchAttributes( $sub = true )
    {
        return parent::getSearchAttributes( $sub ) + $this->createAttributes( $this->attr );
    }
}
but when i hit save button the value of city field does not stores.please guide me what i am doing wrong and i need quick
response because i am in real time project.thanks

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

Re: store data in site table

Post by aimeos » 22 Jan 2021, 12:29

Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

Post Reply