Request Sample for Magento with Yes / No Attribute

Salams All

Currently we are redoing Website and they are using Magento ( :D) for their catalog

They sell mainly lovely nice Attars, Fragrances and Bakhoors as well as other stuff like Bakhoor Holders etc

So…On their website they wanted to offer the option for Customers to Order Samples of Certain Fragrances which they then ship out to customer

HOWEVER these samples were not applicable for all products for example Bakhoor Holders its a physical holder and you can’t really have samples for that lol!

Anyway Used the ParadoxLabs Request Sample Plugin which works a treat (Link here btw ) Big thanks for a lovely plugin

but this required a bit of small customisation from ourside to achieve what we wanted


Ok Step one

We Create attributes from Magento Backend

> Admin > catalog > Manage Attributes > Create new attribute

Attribute code: samplerequest

Scope: store view

Default Value: YES

Unique Value: NO

Catalog Input Type for Store Owner: YES / NO

Values Required: YES

Leave the rest upto you or as it is


Manage Label Option Tab: Request Sample link?  (Or you can put down whatever you want meaningful to you)

Then Save

Then Catalog > Attributes > Manage Attributes Set

Choose Default Set

Unassigned Attributes you find samplerequest there simply drag it across to under General or wherever you want to put it

reload your cache and you will now find that there is a new field which says “Request Sample link” and a drop down either Yes or no

Now We Browse the template file

Edit default.phtml (Or whatever template file you want

Then we add this Code right at the bottom

<?php if ($_product->getAttributeText(‘samplerequest’) == “Yes”): ?>
<p class=”availability in-stock”><a href=”<?php echo Mage::getBaseUrl(); ?>requestsample/?id=<?php echo $_product->getId() ?>”>Request a Sample</a></p>
<?php endif; ?>

The Bit in Orange is the code provided by the Plugin and the one above we did ourselves

So basically what this code says is that if “samplerequest” is set to YES then run the code in orange which is basically the request sample link and if set to no then display nothing


hope this helps 🙂


Magento Woes!


We are currently designing a few E-commerce based websites using Magento! Installed through softaculous

Installation went fine and the software is really good although it can be a bit of a fiddle to find your way around

Anyway Aside from that we can across a few very puzzling Errors

Each time we tested it out by adding items in the checkout if you go checking out it returns with error 500!

Cpanel Log showed “client Denied access by Server” Some help that was!

So then you can take a look at the actual Magento error log itself located in your magento directory called error_log

this showed

[05-Nov-2011 14:14:42] PHP Fatal error:  Allowed memory size of 42991616 bytes exhausted (tried to allocate 7680 bytes) in /home/nasheedc/public_html/portal/app/code/core/Mage/Directory/Model/Resou$
[05-Nov-2011 14:14:47] PHP Fatal error:  Allowed memory size of 42991616 bytes exhausted (tried to allocate 491520 bytes) in /home/nasheedc/public_html/portal/lib/Zend/Date.php on line 1591

Creating a PHP INI file and sticking it in root of magento is the way to go (the file code is below whcih you can use)

However when uploading it we came across the following error message

There has been an error processing your request
Exception printing is disabled by default for security reasons

Error log record number: XXXXXXXXXXXXXXX


PDO Extension not Loaded Error

NOW what you need to do is create a php.ini file and copy the following down upload it to root of magento installation

; This file is for CGI/FastCGI installations.
; Try copying it to php5.ini, if it doesn't work

; adjust memory limit

memory_limit = 64M

max_execution_time = 18000

; disable magic quotes for php request vars

magic_quotes_gpc = off

; disable automatic session start
; before autoload was initialized

flag session.auto_start = off

; enable resulting html compression

zlib.output_compression = on

; disable user agent verification to not break multiple image upload

suhosin.session.cryptua = off

; turn off compatibility with PHP4 when dealing with objects
zend.ze1_compatibility_mode = off

; PHP for some reason ignores this setting in system php.ini 
; and disables mcrypt if this line is missing in local php.ini


The Key to this file is to add the 3 Extension code about in your PHP File and Voila! it worked Alhumdulillah!



[ipcheck] Problem with DNS setup – Fix email

One of our servers new one decided to really annoy us by sending us [ipcheck] Problem with DNS setup Emails!

The Email read as…

[ipcheck] Problem with DNS setup on
IMPORTANT: Do not ignore this email.

Your hostname ( could not be resolved to an IP
address. This means that /etc/hosts is not set up correctly, and/or
there is no dns entry for Please be sure that
the contents of /etc/hosts are configured correctly, and also that
there is a correct ‘A’ entry for the domain in the zone file.

Some or all of these problems can be caused by /etc/resolv.conf
being setup incorrectly. Please check that file if you believe
everything else is correct.

You may be able to automatically correct this problem by using the
‘Add an A entry for your hostname’ option under ‘Dns Functions’ in
your Web Host Manager.

After trying to figure what the problem was and why certain people around the world i’d say maybe 3% could not access our website the fix was the following (useful if anyone else is having the same problem)

Login to SSH

cd /etc
pico resolv.conf

Ensure that the contents of it is the following (obviously replace yourdomainane.ext with your own)

search yourdomainame.ext
domain yourdomainane.ext
Save this Ctrl + o

Then open your hosts file
pico hosts
(this should be in etc directory)

Ensure contents are like the following:

# Do not remove the following line, or various programs
# that require network functionality will fail.               localhost.localdomain localhost
xx.xx.xx.xx          hostname.domainanme host
xx - Enter your MAIN Server IP Here
Replace Hostname with hostname
for example server

server being the host 
again save
then run /scripts/ipcheck

Hopefully you should not get any more error messages!

Shoutcast Keeps closing When Exiting Putty


As you know we do Radio Streaming and its popular at the moment with Masjids using the streaming service to stream their programmes/Khutbas/Lectures/Salaah over the Internet! If you are interested do contact us inshallah .

But anyway one of the really annoying thing is when for whatever reason you need to restart the shoutcast server through SSH and Putty as soon as you exit Putty the Shoutcast Server goes down

usually a command such as

./sc_serv & does the trick but sometime it doesn’t

Since we have multiple streams on the Server doing this one by one is not ideal! So on the server you want to add this to the rc.local file normally found at

cd etc/rc.d/

then look for file called rc.local and edit it then enter the shoutcast command you wish to start so for example you would enter a line like this in the file

/home/accountname/public_html/path/to/shoutcast/file/;./sc_serv &

then once server is started again then it will start up automatically however its not IDEAL to keep rebooting the server


so this is what you do

ps aux | grep sc_serv

this will find all processed running sc_serv which is shoutcast server

take a note of the port number

then type in top

this will then show current running processes

type in k

then type in process id confirm and kill it!

Now what i did was created a cron job via cpanel on where shoutcast was installed so you enter this as

/home/accountname/public_html/path/to/shoutcast/file/;./sc_serv &

run it every  minute…then shoutcast server should run back up again! then delete the cron job

cheeky way of doing it but thats the only way i found out how to run shoutcast again without closing putty down !



One ISP in UK TalkTalk all of a sudden decided to 404 any websites hosted on our Server as well as several servers hosted by our main datacenter liquidweb.

Why this happened all of a sudden is beyond me! Since we have several customers in the UK who use TalkTalk as their phone line these customers found that they could not longer access nothing! Their Website nor the Main MPADC Website!

Checking the web logs it went down in the morning – decide to come back on again briefly for about an hour or so then down again then up again until kicking the bucket around 2pm!

So after spending the last 8 hours trying to figure this out still t he site is inaccesible

Since im Using Virgin as the main ISP everything is working fine and cool!

After having several discussion with our techies as well as the Systems administrators (The Top guys over at our Datacenter) There was absolutely nothing wrong with our servers or network despite being convinced it was our firewall blocking this ISP out – this wasnt the case since the server must have gotten checked through by atleast 4 different people!

So we ring talktalk after being on hold for 30 mins then someoen appeared on the other line for about 30 seconds then she vanishes again and returns back after 37 minutes and say “Problem at our side, will check with our security company will call you back”

Now whether they call back is another mystery since in past experience talktalk have been awful!

Do a google on Talktalk reputation and you see how awful they are………