本文整理汇总了PHP中osC_Product::getProductVariantsId方法的典型用法代码示例。如果您正苦于以下问题:PHP osC_Product::getProductVariantsId方法的具体用法?PHP osC_Product::getProductVariantsId怎么用?PHP osC_Product::getProductVariantsId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类osC_Product
的用法示例。
在下文中一共展示了osC_Product::getProductVariantsId方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: restock
function restock($orders_id, $orders_products_id, $products_id, $products_quantity)
{
global $osC_Database;
if (STOCK_LIMITED == '1') {
$error = false;
$osC_Database->startTransaction();
$Qupdate = $osC_Database->query('update :table_products set products_quantity = products_quantity + :products_quantity, products_ordered = products_ordered - :products_ordered where products_id = :products_id');
$Qupdate->bindTable(':table_products', TABLE_PRODUCTS);
$Qupdate->bindInt(':products_quantity', $products_quantity);
$Qupdate->bindInt(':products_ordered', $products_quantity);
$Qupdate->bindInt(':products_id', $products_id);
$Qupdate->setLogging($_SESSION['module'], $orders_id);
$Qupdate->execute();
if (!$osC_Database->isError()) {
$Qcheck = $osC_Database->query('select products_quantity from :table_products where products_id = :products_id and products_status = 0');
$Qcheck->bindTable(':table_products', TABLE_PRODUCTS);
$Qcheck->bindInt(':products_id', $products_id);
$Qcheck->execute();
if ($Qcheck->numberOfRows() === 1 && $products_quantity > 0) {
$Qstatus = $osC_Database->query('update :table_products set products_status = 1 where products_id = :products_id');
$Qstatus->bindTable(':table_products', TABLE_PRODUCTS);
$Qstatus->bindInt(':products_id', $products_id);
$Qstatus->setLogging($_SESSION['module'], $orders_id);
$Qstatus->execute();
if ($osC_Database->isError() === true) {
$error = true;
}
}
}
//restock products variant details
if ($error === false) {
$Qvariants = $osC_Database->query('select products_variants_groups_id, products_variants_values_id from :table_orders_products_variants where orders_id = :orders_id and orders_products_id = :orders_products_id order by products_variants_groups_id');
$Qvariants->bindTable(':table_orders_products_variants', TABLE_ORDERS_PRODUCTS_VARIANTS);
$Qvariants->bindInt(':orders_id', $orders_id);
$Qvariants->bindInt(':orders_products_id', $orders_products_id);
$Qvariants->execute();
if ($Qvariants->numberOfRows() > 0) {
$variants = array();
while ($Qvariants->next()) {
$variants[$Qvariants->value('products_variants_groups_id')] = $Qvariants->value('products_variants_values_id');
}
$Qvariants->freeResult();
$osC_Product = new osC_Product($products_id);
$products_variants_id = $osC_Product->getProductVariantsId($variants);
$QstockUpdate = $osC_Database->query('update :table_products_variants set products_quantity = products_quantity + :products_quantity where products_variants_id = :products_variants_id');
$QstockUpdate->bindTable(':table_products_variants', TABLE_PRODUCTS_VARIANTS);
$QstockUpdate->bindInt(':products_quantity', $products_quantity);
$QstockUpdate->bindInt(':products_variants_id', $products_variants_id);
$QstockUpdate->setLogging($_SESSION['module'], $orders_id);
$QstockUpdate->execute();
if ($osC_Database->isError() === true) {
$error = true;
}
$Qcheck = $osC_Database->query('select products_quantity from :table_products_variants where products_variants_id = :products_variants_id and products_status = 0');
$Qcheck->bindTable(':table_products_variants', TABLE_PRODUCTS_VARIANTS);
$Qcheck->bindInt(':products_variants_id', $products_variants_id);
$Qcheck->execute();
if ($error === false) {
if ($Qcheck->numberOfRows() === 1 && $Qcheck->valueInt('products_quantity') > 0) {
$QattribStatus = $osC_Database->query('update :table_products_variants set products_status = 1 where products_variants_id = :products_variants_id');
$QattribStatus->bindTable(':table_products_variants', TABLE_PRODUCTS_VARIANTS);
$QattribStatus->bindInt(':products_variants_id', $products_variants_id);
$QattribStatus->setLogging($_SESSION['module'], $orders_id);
$QattribStatus->execute();
if ($osC_Database->isError() === true) {
$error = true;
}
}
}
}
}
if ($error === false) {
$osC_Database->commitTransaction();
return true;
}
$osC_Database->rollbackTransaction();
return false;
} else {
return true;
}
}