Follow the tutorial for Drupal 8 Commerce Custom Deals, but you'll get the error "name already in use"

I follow the tutorial on creating a custom quote in the official Drupal 8 Commerce documentation. However, I see an error that I inserted below when I click on one of the conditions, and none of the offers integrated in Commerce show a form. I followed the tutorial closely, except that the OrderPromotionOfferBase class was extended instead of the OrderFixedAmountOff class. I have inserted the content of the OrderItemFixedAmountTarget class that I have defined for the offer under the error.

Quotation fields are not displayed

error

Ajax Error:
An AJAX HTTP error has occurred.
HTTP result code: 200
Debugging information will follow.
Path: / promotion / 1 / edit? Destination = / admin / commerce / promotions & ajax_form = 1
StatusText: OK
Response Text:
(!) Fatal Error: Class Drupal  my_module  Plugin  Commerce  PromotionOffer  OrderItemFixedAmountTarget can not be declared because the name already uses / home / usertest / workspace / drupalsite / web / modules / my_module / src / plugin / commerce / becomes. PromotionOffer / OrderItemFixedAmountTarget.php on line 18
Call Stack
#TimeMemoryFunctionLocation
10.0000438056 {main} () ... / index.php: 0
20.0006554920Drupal  Core  DrupalKernel-> handle () ... / index.php: 19
30.00441717448Stack  StackedHttpKernel-> handle () ... / DrupalKernel.php: 693
40.00441717448Drupal  Core  StackMiddleware  NegotiationMiddleware-> handle () ... / StackedHttpKernel.php: 23
50.00441718144Drupal  Core  StackMiddleware  ReverseProxyMiddleware-> handle () ... / NegotiationMiddleware.php: 52
60.00441718144Drupal  page_cache  StackMiddleware  PageCache-> handle () ... / ReverseProxyMiddleware.php: 47
70.00441718144Drupal  page_cache  StackMiddleware  PageCache-> pass () ... / PageCache.php: 85
80.00441718144Drupal  Core  StackMiddleware  KernelPreHandle-> handle () ... / PageCache.php: 106
90.00562139576Drupal  Core  StackMiddleware  Session-> handle () ... / KernelPreHandle.php: 47
100.00642260136Symfony  Component  HttpKernel  HttpKernel-> handle () ... / Session.php: 57
110.00652260552Symfony  Component  HttpKernel  HttpKernel-> handleRaw () ... / HttpKernel.php: 68
120.02877724544Drupal  Core  EventSubscriber  EarlyRenderingControllerWrapperSubscriber-> Drupal  Core  EventSubscriber  {closure} () ... / HttpKernel.php: 151
130.02877724544Drupal  Core  EventSubscriber  EarlyRenderingControllerWrapperSubscriber-> wrapControllerExecutionInRenderContext () ... / EarlyRenderingControllerWrapperSubscriber.php: 97
140.02877727080Drupal  Core  Render  Renderer-> executeInRenderContext () ... / EarlyRenderingControllerWrapperSubscriber.php: 124
150.02877727432Drupal  Core  EventSubscriber  EarlyRenderingControllerWrapperSubscriber-> Drupal  Core  EventSubscriber  {closure} () ... / Renderer.php: 582
160.02877727432call_user_func_array: {/ home / usertest / workspace / drupalsite / web / core / lib / Drupal / Core / EventSubscriber / EarlyRenderingControllerWrapperSubscriber.php: 123}
() ... / EarlyRenderingControllerWrapperSubscriber.php: 123
170.02877727840Drupal  Core  Entity  HtmlEntityFormController-> getContentResult () ... / EarlyRenderingControllerWrapperSubscriber.php: 123
180.02917849224Drupal  Core  Form  FormBuilder-> buildForm () ... / FormController.php: 93
190.043110154816Drupal  Core  Form  FormBuilder-> processForm () ... / FormBuilder.php: 319
200.087912157904Drupal  Core  Form  FormBuilder-> rebuildForm () ... / FormBuilder.php: 626
210.087912157904Drupal  Core  Form  FormBuilder-> retrieveForm () ... / FormBuilder.php: 369
220.087912160160call_user_func_array: {/ home / usertest / workspace / drupalsite / web / core / lib / Drupal / core / Form / FormBuilder.php: 519}
() ... / FormBuilder.php: 519
230.087912160568Drupal  commerce_promotion  Form  PromotionForm-> buildForm () ... / FormBuilder.php: 519
240.088212170728Drupal  commerce_promotion  Form  PromotionForm-> buildForm () ... / PromotionForm.php: 31
250.088312171952Drupal  commerce_promotion  Form  PromotionForm-> form () ... / EntityForm.php: 117
260.088312171952Drupal  commerce_promotion  Form  PromotionForm-> form () ... / PromotionForm.php: 38
270.088312172728Drupal  Core  Entity  Entity  EntityFormDisplay-> buildForm () ... / ContentEntityForm.php: 125
280.089312198408Drupal  commerce  Plugin  Field  FieldWidget  PluginSelectWidget-> form () ... / EntityFormDisplay.php: 177
290.089312198408Drupal  commerce  Plugin  Field  FieldWidget  PluginSelectWidget-> formMultipleElements () ... / WidgetBase.php: 104
300.089312198784Drupal  commerce  Plugin  Field  FieldWidget  PluginSelectWidget-> formSingleElement () ... / WidgetBase.php: 202
310.089312199160Drupal  commerce  Plugin  Field  FieldWidget  PluginSelectWidget-> formElement () ... / WidgetBase.php: 335
320.089312201184Drupal  commerce  Plugin  Field  FieldWidget  PluginSelectWidget-> supportedConfiguration () ... / PluginSelectWidget.php: 116
330.089312201584ist_unterkategorie_von
() ... / PluginSelectWidget.php: 149
340.089312201712spl_autoload_call
() ... / PluginSelectWidget.php: 149
350.089312201840Composer  Autoload  ClassLoader-> loadClass () ... / PluginSelectWidget.php: 149
360.089412202032Composer  Autoload  includeFile () ... / ClassLoader.php: 322
370.089412202272include (& # 39; /home/usertest/workspace/drupalsite/web/modules/my_module/src/Plugin/Commerce/PromotionOffer/OrderItemFixedAmountTarget.php') ... / ClassLoader.php: 444

OrderItemFixedAmountTarget.php

Namespace Drupal  my_module  Plugin  Commerce  PromotionOffer;

use Drupal  commerce_promotion  Plugin  Commerce  PromotionOffer  OrderPromotionOfferBase;
use Drupal  commerce_promotion  Plugin  Commerce  PromotionOffer  FixedAmountOffTrait;
use Drupal  commerce_order  Adjustment;
Use Drupal  commerce_promotion  Entity  PromotionInterface.
use Drupal  Core  Entity  EntityInterface;

/ **
* @CommercePromotionOffer (
* id = "my_module_fixed_amount_target",
* label = @Translation ("Discount for each matching product to a fixed amount"),
* entity_type = "commerce_order_item",
*)
* /
Class OrderItemFixedAmountTarget extends OrderPromotionOfferBase {

use FixedAmountOffTrait;

/ **
* {@inheritdoc}
* /
public function apply (EntityInterface $ entity, PromotionInterface $ promotion) {
$ this-> assertEntity ($ entity);
/ ** @var  Drupal  commerce_order  Entity  OrderInterface $ order * /
$ order = $ entity;
$ subtotal_price = $ order-> getSubTotalPrice ();
$ amount = $ this-> getAmount ();
if ($ subtotal_price-> getCurrencyCode ()! = $ amount-> getCurrencyCode ()) {
Return;
}
// The advertising amount can not be greater than the subtotal to avoid this
// possibly with a negative total.
if ($ amount-> largerThan ($ subtotal_price)) {
$ amount = $ subtotal_price;
}
// Split amount between order items.
$ amount = $ this-> splitter-> split ($ order, $ amount);

foreach ($ order-> getItems () as $ order_item) {
if (isset ($ amounts[$order_item->id()])) {
$ order_item-> addAdjustment (new Adjustment ([
& # 39; type & # 39; => & # 39; promotion & # 39 ;,
// @todo Changes the label from the UI when added to # 2770731.
& # 39; label & # 39; => t (& # 39; discount & # 39;),
& # 39; amount & # 39; => $ amounts[$order_item->id()]-> multiply (& # 39; - 1 & # 39;),
& # 39; # 39 & source_id; => $ promotion-> id (),
]));
}
}
}
}

my_module.info.yml:

Name: "Custom Promotion Terms"
Type: Module
Description: "Offers custom quotes and conditions"
Core: 8.x.
Package: "Custom"
dependencies:
- Trade: Trade
- commerce: commerce_order
- Drupal: options

my_module.module:

<? php

/ **
* @File
* Contains my_module_custom_promotion.module.
* /

use Drupal  Core  Routing  RouteMatchInterface;

/ **
* Implemented hook_help ().
* /
function my_module_custom_promotion_help ($ route_name, RouteMatchInterface $ route_match) {
switch ($ route_name) {
// Main module help for the my_module_custom_promotion module.
case & # 39; help.page.my_module_custom_promotion & # 39 ;:
$ output = & # 39; & # 39 ;;
$ output. = & # 39;

& # 39 ;. t (& # 39; over & # 39;). & # 39;

& # 39 ;; $ output. = & # 39;

& # 39 ;. t (& # 39; my fantastic module & # 39;). & # 39;

& # 39 ;; return $ output; Default: } } / ** * Implements hook_theme (). * / Function my_module_custom_promotion_theme () { return [ 'my_module_custom_promotion' => [ 'render element' => 'children', ]. ]; }

I've tried my best, but I can not figure out what I'm doing wrong and cause this "used name" error. I searched my entire project just in case, but the text "OrderItemFixedAmountTarget" is only used in this one file.

Brave Airdrop: Get $ 5 a month for downloading this app, $ 5 per referral, and you'll be paid to watch ads

Brave is a free open source web browser developed by Brave Software Inc. based on the Chromium web browser. The browser blocks ads and website trackers. In a future version of the browser, the company has proposed the introduction of a pay-to-surf business model. Wikipedia
FREE EARNING BAT TOKEN

FOLLOW THE INSTRUCTIONS FOR EASY ACCESS, Bat is listed in the binance

GET 5 BAT TOKEN (15 BAT) each month without doing anything! Just to keep the app on your smartphone or desktop and claim for free …

Brave Airdrop: Get $ 5 a month for downloading this app, $ 5 per referral, and you'll be paid to watch ads

XRP surpasses price gains on crypto currency! You'll be shocked to see that they have about 20,000 live dealers and offer a demo of their services and messages. – Advertising, offers

Dear users,

The GGBTC Exchange will list the DSC on May 25, 2019. At this time, the deposit and trade services will be opened.

Deposit opening time: 25th May 2019

Trading opening time: 27th May 2019

To open trading pairs: DSC / USDT

Project introduction:

Source Chain is dedicated to developing the underlying technology. The L algorithm significantly improves the efficiency of the blockchain operation and implements directly programmable operations on the client side. At present, it has been applied to the system for tracking health products to realize the application of blockchain. At the same time, it is committed to the security of Blockchain to realize intelligent monitoring of the operating environment and to update client intelligence to create a rapid development path for the industry.

Innovation of the project:

1. The programmable blockchain's low-level technology enables the system to communicate with the standard development language, low learning costs and third-party open programming interface.

2. Application-ledger interface reserved in POW mode using multi-chain parallelism to provide the project ecosystem with a simple "blockchain application capability"

3. Private and public subapplications can be created including TOKEN, which enhances the simple development framework.

4. In the application market, the method of contracting will be used to set up the project library, and the commercialization of the project will be carried out through the funds and the financing mechanism of a third party

5. Multi-module upgrade mechanism, including authentication, intelligent network, and data store, which uses a distributed single-control upgrade mechanism to promote the integration of blockchain and artificial intelligence

6. A new distribution network where all of the digital assets exist as "variables". After learning through artificial intelligence training, the value of data can be refined, used, managed, and flowed to create intelligent digital assets.

Official Website: http://www.chaindsc.com/

Download for wallet: www.chaindsc.com/kehuduan.rar

Block Explorer: view.chaindsc.com

Risk Considerations:
Trading in digital assets involves significant risks and may result in the loss of your invested capital. Please make a reasonable judgment about your investment ability and make prudent investment decisions.
GGBTC tries to validate all tokens before they are put on the market. Despite the best care, however, there are still risks associated with the investment. GGBTC is not liable for any investment gains or losses. We thank you for your support and understanding. GGBTC will continue to offer you better products and services!

Contact us:

Website: https://www.ggbtc.com/

Facebook: https://www.facebook.com/ggbtcofficial/

Twitter: https://twitter.com/GGBTC_Official

Telegram English Group: https://t.me/ggbtcvipenglishgroup

,

Here's why Bitcoin wins so fast! You'll be shocked to see that there are around 20,000 live traders. – Advertising, offers

Bitcoin's Bullish Momentum is back, visit the largest crypto community to make massive profits, Gdax Bot, Bitcoin Bot and Crypto Trading Strategy – https://t.me/freebitmexsignals

Bitcoin has risen massively in the last few weeks.

This is because Bakkt has been informed about the introduction of Bitcoin futures contracts.

It is being developed by Bakkt in collaboration with ICE Futures USA and ICE Clear USA.

#TRX is a coin for now, if you want to get maximum profit.

Our team makes impressive accuracy of #TRX trades. #TRX Trades has continued to generate profits – Auto Bot has generated these trades excellently

Grab the most powerful and accurate bot for leverage.

It has just taken profit through all these trades to the next level.

,

You'll need all the emails that Inmotion has forwarded to Gmail to initiate new conversations

If guests fill out a contact form on our website, send them to our info@emailaddress.net at our hosting company Inmotion. These are DIVI contact forms in WordPress. The problem is, if they're redirected to our Gmail Work account, where people can respond, they'll all be in the same conversation in Gmail, which makes it very hard for us to share. It can be confusing and it is unnecessary waste of time.

I think, groups emails in conversations when the subject of the email is the same. In this case, the e-mail subject is always the same, it is the static title of the DIVI contact form. Gmail filters can help me keep messages out of the spam folder. How can I filter all emails we send from our email address into new conversations / threads in Gmail?

I do not want to use a contact plugin like Contact Form 7 or WPForms because they are not integrated. We will use another plugin that I use with the DIVI contact forms called DIVI overlays.

Fingers crossed.

Minimize the effort you'll face in your multi-level marketing – MLM & Network Marketing

MLM Software is the heart of the MLM business. Buy MLM software what secures and increases your profit and run your business efficiently. The ecove offers you all kinds of business plan at the lowest price. Overview different Functions and functionality of the MLM plan with a Free demo with quality service and 24-hour customer supportD1xwurDXQAEPfTV.jpg "class =" ipsImage "data-ratio =" 64.08 "height =" 640 "width =" 1000 "src =" https://pbs.twimg.com/media/D1xwurDXQAEPfTV.jpg "/></p>
<p>
<span style=For all questions please visit the website.