Create the presentation/admin_product_details.php presentation object, and add the following in
it:
// Class that deals with product administration
class AdminProductDetails
{
// Public attributes
public $mProduct;
public $mErrorMessage;
public $mProductCategoriesString;
public $mProductDisplayOptions;
public $mProductAttributes;
public $mCatalogAttributes;
public $mAssignOrMoveTo;
public $mRemoveFromCategories;
public $mRemoveFromCategoryButtonDisabled = false;
public $mLinkToCategoryProductsAdmin;
public $mLinkToProductDetailsAdmin;
// Private attributes
private $_mProductId;
private $_mCategoryId;
private $_mDepartmentId;
// Class constructor
public function __construct()
{
// Need to have DepartmentId in the query string
if (!isset ($_GET['DepartmentId']))
trigger_error('DepartmentId not set');
else
$this->_mDepartmentId = (int)$_GET['DepartmentId'];
// Need to have CategoryId in the query string
if (!isset ($_GET['CategoryId']))
trigger_error('CategoryId not set');
CHAPTER 11 ?– CATALOG ADMINISTRATION: PRODUCTS AND ATTRIBUTES 333
else
$this->_mCategoryId = (int)$_GET['CategoryId'];
// Need to have ProductId in the query string
if (!isset ($_GET['ProductId']))
trigger_error('ProductId not set');
else
$this->_mProductId = (int)$_GET['ProductId'];
$this->mProductDisplayOptions = Catalog::$mProductDisplayOptions;
$this->mLinkToCategoryProductsAdmin =
Link::ToCategoryProductsAdmin($this->_mDepartmentId, $this->_mCategoryId);
$this->mLinkToProductDetailsAdmin =
Link::ToProductAdmin($this->_mDepartmentId,
$this->_mCategoryId,
$this->_mProductId);
}
public function init()
{
// If uploading a product picture .
Pages:
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446