devosc Posted August 23, 2004 Author Share Posted August 23, 2004 I have php5 installed in my server so I'm getting the error Fatal error: Cannot re-assign $this in /home/wnfaknd/public_html/catalog/includes/modules/payment/paypal.php on line 25 Any fixes other than installing php4? Hi Jose, yeah at the time I thought it seemed cool, but then I read somewhere something like that wouldn't work in php5 and I haven't had time to make some updates to the contrib recently. I would be interested to know whether whether in catalog/includes/modules/payment/paypal.php on line 25 if changing it to a reference would work, eg: try changing $this = new ipn_query($paypal_ipn_id); To $this = & new ipn_query($paypal_ipn_id); Alternatively the sure fire way is to add the function query($paypal_ipn_id) from paypal/classes/ipn_query.class.php back into the modules/payment/paypal.php and change lines 24 & 25 from include_once(DIR_FS_CATALOG_MODULES . 'payment/paypal/classes/ipn_query.class.php');$this = new ipn_query($paypal_ipn_id); To $this->query($paypal_ipn_id); Prevously the query was a seperate class inside paypal.php which was then always loaded during the catalog, so I tried to put it into a seperate file. However now it seems that the thing to do is to not use a seperate class but just put the query function in with the main paypal class and described above - this is similar to includes/classes/order.php Quote "Any fool can know. The point is to understand." -- Albert Einstein Link to comment Share on other sites More sharing options...
wwsmith64 Posted August 23, 2004 Share Posted August 23, 2004 Greg this is an extrodinarily valuable contribution to us. Thank you. Can you tell me if it handles the following? When the customer uses a currency other than the store default, the OSC order status does not change because the test for a valid cart (sufficient payment) appears to be a string match. Is there some way to continue to check for a sufficient payment and allow for multiple currencies? (i.e. not turn off cart test) When refunds and reversals occur at PayPal they do not seem to come back to our store via IPN. Is this an implemented feature? Is there anything I need to do to turn it on? If the contribution does not include these items would you be able to add them for a fee? Quote Link to comment Share on other sites More sharing options...
devosc Posted August 23, 2004 Author Share Posted August 23, 2004 Can you tell me if it handles the following? When the customer uses a currency other than the store default, the OSC order status does not change because the test for a valid cart (sufficient payment) appears to be a string match. Is there some way to continue to check for a sufficient payment and allow for multiple currencies? (i.e. not turn off cart test) When refunds and reversals occur at PayPal they do not seem to come back to our store via IPN. Is this an implemented feature? Is there anything I need to do to turn it on? Hi Bill, I haven't previously sat down to fully consider the currency aspect, however from the above you refered to 'store default'..., from working with the code (using USD as default and as the currency selected during checkout), the checkout/order currency is supposed to be stored into the orders_session_info db table, then when the IPN is received and osC is initialized the currency of that order is used and set. Are you saying that this is not happening? or is it because customers are able to choose a different currency once they get to PayPal? (as said I've haven't played much with the currency settings). Thinking now, really it shouldn't matter, since I think PayPal also sends the currency conversion rate in the IPN, so whatever amount paid could be recalculated using the currency rate to determine that it matches the amount expected for that order (although d.p. may have to be taken into consideration also). In regards to refunds and reversals it wasn't previously clear as to what should actually happen, e.g should the stock levels be replenished and or etc... However now having an IPN transaction history does help, so for example it would be possible to update the PayPal IPN payment status of that order accordingly, if one then wanted to automatically update the main osC 'order' status then a new field would need to occur in the admin->modules->payment->paypal config section so that one can specifically chose the order status to use (since osC doesn't have a 'refunded' order status by default). Let me know what you think should happen etc.. If you have a specific need and or time frame let me know (pm or email). Regards, Greg. Quote "Any fool can know. The point is to understand." -- Albert Einstein Link to comment Share on other sites More sharing options...
wnfaknd Posted August 23, 2004 Share Posted August 23, 2004 Alternatively the sure fire way is to add the function query($paypal_ipn_id) from paypal/classes/ipn_query.class.php back into the modules/payment/paypal.php and change lines 24 & 25 from QUOTE include_once(DIR_FS_CATALOG_MODULES . 'payment/paypal/classes/ipn_query.class.php'); $this = new ipn_query($paypal_ipn_id); To QUOTE $this->query($paypal_ipn_id); Prevously the query was a seperate class inside paypal.php which was then always loaded during the catalog, so I tried to put it into a seperate file. However now it seems that the thing to do is to not use a seperate class but just put the query function in with the main paypal class and described above - this is similar to includes/classes/order.php This fixed it, although I still havent run any tests... I'll keep you posted. Thanks! :D Quote Link to comment Share on other sites More sharing options...
wnfaknd Posted August 23, 2004 Share Posted August 23, 2004 (edited) Well, I was able to place the order just fine online. It forward me to paypal to pay and all went well. When I went to /admin to check on the invoice, I got this error: Fatal error: Call to undefined method paypal::query() in /home/wnfaknd/public_html/catalog/includes/modules/payment/paypal.php on line 24 It gave me a bit of info on the page such as the customer addresses, phone number and email address, but it stopped there. Should i have removed the function query($paypal_ipn_id) from paypal/classes/ipn_query.class.php ?? Edited August 23, 2004 by wnfaknd Quote Link to comment Share on other sites More sharing options...
devosc Posted August 23, 2004 Author Share Posted August 23, 2004 You need to copy the function query(....) from the paypal/classes/ip_query.class.php script and paste it into payment/paypal.php before the last '}'. To test it, just try and view a paypal order in the admin. Quote "Any fool can know. The point is to understand." -- Albert Einstein Link to comment Share on other sites More sharing options...
Guest Posted August 23, 2004 Share Posted August 23, 2004 i just installed the module, admin works fine. in checkout_payment.php (1.95) i'm getting this :-/ Quote Link to comment Share on other sites More sharing options...
wnfaknd Posted August 23, 2004 Share Posted August 23, 2004 greg, that fixed it! You are indeed a genious :D Quote Link to comment Share on other sites More sharing options...
wnfaknd Posted August 24, 2004 Share Posted August 24, 2004 (edited) Greg, One minor cosmetic problem. I would like the thing to look like this: isntead of this: Thanks :D Edited August 24, 2004 by wnfaknd Quote Link to comment Share on other sites More sharing options...
Jazzer Posted August 24, 2004 Share Posted August 24, 2004 Can someone help me pleaseFirst of all there is no payment method in my payment page(user site) and also i am getting these error messages 1- 1054 - Unknown column 'paypal_ipn_id' in 'field list' select paypal_ipn_id from orders where orders_id ='2' 2- when trying to see order in history in my accounts 1054 - Unknown column 'products_options_id' in 'field list' select products_options_id, products_options_values_id, products_options, products_options_values, options_values_price, price_prefix from orders_products_attributes where orders_id = '2' and orders_products_id = '2' 3- in admin page when i click on orders 1054 - Unknown column 'o.paypal_ipn_id' in 'on clause' select p.payment_status from paypal p left join orders o on p.paypal_ipn_id = o.paypal_ipn_id where o.orders_id ='2' 4- in admin area when click on paypal ipn 1054 - Unknown column 'o.paypal_ipn_id' in 'on clause' select count(*) as total from paypal as p left join orders as o on p.paypal_ipn_id=o.paypal_ipn_id 5- when i click on any order this message will comes up 1054 - Unknown column 'paypal_ipn_id' in 'field list' select customers_name, customers_company, customers_street_address, customers_suburb, customers_city, customers_postcode, customers_state, customers_country, customers_telephone, customers_email_address, customers_address_format_id, delivery_name, delivery_company, delivery_street_address, delivery_suburb, delivery_city, delivery_postcode, delivery_state, delivery_country, delivery_address_format_id, billing_name, billing_company, billing_street_address, billing_suburb, billing_city, billing_postcode, billing_state, billing_country, billing_address_format_id, payment_method, cc_type, cc_owner, cc_number, cc_expires, currency, currency_value, date_purchased, orders_status, last_modified, paypal_ipn_id from orders where orders_id = '2' i am 100% sure that i added the fields to the database and i follow the instruction step by step and double check everything(maybe not) any way but i don't know why it doesn't work can any one help me please I'm getting almost exactly the same errors. I'm sure as I can be that I've followed all the steps. Any help? Quote Link to comment Share on other sites More sharing options...
devosc Posted August 24, 2004 Author Share Posted August 24, 2004 ics-lingen, I can't say much at this one, are you using osC-MS2-2.2? The array is generated in modules/payment/paypal.php in function selection(). wnfaknd, have a look in the function selection() refered to above, you'll see there the images being defined and placed into a string, just remove what it is not needed. Jazzer, you found the problem post but what about the solution post? only teasing :) hamed, you need to perform the 'alterations' as per step 1 of the install docs. Quote "Any fool can know. The point is to understand." -- Albert Einstein Link to comment Share on other sites More sharing options...
Jazzer Posted August 24, 2004 Share Posted August 24, 2004 (edited) Well, I've backed up the files, uninstalled paypal, made the three table alterations and squirted up the .sql database. I then followed step 2 & 3, copying and editing the various php files. Am I missing something? Really need help on this one. Edited August 24, 2004 by Jazzer Quote Link to comment Share on other sites More sharing options...
Guest Posted August 24, 2004 Share Posted August 24, 2004 I have read through a considerable amount of this thread and all I have seen regarding this problem is someone having te same issue but no reply, so if it is answered before excuse my question. I have installed this contrib a couple of times and verified the install everything works during checkout and I receive orders, but in admin when I try and get order details I get this error: Fatal error: Cannot instantiate non-existent class: paypal_ipn on: /includes/modules/payment/paypal/admin_orders.php on line 20 Help on this would be appreciated, thx in advance.... Quote Link to comment Share on other sites More sharing options...
devosc Posted August 24, 2004 Author Share Posted August 24, 2004 Andy, can you print the error here... Elwyn, have a look in the install docs for the edits in admin/orders.php they should now referer to paypal.php or something, older versions were paypal_ipn. Quote "Any fool can know. The point is to understand." -- Albert Einstein Link to comment Share on other sites More sharing options...
Idult Posted August 24, 2004 Share Posted August 24, 2004 Hey Greg, Some of my orders are showing up but the money does not appear in my paypal account. Any ideas? And even if the order goes through okay when i look at my paypal order invoice all the information come up blank like ie: Customer: Business Name E-Mail Address: Payer ID Payer Status Address Payment Type No Of Cart Items Transaction ID Invoice MC Currency MC Gross MC Fee Settle Amount Settle Currency Exchange Rate On top of this i have installed this module on another site and i noticed under customer there is a tab called PayPal IPN but for my current site its not there ?? odd Quote Link to comment Share on other sites More sharing options...
Jazzer Posted August 24, 2004 Share Posted August 24, 2004 1146 - Table 'paranoia_osc1.paypal_payment_status' doesn't exist select payment_status_name as payment_status from paypal_payment_status [TEP STOP] That's one of many, Greg. I know, it says there's no table but since I made those alterations and executed that sql file, I'm at a bit of loss as to why. Quote Link to comment Share on other sites More sharing options...
devosc Posted August 24, 2004 Author Share Posted August 24, 2004 Young, try out the IPN Test Panel via osC->Admin->Modules->Payment->PayPal. Really you should not be receiving IPNs if you're not getting any official PayPal payment receipt emails, this would be cause for concern. Anway try out the IPN Test Panel and once you start seeing info appearing take things from there. Andy, from your above post, when using phpMyAdmin make sure that it says something like 'running osc1' because it would seem that the alterations and execution of the sql script occured on a different database. Also try out the IPN Test Panel, this may lead to better determination of the problem, for example your admin maybe configured to use the wrong database. Quote "Any fool can know. The point is to understand." -- Albert Einstein Link to comment Share on other sites More sharing options...
Guest Posted August 25, 2004 Share Posted August 25, 2004 Elwyn, have a look in the install docs for the edits in admin/orders.php they should now referer to paypal.php or something, older versions were paypal_ipn. Hi thx for the reply here is the bit which has the code you mention in the orders.php file: //begin PayPal_Shopping_Cart_IPN if (strtolower($oInfo->payment_method) == 'paypal') { include_once(DIR_FS_CATALOG_MODULES . 'payment/paypal/database_tables.inc.php'); $paypal_payment_status_query = tep_db_query("select p.payment_status from " . TABLE_PAYPAL . " p left join " . TABLE_ORDERS . " o on p.paypal_ipn_id = o.paypal_ipn_id where o.orders_id ='" . $oInfo->orders_id . "'"); $paypal_payment_status = tep_db_fetch_array($paypal_payment_status_query); //quick work around for unkown order status id $paypal_payment_status_value = (tep_not_null($paypal_payment_status['payment_status'])) ? $paypal_payment_status['payment_status'] : $oInfo->orders_status_name ; $contents[] = array('text' => TABLE_HEADING_PAYMENT_STATUS . ': ' . $paypal_payment_status_value ); } //end PayPal_shopping_Cart_IPN This is straight from the docs in the PayPal_Shopping_Cart_IPN_v2.6a package and this is what I have installed in the site, do I need to change these further, or are the docs wrong? Thx in advance. Quote Link to comment Share on other sites More sharing options...
Guest Posted August 25, 2004 Share Posted August 25, 2004 I need help desperately! I've installed and removed this contribution at least 4 times (it's removed at the moment). I think it would be a great addition for me (and some folks who want me to set up shopping carts for them), so I'd really appreciate some help. 1) I've seen \catalog\includes\modules\payment\paypal\checkout_process.php mentioned in various posts to this forum, but I'm not finding it anywhere. There are checkout_process.php files present but not under the directories listed above. Should there be? It's not in the contribution installation. 2) I also didn't have admin/includes/filenames.php but I copied that from the contribution download. 3) In the installation instructions it says admin/includes/functions/general.php Find (line 919 in function tep_remove_order($order_id, $restock = false) ): tep_db_query("delete from " . TABLE_ORDERS . " where orders_id = '" . (int)$order_id . "'"); I don't have any such line in my admin/includes/functions/general.php. The closest I come is tep_db_query("delete from " . TABLE_ORDERS . " where orders_id = '" . tep_db_input($order_id) . "'"); 4) When I do have it installed, I get header errors like crazy. First I got: Warning: Cannot modify header information - headers already sent by (output started at /home/xxx/xxxx/osCommerce/admin/includes/languages/english.php:284) in /home/xxx/xxxx/osCommerce/admin/includes/functions/general.php on line 18 I seemingly got that fixed, but then I started to get Warning: Cannot modify header information - headers already sent by (output started at /home/xxx/xxxx/osCommerce/ncludes/application_top.php:471) in /home/xxx/xxxx/osCommerce/admin/includes/functions/general.php on line 23 I get/got these errors when running the OSC admin. I'm running osCommerce 2.2MS and php 4.3.8. I also have the CCGV installed, but that doesn't seem to be giving me any problems. Sorry for the really long post, but if anyone can help, I'd really appreciate it. Mary Ellen, the confused :blink: Quote Link to comment Share on other sites More sharing options...
Guest Posted August 25, 2004 Share Posted August 25, 2004 #1. did you find reference to \catalog\includes\modules\payment\paypal\checkout_process.php in the directions for installing ipn? #2. what version of osCommerce are you using that doesnt have admin/includes/filenames.php? without that, the whole admin section would not operate. #3. I did a search iin the code from a file which has not been touched (just unzipped) and found this on line 919: tep_db_query("delete from " . TABLE_ORDERS . " where orders_id = '" . (int)$order_id . "'"); #4. you probably modified the file and then left 'white space' at the top or the bottom of the file. this is answered in the knowledge base, search for 'headers already sent' for more detail. #5. see #4, you modified application_top and left some space. the best way i have found to install contributions, is to use code compare software, which finds the code very easily and you can see what it looks like versus what is different in the other file. Quote Link to comment Share on other sites More sharing options...
Guest Posted August 25, 2004 Share Posted August 25, 2004 contribution. It doesn't reference \catalog\includes\modules\payment\paypal\checkout_process.php #2. This is a clean install of osCommerce 2.2MS. I can start from scratch if necessary, but I'd really rather not. The admin/includes I backed up before intalling this contribution contains: File folders : boxes, classes, CVS, functions, graphs, javascript, languages, local and modules Files : add_ccgvdc_application_top.php, application_bottom.php, application_top.php, column_left.php, configure.php, footer.php, general (javascript), header.php and stylesheet #3. This is the untouched admin/includes/functions/general.php I backed up. <?php/* $Id: general.php,v 1.148 2002/11/25 10:41:34 dgw_ Exp $ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright © 2002 osCommerce Released under the GNU General Public License */ //// // Redirect to another page or site function tep_redirect($url) { global $logger; header('Location: ' . $url); if (STORE_PAGE_PARSE_TIME == 'true') { if (!is_object($logger)) $logger = new logger; $logger->timer_stop(); } exit; } function tep_customers_name($customers_id) { $customers = tep_db_query("select customers_firstname, customers_lastname from " . TABLE_CUSTOMERS . " where customers_id = '" . $customers_id . "'"); $customers_values = tep_db_fetch_array($customers); return $customers_values['customers_firstname'] . ' ' . $customers_values['customers_lastname']; } function tep_get_path($current_category_id = '') { global $cPath_array; if ($current_category_id == '') { $cPath_new = implode('_', $cPath_array); } else { if (sizeof($cPath_array) == 0) { $cPath_new = $current_category_id; } else { $cPath_new = ''; $last_category_query = tep_db_query("select parent_id from " . TABLE_CATEGORIES . " where categories_id = '" . $cPath_array[(sizeof($cPath_array)-1)] . "'"); $last_category = tep_db_fetch_array($last_category_query); $current_category_query = tep_db_query("select parent_id from " . TABLE_CATEGORIES . " where categories_id = '" . $current_category_id . "'"); $current_category = tep_db_fetch_array($current_category_query); if ($last_category['parent_id'] == $current_category['parent_id']) { for ($i = 0, $n = sizeof($cPath_array) - 1; $i < $n; $i++) { $cPath_new .= '_' . $cPath_array[$i]; } } else { for ($i = 0, $n = sizeof($cPath_array); $i < $n; $i++) { $cPath_new .= '_' . $cPath_array[$i]; } } $cPath_new .= '_' . $current_category_id; if (substr($cPath_new, 0, 1) == '_') { $cPath_new = substr($cPath_new, 1); } } } return 'cPath=' . $cPath_new; } function tep_get_all_get_params($exclude_array = '') { global $HTTP_GET_VARS; if ($exclude_array == '') $exclude_array = array(); $get_url = ''; reset($HTTP_GET_VARS); while (list($key, $value) = each($HTTP_GET_VARS)) { if (($key != tep_session_name()) && ($key != 'error') && (!tep_in_array($key, $exclude_array))) $get_url .= $key . '=' . $value . '&'; } return $get_url; } function tep_date_long($raw_date) { if ( ($raw_date == '0000-00-00 00:00:00') || ($raw_date == '') ) return false; $year = (int)substr($raw_date, 0, 4); $month = (int)substr($raw_date, 5, 2); $day = (int)substr($raw_date, 8, 2); $hour = (int)substr($raw_date, 11, 2); $minute = (int)substr($raw_date, 14, 2); $second = (int)substr($raw_date, 17, 2); return strftime(DATE_FORMAT_LONG, mktime($hour, $minute, $second, $month, $day, $year)); } //// // Output a raw date string in the selected locale date format // $raw_date needs to be in this format: YYYY-MM-DD HH:MM:SS // NOTE: Includes a workaround for dates before 01/01/1970 that fail on windows servers function tep_date_short($raw_date) { if ( ($raw_date == '0000-00-00 00:00:00') || ($raw_date == '') ) return false; $year = substr($raw_date, 0, 4); $month = (int)substr($raw_date, 5, 2); $day = (int)substr($raw_date, 8, 2); $hour = (int)substr($raw_date, 11, 2); $minute = (int)substr($raw_date, 14, 2); $second = (int)substr($raw_date, 17, 2); if (@date('Y', mktime($hour, $minute, $second, $month, $day, $year)) == $year) { return date(DATE_FORMAT, mktime($hour, $minute, $second, $month, $day, $year)); } else { return ereg_replace('2037' . '$', $year, date(DATE_FORMAT, mktime($hour, $minute, $second, $month, $day, 2037))); } } function tep_datetime_short($raw_datetime) { if ( ($raw_datetime == '0000-00-00 00:00:00') || ($raw_datetime == '') ) return false; $year = (int)substr($raw_datetime, 0, 4); $month = (int)substr($raw_datetime, 5, 2); $day = (int)substr($raw_datetime, 8, 2); $hour = (int)substr($raw_datetime, 11, 2); $minute = (int)substr($raw_datetime, 14, 2); $second = (int)substr($raw_datetime, 17, 2); return strftime(DATE_TIME_FORMAT, mktime($hour, $minute, $second, $month, $day, $year)); } function tep_array_merge($array1, $array2, $array3 = '') { if ($array3 == '') $array3 = array(); if (function_exists('array_merge')) { $array_merged = array_merge($array1, $array2, $array3); } else { while (list($key, $val) = each($array1)) $array_merged[$key] = $val; while (list($key, $val) = each($array2)) $array_merged[$key] = $val; if (sizeof($array3) > 0) while (list($key, $val) = each($array3)) $array_merged[$key] = $val; } return (array) $array_merged; } function tep_in_array($lookup_value, $lookup_array) { if (function_exists('in_array')) { if (in_array($lookup_value, $lookup_array)) return true; } else { reset($lookup_array); while (list($key, $value) = each($lookup_array)) { if ($value == $lookup_value) return true; } } return false; } function tep_get_category_tree($parent_id = '0', $spacing = '', $exclude = '', $category_tree_array = '', $include_itself = false) { global $languages_id; if (!is_array($category_tree_array)) $category_tree_array = array(); if ( (sizeof($category_tree_array) < 1) && ($exclude != '0') ) $category_tree_array[] = array('id' => '0', 'text' => TEXT_TOP); if ($include_itself) { $category_query = tep_db_query("select cd.categories_name from " . TABLE_CATEGORIES_DESCRIPTION . " cd where cd.language_id = '" . $languages_id . "' and cd.categories_id = '" . $parent_id . "'"); $category = tep_db_fetch_array($category_query); $category_tree_array[] = array('id' => $parent_id, 'text' => $category['categories_name']); } $categories_query = tep_db_query("select c.categories_id, cd.categories_name, c.parent_id from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.categories_id = cd.categories_id and cd.language_id = '" . $languages_id . "' and c.parent_id = '" . $parent_id . "' order by c.sort_order, cd.categories_name"); while ($categories = tep_db_fetch_array($categories_query)) { if ($exclude != $categories['categories_id']) $category_tree_array[] = array('id' => $categories['categories_id'], 'text' => $spacing . $categories['categories_name']); $category_tree_array = tep_get_category_tree($categories['categories_id'], $spacing . ' ', $exclude, $category_tree_array); } return $category_tree_array; } function tep_draw_products_pull_down($name, $parameters = '', $exclude = '') { global $currencies, $languages_id; if ($exclude == '') { $exclude = array(); } $select_string = '<select name="' . $name . '"'; if ($parameters) { $select_string .= ' ' . $parameters; } $select_string .= '>'; $products_query = tep_db_query("select p.products_id, pd.products_name, p.products_price from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_id = pd.products_id and pd.language_id = '" . $languages_id . "' order by products_name"); while ($products = tep_db_fetch_array($products_query)) { if (!tep_in_array($products['products_id'], $exclude)) { $select_string .= '<option value="' . $products['products_id'] . '">' . $products['products_name'] . ' (' . $currencies->format($products['products_price']) . ')</option>'; } } $select_string .= '</select>'; return $select_string; } function tep_options_name($options_id) { global $languages_id; $options = tep_db_query("select products_options_name from " . TABLE_PRODUCTS_OPTIONS . " where products_options_id = '" . $options_id . "' and language_id = '" . $languages_id . "'"); $options_values = tep_db_fetch_array($options); return $options_values['products_options_name']; } function tep_values_name($values_id) { global $languages_id; $values = tep_db_query("select products_options_values_name from " . TABLE_PRODUCTS_OPTIONS_VALUES . " where products_options_values_id = '" . $values_id . "' and language_id = '" . $languages_id . "'"); $values_values = tep_db_fetch_array($values); return $values_values['products_options_values_name']; } function tep_info_image($image, $alt, $width = '', $height = '') { if ( ($image) && (file_exists(DIR_FS_CATALOG_IMAGES . $image)) ) { $image = tep_image(DIR_WS_CATALOG_IMAGES . $image, $alt, $width, $height); } else { $image = TEXT_IMAGE_NONEXISTENT; } return $image; } function tep_break_string($string, $len, $break_char = '-') { $l = 0; $output = ''; for ($i = 0; $i < strlen($string); $i++) { $char = substr($string, $i, 1); if ($char != ' ') { $l++; } else { $l = 0; } if ($l > $len) { $l = 1; $output .= $break_char; } $output .= $char; } return $output; } function tep_get_country_name($country_id) { $country_query = tep_db_query("select countries_name from " . TABLE_COUNTRIES . " where countries_id = '" . $country_id . "'"); if (!tep_db_num_rows($country_query)) { return $country_id; } else { $country = tep_db_fetch_array($country_query); return $country['countries_name']; } } function tep_get_zone_name($zone_id) { $zone_query = tep_db_query("select zone_name from " . TABLE_ZONES . " where zone_id = '" . $zone_id . "'"); if (!tep_db_num_rows($zone_query)) { return $zone_id; } else { $zone = tep_db_fetch_array($zone_query); return $zone['zone_name']; } } function tep_not_null($value) { if (is_array($value)) { if (sizeof($value) > 0) { return true; } else { return false; } } else { if (($value != '') && ($value != 'NULL') && (strlen(trim($value)) > 0)) { return true; } else { return false; } } } function tep_browser_detect($component) { global $HTTP_USER_AGENT; return stristr($HTTP_USER_AGENT, $component); } function tep_tax_classes_pull_down($parameters, $selected = '') { $select_string = '<select ' . $parameters . '>'; $classes_query = tep_db_query("select tax_class_id, tax_class_title from " . TABLE_TAX_CLASS . " order by tax_class_title"); while ($classes = tep_db_fetch_array($classes_query)) { $select_string .= '<option value="' . $classes['tax_class_id'] . '"'; if ($selected == $classes['tax_class_id']) $select_string .= ' SELECTED'; $select_string .= '>' . $classes['tax_class_title'] . '</option>'; } $select_string .= '</select>'; return $select_string; } function tep_geo_zones_pull_down($parameters, $selected = '') { $select_string = '<select ' . $parameters . '>'; $zones_query = tep_db_query("select geo_zone_id, geo_zone_name from " . TABLE_GEO_ZONES . " order by geo_zone_name"); while ($zones = tep_db_fetch_array($zones_query)) { $select_string .= '<option value="' . $zones['geo_zone_id'] . '"'; if ($selected == $zones['geo_zone_id']) $select_string .= ' SELECTED'; $select_string .= '>' . $zones['geo_zone_name'] . '</option>'; } $select_string .= '</select>'; return $select_string; } function tep_get_geo_zone_name($geo_zone_id) { $zones_query = tep_db_query("select geo_zone_name from " . TABLE_GEO_ZONES . " where geo_zone_id = '" . $geo_zone_id . "'"); if (!tep_db_num_rows($zones_query)) { $geo_zone_name = $geo_zone_id; } else { $zones = tep_db_fetch_array($zones_query); $geo_zone_name = $zones['geo_zone_name']; } return $geo_zone_name; } ////////////////////////////////////////////////////////////////////////////////////////// // // Function : tep_format_address // // Arguments : customers_id, address_id, html // // Return : properly formatted address // // Description : This function will lookup the Addres format from the countries database // and properly format the address label. // ////////////////////////////////////////////////////////////////////////////////////////// function tep_address_format($address_format_id, $address, $html, $boln, $eoln) { $address_format_query = tep_db_query("select address_format as format from " . TABLE_ADDRESS_FORMAT . " where address_format_id = '" . $address_format_id . "'"); $address_format = tep_db_fetch_array($address_format_query); $company = addslashes($address['company']); $firstname = addslashes($address['firstname']); $lastname = addslashes($address['lastname']); $street = addslashes($address['street_address']); $suburb = addslashes($address['suburb']); $city = addslashes($address['city']); $state = addslashes($address['state']); $country_id = $address['country_id']; $zone_id = $address['zone_id']; $postcode = addslashes($address['postcode']); $zip = $postcode; $country = tep_get_country_name($country_id); $state = tep_get_zone_code($country_id, $zone_id, $state); if ($html) { // HTML Mode $HR = '<hr>'; $hr = '<hr>'; if ( ($boln == '') && ($eoln == "\n") ) { // Values not specified, use rational defaults $CR = '<br>'; $cr = '<br>'; $eoln = $cr; } else { // Use values supplied $CR = $eoln . $boln; $cr = $CR; } } else { // Text Mode $CR = $eoln; $cr = $CR; $HR = '----------------------------------------'; $hr = '----------------------------------------'; } $statecomma = ''; $streets = $street; if ($suburb != '') $streets = $street . $cr . $suburb; if ($firstname == '') $firstname = addslashes($address['name']); if ($country == '') $country = addslashes($address['country']); if ($state != '') $statecomma = $state . ', '; $fmt = $address_format['format']; eval("\$address = \"$fmt\";"); $address = stripslashes($address); if ( (ACCOUNT_COMPANY == 'true') && (tep_not_null($company)) ) { $address = $company . $cr . $address; } return $boln . $address . $eoln; } //////////////////////////////////////////////////////////////////////////////////////////////// // // Function : tep_get_zone_code // // Arguments : country country code string // zone state/province zone_id // def_state default string if zone==0 // // Return : state_prov_code state/province code // // Description : Function to retrieve the state/province code (as in FL for Florida etc) // //////////////////////////////////////////////////////////////////////////////////////////////// function tep_get_zone_code($country, $zone, $def_state) { $state_prov_query = tep_db_query("select zone_code from " . TABLE_ZONES . " where zone_country_id = '" . $country . "' and zone_id = '" . $zone . "'"); if (!tep_db_num_rows($state_prov_query)) { $state_prov_code = $def_state; } else { $state_prov_values = tep_db_fetch_array($state_prov_query); $state_prov_code = $state_prov_values['zone_code']; } return $state_prov_code; } function tep_get_uprid($prid, $params) { $uprid = $prid; if ( (is_array($params)) && (!strstr($prid, '{')) ) { while (list($option, $value) = each($params)) { $uprid = $uprid . '{' . $option . '}' . $value; } } return $uprid; } function tep_get_prid($uprid) { $pieces = explode ('{', $uprid); return $pieces[0]; } function tep_get_languages() { $languages_query = tep_db_query("select languages_id, name, code, image, directory from " . TABLE_LANGUAGES . " order by sort_order"); while ($languages = tep_db_fetch_array($languages_query)) { $languages_array[] = array('id' => $languages['languages_id'], 'name' => $languages['name'], 'code' => $languages['code'], 'image' => $languages['image'], 'directory' => $languages['directory'] ); } return $languages_array; } function tep_get_category_name($category_id, $language_id) { $category_query = tep_db_query("select categories_name from " . TABLE_CATEGORIES_DESCRIPTION . " where categories_id = '" . $category_id . "' and language_id = '" . $language_id . "'"); $category = tep_db_fetch_array($category_query); return $category['categories_name']; } function tep_get_orders_status_name($orders_status_id, $language_id = '') { global $languages_id; if (!$language_id) $language_id = $languages_id; $orders_status_query = tep_db_query("select orders_status_name from " . TABLE_ORDERS_STATUS . " where orders_status_id = '" . $orders_status_id . "' and language_id = '" . $language_id . "'"); $orders_status = tep_db_fetch_array($orders_status_query); return $orders_status['orders_status_name']; } function tep_get_orders_status() { global $languages_id; $orders_status_array = array(); $orders_status_query = tep_db_query("select orders_status_id, orders_status_name from " . TABLE_ORDERS_STATUS . " where language_id = '" . $languages_id . "' order by orders_status_id"); while ($orders_status = tep_db_fetch_array($orders_status_query)) { $orders_status_array[] = array('id' => $orders_status['orders_status_id'], 'text' => $orders_status['orders_status_name'] ); } return $orders_status_array; } function tep_get_products_name($product_id, $language_id = 0) { global $languages_id; if ($language_id == 0) $language_id = $languages_id; $product_query = tep_db_query("select products_name from " . TABLE_PRODUCTS_DESCRIPTION . " where products_id = '" . $product_id . "' and language_id = '" . $language_id . "'"); $product = tep_db_fetch_array($product_query); return $product['products_name']; } function tep_get_products_description($product_id, $language_id) { $product_query = tep_db_query("select products_description from " . TABLE_PRODUCTS_DESCRIPTION . " where products_id = '" . $product_id . "' and language_id = '" . $language_id . "'"); $product = tep_db_fetch_array($product_query); return $product['products_description']; } function tep_get_products_url($product_id, $language_id) { $product_query = tep_db_query("select products_url from " . TABLE_PRODUCTS_DESCRIPTION . " where products_id = '" . $product_id . "' and language_id = '" . $language_id . "'"); $product = tep_db_fetch_array($product_query); return $product['products_url']; } //// // Return the manufacturers URL in the needed language // TABLES: manufacturers_info function tep_get_manufacturer_url($manufacturer_id, $language_id) { $manufacturer_query = tep_db_query("select manufacturers_url from " . TABLE_MANUFACTURERS_INFO . " where manufacturers_id = '" . $manufacturer_id . "' and languages_id = '" . $language_id . "'"); $manufacturer = tep_db_fetch_array($manufacturer_query); return $manufacturer['manufacturers_url']; } //// // Wrapper for class_exists() function // This function is not available in all PHP versions so we test it before using it. function tep_class_exists($class_name) { if (function_exists('class_exists')) { return class_exists($class_name); } else { return true; } } //// // Count how many products exist in a category // TABLES: products, products_to_categories, categories function tep_products_in_category_count($categories_id, $include_deactivated = false) { $products_count = 0; if ($include_deactivated) { $products_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_id = p2c.products_id and p2c.categories_id = '" . $categories_id . "'"); } else { $products_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_id = p2c.products_id and p.products_status = 1 and p2c.categories_id = '" . $categories_id . "'"); } $products = tep_db_fetch_array($products_query); $products_count += $products['total']; $childs_query = tep_db_query("select categories_id from " . TABLE_CATEGORIES . " where parent_id = '" . $categories_id . "'"); if (tep_db_num_rows($childs_query)) { while ($childs = tep_db_fetch_array($childs_query)) { $products_count += tep_products_in_category_count($childs['categories_id'], $include_deactivated); } } return $products_count; } //// // Count how many subcategories exist in a category // TABLES: categories function tep_childs_in_category_count($categories_id) { $categories_count = 0; $categories_query = tep_db_query("select categories_id from " . TABLE_CATEGORIES . " where parent_id = '" . $categories_id . "'"); while ($categories = tep_db_fetch_array($categories_query)) { $categories_count++; $categories_count += tep_childs_in_category_count($categories['categories_id']); } return $categories_count; } //// // Returns an array with countries // TABLES: countries function tep_get_countries($default = '') { $countries_array = array(); if ($default) { $countries_array[] = array('id' => '', 'text' => $default); } $countries_query = tep_db_query("select countries_id, countries_name from " . TABLE_COUNTRIES . " order by countries_name"); while ($countries = tep_db_fetch_array($countries_query)) { $countries_array[] = array('id' => $countries['countries_id'], 'text' => $countries['countries_name']); } return $countries_array; } //// // return an array with country zones function tep_get_country_zones($country_id) { $zones_array = array(); $zones_query = tep_db_query("select zone_id, zone_name from " . TABLE_ZONES . " where zone_country_id = '" . $country_id . "' order by zone_name"); while ($zones = tep_db_fetch_array($zones_query)) { $zones_array[] = array('id' => $zones['zone_id'], 'text' => $zones['zone_name']); } return $zones_array; } function tep_prepare_country_zones_pull_down($country_id = '') { // preset the width of the drop-down for Netscape $pre = ''; if ( (!tep_browser_detect('MSIE')) && (tep_browser_detect('Mozilla/4')) ) { for ($i=0; $i<45; $i++) $pre .= ' '; } $zones = tep_get_country_zones($country_id); if (sizeof($zones) > 0) { $zones_select = array(array('id' => '', 'text' => PLEASE_SELECT)); $zones = tep_array_merge($zones_select, $zones); } else { $zones = array(array('id' => '', 'text' => TYPE_BELOW)); // create dummy options for Netscape to preset the height of the drop-down if ( (!tep_browser_detect('MSIE')) && (tep_browser_detect('Mozilla/4')) ) { for ($i=0; $i<9; $i++) { $zones[] = array('id' => '', 'text' => $pre); } } } return $zones; } //// // Alias function for Store configuration values in the Administration Tool function tep_cfg_pull_down_country_list($country_id) { return tep_draw_pull_down_menu('configuration_value', tep_get_countries(), $country_id); } function tep_cfg_pull_down_zone_list($zone_id) { return tep_draw_pull_down_menu('configuration_value', tep_get_country_zones(STORE_COUNTRY), $zone_id); } function tep_cfg_pull_down_tax_classes($tax_class_id, $key = '') { $name = (($key) ? 'configuration[' . $key . ']' : 'configuration_value'); $tax_class_array = array(array('id' => '0', 'text' => TEXT_NONE)); $tax_class_query = tep_db_query("select tax_class_id, tax_class_title from " . TABLE_TAX_CLASS . " order by tax_class_title"); while ($tax_class = tep_db_fetch_array($tax_class_query)) { $tax_class_array[] = array('id' => $tax_class['tax_class_id'], 'text' => $tax_class['tax_class_title']); } return tep_draw_pull_down_menu($name, $tax_class_array, $tax_class_id); } //// // Function to read in text area in admin function tep_cfg_textarea($text) { return tep_draw_textarea_field('configuration_value', false, 35, 5, $text); } //// // Sets the status of a banner function tep_set_banner_status($banners_id, $status) { if ($status == '1') { return tep_db_query("update " . TABLE_BANNERS . " set status = '1', expires_impressions = NULL, expires_date = NULL, date_status_change = NULL where banners_id = '" . $banners_id . "'"); } elseif ($status == '0') { return tep_db_query("update " . TABLE_BANNERS . " set status = '0', date_status_change = now() where banners_id = '" . $banners_id . "'"); } else { return -1; } } //// // Sets the status of a product function tep_set_product_status($products_id, $status) { if ($status == '1') { return tep_db_query("update " . TABLE_PRODUCTS . " set products_status = '1', products_last_modified = now() where products_id = '" . $products_id . "'"); } elseif ($status == '0') { return tep_db_query("update " . TABLE_PRODUCTS . " set products_status = '0', products_last_modified = now() where products_id = '" . $products_id . "'"); } else { return -1; } } //// // Sets the status of a product on special function tep_set_specials_status($specials_id, $status) { if ($status == '1') { return tep_db_query("update " . TABLE_SPECIALS . " set status = '1', expires_date = NULL, date_status_change = NULL where specials_id = '" . $specials_id . "'"); } elseif ($status == '0') { return tep_db_query("update " . TABLE_SPECIALS . " set status = '0', date_status_change = now() where specials_id = '" . $specials_id . "'"); } else { return -1; } } //// // Sets timeout for the current script. // Cant be used in safe mode. function tep_set_time_limit($limit) { if (!get_cfg_var('safe_mode')) { set_time_limit($limit); } } //// // Alias function for Store configuration values in the Administration Tool function tep_cfg_select_option($select_array, $key_value, $key = '') { for ($i = 0, $n = sizeof($select_array); $i < $n; $i++) { $name = (($key) ? 'configuration[' . $key . ']' : 'configuration_value'); $string .= '<br><input type="radio" name="' . $name . '" value="' . $select_array[$i] . '"'; if ($key_value == $select_array[$i]) $string .= ' CHECKED'; $string .= '> ' . $select_array[$i]; } return $string; } //// // Alias function for module configuration keys function tep_mod_select_option($select_array, $key_name, $key_value) { reset($select_array); while (list($key, $value) = each($select_array)) { if (is_int($key)) $key = $value; $string .= '<br><input type="radio" name="configuration[' . $key_name . ']" value="' . $key . '"'; if ($key_value == $key) $string .= ' CHECKED'; $string .= '> ' . $value; } return $string; } //// // Retreive server information function tep_get_system_information() { global $HTTP_SERVER_VARS; $db_query = tep_db_query("select now() as datetime"); $db = tep_db_fetch_array($db_query); list($system, $host, $kernel) = preg_split('/[\s,]+/', @exec('uname -a'), 5); return array('date' => tep_datetime_short(date('Y-m-d H:i:s')), 'system' => $system, 'kernel' => $kernel, 'host' => $host, 'ip' => gethostbyname($host), 'uptime' => @exec('uptime'), 'http_server' => $HTTP_SERVER_VARS['SERVER_SOFTWARE'], 'php' => PHP_VERSION, 'zend' => (function_exists('zend_version') ? zend_version() : ''), 'db_server' => DB_SERVER, 'db_ip' => gethostbyname(DB_SERVER), 'db_version' => 'MySQL ' . (function_exists('mysql_get_server_info') ? mysql_get_server_info() : ''), 'db_date' => tep_datetime_short($db['datetime'])); } function tep_get_uploaded_file($filename) { if (isset($_FILES[$filename])) { $uploaded_file = array('name' => $_FILES[$filename]['name'], 'type' => $_FILES[$filename]['type'], 'size' => $_FILES[$filename]['size'], 'tmp_name' => $_FILES[$filename]['tmp_name']); } elseif (isset($GLOBALS['HTTP_POST_FILES'][$filename])) { global $HTTP_POST_FILES; $uploaded_file = array('name' => $HTTP_POST_FILES[$filename]['name'], 'type' => $HTTP_POST_FILES[$filename]['type'], 'size' => $HTTP_POST_FILES[$filename]['size'], 'tmp_name' => $HTTP_POST_FILES[$filename]['tmp_name']); } else { $uploaded_file = array('name' => $GLOBALS[$filename . '_name'], 'type' => $GLOBALS[$filename . '_type'], 'size' => $GLOBALS[$filename . '_size'], 'tmp_name' => $GLOBALS[$filename]); } return $uploaded_file; } // the $filename parameter is an array with the following elements: // name, type, size, tmp_name function tep_copy_uploaded_file($filename, $target) { if (substr($target, -1) != '/') $target .= '/'; $target .= $filename['name']; move_uploaded_file($filename['tmp_name'], $target); } // return a local directory path (without trailing slash) function tep_get_local_path($path) { if (substr($path, -1) == '/') $path = substr($path, 0, -1); return $path; } function tep_array_shift(&$array) { if (function_exists('array_shift')) { return array_shift($array); } else { $i = 0; $shifted_array = array(); reset($array); while (list($key, $value) = each($array)) { if ($i > 0) { $shifted_array[$key] = $value; } else { $return = $array[$key]; } $i++; } $array = $shifted_array; return $return; } } function tep_array_reverse($array) { if (function_exists('array_reverse')) { return array_reverse($array); } else { $reversed_array = array(); for ($i=sizeof($array)-1; $i>=0; $i--) { $reversed_array[] = $array[$i]; } return $reversed_array; } } function tep_generate_category_path($id, $from = 'category', $categories_array = '', $index = 0) { global $languages_id; if (!is_array($categories_array)) $categories_array = array(); if ($from == 'product') { $categories_query = tep_db_query("select categories_id from " . TABLE_PRODUCTS_TO_CATEGORIES . " where products_id = '" . $id . "'"); while ($categories = tep_db_fetch_array($categories_query)) { if ($categories['categories_id'] == '0') { $categories_array[$index][] = array('id' => '0', 'text' => TEXT_TOP); } else { $category_query = tep_db_query("select cd.categories_name, c.parent_id from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.categories_id = '" . $categories['categories_id'] . "' and c.categories_id = cd.categories_id and cd.language_id = '" . $languages_id . "'"); $category = tep_db_fetch_array($category_query); $categories_array[$index][] = array('id' => $categories['categories_id'], 'text' => $category['categories_name']); if ( (tep_not_null($category['parent_id'])) && ($category['parent_id'] != '0') ) $categories_array = tep_generate_category_path($category['parent_id'], 'category', $categories_array, $index); $categories_array[$index] = tep_array_reverse($categories_array[$index]); } $index++; } } elseif ($from == 'category') { $category_query = tep_db_query("select cd.categories_name, c.parent_id from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.categories_id = '" . $id . "' and c.categories_id = cd.categories_id and cd.language_id = '" . $languages_id . "'"); $category = tep_db_fetch_array($category_query); $categories_array[$index][] = array('id' => $id, 'text' => $category['categories_name']); if ( (tep_not_null($category['parent_id'])) && ($category['parent_id'] != '0') ) $categories_array = tep_generate_category_path($category['parent_id'], 'category', $categories_array, $index); } return $categories_array; } function tep_output_generated_category_path($id, $from = 'category') { $calculated_category_path_string = ''; $calculated_category_path = tep_generate_category_path($id, $from); for ($i = 0, $n = sizeof($calculated_category_path); $i < $n; $i++) { for ($j = 0, $k = sizeof($calculated_category_path[$i]); $j < $k; $j++) { $calculated_category_path_string .= $calculated_category_path[$i][$j]['text'] . ' > '; } $calculated_category_path_string = substr($calculated_category_path_string, 0, -16) . '<br>'; } $calculated_category_path_string = substr($calculated_category_path_string, 0, -4); if (strlen($calculated_category_path_string) < 1) $calculated_category_path_string = TEXT_TOP; return $calculated_category_path_string; } function tep_remove_category($category_id) { $category_image_query = tep_db_query("select categories_image from " . TABLE_CATEGORIES . " where categories_id = '" . tep_db_input($category_id) . "'"); $category_image = tep_db_fetch_array($category_image_query); $duplicate_image_query = tep_db_query("select count(*) as total from " . TABLE_CATEGORIES . " where categories_image = '" . tep_db_input($category_image['categories_image']) . "'"); $duplicate_image = tep_db_fetch_array($duplicate_image_query); if ($duplicate_image['total'] < 2) { if (file_exists(DIR_FS_CATALOG_IMAGES . $category_image['categories_image'])) { @unlink(DIR_FS_CATALOG_IMAGES . $category_image['categories_image']); } } tep_db_query("delete from " . TABLE_CATEGORIES . " where categories_id = '" . tep_db_input($category_id) . "'"); tep_db_query("delete from " . TABLE_CATEGORIES_DESCRIPTION . " where categories_id = '" . tep_db_input($category_id) . "'"); tep_db_query("delete from " . TABLE_PRODUCTS_TO_CATEGORIES . " where categories_id = '" . tep_db_input($category_id) . "'"); if (USE_CACHE == 'true') { tep_reset_cache_block('categories'); tep_reset_cache_block('also_purchased'); } } function tep_remove_product($product_id) { $product_image_query = tep_db_query("select products_image from " . TABLE_PRODUCTS . " where products_id = '" . tep_db_input($product_id) . "'"); $product_image = tep_db_fetch_array($product_image_query); $duplicate_image_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS . " where products_image = '" . tep_db_input($product_image['products_image']) . "'"); $duplicate_image = tep_db_fetch_array($duplicate_image_query); if ($duplicate_image['total'] < 2) { if (file_exists(DIR_FS_CATALOG_IMAGES . $product_image['products_image'])) { @unlink(DIR_FS_CATALOG_IMAGES . $product_image['products_image']); } } tep_db_query("delete from " . TABLE_SPECIALS . " where products_id = '" . tep_db_input($product_id) . "'"); tep_db_query("delete from " . TABLE_PRODUCTS . " where products_id = '" . tep_db_input($product_id) . "'"); tep_db_query("delete from " . TABLE_PRODUCTS_TO_CATEGORIES . " where products_id = '" . tep_db_input($product_id) . "'"); tep_db_query("delete from " . TABLE_PRODUCTS_DESCRIPTION . " where products_id = '" . tep_db_input($product_id) . "'"); tep_db_query("delete from " . TABLE_PRODUCTS_ATTRIBUTES . " where products_id = '" . tep_db_input($product_id) . "'"); tep_db_query("delete from " . TABLE_CUSTOMERS_BASKET . " where products_id = '" . tep_db_input($product_id) . "'"); tep_db_query("delete from " . TABLE_CUSTOMERS_BASKET_ATTRIBUTES . " where products_id = '" . tep_db_input($product_id) . "'"); $product_reviews_query = tep_db_query("select reviews_id from " . TABLE_REVIEWS . " where products_id = '" . tep_db_input($product_id) . "'"); while ($product_reviews = tep_db_fetch_array($product_reviews_query)) { tep_db_query("delete from " . TABLE_REVIEWS_DESCRIPTION . " where reviews_id = '" . $product_reviews['reviews_id'] . "'"); } tep_db_query("delete from " . TABLE_REVIEWS . " where products_id = '" . tep_db_input($product_id) . "'"); if (USE_CACHE == 'true') { tep_reset_cache_block('categories'); tep_reset_cache_block('also_purchased'); } } function tep_remove_order($order_id, $restock = false) { if ($restock == 'on') { $order_query = tep_db_query("select products_id, products_quantity from " . TABLE_ORDERS_PRODUCTS . " where orders_id = '" . tep_db_input($order_id) . "'"); while ($order = tep_db_fetch_array($order_query)) { tep_db_query("update " . TABLE_PRODUCTS . " set products_quantity = products_quantity + " . $order['products_quantity'] . ", products_ordered = products_ordered - " . $order['products_quantity'] . " where products_id = '" . $order['products_id'] . "'"); } } tep_db_query("delete from " . TABLE_ORDERS . " where orders_id = '" . tep_db_input($order_id) . "'"); tep_db_query("delete from " . TABLE_ORDERS_PRODUCTS . " where orders_id = '" . tep_db_input($order_id) . "'"); tep_db_query("delete from " . TABLE_ORDERS_PRODUCTS_ATTRIBUTES . " where orders_id = '" . tep_db_input($order_id) . "'"); tep_db_query("delete from " . TABLE_ORDERS_STATUS_HISTORY . " where orders_id = '" . tep_db_input($order_id) . "'"); tep_db_query("delete from " . TABLE_ORDERS_TOTAL . " where orders_id = '" . tep_db_input($order_id) . "'"); } function tep_reset_cache_block($cache_block) { global $cache_blocks; for ($i = 0, $n = sizeof($cache_blocks); $i < $n; $i++) { if ($cache_blocks[$i]['code'] == $cache_block) { if ($cache_blocks[$i]['multiple']) { if ($dir = @opendir(DIR_FS_CACHE)) { while ($cache_file = readdir($dir)) { $cached_file = $cache_blocks[$i]['file']; $languages = tep_get_languages(); for ($j = 0, $k = sizeof($languages); $j < $k; $j++) { $cached_file_unlink = ereg_replace('-language', '-' . $languages[$j]['directory'], $cached_file); if (ereg('^' . $cached_file_unlink, $cache_file)) { @unlink(DIR_FS_CACHE . $cache_file); } } } closedir($dir); } } else { $cached_file = $cache_blocks[$i]['file']; $languages = tep_get_languages(); for ($i = 0, $n = sizeof($languages); $i < $n; $i++) { $cached_file = ereg_replace('-language', '-' . $languages[$i]['directory'], $cached_file); @unlink(DIR_FS_CACHE . $cached_file); } } break; } } } function tep_get_file_permissions($mode) { // determine type if Quote Link to comment Share on other sites More sharing options...
devosc Posted August 25, 2004 Author Share Posted August 25, 2004 Hi Mary, No you're not using MS2-2.2, first, the cvs file revision history does not match what is in MS2-2.2, second, the stable MS2-2.2 does not contain any CVS directories. This could you set back a bit, especially in regard to other contributions and or a working site. I would suggest that you install a fresh copy, download it from here, and then copy over the files from the misc/catalog directory, where the edits have already been done for all files. You would then just need to perform the mysql alterations and execute the sql script file, and then enable paypal via the admin. the purpose of the paypal directory is to consolidate the contrib integration as much as possible which also gives less interuptable freedom for internal changes of the contrib to occur without having to edit files uneccesarily when upgrading, these changes can therefore occur without justification, although they do try to be intuitive like moving checkout_process.php into paypal/catalog since it is only related (used) by the catalog side of the application during the checkout process. Elwyn That bit of script you posted doesn't utilize any paypal class methods, the bits that include methods that do occur further up in the page, have a look/search for ENTRY_PAYMENT_METHOD. Quote "Any fool can know. The point is to understand." -- Albert Einstein Link to comment Share on other sites More sharing options...
Guest Posted August 25, 2004 Share Posted August 25, 2004 Hi Mary, No you're not using MS2-2.2, first, the cvs file revision history does not match what is in MS2-2.2, second, the stable MS2-2.2 does not contain any CVS directories. This could you set back a bit, especially in regard to other contributions and or a working site. I would suggest that you install a fresh copy, download it from here, and then copy over the files from the misc/catalog directory, where the edits have already been done for all files. You would then just need to perform the mysql alterations and execute the sql script file, and then enable paypal via the admin. the purpose of the paypal directory is to consolidate the contrib integration as much as possible which also gives less interuptable freedom for internal changes of the contrib to occur without having to edit files uneccesarily when upgrading, these changes can therefore occur without justification, although they do try to be intuitive like moving checkout_process.php into paypal/catalog since it is only related (used) by the catalog side of the application during the checkout process. Hi Greg, Thanks for the info. I got this copy of osCommerce from my webmaster control panel. I'll have to let the hosting service know it's not the latest. I'll try your suggestion and see if that clears up my "problems". I figured if I overloaded everyone with details, someone would spot the problem. ;) Now I just have to remember all the other stuff I changed/added. It really isn't very much since I'm just playing with this at the moment. I picked the least complicated site to try OSC out on. Thanks again! B) Mary Ellen Quote Link to comment Share on other sites More sharing options...
Druide Posted August 25, 2004 Share Posted August 25, 2004 Hi Mary, No you're not using MS2-2.2, first, the cvs file revision history does not match what is in MS2-2.2, second, the stable MS2-2.2 does not contain any CVS directories. This could you set back a bit, especially in regard to other contributions and or a working site. I would suggest that you install a fresh copy, download it from here, and then copy over the files from the misc/catalog directory, where the edits have already been done for all files. You would then just need to perform the mysql alterations and execute the sql script file, and then enable paypal via the admin. the purpose of the paypal directory is to consolidate the contrib integration as much as possible which also gives less interuptable freedom for internal changes of the contrib to occur without having to edit files uneccesarily when upgrading, these changes can therefore occur without justification, although they do try to be intuitive like moving checkout_process.php into paypal/catalog since it is only related (used) by the catalog side of the application during the checkout process. Hi Greg, Thanks for the info. I got this copy of osCommerce from my webmaster control panel. I'll have to let the hosting service know it's not the latest. I'll try your suggestion and see if that clears up my "problems". I figured if I overloaded everyone with details, someone would spot the problem. ;) Now I just have to remember all the other stuff I changed/added. It really isn't very much since I'm just playing with this at the moment. I picked the least complicated site to try OSC out on. Thanks again! B) Mary Ellen if your host is THAT slow with updating i would suggest to get ASAP a new host. better check your php & mysql version too there....LOL Quote Robert We all need to learn it once, how hard it may seem when you look at it, also you will master it someday ;) Link to comment Share on other sites More sharing options...
SuperCrank Posted August 25, 2004 Share Posted August 25, 2004 this contribution is not passing size values? for instance I just got an order after install paypal ipn 2.6a and it looks like this: 1 x widget - : the "- :" should be something like this "- Size: Large" so if anyone has a fix for this, it would be much appreciated. tia. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.