I am using the following URL in wishlist/item/list.phtml to move products from my wishlist to the cart.
<?=$this->getBaseUrl()?>checkout/cart/add?product=<?=$item->getId()?>&qty=1
I understand that in order to move configurable items that the product options need to be included in the URL. I can't for the life of me figure out how to pull the super attributes IDs or how to include them in the URL.
Best Answer
To add a product to the cart with the super attributes set you will need the following url structure:
But I am a bit confused as to why you need this as by default the wishlist will save to custom options in the database and then the add to cart button on the wishlist will add the product with the options set.
The options saved against a product in the wishlist can be found on the table
wishlist_item_option
. Here you will see an entry for the codeinfo_buyRequest
and one for the codeattributes
, these are used when adding to a cart to set the attribute to the saved value.You can also look at the wishlist controller to see how the core code adds configurable products. See in
Mage_Wishlist_IndexController->cartAction
where it loads the the buy request of the item and sets it to the cart item