{extends file="admin-layout.tpl"} {block name="no-return-functions"} {$admin_current_location = 'catalog'} {/block} {block name="page-title"}{intl l='Categories'}{/block} {block name="check-resource"}admin.category{/block} {block name="check-access"}view{/block} {block name="main-content"}
{include file="includes/catalog-breadcrumb.html"} {hook name="categories.top" location="categories_top" }

{* display parent category name, and get current cat ID *} {loop name="category_title" type="category" visible="*" id=$category_id} {intl l="Categories in %cat" cat={$TITLE}} {/loop} {elseloop rel="category_title"} {intl l="Top level categories"} {/elseloop} {hook name="categories.caption" location="category_list_caption" } {loop type="auth" name="can_create" role="ADMIN" resource="admin.category" access="CREATE"} {/loop}
{ifloop rel="category_list"}
{admin_sortable_header current_order=$category_order order='id' reverse_order='id_reverse' path={url path='/admin/catalog' category_id=$category_id} request_parameter_name='category_order' label="{intl l='ID'}" } |  | {admin_sortable_header current_order=$category_order order='alpha' reverse_order='alpha_reverse' path={url path='/admin/catalog' category_id=$category_id} request_parameter_name='category_order' label="{intl l='Category title'}" } {hook name="categories.header" location="category_list_header" } | {admin_sortable_header current_order=$category_order order='visible' reverse_order='visible_reverse' path={url path='/admin/catalog' category_id=$category_id} request_parameter_name='category_order' label="{intl l='Online'}" } | {admin_sortable_header current_order=$category_order order='manual' reverse_order='manual_reverse' path={url path='/admin/catalog' category_id=$category_id} request_parameter_name='category_order' label="{intl l='Position'}" } | {intl l='Actions'}
--- | --- | --- | --- | --- | ---
{loop name="category_list" type="category" visible="*" parent=$category_id order=$category_order backend_context="1" lang=$lang_id return_url=false}
{$ID} | {loop type="image" name="cat_image" source="category" source_id="$ID" limit="1" width="50" height="50" resize_mode="crop" backend_context="1"} {/loop} | {$TITLE} {hook name="categories.row" location="category_list_row" category_id={$ID} } | {loop type="auth" name="can_change" role="ADMIN" resource="admin.category" access="UPDATE"} {/loop} {elseloop rel="can_change"} {/elseloop} | {admin_position_block resource="admin.category" access="UPDATE" path={url path='admin/categories/update-position' category_id=$ID} url_parameter="category_id" in_place_edit_class="categoryPositionChange" position=$POSITION id=$ID } | {loop type="auth" name="can_change" role="ADMIN" resource="admin.category" access="UPDATE"} {/loop} {loop type="auth" name="can_delete" role="ADMIN" resource="admin.category" access="DELETE"} {/loop}
{/loop}
{/ifloop} {elseloop rel="category_list"}
{loop type="auth" name="can_create" role="ADMIN" resource="admin.category" access="CREATE"} {intl l="This category has no sub-categories. To create a new one, click the + button above."} {/loop} {elseloop rel="can_create"} {intl l="This category has no sub-categories."} {/elseloop}
{/elseloop}

{* -- PRODUCT MANAGEMENT ---------------------------------------------------- *} {* No product on toplevel category, e.g. id_category = 0 *} {loop type="currency" name="product-currency" id=$edit_currency_id backend_context="1"} {$currency_symbol = $SYMBOL} {/loop} {if $category_id > 0}

{* display parent category name *} {loop name="category_title" type="category" visible="*" id=$category_id} {intl l="Products in %cat" cat={$TITLE}} {/loop} {elseloop rel="category_title"} {intl l="Top level Products"} {/elseloop} {hook name="products.caption" location="product_list_caption" }
{ifloop rel="product_list"}
{admin_sortable_header current_order=$product_order order='id' reverse_order='id_reverse' path={url path='/admin/catalog' category_id=$category_id target='products'} request_parameter_name='product_order' label="{intl l='ID'}" } |  | {admin_sortable_header current_order=$product_order order='ref' reverse_order='ref_reverse' path={url path='/admin/catalog' category_id=$category_id target='products'} request_parameter_name='product_order' label="{intl l='Reference'}" } | {admin_sortable_header current_order=$product_order order='alpha' reverse_order='alpha_reverse' path={url path='/admin/catalog' category_id=$category_id target='products'} request_parameter_name='product_order' label="{intl l='Product title'}" } {hook name="products.header" location="product_list_header" } | {admin_sortable_header current_order=$product_order order='min_price' reverse_order='max_price' path={url path='/admin/catalog' category_id=$category_id target='products'} request_parameter_name='product_order' label="{intl l='Price'}" } | {admin_sortable_header current_order=$product_order order='visible' reverse_order='visible_reverse' path={url path='/admin/catalog' category_id=$category_id target='products'} request_parameter_name='product_order' label="{intl l='Online'}" } | {admin_sortable_header current_order=$product_order order='manual' reverse_order='manual_reverse' path={url path='/admin/catalog' category_id=$category_id target='products'} request_parameter_name='product_order' label="{intl l='Position'}" } | {intl l="Actions"}
--- | --- | --- | --- | --- | --- | --- | ---
{loop name="product_list" type="product" visible="*" category=$category_id order=$product_order page=$page backend_context="on" limit={config key="number_default_results_per_page.category_list" default=20} return_url=false}
{$ID} | {loop type="image" name="cat_image" source="product" source_id="$ID" limit="1" width="50" height="50" resize_mode="crop" backend_context="1"} {/loop} | {$REF} {if $VIRTUAL}{/if} | {$TITLE} {hook name="products.row" location="product_list_row" product_id={$ID} } | {format_money number=$BEST_PRICE symbol=$currency_symbol} | {loop type="auth" name="can_change" role="ADMIN" resource="admin.product" access="UPDATE"} {/loop} {elseloop rel="can_change"} {/elseloop} | {admin_position_block resource="admin.product" access="UPDATE" path={url path='/admin/products/update-position' product_id=$ID category_id=$category_id} url_parameter="product_id" in_place_edit_class="productPositionChange" position=$POSITION id=$ID } | {loop type="auth" name="can_change" role="ADMIN" resource="admin.product" access="UPDATE"} {/loop} {loop type="auth" name="can_delete" role="ADMIN" resource="admin.product" access="DELETE"} {/loop}
{/loop}
{include file = "includes/pagination.html" loop_ref = "product_list" max_page_count = 10 page_url = {url path="/admin/catalog" category_id=$category_id product_order=$product_order} }
{/ifloop} {elseloop rel="product_list"}
{intl l="This category doesn't contains any products. To add a new product, click the + button above."}
{/elseloop}

{else}
{intl l="To create a new product, select an existing category, or create a new one."}
{/if} {hook name="categories.bottom" location="categories_bottom" }
{hook name="categories.catalog-bottom" location="catalog_bottom" }
{* -- Adding a new category ------------------------------------------------- *} {form name="thelia.admin.category.creation"} {* Capture the dialog body, to pass it to the generic dialog *} {capture "category_creation_dialog"} {form_hidden_fields exclude="parent,locale"} {* on success, redirect to the edition page, _ID_ is replaced with the created object ID, see controller *} {render_form_field field="success_url" value={url path='/admin/categories/update' category_id='_ID_'}} {custom_render_form_field field="title"} {loop type="lang" name="default-lang" default_only="1"}
{* Switch edition to the current locale *} {render_form_field field="locale" value=$LOCALE} {/loop} {/custom_render_form_field} {form_field field="visible"} {$label} {/form_field} {hook name="category.create-form" location="category_create_form" } {/capture} {include file = "includes/generic-create-dialog.html" dialog_id = "category_creation_dialog" dialog_title = {intl l="Create a new category"} dialog_body = {$smarty.capture.category_creation_dialog nofilter} dialog_ok_label = {intl l="Create this category"} form_action = {url path='/admin/categories/create'} form_enctype = {form_enctype} form_error_message = $form_error_message } {/form} {* -- Adding a new product -------------------------------------------------- *} {form name="thelia.admin.product.creation"} {* Capture the dialog body, to pass it to the generic dialog *} {capture "product_creation_dialog"} {form_hidden_fields} {* Be sure to get the category_id, even if the form could not be validated *} {form_field field='success_url'} {* on success, redirect to the edition page, _ID_ is replaced with the created object ID, see controller *} {/form_field} {form_field field='default_category'} {/form_field} {form_field field='ref'}
{$label} :
{intl l='Enter here the product reference'}
{/form_field} {form_field field='title'}
{$label}{if $required} *{/if} : {loop type="lang" name="default-lang" default_only="1" backend_context="1"}
{intl l='Enter here the product name in the default language (%title)' title=$TITLE}
{* Switch edition to the current locale *} {form_field field='locale'} {/form_field} {/loop}
{/form_field}
{form_field field='tax_rule'}
{$label} :
{intl l='Select here the tax applicable to this product'}
{/form_field}
{* If there are some templates, display select template field *} {ifloop rel="product_template"} {* Get category template *} {loop type="category" name="new_product_category" visible="*" id=$category_id} {assign var="product_template" value=$TEMPLATE} {assign var="parent_category" value=$PARENT} {/loop} {* If current category has no template, get a parent's one *} {if !$product_template} {while $parent_category != 0 && !$product_template} {loop type="category" name="parent_category" backend_context=1 visible="*" id=$parent_category} {$parent_category = $PARENT} {$product_template = $TEMPLATE} {/loop} {* Be sure to prevent infinite loops *} {elseloop rel="parent_category"} {$parent_category = 0} {/elseloop} {/while} {/if} {form_field field='template_id'}
{$label} :
{intl l='Select here a template for this product'}
{/form_field} {/ifloop}
{form_field field='price'}
{$label} : {loop type="currency" name="default-currency" default_only="1" backend_context="1"}
{$SYMBOL}
{intl l='Enter here the product price in %title' title={$NAME}}
{form_field field='currency'} {/form_field} {/loop}
{/form_field}
{form_field field='tax_price'}
{$label} : {loop type="currency" name="default-currency" default_only="1" backend_context="1"}
{$SYMBOL}
{intl l='Enter here the product tax price in %title' title={$NAME}}
{/loop}
{/form_field}
{form_field field='weight'}
{$label}:
{intl l="Kg"}
{intl l='Enter here the product weight, in Kilogrammes'}
{/form_field}
{form_field field='quantity'}
{$label}:
{intl l='Enter here the product stock'}
{/form_field}
{form_field field='virtual'}
{$label}
{/form_field} {form_field field='visible'}
{$label}
{/form_field} {hook name="product.create-form" location="product_create_form" } {/capture} {include file = "includes/generic-create-dialog.html" dialog_id = "product_creation_dialog" dialog_title = {intl l="Create a new product"} dialog_body = {$smarty.capture.product_creation_dialog nofilter} dialog_ok_label = {intl l="Create this product"} form_action = {url path='/admin/products/create'} form_enctype = {form_enctype} form_error_message = $form_error_message } {/form} {* -- Delete category confirmation dialog ----------------------------------- *} {capture "category_delete_dialog"} {hook name="category.delete-form" location="category_delete_form" } {/capture} {include file = "includes/generic-confirm-dialog.html" dialog_id = "category_delete_dialog" dialog_title = {intl l="Delete category"} dialog_message = {intl l="Do you really want to delete this category and all its content ?"} form_action = {token_url path='/admin/categories/delete'} form_content = {$smarty.capture.category_delete_dialog nofilter} } {* -- Delete product confirmation dialog ------------------------------------ *} {capture "product_delete_dialog"} {hook name="product.delete-form" location="product_delete_form" } {/capture} {include file = "includes/generic-confirm-dialog.html" dialog_id = "product_delete_dialog" dialog_title = {intl l="Delete product"} dialog_message = {intl l="Do you really want to delete this product and all it's components (images, documents)?
This can't be canceled."} form_action = {token_url path='/admin/products/delete'} form_content = {$smarty.capture.product_delete_dialog nofilter} } {/block} {block name="javascript-initialization"} {javascripts file='assets/js/bootstrap-switch/bootstrap-switch.js'}
{/javascripts} {javascripts file='assets/js/bootstrap-editable/bootstrap-editable.js'}
{/javascripts} {javascripts file='assets/js/jquery.typewatch.js'}
{/javascripts}
{/block} {block name="javascript-last-call"} {hook name="categories.js" location="categories-js" } {/block}