GithubHelp home page GithubHelp logo

Comments (9)

aimeos avatar aimeos commented on August 19, 2024

You can add arbitrary information as order service attributes which you can display in the summary and e-mail later on: https://aimeos.org/api/latest/class-Aimeos.MShop.Order.Item.Base.Service.Iface.html#_setAttributeItem

from aimeos-core.

nvindice avatar nvindice commented on August 19, 2024

Thank you, tried that and it works well. However, the additional attribute is missing in the confirmation e-mail. The decorator does not even seem to get called at all here. What am I missing?

from aimeos-core.

aimeos avatar aimeos commented on August 19, 2024

The decorator is only called on the checkout delivery page and you have to add the information you want to store as order service attribute. At the summary page and in the e-mail you can only display the information that have been stored as order service attributes.

from aimeos-core.

nvindice avatar nvindice commented on August 19, 2024

I use this code in the getConfigFE() function of my decorator:

$service->setAttributeItem( new \Aimeos\MShop\Order\Item\Base\Service\Attribute\Standard( array(
	'order.base.service.attribute.code' => 'delivery-supplier.address',
	'order.base.service.attribute.value' => $addressShort,
) ) );

It definitely gets executed, the information is displayed at the summary page automatically, but it's missing in the e-mail...

from aimeos-core.

aimeos avatar aimeos commented on August 19, 2024

Is it stored in the mshop_order_base_service_attr table for the order?
If it is available it should be displayed:

from aimeos-core.

nvindice avatar nvindice commented on August 19, 2024

No it isn't. So it looks like I did not fully understand the Controller system, and the $service object I use is just a copy, not a reference. I'm still an Aimeos newbie, sorry.

Where should I use the setAttributeItem() call? At which position in my decorator should I use which Service item?

EDIT: I found this handy function: $this->saveOrderBase( $basket ); - now the value is stored in the DB. Nevertheless, when I change pages during the checkout process a few times (Delivery -> Payment -> Summary -> Payment -> Delivery -> etc), the attribute is stored multiple times - each time with a new ordservid. Is this desired behaviour or can I optimize my code?

from aimeos-core.

aimeos avatar aimeos commented on August 19, 2024

saveOrderBase() is not meant to be used during the checkout process.

You can use the setConfigFE() in your decorator to add more data to the order:
https://aimeos.org/api/latest/class-Aimeos.MShop.Service.Provider.Iface.html#_setConfigFE

from aimeos-core.

nvindice avatar nvindice commented on August 19, 2024

Thanks, that was the missing bit. I created a PR with added functionality. There should be no breaking changes because the new functionality is controlled by the BE config parameters which default to the old behaviour.

Furthermore, the user manual should be updated here: https://aimeos.org/docs/User_Manual/Administration_Interface/Service_decorators

from aimeos-core.

aimeos avatar aimeos commented on August 19, 2024

Merged into the Aimeos Core

from aimeos-core.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.