Articles in this series

Author - Robert Popovic

Founder and Technical Director of LERO9, a web agency specializing in Magento and WordPress design and development.

I launched Magebase in April, 2010 and am its editor and contributor. My main topics of interest are Magento development, customization and how to get the most out of Magento with the least amount of headache.

More Info » Follow me on Twitter »

Reader Comments (11)

  1. David
    September 22, 2010 at 8:15 am /

    WOW! This is fantastic… Thank you so much for sharing such a great home made tool, exactly what I was looking for…

    Reply
  2. Moogento
    December 19, 2010 at 12:39 am /

    Or, for an easy drag and drop solution, we have just released our mooTestimonials extension. It has things like:
    – gravatars for reviewers
    – auto footer link
    – auto sidebar mini-testimonial display
    – auto-approval and auto-disapproval
    – simple, easily-customised design
    Check: http://www.moogento.com
    🙂

    Reply
  3. rahul
    rahul
    April 26, 2011 at 11:53 pm /

    hi robert i am new for magento, i wanna display random testimonials in my home page and i dont understand second point in ur 1tutorial. how can i create the several blocks with different id’s, if u place some examples its lot of help ful to me. one more thing is i need to create different blocks in same .phtml or another .phtml file… below i placed my code by which i was facing problem.. can u plz help to me…

    getLayout()->createBlock(‘cms/block’)->setBlockId($this->getIdentifier().mt_rand(1, $this->getNumber()));

    $_block = $this->getLayout()->createBlock(‘cms/block’)->setBlockId($this->getIdentifier().mt_rand(2, $this->getNumber()));

    $_block = $this->getLayout()->createBlock(‘cms/block’)->setBlockId($this->getIdentifier().mt_rand(3, $this->getNumber()));
    if ($_block) :
    ?>

    getTitle(); ?>

    toHtml(); ?>

    One of the features we wanted our new home to
    havewas a Great Room; a wide open space where any
    number of people can gather.We looked everywhere
    for a rug large enough for the room. It wasn’t
    until we found Medallion,who specializes in
    oversized and palace sized rugs, that we found what
    we were looking for.

    getTitle(); ?>

    toHtml(); ?>
    For this approach, we will use the Magento curly braces
    syntax to insert the block into the page itself. This is
    useful if you want to drop a random testimonial into your
    customer services pages, for example.

    getTitle(); ?>

    toHtml(); ?>

    It will become apparent in the next step where the values
    for these properties come from. Now, we can decide where to
    call the phtml block from.

    Reply
  4. rahul
    rahul
    April 27, 2011 at 4:36 pm /

    hi robert i am new for magento, i wanna display random testimonials in my home page and i dont understand second point in ur 1tutorial. how can i create the several blocks with different id’s, if u place some examples its lot of help ful to me. one more thing is should i need to create different blocks in same .phtml or another .phtml file…can u plz help to me.

    Reply
  5. rahul
    rahul
    April 27, 2011 at 5:14 pm /

    Thanku very much robert for ur reply and actually i am new to magento and had entered few days back. i need to display the testiomonials in my site for every refresh of a page.. really ur article very helpful. i created 3 testiomonials with testiomonial-1, testiomonial-2, testiomonial-3 in the app\design\frontend\task\themehotwater\template\myrandom\random_testiomonial and i download the random testomonial extension file which u provided in second tutorial and copy n paste files in my magento according to those folders.. those testiomonials are displaying in my page which i hav created but how could i restrict number of testiomonials to be display for a page… Means for example if i created 6 testiomonials and need to display 3 testimonials each time, when i refresh the page remain 4, 5, 6 testimonial will display on page instead 1,2,3 testimonials..

    Thanks in advance,
    rahul

    Reply
  6. rahul
    rahul
    April 27, 2011 at 5:15 pm /

    here i placed my random_testiomonial code and i created 3 testimonials but don’t know whether it is right or wrong…. if i made any mistake could u plz give step by step procedure how to create multiple testiomonial blocks and its very helpfull to me………

    getLayout()->createBlock(‘cms/block’)->setBlockId($this->getIdentifier().mt_rand(1, $this->getNumber()));

    $_block = $this->getLayout()->createBlock(‘cms/block’)->setBlockId($this->getIdentifier().mt_rand(2, $this->getNumber()));

    $_block = $this->getLayout()->createBlock(‘cms/block’)->setBlockId($this->getIdentifier().mt_rand(3, $this->getNumber()));
    if ($_block) :
    ?>

    getTitle(); ?>

    toHtml(); ?>

    One of the features we wanted our new home to
    havewas a Great Room; a wide open space where any
    number of people can gather.We looked everywhere
    for a rug large enough for the room. It wasn’t
    until we found Medallion,who specializes in
    oversized and palace sized rugs, that we found what
    we were looking for.

    getTitle(); ?>

    toHtml(); ?>
    For this approach, we will use the Magento curly braces
    syntax to insert the block into the page itself. This is
    useful if you want to drop a random testimonial into your
    customer services pages, for example.

    getTitle(); ?>

    toHtml(); ?>

    It will become apparent in the next step where the values
    for these properties come from. Now, we can decide where to
    call the phtml block from.

    Thanks,
    rahul.

    Reply
  7. rahul
    rahul
    April 28, 2011 at 5:14 pm /

    hi robert this article is very superb working like a charm.. but it not displaying my block titles, always displays ” What Customers Say…” for every testiomonial when page refresh. how could i get those titles which i give in cms static blocks title field… thanks for u r article buddy……..

    Thanks,
    rahul.

    Reply
  8. Hrishikesh
    Hrishikesh
    May 27, 2011 at 5:29 pm /

    Thanks a lot man, this tutorial very useful for me. please continue …..

    Reply
  9. emil
    December 12, 2011 at 6:41 am /

    Hi, and thanks for such a good tutorial.
    I have installed the extension and it works. But I can not make it to show on the home page.
    Best regards

    Reply

Add a Comment & Join the Discussion

Insert small snippets of code by using [code]{your_code_here}[/code]
For larger code blocks please use http://pastebin.com and paste your link.

You may also use the following HTML in your comment: <a href="" title=""> <abbr title="">
<acronym title=""> <blockquote cite=""> <cite> <em> <strike> <strong>