Announcement

Collapse
No announcement yet.

Exclusion of a product using Product Reviews by Tess

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

    Exclusion of a product using Product Reviews by Tess

    We are currently using the below shown conditional to hide the review form for gift certificates on the product page;

    <mvt:if expr="(l.settings:product:code NE 'e-gift-cert' AND l.settings:product:code NE 'gift-cert')">
    <mvt:item name="readytheme" param="contentsection( 'review-stars-prod' )" /></mvt:if>

    Can anyone tell me where we would place this so the email asking for a review 7 days after purchase would not be sent? I assume it would be in the Reviews Email Template: Mail After page but I need to test to see if this is correct and I don't know how to test this email.

    #2
    The Reviews by Tess module does not have a way to manually send that email via the admin. You would need to add some template code logic to only send when you want it to send.

    For example you could wrap the TGR_MailAfter_Email page template in a conditional that checks for the billing email address:

    <mvt:if expr="l.settings:order:bill_email EQ '[email protected]">

    EMAIL TEMPLATE

    </mvt:if>

    If the order billing email address does not match then the email will not send because the template will be blank.
    Nicholas Adkins
    Technical Training Specialist / Miva, Inc.
    [email protected]
    https://www.miva.com/mivalearn

    Comment


      #3
      I'm not too sure there is a way to stop the Mail After emails from sending based on the product ordered, especially if other items that are not gift certs are part of the order too.

      Also, wrapping the whole template in that conditional may end up sending a blank email.

      You could potentially do this in the TGR_MailAfter_Email template though.

      At the top of the template add something like this:
      Code:
      <mvt:comment> set order items count variable </mvt:comment>
      <mvt:assign name="l.settings:order:items_count" value="0" />
      <mvt:foreach iterator="item" array="order:items">
          <mvt:comment> update the order items count variable </mvt:comment>
          <mvt:assign name="l.settings:order:items_count" value="l.settings:order:items_count + 1" />
          <mvt:comment> check if the order has e gift cert and set varable order_has_e_gift_cert to true </mvt:comment>
          <mvt:if expr="l.settings:item:code EQ 'e-gift-cert'>
              <mvt:assign name="l.settings:order_has_e_gift_cert" value="'true'" />
          </mvt:if>
          <mvt:comment> check if the order has  gift cert and set varable order_has_gift_cert to true </mvt:comment>
          <mvt:if expr="l.settings:item:code EQ 'gift-cert'">
              <mvt:assign name="l.settings:order_has_gift_cert" value="'true'" />
          </mvt:if>
      </mvt:foreach>
      Then within the template wrap <!-- Message --> and <!-- BEGIN Items --> in a condtional like this:

      Code:
      <mvt:comment> order only contains gift cert </mvt:comment>
      <mvt:if expr="(l.settings:order:items_count EQ 1 AND (l.settings:order_has_e_gift_cert EQ 'true' OR l.settings:order_has_gift_cert EQ 'true')) OR (l.settings:order:items_count EQ 2 AND l.settings:order_has_e_gift_cert EQ 'true' AND l.settings:order_has_gift_cert EQ 'true')">
           New <!-- Message --> section code / message specific to orders for gift gertificates only (perhaps a second more personal thank you)
          (leave out the <!-- BEGIN Items --> section since there are no other items to be reviewed)
      <mvt:else>
           Original <!-- Message --> section code / message for orders with no gift cert or orders with gift cert and other items
           <!-- BEGIN Items --> ( this section will need to be altered, see below)
      </mvt:if>
      Within the <!-- BEGIN Items --> section (within the mvt:else contitional above) You will then need to wrap the code for the order:items foreach loop in a conditional like this:

      Code:
      <mvt:foreach iterator="item" array="order:items">
          <mvt:comment> check if the item is a gift cert to not show product to be reviewed </mvt:comment>
          <mvt:if expr="l.settings:item:code NE 'e-gift-cert' AND l.settings:item:code NE 'gift-cert'">
              <-------- original code for the order items that are not gift certs -------->
          </mvt:if>
      </mvt:foreach>

      TESTING THE REVIEW AFTER EMAILS

      You need to have orders in the admin that contain the products in question and the products must not have already been reviewed by the customer. Luckily for you there are probably many since you removed the review form for those products.

      Then find orders in the admin for each different scenario you may want to check for and take note of each order number.

      If you cant find all scenarios, I found it best to place test orders for each different scenario you may want to check for.

      For you it might be: order only has e-gift-cert, order only has gift-cert, order has only e-gift-cert and gift-cert, order has e-gift-cert and other items, order has gift-cert and other items.


      Then create a new blank page template with a code of something like: TGR_MailAfter_Email_Test and a name of : Reviews Email Template Mail After Testing

      Check the box for Always Link to This Page Using HTTPS if using HTTPS

      Assign the sitemap_exclude and tgreviews items to the page template under the items tab.

      Add this code to the template (it includes commented instructions)
      Code:
      <mvt:comment>
          <!-----------
              - order # 11111 only has e-gift-cert
              - order # 22222 only has gift-cert
              - order # 33333 only has e-gift-cert and gift-cert
              - order # 44444 has e-gift-cert and other items
              - order # 55555 has gift-cert and other items
          ---------->
         <!---------- update tgreviews item below to include the order number you want to test and the email you want the tests to be sent to within the single quotes ---------->
         <!---------- Then open your broswer and navigate to the canonical URI in the URIs tab above. Ex: yourdomain . com/canonical-uri ---------->
      </mvt:comment>
      <mvt:item name="tgreviews" param="Test_MailAfter_Email( 11111, '[email protected]' )" />

      Hope this helps.
      Last edited by SidFeyDesigns; 08-28-23, 09:14 PM.
      Nick Harkins
      www.loveisarose.com
      *Web Developer
      *Miva
      *Google Analytics, Search Console, Tag Manager, Merchant Center, Ads

      Comment


        #4
        Originally posted by SidFeyDesigns View Post
        Also, wrapping the whole template in that conditional may end up sending a blank email.
        If the template is blank the email will not be sent.

        Nicholas Adkins
        Technical Training Specialist / Miva, Inc.
        [email protected]
        https://www.miva.com/mivalearn

        Comment


          #5
          Originally posted by Nick View Post

          If the template is blank the email will not be sent.
          I did not know that but that is good to know. I don't think that info is in the module's documentation.

          In that case it may be better to wrap the whole email template in this:

          Code:
          <mvt:comment> set order items count variable </mvt:comment>
          <mvt:assign name="l.settings:order:items_count" value="0" />
              <mvt:foreach iterator="item" array="order:items">
              <mvt:comment> update the order items count variable </mvt:comment>
              <mvt:assign name="l.settings:order:items_count" value="l.settings:order:items_count + 1" />
              <mvt:comment> check if the order has e gift cert and set varable order_has_e_gift_cert to true </mvt:comment>
              <mvt:if expr="l.settings:item:code EQ 'e-gift-cert'>
                  <mvt:assign name="l.settings:order_has_e_gift_cert" value="'true'" />
              </mvt:if>
              <mvt:comment> check if the order has gift cert and set varable order_has_gift_cert to true </mvt:comment>
              <mvt:if expr="l.settings:item:code EQ 'gift-cert'">
                  <mvt:assign name="l.settings:order_has_gift_cert" value="'true'" />
              </mvt:if>
          </mvt:foreach>
          <mvt:comment> order does NOT only contains gift certs (1 or 1 of each) </mvt:comment>
          <mvt:if expr="NOT(l.settings:order:items_count EQ 1 AND (l.settings:order_has_e_gift_cert EQ 'true' OR l.settings:order_has_gift_cert EQ 'true')) OR NOT(l.settings:order:items_count EQ 2 AND l.settings:order_has_e_gift_cert EQ 'true' AND l.settings:order_has_gift_cert EQ 'true')">
          
                  <-------- original email template code -------->
          
          </mvt:if>
          Then within that email template code, within the <!-- BEGIN Items --> section, I would still wrap the code for the order:items foreach loop in a conditional to exclude gift certs from the list of products to review when there are other products part of the order:

          Code:
          <mvt:foreach iterator="item" array="order:items">
              <mvt:comment> check if the item is a gift cert to not show product to be reviewed </mvt:comment>
              <mvt:if expr="l.settings:item:code NE 'e-gift-cert' AND l.settings:item:code NE 'gift-cert'">
          
                  <-------- original code for the order items that are not gift certs -------->
          
              </mvt:if>
          </mvt:foreach>
          Last edited by SidFeyDesigns; 08-29-23, 07:42 PM.
          Nick Harkins
          www.loveisarose.com
          *Web Developer
          *Miva
          *Google Analytics, Search Console, Tag Manager, Merchant Center, Ads

          Comment

          Working...
          X