<?php

/** @var Ess_M2ePro_Block_Adminhtml_Amazon_Listing_Variation_Product_Manage_Tabs_Settings $this */

$channelThemes = $this->getChannelThemes();
$channelThemeNote = $this->getChannelThemeNote();

$magentoProductVariations = $this->getListingProduct()->getMagentoProduct()->getVariationInstance()->getVariationsTypeStandard();

?>
<div style="height: 510px; overflow: auto;">

<div class="hor-scroll" style="padding-bottom: 15px; ">
    <div id="variation_settings_error_block">
        <ul class="messages">
                <?php if (count($this->getMessages()) > 0) {
                echo $this->getWarnings();
            } ?>
        </ul>
    </div>
</div>

<?php if($this->isNotExistsMissedProductTypeTemplate()) return; ?>

<div class="entry-edit" id="magento_block_amazon_variation_manager_variation_general_id">

    <div class="entry-edit-head">
        <h4 class="icon-head head-edit-form fieldset-legend"><?php echo Mage::helper('M2ePro')->__('Parent Product'); ?></h4>
    </div>
    <div class="fieldset">
        <div class="hor-scroll">

            <div id="block_notice_amazon_product_manage_settings_general_id" class="block_notices_module" title="<?php echo Mage::helper('M2ePro')->__('Parent Product Ownership'); ?>">
                <?php echo Mage::helper('M2ePro')->__('The fact that you are the Creator of this Amazon Parent Product influences on the work with its Child Products. <br/><br/>

                In case you create New Amazon Parent-Child Product using M2E Pro you will be considered as a Creator of this Product. <br/><br/>

                What you should know if you are the Creator of the Parent Product:
                <ul class="list">
                    <li>Only you have an ability to add new Options of Attributes (for example, Option Red of Attribute Color) and Child Products for them;</li>
                    <li>New Amazon Child Product will be created using a Product Type assigned to the Amazon Parent Product.</li>
                </ul>

                If you are not the Creator of this Product, you can only sell existing Child Products of the Parent Product.
                '); ?>
            </div>

<?php if ($this->hasGeneralId() && !$this->isGeneralIdOwner()) { ?>

    <p><?php echo Mage::helper('M2ePro')->__('You are not the Creator of Amazon Parent Product: %asin%. It is not allowed to you to create New Amazon Child Products.', $this->getGeneralIdLink()) ?>
    </p>

<?php } elseif ($this->hasGeneralId() && $this->isGeneralIdOwner()) { ?>

    <p><?php echo Mage::helper('M2ePro')->__('You are the Creator of Amazon Parent Product %asin%. It is allowed to you to create New Amazon Child Products. <br/><br/><b>Please Note:</b> New Amazon Child Products will be created based on Product Type %pt_link%.', array('asin' => $this->getGeneralIdLink(), 'pt_link' => $this->getProductTypeLink())) ?>
    <?php if ($this->showGeneralIdActions()) { ?>
        <a href="javascript:void(0);" onclick="ListingGridObj.variationProductManageHandler.setGeneralIdOwner(<?php echo Ess_M2ePro_Model_Amazon_Listing_Product::IS_GENERAL_ID_OWNER_NO ?>)"><?php echo Mage::helper('M2ePro')->__('I am not Creator'); ?></a></p>
    <?php } ?>

<?php } elseif (!$this->hasGeneralId() && $this->isGeneralIdOwner()) { ?>

    <p><?php echo Mage::helper('M2ePro')->__('New Amazon Parent Product will be created based on %pt_link% Product Type.<br/> You will be able to create New Amazon Child Products.', $this->getProductTypeLink())?></p>

<?php } ?>

        </div>
    </div>
</div>

<div id="manage_variation_sku_popup" style="display: none; padding: 10px;">
    <div id="block_notice_amazon_product_manage_settings_new_product_asin_sku" class="block_notices_module" title="<?php echo Mage::helper('M2ePro')->__('Amazon Parent Product SKU'); ?>">
        <?php echo Mage::helper('M2ePro')->__('In order to prove that this is your Product, you need to provide SKU of the respective Product in your Amazon Inventory. Please follow the Rules below to avoid issues:
            <ul class="list">
                <li>The SKU has to be related to Parent Product in your Amazon Inventory;</li>
                <li>ASIN(s)/ISBN(s) in M2E Pro and in Amazon Inventory have to be the same;</li>
                <li>The Product in the Amazon Inventory has to be visible via Amazon API.</li>
            </ul>
        '); ?>
    </div>

    <form id="variation_manager_sku_form" action="javascript:void(0);">
        <table class="form-list" cellspacing="0" cellpadding="0">
            <tr>
                <td class="label" style="width: 60px;">
                    <label style="width: 60px;" for="sku"><?php echo Mage::helper('M2ePro')->__('SKU') ?>: <span class="required">*</span></label>
                </td>
                <td class="value">
                    <input type="text" name="sku" style="width: 325px;">
                    <div id="variation_manager_sku_form_error" class="validation-advice" style="display: none"></div>
                </td>
            </tr>
        </table>
        <div style="text-align: right; margin: 10px 0px;">
            <a href="javascript:void(0);" onclick="Windows.getFocusedWindow().close();"><?php echo Mage::helper('M2ePro')->__('Cancel'); ?></a>
            &nbsp;&nbsp;
            <button onclick="ListingGridObj.variationProductManageHandler.setProductSku()"><?php echo Mage::helper('M2ePro')->__('Confirm'); ?></button>
        </div>
    </form>
</div>

<?php if ($this->isGeneralIdOwner()) { ?>

<div class="entry-edit" id="magento_block_amazon_variation_manager_channel_theme">
    <div class="entry-edit-head">
        <h4 class="icon-head head-edit-form fieldset-legend"><?php echo Mage::helper('M2ePro')->__('Variation Theme'); ?></h4>
    </div>
    <div class="fieldset">
        <div class="hor-scroll">

            <div id="block_notice_amazon_product_manage_settings_theme" class="block_notices_module" title="<?php echo Mage::helper('M2ePro')->__('Variation Theme'); ?>">
                <?php echo Mage::helper('M2ePro')->__('Variation Theme is a combination of Attributes by which 
                    your product will vary on Amazon. To create new Amazon Multi-Variation Products, 
                    a Variation Theme is required.<br><br>
                    The list of available Variation Themes depends on the Category and Product Type selected 
                    in the Product Type.
                    The Variation Themes are strictly regulated by Amazon, so they cannot be modified or added.<br><br>
                    <b>Note:</b> You cannot change the Variation Theme once the ASIN/ISBN is assigned 
                    to the Parent Product.
                 '); ?>
            </div>

<?php if ($this->hasGeneralId()) { ?>

    <?php if (!$this->hasChannelTheme()) { ?>
        <p style="color: #ea7601; "><?php echo Mage::helper('M2ePro')->__('Variation Theme')?>: <?php echo Mage::helper('M2ePro')->__('Not Available')?></p>
    <?php } else { ?>
        <p>
            <?php echo Mage::helper('M2ePro')->__('Variation Theme')?>: <span style="color: grey;"><?php echo $this->getChannelThemeAttrString() ?></span>&nbsp;
            <?php if (!empty($channelThemeNote)) { ?>
                <img class="tool-tip-image"
                     style="vertical-align: middle;"
                     src="<?php echo $this->getSkinUrl('M2ePro/images/warning.png'); ?>">&nbsp;&nbsp;
                <span class="tool-tip-message tool-tip-warning" style="display:none;">
                    <img src="<?php echo $this->getSkinUrl('M2ePro/images/i_notice.gif'); ?>">
                    <span><?php echo $channelThemeNote; ?></span>
                </span>
            <?php } ?>
        </p>
    <?php } ?>

<?php } elseif (!$this->hasGeneralId()) { ?>

    <table class="form-list" cellspacing="0" cellpadding="0">
        <tr>
            <td class="label">
                <label for="variation_manager_theme"><?php echo Mage::helper('M2ePro')->__('Variation Theme')?>: <span class="required">*</span></label>
            </td>
            <td class="value">
                <span id="variation_manager_theme_attributes" <?php echo !$this->hasChannelTheme() ? 'style="color: red;"' : '' ?>>
                    <?php echo $this->hasChannelTheme() ? $this->getChannelThemeAttrString() : Mage::helper('M2ePro')->__('Not Set') ?>
                </span>&nbsp;
                <select id="variation_manager_theme" name="variation_manager_theme" class="required-entry" style="display: none;">
                    <?php foreach($channelThemes as $key => $theme) { ?>
                        <option value="<?php echo $key; ?>" <?php echo $key == $this->getChannelTheme() ? 'selected="selected"' : '' ?> ><?php echo implode(', ', $theme['attributes']); ?></option>
                    <?php } ?>
                </select>

                <?php if (!empty($channelThemeNote)) { ?>
                <img id="channel_variation_theme_note"
                         class="tool-tip-image"
                         style="vertical-align: middle;"
                         src="<?php echo $this->getSkinUrl('M2ePro/images/warning.png'); ?>">&nbsp;&nbsp;
                <span class="tool-tip-message tool-tip-warning" style="display:none;">
                    <img src="<?php echo $this->getSkinUrl('M2ePro/images/i_notice.gif'); ?>">
                    <span><?php echo $channelThemeNote; ?></span>
                </span>
                <?php } ?>

                <?php if (!$this->isInAction()) {?>
                    <button onclick="ListingGridObj.variationProductManageHandler.changeVariationTheme(this)">
                        <?php echo $this->hasChannelTheme() ? Mage::helper('M2ePro')->__('Change') : Mage::helper('M2ePro')->__('Set Theme'); ?>
                    </button>&nbsp;&nbsp;
                    <span id="edit_variation_btns" style="display: none;">
                        <img class="tool-tip-image" style="vertical-align: middle;" src="<?php echo $this->getSkinUrl('M2ePro/images/tool-tip-icon.png'); ?>">
                        <span class="tool-tip-message tip-right" style="display: none;">
                            <img src="<?php echo $this->getSkinUrl('M2ePro/images/help.png'); ?>">
                            <span><?php echo Mage::helper('M2ePro')->__('Some Variation Themes cannot be used because number of Attributes in Variation Theme is not equal to number of Magento Product Attributes.'); ?></span>
                        </span>
                        &nbsp;&nbsp;
                        <a href="javascript:void(0);" onclick="ListingGridObj.variationProductManageHandler.cancelVariationTheme(this);"><?php echo Mage::helper('M2ePro')->__('Cancel'); ?></a>&nbsp;&nbsp;
                        <button onclick="ListingGridObj.variationProductManageHandler.setVariationTheme()"><?php echo Mage::helper('M2ePro')->__('Confirm'); ?></button>
                    </span>
                <?php } ?>
            </td>
        </tr>
    </table>

<?php } ?>

        </div>
    </div>
</div>

<?php } ?>

<?php if ($this->hasGeneralId() ||
          (!$this->hasGeneralId() && $this->isGeneralIdOwner() && $this->hasChannelTheme())) {

    $magentoGreaterLeftSideText = Mage::helper('M2ePro')->__('This Amazon Attribute and its Value are virtualized based on the selected Magento Variational Attribute and its Value as physically this Amazon Attribute does not exist.');
    $magentoGreaterRightSideText = Mage::helper('M2ePro')->__('Select a particular Option of the Attribute to fix it for virtualized Amazon Attribute. Please, be thoughtful as only those Variations of Magento Product which contains the selected Option can be sold on Amazon.');

    $amazonGreaterLeftSideText = Mage::helper('M2ePro')->__('This Magento Attribute and its Value are virtualized based on the selected Amazon Variational Attribute and its Value as physically this Magento Attribute does not exist.');
    $amazonGreaterRightSideText = Mage::helper('M2ePro')->__('Select a particular Option of the Attribute to fix it for virtualized Magento Attribute. Please, be thoughtful as your offer will be available only for those Buyers who selected the same Option.');

    $duplicateMagentoAttributesError = Mage::helper('M2ePro')->__('The Magento Attributes which you selected in your settings have the same Labels. Such combination is invalid. Please, add the valid combination of Attributes.');
    $duplicateAmazonAttributesError = Mage::helper('M2ePro')->__('The Amazon Attributes which you selected in your settings have the same Labels. Such combination is invalid. Please, add the valid combination of Attributes.');

    $changeOption = Mage::helper('M2ePro')->__('Change option');
?>

<script type="application/javascript">
    ListingGridObj.variationProductManageHandler.virtualAmazonMatchedAttributes = false;
    ListingGridObj.variationProductManageHandler.amazonVariationSet = false;

    M2ePro.text.help_icon_magento_greater_left = '<?php echo $magentoGreaterLeftSideText ?>';
    M2ePro.text.help_icon_magento_greater_right = '<?php echo $magentoGreaterRightSideText ?>';

    M2ePro.text.help_icon_amazon_greater_left = '<?php echo $amazonGreaterLeftSideText ?>';
    M2ePro.text.help_icon_amazon_greater_right = '<?php echo $amazonGreaterRightSideText ?>';

    M2ePro.text.duplicate_magento_attribute_error = '<?php echo $duplicateMagentoAttributesError ?>';
    M2ePro.text.duplicate_amazon_attribute_error = '<?php echo $duplicateAmazonAttributesError ?>';

    M2ePro.text.change_option = '<?php echo $changeOption ?>';
</script>

<div id="product_search_help_icon_tpl" style="display: none">
    <img class="tool-tip-image" style="vertical-align: middle;" src="<?php echo $this->getSkinUrl('M2ePro/images/tool-tip-icon.png'); ?>">
    <span class="tool-tip-message tip-right" style="display: none;">
        <img src="<?php echo $this->getSkinUrl('M2ePro/images/help.png'); ?>">
        <span class="tool-tip-message-text"></span>
    </span>
</div>

<form id="variation_manager_attributes_form" action="javascript:void(0);">

<div class="entry-edit" id="magento_block_amazon_variation_manager_attributes">
    <div class="entry-edit-head">
        <h4 class="icon-head head-edit-form fieldset-legend"><?php echo Mage::helper('M2ePro')->__('Matching Attributes'); ?></h4>
    </div>
    <div class="fieldset">
        <div class="hor-scroll">
            <div id="block_notice_amazon_product_manage_settings_attributes" class="block_notices_module" title="<?php echo Mage::helper('M2ePro')->__('Matching Attributes'); ?>">
                <?php echo Mage::helper('M2ePro')->__('To sell Magento Variational Product as Amazon Parent-Child Product it is necessary to set correspondence of Magento and Amazon Variation Attributes. Prerequisite to set correspondence is equal number of Magento Product Attributes and Amazon Parent-Child Product Attributes. <br/><br/>

                You can always change this correspondence manually by clicking <i class="underline">"Change"</i> Button. <br/><br/>

                <b>Note:</b> In case correspondence between Amazon and Magento Variation Attributes is not set adding and selling of Amazon Child Products is impossible.'); ?>
            </div>

            <?php if (!$this->hasMatchedAttributes() && !$this->getMatcherAttributes()->isAmountEqual()) { ?>

            <table class="form-list" cellspacing="0" cellpadding="0">
                <thead>
                    <tr>
                        <td class="label" style="font-weight: bold; border-bottom: 1px solid #D6D6D6 !important; border-right: 1px solid #D6D6D6 !important;">
                            <?php echo Mage::helper('M2ePro')->__('Magento Attributes') ?>
                        </td>
                        <td class="value" style="font-weight: bold; border-bottom: 1px solid #D6D6D6 !important;">
                            <?php echo Mage::helper('M2ePro')->__('Amazon Attributes') ?>
                        </td>
                    </tr>
                </thead>
                <tbody></tbody>
                <tfoot></tfoot>
            </table>

                <?php if ($this->getMatcherAttributes()->isSourceAmountGreater()) { ?>

            <script type="application/javascript">
                ListingGridObj.variationProductManageHandler.matchingType = ListingGridObj.variationProductManageHandler.MATCHING_TYPE_VIRTUAL_AMAZON;
                ListingGridObj.variationProductManageHandler.matchedAttributes = <?php echo json_encode($this->getMatchedAttributes(), JSON_FORCE_OBJECT)?>;
                ListingGridObj.variationProductManageHandler.productAttributes = <?php echo json_encode($this->getProductAttributes())?>;
                ListingGridObj.variationProductManageHandler.destinationAttributes = <?php echo json_encode($this->getDestinationAttributes())?>;
                ListingGridObj.variationProductManageHandler.magentoVariationSet = <?php echo json_encode($magentoProductVariations['set'])?>;

                ListingGridObj.variationProductManageHandler.renderMatchedAttributesNotSetView();
            </script>

                <?php } elseif ($this->getMatcherAttributes()->isDestinationAmountGreater()) {?>

            <script type="application/javascript">
                ListingGridObj.variationProductManageHandler.matchingType = ListingGridObj.variationProductManageHandler.MATCHING_TYPE_VIRTUAL_MAGENTO;
                ListingGridObj.variationProductManageHandler.matchedAttributes = <?php echo json_encode($this->getMatchedAttributes(), JSON_FORCE_OBJECT)?>;
                ListingGridObj.variationProductManageHandler.destinationAttributes = <?php echo json_encode($this->getDestinationAttributes())?>;
                ListingGridObj.variationProductManageHandler.amazonVariationSet = <?php echo json_encode($this->getAmazonVariationsSet())?>;

                ListingGridObj.variationProductManageHandler.renderMatchedAttributesNotSetView();
            </script>

                <?php } ?>
            <?php } else { ?>

                <table class="form-list" cellspacing="0" cellpadding="0">
                    <tr>
                        <td class="label" style="font-weight: bold; border-bottom: 1px solid #D6D6D6 !important; border-right: 1px solid #D6D6D6 !important;">
                            <?php echo Mage::helper('M2ePro')->__('Magento Attributes') ?>
                        </td>
                        <td class="value" style="font-weight: bold; border-bottom: 1px solid #D6D6D6 !important;">
                            <?php echo Mage::helper('M2ePro')->__('Amazon Attributes') ?>
                        </td>
                    </tr>

                    <?php
                        $attrId = 0;
                        $virtualAttributes = $this->getVirtualAttributes();
                        $virtualProductAttributes = $this->getVirtualProductAttributes();
                        $virtualChannelAttributes = $this->getVirtualChannelAttributes();

                        foreach ($this->getMatchedAttributes() as $magentoAttr => $amazonAttr) {

                            $isVirtual = ($magentoAttr == $amazonAttr) && in_array($magentoAttr, array_keys($virtualAttributes));
                    ?>
                        <tr>
                            <td class="label" style="border-right: 1px solid #D6D6D6 !important;">
                                <?php if (!$isVirtual) { ?>

                                <label for="variation_manager_attributes_amazon_<?php echo $attrId ?>">
                                    <?php echo $magentoAttr ?>
                                </label>

                                <?php } else { ?>

                                <label for="variation_manager_attributes_amazon_<?php echo $attrId ?>">
                                    <span style="<?php echo in_array($magentoAttr, array_keys($virtualProductAttributes)) ? 'border-bottom: 2px dotted grey;' : '' ?>">
                                        <?php echo $magentoAttr ?> (<?php echo $virtualAttributes[$magentoAttr] ?>)
                                    </span>
                                </label>

                                <?php } ?>
                            </td>
                            <td class="value">
                                <input type="hidden" value="<?php echo Mage::helper('M2ePro')->escapeHtml($magentoAttr) ?>" name="variation_attributes[magento_attributes][]">

                                <?php if (!$isVirtual) { ?>

                                <span class="variation_manager_attributes_amazon_value" <?php echo $this->hasMatchedAttributes() ? '' : 'style="color: red;"' ?>>
                                    <?php echo $this->hasMatchedAttributes() ? $amazonAttr : Mage::helper('M2ePro')->__('Not Set') ?>
                                </span>

                                <select id="variation_manager_attributes_amazon_<?php echo $attrId ?>"
                                        name="variation_attributes[amazon_attributes][]"
                                        class="required-entry variation_manager_attributes_amazon_select"
                                        style="display: none;">
                                    <?php
                                        $destinationAttributes = $this->getDestinationAttributes();

                                        if (empty($amazonAttr)) {
                                            echo '<option class="empty" value=""></option>';
                                        }
                                    ?>
                                    <?php foreach ($destinationAttributes as $attr) { ?>
                                        <?php
                                            if (in_array($attr, array_keys($virtualAttributes))) {
                                                continue;
                                            }
                                        ?>
                                        <option value="<?php echo $attr; ?>" <?php echo $amazonAttr == $attr ? 'selected="selected"' : '' ?> ><?php echo $attr; ?></option>
                                    <?php } ?>
                                </select>

                                <?php } else { ?>

                                    <span style="<?php echo in_array($amazonAttr, array_keys($virtualChannelAttributes)) ? 'border-bottom: 2px dotted grey;' : '' ?>"><?php echo $amazonAttr ?> (<?php echo $virtualAttributes[$amazonAttr] ?>)</span>
                                    <input type="hidden" name="variation_attributes[amazon_attributes][]" value="<?php echo $amazonAttr ?>" />

                                <?php } ?>
                                <div id="variation_manager_attributes_error_<?php echo $attrId ?>" class="validation-advice" style="display: none;"></div>
                            </td>
                        </tr>

                    <?php
                            $attrId++;
                        }
                    ?>

                    <tr>
                        <td class="label" colspan="2" style="text-align: right; <?php echo $this->isChangeMatchedAttributesAllowed() ? '' : 'display: none;' ?>">
                            <button onclick="ListingGridObj.variationProductManageHandler.changeMatchedAttributes(this)">
                                <?php echo $this->hasMatchedAttributes() ? Mage::helper('M2ePro')->__('Change') : Mage::helper('M2ePro')->__('Set Attributes'); ?>
                            </button>
                            <a href="javascript:void(0);" onclick="ListingGridObj.variationProductManageHandler.cancelMatchedAttributes(this);" style="display: none;"><?php echo Mage::helper('M2ePro')->__('Cancel'); ?></a>&nbsp;&nbsp;
                            <button onclick="ListingGridObj.variationProductManageHandler.setMatchedAttributes()" style="display: none;"><?php echo Mage::helper('M2ePro')->__('Confirm'); ?></button>
                        </td>
                    </tr>
                </table>
            <?php } ?>
        </div>
    </div>
</div>

</form>

<?php } ?>

<?php if ($this->hasGeneralId() && $this->hasMatchedAttributes()) { ?>

<div class="entry-edit" id="magento_block_amazon_variation_manager_options">
    <div class="entry-edit-head">
        <h4 class="icon-head head-edit-form fieldset-legend"><?php echo Mage::helper('M2ePro')->__('Child Products'); ?></h4>
    </div>
    <div class="fieldset">
        <div class="hor-scroll">

            <div id="block_notice_amazon_product_manage_settings_options" class="block_notices_module" title="<?php echo Mage::helper('M2ePro')->__('Child Products'); ?>">
                <?php echo Mage::helper('M2ePro')->__(
                    'In case of successful Setting of correspondence between Variation Attributes of Magento Product and Variation Attributes of Amazon Product you can work with Amazon Child Products. <br/><br/>

                    To add Child Product to your Amazon Inventory means to set correspondence between available Magento Product Variation and Amazon Parent Product Variation. To do that it is necessary to click <i class="underline">"Add New Child Product"</i> Button on the Child Products Tab. <br/><br/>

                    In case you are the Creator of this Product, you can create New Amazon Child Products for unused Magento Product Variations.',
                    implode(', ', $this->getProductAttributes()), implode(', ', $this->getDestinationAttributes())
                ); ?>
            </div>

<?php if (!$this->hasUnusedProductVariation()) { ?>

    <p><?php echo Mage::helper('M2ePro')->__('All the possible Variations of Magento Product are being sold.')?></p>

<?php } elseif ($this->hasChildWithEmptyProductOptions()) { ?>

    <p><?php echo Mage::helper('M2ePro')->__('There is Amazon Child Product, you are selling, for which Magento Variation was not set for some reasons. <br/><br/>

    Adding or changing other Amazon Child Products is suspended.  <br/><br/>

    To continue full work with all your Amazon Child Products you should specify Magento Product Variation for that Amazon Child Product on Child Products Tab.')?></p>

<?php } elseif (!$this->isGeneralIdOwner() && !$this->hasUnusedChannelVariations()) { ?>

    <p><?php echo Mage::helper('M2ePro')->__('All the possible Variations of Amazon Product are being sold.')?></p>

<?php } elseif (!$this->isGeneralIdOwner() && $this->hasChildWithEmptyChannelOptions()) {?>

    <p><?php echo Mage::helper('M2ePro')->__('There is Amazon Child Product, you are selling, for which Amazon Variation was not set for some reasons. <br/><br/>

    Adding or changing other Amazon Child Products is suspended. <br/><br/>

    To continue full work with all your Amazon Child Products you should specify Amazon Product Variation for that Amazon Child Product on Child Products Tab.')?></p>

<?php } else { ?>

    <?php echo Mage::helper('M2ePro')->__('To sell existing Amazon Child Products or to add New Child Products (if you are the Creator) click <a href="%url%" onclick="%onclick%">"Add New Child Product"</a> Button on Child Products Tab.', array('url' => 'javascript:void(0);', 'onclick' => 'ListingGridObj.variationProductManageHandler.openVariationsTab('.(int)!$this->hasUnusedChannelVariations().');')); ?>

<?php } ?>

        </div>
    </div>
</div>

<?php } ?>

</div>
