Submit a request

What Merge Codes are available?

Follow

Comments

40 comments

  • Avatar
    Jason

    ##RESETPASSWORDURL## 

  • Avatar
    Jason

    Please list all conditions able to be used with conditional merges:

    ##IF[StoreID=1]## True Content ##ELSE## False Content ##ENDIF##

  • Avatar
    Placeholder Support #5

    Jason,

    The conditional mergecodes listed are the only ones available for performing logic.

  • Avatar
    Jason

    Missing 

    $$ROOTCATEGORYIMAGE$$

    $$SUBCATEGORIES$$

    $$CATPRODUCTCOUNT$$ 

  • Avatar
    Paul Component Engineering

    The new design of this page with the collapsing sections makes it hard to find merge codes by using CMD+F.

  • Avatar
    Blake Petersen

    Paul, click "Expand All" and you're good to go.

  • Avatar
    Agnes Doue

    " ##LOGINMESSAGE[message=Welcome ##CUSTOMERFIRSTNAME##!]## - Notice this is a merge within a merge. To get a comma, use the character entity code for it: #44 (without the space after the ","). "

    I have tried this, and I get "#44" rather than "," in my display. Please explain a little more.

    Thanks. --Aggie

  • Avatar
    Blake Petersen

    Hi Aggie,

    "#44" needs to be wrapped in "&" and ";" in order to be recognized as an entity code. So if you use "," instead of "#44", you should be good to go. You can see additional entity codes at  http://www.w3schools.com/tags/ref_entities.asp

    -Blake

  • Avatar
    Ryan Olson

    You can also get more control over what you show with the 

    ##IF[LoggedIn]##

    Put content here, ##CUSTOMERFIRSTNAME##, and here.

    ##ENDIF##

     

    Conditional Merge.

  • Avatar
    Agnes Doue

    Blake thank you a lot for the &; wrapper (worked fine) and the link (W3 schools tab is usually open in my browser).

    Ryan, thank you. I have that If statement working. However, I don't know how to get rid of the comma when a customer is not logged in, i.e., I need an ELSE statement... I can't figure out what "language" this is in to look up how to code it, nor do I know what the condition would be labeled (NotLoggedIn, LogggedOut, etc.) Will you help?

    Thanks, Aggie

  • Avatar
    AmeriCommerce Developer

    You can do 

    ##IF[LoggedIn]## Something ##ELSE## Something else ##ENDIF##

     

    These are called conditional merges and actually are covered in this article.

     

    What exactly are you trying to do? It sounds like you could just put the comma inside the conditional too.

  • Avatar
    Agnes Doue

    I tried both of these two:

    1.

          ##IF[LoggedIn]##

          <li>Welcome, ##CUSTOMERFIRSTNAME##</li>

          ##ENDIF##

    2.

          ##IF[LoggedIn]##

          <li>Welcome, ##CUSTOMERFIRSTNAME##</li>

          ##ELSE##

          <li>Welcome</li>

          ##ENDIF##

    Either way, what I see when logged out is "Welcome," and when logged in, "Welcome, Lou" ... Ideas? Thanks.

  • Avatar
    AmeriCommerce Developer

    Hi Agnes,

    What you have looks correct. I think you are probably logged into the admin. If that is the case the LoggedIn condition is considered true no matter what.

    Try viewing it in a different browser where you aren't logged in to the admin or in an Incognito/Private window.

     

    Ryan

  • Avatar
    Agnes Doue

    OMG Thank you! I would never have guessed.  --Aggie

  • Avatar
    Justin Murphy

    Is anyone familiar with a way to display the levels of sub-categories individually? For example, if I have...

    Movies > DVDs > Drama > New Releases

    ...I understand that I can display the entire navigation using $$CATEGORYTRAIL$$.

    However, I would like to modify the way this is displayed, so that it shows like this:

    Movies

    DVDs

    Drama

    New Releases

    I imagine it would look like something this:

    ##SUBCATEGORYLEVEL1##

    ##SUBCATEGORYLEVEL2##

    ##SUBCATEGORYLEVEL3##

    ##SUBCATEGORYLEVEL4##

    Do this mystery merge code exist, or is there another way to accomplish this?

    Thank you!

    Justin

  • Avatar
    Blake Petersen

    You can take the markup derived from the $$CATEGORYTRAIL$$ and use CSS and/or Javascript to style it to your liking. Examples: 

    CSS and jQuery:  http://jsfiddle.net/BlakePetersen/c2sF4/

    All jQuery:  http://jsfiddle.net/BlakePetersen/c2sF4/1/

  • Avatar
    Justin Murphy

    Hi, Blake. Thank you for your wonderful input. I have two questions:

    *Question One

    I have the ">" character where you put " " and I am having trouble modifying your script to remove the ">".

    I tried this...

    $(".ProductDetailsCategoryTrail").each(function () {

    $(this).children('a').css('display','block');

    $(this).html($(this).html().replace(/ > /g, ''));

    });

    But I could not get it to perform the way I want it to.

    *Question Two:

    We currently utilize the $$CATEGORYTRAIL$$ at the top of our page. I am inquiring about this for a secondary usage towards the middle of the page. This is part of the reason why I was initially hoping to find a merge code that lets me break the trail apart, so that there would be no conflicting scripts on the page. Do you know of a way that I can tell the script to ignore the top merge code and apply only to the one below?

    Thanks,

    Justin

     

     

  • Avatar
    AmeriCommerce Developer

    The ">" character is store text. The key is "Catalog_BreadcrumbSeperator_string".

    You could achieve what you want without javascript simply by making the store text value a break. "<br>"

  • Avatar
    Justin Murphy

    That's a good idea, but that would still not solve my problem I listed in Question Two:

    I want to reference the $$CATEGORYTRAIL$$ in multiple places on the page. I want the first one to be the standard version (Movies > DVDs > Drama > New Releases) and the second to be modified version:

    Movies

    DVDs

    Drama

    New Releases

    Let me know if you have any questions.

    Thanks,

    Justin

  • Avatar
    AmeriCommerce Developer

    oops. Didn't see that part. In that case you would need to use the javascript Blake provided. 

    This line should work in place of the original:

    $(this).html($(this).html().replace(/>/g, ''));

  • Avatar
    Blake Petersen

    Hi Justin,

    This should get you where you need to be -- http://jsfiddle.net/BlakePetersen/c2sF4/2/. Let me know if you have any questions on what's going on and I'd be happy to explain.

    Regarding the reasoning as to why $(this).html($(this).html().replace(/ > /g, '')); failed, the value to be replaced ('/ > /' in this case) is expected to be an html entity expressed in regex (or '/>/'). Also, adding the g after the 2nd slash applies this globally, so it will replace all instances of that regex value within scope. If you kept it off, it would just replace the first item and call it quits.

    Hope this helps!

    -Blake

  • Avatar
    Justin Murphy

    Hi Blake & AC Dev -

    That did the trick! Thank you very much for all of your great input.

    You both definitely went above and beyond what I was expecting. Blake, thank you for walking me through those scripts. It was a very good learning experience for me and is much appreciated.

    Regards, 

    Justin

  • Avatar
    Brandon Young

    You can also use ##EXPIRINGREWARDPOINTS##

  • Avatar
    Reblin, Teri

    How do you format a conditional statement with a custom order field?

  • Avatar
    Lucas Lovett

    Teri,

    The conditional merge codes on this page are the only conditional merge codes supported, so if its not on this page then its not in the system.

    However, I think you'll want to look into our Generic Variable Merge code functionality, http://support.americommerce.com/hc/en-us/articles/201904650-How-do-you-use-Generic-Variable-Merges-. With this, you should be able to set a conditional variable merge, and run checks on it later.

    So something like this:

    ##SET[Variable=##CUSTOMORDERFIELDMERGECODE##]##
    ##IF[Variable=TRUE]##
    Content
    ##ELSE##
    Else content
    ##ENDIF##

    As always, let us know if you have any additional questions.

    Lucas

  • Avatar
    Trevia Baltimore

    Are there any other merge codes for gift certificates? I can't get any to show up on the front end in the customer's account dashboard.

  • Avatar
    Jeremy Roberts

    It would be great if conditionals could be nested AND/OR basic boolean logic... AND NOT (or !) added to conditionals...

    There are times when I want to serve content ONLY to customers that are NOT logged in AND if not logged in AND cart is not empty, then serve content.
    BUT if logged in, don't serve.

    But we can't nest or combine conditionals.

    A perfect use of this logic would be for an exit-intent popup.

    IF customer is logged in: don't do anything
    IF customer is not logged in:
    (if cart is empty, serve content A)
    (if cart is not empty, serve content B)

    ##ENDIF##

    This is so incredibly powerful, adding nesting and boolean would take it to another level. Thanks for listening.

  • Avatar
    Brandon Young

    Is it possible to call an item on a content page and how would I do this. For example I am trying to make a page that shows items based on the industry they are in. I would like to call a specific item and use merge codes to show the items ##SHORTDESCRIPTION## and other things.

  • Avatar
    Implementation

    @Brandon, you can use the SETITEMBYID mergecode. For example:

    ##SETITEMBYID[123]##

    ##ITEMNAME## is the best product.

    ##LONGDESCRIPTION1##

    ##ENDSETITEM##

  • Avatar
    Brandon Young

    Wow I didn't even notice that above. Thank you

Please sign in to leave a comment.