Hello,

I wish display in a shop that works with Magento the regions of the site in the layout.

I created a node for the shop and now I want show this regions on my Magento's shop.

Is it possible to retrieve the regions (sidebar_left, sidebar_top, footer, ...)?

I have tried many things but without succes... :(
A exemple:

<?php

define('DRUPAL_ROOT', dirname(__FILE__).'/carmelocrea/');
define('DRUPAL_BOOTSTRAP_PATH', 'node/12');
require_once 'carmelocrea/includes/bootstrap.inc';
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);

print print_block('nav');
function print_block($region = 'sidebar_first') {
  $output = '';
  $block_list = block_list($region);
  //print '<pre>'.print_r($block_list, true).'</pre>';
  foreach($block_list as $block) {
	  print_r($block).print '<hr/>';
    $renderable_block .=  _block_get_renderable_array($block);
	$output = drupal_render($renderable_block);
	break;
  }
  return $output;
}

Can you help me please? Thank you very much!

Comments

Clément’s picture

Finally, I created a small function to show the blocks of a specific region based on the page seen. I hope it will help some who are in the same situation as me. ;-)

My problem is now solved.

define('DRUPAL_ROOT', dirname(__FILE__).'/carmelocrea/');
require_once 'carmelocrea/includes/bootstrap.inc';
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);

print (region_blocks_view('top'));
function region_blocks_view($region, $page = 'node/34', $theme = 'carmelocrea_1') {
  $return = '';
  $result = db_query("SELECT module, delta, visibility, pages  FROM {block} WHERE status = 1 AND theme = :theme AND region = :region ORDER BY weight ASC", array(':theme' => $theme, ':region' => $region));
  foreach ($result as $v) {
	$visibility = true;
	$page = str_replace('/', '\/', $page);
	if($page and $v->pages and preg_match('/'.$page.'/', $v->pages)) {
	  $visibility = false; // Toutes les pages sauf celles listées et PHP
	  if($v->visibility == 1) { // Seulement les pages listées
	    $visibility = true;
	  }
	}

	if($visibility) {
          $block = module_invoke($v->module, 'block_view', $v->delta);
	  $return .= render($block['content']);
    }
  }
  return $return;
}