Here are the deailled install instructions:
####### Auction.lister Version #########
A. CREATING DATABASE TABLE.
B. ADDING NEW FILES.(14 files + 8 images).
C. EDITING OS COMMERCE FILES.(catalog dir)
D. EDITING OS COMMERCE FILES.(admin dir)
A. CREATING DATABASE TABLE.
Copy the auctionlister_sql_install_script.php from the Setup folder to your catalog folder and run it.
B. ADDING NEW FILES
C. EDITING OS COMMERCE FILES.(catalog dir)
-- Files to Modify in catalog section --------------
1. catalog/checkout_process.php
2. catalog/index.php
3. catalog/login.php
4. catalog/shopping_cart.php
5. catalog/includes/application_top.php
6. catalog\includes\classes\order.php
7. catalog\includes\classes\shopping_cart.php
CATALOG STEP = 1. open catalog/checkout_process.php
find.....(aprox. line no.155)
// do not decrement quantities if products_attributes_filename exists
if ((DOWNLOAD_ENABLED != 'true') || (!$stock_values['products_attributes_filename'])) {
$stock_left = $stock_values['products_quantity'] - $order->products[$i]['qty'];
} else {
$stock_left = $stock_values['products_quantity'];
}
tep_db_query("update " . TABLE_PRODUCTS . " set products_quantity = '" . $stock_left . "' where products_id = '" . tep_get_prid($order->products[$i]['id']) . "'");
if ( ($stock_left < 1) && (STOCK_ALLOW_CHECKOUT == 'false') ) {
tep_db_query("update " . TABLE_PRODUCTS . " set products_status = '0' where products_id = '" . tep_get_prid($order->products[$i]['id']) . "'");
}
}
}
.. and add this after...
/*# auction.lister ####################
# update orderid in auction_details #
# START- #
#####################################*/
if($order->products[$i]['auctionid']!=""){
$sqlstring = "UPDATE auction_details SET order_number = '".$insert_id."' WHERE auction_id = '".$order->products[$i]['auctionid']."'
AND buyer_email = '".$order->customer['email_address']."'";
tep_db_query($sqlstring);
}
/*# auction.lister #
# -END #
##################*/
find.....(aprox. line no.169)
// Update products_ordered (for bestsellers list)
tep_db_query("update " . TABLE_PRODUCTS . " set products_ordered = products_ordered + " . sprintf('%d', $order->products[$i]['qty']) . " where products_id = '" . tep_get_prid($order->products[$i]['id']) . "'");
.. and add this after...
/*# auction.lister ###
# set an auctionid #
# START- #
####################*/
if($order->products[$i]['auctionid']!=""){
//set special if product is an auction
$auctionid = " (EBAY-ID: ".$order->products[$i]['auctionid'].")";
}else{
$auctionid = "";
}
/*# auction.lister #
# -END #
##################*/
/*# auction.lister ##############################################
# add auctionid to productname in order #
# 'products_name' => $order->products[$i]['name'].$auctionid, #
# e.g. ProductXYZ (EBAY-ID: 1234567890) #
###############################################################*/
find.....(aprox. line no.193)
'products_name' => $order->products[$i]['name'],
..and replace it with this.......
'products_name' => $order->products[$i]['name'].$auctionid,
CATALOG STEP = 2. open catalog/index.php
find.....(aprox. line no.306)
<tr>
<td class="main"><?php echo TEXT_MAIN; ?></td>
..and replace it with this.......
<tr>
<td class="main"><?php include(DIR_WS_LANGUAGES . $language . '/' . FILENAME_DEFINE_MAINPAGE); ?></td>
CATALOG STEP = 3. open catalog/login.php
find.....(aprox. line no.23)
require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_LOGIN);
$error = false;
if (isset($HTTP_GET_VARS['action']) && ($HTTP_GET_VARS['action'] == 'process')) {
..and replace it with this.......
require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_LOGIN);
$error = false;
/*# auction.lister ###########################
# accept login by click in email-link #
# || $HTTP_GET_VARS['action'] == 'auction' #
############################################*/
if (isset($HTTP_GET_VARS['action']) && ($HTTP_GET_VARS['action'] == 'process' || $HTTP_GET_VARS['action'] == 'auction')) {
find.....(aprox. line no.30)
$email_address = tep_db_prepare_input($HTTP_POST_VARS['email_address']);
$password = tep_db_prepare_input($HTTP_POST_VARS['password']);
.. and add this after...
/*# auction.lister ###############################
# set email_address and password automatically #
# START- #
################################################*/
if($HTTP_GET_VARS['action']== 'auction'){
$email_address = tep_db_prepare_input($HTTP_GET_VARS['email_address']);
$password = tep_db_prepare_input($HTTP_GET_VARS['password']);
}
/*# auction.lister #
# -END #
##################*/
find.....(aprox. line no.48)
// Check that password is good
if (!tep_validate_password($password, $check_customer['customers_password'])) {
..and replace it with this.......
/*# auction.lister #########################################
# encript password out of link and check that it is good #
# START- #
##########################################################*/
if($HTTP_GET_VARS['action'] == 'auction'){
$ispassword = tep_validate_password_enc($password, $check_customer['customers_password']);
}else{
// Check on normal login that password is good
$ispassword = tep_validate_password($password, $check_customer['customers_password']);
}
if (!$ispassword) {
/*# auction.lister #
# -END #
##################*/
find.....(aprox. line no.92)
tep_redirect(tep_href_link(FILENAME_DEFAULT));
..and replace it with this.......
/*# auction.lister #####################################
# if login by click in e-mail, then redirect to cart #
# START- #
######################################################*/
if($HTTP_GET_VARS['action']== 'auction'){
tep_redirect(tep_href_link(FILENAME_SHOPPING_CART));
}else{
//normal login - redirect to user account
tep_redirect(tep_href_link(FILENAME_DEFAULT));
}
/*# auction.lister #
# -END #
##################*/
CATALOG STEP = 4. open catalog/shopping_cart.php
find.....(aprox. line no.110)
$info_box_contents[$cur_row][] = array('align' => 'center',
'params' => 'class="productListing-data" valign="top"',
'text' => tep_draw_checkbox_field('cart_delete[]', $products[$i]['id']));
..and replace it with this.......
/*# auction.lister ######################################
# if the product is an auction don't show a deletebox #
# and quantitybox - check auctionid in productsarray #
# START- #
#######################################################*/
$auctionid = $products[$i][auctionid];
if($auctionid!=''){
//no deletebox
$mydelete = " ";
//quantity is hidden - no changes can be made by the user
$myquantity = $products[$i]['quantity'].tep_draw_hidden_field('cart_quantity[]', $products[$i]['quantity']). tep_draw_hidden_field('products_id[]', $products[$i]['id']);
//as title show ebayicon - so user knows that this is the product bought at ebay
$mytitle = tep_image(DIR_WS_IMAGES . "ebay.gif");
//link to ebay-auction
$mylink = "'
http://cgi.sandbox.ebay.com/ws/eBayISAPI.dll?ViewItem&item=".$auctionid."' target='_blank'";
}else{
//if product is not a auction - deletbox can be shown
$mydelete = tep_draw_checkbox_field('cart_delete[]', $products[$i]['id']);
//auctionbox can be shown
$myquantity = tep_draw_input_field('cart_quantity[]', $products[$i]['quantity'], 'size="4"') . tep_draw_hidden_field('products_id[]', $products[$i]['id']);
$mytitle = "";
//link to product
$mylink = tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products[$i]['id']);
}
/*# auction.lister #
# -END #
##################*/
/*# auction.lister ###############
# infobox with delete checkbox #
# 'text' => $mydelete #
################################*/
$info_box_contents[$cur_row][] = array('align' => 'center',
'params' => 'class="productListing-data" valign="top"',
'text' => $mydelete);
/*# auction.lister ###############################################################
# insert link an title, if there's one, also the products name #
# <a href=' . $mylink . '><b>' . $mytitle . $products[$i]['name'] . '</b></a>' #
################################################################################
*/
find.....(aprox. line no.154)
$products_name = '<table border="0" cellspacing="2" cellpadding="2">' .
' <tr>' .
' <td class="productListing-data" align="center"><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products[$i]['id']) . '">' . tep_image(DIR_WS_IMAGES . $products[$i]['image'], $products[$i]['name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a></td>' .
.. and add this after...
' <td class="productListing-data" valign="top"><a href=' . $mylink . '><b>' . $mytitle . $products[$i]['name'] . '</b></a>';
find.....(aprox. line no.168)
$products_name .= '<br><small><i> - ' . $products[$i][$option]['products_options_name'] . ' ' . $products[$i][$option]['products_options_values_name'] . '</i></small>';
..and replace it with this.......
/*# auction.lister ##########################
# if the product has attributes show #
# dropdown box to let the customer choose #
# this is for NON-AUCTION products! #
# START- #
###########################################*/
$products_options_array = array();
//select all attributes of the defined productoption
$sql_query = "select products_options_name, options_values_id, options_values_price, price_prefix, products_options_values_name
from " . TABLE_PRODUCTS_ATTRIBUTES . ", ".TABLE_PRODUCTS_OPTIONS_VALUES. ", ".TABLE_PRODUCTS_OPTIONS.
" where products_id = '" . (int)$products[$i]['id'] . "'
AND options_id = '" . (int)$option . "'
AND products_options_values_id = options_values_id
AND products_options_id = options_id
AND ".TABLE_PRODUCTS_OPTIONS.".language_id = '".(int)$languages_id."'
AND ".TABLE_PRODUCTS_OPTIONS_VALUES.".language_id = '".(int)$languages_id."'";
$attribute_query = tep_db_query($sql_query);
//get general productinfos
$product_info_query = tep_db_query("select p.products_id, pd.products_name, pd.products_description, p.products_model, p.products_quantity, p.products_image, pd.products_url, p.products_price, p.products_tax_class_id, p.products_date_added, p.products_date_available, p.manufacturers_id
from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd
where p.products_status = '1' and p.products_id = '" . (int)$products[$i]['id'] . "'
and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "'");
$product_info = tep_db_fetch_array($product_info_query);
//get titel and costs of the selected attributes
while ($products_options = tep_db_fetch_array($attribute_query)) {
$mytitle = $products_options['products_options_name'];
$products_options_array[] = array('id' => $products_options['options_values_id'],
'text' => $products_options['products_options_values_name']);
//if there are extra costs or reductions show prefix (+/-)
if ($products_options['options_values_price'] != '0') {
$products_options_array[sizeof($products_options_array)-1]['text'] .= ' (' . $products_options['price_prefix'] . $currencies->display_price($products_options['options_values_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) .') ';
}
}
//select a value in dropdown
$selected_attribute = $value;
//create dropdown with name and costs of each attribute
$attr_pull_down = $mytitle.": ".tep_draw_pull_down_menu('att_id['.$i.'][' . $option . ']', $products_options_array, $selected_attribute);
//add for each option a attribute-dropdown
$products_name .= '<br><small><i>'.$attr_pull_down;
/*# auction.lister #
# -END #
##################*/
}
/*# auction.lister ##########################
# if the product has attributes show #
# dropdown box to let the customer choose #
# this is for AUCTION products #
# START- #
###########################################*/
}else{
//get productid - if product is an auction the productid is a combination --> productid[ebayauctionid] - so you have to extract it
$my_productsid = split("[[]",$products[$i]['id']);
//select all options to the product
$my_sql_query = "select distinct(options_id) from ".TABLE_PRODUCTS_ATTRIBUTES." where products_id = '".$my_productsid[0]."'";
$check_attribute_query = tep_db_query($my_sql_query);
//get attributes of each productoption
while ($check_attribute = tep_db_fetch_array($check_attribute_query)) {
$products_options_array = array();
$sql_query = "select products_options_name, options_values_id, options_values_price, price_prefix, products_options_values_name
from " . TABLE_PRODUCTS_ATTRIBUTES . ", ".TABLE_PRODUCTS_OPTIONS_VALUES. ", ".TABLE_PRODUCTS_OPTIONS.
" where products_id = '" . $my_productsid[0] . "'
AND options_id = '" . $check_attribute['options_id'] . "'
AND products_options_values_id = options_values_id
AND products_options_id = options_id
AND ".TABLE_PRODUCTS_OPTIONS.".language_id = '".(int)$languages_id."'
AND ".TABLE_PRODUCTS_OPTIONS_VALUES.".language_id = '".(int)$languages_id."'";
$attribute_query = tep_db_query($sql_query);
//get titel and costs of the selected attributes
while ($products_options = tep_db_fetch_array($attribute_query)) {
$mytitle = $products_options['products_options_name'];
$products_options_array[] = array('id' => $products_options['options_values_id'],
'text' => $products_options['products_options_values_name']);
//if there are extra costs or reductions show prefix (+/-)
if ($products_options['options_values_price'] != '0') {
$products_options_array[sizeof($products_options_array)-1]['text'] .= ' (' . $products_options['price_prefix'] . $currencies->display_price($products_options['options_values_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) .') ';
}
}
//select a value in dropdown
$selected_attribute = $value;
//create dropdown with name and costs of each attribute
$attr_pull_down = $mytitle.": ".tep_draw_pull_down_menu('att_id['.$i.'][' . $check_attribute['options_id'] . ']', $products_options_array, $selected_attribute);
//add for each option a attribute-dropdown
$products_name .= '<br><small><i>'.$attr_pull_down;
}
/*# auction.lister #
# -END #
##################*/
}
find.....(aprox. line no.262)
$info_box_contents[$cur_row][] = array('params' => 'class="productListing-data"',
'text' => $products_name);
$info_box_contents[$cur_row][] = array('align' => 'center',
'params' => 'class="productListing-data" valign="top"',
'text' => tep_draw_input_field('cart_quantity[]', $products[$i]['quantity'], 'size="4"') . tep_draw_hidden_field('products_id[]', $products[$i]['id']));
.. and replace with this ...
$info_box_contents[$cur_row][] = array('params' => 'class="productListing-data"',
'text' => $products_name);
/*# auction.lister #################
# infobox with quantity checkbox #
# 'text' => $myquantity); #
################################*/
$info_box_contents[$cur_row][] = array('align' => 'center',
'params' => 'class="productListing-data" valign="top"',
'text' => $myquantity);
CATALOG STEP = 5. open catalog\includes\application_top.php
find.....(aprox. line no.349)
$attributes = ($HTTP_POST_VARS['id'][$HTTP_POST_VARS['products_id'][$i]]) ? $HTTP_POST_VARS['id'][$HTTP_POST_VARS['products_id'][$i]] : '';
.. and replace with this ...
/*# auction.lister ######################################################################
# to push attributs out of cart #
# $attributes = ($HTTP_POST_VARS['att_id'][$i]) ? $HTTP_POST_VARS['att_id'][$i] : ''; #
################################################################################
#######*/
$attributes = ($HTTP_POST_VARS['att_id'][$i]) ? $HTTP_POST_VARS['att_id'][$i] : '';
find.....(aprox. line no.431)
// include the password crypto functions
require(DIR_WS_FUNCTIONS . 'password_funcs.php');
.. and add this after...
/*# auction.lister ########################
# include the password crypto functions #
#########################################*/
require(DIR_WS_FUNCTIONS . 'password_funcs2.php');
CATALOG STEP = 6. catalog\includes\classes\order.php
find.....(aprox. line no.213)
$index = 0;
$products = $cart->get_products();
for ($i=0, $n=sizeof($products); $i<$n; $i++) {
.. and add this after...
/*# auction.lister #############################
# ad auctionid in products array #
# 'auctionid' => $products[$i]['auctionid']) #
##############################################*/
find.....(aprox. line no.228)
'id' => $products[$i]['id']);
.. and replace with this ...
'id' => $products[$i]['id'],
'auctionid' => $products[$i]['auctionid']);
CATALOG STEP = 7. catalog\includes\classes\shopping_cart.php
find.....(aprox. line no.47)
$products_query = tep_db_query("select products_id, customers_basket_quantity from " . TABLE_CUSTOMERS_BASKET . " where customers_id = '" . (int)$customer_id . "'");
while ($products = tep_db_fetch_array($products_query)) {
$this->contents[$products['products_id']] = array('qty' => $products['customers_basket_quantity']);
// attributes
$attributes_query = tep_db_query("select products_options_id, products_options_value_id from " . TABLE_CUSTOMERS_BASKET_ATTRIBUTES . " where customers_id = '" . (int)$customer_id . "' and products_id = '" . tep_db_input($products['products_id']) . "'");
while ($attributes = tep_db_fetch_array($attributes_query)) {
$this->contents[$products['products_id']]['attributes'][$attributes['products_options_id']] = $attributes['products_options_value_id'];
}
}
.. and replace with this ...
/*# auction.lister ########################################
# select auctionid in query, too #
# combine productid and auctionid --> prodid[auctionid] #
# START- #
#########################################################*/
//select also auctionid
$products_query = tep_db_query("select products_id, auctionid, customers_basket_quantity from " . TABLE_CUSTOMERS_BASKET . " where customers_id = '" . (int)$customer_id . "'");
while ($products = tep_db_fetch_array($products_query)) {
//if product is an auction
if($products['auctionid']!=''){
//conbine ids
$myproducts_id = $products['products_id']."[".$products['auctionid']."]";
}else{
//no auction
$myproducts_id = $products['products_id'];
}
$this->contents[$myproducts_id] =
array('qty' => $products['customers_basket_quantity'], 'auctionid' => $products['auctionid']);
// look for attributes
//is auction with attributes?
if($products['auctionid']!=''){
$mysql = "select products_options_id, products_options_value_id from " . TABLE_CUSTOMERS_BASKET_ATTRIBUTES . "
where customers_id = '" . (int)$customer_id . "'
and products_id = '" . tep_db_input($products['products_id']) . "'
and auctionid = '".tep_db_input($products['auctionid'])."'";
}else{
//normal product from shop
$mysql = "select products_options_id, products_options_value_id from " . TABLE_CUSTOMERS_BASKET_ATTRIBUTES . "
where customers_id = '" . (int)$customer_id . "'
and products_id = '" . tep_db_input($products['products_id']) . "'
and auctionid = '0'";
}
$attributes_query = tep_db_query($mysql);
while ($attributes = tep_db_fetch_array($attributes_query)) {
if($products['auctionid']!=''){
$myproducts_id = $products['products_id']."[".$products['auctionid']."]";
}else{
$myproducts_id = $products['products_id'];
}
//add attributes to productarray
$this->contents[$myproducts_id]['attributes'][$attributes['products_options_id']] = $attributes['products_options_value_id'];
}
}
/*# auction.lister #
# -END #
##################*/
find.....(aprox. line no.116)
function add_cart($products_id, $qty = '1', $attributes = '', $notify = true) {
global $new_products_id_in_cart, $customer_id;
.. and add this after...
/*# auction.lister ###############
# save passed products_id tmp #
# $old_prod_id = $products_id; #
################################*/
$old_prod_id = $products_id;
find.....(aprox. line no.134)
if ($this->in_cart($products_id_string)) {
$this->update_quantity($products_id_string, $qty, $attributes);
} else {
$this->contents[$products_id_string] = array('qty' => $qty);
// insert into database
if (tep_session_is_registered('customer_id')) tep_db_query("insert into " . TABLE_CUSTOMERS_BASKET . " (customers_id, products_id, customers_basket_quantity, customers_basket_date_added) values ('" . (int)$customer_id . "', '" . tep_db_input($products_id_string) . "', '" . (int)$qty . "', '" . date('Ymd') . "')");
if (is_array($attributes)) {
reset($attributes);
while (list($option, $value) = each($attributes)) {
$this->contents[$products_id_string]['attributes'][$option] = $value;
// insert into database
if (tep_session_is_registered('customer_id')) tep_db_query("insert into " . TABLE_CUSTOMERS_BASKET_ATTRIBUTES . " (customers_id, products_id, products_options_id, products_options_value_id) values ('" . (int)$customer_id . "', '" . tep_db_input($products_id_string) . "', '" . (int)$option . "', '" . (int)$value . "')");
}
}
}
$this->cleanup();
// assign a temporary unique ID to the order contents to prevent hack attempts during the checkout procedure
$this->cartID = $this->generate_cart_id();
.. and replace with this ...
/*# auction.lister ########################
# look if product in cart is an auction #
# START- #
#########################################*/
//look for tmp saved prodid - if it is an auction
if($this->contents[$old_prod_id][auctionid]!=''){
//if it is in cart
if ($this->in_cart($old_prod_id)) {
//update quantity and attributes
$this->update_quantity($old_prod_id, $qty, $attributes);
}
//tmp saved prodid is not an auction
}else{
//look if normal product is in cart
if ($this->in_cart($products_id_string)) {
//update quantity and attributes
$this->update_quantity($products_id_string, $qty, $attributes);
} else {//product is not in cart
//add a new product to cart
$this->contents[$products_id_string] = array('qty' => $qty);
// insert into database
if (tep_session_is_registered('customer_id')) tep_db_query("insert into " . TABLE_CUSTOMERS_BASKET . " (customers_id, products_id, customers_basket_quantity, customers_basket_date_added) values ('" . (int)$customer_id . "', '" . tep_db_input($products_id_string) . "', '" . (int)$qty . "', '" . date('Ymd') . "')");
//add attributes
if (is_array($attributes)) {
reset($attributes);
while (list($option, $value) = each($attributes)) {
$this->contents[$products_id_string]['attributes'][$option] = $value;
// insert into database
if (tep_session_is_registered('customer_id')) tep_db_query("insert into " . TABLE_CUSTOMERS_BASKET_ATTRIBUTES . " (customers_id, products_id, products_options_id, products_options_value_id) values ('" . (int)$customer_id . "', '" . tep_db_input($products_id_string) . "', '" . (int)$option . "', '" . (int)$value . "')");
}
}
}
$this->cleanup();
// assign a temporary unique ID to the order contents to prevent hack attempts during the checkout procedure
$this->cartID = $this->generate_cart_id();
}
/*# auction.lister #
# -END #
##################*/
find.....(aprox. line no.181)
$products_id_string = tep_get_uprid($products_id, $attributes);
$products_id = tep_get_prid($products_id_string);
if (is_numeric($products_id) && isset($this->contents[$products_id_string]) && is_numeric($quantity)) {
$this->contents[$products_id_string] = array('qty' => $quantity);
// update database
if (tep_session_is_registered('customer_id')) tep_db_query("update " . TABLE_CUSTOMERS_BASKET . " set customers_basket_quantity = '" . (int)$quantity . "' where customers_id = '" . (int)$customer_id . "' and products_id = '" . tep_db_input($products_id_string) . "'");
if (is_array($attributes)) {
reset($attributes);
while (list($option, $value) = each($attributes)) {
$this->contents[$products_id_string]['attributes'][$option] = $value;
// update database
if (tep_session_is_registered('customer_id')) tep_db_query("update " . TABLE_CUSTOMERS_BASKET_ATTRIBUTES . " set products_options_value_id = '" . (int)$value . "' where customers_id = '" . (int)$customer_id . "' and products_id = '" . tep_db_input($products_id_string) . "' and products_options_id = '" . (int)$option . "'");
.. and replace with this ...
/*# auction.lister ########################
# look if product in cart is an auction #
# START- #
#########################################*/
//tmp save passed productid
$old_prod_id = $products_id;
$products_id_string = tep_get_uprid($products_id, $attributes);
$products_id = tep_get_prid($products_id_string);
//substract auctionid (out of combination --> productid[auctionid])
$myauctionid = substr(strstr($old_prod_id,"["),1,-1);
//get clear productid (out of combination --> productid[auctionid])
$myproducts_id = explode("[",$old_prod_id);
//look if products are in productsarray (auction and normal products)
if (is_numeric($products_id) && (isset($this->contents[$products_id_string]) || isset($this->contents[$old_prod_id])) && is_numeric($quantity)) {
//if no auction product
if($myauctionid==''){
$this->contents[$products_id_string] = array('qty' => $quantity);
}else{ //if an auction
$this->contents[$old_prod_id] = array('qty' => $quantity);
//also set auctionid in productsarray
$this->contents[$old_prod_id]['auctionid'] = $myauctionid;
}
// update database
if (tep_session_is_registered('customer_id')){
//is not a auction add to database
if($myauctionid==''){
tep_db_query("update " . TABLE_CUSTOMERS_BASKET . " set customers_basket_quantity = '" . (int)$quantity . "' where customers_id = '" . (int)$customer_id . "' and products_id = '" . tep_db_input($products_id_string) . "' and auction='0'");
}
}
if (is_array($attributes)) {
reset($attributes);
while (list($option, $value) = each($attributes)) {
//if no auction add attributes
if($myauctionid==''){
$this->contents[$products_id_string]['attributes'][$option] = $value;
}else{//if auction add attributes on this way
$this->contents[$old_prod_id]['attributes'][$option] = $value;
}
// update database
if (tep_session_is_registered('customer_id')){
//is an auction - update db customers basket in this way
if($myauctionid!=''){
$mysqlstring = "update " . TABLE_CUSTOMERS_BASKET_ATTRIBUTES . " set products_options_value_id = '" . (int)$value . "'
where customers_id = '" . (int)$customer_id . "'
and products_id = '" . tep_db_input($myproducts_id[0]) . "'
and products_options_id = '" . (int)$option . "'
and auctionid ='".$myauctionid."'";
//is a normal product
}else{
$mysqlstring = "update " . TABLE_CUSTOMERS_BASKET_ATTRIBUTES . " set products_options_value_id = '" . (int)$value . "'
where customers_id = '" . (int)$customer_id . "'
and products_id = '" . tep_db_input($products_id_string) . "'
and products_options_id = '" . (int)$option . "'
and auctionid = '0'";
}
tep_db_query($mysqlstring);
}
/*# auction.lister #
# -END #
##################*/
find.....(aprox. line no.181)
// remove from database
if (tep_session_is_registered('customer_id')) {
tep_db_query("delete from " . TABLE_CUSTOMERS_BASKET . " where customers_id = '" . (int)$customer_id . "' and products_id = '" . tep_db_input($products_id) . "'");
.. and replace with this ...
// remove from database
if (tep_session_is_registered('customer_id')) {
/*# auction.lister ##############################
# remove normal product from customers basket #
# normal product --> auctionid==0 #
###############################################*/
tep_db_query("delete from " . TABLE_CUSTOMERS_BASKET . " where customers_id = '" . (int)$customer_id . "' and products_id = '" . tep_db_input($products_id) . "' and auction=0");
find.....(aprox. line no.326)
function calculate() {
$this->total = 0;
$this->weight = 0;
if (!is_array($this->contents)) return 0;
reset($this->contents);
while (list($products_id, ) = each($this->contents)) {
$qty = $this->contents[$products_id]['qty'];
// products price
$product_query = tep_db_query("select products_id, products_price, products_tax_class_id, products_weight from " . TABLE_PRODUCTS . " where products_id = '" . (int)$products_id . "'");
if ($product = tep_db_fetch_array($product_query)) {
$prid = $product['products_id'];
$products_tax = tep_get_tax_rate($product['products_tax_class_id']);
$products_price = $product['products_price'];
.. and replace with this ...
/*# auction.lister ###
# add customer_id #
####################*/
global $customer_id;
$this->total = 0;
$this->weight = 0;
if (!is_array($this->contents)) return 0;
reset($this->contents);
while (list($products_id, ) = each($this->contents)) {
$qty = $this->contents[$products_id]['qty'];
// products price
/*# auction.lister ##########
# get right product price #
# START- #
###########################*/
//get auctionid
$auctionid = $this->contents[$products_id][auctionid];
//if product is an auction - get right price out of table auction_details
if($auctionid!=''){
$sqlquery = "select p.products_id, ad.auction_endprice, p.products_tax_class_id,
p.products_weight from products p, auction_list al, auction_details ad, customers c
WHERE p.products_id = al.product_id
AND c.customers_email_address = ad.buyer_email
AND al.auction_id = ad.auction_id
AND al.auction_id='".$auctionid."'
AND c.customers_id = '".$customer_id."'";
}else{
//normal shopproduct - normal select
$sqlquery = "select products_id, products_price, products_tax_class_id, products_weight from " . TABLE_PRODUCTS . " where products_id = '" . (int)$products_id . "'";
}
$product_query = tep_db_query($sqlquery);
if ($product = tep_db_fetch_array($product_query)) {
$prid = $product['products_id'];
$products_tax = tep_get_tax_rate($product['products_tax_class_id']);
//if auction
if($auctionid!=''){
//auctionprice is incl. tax - so you have to get the price without tax (because in cart it automatically added)
$products_price = $product['auction_endprice']/(1+($products_tax/100));
}else{//normalproduct
$products_price = $product['products_price'];
}
/*# auction.lister #
# -END #
##################*/
find.....(aprox. line no.429)
$products_query = tep_db_query("select p.products_id, pd.products_name, p.products_model, p.products_image, p.products_price, p.products_weight, p.products_tax_class_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_id = '" . (int)$products_id . "' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "'");
if ($products = tep_db_fetch_array($products_query)) {
$prid = $products['products_id'];
$products_price = $products['products_price'];
$specials_query = tep_db_query("select specials_new_products_price from " . TABLE_SPECIALS . " where products_id = '" . (int)$prid . "' and status = '1'");
if (tep_db_num_rows($specials_query)) {
$specials = tep_db_fetch_array($specials_query);
$products_price = $specials['specials_new_products_price'];
}
$products_array[] = array('id' => $products_id,
.. and replace with this ...
/*# auction.lister ####################
# update orderid in auction_details #
# START- #
#####################################*/
$auctionid = $this->contents[$products_id][auctionid];
//if product is an auction
if($auctionid!=''){
//query: also select for auctionid - there might be more than one auction from the same product (same productid) with different prices
$sqlquery = "select p.products_id, pd.products_name, p.products_model, p.products_image,
ad.auction_endprice, p.products_weight, p.products_tax_class_id
from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd,
auction_details ad, auction_list al where
ad.auction_id = al.auction_id AND
al.product_id=p.products_id AND
p.products_id = '" . (int)$products_id . "' and
pd.products_id = p.products_id
and al.auction_id = '".$auctionid."'
and pd.language_id = '" . (int)$languages_id . "'";
$products_query = tep_db_query($sqlquery);
}else{//normal shopproduct - normal select
$sqlquery = "select p.products_id, pd.products_name, p.products_model, p.products_image, p.products_price,
p.products_weight, p.products_tax_class_id
from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd
where p.products_id = '" . (int)$products_id . "' and
pd.products_id = p.products_id
and pd.language_id = '" . (int)$languages_id . "'";
$products_query = tep_db_query($sqlquery);
}
if ($products = tep_db_fetch_array($products_query)) {
$prid = $products['products_id'];
//if auction - get right excl. tax price
if($auctionid!=''){
$products_price = $products['auction_endprice']/(1+(tep_get_tax_rate($products['products_tax_class_id'])/100));
}else{//normal price - normal shopproduct
$products_price = $products['products_price'];
$specials_query = tep_db_query("select specials_new_products_price from " . TABLE_SPECIALS . " where products_id = '" . (int)$prid . "' and status = '1'");
if (tep_db_num_rows($specials_query)) {
$specials = tep_db_fetch_array($specials_query);
$products_price = $specials['specials_new_products_price'];
}
}
/*# auction.lister #
# -END #
##################*/
/*# auction.lister ################
# add auctionid to productarray #
# 'auctionid' => $auctionid, #
#################################*/
$products_array[] = array('id' => $products_id,
'auctionid' => $auctionid,
At the End of the file, just before the
}
?>
/*# auction.lister #######################
# function - check product if it is a #
# combination of prodid and auctionid #
# --> then product would be an auction #
########################################*/
function is_auction($products_id){
$myproduct = $this->contents[$products_id];
if($myproduct[auctionid] != ''){
return true;
}else{
return false;
}
}
D. EDITING OS COMMERCE FILES.(admin dir)
-- Files to Modify in admin section --------------
1. catalog\admin\categories.php
2. catalog\admin\index.php
3. catalog\admin\includes\application_top.php
4. catalog\admin\includes\column_left.php
5. catalog\admin\includes\filenames.php
6. catalog\admin\includes\stylesheet.css
1. ADMIN STEP = 1. catalog\admin\categories.php
find.....(aprox. line no.264)
if ($action == 'insert_product') {
$insert_sql_data = array('products_id' => $products_id,
'language_id' => $language_id);
$sql_data_array = array_merge($sql_data_array, $insert_sql_data);
tep_db_perform(TABLE_PRODUCTS_DESCRIPTION, $sql_data_array);
} elseif ($action == 'update_product') {
tep_db_perform(TABLE_PRODUCTS_DESCRIPTION, $sql_data_array, 'update', "products_id = '" . (int)$products_id . "' and language_id = '" . (int)$language_id . "'");
}
}
.. and add this after...
/*# auction.lister #############################
# insert ebay product description in catalog #
# START- #
##############################################*/
if ($action == 'insert_product') {
$sql_data_array = array('products_id' => $products_id,
'auction_description' => tep_db_prepare_input($HTTP_POST_VARS['auction_description']));
tep_db_perform('ebay_products', $sql_data_array);
} elseif ($action == 'update_product') {
$sql_data_array = array('products_id' => $products_id,
'auction_description' => tep_db_prepare_input($HTTP_POST_VARS['auction_description']));
tep_db_perform('ebay_products', $sql_data_array, 'update', "products_id = '" . (int)$products_id . "'");
}
/*# auction.lister #
# -END #
##################*/
find.....(aprox. line no.306)
} elseif ($HTTP_POST_VARS['copy_as'] == 'duplicate') {
$product_query = tep_db_query("select products_quantity, products_model, products_image, products_price, products_date_available, products_weight, products_tax_class_id, manufacturers_id from " . TABLE_PRODUCTS . " where products_id = '" . (int)$products_id . "'");
$product = tep_db_fetch_array($product_query);
.. and add this after...
//####################################################################
if ($product['products_date_available'] == '') {
tep_db_query("insert into " . TABLE_PRODUCTS . " (products_quantity, products_model,products_image, products_price, products_date_added, products_date_available, products_weight, products_status, products_tax_class_id, manufacturers_id) values ('" . tep_db_input($product['products_quantity']) . "', '" . tep_db_input($product['products_model']) . "', '" . tep_db_input($product['products_image']) . "', '" . tep_db_input($product['products_price']) . "', now(), null, '" . tep_db_input($product['products_weight']) . "', '0', '" . (int)$product['products_tax_class_id'] . "', '" . (int)$product['manufacturers_id'] . "')");
} else {
tep_db_query("insert into " . TABLE_PRODUCTS . " (products_quantity, products_model,products_image, products_price, products_date_added, products_date_available, products_weight, products_status, products_tax_class_id, manufacturers_id) values ('" . tep_db_input($product['products_quantity']) . "', '" . tep_db_input($product['products_model']) . "', '" . tep_db_input($product['products_image']) . "', '" . tep_db_input($product['products_price']) . "', now(), '" . tep_db_input($product['products_date_available']) . "', '" . tep_db_input($product['products_weight']) . "', '0', '" . (int)$product['products_tax_class_id'] . "', '" . (int)$product['manufacturers_id'] . "')");
}
//####################################################################
find.....(aprox. line no.381)
$parameters = array('products_name' => '',
'products_description' => '',
'products_url' => '',
'products_id' => '',
'products_quantity' => '',
'products_model' => '',
'products_image' => '',
'products_price' => '',
'products_weight' => '',
'products_date_added' => '',
'products_last_modified' => '',
'products_date_available' => '',
'products_status' => '',
'products_tax_class_id' => '',
'manufacturers_id' => '');
$pInfo = new objectInfo($parameters);
if (isset($HTTP_GET_VARS['pID']) && empty($HTTP_POST_VARS)) {
$product_query = tep_db_query("select pd.products_name, pd.products_description, pd.products_url, p.products_id, p.products_quantity, p.products_model, p.products_image, p.products_price, p.products_weight, p.products_date_added, p.products_last_modified, date_format(p.products_date_available, '%Y-%m-%d') as products_date_available, p.products_status, p.products_tax_class_id, p.manufacturers_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_id = '" . (int)$HTTP_GET_VARS['pID'] . "' and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "'");
$product = tep_db_fetch_array($product_query);
.. and replace with this ...
/*# auction.lister ###################
# add auction_description in array #
# 'auction_description' => '' #
####################################*/
$parameters = array('products_name' => '',
'products_description' => '',
'products_url' => '',
'products_id' => '',
'products_quantity' => '',
'products_model' => '',
'products_image' => '',
'products_price' => '',
'products_weight' => '',
'products_date_added' => '',
'products_last_modified' => '',
'products_date_available' => '',
'products_status' => '',
'products_tax_class_id' => '',
'manufacturers_id' => '',
'auction_description' => '');
$pInfo = new objectInfo($parameters);
if (isset($HTTP_GET_VARS['pID']) && empty($HTTP_POST_VARS)) {
/*# auction.lister ##########
# select all productinfos #
###########################*/
$sql_query = "select pd.products_name, pd.products_description, ep.auction_description, pd.products_url, p.products_id, p.products_quantity,
p.products_model, p.products_image, p.products_price, p.products_weight, p.products_date_added, p.products_last_modified,
date_format(p.products_date_available, '%Y-%m-%d') as products_date_available, p.products_status, p.products_tax_class_id,
p.manufacturers_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, ebay_products ep
where p.products_id = '" . (int)$HTTP_GET_VARS['pID'] . "' and p.products_id = pd.products_id
AND p.products_id = ep.products_id
and pd.language_id = '" . (int)$languages_id . "'";
$product_query = tep_db_query($sql_query);
$product = tep_db_fetch_array($product_query);
find.....(aprox. line no.542)
<td class="main"><?php echo tep_image(DIR_WS_CATALOG_LANGUAGES . $languages[$i]['directory'] . '/images/' . $languages[$i]['image'], $languages[$i]['name']) . ' ' . tep_draw_input_field('products_name[' . $languages[$i]['id'] . ']', (isset($products_name[$languages[$i]['id']]) ? stripslashes($products_name[$languages[$i]['id']]) : tep_get_products_name($pInfo->products_id, $languages[$i]['id']))); ?></td>
.. and replace with this...
<td class="main"><?php echo tep_image(DIR_WS_CATALOG_LANGUAGES . $languages[$i]['directory'] . '/images/' . $languages[$i]['image'], $languages[$i]['name']) . ' ' . tep_draw_input_field('products_name[' . $languages[$i]['id'] . ']', (isset($products_name[$languages[$i]['id']]) ? $products_name[$languages[$i]['id']] : tep_get_products_name($pInfo->products_id, $languages[$i]['id']))); ?></td>
find.....(aprox. line no.569)
for ($i=0, $n=sizeof($languages); $i<$n; $i++) {
?>
<tr>
<td class="main" valign="top"><?php if ($i == 0) echo TEXT_PRODUCTS_DESCRIPTION; ?></td>
<td><table border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="main" valign="top"><?php echo tep_image(DIR_WS_CATALOG_LANGUAGES . $languages[$i]['directory'] . '/images/' . $languages[$i]['image'], $languages[$i]['name']); ?> </td>
<td class="main"><?php echo tep_draw_textarea_field('products_description[' . $languages[$i]['id'] . ']', 'soft', '70', '15', (isset($products_description[$languages[$i]['id']]) ? stripslashes($products_description[$languages[$i]['id']]) : tep_get_products_description($pInfo->products_id, $languages[$i]['id']))); ?></td>
</tr>
</table></td>
</tr>
.. and replace with this...
for ($i=0, $n=sizeof($languages); $i<$n; $i++) {
?>
<tr>
<td class="main" valign="top"><?php if ($i == 0) echo TEXT_PRODUCTS_DESCRIPTION; ?></td>
<td><table border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="main" valign="top"><?php echo tep_image(DIR_WS_CATALOG_LANGUAGES . $languages[$i]['directory'] . '/images/' . $languages[$i]['image'], $languages[$i]['name']); ?> </td>
<td class="main"><?php echo tep_draw_textarea_field('products_description[' . $languages[$i]['id'] . ']', 'soft', '70', '15', (isset($products_description[$languages[$i]['id']]) ? $products_description[$languages[$i]['id']] : tep_get_products_description($pInfo->products_id, $languages[$i]['id']))); ?></td>
</tr>
</table></td>
</tr>
find.....(aprox. line no.583)
<tr>
<td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
</tr>
.. and add this after...
<?php
/*# auction.lister ####################
# add field for auction description #
# START- #
#####################################*/
?>
<tr>
<td class="main" valign="top">Auktionsbeschreibung</td>
<td><table border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="main" valign="top"><?php echo tep_draw_separator('pixel_trans.gif', '24', '15'); ?> </td>
<td class="main"><?php echo tep_draw_textarea_field('auction_description', 'soft', '70', '15', $pInfo->auction_description); ?></td>
</tr>
</table></td>
</tr>
<tr>
<td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
</tr>
<?php
/*# auction.lister #
# -END #
##################*/
?>
find.....(aprox. line no.623)
<tr>
<td class="main"><?php echo TEXT_PRODUCTS_IMAGE; ?></td>
<td class="main"><?php echo tep_draw_separator('pixel_trans.gif', '24', '15') . ' ' . tep_draw_file_field('products_image') . '<br>' . tep_draw_separator('pixel_trans.gif', '24', '15') . ' ' . $pInfo->products_image . tep_draw_hidden_field('products_previous_image', $pInfo->products_image); ?></td>
</tr>
<tr>
<td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
</tr>
<?php
for ($i=0, $n=sizeof($languages); $i<$n; $i++) {
?>
<tr>
<td class="main"><?php if ($i == 0) echo TEXT_PRODUCTS_URL . '<br><small>' . TEXT_PRODUCTS_URL_WITHOUT_HTTP . '</small>'; ?></td>
<td class="main"><?php echo tep_image(DIR_WS_CATALOG_LANGUAGES . $languages[$i]['directory'] . '/images/' . $languages[$i]['image'], $languages[$i]['name']) . ' ' . tep_draw_input_field('products_url[' . $languages[$i]['id'] . ']', (isset($products_url[$languages[$i]['id']]) ? stripslashes($products_url[$languages[$i]['id']]) : tep_get_products_url($pInfo->products_id, $languages[$i]['id']))); ?></td>
</tr>
.. and replace with this...
<tr>
<td class="main"><?php echo TEXT_PRODUCTS_IMAGE; ?></td>
<td class="main"><?php echo tep_draw_separator('pixel_trans.gif', '24', '15') . ' ' . tep_draw_file_field('products_image') . '<br>' . tep_draw_separator('pixel_trans.gif', '24', '15') . ' ' . $pInfo->products_image . tep_draw_hidden_field('products_previous_image', $pInfo->products_image); ?></td>
</tr>
</tr>
<tr>
<td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
</tr>
<?php
for ($i=0, $n=sizeof($languages); $i<$n; $i++) {
?>
<tr>
<td class="main"><?php if ($i == 0) echo TEXT_PRODUCTS_URL . '<br><small>' . TEXT_PRODUCTS_URL_WITHOUT_HTTP . '</small>'; ?></td>
<td class="main"><?php echo tep_image(DIR_WS_CATALOG_LANGUAGES . $languages[$i]['directory'] . '/images/' . $languages[$i]['image'], $languages[$i]['name']) . ' ' . tep_draw_input_field('products_url[' . $languages[$i]['id'] . ']', (isset($products_url[$languages[$i]['id']]) ? $products_url[$languages[$i]['id']] : tep_get_products_url($pInfo->products_id, $languages[$i]['id']))); ?></td>
</tr>
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Post to be continued
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Edited by Jupiters, 24 January 2007 - 11:31 AM.