| 1 |
// $Id$
|
| 2 |
|
| 3 |
// Functions used on the product view page.
|
| 4 |
|
| 5 |
function switch_vocabulary(vid) {
|
| 6 |
var settings = {
|
| 7 |
'div': "#products-selector",
|
| 8 |
'class': "product-ubrowser",
|
| 9 |
'vid': vid,
|
| 10 |
'filter': $('#edit-product-filter').val(),
|
| 11 |
'search': "true",
|
| 12 |
'nids': "true",
|
| 13 |
'nodesg': "product",
|
| 14 |
'nodepl': "products",
|
| 15 |
'multi': "true",
|
| 16 |
'select': "buffer_products()"
|
| 17 |
};
|
| 18 |
|
| 19 |
display_ubrowser(Drupal.settings.basePath, settings);
|
| 20 |
}
|
| 21 |
|
| 22 |
function buffer_products(file_path) {
|
| 23 |
$('#edit-unid option:selected').each(
|
| 24 |
function(i) {
|
| 25 |
if (this.value == 0) {
|
| 26 |
return;
|
| 27 |
}
|
| 28 |
|
| 29 |
var productsURL = $('#edit-products').val();
|
| 30 |
|
| 31 |
if (productsURL.search(new RegExp("\/" + this.value + "(\/|$)")) == -1) {
|
| 32 |
if (productsURL == '') {
|
| 33 |
$('#buffer-images').empty();
|
| 34 |
}
|
| 35 |
|
| 36 |
$('#edit-products').val(productsURL + '/' + this.value);
|
| 37 |
$.post(Drupal.settings.basePath + 'products/field_image_cache/' + this.value, {},
|
| 38 |
function(contents) {
|
| 39 |
if (contents != 'false') {
|
| 40 |
$('#buffer-images').append('<img src="' + file_path + '/imagecache/uc_thumbnail/' + contents +'" />');
|
| 41 |
}
|
| 42 |
else {
|
| 43 |
$('#buffer-images').append('<img src="" alt="' + $('#edit-unid option:selected').get(i).text + '" />');
|
| 44 |
}
|
| 45 |
}
|
| 46 |
);
|
| 47 |
}
|
| 48 |
}
|
| 49 |
);
|
| 50 |
}
|