How to change the behavior of your purchase buttons
NOTE: You need some basic understanding of HTML in order to do what is required here. To pass the parameters described below, you can simply hardcode them into the button's
All Cart and Buy Now button codes provided by E-junkie contain a purchase link URL which looks basically like this:
...where XXXXXX is the item number and YYYYY is your E-junkie client account ID (your actual URLs will have some additional parameters which determine whether the URL works as a cart or a Buy Now button).
To pass a custom variable for the full order:
&custom=value_you_want_to_pass at the end of your Add to Cart or Buy Now buttons' purchase link URL. This will be passed back to you in the Sale Notification email and transaction log, as well as your Integration URL and/or keygen URL (if configured), and you can choose to display it in your Thank-you Page and/or Thank-you Email as well. This value can be up to 255 characters long, and for best results we'd recommend using only letters, numbers, dots.dashes-and_underscores (or at least avoid Reserved or Unsafe characters in URLs).
Although this custom value is passed to the cart by clicking an Add to Cart button, the custom value itself is only associated with the whole order, rather than any particular item in the order, so there can be only one custom value per order. If more than one button has a Custom value, only the Custom value of the last button clicked will be passed with the order. If you need to pass the same custom value regardless of which Add to Cart button(s) the buyer clicks, make sure you append the custom parameter to the URL of every Add to Cart button the buyer might use that could pass the custom value into the cart.
You would normally use Variants or Variations for that, but E-junkie only allows up to 6 options values to be passed in our buttons (up to 3 menus for "Variants affecting price/weight/stock/SKU", and/or up to 3 menus or text fields for "Variations which tell more about the product"). Information such as buyer name, email, and address can be collected during checkout if you enable Require Buyer's Shipping Address for your product(s) (even if you won't actually be using our shipping calculation feature).
If you need more fields, then with some additional custom scripting at your end, you could have additional menus/fields on your page that would get concatenated (strung together) into the max. 3 Variations fields that can be passed into the cart by dynamically appending them to the button URL, as shown below. This would also work if you need to pass some Variations values to checkout automatically without manual buyer input:
(This string can't be more than 64 characters. If that's not enough, you can add the following.)
(These strings can't be more than 64 characters each.)
This will work for E-junkie Add to Cart buttons regardless of checkout method, but for Buy Now buttons it will only work with PayPal checkout. Note that every
os# (option selection) value needs to be accompanied by a corresponding
on# (option name) value -- e.g.,
os0 must be accompanied by an
on0), and higher-index pairs will only be passed if lower-index pairs are also passed -- i.e.,
os1 can only be passed if
os0 are also being passed, and
os2 can only be passed if
os1 are also being passed.
- E-junkie Add to Cart buttons:
&amount=amount_you_want_to_passat the end of the purchase link URL in your Add to Cart button. This amount will be added to the price you have set in admin, so buyers will be shown the combined price.
- E-junkie Buy Now buttons:
&amount=amount_you_want_to_passat the end of the purchase link URL in your button. This amount will override the price you have set in Seller Admin, as long as it meets or exceeds that price.
N is your desired quantity) at the end of the purchase link URL in your button code. Passed quantity will be ignored if you have set item price as 0.00 in Admin, as free products are limited to orders of 1 unit at a time. You can also disable the Let buyer edit quantity setting for the product, e.g. if you want buyers to add more than 1 unit to their cart without allowing the buyer to edit it back down to 1 nor adjust the quantity any higher.
Any GET parameter (e.g.
&name=value) that would normally be passed in the query string of an E-junkie Add to Cart button's
action= URL can also be passed as a POST parameter in an E-junkie Add to Cart form, and vice-versa. This can come in quite handy when programming scripts to perform custom functions that E-junkie does not natively support.
For instance, product option values using Variations, which the buyer normally selects from a menu or enters in a text field, can also be passed in the button URL as
&on0=somename&os0=somevalue...etc.; these parameter values can be completely arbitrary and don't have to match anything in the product's settings, but note the length limitations and pairing requirements in the "Pass custom values per product" section discussed above.
Likewise, option values using Variants can be passed directly in the Add to Cart button URL as
&o1=this&o2=that&o3=other; in this case, note the values you pass must match a combination of values you have defined in your Variants configuration. For a more detailed explanation, please see this tutorial.
Moreover, parameters that are normally passed in the button URL (such as
&i=XXXXXX for the item number) could instead be passed via form fields or menus -- e.g., you could show a single Add to Cart button with a menu to pick which item it adds to the cart, as in the example code below, where
XXXXXX represents your E-junkie Client ID, and
ZZZZZZ represent the item numbers of products named "Widget" and "Wibble":
<form action="https://www.e-junkie.com/ecom/gb.php?c=cart&ejc=2&cl=XXXXXX" target="ej_ejc" method="POST" accept-charset="UTF-8">
<option disabled selected>↓ Pick one ↓</option>
<input src="https://www.e-junkie.com/ej/ej_add_to_cart.gif" alt="Add to Cart" class="ec_ejc_thkbx" onclick="return EJEJC_lc(this.parentNode);" type="image" border="0">