Prev | Current Page 455 | Next

Emilian Balanescu and Cristian Darie

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

product_id}" />


{/if}

{if $smarty.section.k.index % 2 != 0 && !$smarty.section.k.first ||
$smarty.section.k.last}

{/if}
{/section}
11. Open presentation/products_list.php, and add the following members to the ProductsList class:
public $mAllWords = 'off';
public $mSearchString;
public $mEditActionTarget;
public $mShowEditButton;
// Private members
private $_mDepartmentId;
private $_mCategoryId;
12. Add the following piece of code to the end of the __construct() method of the ProductsList class:
if ($this->mPage < 1)
trigger_error('Incorrect Page value');
// Save page request for continue shopping functionality
$_SESSION['link_to_continue_shopping'] = $_SERVER['QUERY_STRING'];
CHAPTER 11 ?–  CATALOG ADMINISTRATION: PRODUCTS AND ATTRIBUTES 356
// Show Edit button for administrators
if (!(isset ($_SESSION['admin_logged'])) ||
$_SESSION['admin_logged'] != true)
$this->mShowEditButton = false;
else
$this->mShowEditButton = true;
}
13. Also in presentation/products_list.php, add the following piece of code at the beginning of the
init() method of ProductsList:
public function init()
{
// Prepare the Edit button
$this->mEditActionTarget =
Link::Build(str_replace(VIRTUAL_LOCATION, '', getenv('REQUEST_URI')));
if (isset ($_SESSION['admin_logged']) &&
$_SESSION['admin_logged'] == true &&
isset ($_POST['product_id']))
{
if (isset ($this->_mDepartmentId) && isset ($this->_mCategoryId))
header('Location: ' .


Pages:
443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467
Apartamenty Świnoujście noclegi hel Lokaty jednodniowe projekty domków letniskowych męskie skarpetki rowerowe