How can I use php mpdf, can not Chinese garbled code? - mpdf

This is my php code, use dPdf, But the PDF I got was garbled in Chinese,like this:
I tried many methods, but they didn't work, My MPDF version is 8.0.8, php verson is v7.4
<?php
$defaultConfig = (new ConfigVariables())->getDefaults();
$fontDirs = $defaultConfig['fontDir'];
$defaultFontConfig = (new FontVariables())->getDefaults();
$fontData = $defaultFontConfig['fontdata'];
//当文件不存在,再生成
// if (!is_file($localFileUrl)) {
$mpdf = new Mpdf([
// 'mode' => 'utf-8',
'mode' => '-aCJK',
'format' => 'A4',
'useSubstitutions' => true,
'useAdobeCJK' => true,
'autoScriptToLang' => true,
'autoLangToFont' => true,
'mgl' => 15,
'mgr' => 15,
'mgt' => 16,
'mgb' => 16,
'mgh' => 9,
'mgf' => 9,
'orientation' => 'P',
'fontDir' => array_merge($fontDirs, [
Yii::$app->basePath . '/fontData',
]),
'fontdata' => ArrayHelper::merge($fontData, [
//配置全局字体
'gb' => [
'R' => 'gb.ttf',
'sip-ext' => 'gb',
],
'default_font' => 'gb'
])
]);
// $mpdf->SetFont('gb');
$mpdf->ignore_invalid_utf8 = true;
$mpdf->useAdobeCJK = true;
$mpdf->autoLangToFont = true;
$mpdf->autoScriptToLang = true;
$mpdf->SetDisplayMode('fullpage'); // 设置pdf显示方式
$mpdf->pgwidth = '240mm'; // 设置pdf的尺寸为mm*mm
$authPic = Yii::$app->basePath . '/rundata/auth/auth_1.png';
$mpdf->WriteHTML("<img src='{$authPic}'>");
$mpdf->WriteText(74, 95, '中文中文');

Related

prestashop overriding and combination

Hi all I have a question regarding the topic, prestashop 1.6.
I added a custom date field on the on the information page:
let's call it "customfield", and it works fine, I can fill a DATE and prestashop stores in the database.
Now I want the same field to be added in the combinations, each combination can have the same or different or null customfield value.
This is what I did regarding combination:
created /override/controllers/admin/templates/products/combinations.tpl (located in the same folder there is a modified information.tpl);
<div class="form-group">
<label class="control-label col-lg-3" for="attribute_customfield">
{l s='Customfield'}
</label>
<div class="col-lg-3">
<input maxlength="12" type="date" id="attribute_customfield" name="attribute_customfield" value="" />
</div>
</div>
/override/classes/Combination.php
class Combination extends CombinationCore
{
public $customfield;
/**
* #see ObjectModel::$definition
*/
public static $definition = array(
'table' => 'product_attribute',
'primary' => 'id_product_attribute',
'fields' => array(
'id_product' => array('type' => self::TYPE_INT, 'shop' => 'both', 'validate' => 'isUnsignedId', 'required' => true),
'location' => array('type' => self::TYPE_STRING, 'validate' => 'isGenericName', 'size' => 64),
'ean13' => array('type' => self::TYPE_STRING, 'validate' => 'isEan13', 'size' => 13),
'upc' => array('type' => self::TYPE_STRING, 'validate' => 'isUpc', 'size' => 12),
'quantity' => array('type' => self::TYPE_INT, 'validate' => 'isInt', 'size' => 10),
'reference' => array('type' => self::TYPE_STRING, 'size' => 32),
'supplier_reference' => array('type' => self::TYPE_STRING, 'size' => 32),
/* Shop fields */
'wholesale_price' => array('type' => self::TYPE_FLOAT, 'shop' => true, 'validate' => 'isPrice', 'size' => 27),
'price' => array('type' => self::TYPE_FLOAT, 'shop' => true, 'validate' => 'isNegativePrice', 'size' => 20),
'ecotax' => array('type' => self::TYPE_FLOAT, 'shop' => true, 'validate' => 'isPrice', 'size' => 20),
'weight' => array('type' => self::TYPE_FLOAT, 'shop' => true, 'validate' => 'isFloat'),
'unit_price_impact' => array('type' => self::TYPE_FLOAT, 'shop' => true, 'validate' => 'isNegativePrice', 'size' => 20),
'minimal_quantity' => array('type' => self::TYPE_INT, 'shop' => true, 'validate' => 'isUnsignedId', 'required' => true),
'default_on' => array('type' => self::TYPE_BOOL, 'allow_null' => true, 'shop' => true, 'validate' => 'isBool'),
'available_date' => array('type' => self::TYPE_DATE, 'shop' => true, 'validate' => 'isDateFormat'),
/*added*/
'customfield' => array('type' => self::TYPE_DATE, 'validate' => 'isDateFormat'),
),
);
}
/override/classes/Product.php
class Product extends ProductCore
{
public $second_reference;
public $customfield;
public function __construct($id_product = null, $full = false, $id_lang = null, $id_shop = null, Context $context = null)
{
self::$definition['fields']['second_reference'] = array('type' => self::TYPE_STRING, 'validate' => 'isString');
self::$definition['fields']['customfield'] = array('type' => self::TYPE_DATE, 'validate' => 'isDateFormat');
parent::__construct($id_product, $full, $id_lang, $id_shop);
}
/**
* #param int $quantity DEPRECATED
* #param string $supplier_reference DEPRECATED
*/
public function addCombinationEntity($wholesale_price, $price, $weight, $unit_impact, $ecotax, $quantity,
$id_images, $reference, $id_supplier, $ean13, $customfield, $default, $location = null, $upc = null, $minimal_quantity = 1, array $id_shop_list = array(), $available_date = null)
{
$id_product_attribute = $this->addAttribute(
$price, $weight, $unit_impact, $ecotax, $id_images,
$reference, $ean13, $customfield, $default, $location, $upc, $minimal_quantity, $id_shop_list, $available_date);
$this->addSupplierReference($id_supplier, $id_product_attribute);
$result = ObjectModel::updateMultishopTable('Combination', array(
'wholesale_price' => (float)$wholesale_price,
), 'a.id_product_attribute = '.(int)$id_product_attribute);
if (!$id_product_attribute || !$result)
return false;
return $id_product_attribute;
}
/**
* Update a product attribute
*
*/
public function updateAttribute($id_product_attribute, $wholesale_price, $price, $weight, $unit, $ecotax,
$id_images, $reference, $ean13, $customfield, $default, $location = null, $upc = null, $minimal_quantity = null, $available_date = null, $update_all_fields = true, array $id_shop_list = array())
{
$combination = new Combination($id_product_attribute);
if (!$update_all_fields)
$combination->setFieldsToUpdate(array(
'price' => !is_null($price),
'wholesale_price' => !is_null($wholesale_price),
'ecotax' => !is_null($ecotax),
'weight' => !is_null($weight),
'unit_price_impact' => !is_null($unit),
'default_on' => !is_null($default),
'minimal_quantity' => !is_null($minimal_quantity),
'available_date' => !is_null($available_date),
));
$price = str_replace(',', '.', $price);
$weight = str_replace(',', '.', $weight);
$combination->price = (float)$price;
$combination->wholesale_price = (float)$wholesale_price;
$combination->ecotax = (float)$ecotax;
$combination->weight = (float)$weight;
$combination->unit_price_impact = (float)$unit;
$combination->reference = pSQL($reference);
$combination->location = pSQL($location);
$combination->ean13 = pSQL($ean13);
$combination->customfield = pSQL($customfield);
$combination->upc = pSQL($upc);
$combination->default_on = (int)$default;
$combination->minimal_quantity = (int)$minimal_quantity;
$combination->available_date = $available_date ? pSQL($available_date) : '0000-00-00';
if (count($id_shop_list))
$combination->id_shop_list = $id_shop_list;
$combination->save();
if (is_array($id_images) && count($id_images))
$combination->setImages($id_images);
$id_default_attribute = (int)Product::updateDefaultAttribute($this->id);
if ($id_default_attribute)
$this->cache_default_attribute = $id_default_attribute;
// Sync stock Reference, EAN13 and UPC for this attribute
if (Configuration::get('PS_ADVANCED_STOCK_MANAGEMENT') && StockAvailable::dependsOnStock($this->id, Context::getContext()->shop->id))
Db::getInstance()->update('stock', array(
'reference' => pSQL($reference),
'ean13' => pSQL($ean13),
'customfield' => pSQL($customfield),
'upc' => pSQL($upc),
), 'id_product = '.$this->id.' AND id_product_attribute = '.(int)$id_product_attribute);
Hook::exec('actionProductAttributeUpdate', array('id_product_attribute' => (int)$id_product_attribute));
Tools::clearColorListCache($this->id);
return true;
}
/**
* Add a product attribute
* #since 1.5.0.1
*
* #param float $price Additional price
* #param float $weight Additional weight
* #param float $ecotax Additional ecotax
* #param int $id_images Image ids
* #param string $reference Reference
* #param string $location Location
* #param string $ean13 Ean-13 barcode
* #param bool $default Is default attribute for product
* #param int $minimal_quantity Minimal quantity to add to cart
* #return mixed $id_product_attribute or false
*/
public function addAttribute($price, $weight, $unit_impact, $ecotax, $id_images, $reference, $ean13, $customfield,
$default, $location = null, $upc = null, $minimal_quantity = 1, array $id_shop_list = array(), $available_date = null)
{
if (!$this->id)
return;
$price = str_replace(',', '.', $price);
$weight = str_replace(',', '.', $weight);
$combination = new Combination();
$combination->id_product = (int)$this->id;
$combination->price = (float)$price;
$combination->ecotax = (float)$ecotax;
$combination->quantity = 0;
$combination->weight = (float)$weight;
$combination->unit_price_impact = (float)$unit_impact;
$combination->reference = pSQL($reference);
$combination->location = pSQL($location);
$combination->ean13 = pSQL($ean13);
$combination->customfield = pSQL($customfield);
$combination->upc = pSQL($upc);
$combination->default_on = (int)$default;
$combination->minimal_quantity = (int)$minimal_quantity;
$combination->available_date = $available_date;
if (count($id_shop_list))
$combination->id_shop_list = array_unique($id_shop_list);
$combination->add();
if (!$combination->id)
return false;
$total_quantity = (int)Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue('
SELECT SUM(quantity) as quantity
FROM '._DB_PREFIX_.'stock_available
WHERE id_product = '.(int)$this->id.'
AND id_product_attribute <> 0 '
);
if (!$total_quantity)
Db::getInstance()->update('stock_available', array('quantity' => 0), '`id_product` = '.$this->id);
$id_default_attribute = Product::updateDefaultAttribute($this->id);
if ($id_default_attribute)
{
$this->cache_default_attribute = $id_default_attribute;
if (!$combination->available_date)
$this->setAvailableDate();
}
if (!empty($id_images))
$combination->setImages($id_images);
Tools::clearColorListCache($this->id);
if (Configuration::get('PS_DEFAULT_WAREHOUSE_NEW_PRODUCT') != 0 && Configuration::get('PS_ADVANCED_STOCK_MANAGEMENT'))
{
$warehouse_location_entity = new WarehouseProductLocation();
$warehouse_location_entity->id_product = $this->id;
$warehouse_location_entity->id_product_attribute = (int)$combination->id;
$warehouse_location_entity->id_warehouse = Configuration::get('PS_DEFAULT_WAREHOUSE_NEW_PRODUCT');
$warehouse_location_entity->location = pSQL('');
$warehouse_location_entity->save();
}
return (int)$combination->id;
}
/**
* Get all available attribute groups
*
* #param int $id_lang Language id
* #return array Attribute groups
*/
public function getAttributesGroups($id_lang)
{
if (!Combination::isFeatureActive())
return array();
$sql = 'SELECT ag.`id_attribute_group`, ag.`is_color_group`, agl.`name` AS group_name, agl.`public_name` AS public_group_name,
a.`id_attribute`, al.`name` AS attribute_name, a.`color` AS attribute_color, product_attribute_shop.`id_product_attribute`,
IFNULL(stock.quantity, 0) as quantity, product_attribute_shop.`price`, product_attribute_shop.`ecotax`, product_attribute_shop.`weight`,
product_attribute_shop.`default_on`, pa.`reference`, pa.`customfield`, product_attribute_shop.`unit_price_impact`,
product_attribute_shop.`minimal_quantity`, product_attribute_shop.`available_date`, ag.`group_type`
FROM `'._DB_PREFIX_.'product_attribute` pa
'.Shop::addSqlAssociation('product_attribute', 'pa').'
'.Product::sqlStock('pa', 'pa').'
LEFT JOIN `'._DB_PREFIX_.'product_attribute_combination` pac ON (pac.`id_product_attribute` = pa.`id_product_attribute`)
LEFT JOIN `'._DB_PREFIX_.'attribute` a ON (a.`id_attribute` = pac.`id_attribute`)
LEFT JOIN `'._DB_PREFIX_.'attribute_group` ag ON (ag.`id_attribute_group` = a.`id_attribute_group`)
LEFT JOIN `'._DB_PREFIX_.'attribute_lang` al ON (a.`id_attribute` = al.`id_attribute`)
LEFT JOIN `'._DB_PREFIX_.'attribute_group_lang` agl ON (ag.`id_attribute_group` = agl.`id_attribute_group`)
'.Shop::addSqlAssociation('attribute', 'a').'
WHERE pa.`id_product` = '.(int)$this->id.'
AND al.`id_lang` = '.(int)$id_lang.'
AND agl.`id_lang` = '.(int)$id_lang.'
GROUP BY id_attribute_group, id_product_attribute
ORDER BY ag.`position` ASC, a.`position` ASC, agl.`name` ASC';
return Db::getInstance()->executeS($sql);
}
/**
* Get product attribute combination by id_product_attribute
* #return array Product attribute combination by id_product_attribute
*/
public function getAttributeCombinationsById($id_product_attribute, $id_lang)
{
if (!Combination::isFeatureActive())
return array();
$sql = 'SELECT pa.*, product_attribute_shop.*, ag.`id_attribute_group`, ag.`is_color_group`, agl.`name` AS group_name, al.`name` AS attribute_name,
a.`id_attribute`
FROM `'._DB_PREFIX_.'product_attribute` pa
'.Shop::addSqlAssociation('product_attribute', 'pa').'
LEFT JOIN `'._DB_PREFIX_.'product_attribute_combination` pac ON pac.`id_product_attribute` = pa.`id_product_attribute`
LEFT JOIN `'._DB_PREFIX_.'attribute` a ON a.`id_attribute` = pac.`id_attribute`
LEFT JOIN `'._DB_PREFIX_.'attribute_group` ag ON ag.`id_attribute_group` = a.`id_attribute_group`
LEFT JOIN `'._DB_PREFIX_.'attribute_lang` al ON (a.`id_attribute` = al.`id_attribute` AND al.`id_lang` = '.(int)$id_lang.')
LEFT JOIN `'._DB_PREFIX_.'attribute_group_lang` agl ON (ag.`id_attribute_group` = agl.`id_attribute_group` AND agl.`id_lang` = '.(int)$id_lang.')
WHERE pa.`id_product` = '.(int)$this->id.'
AND pa.`id_product_attribute` = '.(int)$id_product_attribute.'
GROUP BY pa.`id_product_attribute`, ag.`id_attribute_group`
ORDER BY pa.`id_product_attribute`';
$res = Db::getInstance()->executeS($sql);
//Get quantity of each variations
foreach ($res as $key => $row)
{
$cache_key = $row['id_product'].'_'.$row['id_product_attribute'].'_quantity';
if (!Cache::isStored($cache_key))
{
$result = StockAvailable::getQuantityAvailableByProduct($row['id_product'], $row['id_product_attribute']);
Cache::store(
$cache_key,
$result
);
$res[$key]['quantity'] = $result;
}
else
$res[$key]['quantity'] = Cache::retrieve($cache_key);
}
return $res;
}
}
/override/controllers/front/ProductController.php
class ProductController extends ProductControllerCore
{
/**
* Assign template vars related to attribute groups and colors
*/
protected function assignAttributesGroups()
{
$colors = array();
$groups = array();
// #todo (RM) should only get groups and not all declination ?
$attributes_groups = $this->product->getAttributesGroups($this->context->language->id);
if (is_array($attributes_groups) && $attributes_groups)
{
$combination_images = $this->product->getCombinationImages($this->context->language->id);
$combination_prices_set = array();
foreach ($attributes_groups as $k => $row)
{
// Color management
if (isset($row['is_color_group']) && $row['is_color_group'] && (isset($row['attribute_color']) && $row['attribute_color']) || (file_exists(_PS_COL_IMG_DIR_.$row['id_attribute'].'.jpg')))
{
$colors[$row['id_attribute']]['value'] = $row['attribute_color'];
$colors[$row['id_attribute']]['name'] = $row['attribute_name'];
if (!isset($colors[$row['id_attribute']]['attributes_quantity']))
$colors[$row['id_attribute']]['attributes_quantity'] = 0;
$colors[$row['id_attribute']]['attributes_quantity'] += (int)$row['quantity'];
}
...
}
}
/override/controllers/admin/AdminProductsController.php
<?php
class AdminProductsController extends AdminProductsControllerCore
{
public function processProductAttribute()
{
// Don't process if the combination fields have not been submitted
if (!Combination::isFeatureActive() || !Tools::getValue('attribute_combination_list'))
return;
if (Validate::isLoadedObject($product = $this->object))
{
if ($this->isProductFieldUpdated('attribute_price') && (!Tools::getIsset('attribute_price') || Tools::getIsset('attribute_price') == null))
$this->errors[] = Tools::displayError('The price attribute is required.');
if (!Tools::getIsset('attribute_combination_list') || Tools::isEmpty(Tools::getValue('attribute_combination_list')))
$this->errors[] = Tools::displayError('You must add at least one attribute.');
$array_checks = array(
'reference' => 'isReference',
'supplier_reference' => 'isReference',
'location' => 'isReference',
'ean13' => 'isEan13',
'upc' => 'isUpc',
'wholesale_price' => 'isPrice',
'price' => 'isPrice',
'ecotax' => 'isPrice',
'quantity' => 'isInt',
'weight' => 'isUnsignedFloat',
'unit_price_impact' => 'isPrice',
'default_on' => 'isBool',
'minimal_quantity' => 'isUnsignedInt',
'available_date' => 'isDateFormat'
);
foreach ($array_checks as $property => $check)
if (Tools::getValue('attribute_'.$property) !== false && !call_user_func(array('Validate', $check), Tools::getValue('attribute_'.$property)))
...
$this->isProductFieldUpdated('attribute_ecotax') ? Tools::getValue('attribute_ecotax') : null,
Tools::getValue('id_image_attr'),
Tools::getValue('attribute_reference'),
Tools::getValue('attribute_ean13'),
Tools::getValue('customfield'),
$this->isProductFieldUpdated('attribute_default') ? Tools::getValue('attribute_default') : null,
Tools::getValue('attribute_location'),
Tools::getValue('attribute_upc'),
$this->isProductFieldUpdated('attribute_minimal_quantity') ? Tools::getValue('attribute_minimal_quantity') : null,
$this->isProductFieldUpdated('available_date_attribute') ? Tools::getValue('available_date_attribute') : null, false);
StockAvailable::setProductDependsOnStock((int)$product->id, $product->depends_on_stock, null, (int)$id_product_attribute);
StockAvailable::setProductOutOfStock((int)$product->id, $product->out_of_stock, null, (int)$id_product_attribute);
}
}
else
$this->errors[] = Tools::displayError('You do not have permission to add this.');
}
// Add new
else
{
if ($this->tabAccess['add'] === '1')
{
if ($product->productAttributeExists(Tools::getValue('attribute_combination_list')))
$this->errors[] = Tools::displayError('This combination already exists.');
else
{
$id_product_attribute = $product->addCombinationEntity(
Tools::getValue('attribute_wholesale_price'),
Tools::getValue('attribute_price') * Tools::getValue('attribute_price_impact'),
Tools::getValue('attribute_weight') * Tools::getValue('attribute_weight_impact'),
Tools::getValue('attribute_unity') * Tools::getValue('attribute_unit_impact'),
Tools::getValue('attribute_ecotax'),
0,
Tools::getValue('id_image_attr'),
Tools::getValue('attribute_reference'),
null,
Tools::getValue('attribute_ean13'),
Tools::getValue('attribute_default'),
Tools::getValue('attribute_location'),
Tools::getValue('customfield'),
...
}
}
}
/**
* #param Product $product
* #throws Exception
* #throws SmartyException
*/
public function initFormInformations($product)
{
if (!$this->default_form_language)
$this->getLanguages();
$data = $this->createTemplate($this->tpl_form);
$currency = $this->context->currency;
$data->assign(array(
'languages' => $this->_languages,
'default_form_language' => $this->default_form_language,
'currency' => $currency
));
$this->object = $product;
//$this->display = 'edit';
$data->assign('product_name_redirected', Product::getProductName((int)$product->id_product_redirected, null, (int)$this->context->language->id));
/*
* Form for adding a virtual product like software, mp3, etc...
*/
$product_download = new ProductDownload();
if ($id_product_download = $product_download->getIdFromIdProduct($this->getFieldValue($product, 'id')))
$product_download = new ProductDownload($id_product_download);
$product->{'productDownload'} = $product_download;
$product_props = array();
// global informations
array_push($product_props, 'reference', 'ean13', 'customfield', 'upc',
'available_for_order', 'show_price', 'online_only',
'id_manufacturer'
);
// specific / detailled information
array_push($product_props,
// physical product
'width', 'height', 'weight', 'active',
// virtual product
'is_virtual', 'cache_default_attribute',
// customization
'uploadable_files', 'text_fields'
);
// prices
array_push($product_props,
'price', 'wholesale_price', 'id_tax_rules_group', 'unit_price_ratio', 'on_sale',
'unity', 'minimum_quantity', 'additional_shipping_cost',
'available_now', 'available_later', 'available_date'
);
...
}
/**
* #param Product $product
* #param Currency|array|int $currency
* #return string
*/
public function renderListAttributes($product, $currency)
{
$this->bulk_actions = array('delete' => array('text' => $this->l('Delete selected'), 'confirm' => $this->l('Delete selected items?')));
$this->addRowAction('edit');
$this->addRowAction('default');
$this->addRowAction('delete');
$default_class = 'highlighted';
$this->fields_list = array(
'attributes' => array('title' => $this->l('Attribute - value pair'), 'align' => 'left'),
'price' => array('title' => $this->l('Impact on price'), 'type' => 'price', 'align' => 'left'),
'weight' => array('title' => $this->l('Impact on weight'), 'align' => 'left'),
'reference' => array('title' => $this->l('Reference'), 'align' => 'left'),
'ean13' => array('title' => $this->l('EAN-13'), 'align' => 'left'),
'upc' => array('title' => $this->l('UPC'), 'align' => 'left')
);
if ($product->id)
{
/* Build attributes combinations */
$combinations = $product->getAttributeCombinations($this->context->language->id);
$groups = array();
$comb_array = array();
if (is_array($combinations))
{
$combination_images = $product->getCombinationImages($this->context->language->id);
foreach ($combinations as $k => $combination)
{
$price_to_convert = Tools::convertPrice($combination['price'], $currency);
$price = Tools::displayPrice($price_to_convert, $currency);
$comb_array[$combination['id_product_attribute']]['id_product_attribute'] = $combination['id_product_attribute'];
$comb_array[$combination['id_product_attribute']]['attributes'][] = array($combination['group_name'], $combination['attribute_name'], $combination['id_attribute']);
$comb_array[$combination['id_product_attribute']]['wholesale_price'] = $combination['wholesale_price'];
$comb_array[$combination['id_product_attribute']]['price'] = $price;
$comb_array[$combination['id_product_attribute']]['weight'] = $combination['weight'].Configuration::get('PS_WEIGHT_UNIT');
$comb_array[$combination['id_product_attribute']]['unit_impact'] = $combination['unit_price_impact'];
$comb_array[$combination['id_product_attribute']]['reference'] = $combination['reference'];
$comb_array[$combination['id_product_attribute']]['ean13'] = $combination['ean13'];
$comb_array[$combination['id_product_attribute']]['customfield'] = $combination['customfield'];
$comb_array[$combination['id_product_attribute']]['upc'] = $combination['upc'];
$comb_array[$combination['id_product_attribute']]
...
}
}
/js/admin/product.js
function editProductAttribute (url, parent){
$.ajax({...
success: function(data) {
// color the selected line
parent.siblings().removeClass('selected-line');
parent.addClass('selected-line');
$('#add_new_combination').show();
$('#attribute_quantity').show();
$('#product_att_list').html('');
self.removeButtonCombination('update');
scroll_if_anchor('#add_new_combination');
var wholesale_price = Math.abs(data[0]['wholesale_price']);
var price = data[0]['price'];
var weight = data[0]['weight'];
var unit_impact = data[0]['unit_price_impact'];
var reference = data[0]['reference'];
var ean = data[0]['ean13'];
//MIO
var customfield = data[0]['customfield'];
.....
.....
self.fillCombination(
wholesale_price,
price,
weight,
unit_impact,
reference,
ean,
customfield,
...
);
/**AND LATER**/
this.fillCombination = function(wholesale_price, price_impact, weight_impact, unit_impact, reference,
ean, customfield, quantity, image, old_attr, id_product_attribute, default_attribute, eco_tax, upc, minimal_quantity, available_date)
{
var link = '';
self.init_elems();
$('#stock_mvt_attribute').show();
$('#initial_stock_attribute').hide();
...
getE('attribute_customfield').value = customfield;
These are all the files i overrided and modified
Of course it doesn't work, it doesn't save info into the db correctly, sometimes if the one in information is set the it copies that one instead.
What I did wrong? And what should I do instead

Drupal Views- Filtering by multiple taxonomy terms

I have a View set up to display featured Article nodes. For each node there are 2 taxonomy vocabs to use. The first is 'Featured' with a term 'Yes'; the second is 'Section' with terms: Home, Info, Blog etc. If a node has the term Yes (Featured vocab) and the term Blog (Section vocab) then if you were to browse to domain.com/blog then you would see that featured content.
The view is set up to accept the first argument in the url to determine which section of the site you are viewing (Views argument: Taxonomy term). This works as expected.
Lastly, I am filtering by node type (Article) and then the taxonomy vocab (Featured) which is where my view is failing to return content. If I remove the taxonomy vocab filter it displays correctly for each section although it is displaying all Article nodes.
Could the issue be that the argument and filter are different taxonomy vocabs?
Here's the SQL query:
SELECT node.nid AS nid,
node.type AS node_type,
node.vid AS node_vid,
node_data_field_article_images.field_article_images_data AS node_data_field_article_images_field_article_images_data,
node.title AS node_title,
node.created AS node_created
FROM node node
LEFT JOIN content_field_article_images node_data_field_article_images ON node.vid = node_data_field_article_images.vid
LEFT JOIN term_node term_node ON node.vid = term_node.vid
LEFT JOIN term_data term_data ON term_node.tid = term_data.tid
WHERE (node.status <> 0) AND (node.type in ('article')) AND (node_data_field_article_images.field_article_images_list <> 0) AND (term_data.vid in ('20')) AND (term_data.name = 'home')
ORDER BY node_created DESC
Here's my view:
$view = new view;
$view->name = 'marquee_slideshow_dev';
$view->description = 'Marquee on homepage and landing pages';
$view->tag = '';
$view->view_php = '';
$view->base_table = 'node';
$view->is_cacheable = FALSE;
$view->api_version = 2;
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
$handler = $view->new_display('default', 'Defaults', 'default');
$handler->override_option('fields', array(
'title' => array(
'label' => '',
'alter' => array(
'alter_text' => 0,
'text' => '',
'make_link' => 0,
'path' => '',
'link_class' => '',
'alt' => '',
'prefix' => '',
'suffix' => '',
'target' => '',
'help' => '',
'trim' => 0,
'max_length' => '',
'word_boundary' => 1,
'ellipsis' => 1,
'html' => 0,
'strip_tags' => 0,
),
'empty' => '',
'hide_empty' => 0,
'empty_zero' => 0,
'link_to_node' => 0,
'exclude' => 0,
'id' => 'title',
'table' => 'node',
'field' => 'title',
'relationship' => 'none',
'override' => array(
'button' => 'Override',
),
),
));
$handler->override_option('sorts', array(
'created' => array(
'order' => 'DESC',
'granularity' => 'second',
'id' => 'created',
'table' => 'node',
'field' => 'created',
'relationship' => 'none',
),
));
$handler->override_option('arguments', array(
'name' => array(
'default_action' => 'default',
'style_plugin' => 'default_summary',
'style_options' => array(),
'wildcard' => 'all',
'wildcard_substitution' => 'All',
'title' => '',
'breadcrumb' => '',
'default_argument_type' => 'php',
'default_argument' => '',
'validate_type' => 'none',
'validate_fail' => 'not found',
'glossary' => 0,
'limit' => '0',
'case' => 'lower',
'path_case' => 'lower',
'transform_dash' => 1,
'add_table' => 0,
'require_value' => 0,
'id' => 'name',
'table' => 'term_data',
'field' => 'name',
'validate_user_argument_type' => 'uid',
'validate_user_roles' => array(
'2' => 0,
'7' => 0,
'8' => 0,
'4' => 0,
'6' => 0,
'5' => 0,
),
'relationship' => 'none',
'default_options_div_prefix' => '',
'default_argument_fixed' => '',
'default_argument_user' => 0,
'default_argument_image_size' => '_original',
'default_argument_php' => '$path = explode(\'/\', drupal_get_path_alias($_GET[\'q\']));
$is_front = $_GET[\'q\'] == \'<front>\' || $_GET[\'q\'] == variable_get(\'site_frontpage\', \'<front>\');
$arg0 = arg(0);
if ($is_front) {
return \'home\';
} else if ($arg0 = \'node\' && arg(1) != \'add\' && arg(2) != \'edit\' && arg(2) != \'delete\' && $path[0] != \'\') {
return $path[0];
}
',
'validate_argument_node_type' => array(
'activitystream' => 0,
'image' => 0,
'contenttab' => 0,
'content_about_fedex_content_page' => 0,
'content_about_fedex_home_page' => 0,
'content_about_fedex_landing_page' => 0,
'content_access_article' => 0,
'content_access_article_index' => 0,
'content_access_content_page' => 0,
'content_access_landing_page' => 0,
'content_block' => 0,
'content_case_study' => 0,
'content_document' => 0,
'content_event' => 0,
'content_executive_viewpoint' => 0,
'content_feature' => 0,
'content_fedex_fact' => 0,
'content_fedex_video_page' => 0,
'content_great_place_to_work' => 0,
'content_location' => 0,
'content_opco_overview' => 0,
'content_our_commitment_content_p' => 0,
'content_our_commitment_landing_p' => 0,
'content_region_overview' => 0,
'content_resources' => 0,
'content_sag' => 0,
'content_small_business' => 0,
'page' => 0,
'slideshow_image' => 0,
'story' => 0,
),
'validate_argument_node_access' => 0,
'validate_argument_nid_type' => 'nid',
'validate_argument_vocabulary' => array(
'14' => 0,
'18' => 0,
'17' => 0,
'11' => 0,
'10' => 0,
'15' => 0,
'9' => 0,
'3' => 0,
'16' => 0,
'8' => 0,
'5' => 0,
'2' => 0,
'7' => 0,
'19' => 0,
'1' => 0,
'12' => 0,
'13' => 0,
),
'validate_argument_type' => 'tid',
'validate_argument_transform' => 0,
'validate_user_restrict_roles' => 0,
'image_size' => array(
'_original' => '_original',
'thumbnail' => 'thumbnail',
'preview' => 'preview',
'icon' => 'icon',
),
'validate_argument_php' => '',
'override' => array(
'button' => 'Override',
),
),
));
$handler->override_option('filters', array(
'status' => array(
'operator' => '=',
'value' => '1',
'group' => '0',
'exposed' => FALSE,
'expose' => array(
'operator' => FALSE,
'label' => '',
),
'id' => 'status',
'table' => 'node',
'field' => 'status',
'relationship' => 'none',
),
'type' => array(
'operator' => 'in',
'value' => array(
'article' => 'article',
),
'group' => '0',
'exposed' => FALSE,
'expose' => array(
'operator' => FALSE,
'label' => '',
),
'id' => 'type',
'table' => 'node',
'field' => 'type',
'relationship' => 'none',
),
'vid' => array(
'operator' => 'in',
'value' => array(
'20' => '20',
),
'group' => '0',
'exposed' => FALSE,
'expose' => array(
'operator' => FALSE,
'label' => '',
),
'id' => 'vid',
'table' => 'term_data',
'field' => 'vid',
'relationship' => 'none',
),
));
$handler->override_option('access', array(
'type' => 'none',
));
$handler->override_option('cache', array(
'type' => 'none',
));
$handler->override_option('empty_format', '3');
$handler->override_option('items_per_page', 0);
$handler->override_option('use_pager', 'mini');
$handler->override_option('distinct', 0);
$handler->override_option('style_options', array(
'grouping' => '',
));
$handler = $view->new_display('block', 'Home Page', 'block_1');
$handler->override_option('block_description', '');
$handler->override_option('block_caching', -1);
hope you have a node which has terms from both the vocabulary ..
its difficult to solve it from exported view..
what you can do is provide the sql query which view is generating check it or post it over here..

create a default view in drupal

i want to create a default view from mymodule. i want to use fields from 2 tables.My base table is users. All the fields from usres are showing. i want the fields from draagabaleviews_structure also. i had a look on hook_views_data. draagabaleviews group is already there in view.then how can i join that table??
function mymodule_views_default_views() {
$view = new view;
$view->name = 'my_view';
$view->description = '';
$view->tag = '';
$view->view_php = '';
$view->base_table = 'users';
$view->is_cacheable = FALSE;
$view->api_version = 2;
$view->disabled = FALSE;
$handler = $view->new_display('default', 'Defaults', 'default');
$handler->override_option('relationships', array(
));
$handler->override_option('fields', array(
'name' => array(
'label' => 'Username',
'alter' => array(
'alter_text' => 0,
'text' => '',
'make_link' => 0,
'path' => '',
'link_class' => '',
'alt' => '',
'prefix' => '',
'suffix' => '',
'help' => '',
'trim' => 0,
'max_length' => '',
'word_boundary' => 1,
'ellipsis' => 1,
'strip_tags' => 0,
'html' => 0,
),
'link_to_node' => 0,
'exclude' => 0,
'id' => 'name',
'table' => 'users',
'field' => 'name',
'override' => array(
'button' => 'Override',
),
'relationship' => 'none',
),
'status' => array(
'label' => 'Status',
'alter' => array(
'alter_text' => 0,
'text' => '',
'make_link' => 0,
'path' => '',
'link_class' => '',
'alt' => '',
'prefix' => '',
'suffix' => '',
'help' => '',
'trim' => 0,
'max_length' => '',
'word_boundary' => 1,
'ellipsis' => 1,
'strip_tags' => 0,
'html' => 0,
),
'link_to_user' => 0,
'overwrite_anonymous' => 0,
'anonymous_text' => '',
'exclude' => 0,
'id' => 'status',
'table' => 'users',
'field' => 'status',
'override' => array(
'button' => 'Override',
),
'relationship' => 'none',
),
'Last access' => array(
'label' => 'Last access',
'alter' => array(
'alter_text' => 0,
'text' => '',
'make_link' => 0,
'path' => '',
'link_class' => '',
'alt' => '',
'prefix' => '',
'suffix' => '',
'help' => '',
'trim' => 0,
'max_length' => '',
'word_boundary' => 1,
'ellipsis' => 1,
'strip_tags' => 0,
'html' => 0,
),
'link_to_user' => 0,
'overwrite_anonymous' => 0,
'anonymous_text' => '',
'exclude' => 0,
'id' => 'Last access',
'table' => 'users',
'field' => 'access',
'override' => array(
'button' => 'Override',
),
'relationship' => 'none',
),
'order' => array(
'label' => 'Order',
'alter' => array(
'alter_text' => 0,
'text' => '',
'make_link' => 0,
'path' => '',
'link_class' => '',
'alt' => '',
'prefix' => '',
'suffix' => '',
'help' => '',
'trim' => 0,
'max_length' => '',
'word_boundary' => 1,
'ellipsis' => 1,
'strip_tags' => 0,
'html' => 0,
),
'set_precision' => FALSE,
'precision' => 0,
'decimal' => '.',
'separator' => ',',
'prefix' => '',
'suffix' => '',
'exclude' => 0,
'id' => 'order',
'table' => 'draggableviews_structure',
'field' => 'value',
'relationship' => 'none',
),
));
$handler->override_option('sorts', array(
'order' => array(
'order' => 'ASC',
'id' => 'Order',
'table' => 'draggableviews_structure',
'field' => 'value',
'override' => array(
'button' => 'Override',
),
'relationship' => 'none',
),
));
$handler->override_option('arguments', array(
));
$handler->override_option('access', array(
'type' => 'perm',
'perm' => 'Allow Reordering',
));
$handler->override_option('cache', array(
'type' => 'none',
));
$handler->override_option('empty', 'This book page doesn\'t contain any sub pages.');
$handler->override_option('empty_format', '1');
$handler->override_option('items_per_page', 20);
$handler->override_option('use_pager', '1');
$handler->override_option('style_plugin', 'draggabletable');
$handler->override_option('style_options', array(
'override' => 1,
'sticky' => 0,
'order' => 'asc',
'columns' => array(
'title' => 'title',
'name' => 'name',
),
'info' => array(
'title' => array(
'sortable' => 0,
'separator' => '',
),
'name' => array(
'sortable' => 0,
'separator' => '',
),
),
'tabledrag_order' => array(
'field' => 'order',
'handler' => 'native',
),
'draggableviews_extensions' => array(
'extension_top' => '3',
'extension_bottom' => '3',
),
'tabledrag_order_visible' => array(
'visible' => 1,
),
'tabledrag_hierarchy_visible' => array(
'visible' => 0,
),
'draggableviews_depth_limit' => '0',
'draggableviews_repair' => array(
'repair' => 'repair',
),
'tabledrag_types_add' => 'Add type',
'tabledrag_expand' => array(
'expand_links' => 'expand_links',
'collapsed' => 0,
'by_draggableviews_structure' => 0,
),
'tabledrag_lock' => array(
'lock' => 0,
),
'draggableviews_default_on_top' => '1',
'draggableviews_button_text' => 'Save order',
'draggableviews_arguments' => array(
'use_args' => 0,
),
'draggableviews_book_radios' => '1',
'draggableviews_book_argument' => 'p',
'draggableviews_book_filter' => 'none',
));
$handler = $view->new_display('page', 'Page', 'page_1');
$handler->override_option('path', 'user/reorder');
$handler->override_option('menu', array(
'type' => 'tab',
'title' => 'Rearrange',
'description' => 'Organize your book pages.',
'weight' => '10',
'name' => 'primary-links',
));
$handler->override_option('tab_options', array(
'type' => 'none',
'title' => '',
'description' => '',
'weight' => 0,
));
$views[$view->name] = $view;
return $views;
}
I was caught with the same issue where i needed to join the two table in view. fortunately i found these links
http://drupalmodules.com/module/reverse-node-reference module enhances views with reverse relationships for node reference fields.
you may also need http://drupal.org/project/noderelationships
These are contributed module. So if you want to do the same thing programmatically then you need to look into reverse-node-reference modules.

How to increase character length for title in views-slideshow module?

Im maintaining this Drupal Site which is using Slideshow Views for displaying the featured posts. Its using Slideshow Thumbnailhover SlideShows contribution of 'Views Slideshow' http://drupal.org/project/views_slideshow Module for Drupal. However, even after scanning through the code and browsing though all settings, I cant figure out how to increase the max -character length of titles. Its currently set to 50. I want to increase it to 70.
Thanks in advance!
The exported view is as follows:
$view = new view;
$view->name = 'SlideShows';
$view->description = 'Various views that display content in slideshows';
$view->tag = '';
$view->view_php = '';
$view->base_table = 'node';
$view->is_cacheable = FALSE;
$view->api_version = 2;
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
$handler = $view->new_display('default', 'Defaults', 'default');
$handler->override_option('fields', array(
'field_upload_image_fid' => array(
'label' => '',
'alter' => array(
'alter_text' => 0,
'text' => '',
'make_link' => 0,
'path' => '',
'link_class' => '',
'alt' => '',
'prefix' => '',
'suffix' => '',
'target' => '',
'help' => '',
'trim' => 0,
'max_length' => '',
'word_boundary' => 1,
'ellipsis' => 1,
'strip_tags' => 0,
'html' => 0,
),
'empty' => '',
'hide_empty' => 1,
'empty_zero' => 0,
'link_to_node' => 0,
'label_type' => 'none',
'format' => 'Slideshow_656x400_default',
'multiple' => array(
'group' => 0,
'multiple_number' => '',
'multiple_from' => '',
'multiple_reversed' => 0,
),
'exclude' => 0,
'id' => 'field_upload_image_fid',
'table' => 'node_data_field_upload_image',
'field' => 'field_upload_image_fid',
'override' => array(
'button' => 'Override',
),
'relationship' => 'none',
),
'field_upload_image_data' => array(
'label' => '',
'alter' => array(
'alter_text' => 0,
'text' => '',
'make_link' => 0,
'path' => '',
'link_class' => '',
'alt' => '',
'prefix' => '',
'suffix' => '',
'target' => '',
'help' => '',
'trim' => 1,
'max_length' => '80',
'word_boundary' => 0,
'ellipsis' => 0,
'strip_tags' => 1,
'html' => 0,
),
'empty' => '',
'hide_empty' => 0,
'empty_zero' => 0,
'link_to_node' => 0,
'data_key' => 'description',
'exclude' => 0,
'id' => 'field_upload_image_data',
'table' => 'node_data_field_upload_image',
'field' => 'field_upload_image_data',
'override' => array(
'button' => 'Override',
),
'relationship' => 'none',
),
));
$handler->override_option('sorts', array(
'created' => array(
'order' => 'DESC',
'granularity' => 'second',
'id' => 'created',
'table' => 'node',
'field' => 'created',
'override' => array(
'button' => 'Override',
),
'relationship' => 'none',
),
));
$handler->override_option('arguments', array(
'nid' => array(
'default_action' => 'default',
'style_plugin' => 'default_summary',
'style_options' => array(),
'wildcard' => 'all',
'wildcard_substitution' => 'All',
'title' => '',
'breadcrumb' => '',
'default_argument_type' => 'node',
'default_argument' => '',
'validate_type' => 'node',
'validate_fail' => 'not found',
'break_phrase' => 0,
'not' => 0,
'id' => 'nid',
'table' => 'node',
'field' => 'nid',
'validate_user_argument_type' => 'uid',
'validate_user_roles' => array(
'2' => 0,
),
'override' => array(
'button' => 'Override',
),
'relationship' => 'none',
'default_options_div_prefix' => '',
'default_argument_user' => 0,
'default_argument_fixed' => '',
'default_argument_php' => '',
'validate_argument_node_type' => array(
'blogs' => 0,
'industry_focus' => 0,
'market_sectors' => 0,
'page' => 0,
),
'validate_argument_node_access' => 0,
'validate_argument_nid_type' => 'nid',
'validate_argument_vocabulary' => array(
'1' => 0,
'6' => 0,
'3' => 0,
'2' => 0,
'5' => 0,
),
'validate_argument_type' => 'tid',
'validate_argument_transform' => 0,
'validate_user_restrict_roles' => 0,
'validate_argument_php' => '',
),
));
$handler->override_option('filters', array(
'status' => array(
'operator' => '=',
'value' => '1',
'group' => '0',
'exposed' => FALSE,
'expose' => array(
'operator' => FALSE,
'label' => '',
),
'id' => 'status',
'table' => 'node',
'field' => 'status',
'override' => array(
'button' => 'Override',
),
'relationship' => 'none',
),
'type' => array(
'operator' => 'in',
'value' => array(
'association' => 'association',
'blogs' => 'blogs',
'cars' => 'cars',
'company_reports' => 'company_reports',
'events' => 'events',
'howto' => 'howto',
'news' => 'news',
'press_releases' => 'press_releases',
'testimonial' => 'testimonial',
'travel' => 'travel',
),
'group' => '0',
'exposed' => FALSE,
'expose' => array(
'operator' => FALSE,
'label' => '',
),
'id' => 'type',
'table' => 'node',
'field' => 'type',
'override' => array(
'button' => 'Override',
),
'relationship' => 'none',
),
'delta' => array(
'operator' => 'not empty',
'value' => array(
'value' => '',
'min' => '',
'max' => '',
),
'group' => '0',
'exposed' => FALSE,
'expose' => array(
'operator' => FALSE,
'label' => '',
),
'id' => 'delta',
'table' => 'node_data_field_upload_image',
'field' => 'delta',
'override' => array(
'button' => 'Override',
),
'relationship' => 'none',
),
));
$handler->override_option('access', array(
'type' => 'none',
));
$handler->override_option('cache', array(
'type' => 'none',
));
$handler->override_option('header_format', '3');
$handler->override_option('header_empty', 0);
$handler->override_option('footer_format', '2');
$handler->override_option('footer_empty', 0);
$handler->override_option('use_ajax', TRUE);
$handler->override_option('distinct', 1);
$handler->override_option('style_plugin', 'slideshow');
$handler->override_option('style_options', array(
'type' => 'ul',
'mode' => 'views_slideshow_thumbnailhover',
'views_slideshow_singleframe-prefix' => '',
'views_slideshow_singleframe' => array(
'timeout' => '6000',
'delay' => '0',
'speed' => '700',
'start_paused' => 0,
'fixed_height' => '1',
'random' => '0',
'pause' => '1',
'pause_on_click' => '0',
'remember_slide' => 0,
'remember_slide_days' => '1',
'controls' => '0',
'pager' => '2',
'pager_type' => 'Numbered',
'pager_hover' => '2',
'pager_click_to_page' => 0,
'image_count' => '0',
'effect' => 'fade',
'sync' => '1',
'nowrap' => '0',
'advanced' => '',
'ie' => array(
'cleartype' => 'true',
'cleartypenobg' => 'false',
),
),
'views_slideshow_thumbnailhover-prefix' => '',
'views_slideshow_thumbnailhover' => array(
'hover_breakout' => 'title',
'teasers_last' => 1,
'timeout' => '5000',
'delay' => '0',
'speed' => '300',
'start_paused' => 0,
'fixed_height' => '1',
'random' => '0',
'pause' => '1',
'pause_on_click' => '0',
'remember_slide' => 0,
'remember_slide_days' => '1',
'pager_event' => 'mouseover',
'controls' => '0',
'image_count' => '0',
'effect' => 'fade',
'sync' => '1',
'nowrap' => '1',
'advanced' => '',
'ie' => array(
'cleartype' => 'true',
'cleartypenobg' => 'false',
),
),
));
$handler->override_option('row_plugin', 'node');
$handler->override_option('row_options', array(
'relationship' => 'none',
'build_mode' => 'full',
'links' => 0,
'comments' => 0,
));
$handler = $view->new_display('block', 'BlockImageSlideshow', 'block_1');
$handler->override_option('use_ajax', FALSE);
$handler->override_option('use_pager', '0');
$handler->override_option('distinct', 0);
$handler->override_option('style_options', array(
'type' => 'ul',
'mode' => 'views_slideshow_singleframe',
'views_slideshow_singleframe-prefix' => '',
'views_slideshow_singleframe' => array(
'timeout' => '5000',
'delay' => '0',
'speed' => '700',
'start_paused' => 0,
'fixed_height' => '1',
'random' => '0',
'pause' => '1',
'pause_on_click' => '0',
'remember_slide' => 0,
'remember_slide_days' => '1',
'controls' => '0',
'pager' => '2',
'pager_type' => 'Numbered',
'pager_hover' => '2',
'pager_click_to_page' => 0,
'image_count' => '0',
'effect' => 'none',
'sync' => '1',
'nowrap' => '0',
'advanced' => '',
'ie' => array(
'cleartype' => 'false',
'cleartypenobg' => 'false',
),
),
'views_slideshow_thumbnailhover-prefix' => '',
'views_slideshow_thumbnailhover' => array(
'main_fields' => array(
'field_upload_image_fid' => 0,
'field_upload_image_data' => 0,
),
'breakout_fields' => array(
'field_upload_image_fid' => 0,
'field_upload_image_data' => 0,
),
'teasers_last' => 1,
'timeout' => '5000',
'delay' => '0',
'speed' => '300',
'start_paused' => 0,
'fixed_height' => '1',
'random' => '0',
'pause' => '1',
'pause_on_click' => '0',
'remember_slide' => 0,
'remember_slide_days' => '1',
'pager_event' => 'mouseover',
'controls' => '0',
'image_count' => '0',
'effect' => 'fade',
'sync' => '1',
'nowrap' => '1',
'advanced' => '',
'ie' => array(
'cleartype' => 'true',
'cleartypenobg' => 'false',
),
),
));
$handler->override_option('row_plugin', 'fields');
$handler->override_option('row_options', array());
$handler->override_option('block_description', 'Block: REFID Image Slideshow');
$handler->override_option('block_caching', -1);
$handler = $view->new_display('block', 'BlockTopStories', 'block_2');
$handler->override_option('fields', array(
'field_upload_image_fid' => array(
'label' => '',
'alter' => array(
'alter_text' => 0,
'text' => '',
'make_link' => 0,
'path' => '',
'link_class' => '',
'alt' => '',
'prefix' => '',
'suffix' => '',
'target' => '',
'help' => '',
'trim' => 0,
'max_length' => '',
'word_boundary' => 1,
'ellipsis' => 1,
'strip_tags' => 0,
'html' => 0,
),
'empty' => '',
'hide_empty' => 0,
'empty_zero' => 0,
'link_to_node' => 0,
'label_type' => 'none',
'format' => 'Thumb_50x50_linked',
'multiple' => array(
'group' => 1,
'multiple_number' => '1',
'multiple_from' => '',
'multiple_reversed' => 0,
),
'exclude' => 0,
'id' => 'field_upload_image_fid',
'table' => 'node_data_field_upload_image',
'field' => 'field_upload_image_fid',
'override' => array(
'button' => 'Use default',
),
'relationship' => 'none',
),
'title' => array(
'label' => '',
'alter' => array(
'alter_text' => 0,
'text' => '',
'make_link' => 0,
'path' => '',
'link_class' => '',
'alt' => '',
'prefix' => '',
'suffix' => '',
'target' => '',
'help' => '',
'trim' => 1,
'max_length' => '55',
'word_boundary' => 1,
'ellipsis' => 0,
'strip_tags' => 0,
'html' => 0,
),
'empty' => '',
'hide_empty' => 0,
'empty_zero' => 0,
'link_to_node' => 1,
'exclude' => 0,
'id' => 'title',
'table' => 'node',
'field' => 'title',
'override' => array(
'button' => 'Use default',
),
'relationship' => 'none',
),
));
$handler->override_option('arguments', array(
'gid' => array(
'default_action' => 'default',
'style_plugin' => 'default_summary',
'style_options' => array(),
'wildcard' => 'all',
'wildcard_substitution' => 'All',
'title' => '',
'breadcrumb' => '',
'default_argument_type' => 'current_domain',
'default_argument' => '',
'validate_type' => 'none',
'validate_fail' => 'not found',
'id' => 'gid',
'table' => 'domain_access',
'field' => 'gid',
'validate_user_argument_type' => 'uid',
'validate_user_roles' => array(
'2' => 0,
),
'override' => array(
'button' => 'Use default',
),
'relationship' => 'none',
'default_options_div_prefix' => '',
'default_argument_user' => 0,
'default_argument_fixed' => '',
'default_argument_php' => '',
'validate_argument_node_type' => array(
'associations' => 0,
'blogs' => 0,
'company_profile' => 0,
'company_reports' => 0,
'events' => 0,
'industry_focus' => 0,
'market_sectors' => 0,
'page' => 0,
),
'validate_argument_node_access' => 0,
'validate_argument_nid_type' => 'nid',
'validate_argument_vocabulary' => array(
'1' => 0,
'6' => 0,
'7' => 0,
'3' => 0,
'2' => 0,
'5' => 0,
),
'validate_argument_type' => 'tid',
'validate_argument_transform' => 0,
'validate_user_restrict_roles' => 0,
'validate_argument_php' => '',
),
));
$handler->override_option('filters', array(
'status' => array(
'operator' => '=',
'value' => '1',
'group' => '0',
'exposed' => FALSE,
'expose' => array(
'operator' => FALSE,
'label' => '',
),
'id' => 'status',
'table' => 'node',
'field' => 'status',
'override' => array(
'button' => 'Override',
),
'relationship' => 'none',
),
'type' => array(
'operator' => 'in',
'value' => array(
'news' => 'news',
),
'group' => '0',
'exposed' => FALSE,
'expose' => array(
'operator' => FALSE,
'label' => '',
),
'id' => 'type',
'table' => 'node',
'field' => 'type',
'override' => array(
'button' => 'Use default',
),
'relationship' => 'none',
),
'delta' => array(
'operator' => 'not empty',
'value' => array(
'value' => '',
'min' => '',
'max' => '',
),
'group' => '0',
'exposed' => FALSE,
'expose' => array(
'operator' => FALSE,
'label' => '',
),
'id' => 'delta',
'table' => 'node_data_field_upload_image',
'field' => 'delta',
'override' => array(
'button' => 'Use default',
),
'relationship' => 'none',
),
'field_news_feature_value_many_to_one' => array(
'operator' => 'or',
'value' => array(
'0' => '0',
),
'group' => '0',
'exposed' => FALSE,
'expose' => array(
'operator' => FALSE,
'label' => '',
),
'id' => 'field_news_feature_value_many_to_one',
'table' => 'node_data_field_news_feature',
'field' => 'field_news_feature_value_many_to_one',
'override' => array(
'button' => 'Use default',
),
'relationship' => 'none',
'reduce_duplicates' => 0,
),
));
$handler->override_option('style_plugin', 'viewscarousel');
$handler->override_option('style_options', array(
'grouping' => '',
'skin' => 'custom',
'skin_path' => 'sites/all/themes/exdigital/carousel/style.css',
'vertical' => 0,
'start' => '',
'offset' => '',
'scroll' => '1',
'visible' => 0,
'animation' => 'fast',
'easing' => '',
'auto' => '0',
'wrap' => 'both',
));
$handler->override_option('row_plugin', 'fields');
$handler->override_option('row_options', array());
$handler->override_option('block_description', 'Block: TopStories Slide');
$handler->override_option('block_caching', -1);
$handler = $view->new_display('block', 'BlockFrontNews', 'block_3');
$handler->override_option('fields', array(
'field_upload_image_fid' => array(
'label' => '',
'alter' => array(
'alter_text' => 0,
'text' => '',
'make_link' => 0,
'path' => '',
'link_class' => '',
'alt' => '',
'prefix' => '',
'suffix' => '',
'target' => '',
'help' => '',
'trim' => 0,
'max_length' => '',
'word_boundary' => 1,
'ellipsis' => 1,
'strip_tags' => 0,
'html' => 0,
),
'empty' => '',
'hide_empty' => 0,
'empty_zero' => 0,
'link_to_node' => 0,
'label_type' => 'none',
'format' => 'Slide_Front_430_linked',
'multiple' => array(
'group' => 0,
'multiple_number' => '',
'multiple_from' => '',
'multiple_reversed' => 0,
),
'exclude' => 0,
'id' => 'field_upload_image_fid',
'table' => 'node_data_field_upload_image',
'field' => 'field_upload_image_fid',
'override' => array(
'button' => 'Use default',
),
'relationship' => 'none',
),
'title' => array(
'label' => '',
'alter' => array(
'alter_text' => 0,
'text' => '',
'make_link' => 0,
'path' => '',
'link_class' => '',
'alt' => '',
'prefix' => '',
'suffix' => '',
'target' => '',
'help' => '',
'trim' => 1,
'max_length' => '55',
'word_boundary' => 1,
'ellipsis' => 0,
'strip_tags' => 0,
'html' => 0,
),
'empty' => '',
'hide_empty' => 0,
'empty_zero' => 0,
'link_to_node' => 1,
'exclude' => 0,
'id' => 'title',
'table' => 'node',
'field' => 'title',
'override' => array(
'button' => 'Use default',
),
'relationship' => 'none',
),
'field_headline_caption_value' => array(
'label' => '',
'alter' => array(
'alter_text' => 0,
'text' => '',
'make_link' => 0,
'path' => '',
'link_class' => '',
'alt' => '',
'prefix' => '',
'suffix' => '',
'target' => '',
'help' => '',
'trim' => 1,
'max_length' => '150',
'word_boundary' => 1,
'ellipsis' => 0,
'strip_tags' => 1,
'html' => 0,
),
'empty' => '',
'hide_empty' => 0,
'empty_zero' => 0,
'link_to_node' => 0,
'label_type' => 'none',
'format' => 'default',
'multiple' => array(
'group' => TRUE,
'multiple_number' => '',
'multiple_from' => '',
'multiple_reversed' => FALSE,
),
'exclude' => 0,
'id' => 'field_headline_caption_value',
'table' => 'node_data_field_headline_caption',
'field' => 'field_headline_caption_value',
'override' => array(
'button' => 'Use default',
),
'relationship' => 'none',
),
));
$handler->override_option('arguments', array(
'gid' => array(
'default_action' => 'default',
'style_plugin' => 'default_summary',
'style_options' => array(),
'wildcard' => 'all',
'wildcard_substitution' => 'All',
'title' => '',
'breadcrumb' => '',
'default_argument_type' => 'current_domain',
'default_argument' => '',
'validate_type' => 'none',
'validate_fail' => 'not found',
'id' => 'gid',
'table' => 'domain_access',
'field' => 'gid',
'validate_user_argument_type' => 'uid',
'validate_user_roles' => array(
'2' => 0,
),
'override' => array(
'button' => 'Use default',
),
'relationship' => 'none',
'default_options_div_prefix' => '',
'default_argument_user' => 0,
'default_argument_fixed' => '',
'default_argument_php' => '',
'validate_argument_node_type' => array(
'association' => 0,
'blogs' => 0,
'company_reports' => 0,
'events' => 0,
'industry_focus' => 0,
'market_sectors' => 0,
'news' => 0,
'page' => 0,
),
'validate_argument_node_access' => 0,
'validate_argument_nid_type' => 'nid',
'validate_argument_vocabulary' => array(
'1' => 0,
'6' => 0,
'7' => 0,
'3' => 0,
'2' => 0,
'5' => 0,
),
'validate_argument_type' => 'tid',
'validate_argument_transform' => 0,
'validate_user_restrict_roles' => 0,
'validate_argument_php' => '',
),
));
$handler->override_option('filters', array(
'status' => array(
'operator' => '=',
'value' => '1',
'group' => '0',
'exposed' => FALSE,
'expose' => array(
'operator' => FALSE,
'label' => '',
),
'id' => 'status',
'table' => 'node',
'field' => 'status',
'override' => array(
'button' => 'Override',
),
'relationship' => 'none',
),
'type' => array(
'operator' => 'in',
'value' => array(
'news' => 'news',
),
'group' => '0',
'exposed' => FALSE,
'expose' => array(
'operator' => FALSE,
'label' => '',
),
'id' => 'type',
'table' => 'node',
'field' => 'type',
'override' => array(
'button' => 'Use default',
),
'relationship' => 'none',
),
'field_news_feature_value_many_to_one' => array(
'operator' => 'or',
'value' => array(
'2' => '2',
),
'group' => '0',
'exposed' => FALSE,
'expose' => array(
'operator' => FALSE,
'label' => '',
),
'id' => 'field_news_feature_value_many_to_one',
'table' => 'node_data_field_news_feature',
'field' => 'field_news_feature_value_many_to_one',
'override' => array(
'button' => 'Use default',
),
'relationship' => 'none',
'reduce_duplicates' => 0,
),
));
$handler->override_option('title', 'News');
$handler->override_option('use_ajax', FALSE);
$handler->override_option('items_per_page', 5);
$handler->override_option('block_description', 'BlockFrontNews');
$handler->override_option('block_caching', -1);
There is an option to trim the field length on the view field settings, but heard to tell what is going on with out more information such as what templates are overridden, css, etc.
Can you export the view and post it?
Found the solution.The view was using row style plugin which themed it in the node-[node-type].tpl file.

GMAP & Location - Coordinates show but cannot show node information

I set up a view with a type of gmap. If I change it to grid, all of the field values output fine. When I switch to gmap, the coordinates show up on the map but I can't get any info on the coordinates/markers.
I am very very stuck. I have gone at this several different ways. You can see the example here: http://speakitnow.com/immersionschools
<div class="views-field-title">
<label class="views-label-title">
Title:
</label>
<span class="field-content"></span>
</div>
After running into the same issue even with 6.x-1.1-rc1 it looks like the version here fixes the issue: http://drupal.org/node/95786
which versions of the modules are you using?
There is a patch at the issue queue for gmap that fixes some of the issues
If it helps, here is my export of a view that is similar to what you're trying to achieve:
http://www.thegalleryguide.co.uk/galleries
This is on Drupal 6.15, with views 6.x-2.8, GMap 6.x-1.1-rc1, GMap Location 6.x-1.1-rc1
$view = new view;
$view->name = 'galleries_map';
$view->description = 'Galleries - Map';
$view->tag = '';
$view->view_php = '';
$view->base_table = 'node';
$view->is_cacheable = FALSE;
$view->api_version = 2;
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
$handler = $view->new_display('default', 'Defaults', 'default');
$handler->override_option('relationships', array(
'nid' => array(
'id' => 'nid',
'table' => 'location_instance',
'field' => 'nid',
),
));
$handler->override_option('fields', array(
'field_images_fid' => array(
'label' => '',
'alter' => array(
'alter_text' => 0,
'text' => '',
'make_link' => 0,
'path' => '',
'link_class' => '',
'alt' => '',
'prefix' => '',
'suffix' => '',
'target' => '',
'help' => '',
'trim' => 0,
'max_length' => '',
'word_boundary' => 1,
'ellipsis' => 1,
'strip_tags' => 0,
'html' => 0,
),
'empty' => '',
'hide_empty' => 0,
'empty_zero' => 0,
'link_to_node' => 0,
'label_type' => 'none',
'format' => 'thumb_linked',
'multiple' => array(
'group' => 1,
'multiple_number' => '1',
'multiple_from' => '',
'multiple_reversed' => 0,
),
'exclude' => 0,
'id' => 'field_images_fid',
'table' => 'node_data_field_images',
'field' => 'field_images_fid',
'override' => array(
'button' => 'Override',
),
'relationship' => 'none',
),
'title' => array(
'label' => '',
'alter' => array(
'alter_text' => 0,
'text' => '',
'make_link' => 0,
'path' => '',
'link_class' => '',
'alt' => '',
'prefix' => '',
'suffix' => '',
'help' => '',
'trim' => 0,
'max_length' => '',
'word_boundary' => 1,
'ellipsis' => 1,
'strip_tags' => 0,
'html' => 0,
),
'link_to_node' => 1,
'exclude' => 0,
'id' => 'title',
'table' => 'node',
'field' => 'title',
'relationship' => 'none',
),
'street' => array(
'label' => '',
'alter' => array(
'alter_text' => 0,
'text' => '',
'make_link' => 0,
'path' => '',
'link_class' => '',
'alt' => '',
'prefix' => '',
'suffix' => '',
'help' => '',
'trim' => 0,
'max_length' => '',
'word_boundary' => 1,
'ellipsis' => 1,
'strip_tags' => 0,
'html' => 0,
),
'style' => 'both',
'exclude' => 0,
'id' => 'street',
'table' => 'location',
'field' => 'street',
'relationship' => 'none',
),
'postal_code' => array(
'label' => '',
'alter' => array(
'alter_text' => 0,
'text' => '',
'make_link' => 0,
'path' => '',
'link_class' => '',
'alt' => '',
'prefix' => '',
'suffix' => '',
'help' => '',
'trim' => 0,
'max_length' => '',
'word_boundary' => 1,
'ellipsis' => 1,
'strip_tags' => 0,
'html' => 0,
),
'exclude' => 0,
'id' => 'postal_code',
'table' => 'location',
'field' => 'postal_code',
'relationship' => 'none',
),
'teaser' => array(
'label' => '',
'alter' => array(
'alter_text' => 0,
'text' => '',
'make_link' => 0,
'path' => '',
'link_class' => '',
'alt' => '',
'prefix' => '',
'suffix' => '',
'target' => '',
'help' => '',
'trim' => 1,
'max_length' => '100',
'word_boundary' => 1,
'ellipsis' => 1,
'strip_tags' => 0,
'html' => 0,
),
'empty' => '',
'hide_empty' => 0,
'empty_zero' => 0,
'exclude' => 0,
'id' => 'teaser',
'table' => 'node_revisions',
'field' => 'teaser',
'relationship' => 'none',
'override' => array(
'button' => 'Override',
),
),
'tid' => array(
'label' => '',
'alter' => array(
'alter_text' => 0,
'text' => '',
'make_link' => 0,
'path' => '',
'link_class' => '',
'alt' => '',
'prefix' => '',
'suffix' => '',
'help' => '',
'trim' => 0,
'max_length' => '',
'word_boundary' => 1,
'ellipsis' => 1,
'strip_tags' => 0,
'html' => 0,
),
'type' => 'separator',
'separator' => ', ',
'empty' => '',
'link_to_taxonomy' => 0,
'limit' => 1,
'vids' => array(
'3' => 3,
'2' => 0,
'4' => 0,
'5' => 0,
),
'exclude' => 0,
'id' => 'tid',
'table' => 'term_node',
'field' => 'tid',
'relationship' => 'none',
),
'view_node' => array(
'label' => '',
'alter' => array(
'alter_text' => 0,
'text' => '',
'make_link' => 0,
'path' => '',
'link_class' => '',
'alt' => '',
'prefix' => '',
'suffix' => '',
'target' => '',
'help' => '',
'trim' => 0,
'max_length' => '',
'word_boundary' => 1,
'ellipsis' => 1,
'strip_tags' => 0,
'html' => 0,
),
'empty' => '',
'hide_empty' => 0,
'empty_zero' => 0,
'text' => 'More...',
'exclude' => 0,
'id' => 'view_node',
'table' => 'node',
'field' => 'view_node',
'override' => array(
'button' => 'Override',
),
'relationship' => 'none',
),
));
$handler->override_option('sorts', array(
'distance' => array(
'order' => 'ASC',
'origin' => 'user',
'units' => 'km',
'latitude' => '',
'longitude' => '',
'id' => 'distance',
'table' => 'location',
'field' => 'distance',
),
));
$handler->override_option('filters', array(
'type' => array(
'operator' => 'in',
'value' => array(
'gallery' => 'gallery',
),
'group' => '0',
'exposed' => FALSE,
'expose' => array(
'operator' => FALSE,
'label' => '',
),
'id' => 'type',
'table' => 'node',
'field' => 'type',
'relationship' => 'none',
),
));
$handler->override_option('access', array(
'type' => 'none',
));
$handler->override_option('cache', array(
'type' => 'none',
));
$handler->override_option('title', 'Galleries');
$handler->override_option('items_per_page', 0);
$handler->override_option('style_plugin', 'gmap');
$handler->override_option('style_options', array(
'grouping' => '',
'macro' => '[gmap ]',
'datasource' => 'location',
'latfield' => 'field_images_fid',
'lonfield' => 'field_images_fid',
'markers' => 'static',
'markerfield' => 'field_images_fid',
'markertype' => 'small blue',
));
$handler->override_option('row_options', array(
'inline' => array(),
'separator' => '',
'hide_empty' => 0,
));
$handler = $view->new_display('page', 'Page', 'page_1');
$handler->override_option('path', 'galleries');
$handler->override_option('menu', array(
'type' => 'normal',
'title' => 'Galleries',
'description' => '',
'weight' => '1',
'name' => 'primary-links',
));
$handler->override_option('tab_options', array(
'type' => 'none',
'title' => '',
'description' => '',
'weight' => 0,
));
$handler = $view->new_display('block', 'Nearest galleries', 'block_1');
$handler->override_option('relationships', array(
'nid' => array(
'label' => 'Location: Node',
'required' => 1,
'id' => 'nid',
'table' => 'location_instance',
'field' => 'nid',
'override' => array(
'button' => 'Use default',
),
'relationship' => 'none',
),
));
$handler->override_option('sorts', array(
'distance' => array(
'order' => 'ASC',
'origin' => 'user',
'units' => 'km',
'latitude' => '',
'longitude' => '',
'id' => 'distance',
'table' => 'location',
'field' => 'distance',
'override' => array(
'button' => 'Use default',
),
'relationship' => 'nid',
),
));
$handler->override_option('arguments', array(
'nid' => array(
'default_action' => 'default',
'style_plugin' => 'default_summary',
'style_options' => array(),
'wildcard' => 'all',
'wildcard_substitution' => 'All',
'title' => '',
'breadcrumb' => '',
'default_argument_type' => 'node',
'default_argument' => '',
'validate_type' => 'none',
'validate_fail' => 'not found',
'break_phrase' => 0,
'not' => 0,
'id' => 'nid',
'table' => 'node',
'field' => 'nid',
'validate_user_argument_type' => 'uid',
'validate_user_roles' => array(
'2' => 0,
'4' => 0,
'3' => 0,
),
'override' => array(
'button' => 'Use default',
),
'relationship' => 'nid',
'default_options_div_prefix' => '',
'default_argument_user' => 0,
'default_argument_fixed' => '',
'default_argument_php' => '',
'validate_argument_node_type' => array(
'webform' => 0,
'poll' => 0,
'image' => 0,
'artist' => 0,
'exhibition' => 0,
'faqs' => 0,
'gallery' => 0,
'link' => 0,
'page' => 0,
'story' => 0,
),
'validate_argument_node_access' => 0,
'validate_argument_nid_type' => 'nid',
'validate_argument_vocabulary' => array(
'2' => 0,
'4' => 0,
'5' => 0,
'3' => 0,
),
'validate_argument_type' => 'tid',
'validate_argument_transform' => 0,
'validate_user_restrict_roles' => 0,
'image_size' => array(
'_original' => '_original',
'thumbnail' => 'thumbnail',
'preview' => 'preview',
),
'validate_argument_php' => '',
),
));
$handler->override_option('filters', array(
'type' => array(
'operator' => 'in',
'value' => array(
'gallery' => 'gallery',
),
'group' => '0',
'exposed' => FALSE,
'expose' => array(
'operator' => FALSE,
'label' => '',
),
'id' => 'type',
'table' => 'node',
'field' => 'type',
'relationship' => 'none',
),
'distance' => array(
'operator' => 'dist',
'value' => array(
'latitude' => '',
'longitude' => '',
'postal_code' => '',
'country' => '',
'search_distance' => '100',
'search_units' => 'mile',
),
'group' => '0',
'exposed' => FALSE,
'expose' => array(
'operator' => FALSE,
'label' => '',
),
'type' => 'latlon',
'identifier' => 'dist',
'id' => 'distance',
'table' => 'location',
'field' => 'distance',
'override' => array(
'button' => 'Use default',
),
'relationship' => 'nid',
),
));
$handler->override_option('items_per_page', 5);
$handler->override_option('style_plugin', 'default');
$handler->override_option('style_options', array(
'grouping' => '',
));
$handler->override_option('row_options', array());
$handler->override_option('block_description', '');
$handler->override_option('block_caching', -1);

Resources