PHP 5 e-commerce Development- P56 pptx

5 44 0
PHP 5 e-commerce Development- P56 pptx

Đang tải... (xem toàn văn)

Thông tin tài liệu

This material is copyright and is licensed for the sole use by jackie tracey on 23rd February 2010 953 Quincy Drive, , Brick, , 08724 Administration Although our journey through creating an e-commerce framework is not yet at an end, we are at the last primary feature: the administration area. In this chapter, you will learn how to enable administrators to: Create a product, taking into account photographs and shipping Edit a product Create, edit, and manage categories View and process orders View customer proles View and create shipping methods and their corresponding rules Create voucher codes A suitable administration area can be broken down into four primary areas: A dashboard: This area is used to provide administrators with a brief overview of the store at any one time. Products and categories: This area is used to allow administrators to view, create, edit, and delete products and categories. Orders and customers: This area is used to allow administrators to view and process orders, as well as view customer proles. Miscellaneous: This area could be used as somewhere for administrators to change any settings, manage shipping methods, shipping rules, and voucher codes. • • • • • • • • • • • This material is copyright and is licensed for the sole use by jackie tracey on 23rd February 2010 953 Quincy Drive, , Brick, , 08724 Administration [ 260 ] Dashboard The dashboard should provide the administrator with an overview of the store; this could include statistics such as: The number of products and the number of categories they are contained within The number of customers The number of orders that are awaiting dispatch (that is, orders that the administrator needs to process) Number of orders placed within the past 24 hours The number of abandoned shopping baskets in the past 24 hours The average cost of orders Graphs and charts illustrating some of these statistics Let's start with the basic statistics; we can generate most of the statistics from a query, breaking the individual statistics into subqueries. $ts = date('Y-m-d h:i:s', strtotime('-1 day')); $sql = "SELECT (SELECT COUNT(*) FROM content c, content_types t WHERE c.type=t.ID AND t.reference='product') AS num_products, (SELECT COUNT(*) FROM users) AS num_customers, (SELECT COUNT(*) FROM orders o, order_statuses os WHERE o.status=os.ID AND os.name='Awaiting Dispatch') AS num_orders_pending_dispatch, (SELECT COUNT(*) FROM orders o, order_statuses os WHERE o.status=os.ID AND os.name='Awaiting payment') AS num_orders_pending_payment, (SELECT COUNT(*) FROM orders o WHERE o.timestamp>'{$ts}') AS num_orders_placed_24, (SELECT FORMAT(AVG(products_cost),2) FROM orders) AS avg_order_cost FROM orders o LIMIT 1"; • • • • • • • This material is copyright and is licensed for the sole use by jackie tracey on 23rd February 2010 953 Quincy Drive, , Brick, , 08724 Chapter 13 [ 261 ] A sample dashboard screen is shown below: We could extend and enhance this by adding some of the following: Support for logging abandoned shopping baskets Graphs and charts Of these, the latter could probably be added using the Google Charts API or an alternative suitable third-party chart service. Products and categories For us to be able to sell anything on our site, we need to allow administrators to create products in the store. We also need to be able to edit and delete products, as well as create, edit, and delete categories. Products Let's look at how we can allow administrators to create, edit, and delete products within our store. Creating a product To create a product in our store, we need to: Save standard information about the product such as the price, the name, the description, and so on. Upload, resize, and save a photograph of the product. Upload additional photographs of the product. • • • • • This material is copyright and is licensed for the sole use by jackie tracey on 23rd February 2010 953 Quincy Drive, , Brick, , 08724 Administration [ 262 ] Save a shipping cost to be associated with the product, for each shipping method we have in the store. Save the categories the product is part of. Save any conguration options, such as if the customer can upload a le when placing the order, if the customer can enter any custom text, if the product has a number of variants, particularly for apparel, for example red, blue, and green t-shirts. A form such as the partial one below captures the relevant information: Product photograph When processing the create product form submission, we need to upload a photograph and resize it to have a thumbnail and to keep the larger image consistently sized. Photograph resizing with PHP When resizing images with PHP, we need to use the function imagecreateresampled as opposed to imagecreateresized. If we use the latter, we will end up with distorted images. • • • This material is copyright and is licensed for the sole use by jackie tracey on 23rd February 2010 953 Quincy Drive, , Brick, , 08724 . the sole use by jackie tracey on 23rd February 2010 953 Quincy Drive, , Brick, , 08724 Administration Although our journey through creating an e-commerce framework is not yet at an end, we are. thumbnail and to keep the larger image consistently sized. Photograph resizing with PHP When resizing images with PHP, we need to use the function imagecreateresampled as opposed to imagecreateresized material is copyright and is licensed for the sole use by jackie tracey on 23rd February 2010 953 Quincy Drive, , Brick, , 08724 Chapter 13 [ 261 ] A sample dashboard screen is shown below: We

Ngày đăng: 07/07/2014, 10:20

Mục lục

  • PHP e-commerce

    • e-commerce: who, what, where, why?

      • An overview of e-commerce

        • eBay

        • Brick 'N Mortar stores

        • Rolling out your own framework

          • Why PHP?

          • When to use an existing package?

            • Existing products

            • A look at e-commerce sites

              • iStockphoto

              • e-commerce: what does it need to do/have?

                • Products

                • Our framework: what is it going to do?

                • Our framework: why is it going to do it?

                  • Juniper Theatricals

                  • Planning our Framework

                    • Designing a killer framework

                      • Patterns

                        • Model-View-Controller (MVC)

                        • Building a killer framework

                          • Pattern implementation

                            • MVC

                            • Routing requests

                              • An alternative: with a router

                              • Processing the incoming URL within our registry object

                              • What about e-commerce?

                                • An e-commerce registry?

                                • Products and Categories

                                  • What we need

                                    • Product information

                                    • Structuring content within our framework

                                      • Pages

                                      • Building products, categories, and content functionality into our framework

                                        • Database

                                          • Content

                                          • Pages within our framework

                                            • Model

                                            • Product and category images

                                            • Routing products and categories

                                              • Featured products

                                              • Product Variations and User Uploads

                                                • Giving users choice

                                                  • Simple variants

                                                    • How could this work?

Tài liệu cùng người dùng

  • Đang cập nhật ...

Tài liệu liên quan