I\'ve just installed Magento Community Edition ver 1.8.0.0 (default settings).
System -> Configuration -> Sales -> Checkout -> Checkout Options
This step is not very complicated! Hope this help.
//Namespace need to change with your namespace
//AddProduct need to change with your module name
class Namespace_AddProduct_AddController extends Mage_Core_Controller_Front_Action {
public function indexAction() {
$product_id = $this->getRequest()->getParam('products');
$qty = $this->getRequest()->getParam('qty'); //used if your qty is not hard coded
$cart = Mage::getModel('checkout/cart');
$cart->init();
if ($product_id == '') {
continue;
}
$productModel = Mage::getModel('catalog/product')->load($product_id);
//I added only Virtual product here. If no need, remove this condtion
if ($productModel->getTypeId() == Mage_Catalog_Model_Product_Type::TYPE_VIRTUAL) {
try
{
$cart->addProduct($productModel, array('qty' => '1')); //qty is hard coded
}
catch (Exception $e) {
continue;
}
}
$cart->save();
if ($this->getRequest()->isXmlHttpRequest()) {
exit('1');
}
$this->_redirect('checkout/cart');
}
}