Questions around the TYPO3 integration and plugins as well as Flow and NeosCMS
Forum rules: Always add your TYPO3/Flow, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
#7610 by cnoelker
05 Feb 2019, 11:09
Hello,
I would like to add additional fields below the basket (e.g. for a remark by the customer or to have him select one of several delivery addresses) . What's the proper way to do this? Maybe store them as service attributes?
Also, there is already a field 'comment' in the order_base table. Is there a way to make this visible and editable to customers?
Claudia
#7616 by aimeos
06 Feb 2019, 10:30
The comment field is available at the summary page where customers can add some text. If you want to show the field in the basket too, you need to add code in the basket/standard client to set the content of that field in the basket object.

A delivery address can be selected in the address section of the checkout. You can rearrange the order of the sections in the checkout or even make a one page checkout if you show that information at a different place:
https://aimeos.org/docs/Configuration/Core/client/html/Change_checkout_steps
#7622 by cnoelker
07 Feb 2019, 20:07
Thank you for providing the link. Is there a way to download the complete configuration documentation as a single file, e.g. PDF? It always switches back to German, which I don't want to read (although it's my mothertongue).
Also, I always get lost inside the links.
#7628 by aimeos
08 Feb 2019, 12:55
The configuration documentation is currently available online only. The language switch may happen due to your browser is telling MediaWiki that your preferred language is German.

The best way to dig through the configuration docs is either to search for a configuration option whose name you know but don't know what's the complete string (e.g. "basket-add") or by starting at the overview page (https://aimeos.org/docs/Configuration) and digging deeper into where you want to change something, for example Frontend -> Shop HTML frontend -> Checkout. Then, there are all articles that care about the topic and a list of all configuration settings for that topic you can investigate if you don't really know the name of what you are searching for.

Hope that helps a bit :-)
#8167 by cnoelker
11 Jun 2019, 12:50
I need to add additional fields in the order. These are the steps:
* create order.php with addColumn() calls
* extend Aimeos\MShop\Order\Item\Base with my own class B2bItem with __construct(), getters and setters for my fields, toArray() and fromArray().
* extend Aimeos\MShop\Order\Manager\Base with my own class B2bManager with createItemBase() returning B2bItem(...)
* extend Aimeos\Client\Html\Common\Decorator with my own class B2bCheckout
* add the new fields in the SELECT/INSERT/UPDATE queries in mshop.php, set manager->base->name to B2bManager
* configure the decorator B2bCheckout for checkout.
* extend jqadm template so that the new fields are accessed with their getters.
* add input fields for my new order fields in the frontend

I got parts of it to work:
* The fields in the database are created. I filled them manually for the first test.
* When I access the order in the backend, then the values of the new fields are displayed (via the getters).
* The input fields in the frontend are displayed.
* B2bCheckout is called.

But: Saving the basket results in an error thrown in the process method of B2bCheckout: "Call to undefined method Aimeos\MShop\Order\Item\Base\Standard::getOrdername()"

$controller = \Aimeos\Controller\Frontend::create( $this->getContext(), 'basket' );
if (($orderName = $view->param('cs_ordername')) !== null) {
$controller->get()->setOrderername($orderName);
$controller->save();
}

Something must be missing. I checked my code with the example here: https://gist.github.com/boettner-it/081 ... 24907fe91b
In difference to the documentation (https://aimeos.org/docs/Developers/Libr ... gers_items), the GIST is extending the Base classes.
Could you please throw some light on this?
#8174 by aimeos
11 Jun 2019, 21:44
You should extend your B2bmanager from the standard order base manager.

What's probably missing in your configuration is to use your manager instead of the standard one, i.e.
Code: Select allreturn [
    'order' => [
        'manager' => [
             'name' => 'B2bmanager',
        ]
    ]
];

in your ./config/mshop.php file. In the Gist example it's here: https://gist.github.com/boettner-it/08111f95393b6cdb7282c924907fe91b#file-mshop-php-L7
#8180 by cnoelker
12 Jun 2019, 09:03
That configuration was available.
I changed every class to extend not the Base class but the one in the parent directory of Base.
Now, I get an error in the backend:
Error SQLSTATE[42S22]: Column not found: 1054 Unknown column 'mord.siteid' in 'where clause', /home/vhosts/biancab2b/typo3conf/ext/aimeos/Resources/Libraries/aimeos/aimeos-core/lib/mwlib/src/MW/DB/Statement/DBAL/Simple.php:91
Where does this come from? It's not in the code which I added.
#8184 by cnoelker
12 Jun 2019, 17:32
I tried as you wrote without the Base in the namespace. This doesn't work at all. The mshop.php needs the 'base' to overwrite the SQLs.
I ended up with the same code like I had before and finally got it working by separately excluding those parts which rely on my new fields and their getters and setters. Placing the calls to these functions at their target location one by one did finally work. I made sure to clean the cache and the autoloader frequently, but this did not seem to have any effect.

Then I tried to install the complete extension on the computer of a colleague - and I ran into exactly the same error messages, although the code worked fine on my computer. This is weird. Is there a way to tell Aimeos that it should completely reload everything?
Now, I just have to make my new field mandatory.
#8186 by aimeos
12 Jun 2019, 17:42
You are right, for the order base manager the config must be:
Code: Select allreturn [
    'order' => [
        'manager' => [
            'base' => [
                 'name' => 'B2bmanager',
            ]
        ]
    ]
];


There is no code caching in Aimeos. Only keep care about the PHP OPCode cache and the APCu cache for configuration settings and translations.