Modify the init() method of the StoreAdmin class located in presentation/store_admin.php, to
load the newly added componentized templates:
// Choose what admin page to load ...
if ($admin_page == 'Departments')
$this->mContentsCell = 'admin_departments.tpl';
elseif ($admin_page == 'Categories')
$this->mContentsCell = 'admin_categories.tpl';
6. Use phpMyAdmin to execute the following code, which creates the data tier stored procedures into your
tshirtshop database. Don??™t forget to set $$ as the delimiter.
-- Create catalog_get_department_categories stored procedure
CREATE PROCEDURE catalog_get_department_categories(IN inDepartmentId INT)
BEGIN
SELECT category_id, name, description
FROM category
WHERE department_id = inDepartmentId
ORDER BY category_id;
END$$
-- Create catalog_add_category stored procedure
CREATE PROCEDURE catalog_add_category(IN inDepartmentId INT,
IN inName VARCHAR(100), IN inDescription VARCHAR(1000))
BEGIN
INSERT INTO category (department_id, name, description)
VALUES (inDepartmentId, inName, inDescription);
END$$
CHAPTER 10 ?– CATALOG ADMINISTRATION: DEPARTMENTS AND CATEGORIES 302
-- Create catalog_update_category stored procedure
CREATE PROCEDURE catalog_update_category(IN inCategoryId INT,
IN inName VARCHAR(100), IN inDescription VARCHAR(1000))
BEGIN
UPDATE category
SET name = inName, description = inDescription
WHERE category_id = inCategoryId;
END$$
-- Create catalog_delete_category stored procedure
CREATE PROCEDURE catalog_delete_category(IN inCategoryId INT)
BEGIN
DECLARE productCategoryRowsCount INT;
SELECT count(*)
FROM product p
INNER JOIN product_category pc
ON p.
Pages:
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421