Blogs on

Drupal 7

knackforge blog

Drupal Commerce - PayPal payment was successful but order not completed

Most of us use PayPal as a payment gateway for our eCommerce sites. Zero upfront, No maintenance fee, API availability and documentation makes anyone easy to get started. At times online references offer out-dated documentation or doesn't apply to us due to account type (Business / Individual), Country of the account holder, etc. We had this tough time when we wanted to set up Auto return to Drupal website.

Continue reading →
How to make Apache solr search programmatically from Drupal 7

Recently I came across a situation where I needed to make Apache solr search from drupal programmatically. Basically we have Apache solr module available in drupal, which enables to connect with solr for searching. There are loads of documentation for setting solr search with drupal, so instead going into those details, lets head straight to the custom code required to make programmatic solr search from drupal:

suresh Thu, 07/14/2016 - 15:07
knackforge blog

How to delete an order if the order is in cart for N days

In drupal commerce, the order will be created when a product is added to cart and the order will exist until the order is deleted or order status is changed to completed.

We have an e-commerce site in which most of the orders are idle in the shopping cart. So we decided to delete the order if the order is in the shopping cart for more than 'N' days or weeks. I have written a custom drush command for deleting the order.

The following code is used to delete an order if it is in the cart for more than 25 days.
 

Continue reading →
knackforge blog

Programmatically create and trigger feeds importer

We met with a challenging requirement where we needed to create a feeds importer on node creation of particular content type. It’s like for ‘n’ number of nodes there must be a ‘n’ number of feeds importer.

For that I created a feeds importer which will be considered as the template. Whenever the node of specific content type is created, the template will be cloned and a new importer will be created.

The following code needs to reside in hook_node_insert() and will be used to clone the feeds importer:

Continue reading →
Apache Solr View Count module

While working with Apache solr in drupal, I had to sort the results based on relevancy, date and popularity. The Apache solr sort module allowed me to sort based on relevancy and date, but sorting based on popularity wasn't available. What I mean by sorting based on popularity is that sorting based on the view count of each result.

suresh Thu, 04/21/2016 - 10:16
CDN Module, and Amazon Cloudfront in Drupal 7

Recently I decided to check out Amazon CloudFront to use it as a CDN. I felt delighted as it was so easy to setup with drupal and configuring it involving just a few steps. Another thing that excited me was its cost. It is really really cheap, just costs about 12 cents per gigabyte of transfer.

Step 1: Create a CloudFront Web Distribution

     To create a CloudFront web distribution

Karalmax Wed, 04/06/2016 - 17:42
Drupal moodle integration

We got an interesting requirement, to integrate Drupal and Moodle (Totara actually) in order for a nice combination of CMS features and LMS features. The integration should follow SSO, where a user logged in Drupal should automatically be logged in Moodle.

We decided to use existing plugins as much as possible along with additional customization wherever needed.

selvam Wed, 04/06/2016 - 16:30
How to get Microsoft office files downloaded properly through Drupal

I recently came across situation where the .ppsx files were displayed as some weird characters instead of getting downloaded. For those who aren't aware of the .ppsx file extension, it is nothing but the extension for files created through Microsoft PowerPoint. You can find more information about the Powerpoint file formats here.

suresh Tue, 03/08/2016 - 17:45
knackforge blog

Drupal Views exposed filter as Links

In Drupal views, we have the option of exposing the filters to users. By default, the exposed filters are displayed as Select boxes. Recently in a multilingual project, there was a requirement to display Courses based on Language. And the Languages had to be shown as links. In order to achieve this functionality, the Views exposed filter had to be customized.

To start with the customization, we need to alter "views_exposed_form" using hook_form_alter

Continue reading →