Exemple #1
0
 public function onMainBodyTop(HookRenderEvent $event)
 {
     $css = $this->addCSS('assets/css/min.css');
     $event->add($css);
     $content = $this->render("main-body-top.html", ['mode' => $this->mode]);
     $event->add($content);
 }
 public function onMainBodyBottom(HookRenderEvent $event)
 {
     $options = array();
     switch ($this->getRequest()->get('_view')) {
         // Category page viewed
         case 'category':
             $categoryId = $this->getRequest()->get('category_id');
             $defaultCategory = CategoryQuery::create()->findPk($categoryId);
             $options[] = array('setEcommerceView', false, false, $defaultCategory->getTitle());
             break;
             // Product detail page viewed
         // Product detail page viewed
         case 'product':
             $productId = $this->getRequest()->getProductId();
             $product = ProductQuery::create()->findPk($productId);
             if ($defaultCategoryId = $product->getDefaultCategoryId()) {
                 $defaultCategory = CategoryQuery::create()->findPk($defaultCategoryId);
             }
             $options[] = array('setEcommerceView', $product->getRef() ? $product->getRef() : $product->getId(), $product->getTitle(), isset($defaultCategory) ? $defaultCategory->getTitle() : false, false);
             break;
     }
     if ($code = $this->generateTrackingCode($options)) {
         $event->add($code);
     }
 }
 public function onProductDeliveryDelay(HookRenderEvent $event)
 {
     $productId = $event->getArgument('product');
     $handler = new ProductDelayHandler();
     $delivery = $handler->getDelayForProduct($productId);
     $event->add($this->render('delivery-delay/product-delivery-delay.html', $delivery));
 }
Exemple #4
0
 /**
  * This function is called when hook uses the automatic insert template.
  *
  * @param HookRenderEvent $event
  * @param string $code
  */
 public function insertTemplate(HookRenderEvent $event, $code)
 {
     if (array_key_exists($code, $this->templates)) {
         $templates = explode(';', $this->templates[$code]);
         foreach ($templates as $template) {
             list($type, $filepath) = $this->getTemplateParams($template);
             if ("render" === $type) {
                 $event->add($this->render($filepath, $event->getArguments()));
                 continue;
             }
             if ("dump" === $type) {
                 $event->add($this->render($filepath));
                 continue;
             }
             if ("css" === $type) {
                 $event->add($this->addCSS($filepath));
                 continue;
             }
             if ("js" === $type) {
                 $event->add($this->addJS($filepath));
                 continue;
             }
             if (method_exists($this, $type)) {
                 $this->{$type}($filepath, $event->getArguments());
             }
         }
     }
 }
Exemple #5
0
 public function onMainHeadBottom(HookRenderEvent $event)
 {
     $value = trim(ConfigQuery::read("hookanalytics_trackingcode", ""));
     if ("" != $value) {
         $event->add($value);
     }
 }
 /**
  * @param HookRenderEvent $hookRender
  */
 public function onMainHeadBottom(HookRenderEvent $hookRender)
 {
     $event = new CanonicalUrlEvent();
     $this->eventDispatcher->dispatch(CanonicalUrlEvents::GENERATE_CANONICAL, $event);
     if ($event->getUrl()) {
         $hookRender->add('<link rel="canonical" href="' . $event->getUrl() . '" />');
     }
 }
Exemple #7
0
 public function onAccountOrderAfterProducts(HookRenderEvent $event)
 {
     $orderId = $event->getArgument('order');
     if (null !== $orderId) {
         $render = $this->render('account-order-after-products.html', ["order_id" => $orderId]);
         $event->add($render);
     }
 }
 public function onMainStylesheet(HookRenderEvent $event)
 {
     // Backup current template definition
     $backup = $this->getParser()->getTemplateDefinition();
     $this->getParser()->setTemplateDefinition(new TemplateDefinition("bo-css-module", TemplateDefinition::FRONT_OFFICE));
     $event->add($this->render("hook/stylesheet-renderer.html"));
     // then restore
     $this->getParser()->setTemplateDefinition($backup);
 }
 public function onModuleConfigure(HookRenderEvent $event)
 {
     $vars = [];
     if (null !== ($params = ModuleConfigQuery::create()->findByModuleId(ForcePhone::getModuleId()))) {
         /** @var ModuleConfig $param */
         foreach ($params as $param) {
             $vars[$param->getName()] = $param->getValue();
         }
     }
     $event->add($this->render('force-phone/module-configuration.html', $vars));
 }
Exemple #10
0
 public function onInvoiceAfterDeliveryModule(HookRenderEvent $event)
 {
     // No So Colissimo information if the delivery module is not SoColissimo
     if (SoColissimo::getModuleId() == $event->getArgument('module_id')) {
         return;
     }
     $order = OrderQuery::create()->findOneById($event->getArgument('order'));
     if (!is_null($order)) {
         $event->add($this->render('delivery_mode_infos.html', ['delivery_address_id' => $order->getDeliveryOrderAddressId()]));
     }
 }
 public function onTeamNavBar(HookRenderEvent $event)
 {
     $query = DealerTeamQuery::create();
     $joinPerson = new Join(DealerTeamTableMap::TEAM_ID, PersonTeamLinkTableMap::TEAM_ID, Criteria::LEFT_JOIN);
     $query->addJoinObject($joinPerson)->where(PersonTeamLinkTableMap::PERSON_ID . " " . Criteria::EQUAL . " " . $event->getArgument("person_id"));
     $dealer = $query->findOne();
     $args = $event->getArguments();
     if (null != $dealer) {
         $args["dealer_id"] = $dealer->getDealerId();
     }
     $event->add($this->render("includes/person-edit-link.html", $args));
 }
Exemple #12
0
 public function onMainBeforeContent(HookRenderEvent $event)
 {
     if ($this->securityContext->isGranted(["ADMIN"], [AdminResources::PRODUCT], [], [AccessManager::VIEW])) {
         $products = ProductQuery::create()->filterByVirtual(1)->filterByVisible(1)->count();
         if ($products > 0) {
             $deliveryModule = ModuleQuery::create()->retrieveVirtualProductDelivery();
             if (false === $deliveryModule) {
                 $event->add($this->render('virtual-delivery-warning.html'));
             }
         }
     }
 }
 public function onMainJavascriptInitialization(HookRenderEvent $event)
 {
     // First add moment and fullCalendar assets
     $langCode = strtolower($this->getLang()->getCode());
     $momentI18n = sprintf($this->getAssetPath(static::MOMENT_I18N_PATH), $langCode);
     $fullcalendarI18n = sprintf($this->getAssetPath(static::FULLCALENDAR_I18N_PATH), $langCode);
     $event->add($this->addJs($this->getAssetPath(static::MOMENT_JS_PATH)));
     if (is_file($momentI18n)) {
         $event->add($this->addJS($momentI18n));
     }
     $event->add($this->addJs($this->getAssetPath(static::FULLCALENDAR_JS_PATH)));
     if (is_file($fullcalendarI18n)) {
         $event->add($this->addJS($momentI18n));
     }
     // Then declare all the calendars to the script
     $calendarScripts = "<script>(function(\$) {\n";
     foreach ($this->smartyPlugin->getCalendars() as $calendarId => $options) {
         $calendarScripts .= sprintf("    \$(\"#%s\").fullCalendar(%s);\n", $calendarId, json_encode($options));
     }
     $calendarScripts .= "})(jQuery);</script>";
     $event->add($calendarScripts);
 }
Exemple #14
0
 public function onModuleConfigure(HookRenderEvent $event)
 {
     $logFilePath = sprintf(THELIA_ROOT . "log" . DS . "%s.log", Atos::MODULE_DOMAIN);
     $traces = @file_get_contents($logFilePath);
     if (false === $traces) {
         $traces = $this->translator->trans("The log file '%log' does not exists yet.", ['%log' => $logFilePath], Atos::MODULE_DOMAIN);
     } elseif (empty($traces)) {
         $traces = $this->translator->trans("The log file is currently empty.", [], Atos::MODULE_DOMAIN);
     }
     $vars = ['trace_content' => nl2br($traces)];
     if (null !== ($params = ModuleConfigQuery::create()->findByModuleId(Atos::getModuleId()))) {
         /** @var ModuleConfig $param */
         foreach ($params as $param) {
             $vars[$param->getName()] = $param->getValue();
         }
     }
     $event->add($this->render('atos/module-configuration.html', $vars));
 }
Exemple #15
0
 public function onModuleConfiguration(HookRenderEvent $event)
 {
     $module_id = self::getModule()->getModuleId();
     $event->add($this->render("module_configuration.html", ['module_id' => $module_id]));
 }
Exemple #16
0
 public function onMiniCart(HookRenderEvent $event)
 {
     $content = $this->render('mini-cart.html');
     $event->add($content);
 }
 public function onAccountUpdateAfterJSInclude(HookRenderEvent $event)
 {
     $event->add($this->addJS('assets/js/update.js'));
 }
 public function onOrderModuleTab(HookRenderEvent $event)
 {
     $event->add($this->render('dpdclassic-order-edit.html'));
 }
Exemple #19
0
 public function onAdditionalPaymentInfo(HookRenderEvent $event)
 {
     $content = $this->render("order-placed.additional-payment-info.html", ['placed_order_id' => $event->getArgument('placed_order_id')]);
     $event->add($content);
 }
 public function orderInvoiceForm(HookRenderEvent $event)
 {
     $event->add($this->render("order-invoice-form.html"));
 }
Exemple #21
0
 public function onMainFooterBottom(HookRenderEvent $event)
 {
     $bottomConfig = HookNavigation::getConfigValue(HookNavigationConfigValue::FOOTER_BOTTOM_FOLDER_ID);
     $content = $this->render('main-footer-bottom.html', ['bottomFolderId' => $bottomConfig]);
     $event->add($content);
 }
Exemple #22
0
 public function onMainNavbarSecondary(HookRenderEvent $event)
 {
     $content = $this->render("main-navbar-secondary.html");
     $event->add($content);
 }
 public function onCategoryEditJs(HookRenderEvent $event)
 {
     $event->add($this->render('criteria-search/category/category-edit-js.html'));
 }
 /**
  * Javascript for extra form fields.
  * @param HookRenderEvent $event
  */
 public function onRegisterAfterJSInclude(HookRenderEvent $event)
 {
     $event->add($this->addJS('assets/js/register.js'));
 }
 public function onCriteriaSearchSearchJs(HookRenderEvent $event)
 {
     $event->add($this->render('criteria-search/search-js.html'));
 }
Exemple #26
0
 /**
  * Add the front-office stylesheets.
  * @param HookRenderEvent $event
  */
 public function onMainStylesheet(HookRenderEvent $event)
 {
     $event->add($this->addCSS('assets/less/pop-in.less', [], 'less'));
 }
 /**
  * Insert the product edition page javascript.
  *
  * @param HookRenderEvent $event
  */
 public function onProductEditJs(HookRenderEvent $event)
 {
     $event->add($this->addJS('assets/js/product-edit.js'));
 }
Exemple #28
0
 public function onMainContentTopOverriding(HookRenderEvent $event)
 {
     $event->add($this->render("override1.html"));
     // redefined in template hooktest in the module
     $event->add($this->render("override2.html"));
     // redefined in template hooktest
     $event->add($this->render("override3.html"));
     $event->add($this->render("override-assets.html"));
 }
Exemple #29
0
 public function insertJSSelectCity(HookRenderEvent $event)
 {
     $event->add($this->addJS("form/select-city.js"));
 }
Exemple #30
0
 public function onHomeBody(HookRenderEvent $event)
 {
     $event->add($this->render('carousel.html'));
 }