Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

How to extract tables from MYSQL_CATALOG.SQL


Down4U

Recommended Posts

Posted

Can't seem to figure out how to extract the tables from the sample .SQL file included in the install package.

 

I've already modified APPLICATION_TOP.PHP so that it knows what database to get to, and which host to connect to for it.

 

Help! Thanks in advance.

Posted

I figured out how to extract the tables from the SQL script. Windows requires the full path to the SQL script, as MySQL apparently doesn't know where to fetch it's script files from.

 

Now I'm having a totally different problem, likely having to do with the way I've defined variables.

 

Maybe you can make out something from the error I get here http://www.omarnyc.com/e-shop/catalog/default.php

Posted

Here's the PHP file I'm working with.

 

<?

if (file_exists('includes/local/configure.php')) {

include('includes/local/configure.php');

if ((!defined(CONFIGURE_STATUS_COMPLETED)) && (CONFIGURE_STATUS_COMPLETED != '1')) { // File not read properly

die('File configure.php was not found or was improperly formatted, contact webmaster of this domain.<br>The configuration file in catalog/includes/local/configure.php was not properly formatted.<br> <br>Please add the following to that file:<br> <br>define('CONFIGURE_STATUS_COMPLETED', '1');');

}

}

 

// for internal use until final v1.0 version is ready

define('PROJECT_VERSION', 'Preview Release 2.1');

 

// define our webserver variables

// FS = Filesystem (physical)

// WS = Webserver (virtual)

define('HTTP_SERVER', 'http://netgty-1');

define('HTTPS_SERVER', 'https://netgty-1');

define('ENABLE_SSL', 1); // ssl server enable(1)/disable(0)

define('DIR_FS_DOCUMENT_ROOT', $DOCUMENT_ROOT . 'd:/iis/publicweb/');

define('DIR_FS_LOGS', 'd:/iis/publicweb/e-shop/logs/');

define('DIR_WS_CATALOG', 'd:/iis/publicweb/e-shop/catalog/');

define('DIR_WS_IMAGES', 'd:/iis/publicweb/e-shop/catalog/images/');

define('DIR_WS_INCLUDES', 'includes/');

define('DIR_WS_BOXES', DIR_WS_INCLUDES . 'd:/iis/publicweb/e-shop/catalog/includes/boxes/');

define('DIR_WS_FUNCTIONS', DIR_WS_INCLUDES . 'd:/iis/publicweb/e-shop/catalog/includes/functions/');

define('DIR_WS_CLASSES', DIR_WS_INCLUDES . 'd:/iis/publicweb/e-shop/catalog/includes/classes/');

define('DIR_WS_MODULES', DIR_WS_INCLUDES . 'd:/iis/publicweb/e-shop/catalog/includes/modules/');

define('DIR_WS_PAYMENT_MODULES', DIR_WS_MODULES . 'd:/iis/publicweb/e-shop/catalog/includes/modules/payment/');

define('DIR_WS_LANGUAGES', DIR_WS_INCLUDES . 'd:/iis/publicweb/e-shop/catalog/includes/languages/');

 

// default values

define('DEFAULT_LANGUAGE', 'en'); // use the code

define('DEFAULT_CURRENCY', 'USD'); // use the code

 

// who to send order confirmation emails to.. there is always one being sent to the customer, so there

// is no need to add their address to the following constant..

// use comma's to separate email addresses (as in the example)

// define('SEND_EXTRA_ORDER_EMAILS_TO', 'root <root@localhost>, root <root@localhost>');

 

define('EXIT_AFTER_REDIRECT', 1); // if enabled, the parse time will not store its time after the header(location) redirect - used with tep_exit();

define('STORE_PAGE_PARSE_TIME', 0); // store the time it takes to parse a page

define('STORE_PAGE_PARSE_TIME_LOG', DIR_FS_LOGS . 'exchange/parse_time_log');

 

define('STORE_PARSE_DATE_TIME_FORMAT', '%d/%m/%Y %H:%M:%S');

if (STORE_PAGE_PARSE_TIME == '1') {

$parse_start_time = microtime();

}

define('STORE_DB_TRANSACTIONS', 0);

 

// enable this under PHP3

define('REPAIR_BROKEN_CART', 0);

 

// define the filenames used in the project

define('FILENAME_NEW_PRODUCTS', 'new_products.php'); // This is the middle of default.php (found in modules)

define('FILENAME_UPCOMING_PRODUCTS', 'upcoming_products.php'); // This is the bottom of default.php (found in modules)

define('FILENAME_ALSO_PURCHASED_PRODUCTS', 'also_purchased_products.php'); // This is the bottom of product_info.php (found in modules)

define('FILENAME_ACCOUNT', 'account.php');

define('FILENAME_ACCOUNT_EDIT', 'account_edit.php');

define('FILENAME_ACCOUNT_EDIT_PROCESS', 'account_edit_process.php');

define('FILENAME_ACCOUNT_HISTORY', 'account_history.php');

define('FILENAME_ACCOUNT_HISTORY_INFO', 'account_history_info.php');

define('FILENAME_ADDRESS_BOOK', 'address_book.php');

define('FILENAME_ADDRESS_BOOK_PROCESS', 'address_book_process.php');

define('FILENAME_ADVANCED_SEARCH', 'advanced_search.php');

define('FILENAME_ADVANCED_SEARCH_RESULT', 'advanced_search_result.php');

define('FILENAME_CHECKOUT_ADDRESS', 'checkout_address.php');

define('FILENAME_CHECKOUT_CONFIRMATION', 'checkout_confirmation.php');

define('FILENAME_CHECKOUT_PAYMENT', 'checkout_payment.php');

define('FILENAME_CHECKOUT_PROCESS', 'checkout_process.php');

define('FILENAME_CHECKOUT_SUCCESS', 'checkout_success.php');

define('FILENAME_CONTACT_US', 'contact_us.php');

define('FILENAME_CREATE_ACCOUNT', 'create_account.php');

define('FILENAME_CREATE_ACCOUNT_PROCESS', 'create_account_process.php');

define('FILENAME_CREATE_ACCOUNT_SUCCESS', 'create_account_success.php');

define('FILENAME_DEFAULT', 'default.php');

define('FILENAME_INFO_SHOPPING_CART', 'info_shopping_cart.php');

define('FILENAME_LOGIN', 'login.php');

define('FILENAME_LOGOFF', 'logoff.php');

define('FILENAME_PASSWORD_FORGOTTEN', 'password_forgotten.php');

define('FILENAME_PRODUCT_INFO', 'product_info.php');

define('FILENAME_PRODUCT_REVIEWS', 'product_reviews.php');

define('FILENAME_PRODUCT_REVIEWS_INFO', 'product_reviews_info.php');

define('FILENAME_PRODUCT_REVIEWS_WRITE', 'product_reviews_write.php');

define('FILENAME_REVIEWS', 'reviews.php');

define('FILENAME_SHOPPING_CART', 'shopping_cart.php');

define('FILENAME_SPECIALS', 'specials.php');

define('FILENAME_PASSWORD_CRYPT', 'password_funcs.php');

 

// define our database connection

define('DB_SERVER', 'netgty-1');

define('DB_SERVER_USERNAME', '');

define('DB_SERVER_PASSWORD', '');

define('DB_DATABASE', 'catalog');

define('USE_PCONNECT', 1);

 

// customization for the design layout

define('CART_DISPLAY', 1); // Enable to view the shopping cart after adding a product

define('TAX_VALUE', 16); // propducts tax

define('TAX_DECIMAL_PLACES', 0); // 16% - If this were 2 it would be 16.00%

define('BOX_WIDTH', 125); // how wide the boxes should be in pixels (default: 125)

 

define('HEADER_BACKGROUND_COLOR', '#AABBDD');

define('HEADER_NAVIGATION_BAR_BACKGROUND_COLOR', '#000000');

define('HEADER_NAVIGATION_BAR_BACKGROUND_ERROR_COLOR', '#FF0000');

define('HEADER_NAVIGATION_BAR_BACKGROUND_INFO_COLOR', '#00FF00');

define('HEADER_NAVIGATION_BAR_FONT_ERROR_COLOR', '#FFFFFF');

define('HEADER_NAVIGATION_BAR_FONT_INFO_COLOR', '#000000');

 

define('FOOTER_BAR_BACKGROUND_COLOR', '#000000');

 

define('BOX_HEADING_BACKGROUND_COLOR', '#AABBDD');

 

define('BOX_CONTENT_BACKGROUND_COLOR', '#FFFFFF');

define('BOX_CONTENT_HIGHLIGHT_COLOR', '#FFFF33'); // use in best_sellers.php

 

define('TOP_BAR_BACKGROUND_COLOR', '#AABBDD');

define('SUB_BAR_BACKGROUND_COLOR', '#f4f7fd');

define('TABLE_ROW_BACKGROUND_COLOR', '#ffffff');

define('TABLE_ALT_BACKGROUND_COLOR', '#f4f7fd');

 

define('SPECIALS_PRICE_COLOR', '#FF0000'); // font color for the new price of products on special

 

define('CHECKOUT_BAR_TEXT_COLOR', '#AABBDD');

define('CHECKOUT_BAR_TEXT_COLOR_HIGHLIGHTED', '#000000');

 

// set to "1" if extended email check function should be used

// If you're testing locally and your webserver has no possibility to query

// a dns server you should set this to "0" !

define('ENTRY_EMAIL_ADDRESS_CHECK', 0);

 

// Control what fields of the customer table are used

define('ACCOUNT_GENDER', 1);

define('ACCOUNT_DOB', 1);

define('ACCOUNT_SUBURB', 1);

define('ACCOUNT_STATE', 1);

 

// Advanced Search controls

define('ADVANCED_SEARCH_DEFAULT_OPERATOR', 'and'); // default boolean search operator: or/and

define('ADVANCED_SEARCH_DISPLAY_TIPS', 1); // Display Advanced Search Tips at the bottom of the page: 0=disable; 1=enable

 

// Bestsellers Min/Max Controls

define('MIN_DISPLAY_BESTSELLERS', 1); // Min no. of bestsellers to display

define('MAX_DISPLAY_BESTSELLERS', 10); // Max no. of bestsellers to display

 

// Min/Max Controls for also_purchased_products.php : 'Customers who bought this product also purchased' module

define('MIN_DISPLAY_ALSO_PURCHASED', 1); // Min no. of products in purchased list to qualify

define('MAX_DISPLAY_ALSO_PURCHASED', 5); // Max no. of products to display

 

// Prev/Next Navigation Bar location

define('PREV_NEXT_BAR_LOCATION', 2) ; // 1 - top, 2 - bottom, 3 - both

 

// Manufacturers box

define('DISPLAY_MANUFACTURERS_BOX', 1); // Manufacturers Box: 0=disable; 1=enable

define('DISPLAY_EMPTY_MANUFACTURERS', 1); // Display Manufacturers with no products: 0=disable; 1=enable

 

// Rollover Effect

define('USE_ROLLOVER_EFFECT', 1); // Rollover Effect: 0=disable; 1=enable

 

// Categories Box: recursive products count

define('SHOW_COUNTS', 1); // show category count: 0=disable; 1=enable

define('USE_RECURSIVE_COUNT', 1); // recursive count: 0=disable; 1=enable

 

// include the database functions

$include_file = DIR_WS_FUNCTIONS . 'database.php'; include(DIR_WS_INCLUDES . 'include_once.php');

 

// make a connection to the database... now

tep_db_connect() or die('Unable to connect to database server!');

 

// include shopping cart class

$include_file = DIR_WS_CLASSES . 'shopping_cart.php'; include(DIR_WS_INCLUDES . 'include_once.php');

 

// some code to solve compatibility issues

$include_file = DIR_WS_FUNCTIONS . 'compatibility.php'; include(DIR_WS_INCLUDES . 'include_once.php');

 

// check to see if php implemented session management functions - if not, include php3/php4 compatible session class

if (!function_exists('session_start')) {

$include_file = DIR_WS_CLASSES . 'sessions.php'; include(DIR_WS_INCLUDES . 'include_once.php');

}

 

// define how the session functions will be used

$include_file = DIR_WS_FUNCTIONS . 'sessions.php'; include(DIR_WS_INCLUDES . 'include_once.php');

 

// lets start our session

if (!SID && $HTTP_GET_VARS[tep_session_name()])

tep_session_id( $HTTP_GET_VARS[tep_session_name()] );

tep_session_start();

if (function_exists('session_set_cookie_params')) {

session_set_cookie_params(0, DIR_WS_CATALOG);

}

 

// Fix the cart if necesary

if (REPAIR_BROKEN_CART && is_object($cart) ) {

$broken_cart = $cart;

$cart = new shoppingCart;

$cart->unserialize($broken_cart);

} else {

if (!$cart) {

tep_session_register('cart');

$cart = new shoppingCart;

}

}

 

// set the application parameters (can be modified through the administration tool)

$configuration_query = tep_db_query('select configuration_key as cfgKey, configuration_value as cfgValue from configuration');

while ($configuration = tep_db_fetch_array($configuration_query)) {

define($configuration['cfgKey'], $configuration['cfgValue']);

}

 

// define our general functions used application-wide

$include_file = DIR_WS_FUNCTIONS . 'general.php'; include(DIR_WS_INCLUDES . 'include_once.php');

 

// language

if ( (!$language) || ($HTTP_GET_VARS['language']) ) {

if (!$language) tep_session_register('language');

 

$language = tep_get_languages_directory($HTTP_GET_VARS['language']);

if (!$language) $language = tep_get_languages_directory(DEFAULT_LANGUAGE);

}

 

// currency

if ( (!$currency) || ($HTTP_GET_VARS['currency']) ) {

if (!$currency) tep_session_register('currency');

 

$currency = tep_currency_exists($HTTP_GET_VARS['currency']);

if (!$currency) $currency = DEFAULT_CURRENCY;

}

 

// include the currency rates, and the language translations

$include_file = DIR_WS_INCLUDES . 'data/rates.php'; include(DIR_WS_INCLUDES . 'include_once.php');

$include_file = DIR_WS_LANGUAGES . $language . '.php'; include(DIR_WS_INCLUDES . 'include_once.php');

 

// Include the password crypto functions

$include_file = DIR_WS_FUNCTIONS . FILENAME_PASSWORD_CRYPT; include(DIR_WS_INCLUDES . 'include_once.php');

 

// Include validation functions (right now only email address)

$include_file = DIR_WS_FUNCTIONS . 'validations.php'; include(DIR_WS_INCLUDES . 'include_once.php');

 

// split-page-results

$include_file = DIR_WS_CLASSES . 'split_page_results.php'; include(DIR_WS_INCLUDES . 'include_once.php');

 

// infobox

$include_file = DIR_WS_CLASSES . 'boxes.php'; include(DIR_WS_INCLUDES . 'include_once.php');

 

// Shopping cart actions

if ($HTTP_GET_VARS['action']) {

$goto = (CART_DISPLAY) ? FILENAME_SHOPPING_CART : basename($PHP_SELF);

$parameters = (CART_DISPLAY) ? array('action', 'cPath', 'products_id') : array('action');

if ($HTTP_GET_VARS['action'] == 'remove_product') {

// customer wants to remove a product from their shopping cart

$cart->remove($HTTP_GET_VARS['products_id']);

header('Location: ' . tep_href_link($goto, tep_get_all_get_params($parameters), 'NONSSL'));

tep_exit();

} elseif ($HTTP_GET_VARS['action'] == 'add_update_product') {

// customer wants to update the product quantity in their shopping cart

if ((is_array($HTTP_POST_VARS['cart_quantity'])) && (is_array($HTTP_POST_VARS['products_id']))) {

for ($i=0; $i<sizeof($HTTP_POST_VARS['products_id']);$i++) {

$attributes = ($HTTP_POST_VARS['id'][$HTTP_POST_VARS['products_id'][$i]]) ? $HTTP_POST_VARS['id'][$HTTP_POST_VARS['products_id'][$i]] : '';

$cart->add_cart($HTTP_POST_VARS['products_id'][$i], $HTTP_POST_VARS['cart_quantity'][$i], $attributes);

}

} else {

if (ereg('^[0-9]+$', $HTTP_POST_VARS['products_id'])) {

$cart->add_cart($HTTP_POST_VARS['products_id'], $HTTP_POST_VARS['cart_quantity'], $HTTP_POST_VARS['id']);

}

}

header('Location: ' . tep_href_link($goto, tep_get_all_get_params($parameters), 'NONSSL'));

tep_exit();

} elseif ($HTTP_GET_VARS['action'] == 'remove_all') {

// customer wants to remove all products from their shopping cart

$cart->reset(TRUE);

header('Location: ' . tep_href_link($goto, '', 'NONSSL'));

tep_exit();

} elseif ($HTTP_GET_VARS['action'] == 'add_a_quickie') {

// customer wants to add a quickie to the cart (called from a box)

$quickie_query = tep_db_query("select products_id from products where products_model = '" . $HTTP_POST_VARS['quickie'] . "'");

if (tep_db_num_rows($quickie_query) == 0) {

$quickie_query = tep_db_query("select products_id from products where products_model LIKE '" . $HTTP_POST_VARS['quickie'] . "%'");

}

if (tep_db_num_rows($quickie_query) == 0 ||tep_db_num_rows($quickie_query) > 1) {

Header( 'Location: ' . tep_href_link(FILENAME_ADVANCED_SEARCH_RESULT, 'keywords=' . $HTTP_POST_VARS['quickie'], 'NONSSL'));

tep_exit();

}

$quickie_values = tep_db_fetch_array($quickie_query);

$cart->add_cart($quickie_values['products_id'], 1, '');

header('Location: ' . tep_href_link($goto, tep_get_all_get_params(array('action')), 'NONSSL'));

tep_exit();

}

}

 

// calculate category path

$cPath = $HTTP_GET_VARS['cPath'];

if (strlen($cPath) > 0) {

$cPath_array = explode('_', $cPath);

if (sizeof($cPath_array) > 1) {

$current_category_id = $cPath_array[(sizeof($cPath_array)-1)];

} else {

$current_category_id = $cPath_array[0];

}

} else {

$current_category_id = 0;

}

?>

Posted

Try changing

 

define('DIR_FS_DOCUMENT_ROOT', $DOCUMENT_ROOT);

 

to

 

define('DIR_FS_DOCUMENT_ROOT', 'D:IISPublicWebe-shop');

 

in includes/configure.php

Posted

Umm.. The Install file says to work with INCLUDES/APPLICATION_TOP.PHP, not INCLUDES/CONFIGURE.PHP. Your suggestion did get rid of the error when I applied it though.

Posted

It seems you are using version 2.1 Maybe you should look at 2.2, it's a lot cleaner

 

Cheers

 

Nick

Posted

That's your call - me I say 2.2 all the way

 

Should we take a vote - 2.1 or 2.2 people???

Posted

I'll do it. This is not a mission-critical project, so if it doesn't work fine, if it works great! :)

 

I'll download it now and see what happens. I'll keep you posted. :)

Posted

Ok. While at it, I almost felt the need to upgrade MySQL from 2.5 to 3.25.53. That's working peachy.

 

I downloaded the 2.2 binaries and now I'm stuck during the setup. Here's what I get.

 

New Install

 

Step 1: Database Import

 

A test connection made to the database was NOT successful.

 

The error message returned is:

 

Access denied for user: '[email protected]' (Using password: YES)

 

Please click on the Back graphic to review your database server settings.

 

If you require help with your database server settings, please consult your hosting company.

 

I configured MySQL with a username and password since OS Commerce doesn't seem to like blank username and passwords, yet I still get the same error.

 

What could it be?

Posted

Would that have something to do with the MY.INI file? Here's what it reads?

 

#This File was made using the WinMySQLAdmin 1.4 Tool

#12/9/2002 4:09:54 PM

 

#Uncomment or Add only the keys that you know how works.

#Read the MySQL Manual for instructions

 

[mysqld]

basedir=D:/Databases

#bind-address=10.14.12.2

datadir=D:/Databases/data

#language=D:/Databases/share/your language directory

#slow query log#=

#tmpdir#=

#port=3306

#set-variable=key_buffer=16M

[WinMySQLadmin]

Server=D:/Databases/bin/mysqld-nt.exe

user=Administrator

password=xxxx

Posted

Are you sure they both setup the same ie: omarnyc.com as opposed to localhost.

 

In the hosts table you need to have omarnyc.com listed as well as localhost.

 

If they are indeed the same, then I'm not too sure

Posted

I just found this out, very strange. It returns this when I only type in the password.

 

New Install

 

Step 1: Database Import

 

A test connection made to the database was NOT successful.

 

The error message returned is:

 

Access denied for user: '[email protected]' (Using password: YES)

 

Please click on the Back graphic to review your database server settings.

 

If you require help with your database server settings, please consult your hosting company.

 

Perhaps it wants an ODBC connection, as in MS SQL server instead of MySQL?

Posted

Well.. I'm still stumped.. OS Commerce is perhaps not meant for production yet, or there's still something I'm missing. It seems to me the product wants to connect to a MS ODBC server in particular.

Posted

Nick.. You are THE MAN!!!! Thanks for all your help, I finally figured it out. I did end up using 2.2.

 

The authentication problem with the database server somehow was settled when using 127.0.0.1 for the database server IP address. I guess it wanted the internal address if the database was running on the same box, go figure.

 

Internet Anonymous User also needs full rights to the e-shop directories in order for it to work, though I'm not very comfortable with leaving the rights that way. Maybe it needed full access to install the product, but not to operate?

 

The site is up and running here: http://omarnyc.com:82/e-shop/catalog/catal...log/default.php

 

Thanks again!

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...