I have a product with two format one downloadable and another non-downloadeable. How can I show both format together on frontend with that product.
2 Answers
By default the Configurable product only allows simple and virtual products to be used, this is specified in the config.xml in Mage/Catalog/etc/:
<configurable translate="label" module="catalog">
<label>Configurable Product</label>
<model>catalog/product_type_configurable</model>
<price_model>catalog/product_type_configurable_price</price_model>
<composite>1</composite>
<allow_product_types>
<simple/>
<virtual/>
</allow_product_types>
<index_priority>30</index_priority>
<price_indexer>catalog/product_indexer_price_configurable</price_indexer>
To add a downloadable product to you configuration you have to create a small extension (do not change the core file!) to add this option:
Module init file (app/etc/modules/Example_DownloadableConfigurable.xml):
<?xml version="1.0"?>
<config>
<modules>
<Example_DownloadableConfigurable>
<active>true</active>
<codePool>community</codePool>
<depends>
<Mage_Bundle/>
<Mage_Downloadable/>
</depends>
</Example_DownloadableConfigurable>
</modules>
</config>
Module configuration file (app/code/community/Example/DownloadableConfigurable/etc/config.xml):
<?xml version="1.0"?>
<config>
<modules>
<Example_DownloadableConfigurable>
<version>14.293.1</version>
</Example_DownloadableConfigurable>
</modules>
<global>
<catalog>
<product>
<type>
<configurable>
<allowed_selection_types>
<downloadable/>
</allowed_selection_types>
</configurable>
</type>
</product>
</catalog>
</global>
</config>
Just tested this with an order and the downloadable product is added to the list with My Downloadable products. The code above can also be applied to the bundle products type (just change <configurable>
to <bundle>
).
-
Thank You for your answer. I did as you told but there is no change. Commented Oct 20, 2014 at 7:07
-
You have to create an attribute that is used for a configurable product, assign that to both the downloadable and the non-downloadable product (for example: order_type with values Download or Shipping). If you now create a configurable product based on that attribute you will have the option to include both products Commented Oct 20, 2014 at 9:04
-
Also refresh the cache to rebuild the configuration Commented Oct 20, 2014 at 9:05
-
It works first time but when I go to downloadable product and set "Links can be purchased separately" option to YES. then this downloadable products disapperars from the list in configurable product associate list and then if I set "Links can be purchased separately" again to "No" then downloadable products still does not show in list. Why.? Commented Oct 20, 2014 at 9:54
-
Yes, its not possible to use the option that links can be purchased separately, not sure why the file isn't shown when you set it back to no, maybe you need to reindex/flush cache? Commented Oct 20, 2014 at 9:59
shashank you can do this by xml configuration:
Magento provide two type of product in associate list for configurable product
s.One is simple and other is virtual
<configurable translate="label" module="catalog">
<label>Configurable Product</label>
<model>catalog/product_type_configurable</model>
<price_model>catalog/product_type_configurable_price</price_model>
<composite>1</composite>
<allow_product_types>
<simple/>
<!-- add this here -->
<downloadable/>
<virtual/>
</allow_product_types>
<index_priority>30</index_priority>
<price_indexer>catalog/product_indexer_price_configurable</price_indexer>
</configurable>
-
Thank you Amit for you answer but I am unable to understand your answer that in which xml file I have to do changes and what code I have to add at which place. Please do more clear. Commented Oct 20, 2014 at 6:47
-
-
Hello Amit I have changed there. but when I go to Associate Products tab in configurable product then there is no name of downloadble product in list. Commented Oct 20, 2014 at 7:07
-