Category Archives: Catalog Product Types

■ Identify and describe standard product types (simple, configurable, bundled, etc.).
○ Create custom product types from scratch or modify existing product types.
○ Identify how custom product types interact with indexing, SQL, and underlying data structures.
In addition to allowing customization of existing product types, the framework provided by the Magento catalog module lets you create completely new ones.
■ Which product types exist in Magento?
■ Which product types are implemented as part of the Mage_Catalog
module, and which are not?
■ What steps need to be taken in order to implement a custom product
type?
■ How do the different product types handle calculation?
■ Which indexing processes does the product type influence?
■ Which product types implement a parent-child relationship between
product entities?
■ Which database tables are shared between product types, and which
ones are specific to one product type?
These code references can be used as an entry point to find answers to the questions above:
■ Mage_Catalog_Model_Product_Type
■ Mage_Catalog_Model_Product_Type_Abstract
■ Mage_Catalog_Model_Product_Type_Simple
■ Mage_Catalog_Model_Resource_Product_Type_Configur
able
■ Mage_Bundle_Model_Product_Type

Frontend – Modifying Bundled Products

Consider a product that is made up of other catalog items. This product needs to be a box of those other items and not allow the user to modify this list. It is a simple case that this is what they get and that is that. This was one of the issues I needed to resolve, and this is how I got around it.

1) Create a Bundle Product.

Admin -> Manage Product -> Add Product -> Create Product Settings

Admin -> Manage Product -> Add Product -> Create Product Settings -> Product Type -> Bundle Product

In the situation that needed to be resolved the price was set to a fixed value, and this was defined instead of the dynamic alternative.

Admin -> Manage Product -> Add Product -> Create Product Settings -> Product Type -> Bundle Product -> Price

The key area to adding the products that this master product will be made up of is defined in the the bottom option on the left hand side; Bundle Items.

Admin -> Manage Product -> Add Product -> Create Product Settings -> Product Type -> Bundle Product -> Bundle Items

In the Bundle Option header click the Add New Option button, and this will display an additional set of options.

Admin -> Manage Product -> Add Product -> Create Product Settings -> Product Type -> Bundle Product -> Bundle Items -> Add New Option

As the intention is to remove the option for the front end visitor to be able to select the products that this bundle will be comprised of, the Checkbox Input Type has been selected, although this is a somewhat random, it will define the Template file that we need to modify later. To avoid any issues with required values the Is Required selection has been set to no. The Add Selection button has then been clicked.

Admin -> Manage Product -> Add Product -> Create Product Settings -> Product Type -> Bundle Product -> Bundle Items -> Add New Option -> Add Selection

Click Search to display a list of products available.

Select the items with the checkbox on the same line as the product and add a quantity in the relevant box.

Click the Add Selected Product(s) to Option button.

Admin -> Manage Product -> Add Product -> Create Product Settings -> Product Type -> Bundle Product -> Bundle Items -> Add New Option -> Add Selection -> Add Selected Product(s) to Option

Save.

This creates a basic Bundled product. All well and good and perhaps nothing of note there. The options above are obviously only a suggestion and therefore setting the values appropriate to the individuals needs is required.

Modifying the Template file to limit and delight is the next intended objective.

As the checkbox option was defined in the creation of the Bundle Product, this will will be the Template file that will need to be altered.

Copy the file: frontend/default/base/template/bundle/catalog/product/view/type/bundle/option/checkbox.phtml into your own theme directory.

This is where we used the following code:

<?php /* @var $this Mage_Bundle_Block_Catalog_Product_View_Type_Bundle_Option_Checkbox */ ?>
<?php $_option = $this->getOption() ?>
<?php $_selections = $_option->getSelections() ?>
<dt><label<?php if ($_option->getRequired()) echo ' class="required"' ?>><?php echo $this->htmlEscape($_option->getTitle()) ?><?php if ($_option->getRequired()) echo '<em>*</em>' ?></label></dt>
<dd<?php if ($_option->decoratedIsLast){?> class="last"<?php }?>>
    <div class="input-box">
    <?php if (count($_selections) == 1 && $_option->getRequired()): ?>
        <?php echo $this->getSelectionQtyTitlePrice($_selections[0]) ?>
        <input type="hidden" name="bundle_option[<?php echo $_option->getId() ?>]" value="<?php echo $_selections[0]->getSelectionId() ?>"/>
    <?php else:?>
    <script type="text/javascript" src="<?php echo $this->getSkinUrl('js/jquery.easing-1.3.pack.js') ?>"></script>
    <script type="text/javascript" src="<?php echo $this->getSkinUrl('js/jquery.mousewheel-3.0.4.pack.js') ?>"></script>
    <script type="text/javascript" src="<?php echo $this->getSkinUrl('js/jquery.fancybox-1.3.4.pack.js') ?>"></script>
    <script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/jquery-ui.min.js"></script>

    <script type="text/javascript" src="<?php echo $this->getSkinUrl('js/bundledbox.js') ?>"></script>
    <link rel="stylesheet" type="text/css" href="<?php echo $this->getSkinUrl('css/jquery.fancybox-1.3.4.css') ?>" media="screen">
    <link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css">

        <?php foreach($_selections as $_selection): ?>
        <a class="bundledbox-product" href="#product-<?php echo ($_selection->getId()); ?>" title="<?php echo ($_selection->getName()); ?>"><?php echo ($_selection->getName()); ?></a><?php var_dump ($_selection); ?>
        <div style="display:none">
            <div id="product-<?php echo ($_selection->getId()); ?>">
                <div class="tabs">
                  <ul>
                    <li><a href="#<?php echo ($_selection->getId()); ?>-tab-1"><?php echo ($this->__('Description')); ?></a></li>
                    <li><a href="#<?php echo ($_selection->getId()); ?>-tab-2"><?php echo ($this->__('Information')); ?></a></li>
                    <li><a href="#<?php echo ($_selection->getId()); ?>-tab-3"><?php echo ($this->__('Storage')); ?></a></li>
                  </ul>
                  <div id="<?php echo ($_selection->getId()); ?>-tab-1">
                    <p><?php echo ($_selection->load($_selection->getId())->getShortDescription()); ?></p>
                  </div>
                  <div id="<?php echo ($_selection->getId()); ?>-tab-2">
                    <p>
                    <?php if ( $_selection->getData()['manufacturer_value']) { echo ($this->__('Manufacturer') . ': ' . $_selection->getData()['manufacturer_value'] . '<br />' ); } ?>
                    <?php if ($_selection->getData()['organic_value']) { echo ($this->__('Organic') . ': ' . $_selection->getData()['organic_value'] . '<br />' ); } ?>
                    <?php if ($_selection->getData()['vegetarian_value']) { echo ($this->__('Vegetarian') . ': ' . $_selection->getData()['vegetarian_value'] . '<br />' ); } ?>
                    <?php if ($_selection->getData()['vegan_value']) { echo ($this->__('Vegan') . ': ' . $_selection->getData()['vegan_value'] . '<br />' ); } ?>
                    <?php if ($_selection->getData()['natural_value']) { echo ($this->__('Natural') . ': ' . $_selection->getData()['natural_value'] . '<br />' ); } ?>
                    <?php if ($_selection->getData()['sin_tacc_value']) { echo ($this->__('Sin TACC') . ': ' . $_selection->getData()['sin_tacc_value'] . '<br />' ); } ?>
                    </p>
                  </div>
                  <div id="<?php echo ($_selection->getId()); ?>-tab-3">
                    <p><?php if ($_selection->getData()['storage']) { echo ($_selection->getData()['storage']); } ?></p>
                  </div>
                </div>
            </div>
        </div>
        <br />
        <?php endforeach; ?>
        <div id="bundle-option-<?php echo $_option->getId() ?>-container"></div>
    <?php endif; ?>
    </div>
</dd>

There are possibly some confusing aspects of this and while this is not a primer on javascript and jQueryUI the new lines are based on allowing users to click on the product options to get more information on the individual options that the Bundle Product is comprised.