Hi,
I am trying to configure my Magento 1.9.2.2 in order to sell in a single page either :
I started to create a simple product in order to sell the physical book.
Then I created a downloadable product to sell the pdf.
Both are configured to "not visible independently".
I want now to display those two product types in a single product page so I created a third product with "bundle" type. I can easily add the simple product to selection of "bundle items" but the downloadable product doesn't want to appear in the selection list so I can't add it.
I faced the same problem with "grouped" product.
Thanks in advance for your help.
Solved! Go to Solution.
Here is the solution I found to answer myself to my first question : "how to add downloadable product to bundle product?" :
I had to modify the app/code/core/Mage/Downloadable/etc/config.xml and uncomment as follow :
<!---<bundle>---> <!---<allowed_selection_types>---> <!---<downloadable/>---> <!---</allowed_selection_types>---> <!---</bundle>--->
to:
<bundle> <allowed_selection_types> <downloadable/> </allowed_selection_types> </bundle>
Now downloadable product appears in bundle product "Add to selection" interface ONLY if those conditions are met in the downloadable product :
* Links can be purchased separately = No
* No custom attributes configured as "Mandatory"
Thanks to http://www.divisionlab.com/solvingmagento/magento-grouped-product-type/ for the answer :
A product to be added to a grouped product must not only be of an allowed type but
also have its attribute required_options not to be equal 1. If a product
has required_options set to 1 it means that there are options that must be selected
before the product can be added to cart. This definitely applies to configurable
and bundle products. In some situations other product types can also be affected.
First, a downloadable product can have this attribute set to 1 if its
links can be purchased separately. Second, any product which has a custom
option flagged as “required” also will get required_options set to 1.
Here is the solution I found to answer myself to my first question : "how to add downloadable product to bundle product?" :
I had to modify the app/code/core/Mage/Downloadable/etc/config.xml and uncomment as follow :
<!---<bundle>---> <!---<allowed_selection_types>---> <!---<downloadable/>---> <!---</allowed_selection_types>---> <!---</bundle>--->
to:
<bundle> <allowed_selection_types> <downloadable/> </allowed_selection_types> </bundle>
Now downloadable product appears in bundle product "Add to selection" interface ONLY if those conditions are met in the downloadable product :
* Links can be purchased separately = No
* No custom attributes configured as "Mandatory"
Thanks to http://www.divisionlab.com/solvingmagento/magento-grouped-product-type/ for the answer :
A product to be added to a grouped product must not only be of an allowed type but
also have its attribute required_options not to be equal 1. If a product
has required_options set to 1 it means that there are options that must be selected
before the product can be added to cart. This definitely applies to configurable
and bundle products. In some situations other product types can also be affected.
First, a downloadable product can have this attribute set to 1 if its
links can be purchased separately. Second, any product which has a custom
option flagged as “required” also will get required_options set to 1.
Please don't override your core files. This is causes much more issues down the road, especially if you make a habit out of it. When you have to upgrade Magento, you will lose all your core changes. Even if you have some mechanism in place to re-add your core changes after an upgrade, it can still prove fatal. There very well can be other code that depends on the updated code, but if you overwrite it, it will break. Not only is it dangerous, but it's then tough for other Magento developers to come in and work with it as it can really throw them for a loop. Anyway, the correct way to do this is by creating a new custom module.
Below is the code how I've done it in the past, but you can probably make it much simler by just putting the code you mentioned in a the custom config.xml file.
app/code/local/Custom/Bundle/etc/config.xml
<?xml version="1.0"?> <config> <modules> <Custom_Bundle> <version>1.0.0</version> </Custom_Bundle> </modules> <global> <helpers> <custom_bundle> <class>Custom_Bundle_Helper</class> </custom_bundle> <bundle> <rewrite> <data>Custom_Bundle_Helper_Data</data> </rewrite> </bundle> </helpers> </global> </config>
app/code/local/Custom/Bundle/Helper/Data.php
<?php class Custom_Bundle_Helper_Data extends Mage_Core_Helper_Abstract { const XML_NODE_BUNDLE_PRODUCT_TYPE = 'global/catalog/product/type/bundle'; /** * Retrieve array of allowed product types for bundle selection product * * @return array */ public function getAllowedSelectionTypes() { $config = Mage::getConfig()->getNode(self::XML_NODE_BUNDLE_PRODUCT_TYPE); //ADD DOWNLOADABLE $allowed_selection_types = $config->allowed_selection_types->asArray(); $allowed_selection_types['downloadable'] = ''; return array_keys($allowed_selection_types); } }