public function approvedOrderPush() { $wsdlUrl = "https://zoffio.unicommerce.com/services/soap/uniware16.wsdl"; $wsdllUrl = "http://zoffio.unicommerce.com/services/soap/?version=1.6&facility=01"; $username = "******"; $password = "******"; $soapClient = new SoapClient($wsdlUrl, array('trace' => 1, 'exception' => 0)); $soapClient->__setLocation($wsdllUrl); $strWSSENS = "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"; $objSoapVarUser = new SoapVar($username, XSD_STRING, NULL, $strWSSENS, "UserName", $strWSSENS); $objSoapVarPass = new SoapVar($password, XSD_STRING, NULL, $strWSSENS, "Password", $strWSSENS); $objWSSEAuth = new clsWSSEAuth($objSoapVarUser, $objSoapVarPass); $objSoapVarWSSEAuth = new SoapVar($objWSSEAuth, SOAP_ENC_OBJECT, NULL, $strWSSENS, 'UsernameToken', $strWSSENS); $objWSSEToken = new clsWSSEToken($objSoapVarWSSEAuth); $objSoapVarWSSEToken = new SoapVar($objWSSEToken, SOAP_ENC_OBJECT, NULL, $strWSSENS, 'UsernameToken', $strWSSENS); $objSoapVarHeaderVal = new SoapVar($objSoapVarWSSEToken, SOAP_ENC_OBJECT, NULL, $strWSSENS, 'Security', $strWSSENS); $objSoapVarWSSEHeader = new SoapHeader($strWSSENS, 'Security', $objSoapVarHeaderVal, true); $soapClient->__setSoapHeaders(array($objSoapVarWSSEHeader)); $aorders = Mage::getModel('sales/order')->getCollection()->addFieldToFilter('status', 'approved')->addAttributeToSelect('increment_id'); foreach ($aorders as $aorder) { $address = array(); $saleorder = array(); $items = array(); $order = Mage::getModel('sales/order')->loadByIncrementId($aorder->getIncrementId()); $incrementId = $order->getIncrementId(); $customer_id = $order->getCustomerId(); $collection = Mage::getModel("customer/customer")->load($customer_id); $allitems = $order->getAllItems(); $totalqtyordered = $order->getTotalQtyOrdered(); $shippingAmount = $order->getShippingAmount(); $itemshipamt = $shippingAmount / $totalqtyordered; $payment_method_code = $order->getPayment()->getMethodInstance()->getCode(); $payment_title = "Payment Method: " . $order->getPayment()->getMethodInstance()->getTitle(); $payment_method_title = $order->getPayment()->getMethodInstance()->getTitle(); if ($payment_method_code == 'checkmo') { $shipmethodcode = "CHQ"; } else { $shipmethodcode = "STD"; } foreach ($allitems as $item) { $itemQty = (int) $item->getQtyOrdered(); if ($item->getPriceInclTax() > 0) { for ($i = 0; $i < $itemQty; $i++) { $icode = $item->getItemId() . $i; $icode = (int) $icode; $itemSku = $item->getSku(); $discountAmt = $item->getDiscountAmount() / $itemQty; $itemTPrice = $item->getPriceInclTax() + $itemshipamt - $discountAmt; $itemSPrice = $item->getPriceInclTax() - $discountAmt; $items[] = array('Code' => $icode, 'ItemSKU' => $itemSku, 'ShippingMethodCode' => $shipmethodcode, 'TotalPrice' => $itemTPrice, 'SellingPrice' => $itemSPrice, 'ShippingCharges' => $itemshipamt, 'Discount' => $discountAmt, 'PacketNumber' => '1'); } } } $verifypayment = 0; if ($payment_method_code == 'cashondelivery' || $payment_method_code == 'checkmo') { $chpmcode = 1; } else { $chpmcode = 0; } $email = $order->getCustomerEmail(); $billing_address = $order->getBillingAddress(); $billing_name = $billing_address->getName(); $billing_street = $billing_address->getStreet(); $billing_company = $billing_address->getCompany() . "."; $billing_str = $billing_street[0] . " " . $billing_street[1]; $billing_city = $billing_address->getCity(); $billingregion = Mage::getModel('directory/region')->load($billing_address->getRegionId()); $billing_state = explode("-", $billingregion->getCode()); $billing_Country = $billing_address->getCountryId(); $billing_postcode = $billing_address->getPostcode(); $billing_phone = $billing_address->getTelephone(); $address[] = array('Name' => $billing_name, 'AddressLine1' => $billing_company, 'AddressLine2' => $billing_str, 'City' => $billing_city, 'State' => $billing_state[1], 'Country' => $billing_Country, 'Pincode' => $billing_postcode, 'Phone' => $billing_phone, 'id' => '1'); $shipping_address = $order->getShippingAddress(); $shipping_name = $shipping_address->getName(); $shipping_street = $shipping_address->getStreet(); $shipping_company = $shipping_address->getCompany() . "."; $shipping_str = $shipping_street[0] . " " . $shipping_street[1]; $shipping_city = $shipping_address->getCity(); $shippingregion = Mage::getModel('directory/region')->load($shipping_address->getRegionId()); $shipping_state = explode("-", $shippingregion->getCode()); $shipping_Country = $shipping_address->getCountryId(); $shipping_postcode = $shipping_address->getPostcode(); $shipping_phone = $shipping_address->getTelephone(); $address[] = array('Name' => $shipping_name, 'AddressLine1' => $shipping_company, 'AddressLine2' => $shipping_str, 'City' => $shipping_city, 'State' => $shipping_state[1], 'Country' => $shipping_Country, 'Pincode' => $shipping_postcode, 'Phone' => $shipping_phone, 'id' => '2'); $saleorder = array('SaleOrder' => array('Code' => $incrementId, 'DisplayOrderCode' => $incrementId, 'CashOnDelivery' => $chpmcode, 'NotificationEmail' => $email, 'NotificationMobile' => $shipping_phone, 'AdditionalInfo' => $payment_title, 'Addresses' => array('Address' => $address), 'VerificationRequired' => $verifypayment, 'BillingAddress' => array('ref' => '1'), 'ShippingAddress' => array('ref' => '2'), 'SaleOrderItems' => array('SaleOrderItem' => $items), 'CustomFields' => array('CustomField' => array(array('name' => 'customerId', 'value' => $customer_id), array('name' => 'zoffioPaymentMethod', 'value' => $payment_method_code))))); $soapClient->CreateSaleOrder($saleorder); } }
} $shipping_address = $order->getShippingAddress(); $shipping_name = $shipping_address->getName(); $shipping_street = $shipping_address->getStreet(); $shipping_company = $shipping_address->getCompany(); $shipping_str = $shipping_street[0] . " " . $shipping_street[1]; $shipping_city = $shipping_address->getCity(); $shippingregion = Mage::getModel('directory/region')->load($shipping_address->getRegionId()); $shipping_state = explode("-", $shippingregion->getCode()); $shipping_Country = $shipping_address->getCountryId(); $shipping_postcode = $shipping_address->getPostcode(); $shipping_phone = $shipping_address->getTelephone(); if ($shipping_address->getCompany() != '') { $address[] = array('Name' => $shipping_name, 'AddressLine1' => $shipping_company, 'AddressLine2' => $shipping_str, 'City' => $shipping_city, 'State' => $shipping_state[1], 'Country' => $shipping_Country, 'Pincode' => $shipping_postcode, 'Phone' => $shipping_phone, 'id' => '2'); } else { $address[] = array('Name' => $shipping_name, 'AddressLine1' => $shipping_str, 'City' => $shipping_city, 'State' => $shipping_state[1], 'Country' => $shipping_Country, 'Pincode' => $shipping_postcode, 'Phone' => $shipping_phone, 'id' => '2'); } $saleorder = array('SaleOrder' => array('Code' => $incrementId, 'DisplayOrderCode' => $incrementId, 'CashOnDelivery' => $chpmcode, 'NotificationEmail' => $email, 'NotificationMobile' => $shipping_phone, 'AdditionalInfo' => $payment_title, 'Addresses' => array('Address' => $address), 'VerificationRequired' => $verifypayment, 'BillingAddress' => array('ref' => '1'), 'ShippingAddress' => array('ref' => '2'), 'SaleOrderItems' => array('SaleOrderItem' => $items), 'CustomFields' => array('CustomField' => array(array('name' => 'customerId', 'value' => $customer_id), array('name' => 'zoffioPaymentMethod', 'value' => $payment_method_code))))); echo "<pre />"; print_r($saleorder); echo "<pre>"; $result = $soapClient->CreateSaleOrder($saleorder); echo "<pre>"; print_r($result); //print_r($result); //echo "<td>"; print_r($result); //echo "</td>"; //echo "</tr>"; //} //echo "</table>"; //}
$address[] = array('Name' => $billing_name, 'AddressLine1' => $billing_company, 'AddressLine2' => $billing_str, 'City' => $billing_city, 'State' => $billing_state[1], 'Country' => $billing_Country, 'Pincode' => $billing_postcode, 'Phone' => $billing_phone, 'id' => '1'); $shipping_address = $order->getShippingAddress(); $shipping_name = $shipping_address->getName(); $shipping_street = $shipping_address->getStreet(); $shipping_company = $shipping_address->getCompany() . "."; $shipping_str = $shipping_street[0] . " " . $shipping_street[1]; $shipping_city = $shipping_address->getCity(); $shippingregion = Mage::getModel('directory/region')->load($shipping_address->getRegionId()); $shipping_state = explode("-", $shippingregion->getCode()); $shipping_Country = $shipping_address->getCountryId(); $shipping_postcode = $shipping_address->getPostcode(); $shipping_phone = $shipping_address->getTelephone(); if ($shipping_phone == '') { $shipping_phone = $shipping_address->getStd() . $shipping_address->getNewTelephoneno(); } $address[] = array('Name' => $shipping_name, 'AddressLine1' => $shipping_company, 'AddressLine2' => $shipping_str, 'City' => $shipping_city, 'State' => $shipping_state[1], 'Country' => $shipping_Country, 'Pincode' => $shipping_postcode, 'Phone' => $shipping_phone, 'id' => '2'); if ($shipping_address->getTelephone() != '') { $notify_mobile = $shipping_address->getTelephone(); } elseif ($billing_address->getTelephone() != '') { $notify_mobile = $billing_address->getTelephone(); } else { $notify_mobile = ""; } $saleorder = array('SaleOrder' => array('Code' => $incrementId, 'DisplayOrderCode' => $incrementId, 'CashOnDelivery' => $chpmcode, 'NotificationEmail' => $email, 'NotificationMobile' => $notify_mobile, 'AdditionalInfo' => $payment_title, 'Addresses' => array('Address' => $address), 'VerificationRequired' => $verifypayment, 'BillingAddress' => array('ref' => '1'), 'ShippingAddress' => array('ref' => '2'), 'SaleOrderItems' => array('SaleOrderItem' => $items), 'CustomFields' => array('CustomField' => array(array('name' => 'customerId', 'value' => $customer_id), array('name' => 'zoffioPaymentMethod', 'value' => $payment_method_code))))); echo "<pre>"; print_r($saleorder); exit; $pushdetails = $soapClient->CreateSaleOrder($saleorder); echo "<pre>"; print_r($pushdetails); }
public function instantAdminOrder(Varien_Event_Observer $observer) { //unicom api details try { $wsdlUrl = "https://zoffio.unicommerce.com/services/soap/uniware16.wsdl"; $wsdllUrl = "http://zoffio.unicommerce.com/services/soap/?version=1.6&facility=01"; $username = "******"; $password = "******"; $soapClient = new SoapClient($wsdlUrl, array('trace' => 1, 'exception' => 0)); $soapClient->__setLocation($wsdllUrl); $strWSSENS = "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"; $objSoapVarUser = new SoapVar($username, XSD_STRING, NULL, $strWSSENS, "UserName", $strWSSENS); $objSoapVarPass = new SoapVar($password, XSD_STRING, NULL, $strWSSENS, "Password", $strWSSENS); $objWSSEAuth = new clsWSSEAuth($objSoapVarUser, $objSoapVarPass); $objSoapVarWSSEAuth = new SoapVar($objWSSEAuth, SOAP_ENC_OBJECT, NULL, $strWSSENS, 'UsernameToken', $strWSSENS); $objWSSEToken = new clsWSSEToken($objSoapVarWSSEAuth); $objSoapVarWSSEToken = new SoapVar($objWSSEToken, SOAP_ENC_OBJECT, NULL, $strWSSENS, 'UsernameToken', $strWSSENS); $objSoapVarHeaderVal = new SoapVar($objSoapVarWSSEToken, SOAP_ENC_OBJECT, NULL, $strWSSENS, 'Security', $strWSSENS); $objSoapVarWSSEHeader = new SoapHeader($strWSSENS, 'Security', $objSoapVarHeaderVal, true); $soapClient->__setSoapHeaders(array($objSoapVarWSSEHeader)); //$lastOrderId = Mage::getSingleton('checkout/session')->getLastOrderId(); $lastOrderId = $observer->getOrder()->getId(); $order = Mage::getModel('sales/order')->load($lastOrderId); $incrementId = $order->getIncrementId(); $customer_id = $order->getCustomerId(); $collection = Mage::getModel("customer/customer")->load($customer_id); $resource = Mage::getSingleton('core/resource'); $read = $resource->getConnection('core_read'); $totalQtys = $read->fetchAll("select qty_ordered from sales_flat_order_item where order_id=" . $lastOrderId . " AND product_type != 'bundle' AND product_type != 'configurable'"); $bundletotalqty = 0; foreach ($totalQtys as $totalQty) { $bundletotalqty = $bundletotalqty + $totalQty['qty_ordered']; } $allitems = $order->getAllItems(); $totalqtyordered = $order->getTotalQtyOrdered(); $shippingAmount = $order->getShippingAmount(); $itemshipamt = $shippingAmount / $totalqtyordered; $payment_method_code = $order->getPayment()->getMethodInstance()->getCode(); $payment_title = "Payment Method: " . $order->getPayment()->getMethodInstance()->getTitle(); $payment_method_title = $order->getPayment()->getMethodInstance()->getTitle(); if ($payment_method_code == 'checkmo') { $shipmethodcode = "CHQ"; } else { $shipmethodcode = "STD"; } foreach ($allitems as $item) { if ($item->getProductType() == "bundle") { $resource = Mage::getSingleton('core/resource'); $read = $resource->getConnection('core_read'); $parentItemId = $item->getId(); $parentItemSku = $item->getSku(); $parentItemQty = $item->getQtyOrdered(); $parentItemName = $item->getName(); $parentPriceInclTax = $item->getPriceInclTax(); $parentDiscountAmount = $item->getDiscountAmount(); $discpercent = $parentDiscountAmount / $parentPriceInclTax; $simpleQtys = $read->fetchAll("select qty_ordered from sales_flat_order_item where parent_item_id=" . $parentItemId); $bundlefixqty = 0; foreach ($simpleQtys as $simpleQty) { $bundlefixqty = $bundlefixqty + $simpleQty['qty_ordered']; } $myBundleQty = $bundlefixqty * $parentItemQty; //$myitemshipamt = $shippingAmount/$myBundleQty; $myitemshipamt = $itemshipamt / $myBundleQty; $cntbundlefixqty = $bundlefixqty / $parentItemQty; $remainQty = 1; $salebulecombo = "Sku: " . $parentItemSku . " Name: " . $parentItemName; $saleorditemcomb[] = array('Identifier' => $parentItemId, 'Description' => $salebulecombo); //$bProduct = Mage::getModel('catalog/product')->load($item->getProductId()); continue; } elseif ($item->getProductType() == "simple" && $item->getParentItemId() != NULL && $item->getPrice() == "0.0000") { $itemQty = (int) $item->getQtyOrdered(); $resource = Mage::getSingleton('core/resource'); $read = $resource->getConnection('core_read'); $myitem = $read->fetchRow("select * from sales_flat_order_item where item_id=" . $item->getParentItemId()); $parentProductId = $myitem['product_id']; $childProductId = $item->getProductId(); $childPricers = $read->fetchRow("select * from catalog_product_bundle_selection where parent_product_id='" . $parentProductId . "' and product_id='" . $childProductId . "'"); $childproducts = $read->fetchAll("select count(DISTINCT(option_id)) as optionid from catalog_product_bundle_selection where parent_product_id='" . $parentProductId . "'"); //foreach($childproducts as $childproduct){ //echo $childproducts['option_id']; //exit; //} //echo "<pre>"; $bundchprods = $childproducts[0]['optionid']; //echo $parentProductId; exit; //echo count($childproducts); exit; //echo $bundlefixqty; exit; $childTaxAmount = $childPricers['selection_price_value'] * $childPricers['selection_qty'] * $percent / 100; $childTaxAmountSubTotal = $childTaxAmount * $item->getQtyOrdered(); $childTaxAmountTotal = $childTaxAmountTotal + $childTaxAmountSubTotal; //echo $childPricers['selection_qty']; if ($childPricers['selection_price_value'] > 0) { $bundlechildqty = 0; //for($i=0; $i<$itemQty; $i++){ for ($j = 0; $j < $bundchprods; $j++) { $bundlechildqty++; //} } } //echo $bundlechildqty; exit; //echo $bundlechildqty; exit; */ /*$childProductIds = $read->fetchAll("select `product_id`,`option_id`,`selection_price_value` from catalog_product_bundle_selection where is_default=1 and parent_product_id='".$parentProductId."'"); foreach($childProductIds as $childrs){ $totalrs = $read->fetchRow("select count(*) as `total` from catalog_product_bundle_selection where option_id='".$childrs[option_id]."'"); } */ if ($childPricers['selection_price_value'] > 0) { //for($j=0; $j<$bundlechildqty; $j++){ $j = 1; for ($i = 0; $i < $itemQty; $i++) { //for($j=0; $j<$childPricers['selection_qty']; $j++){ //for($k=0; $k<$childPricers['selection_qty']; $k++){ //$icode = $item->getItemId().$i; //$icode = (int)$icode; //$icode = $parentItemSku."@".$parentItemId; $icode = $parentItemId . $j . "-" . $remainQty . "@" . $parentItemSku; $itemSku = $item->getSku(); //echo $parentDiscountAmount; $itemqt = $bundlechildqty * $itemQty; $itemprice = $childPricers['selection_price_value']; //$discountAmt = $item->getDiscountAmount()/$itemQty; //$discountAmt = $parentDiscountAmount/$itemqt; $discountAmt = $discpercent * $itemprice; $itemTPrice = $childPricers['selection_price_value'] + $myitemshipamt - $discountAmt; $itemSPrice = $childPricers['selection_price_value'] - $discountAmt; $items[] = array('Code' => $icode, 'ItemSKU' => $itemSku, 'ShippingMethodCode' => $shipmethodcode, 'TotalPrice' => $itemTPrice, 'SellingPrice' => $itemSPrice, 'ShippingCharges' => $myitemshipamt, 'Discount' => $discountAmt, 'PacketNumber' => '1'); //} // } //$item->getParentItemId(); if ($j == $parentItemQty) { if ($item->getParentItemId() == $parentItemId) { if ($remainQty != $cntbundlefixqty) { $remainQty++; } else { $remainQty = 1; } } $j = 1; } else { $j++; } } } //exit; } elseif ($item->getProductType() == "simple" && $item->getParentItemId() != NULL) { $itemQty = (int) $item->getQtyOrdered(); $ActQty = $cntbundlefixqty / $parentItemQty; //$remainQty = $cntbundlefixqty - $remainQty; if ($item->getPriceInclTax() > 0) { $itembunInceId = $cntbundlefixqty - $bundlefixqty; $j = 1; //for($j=1; $j<=$itemQty; $j++){ for ($i = 1; $i <= $itemQty; $i++) { //$icode = $item->getItemId().$i; //$icode = (int)$icode; //$bundlefixqty = $itembunInceId - $i; //$icode = $parentItemSku."@".$parentItemId.$remainQty; $icode = $parentItemId . $j . "-" . $remainQty . "@" . $parentItemSku; $itemSku = $item->getSku(); $discountAmt = $item->getDiscountAmount() / $itemQty; $itemTPrice = $item->getPriceInclTax() + $myitemshipamt - $discountAmt; $itemSPrice = $item->getPriceInclTax() - $discountAmt; $items[] = array('Code' => $icode, 'ItemSKU' => $itemSku, 'ShippingMethodCode' => $shipmethodcode, 'TotalPrice' => $itemTPrice, 'SellingPrice' => $itemSPrice, 'ShippingCharges' => $myitemshipamt, 'Discount' => $discountAmt, 'PacketNumber' => '1'); //$remainQty++; if ($j == $parentItemQty) { if ($item->getParentItemId() == $parentItemId) { if ($remainQty != $cntbundlefixqty) { $remainQty++; } else { $remainQty = 1; } } $j = 1; } else { $j++; } } //} //$remainQty = $j; } } else { $itemQty = (int) $item->getQtyOrdered(); if ($item->getPriceInclTax() > 0) { for ($i = 1; $i <= $itemQty; $i++) { $icode = $item->getItemId() . $i; $icode = (int) $icode; $itemSku = $item->getSku(); $discountAmt = $item->getDiscountAmount() / $itemQty; $itemTPrice = $item->getPriceInclTax() + $itemshipamt - $discountAmt; $itemSPrice = $item->getPriceInclTax() - $discountAmt; $items[] = array('Code' => $icode, 'ItemSKU' => $itemSku, 'ShippingMethodCode' => $shipmethodcode, 'TotalPrice' => $itemTPrice, 'SellingPrice' => $itemSPrice, 'ShippingCharges' => $itemshipamt, 'Discount' => $discountAmt, 'PacketNumber' => '1'); } } } } $verifypayment = 0; if ($payment_method_code == 'cashondelivery' || $payment_method_code == 'checkmo') { $chpmcode = 1; } else { $chpmcode = 0; } $email = $order->getCustomerEmail(); $billing_address = $order->getBillingAddress(); $billing_name = $billing_address->getName(); $billing_street = $billing_address->getStreet(); $billing_company = $billing_address->getCompany(); $billing_str = $billing_street[0] . " " . $billing_street[1]; $billing_city = $billing_address->getCity(); $billingregion = Mage::getModel('directory/region')->load($billing_address->getRegionId()); $billing_state = explode("-", $billingregion->getCode()); $billing_Country = $billing_address->getCountryId(); $billing_postcode = $billing_address->getPostcode(); $billing_phone = $billing_address->getTelephone(); if ($billing_address->getCompany() != '') { $address[] = array('Name' => $billing_name, 'AddressLine1' => $billing_company, 'AddressLine2' => $billing_str, 'City' => $billing_city, 'State' => $billing_state[1], 'Country' => $billing_Country, 'Pincode' => $billing_postcode, 'Phone' => $billing_phone, 'id' => '1'); } else { $address[] = array('Name' => $billing_name, 'AddressLine1' => $billing_str, 'City' => $billing_city, 'State' => $billing_state[1], 'Country' => $billing_Country, 'Pincode' => $billing_postcode, 'Phone' => $billing_phone, 'id' => '1'); } $shipping_address = $order->getShippingAddress(); $shipping_name = $shipping_address->getName(); $shipping_street = $shipping_address->getStreet(); $shipping_company = $shipping_address->getCompany(); $shipping_str = $shipping_street[0] . " " . $shipping_street[1]; $shipping_city = $shipping_address->getCity(); $shippingregion = Mage::getModel('directory/region')->load($shipping_address->getRegionId()); $shipping_state = explode("-", $shippingregion->getCode()); $shipping_Country = $shipping_address->getCountryId(); $shipping_postcode = $shipping_address->getPostcode(); $shipping_phone = $shipping_address->getTelephone(); if ($shipping_address->getCompany() != '') { $address[] = array('Name' => $shipping_name, 'AddressLine1' => $shipping_company, 'AddressLine2' => $shipping_str, 'City' => $shipping_city, 'State' => $shipping_state[1], 'Country' => $shipping_Country, 'Pincode' => $shipping_postcode, 'Phone' => $shipping_phone, 'id' => '2'); } else { $address[] = array('Name' => $shipping_name, 'AddressLine1' => $shipping_str, 'City' => $shipping_city, 'State' => $shipping_state[1], 'Country' => $shipping_Country, 'Pincode' => $shipping_postcode, 'Phone' => $shipping_phone, 'id' => '2'); } $cFormProvided = '0'; if ($order->getCForm() == 1) { $cFormProvided = '1'; } $saleorder = array('SaleOrder' => array('Code' => $incrementId, 'DisplayOrderCode' => $incrementId, 'CashOnDelivery' => $chpmcode, 'NotificationEmail' => $email, 'NotificationMobile' => $shipping_phone, 'AdditionalInfo' => $payment_title, 'Addresses' => array('Address' => $address), 'VerificationRequired' => $verifypayment, 'CFormProvided' => $cFormProvided, 'BillingAddress' => array('ref' => '1'), 'ShippingAddress' => array('ref' => '2'), 'SaleOrderItems' => array('SaleOrderItem' => $items), 'CustomFields' => array('CustomField' => array(array('name' => 'customerId', 'value' => $customer_id), array('name' => 'zoffioPaymentMethod', 'value' => $payment_method_code))))); // echo "<pre>"; //print_r($saleorder); //exit; $soapClient->CreateSaleOrder($saleorder); } catch (Exception $e) { } }
public function instantAdminOrder(Varien_Event_Observer $observer) { //unicom api details $wsdlUrl = Mage::getStoreConfig('unicom_options/unigroup/uniurl'); $wsdllUrl = Mage::getStoreConfig('unicom_options/unigroup/unilurl'); $uniUname = Mage::getStoreConfig('unicom_options/unigroup/uniusername'); $uniPass = Mage::getStoreConfig('unicom_options/unigroup/unipass'); echo "qaws"; exit; $soapClient = new SoapClient($wsdlUrl, array('trace' => 1, 'exception' => 0)); $soapClient->__setLocation($wsdllUrl); $strWSSENS = "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"; $objSoapVarUser = new SoapVar($username, XSD_STRING, NULL, $strWSSENS, "UserName", $strWSSENS); $objSoapVarPass = new SoapVar($password, XSD_STRING, NULL, $strWSSENS, "Password", $strWSSENS); $objWSSEAuth = new clsWSSEAuth($objSoapVarUser, $objSoapVarPass); $objSoapVarWSSEAuth = new SoapVar($objWSSEAuth, SOAP_ENC_OBJECT, NULL, $strWSSENS, 'UsernameToken', $strWSSENS); $objWSSEToken = new clsWSSEToken($objSoapVarWSSEAuth); $objSoapVarWSSEToken = new SoapVar($objWSSEToken, SOAP_ENC_OBJECT, NULL, $strWSSENS, 'UsernameToken', $strWSSENS); $objSoapVarHeaderVal = new SoapVar($objSoapVarWSSEToken, SOAP_ENC_OBJECT, NULL, $strWSSENS, 'Security', $strWSSENS); $objSoapVarWSSEHeader = new SoapHeader($strWSSENS, 'Security', $objSoapVarHeaderVal, true); $soapClient->__setSoapHeaders(array($objSoapVarWSSEHeader)); //$lastOrderId = Mage::getSingleton('checkout/session')->getLastOrderId(); $lastOrderId = $observer->getOrder()->getId(); $order = Mage::getModel('sales/order')->load($lastOrderId); $incrementId = $order->getIncrementId(); $customer_id = $order->getCustomerId(); $collection = Mage::getModel("customer/customer")->load($customer_id); $allitems = $order->getAllItems(); $totalqtyordered = $order->getTotalQtyOrdered(); $shippingAmount = $order->getShippingAmount(); $itemshipamt = $shippingAmount / $totalqtyordered; foreach ($allitems as $item) { $itemQty = (int) $item->getQtyOrdered(); for ($i = 0; $i < $itemQty; $i++) { $icode = $item->getItemId() . $i; $icode = (int) $icode; $itemSku = $item->getSku(); $discountAmt = $item->getDiscountAmount() / $itemQty; $itemTPrice = $item->getOriginalPrice() + $itemshipamt - $discountAmt; $itemSPrice = $item->getOriginalPrice(); $items[] = array('Code' => $icode, 'ItemSKU' => $itemSku, 'ShippingMethodCode' => 'STD', 'TotalPrice' => $itemTPrice, 'SellingPrice' => $itemSPrice, 'ShippingCharges' => $itemshipamt, 'Discount' => $discountAmt); } } $payment_method_code = $order->getPayment()->getMethodInstance()->getCode(); $payment_title = "Payment Method: " . $order->getPayment()->getMethodInstance()->getTitle(); $payment_method_title = $order->getPayment()->getMethodInstance()->getTitle(); if ($payment_method_code == 'cashondelivery' || $payment_method_code == 'checkmo') { $chpmcode = 1; $verifypayment = 1; } else { $chpmcode = 0; $verifypayment = 0; } $verify = $collection->getIsVerified(); if ($verify == 335) { $paycodes = array("cashondelivery"); $orderCode = $order->getPayment()->getMethodInstance()->getCode(); if (in_array($orderCode, $paycodes)) { $verifypayment = 0; } } $billing_address = $order->getBillingAddress(); $billing_name = $billing_address->getName(); $billing_street = $billing_address->getStreet(); $billing_str = $billing_street[0]; $billing_city = $billing_address->getCity(); $billingregion = Mage::getModel('directory/region')->load($billing_address->getRegionId()); $billing_state = explode("-", $billingregion->getCode()); $billing_Country = $billing_address->getCountryId(); $billing_postcode = $billing_address->getPostcode(); $billing_phone = $billing_address->getTelephone(); $address[] = array('Name' => $billing_name, 'AddressLine1' => $billing_str, 'City' => $billing_city, 'State' => $billing_state[1], 'Country' => $billing_Country, 'Pincode' => $billing_postcode, 'Phone' => $billing_phone, 'id' => '1'); $shipping_address = $order->getShippingAddress(); $shipping_name = $shipping_address->getName(); $shipping_street = $shipping_address->getStreet(); $shipping_str = $shipping_street[0]; $shipping_city = $shipping_address->getCity(); $shippingregion = Mage::getModel('directory/region')->load($shipping_address->getRegionId()); $shipping_state = explode("-", $shippingregion->getCode()); $shipping_Country = $shipping_address->getCountryId(); $shipping_postcode = $shipping_address->getPostcode(); $shipping_phone = $shipping_address->getTelephone(); $address[] = array('Name' => $shipping_name, 'AddressLine1' => $shipping_str, 'City' => $shipping_city, 'State' => $shipping_state[1], 'Country' => $shipping_Country, 'Pincode' => $shipping_postcode, 'Phone' => $shipping_phone, 'id' => '2'); $saleorder = array('SaleOrder' => array('Code' => $incrementId, 'DisplayOrderCode' => $incrementId, 'CashOnDelivery' => $chpmcode, 'AdditionalInfo' => $payment_title, 'Addresses' => array('Address' => $address), 'VerificationRequired' => $verifypayment, 'BillingAddress' => array('ref' => '1'), 'ShippingAddress' => array('ref' => '2'), 'SaleOrderItems' => array('SaleOrderItem' => $items), 'CustomFields' => array('CustomField' => array('name' => 'customerId', 'value' => $customer_id)))); $soapClient->CreateSaleOrder($saleorder); }
public function _approve($post_val, $quote) { $paymentMethod = $post_val['payment_option']; if ($paymentMethod != "") { $shippingAddress = $quote->getShippingAddress(); $shippingAddress->setPaymentMethod($paymentMethod); // Set the payment method $quote->getPayment()->importData(array('method' => $paymentMethod)); #Mage::Log("importing payemnt method " . $paymentMethod); } $quote->setIsActive(1); $quote->setApprovalStatus(2); $quote->collectTotals(); $quote->save(); /* cause this quote to be approved - i.e. convert to order But since all order conversion code assumes it is for the logged in user of this session, fake some */ /* $approverBillingAddress = Mage::getSingleton('customer/session')->getCustomer()->getDefaultBillingAddress(); if(!empty($approverBillingAddress)){ $quoteBillingAddress = $quote->getBillingAddress(); $quoteBillingAddress->importCustomerAddress($approverBillingAddress); $quoteBillingAddress->save(); }*/ $result = array(); $one_page = $this->getOnepage(); $me = $one_page->getCustomerSession()->getCustomer(); Mage::getSingleton('checkout/session')->setQuote($quote); Mage::getSingleton('checkout/session')->setQuoteId($quote->getId()); $one_page->setQuote($quote); //$customer = Mage::getModel('customer/customer') // ->load($quote->getCustomerId()); #Mage::Log("setting customer id to : " . $quote->getCustomerId()); Mage::getSingleton('core/session')->setQuoteCustomer($quote->getCustomerId()); $quote_customer_address = Mage::getModel('customer/customer')->load($quote->getCustomerId())->getData(); Mage::getSingleton('core/session')->setQuoteCustomerData($quote_customer_address); //$one_page->getCustomerSession()->setCustomer($customer); $this->getOnepage()->saveOrder(); $redirectUrl = $this->getOnepage()->getCheckout()->getRedirectUrl(); $this->getOnepage()->getQuote()->save(); /* invoice this order */ $order = Mage::getModel('sales/order')->loadByAttribute('quote_id', $quote->getId()); if (!isset($redirectUrl)) { if ($order) { #Mage::Log("sales order created ... creating invoices"); $qty = array(); foreach ($order->getAllItems() as $item) { $qty[$item->getId()] = $item->getQtyOrdered(); $item->setQtyToInvoice($item->getQtyOrdered()); #Mage::Log("item " . $item->getId() . " qty " . $item->getQtyOrdered()); } // $invoice = Mage::getModel('sales/service_order', $order)->prepareInvoice($qty); // if ($invoice) { /* $comment = "Approved by " . $me->getName(); $invoice->addComment($comment, false, true); $invoice->setRequestedCaptureCase(Mage_Sales_Model_Order_Invoice::NOT_CAPTURE); $invoice->register(); $invoice->getOrder()->setCustomerNoteNotify(true); $invoice->getOrder()->setIsInProcess(true); /* save invoice and order in a transaction */ /* $transactionSave = Mage::getModel('core/resource_transaction') ->addObject($invoice) ->addObject($invoice->getOrder()); $transactionSave->save(); */ $one_page->getCustomerSession()->addSuccess($this->__('You have approved order ' . $order->getIncrementId())); // } } else { Mage::Log("sales order not found ... NOT creating invoices"); } } if (isset($redirectUrl)) { $redirectUrl1 = $redirectUrl; } $quote_customer = Mage::getSingleton('core/session')->getQuoteCustomer(); $quote_customer_data = Mage::getSingleton('core/session')->getQuoteCustomerData(); $order->setCustomerId($quote_customer); $quote->setCustomerId($quote_customer); $order->setCustomerEmail($quote_customer_data['email']); $quote->setCustomerEmail($quote_customer_data['email']); $order->setCustomerFirstname($quote_customer_data['firstname']); $quote->setCustomerFirstname($quote_customer_data['firstname']); $order->setCustomerLastname($quote_customer_data['lastname']); $quote->setCustomerLastname($quote_customer_data['lastname']); $order->save(); $quote->save(); // if (isset($redirectUrl)) { // $redirectUrl1 = $redirectUrl; //Mage::app()->getResponse()->setRedirect($redirectUrl1); // }else{ // $this->_redirect('*/*/approve'); //} $incrementId = Mage::getSingleton('checkout/session')->getLastRealOrderId(); $_order = Mage::getModel('sales/order')->loadByIncrementId($incrementId); $_order->sendNewOrderEmail(); $testdemo = true; if ($testdemo == false) { die; $_order->setState(Mage_Sales_Model_Order::STATE_APPROVED, true); $comment = "Approved by " . $me->getName(); $history = $_order->addStatusHistoryComment($comment, false); $history->setIsCustomerNotified(false); $_order->save(); if ($_order->getState() == Mage_Sales_Model_Order::STATE_APPROVED) { $wsdlUrl = "https://zoffio.unicommerce.com/services/soap/uniware16.wsdl"; $wsdllUrl = "http://zoffio.unicommerce.com/services/soap/?version=1.6&facility=01"; $username = "******"; $password = "******"; $soapClient = new SoapClient($wsdlUrl, array('trace' => 1, 'exception' => 0)); $soapClient->__setLocation($wsdllUrl); $strWSSENS = "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"; $objSoapVarUser = new SoapVar($username, XSD_STRING, NULL, $strWSSENS, "UserName", $strWSSENS); $objSoapVarPass = new SoapVar($password, XSD_STRING, NULL, $strWSSENS, "Password", $strWSSENS); $objWSSEAuth = new clsWSSEAuth($objSoapVarUser, $objSoapVarPass); $objSoapVarWSSEAuth = new SoapVar($objWSSEAuth, SOAP_ENC_OBJECT, NULL, $strWSSENS, 'UsernameToken', $strWSSENS); $objWSSEToken = new clsWSSEToken($objSoapVarWSSEAuth); $objSoapVarWSSEToken = new SoapVar($objWSSEToken, SOAP_ENC_OBJECT, NULL, $strWSSENS, 'UsernameToken', $strWSSENS); $objSoapVarHeaderVal = new SoapVar($objSoapVarWSSEToken, SOAP_ENC_OBJECT, NULL, $strWSSENS, 'Security', $strWSSENS); $objSoapVarWSSEHeader = new SoapHeader($strWSSENS, 'Security', $objSoapVarHeaderVal, true); $soapClient->__setSoapHeaders(array($objSoapVarWSSEHeader)); $incrementId = $_order->getIncrementId(); $customer_id = $_order->getCustomerId(); $collection = Mage::getModel("customer/customer")->load($customer_id); $allitems = $_order->getAllItems(); $totalqtyordered = $_order->getTotalQtyOrdered(); $shippingAmount = $_order->getShippingAmount(); $itemshipamt = $shippingAmount / $totalqtyordered; $payment_method_code = $_order->getPayment()->getMethodInstance()->getCode(); $payment_title = "Payment Method: " . $_order->getPayment()->getMethodInstance()->getTitle(); $shipmethodcode = "STD"; foreach ($allitems as $item) { /*$itemQty = (int)$item->getQtyOrdered(); if($item->getPriceInclTax() > 0) { for($i=0; $i<$itemQty; $i++){ $icode = $item->getItemId().$i; $icode = (int)$icode; $itemSku = $item->getSku(); $discountAmt = $item->getDiscountAmount()/$itemQty; $itemTPrice = $item->getPriceInclTax() + $itemshipamt - $discountAmt; $itemSPrice = $item->getPriceInclTax() - $discountAmt; $items[] = array('Code'=>$icode,'ItemSKU'=>$itemSku,'ShippingMethodCode'=>$shipmethodcode,'TotalPrice'=>$itemTPrice,'SellingPrice'=>$itemSPrice,'ShippingCharges'=>$itemshipamt,'Discount'=>$discountAmt,'PacketNumber'=>'1'); } } */ if ($item->getProductType() == "bundle") { $resource = Mage::getSingleton('core/resource'); $read = $resource->getConnection('core_read'); $parentItemId = $item->getId(); $parentItemSku = $item->getSku(); $parentItemQty = $item->getQtyOrdered(); $parentItemName = $item->getName(); $parentPriceInclTax = $item->getPriceInclTax(); $parentDiscountAmount = $item->getDiscountAmount(); $discpercent = $parentDiscountAmount / $parentPriceInclTax; $simpleQtys = $read->fetchAll("select qty_ordered from sales_flat_order_item where parent_item_id=" . $parentItemId); $bundlefixqty = 0; foreach ($simpleQtys as $simpleQty) { $bundlefixqty = $bundlefixqty + $simpleQty['qty_ordered']; } $myBundleQty = $bundlefixqty * $parentItemQty; //$myitemshipamt = $shippingAmount/$myBundleQty; $myitemshipamt = $itemshipamt / $myBundleQty; $cntbundlefixqty = $bundlefixqty / $parentItemQty; $remainQty = 1; $salebulecombo = "Sku: " . $parentItemSku . " Name: " . $parentItemName; $saleorditemcomb[] = array('Identifier' => $parentItemId, 'Description' => $salebulecombo); //$bProduct = Mage::getModel('catalog/product')->load($item->getProductId()); continue; } elseif ($item->getProductType() == "simple" && $item->getParentItemId() != NULL && $item->getPrice() == "0.0000") { $itemQty = (int) $item->getQtyOrdered(); $resource = Mage::getSingleton('core/resource'); $read = $resource->getConnection('core_read'); $myitem = $read->fetchRow("select * from sales_flat_order_item where item_id=" . $item->getParentItemId()); $parentProductId = $myitem['product_id']; $childProductId = $item->getProductId(); $childPricers = $read->fetchRow("select * from catalog_product_bundle_selection where parent_product_id='" . $parentProductId . "' and product_id='" . $childProductId . "'"); $childproducts = $read->fetchAll("select count(DISTINCT(option_id)) as optionid from catalog_product_bundle_selection where parent_product_id='" . $parentProductId . "'"); //foreach($childproducts as $childproduct){ //echo $childproducts['option_id']; //exit; //} //echo "<pre>"; $bundchprods = $childproducts[0]['optionid']; //echo $parentProductId; exit; //echo count($childproducts); exit; //echo $bundlefixqty; exit; $childTaxAmount = $childPricers['selection_price_value'] * $childPricers['selection_qty'] * $percent / 100; $childTaxAmountSubTotal = $childTaxAmount * $item->getQtyOrdered(); $childTaxAmountTotal = $childTaxAmountTotal + $childTaxAmountSubTotal; //echo $childPricers['selection_qty']; if ($childPricers['selection_price_value'] > 0) { $bundlechildqty = 0; //for($i=0; $i<$itemQty; $i++){ for ($j = 0; $j < $bundchprods; $j++) { $bundlechildqty++; //} } } //echo $bundlechildqty; exit; //echo $bundlechildqty; exit; */ /*$childProductIds = $read->fetchAll("select `product_id`,`option_id`,`selection_price_value` from catalog_product_bundle_selection where is_default=1 and parent_product_id='".$parentProductId."'"); foreach($childProductIds as $childrs){ $totalrs = $read->fetchRow("select count(*) as `total` from catalog_product_bundle_selection where option_id='".$childrs[option_id]."'"); } */ if ($childPricers['selection_price_value'] > 0) { //for($j=0; $j<$bundlechildqty; $j++){ $j = 1; for ($i = 0; $i < $itemQty; $i++) { //for($j=0; $j<$childPricers['selection_qty']; $j++){ //for($k=0; $k<$childPricers['selection_qty']; $k++){ //$icode = $item->getItemId().$i; //$icode = (int)$icode; //$icode = $parentItemSku."@".$parentItemId; $icode = $parentItemId . $j . "-" . $remainQty . "@" . $parentItemSku; $itemSku = $item->getSku(); //echo $parentDiscountAmount; $itemqt = $bundlechildqty * $itemQty; $itemprice = $childPricers['selection_price_value']; //$discountAmt = $item->getDiscountAmount()/$itemQty; //$discountAmt = $parentDiscountAmount/$itemqt; $discountAmt = $discpercent * $itemprice; $itemTPrice = $childPricers['selection_price_value'] + $myitemshipamt - $discountAmt; $itemSPrice = $childPricers['selection_price_value'] - $discountAmt; $items[] = array('Code' => $icode, 'ItemSKU' => $itemSku, 'ShippingMethodCode' => $shipmethodcode, 'TotalPrice' => $itemTPrice, 'SellingPrice' => $itemSPrice, 'ShippingCharges' => $myitemshipamt, 'Discount' => $discountAmt, 'PacketNumber' => '1'); //} // } //$item->getParentItemId(); if ($j == $parentItemQty) { if ($item->getParentItemId() == $parentItemId) { if ($remainQty != $cntbundlefixqty) { $remainQty++; } else { $remainQty = 1; } } $j = 1; } else { $j++; } } } //exit; } elseif ($item->getProductType() == "simple" && $item->getParentItemId() != NULL) { $itemQty = (int) $item->getQtyOrdered(); $ActQty = $cntbundlefixqty / $parentItemQty; //$remainQty = $cntbundlefixqty - $remainQty; if ($item->getPriceInclTax() > 0) { $itembunInceId = $cntbundlefixqty - $bundlefixqty; $j = 1; //for($j=1; $j<=$itemQty; $j++){ for ($i = 1; $i <= $itemQty; $i++) { //$icode = $item->getItemId().$i; //$icode = (int)$icode; //$bundlefixqty = $itembunInceId - $i; //$icode = $parentItemSku."@".$parentItemId.$remainQty; $icode = $parentItemId . $j . "-" . $remainQty . "@" . $parentItemSku; $itemSku = $item->getSku(); $discountAmt = $item->getDiscountAmount() / $itemQty; $itemTPrice = $item->getPriceInclTax() + $myitemshipamt - $discountAmt; $itemSPrice = $item->getPriceInclTax() - $discountAmt; $items[] = array('Code' => $icode, 'ItemSKU' => $itemSku, 'ShippingMethodCode' => $shipmethodcode, 'TotalPrice' => $itemTPrice, 'SellingPrice' => $itemSPrice, 'ShippingCharges' => $myitemshipamt, 'Discount' => $discountAmt, 'PacketNumber' => '1'); //$remainQty++; if ($j == $parentItemQty) { if ($item->getParentItemId() == $parentItemId) { if ($remainQty != $cntbundlefixqty) { $remainQty++; } else { $remainQty = 1; } } $j = 1; } else { $j++; } } //} //$remainQty = $j; } } else { $itemQty = (int) $item->getQtyOrdered(); if ($item->getPriceInclTax() > 0) { for ($i = 1; $i <= $itemQty; $i++) { $icode = $item->getItemId() . $i; $icode = (int) $icode; $itemSku = $item->getSku(); $discountAmt = $item->getDiscountAmount() / $itemQty; $itemTPrice = $item->getPriceInclTax() + $itemshipamt - $discountAmt; $itemSPrice = $item->getPriceInclTax() - $discountAmt; $items[] = array('Code' => $icode, 'ItemSKU' => $itemSku, 'ShippingMethodCode' => $shipmethodcode, 'TotalPrice' => $itemTPrice, 'SellingPrice' => $itemSPrice, 'ShippingCharges' => $itemshipamt, 'Discount' => $discountAmt, 'PacketNumber' => '1'); } } } } $verifypayment = 0; $verify2 = 1; $chpmcode = 0; $email = $_order->getCustomerEmail(); $billing_address = $_order->getBillingAddress(); $billing_name = $billing_address->getName(); $billing_street = $billing_address->getStreet(); $billing_company = $billing_address->getCompany() . "."; $billing_str = $billing_street[0] . " " . $billing_street[1]; $billing_city = $billing_address->getCity(); $billingregion = Mage::getModel('directory/region')->load($billing_address->getRegionId()); $billing_state = explode("-", $billingregion->getCode()); $billing_Country = $billing_address->getCountryId(); $billing_postcode = $billing_address->getPostcode(); $billing_phone = $billing_address->getTelephone(); $address[] = array('Name' => $billing_name, 'AddressLine1' => $billing_company, 'AddressLine2' => $billing_str, 'City' => $billing_city, 'State' => $billing_state[1], 'Country' => $billing_Country, 'Pincode' => $billing_postcode, 'Phone' => $billing_phone, 'id' => '1'); $shipping_address = $_order->getShippingAddress(); $shipping_name = $shipping_address->getName(); $shipping_street = $shipping_address->getStreet(); $shipping_company = $shipping_address->getCompany() . "."; $shipping_str = $shipping_street[0] . " " . $shipping_street[1]; $shipping_city = $shipping_address->getCity(); $shippingregion = Mage::getModel('directory/region')->load($shipping_address->getRegionId()); $shipping_state = explode("-", $shippingregion->getCode()); $shipping_Country = $shipping_address->getCountryId(); $shipping_postcode = $shipping_address->getPostcode(); $shipping_phone = $shipping_address->getTelephone(); $address[] = array('Name' => $shipping_name, 'AddressLine1' => $shipping_company, 'AddressLine2' => $shipping_str, 'City' => $shipping_city, 'State' => $shipping_state[1], 'Country' => $shipping_Country, 'Pincode' => $shipping_postcode, 'Phone' => $shipping_phone, 'id' => '2'); $saleorder = array('SaleOrder' => array('Code' => $incrementId, 'DisplayOrderCode' => $incrementId, 'CashOnDelivery' => $chpmcode, 'NotificationEmail' => $email, 'NotificationMobile' => $shipping_phone, 'AdditionalInfo' => $payment_title, 'Addresses' => array('Address' => $address), 'VerificationRequired' => $verifypayment, 'BillingAddress' => array('ref' => '1'), 'ShippingAddress' => array('ref' => '2'), 'SaleOrderItems' => array('SaleOrderItem' => $items), 'CustomFields' => array('CustomField' => array(array('name' => 'customerId', 'value' => $customer_id), array('name' => 'zoffioPaymentMethod', 'value' => $payment_method_code))))); $soapClient->CreateSaleOrder($saleorder); } } Mage::getSingleton("core/session")->setApproveOrderID($quote->getId()); $this->_redirect('*/order/success', array('orderid' => $incrementId)); //$one_page->getCustomerSession()->setCustomer($me); Mage::Log('Firstname: ' . $quote_customer_data['firstname'] . 'LastName: ' . $quote_customer_data['lastname'] . 'Email: ' . $quote_customer_data['email']); //Mage::app()->getResponse()->setRedirect($redirectUrl1); //$this->_redirect('*/*/approve'); Mage::Log("LEAVE : makeapproveAction"); }