本文整理汇总了PHP中zen_remove_product函数的典型用法代码示例。如果您正苦于以下问题:PHP zen_remove_product函数的具体用法?PHP zen_remove_product怎么用?PHP zen_remove_product使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了zen_remove_product函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: substr
$category_ids .= "'" . (int) $value['categories'][$i] . "', ";
}
$category_ids = substr($category_ids, 0, -2);
$check = $db->Execute("select count(*) as total\n from " . TABLE_PRODUCTS_TO_CATEGORIES . "\n where products_id = '" . (int) $key . "'\n and categories_id not in (" . $category_ids . ")");
if ($check->fields['total'] < '1') {
$products_delete[$key] = $key;
}
}
// removing categories can be a lengthy process
zen_set_time_limit(600);
for ($i = 0, $n = sizeof($categories); $i < $n; $i++) {
zen_remove_category($categories[$i]['id']);
}
reset($products_delete);
while (list($key) = each($products_delete)) {
zen_remove_product($key);
}
}
zen_redirect(zen_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath));
break;
//////////////////////////////////
// delete new
//////////////////////////////////
// delete new
case 'delete_category_confirm':
// demo active test
if (zen_admin_demo()) {
$_GET['action'] = '';
$messageStack->add_session(ERROR_ADMIN_DEMO, 'caution');
zen_redirect(zen_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath));
}
示例2: zen_db_input
}
//echo 'SQL=' . "select artists_id, record_company_id, music_genre_id from " . TABLE_PRODUCT_MUSIC_EXTRA . " where products_id = '" . (int)$product_id . "'<br />";
$music_extra = $db->Execute("select artists_id, record_company_id, music_genre_id from " . TABLE_PRODUCT_MUSIC_EXTRA . "\r\n where products_id = '" . (int) $product_id . "'");
//echo 'media count =' . $music_extra->RecordCount() . '<br />';
if ($music_extra->RecordCount() > 0) {
//echo 'artists_id delete=' . $music_extra->fields['artists_id'] . '<br />';
//echo 'record_company_id delete=' . $music_extra->fields['record_company_id'] . '<br />';
//echo 'music_genre_id delete=' . $music_extra->fields['music_genre_id'] . '<br />';
$db->Execute("delete from " . TABLE_PRODUCT_MUSIC_EXTRA . "\r\n where products_id = '" . (int) $product_id . "'\r\n and artists_id = '" . zen_db_input($music_extra->fields['artists_id']) . "'\r\n and record_company_id = '" . zen_db_input($music_extra->fields['record_company_id']) . "'\r\n and music_genre_id = '" . zen_db_input($music_extra->fields['music_genre_id']) . "'");
}
}
//--------------PRODUCT_TYPE_SPECIFIC_INSTRUCTIONS_GO__ABOVE__HERE--------------------------------------------------------
// now do regular non-type-specific delete:
// remove product from all its categories:
for ($k = 0, $m = sizeof($product_categories); $k < $m; $k++) {
$db->Execute("delete from " . TABLE_PRODUCTS_TO_CATEGORIES . "\r\n where products_id = '" . (int) $product_id . "'\r\n and categories_id = '" . (int) $product_categories[$k] . "'");
}
// confirm that product is no longer linked to any categories
$count_categories = $db->Execute("select count(categories_id) as total\r\n from " . TABLE_PRODUCTS_TO_CATEGORIES . "\r\n where products_id = '" . (int) $product_id . "'");
// echo 'count of category links for this product=' . $count_categories->fields['total'] . '<br />';
// if not linked to any categories, do delete:
if ($count_categories->fields['total'] == '0') {
zen_remove_product($product_id, $delete_linked);
}
}
// endif $do_delete_flag
// if this is a single-product delete, redirect to categories page
// if not, then this file was called by the cascading delete initiated by the category-delete process
if ($action == 'delete_product_confirm') {
zen_redirect(zen_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath));
}
示例3: zen_redirect
zen_redirect(zen_href_link(FILENAME_MANUFACTURERS, 'page=' . $_GET['page']));
}
$manufacturers_id = zen_db_prepare_input($_POST['mID']);
if (isset($_POST['delete_image']) && $_POST['delete_image'] == 'on') {
$manufacturer = $db->Execute("select manufacturers_image\n from " . TABLE_MANUFACTURERS . "\n where manufacturers_id = '" . (int) $manufacturers_id . "'");
$image_location = DIR_FS_CATALOG_IMAGES . $manufacturer->fields['manufacturers_image'];
if (file_exists($image_location)) {
@unlink($image_location);
}
}
$db->Execute("delete from " . TABLE_MANUFACTURERS . "\n where manufacturers_id = '" . (int) $manufacturers_id . "'");
$db->Execute("delete from " . TABLE_MANUFACTURERS_INFO . "\n where manufacturers_id = '" . (int) $manufacturers_id . "'");
if (isset($_POST['delete_products']) && $_POST['delete_products'] == 'on') {
$products = $db->Execute("select products_id\n from " . TABLE_PRODUCTS . "\n where manufacturers_id = '" . (int) $manufacturers_id . "'");
while (!$products->EOF) {
zen_remove_product($products->fields['products_id']);
$products->MoveNext();
}
} else {
$db->Execute("update " . TABLE_PRODUCTS . "\n set manufacturers_id = 0\n where manufacturers_id = '" . (int) $manufacturers_id . "'");
}
zen_redirect(zen_href_link(FILENAME_MANUFACTURERS, 'page=' . $_GET['page']));
break;
}
}
?>
<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
<html <?php
echo HTML_PARAMS;
?>
>
示例4: zen_redirect
// | Portions Copyright (c) 2003 osCommerce |
// +----------------------------------------------------------------------+
// | This source file is subject to version 2.0 of the GPL license, |
// | that is bundled with this package in the file LICENSE, and is |
// | available through the world-wide-web at the following url: |
// | http://www.zen-cart.com/license/2_0.txt. |
// | If you did not receive a copy of the zen-cart license and are unable |
// | to obtain it through the world-wide-web, please send a note to |
// | license@zen-cart.com so we can mail you a copy immediately. |
// +----------------------------------------------------------------------+
// $Id: delete_product_confirm.php 290 2004-09-15 19:48:26Z wilt $
//
//
// demo active test
if (zen_admin_demo()) {
$_GET['action'] = '';
$messageStack->add_session(ERROR_ADMIN_DEMO, 'caution');
zen_redirect(zen_href_link(FILENAME_CATEGORIES, 'cPath=' . $_GET['cPath'] . '&pID=' . $_GET['pID'] . (isset($_GET['page']) ? '&page=' . $_GET['page'] : '')));
}
if (isset($_POST['products_id']) && isset($_POST['product_categories']) && is_array($_POST['product_categories'])) {
$product_id = zen_db_prepare_input($_POST['products_id']);
$product_categories = $_POST['product_categories'];
for ($i = 0, $n = sizeof($product_categories); $i < $n; $i++) {
$db->Execute("delete from " . TABLE_PRODUCTS_TO_CATEGORIES . "\r\n where products_id = '" . (int) $product_id . "'\r\n and categories_id = '" . (int) $product_categories[$i] . "'");
}
$product_categories = $db->Execute("select count(*) as total\r\n from " . TABLE_PRODUCTS_TO_CATEGORIES . "\r\n where products_id = '" . (int) $product_id . "'");
if ($product_categories->fields['total'] == '0') {
zen_remove_product($product_id);
}
}
zen_redirect(zen_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath));
示例5: ep_purge_dross
function ep_purge_dross()
{
$dross = array();
$dross = ep_get_dross();
foreach ($dross as $products_id => $langer) {
zen_remove_product($products_id);
}
}
示例6: while
for ($i = 0, $n = sizeof($categories); $i < $n; $i++) {
$product_ids = $db->Execute("select products_id\r\n from " . TABLE_PRODUCTS_TO_CATEGORIES . "\r\n where categories_id = '" . (int) $categories[$i]['id'] . "'");
while (!$product_ids->EOF) {
$products[$product_ids->fields['products_id']]['categories'][] = $categories[$i]['id'];
$product_ids->MoveNext();
}
}
// change the status of categories and products
zen_set_time_limit(600);
for ($i = 0, $n = sizeof($categories); $i < $n; $i++) {
// set products_status based on selection
$sql = "select products_id from " . TABLE_PRODUCTS_TO_CATEGORIES . " where categories_id='" . $categories[$i]['id'] . "'";
$category_products = $db->Execute($sql);
while (!$category_products->EOF) {
// future cat specific use for
zen_remove_product($category_products->fields['products_id'], $delete_linked);
$category_products->MoveNext();
}
zen_remove_category($categories[$i]['id']);
}
// for
}
zen_redirect(zen_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath));
break;
// eof delete new
/////////////////////////////////
// @@TODO where is delete_product_confirm
// eof delete new
/////////////////////////////////
// @@TODO where is delete_product_confirm
case 'move_category_confirm':
示例7: ep_4_remove_product
function ep_4_remove_product($product_model)
{
global $db, $ep_debug_logging, $ep_debug_logging_all, $ep_stack_sql_error;
$project = PROJECT_VERSION_MAJOR . '.' . PROJECT_VERSION_MINOR;
$ep_uses_mysqli = PROJECT_VERSION_MAJOR > '1' || PROJECT_VERSION_MINOR >= '5.3' ? true : false;
$sql = "SELECT products_id FROM " . TABLE_PRODUCTS . " WHERE products_model = '" . zen_db_input($product_model) . "'";
$products = $db->Execute($sql);
if ($ep_uses_mysqli ? mysqli_errno($db->link) : mysql_errno()) {
$ep_stack_sql_error = true;
if ($ep_debug_logging == true) {
$string = "MySQL error " . ($ep_uses_mysqli ? mysqli_errno($db->link) : mysql_errno()) . ": " . ($ep_uses_mysqli ? mysqli_error($db->link) : mysql_error()) . "\nWhen executing:\n{$sql}\n";
write_debug_log($string);
}
} elseif ($ep_debug_logging_all == true) {
$string = "MySQL PASSED\nWhen executing:\n{$sql}\n";
write_debug_log($string);
}
while (!$products->EOF) {
zen_remove_product($products->fields['products_id']);
$products->MoveNext();
}
return;
}
示例8: importProduct
function importProduct($data, $format)
{
// prepare data
$validate = true;
$ignore_column = $this->getFormatColumnIgnore($format['csv_format_type_id']);
$ignore_id = $ignore_column['csv_column_id'];
$delete_column = $this->getFormatColumnDelete($format['csv_format_type_id']);
$delete_id = $delete_column['csv_column_id'];
$this->messageStack->reset();
// search products_model and validate
foreach ($format['columns'] as $key => $val) {
if (!empty($val['csv_column_validate_function'])) {
$validate_function = $val['csv_column_validate_function'];
if ($this->{$validate_function}($data[$key], $val['csv_column_name']) === true) {
$validate = $validate && true;
} else {
$validate = $validate && false;
}
}
if ($val['csv_columns_dbtable'] == 'products' && $val['csv_columns_dbcolumn'] == 'products_model') {
$products_model = $data[$key];
}
if ($val['csv_column_id'] == $delete_id) {
if ($data[$key] == 1) {
$delete_flag = true;
} else {
$delete_flag = false;
}
}
}
if (empty($products_model)) {
$validate = $validate && false;
$this->messageStack->add(PRODUCT_CSV_MESSAGE_NO_MODEL, 'warning');
}
// return if validate is false
if ($validate === false) {
return false;
}
// main
$sql = 'SELECT * FROM ' . TABLE_PRODUCTS . ' WHERE products_model=\'' . zen_db_input($products_model) . '\'';
$product = $this->db->Execute($sql);
if ($product->RecordCount() == 0) {
$sql = 'INSERT INTO ' . TABLE_PRODUCTS . ' (products_model, products_date_added, products_status) VALUES(\'' . zen_db_input($products_model) . '\', NOW(), 1)';
$this->db->Execute($sql);
$products_id = $this->db->Insert_ID();
// search language id
foreach ($format['columns'] as $val) {
if (isset($val['language_id'])) {
$language_ids[$val['language_id']] = 1;
}
}
// insert products description
foreach ($language_ids as $language_id => $flag) {
$sql = 'INSERT INTO ' . TABLE_PRODUCTS_DESCRIPTION . ' (products_id, language_id) VALUES (\'' . $products_id . '\', \'' . $language_id . '\')';
$this->db->Execute($sql);
$sql = 'INSERT INTO ' . TABLE_META_TAGS_PRODUCTS_DESCRIPTION . ' (products_id, language_id) VALUES (\'' . $products_id . '\', \'' . $language_id . '\')';
$this->db->Execute($sql);
}
} else {
$products_id = $product->fields['products_id'];
}
// delete product
if ($delete_flag === true) {
zen_remove_product($products_id);
$this->messageStack->add(PRODUCT_CSV_MESSAGE_DELETE, 'success');
return true;
}
foreach ($format['columns'] as $key => $val) {
if ($val['csv_column_id'] == $ignore_id) {
continue;
}
if ($val['csv_columns_dbtable'] == 'products') {
if ($val['csv_columns_dbcolumn'] == 'products_status' && $data[$key] == '') {
continue;
}
$sql = 'UPDATE ' . TABLE_PRODUCTS . ' SET ' . $val['csv_columns_dbcolumn'] . '=\'' . zen_db_input($data[$key]) . '\' WHERE products_id=' . $products_id . '';
$this->db->Execute($sql);
if ($val['csv_columns_dbcolumn'] == 'products_price') {
$products_price = $data[$key];
}
} elseif ($val['csv_columns_dbtable'] == 'tax_class') {
$sql = 'SELECT tax_class_id FROM ' . TABLE_TAX_CLASS . ' WHERE ' . $val['csv_columns_dbcolumn'] . '=\'' . zen_db_input($data[$key]) . '\'';
$tax_class = $this->db->Execute($sql);
$sql = 'UPDATE ' . TABLE_PRODUCTS . ' SET products_tax_class_id=\'' . $tax_class->fields['tax_class_id'] . '\' WHERE products_id=\'' . $products_id . '\'';
$this->db->Execute($sql);
} elseif ($val['csv_columns_dbtable'] == 'product_types') {
$sql = 'SELECT type_id FROM ' . TABLE_PRODUCT_TYPES . ' WHERE ' . $val['csv_columns_dbcolumn'] . '=\'' . zen_db_input($data[$key]) . '\'';
$product_type = $this->db->Execute($sql);
$sql = 'UPDATE ' . TABLE_PRODUCTS . ' SET products_type=\'' . $product_type->fields['type_id'] . '\' WHERE products_id=' . $products_id . '';
$this->db->Execute($sql);
} elseif ($val['csv_columns_dbtable'] == 'manufacturers') {
$sql = 'SELECT manufacturers_id FROM ' . TABLE_MANUFACTURERS . ' WHERE ' . $val['csv_columns_dbcolumn'] . '=\'' . zen_db_input($data[$key]) . '\'';
$manufacturer = $this->db->Execute($sql);
if ($manufacturer->RecordCount() == 0) {
// insert manufacturer
$sql = 'INSERT INTO ' . TABLE_MANUFACTURERS . ' (manufacturers_name, date_added, last_modified) VALUES (\'' . zen_db_input($data[$key]) . '\', NOW(), NOW())';
$this->db->Execute($sql);
$manufacturer_id = $this->db->Insert_ID();
} else {
$manufacturer_id = $manufacturer->fields['manufacturers_id'];
//.........这里部分代码省略.........