Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /**
- * Product catalog
- *
- * @version 1.0
- * @package samples
- * @subpackage tutor
- * @author Pablo Dall'Oglio
- * @copyright Copyright (c) 2006-2014 Adianti Solutions Ltd. (http://www.adianti.com.br)
- * @license http://www.adianti.com.br/framework-license
- */
- class ProductCatalogView extends TPage
- {
- /**
- * Constructor method
- */
- public function __construct()
- {
- parent::__construct();
- // load the styles
- TPage::include_css('app/resources/catalog.css');
- // create the HTML Renderer
- $this->html = new THtmlRenderer('app/resources/catalog.html');
- // define replacements for the main section
- $replace = array();
- $this->html->enableSection('main', $replace);
- try
- {
- // load the products
- TTransaction::open('samples');
- $criteria = new TCriteria;
- $criteria->add(new TFilter('photo_path', '<>', ''));
- $products = Product::getObjects($criteria);
- TTransaction::close();
- $replace_detail = array();
- if ($products)
- {
- // iterate products
- foreach ($products as $product)
- {
- $replace_detail[] = $product->toArray(); // array of replacements
- }
- }
- // enable products section as repeatable
- $this->html->enableSection('products', $replace_detail, TRUE);
- // wrap the page content using vertical box
- $vbox = new TVBox;
- $vbox->add(new TXMLBreadCrumb('menu.xml', __CLASS__));
- $vbox->add($this->html);
- $this->html->enableSection('manage');
- parent::add($vbox);
- }
- catch (Exception $e)
- {
- new TMessage('error', $e->getMessage());
- }
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement