1

i want to create email method. if customer select free shipping method then admin and user both will get an custom email.

how to do that? need help.

there are two shipping . one is paid and second is free. if customer select free shipping method and place the order then admin and customer both will get email notification.

need help how to do that?

in module folder Custom_shipping.xml

   <?xml version="1.0"?>
 <config>
     <modules>
       <Custom_Shipping>
         <active>true</active>
          <codePool>local</codePool>

        </Custom_Shipping>
      </modules>
  </config>

in Model Folder Observer.php

   <?php

   class Custom_Shipping_Model_Observer(){

    public function salesOrderShipmentSaveBefore($observer)
    {

    $shipment = $observer->getShipment();
    $order = $shipment->getOrder();
    $storeId = $order->getStore()->getStoreId();

     die('test');


     }


}

ann etc/config.xml

      <?xml version="1.0"?>
  <config>
   <modules>
    <Custom_Shipping>
        <version>1.0</version>
    </Custom_Shipping>
  </modules>
<global>
   <events>             
      <sales_order_shipment_save_before>
        <observers>
            <shipping>
                <type>singleton</type>
                <class>shipping/observer</class>
                <method>salesOrderShipmentSaveBefore</method>
            </shipping>
        </observers>
     </sales_order_shipment_save_before>
     </events>
     </global>
     </config>
  • What is the exact problem? – Fabian Blechschmidt Feb 18 '14 at 13:53
  • i don't know what is the issue. i created this module and unfortunately it is not working. i want to send email to user if user place place the order using freeshipping. as you suggested to use observer and sales_order_shipment_save_before i just tried to create the observer but it isn't working. can you help me? – Jack Torris Feb 19 '14 at 4:27
  • Is the code called? Is the file included? Does the module show up in the backend? magento.stackexchange.com/questions/428/… – Fabian Blechschmidt Feb 19 '14 at 13:34
  • yes . module show up in system >> configuration >> advanced. it is is enable. i don't know why it is not firing the action – Jack Torris Feb 20 '14 at 11:19
2

The problem appears to be you are missing the model definition in your config.xml so the observer does not get called.

You have two options.

Either update <class>custom_shipping/observer</class> to use <class>Custom_Shipping_Model_Observer</class>

Or create the following section in your config.xml:

<global>
    <models>
        <custom_shipping>
            <class>Custom_Shipping_Model</class>
        </custom_shipping>
    </models>
</global>

Thanks to Fabian for pointing out <shipping> is already in use :)

  • Don't use `shipping``, this is already used by Mage_Shipping :) – Fabian Blechschmidt May 21 '14 at 16:19
  • @FabianBlechschmidt opps :) – David Manners May 21 '14 at 16:34
0

Hook into the event sales_order_shipment_save_before check wether the order has an ID, if no, check the method and if the method is free, then send an email.

Further informations:

  • what will be in overserver? – Jack Torris Feb 18 '14 at 5:44
  • The check whether the shipment has an id (to check whether it is new and only send the mail once) and the mail sending – Fabian Blechschmidt Feb 18 '14 at 7:09
  • hi, i updated the question with the module i created. please have a look. i just created observer. but it is not working. need help – Jack Torris Feb 18 '14 at 10:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.