How to create voucher via programmatically?
Forum rules
Always add your Laravel, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
Always add your Laravel, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
How to create voucher via programmatically?
I want to create a voucher programmatically and redeeming this voucher to give access/discount to users.
How to write the code in Aimeos and please explain directory structure and coding structure to how can I write my code.
The Aimeos document is very very difficult to understand. I would like to suggest you please upgrade the document for custom features and development like the Laravel document.
Also, I noticed in the Aimeos document, there is some mistake in syntax in the given example. Please upgrade the document to easy to understand and easy to implement.
How to write the code in Aimeos and please explain directory structure and coding structure to how can I write my code.
The Aimeos document is very very difficult to understand. I would like to suggest you please upgrade the document for custom features and development like the Laravel document.
Also, I noticed in the Aimeos document, there is some mistake in syntax in the given example. Please upgrade the document to easy to understand and easy to implement.
- Attachments
-
- Syntax error in given example in Aimeos official site.
- error.png (64.03 KiB) Viewed 617 times
Re: How to create voucher via programmatically?
Thans for the hint, the code in the documentation has been fixed now.
Do you have more concrete suggestions how to improve the documentation? You can also create a pull request with suggested changes for the docs here: https://github.com/aimeos/aimeos-docs
To create vouchers programatically, use the coupon manager:
You can find the details here:
- https://aimeos.org/docs/latest/laravel/ ... os-objects
- https://aimeos.org/docs/latest/models/managing-items/
- https://github.com/aimeos/aimeos-core/t ... hop/Coupon
Do you have more concrete suggestions how to improve the documentation? You can also create a pull request with suggested changes for the docs here: https://github.com/aimeos/aimeos-docs
To create vouchers programatically, use the coupon manager:
Code: Select all
$context = app( 'aimeos.context' )->get();
$manager = \Aimeos\MShop::create( $context, 'coupon' );
$item = $manager->create()
->setLabel( 'test' )->setProvider( 'FixedRebate' )
->setConfig( [
'fixedrebate.productcode' => 'demo-rebate',
'fixedrebate.rebate' => ['EUR' => 10.0]
] );
$item = $manager->save( $item );
$codeManager = \Aimeos\MShop::create( $context, 'coupon/code' );
$codeItem = $codeManager->create()
->setParentId( $item->getId() )
->setCode( 'ABDC' )
->setCount( 100 );
$codeManager->save( $codeItem );
- https://aimeos.org/docs/latest/laravel/ ... os-objects
- https://aimeos.org/docs/latest/models/managing-items/
- https://github.com/aimeos/aimeos-core/t ... hop/Coupon
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