--- /dev/null
+<?php\r
+\r
+\r
+class Fluidbook_Coupon {\r
+ protected static $_coupons = array('PROMO15000' => array('discount' => '-30%', 'from_date' => '10/01/2017', 'to_date' => '31/01/2017'));\r
+\r
+ protected static function _getCoupon() {\r
+ $session = Bootstrap::getInstance()->getSession();\r
+ // Check coupon code\r
+ if (isset($session->coupon) && isset(self::$_coupons[$session->coupon])) {\r
+ $c = self::$_coupons[$session->coupon];\r
+ // Check dates\r
+ $now = CubeIT_Date::now();\r
+ $from = new CubeIT_Date($c['from_date'], CubeIT_Date::DAY . '/' . CubeIT_Date::MONTH . '/' . CubeIT_Date::YEAR);\r
+ if ($now->isEarlier($from)) {\r
+ return false;\r
+ }\r
+ $to = new CubeIT_Date($c['to_date'], CubeIT_Date::DAY . '/' . CubeIT_Date::MONTH . '/' . CubeIT_Date::YEAR);\r
+ if ($now->isLater($to)) {\r
+ return false;\r
+ }\r
+ return array('code' => $session->coupon, 'discount' => $c['discount']);\r
+ }\r
+\r
+ return false;\r
+ }\r
+\r
+ public static function getCouponCode() {\r
+ $c = self::_getCoupon();\r
+ if ($c === false) {\r
+ return false;\r
+ }\r
+ return $c['code'];\r
+ }\r
+\r
+ public static function getCouponDiscount() {\r
+ $c = self::_getCoupon();\r
+ if ($c === false) {\r
+ return false;\r
+ }\r
+ return $c['discount'];\r
+ }\r
+}
\ No newline at end of file
$res = array();\r
\r
$res[] = $this->linkInternal(null, 'internal:agences',array('class'=>'agencies'));\r
- $res[] = $this->linkQuote(__('Demandez un devis'));\r
+ $res[] = $this->linkQuote(__('Demandez un devis'),'',true);\r
\r
return $this->htmlElement($this->listUnordered($res), 'nav', array('id' => 'contactnav', 'role' => 'navigation'));\r
}\r
/**\r
* @return string\r
*/\r
- public function linkQuote($label, $style = '') {\r
+ public function linkQuote($label, $style = '', $header = false) {\r
$this->headScript()->addScriptAndStyle('005-fancyselect');\r
$this->headScript()->addScriptAndStyle('315-quote');\r
+\r
+ $attrs = ['data-popup-href' => '/ajaxPopup/quoteForm',\r
+ 'class' => 'quoteLink',\r
+ 'data-event' => [\r
+ 'category' => 'form',\r
+ 'action' => 'open',\r
+ 'label' => 'quote'\r
+ ],\r
+ 'style' => $style\r
+ ];\r
+\r
+ if ($header) {\r
+ $discount = Fluidbook_Coupon::getCouponDiscount();\r
+ if ($discount) {\r
+ $label .= $this->htmlElement(str_replace('%', '<sup>%</sup>', $discount), 'div', array('class' => 'macaron'));\r
+ }\r
+ }\r
+\r
return $this->linkPopup($label,\r
- 'internal:contact',\r
- ['data-popup-href' => '/ajaxPopup/quoteForm',\r
- 'class' => 'quoteLink',\r
- 'data-event' => [\r
- 'category' => 'form',\r
- 'action' => 'open',\r
- 'label' => 'quote'\r
- ],\r
- 'style' => $style\r
- ]);\r
+ 'internal:contact',\r
+ $attrs);\r
}\r
}
\ No newline at end of file
@media @m640 {\r
display: none;\r
}\r
+\r
+ position: relative;\r
}\r
&.agencies {\r
.border-button-fill(@color-header-grey, #c2c4c7, 5%);\r
}\r
}\r
\r
+.macaron {\r
+ box-sizing: border-box;\r
+ display: inline-block;\r
+ position: absolute;\r
+ top: -22px;\r
+ right: -25px;\r
+ width: 45px;\r
+ height: 45px;\r
+ border-radius: 50%;\r
+ background-color: #f7807e;\r
+ color: #fff;\r
+ font-family: "Times New Roman", "Times", serif;\r
+ font-size: 19px;\r
+ text-align: center;\r
+ padding-top: 13px;\r
+ sup {\r
+ font-size: 50%;\r
+ }\r
+ z-index: 1;\r
+\r
+ @media @m1024 {\r
+ width: 35px;\r
+ height: 35px;\r
+ font-size: 17px;\r
+ padding-top: 8px;\r
+ top: -12px;\r
+ right: -18px;\r
+ line-height:17px;\r
+ }\r
+\r
+ @media @m640 {\r
+ position: absolute;\r
+ top: 12px;\r
+ right: auto;\r
+ margin-left:20px;\r
+ padding-top:6px;\r
+ }\r
+}\r
+\r
#nav-icon {\r
width: 31px;\r
height: 26px;\r