-
-
Notifications
You must be signed in to change notification settings - Fork 436
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
86 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
--- | ||
hide: | ||
- toc | ||
tags: | ||
- Catagory | ||
- CMS blocks | ||
--- | ||
|
||
# Dynamic block contents in category page | ||
|
||
In _backend > Catalog > Manage Categories_, we can configure a category page and put it on the main menu. The page contents are rendered in | ||
|
||
> app\design\frontend\base\default\template\catalog\category\view.phtml | ||
If we want to render an HTML table in which its data are taken from the database, we would follow these steps: | ||
|
||
1. Create a custom block `mymodule/mytable` with template `mymodule/mytable.phtml`. | ||
2. Whitelist our block for rendering in the frontend: backend > System > Permissions > Blocks | ||
3. Create a CMS static block: backend > CMS > Static Blocks and set the _Content_ to render from our block with this directive: | ||
```html | ||
{{block type="mymodule/mytable" template="mymodule/mytable.phtml"}} | ||
``` | ||
4. Create a subcategory: backend > Catalog > Manage Categories > Add a subcategory and in the _Display Setings_ tab, set the category attribute _Display Mode_ to _Static block only_ and _CMS Block_ pointing to our block. | ||
|
||
Voila, the HTML table is rendered under the menu we just created. However, every time the table in the database is updated, and because CMS blocks rendering are taken from the cache, we would need to refresh the cache. | ||
|
||
What if the table is constantly being updated, or there is an expiry condition on some data which shouldn't be included? In which case, we would want to render the HTML table dynamically. It's actually quite easy to do: | ||
|
||
1. In the subcategory page in backend, set the _Description_ to this: | ||
```html | ||
{{block type="mymodule/mytable" template="mymodule/mytable.phtml"}} | ||
``` | ||
2. Continue on to the _Display Setings_ tab and set the _CMS Block_ to _Please select a static block ..._. | ||
3. In our config file, either in the module `etc/config.xml` or in the `local.xml`, insert the following: | ||
|
||
```xml | ||
<config> | ||
<global> | ||
<catalog> | ||
<content> | ||
<tempate_filter>cms/template_filter</tempate_filter> <!-- Note the typo on template must remain as "tempate". --> | ||
</content> | ||
</catalog> | ||
</global> | ||
</config> | ||
``` | ||
|
||
That's it, the table is now rendered dynamically. There 's no need to create the CMS static block. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
--- | ||
tags: | ||
- Guides | ||
--- | ||
|
||
# Guides | ||
|
||
**Guides** are focused on accomplishing a specific task and assume that you are | ||
already familiar with the basics of OpenMage. If you're looking for an | ||
introduction to packaging, see :doc:`/tutorials/index`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
--- | ||
tags: | ||
- Tutorials | ||
--- | ||
|
||
# Tutorials | ||
|
||
**Tutorials** are opinionated step-by-step guides to help you get familiar | ||
with concepts. For more detailed information on specific | ||
topics, see :doc:`/guides/index`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
--- | ||
tags: | ||
- Modules | ||
--- | ||
|
||
# Swatches | ||
|
||
Find a good description at: https://sherocommerce.com/tutorial-configurable-swatches-in-magento/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters