Submit a request

List of Available Merge Codes

Follow

Feature Request

Need an integration or feature that doesn't exist?

Our experienced development team is always looking to add new capabilities to the platform. Let us know what you are looking for!


Enterprise Support

Is your company in need of full time 24/7 AmeriCommerce support?

Our Enterprise support plan is the perfect fit for large operations needing the commitment of our team outside of standard operating hours.

Comments

54 comments

  • Avatar
    Jason

    Missing 

    $$ROOTCATEGORYIMAGE$$

    $$SUBCATEGORIES$$

    $$CATPRODUCTCOUNT$$ 

    1
    Comment actions Permalink
  • Avatar
    Joshua Artman

    Interesting, I tested that code on our template before I sent it to you, and it worked on our template. 

    I took your code and slightly modified it to work inside of the each loop from my code and the following works on our theme:

    $(function(){ //fire when the page is done loading
      $('.ProductDetailsPrice, .CategoryProductPrice').each(function(){
     const interestLowRate = 0.065;
    const loanMonthsNumber = 60;
    var loanTotalAmount = $(this).text();
    var useThisAmount = parseFloat(loanTotalAmount.replace(/\$|,/g, ''));
    var intLowest = interestLowRate / 12;
    var compoundInt = Math.pow(1 + intLowest, loanMonthsNumber);
    monthlyPaymentLowest = Math.round(useThisAmount * (intLowest * compoundInt) / (compoundInt - 1));
    if (useThisAmount >= 5000) {
    $(this).append("FINANCE AS LOW AS $" + monthlyPaymentLowest + "/month");
    }
      });
    });  //END fire when the page is done loading

    If that does not work for you, you might want to verify if your theme is using the classes "ProductDetailsPrice" and "CategoryProductPrice" for the prices.

    1
    Comment actions Permalink
  • Avatar
    Brandon Young

    What if I want to call the category that the item is in. I have tried a few things but cant get this to work. Or even being able to call a certain category instead of an item would be fine

    0
    Comment actions Permalink
  • 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.

    0
    Comment actions Permalink
  • Avatar
    Joshua Artman

    Per AmeriCommerce Support:

    ##CURRENTDATE## merge formatting that is was not fully documented but works:

    Examples:

    ##CURRENTDATE[yyyy/MM/dd hh:mm]##
    

    This will give the date and time down to the seconds.

    ##CURRENTDATE[hh:mm]##
    

    This will only give the hours and minutes.

    ##CURRENTDATE[hh:mm’:’ss.fffffff]##
    

    This will give the hours and minutes and include fractions of a second.

    ##CURRENTDATE[fffffff]##
    

    This will only output the fractions of a second to 7 places. This would function almost like a random number.

     

    0
    Comment actions Permalink
  • Avatar
    Paul Ackley

    Is there a merge code to show the $$ of the discount when reward points are used as a partial payment so it shows up on the customers invoice as a discount - currently when they apply points it doesn't show its been applied anywhere except on the admin screen as loyalty payment- the customers think the points weren't applied at all because they don't see it.

    0
    Comment actions Permalink
  • Avatar
    Joshua Artman

    Hi Kathy,

    I modified the code so it should add a message after any price on the category, search or product details pages if your theme uses the same classes as our theme does for the $$PRICE$$ merge code:

    $('.ProductDetailsPrice, .CategoryProductPrice').each(function(){
    var this_price = $(this).text().replace('$','').replace(',','');//get price and remove $ and coma
    this_price = Number(this_price); // make sure the value is treated as a number not a string
    if(this_price > 100){ //check if the price is over $100
    var my_message="<div class='alert alert-info small'>This is my message</div>";//div to append
    $(this).after(my_message); //append message if over price threshold
    }
    });

     

    0
    Comment actions Permalink
  • Avatar
    Kathy Sechrist

    Sweet! Thanks Joshua!

    I already hammered out something that works on the product details page, but I was struggling to make it work on the category page - I should have mentioned that. And I'm not changing the price, I'm appending a small div with additional info if the price is high.  I'm going to toy with your code today to see if I can make it work on the category page. My hope is to get something that works on ANY page so I can add it to the global footer.

    0
    Comment actions Permalink
  • Avatar
    Kathy Sechrist

    I need to do some math on product prices - how would I get this into a javascript variable? (JS is not my strong suit - many thanks and virtual beers to anyone who can help!)

    $$PRICE$$

    or

    $$ITEMPRICE$$

    0
    Comment actions Permalink
  • Avatar
    Joshua Artman

    Hi Kathy,

    How you would go about this would depend on where you are trying to do this.  The $$PRICE$$ and $$ITEMPRICE$$ include HTML in them, and seem to render different html with different CSS classes in different places. 

    For example on our product details template we use the $$PRICE$$ merge in a couple places and they do not all render the same.  For the ones in our carousels $$PRICE$$ renders as the following:

    <span class="ProductDetailsPrice">$1.98</span>

    But we use the same merge code for the price of the main product and $$PRICE$$ renders as the following in that instance:

    <span id="lblPriceArea" class="ProductDetailsPriceArea">
    <span id="lblPriceLabel" class="ProductDetailsPriceLabel">Price: </span>
    <span id="lblPrice" class="ProductDetailsPrice PriceToUpdate">$0.86</span>
    </span>

    However, at least on the product details template, the $$PRICE$$ in both instances includes the "ProductDetailsPrice" class, at least for both of our uses of $$PRICE$$, so you could use that in Javascript to pull those values into your script. 

    I believe you are using JQuery, so in that case you could do something like:

    //example applying 10% discount to all prices on product details template
    $('.ProductDetailsPrice').each(function(){
    var this_price = $(this).text().replace('$','').replace(',','');//get price and remove $ and coma
    this_price = Number(this_price); // make sure the value is treated as a number not a string
    var new_price=this_price*.9; //give 10% discount or charge 90% of the original price
    new_price = new_price.toFixed(2);//limit to 2 decimal places. Note: toFixed does not always round as expected.
    new_price = "$"+new_price.toLocaleString("en-US"); //add dollar sign and format number with comas if over $1,000. 
    $(this).text(new_price); //update value on page
    });

    This would take every price on your page that has a class of 'ProductDetailsPrice' remove 10% and update what is shown.

    You could also modify your template(s) to have a hidden field that you can call in your JavaScript that contains the ##RAWPRICE## merge code so you do not have to deal with stripping the $ and Comas out of the value.

    Anyway, hopefully this will help point you in the right direction.

    0
    Comment actions Permalink
  • Avatar
    Kathy Sechrist

    Bummer. I'm getting the same error with your newest code that I got with my modification of your previous code :

    cannot use 'in' operator to search for "length" in "5900.00"    jquery.min.js:2:1065

    Here's a simplified version of what worked on the product details page:

    const interestLowRate = 0.065;
    const loanMonthsNumber = 60;
    var loanTotalAmount = document.getElementById('lblPrice').textContent;
    var useThisAmount = parseFloat(loanTotalAmount.replace(/\$|,/g, ''));
    var intLowest = interestLowRate / 12;
    var compoundInt = Math.pow(1 + intLowest, loanMonthsNumber);
    monthlyPaymentLowest = Math.round(useThisAmount * (intLowest * compoundInt) / (compoundInt - 1));
    if (useThisAmount >= 5000) {
    $('#lblPrice').append("FINANCE AS LOW AS $" + monthlyPaymentLowest + "/month");
    }

     

    0
    Comment actions Permalink
  • 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.

    0
    Comment actions Permalink
  • Avatar
    Юлия

    Can you copy here email merges from old admin? There was long list of email merges on page for email templates editor. For example ##STORETECHCONTACTEMAIL##. http://releasehistory.sparkpay.com/release-history/feature-new-store-merges

    0
    Comment actions Permalink
  • Avatar
    tnovak

    Is there a merge code for the abandoned cart that is a link back to the users cart with their items and information still in it? I see this in a lot of other store abandoned cart emails and it's a definite help for the user to be able to just click the link and have everything there still to complete the purchase.

    0
    Comment actions Permalink
  • Avatar
    Jeremy Roberts

    Is it possible to see a changelog for this document?

    You guys appear to be adding mergecodes (thank you) but store admins can't be expected to memorize every mergecode available.
    How will we know when you add something?
    This is not super-secret sauce -- how about adding the added-on date to new mergecode entries?
    Thanks.

    0
    Comment actions Permalink
  • Avatar
    Blake Petersen

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

    0
    Comment actions Permalink
  • Avatar
    Reblin, Teri

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

    0
    Comment actions Permalink
  • Avatar
    Implementation

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

    ##SETITEMBYID[123]##

    ##ITEMNAME## is the best product.

    ##LONGDESCRIPTION1##

    ##ENDSETITEM##

    0
    Comment actions Permalink
  • 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

    0
    Comment actions Permalink
  • Avatar
    Brandon Young

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

    0
    Comment actions Permalink
  • 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

    0
    Comment actions Permalink
  • 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.

    0
    Comment actions Permalink
  • 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

    0
    Comment actions Permalink
  • Avatar
    Brandon Young

    You can also use ##EXPIRINGREWARDPOINTS##

    0
    Comment actions Permalink
  • 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.

    0
    Comment actions Permalink
  • 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.

    0
    Comment actions Permalink
  • 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

    0
    Comment actions Permalink
  • 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.

    0
    Comment actions Permalink
  • Avatar
    Agnes Doue

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

    0
    Comment actions Permalink
  • Avatar
    Kathy Sechrist

    I need a way to show different content in the left column of various category pages. I didn't see a way to do this in the category editor, so I thought CONDITIONAL MERGES! But I don't see anything here that would work - did I miss it or does this not exist?

    0
    Comment actions Permalink

Please sign in to leave a comment.

We're Here To Help


Standard Support Hours: Monday-Friday 8AM-6PM CST
Looking for Premium Support? Just ask!

Speak to a live person
1 (800) 936-9006
Submit A Support Ticket
Submit Your Ticket Here