Prev | Current Page 453 | Next

Emilian Balanescu and Cristian Darie

"Beginning PHP and MySQL E-Commerce: From Novice to Professional, Second Edition"

tpl:
{* Add the submit button and close the form *}





{* Show edit button for administrators *}
{if $obj->mShowEditButton}
method="post" class="edit-form">





{/if}
{if $obj->mLinkToContinueShopping}
Continue Shopping
{/if}
7. Add these members to the Product class in presentation/product.php:
// Handles product details
class Product
{
// Public variables to be used in Smarty template
public $mProduct;
public $mProductLocations;
public $mLinkToContinueShopping;
public $mLocations;
public $mEditActionTarget;
public $mShowEditButton;
CHAPTER 11 ?–  CATALOG ADMINISTRATION: PRODUCTS AND ATTRIBUTES 354
8. Add this code at the end of the constructor of the Product class, in presentation/product.php. This
code ensures the Edit button shows up only if the user is an administrator:
else
trigger_error('ProductId not set');
// Show Edit button for administrators
if (!(isset ($_SESSION['admin_logged'])) ||
$_SESSION['admin_logged'] != true)
$this->mShowEditButton = false;
else
$this->mShowEditButton = true;
}
9. In the same file, add the highlighted piece of code at the end of the init() method of the Product class.


Pages:
441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465
Kalkulator kredytowy zakłady bukmacherskie ziemme.bizor.pl ścianki biurowe baseny ogrodowe