diff --git a/.vscode/ftp-kr.sync.cache.json b/.vscode/ftp-kr.sync.cache.json index 52f18d62..b3b24677 100644 --- a/.vscode/ftp-kr.sync.cache.json +++ b/.vscode/ftp-kr.sync.cache.json @@ -1,14 +1,8 @@ { - "ftp://www@masimmo.pl@dedyk8.cyber-folks.pl": { + "ftp://dedyk8.cyber-folks.pl@www@masimmo.pl": { "public_html": { "admin264x7t1sv": {}, "app": {}, - "archive.zip": { - "type": "-", - "size": 3061108936, - "lmtime": 0, - "modified": false - }, "autoload.php": { "type": "-", "size": 1316, @@ -17,9 +11,9 @@ }, "bck": {}, "bin": {}, - "bridge_bW9IlgH3.php": { + "buy-by-phone.php": { "type": "-", - "size": 171555, + "size": 4120, "lmtime": 0, "modified": false }, @@ -28,7 +22,7 @@ "type": "-", "size": 2369, "lmtime": 0, - "modified": true + "modified": false }, "classes": {}, "composer.lock": { @@ -63,13 +57,13 @@ "type": "-", "size": 4937, "lmtime": 0, - "modified": true + "modified": false }, ".htaccess": { "type": "-", - "size": 7693, + "size": 7694, "lmtime": 0, - "modified": true + "modified": false }, ".htaccess.2025-05-22-1747946145": { "type": "-", @@ -119,6 +113,12 @@ "lmtime": 0, "modified": false }, + ".htaccess.2026-02-11-1770817243": { + "type": "-", + "size": 7693, + "lmtime": 0, + "modified": false + }, "image_log.json": { "type": "-", "size": 128703, @@ -134,8 +134,8 @@ "img": {}, "import-drewmax.php": { "type": "-", - "size": 33916, - "lmtime": 1768288646185.91, + "size": 34853, + "lmtime": 0, "modified": false }, "import-product.php": { @@ -148,7 +148,7 @@ "type": "-", "size": 1681, "lmtime": 0, - "modified": true + "modified": false }, "init.php": { "type": "-", @@ -162,12 +162,6 @@ "lmtime": 0, "modified": false }, - ".jpg": { - "type": "-", - "size": 273351, - "lmtime": 0, - "modified": true - }, "js": {}, "komplet-produktow-3.xml": { "type": "-", @@ -179,7 +173,7 @@ "type": "-", "size": 25527, "lmtime": 0, - "modified": true + "modified": false }, "LICENSES": { "type": "-", @@ -199,26 +193,486 @@ "type": "-", "size": 10596, "lmtime": 0, - "modified": true + "modified": false }, "modules": { - "blockreassurance": { + "arseopro": {}, + "blockreassurance": {}, + "blockwishlist": {}, + "caraty": {}, + "ceneo_trustedreviews": {}, + "contactform": {}, + "cookiesplus": {}, + "creativeelements": {}, + "dashactivity": {}, + "dashgoals": {}, + "dashproducts": {}, + "dashtrends": {}, + ".DS_Store": { + "type": "-", + "size": 6148, + "lmtime": 0, + "modified": false + }, + "ets_blog": {}, + "ets_multilayerslider": {}, + "followup": {}, + "gm_omniprice": {}, + "graphnvd3": {}, + "gridhtml": {}, + "gsitemap": {}, + ".htaccess": { + "type": "-", + "size": 242, + "lmtime": 0, + "modified": false + }, + "import_api": {}, + "index.php": { + "type": "-", + "size": 1377, + "lmtime": 0, + "modified": false + }, + "leobootstrapmenu": {}, + "omnibuseufree": { + "composer.json": { + "type": "-", + "size": 369, + "lmtime": 1772664068231, + "modified": false + }, + "config": { + "index.php": { + "type": "-", + "size": 725, + "lmtime": 1772664068740, + "modified": false + }, + "routes.yml": { + "type": "-", + "size": 248, + "lmtime": 1772664068813, + "modified": false + } + }, + "config_pl.xml": { + "type": "-", + "size": 648, + "lmtime": 1772664068305, + "modified": false + }, + "config.xml": { + "type": "-", + "size": 430, + "lmtime": 1772664068376, + "modified": false + }, + "controllers": { + "front": { + "cron.php": { + "type": "-", + "size": 1762, + "lmtime": 1772664068958, + "modified": false + }, + "index.php": { + "type": "-", + "size": 725, + "lmtime": 1772664069030, + "modified": false + } + }, + "index.php": { + "type": "-", + "size": 725, + "lmtime": 1772664068886, + "modified": false + } + }, + "index.php": { + "type": "-", + "size": 725, + "lmtime": 1772664068447, + "modified": false + }, + "LICENSE": { + "type": "-", + "size": 10768, + "lmtime": 1772664068518, + "modified": false + }, + "logo.png": { + "type": "-", + "size": 3875, + "lmtime": 1772664068588, + "modified": false + }, + "omnibuseufree.php": { + "type": "-", + "size": 29422, + "lmtime": 1772664207383, + "modified": false + }, + "Readme.md": { + "type": "-", + "size": 1462, + "lmtime": 1772664068660, + "modified": false + }, + "sql": { + "index.php": { + "type": "-", + "size": 725, + "lmtime": 1772664069101, + "modified": false + }, + "install.php": { + "type": "-", + "size": 1370, + "lmtime": 1772664069173, + "modified": false + }, + "uninstall.php": { + "type": "-", + "size": 631, + "lmtime": 1772664069246, + "modified": false + } + }, + "src": { + "compatibility": { + "index.php": { + "type": "-", + "size": 725, + "lmtime": 1772664069410, + "modified": false + }, + "PrestashopCompatibility.php": { + "type": "-", + "size": 910, + "lmtime": 1772664069481, + "modified": false + } + }, + "controller": { + "index.php": { + "type": "-", + "size": 725, + "lmtime": 1772664069556, + "modified": false + }, + "MenuController.php": { + "type": "-", + "size": 781, + "lmtime": 1772664069628, + "modified": false + } + }, + "index.php": { + "type": "-", + "size": 725, + "lmtime": 1772664069336, + "modified": false + } + }, + "translations": { + "index.php": { + "type": "-", + "size": 725, + "lmtime": 1772664069698, + "modified": false + }, + "pl.php": { + "type": "-", + "size": 4766, + "lmtime": 1772664069770, + "modified": false + } + }, + "upgrade": { + "index.php": { + "type": "-", + "size": 725, + "lmtime": 1772664069843, + "modified": false + }, + "upgrade-1.1.0.php": { + "type": "-", + "size": 536, + "lmtime": 1772664069919, + "modified": false + } + }, + "vendor": { + "autoload.php": { + "type": "-", + "size": 771, + "lmtime": 1772664069992, + "modified": false + }, + "composer": { + "autoload_classmap.php": { + "type": "-", + "size": 434, + "lmtime": 1772664070213, + "modified": false + }, + "autoload_namespaces.php": { + "type": "-", + "size": 139, + "lmtime": 1772664070284, + "modified": false + }, + "autoload_psr4.php": { + "type": "-", + "size": 275, + "lmtime": 1772664070356, + "modified": false + }, + "autoload_real.php": { + "type": "-", + "size": 1089, + "lmtime": 1772664070430, + "modified": false + }, + "autoload_static.php": { + "type": "-", + "size": 1497, + "lmtime": 1772664070497, + "modified": false + }, + "ClassLoader.php": { + "type": "-", + "size": 16431, + "lmtime": 1772664070577, + "modified": false + }, + "index.php": { + "type": "-", + "size": 725, + "lmtime": 1772664070647, + "modified": false + }, + "LICENSE": { + "type": "-", + "size": 1070, + "lmtime": 1772664070716, + "modified": false + } + }, + ".htaccess": { + "type": "-", + "size": 170, + "lmtime": 1772664070066, + "modified": false + }, + "index.php": { + "type": "-", + "size": 725, + "lmtime": 1772664070138, + "modified": false + } + }, "views": { + "css": { + "back.css": { + "type": "-", + "size": 1534, + "lmtime": 1772664070867, + "modified": false + }, + "index.php": { + "type": "-", + "size": 725, + "lmtime": 1772664070938, + "modified": false + }, + "omnibuseufree-presta-studio.css": { + "type": "-", + "size": 534, + "lmtime": 1772664071007, + "modified": false + } + }, + "img": { + "baner_en.png": { + "type": "-", + "size": 10975, + "lmtime": 1772664071073, + "modified": false + }, + "baner_mobile_en.png": { + "type": "-", + "size": 9882, + "lmtime": 1772664071144, + "modified": false + }, + "baner_mobile_pl.png": { + "type": "-", + "size": 10530, + "lmtime": 1772664071214, + "modified": false + }, + "baner_pl.png": { + "type": "-", + "size": 11440, + "lmtime": 1772664071285, + "modified": false + }, + "index.php": { + "type": "-", + "size": 725, + "lmtime": 1772664071356, + "modified": false + }, + "presta_studio_logo.png": { + "type": "-", + "size": 6179, + "lmtime": 1772664071427, + "modified": false + }, + "yt_logo.png": { + "type": "-", + "size": 5429, + "lmtime": 1772664071497, + "modified": false + } + }, + "index.php": { + "type": "-", + "size": 725, + "lmtime": 1772664070790, + "modified": false + }, + "js": { + "back.js": { + "type": "-", + "size": 712, + "lmtime": 1772664071569, + "modified": false + }, + "index.php": { + "type": "-", + "size": 725, + "lmtime": 1772664071641, + "modified": false + } + }, "templates": { - "hook": { - "displayBlockProduct.tpl": { + "admin": { + "configure.tpl": { "type": "-", - "size": 4356, - "lmtime": 1768288646186.5957, + "size": 3484, + "lmtime": 1772664071801, + "modified": false + }, + "index.php": { + "type": "-", + "size": 725, + "lmtime": 1772664071874, + "modified": false + }, + "products-price-list.tpl": { + "type": "-", + "size": 1577, + "lmtime": 1772664071943, "modified": false } + }, + "hook": { + "index.php": { + "type": "-", + "size": 725, + "lmtime": 1772664072012, + "modified": false + }, + "presta_studio_omnibus_price.tpl": { + "type": "-", + "size": 1401, + "lmtime": 1772664072085, + "modified": false + } + }, + "index.php": { + "type": "-", + "size": 725, + "lmtime": 1772664071727, + "modified": false } } } - } + }, + "pagecache": {}, + "pagesnotfound": {}, + "paynow": {}, + "pdgoogleanalytycs4pro": {}, + "pricewars2": {}, + "productcomments": {}, + "ps_accounts": {}, + "ps_banner": {}, + "ps_buybuttonlite": {}, + "ps_cashondelivery": {}, + "ps_categorytree": {}, + "ps_checkout": {}, + "ps_checkpayment": {}, + "ps_contactinfo": {}, + "ps_crossselling": {}, + "ps_currencyselector": {}, + "ps_customeraccountlinks": {}, + "ps_customersignin": {}, + "ps_customtext": {}, + "ps_dataprivacy": {}, + "ps_emailalerts": {}, + "ps_emailsubscription": {}, + "ps_facebook": {}, + "ps_facetedsearch": {}, + "ps_faviconnotificationbo": {}, + "ps_featuredproducts": {}, + "psgdpr": {}, + "ps_imageslider": {}, + "ps_languageselector": {}, + "ps_linklist": {}, + "ps_mainmenu": {}, + "ps_mbo": {}, + "ps_metrics": {}, + "ps_reminder": {}, + "ps_searchbar": {}, + "ps_sharebuttons": {}, + "ps_shoppingcart": {}, + "ps_socialfollow": {}, + "ps_themecusto": {}, + "ps_wirepayment": {}, + "psxmarketingwithgoogle": {}, + "raty": {}, + "referralprogram": {}, + "regenerateimage": {}, + "santandercredit": {}, + "statsbestcategories": {}, + "statsbestcustomers": {}, + "statsbestmanufacturers": {}, + "statsbestproducts": {}, + "statsbestsuppliers": {}, + "statsbestvouchers": {}, + "statscarrier": {}, + "statscatalog": {}, + "statscheckup": {}, + "statsdata": {}, + "statsforecast": {}, + "statsnewsletter": {}, + "statspersonalinfos": {}, + "statsproduct": {}, + "statsregistrations": {}, + "statssales": {}, + "statssearch": {}, + "statsstock": {}, + "welcome": {}, + "x13gpsr": {}, + "x13webp": {} }, "override": {}, "pdf": {}, + "phpmailer": {}, "phpstan.neon.dist": { "type": "-", "size": 1580, @@ -229,488 +683,30 @@ "type": "-", "size": 3372, "lmtime": 0, - "modified": true + "modified": false }, "sitemaps": {}, "sitemap_shop_1.xml": { "type": "-", "size": 968, "lmtime": 0, - "modified": true + "modified": false }, "-small_default.jpg": { "type": "-", "size": 1818, "lmtime": 0, - "modified": true + "modified": false }, "src": {}, - "themes": { - "classic": { - "modules": { - "ps_linklist": { - "views": { - "templates": { - "hook": { - "linkblock.tpl": { - "type": "-", - "size": 2203, - "lmtime": 1759826160000, - "modified": false - } - } - } - } - } - }, - "templates": { - "catalog": { - "listing": { - "best-sales.tpl": { - "type": "-", - "size": 214, - "lmtime": 0, - "modified": false - }, - "category.tpl": { - "type": "-", - "size": 1298, - "lmtime": 0, - "modified": false - }, - "manufacturer.tpl": { - "type": "-", - "size": 1622, - "lmtime": 0, - "modified": false - }, - "new-products.tpl": { - "type": "-", - "size": 215, - "lmtime": 0, - "modified": false - }, - "prices-drop.tpl": { - "type": "-", - "size": 214, - "lmtime": 0, - "modified": false - }, - "product-list.tpl": { - "type": "-", - "size": 4401, - "lmtime": 1759829696632.9082, - "modified": false - }, - "search.tpl": { - "type": "-", - "size": 581, - "lmtime": 0, - "modified": false - }, - "supplier.tpl": { - "type": "-", - "size": 1493, - "lmtime": 0, - "modified": false - } - } - }, - "layouts": { - "layout-both-columns.tpl": { - "type": "-", - "size": 3772, - "lmtime": 1759830163474.185, - "modified": false - }, - "layout-content-only.tpl": { - "type": "-", - "size": 1556, - "lmtime": 0, - "modified": false - }, - "layout-error.tpl": { - "type": "-", - "size": 1844, - "lmtime": 0, - "modified": false - }, - "layout-full-width.tpl": { - "type": "-", - "size": 1482, - "lmtime": 0, - "modified": false - }, - "layout-left-column.tpl": { - "type": "-", - "size": 1689, - "lmtime": 1759830255906.7522, - "modified": false - }, - "layout-right-column.tpl": { - "type": "-", - "size": 1487, - "lmtime": 0, - "modified": false - } - } - }, - "assets": { - "css": { - "00b1fb69fb78ff50fd555de80b2fb45e.ttf": { - "type": "-", - "size": 174048, - "lmtime": 0, - "modified": false - }, - "016d41b1da3f1f5aaa44a7e20baee117.woff": { - "type": "-", - "size": 32904, - "lmtime": 0, - "modified": false - }, - "04be689c12d686c595032705f6b3cf6c.svg": { - "type": "-", - "size": 848, - "lmtime": 0, - "modified": false - }, - "057cc3c927dc0b2e8dbb739a306bd3a3.otf": { - "type": "-", - "size": 73016, - "lmtime": 0, - "modified": false - }, - "0ba57b3ea460c3d7d0c46d6138f088a8.svg": { - "type": "-", - "size": 3780, - "lmtime": 0, - "modified": false - }, - "0f099f4e4d67aeb18ab6da291367a93f.woff": { - "type": "-", - "size": 32596, - "lmtime": 0, - "modified": false - }, - "12a47ed5fd5585f0f4227fa035a1a607.woff2": { - "type": "-", - "size": 60840, - "lmtime": 0, - "modified": false - }, - "1e81f33d197ccdb39d4edce581ff50ec.woff": { - "type": "-", - "size": 30148, - "lmtime": 0, - "modified": false - }, - "250c120c3f8b2b0bb58ea27ee36153fc.woff2": { - "type": "-", - "size": 29860, - "lmtime": 0, - "modified": false - }, - "29acb3c63123183305b02ebc9844b2ef.otf": { - "type": "-", - "size": 73124, - "lmtime": 0, - "modified": false - }, - "33e7446832ac7aa84b959a6ea8efb915.svg": { - "type": "-", - "size": 891, - "lmtime": 0, - "modified": false - }, - "38fa559ad8e8cbaee0c7a2178d308df5.woff2": { - "type": "-", - "size": 27760, - "lmtime": 0, - "modified": false - }, - "3a94078d659136527abfe39bc3432628.svg": { - "type": "-", - "size": 1013, - "lmtime": 0, - "modified": false - }, - "40ef5dc59db6eeef16942fc6a0baa8de.otf": { - "type": "-", - "size": 71000, - "lmtime": 0, - "modified": false - }, - "479700ea91d964d295d75c6b67bd0b28.eot": { - "type": "-", - "size": 69177, - "lmtime": 0, - "modified": false - }, - "47f13bcaf75af86613bca9721d6e858f.svg": { - "type": "-", - "size": 901, - "lmtime": 0, - "modified": false - }, - "4903fb37c04676f5a805be194ad59b2b.svg": { - "type": "-", - "size": 1560, - "lmtime": 0, - "modified": false - }, - "4db1ea0d15010c761ee577d7c0f5a0a0.otf": { - "type": "-", - "size": 70960, - "lmtime": 0, - "modified": false - }, - "52260854eea2d38939bf40e9e9687830.woff2": { - "type": "-", - "size": 29756, - "lmtime": 0, - "modified": false - }, - "56b65c6bec8f40445da4f7853f2553ec.otf": { - "type": "-", - "size": 70940, - "lmtime": 0, - "modified": false - }, - "57a1d494b0e76131f062c5c9c2d4960d.woff2": { - "type": "-", - "size": 30220, - "lmtime": 0, - "modified": false - }, - "64041bf784575b30a79fa31900c79cf6.otf": { - "type": "-", - "size": 70404, - "lmtime": 0, - "modified": false - }, - "726b87682d18d1e8307635d146fe58cc.svg": { - "type": "-", - "size": 3103, - "lmtime": 0, - "modified": false - }, - "740f1557cae714dc4b180b4d5de69375.svg": { - "type": "-", - "size": 5233, - "lmtime": 0, - "modified": false - }, - "7acb0ff3a9a16ba3806d7f16b745af38.svg": { - "type": "-", - "size": 1192, - "lmtime": 0, - "modified": false - }, - "83131b9daba3e9a7b2c7ae7e47d2d503.woff": { - "type": "-", - "size": 31392, - "lmtime": 0, - "modified": false - }, - "882e1291e47c7d9d5dd7633845caa204.svg": { - "type": "-", - "size": 891, - "lmtime": 0, - "modified": false - }, - "895e092292d88717adaa347e532822ab.woff2": { - "type": "-", - "size": 28776, - "lmtime": 0, - "modified": false - }, - "91fc2885f1aa34fb73f63e9ef538fe1c.svg": { - "type": "-", - "size": 1145, - "lmtime": 0, - "modified": false - }, - "a7360927bb3673ed7814d6f607d122cb.woff2": { - "type": "-", - "size": 29856, - "lmtime": 0, - "modified": false - }, - "a8af1233a958bd1e96edcad65791a0d3.woff": { - "type": "-", - "size": 32840, - "lmtime": 0, - "modified": false - }, - "b252849e892c264f4f220c7e7cb0207a.svg": { - "type": "-", - "size": 1198, - "lmtime": 0, - "modified": false - }, - "b2efa71e4ca1cd26b0f4df4e71e531a8.svg": { - "type": "-", - "size": 357, - "lmtime": 0, - "modified": false - }, - "c472ea2ef3e5b37438730a4ab00513b4.svg": { - "type": "-", - "size": 901, - "lmtime": 0, - "modified": false - }, - "c80d4fb11dcc2140b26007ce39cfa521.woff": { - "type": "-", - "size": 32508, - "lmtime": 0, - "modified": false - }, - "cbeba06698c00a61e82219b76357ce42.svg": { - "type": "-", - "size": 1020, - "lmtime": 0, - "modified": false - }, - "custom.css": { - "type": "-", - "size": 91828, - "lmtime": 1765895938673.4114, - "modified": false - }, - "custom.css.map": { - "type": "-", - "size": 25242, - "lmtime": 1765895938673.352, - "modified": false - }, - "custom.scss": { - "type": "-", - "size": 79358, - "lmtime": 1765895938432.5369, - "modified": false - }, - "dce0916af972e3040aa191f74b17dd46.woff2": { - "type": "-", - "size": 30428, - "lmtime": 0, - "modified": false - }, - "de69cd9e672c81725abcde04ecf022ee.woff": { - "type": "-", - "size": 33400, - "lmtime": 0, - "modified": false - }, - "error.css": { - "type": "-", - "size": 742, - "lmtime": 0, - "modified": false - }, - "f2a0933406f7830651524f477ba2f543.woff": { - "type": "-", - "size": 79612, - "lmtime": 0, - "modified": false - }, - "f56d95737d55e2bdba95baa528b2583b.svg": { - "type": "-", - "size": 3780, - "lmtime": 0, - "modified": false - }, - "fa3993a997a0b84e9900ee168b18b919.svg": { - "type": "-", - "size": 848, - "lmtime": 0, - "modified": false - }, - "fd2d932b381003546821288ecde6e370.otf": { - "type": "-", - "size": 71180, - "lmtime": 0, - "modified": false - }, - "theme.css": { - "type": "-", - "size": 192439, - "lmtime": 0, - "modified": false - }, - "theme.css.map": { - "type": "-", - "size": 544940, - "lmtime": 0, - "modified": false - }, - "theme.scss": { - "type": "-", - "size": 255419, - "lmtime": 0, - "modified": false - } - } - } - }, - "core.js": { - "type": "-", - "size": 477381, - "lmtime": 1768288646189.247, - "modified": false - }, - "core.js.LICENSE.txt": { - "type": "-", - "size": 1664, - "lmtime": 0, - "modified": false - }, - "debug.tpl": { - "type": "-", - "size": 5064, - "lmtime": 0, - "modified": false - }, - ".DS_Store": { - "type": "-", - "size": 6148, - "lmtime": 0, - "modified": false - }, - ".htaccess": { - "type": "-", - "size": 242, - "lmtime": 0, - "modified": false - }, - "index.php": { - "type": "-", - "size": 1369, - "lmtime": 0, - "modified": false - }, - "javascript.tpl": { - "type": "-", - "size": 1583, - "lmtime": 0, - "modified": false - }, - "_libraries": {}, - "package-lock.json": { - "type": "-", - "size": 235491, - "lmtime": 0, - "modified": false - } - }, + "themes": {}, "tmp": {}, "tools": {}, "translations": {}, "update_price_log.csv": { "type": "-", - "size": 23674, - "lmtime": 1768288646190.215, + "size": 1274254, + "lmtime": 0, "modified": false }, "upload": {}, diff --git a/.vscode/sftp.json b/.vscode/sftp.json index 1595b84a..ee35e309 100644 --- a/.vscode/sftp.json +++ b/.vscode/sftp.json @@ -1,5 +1,5 @@ { - "name": "dedyk8.cyber-folks.pl", + "name": "masimmo.pl", "host": "dedyk8.cyber-folks.pl", "protocol": "ftp", "port": 21, diff --git a/modules/omnibuseufree/LICENSE b/modules/omnibuseufree/LICENSE new file mode 100644 index 00000000..b63ed108 --- /dev/null +++ b/modules/omnibuseufree/LICENSE @@ -0,0 +1,190 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/LICENSE-2.0 + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + Copyright 2023 presta.studio + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. \ No newline at end of file diff --git a/modules/omnibuseufree/Readme.md b/modules/omnibuseufree/Readme.md new file mode 100644 index 00000000..d368eaf6 --- /dev/null +++ b/modules/omnibuseufree/Readme.md @@ -0,0 +1,22 @@ +# Omnibus for PrestaShop – Free Module + +The price history module for stores based on the PrestaShop platform has been created to meet the requirements of the Omnibus directive in force in the European Union. +Once installed, the Omnibus Directive module will record information on each product price change. In addition, our module supports products with combinations and support for multiple currencies. If you have more than one currency configured, then our module will save product prices for each currency available in your store. Based on this, the module provides the consumer with information about the lowest available price for the product. + +The module has been tested in the following versions of PrestaShop: +- 1.7.8.10 +- 8.0.5 +- 8.1.2 + +Online manual +============= + +Online manual is available at: +- [https://presta.studio/omnibus-for-prestashop-free-module/](https://presta.studio/omnibus-for-prestashop-free-module/) (English) +- [https://presta.studio/pl/omnibus-dla-prestashop-darmowy-modul/](https://presta.studio/pl/omnibus-dla-prestashop-darmowy-modul/) (Polish) +- [YouTube](https://presta.studio/youtube-omnibus-module) + +Installation +============= + +If you intend to install a module on production shop, make sure to download the latest version from our [releases page](https://github.com/dominikadamiak/omnibus-eu/releases), then read the [install guide for users](https://presta.studio/omnibus-for-prestashop-free-module/#installation). \ No newline at end of file diff --git a/modules/omnibuseufree/composer.json b/modules/omnibuseufree/composer.json new file mode 100644 index 00000000..9a8d6299 --- /dev/null +++ b/modules/omnibuseufree/composer.json @@ -0,0 +1,14 @@ +{ + "name": "prestastudio/omnibus", + "description": "Module for Omnibus Directive by the European Union law.", + "autoload": { + "psr-4": { + "Omnibus\\Controller\\": "src/controller/", + "Omnibus\\Compatibility\\": "src/compatibility/" + } + }, + "config": { + "prepend-autoloader": false + }, + "type": "prestashop-module" + } \ No newline at end of file diff --git a/modules/omnibuseufree/config.xml b/modules/omnibuseufree/config.xml new file mode 100644 index 00000000..eb4385d2 --- /dev/null +++ b/modules/omnibuseufree/config.xml @@ -0,0 +1,11 @@ + + + omnibuseufree + + + + + + 1 + 1 + diff --git a/modules/omnibuseufree/config/index.php b/modules/omnibuseufree/config/index.php new file mode 100644 index 00000000..65e05151 --- /dev/null +++ b/modules/omnibuseufree/config/index.php @@ -0,0 +1,23 @@ + + + omnibuseufree + + + + + + + 1 + 1 + + \ No newline at end of file diff --git a/modules/omnibuseufree/controllers/front/cron.php b/modules/omnibuseufree/controllers/front/cron.php new file mode 100644 index 00000000..199d8262 --- /dev/null +++ b/modules/omnibuseufree/controllers/front/cron.php @@ -0,0 +1,46 @@ +ajax = 1; + + if (Configuration::get('OMNIBUSEUFREE_CRON_STATUS', null, null, null, 2) == 1 && Tools::getIsset('token') && Tools::getIsset('type')) { + if (Configuration::get('OMNIBUSEUFREE_CRON_TOKEN') == Tools::getValue('token')) { + $type = (int) Tools::getValue('type'); + + if ($type == 1) { + $Omnibus = new OmnibusEuFree; + $InsertDataCounter = $Omnibus->insertAllProductsToOmnibusTable(); + PrestaShopLogger::addLog('[CRON] Omnibus Directive module by presta.studio - Updated price history. Number of products checked: ' . $InsertDataCounter); + } + + if ($type == 2) { + $Omnibus = new OmnibusEuFree; + $OldDataCounter = $Omnibus->removeOldDataFromOmnibusTable(); + PrestaShopLogger::addLog('[CRON] Omnibus Directive module by presta.studio - Deleted old data. Number of records deleted in database: ' . $OldDataCounter); + } + } + } + } +} \ No newline at end of file diff --git a/modules/omnibuseufree/controllers/front/index.php b/modules/omnibuseufree/controllers/front/index.php new file mode 100644 index 00000000..65e05151 --- /dev/null +++ b/modules/omnibuseufree/controllers/front/index.php @@ -0,0 +1,23 @@ +name = 'omnibuseufree'; + $this->tab = 'pricing_promotion'; + $this->version = '1.0.2'; + $this->author = 'presta.studio'; + $this->need_instance = 1; + $this->bootstrap = true; + + parent::__construct(); + + $this->displayName = $this->l('Omnibus Directive'); + $this->description = $this->l('This module will help you meet the requirements of the EU Omnibus Directive in your store.'); + + $this->confirmUninstall = $this->l('Are you sure you want to uninstall this module? The price history will be deleted.'); + + $this->ps_versions_compliancy = array('min' => '1.7', 'max' => _PS_VERSION_); + } + + public function install() + { + Configuration::updateValue('OMNIBUSEUFREE_INFORMATION_VERSION', 2); + Configuration::updateValue('OMNIBUSEUFREE_DISPLAY_PRODUCT_PRICE_BLOCK', 1); + Configuration::updateValue('OMNIBUSEUFREE_CRON_STATUS', 2); + Configuration::updateValue('OMNIBUSEUFREE_DAYS', 30); + Configuration::updateValue('OMNIBUSEUFREE_HISTORY_DAYS', 60); + + include(dirname(__FILE__) . '/sql/install.php'); + + return parent::install() && + $this->registerHook('header') && + $this->registerHook('displayBackOfficeHeader') && + $this->registerHook('actionProductSave') && + $this->registerHook('actionProductAttributeUpdate') && + $this->registerHook('displayOmnibusEuFree') && + $this->registerHook('displayProductPriceBlock') && + $this->registerHook('displayAdminProductsExtra') && + $this->installTab(); + } + + public function uninstall() + { + Configuration::deleteByName('OMNIBUSEUFREE_INFORMATION_VERSION'); + Configuration::deleteByName('OMNIBUSEUFREE_DISPLAY_PRODUCT_PRICE_BLOCK'); + Configuration::deleteByName('OMNIBUSEUFREE_CRON_STATUS'); + Configuration::deleteByName('OMNIBUSEUFREE_DAYS'); + Configuration::deleteByName('OMNIBUSEUFREE_HISTORY_DAYS'); + + include(dirname(__FILE__) . '/sql/uninstall.php'); + + return parent::uninstall() && + $this->uninstallTab(); + } + + private function installTab() + { + $tabId = (int) Tab::getIdFromClassName('OmnibusEuFreeController'); + if (!$tabId) { + $tabId = null; + } + + $tab = new Tab($tabId); + $tab->active = 1; + $tab->class_name = 'OmnibusEuFreeController'; + $tab->route_name = 'admin_link_config'; + $tab->icon = 'euro_symbol'; + $tab->name = array(); + foreach (Language::getLanguages() as $lang) { + $tab->name[$lang['id_lang']] = $this->l('Omnibus Directive'); + } + $tab->id_parent = (int) Tab::getIdFromClassName('IMPROVE'); + $tab->module = $this->name; + + return $tab->save(); + } + + private function uninstallTab() + { + $tabId = (int) Tab::getIdFromClassName('OmnibusEuFreeController'); + if (!$tabId) { + return true; + } + + $tab = new Tab($tabId); + + return $tab->delete(); + } + + protected function getLastMinimalPrice($id_product = null, $id_product_attribute = 0, $currency = null) + { + if (!isset($id_product)) { + throw new Exception('Missing parameter: $id_product'); + } + + if (!isset($currency)) { + $defaultCurrency = Currency::getDefaultCurrency(); + $currency = $defaultCurrency->id; + } + + $info_version = Configuration::get('OMNIBUSEUFREE_INFORMATION_VERSION', null, null, null, 2); + $NumberOfDays = (int) Configuration::get('OMNIBUSEUFREE_DAYS', null, null, null, 30); + + $date = new DateTime(); + $date->modify('-' . $NumberOfDays . ' days'); + $CutOffDate = $date->format('Y-m-d'); + + $sql = new DbQuery(); + $sql->select('price'); + $sql->from('omnibus_eu_free'); + $sql->where('id_product = ' . (int) $id_product); + $sql->where('id_product_attribute = ' . (int) $id_product_attribute); + $sql->where('id_currency = ' . (int) $currency); + $sql->where('date_add >= "'.$CutOffDate.' 00:00:00"'); + + if ($info_version == 2) { + $sql->where('is_last = 0'); + } + + $sql->orderBy('price ASC'); + $sql->limit(1); + $sqlResult = Db::getInstance()->executeS($sql); + + return (!empty($sqlResult)) ? $sqlResult[0] : array(); + } + + public function hookDisplayOmnibusEuFree($params) + { + $currency = $this->context->currency; + $lastMinimalPrice = $this->getLastMinimalPrice($params['product']['id_product'], $params['product']['id_product_attribute'], $currency->id); + + if (!empty($lastMinimalPrice)) { + $minimalPrice = PrestashopCompatibility::formatPrice(_PS_VERSION_, $lastMinimalPrice['price'], $currency); + } + else { + $minimalPrice = null; + } + + $this->context->smarty->assign([ + 'OmnibuseufreeInfoVersion' => (int) Configuration::get('OMNIBUSEUFREE_INFORMATION_VERSION', null, null, null, 2), + 'OmnibuseufreeProductPriceMin' => $minimalPrice, + 'OmnibuseufreeProductPriceCurrent' => $params['product']['price'], + 'OmnibuseufreeProductDiscount' => (bool) $params['product']['has_discount'], + 'OmnibuseufreeNumberOfDays' => (int) Configuration::get('OMNIBUSEUFREE_DAYS', null, null, null, 30), + ]); + + return $this->display(__FILE__, '/views/templates/hook/presta_studio_omnibus_price.tpl'); + } + + public function hookDisplayProductPriceBlock($params) + { + return ($params['type'] == 'after_price' && Configuration::get('OMNIBUSEUFREE_DISPLAY_PRODUCT_PRICE_BLOCK') == 1) ? $this->hookDisplayOmnibusEuFree($params) : ''; + } + + public function hookDisplayAdminProductsExtra($params) + { + $OmnibusData = array(); + $product = new Product((int) $params['id_product']); + $hasCombinations = $product->hasCombinations(); + $nameCache = array(); + + foreach ($this->getOmnibusData($params['id_product']) as $rowId => $rowValue) { + $OmnibusData[$rowId]['price_locale'] = ''; + $OmnibusData[$rowId]['currency_iso_code'] = ''; + $OmnibusData[$rowId]['name'] = ''; + $OmnibusData[$rowId]['is_last_icon'] = ''; + + foreach ($rowValue as $key => $value) { + if (isset($OmnibusData[$rowId]['price']) && $key == 'id_currency') { + $currency = Currency::getCurrencyInstance((int) $value); + $OmnibusData[$rowId]['price_locale'] = PrestashopCompatibility::formatPrice(_PS_VERSION_, $OmnibusData[$rowId]['price'], $currency); + $OmnibusData[$rowId]['currency_iso_code'] = $currency->iso_code; + } + elseif ($key == 'id_product_attribute') { + $attrId = (int) $value; + if (!isset($nameCache[$attrId])) { + $nameCache[$attrId] = $product->getProductName((int) $params['id_product'], $attrId); + if ($hasCombinations && $attrId === 0) { + $nameCache[$attrId] .= ' ' . $this->l('(default combination)'); + } + } + $OmnibusData[$rowId]['name'] = $nameCache[$attrId]; + } + elseif ($key == 'is_last' && $value == 1) { + $OmnibusData[$rowId]['is_last_icon'] = 'done'; + } + + $OmnibusData[$rowId][$key] = $value; + } + } + + $this->context->smarty->assign([ + 'OmnibuseufreeData' => $OmnibusData + ]); + + return $this->display(__FILE__, '/views/templates/admin/products-price-list.tpl'); + } + + public function hookHeader() + { + $this->context->controller->addCSS($this->_path . '/views/css/omnibuseufree-presta-studio.css'); + } + + public function hookDisplayBackOfficeHeader() + { + $this->context->controller->addJS($this->_path . 'views/js/back.js'); + $this->context->controller->addCSS($this->_path . 'views/css/back.css'); + } + + public function hookActionProductSave($hook_params) + { + if (Module::isEnabled('omnibuseufree')) { + $id_product = (int) $hook_params['id_product']; + + $combinationCount = (int) Db::getInstance()->getValue( + 'SELECT COUNT(*) FROM `' . _DB_PREFIX_ . 'product_attribute` WHERE `id_product` = ' . $id_product + ); + + Product::flushPriceCache(); + $this->addProductPrice($id_product); + + if ($combinationCount <= 30) { + $this->addProductPriceWithCombinations($id_product); + } + } + } + + public function hookActionProductAttributeUpdate() + { + if (Module::isEnabled('omnibuseufree')) { + $id_product = (int) Tools::getValue('id_product'); + + $combinationCount = (int) Db::getInstance()->getValue( + 'SELECT COUNT(*) FROM `' . _DB_PREFIX_ . 'product_attribute` WHERE `id_product` = ' . $id_product + ); + + // Skip entirely for products with many combinations. + // hookActionProductSave already handles base price recording. + // This hook fires once PER combination, so running here is wasteful. + if ($combinationCount > 30) { + return; + } + + Product::flushPriceCache(); + $this->addProductPrice($id_product); + $this->addProductPriceWithCombinations($id_product); + } + } + + /** + * Load the configuration form + */ + public function getContent() + { + $confirmation = ''; + if (((bool) Tools::isSubmit('submitOmnibusEuFreeModule')) == true) { + $confirmation = $this->postProcess(); + } + + $token = Configuration::get('OMNIBUSEUFREE_CRON_TOKEN', null, null, null, 'error'); + + $this->context->smarty->assign([ + 'module_dir' => $this->_path, + 'lang' => $this->context->language->iso_code, + 'update_prices' => Context::getContext()->link->getModuleLink('omnibuseufree', 'cron', array('type' => 1, 'token' => $token)), + 'delete_outdated_data' => Context::getContext()->link->getModuleLink('omnibuseufree', 'cron', array('type' => 2, 'token' => $token)), + 'cron_status' => Configuration::get('OMNIBUSEUFREE_CRON_STATUS', null, null, null, 2) + ]); + + $output = $this->context->smarty->fetch($this->local_path . 'views/templates/admin/configure.tpl'); + + return $confirmation . $output . $this->renderForm(); + } + + protected function renderForm() + { + $helper = new HelperForm(); + + $helper->show_toolbar = false; + $helper->table = $this->table; + $helper->module = $this; + $helper->default_form_language = $this->context->language->id; + $helper->allow_employee_form_lang = Configuration::get('PS_BO_ALLOW_EMPLOYEE_FORM_LANG', 0); + + $helper->identifier = $this->identifier; + $helper->submit_action = 'submitOmnibusEuFreeModule'; + $helper->currentIndex = $this->context->link->getAdminLink('AdminModules', false) + . '&configure=' . $this->name . '&tab_module=' . $this->tab . '&module_name=' . $this->name; + $helper->token = Tools::getAdminTokenLite('AdminModules'); + + $helper->tpl_vars = array( + 'fields_value' => $this->getConfigFormValues(), + 'languages' => $this->context->controller->getLanguages(), + 'id_language' => $this->context->language->id, + ); + + return $helper->generateForm(array($this->getConfigForm())); + } + + protected function getConfigForm() + { + $NumberOfDays = (int) Configuration::get('OMNIBUSEUFREE_DAYS', null, null, null, 30); + + return array( + 'form' => array( + 'legend' => array( + 'title' => $this->l('Settings'), + 'icon' => 'icon-cogs', + ), + 'input' => array( + array( + 'type' => 'switch', + 'label' => $this->l('Delete outdated data'), + 'name' => 'OMNIBUSEUFREE_OLD_DATA', + 'is_bool' => true, + 'values' => array( + array( + 'id' => 'active_on', + 'value' => true, + 'label' => $this->l('Enabled') + ), + array( + 'id' => 'active_off', + 'value' => false, + 'label' => $this->l('Disabled') + ) + ), + ), + array( + 'type' => 'switch', + 'label' => $this->l('Update prices'), + 'name' => 'OMNIBUSEUFREE_UPDATE_DATABASE_PRICE', + 'is_bool' => true, + 'values' => array( + array( + 'id' => 'active_on', + 'value' => true, + 'label' => $this->l('Enabled') + ), + array( + 'id' => 'active_off', + 'value' => false, + 'label' => $this->l('Disabled') + ) + ), + ), + array( + 'type' => 'select', + 'label' => $this->l('Version:'), + 'name' => 'OMNIBUSEUFREE_INFORMATION_VERSION', + 'class' => 'omnibus-select-version', + 'required' => true, + 'options' => array( + 'query' => array( + array( + 'id_option' => 1, + 'name' => sprintf($this->l('Lowest price in %d days'),$NumberOfDays) + ), + array( + 'id_option' => 2, + 'name' => sprintf($this->l('Lowest price in %d days before discount'),$NumberOfDays) + ), + ), + 'id' => 'id_option', + 'name' => 'name' + ) + ), + array( + 'type' => 'text', + 'label' => $this->l('Number of days'), + 'name' => 'OMNIBUSEUFREE_DAYS', + 'class' => 'omnibus-input-days', + 'maxlength' => '3', + 'required' => true + ), + array( + 'type' => 'text', + 'label' => $this->l('History retention (days)'), + 'desc' => $this->l('How many days of price history to keep and display in admin. Older entries (except current price) will be deleted by CRON.'), + 'name' => 'OMNIBUSEUFREE_HISTORY_DAYS', + 'class' => 'omnibus-input-days', + 'maxlength' => '4', + 'required' => true + ), + array( + 'type' => 'switch', + 'label' => $this->l('Display on product page'), + 'name' => 'OMNIBUSEUFREE_DISPLAY_PRODUCT_PRICE_BLOCK', + 'is_bool' => false, + 'desc' => $this->l('Hook: ProductPriceBlock type: after_price'), + 'values' => array( + array( + 'id' => 'active_on', + 'value' => 1, + 'label' => $this->l('Enabled') + ), + array( + 'id' => 'active_off', + 'value' => 2, + 'label' => $this->l('Disabled') + ) + ), + ), + array( + 'type' => 'switch', + 'label' => $this->l('CRON'), + 'name' => 'OMNIBUSEUFREE_CRON_STATUS', + 'is_bool' => false, + 'desc' => $this->l('A new token will be generated if you change the CRON status'), + 'values' => array( + array( + 'id' => 'active_on', + 'value' => 1, + 'label' => $this->l('Enabled') + ), + array( + 'id' => 'active_off', + 'value' => 2, + 'label' => $this->l('Disabled') + ) + ), + ), + ), + 'submit' => array( + 'title' => $this->l('Save'), + ), + ), + ); + } + + /** + * Set values for the inputs. + * + * OMNIBUSEUFREE_CRON_STATUS since v1.0.2 + * OMNIBUSEUFREE_DAYS since v1.0.2 + * + */ + protected function getConfigFormValues() + { + return array( + 'OMNIBUSEUFREE_OLD_DATA' => false, + 'OMNIBUSEUFREE_UPDATE_DATABASE_PRICE' => false, + 'OMNIBUSEUFREE_INFORMATION_VERSION' => Configuration::get('OMNIBUSEUFREE_INFORMATION_VERSION', null, null, null, 2), + 'OMNIBUSEUFREE_DISPLAY_PRODUCT_PRICE_BLOCK' => Configuration::get('OMNIBUSEUFREE_DISPLAY_PRODUCT_PRICE_BLOCK', null, null, null, 1), + 'OMNIBUSEUFREE_CRON_STATUS' => Configuration::get('OMNIBUSEUFREE_CRON_STATUS', null, null, null, 2), + 'OMNIBUSEUFREE_DAYS' => Configuration::get('OMNIBUSEUFREE_DAYS', null, null, null, 30), + 'OMNIBUSEUFREE_HISTORY_DAYS' => Configuration::get('OMNIBUSEUFREE_HISTORY_DAYS', null, null, null, 60) + ); + } + + /** + * Save form data. + */ + protected function postProcess() + { + if (Configuration::get('OMNIBUSEUFREE_CRON_STATUS', null, null, null, 2) != Tools::getValue('OMNIBUSEUFREE_CRON_STATUS')) { + Configuration::updateValue('OMNIBUSEUFREE_CRON_TOKEN', Tools::hash(Tools::passwdGen(16))); + } + + Configuration::updateValue('OMNIBUSEUFREE_INFORMATION_VERSION', (int) Tools::getValue('OMNIBUSEUFREE_INFORMATION_VERSION')); + Configuration::updateValue('OMNIBUSEUFREE_DISPLAY_PRODUCT_PRICE_BLOCK', (int) Tools::getValue('OMNIBUSEUFREE_DISPLAY_PRODUCT_PRICE_BLOCK')); + Configuration::updateValue('OMNIBUSEUFREE_CRON_STATUS', (int) Tools::getValue('OMNIBUSEUFREE_CRON_STATUS')); + Configuration::updateValue('OMNIBUSEUFREE_DAYS', (int) Tools::getValue('OMNIBUSEUFREE_DAYS')); + Configuration::updateValue('OMNIBUSEUFREE_HISTORY_DAYS', max(1, (int) Tools::getValue('OMNIBUSEUFREE_HISTORY_DAYS'))); + + $confirmation = $this->l('The settings have been updated.'); + + if (Tools::getValue('OMNIBUSEUFREE_OLD_DATA')) { + $OldDataCounter = $this->removeOldDataFromOmnibusTable(); + PrestaShopLogger::addLog('Omnibus Directive module by presta.studio - Deleted old data. Number of records deleted in database: ' . $OldDataCounter); + $confirmation .= '
' . $this->l('Deleted old data. Number of records deleted in database: ') . $OldDataCounter; + } + + if (Tools::getValue('OMNIBUSEUFREE_UPDATE_DATABASE_PRICE')) { + $InsertDataCounter = $this->insertAllProductsToOmnibusTable(); + PrestaShopLogger::addLog('Omnibus Directive module by presta.studio - Updated price history. Number of products checked: ' . $InsertDataCounter); + $confirmation .= '
' . $this->l('Updated price history. Number of products checked: ') . $InsertDataCounter; + } + + return $this->displayConfirmation($confirmation); + } + + protected function checkCurrencyConversionRate($id_product = null, $id_product_attribute = 0) + { + if (!isset($id_product)) { + throw new Exception('Missing parameter: $id_product'); + } + + $sql = new DbQuery(); + $sql->select('id_currency, currency_conversion_rate'); + $sql->from('omnibus_eu_free'); + $sql->where('id_product = ' . (int) $id_product); + $sql->where('id_product_attribute = ' . (int) $id_product_attribute); + $sql->where('is_last = 1'); + $SQLResult = Db::getInstance()->executeS($sql); + + $ToChange = 0; + $OmnibusCurrencies = array(); + + foreach ($SQLResult as $row) { + $OmnibusCurrencies[$row['id_currency']] = $row['currency_conversion_rate']; + } + + if (!empty($OmnibusCurrencies)) { + $currencies = Currency::getCurrencies(); + $AvailableCurrencies = array(); + + foreach ($currencies as $currency) { + $AvailableCurrencies[$currency['id_currency']] = $currency['conversion_rate']; + } + + foreach ($AvailableCurrencies as $CurrencyKey => $CurrencyValue) { + if (!isset($OmnibusCurrencies[$CurrencyKey]) || $CurrencyValue != $OmnibusCurrencies[$CurrencyKey]) { + $ToChange++; + } + } + } + else { + $ToChange++; + } + + return $ToChange == 0 ? false : true; + } + + protected function addProductPrice($id_product = null) + { + if (!isset($id_product)) { + throw new Exception('Missing parameter: $id_product'); + } + + $product = new Product($id_product); + $product_price = $product->getPrice(); + + if($product_price != 0){ + $omnibus_price = array(); + $omnibus_price = $this->getLastPrice($id_product, 0); + + $check_currency = $this->checkCurrencyConversionRate($id_product, 0); + + if (empty($omnibus_price) || $product_price != $omnibus_price[0]['price'] || (bool) $check_currency == true) { + $this->clearLastPrice($id_product); + $currencies = Currency::getCurrencies(); + $defaultCurrency = Currency::getDefaultCurrency(); + + foreach ($currencies as $currency) { + if ($currency['id_currency'] == $defaultCurrency->id) { + $isDefaultCurrency = 1; + $product_price_currency = $product_price; + } + else { + $isDefaultCurrency = 0; + $product_price_currency = Tools::convertPrice($product_price, $currency); + } + + $this->insertToOmnibusTable($id_product, 0, $product_price_currency, $currency['id_currency'], $isDefaultCurrency, $currency['conversion_rate']); + } + } + } + } + + protected function addProductPriceWithCombinations($id_product = null) + { + if (!isset($id_product)) { + throw new Exception('Missing parameter: $id_product'); + } + + $product = new Product($id_product); + $product_combinations = $product->getAttributeCombinations(); + + if (!empty($product_combinations)) { + $currencies = Currency::getCurrencies(); + $defaultCurrency = Currency::getDefaultCurrency(); + + foreach ($product_combinations as $combination) { + $product_price = $product->getPrice(true, $combination['id_product_attribute']); + + if($product_price != 0){ + $omnibus_price = array(); + $omnibus_price = $this->getLastPrice($id_product, $combination['id_product_attribute']); + + $check_currency = $this->checkCurrencyConversionRate($id_product, $combination['id_product_attribute']); + + if (empty($omnibus_price) || $product_price != $omnibus_price[0]['price'] || (bool) $check_currency == true) { + $this->clearLastPrice($id_product, $combination['id_product_attribute']); + + foreach ($currencies as $currency) { + if ($currency['id_currency'] == $defaultCurrency->id) { + $isDefaultCurrency = 1; + $product_price_currency = $product_price; + } + else { + $isDefaultCurrency = 0; + $product_price_currency = Tools::convertPrice($product_price, $currency); + } + + $this->insertToOmnibusTable($id_product, $combination['id_product_attribute'], $product_price_currency, $currency['id_currency'], $isDefaultCurrency, $currency['conversion_rate']); + } + } + } + } + } + } + + protected function insertToOmnibusTable($id_product = 0, $id_product_attribute = 0, $product_price = 0, $currency = 0, $isDefaultCurrency = 0, $CurrencyConversionRate = 0) + { + $result = Db::getInstance()->insert('omnibus_eu_free', [ + 'id_product' => (int) $id_product, + 'id_product_attribute' => (int) $id_product_attribute, + 'price' => pSQL($product_price), + 'id_currency' => (int) $currency, + 'is_default_currency' => (int) $isDefaultCurrency, + 'is_last' => 1, + 'currency_conversion_rate' => pSQL($CurrencyConversionRate) + ]); + } + + protected function getLastPrice($id_product = 0, $id_product_attribute = 0) + { + $sql = new DbQuery(); + $sql->select('price'); + $sql->from('omnibus_eu_free'); + $sql->where('id_product = ' . (int) $id_product); + $sql->where('id_product_attribute = ' . (int) $id_product_attribute); + $sql->where('is_last = 1'); + $sql->where('is_default_currency = 1'); + $sql->limit(1); + + return Db::getInstance()->executeS($sql); + } + + protected function getOmnibusData($id_product = null) + { + if (!isset($id_product)) { + throw new Exception('Missing parameter: $id_product'); + } + + $historyDays = (int) Configuration::get('OMNIBUSEUFREE_HISTORY_DAYS', null, null, null, 60); + + $sql = new DbQuery(); + $sql->select('*'); + $sql->from('omnibus_eu_free'); + $sql->where('id_product = ' . (int) $id_product); + $sql->where('(`is_last` = 1 OR `date_add` >= DATE_SUB(NOW(), INTERVAL ' . $historyDays . ' DAY))'); + $sql->orderBy('is_default_currency DESC'); + $sql->orderBy('id_currency ASC'); + $sql->orderBy('id_product_attribute ASC'); + $sql->orderBy('id_omnibuseufree DESC'); + + return Db::getInstance()->executeS($sql); + } + + protected function clearLastPrice($id_product = 0, $id_product_attribute = 0) + { + $result = Db::getInstance()->update('omnibus_eu_free', array( + 'is_last' => 0, + ), 'id_product = ' . (int) $id_product . ' AND id_product_attribute = ' . (int) $id_product_attribute); + } + + public function insertAllProductsToOmnibusTable() + { + $counter = 0; + $ProductClass = new Product(); + $ProductClass->flushPriceCache(); + $products = $ProductClass->getProducts($this->context->language->id, 0, 0, 'id_product', 'ASC'); + + foreach ($products as $product) { + $this->addProductPriceWithCombinations($product['id_product']); + $this->addProductPrice($product['id_product']); + $counter++; + } + + return $counter; + } + + public function removeOldDataFromOmnibusTable() + { + $numberOfDays = (int) Configuration::get('OMNIBUSEUFREE_HISTORY_DAYS', null, null, null, 60); + + Db::getInstance()->execute( + 'DELETE FROM `' . _DB_PREFIX_ . 'omnibus_eu_free` + WHERE `is_last` = 0 + AND `date_add` < DATE_SUB(NOW(), INTERVAL ' . $numberOfDays . ' DAY)' + ); + + return (int) Db::getInstance()->Affected_Rows(); + } +} diff --git a/modules/omnibuseufree/sql/index.php b/modules/omnibuseufree/sql/index.php new file mode 100644 index 00000000..65e05151 --- /dev/null +++ b/modules/omnibuseufree/sql/index.php @@ -0,0 +1,23 @@ +execute($query) == false) { + return false; + } +} diff --git a/modules/omnibuseufree/sql/uninstall.php b/modules/omnibuseufree/sql/uninstall.php new file mode 100644 index 00000000..68454a7b --- /dev/null +++ b/modules/omnibuseufree/sql/uninstall.php @@ -0,0 +1,24 @@ +execute($query) == false) { + return false; + } +} diff --git a/modules/omnibuseufree/src/compatibility/PrestashopCompatibility.php b/modules/omnibuseufree/src/compatibility/PrestashopCompatibility.php new file mode 100644 index 00000000..731df1e0 --- /dev/null +++ b/modules/omnibuseufree/src/compatibility/PrestashopCompatibility.php @@ -0,0 +1,35 @@ += 0) { + return Tools::getContextLocale(Context::getContext())->formatPrice($price, $currency->iso_code); + } + else { + return Tools::displayPrice($price, $currency->id); + } + } +} diff --git a/modules/omnibuseufree/src/compatibility/index.php b/modules/omnibuseufree/src/compatibility/index.php new file mode 100644 index 00000000..65e05151 --- /dev/null +++ b/modules/omnibuseufree/src/compatibility/index.php @@ -0,0 +1,23 @@ +link->getAdminLink('AdminModules').'&configure=omnibuseufree'); + } +} \ No newline at end of file diff --git a/modules/omnibuseufree/src/controller/index.php b/modules/omnibuseufree/src/controller/index.php new file mode 100644 index 00000000..65e05151 --- /dev/null +++ b/modules/omnibuseufree/src/controller/index.php @@ -0,0 +1,23 @@ +omnibuseufree_1f02c2fa9d484f44c5da7f380dff8c60'] = 'Dyrektywa Omnibus'; +$_MODULE['<{omnibuseufree}prestashop>omnibuseufree_a79fe40b2123c032e9a814001fe222bd'] = 'Ten moduł pomoże Ci spełnić wymagania Europejskiej Dyrektywy Omnibus.'; +$_MODULE['<{omnibuseufree}prestashop>omnibuseufree_28819824712520e55d7c4a41e7b4a473'] = 'Czy na pewno chcesz odinstalować ten moduł? Historia cen zostanie usunięta.'; +$_MODULE['<{omnibuseufree}prestashop>omnibuseufree_292798f2e60c44bdb0f8574e23ef93c9'] = '(domyślna kombinacja)'; +$_MODULE['<{omnibuseufree}prestashop>omnibuseufree_f4f70727dc34561dfde1a3c529b6205c'] = 'Ustawienia'; +$_MODULE['<{omnibuseufree}prestashop>omnibuseufree_f7e5ee1fbf4617a1f7392a78df1c7f51'] = 'Usuń nieaktualne dane'; +$_MODULE['<{omnibuseufree}prestashop>omnibuseufree_00d23a76e43b46dae9ec7aa9dcbebb32'] = 'Włączony'; +$_MODULE['<{omnibuseufree}prestashop>omnibuseufree_b9f5c797ebbf55adccdd8539a65a0241'] = 'Wyłączony'; +$_MODULE['<{omnibuseufree}prestashop>omnibuseufree_bb2a88ee038dcf4ee8c5d3c2c0c9932a'] = 'Zaktualizuj ceny'; +$_MODULE['<{omnibuseufree}prestashop>omnibuseufree_9d290d3434589e33be3d2cad4f8323ec'] = 'Wersja'; +$_MODULE['<{omnibuseufree}prestashop>omnibuseufree_7cb3887eb464b7ec919eaab83d2b2bf8'] = 'Najniższa cena w ciągu %d dni'; +$_MODULE['<{omnibuseufree}prestashop>omnibuseufree_8f5d023ee6465215923e8ff47460c16c'] = 'Najniższa cena w ciągu %d dni przed obniżką'; +$_MODULE['<{omnibuseufree}prestashop>omnibuseufree_58fd2b2308056ad80255a322b305742b'] = 'Ilość dni'; +$_MODULE['<{omnibuseufree}prestashop>omnibuseufree_05bc01ac9b2ddb3ca06251211ba7ffba'] = 'Wyświetlaj na stronie produktu'; +$_MODULE['<{omnibuseufree}prestashop>omnibuseufree_9153c0b134e442737ebcda88012a29b8'] = 'Hook: ProductPriceBlock type: after_price'; +$_MODULE['<{omnibuseufree}prestashop>omnibuseufree_c16afd878f99cc59851c860ea909059d'] = 'CRON'; +$_MODULE['<{omnibuseufree}prestashop>omnibuseufree_08baf2fc3ce7096a98a262d45bd2eb6e'] = 'Nowy token zostanie wygenerowany przy każdym włączeniu CRON'; +$_MODULE['<{omnibuseufree}prestashop>omnibuseufree_c9cc8cce247e49bae79f15173ce97354'] = 'Zapisz'; +$_MODULE['<{omnibuseufree}prestashop>omnibuseufree_efc226b17e0532afff43be870bff0de7'] = 'Ustawienia zostały zapisane'; +$_MODULE['<{omnibuseufree}prestashop>omnibuseufree_f1bf37ab201597afc8a9c65bcbec15f1'] = 'Usunięto nieaktualne dane. Ilość usuniętych rekordów w bazie danych: '; +$_MODULE['<{omnibuseufree}prestashop>omnibuseufree_cb9221743dea1428e7fdc4c7c9b499cd'] = 'Zaktualizowano historię cen. Ilość sprawdzonych produktów: '; +$_MODULE['<{omnibuseufree}prestashop>configure_5b6cf869265c13af8566f192b4ab3d2a'] = 'Dokumentacja'; +$_MODULE['<{omnibuseufree}prestashop>configure_7c9a200fb690d89b9ab34f521db396fc'] = 'Instalacja i konfiguracja modułu'; +$_MODULE['<{omnibuseufree}prestashop>configure_78463a384a5aa4fad5fa73e2f506ecfc'] = 'English'; +$_MODULE['<{omnibuseufree}prestashop>configure_c730389bc8d99e59c867766babdd48b5'] = 'Polski'; +$_MODULE['<{omnibuseufree}prestashop>configure_738bc5faa88e6b0fa0e7e3385d7e4ee3'] = 'Obserwuj nas'; +$_MODULE['<{omnibuseufree}prestashop>configure_c16afd878f99cc59851c860ea909059d'] = 'CRON'; +$_MODULE['<{omnibuseufree}prestashop>configure_bb2a88ee038dcf4ee8c5d3c2c0c9932a'] = 'Zaktualizuj ceny'; +$_MODULE['<{omnibuseufree}prestashop>configure_7ba8e8ff7f4d3a79fb20609888b2bf3b'] = 'CRON jest wyłączony'; +$_MODULE['<{omnibuseufree}prestashop>configure_f7e5ee1fbf4617a1f7392a78df1c7f51'] = 'Usuń nieaktualne dane'; +$_MODULE['<{omnibuseufree}prestashop>products-price-list_a593c6d1e05af324063dac348353cece'] = 'Odśwież stronę'; +$_MODULE['<{omnibuseufree}prestashop>products-price-list_60cd4fe878b3953e84fe70f7f37dea84'] = 'Zapisz ustawienia przed odświeżeniem strony!'; +$_MODULE['<{omnibuseufree}prestashop>products-price-list_74e5e485bacb9dab571e5acf673bd823'] = 'ID:'; +$_MODULE['<{omnibuseufree}prestashop>products-price-list_47c3f766582c23412805a4564235e319'] = 'Nazwa produktu:'; +$_MODULE['<{omnibuseufree}prestashop>products-price-list_75edf643d9f66f0f905722da73da0a94'] = 'Cena:'; +$_MODULE['<{omnibuseufree}prestashop>products-price-list_1b13b43983ddd15eb8c8023686e24cbb'] = 'Waluta:'; +$_MODULE['<{omnibuseufree}prestashop>products-price-list_bb3fa120d9acc4dd89421921b049645f'] = 'Ostatnia wartość:'; +$_MODULE['<{omnibuseufree}prestashop>products-price-list_a6054352db7de250c83770a6eac6383d'] = 'Data dodania'; +$_MODULE['<{omnibuseufree}prestashop>presta_studio_omnibus_price_fd8c93ac2518db4006d802382d71d257'] = 'Najniższa cena w ciągu %d dni przed obniżką: '; +$_MODULE['<{omnibuseufree}prestashop>presta_studio_omnibus_price_75c403f3838c531bfefa5cec252b011e'] = 'Najniższa cena w ciągu %d dni: '; diff --git a/modules/omnibuseufree/upgrade/index.php b/modules/omnibuseufree/upgrade/index.php new file mode 100644 index 00000000..65e05151 --- /dev/null +++ b/modules/omnibuseufree/upgrade/index.php @@ -0,0 +1,23 @@ + + Order deny,allow + Deny from all + + +# Apache 2.4 + + Require all denied + diff --git a/modules/omnibuseufree/vendor/autoload.php b/modules/omnibuseufree/vendor/autoload.php new file mode 100644 index 00000000..be67207a --- /dev/null +++ b/modules/omnibuseufree/vendor/autoload.php @@ -0,0 +1,25 @@ + + * Jordi Boggiano + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Composer\Autoload; + +/** + * ClassLoader implements a PSR-0, PSR-4 and classmap class loader. + * + * $loader = new \Composer\Autoload\ClassLoader(); + * + * // register classes with namespaces + * $loader->add('Symfony\Component', __DIR__.'/component'); + * $loader->add('Symfony', __DIR__.'/framework'); + * + * // activate the autoloader + * $loader->register(); + * + * // to enable searching the include path (eg. for PEAR packages) + * $loader->setUseIncludePath(true); + * + * In this example, if you try to use a class in the Symfony\Component + * namespace or one of its children (Symfony\Component\Console for instance), + * the autoloader will first look for the class under the component/ + * directory, and it will then fallback to the framework/ directory if not + * found before giving up. + * + * This class is loosely based on the Symfony UniversalClassLoader. + * + * @author Fabien Potencier + * @author Jordi Boggiano + * @see https://www.php-fig.org/psr/psr-0/ + * @see https://www.php-fig.org/psr/psr-4/ + */ +class ClassLoader +{ + /** @var \Closure(string):void */ + private static $includeFile; + + /** @var ?string */ + private $vendorDir; + + // PSR-4 + /** + * @var array[] + * @psalm-var array> + */ + private $prefixLengthsPsr4 = array(); + /** + * @var array[] + * @psalm-var array> + */ + private $prefixDirsPsr4 = array(); + /** + * @var array[] + * @psalm-var array + */ + private $fallbackDirsPsr4 = array(); + + // PSR-0 + /** + * @var array[] + * @psalm-var array> + */ + private $prefixesPsr0 = array(); + /** + * @var array[] + * @psalm-var array + */ + private $fallbackDirsPsr0 = array(); + + /** @var bool */ + private $useIncludePath = false; + + /** + * @var string[] + * @psalm-var array + */ + private $classMap = array(); + + /** @var bool */ + private $classMapAuthoritative = false; + + /** + * @var bool[] + * @psalm-var array + */ + private $missingClasses = array(); + + /** @var ?string */ + private $apcuPrefix; + + /** + * @var self[] + */ + private static $registeredLoaders = array(); + + /** + * @param ?string $vendorDir + */ + public function __construct($vendorDir = null) + { + $this->vendorDir = $vendorDir; + self::initializeIncludeClosure(); + } + + /** + * @return string[] + */ + public function getPrefixes() + { + if (!empty($this->prefixesPsr0)) { + return call_user_func_array('array_merge', array_values($this->prefixesPsr0)); + } + + return array(); + } + + /** + * @return array[] + * @psalm-return array> + */ + public function getPrefixesPsr4() + { + return $this->prefixDirsPsr4; + } + + /** + * @return array[] + * @psalm-return array + */ + public function getFallbackDirs() + { + return $this->fallbackDirsPsr0; + } + + /** + * @return array[] + * @psalm-return array + */ + public function getFallbackDirsPsr4() + { + return $this->fallbackDirsPsr4; + } + + /** + * @return string[] Array of classname => path + * @psalm-return array + */ + public function getClassMap() + { + return $this->classMap; + } + + /** + * @param string[] $classMap Class to filename map + * @psalm-param array $classMap + * + * @return void + */ + public function addClassMap(array $classMap) + { + if ($this->classMap) { + $this->classMap = array_merge($this->classMap, $classMap); + } else { + $this->classMap = $classMap; + } + } + + /** + * Registers a set of PSR-0 directories for a given prefix, either + * appending or prepending to the ones previously set for this prefix. + * + * @param string $prefix The prefix + * @param string[]|string $paths The PSR-0 root directories + * @param bool $prepend Whether to prepend the directories + * + * @return void + */ + public function add($prefix, $paths, $prepend = false) + { + if (!$prefix) { + if ($prepend) { + $this->fallbackDirsPsr0 = array_merge( + (array) $paths, + $this->fallbackDirsPsr0 + ); + } else { + $this->fallbackDirsPsr0 = array_merge( + $this->fallbackDirsPsr0, + (array) $paths + ); + } + + return; + } + + $first = $prefix[0]; + if (!isset($this->prefixesPsr0[$first][$prefix])) { + $this->prefixesPsr0[$first][$prefix] = (array) $paths; + + return; + } + if ($prepend) { + $this->prefixesPsr0[$first][$prefix] = array_merge( + (array) $paths, + $this->prefixesPsr0[$first][$prefix] + ); + } else { + $this->prefixesPsr0[$first][$prefix] = array_merge( + $this->prefixesPsr0[$first][$prefix], + (array) $paths + ); + } + } + + /** + * Registers a set of PSR-4 directories for a given namespace, either + * appending or prepending to the ones previously set for this namespace. + * + * @param string $prefix The prefix/namespace, with trailing '\\' + * @param string[]|string $paths The PSR-4 base directories + * @param bool $prepend Whether to prepend the directories + * + * @throws \InvalidArgumentException + * + * @return void + */ + public function addPsr4($prefix, $paths, $prepend = false) + { + if (!$prefix) { + // Register directories for the root namespace. + if ($prepend) { + $this->fallbackDirsPsr4 = array_merge( + (array) $paths, + $this->fallbackDirsPsr4 + ); + } else { + $this->fallbackDirsPsr4 = array_merge( + $this->fallbackDirsPsr4, + (array) $paths + ); + } + } elseif (!isset($this->prefixDirsPsr4[$prefix])) { + // Register directories for a new namespace. + $length = strlen($prefix); + if ('\\' !== $prefix[$length - 1]) { + throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator."); + } + $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length; + $this->prefixDirsPsr4[$prefix] = (array) $paths; + } elseif ($prepend) { + // Prepend directories for an already registered namespace. + $this->prefixDirsPsr4[$prefix] = array_merge( + (array) $paths, + $this->prefixDirsPsr4[$prefix] + ); + } else { + // Append directories for an already registered namespace. + $this->prefixDirsPsr4[$prefix] = array_merge( + $this->prefixDirsPsr4[$prefix], + (array) $paths + ); + } + } + + /** + * Registers a set of PSR-0 directories for a given prefix, + * replacing any others previously set for this prefix. + * + * @param string $prefix The prefix + * @param string[]|string $paths The PSR-0 base directories + * + * @return void + */ + public function set($prefix, $paths) + { + if (!$prefix) { + $this->fallbackDirsPsr0 = (array) $paths; + } else { + $this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths; + } + } + + /** + * Registers a set of PSR-4 directories for a given namespace, + * replacing any others previously set for this namespace. + * + * @param string $prefix The prefix/namespace, with trailing '\\' + * @param string[]|string $paths The PSR-4 base directories + * + * @throws \InvalidArgumentException + * + * @return void + */ + public function setPsr4($prefix, $paths) + { + if (!$prefix) { + $this->fallbackDirsPsr4 = (array) $paths; + } else { + $length = strlen($prefix); + if ('\\' !== $prefix[$length - 1]) { + throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator."); + } + $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length; + $this->prefixDirsPsr4[$prefix] = (array) $paths; + } + } + + /** + * Turns on searching the include path for class files. + * + * @param bool $useIncludePath + * + * @return void + */ + public function setUseIncludePath($useIncludePath) + { + $this->useIncludePath = $useIncludePath; + } + + /** + * Can be used to check if the autoloader uses the include path to check + * for classes. + * + * @return bool + */ + public function getUseIncludePath() + { + return $this->useIncludePath; + } + + /** + * Turns off searching the prefix and fallback directories for classes + * that have not been registered with the class map. + * + * @param bool $classMapAuthoritative + * + * @return void + */ + public function setClassMapAuthoritative($classMapAuthoritative) + { + $this->classMapAuthoritative = $classMapAuthoritative; + } + + /** + * Should class lookup fail if not found in the current class map? + * + * @return bool + */ + public function isClassMapAuthoritative() + { + return $this->classMapAuthoritative; + } + + /** + * APCu prefix to use to cache found/not-found classes, if the extension is enabled. + * + * @param string|null $apcuPrefix + * + * @return void + */ + public function setApcuPrefix($apcuPrefix) + { + $this->apcuPrefix = function_exists('apcu_fetch') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) ? $apcuPrefix : null; + } + + /** + * The APCu prefix in use, or null if APCu caching is not enabled. + * + * @return string|null + */ + public function getApcuPrefix() + { + return $this->apcuPrefix; + } + + /** + * Registers this instance as an autoloader. + * + * @param bool $prepend Whether to prepend the autoloader or not + * + * @return void + */ + public function register($prepend = false) + { + spl_autoload_register(array($this, 'loadClass'), true, $prepend); + + if (null === $this->vendorDir) { + return; + } + + if ($prepend) { + self::$registeredLoaders = array($this->vendorDir => $this) + self::$registeredLoaders; + } else { + unset(self::$registeredLoaders[$this->vendorDir]); + self::$registeredLoaders[$this->vendorDir] = $this; + } + } + + /** + * Unregisters this instance as an autoloader. + * + * @return void + */ + public function unregister() + { + spl_autoload_unregister(array($this, 'loadClass')); + + if (null !== $this->vendorDir) { + unset(self::$registeredLoaders[$this->vendorDir]); + } + } + + /** + * Loads the given class or interface. + * + * @param string $class The name of the class + * @return true|null True if loaded, null otherwise + */ + public function loadClass($class) + { + if ($file = $this->findFile($class)) { + (self::$includeFile)($file); + + return true; + } + + return null; + } + + /** + * Finds the path to the file where the class is defined. + * + * @param string $class The name of the class + * + * @return string|false The path if found, false otherwise + */ + public function findFile($class) + { + // class map lookup + if (isset($this->classMap[$class])) { + return $this->classMap[$class]; + } + if ($this->classMapAuthoritative || isset($this->missingClasses[$class])) { + return false; + } + if (null !== $this->apcuPrefix) { + $file = apcu_fetch($this->apcuPrefix.$class, $hit); + if ($hit) { + return $file; + } + } + + $file = $this->findFileWithExtension($class, '.php'); + + // Search for Hack files if we are running on HHVM + if (false === $file && defined('HHVM_VERSION')) { + $file = $this->findFileWithExtension($class, '.hh'); + } + + if (null !== $this->apcuPrefix) { + apcu_add($this->apcuPrefix.$class, $file); + } + + if (false === $file) { + // Remember that this class does not exist. + $this->missingClasses[$class] = true; + } + + return $file; + } + + /** + * Returns the currently registered loaders indexed by their corresponding vendor directories. + * + * @return self[] + */ + public static function getRegisteredLoaders() + { + return self::$registeredLoaders; + } + + /** + * @param string $class + * @param string $ext + * @return string|false + */ + private function findFileWithExtension($class, $ext) + { + // PSR-4 lookup + $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext; + + $first = $class[0]; + if (isset($this->prefixLengthsPsr4[$first])) { + $subPath = $class; + while (false !== $lastPos = strrpos($subPath, '\\')) { + $subPath = substr($subPath, 0, $lastPos); + $search = $subPath . '\\'; + if (isset($this->prefixDirsPsr4[$search])) { + $pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1); + foreach ($this->prefixDirsPsr4[$search] as $dir) { + if (file_exists($file = $dir . $pathEnd)) { + return $file; + } + } + } + } + } + + // PSR-4 fallback dirs + foreach ($this->fallbackDirsPsr4 as $dir) { + if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) { + return $file; + } + } + + // PSR-0 lookup + if (false !== $pos = strrpos($class, '\\')) { + // namespaced class name + $logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1) + . strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR); + } else { + // PEAR-like class name + $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext; + } + + if (isset($this->prefixesPsr0[$first])) { + foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) { + if (0 === strpos($class, $prefix)) { + foreach ($dirs as $dir) { + if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) { + return $file; + } + } + } + } + } + + // PSR-0 fallback dirs + foreach ($this->fallbackDirsPsr0 as $dir) { + if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) { + return $file; + } + } + + // PSR-0 include paths. + if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) { + return $file; + } + + return false; + } + + private static function initializeIncludeClosure(): void + { + if (self::$includeFile !== null) { + return; + } + + /** + * Scope isolated include. + * + * Prevents access to $this/self from included files. + * + * @param string $file + * @return void + */ + self::$includeFile = static function($file) { + include $file; + }; + } +} diff --git a/modules/omnibuseufree/vendor/composer/LICENSE b/modules/omnibuseufree/vendor/composer/LICENSE new file mode 100644 index 00000000..f27399a0 --- /dev/null +++ b/modules/omnibuseufree/vendor/composer/LICENSE @@ -0,0 +1,21 @@ + +Copyright (c) Nils Adermann, Jordi Boggiano + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is furnished +to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + diff --git a/modules/omnibuseufree/vendor/composer/autoload_classmap.php b/modules/omnibuseufree/vendor/composer/autoload_classmap.php new file mode 100644 index 00000000..b6ea74f8 --- /dev/null +++ b/modules/omnibuseufree/vendor/composer/autoload_classmap.php @@ -0,0 +1,12 @@ + $vendorDir . '/composer/InstalledVersions.php', + 'Omnibus\\Compatibility\\PrestashopCompatibility' => $baseDir . '/src/compatibility/PrestashopCompatibility.php', + 'Omnibus\\Controller\\MenuController' => $baseDir . '/src/controller/MenuController.php', +); diff --git a/modules/omnibuseufree/vendor/composer/autoload_namespaces.php b/modules/omnibuseufree/vendor/composer/autoload_namespaces.php new file mode 100644 index 00000000..15a2ff3a --- /dev/null +++ b/modules/omnibuseufree/vendor/composer/autoload_namespaces.php @@ -0,0 +1,9 @@ + array($baseDir . '/src/controller'), + 'Omnibus\\Compatibility\\' => array($baseDir . '/src/compatibility'), +); diff --git a/modules/omnibuseufree/vendor/composer/autoload_real.php b/modules/omnibuseufree/vendor/composer/autoload_real.php new file mode 100644 index 00000000..24695f9a --- /dev/null +++ b/modules/omnibuseufree/vendor/composer/autoload_real.php @@ -0,0 +1,36 @@ +register(false); + + return $loader; + } +} diff --git a/modules/omnibuseufree/vendor/composer/autoload_static.php b/modules/omnibuseufree/vendor/composer/autoload_static.php new file mode 100644 index 00000000..166a6939 --- /dev/null +++ b/modules/omnibuseufree/vendor/composer/autoload_static.php @@ -0,0 +1,43 @@ + + array ( + 'Omnibus\\Controller\\' => 19, + 'Omnibus\\Compatibility\\' => 22, + ), + ); + + public static $prefixDirsPsr4 = array ( + 'Omnibus\\Controller\\' => + array ( + 0 => __DIR__ . '/../..' . '/src/controller', + ), + 'Omnibus\\Compatibility\\' => + array ( + 0 => __DIR__ . '/../..' . '/src/compatibility', + ), + ); + + public static $classMap = array ( + 'Composer\\InstalledVersions' => __DIR__ . '/..' . '/composer/InstalledVersions.php', + 'Omnibus\\Compatibility\\PrestashopCompatibility' => __DIR__ . '/../..' . '/src/compatibility/PrestashopCompatibility.php', + 'Omnibus\\Controller\\MenuController' => __DIR__ . '/../..' . '/src/controller/MenuController.php', + ); + + public static function getInitializer(ClassLoader $loader) + { + return \Closure::bind(function () use ($loader) { + $loader->prefixLengthsPsr4 = ComposerStaticInit26f72ce49b24d770f51f3125f1089bff::$prefixLengthsPsr4; + $loader->prefixDirsPsr4 = ComposerStaticInit26f72ce49b24d770f51f3125f1089bff::$prefixDirsPsr4; + $loader->classMap = ComposerStaticInit26f72ce49b24d770f51f3125f1089bff::$classMap; + + }, null, ClassLoader::class); + } +} diff --git a/modules/omnibuseufree/vendor/composer/index.php b/modules/omnibuseufree/vendor/composer/index.php new file mode 100644 index 00000000..65e05151 --- /dev/null +++ b/modules/omnibuseufree/vendor/composer/index.php @@ -0,0 +1,23 @@ + +
+
+
+ {l s='Documentation' mod='omnibuseufree'} +
+
+ presta.studio + +
+
+
+
+

» {l s='Module installation and configuration' mod='omnibuseufree'}:

+ + +

» {l s='Follow us on' mod='omnibuseufree'}:

+ + +
+ +
+
+ {if $lang == 'pl'} + + + {else} + + + {/if} +
+
+
+
+ sync{l s='CRON' mod='omnibuseufree'} +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
diff --git a/modules/omnibuseufree/views/templates/admin/index.php b/modules/omnibuseufree/views/templates/admin/index.php new file mode 100644 index 00000000..65e05151 --- /dev/null +++ b/modules/omnibuseufree/views/templates/admin/index.php @@ -0,0 +1,23 @@ + + +
+ {l s='Save changes before refresh page!' mod='omnibuseufree'} +
+ + + + + + + + + + + + + + + {if !empty($OmnibuseufreeData)} + {foreach from=$OmnibuseufreeData item=item key=key} + + + + + + + + + {/foreach} + {/if} + +
{l s='ID: ' mod='omnibuseufree'}{l s='Product name: ' mod='omnibuseufree'}{l s='Price: ' mod='omnibuseufree'}{l s='Currency: ' mod='omnibuseufree'}{l s='Last value: ' mod='omnibuseufree'}{l s='Date Added: ' mod='omnibuseufree'}
{$key+1}{$item.name}{$item.price_locale}{$item.currency_iso_code}{$item.is_last_icon}{$item.date_add}
\ No newline at end of file diff --git a/modules/omnibuseufree/views/templates/hook/index.php b/modules/omnibuseufree/views/templates/hook/index.php new file mode 100644 index 00000000..65e05151 --- /dev/null +++ b/modules/omnibuseufree/views/templates/hook/index.php @@ -0,0 +1,23 @@ + +

+ {if $OmnibuseufreeInfoVersion == 2} + {if $OmnibuseufreeProductPriceMin != null} + {l s='Lowest price in %d days before discount: ' sprintf=[$OmnibuseufreeNumberOfDays] mod='omnibuseufree'}{$OmnibuseufreeProductPriceMin} + {else} + {* when history is empty *} + {l s='Lowest price in %d days: ' sprintf=[$OmnibuseufreeNumberOfDays] mod='omnibuseufree'}{$OmnibuseufreeProductPriceCurrent} + {/if} + {else} + {l s='Lowest price in %d days: ' sprintf=[$OmnibuseufreeNumberOfDays] mod='omnibuseufree'}{$OmnibuseufreeProductPriceMin} + {/if} +

+ +{/if} \ No newline at end of file diff --git a/modules/omnibuseufree/views/templates/index.php b/modules/omnibuseufree/views/templates/index.php new file mode 100644 index 00000000..65e05151 --- /dev/null +++ b/modules/omnibuseufree/views/templates/index.php @@ -0,0 +1,23 @@ +