Let's ecommerce together and feel Plone right

Post on 23-Jan-2015

795 views 0 download

description

My presentation of an e-commerce solution at the latest Plone conference.

Transcript of Let's ecommerce together and feel Plone right

Let’s ecommerce together and feel Plone right

One Love!One Heart!Let's get together and feel all right.Hear the children cryin'(One Love! );Hear the children cryin'(One Heart! ),Sayin': give thanks and praiseTo the Lord and I will feel all right;Sayin': let's get togetherAnd feel all right.Wo wo-wo wo-wo!

Let them all pass all their dirtyRemarks (One Love! );There is one questionI'd really love to ask (One Heart! ):Is there a place for the hopeless sinner,Who has hurt all mankind justTo save his own beliefs?

One Love! What about the one heart?One Heart!What about?Let's get together and feel all rightAs it was in the beginning(One Love! );So shall it be in the end(One Heart! ),All right!Give thanks and praise to the LordAnd I will feel all right;Let's get togetherAnd feel all right.One more thing!

Let's get together to fightThis Holy Armagiddyon (One Love! ),So when the Man comes there will be no,No doom (One Song! ).Have pity on those whoseChances grows t'inner;There ain't no hiding placeFrom the Father of Creation.

Sayin': One Love!What about the One Heart?(One Heart! )What about the?Let's get together and feel all right.I'm pleadin' to mankind!(One Love! );Oh, Lord!(One Heart)Wo-ooh!

Give thanks and praise to the LordAnd I will feel all right;Let's get together and feel all right.Give thanks and praise to the LordAnd I will feel all right;Let's get together and feel all right.

Alessandro Pisa - 2012/10/12 - Arnhem Plone Conference 2012

Software Integrator

alessandro.pisa@redturtle.ithttp://blog.redturtle.it@ale_pisa

Alessandro Pisa

What you will see

✔ The use case✔ Problems ☹✔ Solutions ☺

✔ Additional slides

Some quotes you will not be able to read and/or understand

The customer

HAS✔ financial tools✔ lots of data

The customer

WANTS✔ to make profit with them✔ security✔ to start first with one site, but...✔ ... two at the end

The customer

NEEDS

And Plone it was!

http://www.icribis.com

Plone role:✔the shop

✔ subscriptions✔ docs✔ reports

✔interface✔customer dashboard✔customer management✔subscription management

http://www.icribis.com

Search for company

Retrieve company informations✔ reports => (free with subscriptions)✔ documents

Search + results

Reports

Documents

Extract from a report

✔ Two kind of users✔ Complex profile✔ First login:

✔ Registration✔ Policy change✔ Email change

✔ Dashboard✔ Backend management✔ Shared user base (?)

Members: problems

✔ Backend: Archetype✔ Products.Membrane (customers)

✔ Frontend: formlib✔ Registration (full, light)

✔ contextual purchase✔ demo & bonuses

✔ User dashboard✔ Policy/email changes

✔ Security Manager

Members: solutions

Register:✔ on one site✔ available in the other

Huge work:✔ login✔ registration✔ catalog...

Shared members

Register:✔ on one site✔ available in the other

Data split in ZODB and SQLProducts.Archetypes.Storage.StorageLayer

Huge work:✔ login✔ registration✔ catalog...

Shared members

Shared user base: First ZODBThen ZODB (per site) + SQL (shared)

SQL FieldsProducts.Archetypes.Storage.StorageLayercaching!

Members: solutions

Lesson learned

http://www.addletters.com/bart-simpson-generator.htm

Authentication

User data

Policy

Authentication

Personal data

Policy

Account informations

Purchase management

Customer care

Account information

Purchase management

Customer care

Behind the curtains

Another hero - another mindless crime

Export

Search

Results

Legend

Fight for your right

The things you own end up owning you

from zope.schema import ValidationError

class NotMyEmailError(ValidationError): """email has to be alessandro.pisa@redturtle.it! """

def is_my_email(value): if value!='alessandro.pisa@redturtle.it': raise NotMyEmailError else: return True

Validation: formlib

from Products.validation.interfaces.IValidator import IValidatorfrom Products.validation import validationfrom my.custom.product import is_my_email

class FormlibValidatorWrapper(object): implements(IValidator) def __init__(self, validator): self.validator = validator self.name = validator.func_name

def __call__(self, value, *args, **kwargs): try: self.validator(value) except ValidationError, error: return error.doc()

validation.register(FormlibValidatorWrapper(is_my_email))

Validation: Archetype

More on formlib tips

from plone.app.users.browser.personalpreferences import UserDataPanelAdapter

class EnhancedUserDataPanelAdapter(UserDataPanelAdapter): def get_firstname(self): return self.context.getProperty('firstname', '') def set_firstname(self, value): return self.context.setMemberProperties({'firstname': value}) firstname = property(get_firstname, set_firstname)

def get_lastname(self): return self.context.getProperty('lastname', '') def set_lastname(self, value): return self.context.setMemberProperties({'lastname': value}) lastname = property(get_lastname, set_lastname)

Properties

http://svn.plone.org/svn/collective/collective.examples.userdata

Welcome to the machine

Look up to the sky! You'll never find rainbows if you're looking down

class ManageUserReportsAdapter(object): report1_sub_month = ReportProperty('report1', 'sub_month') report1_sub_year = ReportProperty('report1', 'sub_year') report1_sub_bonus = ReportProperty('report1', 'sub_bonus') report1_sub_total = ReportProperty('report1', 'sub_total') report1_res_month = ReportProperty('report1', 'res_month') report1_res_year = ReportProperty('report1', 'res_year') report1_res_bonus = ReportProperty('report1', 'res_bonus') report1_res_total = ReportProperty('report1', 'res_total')

Uber-Properties in action

class ReportProperty(property): @staticmethod def report_getter(report_type, duration): def getter(self): return self.reports.get(report_type, {}).get(duration, 0) return getter

@staticmethod def report_setter(report_type, duration): def setter(self, value): self.reports[report_type][duration] = value return setter

def __init__(self, type, duration): doc = "Property for %s %s" % (type, duration) super(ReportProperty, self).__init__(self.report_getter(type, duration), self.report_setter(type, duration), doc=doc)

Uber-Properties

✔ memberdata✔ property sheets✔ registry✔ anything...

Can be handy also for

Lesson learned

http://www.addletters.com/bart-simpson-generator.htm

Thank you

Thank you

thank you silence