Clone wiki

satchmo / BackwardsIncompatibleChangesAfter0.7

Backwards Incompatible Changes After 0.7

Table of Contents

  • June 13, 2008: [#SatchmoProductJS Satchmo Product JS]
  • June 28, 2008: [#AddedThumbnailConfig Added Thumbnail Config]
  • July 22, 2008: [#MergedNewforms-Admin Merged Newforms Admin]
  • July 23, 2008: [#AddUnique_togethertoSettings Add Unique_together to Settings]
  • August 19, 2008: [#MergedMulti-shop Merged Multishop Branch]
  • August 23, 2008: [#CommentUtils Updated templates for newest comment_utils]
  • August 30, 2008: [#ProductRatings Added new, compatible Product Ratings app]
  • September 17, 2008: [#CreditCardDetailsUpdates Updated CreditCardDetails object]
  • September 18, 2008: [#AddedRelatedCategories Added Related Categories]
  • September 19, 2008: [#AddedNewsletterAttributes Added Subscription Attributes for Newsletters]
  • September 27, 2008: [#AddedContactTitle Added Contact Title]
  • September 28, 2008: [#ChangedTimestamp Changed timestamp field name]
  • October 26, 2008: [#AddedShippingtoBaseProduct Added Shipping to Base Product]
  • November 11, 2008: [#AddedPricingLookup Added Pricing Lookup]
  • November 12, 2008: [#AddedDayAndMonthRebilling Added Day and Month Rebilling]
  • Novemver 21, 2008: [#UpdatedSatchmoProductJS Updated Satchmo Product JS]

Satchmo Product JS

In [1250], I added enforcement of product.active status when attempting to add to the cart. This involved refactoring the product javascript and the configurableproduct template.

Unless you've overridden the default satchmo_product.js or detail_configurableproduct.html, you won't have to do a thing. If you've copied it from satchmo/static/js/satchmo_product.js just copy it again and you'll be up to date.

If you have your own custom detail_configurableproduct.html, then you'll need to change this part:

satchmo.prices = {{ prices|as_json }};
satchmo.optmap = {{ optmap|as_json }};
{% if taxes %}satchmo.taxes = {{ taxes|as_json }};{% endif %}

and replace it with this:

satchmo.variations = {{ details|as_json }};

Added Thumbnail Config

In [1291], changed "Rename Product Images" and "Thumbnail Quality" settings to use a new config section, "Thumbnail." This allows the satchmo.thumbnail app to be standalone, but it is backwards incompatible in that you'll have to set those settings again in your store.

Merged Newforms-Admin

In [1348], the nfa branch was merged into trunk. Make sure that you have Django revision 7967 or later. If you've written custom code for Satchmo, read [http://code.djangoproject.com/wiki/BackwardsIncompatibleChanges#Mergednewforms-adminintotrunk Django's change notes].

Add Unique_together to Settings

In [1355], a unique_together constraint was added to the Setting and !LongSetting models.

Merged Multi-shop

In [1424], we merged the multi-shop branch.

Updates required:

In your settings and local_settings, move SHOP_BASE, SHOP_URLS, CUSTOM_NEWSLETTER_MODULES, CUSTOM_PAYMENT_MODULES , CUSTOM_SHIPPING_MODULES, CUSTOM_PRODUCT_MODULES to a new dictionary "SATCHMO_SETTINGS".

Add 'MULTISHOP' : True to SATCHMO_SETTINGS if you want to enable the multishop features.

'''SQL Updates'''

(postgres)

''I need the syntax for dropping the "sku" constraint on product_product in psql and the productimage/sort order constraint in product_productimage -- to drop a constraint, you do ALTER TABLE sometable DROP CONSTRAINT someconstraint''

BEGIN;
alter table contact_order rename to shop_order;
alter table contact_orderitem rename to shop_orderitem;
alter table contact_downloadlink rename to shop_downloadlink;
alter table contact_orderitemdetail rename to shop_orderitemdetail;
alter table contact_orderpayment rename to shop_orderpayment;
alter table contact_orderstatus rename to shop_orderstatus;
alter table contact_ordertaxdetail rename to shop_ordertaxdetail;
alter table contact_ordervariable rename to shop_ordervariable;
alter table discount_discount add column site int not null default 1;
alter table product_category add column site int not null default 1;
alter table product_optiongroup add column site int not null default 1;
alter table shop_cart add column site int not null default 1;
alter table shop_order add column site int not null default 1;
alter table giftcertificate_giftcertificate add column site int not null default 1;
alter table contact_addressbook add column addressee varchar(61) not null default '';
update contact_addressbook set addressee = contact_contact.first_name || ' ' || contact_contact.last_name from contact_contact where contact_contact.id = contact_addressbook.contact_id;
alter table contact_addressbook alter column street1 type varchar(80);
alter table contact_addressbook alter column street2 type varchar(80);
alter table contact_addressbook alter column postal_code type varchar(30);
alter table contact_addressbook add column country_id integer references l10n_country(id);
update contact_addressbook set country_id = l10n_country.id from l10n_country 
where l10n_country.iso2_code = contact_addressbook.country;
alter table contact_addressbook drop column country;
alter table shop_order add column ship_addressee varchar(61) not null default '';
alter table shop_order add column bill_addressee varchar(61) not null default '';
alter table shop_order alter column ship_street1 type varchar(80);
alter table shop_order alter column ship_street2 type varchar(80);
alter table shop_order alter column ship_postal_code type varchar(30);
update shop_order set ship_country = l10n_country.iso2_code from l10n_country 
where l10n_country.name = shop_order.ship_country;
alter table shop_order alter column ship_country type varchar(2);
alter table shop_order alter column bill_street1 type varchar(80);
alter table shop_order alter column bill_street2 type varchar(80);
alter table shop_order alter column bill_postal_code type varchar(30);
update shop_order set bill_country = l10n_country.iso2_code from l10n_country 
where l10n_country.name = shop_order.bill_country;
alter table shop_order alter column bill_country type varchar(2);
update shop_config set country=231 where country is null;
alter table shop_config alter column country int not null default 231;
alter table product_option rename column optionGroup_id to option_group_id;
alter table product_option rename column displayOrder to sort_order;
COMMIT;

Untested postgresql commands for updating product_product:

BEGIN;
alter table product_product add column site_id int not null default 1;
alter table product_product drop constraint product_product_sku_key;
alter table product_product add constraint product_product_site_id_key unique (site_id, sku);
COMMIT;

(mysql)

rename table `contact_order` to `shop_order`;
rename table `contact_orderitem` to `shop_orderitem`;
rename table `contact_downloadlink` to `shop_downloadlink`;
rename table `contact_orderitemdetail` to `shop_orderitemdetail`;
rename table `contact_orderpayment` to `shop_orderpayment`;
rename table `contact_orderstatus` to `shop_orderstatus`;
rename table `contact_ordertaxdetail` to `shop_ordertaxdetail`;
rename table `contact_ordervariable` to `shop_ordervariable`;
alter table discount_discount add column site_id int(11) not null default 1;
alter table product_category add column site_id int(11) not null default 1;
alter table product_optiongroup add column site_id int(11) not null default 1;
alter table product_product add column site_id int(11) not null default 1;
alter table shop_cart add column site_id int(11) not null default 1;
alter table shop_order add column site_id int(11) not null default 1;
alter table product_option change column optionGroup_id option_group_id int(11);
alter table product_option change column displayOrder sort_order int(11);
alter table product_product drop index sku;
alter table product_productimage drop index `product_productimage_product_id`;
alter table contact_addressbook add column addressee varchar(61) not null default '';
update contact_addressbook set addressee = (select concat(contact_contact.first_name, ' ', contact_contact.last_name) 
from contact_contact where contact_contact.id = contact_addressbook.contact_id);
alter table contact_addressbook modify column street1 varchar(80);
alter table contact_addressbook modify column street2 varchar(80);




alter table contact_addressbook modify column postal_code varchar(30);
alter table contact_addressbook add column country_id integer references l10n_country(id);
update contact_addressbook set country_id = (select l10n_country.id from l10n_country where l10n_country.iso2_code = contact_addressbook.country);
alter table contact_addressbook drop column country;
alter table shop_order add column ship_addressee varchar(61) not null default '';
alter table shop_order add column bill_addressee varchar(61) not null default '';
alter table shop_order modify column ship_street1 varchar(80);
alter table shop_order modify column ship_street2 varchar(80);
alter table shop_order modify column ship_postal_code varchar(30);
update shop_order set ship_country = (select l10n_country.iso2_code 
from l10n_country where l10n_country.name = shop_order.ship_country);
alter table shop_order modify column ship_country varchar(2);
alter table shop_order modify column bill_street1 varchar(80);
alter table shop_order modify column bill_street2 varchar(80);
alter table shop_order modify column bill_postal_code varchar(30);
update shop_order set bill_country = (select l10n_country.iso2_code 
from l10n_country where l10n_country.name = shop_order.bill_country);
alter table shop_order modify column bill_country varchar(2);
alter table shop_config add column country int(11) not null default 231;
update shop_config set country=231 where country is null;

Comment Utils

in [1444] changed the template loading to use the latest comment_utils. You will need to update to the latest svn version of comment_utils for this to work.

Product Ratings

in [1466] added a new app satchmo.productratings, which restores compatibility with Django HEAD. Requires Django HEAD to work. To upgrade, remove any reference to comment_utils in project templates, remove comment_utils from your installed apps and make sure satchmo.productratings in in your installed apps then run syncdb. We need a SQL upgrade path, which is not yet ready.

CreditCardDetails Updates

in [1517] modified CreditCardDetail object to standardize the naming of fields, and to add compatibility for additional credit card types and new Credit processors such as Prot/X, which requires a few more fields than we had before.

Renamed:

  • creditType -> credit_type
  • displayCC -> display_cc
  • encryptedCC -> encrypted_cc
  • expireMonth -> expire_month
  • expireYear -> expire_year

Added:

  • card_holder
  • start_month
  • start_year
  • issue_num

'''SQL Updates'''

(Mysql)

begin;
alter table payment_creditcarddetail change column creditType credit_type varchar(16);
alter table payment_creditcarddetail change column displayCC display_cc varchar(4);
alter table payment_creditcarddetail change column encryptedCC encrypted_cc varchar(40);
alter table payment_creditcarddetail change column expireMonth expire_month int(11);
alter table payment_creditcarddetail change column expireYear expire_year int(11);
alter table payment_creditcarddetail add column card_holder varchar(60) default '';
alter table payment_creditcarddetail add column start_month int(11);
alter table payment_creditcarddetail add column start_year int(11);
alter table payment_creditcarddetail add column issue_num varchar(2) default '';
commit;

(PostgreSQL)

begin;
alter table payment_creditcarddetail rename column "creditType" to credit_type;
alter table payment_creditcarddetail rename column "displayCC" to display_cc;
alter table payment_creditcarddetail rename column "encryptedCC" to encrypted_cc;
alter table payment_creditcarddetail rename column "expireMonth" to expire_month;
alter table payment_creditcarddetail rename column "expireYear" to expire_year;
alter table payment_creditcarddetail add column card_holder varchar(60) default '';
alter table payment_creditcarddetail add column start_month int;
alter table payment_creditcarddetail add column start_year int;
alter table payment_creditcarddetail add column issue_num varchar(2);
commit;

In [1527], added a related_categories many_to_many field to the product.models.Category object.

'''SQL Updates'''

(sqlite)

CREATE TABLE "product_category_related_categories" (
    "id" integer NOT NULL PRIMARY KEY,
    "from_category_id" integer NOT NULL REFERENCES "product_category" ("id"),
    "to_category_id" integer NOT NULL REFERENCES "product_category" ("id"),
    UNIQUE ("from_category_id", "to_category_id")
);

(mysql)

CREATE TABLE `product_category_related_categories` (
    `id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
    `from_category_id` integer NOT NULL,
    `to_category_id` integer NOT NULL,
    UNIQUE (`from_category_id`, `to_category_id`)
)
;
ALTER TABLE `product_category_related_categories` 
  ADD CONSTRAINT from_category_id_refs_id_5b6546b1 
  FOREIGN KEY (`from_category_id`) REFERENCES `product_category` (`id`);
ALTER TABLE `product_category_related_categories`
  ADD CONSTRAINT to_category_id_refs_id_5b6546b1
  FOREIGN KEY (`to_category_id`) REFERENCES `product_category` (`id`);

(postgres)

CREATE TABLE "product_category_related_categories" (
    "id" serial NOT NULL PRIMARY KEY,
    "from_category_id" integer NOT NULL REFERENCES "product_category" ("id") DEFERRABLE INITIALLY DEFERRED,
    "to_category_id" integer NOT NULL REFERENCES "product_category" ("id") DEFERRABLE INITIALLY DEFERRED,
    UNIQUE ("from_category_id", "to_category_id")
)
;

Added Newsletter Attributes

In [1536] added (optional) SubscriptionAttributes for newsletters, which track additional information interesting to some stores.

'''SQL Updates'''

(Sqlite)

CREATE TABLE "newsletter_subscriptionattribute" (
    "id" integer NOT NULL PRIMARY KEY,
    "subscription_id" integer NOT NULL REFERENCES "newsletter_subscription" ("id"),
    "name" varchar(100) NOT NULL,
    "value" varchar(255) NOT NULL
);

(MySQL)

BEGIN;
CREATE TABLE `newsletter_subscriptionattribute` (
    `id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
    `subscription_id` integer NOT NULL,
    `name` varchar(100) NOT NULL,
    `value` varchar(255) NOT NULL
);
ALTER TABLE `newsletter_subscriptionattribute` 
	ADD CONSTRAINT subscription_id_refs_id_41c3ffa6 FOREIGN KEY (`subscription_id`) 
	REFERENCES `newsletter_subscription` (`id`);
COMMIT;

(Postgresql)

BEGIN;
CREATE TABLE "newsletter_subscriptionattribute" (
    "id" serial NOT NULL PRIMARY KEY,
    "subscription_id" integer NOT NULL REFERENCES 
		"newsletter_subscription" ("id") DEFERRABLE INITIALLY DEFERRED,
    "name" varchar(100) NOT NULL,
    "value" varchar(255) NOT NULL
);
COMMIT;

Added Contact Title

In [1564] added 'title' column to Contact.

'''SQL Updates'''

(Same for Mysql, PostgreSQL, and Sqlite, for once)

alter table contact_contact add column title varchar(30) null;

Changed Timestamp

In [1569], changed the naming of the times stamp field from timestamp to time_stamp. It was changed in 2 model locations:

  • shop.models.Order
  • shop.models.OrderStatus
  • shop.models.OrderPayment

'''SQL Updates'''

(Postgresql)

alter table shop_order rename column "timestamp" to time_stamp;
alter table shop_orderstatus rename column "timestamp" to time_stamp;
alter table shop_orderpayment rename column "timestamp" to time_stamp;

(MySql)

ALTER TABLE  `shop_order` CHANGE  `timestamp`  `time_stamp` DATETIME NULL DEFAULT NULL;
ALTER TABLE  `shop_orderstatus` CHANGE  `timestamp`  `time_stamp` DATETIME NULL DEFAULT NULL;
ALTER TABLE  `shop_orderpayment` CHANGE  `timestamp`  `time_stamp` DATETIME NULL DEFAULT NULL;

Added Shipping to Base Product

In [1668], added shipping to base product. This allows you to explicitly set "shippable" or "not shippable" for any product, regardless of subtype. If you leave it as "default", then the default shippable status for the subtype will be used.

'''SQL Update'''

(Postgres and MySQL)

alter table product_product add column shipclass varchar(10) default 'DEFAULT';

(Sqlite)

alter table product_product add column shipclass varchar(10) null;
update product_product set shipclass='DEFAULT';

Downloadable Products File Field

Downloadable products now has a file field.

'''SQL Update''';

(Postgres)

alter table product_downloadableproduct add column "file" varchar(100) not null;

Drop Not Null on issue_num

Dropped not null constraint on payment_creditcarddetail in the database.

'''SQL Update''';

(Postgres)

alter table payment_creditcarddetail alter column issue_num drop not null;

Added Pricing Lookup

You must run syncdb and then

./manage.py satchmo_rebuild_pricing

Also, if you use expiring prices, you'll have to run the pricing rebuild command every day from a cron-job or something similar.

Added Day and Month Rebilling

In [1697], modified subscription products to allow for day (the current/default) or month periods.

'''SQL Update'''

Postgres

alter table product_subscriptionproduct add column "expire_unit" varchar(5) not null default 'DAY';
alter table product_subscriptionproduct rename column "expire_days" to expire_length;
alter table product_trial rename column "expire_days" to expire_length;

MySQL

alter table  `product_subscriptionproduct` change  `expire_days`  `expire_length` int(11) NULL DEFAULT NULL;
alter table  `product_trial` change  `expire_days`  `expire_length` int(11) NULL DEFAULT NULL;
alter table `product_subscriptionproduct` add column expire_unit varchar(5) not null default 'DAY';

Sqlite

alter table product_subscriptionproduct add column expire_unit varchar(5) null default 'DAY';
update product_subscriptionproduct set expire_unit='DAY';
alter table product_subscriptionproduct add column expire_length int(11) null;
update product_subscriptionproduct set expire_length=expire_days;
alter table product_trial add column expire_length int(11) null;
update product_trial set expire_length=expire_days;

Updated Satchmo Product JS

In [1719], I solidified the optionkey system for product pages.

Unless you've overridden the default satchmo_product.js or detail_configurableproduct.html, you won't have to do a thing. If you've copied it from satchmo/static/js/satchmo_product.js just copy it again and you'll be up to date.

If you have your own custom detail_configurableproduct.html, then you'll need to change this part:

satchmo.make_optionkey = function() {
    var k = Array({{options.count}});
    {% for option_group in options %}
    k[{{forloop.counter0}}] = $('#{{ option_group.id }}').fieldValue()[0];
    {% endfor %}
    return k.join('::');
};

and replace it with the simpler:

satchmo.set_option_ids([{% for option_group in options %}{{ option_group.id }}{% if not forloop.last %},{% endif %}{% endfor %}]);

Updated