本文整理汇总了PHP中products_minierp::addElementToProducts方法的典型用法代码示例。如果您正苦于以下问题:PHP products_minierp::addElementToProducts方法的具体用法?PHP products_minierp::addElementToProducts怎么用?PHP products_minierp::addElementToProducts使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类products_minierp
的用法示例。
在下文中一共展示了products_minierp::addElementToProducts方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: strpos
# Created : Mar 10, 2011 3:40:53 PM #
#########################################
use_class('elements_search');
use_class('products_minierp');
use_class('element');
$class_es = new elements_search();
$class_pm = new products_minierp();
$products_id = tep_db_prepare_input($_GET['pid']);
$is_accessed_from_design_mgmt = strpos($_SERVER['HTTP_REFERER'], 'designs-products-elements-used') !== false ? true : false;
if (isset($_POST['me_action'])) {
$class_es->postProcess($_POST);
if ($_POST['me_action'] == 'ELEMENTSUSEDADD') {
$pid = tep_db_prepare_input($_POST['pid']);
$elid = tep_db_prepare_input($_POST['elid']);
$elqty = tep_db_prepare_input($_POST['elqty']);
$el_added = $class_pm->addElementToProducts($pid, $elid, $elqty);
$result = array();
$result['eladded'] = $el_added;
ajaxReturn($result);
exit;
} elseif ($_POST['me_action'] == 'ELEMENTSUSEDADDDIRECT') {
$pid = tep_db_prepare_input($_POST['pid']);
$elid = tep_db_prepare_input($_POST['elid']);
$elqty = tep_db_prepare_input($_POST['elqty']);
$el_added = $class_pm->addElementToProducts($pid, $elid, $elqty);
$result = array();
$result['eladded'] = $el_added;
ajaxReturn($result);
exit;
} elseif ($_POST['me_action'] == 'SEARCHUSEDELEMENTS') {
$products_id_copy = tep_db_prepare_input($_POST['pid_c']);
示例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>";