Search This Blog

Wednesday, 21 February 2018

Drupal 8 ecommerce

 Install Drupal 8 ecommerce Ubuntu system


First install : address module and dependencies via composer



use Composer to

download the module, which will also download the required libraries:


write following command in terminal:

   composer require "drupal/address ~1.0"
 
~1.0 downloads the latest release, use 1.x-dev to get the -dev release instead.

to update
Use

composer update drupal/address --with-dependencies



If you get following error
Error: BC math PHP extension not found
Need to run this command: sudo apt install php7.0-bcmath After it apply this command: sudo service apache2 restart
Note: This command is for PHP 7


Then download commerce module and enable in Drupal 8 extend

Tuesday, 20 February 2018

Basic code for drupal 7

To apply database simple query for getting node title.
Query: To print node title with term id 2

Table format is as follow:
Node Table:


taxonomy_index Table:


taxonomy_term_data Table:


Result:




<?php
function general_menu() {
 $items['first'] = array(
   'title' => 'First Page',
   'page callback' => 'first_page',
   'access callback' => TRUE,
  );
 return $items;
}
function first_page(){
 $query = db_query("SELECT taxonomy_index.nid
      FROM taxonomy_index
      JOIN taxonomy_term_data ON taxonomy_index.tid = taxonomy_term_data.tid
      WHERE taxonomy_index.tid=2")->fetchAll();
 $output = '';
 $nid = '';
  foreach($query as $results){
   $nid = $results->nid;
   $query2 = db_query("SELECT * FROM node WHERE nid = :nid", array(':nid' => $nid));
   $title = '';
   foreach($query2 as $result2){
    $title .= $result2->title;
    $output .= $title.'<br>';
   }
  }
 return $output;
}

There is other solutions too like from hooks. I have only described one of the method.

Monday, 19 February 2018

USEFUL SITE FOR DRUPAL




1.   https://sqndr.github.io/d8-theming-guide/twig/twig-basics.html


2. Useful Video links :

About Composer:

https://drupalize.me/videos/wonderful-world-composer

3. Restricting Access to Drupal 8 Controllers
https://atendesigngroup.com/blog/restricting-access-drupal-8-controllers

First HTML blog

Hello there


echo 'dddd';
?>

Js to show Hide Content

Js: var showChar = 250;  // How many characters are shown by default     var ellipsestext = "...";     var moretext = "Sh...