I have a view that contains a tabular list of products. Each product contains an add to cart form via Ubercart's Views intergration. I have just noticed that the first product listed in the table has a non-functional add to cart form. All other item's add to cart forms appear to work correctly.

I have tried the exact same view with other styles and all of the add to cart forms (including the first one) works as expected.

Looking into the source code I see that the form element is completely removed from the first item. Below is a comparison between the first item and another, working item.

First item

<div class="add-to-cart">
  <div>
    <div id="edit-qty-wrapper" class="form-item">
     <label for="edit-qty">Quantity: </label>
     <input type="text" class="form-text" value="1" size="5" id="edit-qty" name="qty" maxlength="6">
    </div>
    <input type="submit" class="form-submit node-add-to-cart" value="Add to cart" id="edit-submit-6" name="op">
    <input type="hidden" value="form-d42c4da8b343336b63e4dc1e04730c2e" id="form-d42c4da8b343336b63e4dc1e04730c2e" name="form_build_id">
    <input type="hidden" value="339979186901d6bf6ab3e21cd1e962ad" id="edit-uc-product-add-to-cart-form-6-form-token" name="form_token">
    <input type="hidden" value="uc_product_add_to_cart_form_6" id="edit-uc-product-add-to-cart-form-6" name="form_id">
  </div>
</div>

Another, working item

<div class="add-to-cart">
  <form id="uc-product-add-to-cart-form-2" method="post" accept-charset="UTF-8" action="/">
    <div>
      <div id="edit-qty-5-wrapper" class="form-item">
        <label for="edit-qty-5">Quantity: </label>
        <input type="text" class="form-text" value="1" size="5" id="edit-qty-5" name="qty" maxlength="6">
      </div>
      <input type="submit" class="form-submit node-add-to-cart" value="Add to cart" id="edit-submit-2" name="op">
      <input type="hidden" value="form-001d7e989361e45a5abfb7840bcbd5f0" id="form-001d7e989361e45a5abfb7840bcbd5f0" name="form_build_id">
      <input type="hidden" value="6a129db6c3bbf1257b238f43099215cb" id="edit-uc-product-add-to-cart-form-2-form-token" name="form_token">
      <input type="hidden" value="uc_product_add_to_cart_form_2" id="edit-uc-product-add-to-cart-form-2" name="form_id">
    </div>
  </form>
</div>

Notice that in the first item the second line contains an empty div tag, where on the working item there is a form tag. Also, the closing form tag is present in the second-to-last line of the working item, but doesn't exist in the first item code.

Things that I have tried (all with no success):
- Rearranged the order of the items
- Rearranged the field elements in the Views module

I am assuming that this is a DraggableView issue, not an Ubercart issue because other Views styles work properly.

Does anyone know what would be causing this and how to solve it? Thanks in advance!

Comments

bocaj’s picture

No one else has ran into this issue? :(

akalata’s picture

Version: 6.x-3.4 » 6.x-3.5

I've run into this as well. Luckily it shouldn't be too much of a big deal, since people who have permissions to reorder the product table shouldn't be the ones who are trying to order. :)

benahlquist’s picture

I wasn't able to replicate what @bocaj was experiencing, however I did have another (very minor) related issue. I created a Draggable Views page so my store admins could set a manual sort order of featured products in our Drupal/Ubercart store.

The draggable order functioned just fine, but the "save" button to commit the sort order sent me to the cart, adding the first item from the list to the cart.

I was able to alleviate this problem by removing the "Add to Cart" buttons from the view, which was perfectly fine—as @akalata mentioned, an admin/editor sorting the table shouldn't need to add to cart anyway.

Running Drupal 7.14, Ubercart 7.x 3.1 and DraggableViews 7.x-2.0-beta1.

istryker’s picture

Status: Active » Closed (won't fix)

6.x in now unsupport. Closing this issue.