Web2make blog

03/25/2010 - 16:17

Today one of our clients wanted us to enhance product selector autocomplete field, and instead of displaying product name it should display name with product thumbnail. First thing on my mind was, its gonna take time + lot of AJAX and Jquery.

But as always in Drupal there is a module that does that! Half an hour later I delivered enhanced autocomplete to my client!

Here is how I did it:

  1. Download Finder module and enable Finder, Finder autocomplete and Finder node.
  2. Go to admin/build/finder and add new Node finder
  3. In settings check "Form on page" option and add autocomplete element/
  4. In autocomplete element field set this fields as per your needs. In my case it was:
  5. Restrict nodes that can be found to only these content types: Product
  6. Find items by this field: Node:Title
  7. Save it.
  8. Open finder_autocomplete.module in editor and edit theme_finder_autocomplete_suggestion function. In here you can...
01/31/2010 - 16:17

Edit your block and select "Show if the following PHP code returns TRUE (PHP-mode, experts only)"  and insert following php code:

<?php

//Read URL
$path=$_GET['q'];

//If URL is node page

if ( strpos($path,'node')===0){
//Parse URL to get nid
$links=explode("/",$_GET['q']);
$nid=$links[1];

//Load node

$node=node_load($nid);

//Display block only if node is of certain content type
if($node->type=='YOUR CONTENT TYPE'){
return TRUE;
}
}

return FALSE;
?>
01/22/2010 - 19:32

The easiest way to export is to use command prompt (cmd):
mysqldump -u USER -p PASSWORD DATABASE > filename.sql

To import database from dump file use:

mysql -u username -p password database_name < filename.sql

01/13/2010 - 16:12

When you install Wysiwyg module and one of its editors some time if you are trying to do some decoration to text it works in editor but when saved on node all styling is lost!

But there is an easy problem on how to solve this. Just go to site configuration -> input format, and disable html filter.

If you still need to use HTML filter than you can install WYSIWYG filter