diff --git a/controllers/front/SmailyCron.php b/controllers/front/SmailyCron.php index ebe130b..4b435b7 100644 --- a/controllers/front/SmailyCron.php +++ b/controllers/front/SmailyCron.php @@ -140,6 +140,10 @@ private function abandonedCart() $reminder_time = strtotime('+' . $delay . ' hours', $cart_updated_time); $current_time = strtotime(date('Y-m-d H:i') . ':00'); + // Continue with data gathering only if there is an email value to send data to. + if (empty($abandoned_cart['email'])) { + continue; + } // Check if mail has allready been sent about this cart $id_customer = (int) $abandoned_cart['id_customer']; $id_cart = (int) $abandoned_cart['id_cart']; @@ -151,10 +155,22 @@ private function abandonedCart() $adresses = array( 'email' => $abandoned_cart['email'], - 'firstname' => $abandoned_cart['firstname'], - 'lastname' => $abandoned_cart['lastname'], + 'firstname' => isset($abandoned_cart['firstname']) ? $abandoned_cart['firstname'] : '', + 'lastname' => isset($abandoned_cart['lastname']) ? $abandoned_cart['lastname'] :'', ); - + // Empty products array for legacy API. All fields are set to empty string. + $fields_available = array( + 'product_name', + 'product_description_short', + 'product_price', + 'product_category', + 'procuct_quantity', + ); + for ($i=1; $i < 11; $i++) { + foreach ($fields_available as $field) { + $adresses[ $field . '_' . $i ] = ''; + } + } // Collect products of abandoned cart. if (!empty($products)) { $i = 1; diff --git a/translations/et.php b/translations/et.php index 4298024..bcfa563 100644 --- a/translations/et.php +++ b/translations/et.php @@ -21,7 +21,7 @@ $_MODULE['<{smailyforprestashop}prestashop>smailycron_ff0f6b0cf4d70ad36a09f7079be3f546'] = 'Unustatud ostukorvi meeldetuletus deaktiveeritud!'; $_MODULE['<{smailyforprestashop}prestashop>smailycron_b55a2b2d84680417f12898a11647a1cb'] = 'Vale kasutajatunnus või parool!'; $_MODULE['<{smailyforprestashop}prestashop>smaily_configure_05118375527d94e35408da46efdce0e5'] = 'Smaily Mooduli Sätted'; -$_MODULE['<{smailyforprestashop}prestashop>smaily_configure_b689be7d5235c3ec45ec989d993c5355'] = 'Aktiveeri kasutajate sünkroniseerimine'; +$_MODULE['<{smailyforprestashop}prestashop>smaily_configure_a69d72ba4abe9915e183bcd00d8fcc42'] = 'Käivita Kasutajate Sünkroniseerimine'; $_MODULE['<{smailyforprestashop}prestashop>smaily_configure_93cba07454f06a4a960172bbd6e2a435'] = 'Jah'; $_MODULE['<{smailyforprestashop}prestashop>smaily_configure_bafd7322c6e97d25b6299b5d6fe8920b'] = 'Ei'; $_MODULE['<{smailyforprestashop}prestashop>smaily_configure_beed05bccb8b6f21466910eb4a4f142b'] = 'Alamdomeen'; diff --git a/upgrade/Upgrade-1.1.0.php b/upgrade/Upgrade-1.1.0.php new file mode 100644 index 0000000..fbe4967 --- /dev/null +++ b/upgrade/Upgrade-1.1.0.php @@ -0,0 +1,42 @@ +. + * + * @author Smaily + * @copyright 2018 Smaily + * @license GPL3 + */ + +if (!defined('_PS_VERSION_')) { + exit; +} + +/** + * Upgrades database with smaily abandoned cart table. + * + */ +function upgrade_module_1_1_0() +{ + return Db::getInstance()->execute( + 'CREATE TABLE IF NOT EXISTS '._DB_PREFIX_.'smaily_cart ( + `id_smaily_cart` INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY , + `id_customer` INT UNSIGNED NULL , + `id_cart` INT UNSIGNED NULL , + `date_sent` DATETIME NOT NULL) ENGINE='._MYSQL_ENGINE_ + ); +} diff --git a/upgrade/index.php b/upgrade/index.php new file mode 100644 index 0000000..a714670 --- /dev/null +++ b/upgrade/index.php @@ -0,0 +1,31 @@ +. + * + * @author Smaily + * @copyright 2018 Smaily + * @license GPL3 + */ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); +header("Location: ../"); +exit; diff --git a/views/templates/admin/smaily_configure.tpl b/views/templates/admin/smaily_configure.tpl index 1da7aff..6d4ab17 100644 --- a/views/templates/admin/smaily_configure.tpl +++ b/views/templates/admin/smaily_configure.tpl @@ -33,7 +33,7 @@