Fix for Fix for Fix for views de catalogo de produtos

  1. $view = new view;
  2. $view->name = 'produtos';
  3. $view->description = '';
  4. $view->tag = '';
  5. $view->view_php = '';
  6. $view->base_table = 'node';
  7. $view->is_cacheable = FALSE;
  8. $view->api_version = 2;
  9. $view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
  10. $handler = $view->new_display('default', 'Padrões', 'default');
  11. $handler->override_option('fields', array(
  12.   'stock' => array(
  13.     'label' => '',
  14.     'alter' => array(
  15.       'alter_text' => 0,
  16.       'text' => '',
  17.       'make_link' => 0,
  18.       'path' => '',
  19.       'link_class' => '',
  20.       'alt' => '',
  21.       'prefix' => '',
  22.       'suffix' => '',
  23.       'target' => '',
  24.       'help' => '',
  25.       'trim' => 0,
  26.       'max_length' => '',
  27.       'word_boundary' => 1,
  28.       'ellipsis' => 1,
  29.       'html' => 0,
  30.       'strip_tags' => 0,
  31.     ),
  32.     'empty' => '',
  33.     'hide_empty' => 0,
  34.     'empty_zero' => 0,
  35.     'set_precision' => FALSE,
  36.     'precision' => 0,
  37.     'decimal' => '.',
  38.     'separator' => '.',
  39.     'prefix' => '',
  40.     'suffix' => '',
  41.     'exclude' => 1,
  42.     'id' => 'stock',
  43.     'table' => 'uc_product_stock',
  44.     'field' => 'stock',
  45.     'override' => array(
  46.       'button' => 'Sobrescrever',
  47.     ),
  48.     'relationship' => 'none',
  49.   ),
  50.   'title' => array(
  51.     'label' => '',
  52.     'alter' => array(
  53.       'alter_text' => 0,
  54.       'text' => '',
  55.       'make_link' => 0,
  56.       'path' => '',
  57.       'link_class' => '',
  58.       'alt' => '',
  59.       'prefix' => '',
  60.       'suffix' => '',
  61.       'target' => '',
  62.       'help' => '',
  63.       'trim' => 0,
  64.       'max_length' => '',
  65.       'word_boundary' => 1,
  66.       'ellipsis' => 1,
  67.       'html' => 0,
  68.       'strip_tags' => 0,
  69.     ),
  70.     'empty' => '',
  71.     'hide_empty' => 1,
  72.     'empty_zero' => 0,
  73.     'link_to_node' => 1,
  74.     'exclude' => 0,
  75.     'id' => 'title',
  76.     'table' => 'node',
  77.     'field' => 'title',
  78.     'relationship' => 'none',
  79.   ),
  80.   'field_image_cache_fid' => array(
  81.     'label' => '',
  82.     'alter' => array(
  83.       'alter_text' => 0,
  84.       'text' => '',
  85.       'make_link' => 0,
  86.       'path' => '',
  87.       'link_class' => '',
  88.       'alt' => '',
  89.       'prefix' => '',
  90.       'suffix' => '',
  91.       'target' => '',
  92.       'help' => '',
  93.       'trim' => 0,
  94.       'max_length' => '',
  95.       'word_boundary' => 1,
  96.       'ellipsis' => 1,
  97.       'html' => 0,
  98.       'strip_tags' => 0,
  99.     ),
  100.     'empty' => '',
  101.     'hide_empty' => 0,
  102.     'empty_zero' => 0,
  103.     'link_to_node' => 0,
  104.     'label_type' => 'none',
  105.     'format' => 'product_list_linked',
  106.     'multiple' => array(
  107.       'group' => 1,
  108.       'multiple_number' => '1',
  109.       'multiple_from' => '0',
  110.       'multiple_reversed' => 0,
  111.     ),
  112.     'exclude' => 0,
  113.     'id' => 'field_image_cache_fid',
  114.     'table' => 'node_data_field_image_cache',
  115.     'field' => 'field_image_cache_fid',
  116.     'relationship' => 'none',
  117.   ),
  118.   'phpcode' => array(
  119.     'label' => '',
  120.     'alter' => array(
  121.       'alter_text' => 0,
  122.       'text' => '',
  123.       'make_link' => 0,
  124.       'path' => '',
  125.       'link_class' => '',
  126.       'alt' => '',
  127.       'prefix' => '',
  128.       'suffix' => '',
  129.       'target' => '',
  130.       'help' => '',
  131.       'trim' => 0,
  132.       'max_length' => '',
  133.       'word_boundary' => 1,
  134.       'ellipsis' => 1,
  135.       'html' => 0,
  136.       'strip_tags' => 0,
  137.     ),
  138.     'empty' => '',
  139.     'hide_empty' => 0,
  140.     'empty_zero' => 0,
  141.     'value' => '<?php
  142.  
  143. if($data->uc_product_stock_stock==0) {
  144. print \'<p class="indisponivel">Produto indisponível</p>\';
  145. } else {
  146. $object = node_load($data->nid);
  147.  
  148. if($object->list_price > 0) {
  149. 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>\';
  150. } else {
  151. print \'<span class="preco-por-valor">\' . uc_currency_format($object->sell_price) . \'</span>\';
  152. }
  153. }
  154. ?>',
  155.     'exclude' => 0,
  156.     'id' => 'phpcode',
  157.     'table' => 'customfield',
  158.     'field' => 'phpcode',
  159.     'override' => array(
  160.       'button' => 'Sobrescrever',
  161.     ),
  162.     'relationship' => 'none',
  163.   ),
  164. ));
  165. $handler->override_option('sorts', array(
  166.   'created' => array(
  167.     'order' => 'DESC',
  168.     'granularity' => 'second',
  169.     'id' => 'created',
  170.     'table' => 'node',
  171.     'field' => 'created',
  172.     'relationship' => 'none',
  173.   ),
  174.   'stock' => array(
  175.     'order' => 'DESC',
  176.     'id' => 'stock',
  177.     'table' => 'uc_product_stock',
  178.     'field' => 'stock',
  179.     'override' => array(
  180.       'button' => 'Sobrescrever',
  181.     ),
  182.     'relationship' => 'none',
  183.   ),
  184. ));
  185. $handler->override_option('arguments', array(
  186.   'tid' => array(
  187.     'default_action' => 'ignore',
  188.     'style_plugin' => 'default_summary',
  189.     'style_options' => array(),
  190.     'wildcard' => 'all',
  191.     'wildcard_substitution' => 'Tudo',
  192.     'title' => '',
  193.     'breadcrumb' => '',
  194.     'default_argument_type' => 'fixed',
  195.     'default_argument' => '',
  196.     'validate_type' => 'none',
  197.     'validate_fail' => 'not found',
  198.     'break_phrase' => 0,
  199.     'add_table' => 0,
  200.     'require_value' => 0,
  201.     'reduce_duplicates' => 1,
  202.     'set_breadcrumb' => 1,
  203.     'id' => 'tid',
  204.     'table' => 'term_node',
  205.     'field' => 'tid',
  206.     'validate_user_argument_type' => 'uid',
  207.     'validate_user_roles' => array(
  208.       '2' => 0,
  209.       '5' => 0,
  210.     ),
  211.     'relationship' => 'none',
  212.     'default_options_div_prefix' => '',
  213.     'default_argument_fixed' => '',
  214.     'default_argument_user' => 0,
  215.     'default_argument_php' => '',
  216.     'validate_argument_node_type' => array(
  217.       'product' => 0,
  218.       'noticia' => 0,
  219.       'pagina' => 0,
  220.     ),
  221.     'validate_argument_node_access' => 0,
  222.     'validate_argument_nid_type' => 'nid',
  223.     'validate_argument_vocabulary' => array(
  224.       '1' => 0,
  225.     ),
  226.     'validate_argument_type' => 'tid',
  227.     'validate_argument_transform' => 0,
  228.     'validate_user_restrict_roles' => 0,
  229.     'validate_argument_php' => '',
  230.   ),
  231. ));
  232. $handler->override_option('filters', array(
  233.   'status' => array(
  234.     'operator' => '=',
  235.     'value' => '1',
  236.     'group' => '0',
  237.     'exposed' => FALSE,
  238.     'expose' => array(
  239.       'operator' => FALSE,
  240.       'label' => '',
  241.     ),
  242.     'id' => 'status',
  243.     'table' => 'node',
  244.     'field' => 'status',
  245.     'relationship' => 'none',
  246.   ),
  247.   'type' => array(
  248.     'operator' => 'in',
  249.     'value' => array(
  250.       'product' => 'product',
  251.     ),
  252.     'group' => '0',
  253.     'exposed' => FALSE,
  254.     'expose' => array(
  255.       'operator' => FALSE,
  256.       'label' => '',
  257.     ),
  258.     'id' => 'type',
  259.     'table' => 'node',
  260.     'field' => 'type',
  261.     'relationship' => 'none',
  262.   ),
  263. ));
  264. $handler->override_option('access', array(
  265.   'type' => 'none',
  266. ));
  267. $handler->override_option('cache', array(
  268.   'type' => 'none',
  269. ));
  270. $handler->override_option('items_per_page', 20);
  271. $handler->override_option('use_pager', '1');
  272. $handler->override_option('distinct', 1);
  273. $handler->override_option('style_plugin', 'grid');
  274. $handler->override_option('style_options', array(
  275.   'grouping' => '',
  276.   'columns' => '4',
  277.   'alignment' => 'horizontal',
  278. ));
  279. $handler = $view->new_display('block', 'Bloco lista categorias', 'block_1');
  280. $handler->override_option('arguments', array(
  281.   'tid' => array(
  282.     'default_action' => 'summary asc',
  283.     'style_plugin' => 'default_summary',
  284.     'style_options' => array(
  285.       'count' => 1,
  286.       'override' => 0,
  287.       'items_per_page' => '25',
  288.     ),
  289.     'wildcard' => 'all',
  290.     'wildcard_substitution' => 'Tudo',
  291.     'title' => '',
  292.     'breadcrumb' => '',
  293.     'default_argument_type' => 'fixed',
  294.     'default_argument' => '',
  295.     'validate_type' => 'taxonomy_term',
  296.     'validate_fail' => 'not found',
  297.     'break_phrase' => 0,
  298.     'add_table' => 0,
  299.     'require_value' => 0,
  300.     'reduce_duplicates' => 1,
  301.     'set_breadcrumb' => 1,
  302.     'id' => 'tid',
  303.     'table' => 'term_node',
  304.     'field' => 'tid',
  305.     'validate_user_argument_type' => 'uid',
  306.     'validate_user_roles' => array(
  307.       '2' => 0,
  308.       '5' => 0,
  309.     ),
  310.     'relationship' => 'none',
  311.     'default_options_div_prefix' => '',
  312.     'default_argument_fixed' => '',
  313.     'default_argument_user' => 0,
  314.     'default_argument_php' => '',
  315.     'validate_argument_node_type' => array(
  316.       'product' => 0,
  317.       'noticia' => 0,
  318.       'pagina' => 0,
  319.     ),
  320.     'validate_argument_node_access' => 0,
  321.     'validate_argument_nid_type' => 'nid',
  322.     'validate_argument_vocabulary' => array(
  323.       '1' => 1,
  324.     ),
  325.     'validate_argument_type' => 'tid',
  326.     'validate_argument_transform' => 0,
  327.     'validate_user_restrict_roles' => 0,
  328.     'validate_argument_php' => '',
  329.     'override' => array(
  330.       'button' => 'Use default',
  331.     ),
  332.   ),
  333. ));
  334. $handler->override_option('filters', array(
  335.   'status' => array(
  336.     'operator' => '=',
  337.     'value' => '1',
  338.     'group' => '0',
  339.     'exposed' => FALSE,
  340.     'expose' => array(
  341.       'operator' => FALSE,
  342.       'label' => '',
  343.     ),
  344.     'id' => 'status',
  345.     'table' => 'node',
  346.     'field' => 'status',
  347.     'relationship' => 'none',
  348.   ),
  349.   'type' => array(
  350.     'operator' => 'in',
  351.     'value' => array(
  352.       'product' => 'product',
  353.     ),
  354.     'group' => '0',
  355.     'exposed' => FALSE,
  356.     'expose' => array(
  357.       'operator' => FALSE,
  358.       'label' => '',
  359.     ),
  360.     'id' => 'type',
  361.     'table' => 'node',
  362.     'field' => 'type',
  363.     'relationship' => 'none',
  364.   ),
  365.   'vid' => array(
  366.     'operator' => 'in',
  367.     'value' => array(
  368.       '1' => '1',
  369.     ),
  370.     'group' => '0',
  371.     'exposed' => FALSE,
  372.     'expose' => array(
  373.       'operator' => FALSE,
  374.       'label' => '',
  375.     ),
  376.     'id' => 'vid',
  377.     'table' => 'term_data',
  378.     'field' => 'vid',
  379.     'override' => array(
  380.       'button' => 'Use default',
  381.     ),
  382.     'relationship' => 'none',
  383.   ),
  384. ));
  385. $handler->override_option('title', 'Categorias');
  386. $handler->override_option('items_per_page', 0);
  387. $handler->override_option('use_pager', '0');
  388. $handler->override_option('block_description', '');
  389. $handler->override_option('block_caching', -1);
  390. $handler = $view->new_display('page', 'Página principal', 'page_1');
  391. $handler->override_option('path', 'produtos');
  392. $handler->override_option('menu', array(
  393.   'type' => 'none',
  394.   'title' => '',
  395.   'description' => '',
  396.   'weight' => 0,
  397.   'name' => 'navigation',
  398. ));
  399. $handler->override_option('tab_options', array(
  400.   'type' => 'none',
  401.   'title' => '',
  402.   'description' => '',
  403.   'weight' => 0,
  404.   'name' => 'navigation',
  405. ));
  406. $handler = $view->new_display('feed', 'Feed principal', 'feed_1');
  407. $handler->override_option('items_per_page', 10);
  408. $handler->override_option('style_plugin', 'rss');
  409. $handler->override_option('style_options', array(
  410.   'mission_description' => FALSE,
  411.   'description' => '',
  412. ));
  413. $handler->override_option('row_plugin', 'node_rss');
  414. $handler->override_option('path', 'produtos/feed');
  415. $handler->override_option('menu', array(
  416.   'type' => 'none',
  417.   'title' => '',
  418.   'description' => '',
  419.   'weight' => 0,
  420.   'name' => 'navigation',
  421. ));
  422. $handler->override_option('tab_options', array(
  423.   'type' => 'none',
  424.   'title' => '',
  425.   'description' => '',
  426.   'weight' => 0,
  427.   'name' => 'navigation',
  428. ));
  429. $handler->override_option('displays', array());
  430. $handler->override_option('sitename_title', 1);

Submit Fix

Any tags you'd like to associate with your code, delimitered by commas (example: Views, CCK, Module, etc).
Select the syntax highlighting mode to use.