We have a node type X with a node ref to a SimpleAds node.
We want to display ads related to this refered SimpleAd.
Notice: Undefined index: nid in template_preprocess_views_simpleads() (regel 154 van /.../simpleads/includes/simpleads.theme.inc).
This is due to the fact the views has now a related node and thus more fields available.
if (isset($data->field_field_ad_category[0])) {
$tid = $data->field_field_ad_category[0]['raw']['tid'];
$node = $data->_field_data['nid']['entity'];
$ads[] = _simpleads_ads_data($node);
}
A hot fix for us where we grab the first item from the field_data is
if (isset($data->_field_data['nid'])) {
$node = $data->_field_data['nid']['entity'];
}
else {
$dummy = $data->_field_data;
$f = array_shift($dummy);
$node = $f['entity'];
}
This is not a patch as I'm not sure how that should look.
| Comment | File | Size | Author |
|---|---|---|---|
| #4 | simpleads-views-refered-ad-1826130-3.patch | 776 bytes | clemens.tolboom |
| #1 | simpleads-views-refered-ad-1826130-1.patch | 920 bytes | clemens.tolboom |
Comments
Comment #1
clemens.tolboomAttached a patch containing the mentioned hotfix
Comment #2
clemens.tolboomThis needs review.
Note the patch allows for node (with a reference to an Ad) to pick up that add.
It is still not possible to pickup _all_ adds with the category of the referred Ad as the Ad Group is not exposed as a relation.
Comment #4
clemens.tolboomFixed (i hope) the wrong paths in the patch.
Comment #5
minnur commentedThanks for the patch, I will review it.
Comment #6
minnur commented