Announcement

Collapse
No announcement yet.

Payment Method Conditionals in Customer Email and Receipt Page

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

    Payment Method Conditionals in Customer Email and Receipt Page

    Using SD's built in 'Bank Transfer' payment method and renaming 'Cash on Delivery' to 'Click and Collect'
    I want to add an instructional paragraph for these respective methods in the Customer email (the one they get after placing an order) and the Recipt page.

    It is easy in the Order Shipped Email Inner Layout:
    Code:
    <actinic:block PHP='true' SELECTABLE='false'>
    
    $myString = '<actinic:variable encoding="htmlline" name="OrderData"/>';
    
    if (strpos($myString, "Click and Collect") !== false) {
    echo "<b>Your purchase is ready for you to collect from our store:</b><br>
    Please print this email and bring it with you together with cash or credit card for payment.<br>
    <b>Please quote this reference: <actinic:variable encoding="perl" name="OrderNumberOnlineXML" selectable="false" /> </b>";
    }
    
    if (strpos($myString, "Bank Transfer") !== false) {
    echo "<b>Please pay now by bank transfer (BACS) using the following details:</b><br> ";
    echo "<actinic:variable name="CompanyNameOnlineXML" /><br> ";
    echo "Sort-Code 20-30-40<br> ";
    echo "A/C 07654321<br> ";
    echo "Please use reference: <actinic:variable encoding="perl" name="OrderNumberOnlineXML" selectable="false" /> ";
    }
    </actinic:block>
    This does not work in the Customer email Inner Layout and on the Recipt page.

    Blockifs using some of the php has not worked:
    Code:
    $myString = '<actinic:variable encoding="htmlline" name="PaymentMethodOnlineXML" />';
    strpos($myString, "Click and Collect") !== false
    or
    Code:
    strpos('<actinic:variable encoding="htmlline" name="PaymentMethodOnlineXML" />', "Click and Collect") !== false
    Neither have php expressions of blockifs using any of the Payment Method variables:
    Code:
    <actinic:variable encoding="htmlline" name="OrderData"/>
    <actinic:variable name="PaymentMethodName" />
    <actinic:variable encoding="htmlline" name="PaymentMethodOnlineXML" />
    How can this be done?

    Thank you!

    Jonathan Chappell
    Website Designer
    SellerDeck Website Designer
    Actinic to SellerDeck upgrades
    Graphicz Limited - www.graphicz.co.uk

    #2
    I am reminded by Gary in support:

    The PHP blockifs work in the Order Shipped Email, because it is generated on the desktop and has access to the PHP compiler on the local machine, however the customer email and receipt page do not use PHP online and are mostly in their final form when actioned.
    I am looking at a jquery method and have so far got to the following. I have tested in the customer email and it doesn't work as it seems "data-myattr" is not rendered in the email, Also a string of numbers get added as a prefix to 'ID':

    Code:
    <p id="m_-747475911965428296jcpm">Payment Method: Click and Collect&nbsp;<u></u>
    </p>
    <div id="m_-747475911965428296mpcj"></div>
    Click image for larger version  Name:	emailnoattrandaddedidii.jpg Views:	0 Size:	77.7 KB ID:	556105

    I have not tested in the receipt page yet.

    Code:
    <!DOCTYPE html>
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Untitled Document</title>
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.4/jquery.min.js"></script>
    </head>
    
    <body>
    <p id="jcpm" data-myattr="Click and Collect">Payment Method: Click and Collect&nbsp;<i>PaymentPendingNoticeOnlineXML</i>
    Daffodils
    </div>
    <script>
    $(function() {
    var jcpmvar =(document.querySelector('[id$="jcpm"]').dataset.myattr);
    
    if (jcpmvar=="Click and Collect"){
    document.querySelector('[id$="mpcj"]').innerHTML = "Your purchase is ready for you to collect from our store:</b><br>Please print this email and bring it with you together with cash or credit card for payment.<br><b>Please quote this reference: <actinic:variable encoding='perl' name='OrderNumberOnlineXML' selectable='false' />";
    }
    else if (jcpmvar=="Bank Transfer"){
    document.querySelector('[id$="mpcj"]').innerHTML = "Please pay now by bank transfer (BACS) using the following details:</b><br><actinic:variable name='CompanyNameOnlineXML' /><br>Sort-Code 20-30-40<br>A/C 07654321<br>Please use reference: <actinic:variable encoding='perl' name='OrderNumberOnlineXML' selectable='false' />";
    }
    });
    </script>
    <div id="mpcj"></div>
    </body>
    </html>
    The Customer email as edited

    Code:
    <actinic:block if="%3cactinic%3avariable%20name%3d%22IsEmailCustomerReceiptEnabled%22%20%2f%3e%20%3d%3d%20True" >
    <p>ChtmlEm
    <p>Dear <actinic:variable name="CustomerNameOnlineXML"/>,
    <p>
    <p>Thank you for shopping at <actinic:variable name="CompanyName"/>. We have received and are processing the following order:
    <p>
    <p>Order Number: <actinic:variable name="OrderNumberOnlineXML"/>
    <p id="jcpm" data-myattr="<actinic:variable encoding="perl" name="PaymentMethodOnlineXML" selectable="false" />">Payment Method: <actinic:variable name="PaymentMethodOnlineXML"/>&nbsp;<actinic:variable name="PaymentPendingNoticeOnlineXML"/>
    <script>
    $(function() {
    var jcpmvar =(document.querySelector('[id$="jcpm"]').dataset.myattr);
    if (jcpmvar=="Click and Collect"){
    document.querySelector('[id^="mpcj"]').innerHTML = "Your purchase is ready for you to collect from our store:</b><br>Please print this email and bring it with you together with cash or credit card for payment.<br><b>Please quote this reference: <actinic:variable encoding='perl' name='OrderNumberOnlineXML' selectable='false' />";
    }
    else if (jcpmvar=="Bank Transfer"){
    document.querySelector('[id^="mpcj"]').innerHTML = "Please pay now by bank transfer (BACS) using the following details:</b><br><actinic:variable name='CompanyNameOnlineXML' /><br>Sort-Code 20-30-40<br>A/C 07654321<br>Please use reference: <actinic:variable encoding='perl' name='OrderNumberOnlineXML' selectable='false' />";
    }
    });
    </script>
    <div id="mpcj"></div>
    <p>
    <p>Order Date: <actinic:variable name="OrderDateOnlineXML"/>
    <p>
    <p>Ship To:
    <actinic:variable name="ShipSalutationOnlineXML"/><actinic:variable name="ShipNameOnlineXML"/><actinic:variable name="ShipNameSepOnlineXML"/><actinic:variable name="ShipTitleOnlineXML"/><actinic:variable name="ShipTitleSepOnlineXML"/><actinic:variable name="ShipCompanyOnlineXML"/><actinic:variable name="ShipCompanySepOnlineXML"/><actinic:variable name="ShipAddress1OnlineXML"/><actinic:variable name="ShipAddress1SepOnlineXML"/><actinic:variable name="ShipAddress2OnlineXML"/><actinic:variable name="ShipAddress2SepOnlineXML"/><actinic:variable name="ShipAddress3OnlineXML"/><actinic:variable name="ShipAddress3SepOnlineXML"/><actinic:variable name="ShipAddress4OnlineXML"/><actinic:variable name="ShipAddress4SepOnlineXML"/><actinic:variable name="ShipPostCodeOnlineXML"/><actinic:variable name="ShipPostCodeSepOnlineXML"/><actinic:variable name="ShipCountryOnlineXML"/><actinic:variable name="ShipCountrySepOnlineXML"/><actinic:variable name="ShipPhoneOnlineXML"/><actinic:variable name="ShipPhoneSepOnlineXML"/><actinic:variable name="ShipFaxOnlineXML"/><actinic:variable name="ShipFaxSepOnlineXML"/><actinic:variable name="ShipEmailOnlineXML"/><actinic:variable name="ShipEmailSepOnlineXML"/><actinic:variable name="ShipUserDefinedOnlineXML"/><actinic:variable name="ShipUserDefinedSepOnlineXML"/>
    <actinic:variable name="BillLabelOnlineXML"/>
    <actinic:variable name="BillSalutationOnlineXML"/><actinic:variable name="BillNameOnlineXML"/><actinic:variable name="BillNameSepOnlineXML"/><actinic:variable name="BillTitleOnlineXML"/><actinic:variable name="BillTitleSepOnlineXML"/><actinic:variable name="BillCompanyOnlineXML"/><actinic:variable name="BillCompanySepOnlineXML"/><actinic:variable name="BillAddress1OnlineXML"/><actinic:variable name="BillAddress1SepOnlineXML"/><actinic:variable name="BillAddress2OnlineXML"/><actinic:variable name="BillAddress2SepOnlineXML"/><actinic:variable name="BillAddress3OnlineXML"/><actinic:variable name="BillAddress3SepOnlineXML"/><actinic:variable name="BillAddress4OnlineXML"/><actinic:variable name="BillAddress4SepOnlineXML"/><actinic:variable name="BillPostCodeOnlineXML"/><actinic:variable name="BillPostCodeSepOnlineXML"/><actinic:variable name="BillCountryOnlineXML"/><actinic:variable name="BillCountrySepOnlineXML"/><actinic:variable name="BillPhoneOnlineXML"/><actinic:variable name="BillPhoneSepOnlineXML"/><actinic:variable name="BillFaxOnlineXML"/><actinic:variable name="BillFaxSepOnlineXML"/><actinic:variable name="BillEmailOnlineXML"/><actinic:variable name="BillEmailSepOnlineXML"/><actinic:variable name="BillUserDefinedOnlineXML"/><actinic:variable name="BillUserDefinedSepOnlineXML"/>
    <actinic:variable name="CartOnlineXML"/>
    <p>
    <p>Sincerely,
    <p><actinic:variable name="CompanyName"/>
    <p>
    <p>
    <p style="font-size: <actinic:variable name="SmallFontSize" />"><strong>Returns and Cancellations</strong><br><actinic:variable name="ReturnsPolicy" />
    <p>
    <p><actinic:variable name="ExtraFooterOnlineXML"/>
    </actinic:block>
    Advice gratefully received - Thank you
    Attached Files
    Jonathan Chappell
    Website Designer
    SellerDeck Website Designer
    Actinic to SellerDeck upgrades
    Graphicz Limited - www.graphicz.co.uk

    Comment


      #3
      It works in the Recipt Page:

      Edit layout ''Receipt Payment Method Used" :

      Code:
      <div class="row">
      <div class="cartheading col-6">
      <b><Actinic:Variable Name="PaymentMethodTitle"/></b>
      </div>
      
      <div id="jcpm" data-myattr="<Actinic:Variable Name="PaymentMethodName"/>" class="cart col-6">
      <Actinic:Variable Name="PaymentMethodName"/>&nbsp;<Actinic:Variable Name="PspPendingNotice"/>
      </div>
      </div>
      <div class="row">
      <div class="cart col-12">
      <script>
      $(function() {
      var jcpmvar =(document.querySelector('[id$="jcpm"]').dataset.myattr);
      if (jcpmvar=="Click and Collect"){
      document.querySelector('[id^="mpcj"]').innerHTML = "Your purchase is ready for you to collect from our store:</b><br>Please print this receipt and bring it with you together with cash or credit card for payment.<br><b>Please quote this reference: <Actinic:Variable Name="TheOrderNumber"/>";
      }
      else if (jcpmvar=="Bank Transfer"){
      document.querySelector('[id^="mpcj"]').innerHTML = "Please pay now by bank transfer (BACS) using the following details:</b><br><actinic:variable name="CompanyName" /><br>Sort-Code 20-30-40<br>A/C 07654321<br>Please use reference: <Actinic:Variable Name="TheOrderNumber"/>";
      }
      });
      </script>
      <div id="mpcj"></div>
      </div>
      </div>
      More as I work it out!
      Jonathan Chappell
      Website Designer
      SellerDeck Website Designer
      Actinic to SellerDeck upgrades
      Graphicz Limited - www.graphicz.co.uk

      Comment

      Working...
      X