Originally Posted by
Famine_1
Yes, I am asking how/where I would make this.
You would have to build an extra cart action script... includes/extra_cart_actions/SOMENAME_extra_cart_actions.php
Doesn't mater what you name it as long as it's in that folder. For ideas/samples you can look at Download Already Purchased mod or Restrict Digital Downloads mod, both good mods by lat9..
I do it on auctions both for loading the cart and for removing an item from the cart.. as a sample...
Code:
<?php
/**
* Product type Auction and Offer shopping cart remove action rewrite
*
* @license http://www.zen-cart.com/license/2_0.txt GNU Public License V3.0
* @Version $id: Product Type Auction and Offer 2 1 2010-06-20 10:30:40Z davewest $
*/
//remove the existing item
if (($_GET['action'] == 'remove_product')) {
$product_id = ($_GET['product_id']);
//die('offer product '. '-'.($_GET['product_id']));
$type_check = $db->Execute("select products_type from " . TABLE_PRODUCTS . " where products_id = '" . (int)$product_id . "'");
$auction = $db->Execute("select type_id from " . TABLE_PRODUCT_TYPES . " where type_handler = 'product_auction' ");
if ($auction->fields['type_id'] == $type_check->fields['products_type']) {
//reset auction price
$auction_bid = $db->Execute("select bid_id, customers_bid from " . TABLE_PRODUCTS_AUCTION . " where products_id = '" . (int)$product_id . "' order by bid_id DESC limit 1");
$start_price = $db->Execute("select bid_start_price from " . TABLE_PRODUCT_AUCTION_EXTRA . " where products_id = '" . (int)$product_id . "' limit 1");
$auction_current_price = ($auction_bid->fields['customers_bid'] >= 1) ? $auction_bid->fields['customers_bid'] : $start_price->fields['bid_start_price'];
// update the product price in the PRODUCTS table to be the correct price
$sql = "update " . TABLE_PRODUCTS . " set products_price = '" . $auction_current_price . "' where products_id = '" . (int)$product_id . "' LIMIT 1 ";
$db->Execute($sql);
$_SESSION['cart']->actionRemoveProduct($goto, $parameters);
} else {
//not auction or offer products go as before
$_SESSION['cart']->actionRemoveProduct($goto, $parameters);
}
}
auto remove would be interesting when you consider time! are you talking about GMT, PST, EST MST... then throw in daylight savings, then winter and summer solstice...
Bookmarks