From c0ac9c844b057e85e70fe6782ecc96b5e6ce6d7e Mon Sep 17 00:00:00 2001 From: TomAbel Date: Sat, 25 Jul 2020 20:55:07 +0300 Subject: [PATCH 01/51] RSS Feed tab --- views/templates/admin/smaily_configure.tpl | 69 +++++++++++++++++++++- 1 file changed, 68 insertions(+), 1 deletion(-) diff --git a/views/templates/admin/smaily_configure.tpl b/views/templates/admin/smaily_configure.tpl index cbbee97..e7db2c9 100644 --- a/views/templates/admin/smaily_configure.tpl +++ b/views/templates/admin/smaily_configure.tpl @@ -45,6 +45,9 @@ + {* Form content *}
@@ -331,11 +334,75 @@ + {* RSS feed settings *} +
+
+
+
+ +
+

{$smaily_rssfeed_url}

+

{l s="Copy this URL into your template editor's RSS block" mod='smailyforprestashop'}

+
+
+
+ +
+
+ + + {l s="Minutes" mod='smailyforprestashop'} + +
+

+ {l s="Limit how many products you will add to your feed. Maximum 250." mod='smailyforprestashop'} +

+
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+
+
From d98afe51e12b794ac238f835f3c5eb4ea7539abc Mon Sep 17 00:00:00 2001 From: TomAbel Date: Tue, 28 Jul 2020 21:20:29 +0300 Subject: [PATCH 02/51] Get product categories --- smailyforprestashop.php | 15 ++++++++++++ views/templates/admin/smaily_configure.tpl | 28 ++++++++++++++-------- 2 files changed, 33 insertions(+), 10 deletions(-) diff --git a/smailyforprestashop.php b/smailyforprestashop.php index 83210c7..4dc1119 100644 --- a/smailyforprestashop.php +++ b/smailyforprestashop.php @@ -280,6 +280,9 @@ public function getContent() $cart_autoresponder_for_template = pSQL((Configuration::get('SMAILY_CART_AUTORESPONDER'))); $cart_autoresponder_for_template = str_replace('\"', '"', $cart_autoresponder_for_template); $cart_autoresponder_for_template = unserialize($cart_autoresponder_for_template); + // + $categories = Category::getNestedCategories(null, Context::getContext()->language->id); + // // Assign variables to template if available. $this->context->smarty->assign( array( @@ -304,12 +307,24 @@ public function getContent() 'smailyforprestashop', 'SmailyCartCron' ), + 'smaily_rss_product_categories' => $this->normalizeCategoriesForTemplate($categories) ) ); // Display settings form. return $output .= $this->display(__FILE__, 'views/templates/admin/smaily_configure.tpl'); } + public function normalizeCategoriesForTemplate($categories) { + $normalized = array(); + foreach ( $categories as $category ) { + $normalized[$category['id_category']] = $category['name']; + if (isset($category['children']) && is_array($category['children'])) { + $normalized = array_merge($normalized, $this->normalizeCategoriesForTemplate($category['children'])); + } + } + return $normalized; + } + // Display Block Newsletter in footer. public function hookDisplayFooterBefore($params) { diff --git a/views/templates/admin/smaily_configure.tpl b/views/templates/admin/smaily_configure.tpl index e7db2c9..dcb4ba3 100644 --- a/views/templates/admin/smaily_configure.tpl +++ b/views/templates/admin/smaily_configure.tpl @@ -341,18 +341,9 @@ {* RSS feed settings *} -
+
-
- -
-

{$smaily_rssfeed_url}

-

{l s="Copy this URL into your template editor's RSS block" mod='smailyforprestashop'}

-
-
+
+                {print_r($)}
+              
+
+
+
+ +
+

{$smaily_rssfeed_url}

+

{l s="Copy this URL into your template editor's RSS block" mod='smailyforprestashop'}

From f98f3c75861011119c38b71cd964f8d028951f0e Mon Sep 17 00:00:00 2001 From: TomAbel Date: Thu, 30 Jul 2020 20:27:48 +0300 Subject: [PATCH 03/51] Use RSS query parameters when fetching products --- controllers/front/SmailyRssFeed.php | 12 ++++- smailyforprestashop.php | 39 +++++++++++++- views/templates/admin/smaily_configure.tpl | 61 +++++++++++++--------- 3 files changed, 82 insertions(+), 30 deletions(-) diff --git a/controllers/front/SmailyRssFeed.php b/controllers/front/SmailyRssFeed.php index 77e7e7d..b065042 100644 --- a/controllers/front/SmailyRssFeed.php +++ b/controllers/front/SmailyRssFeed.php @@ -32,7 +32,15 @@ public function initContent() public function generateRssFeed() { - $products = Product::getProducts($this->context->language->id, 0, 50, 'date_upd', 'desc', false, true); + $products = Product::getProducts( + $this->context->language->id, + 0, // start number + Tools::getValue('limit') ? Tools::getValue('limit') : 50, + Tools::getValue('order_by') ? Tools::getValue('order_by') : 'date_upd', + Tools::getValue('order_way') ? Tools::getValue('order_way') : 'desc', + Tools::getValue('id_category') ? Tools::getValue('id_category') : false, + true // only active products + ); $baseUrl = Tools::getHttpHost(true).__PS_BASE_URI__; $rss ='' . '' . @@ -75,7 +83,7 @@ public function generateRssFeed() } $rss .= ' <![CDATA['. $name .']]> - + '. $baseUrl . ' ' . date("D, d M Y H:i:s", strtotime($date_add)) . ' diff --git a/smailyforprestashop.php b/smailyforprestashop.php index 4dc1119..d8fc393 100644 --- a/smailyforprestashop.php +++ b/smailyforprestashop.php @@ -72,6 +72,10 @@ public function install() !Configuration::updateValue('SMAILY_ABANDONED_CART_TIME', '') || !Configuration::updateValue('SMAILY_SYNCRONIZE_ADDITIONAL', serialize(array())) || !Configuration::updateValue('SMAILY_CART_SYNCRONIZE_ADDITIONAL', serialize(array())) || + !Configuration::updateValue('SMAILY_RSS_PRODUCT_CATEGORY', '') || + !Configuration::updateValue('SMAILY_RSS_PRODUCT_LIMIT', 50) || + !Configuration::updateValue('SMAILY_RSS_SORT_CATEGORY', 'date_upd') || + !Configuration::updateValue('SMAILY_RSS_SORT_ORDER', 'desc') || // Add tab to sidebar !$this->installTab('AdminAdmin', 'AdminSmailyforprestashopAjax', 'Smaily for PrestaShop') || // Add Newsletter subscription form. @@ -122,6 +126,10 @@ public function uninstall() !Configuration::deleteByName('SMAILY_ABANDONED_CART_TIME') || !Configuration::deleteByName('SMAILY_SYNCRONIZE_ADDITIONAL') || !Configuration::deleteByName('SMAILY_CART_SYNCRONIZE_ADDITIONAL') || + !Configuration::deleteByName('SMAILY_RSS_PRODUCT_CATEGORY') || + !Configuration::deleteByName('SMAILY_RSS_PRODUCT_LIMIT') || + !Configuration::deleteByName('SMAILY_RSS_SORT_CATEGORY') || + !Configuration::deleteByName('SMAILY_RSS_SORT_ORDER') || // Remove sideTab of smaily module. !$this->uninstallTab('AdminSmailyforprestashopAjax') ) { @@ -251,6 +259,27 @@ public function getContent() $output .= $this->displayConfirmation($this->l('Abandoned cart settings updated')); } } + // RSS + if (Tools::isSubmit('smaily_submit_rss')) { + $product_category = pSQL(Tools::getValue('SMAILY_RSS_PRODUCT_CATEGORY')); + $product_limit = pSQL(Tools::getValue('SMAILY_RSS_PRODUCT_LIMIT')); + $sort_category = pSQL(Tools::getValue('SMAILY_RSS_SORT_CATEGORY')); + $sort_order = pSQL(Tools::getValue('SMAILY_RSS_SORT_ORDER')); + + // Check if subdomain is saved to db to verify that credentials are validated. + if (empty(Configuration::get('SMAILY_SUBDOMAIN'))) { + // Display error message. + $output .= $this->displayError($this->l('Please validate credentials before saving.')); + } else { + // Update settings. + Configuration::updateValue('SMAILY_RSS_PRODUCT_CATEGORY', $product_category); + Configuration::updateValue('SMAILY_RSS_PRODUCT_LIMIT', $product_limit); + Configuration::updateValue('SMAILY_RSS_SORT_CATEGORY', $sort_category); + Configuration::updateValue('SMAILY_RSS_SORT_ORDER', $sort_order); + // Display success message. + $output .= $this->displayConfirmation($this->l('RSS settings updated')); + } + } // Get syncronize additional values for template. if (false !== unserialize(Configuration::get('SMAILY_SYNCRONIZE_ADDITIONAL'))) { @@ -298,7 +327,7 @@ public function getContent() 'smaily_syncronize_additional' => $sync_array, 'smaily_cart_syncronize_additional' => $cart_sync_array, 'token' => Tools::getAdminTokenLite('AdminSmailyforprestashopAjax'), - 'smaily_rssfeed_url' => Context::getContext()->link->getModuleLink('smailyforprestashop', 'SmailyRssFeed'), + 'smaily_rssfeed_url' => $this->generateCronUrlFromSettings(), 'smaily_customer_cron_url' => Context::getContext()->link->getModuleLink( 'smailyforprestashop', 'SmailyCustomerCron' @@ -314,7 +343,8 @@ public function getContent() return $output .= $this->display(__FILE__, 'views/templates/admin/smaily_configure.tpl'); } - public function normalizeCategoriesForTemplate($categories) { + + private function normalizeCategoriesForTemplate($categories) { $normalized = array(); foreach ( $categories as $category ) { $normalized[$category['id_category']] = $category['name']; @@ -325,6 +355,11 @@ public function normalizeCategoriesForTemplate($categories) { return $normalized; } + private function generateCronUrlFromSettings() { + $base_url = Context::getContext()->link->getModuleLink('smailyforprestashop', 'SmailyRssFeed'); + return $base_url; + } + // Display Block Newsletter in footer. public function hookDisplayFooterBefore($params) { diff --git a/views/templates/admin/smaily_configure.tpl b/views/templates/admin/smaily_configure.tpl index dcb4ba3..3ef11cd 100644 --- a/views/templates/admin/smaily_configure.tpl +++ b/views/templates/admin/smaily_configure.tpl @@ -344,16 +344,31 @@
+
+ +
+ +

+ {l s="Show products from only this category." mod='smailyforprestashop'} +

+
+
- - - {l s="Minutes" mod='smailyforprestashop'} - +

{l s="Limit how many products you will add to your feed. Maximum 250." mod='smailyforprestashop'} @@ -366,10 +381,15 @@

+

+ {l s="Sort products by this category." mod='smailyforprestashop'} +

@@ -378,28 +398,11 @@
-
- -
- -
-                {print_r($)}
-              
-
-
+
From de674356bde35f5a9bca6ac4b1ce0f8ce0c35cb4 Mon Sep 17 00:00:00 2001 From: TomAbel Date: Wed, 5 Aug 2020 21:36:38 +0300 Subject: [PATCH 04/51] Build RSS URL --- smailyforprestashop.php | 31 +++++++++++++++++----- views/templates/admin/smaily_configure.tpl | 22 +++++++-------- 2 files changed, 35 insertions(+), 18 deletions(-) diff --git a/smailyforprestashop.php b/smailyforprestashop.php index d8fc393..f384064 100644 --- a/smailyforprestashop.php +++ b/smailyforprestashop.php @@ -72,7 +72,7 @@ public function install() !Configuration::updateValue('SMAILY_ABANDONED_CART_TIME', '') || !Configuration::updateValue('SMAILY_SYNCRONIZE_ADDITIONAL', serialize(array())) || !Configuration::updateValue('SMAILY_CART_SYNCRONIZE_ADDITIONAL', serialize(array())) || - !Configuration::updateValue('SMAILY_RSS_PRODUCT_CATEGORY', '') || + !Configuration::updateValue('SMAILY_RSS_PRODUCT_CATEGORY_ID', '') || !Configuration::updateValue('SMAILY_RSS_PRODUCT_LIMIT', 50) || !Configuration::updateValue('SMAILY_RSS_SORT_CATEGORY', 'date_upd') || !Configuration::updateValue('SMAILY_RSS_SORT_ORDER', 'desc') || @@ -126,7 +126,7 @@ public function uninstall() !Configuration::deleteByName('SMAILY_ABANDONED_CART_TIME') || !Configuration::deleteByName('SMAILY_SYNCRONIZE_ADDITIONAL') || !Configuration::deleteByName('SMAILY_CART_SYNCRONIZE_ADDITIONAL') || - !Configuration::deleteByName('SMAILY_RSS_PRODUCT_CATEGORY') || + !Configuration::deleteByName('SMAILY_RSS_PRODUCT_CATEGORY_ID') || !Configuration::deleteByName('SMAILY_RSS_PRODUCT_LIMIT') || !Configuration::deleteByName('SMAILY_RSS_SORT_CATEGORY') || !Configuration::deleteByName('SMAILY_RSS_SORT_ORDER') || @@ -261,7 +261,7 @@ public function getContent() } // RSS if (Tools::isSubmit('smaily_submit_rss')) { - $product_category = pSQL(Tools::getValue('SMAILY_RSS_PRODUCT_CATEGORY')); + $product_category_id = pSQL(Tools::getValue('SMAILY_RSS_PRODUCT_CATEGORY_ID')); $product_limit = pSQL(Tools::getValue('SMAILY_RSS_PRODUCT_LIMIT')); $sort_category = pSQL(Tools::getValue('SMAILY_RSS_SORT_CATEGORY')); $sort_order = pSQL(Tools::getValue('SMAILY_RSS_SORT_ORDER')); @@ -272,7 +272,7 @@ public function getContent() $output .= $this->displayError($this->l('Please validate credentials before saving.')); } else { // Update settings. - Configuration::updateValue('SMAILY_RSS_PRODUCT_CATEGORY', $product_category); + Configuration::updateValue('SMAILY_RSS_PRODUCT_CATEGORY_ID', $product_category_id); Configuration::updateValue('SMAILY_RSS_PRODUCT_LIMIT', $product_limit); Configuration::updateValue('SMAILY_RSS_SORT_CATEGORY', $sort_category); Configuration::updateValue('SMAILY_RSS_SORT_ORDER', $sort_order); @@ -336,7 +336,11 @@ public function getContent() 'smailyforprestashop', 'SmailyCartCron' ), - 'smaily_rss_product_categories' => $this->normalizeCategoriesForTemplate($categories) + 'smaily_rss_product_categories' => $this->normalizeCategoriesForTemplate($categories), + 'smaily_rss_product_category_selected' => pSQL(Configuration::get('SMAILY_RSS_PRODUCT_CATEGORY_ID')), + 'smaily_rss_product_limit' => pSQL(Configuration::get('SMAILY_RSS_PRODUCT_LIMIT')), + 'smaily_rss_sort_category' => pSQL(Configuration::get('SMAILY_RSS_SORT_CATEGORY')), + 'smaily_rss_sort_order' => pSQL(Configuration::get('SMAILY_RSS_SORT_ORDER')), ) ); // Display settings form. @@ -356,8 +360,21 @@ private function normalizeCategoriesForTemplate($categories) { } private function generateCronUrlFromSettings() { - $base_url = Context::getContext()->link->getModuleLink('smailyforprestashop', 'SmailyRssFeed'); - return $base_url; + $id_category = pSQL(Configuration::get('SMAILY_RSS_PRODUCT_CATEGORY_ID')) ? pSQL(Configuration::get('SMAILY_RSS_PRODUCT_CATEGORY_ID')) : 'all'; + $limit = pSQL(Configuration::get('SMAILY_RSS_PRODUCT_LIMIT')) ? pSQL(Configuration::get('SMAILY_RSS_PRODUCT_LIMIT')) : '25'; + $order_by = pSQL(Configuration::get('SMAILY_RSS_SORT_CATEGORY')) ? pSQL(Configuration::get('SMAILY_RSS_SORT_CATEGORY')) : 'date_upd'; + $order_way = pSQL(Configuration::get('SMAILY_RSS_SORT_ORDER')) ? pSQL(Configuration::get('SMAILY_RSS_SORT_ORDER')) : 'desc'; + $url = Context::getContext()->link->getModuleLink( + 'smailyforprestashop', + 'SmailyRssFeed', + array( + 'id_category' => $id_category, + 'limit' => $limit, + 'order_by' => $order_by, + 'order_way' => $order_way + ) + ); + return $url; } // Display Block Newsletter in footer. diff --git a/views/templates/admin/smaily_configure.tpl b/views/templates/admin/smaily_configure.tpl index 3ef11cd..4c73c63 100644 --- a/views/templates/admin/smaily_configure.tpl +++ b/views/templates/admin/smaily_configure.tpl @@ -349,10 +349,10 @@ {l s="Products category" mod='smailyforprestashop'}
- + {foreach $smaily_rss_product_categories as $id=>$name} - {/foreach} @@ -368,7 +368,7 @@
- +

{l s="Limit how many products you will add to your feed. Maximum 250." mod='smailyforprestashop'} @@ -381,11 +381,11 @@

{l s="Sort products by this category." mod='smailyforprestashop'} @@ -398,8 +398,8 @@

From 3252dbe6aaf92db40ef62d404a92e5d68df6b2fe Mon Sep 17 00:00:00 2001 From: TomAbel Date: Thu, 6 Aug 2020 21:18:52 +0300 Subject: [PATCH 05/51] Add RSS default values. Name things as they are --- smailyforprestashop.php | 70 +++++++++++----------- views/templates/admin/smaily_configure.tpl | 37 ++++++------ 2 files changed, 53 insertions(+), 54 deletions(-) diff --git a/smailyforprestashop.php b/smailyforprestashop.php index f384064..67a22d3 100644 --- a/smailyforprestashop.php +++ b/smailyforprestashop.php @@ -72,10 +72,10 @@ public function install() !Configuration::updateValue('SMAILY_ABANDONED_CART_TIME', '') || !Configuration::updateValue('SMAILY_SYNCRONIZE_ADDITIONAL', serialize(array())) || !Configuration::updateValue('SMAILY_CART_SYNCRONIZE_ADDITIONAL', serialize(array())) || - !Configuration::updateValue('SMAILY_RSS_PRODUCT_CATEGORY_ID', '') || - !Configuration::updateValue('SMAILY_RSS_PRODUCT_LIMIT', 50) || - !Configuration::updateValue('SMAILY_RSS_SORT_CATEGORY', 'date_upd') || - !Configuration::updateValue('SMAILY_RSS_SORT_ORDER', 'desc') || + !Configuration::updateValue('SMAILY_RSS_CATEGORY_ID', 'all_products') || + !Configuration::updateValue('SMAILY_RSS_LIMIT', '50') || + !Configuration::updateValue('SMAILY_RSS_ORDER_BY', 'date_upd') || + !Configuration::updateValue('SMAILY_RSS_ORDER_WAY', 'desc') || // Add tab to sidebar !$this->installTab('AdminAdmin', 'AdminSmailyforprestashopAjax', 'Smaily for PrestaShop') || // Add Newsletter subscription form. @@ -126,10 +126,10 @@ public function uninstall() !Configuration::deleteByName('SMAILY_ABANDONED_CART_TIME') || !Configuration::deleteByName('SMAILY_SYNCRONIZE_ADDITIONAL') || !Configuration::deleteByName('SMAILY_CART_SYNCRONIZE_ADDITIONAL') || - !Configuration::deleteByName('SMAILY_RSS_PRODUCT_CATEGORY_ID') || - !Configuration::deleteByName('SMAILY_RSS_PRODUCT_LIMIT') || - !Configuration::deleteByName('SMAILY_RSS_SORT_CATEGORY') || - !Configuration::deleteByName('SMAILY_RSS_SORT_ORDER') || + !Configuration::deleteByName('SMAILY_RSS_CATEGORY_ID') || + !Configuration::deleteByName('SMAILY_RSS_LIMIT') || + !Configuration::deleteByName('SMAILY_RSS_ORDER_BY') || + !Configuration::deleteByName('SMAILY_RSS_ORDER_WAY') || // Remove sideTab of smaily module. !$this->uninstallTab('AdminSmailyforprestashopAjax') ) { @@ -261,10 +261,10 @@ public function getContent() } // RSS if (Tools::isSubmit('smaily_submit_rss')) { - $product_category_id = pSQL(Tools::getValue('SMAILY_RSS_PRODUCT_CATEGORY_ID')); - $product_limit = pSQL(Tools::getValue('SMAILY_RSS_PRODUCT_LIMIT')); - $sort_category = pSQL(Tools::getValue('SMAILY_RSS_SORT_CATEGORY')); - $sort_order = pSQL(Tools::getValue('SMAILY_RSS_SORT_ORDER')); + $category_id = pSQL(Tools::getValue('SMAILY_RSS_CATEGORY_ID')); + $limit = pSQL(Tools::getValue('SMAILY_RSS_LIMIT')); + $order_by = pSQL(Tools::getValue('SMAILY_RSS_ORDER_BY')); + $order_way = pSQL(Tools::getValue('SMAILY_RSS_ORDER_WAY')); // Check if subdomain is saved to db to verify that credentials are validated. if (empty(Configuration::get('SMAILY_SUBDOMAIN'))) { @@ -272,10 +272,10 @@ public function getContent() $output .= $this->displayError($this->l('Please validate credentials before saving.')); } else { // Update settings. - Configuration::updateValue('SMAILY_RSS_PRODUCT_CATEGORY_ID', $product_category_id); - Configuration::updateValue('SMAILY_RSS_PRODUCT_LIMIT', $product_limit); - Configuration::updateValue('SMAILY_RSS_SORT_CATEGORY', $sort_category); - Configuration::updateValue('SMAILY_RSS_SORT_ORDER', $sort_order); + Configuration::updateValue('SMAILY_RSS_CATEGORY_ID', $category_id); + Configuration::updateValue('SMAILY_RSS_LIMIT', $limit); + Configuration::updateValue('SMAILY_RSS_ORDER_BY', $order_by); + Configuration::updateValue('SMAILY_RSS_ORDER_WAY', $order_way); // Display success message. $output .= $this->displayConfirmation($this->l('RSS settings updated')); } @@ -336,11 +336,11 @@ public function getContent() 'smailyforprestashop', 'SmailyCartCron' ), - 'smaily_rss_product_categories' => $this->normalizeCategoriesForTemplate($categories), - 'smaily_rss_product_category_selected' => pSQL(Configuration::get('SMAILY_RSS_PRODUCT_CATEGORY_ID')), - 'smaily_rss_product_limit' => pSQL(Configuration::get('SMAILY_RSS_PRODUCT_LIMIT')), - 'smaily_rss_sort_category' => pSQL(Configuration::get('SMAILY_RSS_SORT_CATEGORY')), - 'smaily_rss_sort_order' => pSQL(Configuration::get('SMAILY_RSS_SORT_ORDER')), + 'smaily_rss_available_category_ids' => $this->recursivelyNormalizeCategoriesForTemplate($categories), + 'smaily_rss_selected_category_id' => pSQL(Configuration::get('SMAILY_RSS_CATEGORY_ID')), + 'smaily_rss_limit' => pSQL(Configuration::get('SMAILY_RSS_LIMIT')), + 'smaily_rss_order_by' => pSQL(Configuration::get('SMAILY_RSS_ORDER_BY')), + 'smaily_rss_order_way' => pSQL(Configuration::get('SMAILY_RSS_ORDER_WAY')), ) ); // Display settings form. @@ -348,31 +348,33 @@ public function getContent() } - private function normalizeCategoriesForTemplate($categories) { + private function recursivelyNormalizeCategoriesForTemplate($categories) + { $normalized = array(); foreach ( $categories as $category ) { $normalized[$category['id_category']] = $category['name']; if (isset($category['children']) && is_array($category['children'])) { - $normalized = array_merge($normalized, $this->normalizeCategoriesForTemplate($category['children'])); + $normalized = array_merge($normalized, $this->recursivelyNormalizeCategoriesForTemplate($category['children'])); } } return $normalized; } - private function generateCronUrlFromSettings() { - $id_category = pSQL(Configuration::get('SMAILY_RSS_PRODUCT_CATEGORY_ID')) ? pSQL(Configuration::get('SMAILY_RSS_PRODUCT_CATEGORY_ID')) : 'all'; - $limit = pSQL(Configuration::get('SMAILY_RSS_PRODUCT_LIMIT')) ? pSQL(Configuration::get('SMAILY_RSS_PRODUCT_LIMIT')) : '25'; - $order_by = pSQL(Configuration::get('SMAILY_RSS_SORT_CATEGORY')) ? pSQL(Configuration::get('SMAILY_RSS_SORT_CATEGORY')) : 'date_upd'; - $order_way = pSQL(Configuration::get('SMAILY_RSS_SORT_ORDER')) ? pSQL(Configuration::get('SMAILY_RSS_SORT_ORDER')) : 'desc'; + private function generateCronUrlFromSettings() + { + $query_arguments = array( + 'limit' => pSQL(Configuration::get('SMAILY_RSS_LIMIT')), + 'order_by' => pSQL(Configuration::get('SMAILY_RSS_ORDER_BY')), + 'order_way' => pSQL(Configuration::get('SMAILY_RSS_ORDER_WAY')), + ); + if (pSQL(Configuration::get('SMAILY_RSS_CATEGORY_ID')) !== 'all_products') { + $query_arguments['id_category'] = pSQL(Configuration::get('SMAILY_RSS_CATEGORY_ID')); + } + $url = Context::getContext()->link->getModuleLink( 'smailyforprestashop', 'SmailyRssFeed', - array( - 'id_category' => $id_category, - 'limit' => $limit, - 'order_by' => $order_by, - 'order_way' => $order_way - ) + $query_arguments ); return $url; } diff --git a/views/templates/admin/smaily_configure.tpl b/views/templates/admin/smaily_configure.tpl index 4c73c63..d84bd99 100644 --- a/views/templates/admin/smaily_configure.tpl +++ b/views/templates/admin/smaily_configure.tpl @@ -349,16 +349,16 @@ {l s="Products category" mod='smailyforprestashop'}
- + + {foreach $smaily_rss_available_category_ids as $id=>$name} + {/foreach}

- {l s="Show products from only this category." mod='smailyforprestashop'} + {l s="Show products only from this category." mod='smailyforprestashop'}

@@ -368,7 +368,7 @@
- +

{l s="Limit how many products you will add to your feed. Maximum 250." mod='smailyforprestashop'} @@ -377,29 +377,26 @@

- + + + + + -

- {l s="Sort products by this category." mod='smailyforprestashop'} -

- + +
From a95f311fc6f739a4fe90b87c3937d6733e8df0ed Mon Sep 17 00:00:00 2001 From: TomAbel Date: Thu, 6 Aug 2020 21:20:16 +0300 Subject: [PATCH 06/51] Remove duplicate RSS field --- views/templates/admin/smaily_configure.tpl | 9 --------- 1 file changed, 9 deletions(-) diff --git a/views/templates/admin/smaily_configure.tpl b/views/templates/admin/smaily_configure.tpl index d84bd99..37487bd 100644 --- a/views/templates/admin/smaily_configure.tpl +++ b/views/templates/admin/smaily_configure.tpl @@ -86,15 +86,6 @@

-
- -
-

{$smaily_rssfeed_url}

-

{l s="Copy this URL into your template editor's RSS block" mod='smailyforprestashop'}

-
-