modules/QSL/PopupAnywhere/src/Model/Popup.php line 20

Open in your IDE?
  1. <?php
  2. /**
  3.  * Copyright (c) 2011-present Qualiteam software Ltd. All rights reserved.
  4.  * See https://www.x-cart.com/license-agreement.html for license details.
  5.  */
  6. namespace QSL\PopupAnywhere\Model;
  7. use Doctrine\ORM\Mapping as ORM;
  8. use QSL\PopupAnywhere\View\FormField\PixelOrPercent;
  9. use QSL\PopupAnywhere\View\FormField\Select\AbsolutePixelOrPercent;
  10. /**
  11.  * Popup model.
  12.  *
  13.  * @ORM\Entity (repositoryClass="\QSL\PopupAnywhere\Model\Repo\Popup")
  14.  * @ORM\Table  (name="anywhere_popups")
  15.  */
  16. class Popup extends \XLite\Model\Base\I18n
  17. {
  18.     public const TYPE_CUSTOM           'Custom';
  19.     public const TYPE_TEMPLATE         'Template';
  20.     public const TYPE_BAR_MESSAGE      'NotificationBar';
  21.     public const TYPE_BAR_CART         'MinicartBar';
  22.     public const TYPE_POPUP_NEWSLETTER 'Subscription';
  23.     public const TYPE_POPUP_FACEBOOK   'SocialPlugin';
  24.     public const DISPLAY_ON_LOAD  0;
  25.     public const DISPLAY_ON_CLICK 1;
  26.     public const DISPLAY_ONCE     2;
  27.     public const DISPLAY_ON_EXIT  3;
  28.     public const LOCATION_CENTER       'center';
  29.     public const LOCATION_TOP          'top';
  30.     public const LOCATION_BOTTOM       'bottom';
  31.     public const LOCATION_LEFT_TOP     'left_top_corner';
  32.     public const LOCATION_LEFT_BOTTOM  'left_bottom_corner';
  33.     public const LOCATION_RIGHT_TOP    'right_top_corner';
  34.     public const LOCATION_RIGHT_BOTTOM 'right_bottom_corner';
  35.     public const ANIMATION_NONE  0;
  36.     public const ANIMATION_FADE  1;
  37.     public const ANIMATION_SLIDE 2;
  38.     public const USERS_ALL        0;
  39.     public const USERS_GUESTS     1;
  40.     public const USERS_REGISTERED 2;
  41.     public const TYPE_PERCENT  '%';
  42.     public const TYPE_ABSOLUTE 'px';
  43.     /**
  44.      * Entity identifier.
  45.      *
  46.      * @var integer
  47.      *
  48.      * @ORM\Id
  49.      * @ORM\GeneratedValue (strategy="AUTO")
  50.      * @ORM\Column         (type="integer", options={ "unsigned": true })
  51.      */
  52.     protected $popup_id;
  53.     /**
  54.      * Whether it is enabled, or not.
  55.      *
  56.      * @var boolean
  57.      *
  58.      * @ORM\Column (type="boolean", options={ "default": 0 })
  59.      */
  60.     protected $enabled false;
  61.     /**
  62.      * Priority. The entity with the highest priority is selected when displaying a popup to the customer.
  63.      *
  64.      * @var integer
  65.      *
  66.      * @ORM\Column (type="integer", options={ "default": 0 })
  67.      */
  68.     protected $position 0;
  69.     /**
  70.      * Class that handles methods specific for the popup type.
  71.      *
  72.      * @var string
  73.      *
  74.      * @ORM\Column (type="string", length=255, options={ "default": "" })
  75.      */
  76.     protected $popupType self::TYPE_CUSTOM;
  77.     /**
  78.      * When to show the popup (on the page load / on a mouse click / ...)
  79.      *
  80.      * @var integer
  81.      *
  82.      * @ORM\Column (type="integer", options={ "default": 0 })
  83.      */
  84.     protected $displayMode self::DISPLAY_ON_LOAD;
  85.     /**
  86.      * Whether the Close button is visible, or not.
  87.      *
  88.      * @var boolean
  89.      *
  90.      * @ORM\Column (type="boolean", options={ "default": 1 })
  91.      */
  92.     protected $showCloseButton true;
  93.     /**
  94.      * Number of days before the popup appears for the same user once again.
  95.      *
  96.      * @var integer
  97.      *
  98.      * @ORM\Column (type="integer", options={ "default": 365 })
  99.      */
  100.     protected $displayPeriod 365;
  101.     /**
  102.      * Delay (in seconds) before the popup appears on the page.
  103.      *
  104.      * @var integer
  105.      *
  106.      * @ORM\Column (type="integer", options={ "default": 0 })
  107.      */
  108.     protected $delay 0;
  109.     /**
  110.      * Whether the overlay background is enabled, or not.
  111.      *
  112.      * @var boolean
  113.      *
  114.      * @ORM\Column (type="boolean", options={ "default": 0 })
  115.      */
  116.     protected $modal false;
  117.     /**
  118.      * Width of the popup
  119.      *
  120.      * @var string
  121.      *
  122.      * @ORM\Column (type="string", length=255, options={ "default": "" })
  123.      */
  124.     protected $width '';
  125.     /**
  126.      * Type Width of the popup ( % or px).
  127.      *
  128.      * @var string
  129.      *
  130.      * @ORM\Column (type="string", length=2)
  131.      */
  132.     protected $widthType self::TYPE_PERCENT;
  133.     /**
  134.      * Position of the popup.
  135.      *
  136.      * @var string
  137.      *
  138.      * @ORM\Column (type="string", length=255, options={ "default": "center" })
  139.      */
  140.     protected $location self::LOCATION_CENTER;
  141.     /**
  142.      * Popup animation.
  143.      *
  144.      * @var integer
  145.      *
  146.      * @ORM\Column (type="integer", options={ "default": 0 })
  147.      */
  148.     protected $animation 0;
  149.     /**
  150.      * URLs where the popup may be displayed.
  151.      *
  152.      * @var string
  153.      *
  154.      * @ORM\Column (type="text")
  155.      */
  156.     protected $targetPages '';
  157.     /**
  158.      * URLs where the popup may not be displayed.
  159.      *
  160.      * @var string
  161.      *
  162.      * @ORM\Column (type="text")
  163.      */
  164.     protected $blockedPages '';
  165.     /**
  166.      * Active from (UNIXSTAMP).
  167.      *
  168.      * @var integer
  169.      *
  170.      * @ORM\Column         (type="integer", options={ "unsigned": true, "default": 0 })
  171.      */
  172.     protected $activeFrom 0;
  173.     /**
  174.      * Active till (UNIXSTAMP).
  175.      *
  176.      * @var integer
  177.      *
  178.      * @ORM\Column (type="integer", options={ "unsigned": true, "default": 0 })
  179.      */
  180.     protected $activeTill 0;
  181.     /**
  182.      * Path to the custom template.
  183.      *
  184.      * @var string
  185.      *
  186.      * @ORM\Column (type="string", length=255, options={ "default": "" })
  187.      */
  188.     protected $customTemplate '';
  189.     /**
  190.      * What users will see the popup.
  191.      *
  192.      * @var integer
  193.      *
  194.      * @ORM\Column (type="integer", options={ "default": 0 })
  195.      */
  196.     protected $targetUsers self::USERS_ALL;
  197.     // {{{ Exit offer-type related attributes
  198.     /**
  199.      * The offer is valid for customers with this minimum number of items in cart.
  200.      *
  201.      * @var integer
  202.      *
  203.      * @ORM\Column (type="integer")
  204.      */
  205.     protected $minItemQty 0;
  206.     /**
  207.      * The offer is valid for customers with this maximum number of items in cart.
  208.      *
  209.      * @var integer
  210.      *
  211.      * @ORM\Column (type="integer")
  212.      */
  213.     protected $maxItemQty 0;
  214.     /**
  215.      * The offer is valid for customers with this minimum cart subtotal.
  216.      *
  217.      * @var float
  218.      *
  219.      * @ORM\Column (type="decimal", precision=14, scale=4)
  220.      */
  221.     protected $minCartTotal 0;
  222.     /**
  223.      * The offer is valid for customers with this maximum cart subtotal.
  224.      *
  225.      * @var float
  226.      *
  227.      * @ORM\Column (type="decimal", precision=14, scale=4)
  228.      */
  229.     protected $maxCartTotal 0;
  230.     /**
  231.      * @var \Doctrine\Common\Collections\Collection
  232.      *
  233.      * @ORM\OneToMany (targetEntity="QSL\PopupAnywhere\Model\PopupTranslation", mappedBy="owner", cascade={"all"})
  234.      */
  235.     protected $translations;
  236.     // }}}
  237.     /**
  238.      * Get the entity identifier.
  239.      *
  240.      * @return integer
  241.      */
  242.     public function getId()
  243.     {
  244.         return $this->getPopupId();
  245.     }
  246.     /**
  247.      * Returns name of the popup widget class.
  248.      *
  249.      * @return string
  250.      */
  251.     public function getPopupWidgetClassName()
  252.     {
  253.         $type $this->getPopupType();
  254.         return $type ? ('\QSL\PopupAnywhere\View\Popup\\' $type) : '';
  255.     }
  256.     /**
  257.      * Returns the string representation for the popup width.
  258.      *
  259.      * @return string
  260.      */
  261.     public function getDisplayWidth()
  262.     {
  263.         return $this->getWidthValue() ? $this->getWidthValue() . $this->getWidthType() : 'auto';
  264.     }
  265.     /**
  266.      * Check if the URL matches one of the target URL patterns.
  267.      *
  268.      * @param string $url URL to match
  269.      *
  270.      * @return boolean
  271.      */
  272.     public function matchesTargetUrlPattern($url)
  273.     {
  274.         $matches false;
  275.         if ($url && $this->getTargetPages()) {
  276.             $urlNorm $this->normalizeUrlForComparison($url);
  277.             foreach ($this->getTargetUrlPatterns() as $pattern) {
  278.                 if ($pattern && strpos($urlNorm$this->normalizePatternForComparison($pattern)) !== false) {
  279.                     $matches true;
  280.                     break;
  281.                 }
  282.             }
  283.         } else {
  284.             $matches true;
  285.         }
  286.         return $matches;
  287.     }
  288.     /**
  289.      * Normilizes URL before comparing
  290.      *
  291.      * @param string $url
  292.      *
  293.      * @return  string
  294.      */
  295.     protected function normalizeUrlForComparison($url)
  296.     {
  297.         $urlParts parse_url($url);
  298.         $path  = isset($urlParts['path'])
  299.             ? str_replace('/index.php''/'$urlParts['path'])
  300.             : '/';
  301.         $query $urlParts['query'] ?? '';
  302.         return strtolower(trim("{$path}?{$query}"));
  303.     }
  304.     /**
  305.      * Normalize pattern for comparison.
  306.      *
  307.      * @param string $pattern URL pattern.
  308.      *
  309.      * @return string
  310.      */
  311.     protected function normalizePatternForComparison(string $pattern): string
  312.     {
  313.         return strtolower($pattern);
  314.     }
  315.     /**
  316.      * Check if the URL matches one of the blocked URL patterns.
  317.      *
  318.      * @param string $url URL to match
  319.      *
  320.      * @return boolean
  321.      */
  322.     public function matchesBlockedUrlPattern($url)
  323.     {
  324.         $matches false;
  325.         $url strtolower($url);
  326.         if ($url) {
  327.             foreach ($this->getBlockedUrlPatterns() as $pattern) {
  328.                 if ($pattern && strpos($urlstrtolower(trim($pattern))) !== false) {
  329.                     $matches true;
  330.                     break;
  331.                 }
  332.             }
  333.         }
  334.         return $matches;
  335.     }
  336.     /**
  337.      * Returns the popoup identifier.
  338.      *
  339.      * @return integer
  340.      */
  341.     public function getPopupId()
  342.     {
  343.         return $this->popup_id;
  344.     }
  345.     /**
  346.      * Set whether the popup is enabled, or not.
  347.      *
  348.      * @param boolean $enabled New state
  349.      *
  350.      * @return Popup
  351.      */
  352.     public function setEnabled($enabled)
  353.     {
  354.         $this->enabled $enabled;
  355.         return $this;
  356.     }
  357.     /**
  358.      * Check if the popup is enabled.
  359.      *
  360.      * @return boolean
  361.      */
  362.     public function getEnabled()
  363.     {
  364.         return $this->enabled;
  365.     }
  366.     /**
  367.      * Set whether the Close button is visible, or not.
  368.      *
  369.      * @param boolean $state New state
  370.      *
  371.      * @return Popup
  372.      */
  373.     public function setShowCloseButton($state)
  374.     {
  375.         $this->showCloseButton $state;
  376.         return $this;
  377.     }
  378.     /**
  379.      * Check if the Close button is visible.
  380.      *
  381.      * @return boolean
  382.      */
  383.     public function getShowCloseButton()
  384.     {
  385.         return $this->showCloseButton;
  386.     }
  387.     /**
  388.      * Sets the popup position.
  389.      *
  390.      * @param integer $position New position.
  391.      *
  392.      * @return Popup
  393.      */
  394.     public function setPosition($position)
  395.     {
  396.         $this->position $position;
  397.         return $this;
  398.     }
  399.     /**
  400.      * Returns the popup position.
  401.      *
  402.      * @return integer
  403.      */
  404.     public function getPosition()
  405.     {
  406.         return $this->position;
  407.     }
  408.     /**
  409.      * Updates the popup type.
  410.      *
  411.      * @param string $popupType New popup type
  412.      *
  413.      * @return Popup
  414.      */
  415.     public function setPopupType($popupType)
  416.     {
  417.         $this->popupType $popupType;
  418.         return $this;
  419.     }
  420.     /**
  421.      * Returns the popup type.
  422.      *
  423.      * @return string
  424.      */
  425.     public function getPopupType()
  426.     {
  427.         return $this->popupType;
  428.     }
  429.     /**
  430.      * Sets the popup display mode.
  431.      *
  432.      * @param integer $displayMode New display mode.
  433.      *
  434.      * @return Popup
  435.      */
  436.     public function setDisplayMode($displayMode)
  437.     {
  438.         $this->displayMode $displayMode;
  439.         return $this;
  440.     }
  441.     /**
  442.      * Get displayMode
  443.      *
  444.      * @return integer
  445.      */
  446.     public function getDisplayMode()
  447.     {
  448.         return $this->displayMode;
  449.     }
  450.     /**
  451.      * Updates the display period.
  452.      *
  453.      * @param integer $displayPeriod New period
  454.      *
  455.      * @return Popup
  456.      */
  457.     public function setDisplayPeriod($displayPeriod)
  458.     {
  459.         $this->displayPeriod $displayPeriod;
  460.         return $this;
  461.     }
  462.     /**
  463.      * Returns the display period.
  464.      *
  465.      * @return integer
  466.      */
  467.     public function getDisplayPeriod()
  468.     {
  469.         return $this->displayPeriod;
  470.     }
  471.     /**
  472.      * Sets the delay before the popup appears on the page.
  473.      *
  474.      * @param integer $delay New delay in seconds
  475.      *
  476.      * @return Popup
  477.      */
  478.     public function setDelay($delay)
  479.     {
  480.         $this->delay $delay;
  481.         return $this;
  482.     }
  483.     /**
  484.      * Returns the delay (in seconds) before the popup appears on the page.
  485.      *
  486.      * @return integer
  487.      */
  488.     public function getDelay()
  489.     {
  490.         return $this->delay;
  491.     }
  492.     /**
  493.      * Sets whether the popup should be modal, or not.
  494.      *
  495.      * @param boolean $modal Status
  496.      *
  497.      * @return Popup
  498.      */
  499.     public function setModal($modal)
  500.     {
  501.         $this->modal $modal;
  502.         return $this;
  503.     }
  504.     /**
  505.      * Checks if the popup is modal.
  506.      *
  507.      * @return boolean
  508.      */
  509.     public function getModal()
  510.     {
  511.         return $this->modal;
  512.     }
  513.     /**
  514.      * Sets the popup width.
  515.      *
  516.      * @param string $width New width
  517.      *
  518.      * @return Popup
  519.      */
  520.     public function setWidth($width)
  521.     {
  522.         $this->setWidthValue(
  523.             $width[PixelOrPercent::PRICE_VALUE] ?? 0
  524.         );
  525.         $this->setWidthType(
  526.             isset($width[PixelOrPercent::TYPE_VALUE])
  527.             && $width[PixelOrPercent::TYPE_VALUE] === AbsolutePixelOrPercent::TYPE_PERCENT
  528.                 ? static::TYPE_PERCENT
  529.                 : static::TYPE_ABSOLUTE
  530.         );
  531.         return $this;
  532.     }
  533.     /**
  534.      * Returns the popup width.
  535.      *
  536.      * @return array
  537.      */
  538.     public function getWidth()
  539.     {
  540.         return [
  541.             PixelOrPercent::PRICE_VALUE => $this->getWidthValue(),
  542.             PixelOrPercent::TYPE_VALUE  => $this->getWidthType() === static::TYPE_PERCENT
  543.                 AbsolutePixelOrPercent::TYPE_PERCENT
  544.                 AbsolutePixelOrPercent::TYPE_ABSOLUTE
  545.         ];
  546.     }
  547.     /**
  548.      * Set width value
  549.      *
  550.      * @param float $value
  551.      *
  552.      * @return Popup
  553.      */
  554.     public function setWidthValue($value)
  555.     {
  556.         $this->width $value;
  557.         return $this;
  558.     }
  559.     /**
  560.      * Get width value
  561.      *
  562.      * @return float
  563.      */
  564.     public function getWidthValue()
  565.     {
  566.         return $this->width;
  567.     }
  568.     /**
  569.      * Set width type
  570.      *
  571.      * @param string $type
  572.      *
  573.      * @return Popup
  574.      */
  575.     public function setWidthType($type)
  576.     {
  577.         $this->widthType $type;
  578.         return $this;
  579.     }
  580.     /**
  581.      * Get width type
  582.      *
  583.      * @return string
  584.      */
  585.     public function getWidthType()
  586.     {
  587.         return $this->widthType;
  588.     }
  589.     /**
  590.      * Updates the popup location.
  591.      *
  592.      * @param string $location New location
  593.      *
  594.      * @return Popup
  595.      */
  596.     public function setLocation($location)
  597.     {
  598.         $this->location $location;
  599.         return $this;
  600.     }
  601.     /**
  602.      * Returns the popup location.
  603.      *
  604.      * @return string
  605.      */
  606.     public function getLocation()
  607.     {
  608.         return $this->location;
  609.     }
  610.     /**
  611.      * Sets the popup animation mode.
  612.      *
  613.      * @param integer $animation New animation mode.
  614.      *
  615.      * @return Popup
  616.      */
  617.     public function setAnimation($animation)
  618.     {
  619.         $this->animation $animation;
  620.         return $this;
  621.     }
  622.     /**
  623.      * Returns the popup animation mode.
  624.      *
  625.      * @return integer
  626.      */
  627.     public function getAnimation()
  628.     {
  629.         return $this->animation;
  630.     }
  631.     /**
  632.      * Sets the pages where the popup should appear.
  633.      *
  634.      * @param string $targetPages URL patterns (multiline - one line per page)
  635.      *
  636.      * @return Popup
  637.      */
  638.     public function setTargetPages($targetPages)
  639.     {
  640.         $this->targetPages $targetPages;
  641.         return $this;
  642.     }
  643.     /**
  644.      * Returns URL patterns for the pages where the popup should appear.
  645.      *
  646.      * The result is a multiline string having one line per page.
  647.      *
  648.      * @return string
  649.      */
  650.     public function getTargetPages()
  651.     {
  652.         return $this->targetPages ?: '';
  653.     }
  654.     /**
  655.      * Sets the pages where the popup should never appear.
  656.      *
  657.      * @param string $blockedPages URL patterns (multiline - one line per page)
  658.      *
  659.      * @return Popup
  660.      */
  661.     public function setBlockedPages($blockedPages)
  662.     {
  663.         $this->blockedPages $blockedPages;
  664.         return $this;
  665.     }
  666.     /**
  667.      * Returns URL patterns for the pages where the popup should never appear.
  668.      *
  669.      * The result is a multiline string having one line per page.
  670.      *
  671.      * @return string
  672.      */
  673.     public function getBlockedPages()
  674.     {
  675.         return $this->blockedPages ?: '';
  676.     }
  677.     /**
  678.      * Set the date from which the popup may appear on the page.
  679.      *
  680.      * @param integer $activeFrom UNIX timestamp
  681.      *
  682.      * @return Popup
  683.      */
  684.     public function setActiveFrom($activeFrom)
  685.     {
  686.         $this->activeFrom = (int) $activeFrom;
  687.         return $this;
  688.     }
  689.     /**
  690.      * Returns UNIX timestamp for the date from which the popup may appear on the page.
  691.      *
  692.      * @return integer
  693.      */
  694.     public function getActiveFrom()
  695.     {
  696.         return $this->activeFrom;
  697.     }
  698.     /**
  699.      * Set the date after which the popup may not appear on the page.
  700.      *
  701.      * @param integer $activeTill UNIX timestamp
  702.      *
  703.      * @return Popup
  704.      */
  705.     public function setActiveTill($activeTill)
  706.     {
  707.         $this->activeTill = (int) $activeTill;
  708.         return $this;
  709.     }
  710.     /**
  711.      * Returns UNIX timestamp for the date after which the popup may not appear on the page.
  712.      *
  713.      * @return integer
  714.      */
  715.     public function getActiveTill()
  716.     {
  717.         return $this->activeTill;
  718.     }
  719.     /**
  720.      * Specifies a custom template file for the popup.
  721.      *
  722.      * @param string $customTemplate Path to the template file
  723.      *
  724.      * @return Popup
  725.      */
  726.     public function setCustomTemplate($customTemplate)
  727.     {
  728.         $this->customTemplate $customTemplate;
  729.         return $this;
  730.     }
  731.     /**
  732.      * Returns the path to the custom template file that should be used for the popup.
  733.      *
  734.      * @return string
  735.      */
  736.     public function getCustomTemplate()
  737.     {
  738.         return $this->customTemplate;
  739.     }
  740.     /**
  741.      * Configures which users the popup may appear for.
  742.      *
  743.      * @param integer $targetUsers New mode
  744.      *
  745.      * @return Popup
  746.      */
  747.     public function setTargetUsers($targetUsers)
  748.     {
  749.         $this->targetUsers $targetUsers;
  750.         return $this;
  751.     }
  752.     /**
  753.      * Determines which users the popup may appear for.
  754.      *
  755.      * @return integer
  756.      */
  757.     public function getTargetUsers()
  758.     {
  759.         return $this->targetUsers;
  760.     }
  761.     /**
  762.      * Returns URL patterns for pages where the popup may be displayed.
  763.      *
  764.      * @return array
  765.      */
  766.     protected function getTargetUrlPatterns()
  767.     {
  768.         $patterns = [];
  769.         foreach (explode(','$this->getTargetPages()) as $line) {
  770.             $patterns[] = explode("\n"$line);
  771.         }
  772.         return array_merge(...$patterns);
  773.     }
  774.     /**
  775.      * Returns URL patterns for pages where the popup may not be displayed.
  776.      *
  777.      * @return array
  778.      */
  779.     protected function getBlockedUrlPatterns()
  780.     {
  781.         $patterns = [];
  782.         foreach (explode(','$this->getBlockedPages()) as $line) {
  783.             $patterns[] = explode("\n"$line);
  784.         }
  785.         return array_merge(...$patterns);
  786.     }
  787.     // {{{ Exit offer-type related attributes
  788.     /**
  789.      * Sets the min number of items in the cart for the exit offer to appear.
  790.      *
  791.      * @param integer $minItemQty Min number of items in cart
  792.      *
  793.      * @return self
  794.      */
  795.     public function setMinItemQty($minItemQty)
  796.     {
  797.         $this->minItemQty $minItemQty;
  798.         return $this;
  799.     }
  800.     /**
  801.      * Returns the min number of items in the cart for the exit offer to appear.
  802.      *
  803.      * @return integer
  804.      */
  805.     public function getMinItemQty()
  806.     {
  807.         return $this->minItemQty;
  808.     }
  809.     /**
  810.      * Sets the max number of items in the cart for the exit offer to appear.
  811.      *
  812.      * @param integer $maxItemQty Max number of items in cart
  813.      *
  814.      * @return self
  815.      */
  816.     public function setMaxItemQty($maxItemQty)
  817.     {
  818.         $this->maxItemQty $maxItemQty;
  819.         return $this;
  820.     }
  821.     /**
  822.      * Returns the max number of items in the cart for the exit offer to appear.
  823.      *
  824.      * @return integer
  825.      */
  826.     public function getMaxItemQty()
  827.     {
  828.         return $this->maxItemQty;
  829.     }
  830.     /**
  831.      * Sets the min cart total for the exit offer to appear.
  832.      *
  833.      * @param float $minCartTotal Min total
  834.      *
  835.      * @return self
  836.      */
  837.     public function setMinCartTotal($minCartTotal)
  838.     {
  839.         $this->minCartTotal $minCartTotal;
  840.         return $this;
  841.     }
  842.     /**
  843.      * Returns the min cart total for the exit offer to appear.
  844.      *
  845.      * @return float
  846.      */
  847.     public function getMinCartTotal()
  848.     {
  849.         return $this->minCartTotal;
  850.     }
  851.     /**
  852.      * Sets the max cart total for the exit offer to appear.
  853.      *
  854.      * @param float $maxCartTotal Max total
  855.      *
  856.      * @return self
  857.      */
  858.     public function setMaxCartTotal($maxCartTotal)
  859.     {
  860.         $this->maxCartTotal $maxCartTotal;
  861.         return $this;
  862.     }
  863.     /**
  864.      * Returns the max cart total for the exit offer to appear.
  865.      *
  866.      * @return float
  867.      */
  868.     public function getMaxCartTotal()
  869.     {
  870.         return $this->maxCartTotal;
  871.     }
  872.     // }}}
  873.     // {{{ Translation Getters / setters
  874.     /**
  875.      * @return string
  876.      */
  877.     public function getCustomHeader()
  878.     {
  879.         return $this->getTranslationField(__FUNCTION__);
  880.     }
  881.     /**
  882.      * @param string $customHeader
  883.      *
  884.      * @return \XLite\Model\Base\Translation
  885.      */
  886.     public function setCustomHeader($customHeader)
  887.     {
  888.         return $this->setTranslationField(__FUNCTION__$customHeader);
  889.     }
  890.     /**
  891.      * @return string
  892.      */
  893.     public function getBody()
  894.     {
  895.         return $this->getTranslationField(__FUNCTION__);
  896.     }
  897.     /**
  898.      * @param string $body
  899.      *
  900.      * @return \XLite\Model\Base\Translation
  901.      */
  902.     public function setBody($body)
  903.     {
  904.         return $this->setTranslationField(__FUNCTION__$body);
  905.     }
  906.     // }}}
  907. }