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 🙂


Installing Magento Extensions Via SSH


If you find that whilst trying to run any sort of mage command via SSH you get   ./mage:  Permission denied

then try the following:

rm -rf var/cache var/session
chmod 550 ./mage
./mage mage-setup .
./mage config-set preferred_state stable
./mage install Mage_All_Latest --force

Hopefully that should fix it!

Zip File Corrupted in Magento Downloadable Product


Late Ramadhan Mubarak infact very late May aswell wish you all a Eid Mubarak at this stage!

Anyway heres a  problem i was scratching my head over

We tend to use Magento CMS System for our E-commerce based website and for (Some Great Nasheeds there btw do check it out :D)

Anyway We offer the option of Digital Download for our mp3 products so people can purchase single tracks or the entire album

So we had a few issues from customers when they purchased the full album which was infact a .zip file containing all the mp3 tracks in there that after they downloaded it the file was corrupted and could not open it, this was only after being redirected the the product download link via their control panel in magento

Tried downloading it directly from the link works fine…

so it must be the way Magento is translating the URL for download (It does not give the direct URL for good reason) it comes with a different URL with a bunch of random generated characters which is good

But anyway there was a few suggestions on the internet floating around about changing .htaccess files and messing about with them …tried it all did not work

Then realised that When magento passes the URL it Compresses it again

So we already had a zip file with the mp3 that was compressed… when a customer purchases the the .zip file it does it again

So the best solution for this is that if you need to upload a Zip file ensure that NO COMPRESSION is set from winrar you choose “No Store” or winzip “No compression” upload it and it worked!

Yes file sizes are larger but if you cant be bothered messing around with .htaccess files etc then this is a workaround that works


Wassalam for now!