Magento – Associating Simple Products with Required Options to a Grouped Product

by tmillhouse on July 10, 2010

(Magento 1.4 & Enterprise 1.9)
A conceptually obvious task of associating simple products with required options to a grouped product proved to be more of a challenge than expected. By default, Magento doesn’t allow this relationship; however, with some simple core overrides, it is possible with the following steps:

1. Create two basic local modules with the following structures:

app/code/local/{module}/Catalog

  • Block/Adminhtml/Product/Edit/Tab/Super/Group.php
  • Model/Product/Type/Grouped.php
  • etc/config.xml

app/code/local/{module}/CatalogInventory

  • Model/Mysql4/Indexer/Stock/Grouped.php
  • etc/config.xml

2. Edit Group.php by extending Mage_Adminhtml_Block_Catalog_Product_Edit_Tab_Super_Group and only overriding the method _prepareCollection(). In the core file, Magento specifies a required option filter; simply remove this and you’re left with:

protected function _prepareCollection()
    {
        $allowProductTypes = array();
        foreach (Mage::getConfig()->getNode('global/catalog/product/type/grouped/allow_product_types')->children() as $type) {
            $allowProductTypes[] = $type->getName();
        }

        $collection = Mage::getModel('catalog/product_link')->useGroupedLinks()
            ->getProductCollection()
            ->setProduct($this->_getProduct())
            ->addAttributeToSelect('*')
            ->addAttributeToFilter('type_id', $allowProductTypes);

        $this->setCollection($collection);
        return Mage_Adminhtml_Block_Widget_Grid::_prepareCollection();
    }

3. Edit Grouped.php by extending Mage_Catalog_Model_Product_Type_Grouped and overriding its getAssociatedProducts() method. Remove the required option filter, and you’re left with:

public function getAssociatedProducts($product = null)
	{
		if (!$this->getProduct($product)->hasData($this->_keyAssociatedProducts)) {
			$associatedProducts = array();

			if (!Mage::app()->getStore()->isAdmin()) {
				$this->setSaleableStatus($product);
			}

			$collection = $this->getAssociatedProductCollection($product)
			->addAttributeToSelect('*')
			->setPositionOrder()
			->addStoreFilter($this->getStoreFilter($product))
			->addAttributeToFilter('status', array('in' => $this->getStatusFilters($product)));

			foreach ($collection as $product) {
				$associatedProducts[] = $product;
			}

			$this->getProduct($product)->setData($this->_keyAssociatedProducts, $associatedProducts);
		}
		return $this->getProduct($product)->getData($this->_keyAssociatedProducts);
	}

4. The last update for the /Catalog sub-module is to create the config.xml file. This file should look like this:

<?xml version="1.0"?>
<config>
	<modules>
		<{Module}_Catalog>
			<version>0.1.0</version>
		</{Module}_Catalog>
	</modules>
	<global>
		<blocks>
            <adminhtml>
                <rewrite>               <catalog_product_edit_tab_super_group>{Module}_Catalog_Block_Adminhtml_Product_Edit_Tab_Super_Group</catalog_product_edit_tab_super_group>
                </rewrite>
            </adminhtml>
        </blocks>
		<models>
			<catalog>
				<rewrite>				<product_type_grouped>{Module}_Catalog_Model_Product_Type_Grouped</product_type_grouped>
				</rewrite>
			</catalog>
		</models>
	</global>
</config>

5. Now edit Grouped.php under the CatalogInventory sub-module. Extend Mage_CatalogInventory_Model_Mysql4_Indexer_Stock_Grouped and override its _getStockStatusSelect(…) method. Remove the required option clause from the sql query, and you’re code should look as such:

protected function _getStockStatusSelect($entityIds = null, $usePrimaryTable = false)
    {
        $adapter  = $this->_getWriteAdapter();
        $idxTable = $usePrimaryTable ? $this->getMainTable() : $this->getIdxTable();
        $select   = $adapter->select()
            ->from(array('e' => $this->getTable('catalog/product')), array('entity_id'));
        $this->_addWebsiteJoinToSelect($select, true);
        $this->_addProductWebsiteJoinToSelect($select, 'cw.website_id', 'e.entity_id');
        $select->columns('cw.website_id')
            ->join(
                array('cis' => $this->getTable('cataloginventory/stock')),
                '',
                array('stock_id'))
            ->joinLeft(
                array('cisi' => $this->getTable('cataloginventory/stock_item')),
                'cisi.stock_id = cis.stock_id AND cisi.product_id = e.entity_id',
                array())
            ->joinLeft(
                array('l' => $this->getTable('catalog/product_link')),
                'e.entity_id = l.product_id AND l.link_type_id=' . Mage_Catalog_Model_Product_Link::LINK_TYPE_GROUPED,
                array())
            ->joinLeft(
                array('le' => $this->getTable('catalog/product')),
                'le.entity_id = l.linked_product_id',
                array())
            ->joinLeft(
                array('i' => $idxTable),
                'i.product_id = l.linked_product_id AND cw.website_id = i.website_id AND cis.stock_id = i.stock_id',
                array())
            ->columns(array('qty' => new Zend_Db_Expr('0')))
            ->where('cw.website_id != 0')
            ->where('e.type_id = ?', $this->getTypeId())
            ->group(array('e.entity_id', 'cw.website_id', 'cis.stock_id'));

        // add limitation of status
        $psExpr = $this->_addAttributeToSelect($select, 'status', 'e.entity_id', 'cs.store_id');
        $psCond = $adapter->quoteInto($psExpr . '=?', Mage_Catalog_Model_Product_Status::STATUS_ENABLED);

        if ($this->_isManageStock()) {
            $statusExpr = new Zend_Db_Expr('IF(cisi.use_config_manage_stock = 0 AND cisi.manage_stock = 0,'
                . ' 1, cisi.is_in_stock)');
        } else {
            $statusExpr = new Zend_Db_Expr('IF(cisi.use_config_manage_stock = 0 AND cisi.manage_stock = 1,'
                . 'cisi.is_in_stock, 1)');
        }

        $stockStatusExpr = new Zend_Db_Expr("LEAST(MAX(IF({$psCond}, i.stock_status, 0))"
            . ", {$statusExpr})");

        $select->columns(array(
            'status' => $stockStatusExpr
        ));

        if (!is_null($entityIds)) {
            $select->where('e.entity_id IN(?)', $entityIds);
        }

        return $select;
    }

6. Edit config.xml under CatalogInventory, which should look as such:

<?xml version="1.0"?>
<config>
	<modules>
		<{Module}_CatalogInventory>
			<version>0.1.0</version>
		</{Module}_CatalogInventory>
	</modules>
	<global>
		<models>
			<cataloginventory_mysql4>
				<rewrite>
					<indexer_stock_grouped>{Module}_CatalogInventory_Model_Mysql4_Indexer_Stock_Grouped</indexer_stock_grouped>
				</rewrite>
			</cataloginventory_mysql4>
		</models>
	</global>
</config>

7. As with any module, you’ll want to define it within your app/etc/modules/{Module}_App.xml file. Simple add:

                 <{Module}_Catalog>
			<active>true</active>
			<codePool>local</codePool>
		</{Module}_Catalog>
		<{Module}_CatalogInventory>
			<active>true</active>
			<codePool>local</codePool>
		</{Module}_CatalogInventory>

That’s all there is to it. Now, from the admin section, you can associate simple products that have required options to a grouped product. Also, with the CatalogInventory modifications, the stock_status will be set appropriately, and the product will be visible from the catalog search and catalog landings pages.

I didn’t dive into the meanings of my changes, but if you’ve done any Magento core overrides in the past, it should be self explanatory.

To see an example, check out http://www.motionsavers.com/catalogsearch/result/?q=Cotterman . As of this posting, each Cotterman ladder is a grouped product with numerous simple product associations, each of which contains required options. Hope this saves someone time…

– Update (1/31/11) –

One piece of this configuration that I accidentally left out is the simple product override. With the steps above, you’ll be able to associate the grouped-to-simple products and you’ll be able to display their options on the grouped page; however, you need to override the simple product type to implement the logic which handles the custom options for the cart. This class is as follows:

class Brim_Groupedsimple_Model_Product_Type_Simple extends Mage_Catalog_Model_Product_Type_Simple
{

	/**
	 * Check custom defined options for product
	 *
	 * @param Varien_Object $buyRequest
	 * @param Mage_Catalog_Model_Product $product
	 * @return  array || string
	 */
	protected function _prepareOptionsForCart(Varien_Object $buyRequest, $product = null)
	{
		$newOptions = array();
		foreach ($this->getProduct($product)->getProductOptionsCollection() as $_option) {

			/* @var $_option Mage_Catalog_Model_Product_Option */
			$group = $_option->groupFactory($_option->getType())
			->setOption($_option)
			->setProduct($this->getProduct($product))
			->setRequest($buyRequest);

			$superOptions = $buyRequest->getSuperOptions();
			if($superOptions && isset($superOptions[$product->getId()])){
				$group->validateUserValue($superOptions[$product->getId()]);
			}else{
				$group->validateUserValue($buyRequest->getOptions());
			}

			$preparedValue = $group->prepareForCart();

			if ($preparedValue !== null) {
				$newOptions[$_option->getId()] = $preparedValue;
			}
		}
		return $newOptions;
	}
}

– Update (2/10/11) –

In the months since I originally wrote this article, I have taken the code above and put it within its own module. You can download the module here. Unzip the module and place it within your app/code/local/Brim directory (create the Brim folder if its not already there). Then create and add the module xml file for the module (Brim_Groupedsimple).

– Update (6/28/11) –

We have packaged this codebase up into an easy to install Magento extension available in our new Magento Extension Store. The new extension is now called Grouped Options.

{ 97 comments }

Martin Christiansen March 3, 2011 at 8:24 am

Thanks for providing this module Tim,
I just can’t get it to work. The product administration throws an “Fatal error: Call to a member function setConfig() on a non-object in /home/fiskeris/public_html/app/code/core/Mage/Catalog/Model/Product/Type.php on line 78″ (Magento 1.4.1.1) when trying to edit af grouped or simple product.
I followed the instructions on uploading the contents of the latest zip file. I then created the Brim_Groupedsimple.xml file and uploaded that as well. The xml file contains the following:

true
local

Any help would be much appreciated.
Thanks,
-Martin

tmillhouse March 3, 2011 at 10:10 am

Hmm … I haven’t seen this error before when dealing with my module. Can you verify that this exception only occurs when my module is installed? Comment out the Brim_Groupedsimple.xml contents and then attempt to edit a product. If the error is still being thrown, then my module isn’t what’s causing it.

I took a look at the line that is throwing the exception, and it appears you may have a configuration issue somewhere else that is prohibiting the product types from being set properly. If you can confirm that the exception is only thrown when the groupedsimple module is installed/active, then I”ll look more closely at potential causes.

Martin Christiansen March 3, 2011 at 5:06 pm

Sorry for the late reply – apparently my browser was stuck on the comments page 1, so I didn’t see your reply until now.

Anyway I got it working with a little help from a friend.. The error was caused by a path error or an error in the Brim_groupedsimple.xml.
It does what it’s supposed to do now and looks superb – thanks man! I’ll keep your details handy if I ever need a custom Magento module coded :)

tmillhouse March 3, 2011 at 5:20 pm

Awesome, I’m glad you fixed your problem. Let us know if you have any further questions, or need any custom work :)

andy bird March 3, 2011 at 7:07 pm

Perfect.. just what i needed

Chadsten March 8, 2011 at 4:26 pm

Hey Man,

Looks like a great module! I’m having a little trouble with the installation though…

Your files are in the app/code/local/Brim dir.

I have the Brim_Groupedsimple.xml file in the app/etc/modules dir

true
local

I also tried the XML data with Grim instead of Brim…referring to an earlier post. I can’t even get the module to yell at me if I delete the config file…any ideas. Thanks in advance!

tmillhouse March 9, 2011 at 9:00 am

I believe “Grim” was a typo previously. I noticed your Brim_Groupedsimple.xml escaped the tags. The file should looks like this:

<?xml version=”1.0″?>
<config>
<modules>
<Brim_Groupedsimple>
<active>true</active>
<codePool>local</codePool>
</Brim_Groupedsimple>
</modules>
</config>

If you have the file in app/etc/modules, and you have the module installed to app/code/local/Brim, then when you navigate to the admin panel’s system configuration page, and you click on “Advanced”, you should see Brim_Groupedsimple along with every other installed module.

Let me know if you’re still having issues with this. I have a few client obligations to wrap up today, but I can come back to it later this evening.

Thanks,
Tim

Ganar Dinero March 11, 2011 at 8:30 pm

Hey There. I found your blog using msn. This is an extremely well written article. I will be sure to bookmark it and return to read more of your useful information. Thanks for the post. I’ll certainly return.

Chadsten March 14, 2011 at 11:41 am

Tim,

Sorry to get back to you so late, I’ve been out of the office sick.

I’ve changed the XML file to contain the correct data, however, I’m still not seeing anything. I develop in Magento a good bit, but I’d like to think I’m just missing something small.

Files are in app/code/local/Brim (/Groupedsimple).

Config file is in the correct location, and has the correct data. I’ve cleared/rm cache, logged out/in, etc.

Magento ver. 1.4.2.0

Thanks for all the help!

tmillhouse March 14, 2011 at 12:43 pm

Chadsten, Do you see the module in the Settings->Configuration->Advanced list of modules? If you don’t see it, then Magento just isn’t picking up the module. Shoot me an email at tim@brimllc.com, and we can continue this conversion via email. If you send me some ftp credentials and your magento admin username/password, I could probably debug in a relatively small time (no charge).

I wont be able to check back until later this evening through.

Chadsten March 22, 2011 at 3:33 pm

Email sent. Thanks so much Tim!

Max March 24, 2011 at 3:56 pm

Hey Tim,
thank you for this insight. This is awesome.

I have your module installed and running. I have the custom options show up on the product page. (1.5.0.1)

1) The Cart doesn’t include the chosen custom options and says, there were products with custom options required. I guess you’ve explained this above. Could you please teach me how to “override the simple product type to implement the logic which handles the custom options for the cart”? What is a class and where do I have to put that code?
2) On the category page, the grouped product shows price “from 0,00″ (instead of the real price)? Have you ever heard about this problem?

I appreciate your help.
Keep up the good work.
Max

Max March 25, 2011 at 3:51 am

Hi again.

I have your module running with the zipped files downloaded from your page. The module is showing active under configuration>advanced… and the custom options are showing up correctly on the frontend grouped product page.
Nevertheless, the chosen custom options are not taken to cart – it says: “Some of the products below do not have all the required options. Please edit them and configure all the required options.”

Another issue is on category page, the products have a price tag of 0,00.

Any idea?
I appreciate your help.
Ver. 1.5.0.1

tmillhouse March 25, 2011 at 8:16 am

v1.5.0.1 has changed certain parts of the core Magento code base that breaks my original version, however, I recently made the necessary fixes for another blog poster here, so I’ll upload the v1.5 version later today. The fixes will resolve both issues you found.

Max March 25, 2011 at 10:18 am

Thank you so much!

tmillhouse March 25, 2011 at 6:09 pm

Max, try this version: http://www.brimllc.com/wp-content/uploads/2011/03/Groupedsimple.zip.

It has some minor tweaks to some of the file overrides, and it works well with v.1.5+ . Let me know if you still have any issues/questions.

Max March 27, 2011 at 8:12 am

Works perfect. Thank you so much!
Do you think uploads will be possible in the future?

Jon March 30, 2011 at 6:01 am

Hi,

I tried that latest version from the 25th of March with our installation of 1.5.0.1.I placed the files in app/code/local/Brim and created a Brim_Groupedsimple.xml file ( as explained in your post of the 9th of March) and placed it in app/etc/modules.

The extension is showing up as installed and enabled, and I am able to associate simple products with required custom options with grouped products. Unfortunately the custom options don’t show up on the frontend, and if I try to add one of these products to the shopping cart I get an error message saying that I need to select the product’s options first (which I can’t do).

I have cleared my browser’s cache, and Magento’s (currently disabled) cache, reindexed etc…..

Have I missed something?

Thanks for your help!
Jon

Max March 30, 2011 at 7:25 am

Tim, one last thing: I have custom options with different prices. How do I get the grouped product to show the prices (fix or percent) of each custom option?
Neither drop-down shows any price nor displayed price tags do change its value according to my selection.

Any ideas how to get this with your extension to work?
Thank you.

tmillhouse March 30, 2011 at 7:41 am

Jon – In order for the options to be displayed on the front-end, you’ll have to programmatically code them in your grouped.phtml file. Search the blog for “super_options”, which is the name given to the inputs. The module has interceptor code that will analyze these options and apply them for all products being added to cart. Let me know if you’d like me to provide further clarification or examples.

tmillhouse March 30, 2011 at 7:47 am

Max – To show the prices per custom option, you’ll have to code that in to your template file. While you’re iterating through the options, you can call value->getPrice() (or something similar). Also, you’ll want to ensure my product js file is attached. I think its included with the module download, but if its not, I’ll send it to you later this evening.

Jon March 30, 2011 at 10:59 am

Hi Tim,

Thanks for your help!

I couldn’t find anything searching the blog for “super_options”, so I Googled it and came up with http://www.e-commercewebdesign.co.uk/blog/magento/simple-products-with-custom-options-in-a-grouped-product.php – which is refers to this page, this provided the solution to me, and your extension is working very nicely now!

Searching through your blog I did also come across “Magento Grouped Products Containing Associated Configurable Products” – which could possibly suit my purposes even better – so I’m scratching my head over that now!

Thanks for sharing your knowledge!
Jon

tmillhouse March 31, 2011 at 1:16 pm

No problem, I’m glad you found what you were looking for.

Tim Elliott April 6, 2011 at 5:50 am

Hi Tim
Thanks for providing this code. I’ve installed it and it’s showing as enabled in my config but it doesn’t seem to be working as expected.
e.g. http://www.kidzdens.co.uk/butterfly-name-plaque-and-letters.html
This is a grouped product. The “Fairytale Letter” simple product has a text box custom option that is set to “not required” at present. However, when I make them required the products just disappear from the grouped product. Perhaps this is because of my template??

Ideally I want the custom option text box to appear below “Fairytale letter” on the grouped product page. However I’m not sure if the changes you have mentioned above allow this.

Any help would be much appreciated.
Tim Elliott

Tim Elliott April 6, 2011 at 10:13 am

Hi again,
Further to my last comment, I now have the module working so that a simple product with “required” custom options now still appears.

I have also used the code in this blog to add the custom options to the grouped product page:
http://www.e-commercewebdesign.co.uk/blog/magento/simple-products-with-custom-options-in-a-grouped-product.php

Great so far. The only problem is that this code only makes a drop down for the custom options, even if the option is a text field.

Do yo know how to make the options shown on the grouped product page reflect the input type as defined in the custom options?

Thanks
Tim

tmillhouse April 10, 2011 at 7:30 pm

Hi Tim (great name btw),

Sorry for the late response; I’m just now getting back from vacation and getting caught up on emails …

Regarding the display of the options, I haven’t made my module flexible enough to support other option types (other than dropdowns) out of the box. You can, however, take a look at my code that generates the dropdowns, and you should be able to make them as text fields (or anything else). The important piece is the “name” attribute on the input. Just as I have generated a “select” input with the name super_options[item_id][option_id], you should be able to generate a textfield with the same name, and it will work as expected.

If you’re still having issues with it, shoot me an email at tim@brimllc.com and I’ll have a look. I haven’t touched this code in a while, but I should be able to put you on the right path in a short time.

Sorry again for the delay…

Tim Elliott April 11, 2011 at 5:04 pm

Just as an update, the code to add to the grouped.phtml file to make this work for drop downs and text fields is:

getProductOptionsCollection();

foreach($options as $option){
echo “”;
$type = Mage::getSingleton(‘catalog/product_option’)->getGroupByType($option->getType());
if($type == ‘text’){
echo $option->getTitle() . “: “;
echo sprintf(“”,
$option->getTitle().’-’.$_item->getId(),
’super_options['.$_item->getId().']['.$option->getId().']‘,
‘product-custom-option product-monogram-option product-custom-option-’.$_item->getId());
}else{
$select = $this->getLayout()->createBlock(‘core/html_select’);
$select->setClass(‘product-custom-option’);
$select->setName(’super_options['.$_item->getId().']['.$option->getId().']‘);
foreach ($option->getValues() as $value) {
$select->addOption($value->getOptionTypeId(), $value->getTitle());
}

echo $option->getTitle() . “: ” . $select->getHtml();
}
}
?>

Hope that helps anyone who has had the same requirements as me.

Josh April 12, 2011 at 4:44 pm

Hey Tim,

Excellent work! It looks like im ALMOST there. The modules are installed and the options are visible in the front end, but when I try to select the option and add the item to the cart, it give me an error “The product has required options”. Ive cleared cach and reindexed with no luck. you can check out the page here:
http://tinyurl.com/3urlhc4

Thanks!

Brandon Smallmon April 12, 2011 at 6:23 pm

Thanks, I’ve recently been seeking for information about this topic for ages and yours is the best I’ve found so far.

tmillhouse April 13, 2011 at 9:39 am

Josh – you may have an old version of the module. Do you have the class app/code/local/Brim/Model/Product/Type/Simple.php? And if you do, does it only have a method called _prepareOptionsForCart? If this is the only version you have, then you have the version of the module that only works for magento version 1.4. In v1.5+, they made some changes to the product models, which required me to tweak this class.

I’m unable to send the correct file now, but if this is the case, then I believe there are other comments in this thread that point to the updated version. Hope this helps, and let me know if you have any other questions.

Josh April 13, 2011 at 10:45 am

Yep, that was it! I didnt notice the updated module for 1.5.

Would you know why the drop down would have the ‘?’ marks i.ei
? Select Color ? for the dropdown? Is it a missing font or something?

Natacha Loupe April 17, 2011 at 1:54 am

Howdy! This is my first comment here so I just wanted to give a quick shout out and say I really enjoy reading through your blog posts. Can you recommend any other blogs/websites/forums that go over the same subjects? Thank you so much!

Erik Oberhausen April 21, 2011 at 8:30 pm

Tim,
thanks for doing this.
Wondering if I could get a nudge in the right direction. I pulled down the module today and installed on 1.4.1.1, dropped the files into app>code>local>Brim and created the Brim_Groupedsimple.xml file in app>etc>modules. Under Configuration>Advanced your module is showing up and is listed as enabled. However, when I attempt to add a simple product with custom options attached, to a new grouped product, it is not available to become an associated product. If I remove the custom option, it then becomes available with all the other simple products without options. Hoping I’m missing something simple.
Thanks so much for your help!

Yossarian April 26, 2011 at 5:03 pm

A small installation tip for everyone who can’t get the module to show up in System > Configuration > Advanced. Make sure you have normal quotes in .

I copy/pasted and it made the module not show up.

Cheers

Yossarian April 27, 2011 at 10:59 am

Hello Tim,

Awesome module you’ve developed. I installed it and it is showing as enabled but I need some help. I am not sure where to put the code in grouped.phtml exactly to show the custom options in my grouped product. The article Jon was referring to (http://www.e-commercewebdesign.co.uk/blog/magento/simple-products-with-custom-options-in-a-grouped-product.php) is not helping me either unfortunately.

I tried it naturally but I only get this error: Fatal error: Call to a member function getProductOptionsCollection() on a non-object in /home/gridlabs.nl/public_html/magento/app/design/frontend/base/default/template/catalog/product/view/type/grouped.phtml

I use Magento version 1.5.0.1

Can you help me out?

Glenn G April 28, 2011 at 10:22 pm

Hi Tim,

Great module, I’m wondering if it will solve my problem. The grouped item can be seen here.
http://oamps.mementogifts.com.au/index.php/oamps-white-cotton-polo.html

As you can see I’m using the grouped simple product to easily display stock on hand for each size. The issue is the client has requested that they have an option to purchase these grouped products as either “company pays” or “employee pays”. This is for the polo shirt items only, not the whole order. So I would put a check box next to the add to cart indicating the employee wishes to have this deducted from their payroll?

Would you module solve this problem?

Kind Regards

Glenn Giblett

tmillhouse April 29, 2011 at 7:04 am

Sorry for the late replies … If you haven’t already figured this out, be sure you’re putting my code within the loop where its iterating over each group product’s associated items.

tmillhouse April 29, 2011 at 7:05 am

Glenn, the module should facilitate this requirement, but you’ll have to code in the checkbox input. Be sure to give it the same input “name” as the select inputs per my examples, and my code should pick this value up and add it as a custom option.

Max May 4, 2011 at 12:42 pm

Hey Tim.
Just discovered another problem, can you help me out?
Your module is working on 1.5.0.1. If you log in as a customer (front end) and you want to re-order one of the grouped products with custom options, the error occures. Magento says “please specify required options…”
Do you know the issue? Do you think, we can solve it?

Thank you very much in advance.
Max

pat May 13, 2011 at 1:31 pm

Hi Tim
I have the custom option drop-down for each product in the grouped but prices for each custom options are not appearing and are not updated in the cart if added. it only update the custom option like small medium large but not the price change ( +10 +20 +30)
what am I doing wrong?
Here is my grouped.phtml

setPreconfiguredValue(); ?>
getProduct(); ?>
getAssociatedProducts(); ?>
0; ?>
isAvailable() && $_hasAssociatedProducts): ?>
__(‘Availability:’) ?> __(‘In stock’) ?>

__(‘Availability:’) ?> __(‘Out of stock’) ?>

getChildHtml(‘product_type_data_extra’) ?>


__(‘Image’)
?>

__(‘Product Name’)
?>
__(‘Price’) ?>
isSaleable()): ?>
__(‘Qty’) ?>

helper(‘tax’)->getPrice($_item, $_item->getFinalPrice(), true) ?>

<img src="helper(‘catalog/image’)->init($_item, ’small_image’)->resize(75, 75); ?>” width=”75″ height=”75″ alt=”stripTags($_item->getName(), null, true) ?>” align=”left” />

htmlEscape($_item->getName()) ?>
getProductOptionsCollection();
foreach($options as $option){
$select = $this->getLayout()->createBlock(‘core/html_select’);
$select->setClass(‘product-custom-option’);
$select->setName(’super_options['.$_item->getId().']['.$option->getId().']‘);
$select->addOption(”, ‘– Select ‘.$option->getTitle().’ –’);

foreach ($option->getValues() as $value) {
$select->addOption($value->getOptionTypeId(), $value->getTitle());
}

echo $select->getHtml();
}
?>

getPriceHtml($_item, true) ?>
getTierPriceHtml($_item) ?>

isSaleable()): ?>

isSaleable()) : ?>
<input name="super_group[getId() ?>]” value=”getQty()*1 ?>” type=”text” class=”input-text qty” />

__(‘Out of stock.’) ?>

<td colspan="isSaleable()): ?>43″>__(‘No options of this product are available.’) ?>

decorateTable(’super-product-table’)

Thanks for helping.

Oskar Risberg May 17, 2011 at 8:09 am

Good day!

I really enjoy finding a well written article and a well written module for my precise needs. However, i can’t get it to work.
I have uploaded the files to the correct foldes, i have added the xml and i have activated the module in the options, but that’s where it stops. I can’t get the products with required options to show up when trying to configure my configurable products.

Have i totally misread the article and need to configure a bunch of files or am i missing something else?

Thanks in advance (Especially for quick answers ;)

Max June 6, 2011 at 5:06 am

Hey Tim – are you still working on this extension?

I have your extension implemented and it’s working fine.

Another Bug: If I try to modify an order in the backend, the chosen options are blown away – I have to manually select the options… Do you know any solution?

My problem (2 comments above) is still not beeing solved.

Thank you.

Oliver June 13, 2011 at 8:20 am

Hi Tim,

I am trying to install this module and I have it in the Brim folder in app/local and the xml file in the modules folder but magento isn’t picking it up. Is there anything I’m missing?

Thanks

Nath June 20, 2011 at 5:33 am

hi..

I have this all setup and it works a treat, many thanks Tim.. The only issue I have seems to be displaying the price in the drop down.

I have tried the $value->getPrice() in the grouped.phtml file in my template but it doesn’t work.. It’s kind of important as otherwise the customer has no idea that a particular option is more or less expensive..

can anyone suggest a solution?..

thanks

Nathan

foreach ($option->getValues() as $value) {
$select->addOption($value->getOptionTypeId(), $value->getTitle(), $value->getPrice());

tmillhouse July 18, 2011 at 12:47 pm

@Max – Do you have the overridden product class that has the new prepareOptionsForCard() method ? Version 1.5 made core updates to another method that you need to override; I believe the most recent code on here should suffice, but you can always purchase a copy of our module from our magento store ecommerce.brimllc.com.

tmillhouse July 18, 2011 at 12:50 pm

Due to the high demand for help on this module, my business partner has bundled it into a magento connect module. You can grab it here : ecommerce.brimllc.com, and if you still have issues, email devs@brimllc.com so that we’ll all get the email.

Barcia July 19, 2011 at 11:31 am

Thank you, that saved me a fair bit of time. How much time have you spent tutoring Magento? You sound like an epic ninja at it!

Thanks again, Barcia.

Comments on this entry are closed.

{ 2 trackbacks }

Next post: