pedro fonseca Posted March 21, 2011 Share Posted March 21, 2011 steps:1. Create a field 'fieldx' in ps_product table;field name: fieldxtype: decimalvalues: 26default: as defined0.000002. Edit file classes/product.php:(Line 147 aprox.) added: public $fieldx; (Line 163 aprox.) added to filesize: 'fieldx' => 32 (Line 196 aprox.) 'fieldx' => 'IsGenericName' (Line 259 aprox.) added to getFields: $fields['fieldx'] = pSQL($this->fieldx); 3. In admin/tabs/AdminProducts.php around line 1831, insert just an imput like this: ’.$this->l(‘Margen:’).’ <input type=“text” size=“33” name=“fieldx” value=”’.htmlentities($this->getFieldValue($obj, ‘fieldx’), ENT_COMPAT, ‘UTF-8’).’” > * (’.$this->l(‘Margen one, and two’).’) have a problem.:appear a error in backoffice: "1 error an error occurred while creating object product" Part of the code is wrong? Link to comment Share on other sites More sharing options...
Radu Posted March 21, 2011 Share Posted March 21, 2011 the field is defined as decimal. what type/how many decimals? how it is defined actually eg: decimal(4, 2); what value are you trying to submit?you can also turn on sql debugging define('_PS_DEBUG_SQL_', true); in config/config.inc.php Link to comment Share on other sites More sharing options...
pedro fonseca Posted March 22, 2011 Author Share Posted March 22, 2011 actually:decimal (4,2). View screenshot.The error persists.Problems in code? Link to comment Share on other sites More sharing options...
Radu Posted March 22, 2011 Share Posted March 22, 2011 actually I asked you something? what value are you trying to submit in your form? have you turned on sql debugging? Link to comment Share on other sites More sharing options...
Radu Posted March 22, 2011 Share Posted March 22, 2011 are you getting the error with any submitted value? Link to comment Share on other sites More sharing options...
pedro fonseca Posted March 22, 2011 Author Share Posted March 22, 2011 no.I can send you my files (with modification).ok? Link to comment Share on other sites More sharing options...
Radu Posted March 22, 2011 Share Posted March 22, 2011 I really don't understand you. I said: "are you getting the error with any submitted value?"you just answered no. With what value you don't get the error. With what value do you get the error? Link to comment Share on other sites More sharing options...
pedro fonseca Posted March 22, 2011 Author Share Posted March 22, 2011 i dont no.where view de value error?i dont no. Link to comment Share on other sites More sharing options...
Radu Posted March 22, 2011 Share Posted March 22, 2011 you can also send the files so I can take a look. MAke sure to let me know the prestashop version you have Link to comment Share on other sites More sharing options...
pedro fonseca Posted March 22, 2011 Author Share Posted March 22, 2011 version prestashop 1.3.7send pm the files. Link to comment Share on other sites More sharing options...
otzy Posted March 22, 2011 Share Posted March 22, 2011 What is the purpose of your field?How are you going to use in Front Office?Why are attributes or customization fields not suitable for you? Link to comment Share on other sites More sharing options...
pedro fonseca Posted March 22, 2011 Author Share Posted March 22, 2011 the idea is for a new field in the product (AdminProduct.php). This field will be called "contribution" (%). When you enter a product choose % for this product. This value (% * price) will appear in the front office, beneath the final product price. Something like: "By buying this product to help nature Ex.10 €)understand Otzy? Link to comment Share on other sites More sharing options...
otzy Posted March 22, 2011 Share Posted March 22, 2011 Create attribute group "contribution", create attributes with different % values and add desired combination for each product.>Something like: “By buying this product to help nature Ex.10 €this may be created by JavaScript after page load. Just change tpl file in your theme folder.Another way - to write a module with product footer hook functionIt seems to me it is better than making modifications in core files. Link to comment Share on other sites More sharing options...
pedro fonseca Posted March 22, 2011 Author Share Posted March 22, 2011 I think...with combinations not is possible.view screens (my idea).thanks Link to comment Share on other sites More sharing options...
otzy Posted March 22, 2011 Share Posted March 22, 2011 One of the possible solutions with combinations:find code in product.tpl {foreach from=$groups key=id_attribute_group item=group} {if $group.attributes|@count} {$group.name|escape:'htmlall':'UTF-8'} : {assign var='groupName' value='group_'|cat:$id_attribute_group} 0}$('#wrapResetImages').show('slow');{/if}"> {foreach from=$group.attributes key=id_attribute item=group_attribute} {$group_attribute|escape:'htmlall':'UTF-8'} {/foreach} {/if} {/foreach} replace it with this one: {foreach from=$groups key=id_attribute_group item=group} {if $group.attributes|@count} {if $group.name != 'contribution'}{$group.name|escape:'htmlall':'UTF-8'} :{/if} {assign var='groupName' value='group_'|cat:$id_attribute_group} 0}$('#wrapResetImages').show('slow');{/if}"> {foreach from=$group.attributes key=id_attribute item=group_attribute} {$group_attribute|escape:'htmlall':'UTF-8'} {if $group.name == 'contribution'} {literal}[removed] $(document).ready(function(){ document.getElementById('contribution_label')[removed]="{/literal}{$group_attribute|escape:'htmlall':'UTF-8'}{literal}" }) [removed]{/literal} {/if} {/foreach} {/if} {/foreach} and place wherever you wantI did not test code, this is only the demonstration of idea Link to comment Share on other sites More sharing options...
otzy Posted March 22, 2011 Share Posted March 22, 2011 oopsforum script replaces ". innerHTML" (without space after dot) with [removed]also tags:script type="text/javascript" /script Link to comment Share on other sites More sharing options...
pedro fonseca Posted March 22, 2011 Author Share Posted March 22, 2011 not working.the page product not open. appear blank.and how create field in BO (page product)? or not necessary?each product have a %. understand? Link to comment Share on other sites More sharing options...
pedro fonseca Posted March 22, 2011 Author Share Posted March 22, 2011 Mr. Otzy, Create a combination name: "contribution"the code product.tpl: {foreach from=$groups key=id_attribute_group item=group} {if $group.attributes|@count} {if $group.name != 'contribution'}{$group.name|escape:'htmlall':'UTF-8'} :{/if} {assign var='groupName' value='group_'|cat:$id_attribute_group} 0}$('#wrapResetImages').show('slow');{/if}"> {foreach from=$group.attributes key=id_attribute item=group_attribute} {$group_attribute|escape:'htmlall':'UTF-8'} {if $group.name == 'contribution'} {literal}. innerHTML $(document).ready(function(){ document.getElementById('contribution_label')[removed]="{/literal}{$group_attribute|escape:'htmlall':'UTF-8'}{literal}" }) . innerHTML{/literal} {/if} {/foreach} page blank. not appear. 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