本文整理汇总了PHP中products_minierp::calculateMaterialExpenses方法的典型用法代码示例。如果您正苦于以下问题:PHP products_minierp::calculateMaterialExpenses方法的具体用法?PHP products_minierp::calculateMaterialExpenses怎么用?PHP products_minierp::calculateMaterialExpenses使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类products_minierp
的用法示例。
在下文中一共展示了products_minierp::calculateMaterialExpenses方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: recalcProductMaterialExpenses
function recalcProductMaterialExpenses($elements_id)
{
$products2update = array();
//$q = tep_db_query("SELECT products_id FROM products_has_elements WHERE elements_id=$elements_id GROUP BY products_id");
//while($row=tep_db_fetch_array($q)) $products2update[] = $row['products_id'];
$q = tep_db_query("SELECT products_id FROM products_use_elements WHERE elements_id={$elements_id} GROUP BY products_id");
while ($row = tep_db_fetch_array($q)) {
$products2update[] = $row['products_id'];
}
if (count($products2update) > 0) {
use_class('products_minierp');
$class_pm = new products_minierp();
$class_pm->calculateMaterialExpenses($products2update);
}
}
示例2: implode
$elements_ids[] = $elid;
$elements_qtys[] = $elqty;
$elements_titles[] = "{$elid} <i>\"JUMPRING-4 {$elqty} qtys</i>\"";
echo "<h3>Add element " . implode(' and ', $elements_titles) . "</h3>";
$q = "SELECT pb.brand_name,pue.finishing_goldplate, p.* ";
$q .= " FROM products p";
$q .= " INNER JOIN products_to_categories ptc ON ptc.products_id = p.products_id AND ptc.categories_id = 30";
//APPLY TO SETS
$q .= " INNER JOIN products_use_elements pue ON pue.products_id = p.products_id";
$q .= " INNER JOIN element e ON e.elements_id = pue.elements_id AND e.attribute_category_id = 4";
$q .= " INNER JOIN products_brand pb ON pb.products_brand_id = p.products_brand_id";
$q .= " WHERE p.products_status = 1";
$q .= " AND p.products_brand_id != 23";
$q .= " AND pue.quantity >= 40";
$dbq = tep_db_query($q);
$counter = 0;
while ($r = tep_db_fetch_array($dbq)) {
$products_id = $r['products_id'];
$brand_name = $r['brand_name'];
$is_goldplated = $r['finishing_goldplate'] == 1 ? true : false;
//chain is goldplated
$goldplated = $is_goldplated ? "- Goldplated" : '';
$class_pm->addElementToProducts($products_id, $elements_ids, $elements_qtys);
if ($is_goldplated) {
tep_db_perform('products_use_elements', array('finishing_goldplate' => '1'), 'update', "products_id={$products_id} AND elements_id IN (" . implode(',', $elements_ids) . ")");
}
$class_pm->calculateMaterialExpenses($products_id);
echo "added to products {$products_id} - {$brand_name} {$goldplated}<br/>";
$counter++;
}
echo "<h2>Total {$counter} Products added with new element!</h2>";
示例3: array
$seo_text = tep_db_input($_POST['seo'][$l]);
$sql_data_array = array();
$sql_data_array['name'] = $name;
$sql_data_array['description'] = $desc;
$sql_data_array['seo_text'] = $seo_text;
ProductAttribute::getOldStylesFunction()->updateDescription($styles_id, $l, $sql_data_array);
}
//save price for certain styles
if (in_array($style_group, ProductAttribute::getAttributeGroupsHavePrice())) {
ProductAttribute::getOldStylesFunction()->setStylePrice($styles_id, $style_price);
//update material expenses of related products (need to monitor whether this make process update halted or not)
$products_matexp_need_updated = array_keys(ProductAttribute::getOldStylesFunction()->retrieveProducts($styles_id));
if (count($products_matexp_need_updated) > 0) {
use_class('products_minierp');
$class_pm = new products_minierp();
$class_pm->calculateMaterialExpenses($products_matexp_need_updated);
}
}
if (!isset($_GET['id']) || $_GET['id'] == '' || $_GET['id'] != $styles_id) {
/* previous method is opening the newly created style
$link = "?open=products-styles&id=$styles_id";
if($hidemenuscript!='') $link .= '&hidemenu=true&reloadlist=true';
header("Location: $link");
exit;
*/
ProductAttribute::getOldStylesFunction()->setHistory($styles_id, "Added styles", $session_userinfo['username']);
ProductAttribute::getOldStylesFunction()->setOwner($styles_id, $session_userinfo['username']);
$messagebox->add('New Style has been created with <strong>ID: ' . $styles_id . '</strong>', 'green');
} else {
ProductAttribute::getOldStylesFunction()->setHistory($styles_id, "Updated detail styles", $session_userinfo['username']);
$messagebox->add('Style Data have been saved.', 'green');
示例4:
<?php
global $db;
require_once '../confy.php';
require_once '../functions.php';
require_once '../functions-2.php';
tep_db_connect();
use_class("products_minierp");
$class_pm = new products_minierp();
$dbq = tep_db_query("SELECT DISTINCT products_id FROM products_use_elements WHERE finishing_oxid = '1'");
//$pids = '69225,72365,72484,72517,72590,72591,72592,72599,72621,72630,72631,72633,72635,72636,72637,72638,72639,72641,72642,72643,72644,72645,72646,72647,72689,72708,72720,72716,72717,72738,72829,72759,72765,72767,72790,72791,72794,72796,72819,72825,72826,72827,72830,72831';
//$pids_array = explode(',', $pids);
$success = 0;
while ($r = tep_db_fetch_array($dbq)) {
$pid = $r['products_id'];
if ($pid > 0) {
$class_pm->calculateMaterialExpenses($pid);
echo "DONE - RECALC MATEXP PRODUCT {$pid}\n";
$success++;
}
}
echo "<h3>TOTAL PRODUCTS RECALC FOR MATEXP = {$success}</h3>";
示例5: remProduct
public function remProduct($styles_id, $products_id, $username)
{
if (is_array($products_id)) {
$removed = array();
$removed_success = array();
$removed_failed = array();
foreach ($products_id as $pid) {
$rem_product_result = $this->remProduct($styles_id, $pid, $username);
//if ($this->remProduct($styles_id, $pid, $username) != false) {
if ($rem_product_result != false) {
//$removed[] = $this->remProduct($styles_id, $pid, $username);
$removed_success[] = $rem_product_result;
} else {
//break;
$removed_failed[] = $pid;
continue;
}
}
$removed['success'] = $removed_success;
$removed['failed'] = $removed_failed;
if ($removed) {
//$removed_id_product = implode(',', $products_id);
$removed_id_product = implode(',', $removed['success']);
$this->setHistory($styles_id, "Delete product ({$removed_id_product}) from style", $username);
}
} else {
if (strpos($products_id, ',') !== false) {
$parray = explode(',', $products_id);
$removed = $this->remProduct($styles_id, $parray, $username);
} else {
if ($this->productExist($styles_id, $products_id) && !$this->productClosed($styles_id)) {
$remove = tep_db_query("DELETE FROM styles_has_products WHERE styles_id={$styles_id} AND products_id={$products_id}");
if ($remove) {
$removed = $products_id;
}
} else {
return false;
}
}
}
//Recalculate Material Expenses if needed
$styles_detail = $this->retrieveDetail($styles_id);
if ($styles_detail['groups'] == ProductAttribute::GROUP_ID_PRODUCT_FINISHING) {
use_class('products_minierp');
$class_pm = new products_minierp();
$class_pm->calculateMaterialExpenses($products_id);
}
return $removed;
}