#
# Upgrade script: Marketplace 1.4.0 and 1.4.1 to Marketplace 1.4.2
#
# Use a mysql-client of your choice ( I recommend 'mysql')
#
# Please make a backup of your database before you start!!!
#
# Also, please backup changes in your language file i.E. the rules
#
# Author: Achim Fischer
#


# NOTE: *** If you use table-prefixes, please add them to the table names ***




# create new table for keywords
CREATE TABLE IF NOT EXISTS `marketplace_keywords` (
	`id`               INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
    `keyword`          VARCHAR(100) DEFAULT NULL,
    `action`           INTEGER DEFAULT '0',
    `infotext`         VARCHAR(200) DEFAULT '',
    `published`        TINYINT(1) DEFAULT 0,
    PRIMARY KEY  (`id`),
    	KEY `marketplace_keywords_keyword` (`keyword`)
) TYPE=MyISAM;



# some new fields in the marketplace configuration table
ALTER TABLE `marketplace_config`
    ADD COLUMN `email_from` VARCHAR(100),
    ADD COLUMN `email_from_name` VARCHAR(100),
    ADD COLUMN `use_admin_email_notification` TINYINT(1) DEFAULT 0,
    ADD COLUMN `use_moderator_email_notification` TINYINT(1) DEFAULT 0,
    ADD COLUMN `notification_email_subject` VARCHAR(100),
    ADD COLUMN `notification_email_text` TEXT,
    ADD COLUMN `use_author_email_notification` TINYINT(1) DEFAULT 0,
    ADD COLUMN `expiry_email_subject` VARCHAR(100),
    ADD COLUMN `expiry_email_text` TEXT;



# update version and set the new fields to default values
UPDATE `marketplace_config` SET version = '1.4.2';
UPDATE `marketplace_config` SET email_from='noreply@localhost';
UPDATE `marketplace_config` SET email_from_name='Marketplace';
UPDATE `marketplace_config` SET notification_email_subject='Marketplace Notificaton';
UPDATE `marketplace_config` SET notification_email_text='Dear Admin/Moderator,\n\na new ad has been placed in your Marketplace\n\n[LINK_TO_AD]\n\nBest regards\n\nYour Marketplace Team';
UPDATE `marketplace_config` SET expiry_email_subject='Your ad has expired';
UPDATE `marketplace_config` SET expiry_email_text='Dear [USERNAME],\n\nyour ad in our marketplace has expired.\n\nPlease feel free to come back and place another ad in our marketplace.\n\nBest regards\n\nYour Marketplace Team';





# select id of your Marketplace and write it down
# you have to put it in the next update and insert Statements. Replace  *MYID* with your selected id.
SELECT id FROM components WHERE name= 'Marketplace' AND parent='0';


# a new backend menu item (Keywords)
INSERT INTO `components`
	( `name`, `link`, `menuid`, `parent`, `admin_menu_link`, `admin_menu_alt`, `option`, `ordering`, `admin_menu_img`, `iscore`, `params`)
		VALUES
	( 'Keywords', '', 0, *MYID*, 'option=com_marketplace&act=keywords', 'Keywords', 'com_marketplace', 5, 'js/ThemeOffice/query.png', 0, '');


# update backend menu items
UPDATE `components` SET name='Types' WHERE option='com_marketplace' AND name='Type Manager';
UPDATE `components` SET name='Categories' WHERE option='com_marketplace' AND name='Category Manager';
UPDATE `components` SET name='Ads' WHERE option='com_marketplace' AND name='Ad Manager';
UPDATE `components` SET name='Users' WHERE option='com_marketplace' AND name='User Manager';




Now copy the files in the zipfile to your server

The following files go in ./components/com_marketplace

# please note that some images have changed and some are new
# to make sure to get all, just replace all of them

	write_ad.php
	delete_ad.php
	footer.php
	images/categories/default.gif
	images/entries/dummy.gif
	images/system/deletead.gif
	images/system/editad.gif
	images/system/error.gif
	images/system/home.gif
	images/system/information.gif
	images/system/myads.gif
	images/system/nopic.gif
	images/system/rules.gif
	images/system/search.gif
	images/system/success.gif
	images/system/warning.gif
	images/system/writead.gif
	joomfish/marketplace_ads.xml
	joomfish/marketplace_categories.xml
	joomfish/marketplace_types.xml
	jscalendar/calendar.js
	jscalendar/calendar-en.js
	jscalendar/calendar-setup.js
	jscalendar/calendar-system.css
	language/dutch.php
	language/english.php
	language/finnish.php
	language/french.php
	language/german.php
	language/germani.php
	language/italian.php
	list.php
	marketplace.php
	marketplace.css
	recent5.php
	search.php
	show_ad.php
	show_category.php
	show_index.php
	show_rules.php
	topmenu.php




The following files go in ./administrator/components/com_marketplace

	admin.marketplace.php
	admin.marketplace.html.php
	marketplace.class.php
	toolbar.marketplace.php
	toolbar.marketplace.html.php
	LICENSE.txt




That's it :-)

Achim Fischer



