Thread: Javascript API
View Single Post
Old 06-10-2014, 07:06 PM
Kevin Kraus's Avatar
Kevin Kraus Kevin Kraus is offline
Join Date: Oct 2013
Posts: 1
Default Javascript API

Store ID 2673243 version: The callbacks are not firing on the initial pageload. It worked for weeks as we refined our JS code and we tested thoroughly. It stopped working in the past week as the initial pageloads quit firing. The onpage load and onpage loaded initial firing of the messages is no longer happening.

More detail: Our goal was to:
1) CLEAR our cart.
2) ADD a single product to the cart.
3) Display the shopping bag.
4) Optionally display the cart bypassing the shopping bag.

<center>[php function=3]</center>
<script type='text/javascript' src=''></script>
<center><h1>Thank You, your checkout is being processed.</h1></center>
<script type="text/javascript" src="" charset="utf-8"></script>
<script src="" type="text/javascript" charset="UTF-8"></script>
<script type="text/javascript">
ecwidMessages = {
"PaymentDetails.enter_email" : "Confirm your email and press the Continue button below."
<script type="text/javascript">
function f(){
f.count = ++f.count || 1
function g(){
g.count = ++g.count || 1
Ecwid.OnPageLoad.add(function(page) {
if(f.count==1) {
var shdata = document.getElementById('sel').innerHTML;
if(shdata=='ADVANCED SCAN Checkup A (3, 5 &amp; 10 year report; components w/o data excluded from scan) $75') {
if(shdata=='ADVANCED SCAN Checkup B (1, 3 &amp; 5 year report; components w/o data excluded from scan) $75')
if(shdata=='QUICK SCAN Checkup, 1 year (components w/o data excluded from scan) $30')
if(shdata=='QUICK SCAN Checkup, 3 year (components w/o data excluded from scan) $30')
if(shdata=='QUICK SCAN Checkup, 5 year (components w/o data excluded from scan) $30')
if(shdata=='QUICK SCAN Checkup, 10 year (components w/o data excluded from scan) $30')
Ecwid.Cart.addProduct(pnum, function(success, product, cart){
console.log(success); // true or false
window.location = '!/~/cart';
Ecwid.OnPageLoaded.add(function(page) {
if(g.count>=2) {
var e=document.getElementById('eaddr').innerHTML;