Merge pull request #27 from prestarocket/product.js

[*] FO : Clean product.js
This commit is contained in:
Francois Gaillard
2012-11-23 10:12:41 -08:00
+18 -18
View File
@@ -76,7 +76,7 @@ function findCombination(firstTime)
$('#quantity_wanted').val(1); $('#quantity_wanted').val(1);
//create a temporary 'choice' array containing the choices of the customer //create a temporary 'choice' array containing the choices of the customer
var choice = new Array(); var choice = new Array();
$('div#attributes select, div#attributes input[type=hidden], div#attributes input[type=radio]:checked').each(function(){ $('#attributes select, #attributes input[type=hidden], #attributes input[type=radio]:checked').each(function(){
choice.push($(this).val()); choice.push($(this).val());
}); });
@@ -264,20 +264,20 @@ function updateDisplay()
{ {
$('#availability_value').text(availableLaterValue); $('#availability_value').text(availableLaterValue);
if(stock_management == 1) if(stock_management == 1)
$('p#availability_statut:hidden').show('slow'); $('#availability_statut:hidden').show('slow');
} }
else else
$('p#availability_statut:visible').hide('slow'); $('#availability_statut:visible').hide('slow');
} }
else else
{ {
$('#add_to_cart:visible').fadeOut(600); $('#add_to_cart:visible').fadeOut(600);
if(stock_management == 1) if(stock_management == 1)
$('p#availability_statut:hidden').show('slow'); $('#availability_statut:hidden').show('slow');
} }
if (productAvailableForOrder == 0) if (productAvailableForOrder == 0)
$('p#availability_statut:visible').hide(); $('#availability_statut:visible').hide();
} }
if (selectedCombination['reference'] || productReference) if (selectedCombination['reference'] || productReference)
@@ -446,7 +446,7 @@ function displayImage(domAAroundImgThumb, no_animation)
//update display of the discounts table //update display of the discounts table
function displayDiscounts(combination) function displayDiscounts(combination)
{ {
$('#quantityDiscount table tbody tr').each(function() { $('#quantityDiscount tbody tr').each(function() {
if (($(this).attr('id') != 'quantityDiscount_0') && if (($(this).attr('id') != 'quantityDiscount_0') &&
($(this).attr('id') != 'quantityDiscount_'+combination) && ($(this).attr('id') != 'quantityDiscount_'+combination) &&
($(this).attr('id') != 'noQuantityDiscount')) ($(this).attr('id') != 'noQuantityDiscount'))
@@ -469,8 +469,8 @@ function serialScrollFixLock(event, targeted, scrolled, items, position)
var leftArrow = position == 0 ? true : false; var leftArrow = position == 0 ? true : false;
var rightArrow = position + serialScrollNbImagesDisplayed >= serialScrollNbImages ? true : false; var rightArrow = position + serialScrollNbImagesDisplayed >= serialScrollNbImages ? true : false;
$('a#view_scroll_left').css('cursor', leftArrow ? 'default' : 'pointer').css('display', leftArrow ? 'none' : 'block').fadeTo(0, leftArrow ? 0 : 1); $('#view_scroll_left').css('cursor', leftArrow ? 'default' : 'pointer').css('display', leftArrow ? 'none' : 'block').fadeTo(0, leftArrow ? 0 : 1);
$('a#view_scroll_right').css('cursor', rightArrow ? 'default' : 'pointer').fadeTo(0, rightArrow ? 0 : 1).css('display', rightArrow ? 'none' : 'block'); $('#view_scroll_right').css('cursor', rightArrow ? 'default' : 'pointer').fadeTo(0, rightArrow ? 0 : 1).css('display', rightArrow ? 'none' : 'block');
return true; return true;
} }
@@ -506,8 +506,8 @@ $(document).ready(function()
//init the serialScroll for thumbs //init the serialScroll for thumbs
$('#thumbs_list').serialScroll({ $('#thumbs_list').serialScroll({
items:'li:visible', items:'li:visible',
prev:'a#view_scroll_left', prev:'#view_scroll_left',
next:'a#view_scroll_right', next:'#view_scroll_right',
axis:'x', axis:'x',
offset:0, offset:0,
start:0, start:0,
@@ -541,21 +541,21 @@ $(document).ready(function()
}); });
} }
//add a link on the span 'view full size' and on the big image //add a link on the span 'view full size' and on the big image
$('span#view_full_size, div#image-block img').click(function(){ $('#view_full_size, #image-block img').click(function(){
$('#views_block li a.shown').click(); $('#views_block .shown').click();
}); });
//catch the click on the "more infos" button at the top of the page //catch the click on the "more infos" button at the top of the page
$('div#short_description_block p a.button').click(function(){ $('#short_description_block .button').click(function(){
$('#more_info_tab_more_info').click(); $('#more_info_tab_more_info').click();
$.scrollTo( '#more_info_tabs', 1200 ); $.scrollTo( '#more_info_tabs', 1200 );
}); });
// Hide the customization submit button and display some message // Hide the customization submit button and display some message
$('p#customizedDatas input').click(function() { $('#customizedDatas input').click(function() {
$('p#customizedDatas input').hide(); $('#customizedDatas input').hide();
$('#ajax-loader').fadeIn(); $('#ajax-loader').fadeIn();
$('p#customizedDatas').append(uploading_in_progress); $('#customizedDatas').append(uploading_in_progress);
}); });
//init the price in relation of the selected attributes //init the price in relation of the selected attributes
@@ -564,7 +564,7 @@ $(document).ready(function()
else if (typeof productHasAttributes != 'undefined' && !productHasAttributes) else if (typeof productHasAttributes != 'undefined' && !productHasAttributes)
refreshProductImages(0); refreshProductImages(0);
$('a#resetImages').click(function() { $('#resetImages').click(function() {
refreshProductImages(0); refreshProductImages(0);
}); });
@@ -656,7 +656,7 @@ function getProductAttribute()
request = ''; request = '';
//create a temporary 'tab_attributes' array containing the choices of the customer //create a temporary 'tab_attributes' array containing the choices of the customer
var tab_attributes = new Array(); var tab_attributes = new Array();
$('div#attributes select, div#attributes input[type=hidden], div#attributes input[type=radio]:checked').each(function(){ $('#attributes select, #attributes input[type=hidden], #attributes input[type=radio]:checked').each(function(){
tab_attributes.push($(this).val()); tab_attributes.push($(this).val());
}); });