Author |
Topic |
|
riprod
VP-CART New User
USA
85 Posts |
Posted - March 20 2008 : 14:23:48
|
On my site I have setup a simple onclick to show up to 3 images. see: http://www.portable-grill-store.com/shopexd.asp?id=63
However if I do not have multiple images for each product, it shows missing images. http://www.portable-grill-store.com/shopexd.asp?id=73
I tried adding a bit of asp into the tmp_product page to skip that area if '[extraimage1]' is nothing. However it seams to filter out any asp from the template file.
Otherwise I was thinking I could make the default for [extraimage1] = "no-image.gif" but I can't find where to do that.
Any ideas ?? |
|
carfin
VP-CART Expert
United Kingdom
948 Posts |
Posted - March 21 2008 : 04:20:18
|
Hi,
for each additional image within your table divisions you will need to insert a $ sign at the start of the line of code in the template. e.g.
<td width="33%"> $ <img src="[extraimage1]"> </td>
<td width="33%"> $ <img src="[extraimage2]"> </td>
<td width="33%"> $ <img src="[extraimage3]"> </td>
Templates will not process any server side code which is why your asp doesn't work.
Hope this helps
Carrol www.deanston-electrical.co.uk |
|
|
riprod
VP-CART New User
USA
85 Posts |
Posted - March 21 2008 : 08:26:18
|
No that doesn't work because it's a little more complicated layout. my code uses an image resizer and does an image swap onclick so looks something like this :
<img src="sizer.aspx?maxdimention=100&filename=[extraimage1]" alt="[translate cname]" name="image1" hspace="3" border="2" id="image1" onclick="MM_swapImage('main','','[extraimage1]',1)" />
A '$' in front does not do anything. any other ideas |
|
|
carfin
VP-CART Expert
United Kingdom
948 Posts |
Posted - March 21 2008 : 08:43:39
|
I'm not familiar with image re-sizers, but a simple solution to get rid of the default no image graphic is to create your own blank white image and add it to the extraimage1,2 or 3 fields for each of your products that does not have additional images. I know it will still let the user click on the blank white image, but they're less likely to click the space if there's nothing to see there.
The default for no image (NoImage.gif) is in Cart Setup in a field called xnoimage.
Regards,
Carrol www.deanston-electrical.co.uk
|
|
|
devshb
Senior Member
United Kingdom
1904 Posts |
Posted - March 22 2008 : 04:31:33
|
true; the $ trick will only work with a single template-field, not with multiple ones on the same physical template line
not sure if you've got this module or not, but our byz033 (template fields) module (which comes as standard with various other byz addons) has lots of examples built into it which would act as a good base-point if you want to do vbscript logic like that in template fields. one of the main tricks in that is to use functions-with-arguments (as functions-without-arguments in templates won't work with the $ trick) I think you definitely need to create a new template field, and then put all the logic into that function, then you'll still be able to use the $ trick but you'll be able to use multiple product columns to format the output.
for example, in that situation I'd create a new template field and call it with something like: [BYZ_CUS_EXTRA_IMAGE catalogid] and then have that function find the other product values for its catalogid byz033 is really a developer's tool, but there are examples built-in which could be used as a base.
sometime soon we'll be releasing a new version of byz033 where you can pass across multiple fields/literals across to template-functions from a single template-field, and to have some kind of "drill-down" template field (eg finding a supplier name for a given supplierid) which uses multiple arguments. that would make what you want to do a bit simpler, but you'd still be able to do what you need to do on the current version.
Simon Barnaby Developer [email protected] www.BigYellowZone.com Web Design, Online Marketing and VPASP addons |
Edited by - devshb on March 22 2008 04:36:01 |
|
|
Admiral The X
VP-CART New User
USA
52 Posts |
Posted - March 22 2009 : 18:29:39
|
Might be a tad late on this, but i got byz033 a few days ago and there is a good resolution for what i think is your problem (and mine too) lol.
the $ does not apear to work for just one line, but rather with myltiple template fields it just becomes an OR || condition unlike which we would prefer an AND && comparison.
IF condition 1 or condition 2 is not "" writeline is how it executes.
Since i just got byz i'm still tooling around in the example files - BUT here is what i did.
$<td><center><img src="[extraimage3]" alt="[BYZ_EXAMPLE1_ARGS catalogid]" /></center></td>
Under most circumstances this would execute a line with a broken link picture when image3 did not exist but i added some logic to example1 to prevent this from happening.
Sub BYZ_EXAMPLE1_ARGS(arg_in_value,arg_out_value,arg_in_cursor) Dim retval, strsql, rs, image, desc
retval=""
if (arg_in_value<>"" and IsNull(arg_in_value)=false) then strsql="select cdescription, extraimage3 from products where catalogid='" & arg_in_value & "'" set rs = dbc.execute(strsql) rs.movefirst end if desc = rs("cdescription") image = rs("extraimage3") if image <> "" and isnull(image) = false then arg_out_value=desc else arg_out_value="" end if rs.Close Set rs=Nothing End Sub
using this method u will have to make a function for each image, but the benifits for SEO are well worth it. And on your product pages you will have the ability to display only as many images as are in exastance Vs having to deal with products that have the "no image" image.
forgive my sub name... lol like i said i just got byz033 and i was to lazy to make a custom file just yet =) cool stuff though.
devshb, is there an easier way to get at the cdescription, and extraimage3 other than running the SQL like i did?
Air Armory - Airsoft http://www.AirArmory.com - shop http://sitrep.airarmory.com - news |
Edited by - Admiral The X on March 23 2009 18:44:35 |
|
|
devshb
Senior Member
United Kingdom
1904 Posts |
Posted - March 23 2009 : 11:06:20
|
Hi,
yes, there are lots of different ways of doing it. Be careful though; in the code above you've forgotten to close the cursor and set it to nothing.
Whenever there's logic which involves more than one dynamic value in it, I'd usually use a single template field/function which returns the whole line (using a separate query like you did), although if what you're already doing works then that's fine, just remember to do this at the end:
rs.Close Set rs=Nothing
Take a look at BYZ_EXAMPLE4_ARGS which is probably a closer match to what you're trying to do (it does a category query, but same logic applies if you're doing a products query)
If you're using a sqlserver database then watch out for the text/ntext (memo) bug; you need to reference all text/ntext columns in the cursor processing first (putting them into temp variables) before you reference other columns in the cursor, otherwise the values in the cursor get blanked out.
Simon Barnaby Developer [email protected] www.BigYellowZone.com Web Design, Online Marketing and VPASP addons |
Edited by - devshb on March 23 2009 11:08:20 |
|
|
Admiral The X
VP-CART New User
USA
52 Posts |
|
devshb
Senior Member
United Kingdom
1904 Posts |
Posted - March 24 2009 : 05:40:10
|
missing out the rs.close will keep the cursor open even after the asp page has finished loading, and missing out the setting to nothing will keep the object's memory in use. it won't cause any errors, but if it happens a lot then it starts to eat up the server memory and you could get sessions being dropped etc.
Simon Barnaby Developer [email protected] www.BigYellowZone.com Web Design, Online Marketing and VPASP addons |
|
|
|
Topic |
|