how can i add to cart a downloadable product with two different downloadable packages from product listing page
i have set two different packages to be downloaded for a single product (buy developer and buy standard). it can be added to cart page from detail page, but wat i want is to add it to cart from listing page too. Mean when add to cart on product listing page is clicked, it should by default add to cart the standard package of a product.
Rite now when i click on add to cart from listing pa开发者_开发知识库ge, it takes me to detail page with a msg to select one of the package.
Any Help ????
If you already have a controller and you are able to send your onclick to that controller and are able to send the product id to it simply do:
$prod_id = $this->getRequest()->getParam('product_id');
$product = Mage::getModel('catalog/product')->load($prod_id);
$param = array( 'product' => $product->getId(),
'options' => '',
'qty' => 1
);
$cart = Mage::getModel('checkout/cart')->init();
$cart->addProduct($product, new Varien_Object($param));
Mage::getSingleton('checkout/session')->setCartWasUpdated(true);
$cart->save();
If however you want to simply change the reference on the add button in the template you can check template: /var/www/.../app/design/frontend/default/default/template/catalog/product/list.phtml
精彩评论