Skip to content

Commit

Permalink
New live template quote to order observer
Browse files Browse the repository at this point in the history
  • Loading branch information
jalogut committed Dec 5, 2017
1 parent bcfff93 commit d637bd2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
6 changes: 6 additions & 0 deletions Preferences/templates/StmpflMagento2.xml
Original file line number Diff line number Diff line change
Expand Up @@ -646,4 +646,10 @@
<option name="XML" value="true" />
</context>
</template>
<template name="2magento quote to order observer" value="/**&#10; * @param Observer $observer&#10; * @return void&#10; * @event sales_model_service_quote_submit_before&#10; */&#10;public function execute(Observer $observer)&#10;{&#10; $this-&gt;addQuoteAttributeToOrder($observer);&#10;}&#10;&#10;private function addQuoteAttributeToOrder(Observer $observer)&#10;{&#10; /* @var $order \Magento\Sales\Model\Order */&#10; $order = $observer-&gt;getEvent()-&gt;getOrder();&#10; /** @var $quote \Magento\Quote\Model\Quote $quote */&#10; $quote = $observer-&gt;getEvent()-&gt;getQuote();&#10;&#10; $order-&gt;setData(&#10; '$attribute$',&#10; $quote-&gt;getData('$attribute$'));&#10;}" toReformat="false" toShortenFQNames="true">
<variable name="attribute" expression="" defaultValue="&quot;custom_attribute&quot;" alwaysStopAt="true" />
<context>
<option name="PHP" value="true" />
</context>
</template>
</templateSet>
1 change: 1 addition & 0 deletions docs/liveTemplates.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,3 +86,4 @@
* 2magento setup order quote field
* 2magento setup uninstall
* 2magento webapi xml
* 2magento quote to order observer

0 comments on commit d637bd2

Please sign in to comment.