Skip to content

Instantly share code, notes, and snippets.

<!--
This is the default store template file which is used to create new stores. It contains all predefined settings and
products, and even demo orders and customers. Every bit of this template can be replaced when the store is
creating in an API call. The custom template passed in API call should have the same structure, but may only describe
some of the tags. Tags in the custom template replace the corresponding tags in the default template before it
gets applied to store creation. Tags that are missing from the custom template are taken from the default template.
Note that some tags are replaced, not merged, meaning that all the subtag structure is taken from the custom
template, if the custom template specifies the tag.
<storeList>
<stores>
<id>STORE ID</id>
<channelId>PARTNER ID</channelId>
<name>Store name</name>
<nick>Store owner's nickname</nick>
<email>Store owner's email</email>
<url>Store URL</url>
<suspended>'Suspended' status, either 'true' or 'false'</suspended>
<traffic>Traffic consumed since start of the month, bytes</traffic>
<?xml version="1.0" encoding="UTF-8"?>
<be-owner-result>
<redirect-url>URL_TO_REDIRECT_TO</redirect-url>
</be-owner-result>
@ndv
ndv / gist:1432831
Created December 5, 2011 08:20
setSignInUrls
window.Ecwid.OnAPILoaded.add(function() {
window.Ecwid.setSignInUrls({
signInUrl: 'http://my.site.com/signin',
signOutUrl: 'http://my.site.com/signout' // signOutUrl is optional
});
});
@ndv
ndv / gist:1432854
Created December 5, 2011 08:29
setSignInProvider
window.Ecwid.OnAPILoaded.add(function() {
window.Ecwid.setSignInProvider({
addSignInLinkToPB: function() { return true; },
signIn: function () { alert('sign in');
window.Ecwid.setSsoProfile('<?php echo "$message $hmac $timestamp"; ?>');
},
canSignOut: function() { return true; },
signOut: function () { alert('sign out') }
});
});
@ndv
ndv / gist:3135544
Created July 18, 2012 10:56
OnAPILoaded usage
<script src="//app.ecwid.com/script.js?1003" type="text/javascript" charset="UTF-8"></script>
<script>
Ecwid.OnAPILoaded.add(function() {
// Ecwid API is available, do something
alert(Ecwid.formatCurrency(123.45));
});
</script>
@ndv
ndv / gist:3135563
Created July 18, 2012 11:03
OnSetProfile
<script src="//app.ecwid.com/script.js?1003" type="text/javascript" charset="UTF-8"></script>
<script>
function dump(arr,level) {
var dumped_text = "";
if (!level) level = 0;
// The padding given at the beginning of the line.
var level_padding = "";
for (var j=0;j<level+1;j++) level_padding += " ";
@ndv
ndv / gist:3135584
Created July 18, 2012 11:04
OnPageLoad
<script src="//app.ecwid.com/script.js?1003" type="text/javascript" charset="UTF-8"></script>
<script>
Ecwid.OnPageLoad.add(function(page) {
alert("My page load handler: "+page.type);
});
</script>
@ndv
ndv / gist:3135901
Created July 18, 2012 12:25
CheckoutWidget API: Extension Point Examlpe
<script src="https://checkout.ecwid.com/controlpanel-api.js" type="text/javascript" charset="UTF-8"></script>
<script>
EcwidCheckout.OnChanged.add(function() {
alert("My change event handler");
});
</script>
@ndv
ndv / gist:3136037
Created July 18, 2012 12:50
Checkout Widget API: Initialization
<?php
define('CHECKOUT_WIDGET_OWNERID', 'TEST-123');
define('CHECKOUT_WIDGET_KEY', 'secret');
$timestamp = time();
$signature = hash_hmac( "sha1", CHECKOUT_WIDGET_OWNERID." ".$timestamp, CHECKOUT_WIDGET_KEY);
?>
<script src="https://checkout.ecwid.com/controlpanel-api.js" type="text/javascript" charset="UTF-8"></script>
<script>