Discussions

Integrating additional calculations into product data

I've been reviewing the Drupal Commerce platform as a possible solution for presenting financial products such as loans to consumers visiting a financial website. I think I can correctly model a loan product, such as a mortgage as product data, but I'm wondering how I might be able to incorporate a calculated monthly payment, based on the loan amount, into the product that gets displayed to the financial consumer.

I've built financial calculators on top of Drupal and used a combination of the Form API, jQuery and Javascript to take user input data and return things like monthly payment information to the user using Dom elements such as a label with a unique id. However, when I look at the HTML created for a product display, there is no unique ID associated with each product item that would allow me to do this; at least I don't think there is.

Are there approaches where I might be able to integrate IDs into the displayed data, such as what I can do with the Drupal Form API suffix and prefix fields? Or are there better approaches I can take to accomplish the same thing.

Thanks.

Posted: Dec 2, 2011

Comments