Shopwired Ecommerce

Virtual Mirror HTML5 and ShopWired

Over the last two weeks I wrote some code to embed Virtual Mirror HTML5 into the ShopWired ecommerce system. Shopwired.co.uk remembers me on Shopify… There is no way to create folders and there are a lot of more restrictions from the technical side of view, for example direct access to the file system of the server is not possible, there is no ftp and of course no ssh.

In result Virtual Mirror requires external hosting. Also, because of the cross-domain restrictions (Virtual Mirror runs on a different server but has to load images for the eyeglasses from ShopWired cdn) a special php script was required. It converts the image into base64 encoded data URL and sends the image back as a JSON object. This means that images can be edited by the canvas tag inside of Virtual Mirror now, as required.

The cross-domain restriction is well known as CORS policy and for this there is an easy solution by setting “Access-Control-Allow-Origin: *” at the html header, but as expected, ShopWired cdn hasn’t defined this and I’m sure there will be no way to get this added…

So I had to add some code to Virtual Mirror to get it “cross-domain compatible”. I’m now also familiar with Twig, a PHP template engine, used on shopwired.co.uk…

Leave a Reply