-
- antoni vidal

-
Total Posts: 14
Joined: 2007-09-03
|
Greetings, is a pleasure for us to send you this good new’s. We already have multiple Table Rates on our website. http://www.helimania.es
Will try to repeat the process we have followed. Sorry for for my bad English.
Table rates keeps your information in a table of the database and this is created in: app\code\core\Mage\Shipping\sql\shipping_setup/mysql4-install-0.7.0.php here we must duplicate the code to create as many tables as we want to have . Note that we create (2) TableRate2 and Tablerate3.
<?php
$installer = $this; /* @var $installer Mage_Core_Model_Resource_Setup */
$installer->startSetup();
$installer->run("
-- DROP TABLE IF EXISTS {$this->getTable('shipping_tablerate')}; CREATE TABLE {$this->getTable('shipping_tablerate')} ( `pk` int(10) unsigned NOT NULL auto_increment, `website_id` int(11) NOT NULL default '0', `dest_country_id` varchar(4) NOT NULL default '0', `dest_region_id` int(10) NOT NULL default '0', `dest_zip` varchar(10) NOT NULL default '', `condition_name` varchar(20) NOT NULL default '', `condition_value` decimal(12,4) NOT NULL default '0.0000', `price` decimal(12,4) NOT NULL default '0.0000', `cost` decimal(12,4) NOT NULL default '0.0000', PRIMARY KEY (`pk`), UNIQUE KEY `dest_country` (`website_id`,`dest_country_id`,`dest_region_id`,`dest_zip`,`condition_name`,`condition_value`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- DROP TABLE IF EXISTS {$this->getTable('shipping_tablerate2')}; CREATE TABLE {$this->getTable('shipping_tablerate2')} ( `pk` int(10) unsigned NOT NULL auto_increment, `website_id` int(11) NOT NULL default '0', `dest_country_id` varchar(4) NOT NULL default '0', `dest_region_id` int(10) NOT NULL default '0', `dest_zip` varchar(10) NOT NULL default '', `condition_name` varchar(20) NOT NULL default '', `condition_value` decimal(12,4) NOT NULL default '0.0000', `price` decimal(12,4) NOT NULL default '0.0000', `cost` decimal(12,4) NOT NULL default '0.0000', PRIMARY KEY (`pk`), UNIQUE KEY `dest_country` (`website_id`,`dest_country_id`,`dest_region_id`,`dest_zip`,`condition_name`,`condition_value`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- DROP TABLE IF EXISTS {$this->getTable('shipping_tablerate3')}; CREATE TABLE {$this->getTable('shipping_tablerate3')} ( `pk` int(10) unsigned NOT NULL auto_increment, `website_id` int(11) NOT NULL default '0', `dest_country_id` varchar(4) NOT NULL default '0', `dest_region_id` int(10) NOT NULL default '0', `dest_zip` varchar(10) NOT NULL default '', `condition_name` varchar(20) NOT NULL default '', `condition_value` decimal(12,4) NOT NULL default '0.0000', `price` decimal(12,4) NOT NULL default '0.0000', `cost` decimal(12,4) NOT NULL default '0.0000', PRIMARY KEY (`pk`), UNIQUE KEY `dest_country` (`website_id`,`dest_country_id`,`dest_region_id`,`dest_zip`,`condition_name`,`condition_value`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
");
$installer->endSetup();
Now we must duplicate and rename:
\app\code\core\Mage\Shipping\Model\Carrier\Tablerate.php to \app\code\core\Mage\Shipping\Model\Carrier\Tablerate3.php or (n) version.
Change all the code that refers to TableRate as in this example.
In the next post
|