Sending copy of confirmation email on particular amount of products (Magento) - email

I'm building a webshop with just 2 simple products. (ID 1 and ID 2)
When a customer does a purchase, he receives a confirmation email with order info.
Also, the store where he wants to pick up the products receives an email with order info.
Now I want to build in an extra function:
An extra email with order info needs to be send to my email when a customer purchases ten or more of product with ID 1 or one or more of product with ID 2.
I am completely new to Magento and where to find the correct files to customize. So I hope someone can help me getting this to work! :)

You will need to use an observer for this
/app/etc/modules/Yournamaspace_Orderhook.xml
<?xml version="1.0"?>
<config>
<modules>
<Yournamaspace_Orderhook>
<active>true</active>
<codePool>community</codePool>
</Yournamaspace_Orderhook>
</modules>
</config>
/app/code/community/Yournamaspace/Orderhook/etc/config.xml
<?xml version="1.0"?>
<config>
<modules>
<Yournamaspace_Orderhook>
<version>1.0</version>
</Yournamaspace_Orderhook>
</modules>
<global>
<models>
<orderhook>
<class>Yournamaspace_Orderhook_Model</class>
</orderhook>
</models>
<events>
<sales_order_place_after>
<observers>
<auto_email_order>
<type>singleton</type>
<class>orderhook/observer</class>
<method>implementOrderEmail</method>
</auto_email_order>
</observers>
</sales_order_place_after>
</events>
</global>
Create observer file
app/code/community/Yournamaspace/Orderhook/Model/Observer.php
class Yournamaspace_Orderhook_Model_Observer
{
public function implementOrderStatus($event)
{
// implement your code here for email order to speacific email address with your template
$order = $event->getOrder();
return $this;
}
}
hope this will sure help you.

Related

Set Allowed Countries on Store View

In Magento 1.4, I was able to set allowed countries on the Store View Level, therefore I could have a Website with one Store und multiple Store Views for each of my countries:
Now in Magento 2, I can only set the Allowed Countries on the Website and not on the Store View, the Store View setting looks as follows:
Why do I want to change that? I need to be able to set a different store contact address for each of these Store Views, because I e.g. have an Argentinien und a Bulgarian Store View, so I want to set the different addresses but use the same Website/Store.
Unfortunately, I'm also not able to change the Store Contact Address per Store View anymore, this also only works on Website Level.
Am I missing something? Was there a logical change from 1.X to 2.X about the Store Views?
I don't know why the allowed country option was removed from settings in store view. But looking in the code shows that the information is used if present. So you can just enter the data into core_config_data (scope: stores, scope_id: your_store_id, value: AT,AB,AC...
the correct answer that respects Magento 2 standardization is overloading the system.xml of the magento/Backend/etc/adminhtml.
you should try:
Vendor/ModuleName/etc/adminhtml/system.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Config:etc/system_file.xsd">
<system>
<section id="general">
<group id="country" translate="label" type="text" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Country Options</label>
<field id="allow" translate="label" type="multiselect" sortOrder="2" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1">
<label>Allow Countries</label>
<source_model>Magento\Directory\Model\Config\Source\Country</source_model>
<can_be_empty>1</can_be_empty>
</field>
</group>
</section>
</system>
</config>
Remember to add overridden module - Magento_Backend
Vendor/ModuleName/etc/module.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="Vendor_YourModule" setup_version="1.0.0">
<sequence>
<module name="Magento_Backend"/>
</sequence>
</module>
</config>

QBO API V3 : Product Inventory is not getting updated

We want to manually adjust/update the Inventory of an Item using QBO V3 API.
But, the QtyOnHand did not get updated on QBO properly. We re-checked using QBO browser app too.
First Request : Create a product of type "Inventory" on QBO with "QtyOnHand" set to 100.
a. The response appropriately mentioned that the product is created.
Second Request : Update the above product with "QtyOnHand" set to 200.
b. The response still contains the older QtyOnHand (100). It didn't reflect that new QtyOnHand.
How can we manually adjust / update QtyOnHand using QBO V3 API?
For reference, our update request is:
<IntuitBatchRequest xmlns="http://schema.intuit.com/finance/v3">
<BatchItemRequest operation="update" bId="0">
<Item>
<Id>2091</Id>
<SyncToken>0</SyncToken>
<Name>Product 26--var 2</Name>
<Description>false</Description>
<Taxable>true</Taxable>
<UnitPrice>1000.00</UnitPrice>
<Type>Inventory</Type>
<IncomeAccountRef>62</IncomeAccountRef>
<ExpenseAccountRef>111</ExpenseAccountRef>
<AssetAccountRef>112</AssetAccountRef>
<TrackQtyOnHand>true</TrackQtyOnHand>
<QtyOnHand>200</QtyOnHand>
<InvStartDate>2014-01-21</InvStartDate>
</Item>
</BatchItemRequest>
</IntuitBatchRequest>
Our response XML is:
<?xml version="1.0" encoding="UTF-8"?>
<IntuitResponse xmlns="http://schema.intuit.com/finance/v3" time="2014-01-20T23:21:44.559-08:00">
<BatchItemResponse bId="0">
<Item domain="QBO" sparse="false">
<Id>2091</Id>
<SyncToken>0</SyncToken>
<MetaData>
<CreateTime>2014-01-20T22:44:10-08:00</CreateTime>
<LastUpdatedTime>2014-01-20T22:44:10-08:00</LastUpdatedTime>
</MetaData>
<Name>Product 26--var 2</Name>
<Description>false</Description>
<Active>true</Active>
<FullyQualifiedName>Product 26--var 2</FullyQualifiedName>
<Taxable>true</Taxable>
<UnitPrice>1000</UnitPrice>
<Type>Inventory</Type>
<IncomeAccountRef name="Sales">62</IncomeAccountRef>
<PurchaseCost>0</PurchaseCost>
<ExpenseAccountRef name="Cost of Goods Sold">111</ExpenseAccountRef>
<AssetAccountRef name="Inventory Asset">112</AssetAccountRef>
<TrackQtyOnHand>true</TrackQtyOnHand>
<QtyOnHand>100</QtyOnHand>
<InvStartDate>2014-01-21</InvStartDate>
</Item>
</BatchItemResponse>
</IntuitResponse>
The QtyOnHand field is not an update-able field.
Inventory adjustments are made when:
You create a transaction that uses up inventory (Sales Receipts, Invoices, etc.)
You create a transaction that returns inventory (Credit Memos)
You issue an Inventory Adjustment (unfortunately, Intuit's API does not support this yet)
Given that the API does not support inventory adjustments yet, I don't think you'll be able to do what you're trying to do.

Orbeon, file reponsible for completed forms

I'm looking for file which is responsible for model of completed data in xml. For example it looks like:
<form xmlns:xxi="http://orbeon.org/oxf/xml/xinclude" xmlns:xh="http://www.w3.org/1999/xhtml" xmlns:xi="http://www.w3.org/2001/XInclude" xmlns:ev="http://www.w3.org/2001/xml-events" xmlns:saxon="http://saxon.sf.net/" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:fb="http://orbeon.org/oxf/xml/form-builder" xmlns:xxf="http://orbeon.org/oxf/xml/xforms" xmlns:xbl="http://www.w3.org/ns/xbl" xmlns:version="java:org.orbeon.oxf.common.Version" xmlns:sql="http://orbeon.org/oxf/xml/sql" xmlns:p="http://www.orbeon.com/oxf/pipeline" xmlns:fr="http://orbeon.org/oxf/xml/form-runner" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xf="http://www.w3.org/2002/xforms" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:exf="http://www.exforms.org/exf/1-0">
<section-1>
<control-3>name</control-3>
<control-1>second-name</control-1>
</section-1>
</form>
This example could store simple form which contains two input field (name, second-name).
I want to find it, because I want to add parameter contains id of user who complete this form. So I want to change model, to reach following effect in completed form xml:
<form xmlns:xxi="http://orbeon.org/oxf/xml/xinclude" xmlns:xh="http://www.w3.org/1999/xhtml" xmlns:xi="http://www.w3.org/2001/XInclude" xmlns:ev="http://www.w3.org/2001/xml-events" xmlns:saxon="http://saxon.sf.net/" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:fb="http://orbeon.org/oxf/xml/form-builder" xmlns:xxf="http://orbeon.org/oxf/xml/xforms" xmlns:xbl="http://www.w3.org/ns/xbl" xmlns:version="java:org.orbeon.oxf.common.Version" xmlns:sql="http://orbeon.org/oxf/xml/sql" xmlns:p="http://www.orbeon.com/oxf/pipeline" xmlns:fr="http://orbeon.org/oxf/xml/form-runner" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xf="http://www.w3.org/2002/xforms" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:exf="http://www.exforms.org/exf/1-0">
<user-who-complete-this-form-ID>100</user-who-complete-this-form-ID>
<section-1>
<control-3>name</control-3>
<control-1>second-name</control-1>
</section-1>
</form>
Or maybe someone knows other way to provide id of user who complete form to own persistence layer?
regards
This looks like the data for a form you created in Form Builder. If that is indeed the case, and you want to add a field, you can do it from Form Builder, republish the form, and the instances of the new form will have the additional field you added.

Unable to Add/Modify Mobile Phone field using IPP against QuickBooks desktop

I can't seem to modify or add the Mobile phone field in QuickBooks for QB Desktop. Online works fine, no dice in desktop but according to the XML response of the MOD request it seems to be working fine.
It shows the field being created/modified (idDomain is created, id value generated) however SyncManager never pushes the changes to QuickBooks.
I can modify the Mobile value on the QB side and I'll be able to see that change in my IPP application but no go when heading the other direction.
Here's the XML traces:
http://pastebin.com/qprwAh9z
Any ideas?
I was able to replicate this. The mobile phone number does not sync to the QB desktop file.Seems like a bug.
Please submit a support ticket here:
Link - http://developer.intuit.com/Support/Incident
It looks like, the problem is when you use 'Mobile' in the Phone's 'Tag' field.
Instead of 'Mobile', I tried 'Home' in the Tag field. As an alternate solution you can try the following (I will take a look if there is any constraint in the intermediate QBXML/QBSDK side )
IDS Req
<?xml version="1.0" encoding="UTF-8"?>
<Add xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" RequestId="22f39648c5ab1111988854e808163dc9" xmlns="http://www.intuit.com/sb/cdm/v2">
<ExternalRealmId>657117515</ExternalRealmId>
<Object xsi:type="Customer">
<TypeOf>Person</TypeOf>
<Name>SampleCust-IDS12</Name>
<Address>
...
</Address>
<Address>
...
</Address>
<Phone>
<DeviceType>LandLine</DeviceType>
<FreeFormNumber>0123456789</FreeFormNumber>
<Default>1</Default>
<Tag>Business</Tag>
</Phone>
<Phone>
<DeviceType>LandLine</DeviceType>
<FreeFormNumber>1234567890</FreeFormNumber>
<Default>0</Default>
<Tag>Home</Tag>
</Phone>
...
</Object>
</Add>
Create Response
<RestResponse xmlns="http://www.intuit.com/sb/cdm/v2">
<Success RequestId="22f39648c5ab1111988854e808163dc9">
<PartyRoleRef>
<Id idDomain="NG">1221097</Id>
<SyncToken>1</SyncToken>
<LastUpdatedTime>2013-07-19T11:25:43Z</LastUpdatedTime>
<PartyReferenceId idDomain="NG">1261065</PartyReferenceId>
</PartyRoleRef>
<RequestName>CustomerAdd</RequestName>
<ProcessedTime>2013-07-19T11:25:43Z</ProcessedTime>
</Success>
</RestResponse>
QBXML [ 2nd phone no is coming under AltPhone tag ]
<?qbxml version="9.0" ?>
<QBXML>
<QBXMLMsgsRq onError="continueOnError" newMessageSetID="13ff6ae6e2c76b59e49">
<CustomerAddRq requestID="EsbKeyMapHeader:1221097:0">
<CustomerAdd>
<Name>SampleCust-IDS12</Name>
..
<BillAddress>
...
</BillAddress>
<ShipAddress>
...
</ShipAddress>
<PrintAs>SampleCust</PrintAs>
<Phone>0123456789</Phone>
<AltPhone>1234567890</AltPhone>
<Fax></Fax>
..
</CustomerAddRq>
</QBXMLMsgsRq>
</QBXML>
QB's view [ There is no specific field for Mobile. Mobile/LandLine is kindOf Metadata. I'll check and confirm this behaviour ]
Thanks

what is the metadata attribute pair in MQFTE ? Why is it used?

I am working with wmqfte. While creating a transfer there is a parameter for metadata attribute pair. Why is this used for ?
One of the FTE engagements I worked on required email notifications of transfer status. Our approach to this was to add an email step in the transfer and the way we passed in the source and destination addresses was with metadata pairs. The transfer XML is provided below for an example:
<?xml version="1.0" encoding="UTF-8"?><request version="4.00" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FileTransfer.xsd">
<!DOCTYPE request>
<managedTransfer>
<originator>
<hostName>host.example.com</hostName>
<userID>me</userID>
</originator>
<sourceAgent QMgr="QMGR01" agent="AGENT01"/>
<destinationAgent QMgr="QMGR02" agent="AGENT02"/>
<transferSet priority="5">
<metaDataSet>
<metaData key="email.from">fteadmin#example.com</metaData>
<metaData key="email.to">"dept#example.com</metaData>
</metaDataSet>
<item checksumMethod="MD5" mode="binary">
<source disposition="delete" recursive="false">
<file>/root/path/file</file>
</source>
<destination exist="overwrite" type="directory">
<file>/root/path/</file>
</destination>
</item>
</transferSet>
<job>
<name>Your Job Name Here</name>
</job>
</managedTransfer>
</request>
A better way of sending status emails is to watch the transfer notifications published at the Coordination QMgr. However this example does show one possible use for the metadata pairs.