Drupal 7
more_horiz
close

on 05th December 2017 / by aby.va
For a recent Drupal project there was a requirement to find the pages that a user visits on the site and send that to Google Analytics. Here, first we should save the page links that the user visits. But for this we need, To know when a tab is closed To know when a page is reloaded To know when the browser is closed In JS there is a browser close event onbeforeunload. In the onbeforeunload callback function enter your code before the return value. The onbeforeunload event sets a pop up box with a browser closing dialogue. The dialogue is the return value of callback function of onbeforeunload. If we put the return value to "null" then the popup box will not display at the browser closing time. (function ($) { Drupal.behaviors.page_load_progress = { attach: function (context, settings) { window.onbeforeunload = close_event_function; function close_event_function() { //Enter your code before run window close; return null; } } }; }(jQuery));The return value is very important in this onbeforeunload callback function. Hope this article helped :) Javascript Drupal 7 Leave a reply Your email address will not be published. Required fields are marker *
more_horiz
close

on 29th November 2017 / by thomas.john
This article will explain, how to display mouse over image for a gallery block image or on any content image in Firefox Web Browser. While working on a project my requirement was to display a mouse over image, say 'View More' image for the last image in gallery block. For the mouse hover in image tag, I added a background image. See the code below. HTML Code for Image <ul> <li class="even first"> <a href="/media-gallery"> <img width="100" height="100" alt="" src="media-gallery-1.jpg"> </a> </li> <li class="odd last"> <a href="/media-gallery"> <img width="100" height="100" alt="" src="media-gallery-2.jpg" > </a> </li> </ul>CSS Code ul li.last a img { position: relative; z-index: 10; opacity: 1; filter: alpha(opacity=100); } ul li.last a img:hover { content: " "; z-index: 100; display: block; top: 0; left: 0; right: 0; bottom: 0; background-image: url("../images/view_more1.png"); opacity: 0.3; filter: alpha(opacity=30); height: 100px; width: 100px; }Here the problem was that, the mouse hover image was getting displayed on every browser except on Firefox Web Browser. When I inspected the element, I found that my CSS was called properly, but the background image was not coming up. I tried many options but the results were same, in the Firefox Web Browser, image was not getting displayed. I even set the mouse hover image on a tag, but still the background image was not coming up. It was because for the Firefox Web Browser, the main image always comes in front. So along with adding mouse hover image on a tag, I added a display none for the image on hover and solved the issue. Checkout the CSS below. ul li.last a { position: relative; z-index: 10; opacity: 1; filter: alpha(opacity=100); } ul li.last a:hover { content: " "; z-index: 100; display: block; top: 0; left: 0; right: 0; bottom: 0; background-image: url("../images/view_more1.png"); opacity: 0.3; filter: alpha(opacity=30); height: 100px; width: 100px; } ul li.last a:hover img { display: none; } CSS Drupal 7 Firefox Leave a reply Your email address will not be published. Required fields are marker *
more_horiz
close

on 21st November 2017 / by safallia.joseph
I came across a situation in my recent project, where user roles other than admin have to access the admin pages. The default admin theme was not provided for the admin pages in which the user role is not admin. Drupal has a module which allows us to add the admin theme to specific pages irrespective of the user role. Below are the steps which I followed to achieve this. Downloaded and enabled the module Administration theme Go to page admin/appearance. There will be a "custom" option in the bottom of the page. You will find specific text boxes to enter the pages where the admin theme need to be displayed and where the admin theme does not need to be displayed. Hope this helps someone. Drupal 7 Leave a reply Your email address will not be published. Required fields are marker *
more_horiz
close

on 20th November 2017 / by anu.mathew
Administration Menu Source module is used to display different menus based on the roles existing in the system. This module is only available in Drupal 7. We can install the module using the following steps : Installation Download Administration Menu Source module. Extract and enable the module. Required modules Administration Menu System Set up the configuration from admin/config/administration/admin_menu/source. From this page you can set up the menus based on the roles, please refer the image. Give permission to all roles to view admin menu, permission named as 'Access administration theme'. Now you will be able to see different menus when logged in under different user roles. Drupal 7 Leave a reply Your email address will not be published. Required fields are marker *
more_horiz
close

on 17th November 2017 / by anu.mathew
Views query alter is used to edit the query in views that we created using Drupal. In cases where we cannot add fields in views, we can use hook_views_query_alter to change the query in views. Example of views query alter by using join. function MY_MODULE_views_query_alter(&$view, &$query) { // Filter based on todays date - added for making conditions. $todays_start_time = mktime(0, 0, 0, date("m") , date("d"), date("Y")); $todays_end_time = mktime(0, 0, 0, date("m") , date("d")+1, date("Y")); // Write the join conditions. $join = new views_join(); $join->table = 'field_data_field_order_selected_date'; $join->field = 'entity_id'; $join->left_table = 'commerce_order'; $join->left_field = 'order_number'; $join->type = 'LEFT'; // Append to current query. $query->table_queue['field_data_field_order_selected_date__commerce_order'] = array ( 'table' => 'field_data_field_order_selected_date', 'alias' => 'field_data_field_order_selected_date', 'relationship' => 'commerce_order', 'join' => $join, ); // Add extra where conditions. $query->where[] = array( 'conditions' => array( array( 'field' => 'field_data_field_order_selected_date.field_order_selected_date_value', 'value' => $todays_start_time, 'operator' => '>', ), ), 'type' => 'AND', ); $query->where[] = array( 'conditions' => array( array( 'field' => 'field_data_field_order_selected_date.field_order_selected_date_value', 'value' => $todays_end_time, 'operator' => '<', ), ), 'type' => 'AND', ); }Here we added join using class views_join in Drupal. It's a built-in function to represent a join and to create the SQL necessary to implement the join. Drupal 7 Leave a reply Your email address will not be published. Required fields are marker *
more_horiz
close

on 16th November 2017 / by aby.va
Deleting a content type in Drupal 7 is very simple. We just go to admin/structure/types and click delete button of the content type which we need to delete. But in the case of Ubercart, there is no delete link in product content type (admin/structure/types). So how we can delete this? Steps to delete ubercart product content type : Delete the uc_product from ubercart store For this first go to admin/store/products/classes. There we can see the uc_product lists. Click the delete button of the content type which we need to delete. Delete the content type of uc_product from structure For this, go to admin/structure/types and click delete button of the content type which we need to delete. We can see two content types like product and product kit in the content type lists. These are uc_product content types and these two are default uc_product content type of ubercart so these cannot be deleted by configuration or other ways. Hope this article helped :) Drupal 7 Ubercart Leave a reply Your email address will not be published. Required fields are marker *
more_horiz
close

on 13th November 2017 / by safallia.joseph
Have you ever found it difficult to access a private file within Drupal? Then read on. Below are the steps I followed to create and access the private file. In file system configuration page (/admin/config/media/file-system), I defined private files path to be 'sites/default/files/private'. Downloaded and enabled the module Private Files Download Permission. In Drupal permission setting page (admin/people/permissions), gave the permission 'Bypass Private files download permission' to the user role who should be able to access the private files. Now I'm able to access the private file using the URL '/system/files/my-file-name'. Need help with your Drupal development work? Get in touch with us! Drupal 7 Leave a reply Your email address will not be published. Required fields are marker *
more_horiz
close

on 08th November 2017 / by fazeela.ma
To render a block, a few methods are used. One way to render is to use block_load() function. In order to render a block, the following syntax is used, if ($type == 'block') { $module = 'views'; $bid = 'home_page-block_13'; $block = block_load($module, $bid); $replacement = render(_block_get_renderable_array(_block_render_blocks(array($block)))); }For block_load(), two parameters are passed. The first parameter is the module providing the block or the module used to create the block. The second parameter is the id of the block. This is how an edit url of the block appears. admin/structure/block/manage/views/home_page-block_13/configure It is easy to identify the first and second parameters from the URL, just after 'manage' would be the module used to create the block, and next would be the block id. To render the block, render function along with _block_get_renderable_array and _block_render_blocks. This will render the block to the node page. Happy coding. Drupal 7 Leave a reply Your email address will not be published. Required fields are marker *
more_horiz
close

on 19th July 2017 / by wellme.m
For one of my project, I have implemented the Chosen module to display a list of content in a select box with user-friendly option style. I used the following configurations: First I downloaded Chosen module for a Drupal 7 environment and stored it in 'sites/all/modules/contrib' directory and enabled the same. For the working of Chosen module we need its libraries, so first you have to download the libraries API, save it in 'contrib/' folder and enable the same. Then download the Chosen JavaScript file from https://github.com/harvesthq/chosen/releases. Extract the entire contents of the archive into the 'sites/all/libraries' directory on your site. In the Chosen configuration form (admin/config/user-interface/chosen) fill the necessary settings. Hope this is useful. Drupal 7 Leave a reply Your email address will not be published. Required fields are marker *
more_horiz
close

on 11th July 2017 / by webmaster
Many Drupal users wanted to know if there was a functionality similar to UberCart test_gateway for Drupal Commerce for emulating the collection of credit cards. If you are faced with the same question while running Drupal Commerce on your Drupal site then read on to know the possible solutions. The Drupal Commerce Kickstart module has the Commerce Kickstart Payment Example which provides exactly the same functionality. You can simply obtain it from the Commerce Kickstart repository and you are good to go. Hope that helps. The easiest way to solve a Drupal issue is to hand it to the Drupal experts. We can provide a wide range of Drupal services to help you maintain and manage your Drupal websites. Get in touch with us to know more. Reference: http://drupal.org/node/1781508 Drupal Drupal 7 Drupal Issues Drupal Commerce Kickstart Leave a reply Your email address will not be published. Required fields are marker *