Ok, so for a simple shopping cart site (~10 products) I am leveraging the power of TVs (Template Variables) to be able to add eCommerce specific attributes to my product pages.
These TVs/attributes are things like:
[*suggested_price*]
[*sale_price*]
etc...
Today, I am using a custom snippet to take the values of the TVs above, and to calculate a "% Savings" for whenever the sale price drops below that of Suggested Retail price.
My roadblock is that I’d like to use Ditto calls to output summarized information on the home page, complete with "% Savings" advertised for each.
The problem is that when called via Ditto, I do not know how to reference the "active Ditto item" within the snippet. If I knew how to determine the current doc_id of the active Ditto document being parsed, I could seemingly still use the snippet (once I find out how to run snippets in Ditto TPLs)
Of course, if the above is not possible, I wouldn’t mind crafting a custom @EVAL or @SELECT TV for display of the percent savings on each product page.
So, anyone have any experience with a TV calculating values from OTHER TVs? What about a way to reference the active Ditto document from within a running snippet?
Or, any other ideas?
(I thought about just making the [*percent_savings*] TV a static number, and letting the user calculate/update manually, or create a 1-click module to update the TV value site-wide, but I’d really prefer the % Savings to be in real time without ANY manual intervention required...)