olivierleduc101 Posted July 25, 2010 Share Posted July 25, 2010 I want to store the second price in the database.Change the value of the second price in the item editor toolDisplay the second price in featured and in the more info page.Here is the solution:In your DB: ALTER TABLE ps_product ADD price_unit decimal(20,6) NOT NULL In classes/product.phpRight After: /** @var float Price in euros */ public $price = 0; Put: /** @var float Price Unit in euros */ public $price_unit = 0; Right After: 'price' => 'isPrice', Put: 'price_unit' => 'isPrice', Right After: $fields['price'] = floatval($this->price); Put: $fields['price_unit'] = floatval($this->price_unit); Save product.php and open admin/tabs/AdminProduct.phpRight After: echo ' '.$this->l('Pre-tax retail price:').' '.($currency->format == 1 ? $currency->sign.' ' : '').'<input size="11" maxlength="14" id="priceTE" name="price" type="text" value="'.$this->getFieldValue($obj, 'price').'" onchange="this.value = this.value.replace(/,/g, \'.\');" onkeyup="calcPriceTI();" />'.($currency->format == 2 ? ' '.$currency->sign : '').' * '.$this->l('The pre-tax retail price to sell this product').' '; Put: echo ' '.$this->l('Pre-tax unit price:').' '.($currency->format == 1 ? $currency->sign.' ' : '').'<input size="11" maxlength="14" id="priceTE" name="price_unit" type="text" value="'.$this->getFieldValue($obj, 'price_unit').'" onchange="this.value = this.value.replace(/,/g, \'.\');" onkeyup="calcPriceTI();" />'.($currency->format == 2 ? ' '.$currency->sign : '').' * '.$this->l('The pre-tax unit price to sell this product').' '; All you have to do now is add {convertPrice price=$product.price_unit} in your .tpl files to print the unit price.Note that this is a dirty solution. DB backup module will not work properly after this mod. I didn't try to provide a fix yet. Link to comment Share on other sites More sharing options...
olivierleduc101 Posted July 26, 2010 Author Share Posted July 26, 2010 I changed the question to the solution has I found a way of doing it myself. 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