Announcement

Collapse
No announcement yet.

Email on Sale of Specific Products

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Email on Sale of Specific Products

    Hello,
    I would love the ability to have the system send me and the different teams here an email when a specific product is sold. We have numerous parts that are built on the fly when ordered and it would be great if we could set alerts on these products to let the proper team know when one of these products sells. This will allow them to get a head start on building the product before the picking/packing team gets the pick list. This could be set up just like an out of stock notification, but just a heads up to a specific email address when the product has sold. Any way to do this now? Thank you,
    --Scott

    #2
    There are two ways:

    One, in the Order Confirmation email template, Order Contents product loop, detect the product you want to monitor. Something like this:

    <mvt:if expr="'|'$tolower(l.settings:order:item)$'|' IN 'product_code1|product_code2|product_code3|etc|">

    <mvt:assign name="g.message" value="g.message $ l.settings:order:id $ ' ' $ l.settings:order:item:code$ ' Ordered'"/>

    </mvt:if>

    Then, just outside the loop:
    <mvt:if expr="g.message">
    <mvt:do file="g.module_library_utilities" name="g.email_sent" value="SendEmail(g.to_email,g.from_email,'','Email Subject','',g.message)" />
    </mvt:if>

    Two:
    Create a copy of the Merchant Notification email template and do something similar.
    Add the Order Items loop to the top of the template.
    Run this code in side it:

    <mvt:if expr="'|'$tolower(l.settings:order:item)$'|' IN 'product_code1|product_code2|product_code3|etc|">

    <mvt:assign name="g.message" value="g.message $ l.settings:order:id $ ' ' $ l.settings:order:item:code$ ' Ordered'"/>

    </mvt:if>

    Then, wrap the rest of the entire template in :
    <mvt:if expr="g.message">

    ...rest of template

    </mvt:if>
    Bruce Golub
    Phosphor Media - "Your Success is our Business"

    Improve Your Customer Service | Get MORE Customers | Edit CSS/Javascript/HTML Easily | Make Your Site Faster | Get Indexed by Google | Free Modules | Follow Us on Facebook
    phosphormedia.com

    Comment


      #3
      Oh this is amazing! I will most likely create a custom field for the products called "Sale Notification Email" and check if that is filled or not. If it is, I can have it send an email to that address when the product sells. This is a great start. Thank you so much for the info! I had no idea where to start.
      --Scott

      Comment


        #4
        Yea, that's a pretty good way to manage the list.

        Note, verify the variable names used as I was typing from memory :)
        Bruce Golub
        Phosphor Media - "Your Success is our Business"

        Improve Your Customer Service | Get MORE Customers | Edit CSS/Javascript/HTML Easily | Make Your Site Faster | Get Indexed by Google | Free Modules | Follow Us on Facebook
        phosphormedia.com

        Comment


          #5
          Hey Bruce,
          Thank you again for the help getting started with this. Here is the simple version that I came up with. The only issue with it at this point is the \n characters do not show up as carriage returns in the g.message.

          <!-- Must have custom field with id = 'sale_notification_email' configured and selected from the list below -->

          <mvt:if expr="NOT ISNULL l.settings:item:customfield_values:customfields:sa le_notification_email">

          <mvt:assign name="g.message" value="'Order ID: ' $ l.settings:order:id $ '\nQuantity: ' $ l.settings:item:quantity $ '\nProduct ID: ' $ l.settings:item:code $ '\nProduct Name: ' $ l.settings:item:name"/>

          <mvt:assign name="g.subject" value="'ITEM ORDER ALERT: ' $ l.settings:item:name"/>

          <mvt:do file="g.module_library_utilities" name="g.email_sent" value="SendEmail(l.settings:item:customfield_value s:customfields:sale_notification_email,l.settings: store:email,'',g.subject,'',g.message)" />

          </mvt:if>


          Thank you again!
          --Scott

          Comment


            #6
            If you want line breaks, you need to use this:

            <mvt:assign name="g.lf" value="asciichar(13)$asciichar(13)" />

            then replace $ '\nProduct with $g.lf$ '\nProduct
            Bruce Golub
            Phosphor Media - "Your Success is our Business"

            Improve Your Customer Service | Get MORE Customers | Edit CSS/Javascript/HTML Easily | Make Your Site Faster | Get Indexed by Google | Free Modules | Follow Us on Facebook
            phosphormedia.com

            Comment


              #7
              Thanks again Bruce! In case anyone else is looking for this functionality, here is what I ended up with for production.

              <!-- Must have custom field with id = 'sale_notification_email' configured and selected from the custom field list below -->

              <mvt:if expr="NOT ISNULL l.settings:item:customfield_values:customfields:sa le_notification_email">

              <mvt:assign name="g.lf" value="asciichar(13)$asciichar(13)" />

              <mvt:assign name="g.message" value=" 'Product Name: ' $ l.settings:item:name $ g.lf $ 'Product ID: ' $ l.settings:item:code $ g.lf $ 'Quantity: ' $ l.settings:item:quantity $ g.lf $ 'Order ID: ' $ l.settings:order:id"/>

              <mvt:assign name="g.subject" value="'ITEM ORDER ALERT: ' $ l.settings:item:name"/>

              <mvt:do file="g.module_library_utilities" name="g.email_sent" value="SendEmail(l.settings:item:customfield_value s:customfields:sale_notification_email,l.settings: store:email,'',g.subject,'',g.message)" />

              </mvt:if>

              Comment


                #8
                Great stuff!

                Comment


                  #9
                  One thing I forgot to mention, probably not germain to this situation but VERY handy to know, is that, if an Email template evaluates to 'no content', the email does not get sent. That is, if you create a condition as in method #2 then wrap the entire template with that condition, and the condition is false, the email doesn't get sent. This is very handy for example, if you wanted to send a separate email to someone BASED in conditions of the order. Classic case, Drop Shipper Email notification: Only send email IF an order contains a drop ship item. (You could of course, also use that condition to only send the order contents of the drop shipped Items.)
                  Bruce Golub
                  Phosphor Media - "Your Success is our Business"

                  Improve Your Customer Service | Get MORE Customers | Edit CSS/Javascript/HTML Easily | Make Your Site Faster | Get Indexed by Google | Free Modules | Follow Us on Facebook
                  phosphormedia.com

                  Comment


                    #10
                    I would like to send a copy of the Merchant Order Confirmation to a drop shipper if the order contains certain products, so this is exactly what I need, but I'm having a little trouble. I created a custom product field and I duplicated the Merchant Order Confirmation email. At the very begging of this new dropship confirmation email I included;

                    <mvt:assign name="g.notification-results" value=" 'false' " />

                    <mvt:foreach iterator="item" array="order:groups">
                    <mvt:if expr="NOT ISNULL l.settings:item:customfield_values:customfields:PL ANT_NOTIFICATION">
                    <mvt:assign name="g.notification-results" value=" 'true' " />
                    <mvt:foreachstop />
                    </mvt:if>
                    </mvt:foreach>


                    Next, I surrounded the existing code with an IF condition;

                    <mvt:if expr="g.notification-results EQ 'true' ">
                    <!DOCTYPE html ...>
                    ....
                    </html>
                    </mvt:if>


                    Currently, no email is being generated. If I move the IF condition to just after the <body> tag and proceed it with a print variable to screen command;

                    <!DOCTYPE html ...>
                    <head>
                    </head>
                    <body>
                    Notification Results: &mvt:global:notification-results;<br/>
                    <mvt:if expr="g.notification-results EQ 'true' ">
                    ....
                    </mvt:if>
                    </body>
                    </html>


                    It will send an email with a single line of text, Notification Results: true. So, I know the global variable for notification-results is working but I don't know why it will not print the confirmation when the results are true.

                    Any suggestions on why this is not working would be greatly appreciated.
                    Gary

                    [email protected]
                    www.icCommerce.com

                    Comment


                      #11
                      It looks like I was over complicating things again. Changed it to the following and it's working.

                      <mvt:foreach iterator="item" array="order:groups">
                      <mvt:if expr="NOT ISNULL l.settings:item:customfield_values:customfields:PL ANT_NOTIFICATION">
                      <!DOCTYPE html ...">
                      <head> ... </head>
                      <body> ... </body>
                      </html>
                      </mvt:if>
                      </mvt:foreach>

                      Gary

                      [email protected]
                      www.icCommerce.com

                      Comment


                        #12
                        that's going to be odd if more than one product is found...

                        the problem with your original code is this:

                        <mvt:assign name="g.notification-results" value=" 'false' " />

                        variables CANNOT have "-" (dashes) as that's the minus operator (i.e., notification MINUS results

                        also, you do not need define the variable as 'false' first. Just test if its populated as in mvt:if expr="g.notification_results"

                        if empty, then that expression is false
                        Bruce Golub
                        Phosphor Media - "Your Success is our Business"

                        Improve Your Customer Service | Get MORE Customers | Edit CSS/Javascript/HTML Easily | Make Your Site Faster | Get Indexed by Google | Free Modules | Follow Us on Facebook
                        phosphormedia.com

                        Comment

                        Working...
                        X