if (\Pasteque\CompositionsService::delete($_POST['delete-comp'])) { $message = \i18n("Changes saved"); } else { $error = \i18n("Unable to save changes"); } } $compositions = \Pasteque\CompositionsService::getAll(); //Title echo \Pasteque\row(\Pasteque\mainTitle(\i18n("Compositions", PLUGIN_NAME))); //Buttons $buttons = \Pasteque\addButton(\i18n("Add composition", PLUGIN_NAME), \Pasteque\get_module_url_action(PLUGIN_NAME, "composition_edit")); echo \Pasteque\row(\Pasteque\buttonGroup($buttons)); //Information \Pasteque\tpl_msg_box($message, $error); //Counter echo \Pasteque\row(\Pasteque\counterDiv(\i18n("%d compositions", PLUGIN_NAME, count($compositions)))); if (count($compositions) == 0) { echo \Pasteque\errorDiv(\i18n("No category found", PLUGIN_NAME)); } else { $content[0][0] = \i18n("Composition.label"); $i = 1; foreach ($compositions as $composition) { if ($composition->hasImage) { $imgSrc = \Pasteque\PT::URL_ACTION_PARAM . "=img&w=product&id=" . $composition->id; } else { $imgSrc = \Pasteque\PT::URL_ACTION_PARAM . "=img&w=product"; } $btn_group = \Pasteque\editButton(\i18n('Edit', PLUGIN_NAME), \Pasteque\get_module_url_action(PLUGIN_NAME, "composition_edit", array("productId" => $composition->id))); $btn_group .= \Pasteque\deleteButton(\i18n('Delete', PLUGIN_NAME), \Pasteque\get_current_url() . "&delete-comp=" . $composition->id); $content[$i][0] .= "<img class=\"img img-thumbnail thumbnail pull-left\" src=\"?" . $imgSrc . "\">"; $content[$i][0] .= $composition->label;
if (isset($_GET['delete-taxcat'])) { if (\Pasteque\TaxesService::deleteCat($_GET['delete-taxcat'])) { $message = \i18n("Changes saved"); } else { $error = \i18n("Unable to delete tax. Tax cannot be deleted when in use.", PLUGIN_NAME); } } $taxes = \Pasteque\TaxesService::getAll(); //Title echo \Pasteque\row(\Pasteque\mainTitle(\i18n("Taxes", PLUGIN_NAME))); //Buttons $buttons = \Pasteque\addButton(\i18n("Add a tax", PLUGIN_NAME), \Pasteque\get_module_url_action(PLUGIN_NAME, 'tax_edit')); echo \Pasteque\row(\Pasteque\buttonGroup($buttons)); //Informations \Pasteque\tpl_msg_box($message, $error); //Counter echo \Pasteque\row(\Pasteque\counterDiv(\i18n("%d taxes", PLUGIN_NAME, count($taxes)))); if (count($taxes) == 0) { echo \Pasteque\errorDiv(\i18n("No tax found", PLUGIN_NAME)); } else { $content[0][0] = \i18n("TaxCat.label"); $i = 1; foreach ($taxes as $tax) { $btn_group = \Pasteque\editButton(\i18n('Edit', PLUGIN_NAME), \Pasteque\get_module_url_action(PLUGIN_NAME, 'tax_edit', array("id" => $tax->id))); $btn_group .= \Pasteque\deleteButton(\i18n('Delete', PLUGIN_NAME), \Pasteque\get_current_url() . "&delete-taxcat=" . $tax->id); $content[$i][0] = $tax->label; $content[$i][0] .= \Pasteque\buttonGroup($btn_group, "pull-right"); $i++; } echo \Pasteque\row(\Pasteque\standardTable($content)); }
} else { $error = \i18n("Unable to save changes"); $error .= " " . \i18n("Only empty category can be deleted", PLUGIN_NAME); } } $categories = \Pasteque\CategoriesService::getAll(); //Title echo \Pasteque\row(\Pasteque\mainTitle(\i18n("Categories", PLUGIN_NAME))); //Buttons $buttons = \Pasteque\addButton(\i18n('Add a category', PLUGIN_NAME), \Pasteque\get_module_url_action(PLUGIN_NAME, "category_edit")); $buttons .= \Pasteque\importButton(\i18n('Import categories', PLUGIN_NAME), \Pasteque\get_module_url_action(PLUGIN_NAME, "categoriesManagement")); echo \Pasteque\row(\Pasteque\buttonGroup($buttons)); //Information \Pasteque\tpl_msg_box($message, $error); //Counter echo \Pasteque\row(\Pasteque\counterDiv(\i18n("%d categories", PLUGIN_NAME, count($categories)))); if (count($categories) == 0) { echo \Pasteque\errorDiv(\i18n("No category found", PLUGIN_NAME)); } else { $content[0][0] = \i18n("Category.label"); $i = 1; foreach ($categories as $category) { if ($category->hasImage) { $imgSrc = \Pasteque\PT::URL_ACTION_PARAM . "=img&w=category&id=" . $category->id; } else { $imgSrc = \Pasteque\PT::URL_ACTION_PARAM . "=img&w=category"; } $btn_group = \Pasteque\editButton(\i18n('Edit', PLUGIN_NAME), \Pasteque\get_module_url_action(PLUGIN_NAME, 'category_edit', array("id" => $category->id))); $btn_group .= \Pasteque\deleteButton(\i18n('Delete', PLUGIN_NAME), \Pasteque\get_current_url() . "&delete-cat=" . $category->id); $content[$i][0] .= "<img class=\"img img-thumbnail thumbnail pull-left\" src=\"?" . $imgSrc . "\">"; $content[$i][0] .= $category->label;
<div class="title"><?php \pi18n("Search"); ?> </div> <h5><?php \pi18n("by category", PLUGIN_NAME); ?> </h5> <?php \Pasteque\tpl_form('select', 'category', \Pasteque\CategoriesService::getAll()); ?> </div> <?php //Counter echo \Pasteque\row(\Pasteque\counterDiv(\i18n("%d products", PLUGIN_NAME, $totalProducts))); ?> </p> <?php \Pasteque\tpl_pagination($totalProducts, $range, $start); ?> <?php $archive = false; foreach ($categories as $category) { if (isset($prdCat[$category->id])) { $content[0][0] = ""; $content[0][1] = \i18n("Product.reference"); $content[0][2] = \i18n("Product.label"); $i = 1;