TassaDarK Posted October 27, 2010 Share Posted October 27, 2010 Hi guys!I have been stucking my head with a perfect solution for this matter and found lot of people have same problem. There are some solutions to this out there but neither one convinced me or they were for old versions of PS.I recently found a excellent job on this from a spanish guy named Hans in http://todoprestashop.com/foro/viewtopic.php?f=17&t=434&start=10 but it was only for PS 1.0 and he didn't update the code for PS 1.3.I have been adapting this solution for PS 1.3 and here are the files to make the modifications. Read carefully the instructions below.IMPORTANT! ALL CREDITS GOES TO HANS, THIS CODE IS NOT MINE, I ONLY ADAPTED IT TO PS 1.3.1WARNING! THIS MODIFICATION IS ONLY FOR PS 1.3.1 (AT LEAST I DON'T TESTED IT ON 1.3.2), IF ANYONE WANT TO HELP, ADAPT IT FOR 1.3.2 AND I WILL PUBLISH HERE.Instructions:--------------1) Backup all your bd. <--- VERY IMPORTANT!!!2) Download the zip below.3) With phpmyadmin in your database execute this code: ALTER TABLE `ps_product` ADD `show_cart` TINYINT( 1 ) NOT NULL DEFAULT '1' this is a new field in your product table: value 0 --> don't show cart value 1 --> show cart 4) Now, replace all file from the zip to your shop (BACKUP BEFORE!!!). The files in the zip are in folders to help you to figure out where insert files into your ps directory. Pay attention to "yourthemedirectory" folder and "youradmin" folder".Note1: Some field names and text are in spanish (sorry, i'm from spain) but you can translate them from PS Translation tool to put the text you want.Note2: This files are original ps1.3.1. files modified with the code changes. If you ALREADY have others modifications to these files in your PS shop and you don't want to lose them, you can manually copy/paste the code changes from my files to yours. Code changes are marked with "Hans" word, use find/search in your text editor and will see the codes you have to insert in your files.UPDATE: I updated the zip file for ps 1.3.1 'cause i'm stupid and forgot to include one neccesary file in the zip (product.php for the root folder of your PS installation). I think all of you who have problems was because this.On the other side i made a update of this modification to work with PS 1.3.2., i have tested it on my server and seems to works perfect. I included the zip file below. cart-enabler-disabler-PS1.3.1(v2).zip cart-enabler-disabler-PS1.3.2.zip Link to comment Share on other sites More sharing options...
rocky Posted October 28, 2010 Share Posted October 28, 2010 Note that PrestaShop v1.4 has this feature built-in, so this modification won't be necessary once it is released. Link to comment Share on other sites More sharing options...
TassaDarK Posted October 28, 2010 Author Share Posted October 28, 2010 Yep, but while its released or not, some people like me need a solution for this. Even when 1.4 is out, not everybody are going to update the first day. We have now 1.3.2 with a lot of bug corrections and few people with 1.3.1 have updated as far i know. Link to comment Share on other sites More sharing options...
Rhobur Posted November 2, 2010 Share Posted November 2, 2010 Any idea when the 1.4 will be released ? Link to comment Share on other sites More sharing options...
rocky Posted November 3, 2010 Share Posted November 3, 2010 Nope. I expect it will be a while yet, since it's still in alpha stages, so there is still at least a beta before the final version is released. Link to comment Share on other sites More sharing options...
Rhobur Posted November 3, 2010 Share Posted November 3, 2010 Thanks Rocky, I'll try this solution ubtil then, hopefully it will resolve the "ask for price" in the cart too.BTW, I've read your interview in Prestamagazine, great job you do here at forum.Thanks TassDark for resolving the 0 price issue too. Link to comment Share on other sites More sharing options...
TassaDarK Posted November 3, 2010 Author Share Posted November 3, 2010 Your welcome :-) If you have any problem with this, post here and i'll try to help. I have been figthing with this for a while until make it works 100% Link to comment Share on other sites More sharing options...
Iamjm Posted November 14, 2010 Share Posted November 14, 2010 Hi,Thanks for contribution to prestashop, it's a usefull addon.I'm searching for a solution to activate/desactivate the show_cart option directly from the list of products like des/activiting.Any ideas,Jean-Michel Link to comment Share on other sites More sharing options...
Iamjm Posted November 14, 2010 Share Posted November 14, 2010 Solution:----------in admin/tabs/AdminProducts.php in postProcess() function before another elseif: /* Change object Show Cart status (active, inactive) */ //IAMJM elseif (isset($_GET['showcart']) AND Tools::getValue($this->identifier)) { if ($this->tabAccess['edit'] === '1') { if (Validate::isLoadedObject($object = $this->loadObject())) { if ($object->toggleShowCartStatus()) Tools::redirectAdmin($currentIndex.'&conf=5'.((($id_category = intval(Tools::getValue('id_category'))) AND Tools::getValue('id_product')) ? '&id;_category='.$id_category : '').'&token;='.$token); else $this->_errors[] = Tools::displayError('an error occurred while updating status'); } else $this->_errors[] = Tools::displayError('an error occurred while updating status for object').' '.$this->table.' '.Tools::displayError('(cannot load object)'); } else $this->_errors[] = Tools::displayError('You do not have permission to edit anything here.'); }//IAMJM in classes/Product.php in __construct() function in fieldsDisplay Array change show_cart line to this 'show_cart' => array('title' => $this->l('Show Cart'), 'show_cart' => 'showcart', 'align' => 'center', 'type' => 'bool', 'orderby' => false), add function /** * Toggle object Show Cart Status in database //IAMJM * * return boolean Update result */ public function toggleShowCartStatus() { if (!Validate::isTableOrIdentifier($this->identifier) OR !Validate::isTableOrIdentifier($this->table)) die(Tools::displayError()); /* Object must have a variable called 'active' */ elseif (!key_exists('show_cart', $this)) die(Tools::displayError()); /* Update active status on object */ $this->show_cart = intval(!$this->active); /* Change status to active/inactive */ return Db::getInstance()->Execute(' UPDATE `'.pSQL(_DB_PREFIX_.$this->table).'` SET `show_cart` = !`show_cart` WHERE `'.pSQL($this->identifier).'` = '.intval($this->id)); } // <-- IAMJM in classes/AdminTab.phpin displayListContent() function before elseif (isset($params['position'])) elseif (isset($params['show_cart']) AND isset($tr[$key]))//IAMJM echo 'identifier.'='.$id.'&'.$params['show_cart']. ((($id_category = intval(Tools::getValue('id_category'))) AND Tools::getValue('id_product')) ? '&id;_category='.$id_category : '').'&token;='.($token!=NULL ? $token : $this->token).'"> l('Enabled') : $this->l('Disabled')).'" title="'.($tr[$key] ? $this->l('Enabled') : $this->l('Disabled')).'" />';//IAMJM So now show_cart status can be change from the list of product in Catalog TabRegards,Jean-Michel Link to comment Share on other sites More sharing options...
TassaDarK Posted November 15, 2010 Author Share Posted November 15, 2010 Great, thanks! From the item list i think is more handy. Link to comment Share on other sites More sharing options...
rebirth Posted November 24, 2010 Share Posted November 24, 2010 Has someone already tested this on 1.3.2? Link to comment Share on other sites More sharing options...
TassaDarK Posted November 24, 2010 Author Share Posted November 24, 2010 Yes, and have some bugs. It needs readjusting the code but i can't do it, busy now :-( Link to comment Share on other sites More sharing options...
rebirth Posted November 24, 2010 Share Posted November 24, 2010 crap, this was just the thing I needed. There doesn't seem to be any solution for 1.3.2. :-( Link to comment Share on other sites More sharing options...
TassaDarK Posted November 24, 2010 Author Share Posted November 24, 2010 If you are patient, i can do it in a couple of days. Some people request me a 1.3.2 version of this hack and i'm planning to do it for a better world, the universal peace and things like that. Link to comment Share on other sites More sharing options...
rebirth Posted November 24, 2010 Share Posted November 24, 2010 Hehe, sure I can be patient, is certainly is better then not to have it.Thanks to universal peace ;-) Link to comment Share on other sites More sharing options...
distinct Posted November 29, 2010 Share Posted November 29, 2010 Hi guys,i have installed this mod and for some reason cant get it to work on version 1.31 here are my stepsSQL: ALTER TABLE `ps_product` ADD `show_cart` TINYINT( 1 ) NOT NULL DEFAULT '1'then i copied over all the files to the respected folders.the back end seems to be working when i click the radio button it changes and stays but there is no affect on the product page no matter what the selection is it is always not showing.also on another note i would like to keep the price and remove from the (qty) down but also tried this and still no luck. Link to comment Share on other sites More sharing options...
distinct Posted November 29, 2010 Share Posted November 29, 2010 after further investigating i have noticed that the product list is working in the categories but still a no go on the products page. i have noticed that the code is a little different between the two filesproduct-list.tpl {if ($product.show_cart != 0)} and product.tpl {if ($show_cart != 0)} now you would think these would be the same but when i change to $product.show_cart the whole page goes screwy and still does not work.anybody have an idea? Link to comment Share on other sites More sharing options...
distinct Posted November 29, 2010 Share Posted November 29, 2010 I have figured it out. just posting what i did for anyone else that needs iton product.tpl the code needs to read {if $product->show_cart != 0} and not this {if ($show_cart != 0)} sometimes it helps to write it down on the forum to figure it out ;-) Link to comment Share on other sites More sharing options...
rebirth Posted December 5, 2010 Share Posted December 5, 2010 TassaDarK, any chance you already had some time to work on this for 1.3.2? Link to comment Share on other sites More sharing options...
TassaDarK Posted December 14, 2010 Author Share Posted December 14, 2010 rebirth, a promise is a promise. You have the files for use in PS 1.3.2 in the main post for a better world, the universal peace and all that.I tested it but if you have any problem, contact me.regards Link to comment Share on other sites More sharing options...
rebirth Posted December 15, 2010 Share Posted December 15, 2010 It works perfect! Thank you very much TassaDarK, this is a great modification :-) Link to comment Share on other sites More sharing options...
pompcircum Posted December 24, 2010 Share Posted December 24, 2010 Thank you Tassadark for this wonderful modification! I'm new to the world of shopping carts and Prestashop and need all the help I can get Link to comment Share on other sites More sharing options...
James Tan Posted January 24, 2011 Share Posted January 24, 2011 Thanks a lot! Works on my 1.3.5, got to make some changes using diff to AdminProducts.php else the WYSWYG editor is messed up. Link to comment Share on other sites More sharing options...
TassaDarK Posted January 24, 2011 Author Share Posted January 24, 2011 Thanks James.If you can provide us the mod files for PS 1.3.5 i can add them to the main post for the community (with credits to you). Note it has to be original files with only the cart disabler modification, you have to delete any other changes if you did any. Link to comment Share on other sites More sharing options...
James Tan Posted January 24, 2011 Share Posted January 24, 2011 Thanks James.If you can provide us the mod files for PS 1.3.5 i can add them to the main post for the community (with credits to you). Note it has to be original files with only the cart disabler modification, you have to delete any other changes if you did any. I am not a coder Please take a look (can diff), don't think I made any change of own. Thanks a lot.AdminProducts.php Link to comment Share on other sites More sharing options...
James Tan Posted January 24, 2011 Share Posted January 24, 2011 By the way, I checked ps 1.4, the hide cart/price does not have a Inquiry -> contact form. It either show product is available for sale (show cart) or not for sale (no cart). So I guess I will still need to depend on this Enabler/Disabler cart modification.Anyone using 1.4 with similar or some other behaviour? I could be wrong in my testing since I am short of time and really depend on this mod.thanks,James Tan Link to comment Share on other sites More sharing options...
ramenpowered Posted January 27, 2011 Share Posted January 27, 2011 Hey guys,I've used this modification on one shop and it worked great. However, I have come up with a problem when trying it on another shop. When I add the modified AdminProducts.php file, it works fine, but my product description formatting tools disappear.Does anyone have any insight into this problem? I'm using 1.3.5 btw. Link to comment Share on other sites More sharing options...
Zwooky Posted July 10, 2013 Share Posted July 10, 2013 What abou 1.5.3.? Link to comment Share on other sites More sharing options...
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