2mdee Posted October 19, 2015 Share Posted October 19, 2015 Hello everybody, AM newer on prestashop but i am a lil good in PHP. I want to know how to add a column points of each product, i saw some tutorials in google but in some french forums of prestashop, they said that it's not the good solution. If somebody can help. Thanks. Link to comment Share on other sites More sharing options...
Rolige Posted October 19, 2015 Share Posted October 19, 2015 In PrestaShop 1.6 you can enable/disable the right/left column for whatever page (including product page) in the BO > Preferences > Themes > Click Advanced settings > And scroll bottom to the section "APPEARANCE OF COLUMNS" I don't know if this solve your issue. Link to comment Share on other sites More sharing options...
2mdee Posted October 19, 2015 Author Share Posted October 19, 2015 Thank you COTOKO for you reply, will try it right now.Will tell you . Regards, Link to comment Share on other sites More sharing options...
2mdee Posted October 19, 2015 Author Share Posted October 19, 2015 Sorry COTOKO but i don't know if you understand what i want. I need to add two columns in products entity, i will have also to add them in database, am looking for the better et safer way. I saw what you already say, but i ask myself if that's the solution you gave me? Regards, Link to comment Share on other sites More sharing options...
Rolige Posted October 20, 2015 Share Posted October 20, 2015 Are you talking about add 2 columns in the product's table of the database? Link to comment Share on other sites More sharing options...
2mdee Posted October 21, 2015 Author Share Posted October 21, 2015 yes i talk about that, in the code and in the database. In french forum somebody found the solution. Thank you, i will translate and put here the solution. Link to comment Share on other sites More sharing options...
jabberbob Posted October 22, 2015 Share Posted October 22, 2015 I don't know if you mean something like this: 1. Changes in DB: alter table ps_product add column some_featurea tinyint(1) unsigned default 0;alter table ps_product add column some_featureb tinyint(1) unsigned default 0; 2. Create file /override/classes/Product.php: <?php class Product extends ProductCore { public $some_featurea; public $some_featureb public function __construct($id_product = null, $full = false, $id_lang = null, $id_shop = null, Context $context = null) { self::$definition['fields']['some_featurea'] = array('type' => self::TYPE_BOOL, 'validate' => 'isBool'); self::$definition['fields']['some_featureb'] = array('type' => self::TYPE_BOOL, 'validate' => 'isBool'); parent::__construct($id_product, $full, $id_lang, $id_shop, $context); } } 3. In admin template file /override/controllers/admin/templates/products/informations.tpl add following code: <div class="form-group"> <div class="col-lg-1"><span class="pull-right">{include file="controllers/products/multishop/checkbox.tpl" field="some_featurea" type="radio" onclick=""}</span></div> <label class="control-label col-lg-2"> {l s='some_featurea'} </label> <div class="col-lg-9"> <span class="switch prestashop-switch fixed-width-lg"> <input onclick="toggleDraftWarning(false);showOptions(true);" type="radio" name="some_featurea" id="some_featurea_on" value="1" {if $product->some_featurea || !$product->isAssociatedToShop()}checked="checked" {/if} /> <label for="some_featurea_on" class="radioCheck"> {l s='Yes'} </label> <input onclick="toggleDraftWarning(true);showOptions(false);" type="radio" name="some_featurea" id="some_featurea_off" value="0" {if !$product->some_featurea && $product->isAssociatedToShop()}checked="checked"{/if} /> <label for="some_featurea_off" class="radioCheck"> {l s='No'} </label> <a class="slide-button btn"></a> </span> </div> </div> <div class="form-group"> <div class="col-lg-1"><span class="pull-right">{include file="controllers/products/multishop/checkbox.tpl" field="some_featureb" type="radio" onclick=""}</span></div> <label class="control-label col-lg-2"> {l s='some_featureb'} </label> <div class="col-lg-9"> <span class="switch prestashop-switch fixed-width-lg"> <input onclick="toggleDraftWarning(false);showOptions(true);" type="radio" name="some_featureb" id="some_featureb_on" value="1" {if $product->some_featureb || !$product->isAssociatedToShop()}checked="checked" {/if} /> <label for="some_featureb_on" class="radioCheck"> {l s='Yes'} </label> <input onclick="toggleDraftWarning(true);showOptions(false);" type="radio" name="some_featureb" id="some_featureb_off" value="0" {if !$product->some_featureb && $product->isAssociatedToShop()}checked="checked"{/if} /> <label for="some_featureb_off" class="radioCheck"> {l s='No'} </label> <a class="slide-button btn"></a> </span> </div> </div> 4. remove file /cache/class_index.php Link to comment Share on other sites More sharing options...
2mdee Posted October 22, 2015 Author Share Posted October 22, 2015 Thanks you a lot that will help help me ! Have a nice day ! Link to comment Share on other sites More sharing options...
Rolige Posted October 22, 2015 Share Posted October 22, 2015 I don't know what is your final purpose, but alter an official table is NOT a recommendation, imagine the problem this would cause when upgrading, the best solution all the time is a module. 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