public function printAction() { $fullPath = $this->getFullPath(); $products = new Catalog_Model_Mapper_Products(); $product = new Catalog_Model_Products(); $product = $products->findByFulPath($fullPath, $product); if (is_null($product)) { throw new Zend_Controller_Action_Exception("Страница не найдена", 404); } $subproducts = new Catalog_Model_Mapper_Subproducts(); $select = $subproducts->getDbTable()->select()->where('deleted != ?', 1)->order('order ASC'); $modifications = $products->findSubproductsRel($product->getId(), $select); $tableModifications = array(); $headTable = array(); if (!empty($modifications)) { $subproductParams = new Catalog_Model_Mapper_SubproductParams(); $select = $subproductParams->getDbTable()->select()->order('order ASC'); $subproductProperty = $products->findSubproductParams($product->getId(), $select); $headTable[] = 'Название'; foreach ($subproductProperty as $property) { $headTable[] = $property->name; } $tableModifications = $this->modificationsTableValues($modifications); array_unshift($tableModifications, $headTable); } //print_r(count(array_shift($tableModifications))-1); $pdf = new Catalog_Model_PrintPdf(); // set document information $pdf->SetAuthor('Альфа Гидро'); $pdf->SetTitle($this->transformSku($product->getSku()) . '. ' . $product->getName()); $pdf->SetSubject($this->transformSku($product->getSku()) . '. ' . $product->getName()); $pdf->SetKeywords($this->transformSku($product->getSku()) . ', ' . $product->getName()); $pdf->SetFont('', '', 12, '', true); $pdf->setProduct($product); // Add a page $pdf->AddPage(); $pdf->showImages()->showProperty()->showDescription()->showModificatonTable($tableModifications); $pdf->Output(); $this->getResponse()->setHeader('Content-Type', 'application/pdf'); $this->_helper->layout()->disableLayout(); }