*/ /** * Klasa stCeneoFrontnedComponents * * @package stCeneoPlugin * @subpackage actions */ class stCeneoFrontendComponents extends sfComponents { /** * Wyświetlanie zaufanych opini */ public function executeTrustedOpinion() { $this->smarty = new stSmarty('stCeneoFrontend'); $this->hasTrustedOpinion = false; $config = stConfig::getInstance(sfContext::getInstance(), 'stCeneoBackend'); $this->trustedOpinionId = $config->get('trusted_opinion_id'); $this->showTransactionSystem = $config->get('transaction_system_on'); $this->trustedOpinionNewType = true; if (strlen($this->trustedOpinionId) < 15) $this->trustedOpinionNewType = false; if ($config->get('trusted_opinion_on') == 1 && !empty($this->trustedOpinionId)) { if ($this->getRequest()->hasParameter('id') && $this->getRequest()->hasParameter('hash_code')) { $id = $this->getRequestParameter('id'); $hashCode = $this->getRequestParameter('hash_code'); $order = OrderPeer::retrieveByIdAndHashCode($id, $hashCode); $this->email = $order->getGuardUser()->getUsername(); if (!$order->getShowOpinion()) $this->email = ''; $this->orderId = $order->getNumber(); $this->orderAmount = number_format($order->getTotalAmount(true), 2, '.', ''); $c = new Criteria(); $c->add(OrderProductPeer::ORDER_ID, $order->getId()); $products = OrderProductPeer::doSelect($c); $this->productIds = ''; foreach ($products as $product) { for ($i = 1; $i<= $product->getQuantity(); $i++) { $this->productIds.= '#'.$product->getProductId(); } } $this->hasTrustedOpinion = true; } } stEventDispatcher::getInstance()->notify(new sfEvent($this, 'stCeneoPlugin.postTrustedOpinionNotify', array())); if ($this->hasTrustedOpinion == false) return sfView::NONE; } }