DrupalBin
Submit Code
About
Recent Posts
Code
Fix for Fix for Code
Fix for Code
Code
Node type whitelist
an axe coach accessories
coach purses married
Fix for de las ghd alturas
de las ghd alturas
Code
more
User login
Log in using OpenID:
What is OpenID?
Username:
*
Password:
*
Log in using OpenID
Cancel OpenID login
Create new account
Request new password
Tags
CCK
drupal
fapi
jquery
menu
module
php
simpletest
taxonomy
test
theme
views
more tags
Home
Fix for Fix for Fix for views de catalogo de produtos
View
Fix
July 4, 2010 - 10:12am — Anonymous
$view = new view;
$view->name = 'produtos';
$view->description = '';
$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', 'Padrões', 'default');
$handler->override_option('fields', array(
'stock' => 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,
'set_precision' => FALSE,
'precision' => 0,
'decimal' => '.',
'separator' => '.',
'prefix' => '',
'suffix' => '',
'exclude' => 1,
'id' => 'stock',
'table' => 'uc_product_stock',
'field' => 'stock',
'override' => array(
'button' => 'Sobrescrever',
),
'relationship' => 'none',
),
'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' => 1,
'empty_zero' => 0,
'link_to_node' => 1,
'exclude' => 0,
'id' => 'title',
'table' => 'node',
'field' => 'title',
'relationship' => 'none',
),
'field_image_cache_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,
'html' => 0,
'strip_tags' => 0,
),
'empty' => '',
'hide_empty' => 0,
'empty_zero' => 0,
'link_to_node' => 0,
'label_type' => 'none',
'format' => 'product_list_linked',
'multiple' => array(
'group' => 1,
'multiple_number' => '1',
'multiple_from' => '0',
'multiple_reversed' => 0,
),
'exclude' => 0,
'id' => 'field_image_cache_fid',
'table' => 'node_data_field_image_cache',
'field' => 'field_image_cache_fid',
'relationship' => 'none',
),
'phpcode' => 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,
'value' => '
<?php
if
(
$data
-
>
uc_product_stock_stock
==0
)
{
print
\
'<p class="indisponivel">Produto indisponível</p>
\'
;
} else {
$object = node_load($data->nid);
if($object->list_price > 0) {
print
\'
<span class="preco-de">De: <span class="preco-de-valor">
\'
. uc_currency_format($object->list_price) .
\'
</span> </span><span class="preco-por">Por: <span class="preco-por-valor">
\'
. uc_currency_format($object->sell_price) .
\'
</span></span>
\'
;
} else {
print
\'
<span class="preco-por-valor">
\'
. uc_currency_format($object->sell_price) .
\'
</span>
\'
;
}
}
?>
',
'exclude' => 0,
'id' => 'phpcode',
'table' => 'customfield',
'field' => 'phpcode',
'override' => array(
'button' => 'Sobrescrever',
),
'relationship' => 'none',
),
));
$handler->override_option('sorts', array(
'created' => array(
'order' => 'DESC',
'granularity' => 'second',
'id' => 'created',
'table' => 'node',
'field' => 'created',
'relationship' => 'none',
),
'stock' => array(
'order' => 'DESC',
'id' => 'stock',
'table' => 'uc_product_stock',
'field' => 'stock',
'override' => array(
'button' => 'Sobrescrever',
),
'relationship' => 'none',
),
));
$handler->override_option('arguments', array(
'tid' => array(
'default_action' => 'ignore',
'style_plugin' => 'default_summary',
'style_options' => array(),
'wildcard' => 'all',
'wildcard_substitution' => 'Tudo',
'title' => '',
'breadcrumb' => '',
'default_argument_type' => 'fixed',
'default_argument' => '',
'validate_type' => 'none',
'validate_fail' => 'not found',
'break_phrase' => 0,
'add_table' => 0,
'require_value' => 0,
'reduce_duplicates' => 1,
'set_breadcrumb' => 1,
'id' => 'tid',
'table' => 'term_node',
'field' => 'tid',
'validate_user_argument_type' => 'uid',
'validate_user_roles' => array(
'2' => 0,
'5' => 0,
),
'relationship' => 'none',
'default_options_div_prefix' => '',
'default_argument_fixed' => '',
'default_argument_user' => 0,
'default_argument_php' => '',
'validate_argument_node_type' => array(
'product' => 0,
'noticia' => 0,
'pagina' => 0,
),
'validate_argument_node_access' => 0,
'validate_argument_nid_type' => 'nid',
'validate_argument_vocabulary' => array(
'1' => 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',
'relationship' => 'none',
),
'type' => array(
'operator' => 'in',
'value' => array(
'product' => 'product',
),
'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('items_per_page', 20);
$handler->override_option('use_pager', '1');
$handler->override_option('distinct', 1);
$handler->override_option('style_plugin', 'grid');
$handler->override_option('style_options', array(
'grouping' => '',
'columns' => '4',
'alignment' => 'horizontal',
));
$handler = $view->new_display('block', 'Bloco lista categorias', 'block_1');
$handler->override_option('arguments', array(
'tid' => array(
'default_action' => 'summary asc',
'style_plugin' => 'default_summary',
'style_options' => array(
'count' => 1,
'override' => 0,
'items_per_page' => '25',
),
'wildcard' => 'all',
'wildcard_substitution' => 'Tudo',
'title' => '',
'breadcrumb' => '',
'default_argument_type' => 'fixed',
'default_argument' => '',
'validate_type' => 'taxonomy_term',
'validate_fail' => 'not found',
'break_phrase' => 0,
'add_table' => 0,
'require_value' => 0,
'reduce_duplicates' => 1,
'set_breadcrumb' => 1,
'id' => 'tid',
'table' => 'term_node',
'field' => 'tid',
'validate_user_argument_type' => 'uid',
'validate_user_roles' => array(
'2' => 0,
'5' => 0,
),
'relationship' => 'none',
'default_options_div_prefix' => '',
'default_argument_fixed' => '',
'default_argument_user' => 0,
'default_argument_php' => '',
'validate_argument_node_type' => array(
'product' => 0,
'noticia' => 0,
'pagina' => 0,
),
'validate_argument_node_access' => 0,
'validate_argument_nid_type' => 'nid',
'validate_argument_vocabulary' => array(
'1' => 1,
),
'validate_argument_type' => 'tid',
'validate_argument_transform' => 0,
'validate_user_restrict_roles' => 0,
'validate_argument_php' => '',
'override' => array(
'button' => 'Use default',
),
),
));
$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(
'product' => 'product',
),
'group' => '0',
'exposed' => FALSE,
'expose' => array(
'operator' => FALSE,
'label' => '',
),
'id' => 'type',
'table' => 'node',
'field' => 'type',
'relationship' => 'none',
),
'vid' => array(
'operator' => 'in',
'value' => array(
'1' => '1',
),
'group' => '0',
'exposed' => FALSE,
'expose' => array(
'operator' => FALSE,
'label' => '',
),
'id' => 'vid',
'table' => 'term_data',
'field' => 'vid',
'override' => array(
'button' => 'Use default',
),
'relationship' => 'none',
),
));
$handler->override_option('title', 'Categorias');
$handler->override_option('items_per_page', 0);
$handler->override_option('use_pager', '0');
$handler->override_option('block_description', '');
$handler->override_option('block_caching', -1);
$handler = $view->new_display('page', 'Página principal', 'page_1');
$handler->override_option('path', 'produtos');
$handler->override_option('menu', array(
'type' => 'none',
'title' => '',
'description' => '',
'weight' => 0,
'name' => 'navigation',
));
$handler->override_option('tab_options', array(
'type' => 'none',
'title' => '',
'description' => '',
'weight' => 0,
'name' => 'navigation',
));
$handler = $view->new_display('feed', 'Feed principal', 'feed_1');
$handler->override_option('items_per_page', 10);
$handler->override_option('style_plugin', 'rss');
$handler->override_option('style_options', array(
'mission_description' => FALSE,
'description' => '',
));
$handler->override_option('row_plugin', 'node_rss');
$handler->override_option('path', 'produtos/feed');
$handler->override_option('menu', array(
'type' => 'none',
'title' => '',
'description' => '',
'weight' => 0,
'name' => 'navigation',
));
$handler->override_option('tab_options', array(
'type' => 'none',
'title' => '',
'description' => '',
'weight' => 0,
'name' => 'navigation',
));
$handler->override_option('displays', array());
$handler->override_option('sitename_title', 1);
produtos
ubercart
views
Submit Fix
Summary:
Tags:
Any tags you'd like to associate with your code, delimitered by commas (example: Views, CCK, Module, etc).
Show summary in full view
$view = new view; $view->name = 'produtos'; $view->description = ''; $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', 'Padrões', 'default'); $handler->override_option('fields', array( 'stock' => 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, 'set_precision' => FALSE, 'precision' => 0, 'decimal' => '.', 'separator' => '.', 'prefix' => '', 'suffix' => '', 'exclude' => 1, 'id' => 'stock', 'table' => 'uc_product_stock', 'field' => 'stock', 'override' => array( 'button' => 'Sobrescrever', ), 'relationship' => 'none', ), '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' => 1, 'empty_zero' => 0, 'link_to_node' => 1, 'exclude' => 0, 'id' => 'title', 'table' => 'node', 'field' => 'title', 'relationship' => 'none', ), 'field_image_cache_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, 'html' => 0, 'strip_tags' => 0, ), 'empty' => '', 'hide_empty' => 0, 'empty_zero' => 0, 'link_to_node' => 0, 'label_type' => 'none', 'format' => 'product_list_linked', 'multiple' => array( 'group' => 1, 'multiple_number' => '1', 'multiple_from' => '0', 'multiple_reversed' => 0, ), 'exclude' => 0, 'id' => 'field_image_cache_fid', 'table' => 'node_data_field_image_cache', 'field' => 'field_image_cache_fid', 'relationship' => 'none', ), 'phpcode' => 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, 'value' => '<?php if($data->uc_product_stock_stock==0) { print \'<p class="indisponivel">Produto indisponível</p>\'; } else { $object = node_load($data->nid); if($object->list_price > 0) { print \'<span class="preco-de">De: <span class="preco-de-valor">\' . uc_currency_format($object->list_price) . \'</span> </span><span class="preco-por">Por: <span class="preco-por-valor">\' . uc_currency_format($object->sell_price) . \'</span></span>\'; } else { print \'<span class="preco-por-valor">\' . uc_currency_format($object->sell_price) . \'</span>\'; } } ?>', 'exclude' => 0, 'id' => 'phpcode', 'table' => 'customfield', 'field' => 'phpcode', 'override' => array( 'button' => 'Sobrescrever', ), 'relationship' => 'none', ), )); $handler->override_option('sorts', array( 'created' => array( 'order' => 'DESC', 'granularity' => 'second', 'id' => 'created', 'table' => 'node', 'field' => 'created', 'relationship' => 'none', ), 'stock' => array( 'order' => 'DESC', 'id' => 'stock', 'table' => 'uc_product_stock', 'field' => 'stock', 'override' => array( 'button' => 'Sobrescrever', ), 'relationship' => 'none', ), )); $handler->override_option('arguments', array( 'tid' => array( 'default_action' => 'ignore', 'style_plugin' => 'default_summary', 'style_options' => array(), 'wildcard' => 'all', 'wildcard_substitution' => 'Tudo', 'title' => '', 'breadcrumb' => '', 'default_argument_type' => 'fixed', 'default_argument' => '', 'validate_type' => 'none', 'validate_fail' => 'not found', 'break_phrase' => 0, 'add_table' => 0, 'require_value' => 0, 'reduce_duplicates' => 1, 'set_breadcrumb' => 1, 'id' => 'tid', 'table' => 'term_node', 'field' => 'tid', 'validate_user_argument_type' => 'uid', 'validate_user_roles' => array( '2' => 0, '5' => 0, ), 'relationship' => 'none', 'default_options_div_prefix' => '', 'default_argument_fixed' => '', 'default_argument_user' => 0, 'default_argument_php' => '', 'validate_argument_node_type' => array( 'product' => 0, 'noticia' => 0, 'pagina' => 0, ), 'validate_argument_node_access' => 0, 'validate_argument_nid_type' => 'nid', 'validate_argument_vocabulary' => array( '1' => 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', 'relationship' => 'none', ), 'type' => array( 'operator' => 'in', 'value' => array( 'product' => 'product', ), '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('items_per_page', 20); $handler->override_option('use_pager', '1'); $handler->override_option('distinct', 1); $handler->override_option('style_plugin', 'grid'); $handler->override_option('style_options', array( 'grouping' => '', 'columns' => '4', 'alignment' => 'horizontal', )); $handler = $view->new_display('block', 'Bloco lista categorias', 'block_1'); $handler->override_option('arguments', array( 'tid' => array( 'default_action' => 'summary asc', 'style_plugin' => 'default_summary', 'style_options' => array( 'count' => 1, 'override' => 0, 'items_per_page' => '25', ), 'wildcard' => 'all', 'wildcard_substitution' => 'Tudo', 'title' => '', 'breadcrumb' => '', 'default_argument_type' => 'fixed', 'default_argument' => '', 'validate_type' => 'taxonomy_term', 'validate_fail' => 'not found', 'break_phrase' => 0, 'add_table' => 0, 'require_value' => 0, 'reduce_duplicates' => 1, 'set_breadcrumb' => 1, 'id' => 'tid', 'table' => 'term_node', 'field' => 'tid', 'validate_user_argument_type' => 'uid', 'validate_user_roles' => array( '2' => 0, '5' => 0, ), 'relationship' => 'none', 'default_options_div_prefix' => '', 'default_argument_fixed' => '', 'default_argument_user' => 0, 'default_argument_php' => '', 'validate_argument_node_type' => array( 'product' => 0, 'noticia' => 0, 'pagina' => 0, ), 'validate_argument_node_access' => 0, 'validate_argument_nid_type' => 'nid', 'validate_argument_vocabulary' => array( '1' => 1, ), 'validate_argument_type' => 'tid', 'validate_argument_transform' => 0, 'validate_user_restrict_roles' => 0, 'validate_argument_php' => '', 'override' => array( 'button' => 'Use default', ), ), )); $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( 'product' => 'product', ), 'group' => '0', 'exposed' => FALSE, 'expose' => array( 'operator' => FALSE, 'label' => '', ), 'id' => 'type', 'table' => 'node', 'field' => 'type', 'relationship' => 'none', ), 'vid' => array( 'operator' => 'in', 'value' => array( '1' => '1', ), 'group' => '0', 'exposed' => FALSE, 'expose' => array( 'operator' => FALSE, 'label' => '', ), 'id' => 'vid', 'table' => 'term_data', 'field' => 'vid', 'override' => array( 'button' => 'Use default', ), 'relationship' => 'none', ), )); $handler->override_option('title', 'Categorias'); $handler->override_option('items_per_page', 0); $handler->override_option('use_pager', '0'); $handler->override_option('block_description', ''); $handler->override_option('block_caching', -1); $handler = $view->new_display('page', 'Página principal', 'page_1'); $handler->override_option('path', 'produtos'); $handler->override_option('menu', array( 'type' => 'none', 'title' => '', 'description' => '', 'weight' => 0, 'name' => 'navigation', )); $handler->override_option('tab_options', array( 'type' => 'none', 'title' => '', 'description' => '', 'weight' => 0, 'name' => 'navigation', )); $handler = $view->new_display('feed', 'Feed principal', 'feed_1'); $handler->override_option('items_per_page', 10); $handler->override_option('style_plugin', 'rss'); $handler->override_option('style_options', array( 'mission_description' => FALSE, 'description' => '', )); $handler->override_option('row_plugin', 'node_rss'); $handler->override_option('path', 'produtos/feed'); $handler->override_option('menu', array( 'type' => 'none', 'title' => '', 'description' => '', 'weight' => 0, 'name' => 'navigation', )); $handler->override_option('tab_options', array( 'type' => 'none', 'title' => '', 'description' => '', 'weight' => 0, 'name' => 'navigation', )); $handler->override_option('displays', array()); $handler->override_option('sitename_title', 1);
Syntax highlighting mode:
ActionScript
ColdFusion
Diff
Drupal 5
Drupal 6
HTML
INI
Javascript
MySQL
PHP
Python
robots.txt
SQL
Text
Select the syntax highlighting mode to use.
See Also:
Order
Title:
URL:
-1
0
1
Title:
URL:
-1
0
1
Any links you'd like to have associated with the post (Drupal.org issue, Wikipedia article, etc).
File attachments
Changes made to the attachments are not permanent until you save this post. The first "listed" file will be included in RSS feeds.
Attach new file:
The maximum upload size is
1 MB
. Only files with the following extensions may be uploaded:
jpg jpeg gif png txt doc xls pdf ppt pps odt ods odp phps
.