Thursday 21 August 2014

On 23:21 by Unknown in , ,    3 comments
Static blocks are very useful tools in Magento. We can effectively use them in different situations. They provide us enough power on content management. However I felt it lacks with something. It can show its content only in boring text format. If we are planning to use multiple static blocks in a page, then we will definitely seek for adding css and js for static block contents. However if we are planning to do it in the most effective way, we can't achieve this functionality in one step. For this small (some time big) headache, I decided to make an end. It results in a tiny magento extension Rkt_JsCssforSb.

What it does

This extension functionality is simple. For every static block, you can see a section for put javascript and css. You need to put css and js in those text areas. Rest will do by the extension. You don't need to put script and style html tag enclosures inside text area. This job will effectively carry out by extension. Css that added for static blocks will get append to head section and scripts will go to bottom section in body part.

In deep

Static block are least considered section in magento code wise !. I am telling this because, during the development of this extension, I have found out that, there are no static block specific events available. However cms pages has lot of events available. Also model of static block is somewhat "weak" when compare with other entity models! For example, there is no event prefix available for static blocks. This made me in serious trouble and as a result, I have done a model rewrite during the development of the extension. I know its bad. But I forced to do it. Along with this, I am observing to three events in order to make the work done.

But I personally believe this extension is highly useful. Since it makes static block somewhat "dynamic". We can set css and make static block content look nice and by applying some js , we can make those contents dynamic etc.

I am waiting for your feedbacks about this extension. Currently the extension is available on GITHUB and soon it will available in Magento connect. Hope you will use it.

Useful Links

  • http://stackoverflow.com/questions/17832914/how-do-i-extend-cms-block-on-save-event-of-magento
  • http://magento.stackexchange.com/questions/32324/how-to-check-whether-a-block-exist-based-on-its-type

3 comments:

  1. De mogelijkheden zijn ongekend en niet onopgemerkt gebleven. Op dit moment zijn er wereldwijd al meer dan 100.000 Magento webshops online en dit aantal groeit iedere dag. Met elkaar genereren deze Magento webshops al meer dan 30 miljard euro! Deze explosieve groei kenmerkt de kracht van Magento. Here are Nieuwe Magento shop,Magento onderhoud,magento update and magento webshop.

    ReplyDelete
  2. Hi! I have 1.5 years experience. I search in Google so Many Websites & Blog but you’re blog and post really is too good its title, description, images your content style is really good and I feel glad when post read Magento CMS Development

    ReplyDelete
  3. By using it, your products can be seen by a large market without your employees or you spending money to do any marketing. One of the major advantages of online shopping is that you can reach out to millions of people. Get more interesting details about progressive web app check this site.

    ReplyDelete