Skip to content

Commit 971e5f7

Browse files
committed
Initial commit
0 parents  commit 971e5f7

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+2974
-0
lines changed

CHANGELOG.md

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
BEAUTIFULL POPUP
2+
� 2017 All rights reserved
3+
4+
This module is for PrestaShop (http://www.prestashop.com), a free open-source e-commerce software.
5+
Use Beautiful POPUP only with PrestaShop.
6+
7+
INFORMATIONS
8+
============
9+
Please read "README" file.
10+
11+
CHANGELOG
12+
=========
13+
14+
# Release Notes for Beautiful POPUP Module v1.0 (2017-07-01)
15+
16+
- First major release of module

README.md

+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
BEAUTIFULL POPUP
2+
© 2017 All rights reserved
3+
4+
This module is for PrestaShop (http://www.prestashop.com), free open-source e-commerce software.
5+
Use Beautiful NOTIFY only with PrestaShop.
6+
7+
INFORMATIONS
8+
============
9+
10+
Version: v1.0
11+
Date: 2017-07-01
12+
Author: Lathanao
13+
License: Single commerciale use
14+
PrestaShop: v1.6
15+
16+
NOTICE OF LICENSE AND TERMS OF USE
17+
==================================
18+
19+
This source file is subject of commerciale license.
20+
The Beautiful NOTIFY module is a single license use.
21+
22+
Reproduction in whole or part of this module, of one or more of its components,
23+
using any process, and without our express permission, is forbidden.
24+
25+
If you did not receive this module from us, please contact us.
26+
27+
Do not edit or add any file to this module if you wish to upgrade it to newer versions in the future.
28+
If you wish to customize Beautiful NOTIFY module for your needs please contact us.
29+
30+
31+
CREDIT ICONS AND ILLUSTRATIONS
32+
=======
33+
http://www.flaticon.com/packs/ecommerce-20
34+
35+
36+
CHANGELOG
37+
=========
38+
39+
Please read "CHANGELOG.md" file.
40+
41+
SUPPORT
42+
=======
43+
44+
Please referrer to user guide about installation/configuration/help use (PDF file).
45+
For any bugs, please contact us, we make free patch.
46+
We often provide update for this module, with brand new features, please contact us for more informations.

beautifulpopup.php

+137
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,137 @@
1+
<?php
2+
/****************************************************************//**
3+
* Beautiful Popup Notification or Prestashop
4+
* Add some beautiful popup, where and when you want on your shop
5+
*
6+
* @category Module / Front
7+
* @author Lathanao <Lathanaogmail.com>
8+
* @copyright 2017 Lathanao
9+
* @version 1.0
10+
* @license Commercial license see README.md
11+
********************************************************************/
12+
13+
include_once(dirname(__FILE__).'/models/BNAutoLoad.php');
14+
spl_autoload_register(array(BNAutoLoad::getInstance(), 'load'));
15+
16+
class Beautifulpopup extends Module {
17+
18+
protected static $instance = null;
19+
20+
public function __construct()
21+
{
22+
$this->name = 'Beautifulpopup';
23+
$this->version = '1.0';
24+
$this->tab = 'Block';
25+
$this->author = "Lathanao";
26+
$this->year = '2017';
27+
$this->ps_versions_compliancy['min'] = '1.6.0.1';
28+
29+
parent::__construct();
30+
31+
$this->displayName = $this->l('Beautiful Popup solution');
32+
$this->description = $this->l('Add some beautifull popups, where and when you want on your shop');
33+
$this->confirmUninstall = $this->l('Are you sure you want to uninstall this module?');
34+
35+
$this->file = __FILE__;
36+
}
37+
38+
public static function getInstance()
39+
{
40+
if (self::$instance === null)
41+
self::$instance = new Beautifulpopup();
42+
return self::$instance;
43+
}
44+
45+
################
46+
# INSTALLATION #
47+
################
48+
49+
public function install() {
50+
51+
52+
if (!BNPopup::createDatabase() || !BNTemplate::createDatabase())
53+
return false;
54+
55+
if (!parent::install())
56+
return false;
57+
58+
if (!$this->registerHook('footer') || !$this->registerHook('backOfficeHeader'))
59+
return false;
60+
61+
return true;
62+
}
63+
64+
public static function getVersionDir()
65+
{
66+
$version = explode('.', _PS_VERSION_);
67+
if ((int)$version[1] < 6)
68+
return ('1.5');
69+
return ('1.6');
70+
}
71+
72+
73+
public function hookbackOfficeHeader() {
74+
75+
$this->context->controller->addCSS(($this->_path).'css/header.css', 'all');
76+
}
77+
78+
79+
public function hookFooter() {
80+
81+
global $cookie;
82+
83+
if (!Tools::isSubmit('admin_preview_popup')) {
84+
85+
$popups = BNPopup::getAllPopup();
86+
$context = Context::getContext();
87+
$page = Tools::getValue('controller');
88+
$idCustomer = $context->customer->id;
89+
$nbOrder = Order::getCustomerNbOrders($idCustomer);
90+
91+
foreach($popups as $key => $popup) {
92+
93+
$cookieName = preg_replace('/[^A-Za-z]/', "", $popup->name);
94+
$cookie = new Cookie($cookieName);
95+
96+
if (!$cookie->__isset($cookieName))
97+
$cookie->__set($cookieName, 0);
98+
99+
if ($popup->nb_view <= $cookie->__get($cookieName)) // 2. If allready see
100+
continue;
101+
if ($popup->id_bn_page == 2 && $page != "index") // 2. If right page
102+
continue;
103+
if ($popup->id_bn_page == 3 && $page != "product") // 2. If right page
104+
continue;
105+
if ($popup->id_bn_page == 4 && $page != "cms") // 2. If right page
106+
continue;
107+
if ($popup->id_bn_peaple == 2 && !empty($idCustomer)) // 4. Only guest
108+
continue;
109+
if ($popup->id_bn_peaple == 3 && empty($idCustomer)) // 5. Only all registered users
110+
continue;
111+
if ($popup->id_bn_peaple == 4 && (empty($idCustomer) || $nbOrder == 0)) // 6. Only registered users who made a order allready
112+
continue;
113+
if ($popup->id_bn_peaple == 5 && (empty($idCustomer) || $nbOrder != 0)) // 7. Only registered users who never made any order
114+
continue;
115+
116+
$cookie->__set($cookieName, (1 + $cookie->__get($cookieName)));
117+
return $this->renderPopup($popup);
118+
}
119+
120+
} else {
121+
122+
$popup = new BNPopup(Tools::getValue('admin_preview_popup'));
123+
return $this->renderPopup($popup);
124+
}
125+
}
126+
127+
128+
public function renderPopup($popup) {
129+
130+
global $smarty;
131+
$template = new BNTemplate($popup->id_bn_template);
132+
$smarty->assign("popup", $popup);
133+
$smarty->assign("template", $template);
134+
$this->context->controller->addjqueryPlugin('fancybox');
135+
return ($this->display(__FILE__, 'views/templates/front/popup.tpl'));
136+
}
137+
}

config.xml

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?xml version="1.0" encoding="UTF-8" ?>
2+
<module>
3+
<name>Beautifulpopup</name>
4+
<displayName><![CDATA[Beautiful Popup solution]]></displayName>
5+
<version><![CDATA[1.0]]></version>
6+
<description><![CDATA[Add some beautifull popups, where and when you want on your shop]]></description>
7+
<author><![CDATA[Lathanao]]></author>
8+
<tab><![CDATA[Block]]></tab>
9+
<confirmUninstall><![CDATA[Are you sure you want to uninstall this module?]]></confirmUninstall>
10+
<is_configurable>0</is_configurable>
11+
<need_instance>1</need_instance>
12+
<limited_countries></limited_countries>
13+
</module>

0 commit comments

Comments
 (0)