Version Notes
First Release
Download this release
Release Info
Developer | Jayneel |
Extension | Openxcell_Attachments |
Version | 1.0.0 |
Comparing to | |
See all releases |
Version 1.0.0
- app/code/local/Openxcell/Adminneworderemail/Helper/Data.php +6 -0
- app/code/local/Openxcell/Adminneworderemail/Model/Observer.php +176 -0
- app/code/local/Openxcell/Adminneworderemail/Model/Observer_csv.php +116 -0
- app/code/local/Openxcell/Adminneworderemail/Model/Options.php +10 -0
- app/code/local/Openxcell/Adminneworderemail/etc/config.xml +71 -0
- app/code/local/Openxcell/Adminneworderemail/etc/system.xml +36 -0
- app/etc/modules/Openxcell_Adminneworderemail.xml +9 -0
- app/locale/en_US/template/email/sales/order_new_admin_attachment.html +105 -0
- package.xml +20 -0
app/code/local/Openxcell/Adminneworderemail/Helper/Data.php
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Openxcell_Adminneworderemail_Helper_Data extends Mage_Core_Helper_Abstract
|
4 |
+
{
|
5 |
+
|
6 |
+
}
|
app/code/local/Openxcell/Adminneworderemail/Model/Observer.php
ADDED
@@ -0,0 +1,176 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Openxcell_Adminneworderemail_Model_Observer
|
4 |
+
{
|
5 |
+
const XML_PATH_ADMIN_EMAIL_TEMPLATE = 'sales_email/order/admin_email_template';
|
6 |
+
|
7 |
+
public function onepageCheckoutSuccess($observer){
|
8 |
+
$orderId = Mage::getSingleton('checkout/session')->getLastOrderId();
|
9 |
+
//$orderId = $observer->getData('order')->getId();
|
10 |
+
$this->sendAdminOrderNotification($orderId);
|
11 |
+
}
|
12 |
+
|
13 |
+
public function sendAdminOrderNotification($orderId) {
|
14 |
+
//DebugBreak();
|
15 |
+
$type = Mage::getStoreConfig('sales_email/order/admin_email_type');
|
16 |
+
$translate = Mage::getSingleton('core/translate');
|
17 |
+
$translate->setTranslateInline(false);
|
18 |
+
|
19 |
+
$mailTemplate = Mage::getModel('core/email_template');
|
20 |
+
$template = Mage::getStoreConfig(self::XML_PATH_ADMIN_EMAIL_TEMPLATE, $this->getStoreId());
|
21 |
+
$adminEmail = '';
|
22 |
+
$adminName = '';
|
23 |
+
$oid = Mage::getModel("sales/order")->getCollection()->getLastItem()->getId();
|
24 |
+
$_order = Mage::getModel('sales/order')->load($oid);
|
25 |
+
$billing_data = $_order->getBillingAddress()->getData();
|
26 |
+
$shipping_data = $_order->getShippingAddress()->getData();
|
27 |
+
$invoiceId = $_order->getData('increment_id');
|
28 |
+
$ip = $_order->getData('remote_ip');
|
29 |
+
$date = $_order->getData('created_at');
|
30 |
+
$shippingMethod = $_order->getData('shipping_method');
|
31 |
+
$subtotal = $_order->getGrandTotal() - 11;
|
32 |
+
$shippingAmount = 11;
|
33 |
+
$discount = $_order->getData('discount_amount');
|
34 |
+
$grand = $_order->getGrandTotal();
|
35 |
+
$street = explode("\n", $billing_data['street']);
|
36 |
+
$streetShipping = explode("\n", $shipping_data['street']);
|
37 |
+
$billing_address1 = str_replace(",",";",$street[0]);
|
38 |
+
$billing_address2 = str_replace(",",";",$street[1]);
|
39 |
+
$shipping_address1 = str_replace(",",";",$streetShipping[0]);
|
40 |
+
$shipping_address2 = str_replace(",",";",$street[1]);
|
41 |
+
$num_date1 = str_replace("-","",$date);
|
42 |
+
$num_date = str_replace(":","",$num_date1);
|
43 |
+
if($type == "xml"){ //Condition for XML file
|
44 |
+
$string = '<?xml version="1.0" encoding="UTF-8"?>
|
45 |
+
<!DOCTYPE OrderList SYSTEM "http://foo.com/">
|
46 |
+
<OrderList StoreAccountName="magento">
|
47 |
+
<Order currency="USD" id="'. $invoiceId .'">
|
48 |
+
<Time>'. $date .'</Time>
|
49 |
+
<NumericTime>'. $num_date .'</NumericTime>
|
50 |
+
<AddressInfo type="ship">
|
51 |
+
<Name>
|
52 |
+
<First>'.$shipping_data["firstname"].'</First>
|
53 |
+
<Last>'.$shipping_data["lastname"].'</Last>
|
54 |
+
<Full>'.$shipping_data["firstname"]." ".$shipping_data["lastname"].'</Full>
|
55 |
+
</Name>
|
56 |
+
<Company>'.$shipping_data["company"].'</Company>
|
57 |
+
<Address1>'.$shipping_address1.'</Address1>
|
58 |
+
<Address2>'.$shipping_address2.'</Address2>
|
59 |
+
<City>'.$shipping_data["city"].'</City>
|
60 |
+
<State>'.$shipping_data["region"].'</State>
|
61 |
+
<Country>'.$shipping_data["country_id"].'</Country>
|
62 |
+
<Zip>'.$shipping_data['postcode'].'</Zip>
|
63 |
+
<Phone>'.$shipping_data['telephone'].'</Phone>
|
64 |
+
<Email>'.$shipping_data['email'].'</Email>
|
65 |
+
</AddressInfo>
|
66 |
+
<AddressInfo type="bill">
|
67 |
+
<Name>
|
68 |
+
<First>'.$billing_data["firstname"].'</First>
|
69 |
+
<Last>'.$billing_data["lastname"].'</Last>
|
70 |
+
<Full>'.$billing_data["firstname"]." ".$billing_data["lastname"].'</Full>
|
71 |
+
</Name>
|
72 |
+
<Company>'.$billing_data["company"].'</Company>
|
73 |
+
<Address1>'.$billing_address1.'</Address1>
|
74 |
+
<Address2>'.$billing_address2.'</Address2>
|
75 |
+
<City>'.$billing_data["city"].'</City>
|
76 |
+
<State>'.$billing_data["region"].'</State>
|
77 |
+
<Country>'.$billing_data["country_id"].'</Country>
|
78 |
+
<Zip>'.$billing_data['postcode'].'</Zip>
|
79 |
+
<Phone>'.$billing_data['telephone'].'</Phone>
|
80 |
+
<Email>'.$billing_data['email'].'</Email>
|
81 |
+
</AddressInfo>
|
82 |
+
<IPAddress>'.$ip.'</IPAddress>
|
83 |
+
<Shipping>'.$shippingMethod.'</Shipping>';
|
84 |
+
|
85 |
+
|
86 |
+
$i=0;
|
87 |
+
foreach($_order->getAllItems() as $itemId => $item){
|
88 |
+
//$item = Mage::getModel('catalog/product')->load($itemId);
|
89 |
+
$itemPrice = $item->getPrice();
|
90 |
+
if($item->getData('tax_amount') > 0){
|
91 |
+
$tax = 'YES';
|
92 |
+
}
|
93 |
+
else{
|
94 |
+
$tax = 'NO';
|
95 |
+
}
|
96 |
+
|
97 |
+
$string.='<Item num="'.$i.'">
|
98 |
+
<Code>'.$item->getSku().'</Code>
|
99 |
+
<Quantity>'.$item->getQtyToInvoice().'</Quantity>
|
100 |
+
<Unit-Price>'.$itemPrice.'</Unit-Price>
|
101 |
+
<Taxable>'.$tax.'</Taxable>
|
102 |
+
|
103 |
+
</Item>';
|
104 |
+
$i++;
|
105 |
+
|
106 |
+
}
|
107 |
+
$string.='<Total>
|
108 |
+
<Line type="Subtotal" name="Subtotal">'.$subtotal.'</Line>
|
109 |
+
<Line type="Shipping" name="Shipping">'.$shippingAmount.'</Line>
|
110 |
+
<Line type="Tax" name="Tax">'.$_order->getShippingTaxAmount().'</Line>
|
111 |
+
<Line type="Total" name="Total">'.$grand.'</Line>
|
112 |
+
</Total>
|
113 |
+
<Space-Id></Space-Id>
|
114 |
+
</Order>
|
115 |
+
</OrderList>';
|
116 |
+
} else{ //For CSV
|
117 |
+
$string = "InvoiceID,IP Address,Date,Firstname,Lastname,Company Name,Address,City,State,PostCode,Country,Shipping Name,Shipping Address,Shipping City,Shipping State,Shipping PostCode,Shipping Country,Shipping Method,Transaction ID,Card Type,Sku Number,Items,Quantity,Price,Item Total,Sub Total,Freight,Tax,Discount,Total\n";
|
118 |
+
foreach($_order->getAllItems() as $itemId => $item){
|
119 |
+
$_order = Mage::getModel('sales/order')->load($orderId);
|
120 |
+
$invoiceId = $_order->getData('increment_id');
|
121 |
+
$ip = $_order->getData('remote_ip');
|
122 |
+
$date = $_order->getData('created_at');
|
123 |
+
$shippingMethod = $_order->getData('shipping_method');
|
124 |
+
$subtotal = $_order->getGrandTotal() - 11;
|
125 |
+
$shippingAmount = 11;
|
126 |
+
$discount = $_order->getData('discount_amount');
|
127 |
+
$grand = $_order->getGrandTotal();
|
128 |
+
//$street = explode("\n", $billing_data['street']);
|
129 |
+
$street = str_replace("\n","|", $billing_data['street']);
|
130 |
+
$streetShipping = str_replace("\n","|", $shipping_data['street']);
|
131 |
+
$billing_address = str_replace(",",";",$street);
|
132 |
+
$shipping_address = str_replace(",",";",$streetShipping);
|
133 |
+
$itemPrice = $item->getPrice() + $item->getData('tax_amount');
|
134 |
+
$_product = Mage::getModel('catalog/product')->loadByAttribute('sku',$item->getSku());
|
135 |
+
$taxClassId = $_product->getTaxClassId();
|
136 |
+
$taxClass = Mage::getModel('tax/class')->load($taxClassId);
|
137 |
+
$taxClassName = $taxClass->getClassName();
|
138 |
+
/*if($taxClassName == 'GST'){
|
139 |
+
$taxRate = 10;
|
140 |
+
}
|
141 |
+
else{
|
142 |
+
$taxRate = 0;
|
143 |
+
}*/
|
144 |
+
|
145 |
+
$string.= $invoiceId . ',' . $ip . ',' . $date . ',' . $billing_data['firstname'] . ',' . $billing_data['lastname'] . ',' .$billing_data['company'] . ',' . $billing_address . ',' . $billing_data['city'] . ',' . $billing_data['region'] .',' . $billing_data['postcode'] . ','. $billing_data['country_id'] . ',' . $shipping_data['firstname'] .',' . $shipping_address . ',' . $shipping_data['city'] .',' .$shipping_data['region'] .',' . $shipping_data['postcode'] . ','. $shipping_data['country_id'] . ',' . $shippingMethod . ','. "" .','. "" . ',' .$item->getSku() . ',' . $item->getName() . ','. $item->getQtyOrdered() . ',' . $itemPrice . ',' . $itemPrice*$item->getQtyOrdered() . ',' . $subtotal . ',' . $shippingAmount . ',' . Mage::helper('checkout')->getQuote()->getShippingAddress()->getData('tax_amount') . ',' . $discount . ',' . $grand ."\n";
|
146 |
+
}
|
147 |
+
}
|
148 |
+
$paymentBlock = Mage::helper('payment')->getInfoBlock($_order->getPayment())->setIsSecureMode(true);
|
149 |
+
$paymentBlock->getMethod()->setStore($_order->getStore()->getId());
|
150 |
+
|
151 |
+
$adminEmailString = Mage::getStoreConfig('sales_email/order/admin_email_notify');
|
152 |
+
$adminEmailArray = explode(',', $adminEmailString);
|
153 |
+
|
154 |
+
foreach ($adminEmailArray as $adminEmail){
|
155 |
+
if($type == "xml"){
|
156 |
+
$mailTemplate->setDesignConfig(array('area'=>'frontend', 'store'=>$this->getStoreId()))->getMail()->createAttachment($string,'text/UTF-8')->filename = 'order.xml'; } else {
|
157 |
+
$mailTemplate->setDesignConfig(array('area'=>'frontend', 'store'=>$this->getStoreId()))->getMail()->createAttachment($string,'text/UTF-8')->filename = 'order.csv'; }
|
158 |
+
$mailTemplate->setDesignConfig(array('area'=>'frontend', 'store'=>$this->getStoreId()))
|
159 |
+
->sendTransactional($template,
|
160 |
+
Mage::getStoreConfig(Mage_Sales_Model_Order::XML_PATH_EMAIL_IDENTITY, $this->getStoreId()),
|
161 |
+
$adminEmail,
|
162 |
+
$adminName,
|
163 |
+
array(
|
164 |
+
'order' => $_order,
|
165 |
+
'payment_html' => $paymentBlock->toHtml(),
|
166 |
+
)
|
167 |
+
);
|
168 |
+
}
|
169 |
+
|
170 |
+
$translate->setTranslateInline(true);
|
171 |
+
}
|
172 |
+
|
173 |
+
public function getStoreId(){
|
174 |
+
return Mage::app()->getStore()->getId();
|
175 |
+
}
|
176 |
+
}
|
app/code/local/Openxcell/Adminneworderemail/Model/Observer_csv.php
ADDED
@@ -0,0 +1,116 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Openxcell_Adminneworderemail_Model_Observer
|
4 |
+
{
|
5 |
+
const XML_PATH_ADMIN_EMAIL_TEMPLATE = 'sales_email/order/admin_email_template';
|
6 |
+
|
7 |
+
public function onepageCheckoutSuccess($observer){
|
8 |
+
// $orderId = Mage::getSingleton('checkout/session')->getLastOrderId();
|
9 |
+
$orderId = $observer->getData('order')->getId();
|
10 |
+
$this->sendAdminOrderNotification($orderId);
|
11 |
+
}
|
12 |
+
|
13 |
+
public function sendAdminOrderNotification($orderId) {
|
14 |
+
$translate = Mage::getSingleton('core/translate');
|
15 |
+
$translate->setTranslateInline(false);
|
16 |
+
|
17 |
+
$mailTemplate = Mage::getModel('core/email_template');
|
18 |
+
$template = Mage::getStoreConfig(self::XML_PATH_ADMIN_EMAIL_TEMPLATE, $this->getStoreId());
|
19 |
+
$adminEmail = '';
|
20 |
+
$adminName = '';
|
21 |
+
//DebugBreak();
|
22 |
+
/*$_order = Mage::getModel('sales/order')->load($orderId);
|
23 |
+
$billing_data = $_order->getBillingAddress()->getData();
|
24 |
+
$shipping_data = $_order->getShippingAddress()->getData();
|
25 |
+
$string = "InvoiceID,IP Address,Date,Firstname,Lastname,Company Name,Address,City,State,PostCode,Country,Shipping Name,Shipping Address,Shipping City,Shipping State,Shipping PostCode,Shipping Country,Shipping Method,Transaction ID,Card Type,Sku Number,Items,Quantity,Price,Item Total,Tax Rate,Sub Total,Freight,Tax,Discount,Total\n";
|
26 |
+
foreach($_order->getAllItems() as $itemId => $item){
|
27 |
+
$_order = Mage::getModel('sales/order')->load($orderId);
|
28 |
+
$invoiceId = $_order->getData('increment_id');
|
29 |
+
$ip = $_order->getData('remote_ip');
|
30 |
+
$date = $_order->getData('created_at');
|
31 |
+
$shippingMethod = $_order->getData('shipping_method');
|
32 |
+
$subtotal = $_order->getGrandTotal() - 11;
|
33 |
+
$shippingAmount = 11;
|
34 |
+
$discount = $_order->getData('discount_amount');
|
35 |
+
$grand = $_order->getGrandTotal();
|
36 |
+
$street = explode("\n", $billing_data['street']);
|
37 |
+
$streetShipping = explode("\n", $shipping_data['street']);
|
38 |
+
$billing_address = str_replace(",",";",$street[0]);
|
39 |
+
$shipping_address = str_replace(",",";",$streetShipping[0]);
|
40 |
+
$itemPrice = $item->getPrice() + $item->getData('tax_amount');
|
41 |
+
$_product = Mage::getModel('catalog/product')->loadByAttribute('sku',$item->getSku());
|
42 |
+
$taxClassId = $_product->getTaxClassId();
|
43 |
+
$taxClass = Mage::getModel('tax/class')->load($taxClassId);
|
44 |
+
$taxClassName = $taxClass->getClassName();
|
45 |
+
if($taxClassName == 'GST'){
|
46 |
+
$taxRate = 10;
|
47 |
+
}
|
48 |
+
else{
|
49 |
+
$taxRate = 0;
|
50 |
+
}
|
51 |
+
|
52 |
+
$string.= $invoiceId . ',' . $ip . ',' . $date . ',' . $billing_data['firstname'] . ',' . $billing_data['lastname'] . ',' .$billing_data['company'] . ',' . $billing_address . ',' . $billing_data['city'] . ',' . $billing_data['region'] .',' . $billing_data['postcode'] . ','. $billing_data['country_id'] . ',' . $shipping_data['firstname'] .',' . $shipping_address . ',' . $shipping_data['city'] .',' .$shipping_data['region'] .',' . $shipping_data['postcode'] . ','. $shipping_data['country_id'] . ',' . $shippingMethod . ','. "" .','. "" . ',' .$item->getSku() . ',' . $item->getName() . ','. $item->getQtyOrdered() . ',' . $itemPrice . ',' . $itemPrice*$item->getQtyToInvoice() . ',' . $taxRate . ',' . $subtotal . ',' . $shippingAmount . ',' . Mage::helper('checkout')->getQuote()->getShippingAddress()->getData('tax_amount') . ',' . $discount . ',' . $grand ."\n";
|
53 |
+
}*/
|
54 |
+
|
55 |
+
$_order = Mage::getModel('sales/order')->load($orderId);
|
56 |
+
$billing_data = $_order->getBillingAddress()->getData();
|
57 |
+
$shipping_data = $_order->getShippingAddress()->getData();
|
58 |
+
$string = "InvoiceID,IP Address,Date,Firstname,Lastname,Company Name,Address,City,State,PostCode,Country,Shipping Name,Shipping Address,Shipping City,Shipping State,Shipping PostCode,Shipping Country,Shipping Method,Transaction ID,Card Type,Sku Number,Items,Quantity,Price,Item Total,Tax Rate,Sub Total,Freight,Tax,Discount,Total\n";
|
59 |
+
foreach($_order->getAllItems() as $itemId => $item){
|
60 |
+
$_order = Mage::getModel('sales/order')->load($orderId);
|
61 |
+
$invoiceId = $_order->getData('increment_id');
|
62 |
+
$ip = $_order->getData('remote_ip');
|
63 |
+
$date = $_order->getData('created_at');
|
64 |
+
$shippingMethod = $_order->getData('shipping_method');
|
65 |
+
$subtotal = $_order->getGrandTotal() - 11;
|
66 |
+
$shippingAmount = 11;
|
67 |
+
$discount = $_order->getData('discount_amount');
|
68 |
+
$grand = $_order->getGrandTotal();
|
69 |
+
//$street = explode("\n", $billing_data['street']);
|
70 |
+
$street = str_replace("\n","|", $billing_data['street']);
|
71 |
+
$streetShipping = str_replace("\n","|", $shipping_data['street']);
|
72 |
+
$billing_address = str_replace(",",";",$street);
|
73 |
+
$shipping_address = str_replace(",",";",$streetShipping);
|
74 |
+
$itemPrice = $item->getPrice() + $item->getData('tax_amount');
|
75 |
+
$_product = Mage::getModel('catalog/product')->loadByAttribute('sku',$item->getSku());
|
76 |
+
$taxClassId = $_product->getTaxClassId();
|
77 |
+
$taxClass = Mage::getModel('tax/class')->load($taxClassId);
|
78 |
+
$taxClassName = $taxClass->getClassName();
|
79 |
+
if($taxClassName == 'GST'){
|
80 |
+
$taxRate = 10;
|
81 |
+
}
|
82 |
+
else{
|
83 |
+
$taxRate = 0;
|
84 |
+
}
|
85 |
+
|
86 |
+
$string.= $invoiceId . ',' . $ip . ',' . $date . ',' . $billing_data['firstname'] . ',' . $billing_data['lastname'] . ',' .$billing_data['company'] . ',' . $billing_address . ',' . $billing_data['city'] . ',' . $billing_data['region'] .',' . $billing_data['postcode'] . ','. $billing_data['country_id'] . ',' . $shipping_data['firstname'] .',' . $shipping_address . ',' . $shipping_data['city'] .',' .$shipping_data['region'] .',' . $shipping_data['postcode'] . ','. $shipping_data['country_id'] . ',' . $shippingMethod . ','. "" .','. "" . ',' .$item->getSku() . ',' . $item->getName() . ','. $item->getQtyOrdered() . ',' . $itemPrice . ',' . $itemPrice*$item->getQtyOrdered() . ',' . $taxRate . ',' . $subtotal . ',' . $shippingAmount . ',' . Mage::helper('checkout')->getQuote()->getShippingAddress()->getData('tax_amount') . ',' . $discount . ',' . $grand ."\n";
|
87 |
+
}
|
88 |
+
|
89 |
+
|
90 |
+
$paymentBlock = Mage::helper('payment')->getInfoBlock($_order->getPayment())->setIsSecureMode(true);
|
91 |
+
$paymentBlock->getMethod()->setStore($_order->getStore()->getId());
|
92 |
+
|
93 |
+
$adminEmailString = Mage::getStoreConfig('sales_email/order/admin_email_notify');
|
94 |
+
$adminEmailArray = explode(',', $adminEmailString);
|
95 |
+
|
96 |
+
foreach ($adminEmailArray as $adminEmail){
|
97 |
+
$mailTemplate->setDesignConfig(array('area'=>'frontend', 'store'=>$this->getStoreId()))->getMail()->createAttachment($string,'text/UTF-8')->filename = 'order.csv';
|
98 |
+
$mailTemplate->setDesignConfig(array('area'=>'frontend', 'store'=>$this->getStoreId()))
|
99 |
+
->sendTransactional($template,
|
100 |
+
Mage::getStoreConfig(Mage_Sales_Model_Order::XML_PATH_EMAIL_IDENTITY, $this->getStoreId()),
|
101 |
+
$adminEmail,
|
102 |
+
$adminName,
|
103 |
+
array(
|
104 |
+
'order' => $_order,
|
105 |
+
'payment_html' => $paymentBlock->toHtml(),
|
106 |
+
)
|
107 |
+
);
|
108 |
+
}
|
109 |
+
|
110 |
+
$translate->setTranslateInline(true);
|
111 |
+
}
|
112 |
+
|
113 |
+
public function getStoreId(){
|
114 |
+
return Mage::app()->getStore()->getId();
|
115 |
+
}
|
116 |
+
}
|
app/code/local/Openxcell/Adminneworderemail/Model/Options.php
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Openxcell_Adminneworderemail_Model_Options {
|
3 |
+
public function toOptionArray()
|
4 |
+
{
|
5 |
+
return array(
|
6 |
+
array('value'=>'csv', 'label'=>Mage::helper('adminneworderemail')->__('CSV')),
|
7 |
+
array('value'=>'xml', 'label'=>Mage::helper('adminneworderemail')->__('XML')),
|
8 |
+
);
|
9 |
+
}
|
10 |
+
}
|
app/code/local/Openxcell/Adminneworderemail/etc/config.xml
ADDED
@@ -0,0 +1,71 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Openxcell_Adminneworderemail>
|
5 |
+
<version>1.1.1</version>
|
6 |
+
</Openxcell_Adminneworderemail>
|
7 |
+
</modules>
|
8 |
+
<frontend>
|
9 |
+
<events>
|
10 |
+
<checkout_onepage_controller_success_action>
|
11 |
+
<observers>
|
12 |
+
<adminneworderemail_onepage_checkout_success>
|
13 |
+
<type>singleton</type>
|
14 |
+
<class>adminneworderemail/observer</class>
|
15 |
+
<method>onepageCheckoutSuccess</method>
|
16 |
+
</adminneworderemail_onepage_checkout_success>
|
17 |
+
</observers>
|
18 |
+
</checkout_onepage_controller_success_action>
|
19 |
+
</events>
|
20 |
+
</frontend>
|
21 |
+
<global>
|
22 |
+
<models>
|
23 |
+
<adminneworderemail>
|
24 |
+
<class>Openxcell_Adminneworderemail_Model</class>
|
25 |
+
</adminneworderemail>
|
26 |
+
</models>
|
27 |
+
<resources>
|
28 |
+
<adminneworderemail_setup>
|
29 |
+
<setup>
|
30 |
+
<module>Openxcell_Adminneworderemail</module>
|
31 |
+
</setup>
|
32 |
+
<connection>
|
33 |
+
<use>core_setup</use>
|
34 |
+
</connection>
|
35 |
+
</adminneworderemail_setup>
|
36 |
+
<adminneworderemail_write>
|
37 |
+
<connection>
|
38 |
+
<use>core_write</use>
|
39 |
+
</connection>
|
40 |
+
</adminneworderemail_write>
|
41 |
+
<adminneworderemail_read>
|
42 |
+
<connection>
|
43 |
+
<use>core_read</use>
|
44 |
+
</connection>
|
45 |
+
</adminneworderemail_read>
|
46 |
+
</resources>
|
47 |
+
<helpers>
|
48 |
+
<adminneworderemail>
|
49 |
+
<class>Openxcell_Adminneworderemail_Helper</class>
|
50 |
+
</adminneworderemail>
|
51 |
+
</helpers>
|
52 |
+
<template>
|
53 |
+
<email>
|
54 |
+
<sales_email_order_admin_email_template translate="label" module="adminneworderemail">
|
55 |
+
<label>New Order with Attachment Template</label>
|
56 |
+
<file>sales/order_new_admin_attachment.html</file>
|
57 |
+
<type>html</type>
|
58 |
+
</sales_email_order_admin_email_template>
|
59 |
+
</email>
|
60 |
+
</template>
|
61 |
+
</global>
|
62 |
+
<default>
|
63 |
+
<sales_email>
|
64 |
+
<order>
|
65 |
+
<enabled>1</enabled>
|
66 |
+
<admin_email_template>sales_email_order_admin_email_template</admin_email_template>
|
67 |
+
<identity>sales</identity>
|
68 |
+
</order>
|
69 |
+
</sales_email>
|
70 |
+
</default>
|
71 |
+
</config>
|
app/code/local/Openxcell/Adminneworderemail/etc/system.xml
ADDED
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<sections>
|
4 |
+
<sales_email>
|
5 |
+
<groups>
|
6 |
+
<order>
|
7 |
+
<fields>
|
8 |
+
<admin_email_notify translate="label comment">
|
9 |
+
<label>Send Email with Attachment</label>
|
10 |
+
<comment><![CDATA[separate by comma ","]]></comment>
|
11 |
+
<frontend_type>text</frontend_type>
|
12 |
+
<sort_order>100</sort_order>
|
13 |
+
<show_in_default>1</show_in_default>
|
14 |
+
</admin_email_notify>
|
15 |
+
|
16 |
+
<admin_email_type translate="label comment">
|
17 |
+
<label>Type of Attachment you need</label>
|
18 |
+
<frontend_type>select</frontend_type>
|
19 |
+
<source_model>adminneworderemail/options</source_model>
|
20 |
+
<sort_order>101</sort_order>
|
21 |
+
<show_in_default>1</show_in_default>
|
22 |
+
</admin_email_type>
|
23 |
+
|
24 |
+
<admin_email_template translate="label">
|
25 |
+
<label>Email Template for Attachments</label>
|
26 |
+
<frontend_type>select</frontend_type>
|
27 |
+
<source_model>adminhtml/system_config_source_email_template</source_model>
|
28 |
+
<sort_order>102</sort_order>
|
29 |
+
<show_in_default>1</show_in_default>
|
30 |
+
</admin_email_template>
|
31 |
+
</fields>
|
32 |
+
</order>
|
33 |
+
</groups>
|
34 |
+
</sales_email>
|
35 |
+
</sections>
|
36 |
+
</config>
|
app/etc/modules/Openxcell_Adminneworderemail.xml
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Openxcell_Adminneworderemail>
|
5 |
+
<active>true</active>
|
6 |
+
<codePool>local</codePool>
|
7 |
+
</Openxcell_Adminneworderemail>
|
8 |
+
</modules>
|
9 |
+
</config>
|
app/locale/en_US/template/email/sales/order_new_admin_attachment.html
ADDED
@@ -0,0 +1,105 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<!--@subject {{var store.getFrontendName()}}: Attachments... # {{var order.increment_id}} @-->
|
2 |
+
<!--@vars
|
3 |
+
{"store url=\"\"":"Store Url",
|
4 |
+
"skin url=\"images/logo_email.gif\" _area='frontend'":"Email Logo Image",
|
5 |
+
"htmlescape var=$order.getCustomerName()":"Customer Name",
|
6 |
+
"var store.getFrontendName()":"Store Name",
|
7 |
+
"store url=\"customer/account/\"":"Customer Account Url",
|
8 |
+
"var order.increment_id":"Order Id",
|
9 |
+
"var order.getCreatedAtFormated('long')":"Order Created At (datetime)",
|
10 |
+
"var order.getBillingAddress().format('html')":"Billing Address",
|
11 |
+
"var payment_html":"Payment Details",
|
12 |
+
"var order.getShippingAddress().format('html')":"Shipping Address",
|
13 |
+
"var order.getShippingDescription()":"Shipping Description",
|
14 |
+
"layout handle=\"sales_email_order_items\" order=$order":"Order Items Grid",
|
15 |
+
"var order.getEmailCustomerNote()":"Email Order Note"}
|
16 |
+
@-->
|
17 |
+
<!--@styles
|
18 |
+
body,td { color:#2f2f2f; font:11px/1.35em Verdana, Arial, Helvetica, sans-serif; }
|
19 |
+
@-->
|
20 |
+
|
21 |
+
<body style="background:#F6F6F6; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;">
|
22 |
+
<div style="background:#F6F6F6; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;">
|
23 |
+
<table cellspacing="0" cellpadding="0" border="0" width="100%">
|
24 |
+
<tr>
|
25 |
+
<td align="center" valign="top" style="padding:20px 0 20px 0">
|
26 |
+
<table bgcolor="#FFFFFF" cellspacing="0" cellpadding="10" border="0" width="650" style="border:1px solid #E0E0E0;">
|
27 |
+
<!-- [ header starts here] -->
|
28 |
+
<tr>
|
29 |
+
<td valign="top"><a href="{{store url=""}}"><img src="{{skin url="images/logo_email.gif" _area='frontend'}}" alt="{{var store.getFrontendName()}}" style="margin-bottom:10px;" border="0"/></a></td>
|
30 |
+
</tr>
|
31 |
+
<!-- [ middle starts here] -->
|
32 |
+
<tr>
|
33 |
+
<td valign="top">
|
34 |
+
<h1 style="font-size:22px; font-weight:normal; line-height:22px; margin:0 0 11px 0;"">Hello, Admin</h1>
|
35 |
+
<p style="font-size:12px; line-height:16px; margin:0;">
|
36 |
+
A order from {{htmlescape var=$order.getCustomerName()}.
|
37 |
+
</p>
|
38 |
+
<p style="font-size:12px; line-height:16px; margin:0;">Please go to admin and check it</p>
|
39 |
+
</tr>
|
40 |
+
<tr>
|
41 |
+
<td>
|
42 |
+
<h2 style="font-size:18px; font-weight:normal; margin:0;">Order #{{var order.increment_id}} <small>(placed on {{var order.getCreatedAtFormated('long')}})</small></h2>
|
43 |
+
</td>
|
44 |
+
</tr>
|
45 |
+
<tr>
|
46 |
+
<td>
|
47 |
+
<table cellspacing="0" cellpadding="0" border="0" width="650">
|
48 |
+
<thead>
|
49 |
+
<tr>
|
50 |
+
<th align="left" width="325" bgcolor="#EAEAEA" style="font-size:13px; padding:5px 9px 6px 9px; line-height:1em;">Billing Information:</th>
|
51 |
+
<th width="10"></th>
|
52 |
+
<th align="left" width="325" bgcolor="#EAEAEA" style="font-size:13px; padding:5px 9px 6px 9px; line-height:1em;">Payment Method:</th>
|
53 |
+
</tr>
|
54 |
+
</thead>
|
55 |
+
<tbody>
|
56 |
+
<tr>
|
57 |
+
<td valign="top" style="font-size:12px; padding:7px 9px 9px 9px; border-left:1px solid #EAEAEA; border-bottom:1px solid #EAEAEA; border-right:1px solid #EAEAEA;">
|
58 |
+
{{var order.getBillingAddress().format('html')}}
|
59 |
+
</td>
|
60 |
+
<td> </td>
|
61 |
+
<td valign="top" style="font-size:12px; padding:7px 9px 9px 9px; border-left:1px solid #EAEAEA; border-bottom:1px solid #EAEAEA; border-right:1px solid #EAEAEA;">
|
62 |
+
{{var payment_html}}
|
63 |
+
</td>
|
64 |
+
</tr>
|
65 |
+
</tbody>
|
66 |
+
</table>
|
67 |
+
<br/>
|
68 |
+
{{depend order.getIsNotVirtual()}}
|
69 |
+
<table cellspacing="0" cellpadding="0" border="0" width="650">
|
70 |
+
<thead>
|
71 |
+
<tr>
|
72 |
+
<th align="left" width="325" bgcolor="#EAEAEA" style="font-size:13px; padding:5px 9px 6px 9px; line-height:1em;">Shipping Information:</th>
|
73 |
+
<th width="10"></th>
|
74 |
+
<th align="left" width="325" bgcolor="#EAEAEA" style="font-size:13px; padding:5px 9px 6px 9px; line-height:1em;">Shipping Method:</th>
|
75 |
+
</tr>
|
76 |
+
</thead>
|
77 |
+
<tbody>
|
78 |
+
<tr>
|
79 |
+
<td valign="top" style="font-size:12px; padding:7px 9px 9px 9px; border-left:1px solid #EAEAEA; border-bottom:1px solid #EAEAEA; border-right:1px solid #EAEAEA;">
|
80 |
+
{{var order.getShippingAddress().format('html')}}
|
81 |
+
|
82 |
+
</td>
|
83 |
+
<td> </td>
|
84 |
+
<td valign="top" style="font-size:12px; padding:7px 9px 9px 9px; border-left:1px solid #EAEAEA; border-bottom:1px solid #EAEAEA; border-right:1px solid #EAEAEA;">
|
85 |
+
{{var order.getShippingDescription()}}
|
86 |
+
|
87 |
+
</td>
|
88 |
+
</tr>
|
89 |
+
</tbody>
|
90 |
+
</table>
|
91 |
+
<br/>
|
92 |
+
{{/depend}}
|
93 |
+
{{layout handle="sales_email_order_items" order=$order}}
|
94 |
+
<p style="font-size:12px; margin:0 0 10px 0">{{var order.getEmailCustomerNote()}}</p>
|
95 |
+
</td>
|
96 |
+
</tr>
|
97 |
+
<tr>
|
98 |
+
<td bgcolor="#EAEAEA" align="center" style="background:#EAEAEA; text-align:center;"><center><p style="font-size:12px; margin:0;">Thank you, <strong>{{var store.getFrontendName()}}</strong></p></center></td>
|
99 |
+
</tr>
|
100 |
+
</table>
|
101 |
+
</td>
|
102 |
+
</tr>
|
103 |
+
</table>
|
104 |
+
</div>
|
105 |
+
</body>
|
package.xml
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<package>
|
3 |
+
<name>Openxcell_Attachments</name>
|
4 |
+
<version>1.0.0</version>
|
5 |
+
<stability>stable</stability>
|
6 |
+
<license>Open Software License (OSL)</license>
|
7 |
+
<channel>community</channel>
|
8 |
+
<extends/>
|
9 |
+
<summary>New Order Email Attachment to Admin gives a power to admin to have a CSV or an XML file of the order along with new order email as an attachments.</summary>
|
10 |
+
<description>New Order Email Attachment to Admin is developed by OpenXcell. It is a free to download extension and as it is open source extension, anyone can use and customize it as per the requirements.
|
11 |
+

|
12 |
+
This extension allows admin to add Emails on which he want to send the New Order email with Attachment of CSV/XML file</description>
|
13 |
+
<notes>First Release</notes>
|
14 |
+
<authors><author><name>Jayneel</name><user>jayneel</user><email>jayneel@openxcell.com</email></author><author><name>Manthan</name><user>manthankvora</user><email>manthan@openxcelltechnolabs.com</email></author></authors>
|
15 |
+
<date>2013-12-13</date>
|
16 |
+
<time>09:28:36</time>
|
17 |
+
<contents><target name="magelocal"><dir name="Openxcell"><dir name="Adminneworderemail"><dir name="Helper"><file name="Data.php" hash="db4c81ad24e5188778fbd8d21a7a43fe"/></dir><dir name="Model"><file name="Observer.php" hash="34dee16316d819b8a8cc6423c7b68e9b"/><file name="Observer_csv.php" hash="f780119b7c038ec05e0ad60ba199fbbe"/><file name="Options.php" hash="aa85d2ba537c55ce4825e4f35cf3c1f0"/></dir><dir name="etc"><file name="config.xml" hash="6f46f16a301da38f6fa828123d880077"/><file name="system.xml" hash="5be126261df23835b62277350424376c"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Openxcell_Adminneworderemail.xml" hash="a86e027ce5af438d588f889ce54d425b"/></dir></target><target name="magelocale"><dir name="en_US"><dir name="template"><dir name="email"><dir name="sales"><file name="order_new_admin_attachment.html" hash="6314074a0a3c3cb85490a880eb37bfae"/></dir></dir></dir></dir></target></contents>
|
18 |
+
<compatible/>
|
19 |
+
<dependencies><required><php><min>5.0.0</min><max>6.0.0</max></php></required></dependencies>
|
20 |
+
</package>
|