$message = NULL; $error = NULL; if (isset($_POST['delete-cat'])) { if (\Pasteque\CategoriesService::deleteCat($_POST['delete-cat'])) { $message = \i18n("Changes saved"); } 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";
} } $categories = \Pasteque\CategoriesService::getAll(); $prdCat = array(); $archivesCat = array(); foreach ($products as $product) { if ($product->categoryId !== \Pasteque\CompositionsService::CAT_ID) { $prdCat[$product->categoryId][] = $product; } // Archive will be filled on display loop } //Title echo \Pasteque\row(\Pasteque\mainTitle(\i18n("Products", PLUGIN_NAME))); //Buttons $buttons = \Pasteque\addButton(\i18n("Add a product", PLUGIN_NAME), \Pasteque\get_module_url_action(PLUGIN_NAME, "product_edit")); $buttons .= \Pasteque\importButton(\i18n("Import products", PLUGIN_NAME), \Pasteque\get_module_url_action(PLUGIN_NAME, "productsManagement")); $buttons .= \Pasteque\exportButton(\i18n("Export products", PLUGIN_NAME), \Pasteque\get_module_url_action(PLUGIN_NAME, "products_export")); echo \Pasteque\row(\Pasteque\buttonGroup($buttons)); //Information \Pasteque\tpl_msg_box($message, $error); ?> <div id="search"> <div class="title"><?php \pi18n("Search"); ?> </div> <h5><?php \pi18n("by category", PLUGIN_NAME); ?> </h5>