Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New handles for the Category, Product and CMS pages #102

Closed
paales opened this issue Oct 18, 2012 · 8 comments
Closed

New handles for the Category, Product and CMS pages #102

paales opened this issue Oct 18, 2012 · 8 comments
Labels
Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development

Comments

@paales
Copy link
Contributor

paales commented Oct 18, 2012

Add handles to category page

If you are viewing a category: /products/dvds.html (category id: 5)

You'll get a handle by default: CATEGORY_5

We add the following:

Handle: CATEGORY_2_child_child

Category 2 is the root category for this store, so allows for store specific configuration. If the category path is
longer it will show something like CATEGORY_2_child_child_child

Handle: CATEGORY_2_child_dvds

This one is kinda cool, this one allows you have one layout for multiple childcategories. Imagine the following categories:

  • /playgroup/books.html
  • /kindergarten/books.html
  • /elementary/books.html

All these categories will have the CATEGORY_2_child_books handle, so you can all style them the same!

Handle: CATEGORY_3_child

Child of a certain category.
If the category path is longer it will show something like CATEGORY_3_child_child.

Add category handle to product page.

The same as for the category applies, except everything is prefixed with PRODUCT_CATEGORY_ instead of CATEGORY_.

Add attribute set handle to product page

PRODUCT_ATTRIBUTE_SET_default

For styling based on the attribute set handle.

Add handles to CMS page

If you have the page: customerservice/faq/question_one, you'll get the following handles (same idea as for the categories):

CMS_PAGE_customerservice_child_child
CMS_PAGE_customerservice_faq_child
CMS_PAGE_customerservice_faq_question_one
@magento-team
Copy link
Contributor

Hi. Thank you for your proposal.
We can implement most of the ideas, but with some modifications.
Here is major resolution:

Add handles to category page:
"CATEGORY_2_child_child" will be transformed to "catalog_category_view_id_2_child_level_2"

"CATEGORY_2_child_dvds"
It's bad practice to make dependance on user input at handle (category name in this case). To apply some layout update to few dvd categories you can reorganize your catalog or make updates for few handles. Will it work for you? If no, can you propose alternative way without using category name for layout handle?

Add category handle to product page:
"PRODUCT_CATEGORY_" => "catalog_product_view_category_id_"

Add attribute set handle to product page:
"PRODUCT_ATTRIBUTE_SET_default" - same situation as with category name. Better to use attribute set id for handle: "catalog_product_view_attribute_set_id_1"

@paales
Copy link
Contributor Author

paales commented Jan 11, 2013

Thanks for responding and implementing this feature :)

It's bad practice to make dependance on user input at handle (category name in this case). To apply some layout update to few dvd categories you can reorganize your catalog or make updates for few handles. Will it work for you? If no, can you propose alternative way without using category name for layout handle?

That requires me to update the XML for each new category (admin, files, doesn't matter, will have to update somewhere), think that solution is a bit less smooth (especially with automatic imports), but I don't really have a better solution.

The other suggestions are fine, dont really care how they are written down, just that they are :)

@amenk
Copy link
Contributor

amenk commented Jan 14, 2013

Cant we have an attribute in categories that let's us specify a category-handle manually? I know, it is still user input - but then it would be clear, that the input affects the layout.

@paales
Copy link
Contributor Author

paales commented Jan 14, 2013

Cant we have an attribute in categories that let's us specify a category-handle manually? I know, it is still user input - but then it would be clear, that the input affects the layout.

There really isn't that much difference to require someone to copy some XML or to copy some string:

Example XML (this is for Magento 1, but I think Magento 2 will be about the same):

<update handle="catalog_category_my_custom_handle" />

@magento-team
Copy link
Contributor

The Technical Task created to resolve this problem.

magento-team pushed a commit that referenced this issue Feb 20, 2015
[Mavericks] Re-factor product end-to-end tests
okorshenko pushed a commit that referenced this issue Nov 3, 2015
okorshenko pushed a commit to isitnikov/magento2 that referenced this issue Jul 19, 2016
MAGETWO-53557: [Github] ACL Error - Admin user can't change the attributes set magento#4061
magento-engcom-team pushed a commit that referenced this issue Apr 13, 2018
Eliminate usage of Zend_Mime from Magento 2 Open Source
magento-engcom-team added a commit that referenced this issue Jul 19, 2018
 - Merge Pull Request magento/graphql-ce#102 from magento/graphql-ce:graphql-fix-the-category-tree-depth-calculation-issue
 - Merged commits:
   1. 9116d82
@dmanners dmanners mentioned this issue May 6, 2019
4 tasks
magento-engcom-team pushed a commit to okorshenko/magento2 that referenced this issue May 31, 2019
magento-engcom-team added a commit to okorshenko/magento2 that referenced this issue Jun 6, 2019
…tore_id from … magento#102

 - Merge Pull Request magento-commerce/async-import#102 from comwrap/async-import:2.3-develop-bulk-api-multistore-hot-fix
 - Merged commits:
   1. fd6cf5e
   2. 80732c8
   3. 51ac4d8
   4. 331e311
   5. dad12c6
   6. 81ecd90
   7. ab2f000
   8. 48104dc
   9. 460a249
   10. c336e36
   11. 038615b
   12. fb06c33
   13. 06bc3a2
magento-engcom-team pushed a commit that referenced this issue Oct 12, 2019
Merging MC-20181 changes to MC-20644 branch
@ilnytskyi
Copy link
Contributor

Not sure what it was like in 2012 but that would be nice to have possibility to disable additional (product_id,sku/category_id) handles.
Check my comment #189 (comment)
Now we have thousands of entries in the cache storage that we do not need...

@paales
Copy link
Contributor Author

paales commented Sep 24, 2020

@ilnytskyi Wow, that is an old issue! I don't thing you'll get any meaningful response. In 2012 this looked like a great idea, but not so much any more ;)

@ilnytskyi
Copy link
Contributor

When we removed entity ids from layout handles. We reduced used cache space significantly and it also improved overall page performance.
Selection_639

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development
Projects
None yet
Development

No branches or pull requests

4 participants