![]() |
Re: Age Calculation
Code:
{* There you go. There is no forms in that and it's text based. You can customize what it says at the bottom. Anything between the <span></span> tags are from the script so you can change anything outside of that. You'll probably need to change the order for which the age is though. At the top with the smarty variables, I have it as 1 0 2. If that works, you'll want to put the script in an actual external .js file so the browser can cache it. Faster load times and less bandwith. The " He is <span id="dAge">5 months</span> old" shouldn't be in a .js file though. |
Re: Age Calculation
THANKS TAL!!! That's awesome!!! I'm extremely grateful!!!
|
Re: Age Calculation
TAL,
I was wondering about making it say "Sku" is <span id="dAge">5 months</span> old" Here's what I was trying, but I got nothing. <span id="product.productid"></span> is <span id="dAge">5 months</span> old |
Re: Age Calculation
the spanId is simply used to let the script know where to replace text.
Code:
document.getElementById('dAge').innerHTML = dife[0]+" years, "+dife[1]+" months, and "+dife[2]+" days"; As you can see, it has dAge in there. So everything in the dAge ID will be replaced by the output of the script, which happens to be the age. If it can't get a value, it'll just say as "5 months". If you want to show something like "Junior (SKU name) is X old" then it would be this as the HTML/smarty part: Code:
{$product.productid} is <span id="dAge">5 months</span> old If you wish to style the name of the puppy you can add its own class/id such as this: Code:
<span class="puppyCust">{$product.productid}</span> is <span id="dAge">5 months</span> old Then you just need to add something like this in your css: Code:
.puppyCust { |
Re: Age Calculation
Thanks Tal.
I was trying to input some logic in the final calc. His puppies are often after less than a year old, so it's not necessary to include the year calc. I was trying the following, but it's not working right Code:
if(dife[0]>0){ |
Re: Age Calculation
That's a bit confusing.
Your first statement is checking the years, then your second is checking the months. It's also not an ifelse statement which would be more logical. In any case... Code:
function calage() Tested and works. |
Re: Age Calculation
Awesome Tal!!
So now I'm trying to put the age on the products_list.tpl I just inserted: Code:
{include file="modules/Age_Calculation/age.tpl"} Below: Code:
<div class="descr">{$product.descr}</div> However it only shows " Junior is 5 months old" And does the same for all dogs, except the name is different. http://littlepuppiesonline.msidesigns.com/home.php?cat=10 |
Re: Age Calculation
Quote:
That's because the extra field variables are not available in the category display. You'll have to have someone else help you with that. |
All times are GMT -8. The time now is 12:53 PM. |
Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.