本文整理汇总了PHP中products_minierp::getDIOHstockTarget方法的典型用法代码示例。如果您正苦于以下问题:PHP products_minierp::getDIOHstockTarget方法的具体用法?PHP products_minierp::getDIOHstockTarget怎么用?PHP products_minierp::getDIOHstockTarget使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类products_minierp
的用法示例。
在下文中一共展示了products_minierp::getDIOHstockTarget方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
tep_db_connect();
define('STOCK_WARNING_LIMIT', 0.5);
//Alert if stock availibility is below this level (in percentage, 0,8=80%)
$products = array();
$articles = array();
use_class('products_minierp');
$class_pm = new products_minierp();
$bg_settings = $class_pm->retrieveBestGoodSettings();
$q = "SELECT pal.products_id, pal.products_articles_id AS articles_id, IFNULL(ps.stock, 0) AS stock";
$q .= " FROM products_log pl";
$q .= " INNER JOIN products p ON p.products_id=pl.products_id AND p.stars=3";
$q .= " INNER JOIN products_articles_log pal ON pal.products_id=pl.products_id";
$q .= " LEFT JOIN products_stock ps ON ps.jng_warehouses_id=" . WAREHOUSE_ID_PRODUCTS_HAMBURG . " AND ps.products_id=pl.products_id AND ps.articles_id=pal.products_articles_id";
$r = tep_db_query($q);
while ($row = tep_db_fetch_array($r)) {
$target = $class_pm->getDIOHstockTarget($row['products_id'], $row['articles_id']);
$percent = $target == 0 ? 0 : $row['stock'] / $target;
if ($percent < STOCK_WARNING_LIMIT) {
if (!in_array($row['products_id'], $products)) {
$products[] = $row['products_id'];
}
$articles[] = $row['products_id'] . '-' . $row['articles_id'];
}
}
$products_total = count($products);
$articles_total = count($articles);
if ($products_total > 0) {
$subject = 'Depot Stock Report';
$send_message = '<p>This email is sent automatically by Manobo.</p>';
$send_message .= '<p>We have today ' . $products_total . ' Top Seller Products (' . $articles_total . ' Articles) with stock ' . STOCK_WARNING_LIMIT * 100 . '% below our stock target</p>';
$send_message .= '<p>MANOBO</p>';