updated ubercart, faq
This commit is contained in:
@@ -21,7 +21,7 @@ class UbercartAttributeTestCase extends UbercartTestHelper {
|
||||
/**
|
||||
* Overrides DrupalWebTestCase::setUp().
|
||||
*/
|
||||
function setUp() {
|
||||
protected function setUp($modules = array(), $permissions = array()) {
|
||||
parent::setUp(array('uc_attribute'), array('administer attributes', 'administer product attributes', 'administer product options'));
|
||||
$this->drupalLogin($this->adminUser);
|
||||
}
|
||||
@@ -316,8 +316,14 @@ class UbercartAttributeTestCase extends UbercartTestHelper {
|
||||
$edit = (array) self::createAttribute(array(), FALSE);
|
||||
|
||||
$this->drupalPost('admin/store/products/attributes/add', $edit, t('Submit'));
|
||||
$this->assertText('Options for ' . $edit['name']);
|
||||
$this->assertText('No options for this attribute have been added yet.');
|
||||
if ($edit['display'] !=0) {
|
||||
// We redirect to add options page ONLY for non-textfield attributes.
|
||||
$this->assertText('Options for ' . $edit['name']);
|
||||
$this->assertText('No options for this attribute have been added yet.');
|
||||
}
|
||||
else {
|
||||
// For textfield attributes we redirect to attribute list.
|
||||
}
|
||||
|
||||
$this->drupalGet('admin/store/products/attributes');
|
||||
$this->assertRaw('<td class="active">' . $edit['name'] . '</td>', t('Verify name field.'));
|
||||
@@ -325,7 +331,7 @@ class UbercartAttributeTestCase extends UbercartTestHelper {
|
||||
$this->assertRaw('<td>' . ($edit['required'] ? t('Yes') : t('No')) . '</td>', t('Verify required field.'));
|
||||
$this->assertRaw('<td>' . $edit['ordering'] . '</td>', t('Verify ordering field.'));
|
||||
$types = _uc_attribute_display_types();
|
||||
$this->assertRaw('<td>' . $types[$edit['display']] . '</td>', t('Verify ordering field.'));
|
||||
$this->assertRaw('<td>' . $types[$edit['display']] . '</td>', t('Verify display field.'));
|
||||
|
||||
$aid = db_query("SELECT aid FROM {uc_attributes} WHERE name = :name", array(':name' => $edit['name']))->fetchField();
|
||||
$this->assertTrue($aid, t('Attribute was created.'));
|
||||
|
@@ -18,7 +18,7 @@ class UbercartAttributeCheckoutTestCase extends UbercartTestHelper {
|
||||
/**
|
||||
* Overrides DrupalWebTestCase::setUp().
|
||||
*/
|
||||
function setUp() {
|
||||
protected function setUp($modules = array(), $permissions = array()) {
|
||||
parent::setUp(array('uc_attribute', 'uc_cart'), array('administer attributes', 'administer product attributes', 'administer product options'));
|
||||
$this->drupalLogin($this->adminUser);
|
||||
}
|
||||
|
@@ -95,6 +95,7 @@ function uc_attribute_form($form, &$form_state, $attribute = NULL) {
|
||||
'#title' => t('Label'),
|
||||
'#description' => t("Enter a label that customers will see instead of the attribute name. Use <none> if you don't want a title to appear at all."),
|
||||
'#default_value' => $label,
|
||||
'#maxlength' => 255,
|
||||
);
|
||||
$form['description'] = array(
|
||||
'#type' => 'textfield',
|
||||
@@ -146,7 +147,14 @@ function uc_attribute_form_submit($form, &$form_state) {
|
||||
}
|
||||
else {
|
||||
drupal_write_record('uc_attributes', $form_state['values']);
|
||||
$form_state['redirect'] = 'admin/store/products/attributes/' . $form_state['values']['aid'] . '/options';
|
||||
if ($form_state['values']['display'] == 0) {
|
||||
// No options needed/allowed for Textfield display type.
|
||||
$form_state['redirect'] = 'admin/store/products/attributes';
|
||||
}
|
||||
else {
|
||||
// All other display types we redirect to add options.
|
||||
$form_state['redirect'] = 'admin/store/products/attributes/' . $form_state['values']['aid'] . '/options';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -584,6 +592,7 @@ function uc_object_attributes_form($form, &$form_state, $object, $type, $view =
|
||||
'#title_display' => 'invisible',
|
||||
'#default_value' => empty($attribute->label) ? $attribute->name : $attribute->label,
|
||||
'#size' => 20,
|
||||
'#maxlength' => 255,
|
||||
),
|
||||
'option' => array(
|
||||
'#markup' => $option ? (check_plain($option->name) . ' (' . theme('uc_price', array('price' => $option->price)) . ')' ) : t('n/a'),
|
||||
|
@@ -8,9 +8,9 @@ core = 7.x
|
||||
files[] = tests/uc_attribute.test
|
||||
files[] = tests/uc_attribute_checkout.test
|
||||
|
||||
; Information added by Drupal.org packaging script on 2014-10-22
|
||||
version = "7.x-3.8"
|
||||
; Information added by Drupal.org packaging script on 2016-07-16
|
||||
version = "7.x-3.10"
|
||||
core = "7.x"
|
||||
project = "ubercart"
|
||||
datestamp = "1413965350"
|
||||
datestamp = "1468644909"
|
||||
|
||||
|
@@ -1280,6 +1280,12 @@ function _uc_attribute_alter_form($id, &$product, $use_ajax) {
|
||||
$attributes = $product->attributes;
|
||||
$priced_attributes = uc_attribute_priced_attributes($nid);
|
||||
|
||||
// At this point, $product->data is the node author's userdata
|
||||
// as a string, as populated by user_node_load(). We don't need that.
|
||||
if (empty($product->data) || !is_array($product->data)) {
|
||||
$product->data = array();
|
||||
}
|
||||
|
||||
// If the form is being built for the first time, populate attributes with their default values.
|
||||
if (!isset($product->data['attributes'])) {
|
||||
$values = array();
|
||||
@@ -1302,10 +1308,6 @@ function _uc_attribute_alter_form($id, &$product, $use_ajax) {
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($product->data) || !is_array($product->data)) {
|
||||
$product->data = array();
|
||||
}
|
||||
|
||||
// Initialize the form element.
|
||||
$form_attributes = array(
|
||||
'#theme' => 'uc_attribute_add_to_cart',
|
||||
|
@@ -13,6 +13,9 @@
|
||||
* - option: The option name.
|
||||
* - price: The price total or adjustment, if any.
|
||||
*
|
||||
* @return string
|
||||
* The HTML output.
|
||||
*
|
||||
* @see _uc_attribute_alter_form()
|
||||
* @ingroup themeable
|
||||
*/
|
||||
|
Reference in New Issue
Block a user