Add group product in cart magento


$productModel = Mage::getModel('catalog/product');
$super_group = array();
$parentId = $params['productid'];
$qty = 1;
// $parentId =  
$parentProduct = $product_model->load($parentId);
$associatedProducts = $parent_prod->getTypeInstance()->getAssociatedProducts();
//set quantity of associate product
 foreach ($associatedProducts as $product) {
            $array[$product->getId()] = $qty;
        }
$params['super_group'] = $array;
$product = Mage::getModel('catalog/product')->load($parentId);
//check product availability
if (!$product) {
                echo "Error";
                return;
          }
// create cart object
 $cart = Mage::getModel('checkout/cart');
$param = array('super_group' => $super_group);
 //Add product to cart with specified parameters 
$cart->addProduct($product, $params);
//and save the cart object
$cart->save();
//update cart
Mage::getSingleton('checkout/session')->setCartWasUpdated(true);
Advertisements

Remove index.php from magento store url


1. open .htaccess file from the root folder
2. Add following code in .htaccess file.

RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]

3. system > configuration from admin panel select web.
4. again select Search Engines Optimization.
5. make Use Web Server Rewrites Yes.
6. at last don’t forget to flush Magento cache.