Skip to content

Instantly share code, notes, and snippets.

@ndv
ndv / gist:3137982
Created July 18, 2012 18:43
Loading JS API dynamically
window.ControlPanelJSLoaded = function() { EcwidCheckout.init({/* something */}); };
var script = document.createElement('SCRIPT');
script.src = "https://checkout.ecwid.com/controlpanel-api.js";
script.charset = "utf-8";
script.setAttribute("type", "text/javascript");
script.onerror = function() { alert('Could not load script'); };
document.body.appendChild(script);
@ndv
ndv / gist:3138496
Created July 18, 2012 19:58
Checkout Widget API: setConfig
EcwidCheckout.setConfig({
currency: {precision:2,roundScale:100,prefix:'$',suffix:'',code:'USD'},
weightUnit: 'POUND',
storeName: 'Test store',
companyEmail: '[email protected]',
storeUrl: 'http://www.example.com',
dateFormat: 'MMM d, yyyy',
timeFormat: 'hh:mm a',
timeZone: 'PST'
});
@ndv
ndv / gist:3171909
Created July 24, 2012 19:01
Ecwid 11.0-12.0 CSS diff
@@ -230,7 +230,7 @@
/* 3rd, 4th, etc level categories */
div.ecwid-categories-MenuBarPopup td.gwt-MenuItem {
padding: 3px 40px 3px 10px;
- width: 100%;
+ width: auto;
}
@@ -3250,7 +3250,8 @@
// Create a state token to prevent request forgery.
// Store it in the session for later validation.
$state = md5(rand());
$app['session']->set('state', $state);
// Set the client ID, token state, and application name in the HTML while
// serving it.
return $app['twig']->render('index.html', array(
'CLIENT_ID' => CLIENT_ID,
'STATE' => $state,
'APPLICATION_NAME' => APPLICATION_NAME