Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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
/**
* 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);
Install the Nodeblock module the usual way at admin/build/modules.(D6) and /admin/modules. (D7)
Edit the content type that you wish to use as a block. In most situations you would create a simple content type named Block to use as your custom blocks, but you shouldn't feel limited to just this usage. Any type of node, using any type of field may be used as a nodeblock.
Select the Enabled radio button on the Available as block field.
Create block nodes and watch them populate your block list!
Using settings to change display for specific blocks on their block configuration pages:
You can get rid of node links like comment, edit, etc. by unchecking that box under "Block specific settings"
You can remove the title by placing <none> in the title box
Using settings to change display for all blocks of a certain node type :
To remove post information, the "submitted by" field, uncheck the box for that node type under "display post information on:" at admin/build/themes/settings
Organizing content in Drupal can be very liberating — or very frustrating, depending on what methods you're used to using.
Almost all information in Drupal is stored as a 'node', the basic unit of content. By default, there is no hierarchy or structure imposed on these nodes: they do not reside in specific 'sections' of your site, and different kinds of nodes (images, blog posts, news articles, etc.) are not automatically grouped or sorted into different groups. Rather than hard-coding specific hierarchies or styles of display, Drupal treats your content as a giant soup, with each piece of content having properties like a title and an author, a 'published' flag, a publication date, and so on. Specific kinds of pages, specific sections of your site, and so on are created by pulling up any content with certain properties and listing it.