need support, trying to implement ajax in a view

Hi, this is what im trying to do:

I made an inventory management, that was easy, I just did the content type product with its respective fields of cuantity, and others.
In a view I did 2 tables the normal stock and the critic stock, where I show the name of the product, the quantity and 2 buttons for each product, the button (+) and the button (-) those buttons are for add or remove products of the stock, you understand, this is an example

Taxonomy upgrade extras: 

Get all nodes attached to a vocabulary,Get all nodes directly attached with a term id,Get all nodes belong to a term id recursively(parent-child taxonomy terms)


* function to get all term ids inside a vocab in a flat array
* No matter if vocab consists of hierarichal order of terms,you will get all term ids in a flat array.
* @param
* $vocab_machine_name takes vocabulary machine name as parameter.
* @return
* $tids return array of tids in a flat array format
function get_taxonomy_term_ids_inside_vocab($vocab_machine_name) {
$vocab = taxonomy_vocabulary_machine_name_load($vocab_machine_name);
if (is_object($vocab)) {
$term_tree = taxonomy_get_tree($vocab->vid);
if (is_array($term_tree) && !empty($term_tree)) {
foreach ($term_tree as $key => $value) {
$tids[] = $value->tid;
} if (empty($term_tree)) {
$tids = array();
} else
return "No Vocab Found with the given name";

return ($tids);

* function to get all the node ids directly mapped to the given taxonomy terms.
* Returns Flat array of node ids belong to the given term ids.
* @param
* $tid takes term id can be a single term or array of terms.
* @return
* $nid/$nids returns node ids array or sinly node id directly mapped to the given taxonomy term.
function get_nodes_directly_mapped_to_term($tid) {
if (is_array($tid) && !empty($tid)) {
foreach ($tid as $key => $value) {
$nids[] = taxonomy_select_nodes($value);

Post a message to twitter when a node is published in Drupal 6.x

With the Twitter module, it is easy to post a message to Twitter when a node is created or updated. However, to post the message at any other time requires a bit more work.

Twitter contains a sub module - Twitter Actions. This sub module enables users to post a message to Twitter with any custom business logic. This document will show you how to take advantage of Twitter Actions to post a message to twitter when a node is published. This is a common occurrence in Drupal. Users may want to create a lot of unpublished nodes, and then wait for an admin to approve them, before they are published.

On the Modules page, enable the twitter_actions module.

Step by step guide:

Option A - Use the Rules module:

Set up the following logic.

ON event - Content is going to be saved
IF NOT condition - Unchanged content is published
AND condition - Saved content is published
DO action - Post a message to Twitter

Option B - Build a custom module

1. Go to Site Configuration->Actions, and create a new advanced action called "Post a message to Twitter..."

Panels 3: How to use variants and views to create node displays. (D7)

You can view your nodes in a custom layout using Panels without having to edit a node template file or use modules such as Content template.

The following example will create a product-page, displaying some of the products content-fields.

Using Panels we will build the node to display in node column.

Requirements for this example

I will asume you have an understanding of the following 3 modules:


  • Create a new node type called Product.
    Create Product Type
  • Add the following fields:
  • Product-Image: Use one of the various CCK image field widgets.
    Product Type fIelds
  • Create an Imagecache preset to show the product-thumbnail in a suitable size.
  • Now create some Product content.

Creating a view to display product-fields

  • Create a View that will show node-items.
    Create View
  • Add Field "Product Image".
  • Add Filter-Criteria "Content: Type(=Product)"

Drupal 7 - Create a Node in Code

The code below presents a simple example of the means by which you can create a node in PHP code. This example makes no use of the Entity API module.

function a_page_submit($form, &$form_state) {
  global $user;

  $node = new stdClass();
  $node->title = "YOUR TITLE";
  $node->type = "YOUR_NODE_TYPE";
  node_object_prepare($node); // Sets some defaults. Invokes hook_prepare() and hook_node_prepare().
  $node->language = LANGUAGE_NONE; // Or e.g. 'en' if locale is enabled
  $node->uid = $user->uid; 
  $node->status = 1; //(1 or 0): published or not
  $node->promote = 0; //(1 or 0): promoted to front page
  $node->comment = 1; // 0 = comments disabled, 1 = read only, 2 = read/write

  // Term reference (taxonomy) field
  $node->field_product_tid[$node->language][]['tid'] = $form_state['values']['a taxonomy term id'];

  // Entity reference field
  $node->field_customer_nid[$node->language][] = array(
    'target_id' => $form_state['values']['entity id'],
    'target_type' => 'node',
  // 'node' is default,
  // Other possible values are "user" and  "taxonomy_term" 

  $node = node_submit($node); // Prepare node for saving
  //drupal_set_message( "Node with nid " . $node->nid . " saved!\n");
  $form_state['redirect']  = 'SOME WHERE';


Subscribe with RSS Subscribe to RSS - Node