checkout_cart_save_after is not working The Next CEO of Stack OverflowHolepunching of header in magento store[Solved]Cannot override Pdf/Total/Default.php modelMagento extension not working in my layoutSimple Observer not firing on eventOut of stock mail subscription Not workingExtension not working correctlyPackage extension not working: MagentoDiscount code not working on mobile in Magento 1.9Magento Product More Views Not working in Responsive Mobile ThemeShow Shipping cost in checkout page not in cart page

Ising model simulation

Is there a rule of thumb for determining the amount one should accept for of a settlement offer?

How seriously should I take size and weight limits of hand luggage?

What difference does it make matching a word with/without a trailing whitespace?

That's an odd coin - I wonder why

Car headlights in a world without electricity

logical reads on global temp table, but not on session-level temp table

Could you use a laser beam as a modulated carrier wave for radio signal?

Why does freezing point matter when picking cooler ice packs?

A hang glider, sudden unexpected lift to 25,000 feet altitude, what could do this?

Early programmable calculators with RS-232

Why can't we say "I have been having a dog"?

Man transported from Alternate World into ours by a Neutrino Detector

Small nick on power cord from an electric alarm clock, and copper wiring exposed but intact

Can Sri Krishna be called 'a person'?

Is it OK to decorate a log book cover?

Why did early computer designers eschew integers?

Why doesn't Shulchan Aruch include the laws of destroying fruit trees?

How to unfasten electrical subpanel attached with ramset

Is it a bad idea to plug the other end of ESD strap to wall ground?

How exploitable/balanced is this homebrew spell: Spell Permanency?

Is it possible to make a 9x9 table fit within the default margins?

Free fall ellipse or parabola?

Does the Idaho Potato Commission associate potato skins with healthy eating?



checkout_cart_save_after is not working



The Next CEO of Stack OverflowHolepunching of header in magento store[Solved]Cannot override Pdf/Total/Default.php modelMagento extension not working in my layoutSimple Observer not firing on eventOut of stock mail subscription Not workingExtension not working correctlyPackage extension not working: MagentoDiscount code not working on mobile in Magento 1.9Magento Product More Views Not working in Responsive Mobile ThemeShow Shipping cost in checkout page not in cart page










2















The little project is to export all items (sku and quantity) of an order using the Magento (1.9.3.2) events.



My NvM2MfExport.xml in /app/etc/modules:



<?xml version="1.0" encoding="UTF-8"?>
<config>
<modules>
<NvM2MfExport>
<active>true</active>
<codePool>community</codePool>
<depends>
<Mage_Checkout />
</depends>
</NvM2MfExport>
</modules>
</config>


My config.xml in /app/code/community/NV/M2MfExport/etc:



<?xml version="1.0"?>
<config>

<modules>
<NvM2MfExport>
<version>1.0.0</version>
</NvM2MfExport>
</modules>

<global>
<models>
<nvm2mfexport>
<class>Nv_Export_Model</class>
</nvm2mfexport>
</models>
<events>
<checkout_cart_save_after>
<observers>
<nvm2mfexport>
<class>nvm2mfexport/observer</class>
<method>orderExport</method>
</nvm2mfexport>
</observers>
</checkout_cart_save_after>
</events>
</global>

</config>


My Observer.php in /app/code/community/Nv/M2MfExport/Model:



<?php

class Nv_Export_Model_Observer

public function orderExport($observer)

//require_once '../app/Mage.php';
//Mage::app();

// Übergebenes Quote und Order Objekt holen
$order = $observer->getEvent()->getOrder();
$quote = $observer->getEvent()->getQuote();

// Nur schicken wenn tatsächlich eine Adresse zugewiesen wurde
if ($quote->getDistributorEmail())

// Lieferadresse als Text formatiert holen
$shipTo = $order->getShippingAddress()->format('text');
$itemsTxt = "Itemsn-----------------------n";

foreach ($order->getAllVisibleItems() as $item)
$itemsTxt .= 'SKU: ' . $item->getSku() . ' QTY: ' . $item->getQtyOrdered() . "n";

$mail = Mage::getModel('core/email')
->setFromEmail('~@~.de')
->setSubject('Neue Bestellung')
->setToEmail('~@~.de')
->setBody("Lieferadresse:nn" . $shipTo . "n" . $itemsTxt)
->send();


/*$myfile = fopen("/var/www/magento-1.9.3.2/newfile.txt", "w") or die("Unable to open file!");
$txt = "John Doen";
fwrite($myfile, $txt);
$txt = "Jane Doen";
fwrite($myfile, $txt);
fclose($myfile);*/




The module is shown in the admin and enabled.



After a successfully order submit inside the backend (admin) I expected getting an email with some information. But nothing - not even a system log entry (logging is set on).



I also changed something in my php file that should result in throwing an error and another log entry. But nothing too. That's why I suggest that my Observer.php will not be called.










share|improve this question




























    2















    The little project is to export all items (sku and quantity) of an order using the Magento (1.9.3.2) events.



    My NvM2MfExport.xml in /app/etc/modules:



    <?xml version="1.0" encoding="UTF-8"?>
    <config>
    <modules>
    <NvM2MfExport>
    <active>true</active>
    <codePool>community</codePool>
    <depends>
    <Mage_Checkout />
    </depends>
    </NvM2MfExport>
    </modules>
    </config>


    My config.xml in /app/code/community/NV/M2MfExport/etc:



    <?xml version="1.0"?>
    <config>

    <modules>
    <NvM2MfExport>
    <version>1.0.0</version>
    </NvM2MfExport>
    </modules>

    <global>
    <models>
    <nvm2mfexport>
    <class>Nv_Export_Model</class>
    </nvm2mfexport>
    </models>
    <events>
    <checkout_cart_save_after>
    <observers>
    <nvm2mfexport>
    <class>nvm2mfexport/observer</class>
    <method>orderExport</method>
    </nvm2mfexport>
    </observers>
    </checkout_cart_save_after>
    </events>
    </global>

    </config>


    My Observer.php in /app/code/community/Nv/M2MfExport/Model:



    <?php

    class Nv_Export_Model_Observer

    public function orderExport($observer)

    //require_once '../app/Mage.php';
    //Mage::app();

    // Übergebenes Quote und Order Objekt holen
    $order = $observer->getEvent()->getOrder();
    $quote = $observer->getEvent()->getQuote();

    // Nur schicken wenn tatsächlich eine Adresse zugewiesen wurde
    if ($quote->getDistributorEmail())

    // Lieferadresse als Text formatiert holen
    $shipTo = $order->getShippingAddress()->format('text');
    $itemsTxt = "Itemsn-----------------------n";

    foreach ($order->getAllVisibleItems() as $item)
    $itemsTxt .= 'SKU: ' . $item->getSku() . ' QTY: ' . $item->getQtyOrdered() . "n";

    $mail = Mage::getModel('core/email')
    ->setFromEmail('~@~.de')
    ->setSubject('Neue Bestellung')
    ->setToEmail('~@~.de')
    ->setBody("Lieferadresse:nn" . $shipTo . "n" . $itemsTxt)
    ->send();


    /*$myfile = fopen("/var/www/magento-1.9.3.2/newfile.txt", "w") or die("Unable to open file!");
    $txt = "John Doen";
    fwrite($myfile, $txt);
    $txt = "Jane Doen";
    fwrite($myfile, $txt);
    fclose($myfile);*/




    The module is shown in the admin and enabled.



    After a successfully order submit inside the backend (admin) I expected getting an email with some information. But nothing - not even a system log entry (logging is set on).



    I also changed something in my php file that should result in throwing an error and another log entry. But nothing too. That's why I suggest that my Observer.php will not be called.










    share|improve this question


























      2












      2








      2








      The little project is to export all items (sku and quantity) of an order using the Magento (1.9.3.2) events.



      My NvM2MfExport.xml in /app/etc/modules:



      <?xml version="1.0" encoding="UTF-8"?>
      <config>
      <modules>
      <NvM2MfExport>
      <active>true</active>
      <codePool>community</codePool>
      <depends>
      <Mage_Checkout />
      </depends>
      </NvM2MfExport>
      </modules>
      </config>


      My config.xml in /app/code/community/NV/M2MfExport/etc:



      <?xml version="1.0"?>
      <config>

      <modules>
      <NvM2MfExport>
      <version>1.0.0</version>
      </NvM2MfExport>
      </modules>

      <global>
      <models>
      <nvm2mfexport>
      <class>Nv_Export_Model</class>
      </nvm2mfexport>
      </models>
      <events>
      <checkout_cart_save_after>
      <observers>
      <nvm2mfexport>
      <class>nvm2mfexport/observer</class>
      <method>orderExport</method>
      </nvm2mfexport>
      </observers>
      </checkout_cart_save_after>
      </events>
      </global>

      </config>


      My Observer.php in /app/code/community/Nv/M2MfExport/Model:



      <?php

      class Nv_Export_Model_Observer

      public function orderExport($observer)

      //require_once '../app/Mage.php';
      //Mage::app();

      // Übergebenes Quote und Order Objekt holen
      $order = $observer->getEvent()->getOrder();
      $quote = $observer->getEvent()->getQuote();

      // Nur schicken wenn tatsächlich eine Adresse zugewiesen wurde
      if ($quote->getDistributorEmail())

      // Lieferadresse als Text formatiert holen
      $shipTo = $order->getShippingAddress()->format('text');
      $itemsTxt = "Itemsn-----------------------n";

      foreach ($order->getAllVisibleItems() as $item)
      $itemsTxt .= 'SKU: ' . $item->getSku() . ' QTY: ' . $item->getQtyOrdered() . "n";

      $mail = Mage::getModel('core/email')
      ->setFromEmail('~@~.de')
      ->setSubject('Neue Bestellung')
      ->setToEmail('~@~.de')
      ->setBody("Lieferadresse:nn" . $shipTo . "n" . $itemsTxt)
      ->send();


      /*$myfile = fopen("/var/www/magento-1.9.3.2/newfile.txt", "w") or die("Unable to open file!");
      $txt = "John Doen";
      fwrite($myfile, $txt);
      $txt = "Jane Doen";
      fwrite($myfile, $txt);
      fclose($myfile);*/




      The module is shown in the admin and enabled.



      After a successfully order submit inside the backend (admin) I expected getting an email with some information. But nothing - not even a system log entry (logging is set on).



      I also changed something in my php file that should result in throwing an error and another log entry. But nothing too. That's why I suggest that my Observer.php will not be called.










      share|improve this question
















      The little project is to export all items (sku and quantity) of an order using the Magento (1.9.3.2) events.



      My NvM2MfExport.xml in /app/etc/modules:



      <?xml version="1.0" encoding="UTF-8"?>
      <config>
      <modules>
      <NvM2MfExport>
      <active>true</active>
      <codePool>community</codePool>
      <depends>
      <Mage_Checkout />
      </depends>
      </NvM2MfExport>
      </modules>
      </config>


      My config.xml in /app/code/community/NV/M2MfExport/etc:



      <?xml version="1.0"?>
      <config>

      <modules>
      <NvM2MfExport>
      <version>1.0.0</version>
      </NvM2MfExport>
      </modules>

      <global>
      <models>
      <nvm2mfexport>
      <class>Nv_Export_Model</class>
      </nvm2mfexport>
      </models>
      <events>
      <checkout_cart_save_after>
      <observers>
      <nvm2mfexport>
      <class>nvm2mfexport/observer</class>
      <method>orderExport</method>
      </nvm2mfexport>
      </observers>
      </checkout_cart_save_after>
      </events>
      </global>

      </config>


      My Observer.php in /app/code/community/Nv/M2MfExport/Model:



      <?php

      class Nv_Export_Model_Observer

      public function orderExport($observer)

      //require_once '../app/Mage.php';
      //Mage::app();

      // Übergebenes Quote und Order Objekt holen
      $order = $observer->getEvent()->getOrder();
      $quote = $observer->getEvent()->getQuote();

      // Nur schicken wenn tatsächlich eine Adresse zugewiesen wurde
      if ($quote->getDistributorEmail())

      // Lieferadresse als Text formatiert holen
      $shipTo = $order->getShippingAddress()->format('text');
      $itemsTxt = "Itemsn-----------------------n";

      foreach ($order->getAllVisibleItems() as $item)
      $itemsTxt .= 'SKU: ' . $item->getSku() . ' QTY: ' . $item->getQtyOrdered() . "n";

      $mail = Mage::getModel('core/email')
      ->setFromEmail('~@~.de')
      ->setSubject('Neue Bestellung')
      ->setToEmail('~@~.de')
      ->setBody("Lieferadresse:nn" . $shipTo . "n" . $itemsTxt)
      ->send();


      /*$myfile = fopen("/var/www/magento-1.9.3.2/newfile.txt", "w") or die("Unable to open file!");
      $txt = "John Doen";
      fwrite($myfile, $txt);
      $txt = "Jane Doen";
      fwrite($myfile, $txt);
      fclose($myfile);*/




      The module is shown in the admin and enabled.



      After a successfully order submit inside the backend (admin) I expected getting an email with some information. But nothing - not even a system log entry (logging is set on).



      I also changed something in my php file that should result in throwing an error and another log entry. But nothing too. That's why I suggest that my Observer.php will not be called.







      magento-1.9 checkout extensions magento-1.9.3.2






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited 12 hours ago









      Muhammad Anas

      330115




      330115










      asked Apr 27 '17 at 13:33









      SebastianSebastian

      113




      113




















          2 Answers
          2






          active

          oldest

          votes


















          3














          You need to update some of the names.



          Rename NvM2MfExport.xml to Nv_M2MfExport.xml and add below code



          <?xml version="1.0" encoding="UTF-8"?>
          <config>
          <modules>
          <Nv_M2MfExport>
          <active>true</active>
          <codePool>community</codePool>
          <depends>
          <Mage_Checkout />
          </depends>
          </Nv_M2MfExport>
          </modules>
          </config>


          Update your config.xml



          <?xml version="1.0"?>
          <config>

          <modules>
          <Nv_M2MfExport>
          <version>1.0.0</version>
          </Nv_M2MfExport>
          </modules>

          <global>
          <models>
          <nvm2mfexport>
          <class>Nv_M2MfExport_Model</class>
          </nvm2mfexport>
          </models>
          <events>
          <checkout_cart_save_after>
          <observers>
          <nvm2mfexport>
          <class>nvm2mfexport/observer</class>
          <method>orderExport</method>
          </nvm2mfexport>
          </observers>
          </checkout_cart_save_after>
          </events>
          </global>

          </config>


          Your observer class is also wrong.



          <?php

          class Nv_M2MfExport_Model_Observer

          public function orderExport($observer)

          //require_once '../app/Mage.php';
          //Mage::app();

          // Übergebenes Quote und Order Objekt holen
          $order = $observer->getEvent()->getOrder();
          $quote = $observer->getEvent()->getQuote();

          // Nur schicken wenn tatsächlich eine Adresse zugewiesen wurde
          if ($quote->getDistributorEmail())

          // Lieferadresse als Text formatiert holen
          $shipTo = $order->getShippingAddress()->format('text');
          $itemsTxt = "Itemsn-----------------------n";

          foreach ($order->getAllVisibleItems() as $item)
          $itemsTxt .= 'SKU: ' . $item->getSku() . ' QTY: ' . $item->getQtyOrdered() . "n";

          $mail = Mage::getModel('core/email')
          ->setFromEmail('~@~.de')
          ->setSubject('Neue Bestellung')
          ->setToEmail('~@~.de')
          ->setBody("Lieferadresse:nn" . $shipTo . "n" . $itemsTxt)
          ->send();


          /*$myfile = fopen("/var/www/magento-1.9.3.2/newfile.txt", "w") or die("Unable to open file!");
          $txt = "John Doen";
          fwrite($myfile, $txt);
          $txt = "Jane Doen";
          fwrite($myfile, $txt);
          fclose($myfile);*/




          And it should work.






          share|improve this answer
































            2














            The following code will never give you anything:



             $order = $observer->getEvent()->getOrder();
            $quote = $observer->getEvent()->getQuote();


            Because the checkout_cart_save_after event only lets you retrieve the cart, see in Mage_Checkout_Model_Cart :



            Mage::dispatchEvent('checkout_cart_save_after', array('cart'=>$this));


            So, you can do the following:



            $cart = $observer->getEvent()->getCart();
            $quote = $cart->getQuote();


            But you still have the problem of retrieving the corresponding order information. The reason behind that is because this event is not triggered necessarily after an order is placed, it's triggered after a change happens to the cart. So if one updates the quantity of an item in the cart, it's gonna trigger it and there's no order linked to it.



            IMHO you should use the sales_order_place_after event and do the following:



            $order = $observer->getEvent()->getOrder();
            $quote = $order->getQuote();





            share|improve this answer























              Your Answer








              StackExchange.ready(function()
              var channelOptions =
              tags: "".split(" "),
              id: "479"
              ;
              initTagRenderer("".split(" "), "".split(" "), channelOptions);

              StackExchange.using("externalEditor", function()
              // Have to fire editor after snippets, if snippets enabled
              if (StackExchange.settings.snippets.snippetsEnabled)
              StackExchange.using("snippets", function()
              createEditor();
              );

              else
              createEditor();

              );

              function createEditor()
              StackExchange.prepareEditor(
              heartbeatType: 'answer',
              autoActivateHeartbeat: false,
              convertImagesToLinks: false,
              noModals: true,
              showLowRepImageUploadWarning: true,
              reputationToPostImages: null,
              bindNavPrevention: true,
              postfix: "",
              imageUploader:
              brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
              contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
              allowUrls: true
              ,
              onDemand: true,
              discardSelector: ".discard-answer"
              ,immediatelyShowMarkdownHelp:true
              );



              );













              draft saved

              draft discarded


















              StackExchange.ready(
              function ()
              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f172081%2fcheckout-cart-save-after-is-not-working%23new-answer', 'question_page');

              );

              Post as a guest















              Required, but never shown

























              2 Answers
              2






              active

              oldest

              votes








              2 Answers
              2






              active

              oldest

              votes









              active

              oldest

              votes






              active

              oldest

              votes









              3














              You need to update some of the names.



              Rename NvM2MfExport.xml to Nv_M2MfExport.xml and add below code



              <?xml version="1.0" encoding="UTF-8"?>
              <config>
              <modules>
              <Nv_M2MfExport>
              <active>true</active>
              <codePool>community</codePool>
              <depends>
              <Mage_Checkout />
              </depends>
              </Nv_M2MfExport>
              </modules>
              </config>


              Update your config.xml



              <?xml version="1.0"?>
              <config>

              <modules>
              <Nv_M2MfExport>
              <version>1.0.0</version>
              </Nv_M2MfExport>
              </modules>

              <global>
              <models>
              <nvm2mfexport>
              <class>Nv_M2MfExport_Model</class>
              </nvm2mfexport>
              </models>
              <events>
              <checkout_cart_save_after>
              <observers>
              <nvm2mfexport>
              <class>nvm2mfexport/observer</class>
              <method>orderExport</method>
              </nvm2mfexport>
              </observers>
              </checkout_cart_save_after>
              </events>
              </global>

              </config>


              Your observer class is also wrong.



              <?php

              class Nv_M2MfExport_Model_Observer

              public function orderExport($observer)

              //require_once '../app/Mage.php';
              //Mage::app();

              // Übergebenes Quote und Order Objekt holen
              $order = $observer->getEvent()->getOrder();
              $quote = $observer->getEvent()->getQuote();

              // Nur schicken wenn tatsächlich eine Adresse zugewiesen wurde
              if ($quote->getDistributorEmail())

              // Lieferadresse als Text formatiert holen
              $shipTo = $order->getShippingAddress()->format('text');
              $itemsTxt = "Itemsn-----------------------n";

              foreach ($order->getAllVisibleItems() as $item)
              $itemsTxt .= 'SKU: ' . $item->getSku() . ' QTY: ' . $item->getQtyOrdered() . "n";

              $mail = Mage::getModel('core/email')
              ->setFromEmail('~@~.de')
              ->setSubject('Neue Bestellung')
              ->setToEmail('~@~.de')
              ->setBody("Lieferadresse:nn" . $shipTo . "n" . $itemsTxt)
              ->send();


              /*$myfile = fopen("/var/www/magento-1.9.3.2/newfile.txt", "w") or die("Unable to open file!");
              $txt = "John Doen";
              fwrite($myfile, $txt);
              $txt = "Jane Doen";
              fwrite($myfile, $txt);
              fclose($myfile);*/




              And it should work.






              share|improve this answer





























                3














                You need to update some of the names.



                Rename NvM2MfExport.xml to Nv_M2MfExport.xml and add below code



                <?xml version="1.0" encoding="UTF-8"?>
                <config>
                <modules>
                <Nv_M2MfExport>
                <active>true</active>
                <codePool>community</codePool>
                <depends>
                <Mage_Checkout />
                </depends>
                </Nv_M2MfExport>
                </modules>
                </config>


                Update your config.xml



                <?xml version="1.0"?>
                <config>

                <modules>
                <Nv_M2MfExport>
                <version>1.0.0</version>
                </Nv_M2MfExport>
                </modules>

                <global>
                <models>
                <nvm2mfexport>
                <class>Nv_M2MfExport_Model</class>
                </nvm2mfexport>
                </models>
                <events>
                <checkout_cart_save_after>
                <observers>
                <nvm2mfexport>
                <class>nvm2mfexport/observer</class>
                <method>orderExport</method>
                </nvm2mfexport>
                </observers>
                </checkout_cart_save_after>
                </events>
                </global>

                </config>


                Your observer class is also wrong.



                <?php

                class Nv_M2MfExport_Model_Observer

                public function orderExport($observer)

                //require_once '../app/Mage.php';
                //Mage::app();

                // Übergebenes Quote und Order Objekt holen
                $order = $observer->getEvent()->getOrder();
                $quote = $observer->getEvent()->getQuote();

                // Nur schicken wenn tatsächlich eine Adresse zugewiesen wurde
                if ($quote->getDistributorEmail())

                // Lieferadresse als Text formatiert holen
                $shipTo = $order->getShippingAddress()->format('text');
                $itemsTxt = "Itemsn-----------------------n";

                foreach ($order->getAllVisibleItems() as $item)
                $itemsTxt .= 'SKU: ' . $item->getSku() . ' QTY: ' . $item->getQtyOrdered() . "n";

                $mail = Mage::getModel('core/email')
                ->setFromEmail('~@~.de')
                ->setSubject('Neue Bestellung')
                ->setToEmail('~@~.de')
                ->setBody("Lieferadresse:nn" . $shipTo . "n" . $itemsTxt)
                ->send();


                /*$myfile = fopen("/var/www/magento-1.9.3.2/newfile.txt", "w") or die("Unable to open file!");
                $txt = "John Doen";
                fwrite($myfile, $txt);
                $txt = "Jane Doen";
                fwrite($myfile, $txt);
                fclose($myfile);*/




                And it should work.






                share|improve this answer



























                  3












                  3








                  3







                  You need to update some of the names.



                  Rename NvM2MfExport.xml to Nv_M2MfExport.xml and add below code



                  <?xml version="1.0" encoding="UTF-8"?>
                  <config>
                  <modules>
                  <Nv_M2MfExport>
                  <active>true</active>
                  <codePool>community</codePool>
                  <depends>
                  <Mage_Checkout />
                  </depends>
                  </Nv_M2MfExport>
                  </modules>
                  </config>


                  Update your config.xml



                  <?xml version="1.0"?>
                  <config>

                  <modules>
                  <Nv_M2MfExport>
                  <version>1.0.0</version>
                  </Nv_M2MfExport>
                  </modules>

                  <global>
                  <models>
                  <nvm2mfexport>
                  <class>Nv_M2MfExport_Model</class>
                  </nvm2mfexport>
                  </models>
                  <events>
                  <checkout_cart_save_after>
                  <observers>
                  <nvm2mfexport>
                  <class>nvm2mfexport/observer</class>
                  <method>orderExport</method>
                  </nvm2mfexport>
                  </observers>
                  </checkout_cart_save_after>
                  </events>
                  </global>

                  </config>


                  Your observer class is also wrong.



                  <?php

                  class Nv_M2MfExport_Model_Observer

                  public function orderExport($observer)

                  //require_once '../app/Mage.php';
                  //Mage::app();

                  // Übergebenes Quote und Order Objekt holen
                  $order = $observer->getEvent()->getOrder();
                  $quote = $observer->getEvent()->getQuote();

                  // Nur schicken wenn tatsächlich eine Adresse zugewiesen wurde
                  if ($quote->getDistributorEmail())

                  // Lieferadresse als Text formatiert holen
                  $shipTo = $order->getShippingAddress()->format('text');
                  $itemsTxt = "Itemsn-----------------------n";

                  foreach ($order->getAllVisibleItems() as $item)
                  $itemsTxt .= 'SKU: ' . $item->getSku() . ' QTY: ' . $item->getQtyOrdered() . "n";

                  $mail = Mage::getModel('core/email')
                  ->setFromEmail('~@~.de')
                  ->setSubject('Neue Bestellung')
                  ->setToEmail('~@~.de')
                  ->setBody("Lieferadresse:nn" . $shipTo . "n" . $itemsTxt)
                  ->send();


                  /*$myfile = fopen("/var/www/magento-1.9.3.2/newfile.txt", "w") or die("Unable to open file!");
                  $txt = "John Doen";
                  fwrite($myfile, $txt);
                  $txt = "Jane Doen";
                  fwrite($myfile, $txt);
                  fclose($myfile);*/




                  And it should work.






                  share|improve this answer















                  You need to update some of the names.



                  Rename NvM2MfExport.xml to Nv_M2MfExport.xml and add below code



                  <?xml version="1.0" encoding="UTF-8"?>
                  <config>
                  <modules>
                  <Nv_M2MfExport>
                  <active>true</active>
                  <codePool>community</codePool>
                  <depends>
                  <Mage_Checkout />
                  </depends>
                  </Nv_M2MfExport>
                  </modules>
                  </config>


                  Update your config.xml



                  <?xml version="1.0"?>
                  <config>

                  <modules>
                  <Nv_M2MfExport>
                  <version>1.0.0</version>
                  </Nv_M2MfExport>
                  </modules>

                  <global>
                  <models>
                  <nvm2mfexport>
                  <class>Nv_M2MfExport_Model</class>
                  </nvm2mfexport>
                  </models>
                  <events>
                  <checkout_cart_save_after>
                  <observers>
                  <nvm2mfexport>
                  <class>nvm2mfexport/observer</class>
                  <method>orderExport</method>
                  </nvm2mfexport>
                  </observers>
                  </checkout_cart_save_after>
                  </events>
                  </global>

                  </config>


                  Your observer class is also wrong.



                  <?php

                  class Nv_M2MfExport_Model_Observer

                  public function orderExport($observer)

                  //require_once '../app/Mage.php';
                  //Mage::app();

                  // Übergebenes Quote und Order Objekt holen
                  $order = $observer->getEvent()->getOrder();
                  $quote = $observer->getEvent()->getQuote();

                  // Nur schicken wenn tatsächlich eine Adresse zugewiesen wurde
                  if ($quote->getDistributorEmail())

                  // Lieferadresse als Text formatiert holen
                  $shipTo = $order->getShippingAddress()->format('text');
                  $itemsTxt = "Itemsn-----------------------n";

                  foreach ($order->getAllVisibleItems() as $item)
                  $itemsTxt .= 'SKU: ' . $item->getSku() . ' QTY: ' . $item->getQtyOrdered() . "n";

                  $mail = Mage::getModel('core/email')
                  ->setFromEmail('~@~.de')
                  ->setSubject('Neue Bestellung')
                  ->setToEmail('~@~.de')
                  ->setBody("Lieferadresse:nn" . $shipTo . "n" . $itemsTxt)
                  ->send();


                  /*$myfile = fopen("/var/www/magento-1.9.3.2/newfile.txt", "w") or die("Unable to open file!");
                  $txt = "John Doen";
                  fwrite($myfile, $txt);
                  $txt = "Jane Doen";
                  fwrite($myfile, $txt);
                  fclose($myfile);*/




                  And it should work.







                  share|improve this answer














                  share|improve this answer



                  share|improve this answer








                  edited Apr 29 '17 at 4:08

























                  answered Apr 27 '17 at 13:41









                  Jaimin SutariyaJaimin Sutariya

                  9,39322055




                  9,39322055























                      2














                      The following code will never give you anything:



                       $order = $observer->getEvent()->getOrder();
                      $quote = $observer->getEvent()->getQuote();


                      Because the checkout_cart_save_after event only lets you retrieve the cart, see in Mage_Checkout_Model_Cart :



                      Mage::dispatchEvent('checkout_cart_save_after', array('cart'=>$this));


                      So, you can do the following:



                      $cart = $observer->getEvent()->getCart();
                      $quote = $cart->getQuote();


                      But you still have the problem of retrieving the corresponding order information. The reason behind that is because this event is not triggered necessarily after an order is placed, it's triggered after a change happens to the cart. So if one updates the quantity of an item in the cart, it's gonna trigger it and there's no order linked to it.



                      IMHO you should use the sales_order_place_after event and do the following:



                      $order = $observer->getEvent()->getOrder();
                      $quote = $order->getQuote();





                      share|improve this answer



























                        2














                        The following code will never give you anything:



                         $order = $observer->getEvent()->getOrder();
                        $quote = $observer->getEvent()->getQuote();


                        Because the checkout_cart_save_after event only lets you retrieve the cart, see in Mage_Checkout_Model_Cart :



                        Mage::dispatchEvent('checkout_cart_save_after', array('cart'=>$this));


                        So, you can do the following:



                        $cart = $observer->getEvent()->getCart();
                        $quote = $cart->getQuote();


                        But you still have the problem of retrieving the corresponding order information. The reason behind that is because this event is not triggered necessarily after an order is placed, it's triggered after a change happens to the cart. So if one updates the quantity of an item in the cart, it's gonna trigger it and there's no order linked to it.



                        IMHO you should use the sales_order_place_after event and do the following:



                        $order = $observer->getEvent()->getOrder();
                        $quote = $order->getQuote();





                        share|improve this answer

























                          2












                          2








                          2







                          The following code will never give you anything:



                           $order = $observer->getEvent()->getOrder();
                          $quote = $observer->getEvent()->getQuote();


                          Because the checkout_cart_save_after event only lets you retrieve the cart, see in Mage_Checkout_Model_Cart :



                          Mage::dispatchEvent('checkout_cart_save_after', array('cart'=>$this));


                          So, you can do the following:



                          $cart = $observer->getEvent()->getCart();
                          $quote = $cart->getQuote();


                          But you still have the problem of retrieving the corresponding order information. The reason behind that is because this event is not triggered necessarily after an order is placed, it's triggered after a change happens to the cart. So if one updates the quantity of an item in the cart, it's gonna trigger it and there's no order linked to it.



                          IMHO you should use the sales_order_place_after event and do the following:



                          $order = $observer->getEvent()->getOrder();
                          $quote = $order->getQuote();





                          share|improve this answer













                          The following code will never give you anything:



                           $order = $observer->getEvent()->getOrder();
                          $quote = $observer->getEvent()->getQuote();


                          Because the checkout_cart_save_after event only lets you retrieve the cart, see in Mage_Checkout_Model_Cart :



                          Mage::dispatchEvent('checkout_cart_save_after', array('cart'=>$this));


                          So, you can do the following:



                          $cart = $observer->getEvent()->getCart();
                          $quote = $cart->getQuote();


                          But you still have the problem of retrieving the corresponding order information. The reason behind that is because this event is not triggered necessarily after an order is placed, it's triggered after a change happens to the cart. So if one updates the quantity of an item in the cart, it's gonna trigger it and there's no order linked to it.



                          IMHO you should use the sales_order_place_after event and do the following:



                          $order = $observer->getEvent()->getOrder();
                          $quote = $order->getQuote();






                          share|improve this answer












                          share|improve this answer



                          share|improve this answer










                          answered Apr 27 '17 at 13:41









                          Raphael at Digital PianismRaphael at Digital Pianism

                          55k22121279




                          55k22121279



























                              draft saved

                              draft discarded
















































                              Thanks for contributing an answer to Magento Stack Exchange!


                              • Please be sure to answer the question. Provide details and share your research!

                              But avoid


                              • Asking for help, clarification, or responding to other answers.

                              • Making statements based on opinion; back them up with references or personal experience.

                              To learn more, see our tips on writing great answers.




                              draft saved


                              draft discarded














                              StackExchange.ready(
                              function ()
                              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f172081%2fcheckout-cart-save-after-is-not-working%23new-answer', 'question_page');

                              );

                              Post as a guest















                              Required, but never shown





















































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown

































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown







                              Popular posts from this blog

                              Grendel Contents Story Scholarship Depictions Notes References Navigation menu10.1093/notesj/gjn112Berserkeree

                              Area configuration aggregation error after install Porto themeMagento 2.1 CE Installed but front/backend not loading/workingCSS not loading on page within Magento 2 pageCannot install module in Magento 2no commands defined in the “setup” namespace. in Magento2Magento 2: Static files are present but shows 404Why do i have to always run the commands to clean cache in Magento 2.1.8?Failure reason: 'Unable to unserialize value.'Error 500 after magento migrationIn production mode the site does not loadMagento 2 : Error 500 after installing

                              Middle Expansion Olielle Resaix Definition: Uttering songs of triumph shouting with joy triumphant exulting Sejunction Journal 붙다 달 고급 품목 외출 The stretch trades the screeching tin. Definition: The act of speaking with a drawl a drawl Cough Sand Definition: An uproar a quarrel a noisy outbreak Shake Iron Publicize Horse House Baby 사과 Resaix Flaggy Jelly Temporary Unequaled Puppet A drop in the bucket Shrew 성격 회원 성질 미팅 The burn frames the tacky quality. Materialistic The smoke reduces the way. Yammoe Nondescript Cheek 얼굴 배 약하다 날리다 타다 The illegal country shows the iron. Help Rule Drearien Smoke Teaching Meaty Wasp Abraham Lincoln Jaws 진심 수리하다 Size Cork Idea Convert Think Lark John Lennon 거울 청소 군 추천하다 아이스크림