0

I have installed the Stock module, but I don't know how to configure or include that to my product content type, nor do I know how to use it.

Do you have any idea or suggestion?

3

You can follow the below step:

  • Go to Content management -> Content
  • Filter content for content type "Product"
  • Edit your product content
  • Click on "stock" link in top of page
  • Set the "Stock" and "Threshold" quantity and check "active" check-box save the form.

Edit:

Code snippets to display total and sold item from stock:

$output = '';

$array_sku = uc_product_get_models($node->nid, FALSE);

foreach ($array_sku as $sku) {
  $stock_level = uc_stock_level($sku);
  $stock_count = db_select('uc_order_products', 'up')->fields('up', array('nid'))->condition('up.model', $sku, '=')->execute()->rowCount();

  $total = $stock_level +  $stock_count;

  $output .= "<div>SKU:" . $sku . " Total :" . $total . ", Sold out:" . $stock_count . "</div>";

}


print $output;

Kindly see that above code will be check stock level for each different SKU of the product. If there is attribute of the product and each attribute has different SKU, then it will display the stock for each sKU of the product.

You can add this code in node--product.tpl.php file in your theme directory.

  • stock is actual quantity of the product. When the stock level drops below the threshold value, you can be notified based on your stock settings. – Jayendra Kainthola Nov 14 '13 at 13:10
  • @Ram suppose if you have 10 products and you set 2 as threshold and if 8 products were sold, then you will be notified by email like "you reached your threshold". – Bala Nov 14 '13 at 13:17
  • @Ram, Yes. You will get this using stock module function, not node module function. – Jayendra Kainthola Nov 14 '13 at 13:18
  • @Ram Please update your question. – Jayendra Kainthola Nov 15 '13 at 4:38
  • @Ram, By default, when a product is purchased, Ubercart automatically decrease its stock level quantity and did not save original stock quantity. – Jayendra Kainthola Nov 15 '13 at 9:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.