Seller Address Changes

From PhpCOIN Documentation

Jump to: navigation, search

Contents

The Issue

Your current address information is set in [Admin] -> [Parameters] -> [User] -> [package] -> [xxxxxx]

To minimize the size of the database, phpCOIN does not save your address info with each invoice. Instead, phpCOIN performs a database look-up each time an invoice is displayed. This is perfect if you never move, but if you have moved it is not desirable that an older invoice displays the new address. phpCOIN v1.4.2 and higher has a method of overriding your address displayed on selected invoices ~ an address override file.


Address Override File

Create a file called invoice_address_override.php and make the contents similar to the following:

<?php
/**
 * Module: Invoices (Override seller address for specified invoices)
 *	- phpCOIN is based on concept and code of Mike Lansberry <mg@mgwebhosting.com>
 *	- Do NOT alter or remove this text block
 * @package phpCOIN
 * @subpackage Invoices
 * @author Stephen M. Kitching <support@phpcoin.com>
 * @copyright Copyright © 2003-2009 COINSoftTechnologies Inc. All rights reserved.
 * @license coin_docs/license.txt phpCOIN License Terms
 */


# If you need to display a different address than your current address for older invoices.
# If the invoice_id is less than the specified number we will override the address info
#	- Enter old address info as necessary, also
#	- Replace LOWEST_CUTOFF_INVOICE_ID with record_id that is the lowest
#	  record_id to retain the current address
#	  Replace only whatever fields you need to replace ~ remove the remainder
	IF ($row['invc_id'] < LOWEST_CUTOFF_INVOICE_ID) {
		$_UVAR['CO_INFO_01_NAME']		= ;
		$_UVAR['CO_INFO_02_ADDR_01']		= ;
		$_UVAR['CO_INFO_03_ADDR_02']		= ;
		$_UVAR['CO_INFO_04_CITY']		= ;
		$_UVAR['CO_INFO_05_STATE_PROV']		= ;
		$_UVAR['CO_INFO_06_POSTAL_CODE']	= ;
		$_UVAR['CO_INFO_07_COUNTRY']		= ;
		$_UVAR['CO_INFO_08_PHONE']		= ;
		$_UVAR['CO_INFO_09_FAX']		= ;
		$_UVAR['CO_INFO_10_TAXNO']		= ;
		$_UVAR['CO_INFO_11_TOLL_FREE']		= ;
		$_UVAR['CO_INFO_12_TAGLINE']		= ;
	}

?>

For phpCOIN v1.4.2, place the file in the root folder of the phpCOIN website.

For phpCOIN v1.4.3 and higher, place the file in the /coin_overrides folder.


The idea of this code is that if an invoice_id (record_ id) is lower than LOWEST_CUTOFF_INVOICE_ID the current address info will be over-ridden with whatever you enter here. Replace LOWEST_CUTOFF_INVOICE_ID with the lowest invoice_id that should use your current address.

If you have several addresses to accommodate, simply add another block before the ending ?> tag and repeat as many times as necessary

# If you need to accommodate multiple addresses over a period of time,
# just repeat the following block as necessary
	ELSEIF ($row['invc_id'] < NEXT_LOWEST_CUTOFF_INVOICE_ID) {
		$_UVAR['CO_INFO_01_NAME']		= ;
		$_UVAR['CO_INFO_02_ADDR_01']		= ;
		$_UVAR['CO_INFO_03_ADDR_02']		= ;
		$_UVAR['CO_INFO_04_CITY']		= ;
		$_UVAR['CO_INFO_05_STATE_PROV']		= ;
		$_UVAR['CO_INFO_06_POSTAL_CODE']	= ;
		$_UVAR['CO_INFO_07_COUNTRY']		= ;
		$_UVAR['CO_INFO_08_PHONE']		= ;
		$_UVAR['CO_INFO_09_FAX']		= ;
		$_UVAR['CO_INFO_10_TAXNO']		= ;
		$_UVAR['CO_INFO_11_TOLL_FREE']		= ;
		$_UVAR['CO_INFO_12_TAGLINE']		= ;
	}

Naturally, replace NEXT_LOWEST_CUTOFF_INVOICE_ID with the invoice_id that should start using the previous address. You could also make the comparison date-based, rather than invoice-number-based.


Invoice Number Example

In the following example, we have 100 invoices in the database. The first 30 should use the oldest address, invoices 31 to 50 should use the middle address, and invoices 51 and up should use the current address:

<?php

# Invoices 1 to 30 will use this address.
# Only our street address and our postal code changed, so we remove the other fields
	IF ($row['invc_id'] < 31) {
		$_UVAR['CO_INFO_02_ADDR_01']		= '123 First Street';
		$_UVAR['CO_INFO_06_POSTAL_CODE']	= '123456';
 
# Invoices 31 to 50 will use this address.
# We DID change our city (then moved back later) so we remove the other fields
	} ELSEIF ($row['invc_id'] < 51) {
		$_UVAR['CO_INFO_02_ADDR_01']		= '123 Second Street';
		$_UVAR['CO_INFO_04_CITY']		= 'Second City';
		$_UVAR['CO_INFO_06_POSTAL_CODE']	= '654321';
	}

# Invoices 51 and higher will use the current address

?>

Invoice Date Example

In the following example, we have 100 invoices in the database. Invoices issued before 2002-01-01 should use the oldest address, invoices issued between 2002-01-01 and 2005-12-31 should use the middle address, and all invoices issued after 2005-01-01 should use the current address:

<?php

# Invoices issued before 2002-01-01 will use this address.
# Only our street address and our postal code changed, so we remove the other fields
	IF ($row['invc_ts'] < 1009843201) {
		$_UVAR['CO_INFO_02_ADDR_01']		= '123 First Street';
		$_UVAR['CO_INFO_06_POSTAL_CODE']	= '123456';
 
# Invoices issued after 2002-01-01 and before 2005-01-01 will use this address.
# We DID change our city (then moved back later) so we remove the other fields
	} ELSEIF ($row['invc_ts'] < 1104537601) {
		$_UVAR['CO_INFO_02_ADDR_01']		= '123 Second Street';
		$_UVAR['CO_INFO_04_CITY']		= 'Second City';
		$_UVAR['CO_INFO_06_POSTAL_CODE']	= '654321';
	}

# Invoices issued after 2005-01-01 will use the current address

?>
Personal tools

Inscrita el Registro Mercantil de Mallorca Tomo 2140, Hoja No. PM-51034, Folio 135
This website owned and operated by: Technology Services RPVW S.L. CIF# B57345084
Avda Constitucion 48 Bajos Alaro 07340 Baleares SPAIN
Tel:+34 971518362    Fax: +34 971518368    eMail: support@phpcoin.com