Crezzur 114 Posted February 17, 2015 Posted February 17, 2015 (edited) DataSwitchPro - Automatic on/off switch for categories and products free module by crezzur Update 16/05: we are considering adding a cronjob to this module (fires automatically every x time and disable and enable categories). For this we want feedback from the users to know if this update is needed. Features< This module will automatically search for (sub)categories with no products and automatically disable them. > < This module will automatically search for (sub)categories with products and automatically enable them. > < This module will automatically search for products with no quantity's and automatically disable them. > < This module will automatically search for products with quantity's and automatically enable them. > < You can choose the time frame of the DataSwitchpro (how many times a day it has to check to enable/disable products) > < You can disable (sub)categories or products if you don't want to use this feature. >How does this work? Every time a customer visit your site a query will run to see when was the last time the DataSwitchPro was active. If this is longer then the time frame you have selected, a update query will run. Products and (sub)Categories with no products/quantity's will automatically disable. Products and (sub)Categories that are updated with new products/quantity's will automatically be re-activated. This product works with Prestashop versions1.6.+ / 1.7+ Back office configuration Setup Install the zip file, change the settings if you want, and your ready! Download this FREE module NOW! V1.0.4 (26/05/2019)* dataswitchpro.zipdataswitchpro.zipV1.0.3 (16/12/2018)* DOWNLOAD REMOVED V1.0.2 (09/10/2017)* DOWNLOAD REMOVED* We have updated our module to the prestashop 1.7 codding requirments.Products which allow ordering when out of stock will not be disabled anymore V1.0.1 (08/11/2016)* DOWNLOAD REMOVED* Version 1.0.0 has to be uninstalled first. V1.0.0 (17/02/2015) DOWNLOAD REMOVED ---------------- PS: a like and a thank you for my work is appreciated ---------------- Edited March 20 by Crezzur (see edit history) 11 2 Share this post Link to post Share on other sites
PrestaShark 131 Posted October 3, 2016 Posted October 3, 2016 Thanks! Much appreciated!PS> New feature In {$HOOK_HEADER} insert something like this {if $page_name == 'product'} {if $product->active != 1} {foreach from=Product::getProductCategoriesFull(Tools::getValue('id_product')) item=cat name=cats} {if $smarty.foreach.cats.last} {assign var="cat_url" value="{$link->getCategoryLink({$cat.id_category})}"} {/if} {/foreach} <meta http-equiv="refresh" content="0; url={$cat_url}" /> {/if} {/if} to redirect disabled product to their parent category. For better user experience. Product not available but the traffic is not wasted Best regards! Share this post Link to post Share on other sites
francesc 49 Posted November 3, 2016 Posted November 3, 2016 Hi, worked fine until I updated to 1.6.1.8 After the upgrade i have this error: (I think that is due to the module) [PrestaShopDatabaseException] Db->executeS() must be used only with select, show, explain or describe queries at line 638 in file classes/db/Db.php 633. } 634. 635. // This method must be used only with queries which display results 636. if (!preg_match('#^\s*\(?\s*(select|show|explain|describe|desc)\s#i', $sql)) { 637. if (defined('_PS_MODE_DEV_') && _PS_MODE_DEV_) { 638. throw new PrestaShopDatabaseException('Db->executeS() must be used only with select, show, explain or describe queries'); 639. } 640. return $this->execute($sql, $use_cache); 641. } 642. 643. $this->result = $this->query($sql); DbCore->executeS - [line 90 - modules/DataSwitchPro/DataSwitchPro.php] - [1 Arguments] DataSwitchPro->hookFooter - [line 587 - classes/Hook.php] - [1 Arguments] HookCore::coreCallHook - [line 544 - classes/Hook.php] - [3 Arguments] HookCore::exec - [line 1022 - classes/controller/FrontController.php] - [1 Arguments] FrontControllerCore->initFooter - [line 195 - classes/controller/Controller.php] ControllerCore->run - [line 367 - classes/Dispatcher.php] DispatcherCore->dispatch - [line 28 - index.php] Share this post Link to post Share on other sites
Crezzur 114 Posted November 8, 2016 Posted November 8, 2016 Hi, worked fine until I updated to 1.6.1.8 After the upgrade i have this error: (I think that is due to the module) Hello, That is correct there was some codding issues with v1.0.0. I had some spare time and cleaned up all the codding to the PSR-2 coding standard Your issue should be solved now. Kind regards! Jaimy A Share this post Link to post Share on other sites
gumersindo 0 Posted July 30, 2017 Posted July 30, 2017 He probado este módulo en prestashop 1.6.1.15 y me ha funcionado perfectamente. Muchas gracias. Este módulo sirve para: Módulo gratis Activa-desactiva un producto cuando el stock cambia (Lo dejo así escrito para que otras personas que hablen español puedan encontrar este módulo más fácilmente) Share this post Link to post Share on other sites
Luisejo 126 Posted September 27, 2017 Posted September 27, 2017 I have checked this module in Prestashop version 1.7.2 and is working prefectly. Share this post Link to post Share on other sites
gray 12 Posted October 1, 2017 Posted October 1, 2017 Hi - Is this able to disable products, if the category is disabled. As I have products that are available only during specific dates. And I want to just disable a category, which then automatically disables all of its products. Share this post Link to post Share on other sites
Cuball 2 Posted October 2, 2017 Posted October 2, 2017 Module works great, But it doesn't take into consideration products that are set to allow ordering when out of stock (Pre-Order Items), Any idea what needs to be changed so it looks at the When out of Stock tick box is set to Allow Orders when out of stock? Share this post Link to post Share on other sites
bickair 0 Posted October 6, 2017 Posted October 6, 2017 Hello, I have more than 1000 categories, my catalog connects to the stock of my supplier. I am interested in that the module automatically activate and disable the categories that are without stock (not without products). Does this module work? Share this post Link to post Share on other sites
Crezzur 114 Posted October 9, 2017 Posted October 9, 2017 Hello, I have more than 1000 categories, my catalog connects to the stock of my supplier. I am interested in that the module automatically activate and disable the categories that are without stock (not without products). Does this module work? I think it already works this way? or am i wrong? Share this post Link to post Share on other sites
Crezzur 114 Posted October 9, 2017 Posted October 9, 2017 Module works great, But it doesn't take into consideration products that are set to allow ordering when out of stock (Pre-Order Items), Any idea what needs to be changed so it looks at the When out of Stock tick box is set to Allow Orders when out of stock? You had a point there, i have added it to the new version 1.0.2 Kind regards, Jaimy Share this post Link to post Share on other sites
Smokie 0 Posted November 6, 2017 Posted November 6, 2017 Please add an option to disable categories if all products there have zero quantities. And another option if all products are disabled. It will great if all options can work in any combination of them. Share this post Link to post Share on other sites
Cuball 2 Posted November 24, 2017 Posted November 24, 2017 (edited) Thanks, the Out of Stock ordering works great now, But it seems like the subcategory disabling/re-enabling isn't working, The products within the Subcategory has been disabled by the module, But the Subcategory stays enabled. Quote On 10/10/2017 at 7:55 AM, Crezzur said: You had a point there, i have added it to the new version 1.0.2 Kind regards, Jaimy Edited November 24, 2017 by Cuball Adding quote (see edit history) Share this post Link to post Share on other sites
jeeegmarco 0 Posted December 11, 2017 Posted December 11, 2017 Hello, I have prestashop 1.7.2.4, the auto switch on/off of the category does not work. There is any actualisaction? Share this post Link to post Share on other sites
mrburton 0 Posted December 25, 2017 Posted December 25, 2017 I have the same problem. on/off on the category does not work in 1.7.x.x Share this post Link to post Share on other sites
Cuball 2 Posted February 26, 2018 Posted February 26, 2018 If there any update on fixing auto switch on/off for categories? Share this post Link to post Share on other sites
leopm 0 Posted March 1, 2018 Posted March 1, 2018 On 3/10/2016 at 8:49 AM, PrestaShark said: Thanks! Much appreciated! PS> New feature In {$HOOK_HEADER} insert something like this {if $page_name == 'product'} {if $product->active != 1} {foreach from=Product::getProductCategoriesFull(Tools::getValue('id_product')) item=cat name=cats} {if $smarty.foreach.cats.last} {assign var="cat_url" value="{$link->getCategoryLink({$cat.id_category})}"} {/if} {/foreach} <meta http-equiv="refresh" content="0; url={$cat_url}" /> {/if} {/if} to redirect disabled product to their parent category. For better user experience. Product not available but the traffic is not wasted Best regards! Hi there, Thanks so Much for your work on this module, working great for me! Just a little question about the great feature you added in for 404 page redirects.. Would it be possible to auto redirect to the set default category opposed to just the parent. Many thanks! Share this post Link to post Share on other sites
Sergi 19 Posted June 9, 2018 Posted June 9, 2018 Hi, On Prestashop 1.7.2.5 doesn't work and appaers this error: " Notice en línea 152 en archivo C:\\xampp71\\htdocs\\presta1725\\modules\\dataswitchpro\\dataswitchpro.php [8] Undefined variable: products_yes Notice en línea 155 en archivo C:\\xampp71\\htdocs\\presta1725\\modules\\dataswitchpro\\dataswitchpro.php [8] Undefined variable: categories_no" The module is ready to work on this version? Share this post Link to post Share on other sites
millien 6 Posted November 14, 2018 Posted November 14, 2018 this can't bee good for the SEO , have that I mind. you will have a lot of 404 from google Share this post Link to post Share on other sites
Crezzur 114 Posted December 16, 2018 Posted December 16, 2018 On 6/9/2018 at 6:31 PM, Sergi said: Hi, On Prestashop 1.7.2.5 doesn't work and appaers this error: " Notice en línea 152 en archivo C:\\xampp71\\htdocs\\presta1725\\modules\\dataswitchpro\\dataswitchpro.php [8] Undefined variable: products_yes Notice en línea 155 en archivo C:\\xampp71\\htdocs\\presta1725\\modules\\dataswitchpro\\dataswitchpro.php [8] Undefined variable: categories_no" The module is ready to work on this version? We have added a new version which solve this issue. Share this post Link to post Share on other sites
Soyons Solidaire 249 Posted December 24, 2018 Posted December 24, 2018 (edited) Bonjour merci pour le partage, petit souci après avoir désinstaller le module plus de produits sur la page d'accueil ? Edited December 25, 2018 by Soyons zen (see edit history) Share this post Link to post Share on other sites
Soyons Solidaire 249 Posted December 25, 2018 Posted December 25, 2018 Hello thanks for sharing, small problem after uninstalling the module more products on the homepage? Share this post Link to post Share on other sites
Crezzur 114 Posted December 25, 2018 Posted December 25, 2018 3 minutes ago, Soyons zen said: Hello thanks for sharing, small problem after uninstalling the module more products on the homepage? I am not sure which issue you have? Share this post Link to post Share on other sites
Soyons Solidaire 249 Posted December 26, 2018 Posted December 26, 2018 (edited) 14 hours ago, Crezzur said: I am not sure which issue you have? Hello, After uninstalling the module, the most sold products are no longer available on the home page Edited December 26, 2018 by Soyons zen (see edit history) Share this post Link to post Share on other sites
César 0 Posted April 19, 2019 Posted April 19, 2019 Hola, tengo PS v.1.7.5.1 Se instala bien pero NO funciona correctamente. a la hora de abrir un producto hace como una marcha atrás y te saca del producto. Es una lastima que no me funcione con mi versión ya que pensé que me funcionaria. Gracias Share this post Link to post Share on other sites
mktm20111 0 Posted April 25, 2019 Posted April 25, 2019 it works but has a bug in front end this when i click to see a product it redirects to its categorie making impossible to see the product and for customer to buy the product Share this post Link to post Share on other sites
Crezzur 114 Posted April 25, 2019 Posted April 25, 2019 13 minutes ago, mktm20111 said: it works but has a bug in front end this when i click to see a product it redirects to its categorie making impossible to see the product and for customer to buy the product Could you provide me a url where the issue happens? Share this post Link to post Share on other sites
PrestaMake 14 Posted May 25, 2019 Posted May 25, 2019 Hi mi friend @Crezzur Appreciate your help to the community for free ❤️ Here is a quick fix I think that should be implemented in your module: on the hookHeader() function, find this line: Db::getInstance()->Execute('UPDATE '._DB_PREFIX_.'product_shop as ps JOIN '._DB_PREFIX_.'stock_available as sa ON sa.quantity=0 AND out_of_stock!=1 AND id_product_attribute=0 SET active=0 WHERE ps.id_product=sa.id_product'); sa.quantity<0 should be changed to this sa.quantity<1 as following: Db::getInstance()->Execute('UPDATE '._DB_PREFIX_.'product_shop as ps JOIN '._DB_PREFIX_.'stock_available as sa ON sa.quantity<1 AND out_of_stock!=1 AND id_product_attribute=0 SET active=0 WHERE ps.id_product=sa.id_product'); Why? I looked at a thread guys were having problem with your module because sometimes their stock when to negative, or they already had negative products, and the behavior was the same as if there was no module. I hope you understand me and take this in consideration. Best regards 1 Share this post Link to post Share on other sites
Crezzur 114 Posted May 26, 2019 Posted May 26, 2019 16 hours ago, PrestaMake said: Hi mi friend @Crezzur Appreciate your help to the community for free ❤️ Here is a quick fix I think that should be implemented in your module: on the hookHeader() function, find this line: Db::getInstance()->Execute('UPDATE '._DB_PREFIX_.'product_shop as ps JOIN '._DB_PREFIX_.'stock_available as sa ON sa.quantity=0 AND out_of_stock!=1 AND id_product_attribute=0 SET active=0 WHERE ps.id_product=sa.id_product'); sa.quantity<0 should be changed to this sa.quantity<1 as following: Db::getInstance()->Execute('UPDATE '._DB_PREFIX_.'product_shop as ps JOIN '._DB_PREFIX_.'stock_available as sa ON sa.quantity<1 AND out_of_stock!=1 AND id_product_attribute=0 SET active=0 WHERE ps.id_product=sa.id_product'); Why? I looked at a thread guys were having problem with your module because sometimes their stock when to negative, or they already had negative products, and the behavior was the same as if there was no module. I hope you understand me and take this in consideration. Best regards Thank you for your contribution! The requested change is now available in version 1.0.4 Share this post Link to post Share on other sites
MarilóAmAtuMundo 3 Posted May 28, 2019 Posted May 28, 2019 (edited) El 26/5/2019 a las 14:58, Crezzur dijo: ¡Gracias por tu contribución! El cambio solicitado ya está disponible en la versión 1.0.4. Muchas gracias a @Crezzur ya @PrestaMake por intentar ayudarnos en nuestro problema. Supongamos que usted no ha notado que ahora, en cualquier producto que selecciones de la tienda se saca automáticamente a la categoría de lo que pertenece, no se deja permanecer en la página de producto, no se si me expliqué. gracias de nuevo Edited June 9, 2019 by MarilóAmAtuMundo (see edit history) 1 Share this post Link to post Share on other sites
mktm20111 0 Posted June 7, 2019 Posted June 7, 2019 On 5/28/2019 at 7:46 AM, MarilóAmAtuMundo said: Muchas gracias a @Crezzur y a @PrestaMake por intentar ayudarnos en nuestro problema. supongo que ya habréis notado que ahora, en cualquier producto que selecciones de la tienda te saca automáticamente a la categoría a la que pertenece, no te deja permanecer en la página de producto, no se si me explico. gracias de nuevo. WhatsApp_Video_2019-05-27_at_21_26_01.mp4 i had the same issue so deleted the module Share this post Link to post Share on other sites
PrestaMake 14 Posted June 7, 2019 Posted June 7, 2019 (edited) 44 minutes ago, mktm20111 said: i had the same issue so deleted the module Another fix that should be implemented its to remove the footer hook @Crezzur Here is the fixed version that solves that issue: dataswitchprov3.zip Edited June 7, 2019 by PrestaMake (see edit history) Share this post Link to post Share on other sites
Josele Hernández 9 Posted July 20, 2019 Posted July 20, 2019 Thanks you for the modules. About : "Update 16/05: we are considering adding a cronjob to this module (fires automatically every x time and disable and enable categories). For this we want feedback from the users to know if this update is needed." I think that it would be a good improvement for people that sincronize DB automatically with diferent data sources or CRMs. For us it will be perfect. Share this post Link to post Share on other sites
mushino 1 Posted November 10, 2019 Posted November 10, 2019 On 4/25/2019 at 9:58 PM, Crezzur said: Could you provide me a url where the issue happens? Hi, I've the same problem. PS: 1.7.5.1 PHP: 7.2.23 Theme: classic Module versione 1.0.4 Any solution? Thanks Share this post Link to post Share on other sites
mushino 1 Posted November 10, 2019 Posted November 10, 2019 On 6/7/2019 at 7:48 PM, PrestaMake said: Another fix that should be implemented its to remove the footer hook @Crezzur Here is the fixed version that solves that issue: dataswitchprov3.zip Thanks, I see this update now! It works fine 😉 Share this post Link to post Share on other sites
Carlos_frescum 0 Posted February 19, 2020 Posted February 19, 2020 Thank you very much for the contribution. We have the doubt if it works correctly when the product has negative stock. In our case it comes out as an active state. Thanks again Share this post Link to post Share on other sites
Aldeag 20 Posted March 6, 2020 Posted March 6, 2020 En 28/5/2019 a las 7:46 AM, MarilóAmAtuMundo dijo: Muchas gracias a @Crezzur ya @PrestaMake por intentar ayudarnos en nuestro problema. Supongamos que usted no ha notado que ahora, en cualquier producto que selecciones de la tienda se saca automáticamente a la categoría de lo que pertenece, no se deja permanecer en la página de producto, no se si me expliqué. gracias de nuevo Me pasa lo mismo y tengo la versión 1.0.4 ¿Es esta la última versión? La he desactivado Share this post Link to post Share on other sites
peoncio 0 Posted May 1, 2020 Posted May 1, 2020 Hello It seems your download link is not working. Please link it again Thank you for your work Share this post Link to post Share on other sites
LinkOfLight 1 Posted May 6, 2020 Posted May 6, 2020 En 17/2/2015 a las 10:17 PM, Crezzur dijo: DataSwitchPro - Automatic on/off switch for categories and products free module by crezzur Update 16/05: we are considering adding a cronjob to this module (fires automatically every x time and disable and enable categories). For this we want feedback from the users to know if this update is needed. Features< This module will automatically search for (sub)categories with no products and automatically disable them. > < This module will automatically search for (sub)categories with products and automatically enable them. > < This module will automatically search for products with no quantity's and automatically disable them. > < This module will automatically search for products with quantity's and automatically enable them. > < You can choose the time frame of the DataSwitchpro (how many times a day it has to check to enable/disable products) > < You can disable (sub)categories or products if you don't want to use this feature. >How does this work? Every time a customer visit your site a query will run to see when was the last time the DataSwitchPro was active. If this is longer then the time frame you have selected, a update query will run. Products and (sub)Categories with no products/quantity's will automatically disable. Products and (sub)Categories that are updated with new products/quantity's will automatically be re-activated. This product works with Prestashop versions1.6.+ / 1.7+ Back office configuration Setup Install the zip file, change the settings if you want, and your ready! Download this FREE module NOW! V1.0.4 (26/05/2019)* Click here to download OR dataswitchpro.zipdataswitchpro.zipUnavailable Contributors: PrestaMake V1.0.3 (16/12/2018)* DOWNLOAD REMOVED V1.0.2 (09/10/2017)* DOWNLOAD REMOVED* We have updated our module to the prestashop 1.7 codding requirments.Products which allow ordering when out of stock will not be disabled anymore V1.0.1 (08/11/2016)* DOWNLOAD REMOVED* Version 1.0.0 has to be uninstalled first. V1.0.0 (17/02/2015) DOWNLOAD REMOVED ---------------- PS: a like and a thank you for my work is appreciated ---------------- if I could disable but not automatically enable it would be a big improvement, I have customers who do not want to be activated products automatically, prefer to do so manually Share this post Link to post Share on other sites
mushino 1 Posted June 25, 2020 Posted June 25, 2020 (edited) Hi, it disable/able products fine, but my site refresh pages of products to main category page. 😥 So I must deactivate module. I doesn't work with empty categories. PS version 1.6.1.24 (not default theme) Edited June 25, 2020 by mushino (see edit history) Share this post Link to post Share on other sites
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now