When enabling on Commerce Kickstart the button is shown before the quantity widget and add to cart button. I think it should be shown last?

Comments

mark.thehub’s picture

Hi guys, I had the same issue. I need to move the wishlist button under the add to cart button.

imiksu’s picture

Category: feature » support
Status: Active » Needs review

The latest dev version has configuration form where you can define the button's weight value. When you set that to high number, the button will go to the end of the add to cart form.

imiksu’s picture

Status: Needs review » Closed (fixed)
Poieo’s picture

Category: Support request » Bug report
Issue summary: View changes
Status: Closed (fixed) » Needs review
StatusFileSize
new1.11 KB

This change puts the weight in the wrong place, I think. It adds the weight to the 'add_to_wishlist' form which is inside the commerce_wishlist_add_form.

$form += commerce_wishlist_add_form();
  if ($in_wishlist) {
    $form['add_to_wishlist'] = array(
      '#markup' => $link_exists,
      '#weight' => variable_get('commerce_wishlist_weight', 0),
    );
 }

This essentially has no effect because it just weights the wishlist button inside it's own form, not inside the commerce_cart_add_to_cart_form.

Instead, the weight should be added to the commerce_wishlist_add_form function.

function commerce_wishlist_add_form() {
  $form['add_to_wishlist'] = array(
    '#type' => 'submit',
    '#value' => t('Add to Wishlist'),
    '#attributes' => array('class' => array('wishlist')),
    '#validate' => array('commerce_wishlist_add_form_validate'),
    '#submit' => array('commerce_wishlist_add_form_submit'),
    '#weight' => variable_get('commerce_wishlist_weight', 0),
  );

  return $form;
}

This weights the form relative to the other items in the add to cart form.

mglaman’s picture

Poieo, thank you! I had written a small hack that did similar and meant to write patch, but yours is much cleaner and efficient.

Patch works for me.

mengi’s picture

I can confirm the patch in #4 works.

45 was the magic weight to get the wishlist button to move down.

Poieo’s picture

Title: Button should be shown last » Wishlist Button Weight Does Not Change Button Location
Status: Needs review » Reviewed & tested by the community
bagqueen’s picture

To me the weight only seems to affect the button, not if I choose "Ajax link". I guess I can style the button the way I want with css, so it's not a huge issue.

joelpittet’s picture

Status: Reviewed & tested by the community » Needs review
StatusFileSize
new898 bytes

Thanks for the patch. Here's a fix to get #8 working too.

johnmcc’s picture

Status: Needs review » Reviewed & tested by the community

Patch #9 worked perfectly for me. Thanks!

rbosscher’s picture

I can confirm patch #9 aswel

hockey2112’s picture

Thanks for the patch in #9! I ended up using "99999" for my button weight.

ItangSanjana’s picture

#9 tested and worked. Thanks!

rbosscher’s picture

Issue tags: +Quick fix

Tagged as Quick fix hopefully get noticed by the maintainers

Scott Robertson’s picture

Version: 7.x-1.x-dev » 7.x-2.x-dev
Status: Reviewed & tested by the community » Closed (fixed)

Thanks all for the patches. A bit of a delay, but committed to 2.x.