Jump to content

aveeva

Members
  • Content Count

    89
  • Joined

  • Last visited

Everything posted by aveeva

  1. I am using Magento (Ver 1.9.x) If i try with my localhost success url like, http://192.168.1.65/magento/index.php/checkout/onepage/success/ and return success message with order id. if i try with live, success url like, https://abc.in/payubiz/redirect/success/ success page like blank page. How to solve the issue? Code : https://github.com/ZusZus/Payubiz
  2. There are lot of installation methods available, which one is best and help to upgrade future versions as well as extension. Centos 7, Nginx
  3. Finally done with below script : <?php class Gta_MerchantNotification_Model_Observer { public function merchantremainder($Observer) { $order = $Observer->getEvent()->getOrder(); $order_details = $order->getAllVisibleItems(); $itemData = array(); foreach ($order_details as $list) { $incrementid = $order->getIncrementId(); $sku = $list->getsku(); $name = $list->getName(); $price = $list->getPrice(); $Qty = $list->getQtyOrdered(); // $this->sendMailbasedOnSku($sku); $message = "<tr> <!-- <td>$incrementid</td> --> <td>$sku</td> <td>$name</td> <td>$price</td> <td>$Qty</td> </tr>"; $itemData[$list->getId()] = $message; } $finalMessage = "<p>Order Id : $incrementid</p> <table border='1'> <tr> <!-- <th>Id</th> --> <th>Sku</th> <th>Product name</th> <th>Price</th> <th>Qty Ordered</th> </tr>"; if (!empty($itemData)) { foreach ($itemData as $data) { $finalMessage .= $data; } $finalMessage .= "</table>"; // $this->sendMail($finalMessage); $this->sendMailbasedOnSku($finalMessage,$sku); } } public function sendMail($message) { $body = "$message"; $emailTemplate = Mage::getModel('core/email'); $emailTemplate->setFromName('Test mail'); $emailTemplate->setBody($body); $emailTemplate->setSubject("Custom Email from observer"); $emailTemplate->setType('html'); // $emailTemplate->setToEmail('abc@gmail.com'); if($sku == '2') { $emailTemplate->setToEmail('abc@gmail.com'); } elseif($sku == '3') { $emailTemplate->setToEmail('xyz@gmail.com'); } elseif($sku == '4') { $emailTemplate->setToEmail('qwe@gmail.com'); } else { $emailTemplate->setToEmail('ewq@gmail.com'); } $emailTemplate->send(); } public function sendMailbasedOnSku($message, $sku) { $body = "$message"; $emailTemplate = Mage::getModel('core/email'); $emailTemplate->setFromName('Giri Test mail'); $emailTemplate->setBody($body); $emailTemplate->setSubject("Custom Email from observer"); $emailTemplate->setType('html'); $chk_sku=(int)substr($sku, 0, 1); if($chk_sku == '2') { $emailTemplate->setToEmail('abc@gmail.com'); } elseif($chk_sku == '3') { $emailTemplate->setToEmail('xyz@gmail.com'); } elseif($chk_sku == '4') { $emailTemplate->setToEmail('qwe@gmail.com'); } else{ $emailTemplate->setToEmail('ewq@gmail.com'); } return $emailTemplate->send(); // try{ // return $emailTemplate->send(); // Mage::getSingleton('core/session')->addSuccess('Success message'); // }catch (Exception $e) // { // Mage::getSingleton('core/session')->addError($e->getMessage()); // } } } ?> But few correction are there, how to solve below logic, eg: If an order contains, 2 series of sku and 3 series of sku order mail received only by 3 series of sku mail not received 2 series of sku mail. another eg. If order placed with 3 products, sku- 22 (abc@gmail.com), sku - 33 (xyz@gmail.com), sku -44 (qwe@gmail.com) order received only qwe@gmail.com My condition, if the order contains 2 products means to send a separate mail. like 2 series of sku : 3 series of sku : 4 Series of sku : now order received highest value of sku,
  4. @Barand code : <?php class Gta_MerchantNotification_Model_Observer { public function merchantremainder($Observer) { $order = $Observer->getEvent()->getOrder(); $order_details = $order->getAllVisibleItems(); $itemData = array(); foreach ($order_details as $list) { $incrementid = $order->getIncrementId(); $sku = $list->getsku(); $name = $list->getName(); $price = $list->getPrice(); $Qty = $list->getQtyOrdered(); $this->sendMailbasedOnSku($sku); $message = "<tr> <!-- <td>$incrementid</td> --> <td>$sku</td> <td>$name</td> <td>$price</td> <td>$Qty</td> </tr>"; // $itemData[$list->getId()] = $message; $itemData[$orderNo][$skuFirst] = $message; } $finalMessage = "<p>Order Id : $incrementid</p> <table border='1'> <tr> <!-- <th>Id</th> --> <th>Sku</th> <th>Product name</th> <th>Price</th> <th>Qty Ordered</th> </tr>"; if (!empty($itemData)) { foreach ($itemData as $data) { $finalMessage .= $data; } $finalMessage .= "</table>"; $this->sendMailbasedOnSku($finalMessage); } } public function sendMailbasedOnSku($message) { $body = "$message"; $emailTemplate = Mage::getModel('core/email'); $emailTemplate->setFromName(' Test mail'); $emailTemplate->setBody($body); $emailTemplate->setSubject("Custom Email from observer"); $emailTemplate->setType('html'); $addys = [ 2 => 'abc@gmail.com', 3 => 'xyz@gmail.com', 4 => 'qwe@gmail.com' ]; // CHECK SKU FIRST DIGIT $chk_sku=(int)substr($sku, 0, 1); if($chk_sku == '2') { $sendTo = $addys[$chk_sku] ?? 'abc@gmail.com'; } elseif($chk_sku == '3') { $sendTo = $addys[$chk_sku] ?? 'xyz@gmail.com'; } elseif($chk_sku == '4') { $sendTo = $addys[$chk_sku] ?? 'qwe@gmail.com'; } else{ $emailTemplate->setToEmail('ewq@gmail.com'); } $emailTemplate->setToEmail($sendTo); return $emailTemplate->send(); } } ?> order not placed.
  5. getting error, <?php class Gta_MerchantNotification_Model_Observer { public function merchantremainder($Observer) { $order = $Observer->getEvent()->getOrder(); $order_details = $order->getAllVisibleItems(); $itemData = array(); foreach ($order_details as $list) { $incrementid = $order->getIncrementId(); $sku = $list->getsku(); $name = $list->getName(); $price = $list->getPrice(); $Qty = $list->getQtyOrdered(); $this->sendMailbasedOnSku($sku); $message = "<tr> <!-- <td>$incrementid</td> --> <td>$sku</td> <td>$name</td> <td>$price</td> <td>$Qty</td> </tr>"; // $itemData[$list->getId()] = $message; $itemData[$orderNo][$skuFirst] = $message; } $finalMessage = "<p>Order Id : $incrementid</p> <table border='1'> <tr> <!-- <th>Id</th> --> <th>Sku</th> <th>Product name</th> <th>Price</th> <th>Qty Ordered</th> </tr>"; if (!empty($itemData)) { foreach ($itemData as $data) { $finalMessage .= $data; } $finalMessage .= "</table>"; $this->sendMailbasedOnSku($finalMessage); } } public function sendMailbasedOnSku($message) { $body = "$message"; $emailTemplate = Mage::getModel('core/email'); $emailTemplate->setFromName('GIRI Test mail'); $emailTemplate->setBody($body); $emailTemplate->setSubject("Custom Email from observer"); $emailTemplate->setType('html'); $addys = [ 2 => 'jeevarathinamit@gmail.com', 3 => 'aveevacool@gmail.com', 4 => 'zus710@gmail.com' ]; // CHECK SKU FIRST DIGIT $chk_sku=(int)substr($sku, 0, 1); if($chk_sku == '2') { $sendTo = $addys[$chk_sku] ?? 'jeevarathinamit@gmail.com'; } elseif($chk_sku == '3') { $sendTo = $addys[$chk_sku] ?? 'aveevacool@gmail.com'; } elseif($chk_sku == '4') { $sendTo = $addys[$chk_sku] ?? 'zus710@gmail.com'; } else{ $emailTemplate->setToEmail('giriwebsiteonline@gmail.com'); } return $emailTemplate->send(); } } ?> Could you help me with above script.
  6. @Barand here i can see only one mail id, $chk_sku=substr($sku, 0, 1); $sendTo = $addys[$chk_sku] ?? 'ewo@gmail.com'; How to add more than one mail id?
  7. @Barand Updated Code : <?php class Gta_MerchantNotification_Model_Observer { public function merchantremainder($Observer) { $order = $Observer->getEvent()->getOrder(); $order_details = $order->getAllVisibleItems(); $itemData = array(); foreach ($order_details as $list) { $incrementid = $order->getIncrementId(); $sku = $list->getsku(); $name = $list->getName(); $price = $list->getPrice(); $Qty = $list->getQtyOrdered(); $this->sendMailbasedOnSku($sku); $message = "<tr> <!-- <td>$incrementid</td> --> <td>$sku</td> <td>$name</td> <td>$price</td> <td>$Qty</td> </tr>"; $itemData[$list->getId()] = $message; } $finalMessage = " <p>Order Id : $incrementid</p> <table border='1'> <tr> <!-- <th>Id</th> --> <th>Sku</th> <th>Product name</th> <th>Price</th> <th>Qty Ordered</th> </tr>"; if (!empty($itemData)) { foreach ($itemData as $data) { $finalMessage .= $data; } $finalMessage .= "</table>"; $this->sendMailbasedOnSku($finalMessage); } } public function sendMailbasedOnSku($message) { $body = "$message"; $emailTemplate = Mage::getModel('core/email'); $emailTemplate->setFromName('Test mail'); $emailTemplate->setBody($body); $emailTemplate->setSubject("Custom Email from observer"); $emailTemplate->setType('html'); $chk_sku=(int)substr($sku, 0, 1); $emailTemplate = Mage::getModel('core/email'); if($chk_sku == '2') { $emailTemplate->setToEmail('abc@gmail.com'); } elseif($chk_sku == '3') { $emailTemplate->setToEmail('xyz@gmail.com'); } elseif($chk_sku == '4') { $emailTemplate->setToEmail('qwe@gmail.com'); } else{ $emailTemplate->setToEmail('ewq@gmail.com'); } try{ $emailTemplate->send(); Mage::getSingleton('core/session')->addSuccess('Success message'); }catch (Exception $e) { Mage::getSingleton('core/session')->addError($e->getMessage()); } } } ?> Anything wrong?
  8. How to declare more than one mail id, $chk_sku=substr($sku, 0, 1); $sendTo = $addys[$chk_sku] ?? 'ewo@gmail.com';
  9. Final code : <?php class Gta_MerchantNotification_Model_Observer { public function merchantremainder($Observer) { $order = $Observer->getEvent()->getOrder(); $order_details = $order->getAllVisibleItems(); $itemData = array(); foreach ($order_details as $list) { $incrementid = $order->getIncrementId(); $sku = $list->getsku(); $name = $list->getName(); $price = $list->getPrice(); $Qty = $list->getQtyOrdered(); $this->sendMailbasedOnSku($sku); $message = "<tr> <!-- <td>$incrementid</td> --> <td>$sku</td> <td>$name</td> <td>$price</td> <td>$Qty</td> </tr>"; $itemData[$list->getId()] = $message; } $finalMessage = " <p>Order Id : $incrementid</p> <table border='1'> <tr> <!-- <th>Id</th> --> <th>Sku</th> <th>Product name</th> <th>Price</th> <th>Qty Ordered</th> </tr>"; if (!empty($itemData)) { foreach ($itemData as $data) { $finalMessage .= $data; } $finalMessage .= "</table>"; $this->sendMail($finalMessage); } } public function sendMail($message) { $body = "$message"; $emailTemplate = Mage::getModel('core/email'); $emailTemplate->setFromName('Test mail'); $emailTemplate->setBody($body); $emailTemplate->setSubject("Custom Email from observer"); $emailTemplate->setType('html'); // $emailTemplate->setToEmail('abc@gmail.com'); if($sku == '2') { $emailTemplate->setToEmail('abc@gmail.com'); } elseif($sku == '3') { $emailTemplate->setToEmail('xyz@gmail.com'); } elseif($sku == '4') { $emailTemplate->setToEmail('qwe@gmail.com'); } else { $emailTemplate->setToEmail('ewq@gmail.com'); } $emailTemplate->send(); } public function sendMailbasedOnSku($sku) { $chk_sku=(int)substr($sku, 0, 1); $emailTemplate = Mage::getModel('core/email'); if($chk_sku == '2') { $emailTemplate->setToEmail('abc@gmail.com'); } elseif($chk_sku == '3') { $emailTemplate->setToEmail('xyz@gmail.com'); } elseif($chk_sku == '4') { $emailTemplate->setToEmail('qwe@gmail.com'); } else{ $emailTemplate->setToEmail('ewq@gmail.com'); } try{ return $emailTemplate->send(); Mage::getSingleton('core/session')->addSuccess('Success message'); }catch (Exception $e) { Mage::getSingleton('core/session')->addError($e->getMessage()); } } } ?>
  10. @Barand After added $emailTemplate = Mage::getModel('core/email'); mail working, but if condition not working. As per my condition if sku start with 2 mail should go to abc@gmail.com but here mail received ewq@gmail.com (Final email id in my if condition). How to correct my script?
  11. Any help with my error, Code : <?php class Gta_MerchantNotification_Model_Observer { public function merchantremainder($Observer) { $order = $Observer->getEvent()->getOrder(); $order_details = $order->getAllVisibleItems(); $itemData = array(); foreach ($order_details as $list) { $incrementid = $order->getIncrementId(); $sku = $list->getsku(); $name = $list->getName(); $price = $list->getPrice(); $Qty = $list->getQtyOrdered(); $this->sendMailbasedOnSku($sku); $message = "<tr> <!-- <td>$incrementid</td> --> <td>$sku</td> <td>$name</td> <td>$price</td> <td>$Qty</td> </tr>"; $itemData[$list->getId()] = $message; } $finalMessage = " <p>Order Id : $incrementid</p> <table border='1'> <tr> <!-- <th>Id</th> --> <th>Sku</th> <th>Product name</th> <th>Price</th> <th>Qty Ordered</th> </tr>"; if (!empty($itemData)) { foreach ($itemData as $data) { $finalMessage .= $data; } $finalMessage .= "</table>"; $this->sendMail($finalMessage); } } public function sendMail($message) { $body = "$message"; $emailTemplate = Mage::getModel('core/email'); $emailTemplate->setFromName('Test mail'); $emailTemplate->setBody($body); $emailTemplate->setSubject("Custom Email from observer"); $emailTemplate->setType('html'); // $emailTemplate->setToEmail('abc@gmail.com'); if($sku == '2') { $emailTemplate->setToEmail('abc@gmail.com'); } elseif($sku == '3') { $emailTemplate->setToEmail('xyz@gmail.com'); } elseif($sku == '4') { $emailTemplate->setToEmail('qwe@gmail.com'); } else { $emailTemplate->setToEmail('ewq@gmail.com'); } $emailTemplate->send(); } public function sendMailbasedOnSku($sku) { // sku is 22302 $chk_sku=(int)substr($sku, 0, 1); if($chk_sku == '2') { $emailTemplate->setToEmail('abc@gmail.com'); } elseif($chk_sku == '3') { $emailTemplate->setToEmail('xyz@gmail.com'); } elseif($chk_sku == '4') { $emailTemplate->setToEmail('qwe@gmail.com'); } else{ $emailTemplate->setToEmail('ewq@gmail.com'); } try{ return $emailTemplate->send(); Mage::getSingleton('core/session')->addSuccess('Your request has been sent'); } catch (Exception $e) { Mage::getSingleton('core/session')->addError($e->getMessage()); } } } ?> error : [09-Jan-2020 04:53:42 UTC] PHP Fatal error: Uncaught Error: Call to a member function setToEmail() on null in C:\wamp64\www\magento\app\code\local\Gta\MerchantNotification\Model\Observer.php:99 Stack trace: #0 C:\wamp64\www\magento\app\code\local\Gta\MerchantNotification\Model\Observer.php(15): Gta_MerchantNotification_Model_Observer->sendMailbasedOnSku('22') #1 C:\wamp64\www\magento\app\code\core\Mage\Core\Model\App.php(1358): Gta_MerchantNotification_Model_Observer->merchantremainder(Object(Varien_Event_Observer)) #2 C:\wamp64\www\magento\app\code\core\Mage\Core\Model\App.php(1337): Mage_Core_Model_App->_callObserverMethod(Object(Gta_MerchantNotification_Model_Observer), 'merchantremaind...', Object(Varien_Event_Observer)) #3 C:\wamp64\www\magento\app\Mage.php(448): Mage_Core_Model_App->dispatchEvent('checkout_submit...', Array) #4 C:\wamp64\www\magento\app\code\core\Mage\Checkout\Model\Type\Onepage.php(872): Mage::dispatchEvent('checkout_submit...', Array) #5 C:\wamp64\www\magento\app\code\core\Mage\Checkout\controllers\OnepageController.php(579): M in C:\wamp64\www\magento\app\code\local\Gta\MerchantNotification\Model\Observer.php on line 99
  12. PHP mail function how to set recipient mail id based on if condition?
  13. I am using magento for sending mail with condition, My code: <?php class Gta_MerchantNotification_Model_Observer { public function merchantremainder($Observer) { $order = $Observer->getEvent()->getOrder(); $order_details = $order->getAllVisibleItems(); $itemData = array(); foreach ($order_details as $list) { $incrementid = $order->getIncrementId(); $sku = $list->getsku(); $name = $list->getName(); $price = $list->getPrice(); $Qty = $list->getQtyOrdered(); $extra = $order->getIncrementId(); $message = " <tr> <!-- <td>$incrementid</td> --> <td>$sku</td> <td>$name</td> <td>$price</td> <td>$Qty</td> </tr>"; $itemData[$list->getId()] = $message; } $finalMessage = " <p>Order Id : $incrementid</p> <table border='1'> <tr> <!-- <th>Id</th> --> <th>Sku</th> <th>Product name</th> <th>Price</th> <th>Qty Ordered</th> </tr>"; if (!empty($itemData)) { foreach ($itemData as $data) { $finalMessage .= $data; } $finalMessage .= "</table>"; $this->sendMail($finalMessage); } } public function sendMail($message) { $body ="$message"; $emailTemplate = Mage::getModel('core/email'); $emailTemplate->setFromName('abc'); $emailTemplate->setBody($body); $emailTemplate->setSubject("Custom Email from observer"); $emailTemplate->setType('html'); $emailTemplate->setToEmail('abc@gmail.com'); $emailTemplate->send(); } } ?> Output : If order placed mail send to abc@gmail.com. How to set email sender based on SKU $sku from order. I want : 1) If SKU starts with 2, email should go to the mail id abc@gmail.com, screenshot : 2) If SKU starts with 3, email should go to the mail id xyz@gmail.com, screenshot : 3) If SKU starts with 4, email should go to the mail id qwe@gmail.com, screenshot : FYI - If an order contains 10 items email should go separately based on SKU. But an order id the same must include all the emails.
  14. Magento PHP mail function : <?php class Gta_MerchantNotification_Model_Observer { public function merchantremainder($Observer) { $order = $Observer->getEvent()->getOrder(); $order_details = $order->getAllVisibleItems(); $itemData = array(); foreach ($order_details as $list) { $incrementid = $order->getIncrementId(); $sku = $list->getsku(); $name = $list->getName(); $price = $list->getPrice(); $Qty = $list->getQtyOrdered(); $extra = $order->getIncrementId(); $message = " <tr> <td>$incrementid</td> <td>$sku</td> <td>$name</td> <td>$price</td> <td>$Qty</td> </tr>"; $itemData[$list->getId()] = $message; } $finalMessage = "<table border='1'> <tr> <th>Id</th> <th>Sku</th> <th>Product name</th> <th>Price</th> <th>Qty Ordered</th> </tr>"; if (!empty($itemData)) { foreach ($itemData as $data) { $finalMessage .= $data; } $finalMessage .= "</table>"; $this->sendMail($finalMessage); } } public function sendMail($message) { $body ="$message"; $emailTemplate = Mage::getModel('core/email'); $emailTemplate->setFromName('abc'); $emailTemplate->setBody($body); $emailTemplate->setSubject("Custom Email from observer"); $emailTemplate->setType('html'); $emailTemplate->setToEmail('aveevacool@gmail.com'); $emailTemplate->send(); } } ?> Now my output like :
  15. PHP script return 20 UL LIST values like, < ul > A B C D E F G H I J K L M N O P Q R S T < /ul > How to display UL LIST into row wise 5 columns like A B C D E F G H I J K L M N O P Q R S T (20 ITEMS)
  16. Magento 1.9 - How to include custom PHP Script into .PHTML file My magento tracking page: https://i.stack.imgur.com/3GIoN.png Back-end magento code : https://i.stack.imgur.com/ySgMA.png How can i add my PHP script into this tracking page. Tracking page code - trackorder.phtml [ https://i.stack.imgur.com/ySgMA.png ] <?php if(Mage::getStoreConfig('trackorder/trackorder_general/enabled')): ?> <div class="page-title"><h1><?php echo $this->__('Track Your Order ') ?></h1></div> <div class="form-list"> <form name="track_order" id="track_order" action="" method="post" onsubmit="sendAjax('track_order','<?php echo Mage::getUrl('*/*/track');?>'); return false;"> <!--<form name="track_order" method="post" id="track_order" action="<?php echo Mage::getUrl('*/*/view');?>">--> <ul class="form-list"> <li> <label for="order_id" class="required"><em>*</em><?php echo $this->__('Order Id') ?></label> <div class="input-box"> <input type="text" name="order_id" id="order_id" value="" title="" class="input-text required-entry" /> </div> </li> <li> <label for="email_address" class="required"><em>*</em><?php echo $this->__('Email Address') ?></label> <div class="input-box" > <input type="text" name="email" id="email_address" value="" title="<?php echo $this->__('Email Address') ?>" class="input-text validate-email required-entry" /> </div> </li> </ul> <div class="buttons-set"> <button type="submit" class="button" title="<?php echo $this->__('Track Order') ?>" name="track" id="track"> <span><span><?php echo $this->__('Track Order') ?></span></span> </button> </div> </form> <div id="loading-details" class="loading-details" style="display:none"> <div id="loading-mask" > <p class="loader" id="loading_mask_loader"><img src="<?php echo $this->getSkinUrl('trackorder/images/ajax-loader-tr.gif') ?>" alt="<?php echo Mage::helper('adminhtml')->__('Loading...') ?>"/><br/><?php echo $this->__('Please wait...') ?></p> </div> </div> </div> <div id="oderinfo" class="order-info-message"></div> <script type="text/javascript"> var validateForm = new VarienForm('track_order', true); </script> <script type="text/javascript"> function sendAjax(frmId,url){ if (!validateForm.validator.validate()) { return; } var data = $(frmId).serialize(this); $("loading-details").show(); new Ajax.Updater( { success:"oderinfo" }, url, { asynchronous:true, evalScripts:false, onComplete:function(request, json){ $("loading-details").hide(); return false; }, onLoading:function(request, json){}, parameters:data } ); return false; } </script> <?php else: ?> <?php $url = Mage::getBaseUrl(); Mage::app()->getFrontController()->getResponse()->setRedirect($url); ?> <?php endif; ?> From above code how can i add my own PHP script : My PHP script : <!DOCTYPE HTML> <html> <body> <form action="#" method="POST"> Select Courier : <select name="courier"> <option disabled='disabled' selected>-- Choose an option --</option> <option value="professional_courier">Professional Courier</option> <option value="shree_maruti_courier">Shree Maruti Courier</option> <option value="india_post_courier">India Post Courier</option> <option value="dhl_courier">DHL Courier</option> <option value="fedex_courier">Fedex Courier</option> <option value="ups_courier">UPS Courier</option> </select> Trackingid: <input type="text" name="trackingid"> <input type="submit"> </form> <?php if (isset($_POST['courier'])) { // Professional Courier if ('professional_courier' === $_POST['courier']) { header("Location: https://www.tpcindia.com/Tracking2014.aspx?id=" . $_POST["trackingid"] . "&type=0&service=0"); } // Shree Maruti Courier else if ('shree_maruti_courier' === $_POST['courier']) { header("Location: https://www.shreemaruticourier.com/track-your-shipment/#track-your", "_blank"); } // india_post_courier else if ('india_post_courier' === $_POST['courier']) { header("Location: https://www.indiapost.gov.in/vas/Pages/IndiaPostHome.aspx/#main-content", "_blank"); } // DHL Courier else if ('dhl_courier' === $_POST['courier']) { header("Location: https://www.dhl.com/en/express/tracking.html?AWB=" . $_POST["trackingid"] . "&brand=DHL", "_blank"); } // Fedex Courier else if ('fedex_courier' === $_POST['courier']) { header("Location: https://www.fedex.com/apps/fedextrack/?action=track&trackingnumber=" . $_POST["trackingid"] . "&cntry_code=in&locale=en_IN", "_blank"); } // ups_courier else if ('ups_courier' === $_POST['courier']) { header("Location: https://www.ups.com/track?loc=en_US&tracknum=" . $_POST["trackingid"] . "&requester=WT/trackdetails", "_blank"); } } ?> </body> </html> My Workout in trackorder.phtml getting error : [start & end header added] <?php if(Mage::getStoreConfig('trackorder/trackorder_general/enabled')): ?> <div class="page-title"><h1><?php echo $this->__('Track Your Order ') ?></h1></div> <div class="form-list" style="float: left;"> <form name="track_order" id="track_order" action="" method="post" onsubmit="sendAjax('track_order','<?php echo Mage::getUrl('*/*/track');?>'); return false;"> <!--<form name="track_order" method="post" id="track_order" action="<?php echo Mage::getUrl('*/*/view');?>">--> <ul class="form-list"> <li> <label for="order_id" class="required"><em>*</em><?php echo $this->__('Order Id') ?></label> <div class="input-box"> <input type="text" name="order_id" id="order_id" value="" title="" class="input-text required-entry" /> </div> </li> <li> <label for="email_address" class="required"><em>*</em><?php echo $this->__('Email Address') ?></label> <div class="input-box" > <input type="text" name="email" id="email_address" value="" title="<?php echo $this->__('Email Address') ?>" class="input-text validate-email required-entry" /> </div> </li> </ul> <div class="buttons-set"> <button type="submit" class="button" title="<?php echo $this->__('Track Order') ?>" name="track" id="track"> <span><span><?php echo $this->__('Track Order') ?></span></span> </button> </div> </form> <div id="loading-details" class="loading-details" style="display:none"> <div id="loading-mask" > <p class="loader" id="loading_mask_loader"><img src="<?php echo $this->getSkinUrl('trackorder/images/ajax-loader-tr.gif') ?>" alt="<?php echo Mage::helper('adminhtml')->__('Loading...') ?>"/><br/><?php echo $this->__('Please wait...') ?></p> </div> </div> </div> <!-- Start couier tracking --> <div style="float: left;"> <form action="#" method="POST" style="padding: 28px 15px 21px 196px;"> Select Courier : <select name="courier"> <option disabled='disabled' selected>-- Choose an option --</option> <option value="professional_courier">Professional Courier</option> <option value="shree_maruti_courier">Shree Maruti Courier</option> <option value="india_post_courier">India Post Courier</option> <option value="dhl_courier">DHL Courier</option> <option value="fedex_courier">Fedex Courier</option> <option value="ups_courier">UPS Courier</option> </select> Trackingid: <input type="text" name="trackingid"> <input type="submit"> </form> <?php if (isset($_POST['courier'])) { // Professional Courier if ('professional_courier' === $_POST['courier']) { header("Location: https://www.tpcindia.com/Tracking2014.aspx?id=" . $_POST["trackingid"] . "&type=0&service=0"); } // Shree Maruti Courier else if ('shree_maruti_courier' === $_POST['courier']) { header("Location: https://www.shreemaruticourier.com/track-your-shipment/#track-your", "_blank"); } // india_post_courier else if ('india_post_courier' === $_POST['courier']) { header("Location: https://www.indiapost.gov.in/vas/Pages/IndiaPostHome.aspx/#main-content", "_blank"); } // DHL Courier else if ('dhl_courier' === $_POST['courier']) { header("Location: https://www.dhl.com/en/express/tracking.html?AWB=" . $_POST["trackingid"] . "&brand=DHL", "_blank"); } // Fedex Courier else if ('fedex_courier' === $_POST['courier']) { header("Location: https://www.fedex.com/apps/fedextrack/?action=track&trackingnumber=" . $_POST["trackingid"] . "&cntry_code=in&locale=en_IN", "_blank"); } // ups_courier else if ('ups_courier' === $_POST['courier']) { header("Location: https://www.ups.com/track?loc=en_US&tracknum=" . $_POST["trackingid"] . "&requester=WT/trackdetails", "_blank"); } } ?> </div> <!-- End couier tracking --> <div id="oderinfo" class="order-info-message"></div> <script type="text/javascript"> var validateForm = new VarienForm('track_order', true); </script> <script type="text/javascript"> function sendAjax(frmId,url){ if (!validateForm.validator.validate()) { return; } var data = $(frmId).serialize(this); $("loading-details").show(); new Ajax.Updater( { success:"oderinfo" }, url, { asynchronous:true, evalScripts:false, onComplete:function(request, json){ $("loading-details").hide(); return false; }, onLoading:function(request, json){}, parameters:data } ); return false; } </script> <?php else: ?> <?php $url = Mage::getBaseUrl(); Mage::app()->getFrontController()->getResponse()->setRedirect($url); ?> <?php endif; ?>
  17. Finally working, thanks to everyone. <!DOCTYPE HTML> <html> <body> <form action="#" method="POST"> Select Courier : <select name="courier"> <option value="">--Please choose an option--</option> <option value="professional_courier">Professional Courier</option> <option value="india_post">India Post</option> </select> Trackingid: <input type="text" name="trackingid"> <input type="submit"> </form> <?php if (isset($_POST['courier'])) { if ('professional_courier' === $_POST['courier']) { header("Location: https://www.tpcindia.com/Tracking2014.aspx?id=" . $_POST["trackingid"] . "&type=0&service=0"); } else if ('india_post' === $_POST['courier']) { header("Location: https://www.dhl.com/en/express/tracking.html?AWB=" . $_POST["trackingid"] . "&brand=DHL"); } } ?> </body> </html>
  18. My final code : <!DOCTYPE HTML> <html> <body> <form action="#" method="POST"> Select Courier : <select name="courier"> <option value="">--Please choose an option--</option> <option value="professional_courier">Professional Courier</option> <option value="india_post">India Post</option> </select> Trackingid: <input type="text" name="trackingid"> <input type="submit"> </form> <?php if(isset($_POST['courier'])) { if(isset($_POST['professional_courier'])) { if (!empty($_POST)): header("Location: https://www.tpcindia.com/Tracking2014.aspx?id=".$_POST["trackingid"]."&type=0&service=0"); } else(isset($_POST['india_post'])) { if (!empty($_POST)): header("Location: https://www.dhl.com/en/express/tracking.html?AWB=".$_POST["trackingid"]."&brand=DHL"); } } ?> </body> </html> Any help, thanks.
  19. @requinix Here is my code, <!DOCTYPE HTML> <html> <body> <form action="#" method="post"> Select Courier : <select name="courier"> <option value="">--Please choose an option--</option> <option value="professional_courier">Professional Courier</option> <option value="india_post">India Post</option> </select> Trackingid: <input type="text" name="trackingid"><br> <input type="submit"> </form> <?php if (!empty($_POST)): header("Location: https://www.tpcindia.com/Tracking2014.aspx?id=".$_POST["trackingid"]."&type=0&service=0"); endif; ?> </body> </html> How to track more than one service, now my code track only one service, how can i add india post if customer choose india post courier service url: https://www.indiapost.gov.in/_layouts/15/dop.portal.tracking/trackconsignment.aspx
  20. https://www.fedex.com/apps/fedextrack/index.html?tracknumbers=12345&cntry_code=in From above how can i post customer entered input field to post after ?tracknumbers=
  21. I need like, http://www.trackcourier.in/ The customer chooses selected courier service and enters tracking id then clicks its redirect to the appropriate courier service website. eg: If tracking id 12345 the redirect link should be https://www.fedex.com/apps/fedextrack/index.html?tracknumbers=12345&cntry_code=in How to do for India courier services?
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.