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
    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
    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
    tnovak

    Is there a way to add an image alt tag which calls the category or product name for each image in the theme files using the merge codes for $$CATEGORYTHUMBNAIL$$, $$THUMBNAIL$$, $$MAINPHOTO$$? It would be much less work to set them up that way than to have to manually include the alt tag in each category or per product.

    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
    Юлия

    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
    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
    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
  • Avatar
    Kathy Sechrist

    Oh!!! I found this about variable merges and got it working - this will work, and my mind is now reeling with all the other possibilities... https://support.sparkpay.com/hc/en-us/articles/201904650-How-to-use-Generic-Variable-Merges

    0
    Comment actions Permalink
  • Avatar
    Brandon Young

    Just thought I would add another Merge Code I came across to link to external scripts:

    ##INCLUDESCRIPTBOTTOM[YOUR SCRIPT LOCATION]##
    ex:
    ##INCLUDESCRIPTBOTTOM[##THEMEDIR##js/product-page.js]##

    0
    Comment actions Permalink
  • Avatar
    AmeriCommerce Developer

    Thanks, Brandon.

    I've added this merge to the General Use Website merge section.

    --Austin
    SPOS Support

    0
    Comment actions Permalink
  • Avatar
    Kathy Sechrist

    I'm putting Customer Type in Admin order emails - removed the ELSE hoping it would do nothing if not matched.

    Instead, the email has a blank line for every IF that wasn't matched. I have 6 customer types so that's a lot of blank lines.

    Is there a way to indicate "do nothing" in an IF statement?

    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
    Fornel M. Aller

    Thankyou

    0
    Comment actions Permalink
  • Avatar
    colin

    am I correct in the notion that there are no conditional email merge codes other than 

    • ##IF[OrderIsGift]## content ##ELSE## content ##ENDIF## (else if optional)

    it sure would be nice to have variable merges there, as shown in your "generic page variables" for example:

    • set the order balance to a variable
    • check to see if order balance is above 0
    • if order balance is above zero, show ##ORDERPAYMENTLINK##
    • else, show nothing
    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

    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
    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

    Thank you Joshua! That's very different from what I was trying (which wasn't working) - I'll give it a shot.

    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
    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
    Kathy Sechrist

    Joshua - I'm in the weeds on something else now but should be able to try that this afternoon.

    THANK YOU. Whether this works or not, I owe you a whole bunch of (virtual) beers just for trying so hard to help me!

     

    0
    Comment actions Permalink
  • Avatar
    Kathy Sechrist

    Joshua - OMG THAT WORKED!  I owe you BIG time! THANK YOU!!

    0
    Comment actions Permalink
  • Avatar
    Joshua Artman

    Kathy - You are welcome, glad it worked for you!

    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