BM positions for specific pages, products etc

Go to core/classes/bm/location.php and add the following lines in the get() func near line 70 after:


<br />
$dynamic_object_condition = "";<br />
  if (!empty($dynamic_object['object_id'])) {<br />
   $dynamic_object_scheme = Bm_SchemesManager::get_dynamic_object($dispatch, 'C');<br />
   if (!empty($dynamic_object_scheme)) {<br />
    $dynamic_object_condition = db_quote(<br />
	 " AND (FIND_IN_SET(?i, l.object_ids) OR l.object_ids = '')",<br />
	 $dynamic_object['object_id']<br />
    );<br />
   }<br />
  }<br />

```<br />
<br />
<br />
```php
<br />
if($dispatch=='pages.view'){<br />
   $predispatch = 'pages.view&page_id='.$_REQUEST['page_id'];<br />
   $test = db_get_field("SELECT `dispatch` FROM ?:bm_locations WHERE `dispatch`='{$predispatch}'");<br />
   if($test){<br />
    $dispatch = $predispatch;<br />
   }<br />
  }<br />

```<br />
<br />
Now you are able to create new block manager locations for specific pages.<br />
eg: Add new location and set dispatch as : pages.view&page_id=30<br />
<br />
The same can be done for products with some minor changes on the snippet i gave you

Hi fellows,



Has anybody figure this out in v4?



Fotis

Well with a little help from a good Friend (he knows who!) we got this



In app/Tygh/BlockManager/location.php line 79 (v4.0.3) insert



if($dispatch=='pages.view'){
$predispatch = 'pages.view&page_id='.$_REQUEST['page_id'];
$test = db_get_field("SELECT `dispatch` FROM ?:bm_locations WHERE `dispatch`='{$predispatch}'");
if($test){
$dispatch = $predispatch;
}
}




and just under



fn_set_hook('get_locations_pre', $params, $lang_code); (line 41) insert





if ($params['dispatch'] == 'pages.view' && $_REQUEST['page_id'] == 30) {
$params['dispatch'] = 'pages.view' . '&' . $_REQUEST['page_id'];
}




where == 30 is the page id you need to have a seperate page location.



The catch is you can't have many pages like this, without changing the file somehow each time.



If someone has a better idea he is welcome to post below.



This was a great mod and it is same to just let it go in v4.



Fotis