when we in the list.phtml file sometime we need to display the list of child categories of current category with there URL for navigations. this can easily implemnt with magento framework objects. below code example can use on list.phtml easily to retrive child categories of current category.this shows as a list, you can apply css to format the list. happy coading…
If you are dealing with magento category i am very sure that you’ll face this problem .Magento category fetching is not an issue its a child play but sorting thse categories is little tricky , so here the is SQL part by which you can sort the categories in alphabetical order
SET @i=0; SET @j=0; DROP TABLE IF EXISTS AAA_NEW_POSITION; CREATE TABLE AAA_NEW_POSITION SELECT e.entity_id AS 'entity_id',
To Create a Custom Attribute for a Category in Magento we need to do:
Depending on which version of magento you’re running will depend on which tables in your database you’ll need to update.
- 1. eav_attribute
- 2. eav_entity_attribute
- 3. catalog_eav_attribute (only required for Magento version 1.4 onwards)
So start by adding a row to the eav_attribute table in your database
INSERT INTO EAV_ATTRIBUTE (attribute_id, entity_type_id, attribute_code, attribute_model, backend_model, backend_type, backend_table, frontend_model, frontend_input, frontend_label, frontend_class, source_model, is_required, is_user_defined, default_value, is_unique, note,
Magento: Automate Related Products with Current Category
Personally, I’d prefer to show other products from the same category rather than have no related products. This seems to be the case with most of my clients too. I wrote this piece of code to check for manually set related products, and if there are none go and get a random collection of products from the current category.
“What if the user has gone directly to the product which belongs to more than one category?” – easy! If there is no current category set then get an array of categories the product belongs to and choose the first one.
Put this PHP at the top of related.php. This will check for the number of related products and fetch some if need be.
Magento offers simple category and product ordering although this may not be obvious at first. I thought I might share this simple information.
To change the order of categories, from within the Admin, go to Catalog -> Manage Categories. Simply drag and drop the category or subcategory to the location you need it.
As products can belong to multiple categories, to order them you will need to go and order them within the categories. From within Admin go to Catalog -> Manage Categories. Select the category to order it’s products. Now go to the category’s ‘Category Products’ tab. Here you will see all products that belong to the category. The last column in the table is the Position and sets the ordering of products within the category.