fast framework Help

E-Commerce

getting started

depending on the requirements of the project, we need the following plugins to implement an e-commerce website

plugin

purpose

required

ffItem

items to buy

x

ffCart

collects items and their quantities

x

ffCheckout

makes sure system has all necessary data for placing order

x

ffUserArea

stores user's data for recurring visits

x

ffOrders

stores orders and enables back-office

x

ffPayment

implements a payment provider

-

ffPhpMailer

handles confirmation mails more reliably

-

ffGlobalize

formatting of currency for different locales

-

ffGoogleAnalytics

analytics

-

ffPiwik

analytics

-

ffGeoIP

better detection of a user's region for analytics

-

ffCookieConsent

gdpr-compliant cookie consent banner

-

Example: The fashion shop

In this tutorial we will create a simple online store.
We will cover the main aspects of a ff based e-commerce website.

In the first step we will do the basic setup.

prerequisites

When implementing an e-commerce project, it is good practice to first extend the used objects with prefixed ones.
We call this approach "poor man's namespace"-pattern:
To instantiate an object, we can still call ffItem::getInstance().
If called from within an already namespaced object (like nsPresenter), this will still return an instance of our custom nsItem object.

Project-specific custom logic can then be implemented in those classes.

File plugins/myProject/classes/nsItem.php

nsItem extends ffItem{}

File plugins/myProject/classes/nsCart.php

nsCart extends ffCart{}

File plugins/myProject/classes/nsOrder.php

nsOrder extends ffOrder{}

File plugins/myProject/classes/nsCheckout.php

nsCheckout extends ffCheckout{}

for API calls we extend the default listeners and code against those.

File plugins/myProject/classes/nsCartListener.php

nsCartListener extends ffCartListener{}

We create the structure for the shop

Project | +-- content | | | +-- items | | | +-- shirts | | | +-- tshirt | | | +-- collarshirt

We're now ready to define the Items, that we want to sell

28 März 2024