While offering downloadable products in Magento, you mandate customers to login to their “My Account” section after purchase to download document, file, Ebook or any other downloadable product you sell. Whenever there are multiple version of your downloadable products available, you require users to choose appropriate version and thus you create radio buttons to opt for version selection.
As radio buttons uses large space of your product page, sometimes it looks ugly. What if you want to minimize the space allocation used by these radio buttons? You require to replace them with dropdown options. For that, you need to custom code.
Here, I’m presenting you with code to replace downloadable products radio buttons with dropdown options on Product Page in Magento:
First of all, go to app\design\frontend\[Your_theme]\[Your_package]\template\downloadable\catalog\product from Magento root. Now find links.phtml file and replace the code of the file with below custom code.
<pre class="lang:default decode:true "> <?php /* @var $this Mage_Downloadable_Block_Catalog_Product_Links */ ?> <?php $_linksPurchasedSeparately = $this->getLinksPurchasedSeparately(); ?> <?php if ($this->getProduct()->isSaleable() && $this->hasLinks()):?> <dl> <?php $_links = $this->getLinks(); if(sizeof($_links)>1):?> <?php $_isRequired = $this->getLinkSelectionRequired(); ?> <dt><label<?php if ($_isRequired) echo ' class="required"' ?>><?php if ($_isRequired) echo '<em>*</em>' ?><?php echo $this->getLinksTitle() ?></label></dt> <dd<?php /* if ($_option->decoratedIsLast){?> class="last"<?php } */ ?>> <ul id="downloadable-links-list" class="options-list"> <?php $count = 1;?> <select name="links[]"> <?php foreach ($_links as $_link): ?> <span class="label downlabel"> <?php if ($_linksPurchasedSeparately): ?> <option <?php if($count == 1):?> selected="selected" <?php endif; ?> class="radio<?php if($_isRequired):?> validate-one-required-by-name<?php endif; ?> product-downloadable-link" >The output looks like this:
Hope this blog have helped you replacing downloadable products radio buttons with dropdown options to minimize space allocation on product page. Let me know if you want more help regarding. If you find any queries, ask me anytime, I’m always there to answer you!
Happy Coding!
Click to rate this post![Total: 2 Average: 5]
In this guide, we'll explore how to integrate ChatGPT, an AI-powered chatbot, with a Laravel…
In the world of business, understanding financial metrics is crucial for making informed decisions and…
Welcome to the MageComp Monthly Digest, where we bring you the latest updates, releases, and…
In this era, businesses are always on the lookout for ways to engage with their…
Managing a Shopify store efficiently involves keeping your product catalog organized. This includes removing outdated…
E-commerce has transformed the way consumers shop for products and services and interact with businesses.…