[+] FO : add files for combination
[*] FO : Create virtual products with no associated file
This commit is contained in:
+4
-1
@@ -403,7 +403,10 @@ if (helpboxes)
|
||||
if ($('input'))
|
||||
{
|
||||
//Display by rollover
|
||||
$('input').mouseover(function() { $(this).parent().find('.hint:first').css('display', 'block'); });
|
||||
$('input').mouseover(function() {
|
||||
console.log($(this).parent());
|
||||
$(this).parent().find('.hint:first').css('display', 'block');
|
||||
});
|
||||
$('input').mouseout(function() { $(this).parent().find('.hint:first').css('display', 'none'); });
|
||||
|
||||
//display when you press the tab key
|
||||
|
||||
+21
-1
@@ -26,9 +26,14 @@
|
||||
|
||||
var storeUsedGroups = {};
|
||||
|
||||
function fillCombinaison(wholesale_price, price_impact, weight_impact, unit_impact, reference, supplier_reference, ean, quantity, image, old_attr, id_product_attribute, default_attribute, eco_tax, location, upc, minimal_quantity, available_date)
|
||||
function fillCombinaison(wholesale_price, price_impact, weight_impact, unit_impact, reference, supplier_reference,
|
||||
ean, quantity, image, old_attr, id_product_attribute, default_attribute, eco_tax, location, upc, minimal_quantity, available_date,
|
||||
virtual_product_name_attribute, virtual_product_filename_attribute, virtual_product_nb_downloable, virtual_product_expiration_date_attribute,
|
||||
virtual_product_nb_days, is_shareable)
|
||||
{
|
||||
var link = '';
|
||||
init_elems();
|
||||
$("#virtual_good_attributes").show();
|
||||
$('#stock_mvt_attribute').show();
|
||||
$('#initial_stock_attribute').hide();
|
||||
$('#attribute_quantity').html(quantity);
|
||||
@@ -40,6 +45,13 @@ function fillCombinaison(wholesale_price, price_impact, weight_impact, unit_impa
|
||||
getE('available_date').value = '0000-00-00';
|
||||
getE('minimal_quantity').value = minimal_quantity;
|
||||
getE('attribute_reference').value = reference;
|
||||
|
||||
getE('virtual_product_name_attribute').value = virtual_product_name_attribute;
|
||||
getE('virtual_product_nb_downloable_attribute').value = virtual_product_nb_downloable;
|
||||
getE('virtual_product_expiration_date_attribute').value = virtual_product_nb_downloable;
|
||||
getE('virtual_product_expiration_date_attribute').value = virtual_product_expiration_date_attribute;
|
||||
getE('virtual_product_nb_days_attribute').value = virtual_product_nb_days;
|
||||
|
||||
getE('attribute_supplier_reference').value = supplier_reference;
|
||||
getE('attribute_ean13').value = ean;
|
||||
getE('attribute_upc').value = upc;
|
||||
@@ -102,6 +114,14 @@ function fillCombinaison(wholesale_price, price_impact, weight_impact, unit_impa
|
||||
getE('attribute_unit_impact').selectedIndex = 1;
|
||||
}
|
||||
|
||||
if (is_shareable > 0)
|
||||
$("#virtual_product_is_shareable_attribute").attr("checked", "checked");
|
||||
|
||||
if (id_product_attribute != '' && virtual_product_filename_attribute != '')
|
||||
$("#gethtmlink").show();
|
||||
link = $("#make_downloadable_product_attribute").attr('href');
|
||||
$("#make_downloadable_product_attribute").attr('href', link+"&id_product_attribute="+id_product_attribute);
|
||||
|
||||
/* Reset all combination images */
|
||||
combinationImages = $('#id_image_attr').find("input[id^=id_image_attr_]");
|
||||
combinationImages.each(function() {
|
||||
|
||||
Vendored
+193
-52
@@ -1,53 +1,194 @@
|
||||
/*
|
||||
* this file come from:
|
||||
* http://www.phpletter.com/Demo/AjaxFileUpload-Demo/
|
||||
* v 1.0
|
||||
*/
|
||||
jQuery.extend({
|
||||
createUploadIframe: function(id, uri)
|
||||
{
|
||||
//create frame
|
||||
var frameId = 'jUploadFrame' + id;
|
||||
var iframeHtml = '<iframe id="' + frameId + '" name="' + frameId + '" style="position:absolute; top:-9999px; left:-9999px"';
|
||||
if(window.ActiveXObject)
|
||||
{
|
||||
if(typeof uri== 'boolean'){
|
||||
iframeHtml += ' src="' + 'javascript:false' + '"';
|
||||
|
||||
jQuery.extend({createUploadIframe:function(id,uri)
|
||||
{var frameId='jUploadFrame'+id;if(window.ActiveXObject){var io=document.createElement('<iframe id="'+frameId+'" name="'+frameId+'" />');if(typeof uri=='boolean'){io.src='javascript:false';}
|
||||
else if(typeof uri=='string'){io.src=uri;}}
|
||||
else{var io=document.createElement('iframe');io.id=frameId;io.name=frameId;}
|
||||
io.style.position='absolute';io.style.top='-1000px';io.style.left='-1000px';document.body.appendChild(io);return io},createUploadForm:function(id,fileElementId)
|
||||
{var formId='jUploadForm'+id;var fileId='jUploadFile'+id;var form=$('<form action="" method="POST" name="'+formId+'" id="'+formId+'" enctype="multipart/form-data"></form>');var oldElement=$('#'+fileElementId);var newElement=$(oldElement).clone();$(oldElement).attr('id',fileId);$(oldElement).before(newElement);$(oldElement).appendTo(form);$(form).css('position','absolute');$(form).css('top','-1200px');$(form).css('left','-1200px');$(form).appendTo('body');return form;},ajaxFileUpload:function(s){s=jQuery.extend({},jQuery.ajaxSettings,s);var id=new Date().getTime()
|
||||
var form=jQuery.createUploadForm(id,s.fileElementId);var io=jQuery.createUploadIframe(id,s.secureuri);var frameId='jUploadFrame'+id;var formId='jUploadForm'+id;if(s.global&&!jQuery.active++)
|
||||
{jQuery.event.trigger("ajaxStart");}
|
||||
var requestDone=false;var xml={}
|
||||
if(s.global)
|
||||
jQuery.event.trigger("ajaxSend",[xml,s]);var uploadCallback=function(isTimeout)
|
||||
{var io=document.getElementById(frameId);try
|
||||
{if(io.contentWindow)
|
||||
{xml.responseText=io.contentWindow.document.body?io.contentWindow.document.body.innerHTML:null;xml.responseXML=io.contentWindow.document.XMLDocument?io.contentWindow.document.XMLDocument:io.contentWindow.document;}else if(io.contentDocument)
|
||||
{xml.responseText=io.contentDocument.document.body?io.contentDocument.document.body.innerHTML:null;xml.responseXML=io.contentDocument.document.XMLDocument?io.contentDocument.document.XMLDocument:io.contentDocument.document;}}catch(e)
|
||||
{jQuery.handleError(s,xml,null,e);}
|
||||
if(xml||isTimeout=="timeout")
|
||||
{requestDone=true;var status;try{status=isTimeout!="timeout"?"success":"error";if(status!="error")
|
||||
{var data=jQuery.uploadHttpData(xml,s.dataType);if(s.success)
|
||||
s.success(data,status);if(s.global)
|
||||
jQuery.event.trigger("ajaxSuccess",[xml,s]);}else
|
||||
jQuery.handleError(s,xml,status);}catch(e)
|
||||
{status="error";jQuery.handleError(s,xml,status,e);}
|
||||
if(s.global)
|
||||
jQuery.event.trigger("ajaxComplete",[xml,s]);if(s.global&&!--jQuery.active)
|
||||
jQuery.event.trigger("ajaxStop");if(s.complete)
|
||||
s.complete(xml,status);jQuery(io).unbind()
|
||||
setTimeout(function()
|
||||
{try
|
||||
{$(io).remove();$(form).remove();}catch(e)
|
||||
{jQuery.handleError(s,xml,null,e);}},100)
|
||||
xml=null}}
|
||||
if(s.timeout>0)
|
||||
{setTimeout(function(){if(!requestDone)uploadCallback("timeout");},s.timeout);}
|
||||
try
|
||||
{var form=$('#'+formId);$(form).attr('action',s.url);$(form).attr('method','POST');$(form).attr('target',frameId);if(form.encoding)
|
||||
{form.encoding='multipart/form-data';}
|
||||
else
|
||||
{form.enctype='multipart/form-data';}
|
||||
$(form).submit();}catch(e)
|
||||
{jQuery.handleError(s,xml,null,e);}
|
||||
if(window.attachEvent){document.getElementById(frameId).attachEvent('onload',uploadCallback);}
|
||||
else{document.getElementById(frameId).addEventListener('load',uploadCallback,false);}
|
||||
return{abort:function(){}};},uploadHttpData:function(r,type){var data=!type;data=type=="xml"||data?r.responseXML:r.responseText;if(type=="script")
|
||||
jQuery.globalEval(data);if(type=="json")
|
||||
eval("data = "+data);if(type=="html")
|
||||
jQuery("<div>").html(data).evalScripts();return data;}})
|
||||
}
|
||||
else if(typeof uri== 'string'){
|
||||
iframeHtml += ' src="' + uri + '"';
|
||||
|
||||
}
|
||||
}
|
||||
iframeHtml += ' />';
|
||||
jQuery(iframeHtml).appendTo(document.body);
|
||||
|
||||
return jQuery('#' + frameId).get(0);
|
||||
},
|
||||
createUploadForm: function(id, fileElementId, data)
|
||||
{
|
||||
//create form
|
||||
var formId = 'jUploadForm' + id;
|
||||
var fileId = 'jUploadFile' + id;
|
||||
var form = jQuery('<form action="" method="POST" name="' + formId + '" id="' + formId + '" enctype="multipart/form-data"></form>');
|
||||
if(data)
|
||||
{
|
||||
for(var i in data)
|
||||
{
|
||||
jQuery('<input type="hidden" name="' + i + '" value="' + data[i] + '" />').appendTo(form);
|
||||
}
|
||||
}
|
||||
var oldElement = jQuery('#' + fileElementId);
|
||||
var newElement = jQuery(oldElement).clone();
|
||||
jQuery(oldElement).attr('id', fileId);
|
||||
jQuery(oldElement).before(newElement);
|
||||
jQuery(oldElement).appendTo(form);
|
||||
|
||||
|
||||
|
||||
//set attributes
|
||||
jQuery(form).css('position', 'absolute');
|
||||
jQuery(form).css('top', '-1200px');
|
||||
jQuery(form).css('left', '-1200px');
|
||||
jQuery(form).appendTo('body');
|
||||
return form;
|
||||
},
|
||||
|
||||
ajaxFileUpload: function(s) {
|
||||
// TODO introduce global settings, allowing the client to modify them for all requests, not only timeout
|
||||
s = jQuery.extend({}, jQuery.ajaxSettings, s);
|
||||
var id = new Date().getTime()
|
||||
var form = jQuery.createUploadForm(id, s.fileElementId, (typeof(s.data)=='undefined'?false:s.data));
|
||||
var io = jQuery.createUploadIframe(id, s.secureuri);
|
||||
var frameId = 'jUploadFrame' + id;
|
||||
var formId = 'jUploadForm' + id;
|
||||
// Watch for a new set of requests
|
||||
if ( s.global && ! jQuery.active++ )
|
||||
{
|
||||
jQuery.event.trigger( "ajaxStart" );
|
||||
}
|
||||
var requestDone = false;
|
||||
// Create the request object
|
||||
var xml = {}
|
||||
if ( s.global )
|
||||
jQuery.event.trigger("ajaxSend", [xml, s]);
|
||||
// Wait for a response to come back
|
||||
var uploadCallback = function(isTimeout)
|
||||
{
|
||||
var io = document.getElementById(frameId);
|
||||
try
|
||||
{
|
||||
if(io.contentWindow)
|
||||
{
|
||||
xml.responseText = io.contentWindow.document.body?io.contentWindow.document.body.innerHTML:null;
|
||||
xml.responseXML = io.contentWindow.document.XMLDocument?io.contentWindow.document.XMLDocument:io.contentWindow.document;
|
||||
|
||||
}else if(io.contentDocument)
|
||||
{
|
||||
xml.responseText = io.contentDocument.document.body?io.contentDocument.document.body.innerHTML:null;
|
||||
xml.responseXML = io.contentDocument.document.XMLDocument?io.contentDocument.document.XMLDocument:io.contentDocument.document;
|
||||
}
|
||||
}catch(e)
|
||||
{
|
||||
jQuery.handleError(s, xml, null, e);
|
||||
}
|
||||
if ( xml || isTimeout == "timeout")
|
||||
{
|
||||
requestDone = true;
|
||||
var status;
|
||||
try {
|
||||
status = isTimeout != "timeout" ? "success" : "error";
|
||||
// Make sure that the request was successful or notmodified
|
||||
if ( status != "error" )
|
||||
{
|
||||
// process the data (runs the xml through httpData regardless of callback)
|
||||
var data = jQuery.uploadHttpData( xml, s.dataType );
|
||||
// If a local callback was specified, fire it and pass it the data
|
||||
if ( s.success )
|
||||
s.success( data, status );
|
||||
|
||||
// Fire the global callback
|
||||
if( s.global )
|
||||
jQuery.event.trigger( "ajaxSuccess", [xml, s] );
|
||||
} else
|
||||
jQuery.handleError(s, xml, status);
|
||||
} catch(e)
|
||||
{
|
||||
status = "error";
|
||||
jQuery.handleError(s, xml, status, e);
|
||||
}
|
||||
|
||||
// The request was completed
|
||||
if( s.global )
|
||||
jQuery.event.trigger( "ajaxComplete", [xml, s] );
|
||||
|
||||
// Handle the global AJAX counter
|
||||
if ( s.global && ! --jQuery.active )
|
||||
jQuery.event.trigger( "ajaxStop" );
|
||||
|
||||
// Process result
|
||||
if ( s.complete )
|
||||
s.complete(xml, status);
|
||||
|
||||
jQuery(io).unbind()
|
||||
|
||||
setTimeout(function()
|
||||
{ try
|
||||
{
|
||||
jQuery(io).remove();
|
||||
jQuery(form).remove();
|
||||
|
||||
} catch(e)
|
||||
{
|
||||
jQuery.handleError(s, xml, null, e);
|
||||
}
|
||||
|
||||
}, 100)
|
||||
xml = null
|
||||
|
||||
}
|
||||
}
|
||||
// Timeout checker
|
||||
if ( s.timeout > 0 )
|
||||
{
|
||||
setTimeout(function(){
|
||||
// Check to see if the request is still happening
|
||||
if( !requestDone ) uploadCallback( "timeout" );
|
||||
}, s.timeout);
|
||||
}
|
||||
try
|
||||
{
|
||||
|
||||
var form = jQuery('#' + formId);
|
||||
jQuery(form).attr('action', s.url);
|
||||
jQuery(form).attr('method', 'POST');
|
||||
jQuery(form).attr('target', frameId);
|
||||
if(form.encoding)
|
||||
{
|
||||
jQuery(form).attr('encoding', 'multipart/form-data');
|
||||
}
|
||||
else
|
||||
{
|
||||
jQuery(form).attr('enctype', 'multipart/form-data');
|
||||
}
|
||||
jQuery(form).submit();
|
||||
|
||||
} catch(e)
|
||||
{
|
||||
jQuery.handleError(s, xml, null, e);
|
||||
}
|
||||
jQuery('#' + frameId).load(uploadCallback );
|
||||
return {abort: function () {}};
|
||||
},
|
||||
|
||||
uploadHttpData: function( r, type ) {
|
||||
var data = !type;
|
||||
data = type == "xml" || data ? r.responseXML : r.responseText;
|
||||
// If the type is "script", eval it in global context
|
||||
if ( type == "script" )
|
||||
jQuery.globalEval( data );
|
||||
// Get the JavaScript object, if JSON is used.
|
||||
if ( type == "json" )
|
||||
eval( "data = " + data );
|
||||
// evaluate scripts within html
|
||||
if ( type == "html" )
|
||||
jQuery("<div>").html(data).evalScripts();
|
||||
|
||||
return data;
|
||||
}
|
||||
})
|
||||
Reference in New Issue
Block a user