
Originally Posted by
pfabrick
You're right, both the invoice & packing slip files do not access the site config files (We don't use these forms so it's not something I had noticed before). I think I might know a way to accomplish this...let me mess around with it and get back to you.
OK, here's what's happening. Within the admin, the constants are loaded before we can determine which site that particular order came from. Since the STORE_NAME_ADDRESS constant is already defined, we can't use the definition within the site config file.
Let's check and make sure this works for you and then I'll give you the code changes for the invoices as well:
open the file YOUR_ADMIN_DIR/packingslip.php and locate the following query:
Code:
$order_check = $db->Execute("select cc_cvv, 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
from " . TABLE_ORDERS . "
where orders_id = '" . (int)$oID . "'");
and MOVE that query to just below the following code:
Code:
<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" bgcolor="#FFFFFF">
<!-- body_text //-->
and now change it to the following (we're adding the order_site field):
Code:
<?php
$order_check = $db->Execute("select cc_cvv, 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, order_site
from " . TABLE_ORDERS . "
where orders_id = '" . (int)$oID . "'");
//multi site : determine order site & load the appropriate config file
if(isset($order_check->fields['order_site'])) {
$config_file = $order_check->fields['order_site'].'_config.php';
//echo $config_file;
// exit;
if(file_exists("../includes/config_sites/".$config_file)) {
include("../includes/config_sites/".$config_file);
}
}
?>
Now locate the following code:
Code:
<td class="pageHeading"><?php echo nl2br(STORE_NAME_ADDRESS); ?></td>
and change to the following:
Code:
<td class="pageHeading"><?php echo nl2br($order_site_address); ?></td>
Save and upload the file to your site. Now we have to add the variable in your site_config file. Open each file and add the following code:
Code:
$order_site_address = 'YOUR_SITE_NAME
YOUR_STREET
YOUR_CITY_STATE_ZIP
YOUR_PHONE';
Upload these files to your site and test it out for me. Let me know your results and I'll get the invoice up and running also.
Bookmarks