Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Shopping Mall system


Aodhan

Recommended Posts

Agreed - Everything should be modular.

 

I have a demo system (non-osCommerce) that basically displays my SINGLE product inventory on 3 different shopfronts, while I have also added a 4th shopfront using a totally different inventory but within the same little group... and as you can imagine this is very complicated to admin!

 

What would be ideal is the ability to:

 

I spose this is just a big wish list...

 

Ok, here is what I have so far.

 

The only changes I have made to the OsC original tables is the addition of a store_id field to the products database. I can't see any way around this. I have added a table for store information, and a table for orders by store (For admin/store payment disbursement).

 

I currently set the name of a top level category to be a "store", thus creating a virtual store. When a product is added to that "store", the admin is asked to assign it to a store (same procedure as assigning a manufacturer.)

 

When a customer purchases a product, the purchase is recorded as normal, and also placed in the store_orders table. This has flags for whether or not the store has been paid for a certain time frame or not. (I plan to disburse payments either 4x or 2x per month to each store owner that I "rent" to).

 

The email portion (Still under construction, damnitall) will send a "total" email to the customer and the site owner, and an email to each store owner separately to show purchases from just their store. This makes for one payment on the customer side.

 

Right now I am working on the final admin parts (Showing total orders by store, according to date range, paid, owing, etc), and I will probably need some help when I get to email splitting since this has been confounding me for a couple weeks now. (I'm new to PHP in general).

 

As soon as I have the admin side finished, I will package it as nicely as I know how, and send it up for testing, harpooning, etc etc.

 

Aodhan

Link to comment
Share on other sites

  • Replies 106
  • Created
  • Last Reply
Aodhan, how goes this major project? Is there anyway I can help you out to get this completed faster?

 

Possibly. I am very close to having the email portion done, which means I can release it for preliminary testing, etc. Heres the problem I am having.

 

In checkout_process, I create an array to hold totals for different stores. There is a store ID that is carried into this page (Through the $orders->products array). What I want to do is create an array that uses the store_id as a reference for the array, i.e. $store_array['store_id']['somevalue']. That way I can reference each store separately.

 

Heres the code that I have for checkout_process, as well as the result of the two text output files that I create as a check. (Note: Even though the sent.txt shows a valid email address, it never arrived at the intended destination, although the normal customer invoice sent to the same email address does show up.)

 

<?php

/*

$Id: checkout_process.php,v 1.112 2002/08/19 11:06:01 hpdl Exp $

 

osCommerce, Open Source E-Commerce Solutions

http://www.oscommerce.com

 

Copyright © 2002 osCommerce

 

Released under the GNU General Public License

*/

 

include('includes/application_top.php');

 

// check for essential variables (payment module could lose them)

if (!tep_session_is_registered('customer_id')) {

$navigation->set_snapshot(array('mode' => 'SSL', 'page' => FILENAME_CHECKOUT_PAYMENT));

tep_redirect(tep_href_link(FILENAME_LOGIN, '', 'SSL'));

}

if (!tep_session_is_registered('sendto')) {

tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL'));

}

 

if ( (tep_not_null(MODULE_PAYMENT_INSTALLED)) && (!tep_session_is_registered('payment')) ) {

tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL'));

}

 

include(DIR_WS_LANGUAGES . $language . '/' . FILENAME_CHECKOUT_PROCESS);

 

// load payment modules as objects

require(DIR_WS_CLASSES . 'payment.php');

$payment_modules = new payment;

 

// load the before_process function from the payment modules

$payment_modules->before_process();

 

require(DIR_WS_CLASSES . 'order.php');

require(DIR_WS_CLASSES . 'order_total.php');

$order = new order;

$order_total_modules = new order_total;

 

//------------Create the store holding array-----------------

 

$store_totals = array();

$store_totals[] = array(store_products => '',

store_id => 0,

store_weight => 0,

store_tax => 0,

store_cost => 0);

 

$order_totals = $order_total_modules->process();

 

$sql_data_array = array('customers_id' => $customer_id,

'customers_name' => $order->customer['firstname'] . ' ' . $order->customer['lastname'],

'customers_street_address' => $order->customer['street_address'],

'customers_suburb' => $order->customer['suburb'],

'customers_city' => $order->customer['city'],

'customers_postcode' => $order->customer['postcode'],

'customers_state' => $order->customer['state'],

'customers_country' => $order->customer['country']['title'],

'customers_telephone' => $order->customer['telephone'],

'customers_email_address' => $order->customer['email_address'],

'customers_address_format_id' => $order->customer['format_id'],

'delivery_name' => $order->delivery['firstname'] . ' ' . $order->delivery['lastname'],

'delivery_street_address' => $order->delivery['street_address'],

'delivery_suburb' => $order->delivery['suburb'],

'delivery_city' => $order->delivery['city'],

'delivery_postcode' => $order->delivery['postcode'],

'delivery_state' => $order->delivery['state'],

'delivery_country' => $order->delivery['country']['title'],

'delivery_address_format_id' => $order->delivery['format_id'],

'payment_method' => $order->info['payment_method'],

'cc_type' => $order->info['cc_type'],

'cc_owner' => $order->info['cc_owner'],

'cc_number' => $order->info['cc_number'],

'cc_expires' => $order->info['cc_expires'],

'date_purchased' => 'now()',

'orders_status' => DEFAULT_ORDERS_STATUS_ID,

'comments' => $order->info['comments'],

'currency' => $order->info['currency'],

'currency_value' => $order->info['currency_value']);

tep_db_perform(TABLE_ORDERS, $sql_data_array);

$insert_id = tep_db_insert_id();

for ($i=0; $i<sizeof($order_totals); $i++) {

$sql_data_array = array('orders_id' => $insert_id,

'title' => $order_totals[$i]['title'],

'text' => $order_totals[$i]['text'],

'value' => $order_totals[$i]['value'],

'class' => $order_totals[$i]['code'],

'sort_order' => $order_totals[$i]['sort_order']);

tep_db_perform(TABLE_ORDERS_TOTAL, $sql_data_array);

}

 

$customer_notification = (SEND_EMAILS == 'true') ? '1' : '0';

$sql_data_array = array('orders_id' => $insert_id,

'new_value' => DEFAULT_ORDERS_STATUS_ID,

'date_added' => 'now()',

'customer_notified' => $customer_notification);

tep_db_perform(TABLE_ORDERS_STATUS_HISTORY, $sql_data_array);

 

// initialized for the email confirmation

$products_ordered = '';

$subtotal = 0;

$total_tax = 0;

 

for ($i=0; $i<sizeof($order->products); $i++) {

// Stock Update - Joao Correia

if (STOCK_LIMITED == 'true') {

if (DOWNLOAD_ENABLED == 'true') {

$stock_query_raw = "SELECT products_quantity, pad.products_attributes_filename

FROM " . TABLE_PRODUCTS . " p

LEFT JOIN " . TABLE_PRODUCTS_ATTRIBUTES . " pa

ON p.products_id=pa.products_id

LEFT JOIN " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD . " pad

ON pa.products_attributes_id=pad.products_attributes_id

WHERE p.products_id = '" . tep_get_prid($order->products[$i]['id']) . "'";

// Will work with only one option for downloadable products

// otherwise, we have to build the query dynamically with a loop

$products_attributes = $order->products[$i]['attributes'];

if (is_array($products_attributes)) {

$stock_query_raw .= " AND pa.options_id = '" . $products_attributes[$i]['option_id'] . "' AND pa.options_values_id = '" . $products_attributes[$i]['value_id'] . "'";

}

$stock_query = tep_db_query($stock_query_raw);

} else {

$stock_query = tep_db_query("select products_quantity from " . TABLE_PRODUCTS . " where products_id = '" . tep_get_prid($order->products[$i]['id']) . "'");

}

$stock_values = tep_db_fetch_array($stock_query);

// 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) {

tep_db_query("update " . TABLE_PRODUCTS . " set products_status = '0' where products_id = '" . tep_get_prid($order->products[$i]['id']) . "'");

}

}

 

// 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']) . "'");

 

$sql_data_array = array('orders_id' => $insert_id,

'products_id' => tep_get_prid($order->products[$i]['id']),

'products_model' => $order->products[$i]['model'],

'products_name' => $order->products[$i]['name'],

'products_price' => $order->products[$i]['price'],

'final_price' => $order->products[$i]['final_price'],

'products_tax' => $order->products[$i]['tax'],

'store_id' => $order->products[$i]['store_id'],

'products_quantity' => $order->products[$i]['qty']);

tep_db_perform(TABLE_ORDERS_PRODUCTS, $sql_data_array);

$order_products_id = tep_db_insert_id();

 

//------insert customer choosen option to order--------

$attributes_exist = '0';

$products_ordered_attributes = '';

if ($order->products[$i]['attributes']) {

$attributes_exist = '1';

for ($j=0; $j<sizeof($order->products[$i]['attributes']); $j++) {

if (DOWNLOAD_ENABLED == 'true') {

$attributes_query = "select popt.products_options_name, poval.products_options_values_name, pa.options_values_price, pa.price_prefix, pad.products_attributes_maxdays, pad.products_attributes_maxcount , pad.products_attributes_filename

from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_OPTIONS_VALUES . " poval, " . TABLE_PRODUCTS_ATTRIBUTES . " pa

left join " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD . " pad

on pa.products_attributes_id=pad.products_attributes_id

where pa.products_id = '" . $order->products[$i]['id'] . "'

and pa.options_id = '" . $order->products[$i]['attributes'][$j]['option_id'] . "'

and pa.options_id = popt.products_options_id

and pa.options_values_id = '" . $order->products[$i]['attributes'][$j]['value_id'] . "'

and pa.options_values_id = poval.products_options_values_id

and popt.language_id = '" . $languages_id . "'

and poval.language_id = '" . $languages_id . "'";

$attributes = tep_db_query($attributes_query);

} else {

$attributes = tep_db_query("select popt.products_options_name, poval.products_options_values_name, pa.options_values_price, pa.price_prefix from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_OPTIONS_VALUES . " poval, " . TABLE_PRODUCTS_ATTRIBUTES . " pa where pa.products_id = '" . $order->products[$i]['id'] . "' and pa.options_id = '" . $order->products[$i]['attributes'][$j]['option_id'] . "' and pa.options_id = popt.products_options_id and pa.options_values_id = '" . $order->products[$i]['attributes'][$j]['value_id'] . "' and pa.options_values_id = poval.products_options_values_id and popt.language_id = '" . $languages_id . "' and poval.language_id = '" . $languages_id . "'");

}

$attributes_values = tep_db_fetch_array($attributes);

 

$sql_data_array = array('orders_id' => $insert_id,

'orders_products_id' => $order_products_id,

'products_options' => $attributes_values['products_options_name'],

'products_options_values' => $attributes_values['products_options_values_name'],

'options_values_price' => $attributes_values['options_values_price'],

'price_prefix' => $attributes_values['price_prefix']);

tep_db_perform(TABLE_ORDERS_PRODUCTS_ATTRIBUTES, $sql_data_array);

 

if (DOWNLOAD_ENABLED == 'true') {

$sql_data_array = array('orders_id' => $insert_id,

'orders_products_id' => $order_products_id,

'orders_products_filename' => $attributes_values['products_attributes_filename'],

'download_maxdays' => $attributes_values['products_attributes_maxdays'],

'download_count' => $attributes_values['products_attributes_maxcount']);

tep_db_perform(TABLE_ORDERS_PRODUCTS_DOWNLOAD, $sql_data_array);

}

$products_ordered_attributes .= "nt" . $attributes_values['products_options_name'] . ' ' . $attributes_values['products_options_values_name'];

}

}

//------insert customer choosen option eof ----

$total_weight += ($order->products[$i]['qty'] * $order->products[$i]['weight']);

$total_tax += tep_calculate_tax($total_products_price, $products_tax) * $order->products[$i]['qty'];

$total_cost += $total_products_price;

 

$products_ordered .= $order->products[$i]['qty'] . ' x ' . $order->products[$i]['name'] . ' (' . $order->products[$i]['model'] . ') = ' . $currencies->display_price($order->products[$i]['final_price'], $order->products[$i]['tax'], $order->products[$i]['qty']) . $products_ordered_attributes . "n";

 

$store_index = $order->products[$i]['store_id'];

 

//------- Stuff the store array with the data needed to create individual store emails------

$store_totals[$store_index]['store_id'] = $order->products[$i]['store_id'];

$store_totals[$store_index]['store_products'] .= $order->products[$i]['qty'] . ' x ' . $order->products[$i]['name'] . ' (' . $order->products[$i]['model'] . ') = ' . $currencies->display_price($order->products[$i]['final_price'], $order->products[$i]['tax'], $order->products[$i]['qty']) . $products_ordered_attributes . "n";

$store_totals[$store_index]['store_weight'] += ($order->products[$i]['qty'] * $order->products[$i]['weight']);

 

$store_totals[$store_index]['store_tax'] += tep_calculate_tax($total_products_price, $products_tax) * $order->products[$i]['qty'];

$store_totals[$store_index]['store_cost'] += $total_products_price;

}

 

// lets start with the email confirmation

$email_order = STORE_NAME . "n" .

EMAIL_SEPARATOR . "n" .

EMAIL_TEXT_ORDER_NUMBER . ' ' . $insert_id . "n" .

EMAIL_TEXT_INVOICE_URL . ' ' . tep_href_link(FILENAME_ACCOUNT_HISTORY_INFO, 'order_id=' . $insert_id, 'SSL', false) . "n" .

EMAIL_TEXT_DATE_ORDERED . ' ' . strftime(DATE_FORMAT_LONG) . "nn";

if ($order->info['comments']) {

$email_order .= $order->info['comments'] . "nn";

}

$email_order .= EMAIL_TEXT_PRODUCTS . "n" .

EMAIL_SEPARATOR . "n" .

$products_ordered .

EMAIL_SEPARATOR . "n";

 

for ($i=0; $i<sizeof($order_totals); $i++) {

$email_order .= strip_tags($order_totals[$i]['title']) . ' ' . strip_tags($order_totals[$i]['text']) . "n";

}

 

$email_order .= "n" . EMAIL_TEXT_DELIVERY_ADDRESS . "n" .

EMAIL_SEPARATOR . "n" .

tep_address_label($customer_id, $sendto, 0, '', "n") . "nn";

if (is_object($$payment)) {

$email_order .= EMAIL_TEXT_PAYMENT_METHOD . "n" .

EMAIL_SEPARATOR . "n";

$payment_class = $$payment;

$email_order .= $payment_class->title . "nn";

if ($payment_class->email_footer) {

$email_order .= $payment_class->email_footer . "nn";

}

}

tep_mail($order->customer['firstname'] . ' ' . $order->customer['lastname'], $order->customer['email_address'], EMAIL_TEXT_SUBJECT, nl2br($email_order), STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, '');

 

// send emails to other people

if (SEND_EXTRA_ORDER_EMAILS_TO != '') {

tep_mail('', SEND_EXTRA_ORDER_EMAILS_TO, EMAIL_TEXT_SUBJECT, nl2br($email_order), STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, '');

}

 

// now send emails to each individual store owner showing purchases from their shops

for ($e=0; $e<sizeof($store_totals); $e++){

 

$store_info_query = tep_db_query("SELECT store_owner_fname, store_owner_lname, store_email_address FROM " . TABLE_STORES . " where store_id = '" . $store_totals[$e]['store_id'] . "'");

$store_info = tep_db_fetch_array($store_info_query);

 

if (is_array($store_info)) {

$fp = fopen("./sent.txt", "a+");

fwrite($fp, $store_info['store_owner_fname'] . ' ' . $store_info['store_owner_lname'] . ' '. $store_info['store_email_address'] . "n");

fwrite($fp, $store_totals[$e]['store_id'] . "n");

fwrite($fp, $store_totals[$e]['store_products'] . "n");

fclose($fp);

 

$email_order = STORE_NAME . "n" .

EMAIL_SEPARATOR . "n" .

EMAIL_TEXT_ORDER_NUMBER . ' ' . $insert_id . "n" .

EMAIL_TEXT_DATE_ORDERED . ' ' . strftime(DATE_FORMAT_LONG) . "nn";

if ($order->info['comments']) {

$email_order .= $order->info['comments'] . "nn";

}

$email_order .= EMAIL_TEXT_PRODUCTS . "n" .

EMAIL_SEPARATOR . "n" .

$store_totals[$e]['store_products'] .

EMAIL_SEPARATOR . "n";

 

// for ($i=0; $i<sizeof($order_totals); $i++) {

// $email_order .= strip_tags($order_totals[$i]['title']) . ' ' . strip_tags($order_totals[$i]['text']) . "n";

// }

 

$email_order .= "n" . EMAIL_TEXT_DELIVERY_ADDRESS . "n" .

EMAIL_SEPARATOR . "n" .

tep_address_label($customer_id, $sendto, 0, '', "n") . "nn";

if (is_object($$payment)) {

$email_order .= EMAIL_TEXT_PAYMENT_METHOD . "n" .

EMAIL_SEPARATOR . "n";

$payment_class = $$payment;

$email_order .= $payment_class->title . "nn";

if ($payment_class->email_footer) {

$email_order .= $payment_class->email_footer . "nn";

}

}

tep_mail($store_info['store_owner_fname'] . ' ' . $store_info['store_owner_lname'], $store_info['owner_email_address'], EMAIL_TEXT_SUBJECT, nl2br($email_order), STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, '');

} else {

$fp = fopen("./mailit.txt", "a+");

fwrite($fp, "No query retrieved for order " . $e . "n");

fwrite($fp, "Store ID: " . $store_totals[$e]['store_id'] . "n");

fwrite($fp, $store_info_query . "n");

fclose($fp);

}

}

 

// load the after_process function from the payment modules

$payment_modules->after_process();

 

$cart->reset(TRUE);

 

// unregister session variables used during checkout

tep_session_unregister('sendto');

tep_session_unregister('comments');

tep_session_unregister('payment');

tep_session_unregister('shipping_selected');

tep_session_unregister('shipping_cost');

tep_session_unregister('shipping_method');

 

tep_redirect(tep_href_link(FILENAME_CHECKOUT_SUCCESS, '', 'SSL'));

 

require(DIR_WS_INCLUDES . 'application_bottom.php');

?>

 

MAILIT.TXT (This is written when failures occur)

No query retrieved for order 0

Store ID: 0

Resource id #28

No query retrieved for order 2

Store ID: 2

Resource id #37

No query retrieved for order 3

Store ID:

Resource id #39

 

SENT.TXT (This is written when the email is sent)

Thomas Doe [email protected]

1

1 x 20 long aquarium () = $20.00

 

If you can see where I might be erring, please let me know!!!

 

Aodhan

Link to comment
Share on other sites

  • 3 weeks later...
Just a quick note checking on how this project is going.

Thx

 

The writeup of the changes is about 1/2 done. I've been busy catching up on the work that piled up while I was on vaca.

 

It will be compatible with the 11/21 snapshot. (That's the majority of the time, just checking what changes have been made in it.) The admin writeup is done, just working on the catalog side of things.

 

Hopefully over the weekend, maybe early next week.

 

Aodhan

Link to comment
Share on other sites

Hi all,

 

I have pretty much finished my mall execpt fpor a couple of small things, it is different from both Linda's and john's mall solution. If possible, I would appreciate any feed back from itie. broken links and anything else. All comments are appreciated.

 

My solution offers customers the ability to set their store up via the internet,

each store has it's own db tables so it acts as it's own individual store, with it's own complete osc store. In the admin, I have removed some of the functionality, but most of it is the same.

 

This is just a trial version and I am hoping to have a finial one available in a week or two.....I am still doing some work on it, so if you find it is not working just let me know ....

 

the link to it is

 

http://www.systemsmanager.net

 

thanks and cheers

Peter McGrath

-----------------------------

See my Profile (click here) for more information and to contact me for professional osCommerce support that includes SEO development, custom development and security implementation

Link to comment
Share on other sites

I guess there are two concepts of the mall.

1.) Shop keeper sets up his own store front and manages it.

2.)The one similar to x-cart's "provider". Where the provider supplies the product for the "mall" and the mall owner "administers" and takes a commission off the provider.

 

This open's up some interesting questions on the two concepts... I guess.

Link to comment
Share on other sites

hi all,

 

I thought the nav bar at the top would work ok, I guess I will make it more clear to people were to get their own store....

 

here is the link to the first page....

 

http://www.systemsmanager.net/service.php?...=conditions.php

 

you may see some of the text not being displayed, that is due to an upgrade I am working on right now, since I am putting all of the text into a db table, I have a couple a patches to fix up so that it displays what it is supposed to...

 

the logic is all in place now to run the mall and to set up and run a store...

 

my thoughts on developing this were to attract people who want to have a small cash outlay and try there hand at e-commerce, as well i thought it would be a good way to get my feet wet in osc...

 

todate, I have set up a template system with osc, so that I use only one html page to run my entire site (or mostly since I am running two copies of osc..) as well I am working on a content management system for the site text.....which is why I put the text into a db table...

 

 

cheers,

Peter McGrath

-----------------------------

See my Profile (click here) for more information and to contact me for professional osCommerce support that includes SEO development, custom development and security implementation

Link to comment
Share on other sites

:tellme: This is what I'm trying to do. I want to have a main catalog site setup as the Virtual Shopping Mall:

 

shopping.enternetmall.com

 

And several stores with their product databases in the mall and links to the individual stores (all currently under construction):

 

demo.enternetmall.com

store.flattopcomputers.com

shop.flattopwoodworks.com

 

I imagine this similar to what everyone else wants a well.

 

Ajeh (Linda McGrath) has almost exactly what I am looking for. Hopfully she will be releasing her code soon.

Aodhan (John Paitel) has a concept that looks promising as well. It seems to be based on the same premise.

I am certainly open to any other suggestions.

 

Basically, I have all the customer data shared between all the stores (so customers can buy from any store with a single login) and individual product and category tables for each shop.

 

// define the database table names used in the project

// define tables used by mall

 define('TABLE_ADDRESS_BOOK', 'mall_address_book');

 define('TABLE_ADDRESS_FORMAT', 'mall_address_format');

 define('TABLE_BANNERS', 'mall_banners');

 define('TABLE_BANNERS_HISTORY', 'mall_banners_history');

// define tables used by stores

 define('TABLE_CATEGORIES', 'stores_categories');

 define('TABLE_CATEGORIES_DESCRIPTION', 'stores_categories_description');

 define('TABLE_CONFIGURATION', 'stores_configuration');

 define('TABLE_CONFIGURATION_GROUP', 'stores_configuration_group');

 define('TABLE_COUNTER', 'stores_counter');

 define('TABLE_COUNTER_HISTORY', 'stores_counter_history');

// define tables used by mall

 define('TABLE_COUNTRIES', 'mall_countries');

 define('TABLE_CURRENCIES', 'mall_currencies');

 define('TABLE_CUSTOMERS', 'mall_customers');

 define('TABLE_CUSTOMERS_BASKET', 'mall_customers_basket');

 define('TABLE_CUSTOMERS_BASKET_ATTRIBUTES', 'mall_customers_basket_attributes');

 define('TABLE_CUSTOMERS_INFO', 'mall_customers_info');

 define('TABLE_LANGUAGES', 'mall_languages');

// define tables used by stores

 define('TABLE_MANUFACTURERS', 'stores_manufacturers');

 define('TABLE_MANUFACTURERS_INFO', 'stores_manufacturers_info');

 define('TABLE_ORDERS', 'stores_orders');

 define('TABLE_ORDERS_PRODUCTS', 'stores_orders_products');

 define('TABLE_ORDERS_PRODUCTS_ATTRIBUTES', 'stores_orders_products_attributes');

 define('TABLE_ORDERS_PRODUCTS_DOWNLOAD', 'stores_orders_products_download');

 define('TABLE_ORDERS_STATUS', 'stores_orders_status');

 define('TABLE_ORDERS_STATUS_HISTORY', 'stores_orders_status_history');

 define('TABLE_ORDERS_TOTAL', 'stores_orders_total');

 define('TABLE_PRODUCTS', 'stores_products');

 define('TABLE_PRODUCTS_ATTRIBUTES', 'stores_products_attributes');

 define('TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD', 'stores_products_attributes_download');

 define('TABLE_PRODUCTS_DESCRIPTION', 'stores_products_description');

 define('TABLE_PRODUCTS_NOTIFICATIONS', 'stores_products_notifications');

 define('TABLE_PRODUCTS_OPTIONS', 'stores_products_options');

 define('TABLE_PRODUCTS_OPTIONS_VALUES', 'stores_products_options_values');

 define('TABLE_PRODUCTS_OPTIONS_VALUES_TO_PRODUCTS_OPTIONS', 'stores_products_options_values_to_products_options');

 define('TABLE_PRODUCTS_TO_CATEGORIES', 'stores_products_to_categories');

 define('TABLE_REVIEWS', 'stores_reviews');

 define('TABLE_REVIEWS_DESCRIPTION', 'stores_reviews_description');

 define('TABLE_SESSIONS', 'stores_sessions');

 define('TABLE_SPECIALS', 'stores_specials');

 define('TABLE_TAX_CLASS', 'stores_tax_class');

 define('TABLE_TAX_RATES', 'stores_tax_rates');

 define('TABLE_GEO_ZONES', 'stores_geo_zones');

 define('TABLE_ZONES_TO_GEO_ZONES', 'stores_zones_to_geo_zones');

// define tables used by mall

 define('TABLE_WHOS_ONLINE', 'mall_whos_online');

 define('TABLE_ZONES', 'mall_zones');

 

Problem is, I can't figure out how to pull all the product and category tables into the mall or setup categories and/or merchants (instead of manufacturers) that link to the other stores. Seems to me (the novice that I am), the ability to pull data from multiple product and category tables would be the trick. Also each store could have it's own configuration (i.e. name, address, phone, etc.) or use the mall's configuration. Just specify which configuration table in the application_top.php.

 

Right now, each of my stores has it's own admin but I would like to have a single admin for the mall that is able to control all data and have the option to set up individual admins that control the only data relevant to that particular store (for customers who want to maintain their own shops). But if I had to choose one over the other, I personally would prefer to have a central admin. Any ideas, thoughts on the subject, or code contributions would be greatly appreciated.

 

:?: By the way, does anyone know how to set it up so that when you login to one store you are automatically logged in on all other stores sharing the same customer database?

I haven't lost my mind,

I have it backed up on disk, somewhere...

Link to comment
Share on other sites

Actually, Peter's method (nope no relation, just a coincidence of names :D ) is more in line with totally different store info.

 

Mine uses the *same* MySQL tables for everything.

 

I filter the categories and products and give a new name ... then you can decide if customer login sets the *store* or if the store itself sets the *store*

 

This lets you have the same exact store with filtered products based on customer or different stores/urls/directories/etc. based on code.

 

This way if you want totally different code, look etc. per store you write it that way but get the database info from one place.

 

You can change store name reference but that is as far as that goes at the moment.

 

It would not be horribly hard to add in the seperat info per store, just have not had the time to do it yet.

 

I kind of wanted to get the multiple stores part working for various stores or various customer logins.

Link to comment
Share on other sites

Hi all,

 

As for the different looks per store Linda, I have implemented a template system to my code. This system will enable me to have different themes per store. I have not filluy implemented it as of yet, but most of it is done.

 

My template system uses just one html page to operate the entire shopping cart. So when I want to add in a different theme, it takes about an hour to make the theme up and set it up in my site, complete....

 

In addition, when I have the rest of the bugs worked out, I will implement the admin side to my template system, as well as the css theme contribution that Ian has included in his snapshot. With both of these things in place, I believe the system should be as powerful as the template system that Postnuke uses.

 

The each store in the mall has it's own customer, product prices, payment etc....So what one does is not effected by what the other stores do. I took this approach since I feel it is the most robust way to start this (just my <b>unbias</b> opinion :)) )....with most of the functionality required for what both Linda and John are doing being an easy adaptation of my solution.

 

Their solutions are ideal for specific applications, but maybe in the future the three of us can work together and combine all of our code together and come up with something even better.

 

Linda, I have been looking at the Post Nuke code, and I think it would be possible to port the DB layer to osc. I am thinking of this so that osc could be used for most DB types. I think this would bring OSC out from a niche market into a more main stream type of product. This is just a thought, if you have some time later Linda and are interested email me about it and we could discuss it further....

 

cheers

Peter McGrath

-----------------------------

See my Profile (click here) for more information and to contact me for professional osCommerce support that includes SEO development, custom development and security implementation

Link to comment
Share on other sites

When I get back on track with the multiple stores I will give you a yell, Peter.

 

I love the thema approach you wrote and have a few ideas for that as well.

 

You openned up a marvelous can of worms for me ...

:shock:

but you gave me some really excellant ideas because of this add-on. :D

Link to comment
Share on other sites

Hi Linda,

 

When i submitted the template design, I know there are some syntax type-errors and the pop-up windows was not working either. I have a fix for the pop up windows, as well a few lines of code need to be added into the search and manufacturers boxes....mainly because they use GET rather then POST.

 

If you need any pointers, just ask in here, I will watch this thread and post replies. Once I have a couple of bugs worked out of the language files being stored in the db table, I could post a submittion for it as well, the problem arises in that I have several parts that I need to separate before I could submit two as distint contributions ....

 

When you have some time, I would be happy to work out some of the other details, on merging the two mall contributions together if you want to. I have a few ideas that I want to try, but as it stands now, I am going to refine my stuff before I go on to anything new.

 

As for the mall, I have a management tool made up for the main administrator for the mall, it needs some more work, but the basics are implemented and functioning already....

 

 

 

I am sure though my next project will be the porting of the DB code I talked about earlier......

 

cheers,

Peter McGrath

-----------------------------

See my Profile (click here) for more information and to contact me for professional osCommerce support that includes SEO development, custom development and security implementation

Link to comment
Share on other sites

 

Why not make the top category the store name??

 

I thought about this, and I would still need the table for the owner information.

 

What I am looking at doing is hosting stores for other people. So, if a customer shops and buys things from three different stores, I need to split the payments between them. I'd like each store owner to get an email showing what was purchased from their store, myself and the purchaser to get an email showing the entire purchase.

 

I thought about making the top level category the store name, but was unsure about how to correlate the category/store with the information in the store table. I figured it was about 50/50 which was easier, and decided to try the addition of the two pages (stores.php, languagesenglishstores.php), and require any "top" category (Not a subcategory) to have a corresponding store_id.

 

If I go the way of making the category the store, then how/where would I look to associate a particular store with its owner information? Like I said, all I am looking for is a nudge in a direction. I've got good programming skills, just new to PHP.

 

Aodhan

I'm thinking along very similar lines for a site I'm going to create, allowing people to list thier collections online, customers can browse and buy a group of items, pay with a single transaction, and then I divvy the money and the listers drop-ship to the customer.

 

I've been doing php full time for the past 2 years till I got laid off from my dotcom job.

 

Do you have somewhere that I can get the modified code you have so far?

 

Tim

Link to comment
Share on other sites

Released!!

 

ok, the first version of the Virtual Mall has been released. It is in the "Other" section of the contributions, under the name Virtual_Mall_v1.0.

 

As always, send me bugs, etc.

 

Hope you all like it!

 

Aodhan

Link to comment
Share on other sites

  • 2 weeks later...

I found two errors in this versions - both in admin/categories.php file (everything else is just fine for me. Thank you for this!!!):

 

1. In the $product_query in line 320 the store_id col is missing .

 

So, $pInfo->store_id from 402 line is empty.

 

<tr>

<td class="main"><?php echo TEXT_PRODUCTS_STORE; ?></td>

<td class="main"><?php echo tep_draw_separator('pixel_trans.gif', '24', '15') . ' ' . tep_draw_pull_down_menu('store_id', $store_array, $pInfo->store_id); ?></td>

</tr>

 

 

 

In this case, the tep_draw_pull_down_menu function didn't know from wich store this product come and didn't make "selected" specification in the pull down menu.

 

So, if you are not carefully to change manually the store option everytime you edit your product, this product will become store_less and checkout process will fail.

 

FIX.

 

Simply insert , p.store_id right after p.manufacturers_id and before from

 

 

 

2. The second problem is that the image (a transparent one) is broken because of his name.

 

Replace:

 

pixel_trans_gif

 

with

 

pixel_trans.gif

 

 

in line quoted above.

 

 

Thank you,

Link to comment
Share on other sites

FIX.

 

Simply insert , p.store_id right after p.manufacturers_id and before from

 

2. The second problem is that the image (a transparent one) is broken because of his name.

 

Clement-

 

Thank you very much! I will get those fixed and in the writeup, and when the contributions section is up again, I'll resubmit it. This will most likely be a stable release, since you are the only one to report any bugs.

 

Not sure why the pixel_trans.gif was changed, I never messed with it...wierd.

 

Aodhan

Link to comment
Share on other sites

Hello there

 

I have installed the mall mod to Ian's loaded setup ... all has gone really well. At least till I tried to upload things to the database using csv files. None of the changes are kept, but then I go into the admin area they hold.

 

Two things I have noticed ...

 

1) if you use subcategories under the top store category then the products are not kept count of

 

2 I get this when trying to view the product info with the product either directly under the top store category or under the sub

 

1064 - You have an error in your SQL syntax near ' p.store_id from, products p, products_description pd where p.products_id = '1' ' at line 1

 

select p.products_id, pd.products_name, pd.products_description, p.products_model, p.products_quantity, p.products_image, p.products_mimage, p.products_bimage, pd.products_url, p.products_price, p.products_tax_class_id, p.products_date_added, p.products_date_available, p.manufacturers_id from, p.store_id from, products p, products_description pd where p.products_id = '1' and pd.products_id = '1' and pd.language_id = '1'

 

Now, both of these could be because of something I have done, I am not sure. I'm still learning all of this. :)

 

Was just wondering if anyone else has had this happen of if they may know what I could have done wrong on my end.

 

I want to say thanks to Aodhan for the mod ... I really have been needing something like this and it is great! Also, thanks to the rest who are also working on mall mods ... from the sounds of them they will be handy and very good as well!

Link to comment
Share on other sites

1064 - You have an error in your SQL syntax near ' p.store_id from, products p, products_description pd where p.products_id = '1' ' at line 1

 

select p.products_id, pd.products_name, pd.products_description, p.products_model, p.products_quantity, p.products_image, p.products_mimage, p.products_bimage, pd.products_url, p.products_price, p.products_tax_class_id, p.products_date_added, p.products_date_available, p.manufacturers_id from, p.store_id from, products p, products_description pd where p.products_id = '1' and pd.products_id = '1' and pd.language_id = '1'

 

Now, both of these could be because of something I have done, I am not sure. I'm still learning all of this. :)

 

You've misstyped something in the SQL statement. I don't have it available at the moment, but I suspect this line

p.manufacturers_id from, p.store_id from, products p, products_description pd

 

Should actually read

p.manufacturers_id, p.store_id from products p, products_description pd

 

i.e. There should only be one FROM in there, and in SQL syntax, there is no comma after keywords.

 

SELECT <these fields> FROM <these tables> WHERE <qualifying conditions>

 

Hope this helps, and I'll check on the totals. I didn't have a problem, but maybe I didn't stack deep enough. I'll play with it some more over the next week.

 

Aodhan

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...