Send different new orders emails to each supplier hiding the items of other suppliersSUPEE-7405 failing to install on my version of 1.9.1.1In Magento 1.9, why are order emails send through the queue, while Invoice emails are sent directly?Order Emails Marked as sent but not receivedHow to get the type of credit card from a MagentoSalesModelOrder?Simple Observer not firing on eventSolved: Braintree and Magestore Onestepcheckout setData() on a non-objectMagento dropshipper e-mailsMagento giving error 503 upon sending emails for New Orders, Invoice, Shipment etc.?How to use Magento 1.9 email queue to send customized email to select customers?Disable sending order email programmaticaly

What can I do to keep a threaded bolt from falling out of it’s slot

What is the latest version of SQL Server native client that is compatible with Sql Server 2008 r2

How to get distinct values from an array of arrays in JavaScript using the filter() method?

Is there a known non-euclidean geometry where two concentric circles of different radii can intersect? (as in the novel "The Universe Between")

Nuclear decay triggers

Can my Boyfriend, who lives in the UK and has a Polish passport, visit me in the USA?

How can I pack my food so it doesn't smell?

Why don't politicians push for fossil fuel reduction by pointing out their scarcity?

I think my coworker went through my notebook and took my project ideas

Why do some academic journals requires a separate "summary" paragraph in addition to an abstract?

How could China have extradited people for political reason under the extradition law it wanted to pass in Hong Kong?

Vacuum collapse -- why do strong metals implode but glass doesn't?

Are there reliable, formulaic ways to form chords on the guitar?

What professions does medieval village with a population of 100 need?

iPhone 8 purchased through AT&T change to T-Mobile

Is there such a thing as too inconvenient?

Is this kind of description not recommended?

Are there categories whose internal hom is somewhat 'exotic'?

Does git delete empty folders?

Chess software to analyze games

How does turbine efficiency compare with internal combustion engines if all the turbine power is converted to mechanical energy?

How do I intentionally fragment a SQL Server Index?

Why didn’t Doctor Strange stay in the original winning timeline?

Is Eldritch Blast affected by antimagic field



Send different new orders emails to each supplier hiding the items of other suppliers


SUPEE-7405 failing to install on my version of 1.9.1.1In Magento 1.9, why are order emails send through the queue, while Invoice emails are sent directly?Order Emails Marked as sent but not receivedHow to get the type of credit card from a MagentoSalesModelOrder?Simple Observer not firing on eventSolved: Braintree and Magestore Onestepcheckout setData() on a non-objectMagento dropshipper e-mailsMagento giving error 503 upon sending emails for New Orders, Invoice, Shipment etc.?How to use Magento 1.9 email queue to send customized email to select customers?Disable sending order email programmaticaly






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








0















Magento 1.9.4



I have more suppliers so I need to send them the email of new orders but only with their products and hide the others.



For instance:



New order with 4 different item



  • 2 items of SUPPLIER A

  • 1 item of SUPPLIER B

  • 1 item of SUPPLIER C

I have to send the emails to all 3, but I need to send them only the list of their products (and all the attributes that the customer had chosen).



What I have done so far is a config.xml like this:



<config>
<modules>
<Company_Multi>
<version>1.0.0</version>
</Company_Multi>
</modules>

<global>
<models>
<multi>
<class>Company_Multi_Model</class>
</multi>
</models>

<events>
<sales_order_place_after>
<observers>
<order_multi>
<type>singleton</type>
<class>multi/observer</class>
<method>orderMulti</method>
</order_multi>
</observers>
</sales_order_place_after>
</events>


<template>

<email>
<custom_order_tpl translate="label" module="Company Multi">
<label>Email Multi</label>
<file>template-multi.html</file>
<type>html</type>
</custom_order_tpl>
</email>

</template>
</global>
</config>


The Observer.php



class Company_Multi_Model_Observer

public function OrderMulti($event)

$order = $event->getOrder();
$this->_sendEmailSuppliers($order);


private function _sendEmailSuppliers($order)

$emailTemplate = Mage::getModel('core/email_template');

$emailTemplate->loadDefault('custom_order_tpl');
$emailTemplate->setTemplateSubject("Object");

$salesData['email'] = Mage::getStoreConfig('trans_email/ident_general/email');
$salesData['name'] = Mage::getStoreConfig('trans_email/ident_general/name');


$emailTemplateVariables['order'] = $order;


foreach($order->getAllVisibleItems() as $item)
$product = Mage::getModel('catalog/product')->load($item->getProductId());
$supplier = $product->getAttributeText('attribute_supplier');

if($supplier == 'supplierA')
$emailTemplate->send(array('supplier.a@email.com'), array('Comapany'), $emailTemplateVariables);
else if($supplier == 'supplierB')
$emailTemplate->send(array('supplier.b@email.com'), array('Comapany'), $emailTemplateVariables);
else if($supplier == 'supplierC')
$emailTemplate->send(array('supplier.c@email.com'), array('Comapany'), $emailTemplateVariables);








The emails work and all 3 suppliers get theirs, but unfortunately they get the list of all the items of the orders included the items of others suppliers.
The problem should be in this bit:



$emailTemplateVariables['order'] = $order;


That I have no clue how to hide some items from there. Any ideas?










share|improve this question
































    0















    Magento 1.9.4



    I have more suppliers so I need to send them the email of new orders but only with their products and hide the others.



    For instance:



    New order with 4 different item



    • 2 items of SUPPLIER A

    • 1 item of SUPPLIER B

    • 1 item of SUPPLIER C

    I have to send the emails to all 3, but I need to send them only the list of their products (and all the attributes that the customer had chosen).



    What I have done so far is a config.xml like this:



    <config>
    <modules>
    <Company_Multi>
    <version>1.0.0</version>
    </Company_Multi>
    </modules>

    <global>
    <models>
    <multi>
    <class>Company_Multi_Model</class>
    </multi>
    </models>

    <events>
    <sales_order_place_after>
    <observers>
    <order_multi>
    <type>singleton</type>
    <class>multi/observer</class>
    <method>orderMulti</method>
    </order_multi>
    </observers>
    </sales_order_place_after>
    </events>


    <template>

    <email>
    <custom_order_tpl translate="label" module="Company Multi">
    <label>Email Multi</label>
    <file>template-multi.html</file>
    <type>html</type>
    </custom_order_tpl>
    </email>

    </template>
    </global>
    </config>


    The Observer.php



    class Company_Multi_Model_Observer

    public function OrderMulti($event)

    $order = $event->getOrder();
    $this->_sendEmailSuppliers($order);


    private function _sendEmailSuppliers($order)

    $emailTemplate = Mage::getModel('core/email_template');

    $emailTemplate->loadDefault('custom_order_tpl');
    $emailTemplate->setTemplateSubject("Object");

    $salesData['email'] = Mage::getStoreConfig('trans_email/ident_general/email');
    $salesData['name'] = Mage::getStoreConfig('trans_email/ident_general/name');


    $emailTemplateVariables['order'] = $order;


    foreach($order->getAllVisibleItems() as $item)
    $product = Mage::getModel('catalog/product')->load($item->getProductId());
    $supplier = $product->getAttributeText('attribute_supplier');

    if($supplier == 'supplierA')
    $emailTemplate->send(array('supplier.a@email.com'), array('Comapany'), $emailTemplateVariables);
    else if($supplier == 'supplierB')
    $emailTemplate->send(array('supplier.b@email.com'), array('Comapany'), $emailTemplateVariables);
    else if($supplier == 'supplierC')
    $emailTemplate->send(array('supplier.c@email.com'), array('Comapany'), $emailTemplateVariables);








    The emails work and all 3 suppliers get theirs, but unfortunately they get the list of all the items of the orders included the items of others suppliers.
    The problem should be in this bit:



    $emailTemplateVariables['order'] = $order;


    That I have no clue how to hide some items from there. Any ideas?










    share|improve this question




























      0












      0








      0








      Magento 1.9.4



      I have more suppliers so I need to send them the email of new orders but only with their products and hide the others.



      For instance:



      New order with 4 different item



      • 2 items of SUPPLIER A

      • 1 item of SUPPLIER B

      • 1 item of SUPPLIER C

      I have to send the emails to all 3, but I need to send them only the list of their products (and all the attributes that the customer had chosen).



      What I have done so far is a config.xml like this:



      <config>
      <modules>
      <Company_Multi>
      <version>1.0.0</version>
      </Company_Multi>
      </modules>

      <global>
      <models>
      <multi>
      <class>Company_Multi_Model</class>
      </multi>
      </models>

      <events>
      <sales_order_place_after>
      <observers>
      <order_multi>
      <type>singleton</type>
      <class>multi/observer</class>
      <method>orderMulti</method>
      </order_multi>
      </observers>
      </sales_order_place_after>
      </events>


      <template>

      <email>
      <custom_order_tpl translate="label" module="Company Multi">
      <label>Email Multi</label>
      <file>template-multi.html</file>
      <type>html</type>
      </custom_order_tpl>
      </email>

      </template>
      </global>
      </config>


      The Observer.php



      class Company_Multi_Model_Observer

      public function OrderMulti($event)

      $order = $event->getOrder();
      $this->_sendEmailSuppliers($order);


      private function _sendEmailSuppliers($order)

      $emailTemplate = Mage::getModel('core/email_template');

      $emailTemplate->loadDefault('custom_order_tpl');
      $emailTemplate->setTemplateSubject("Object");

      $salesData['email'] = Mage::getStoreConfig('trans_email/ident_general/email');
      $salesData['name'] = Mage::getStoreConfig('trans_email/ident_general/name');


      $emailTemplateVariables['order'] = $order;


      foreach($order->getAllVisibleItems() as $item)
      $product = Mage::getModel('catalog/product')->load($item->getProductId());
      $supplier = $product->getAttributeText('attribute_supplier');

      if($supplier == 'supplierA')
      $emailTemplate->send(array('supplier.a@email.com'), array('Comapany'), $emailTemplateVariables);
      else if($supplier == 'supplierB')
      $emailTemplate->send(array('supplier.b@email.com'), array('Comapany'), $emailTemplateVariables);
      else if($supplier == 'supplierC')
      $emailTemplate->send(array('supplier.c@email.com'), array('Comapany'), $emailTemplateVariables);








      The emails work and all 3 suppliers get theirs, but unfortunately they get the list of all the items of the orders included the items of others suppliers.
      The problem should be in this bit:



      $emailTemplateVariables['order'] = $order;


      That I have no clue how to hide some items from there. Any ideas?










      share|improve this question
















      Magento 1.9.4



      I have more suppliers so I need to send them the email of new orders but only with their products and hide the others.



      For instance:



      New order with 4 different item



      • 2 items of SUPPLIER A

      • 1 item of SUPPLIER B

      • 1 item of SUPPLIER C

      I have to send the emails to all 3, but I need to send them only the list of their products (and all the attributes that the customer had chosen).



      What I have done so far is a config.xml like this:



      <config>
      <modules>
      <Company_Multi>
      <version>1.0.0</version>
      </Company_Multi>
      </modules>

      <global>
      <models>
      <multi>
      <class>Company_Multi_Model</class>
      </multi>
      </models>

      <events>
      <sales_order_place_after>
      <observers>
      <order_multi>
      <type>singleton</type>
      <class>multi/observer</class>
      <method>orderMulti</method>
      </order_multi>
      </observers>
      </sales_order_place_after>
      </events>


      <template>

      <email>
      <custom_order_tpl translate="label" module="Company Multi">
      <label>Email Multi</label>
      <file>template-multi.html</file>
      <type>html</type>
      </custom_order_tpl>
      </email>

      </template>
      </global>
      </config>


      The Observer.php



      class Company_Multi_Model_Observer

      public function OrderMulti($event)

      $order = $event->getOrder();
      $this->_sendEmailSuppliers($order);


      private function _sendEmailSuppliers($order)

      $emailTemplate = Mage::getModel('core/email_template');

      $emailTemplate->loadDefault('custom_order_tpl');
      $emailTemplate->setTemplateSubject("Object");

      $salesData['email'] = Mage::getStoreConfig('trans_email/ident_general/email');
      $salesData['name'] = Mage::getStoreConfig('trans_email/ident_general/name');


      $emailTemplateVariables['order'] = $order;


      foreach($order->getAllVisibleItems() as $item)
      $product = Mage::getModel('catalog/product')->load($item->getProductId());
      $supplier = $product->getAttributeText('attribute_supplier');

      if($supplier == 'supplierA')
      $emailTemplate->send(array('supplier.a@email.com'), array('Comapany'), $emailTemplateVariables);
      else if($supplier == 'supplierB')
      $emailTemplate->send(array('supplier.b@email.com'), array('Comapany'), $emailTemplateVariables);
      else if($supplier == 'supplierC')
      $emailTemplate->send(array('supplier.c@email.com'), array('Comapany'), $emailTemplateVariables);








      The emails work and all 3 suppliers get theirs, but unfortunately they get the list of all the items of the orders included the items of others suppliers.
      The problem should be in this bit:



      $emailTemplateVariables['order'] = $order;


      That I have no clue how to hide some items from there. Any ideas?







      magento-1.9 email order-email






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Aug 8 at 9:36







      Xavier

















      asked Aug 7 at 23:07









      XavierXavier

      1251 gold badge1 silver badge9 bronze badges




      1251 gold badge1 silver badge9 bronze badges























          0






          active

          oldest

          votes














          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%2f284755%2fsend-different-new-orders-emails-to-each-supplier-hiding-the-items-of-other-supp%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes















          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%2f284755%2fsend-different-new-orders-emails-to-each-supplier-hiding-the-items-of-other-supp%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

          Get product attribute by attribute group code in magento 2get product attribute by product attribute group in magento 2Magento 2 Log Bundle Product Data in List Page?How to get all product attribute of a attribute group of Default attribute set?Magento 2.1 Create a filter in the product grid by new attributeMagento 2 : Get Product Attribute values By GroupMagento 2 How to get all existing values for one attributeMagento 2 get custom attribute of a single product inside a pluginMagento 2.3 How to get all the Multi Source Inventory (MSI) locations collection in custom module?Magento2: how to develop rest API to get new productsGet product attribute by attribute group code ( [attribute_group_code] ) in magento 2

          Category:9 (number) SubcategoriesMedia in category "9 (number)"Navigation menuUpload mediaGND ID: 4485639-8Library of Congress authority ID: sh85091979ReasonatorScholiaStatistics

          Magento 2.3: How do i solve this, Not registered handle, on custom form?How can i rewrite TierPrice Block in Magento2magento 2 captcha not rendering if I override layout xmlmain.CRITICAL: Plugin class doesn't existMagento 2 : Problem while adding custom button order view page?Magento 2.2.5: Overriding Admin Controller sales/orderMagento 2.2.5: Add, Update and Delete existing products Custom OptionsMagento 2.3 : File Upload issue in UI Component FormMagento2 Not registered handleHow to configured Form Builder Js in my custom magento 2.3.0 module?Magento 2.3. How to create image upload field in an admin form