本文整理汇总了PHP中Helper::renderCategoryTree方法的典型用法代码示例。如果您正苦于以下问题:PHP Helper::renderCategoryTree方法的具体用法?PHP Helper::renderCategoryTree怎么用?PHP Helper::renderCategoryTree使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Helper
的用法示例。
在下文中一共展示了Helper::renderCategoryTree方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: displayAjaxCategoriesList
/**
* Listing ajax des catégories
*/
public function displayAjaxCategoriesList()
{
//Insertion des styles admin nécessaire à l'affichage des actions ajax
foreach ($this->css_files as $css_key => $css_type) {
echo '<link rel="stylesheet" type="text/css" href="' . $css_key . '" type="' . $css_type . '"/>';
}
//Géneration du tree des catégories
if (_PS_VERSION_ < '1.6') {
$categoryTree = new Helper();
echo $categoryTree->renderCategoryTree(2, array(), 'id-category-for-insert');
} else {
$categoryTree = new HelperTreeCategories('categories-tree', $this->l('Check the category to display the link'));
echo $categoryTree->setAttribute()->setInputName('id-category-for-insert')->render();
}
}
示例2: getContent
//.........这里部分代码省略.........
(<span id="layered-cat-counter"></span> ' . $this->l('selected') . ')</label>
</p>';
$shops = Shop::getShops(true, null, true);
if (count($shops) > 1) {
$helper = new HelperForm();
$helper->id = null;
$helper->table = 'layered_filter';
$helper->identifier = 'id_layered_filter';
if (Shop::isFeatureActive()) {
$html .= '<span style="color: #585A69;display: block;float: left;font-weight: bold;text-align: right;width: 200px;" >' . $this->l('Choose shop association:') . '</span>';
$html .= '<div id="shop_association" style="width: 300px;margin-left: 215px;">' . $helper->renderAssoShop() . '</div>';
}
}
$html .= '
<div id="error-treeview" class="error" style="display: none;">
<img src="../img/admin/error2.png" alt="" /> ' . $this->l('Please select at least one specific category or select "All categories".') . '
</div>
<div style="display: none;">
<div id="layered-categories-selection" style="padding: 10px; text-align: left;">
<h2>' . $this->l('Categories using this template') . '</h2>
<ol style="padding-left: 20px;">
<li>' . $this->l('Select one ore more category using this filter template') . '</li>
<li>' . $this->l('Press "Save this selection" or close the window to save') . '</li>
</ol>';
$selected_cat = array();
// Translations are not automatic for the moment ;)
if (Shop::getContext() == Shop::CONTEXT_SHOP) {
$root_category = Category::getRootCategory();
$root_category = array('id_category' => $root_category->id_category, 'name' => $root_category->name);
} else {
$root_category = array('id_category' => '0', 'name' => $this->l('Root'));
}
$helper = new Helper();
$html .= $helper->renderCategoryTree(null, $selected_cat, 'categoryBox');
$html .= '
<br />
<center><input type="button" class="button" value="' . $this->l('Save this selection') . '" onclick="$.fancybox.close();" /></center>
</div>
</div>
<div id="layered-step-2">
<hr size="1" noshade />
<h2>' . $this->l('Step 2/3 - Select filters') . '</h2>
<div id="layered_container">
<div id="layered_container_left" style="width: 360px; float: left; height: 200px; overflow-y: auto;">
<h3>' . $this->l('Selected filters') . ' <span id="num_sel_filters">(0)</span></h3>
<p id="no-filters">' . $this->l('No filters selected yet.') . '</p>
<ul id="selected_filters"></ul>
</div>
<div id="layered-ajax-refresh">
' . $this->ajaxCallBackOffice() . '
</div>
</div>
<div class="clear"></div>
<hr size="1" noshade />';
$this->context->controller->addJQueryPlugin('fancybox');
$this->context->controller->addJQueryUI('ui.sortable');
$this->context->controller->addJQueryUI('ui.draggable');
$this->context->controller->addJQueryUI('effects.transfer');
$id_lang = Context::getContext()->cookie->id_lang;
$html .= '
<script type="text/javascript">
function updLayCounters(showAlert)
{
$(\'#num_sel_filters\').html(\'(\'+$(\'ul#selected_filters\').find(\'li\').length+\')\');
$(\'#num_avail_filters\').html(\'(\'+$(\'#layered_container_right ul\').find(\'li\').length+\')\');
示例3: initCategoriesAssociation
public function initCategoriesAssociation($id_root = null)
{
if (is_null($id_root)) {
$id_root = Configuration::get('PS_ROOT_CATEGORY');
}
$id_shop = (int) Tools::getValue('id_shop');
$shop = new Shop($id_shop);
$selected_cat = Shop::getCategories($id_shop);
if (empty($selected_cat)) {
// get first category root and preselect all these children
$root_categories = Category::getRootCategories();
$root_category = new Category($root_categories[0]['id_category']);
$children = $root_category->getAllChildren($this->context->language->id);
$selected_cat[] = $root_categories[0]['id_category'];
foreach ($children as $child) {
$selected_cat[] = $child->id;
}
}
if (Shop::getContext() == Shop::CONTEXT_SHOP && Tools::isSubmit('id_shop')) {
$root_category = new Category($shop->id_category);
} else {
$root_category = new Category($id_root);
}
$root_category = array('id_category' => $root_category->id, 'name' => $root_category->name[$this->context->language->id]);
$helper = new Helper();
return $helper->renderCategoryTree($root_category, $selected_cat, 'categoryBox', false, true);
}
示例4: renderAdminCategorieTree
/**
* @deprecated 1.5.0
*/
public static function renderAdminCategorieTree($translations, $selected_cat = array(), $input_name = 'categoryBox', $use_radio = false, $use_search = false, $disabled_categories = array(), $use_in_popup = false)
{
Tools::displayAsDeprecated();
$helper = new Helper();
if (isset($translations['Root'])) {
$root = $translations['Root'];
} else {
if (isset($translations['Home'])) {
$root = array('name' => $translations['Home'], 'id_category' => 1);
} else {
throw new PrestaShopException('Missing root category parameter.');
}
}
return $helper->renderCategoryTree($root, $selected_cat, $input_name, $use_radio, $use_search, $disabled_categories, $use_in_popup);
}
示例5: initFormAssociations
public function initFormAssociations($obj)
{
$product = $obj;
$data = $this->createTemplate($this->tpl_form);
// Prepare Categories tree for display in Associations tab
$root = Category::getRootCategory();
$default_category = $this->context->cookie->id_category_products_filter ? $this->context->cookie->id_category_products_filter : Context::getContext()->shop->id_category;
if (!$product->id || !$product->isAssociatedToShop()) {
$selected_cat = Category::getCategoryInformations(Tools::getValue('categoryBox', array($default_category)), $this->default_form_language);
} else {
if (Tools::isSubmit('categoryBox')) {
$selected_cat = Category::getCategoryInformations(Tools::getValue('categoryBox', array($default_category)), $this->default_form_language);
} else {
$selected_cat = Product::getProductCategoriesFull($product->id, $this->default_form_language);
}
}
// Multishop block
$data->assign('feature_shop_active', Shop::isFeatureActive());
$helper = new HelperForm();
if ($this->object && $this->object->id) {
$helper->id = $this->object->id;
} else {
$helper->id = null;
}
$helper->table = $this->table;
$helper->identifier = $this->identifier;
// Accessories block
$accessories = Product::getAccessoriesLight($this->context->language->id, $product->id);
if ($post_accessories = Tools::getValue('inputAccessories')) {
$post_accessories_tab = explode('-', Tools::getValue('inputAccessories'));
foreach ($post_accessories_tab as $accessory_id) {
if (!$this->haveThisAccessory($accessory_id, $accessories) && ($accessory = Product::getAccessoryById($accessory_id))) {
$accessories[] = $accessory;
}
}
}
$data->assign('accessories', $accessories);
$product->manufacturer_name = Manufacturer::getNameById($product->id_manufacturer);
$tab_root = array('id_category' => $root->id, 'name' => $root->name);
$helper = new Helper();
$category_tree = $helper->renderCategoryTree($tab_root, $selected_cat, 'categoryBox', false, true, array(), false, true);
$data->assign(array('default_category' => $default_category, 'selected_cat_ids' => implode(',', array_keys($selected_cat)), 'selected_cat' => $selected_cat, 'id_category_default' => $product->getDefaultCategory(), 'category_tree' => $category_tree, 'product' => $product, 'link' => $this->context->link, 'is_shop_context' => Shop::getContext() == Shop::CONTEXT_SHOP));
$this->tpl_form_vars['custom_form'] = $data->fetch();
}
示例6: initCategoriesAssociation
public function initCategoriesAssociation($id_root = null, $id_criterion = 0)
{
if (is_null($id_root)) {
$id_root = Configuration::get('PS_ROOT_CATEGORY');
}
$id_shop = (int) Tools::getValue('id_shop');
$shop = new Shop($id_shop);
if ($id_criterion == 0) {
$selected_cat = array();
} else {
$pdc_object = new ProductCommentCriterion($id_criterion);
$selected_cat = $pdc_object->getCategories();
}
if (Shop::getContext() == Shop::CONTEXT_SHOP && Tools::isSubmit('id_shop')) {
$root_category = new Category($shop->id_category);
} else {
$root_category = new Category($id_root);
}
$root_category = array('id_category' => $root_category->id, 'name' => $root_category->name[$this->context->language->id]);
$helper = new Helper();
return $helper->renderCategoryTree($root_category, $selected_cat, 'categoryBox', false, true);
}
示例7: getContent
//.........这里部分代码省略.........
$message = $this->displayConfirmation($this->l('Filter template deleted, categories updated (reverted to default Filter template).'));
} else {
$message = $this->displayError($this->l('Filter template not found'));
}
}
}
}
$category_box = array();
$attribute_groups = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
SELECT ag.id_attribute_group, ag.is_color_group, agl.name, COUNT(DISTINCT(a.id_attribute)) n
FROM ' . _DB_PREFIX_ . 'attribute_group ag
LEFT JOIN ' . _DB_PREFIX_ . 'attribute_group_lang agl ON (agl.id_attribute_group = ag.id_attribute_group)
LEFT JOIN ' . _DB_PREFIX_ . 'attribute a ON (a.id_attribute_group = ag.id_attribute_group)
WHERE agl.id_lang = ' . (int) $cookie->id_lang . '
GROUP BY ag.id_attribute_group');
$features = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
SELECT fl.id_feature, fl.name, COUNT(DISTINCT(fv.id_feature_value)) n
FROM ' . _DB_PREFIX_ . 'feature_lang fl
LEFT JOIN ' . _DB_PREFIX_ . 'feature_value fv ON (fv.id_feature = fl.id_feature)
WHERE (fv.custom IS NULL OR fv.custom = 0) AND fl.id_lang = ' . (int) $cookie->id_lang . '
GROUP BY fl.id_feature');
if (Shop::isFeatureActive() && count(Shop::getShops(true, null, true)) > 1) {
$helper = new HelperForm();
$helper->id = Tools::getValue('id_layered_filter', null);
$helper->table = 'layered_filter';
$helper->identifier = 'id_layered_filter';
$this->context->smarty->assign('asso_shops', $helper->renderAssoShop());
}
if (version_compare(_PS_VERSION_, '1.6.0', '>=') === true) {
$tree_categories_helper = new HelperTreeCategories('categories-treeview');
$tree_categories_helper->setRootCategory(Shop::getContext() == Shop::CONTEXT_SHOP ? Category::getRootCategory()->id_category : 0)->setUseCheckBox(true);
} else {
if (Shop::getContext() == Shop::CONTEXT_SHOP) {
$root_category = Category::getRootCategory();
$root_category = array('id_category' => $root_category->id_category, 'name' => $root_category->name);
} else {
$root_category = array('id_category' => '0', 'name' => $this->l('Root'));
}
$tree_categories_helper = new Helper();
}
$module_url = Tools::getProtocol(Tools::usingSecureMode()) . $_SERVER['HTTP_HOST'] . $this->getPathUri();
if (method_exists($this->context->controller, 'addJquery')) {
$this->context->controller->addJS($this->_path . 'js/blocklayered_admin.js');
if (version_compare(_PS_VERSION_, '1.6.0.3', '>=') === true) {
$this->context->controller->addjqueryPlugin('sortable');
} elseif (version_compare(_PS_VERSION_, '1.6.0', '>=') === true) {
$this->context->controller->addJS(_PS_JS_DIR_ . 'jquery/plugins/jquery.sortable.js');
} else {
$this->context->controller->addJS($this->_path . 'js/jquery.sortable.js');
}
}
if (version_compare(_PS_VERSION_, '1.6.0', '>=') === true) {
$this->context->controller->addCSS($this->_path . 'css/blocklayered_admin_1.6.css');
} else {
$this->context->controller->addCSS($this->_path . 'css/blocklayered_admin.css');
}
if (Tools::getValue('add_new_filters_template')) {
$this->context->smarty->assign(array('current_url' => $this->context->link->getAdminLink('AdminModules') . '&configure=blocklayered&tab_module=front_office_features&module_name=blocklayered', 'uri' => $this->getPathUri(), 'id_layered_filter' => 0, 'template_name' => sprintf($this->l('My template - %s'), date('Y-m-d')), 'attribute_groups' => $attribute_groups, 'features' => $features, 'total_filters' => 6 + count($attribute_groups) + count($features)));
if (version_compare(_PS_VERSION_, '1.6.0', '>=') === true) {
$this->context->smarty->assign('categories_tree', $tree_categories_helper->render());
} else {
$this->context->smarty->assign('categories_tree', $tree_categories_helper->renderCategoryTree($root_category, array(), 'categoryBox'));
}
if (version_compare(_PS_VERSION_, '1.6.0', '>=') === true) {
return $this->display(__FILE__, 'views/templates/admin/add_1.6.tpl');
} else {
return $this->display(__FILE__, 'views/templates/admin/add.tpl');
}
} else {
if (Tools::getValue('edit_filters_template')) {
$template = Db::getInstance()->getRow('
SELECT *
FROM `' . _DB_PREFIX_ . 'layered_filter`
WHERE id_layered_filter = ' . (int) Tools::getValue('id_layered_filter'));
$filters = unserialize($template['filters']);
if (version_compare(_PS_VERSION_, '1.6.0', '>=') === true) {
$tree_categories_helper->setSelectedCategories($filters['categories']);
$this->context->smarty->assign('categories_tree', $tree_categories_helper->render());
} else {
$this->context->smarty->assign('categories_tree', $tree_categories_helper->renderCategoryTree($root_category, $filters['categories'], 'categoryBox'));
}
$select_shops = $filters['shop_list'];
unset($filters['categories']);
unset($filters['shop_list']);
$this->context->smarty->assign(array('current_url' => $this->context->link->getAdminLink('AdminModules') . '&configure=blocklayered&tab_module=front_office_features&module_name=blocklayered', 'uri' => $this->getPathUri(), 'id_layered_filter' => (int) Tools::getValue('id_layered_filter'), 'template_name' => $template['name'], 'attribute_groups' => $attribute_groups, 'features' => $features, 'filters' => Tools::jsonEncode($filters), 'total_filters' => 6 + count($attribute_groups) + count($features)));
if (version_compare(_PS_VERSION_, '1.6.0', '>=') === true) {
return $this->display(__FILE__, 'views/templates/admin/add_1.6.tpl');
} else {
return $this->display(__FILE__, 'views/templates/admin/add.tpl');
}
} else {
$this->context->smarty->assign(array('message' => $message, 'uri' => $this->getPathUri(), 'PS_LAYERED_INDEXED' => Configuration::getGlobalValue('PS_LAYERED_INDEXED'), 'current_url' => Tools::safeOutput(preg_replace('/&deleteFilterTemplate=[0-9]*&id_layered_filter=[0-9]*/', '', $_SERVER['REQUEST_URI'])), 'id_lang' => Context::getContext()->cookie->id_lang, 'token' => substr(Tools::encrypt('blocklayered/index'), 0, 10), 'base_folder' => urlencode(_PS_ADMIN_DIR_), 'price_indexer_url' => $module_url . 'blocklayered-price-indexer.php' . '?token=' . substr(Tools::encrypt('blocklayered/index'), 0, 10), 'full_price_indexer_url' => $module_url . 'blocklayered-price-indexer.php' . '?token=' . substr(Tools::encrypt('blocklayered/index'), 0, 10) . '&full=1', 'attribute_indexer_url' => $module_url . 'blocklayered-attribute-indexer.php' . '?token=' . substr(Tools::encrypt('blocklayered/index'), 0, 10), 'url_indexer_url' => $module_url . 'blocklayered-url-indexer.php' . '?token=' . substr(Tools::encrypt('blocklayered/index'), 0, 10) . '&truncate=1', 'filters_templates' => Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('SELECT * FROM ' . _DB_PREFIX_ . 'layered_filter ORDER BY date_add DESC'), 'hide_values' => Configuration::get('PS_LAYERED_HIDE_0_VALUES'), 'show_quantities' => Configuration::get('PS_LAYERED_SHOW_QTIES'), 'full_tree' => Configuration::get('PS_LAYERED_FULL_TREE'), 'category_depth' => Configuration::get('PS_LAYERED_FILTER_CATEGORY_DEPTH'), 'price_use_tax' => Configuration::get('PS_LAYERED_FILTER_PRICE_USETAX'), 'index_cdt' => Configuration::get('PS_LAYERED_FILTER_INDEX_CDT'), 'index_qty' => Configuration::get('PS_LAYERED_FILTER_INDEX_QTY'), 'index_mnf' => Configuration::get('PS_LAYERED_FILTER_INDEX_MNF'), 'index_cat' => Configuration::get('PS_LAYERED_FILTER_INDEX_CAT'), 'limit_warning' => $this->displayLimitPostWarning(21 + count($attribute_groups) * 3 + count($features) * 3)));
if (version_compare(_PS_VERSION_, '1.6.0', '>=') === true) {
return $this->display(__FILE__, 'views/templates/admin/view_1.6.tpl');
} else {
return $this->display(__FILE__, 'views/templates/admin/view.tpl');
}
}
}
}
示例8: find
//.........这里部分代码省略.........
foreach ($intersect_array as $query) {
$eligible_products2 = array();
foreach ($db->executeS($query) as $row) {
$eligible_products2[] = $row['id_product'];
}
$eligible_products = array_intersect($eligible_products, $eligible_products2);
if (!count($eligible_products)) {
return $ajax ? array() : array('total' => 0, 'result' => array(), 'painters' => array());
}
}
$eligible_products = array_unique($eligible_products);
$product_pool = '';
foreach ($eligible_products as $id_product) {
if ($id_product) {
$product_pool .= (int) $id_product . ',';
}
}
if (empty($product_pool)) {
return $ajax ? array() : array('total' => 0, 'result' => array());
}
$product_pool = strpos($product_pool, ',') === false ? ' = ' . (int) $product_pool . ' ' : ' IN (' . rtrim($product_pool, ',') . ') ';
if ($ajax) {
$sql = 'SELECT DISTINCT p.id_product, pl.name pname, cl.name cname,
cl.link_rewrite crewrite, pl.link_rewrite prewrite ' . $score . '
FROM ' . _DB_PREFIX_ . 'product p
INNER JOIN `' . _DB_PREFIX_ . 'product_lang` pl ON (
p.`id_product` = pl.`id_product`
AND pl.`id_lang` = ' . (int) $id_lang . Shop::addSqlRestrictionOnLang('pl') . '
)
' . Shop::addSqlAssociation('product', 'p') . '
INNER JOIN `' . _DB_PREFIX_ . 'category_lang` cl ON (
product_shop.`id_category_default` = cl.`id_category`
AND cl.`id_lang` = ' . (int) $id_lang . Shop::addSqlRestrictionOnLang('cl') . '
)
WHERE p.`id_product` ' . $product_pool . '
ORDER BY position DESC LIMIT 10';
return $db->executeS($sql);
}
if (strpos($order_by, '.') > 0) {
$order_by = explode('.', $order_by);
$order_by = pSQL($order_by[0]) . '.`' . pSQL($order_by[1]) . '`';
}
$alias = '';
if ($order_by == 'price') {
$alias = 'product_shop.';
} elseif (in_array($order_by, array('date_upd', 'date_add'))) {
$alias = 'p.';
}
$sql = 'SELECT p.*, product_shop.*, stock.out_of_stock, IFNULL(stock.quantity, 0) as quantity,
pl.`description_short`, pl.`available_now`, pl.`available_later`, pl.`link_rewrite`, pl.`name`,
MAX(image_shop.`id_image`) id_image, il.`legend`, m.`name` manufacturer_name ' . $score . (Combination::isFeatureActive() ? ', MAX(product_attribute_shop.`id_product_attribute`) id_product_attribute' : '') . ',
DATEDIFF(
p.`date_add`,
DATE_SUB(
NOW(),
INTERVAL ' . (Validate::isUnsignedInt(Configuration::get('PS_NB_DAYS_NEW_PRODUCT')) ? Configuration::get('PS_NB_DAYS_NEW_PRODUCT') : 20) . ' DAY
)
) > 0 new' . (Combination::isFeatureActive() ? ', MAX(product_attribute_shop.minimal_quantity) AS product_attribute_minimal_quantity' : '') . '
FROM ' . _DB_PREFIX_ . 'product p
' . Shop::addSqlAssociation('product', 'p') . '
INNER JOIN `' . _DB_PREFIX_ . 'product_lang` pl ON (
p.`id_product` = pl.`id_product`
AND pl.`id_lang` = ' . (int) $id_lang . Shop::addSqlRestrictionOnLang('pl') . '
)
' . (Combination::isFeatureActive() ? 'LEFT JOIN `' . _DB_PREFIX_ . 'product_attribute` pa ON (p.`id_product` = pa.`id_product`)
' . Shop::addSqlAssociation('product_attribute', 'pa', false, 'product_attribute_shop.`default_on` = 1') . '
' . Product::sqlStock('p', 'product_attribute_shop', false, $context->shop) : Product::sqlStock('p', 'product', false, Context::getContext()->shop)) . '
LEFT JOIN `' . _DB_PREFIX_ . 'manufacturer` m ON m.`id_manufacturer` = p.`id_manufacturer`
LEFT JOIN `' . _DB_PREFIX_ . 'image` i ON (i.`id_product` = p.`id_product`)' . Shop::addSqlAssociation('image', 'i', false, 'image_shop.cover=1') . '
LEFT JOIN `' . _DB_PREFIX_ . 'image_lang` il ON (i.`id_image` = il.`id_image` AND il.`id_lang` = ' . (int) $id_lang . ')
WHERE p.`id_product` ' . $product_pool . '
GROUP BY product_shop.id_product
' . ($order_by ? 'ORDER BY ' . $alias . $order_by : '') . ($order_way ? ' ' . $order_way : '') . '
LIMIT ' . (int) (($page_number - 1) * $page_size) . ',' . (int) $page_size;
$result = $db->executeS($sql);
$helper = new Helper();
$categoryTree = $helper->renderCategoryTree();
$sql = 'SELECT COUNT(*)
FROM ' . _DB_PREFIX_ . 'product p
' . Shop::addSqlAssociation('product', 'p') . '
INNER JOIN `' . _DB_PREFIX_ . 'product_lang` pl ON (
p.`id_product` = pl.`id_product`
AND pl.`id_lang` = ' . (int) $id_lang . Shop::addSqlRestrictionOnLang('pl') . '
)
LEFT JOIN `' . _DB_PREFIX_ . 'manufacturer` m ON m.`id_manufacturer` = p.`id_manufacturer`
WHERE p.`id_product` ' . $product_pool;
$total = $db->getValue($sql);
if (!$result) {
$result_properties = false;
} else {
$result_properties = Product::getProductsProperties((int) $id_lang, $result);
}
$sql = 'SELECT c.*, c_lang.*
FROM ' . _DB_PREFIX_ . 'category c
INNER JOIN ' . _DB_PREFIX_ . 'category_lang c_lang ON (
c.id_category = c_lang.id_category)
WHERE c_lang.name LIKE ' . ($word[0] == '-' ? ' \'' . $end_search . pSQL(Tools::substr($word, 1, PS_SEARCH_MAX_WORD_LENGTH)) . $end_search . '\'' : ' \'' . $end_search . pSQL(Tools::substr($word, 0, PS_SEARCH_MAX_WORD_LENGTH)) . $end_search . '\'') . 'AND c.id_parent = 14';
$painters = $db->executeS($sql);
return array('total' => $total, 'result' => $result_properties, 'painters' => $painters);
}
示例9: getContent
public function getContent()
{
$this->instanceDefaultStates();
$this->_postProcess();
$order_states = OrderState::getOrderStates($this->context->language->id);
$currency = new Currency((int) Configuration::get('PS_CURRENCY_DEFAULT'));
$id_lang_default = (int) Configuration::get('PS_LANG_DEFAULT');
$languages = Language::getLanguages(false);
$languageIds = 'voucher_details¤default_loyalty_state¤none_award_loyalty_state¤convert_loyalty_state¤validation_loyalty_state¤cancel_loyalty_state';
$this->html .= '
<script type="text/javascript">
id_language = Number(' . $id_lang_default . ');
</script>
<h2>' . $this->l('Loyalty Program') . '</h2>
<form action="' . Tools::safeOutput($_SERVER['REQUEST_URI']) . '" method="post">
<fieldset>
<legend>' . $this->l('Settings') . '</legend>
<label>' . $this->l('Ratio') . '</label>
<div class="margin-form">
<input type="text" size="2" id="point_rate" name="point_rate" value="' . (double) Configuration::get('PS_LOYALTY_POINT_RATE') . '" /> ' . $currency->sign . '
<label for="point_rate" class="t"> = ' . $this->l('1 reward point') . '.</label>
<br />
<label for="point_value" class="t">' . $this->l('1 point = ') . '</label>
<input type="text" size="2" name="point_value" id="point_value" value="' . (double) Configuration::get('PS_LOYALTY_POINT_VALUE') . '" /> ' . $currency->sign . '
<label for="point_value" class="t">' . $this->l('for the discount') . '.</label>
</div>
<div class="clear"></div>
<label>' . $this->l('Voucher details') . '</label>
<div class="margin-form">';
foreach ($languages as $language) {
$this->html .= '
<div id="voucher_details_' . $language['id_lang'] . '" style="display: ' . ($language['id_lang'] == $id_lang_default ? 'block' : 'none') . '; float: left;">
<input size="33" type="text" name="voucher_details_' . $language['id_lang'] . '" value="' . Configuration::get('PS_LOYALTY_VOUCHER_DETAILS', (int) $language['id_lang']) . '" />
</div>';
}
$this->html .= $this->displayFlags($languages, $id_lang_default, $languageIds, 'voucher_details', true);
$this->html .= ' </div>
<div class="clear" style="margin-top: 20px"></div>
<label>' . $this->l('Minimum amount in which the voucher can be used') . '</label>
<div class="margin-form">
<input type="text" size="2" name="minimal" value="' . (double) Configuration::get('PS_LOYALTY_MINIMAL') . '" /> ' . $currency->sign . '
</div>
<div class="clear" style="margin-top: 20px"></div>
<label>' . $this->l('Give points on discounted products') . ' </label>
<div class="margin-form">
<input type="radio" name="PS_LOYALTY_NONE_AWARD" id="PS_LOYALTY_NONE_AWARD_on" value="1" ' . (Configuration::get('PS_LOYALTY_NONE_AWARD') ? 'checked="checked" ' : '') . '/>
<label class="t" for="PS_LOYALTY_NONE_AWARD_on"><img src="../img/admin/enabled.gif" alt="' . $this->l('Enabled') . '" title="' . $this->l('Yes') . '" /></label>
<input type="radio" name="PS_LOYALTY_NONE_AWARD" id="PS_LOYALTY_NONE_AWARD_off" value="0" ' . (!Configuration::get('PS_LOYALTY_NONE_AWARD') ? 'checked="checked" ' : '') . '/>
<label class="t" for="PS_LOYALTY_NONE_AWARD_off"><img src="../img/admin/disabled.gif" alt="' . $this->l('Disabled') . '" title="' . $this->l('No') . '" /></label>
</div>
<div class="clear"></div>
<label>' . $this->l('Points are awarded when the order is') . '</label>
<div class="margin-form" style="margin-top:10px">
<select id="id_order_state_validation" name="id_order_state_validation">';
foreach ($order_states as $order_state) {
$this->html .= '<option value="' . $order_state['id_order_state'] . '" style="background-color:' . $order_state['color'] . ';"';
if ((int) $this->loyaltyStateValidation->id_order_state == $order_state['id_order_state']) {
$this->html .= ' selected="selected"';
}
$this->html .= '>' . $order_state['name'] . '</option>';
}
$this->html .= '</select>
</div>
<div class="clear"></div>
<label>' . $this->l('Points are cancelled when the order is') . '</label>
<div class="margin-form" style="margin-top:10px">
<select id="id_order_state_cancel" name="id_order_state_cancel">';
foreach ($order_states as $order_state) {
$this->html .= '<option value="' . $order_state['id_order_state'] . '" style="background-color:' . $order_state['color'] . ';"';
if ((int) $this->loyaltyStateCancel->id_order_state == $order_state['id_order_state']) {
$this->html .= ' selected="selected"';
}
$this->html .= '>' . $order_state['name'] . '</option>';
}
$this->html .= '</select>
</div>
<div class="clear"></div>
<label>' . $this->l('Vouchers created by the loyalty system can be used in the following categories :') . '</label>';
$index = explode(',', Configuration::get('PS_LOYALTY_VOUCHER_CATEGORY'));
$indexedCategories = isset($_POST['categoryBox']) ? $_POST['categoryBox'] : $index;
$helper = new Helper();
$this->html .= '<div class="margin-form">' . $helper->renderCategoryTree(null, $indexedCategories) . '</div>';
$this->html .= '
<p style="padding-left:200px;">' . $this->l('Mark the box(es) of categories in which loyalty vouchers are usable.') . '</p>
<div class="clear"></div>
<h3 style="margin-top:20px">' . $this->l('Loyalty points progression') . '</h3>
<label>' . $this->l('Initial') . '</label>
<div class="margin-form">';
foreach ($languages as $language) {
$this->html .= '
<div id="default_loyalty_state_' . $language['id_lang'] . '" style="display: ' . ($language['id_lang'] == $id_lang_default ? 'block' : 'none') . '; float: left;">
<input size="33" type="text" name="default_loyalty_state_' . $language['id_lang'] . '" value="' . (isset($this->loyaltyStateDefault->name[(int) $language['id_lang']]) ? $this->loyaltyStateDefault->name[(int) $language['id_lang']] : $this->loyaltyStateDefault->name[(int) $id_lang_default]) . '" />
</div>';
}
$this->html .= $this->displayFlags($languages, $id_lang_default, $languageIds, 'default_loyalty_state', true);
$this->html .= ' </div>
<div class="clear"></div>
<label>' . $this->l('Unavailable') . '</label>
<div class="margin-form">';
//.........这里部分代码省略.........
示例10: renderForm
public function renderForm()
{
if (!($group = $this->loadObject(true))) {
return;
}
$this->fields_form = array('legend' => array('title' => $this->l('Customer group'), 'image' => '../img/admin/tab-groups.gif'), 'submit' => array('title' => $this->l(' Save '), 'class' => 'button'), 'input' => array(array('type' => 'text', 'label' => $this->l('Name:'), 'name' => 'name', 'size' => 33, 'required' => true, 'lang' => true, 'hint' => $this->l('Forbidden characters:') . ' 0-9!<>,;?=+()@#"�{}_$%:'), array('type' => 'text', 'label' => $this->l('Discount (%):'), 'name' => 'reduction', 'size' => 33, 'desc' => $this->l('Will automatically apply this value as a discount on all products for members of this customer group.')), array('type' => 'select', 'label' => $this->l('Price display method:'), 'name' => 'price_display_method', 'desc' => $this->l('How prices are displayed in the order summary for this customer group.'), 'options' => array('query' => array(array('id_method' => PS_TAX_EXC, 'name' => $this->l('Tax excluded')), array('id_method' => PS_TAX_INC, 'name' => $this->l('Tax included'))), 'id' => 'id_method', 'name' => 'name')), array('type' => 'radio', 'label' => $this->l('Show prices:'), 'name' => 'show_prices', 'required' => false, 'class' => 't', 'is_bool' => true, 'values' => array(array('id' => 'show_prices_on', 'value' => 1, 'label' => $this->l('Enabled')), array('id' => 'show_prices_off', 'value' => 0, 'label' => $this->l('Disabled'))), 'desc' => $this->l('Customers in this group can view price')), array('type' => 'group_discount_category', 'label' => $this->l('Category discount:'), 'name' => 'reduction', 'size' => 33, 'values' => $group->id ? $this->formatCategoryDiscountList((int) $group->id) : array()), array('type' => 'modules', 'label' => array('auth_modules' => $this->l('Authorized modules:'), 'unauth_modules' => $this->l('Unauthorized modules:')), 'name' => 'auth_modules', 'values' => $this->formatModuleListAuth($group->id))));
if (Shop::isFeatureActive()) {
$this->fields_form['input'][] = array('type' => 'shop', 'label' => $this->l('Shop association:'), 'name' => 'checkBoxShopAsso');
}
$this->fields_value['reduction'] = isset($group->reduction) ? $group->reduction : 0;
$helper = new Helper();
$this->tpl_form_vars['categoryTreeView'] = $helper->renderCategoryTree(null, array(), 'id_category', true, false, array(), true, true);
return parent::renderForm();
}