From e6d8e098861e036d73db35d699810004c520522d Mon Sep 17 00:00:00 2001 From: franck Date: Thu, 19 Sep 2013 14:02:56 +0200 Subject: [PATCH 1/3] Added product edition routing --- core/lib/Thelia/Config/Resources/config.xml | 1 + .../Thelia/Config/Resources/routing/admin.xml | 20 ++++++++++++++++++- install/insert.sql | 2 +- 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/core/lib/Thelia/Config/Resources/config.xml b/core/lib/Thelia/Config/Resources/config.xml index 1ecd8a649..5fdefc096 100755 --- a/core/lib/Thelia/Config/Resources/config.xml +++ b/core/lib/Thelia/Config/Resources/config.xml @@ -31,6 +31,7 @@ + diff --git a/core/lib/Thelia/Config/Resources/routing/admin.xml b/core/lib/Thelia/Config/Resources/routing/admin.xml index 50b622451..42be03276 100755 --- a/core/lib/Thelia/Config/Resources/routing/admin.xml +++ b/core/lib/Thelia/Config/Resources/routing/admin.xml @@ -144,6 +144,8 @@ Thelia\Controller\Admin\ProductController::updatePositionAction + + Thelia\Controller\Admin\ProductController::addRelatedContentAction @@ -156,7 +158,23 @@ Thelia\Controller\Admin\ProductController::getAvailableRelatedContentAction xml|json - + + + + + Thelia\Controller\Admin\ProductController::addAccessoryAction + + + + Thelia\Controller\Admin\ProductController::deleteAccessoryAction + + + + Thelia\Controller\Admin\ProductController::getAvailableAccessoriesAction + xml|json + + + Thelia\Controller\Admin\FolderController::indexAction diff --git a/install/insert.sql b/install/insert.sql index 9680abd28..b6c98f071 100755 --- a/install/insert.sql +++ b/install/insert.sql @@ -27,7 +27,7 @@ INSERT INTO `config` (`name`, `value`, `secured`, `hidden`, `created_at`, `updat ('thelia_admin_remember_me_cookie_expiration', 2592000, 0, 0, NOW(), NOW()), ('thelia_customer_remember_me_cookie_name', 'tcrmcn', 0, 0, NOW(), NOW()), ('thelia_customer_remember_me_cookie_expiration', 31536000, 0, 0, NOW(), NOW()), -('session_config.handlers', 'Symfony\Component\HttpFoundation\Session\Storage\Handler\NativeFileSessionHandler', 0, 0, NOW(), NOW()) +('session_config.handlers', 'Symfony\\Component\\HttpFoundation\\Session\\Storage\\Handler\\NativeFileSessionHandler', 0, 0, NOW(), NOW()) ; From 3ff1f7f9bb4579730784700ebfdd0150e26a1f9d Mon Sep 17 00:00:00 2001 From: franck Date: Thu, 19 Sep 2013 16:49:39 +0200 Subject: [PATCH 2/3] Added accessories management events --- core/lib/Thelia/Core/Event/TheliaEvents.php | 37 +++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/core/lib/Thelia/Core/Event/TheliaEvents.php b/core/lib/Thelia/Core/Event/TheliaEvents.php index 6a024f33b..b99a5af1b 100755 --- a/core/lib/Thelia/Core/Event/TheliaEvents.php +++ b/core/lib/Thelia/Core/Event/TheliaEvents.php @@ -165,6 +165,17 @@ final class TheliaEvents const BEFORE_UPDATECATEGORY = "action.before_updateCategory"; const AFTER_UPDATECATEGORY = "action.after_updateCategory"; + // -- Categories Associated Content ---------------------------------------- + + const BEFORE_CREATECATEGORY_ASSOCIATED_CONTENT = "action.before_createCategoryAssociatedContent"; + const AFTER_CREATECATEGORY_ASSOCIATED_CONTENT = "action.after_createCategoryAssociatedContent"; + + const BEFORE_DELETECATEGORY_ASSOCIATED_CONTENT = "action.before_deleteCategoryAssociatedContenty"; + const AFTER_DELETECATEGORY_ASSOCIATED_CONTENT = "action.after_deleteproduct_accessory"; + + const BEFORE_UPDATECATEGORY_ASSOCIATED_CONTENT = "action.before_updateCategoryAssociatedContent"; + const AFTER_UPDATECATEGORY_ASSOCIATED_CONTENT = "action.after_updateCategoryAssociatedContent"; + // -- Product management ----------------------------------------------- const PRODUCT_CREATE = "action.createProduct"; @@ -176,6 +187,10 @@ final class TheliaEvents const PRODUCT_ADD_CONTENT = "action.productAddContent"; const PRODUCT_REMOVE_CONTENT = "action.productRemoveContent"; + const PRODUCT_ADD_ACCESSORY = "action.productAddAccessory"; + const PRODUCT_REMOVE_ACCESSORY = "action.productRemoveAccessory"; + const PRODUCT_UPDATE_ACCESSORY_POSITION = "action.updateProductPosition"; + const BEFORE_CREATEPRODUCT = "action.before_createproduct"; const AFTER_CREATEPRODUCT = "action.after_createproduct"; @@ -185,6 +200,28 @@ final class TheliaEvents const BEFORE_UPDATEPRODUCT = "action.before_updateProduct"; const AFTER_UPDATEPRODUCT = "action.after_updateProduct"; + // -- Product Accessories -------------------------------------------------- + + const BEFORE_CREATEACCESSORY = "action.before_createAccessory"; + const AFTER_CREATEACCESSORY = "action.after_createAccessory"; + + const BEFORE_DELETEACCESSORY = "action.before_deleteAccessory"; + const AFTER_DELETEACCESSORY = "action.after_deleteAccessory"; + + const BEFORE_UPDATEACCESSORY = "action.before_updateAccessory"; + const AFTER_UPDATEACCESSORY = "action.after_updateAccessory"; + + // -- Product Associated Content -------------------------------------------------- + + const BEFORE_CREATEPRODUCT_ASSOCIATED_CONTENT = "action.before_createProductAssociatedContent"; + const AFTER_CREATEPRODUCT_ASSOCIATED_CONTENT = "action.after_createProductAssociatedContent"; + + const BEFORE_DELETEPRODUCT_ASSOCIATED_CONTENT = "action.before_deleteProductAssociatedContenty"; + const AFTER_DELETEPRODUCT_ASSOCIATED_CONTENT = "action.after_deleteproduct_accessory"; + + const BEFORE_UPDATEPRODUCT_ASSOCIATED_CONTENT = "action.before_updateProductAssociatedContent"; + const AFTER_UPDATEPRODUCT_ASSOCIATED_CONTENT = "action.after_updateProductAssociatedContent"; + /** * sent when a new existing cat id duplicated. This append when current customer is different from current cart */ From 05aa284f4ba0394685ffbe6c855698f929aeb7b2 Mon Sep 17 00:00:00 2001 From: franck Date: Thu, 19 Sep 2013 17:06:10 +0200 Subject: [PATCH 3/3] Fixed minor UI glithces --- templates/admin/default/categories.html | 8 +- templates/admin/default/category-edit.html | 99 +++++++++++++--------- 2 files changed, 61 insertions(+), 46 deletions(-) diff --git a/templates/admin/default/categories.html b/templates/admin/default/categories.html index 3c2e6f00a..68fd220b5 100755 --- a/templates/admin/default/categories.html +++ b/templates/admin/default/categories.html @@ -266,14 +266,14 @@ {loop type="image" name="cat_image" source="product" source_id="$ID" limit="1" width="50" height="50" resize_mode="crop" backend_context="1"} - + {$TITLE} {/loop} - {$REF} + {$REF} - {$TITLE} + {$TITLE} {module_include location='product_list_row'} @@ -305,7 +305,7 @@
{loop type="auth" name="can_change" roles="ADMIN" permissions="admin.product.edit"} - + {/loop} {loop type="auth" name="can_delete" roles="ADMIN" permissions="admin.product.delete"} diff --git a/templates/admin/default/category-edit.html b/templates/admin/default/category-edit.html index ddf39f5f2..a4a69ff3d 100755 --- a/templates/admin/default/category-edit.html +++ b/templates/admin/default/category-edit.html @@ -40,24 +40,23 @@
-
+
{form name="thelia.admin.category.modification"}
- {include file="includes/inner-form-toolbar.html" close_url="{url path='/admin/categories' category_id=$category_id}"} + {include file="includes/inner-form-toolbar.html" close_url="{url path='/admin/categories' category_id=$PARENT}"} {* Be sure to get the category ID, even if the form could not be validated *} @@ -141,7 +140,7 @@
-
+
@@ -149,9 +148,12 @@ {include file="includes/inner-form-toolbar.html" hide_submit_buttons=true - close_url="{url path='/admin/categories' category_id=$category_id}" + close_url="{url path='/admin/categories' category_id=$PARENT}" } +

{intl l='Related content'}

+

{intl l='You can attach here some content to this product'}

+ @@ -162,8 +164,8 @@
@@ -183,6 +185,12 @@ {intl l='Select a content and click (+) to add it to this category'}
+ +
+
+ {intl l="No available content in this folder"} +
+
@@ -200,7 +208,7 @@ {intl l='ID'} - {intl l='Attribute title'} + {intl l='Content title'} {module_include location='category_contents_table_header'} @@ -245,13 +253,13 @@
-
+
-
+
-
+
@@ -287,7 +295,7 @@ {block name="javascript-initialization"} - + @@ -317,12 +325,6 @@ $(function() { ev.preventDefault(); }); - // Show proper tab, if defined - {if ! empty($current_tab)} - $('#tabbed-menu a[href="#{$current_tab}"]').tab('show') - {/if} - - // Set proper content ID in delete content from $('a.delete-content').click(function(ev) { $('#content_delete_id').val($(this).data('id')); @@ -331,28 +333,41 @@ $(function() { // Load content on folder selection $('#folder_id').change(function(event) { - $.ajax({ - url : '{url path="/admin/category/$category_id/available-related-content/"}' + $(this).val() + '.xml', - type : 'get', - dataType : 'json', - success : function(json) { - $('#content_id :not(:first-child)').remove(); - var have_content = false; + var val = $(this).val(); - $.each(json, function(idx, value) { - $('#content_id').append($('