uc_product.js 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. /**
  2. * @file
  3. * Utility functions to display settings summaries on vertical tabs.
  4. */
  5. (function ($) {
  6. Drupal.behaviors.ucProductFieldsetSummaries = {
  7. attach: function (context) {
  8. $('fieldset#edit-uc-product', context).drupalSetSummary(function(context) {
  9. var vals = [];
  10. $('input:checked', context).next('label').each(function() {
  11. vals.push(Drupal.checkPlain($(this).text()));
  12. });
  13. if (!$('#edit-uc-product-shippable', context).is(':checked')) {
  14. vals.unshift(Drupal.t('Not shippable'));
  15. }
  16. return vals.join(', ');
  17. });
  18. $('fieldset.product-field', context).drupalSetSummary(function(context) {
  19. var vals = [];
  20. if (Drupal.checkPlain($('#edit-model', context).val())) {
  21. vals.push(Drupal.t('SKU') + ': ' + Drupal.checkPlain($('#edit-model', context).val()));
  22. }
  23. if (Drupal.checkPlain($('#edit-sell-price', context).val()) != '0') {
  24. vals.push(Drupal.t('Sell price') + ': '
  25. + $('.form-item-sell-price .field-prefix', context).html()
  26. + Drupal.checkPlain($('#edit-sell-price', context).val())
  27. + $('.form-item-sell-price .field-suffix', context).html());
  28. }
  29. if ($('#edit-shippable', context).is(':checked')) {
  30. vals.push(Drupal.t('Shippable'));
  31. }
  32. else {
  33. vals.push(Drupal.t('Not shippable'));
  34. }
  35. return vals.join(', ');
  36. });
  37. }
  38. };
  39. })(jQuery);