(function($){
    var $document = $(document);

    $document.off('initProduct');
    $document.on('initProduct', function( ev, product_id, result, callback) {

        $.coreUtilites.ajaxRequest(
            {
                subject: 'prestashop',
                action: 'get_product_details',
                params: {
                    product_id: product_id
                }
            },
            function(data){
                if(data.status = 'success') {
                    callback(data.message);
                }
            }
        );

        /*
        Format:
        {
            product_id: 1,
            views: [
                 {
                 view_id: 1,
                 background: '{$config->path->products_preview}tshirt.png',
                 area_position: [85, 54],
                 area_size: [230, 265]
                 },
            ]
        }

        */
    });
})(SWjQuery);