> Zencart中文手册 > zencart获取产品最小订单数和最大订单数

zen_get_products_quAntity_order_min 函数是获取产品的最小订单数,该函数获取的是产品表products 的products_quantity_order_min字段的值,而该字段是在添加产品的时候设置,默认设置的是1
function zen_get_products_quantity_order_min($product_id) {
global $db;
$the_products_quantity_order_min = $db->Execute(“select products_id, products_quantity_order_min from ” . TABLE_PRODUCTS . ” where products_id = ‘” . (int)$product_id . “‘”);
return $the_products_quantity_order_min->fields['products_quantity_order_min'];
}

与该函数类似功能的是获取产品最大订单数函数zen_get_products_quantity_order_max,其主要是获取products表的products_quantity_order_max字段,该字段是在添加产品的时候设置,默认设置的是0,表示无限制订单数

function zen_get_products_quantity_order_max($product_id) {
global $db;

$the_products_quantity_order_max = $db->Execute(“select products_id, products_quantity_order_max from ” . TABLE_PRODUCTS . ” where products_id = ‘” . (int)$product_id . “‘”);
return $the_products_quantity_order_max->fields['products_quantity_order_max'];
}