sokpet 0 Posted August 29, 2010 Posted August 29, 2010 Hello.Coming back to customized product page for On the fly calculation of Length and Width.1. There is a basic price of the item (in my case I consider it as price per 1 linear meter)So I regestered a new function in init.php $smarty->register_function('on_the_fly', array('Tools', 'displayPriceSmarty')); I added new function in js/tools.js (not in themes/../js/ tools.js!) as follows: function on_the_fly(formObj){ var length = new Number(formObj.frameLength.value); var width = new Number(formObj.frameWidth.value); var basePrice = ((2 * length) + (2 * width))/100; var price = basePrice * MainPrice; formObj.total.value = price.toFixed(2); ; } Afterwords I made some changes in product.tpl as follows:1. Adding new variable, so we can get BASE prive of the item var MainPrice = '{$product->getPrice(true, $smarty.const.NULL)}'; 2. Adding extra price (which is supposed to be Price for linear meter). In my case only has to work with certain categories! Changing class and id names seems to be important, so the attributes do not add on for this price. <!--Linear meter price only for Marcos a medida--> {if $category->id==8 || id==9 || id==10 || id==11 || id==12 || id==13 || id==14 || id==15 || id==16 || id==17} {l s='Metro lineal - '} {if !$priceDisplay || $priceDisplay == 2} {convertPrice price=$product->getPrice(true, $smarty.const.NULL)} {if $tax_enabled}{l s='tax incl.'}{/if} {/if} {/if} 3. Adding extra fields for Lengh and Width and Subtotal Price in the buy_block form <!-- on the fly calculator --> {if $category->id==8 || id==9 || id==10 || id==11 || id==12 || id==13 || id==14 || id==15 || id==16 || id==17} {l s='Altura (cm):'} <input type="text" name="frameLength"><span class="medida_example">(Ej: 80.27) {l s='Anchura (cm):'} <input type="text" name="frameWidth"><span class="medida_example">(Ej: 110.12) {l s='Subtotal'} <input id="total" name="total" disabled="disabled" value=""/> {/if} > 4. Moved Price with VAT after Attributes, so in my case it should work as TOTAL PRICE <!-- final price --> {l s='Precio total:'} {if !$priceDisplay || $priceDisplay == 2} {convertPrice price=$product->getPrice(true, $smarty.const.NULL)} {if $tax_enabled}{l s='tax incl.'}{/if} {/if} So now comes questions. Till now I get the result in <input id="total" name="total" disabled="disabled" value=""/> Till now it works correct. See the attachement print screen. But now I need to use this result.So, what is the best way to assign this result, frameWidth and frameLength as variable, so it can be used for further calculations? Because all attributes have to be added on the top of "Result price"Is it Product.php (classes) which is responsable for formula calculations?I need some help to continue. Share this post Link to post Share on other sites
Optic 0 Posted September 21, 2010 Posted September 21, 2010 I don't have the answer for you, but this functionality is badly needed! Share this post Link to post Share on other sites
xfera 0 Posted October 27, 2010 Posted October 27, 2010 Hello. I need this function. Please send the final version if it is ready and functional. Thanks. Share this post Link to post Share on other sites
Pshopic 17 Posted October 28, 2010 Posted October 28, 2010 That is great work. I liked it. It will be good if your publish your final version Share this post Link to post Share on other sites
sintl 0 Posted January 6, 2011 Posted January 6, 2011 Hi Sokpet,Have you made the module, i am interested working with together on similar need. Share this post Link to post Share on other sites
tomlotgerink 0 Posted March 11, 2011 Posted March 11, 2011 I like to buy the final module! Pleas contact me! Share this post Link to post Share on other sites
Antoni0 1 Posted May 12, 2011 Posted May 12, 2011 Hola, alguien ha encontrado la solucion? Share this post Link to post Share on other sites
BossThemes 5 Posted July 16, 2011 Posted July 16, 2011 Hello, we have developed a solution for this, if anybody needs this functionality please send PM. Thank you. 1 Share this post Link to post Share on other sites
simberak 15 Posted February 17, 2012 Posted February 17, 2012 Hello it looks like you very understand this. I need simple thing - to display only base price on product-list.tpl, now it calculated like this: base price + attribute price impact, wich is bad... Can you help me please? I can send some money to your Paypal if it will works, but I am student, so I cant afford to much It would be very kind from you to help me... Thanks Share this post Link to post Share on other sites
sergio555 0 Posted January 3, 2013 Posted January 3, 2013 Hello, price? Hello, we have developed a solution for this, if anybody needs this functionality please send PM. Thank you. 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