How to add “order a free sample” to a magento store

As always there are more than one way of doing things and over the last few months I have tried a few of the options based on client needs. Firstly I went through the process of having a sample product in the catalog as well as the original but priced at zero and free shipping, but when you have several 100/1000’s of products this becomes unmanageable.

I then went through the “customized php script route” following along the lines of this blog post from Robert Kent with some particular modifications for the client – which was fine until we started to do more advanced checkout options and the script option fails with this process.

Recently settled on this module “Request a Sample” with some customisations. As a free module it should carry a health warning – poor documentation! Hats off to companies that give away work for free but as can be seen from comments and reviews time and time again – document how these things work!! So, I will try and explain exactly how to use this module and modify it to use an image such as free-sample instead of a text link and also how to customize the “order sample” form.

First of all, the two environments I have installed the module in –

  1. WAMP – Windows 2003 Server Web Edition SP2, Apache 2.2.22, MYSQL 5.5.25a, PHP 5.4.4
  2. (L)AMP – FreeBSD 9.1-RELEASE FreeBSD 9.1-RELEASE #0 r243825, Apache 2.2.23, MYSQL 5.5.29, PHP 5.4.11

Both configurations are running Magento

Installation Step 1 – Magento Admin

  • Obtain a licence key link from here – copy and save this link in a text file using notepad for future reference
  • login to your magento store admin panel
  • Go to System -> Magento Connect -> Magento Connect Manager
  • Login with your store admin username/password
  • In the box “Paste extension key to install:” copy the link from your saved textfile e.g.


  • click Install
  • click Proceed
  • then go to the top of the browser window and click “Return To Admin”
  • Back in the admin system, go to System -> Configuration, then choose the Contacts menu under the General section and enter an email address to “Send Sample Requests to”


  • Click on “Save Config”
  • If you use multiple stores and want emails to go to different store email addresses then you can change the “Current Configuration Scope” and change each email address you want

Installation Step 2 – Magento Front End Changes

The default setup instructions here say “In /app/design/frontend/base/default/template/catalog/product/view.phtml , add this before the ‘Email to a Friend’ link:” which is not very useful!

  • edit & save /app/design/frontend/<THEME>/default/template/catalog/product/view.phtml and add the following to create a “text-based” link similar to “Email to a Friend” underneath the<?php endif; ?> line under ‘Email to a Friend’

<a href=”<?php echo Mage::getBaseUrl(); ?>requestsample/?id=<?php echo $_product->getId() ?>”><?php echo $this->__(‘Request A Free Sample’) ?></a><br />

  • OR if you’d like to use an image instead, create an image and upload to /media/ and use the following code instead

<a href=”<?php echo Mage::getBaseUrl(); ?>requestsample/?id=<?php echo $_product->getId() ?>”><img src=’/media/free-sample.png’ /></a><br />

  • edit & save /app/design/frontend/<THEME>/default/template/catalog/product/list.phtml if you want to create the link in category list view (in 2 places in file)
  • If you’d like to customise the “requestsample” form then edit the following file – appdesignfrontenddefaultdefaulttemplaterequestsamplerequestsample.phtml and maybe change the country drop down list (e.g. to UK only) – line 142 to

<select id=”country” name=”country”><option value=””> </option><option value=”GB”>United Kingdom</option></select>

  • or change line 73 to change the text “There is never …” etc


That’s about it to use this module successfully BUT remember this solution will provide a free sample for EVERY product in the catalog.

Blogger, Writer, SEO Consultant, Litigant In Person, SMM Consultant, Web Researcher

Tagged with: , ,
3 comments on “How to add “order a free sample” to a magento store
  1. Ravi Agravat says:

    thank you,

    This isn;t working for following your steps. I’ve added your text link in – but no luck?

    Any ideas?

  2. Hope this is the fix Ravi –

    1) I disabled magento cache first – System -> Cache Management -> Select All – Actions Disable -> Submit
    2) In view.phtml you had some strange characters (probably cut and paste errors – always copy to notepad first) –
    a. <a href=”requestsample/?id=getId() ?>”>__(‘Request A Free Sample’) ?>
    b. <a href=”requestsample/?id=getId() ?>”>__(‘Request A Free Sample’) ?>


Leave a Reply