The code under Mage_Catalog_Block_Product_Abstract
has a very useful comment.
/**
* Retrieve url for add product to cart
* Will return product view page URL if product has required options
*
* @param Mage_Catalog_Model_Product $product
* @param array $additional
* @return string
*/
public function getAddToCartUrl($product, $additional = array())
{
if ($product->getTypeInstance(true)->hasRequiredOptions($product)) {
if (!isset($additional['_escape'])) {
$additional['_escape'] = true;
}
if (!isset($additional['_query'])) {
$additional['_query'] = array();
}
$additional['_query']['options'] = 'cart';
return $this->getProductUrl($product, $additional);
}
return $this->helper('checkout/cart')->getAddUrl($product, $additional);
}
The difference is that the Mage_Catalog_Block_Product_Abstract::getAddToCartUrl
will set the url as the product view page if the product has required options, otherwise it will just return Mage_Checkout_Helper_Cart::getAddUrl
.
The getAddToCartUrl
can be used when you are not on the product view page, say for the wishlist page. So that you do not get an error when the user tries to add a product to the cart that has required options.