for
http://brimllc.com/2010/12/magento-grouped-products-containing-associated-configurable-products/
in group.php add below code
if($subProduct->getTypeId() == 'configurable' ){
$buyRequestconfig['super_attribute']=$buyRequest['super_attribute'][$subProduct->getId()];
$buyRequestconfig['product']=$subProduct->getId();
//$buyRequestconfig['product_id']=$subProduct->getId();
$buyRequestconfig['qty'] = $buyRequest['super_group'][$subProduct->getId()];
$buyRequestconfig['form_key'] = $buyRequest['form_key'];
$buyRequestconfig['uenc'] = $buyRequest['uenc'];
//$cart = Mage::getModel("checkout/cart");
//$cart->addProduct($subProduct, $buyRequestconfig);
//print_r($buyRequest); exit;
/* $products[] = $subProduct->getTypeInstance(true)
->_prepareProduct(
$buyRequestconfig,
$subProduct,
$processMode
);
*/
$subProduct = $subProduct->getTypeInstance(true)->getProductByAttributes($buyRequestconfig['super_attribute'], $subProduct);
$productsInfo[$subProduct->getId()]=1;
}
and also in
configurable.phtml
<?php
/**
* This template handles individual configurable products that have been associated with a grouped product.
*/
?>
<?php
$_product = $this->getProduct();
$_attributes = Mage::helper('core')->decorateArray($this->getAllowAttributes());
$_formId = "product_addtocart_wrapper_".$_product->getId();
$_formJsVar = "productAddToCartForm".$_product->getId();
?>
<div class="price-box"><?php //echo $this->getPriceHtml($_product); ?></div>
<div id="<?php echo $_formId ?>">
<h3><?php echo $_product->getName() ?></h3>
<div class="no-display">
<input type="hidden" name="product" value="<?php echo $_product->getId() ?>" />
<input type="hidden" name="related_product" id="related-products-field" value="" />
</div>
<?php if ($_product->isSaleable() && count($_attributes)):?>
<dl>
<?php foreach($_attributes as $_attribute): ?>
<dt><label><?php echo $_attribute->getLabel() ?><span class="required"> *</span></label></dt>
<dd<?php if ($_attribute->decoratedIsLast){?> class="last"<?php }?>>
<select name="super_attribute[<?php echo $_product->getId() ?>][<?php echo $_attribute->getAttributeId() ?>]" id="attribute<?php echo $_attribute->getAttributeId() ?>" class="go-qty-required-entry required-entry super-attribute-select">
<option><?php echo $this->__('Choose an Option...') ?></option>
</select>
</dd>
<?php endforeach; ?>
</dl>
<script type="text/javascript">
var spConfig = new Product.GroupedConfig(<?php echo $this->getJsonConfig() ?>, <?php echo $_product->getId() ?>);
spConfig.setOptionsPrice(new Product.OptionsPrice(<?php echo Mage::helper('groupedconfigured')->getProductViewJsonConfig($_product) ?>));
</script>
<?php echo $this->getPriceHtml($_product) ?>
<input id="super_group_<?php echo $_product->getId(); ?>" type="hidden" name="super_group[<?php echo $_product->getId() ?>]" maxlength="12" value="1<?php //echo $_item->getQty()*1 ?>" title="<?php echo $this->__('Qty') ?>" class="input-text qty" />
<script type="text/javascript">
//<![CDATA[
var <?php echo $_formJsVar ?> = new VarienForm('<?php echo $_formId ?>');
<?php echo $_formJsVar ?>.submit = function(){
if (this.validator.validate()) {
this.form.submit();
}
}.bind(<?php echo $_formJsVar ?>);
//]]>
</script>
<?php endif;?>
</div>
which will support magento1.9
Thursday, May 7, 2015
Magento Grouped Products Containing Associated Configurable Products
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment