コード例 #1
0
ファイル: fn.promotions.php プロジェクト: askzap/ultimate
/**
 * Get promotion data
 *
 * @param int $promotion_id promotion ID
 * @param string $lang_code code language
 * @return array promotion data
 */
function fn_get_promotion_data($promotion_id, $lang_code = DESCR_SL)
{
    $extra_condition = '';
    if (fn_allowed_for('ULTIMATE:FREE')) {
        $extra_condition = Database::quote(' AND p.zone = ?s', 'catalog');
    }
    $promotion_data = db_get_row("SELECT * FROM ?:promotions as p LEFT JOIN ?:promotion_descriptions as d ON p.promotion_id = d.promotion_id AND d.lang_code = ?s WHERE p.promotion_id = ?i ?p", $lang_code, $promotion_id, $extra_condition);
    if (!empty($promotion_data)) {
        $promotion_data['conditions'] = !empty($promotion_data['conditions']) ? unserialize($promotion_data['conditions']) : array();
        $promotion_data['bonuses'] = !empty($promotion_data['bonuses']) ? unserialize($promotion_data['bonuses']) : array();
        if (!empty($promotion_data['conditions']['conditions'])) {
            foreach ($promotion_data['conditions']['conditions'] as $key => $condition) {
                if (!empty($condition['condition']) && $condition['condition'] == 'feature') {
                    $condition['value_name'] = fn_get_product_feature_variant($condition['value']);
                    $promotion_data['conditions']['conditions'][$key]['value_name'] = $condition['value_name']['variant'];
                }
            }
        }
    }
    return $promotion_data;
}
    function content_55e61f9b555597_02885983($_smarty_tpl)
    {
        if (!is_callable('smarty_modifier_enum')) {
            include '/var/www/html/market/app/functions/smarty_plugins/modifier.enum.php';
        }
        fn_preload_lang_vars(array('none', 'enter_other', 'none', 'enter_other', 'enter_other', 'enter_other'));
        $_smarty_tpl->tpl_vars['feature'] = new Smarty_Variable();
        $_smarty_tpl->tpl_vars['feature']->_loop = false;
        $_smarty_tpl->tpl_vars["feature_id"] = new Smarty_Variable();
        $_from = $_smarty_tpl->tpl_vars['product_features']->value;
        if (!is_array($_from) && !is_object($_from)) {
            settype($_from, 'array');
        }
        foreach ($_from as $_smarty_tpl->tpl_vars['feature']->key => $_smarty_tpl->tpl_vars['feature']->value) {
            $_smarty_tpl->tpl_vars['feature']->_loop = true;
            $_smarty_tpl->tpl_vars["feature_id"]->value = $_smarty_tpl->tpl_vars['feature']->key;
            ?>
    <?php 
            $_smarty_tpl->tpl_vars['allow_enter_variant'] = new Smarty_variable(fn_allow_save_object($_smarty_tpl->tpl_vars['feature']->value, "product_features"), null, 0);
            ?>
    <?php 
            if ($_smarty_tpl->tpl_vars['feature']->value['feature_type'] != smarty_modifier_enum("ProductFeatures::GROUP")) {
                ?>
        <div class="control-group">
            <label class="control-label" for="feature_<?php 
                echo htmlspecialchars($_smarty_tpl->tpl_vars['feature_id']->value, ENT_QUOTES, 'UTF-8');
                ?>
"><?php 
                echo htmlspecialchars($_smarty_tpl->tpl_vars['feature']->value['description'], ENT_QUOTES, 'UTF-8');
                ?>
</label>
            <div class="controls">
            <?php 
                if ($_smarty_tpl->tpl_vars['feature']->value['prefix']) {
                    ?>
<span><?php 
                    echo htmlspecialchars($_smarty_tpl->tpl_vars['feature']->value['prefix'], ENT_QUOTES, 'UTF-8');
                    ?>
</span><?php 
                }
                ?>
            <?php 
                if ($_smarty_tpl->tpl_vars['feature']->value['feature_type'] == smarty_modifier_enum("ProductFeatures::TEXT_SELECTBOX") || $_smarty_tpl->tpl_vars['feature']->value['feature_type'] == smarty_modifier_enum("ProductFeatures::NUMBER_SELECTBOX") || $_smarty_tpl->tpl_vars['feature']->value['feature_type'] == smarty_modifier_enum("ProductFeatures::EXTENDED")) {
                    ?>
                <?php 
                    $_smarty_tpl->tpl_vars["value_selected"] = new Smarty_variable(false, null, 0);
                    ?>

                <?php 
                    if ($_smarty_tpl->tpl_vars['feature']->value['use_variant_picker']) {
                        ?>
                    <input type="hidden" name="product_data[product_features][<?php 
                        echo htmlspecialchars($_smarty_tpl->tpl_vars['feature_id']->value, ENT_QUOTES, 'UTF-8');
                        ?>
]" id="feature_<?php 
                        echo htmlspecialchars($_smarty_tpl->tpl_vars['feature_id']->value, ENT_QUOTES, 'UTF-8');
                        ?>
" value="<?php 
                        echo htmlspecialchars(($tmp = @$_smarty_tpl->tpl_vars['selected']->value) === null || $tmp === '' ? $_smarty_tpl->tpl_vars['feature']->value['variant_id'] : $tmp, ENT_QUOTES, 'UTF-8');
                        ?>
" />
                    <?php 
                        if ($_smarty_tpl->tpl_vars['feature']->value['variants'][$_smarty_tpl->tpl_vars['feature']->value['variant_id']]['variant']) {
                            ?>
                        <?php 
                            $_smarty_tpl->tpl_vars["selected_variant"] = new Smarty_variable($_smarty_tpl->tpl_vars['feature']->value['variants'][$_smarty_tpl->tpl_vars['feature']->value['variant_id']]['variant'], null, 0);
                            ?>
                    <?php 
                        } elseif ($_smarty_tpl->tpl_vars['feature']->value['variant_id']) {
                            ?>
                        <?php 
                            $_smarty_tpl->tpl_vars["selected_variant"] = new Smarty_variable(fn_get_product_feature_variant($_smarty_tpl->tpl_vars['feature']->value['variant_id']), null, 0);
                            ?>
                        <?php 
                            $_smarty_tpl->tpl_vars["selected_variant"] = new Smarty_variable($_smarty_tpl->tpl_vars['selected_variant']->value['variant'], null, 0);
                            ?>
                    <?php 
                        } else {
                            ?>
                        <?php 
                            $_smarty_tpl->tpl_vars["selected_variant"] = new Smarty_variable($_smarty_tpl->__("none"), null, 0);
                            ?>
                    <?php 
                        }
                        ?>
                    <?php 
                        echo $_smarty_tpl->getSubTemplate("common/ajax_select_object.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('data_url' => "product_features.get_feature_variants_list?feature_id=" . (string) $_smarty_tpl->tpl_vars['feature_id']->value, 'text' => $_smarty_tpl->tpl_vars['selected_variant']->value, 'result_elm' => "feature_" . (string) $_smarty_tpl->tpl_vars['feature_id']->value, 'id' => (string) $_smarty_tpl->tpl_vars['feature_id']->value . "_selector", 'js_action' => "Tygh." . "\$" . "('#input_" . (string) $_smarty_tpl->tpl_vars['feature_id']->value . "').toggleBy((Tygh." . "\$" . "('#feature_" . (string) $_smarty_tpl->tpl_vars['feature_id']->value . "').val() != 'disable_select'));"), 0);
                        ?>

                    <input type="text" class="hidden-input<?php 
                        if ($_smarty_tpl->tpl_vars['feature']->value['feature_type'] == smarty_modifier_enum("ProductFeatures::NUMBER_SELECTBOX")) {
                            ?>
 cm-value-decimal<?php 
                        }
                        ?>
" name="product_data[add_new_variant][<?php 
                        echo htmlspecialchars($_smarty_tpl->tpl_vars['feature']->value['feature_id'], ENT_QUOTES, 'UTF-8');
                        ?>
][variant]" id="input_<?php 
                        echo htmlspecialchars($_smarty_tpl->tpl_vars['feature_id']->value, ENT_QUOTES, 'UTF-8');
                        ?>
" placeholder="<?php 
                        echo $_smarty_tpl->__("enter_other");
                        ?>
" />
                <?php 
                    } else {
                        ?>
                    <select name="product_data[product_features][<?php 
                        echo htmlspecialchars($_smarty_tpl->tpl_vars['feature_id']->value, ENT_QUOTES, 'UTF-8');
                        ?>
]" id="feature_<?php 
                        echo htmlspecialchars($_smarty_tpl->tpl_vars['feature_id']->value, ENT_QUOTES, 'UTF-8');
                        ?>
" onchange="Tygh.$('#input_<?php 
                        echo htmlspecialchars($_smarty_tpl->tpl_vars['feature_id']->value, ENT_QUOTES, 'UTF-8');
                        ?>
').toggleBy((this.value != 'disable_select'));">
                        <option value="">-<?php 
                        echo $_smarty_tpl->__("none");
                        ?>
-</option>
                        <?php 
                        $_smarty_tpl->tpl_vars["var"] = new Smarty_Variable();
                        $_smarty_tpl->tpl_vars["var"]->_loop = false;
                        $_from = $_smarty_tpl->tpl_vars['feature']->value['variants'];
                        if (!is_array($_from) && !is_object($_from)) {
                            settype($_from, 'array');
                        }
                        foreach ($_from as $_smarty_tpl->tpl_vars["var"]->key => $_smarty_tpl->tpl_vars["var"]->value) {
                            $_smarty_tpl->tpl_vars["var"]->_loop = true;
                            ?>
                        <option value="<?php 
                            echo htmlspecialchars($_smarty_tpl->tpl_vars['var']->value['variant_id'], ENT_QUOTES, 'UTF-8');
                            ?>
" <?php 
                            if ($_smarty_tpl->tpl_vars['var']->value['variant_id'] == $_smarty_tpl->tpl_vars['feature']->value['variant_id']) {
                                $_smarty_tpl->tpl_vars["value_selected"] = new Smarty_variable(true, null, 0);
                                ?>
selected="selected"<?php 
                            }
                            ?>
><?php 
                            echo htmlspecialchars($_smarty_tpl->tpl_vars['var']->value['variant'], ENT_QUOTES, 'UTF-8');
                            ?>
</option>
                        <?php 
                        }
                        ?>
                        <?php 
                        if ($_smarty_tpl->tpl_vars['allow_enter_variant']->value) {
                            ?>
                        <option value="disable_select">-<?php 
                            echo $_smarty_tpl->__("enter_other");
                            ?>
-</option>
                        <?php 
                        }
                        ?>
                    </select>
                    <input type="text" class="hidden-input<?php 
                        if ($_smarty_tpl->tpl_vars['feature']->value['feature_type'] == smarty_modifier_enum("ProductFeatures::NUMBER_SELECTBOX")) {
                            ?>
 cm-value-decimal<?php 
                        }
                        ?>
" name="product_data[add_new_variant][<?php 
                        echo htmlspecialchars($_smarty_tpl->tpl_vars['feature']->value['feature_id'], ENT_QUOTES, 'UTF-8');
                        ?>
][variant]" id="input_<?php 
                        echo htmlspecialchars($_smarty_tpl->tpl_vars['feature_id']->value, ENT_QUOTES, 'UTF-8');
                        ?>
" placeholder="<?php 
                        echo $_smarty_tpl->__("enter_other");
                        ?>
" />
                <?php 
                    }
                    ?>

            <?php 
                } elseif ($_smarty_tpl->tpl_vars['feature']->value['feature_type'] == smarty_modifier_enum("ProductFeatures::MULTIPLE_CHECKBOX")) {
                    ?>
                <input type="hidden" name="product_data[product_features][<?php 
                    echo htmlspecialchars($_smarty_tpl->tpl_vars['feature_id']->value, ENT_QUOTES, 'UTF-8');
                    ?>
]" value="" />
                <?php 
                    $_smarty_tpl->tpl_vars["var"] = new Smarty_Variable();
                    $_smarty_tpl->tpl_vars["var"]->_loop = false;
                    $_from = $_smarty_tpl->tpl_vars['feature']->value['variants'];
                    if (!is_array($_from) && !is_object($_from)) {
                        settype($_from, 'array');
                    }
                    foreach ($_from as $_smarty_tpl->tpl_vars["var"]->key => $_smarty_tpl->tpl_vars["var"]->value) {
                        $_smarty_tpl->tpl_vars["var"]->_loop = true;
                        ?>
                    <label for="variant_<?php 
                        echo htmlspecialchars($_smarty_tpl->tpl_vars['var']->value['variant_id'], ENT_QUOTES, 'UTF-8');
                        ?>
" class="checkbox"><input type="checkbox" id="variant_<?php 
                        echo htmlspecialchars($_smarty_tpl->tpl_vars['var']->value['variant_id'], ENT_QUOTES, 'UTF-8');
                        ?>
" name="product_data[product_features][<?php 
                        echo htmlspecialchars($_smarty_tpl->tpl_vars['feature_id']->value, ENT_QUOTES, 'UTF-8');
                        ?>
][<?php 
                        echo htmlspecialchars($_smarty_tpl->tpl_vars['var']->value['variant_id'], ENT_QUOTES, 'UTF-8');
                        ?>
]" <?php 
                        if ($_smarty_tpl->tpl_vars['var']->value['selected']) {
                            ?>
checked="checked"<?php 
                        }
                        ?>
 value="<?php 
                        echo htmlspecialchars($_smarty_tpl->tpl_vars['var']->value['variant_id'], ENT_QUOTES, 'UTF-8');
                        ?>
" /><?php 
                        echo htmlspecialchars($_smarty_tpl->tpl_vars['var']->value['variant'], ENT_QUOTES, 'UTF-8');
                        ?>
</label>
                <?php 
                    }
                    ?>
                <?php 
                    if ($_smarty_tpl->tpl_vars['allow_enter_variant']->value) {
                        ?>
                <input type="text" name="product_data[add_new_variant][<?php 
                        echo htmlspecialchars($_smarty_tpl->tpl_vars['feature']->value['feature_id'], ENT_QUOTES, 'UTF-8');
                        ?>
][variant]" id="feature_<?php 
                        echo htmlspecialchars($_smarty_tpl->tpl_vars['feature_id']->value, ENT_QUOTES, 'UTF-8');
                        ?>
" placeholder="<?php 
                        echo $_smarty_tpl->__("enter_other");
                        ?>
" />
                <?php 
                    }
                    ?>
            <?php 
                } elseif ($_smarty_tpl->tpl_vars['feature']->value['feature_type'] == smarty_modifier_enum("ProductFeatures::SINGLE_CHECKBOX")) {
                    ?>
                <label class="checkbox">
                <input type="hidden" name="product_data[product_features][<?php 
                    echo htmlspecialchars($_smarty_tpl->tpl_vars['feature_id']->value, ENT_QUOTES, 'UTF-8');
                    ?>
]" value="N" />
                <input type="checkbox" name="product_data[product_features][<?php 
                    echo htmlspecialchars($_smarty_tpl->tpl_vars['feature_id']->value, ENT_QUOTES, 'UTF-8');
                    ?>
]" value="Y" id="feature_<?php 
                    echo htmlspecialchars($_smarty_tpl->tpl_vars['feature_id']->value, ENT_QUOTES, 'UTF-8');
                    ?>
" <?php 
                    if ($_smarty_tpl->tpl_vars['feature']->value['value'] == "Y") {
                        ?>
checked="checked"<?php 
                    }
                    ?>
 /></label>
            <?php 
                } elseif ($_smarty_tpl->tpl_vars['feature']->value['feature_type'] == smarty_modifier_enum("ProductFeatures::DATE")) {
                    ?>
                <?php 
                    echo $_smarty_tpl->getSubTemplate("common/calendar.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('date_id' => "date_" . (string) $_smarty_tpl->tpl_vars['feature_id']->value, 'date_name' => "product_data[product_features][" . (string) $_smarty_tpl->tpl_vars['feature_id']->value . "]", 'date_val' => ($tmp = @$_smarty_tpl->tpl_vars['feature']->value['value_int']) === null || $tmp === '' ? '' : $tmp, 'start_year' => $_smarty_tpl->tpl_vars['settings']->value['Company']['company_start_year']), 0);
                    ?>

            <?php 
                } else {
                    ?>
                <input type="text" name="product_data[product_features][<?php 
                    echo htmlspecialchars($_smarty_tpl->tpl_vars['feature_id']->value, ENT_QUOTES, 'UTF-8');
                    ?>
]" value="<?php 
                    if ($_smarty_tpl->tpl_vars['feature']->value['feature_type'] == smarty_modifier_enum("ProductFeatures::NUMBER_FIELD")) {
                        if ($_smarty_tpl->tpl_vars['feature']->value['value_int'] != '') {
                            echo htmlspecialchars(floatval($_smarty_tpl->tpl_vars['feature']->value['value_int']), ENT_QUOTES, 'UTF-8');
                        }
                    } else {
                        echo htmlspecialchars($_smarty_tpl->tpl_vars['feature']->value['value'], ENT_QUOTES, 'UTF-8');
                    }
                    ?>
" id="feature_<?php 
                    echo htmlspecialchars($_smarty_tpl->tpl_vars['feature_id']->value, ENT_QUOTES, 'UTF-8');
                    ?>
" class="<?php 
                    if ($_smarty_tpl->tpl_vars['feature']->value['feature_type'] == smarty_modifier_enum("ProductFeatures::NUMBER_FIELD")) {
                        ?>
 cm-value-decimal<?php 
                    }
                    ?>
" />
            <?php 
                }
                ?>
            <?php 
                if ($_smarty_tpl->tpl_vars['feature']->value['suffix']) {
                    ?>
<span><?php 
                    echo htmlspecialchars($_smarty_tpl->tpl_vars['feature']->value['suffix'], ENT_QUOTES, 'UTF-8');
                    ?>
</span><?php 
                }
                ?>
            </div>
        </div>
    <?php 
            }
        }
        ?>

<?php 
        $_smarty_tpl->tpl_vars['feature'] = new Smarty_Variable();
        $_smarty_tpl->tpl_vars['feature']->_loop = false;
        $_smarty_tpl->tpl_vars["feature_id"] = new Smarty_Variable();
        $_from = $_smarty_tpl->tpl_vars['product_features']->value;
        if (!is_array($_from) && !is_object($_from)) {
            settype($_from, 'array');
        }
        foreach ($_from as $_smarty_tpl->tpl_vars['feature']->key => $_smarty_tpl->tpl_vars['feature']->value) {
            $_smarty_tpl->tpl_vars['feature']->_loop = true;
            $_smarty_tpl->tpl_vars["feature_id"]->value = $_smarty_tpl->tpl_vars['feature']->key;
            ?>
    <?php 
            if ($_smarty_tpl->tpl_vars['feature']->value['feature_type'] == smarty_modifier_enum("ProductFeatures::GROUP") && $_smarty_tpl->tpl_vars['feature']->value['subfeatures']) {
                ?>
        <?php 
                echo $_smarty_tpl->getSubTemplate("common/subheader.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('title' => $_smarty_tpl->tpl_vars['feature']->value['description']), 0);
                ?>

        <?php 
                echo $_smarty_tpl->getSubTemplate("views/products/components/product_assign_features.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('product_features' => $_smarty_tpl->tpl_vars['feature']->value['subfeatures']), 0);
                ?>

    <?php 
            }
        }
    }
    function content_55ccecdc135ce6_43835279($_smarty_tpl)
    {
        fn_preload_lang_vars(array('none', 'enter_other', 'none', 'enter_other', 'enter_other', 'enter_other', 'details', 'image'));
        ?>

    <script type="text/javascript">
        function show_product_variant_details(myId){
            $('tr#variant_details_'+myId).toggle();
        }
        function show_variant_details(myId){
            $('td#link_variant_details_'+myId).toggle();
        }
    </script>

<?php 
        $_smarty_tpl->tpl_vars['feature'] = new Smarty_Variable();
        $_smarty_tpl->tpl_vars['feature']->_loop = false;
        $_smarty_tpl->tpl_vars["feature_id"] = new Smarty_Variable();
        $_from = $_smarty_tpl->tpl_vars['product_features']->value;
        if (!is_array($_from) && !is_object($_from)) {
            settype($_from, 'array');
        }
        foreach ($_from as $_smarty_tpl->tpl_vars['feature']->key => $_smarty_tpl->tpl_vars['feature']->value) {
            $_smarty_tpl->tpl_vars['feature']->_loop = true;
            $_smarty_tpl->tpl_vars["feature_id"]->value = $_smarty_tpl->tpl_vars['feature']->key;
            ?>
    <?php 
            $_smarty_tpl->tpl_vars['allow_enter_variant'] = new Smarty_variable(fn_allow_save_object($_smarty_tpl->tpl_vars['feature']->value, "product_features"), null, 0);
            ?>
    <?php 
            if ($_smarty_tpl->tpl_vars['feature']->value['feature_type'] != "G") {
                ?>
        <div class="control-group">
            <label class="control-label" for="feature_<?php 
                echo htmlspecialchars($_smarty_tpl->tpl_vars['feature_id']->value, ENT_QUOTES, 'UTF-8');
                ?>
"><?php 
                echo htmlspecialchars($_smarty_tpl->tpl_vars['feature']->value['description'], ENT_QUOTES, 'UTF-8');
                ?>
</label>
            <div class="controls">
            <?php 
                if ($_smarty_tpl->tpl_vars['feature']->value['prefix']) {
                    ?>
<span><?php 
                    echo htmlspecialchars($_smarty_tpl->tpl_vars['feature']->value['prefix'], ENT_QUOTES, 'UTF-8');
                    ?>
</span><?php 
                }
                ?>
            <?php 
                if ($_smarty_tpl->tpl_vars['feature']->value['feature_type'] == "S" || $_smarty_tpl->tpl_vars['feature']->value['feature_type'] == "N" || $_smarty_tpl->tpl_vars['feature']->value['feature_type'] == "E") {
                    ?>
                <?php 
                    $_smarty_tpl->tpl_vars["value_selected"] = new Smarty_variable(false, null, 0);
                    ?>

                <?php 
                    if ($_smarty_tpl->tpl_vars['feature']->value['use_variant_picker']) {
                        ?>
                    <input type="hidden" name="product_data[product_features][<?php 
                        echo htmlspecialchars($_smarty_tpl->tpl_vars['feature_id']->value, ENT_QUOTES, 'UTF-8');
                        ?>
]" id="feature_<?php 
                        echo htmlspecialchars($_smarty_tpl->tpl_vars['feature_id']->value, ENT_QUOTES, 'UTF-8');
                        ?>
" value="<?php 
                        echo htmlspecialchars(($tmp = @$_smarty_tpl->tpl_vars['selected']->value) === null || $tmp === '' ? $_smarty_tpl->tpl_vars['feature']->value['variant_id'] : $tmp, ENT_QUOTES, 'UTF-8');
                        ?>
" />
                    <?php 
                        if ($_smarty_tpl->tpl_vars['feature']->value['variants'][$_smarty_tpl->tpl_vars['feature']->value['variant_id']]['variant']) {
                            ?>
                        <?php 
                            $_smarty_tpl->tpl_vars["selected_variant"] = new Smarty_variable($_smarty_tpl->tpl_vars['feature']->value['variants'][$_smarty_tpl->tpl_vars['feature']->value['variant_id']]['variant'], null, 0);
                            ?>
                    <?php 
                        } elseif ($_smarty_tpl->tpl_vars['feature']->value['variant_id']) {
                            ?>
                        <?php 
                            $_smarty_tpl->tpl_vars["selected_variant"] = new Smarty_variable(fn_get_product_feature_variant($_smarty_tpl->tpl_vars['feature']->value['variant_id']), null, 0);
                            ?>
                        <?php 
                            $_smarty_tpl->tpl_vars["selected_variant"] = new Smarty_variable($_smarty_tpl->tpl_vars['selected_variant']->value['variant'], null, 0);
                            ?>
                    <?php 
                        } else {
                            ?>
                        <?php 
                            $_smarty_tpl->tpl_vars["selected_variant"] = new Smarty_variable($_smarty_tpl->__("none"), null, 0);
                            ?>
                    <?php 
                        }
                        ?>
                    <?php 
                        echo $_smarty_tpl->getSubTemplate("common/ajax_select_object.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('data_url' => "product_features.get_feature_variants_list?feature_id=" . (string) $_smarty_tpl->tpl_vars['feature_id']->value, 'text' => $_smarty_tpl->tpl_vars['selected_variant']->value, 'result_elm' => "feature_" . (string) $_smarty_tpl->tpl_vars['feature_id']->value, 'id' => (string) $_smarty_tpl->tpl_vars['feature_id']->value . "_selector", 'js_action' => "Tygh." . "\$" . "('#input_" . (string) $_smarty_tpl->tpl_vars['feature_id']->value . "').toggleBy((Tygh." . "\$" . "('#feature_" . (string) $_smarty_tpl->tpl_vars['feature_id']->value . "').val() != 'disable_select'));"), 0);
                        ?>

                    <input type="text" class="hidden-input<?php 
                        if ($_smarty_tpl->tpl_vars['feature']->value['feature_type'] == "N") {
                            ?>
 cm-value-decimal<?php 
                        }
                        ?>
" name="product_data[add_new_variant][<?php 
                        echo htmlspecialchars($_smarty_tpl->tpl_vars['feature']->value['feature_id'], ENT_QUOTES, 'UTF-8');
                        ?>
][variant]" id="input_<?php 
                        echo htmlspecialchars($_smarty_tpl->tpl_vars['feature_id']->value, ENT_QUOTES, 'UTF-8');
                        ?>
" placeholder="<?php 
                        echo $_smarty_tpl->__("enter_other");
                        ?>
" />                    
                <?php 
                    } else {
                        ?>
                    <select name="product_data[product_features][<?php 
                        echo htmlspecialchars($_smarty_tpl->tpl_vars['feature_id']->value, ENT_QUOTES, 'UTF-8');
                        ?>
]" id="feature_<?php 
                        echo htmlspecialchars($_smarty_tpl->tpl_vars['feature_id']->value, ENT_QUOTES, 'UTF-8');
                        ?>
" onchange="Tygh.$('#input_<?php 
                        echo htmlspecialchars($_smarty_tpl->tpl_vars['feature_id']->value, ENT_QUOTES, 'UTF-8');
                        ?>
').toggleBy((this.value != 'disable_select'));">
                        <option value="">-<?php 
                        echo $_smarty_tpl->__("none");
                        ?>
-</option>
                        <?php 
                        $_smarty_tpl->tpl_vars["var"] = new Smarty_Variable();
                        $_smarty_tpl->tpl_vars["var"]->_loop = false;
                        $_from = $_smarty_tpl->tpl_vars['feature']->value['variants'];
                        if (!is_array($_from) && !is_object($_from)) {
                            settype($_from, 'array');
                        }
                        foreach ($_from as $_smarty_tpl->tpl_vars["var"]->key => $_smarty_tpl->tpl_vars["var"]->value) {
                            $_smarty_tpl->tpl_vars["var"]->_loop = true;
                            ?>
                        <option value="<?php 
                            echo htmlspecialchars($_smarty_tpl->tpl_vars['var']->value['variant_id'], ENT_QUOTES, 'UTF-8');
                            ?>
" <?php 
                            if ($_smarty_tpl->tpl_vars['var']->value['variant_id'] == $_smarty_tpl->tpl_vars['feature']->value['variant_id']) {
                                $_smarty_tpl->tpl_vars["value_selected"] = new Smarty_variable(true, null, 0);
                                ?>
selected="selected"<?php 
                            }
                            ?>
><?php 
                            echo htmlspecialchars($_smarty_tpl->tpl_vars['var']->value['variant'], ENT_QUOTES, 'UTF-8');
                            ?>
</option>
                        <?php 
                        }
                        ?>
                        <?php 
                        if ($_smarty_tpl->tpl_vars['allow_enter_variant']->value) {
                            ?>
                        <option value="disable_select">-<?php 
                            echo $_smarty_tpl->__("enter_other");
                            ?>
-</option>
                        <?php 
                        }
                        ?>
                    </select>
                    <input type="text" class="hidden-input<?php 
                        if ($_smarty_tpl->tpl_vars['feature']->value['feature_type'] == "N") {
                            ?>
 cm-value-decimal<?php 
                        }
                        ?>
" name="product_data[add_new_variant][<?php 
                        echo htmlspecialchars($_smarty_tpl->tpl_vars['feature']->value['feature_id'], ENT_QUOTES, 'UTF-8');
                        ?>
][variant]" id="input_<?php 
                        echo htmlspecialchars($_smarty_tpl->tpl_vars['feature_id']->value, ENT_QUOTES, 'UTF-8');
                        ?>
" placeholder="<?php 
                        echo $_smarty_tpl->__("enter_other");
                        ?>
" />
                <?php 
                    }
                    ?>

            <?php 
                } elseif ($_smarty_tpl->tpl_vars['feature']->value['feature_type'] == "M" && $_smarty_tpl->tpl_vars['feature']->value['feature_variants_images'] == 0) {
                    ?>
                <input type="hidden" name="product_data[product_features][<?php 
                    echo htmlspecialchars($_smarty_tpl->tpl_vars['feature_id']->value, ENT_QUOTES, 'UTF-8');
                    ?>
]" value="" />
                <?php 
                    $_smarty_tpl->tpl_vars["var"] = new Smarty_Variable();
                    $_smarty_tpl->tpl_vars["var"]->_loop = false;
                    $_from = $_smarty_tpl->tpl_vars['feature']->value['variants'];
                    if (!is_array($_from) && !is_object($_from)) {
                        settype($_from, 'array');
                    }
                    foreach ($_from as $_smarty_tpl->tpl_vars["var"]->key => $_smarty_tpl->tpl_vars["var"]->value) {
                        $_smarty_tpl->tpl_vars["var"]->_loop = true;
                        ?>
                    <label for="variant_<?php 
                        echo htmlspecialchars($_smarty_tpl->tpl_vars['var']->value['variant_id'], ENT_QUOTES, 'UTF-8');
                        ?>
" class="checkbox"><input type="checkbox" id="variant_<?php 
                        echo htmlspecialchars($_smarty_tpl->tpl_vars['var']->value['variant_id'], ENT_QUOTES, 'UTF-8');
                        ?>
" name="product_data[product_features][<?php 
                        echo htmlspecialchars($_smarty_tpl->tpl_vars['feature_id']->value, ENT_QUOTES, 'UTF-8');
                        ?>
][<?php 
                        echo htmlspecialchars($_smarty_tpl->tpl_vars['var']->value['variant_id'], ENT_QUOTES, 'UTF-8');
                        ?>
]" <?php 
                        if ($_smarty_tpl->tpl_vars['var']->value['selected']) {
                            ?>
checked="checked"<?php 
                        }
                        ?>
 value="<?php 
                        echo htmlspecialchars($_smarty_tpl->tpl_vars['var']->value['variant_id'], ENT_QUOTES, 'UTF-8');
                        ?>
" /><?php 
                        echo htmlspecialchars($_smarty_tpl->tpl_vars['var']->value['variant'], ENT_QUOTES, 'UTF-8');
                        ?>
</label>
                <?php 
                    }
                    ?>
                <?php 
                    if ($_smarty_tpl->tpl_vars['allow_enter_variant']->value) {
                        ?>
                <input type="text" name="product_data[add_new_variant][<?php 
                        echo htmlspecialchars($_smarty_tpl->tpl_vars['feature']->value['feature_id'], ENT_QUOTES, 'UTF-8');
                        ?>
][variant]" id="feature_<?php 
                        echo htmlspecialchars($_smarty_tpl->tpl_vars['feature_id']->value, ENT_QUOTES, 'UTF-8');
                        ?>
" placeholder="<?php 
                        echo $_smarty_tpl->__("enter_other");
                        ?>
" />
                <?php 
                    }
                    ?>
            <?php 
                } elseif ($_smarty_tpl->tpl_vars['feature']->value['feature_type'] == "M" && $_smarty_tpl->tpl_vars['feature']->value['feature_variants_images'] == 1) {
                    ?>
                
                <input type="hidden" name="product_data[product_features][<?php 
                    echo htmlspecialchars($_smarty_tpl->tpl_vars['feature_id']->value, ENT_QUOTES, 'UTF-8');
                    ?>
]" value="" />
                <table style="width:100%">
                    <?php 
                    $_smarty_tpl->tpl_vars["var"] = new Smarty_Variable();
                    $_smarty_tpl->tpl_vars["var"]->_loop = false;
                    $_from = $_smarty_tpl->tpl_vars['feature']->value['variants'];
                    if (!is_array($_from) && !is_object($_from)) {
                        settype($_from, 'array');
                    }
                    foreach ($_from as $_smarty_tpl->tpl_vars["var"]->key => $_smarty_tpl->tpl_vars["var"]->value) {
                        $_smarty_tpl->tpl_vars["var"]->_loop = true;
                        ?>
                        <tr>
                            <td><label for="variant_<?php 
                        echo htmlspecialchars($_smarty_tpl->tpl_vars['var']->value['variant_id'], ENT_QUOTES, 'UTF-8');
                        ?>
" class="checkbox" style="display:inline-block;"><input type="checkbox" id="variant_<?php 
                        echo htmlspecialchars($_smarty_tpl->tpl_vars['var']->value['variant_id'], ENT_QUOTES, 'UTF-8');
                        ?>
" name="product_data[product_features][<?php 
                        echo htmlspecialchars($_smarty_tpl->tpl_vars['feature_id']->value, ENT_QUOTES, 'UTF-8');
                        ?>
][<?php 
                        echo htmlspecialchars($_smarty_tpl->tpl_vars['var']->value['variant_id'], ENT_QUOTES, 'UTF-8');
                        ?>
]" <?php 
                        if ($_smarty_tpl->tpl_vars['var']->value['selected']) {
                            ?>
checked="checked"<?php 
                        }
                        ?>
 value="<?php 
                        echo htmlspecialchars($_smarty_tpl->tpl_vars['var']->value['variant_id'], ENT_QUOTES, 'UTF-8');
                        ?>
" onchange="show_variant_details(<?php 
                        echo htmlspecialchars($_smarty_tpl->tpl_vars['var']->value['variant_id'], ENT_QUOTES, 'UTF-8');
                        ?>
)" /><?php 
                        echo htmlspecialchars($_smarty_tpl->tpl_vars['var']->value['variant'], ENT_QUOTES, 'UTF-8');
                        ?>
</label></td>
                            <td id="link_variant_details_<?php 
                        echo htmlspecialchars($_smarty_tpl->tpl_vars['var']->value['variant_id'], ENT_QUOTES, 'UTF-8');
                        ?>
" <?php 
                        if (!$_smarty_tpl->tpl_vars['var']->value['selected']) {
                            ?>
style="display:none;"<?php 
                        }
                        ?>
><a href="#" onclick="show_product_variant_details(<?php 
                        echo htmlspecialchars($_smarty_tpl->tpl_vars['var']->value['variant_id'], ENT_QUOTES, 'UTF-8');
                        ?>
);return false;"><?php 
                        echo $_smarty_tpl->__("details");
                        ?>
</a><br/></td>
                        </tr>
                        <tr id="variant_details_<?php 
                        echo htmlspecialchars($_smarty_tpl->tpl_vars['var']->value['variant_id'], ENT_QUOTES, 'UTF-8');
                        ?>
" class="hidden">
                            <td colspan="2">
                                <div>
                                    <div class="control-group">
                                        <label class="control-label" for="elm_image_<?php 
                        echo htmlspecialchars($_smarty_tpl->tpl_vars['var']->value['variant_id'], ENT_QUOTES, 'UTF-8');
                        ?>
"><?php 
                        echo $_smarty_tpl->__("image");
                        ?>
</label>
                                        <div class="controls">
                                            <?php 
                        echo $_smarty_tpl->getSubTemplate("common/attach_images.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('image_name' => "p_feature_var_extra", 'image_object_id' => $_smarty_tpl->tpl_vars['var']->value['variant_id'], 'hide_titles' => true, 'image_key' => $_smarty_tpl->tpl_vars['var']->value['variant_id'], 'no_detailed' => true, 'image_object_type' => "p_feature_var_extra", 'image_type' => "M", 'image_pair' => $_smarty_tpl->tpl_vars['var']->value['product_image_pairs_extra'], 'prefix' => $_smarty_tpl->tpl_vars['id']->value), 0);
                        ?>

                                        </div>
                                    </div>
                                </div>
                            </td>
                        </tr>
                    
                    <?php 
                    }
                    ?>
                </table>
                
                
                
                
                
                
            <?php 
                } elseif ($_smarty_tpl->tpl_vars['feature']->value['feature_type'] == "C") {
                    ?>
                <label class="checkbox">
                <input type="hidden" name="product_data[product_features][<?php 
                    echo htmlspecialchars($_smarty_tpl->tpl_vars['feature_id']->value, ENT_QUOTES, 'UTF-8');
                    ?>
]" value="N" />
                <input type="checkbox" name="product_data[product_features][<?php 
                    echo htmlspecialchars($_smarty_tpl->tpl_vars['feature_id']->value, ENT_QUOTES, 'UTF-8');
                    ?>
]" value="Y" id="feature_<?php 
                    echo htmlspecialchars($_smarty_tpl->tpl_vars['feature_id']->value, ENT_QUOTES, 'UTF-8');
                    ?>
" <?php 
                    if ($_smarty_tpl->tpl_vars['feature']->value['value'] == "Y") {
                        ?>
checked="checked"<?php 
                    }
                    ?>
 /></label>
            <?php 
                } elseif ($_smarty_tpl->tpl_vars['feature']->value['feature_type'] == "D") {
                    ?>
                <?php 
                    echo $_smarty_tpl->getSubTemplate("common/calendar.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('date_id' => "date_" . (string) $_smarty_tpl->tpl_vars['feature_id']->value, 'date_name' => "product_data[product_features][" . (string) $_smarty_tpl->tpl_vars['feature_id']->value . "]", 'date_val' => ($tmp = @$_smarty_tpl->tpl_vars['feature']->value['value_int']) === null || $tmp === '' ? '' : $tmp, 'start_year' => $_smarty_tpl->tpl_vars['settings']->value['Company']['company_start_year']), 0);
                    ?>

            <?php 
                } else {
                    ?>
                <input type="text" name="product_data[product_features][<?php 
                    echo htmlspecialchars($_smarty_tpl->tpl_vars['feature_id']->value, ENT_QUOTES, 'UTF-8');
                    ?>
]" value="<?php 
                    if ($_smarty_tpl->tpl_vars['feature']->value['feature_type'] == "O") {
                        if ($_smarty_tpl->tpl_vars['feature']->value['value_int'] != '') {
                            echo htmlspecialchars(floatval($_smarty_tpl->tpl_vars['feature']->value['value_int']), ENT_QUOTES, 'UTF-8');
                        }
                    } else {
                        echo htmlspecialchars($_smarty_tpl->tpl_vars['feature']->value['value'], ENT_QUOTES, 'UTF-8');
                    }
                    ?>
" id="feature_<?php 
                    echo htmlspecialchars($_smarty_tpl->tpl_vars['feature_id']->value, ENT_QUOTES, 'UTF-8');
                    ?>
" class="<?php 
                    if ($_smarty_tpl->tpl_vars['feature']->value['feature_type'] == "O") {
                        ?>
 cm-value-decimal<?php 
                    }
                    ?>
" />
            <?php 
                }
                ?>
            <?php 
                if ($_smarty_tpl->tpl_vars['feature']->value['suffix']) {
                    ?>
<span><?php 
                    echo htmlspecialchars($_smarty_tpl->tpl_vars['feature']->value['suffix'], ENT_QUOTES, 'UTF-8');
                    ?>
</span><?php 
                }
                ?>
            </div>
        </div>
    <?php 
            }
        }
        ?>

<?php 
        $_smarty_tpl->tpl_vars['feature'] = new Smarty_Variable();
        $_smarty_tpl->tpl_vars['feature']->_loop = false;
        $_smarty_tpl->tpl_vars["feature_id"] = new Smarty_Variable();
        $_from = $_smarty_tpl->tpl_vars['product_features']->value;
        if (!is_array($_from) && !is_object($_from)) {
            settype($_from, 'array');
        }
        foreach ($_from as $_smarty_tpl->tpl_vars['feature']->key => $_smarty_tpl->tpl_vars['feature']->value) {
            $_smarty_tpl->tpl_vars['feature']->_loop = true;
            $_smarty_tpl->tpl_vars["feature_id"]->value = $_smarty_tpl->tpl_vars['feature']->key;
            ?>
    <?php 
            if ($_smarty_tpl->tpl_vars['feature']->value['feature_type'] == "G" && $_smarty_tpl->tpl_vars['feature']->value['subfeatures']) {
                ?>
        <?php 
                echo $_smarty_tpl->getSubTemplate("common/subheader.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('title' => $_smarty_tpl->tpl_vars['feature']->value['description']), 0);
                ?>

        <?php 
                echo $_smarty_tpl->getSubTemplate("views/products/components/product_assign_features.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('product_features' => $_smarty_tpl->tpl_vars['feature']->value['subfeatures']), 0);
                ?>

    <?php 
            }
        }
    }
コード例 #4
0
    }
    list($filters) = fn_get_filters_products_count($_REQUEST);
    if (empty($filters[$filter_id])) {
        return array(CONTROLLER_STATUS_NO_PAGE);
    }
    fn_add_breadcrumb($filters[$filter_id]['filter']);
    $variants = array();
    if (!empty($filters[$filter_id]['variants'])) {
        foreach ($filters[$filter_id]['variants'] as $variant) {
            $variants[fn_substr($variant['variant'], 0, 1)][] = $variant;
        }
    }
    ksort($variants);
    Registry::get('view')->assign('variants', $variants);
} elseif ($mode == 'view') {
    $variant_data = fn_get_product_feature_variant($_REQUEST['variant_id']);
    Registry::get('view')->assign('variant_data', $variant_data);
    fn_add_breadcrumb($variant_data['variant']);
    // Override meta description/keywords
    if (!empty($variant_data['meta_description']) || !empty($variant_data['meta_keywords'])) {
        Registry::get('view')->assign('meta_description', $variant_data['meta_description']);
        Registry::get('view')->assign('meta_keywords', $variant_data['meta_keywords']);
    }
    // Override page title
    if (!empty($variant_data['page_title'])) {
        Registry::get('view')->assign('page_title', $variant_data['page_title']);
    }
    $params = $_REQUEST;
    $params['extend'] = array('description');
    list($products, $search) = fn_get_products($params, Registry::get('settings.Appearance.products_per_page'));
    fn_gather_additional_products_data($products, array('get_icon' => true, 'get_detailed' => true, 'get_options' => true, 'get_discounts' => true, 'get_features' => false));