function zen_start_specials() { global $gBitDb; // turn on special if active $specials_query = "select `specials_id`, `products_id`\n from " . TABLE_SPECIALS . "\n where `status` = '0'\n and (((`specials_date_available` <= 'NOW' and `specials_date_available` != '0001-01-01') and (`expires_date` >= 'NOW'))\n or ((`specials_date_available` <= 'NOW' and `specials_date_available` != '0001-01-01') and (`expires_date` = '0001-01-01'))\n or (`specials_date_available` = '0001-01-01' and `expires_date` >= 'NOW'))\n "; if ($rs = $gBitDb->Execute($specials_query)) { while ($specials = $rs->FetchRow()) { zen_set_specials_status($specials['specials_id'], '1'); zen_update_lowest_purchase_price($specials['products_id']); } } // turn off special if not active yet $specials_query = "select `specials_id`, `products_id`\n from " . TABLE_SPECIALS . "\n where `status` = '1'\n and ('NOW' < `specials_date_available` and `specials_date_available` != '0001-01-01')\n "; if ($rs = $gBitDb->Execute($specials_query)) { while ($specials = $rs->FetchRow()) { zen_set_specials_status($specials['specials_id'], '0'); zen_update_lowest_purchase_price($specials['products_id']); } } }
// | | // | http://www.zen-cart.com/index.php | // | | // | 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$ // $products_id = zen_db_prepare_input($_POST['products_id']); $new_parent_id = zen_db_prepare_input($_POST['move_to_category_id']); $duplicate_check = $gBitDb->Execute("select count(*) as `total`\n from " . TABLE_PRODUCTS_TO_CATEGORIES . "\n where `products_id` = '" . (int) $products_id . "'\n and `categories_id` = '" . (int) $new_parent_id . "'"); if ($duplicate_check->fields['total'] < 1) { $gBitDb->Execute("update " . TABLE_PRODUCTS_TO_CATEGORIES . "\n set `categories_id` = '" . (int) $new_parent_id . "'\n where `products_id` = '" . (int) $products_id . "'\n and `categories_id` = '" . (int) $current_category_id . "'"); // reset master_categories_id if moved from original master category $check_master = $gBitDb->Execute("select `products_id`, `master_categories_id` from " . TABLE_PRODUCTS . " where `products_id` ='" . (int) $products_id . "'"); if ($check_master->fields['master_categories_id'] == (int) $current_category_id) { $gBitDb->Execute("update " . TABLE_PRODUCTS . "\n set `master_categories_id`='" . (int) $new_parent_id . "'\n where `products_id` = '" . (int) $products_id . "'"); } // reset lowest_purchase_price for searches etc. zen_update_lowest_purchase_price((int) $products_id); } else { $messageStack->add_session(ERROR_CANNOT_MOVE_PRODUCT_TO_CATEGORY_SELF, 'error'); } zen_redirect(zen_href_link_admin(FILENAME_CATEGORIES, 'cPath=' . $new_parent_id . '&pID=' . $products_id . (isset($_GET['page']) ? '&page=' . $_GET['page'] : '')));
function zen_update_salemaker_product_prices($salemaker_id) { global $gBitDb; $zv_categories = $gBitDb->Execute("select `sale_categories_selected` from " . TABLE_SALEMAKER_SALES . " where `sale_id` = '" . $salemaker_id . "'"); $za_salemaker_categories = zen_parse_salemaker_categories($zv_categories->fields['sale_categories_selected']); $n = sizeof($za_salemaker_categories); for ($i = 0; $i < $n; $i++) { $update_products_price = $gBitDb->Execute("select `products_id` from " . TABLE_PRODUCTS_TO_CATEGORIES . " where `categories_id`='" . $za_salemaker_categories[$i] . "'"); while (!$update_products_price->EOF) { zen_update_lowest_purchase_price($update_products_price->fields['products_id']); $update_products_price->MoveNext(); } } }
function ep_update_prices() { global $gBitDb; // reset lowest_purchase_price for searches etc. $sql = "select products_id from " . TABLE_PRODUCTS; $update_prices = $gBitDb->Execute($sql); while (!$update_prices->EOF) { zen_update_lowest_purchase_price($update_prices->fields['products_id']); $update_prices->MoveNext(); } }
$gBitDb->Execute("update " . TABLE_SPECIALS . " set\n\t\t\t\t\t`specials_new_products_price`='" . zen_db_input($specials_price) . "',\n\t\t\t\t\t`specials_date_available`='" . zen_db_input($specials_date_available) . "',\n\t\t\t\t\t`specials_last_modified`=" . $gBitDb->mDb->sysTimeStamp . ",\n\t\t\t\t\t`expires_date`='" . zen_db_input($specials_expires_date) . "',\n\t\t\t\t\t`status`='" . zen_db_input($_POST['special_status']) . "'\n\t\t\t\t\twhere `products_id` ='" . $productsId . "'"); } if (!empty($_POST['featured_id'])) { $gBitDb->Execute("update " . TABLE_FEATURED . " set\n\t\t\t\t`featured_date_available`='" . zen_db_input($featured_date_available) . "',\n\t\t\t\t`expires_date`='" . zen_db_input($featured_expires_date) . "',\n\t\t\t\t`featured_last_modified`=" . $gBitDb->mDb->sysTimeStamp . ",\n\t\t\t\t`status`='" . zen_db_input($_POST['featured_status']) . "'\n\t\t\t\twhere `products_id` ='" . $productsId . "'"); } $discounted = FALSE; foreach (array_keys($_POST['discount_qty']) as $discountId) { $discountHash = array('discount_id' => $discountId, 'discount_qty' => $_POST['discount_qty'][$discountId], 'discount_price' => $_POST['discount_price'][$discountId]); $gBitProduct->storeDiscount($discountHash); $discounted = $discounted || !empty($_POST['discount_qty'][$discountId]); } if (!$discounted) { $gBitDb->Execute("update " . TABLE_PRODUCTS . " set `products_discount_type`='0' where `products_id`='" . $productsId . "'"); } // reset lowest_purchase_price for searches etc. zen_update_lowest_purchase_price($productsId); $messageStack->add_session(PRODUCT_UPDATE_SUCCESS, 'success'); zen_redirect(zen_href_link_admin(FILENAME_PRODUCTS_PRICE_MANAGER, 'products_id=' . $productsId . '¤t_category_id=' . $current_category_id)); break; case 'set_products_id': $_GET['products_id'] = $_POST['products_id']; zen_redirect(zen_href_link_admin(FILENAME_PRODUCTS_PRICE_MANAGER, 'products_id=' . $_GET['products_id'] . '¤t_category_id=' . $_POST['current_category_id'])); break; case 'deleteconfirm': // demo active test if (zen_admin_demo()) { $_GET['action'] = ''; $messageStack->add_session(ERROR_ADMIN_DEMO, 'caution'); zen_redirect(zen_href_link_admin(FILENAME_PRODUCTS_PRICE_MANAGER, 'page=' . $_GET['page'])); } $featured_id = zen_db_prepare_input($_GET['fID']);
while (!$all_products_attributes->EOF) { $count++; $product_id_updated .= ' - ' . $all_products_attributes->fields['products_id'] . ':' . $all_products_attributes->fields['products_attributes_id']; zen_update_attributes_products_option_values_sort_order($all_products_attributes->fields['products_id']); $all_products_attributes->MoveNext(); } $messageStack->add_session(SUCCESS_PRODUCT_UPDATE_SORT_ALL, 'success'); $action = ''; zen_redirect(zen_href_link_admin(FILENAME_STORE_MANAGER)); break; case 'update_all_lowest_purchase_price': // reset lowest_purchase_price for searches etc. $sql = "select `products_id` from " . TABLE_PRODUCTS; $update_prices = $gBitDb->Execute($sql); while (!$update_prices->EOF) { zen_update_lowest_purchase_price($update_prices->fields['products_id']); $update_prices->MoveNext(); } $messageStack->add_session(SUCCESS_PRODUCT_UPDATE_PRODUCTS_PRICE_SORTER, 'success'); $action = ''; zen_redirect(zen_href_link_admin(FILENAME_STORE_MANAGER)); break; case 'update_all_products_viewed': // reset products_viewed to 0 $sql = "update " . TABLE_PRODUCTS_DESCRIPTION . " set `products_viewed` = '0'"; $update_viewed = $gBitDb->Execute($sql); $messageStack->add_session(SUCCESS_PRODUCT_UPDATE_PRODUCTS_VIEWED, 'success'); $action = ''; zen_redirect(zen_href_link_admin(FILENAME_STORE_MANAGER)); break; case 'update_all_products_ordered':
zen_update_lowest_purchase_price($update_price->fields['products_id']); zen_redirect(zen_href_link_admin(FILENAME_SPECIALS, 'page=' . $_GET['page'] . '&sID=' . $specials_id)); break; case 'deleteconfirm': // demo active test if (zen_admin_demo()) { $_GET['action'] = ''; $messageStack->add_session(ERROR_ADMIN_DEMO, 'caution'); zen_redirect(zen_href_link_admin(FILENAME_SPECIALS, 'page=' . $_GET['page'])); } $specials_id = zen_db_prepare_input($_GET['sID']); // reset lowest_purchase_price for searches etc. $update_price = $gBitDb->Execute("select `products_id` from " . TABLE_SPECIALS . " where `specials_id` = '" . $specials_id . "'"); $update_price_id = $update_price->fields['products_id']; $gBitDb->Execute("delete from " . TABLE_SPECIALS . "\n where specials_id = '" . (int) $specials_id . "'"); zen_update_lowest_purchase_price($update_price_id); zen_redirect(zen_href_link_admin(FILENAME_SPECIALS, 'page=' . $_GET['page'])); break; } } ?> <!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN"> <html <?php echo HTML_PARAMS; ?> > <head> <meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?> ">
} break; // @@TODO where is move_product_confirm // @@TODO where is insert_product // @@TODO where is update_product // attribute features // @@TODO where is move_product_confirm // @@TODO where is insert_product // @@TODO where is update_product // attribute features case 'delete_attributes': zen_delete_products_attributes($_GET['products_id']); $messageStack->add_session(SUCCESS_ATTRIBUTES_DELETED . ' ID#' . $_GET['products_id'], 'success'); $action = ''; // reset lowest_purchase_price for searches etc. zen_update_lowest_purchase_price($_GET['products_id']); zen_redirect(zen_href_link_admin(FILENAME_CATEGORIES, 'cPath=' . $cPath . '&pID=' . $_GET['products_id'] . (isset($_GET['page']) ? '&page=' . $_GET['page'] : ''))); break; case 'update_attributes_sort_order': zen_update_attributes_products_option_values_sort_order($_GET['products_id']); $messageStack->add_session(SUCCESS_ATTRIBUTES_UPDATE . ' ID#' . $_GET['products_id'], 'success'); $action = ''; zen_redirect(zen_href_link_admin(FILENAME_CATEGORIES, 'cPath=' . $cPath . '&pID=' . $_GET['products_id'] . (isset($_GET['page']) ? '&page=' . $_GET['page'] : ''))); break; // attributes copy to product // attributes copy to product case 'update_attributes_copy_to_product': $copy_attributes_delete_first = $_POST['copy_attributes'] == 'copy_attributes_delete' ? '1' : '0'; $copy_attributes_duplicates_skipped = $_POST['copy_attributes'] == 'copy_attributes_ignore' ? '1' : '0'; $copy_attributes_duplicates_overwrite = $_POST['copy_attributes'] == 'copy_attributes_update' ? '1' : '0'; zen_copy_products_attributes($_POST['products_id'], $_POST['products_update_id']);