PDA

View Full Version : LinkImages Tokens?


Brandon MUS
05-03-06, 06:34 PM
I just got the Product Page Templates module from Viking Coders and my last step is to include my LinkImages on the product pages. I cannot find any documenation from LinkImages (says "coming soon" even though its been out for some time now), and I didn't know where else to look. Does anyone know how to include those images in my template?

Thanks

Brandon

DesignExtend-MSI
05-04-06, 12:16 AM
Who makes that module (never heard of it).

If it can be called with OpenTokens, you can register the module with the OpenUI and call it in the templates with OpenTokens. But you may need to contact the developer of LinkImages.

PCINET - Andreas
05-04-06, 12:22 AM
ahm ... modstop ... LINKIMAGES (http://www.modstop.com/store.mv?PROD=MIVA-LINKIMAGES)

Brandon MUS
05-04-06, 12:22 AM
its a really nice module that we use on all of our sites, but I didn't set any of the up so I'm just now learning it.

http://www.modstop.com/store.mv?PROD=MIVA-LINKIMAGES

I think its a modstop original. And I would assume it would be able to be called some how by OpenTokens (at least this is what I'm hoping!), but I can't find the code anywhere. I've been looking through the raw code all day, but without documentation I wouldn't even know where else to look.

DesignExtend-MSI
05-04-06, 12:34 AM
its a really nice module that we use on all of our sites, but I didn't set any of the up so I'm just now learning it.

http://www.modstop.com/store.mv?PROD=MIVA-LINKIMAGES

I think its a modstop original. And I would assume it would be able to be called some how by OpenTokens (at least this is what I'm hoping!), but I can't find the code anywhere. I've been looking through the raw code all day, but without documentation I wouldn't even know where else to look.

Register it with the OpenUI and see if it does. If it doesn't there's nothing you can do really - they haven't supported their products in years.

However, you don't even need the module. A simple JavaScript with lookup conditional in the template will do the exact same thing, and will eat up less resources.

Brandon MUS
05-04-06, 12:48 AM
That isn't anything I've ever done. Where do I find the "Module Code" and do I make up my own name? And am I even in the correct spot (Store > "Store". Tokens.)?

Vic - WolfPaw Computers
05-04-06, 01:33 AM
The module code is often the module's product code when you purchased it. You can also find it under Modules. Click on the module and the information tab will show its name, code, version, vendor, and type of module.

Yes, you are in the right place.

Brandon MUS
05-04-06, 01:36 AM
Thanks for the info! It registered..... but I get this:

OpenUI Token Codes
/Merchant2/4.12/modules/system/linkimages.mv: Line 1: Expression Error: Call to undefined function 'TemplatePages_Instructions'

Any way to fix that?

Vic - WolfPaw Computers
05-04-06, 01:42 AM
Nope.

The module's author has left out a needed function. Until the module is updated to include the 'TemplatePages_Instructions' function, it will not work.

I would return it and hope they'll respond to your refund request. They certainly do not bother responding to support requests, emails or telephone calls.

Use the suggestion Pamela brought up. Use Javascript and templates.

Might want to update that buggy 4.12 version of Merchant as well.

Brandon MUS
05-04-06, 05:15 PM
Unfortunately, we purchased this a long time ago (back when 4.12 was near-current I assume). I'm going to try and contact modstop and cross my fingers for a response (I've heard of their support staff before). I'm also open to ideas of how to do this with Javascript. LinkImages gives you the ability to associated up to 6 pictures with a product (and 3 sizes for each picture). If this can be done another way, I'd love to hear it. The LinkImages database has corrupted on us before, and is the most time consuming part of adding products.

Thanks again, Vic.

Brandon MUS
05-04-06, 06:59 PM
Can I make OpenUI process Mivascript? I have been trying to covert this snipet of code for LinkImages to OpenUI tokens and I've gotten very little to show for it. Is there an undocumented function(or one I looked over) that I can wrap around some miva code to have it parsed completely?

Or can I post it here and someone walk me through the translation process?

Vic - WolfPaw Computers
05-04-06, 07:17 PM
Absolutely.

That is one of the major benefits of OpenUI's OpenTokens. Just about any script can be translated.

Post the snippet and I'll help you translate it.

Brandon MUS
05-04-06, 07:23 PM
Here's everything I think I need to display the LinkImages:
(copyrighted code removed)

I can handle the ifs and whiles of course. I have been using %SET()% for the assigns, but my first hurdle was not being able to concatenate any of the variable names:
(removed)

Thanks a million Vic

EDIT: removed code

PCINET - Andreas
05-04-06, 07:29 PM
The part opening the dbs is missing and probably even more.

Vic - WolfPaw Computers
05-04-06, 07:33 PM
I didnt realize you were taking snippets out of the module's code.

I was under the impression you had come up with some MIVA Script of your own to work with.

I'm sorry, but I cannot assist you with this.

Modifying copyrighted code is not only illegal, but unethical.

DesignExtend-MSI
05-04-06, 07:35 PM
I didnt realize you were taking snippets out of the module's code.

I was under the impression you had come up with some MIVA Script of your own to work with.

I'm sorry, but I cannot assist you with this.

Modifying copyrighted code is not only illegal, but unethical.

Yep - HUGE ethical problem here.

But, as I said earlier, you do not even need that module to do what you want. You can do it using conditional tokens right in the template.

Brandon MUS
05-04-06, 08:32 PM
Any info on the conditionals then? I just need some way to add these product images to my product pages.

PCINET - Andreas
05-04-06, 08:45 PM
The easiest way is naming the image files like the prodcode plus a counter (e.g. code01.jpg, code02.jpg, ...) and then by using opentokens cycling thru the images (use fexist) and display thumbnails and when clicked display a larger version.

Sample store (http://www.cheaphumidors.com/Merchant2/merchant.mvc?Screen=PROD&Product_Code=HUM-DIS4&Category_Code=STOREHUMIDORS) - build 1.5 y ago.

Vic - WolfPaw Computers
05-04-06, 08:57 PM
Why not just add a table in your product description with the extra images?

Name them the same as your product code, incrementally.

(This would be MUCH easier to do with product page templates)

Then simple conditional:

%IF(sexists('/Merchant2/graphics/00000001/%VAR(Products.d.code%1.jpg'))%
<img src="graphics/00000001/%VAR(Products.d.code)1.jpg">
%ELSE%
<img src="graphics/00000001/noimage.jpg">
%IFEND%

Loop through or duplicate lines for each additional picture.

DesignExtend-MSI
05-04-06, 08:58 PM
OR... use the predefined PPT tokens (which will save on some resources).

Vic - WolfPaw Computers
05-04-06, 08:58 PM
The easiest way is naming the image files like the prodcode plus a counter (e.g. code01.jpg, code02.jpg, ...) and then by using opentokens cycling thru the images (use fexist) and display thumbnails and when clicked display a larger version.

Sample store (http://www.cheaphumidors.com/Merchant2/merchant.mvc?Screen=PROD&Product_Code=HUM-DIS4&Category_Code=STOREHUMIDORS) - build 1.5 y ago.

Actually you'd want to use sexists, since the images would likely reside in the scripts (www/Merchant2) rather than the data directories.

PCINET - Andreas
05-04-06, 09:01 PM
BTW You have up to three additional images when using OpenUI.
Alternate Image #1 - #3

PCINET - Andreas
05-04-06, 09:02 PM
I'm not a sexist ;) ... but you're right Vic -> Master of the forum

Vic - WolfPaw Computers
05-04-06, 09:08 PM
I always thought that was an odd name for a function :)

Brandon MUS
05-04-06, 09:31 PM
I can't thank you enough really guys. I'm going to use a variation of what Vic suggested. I may be back in this thread if I have more questions, and Im' sure I'll have another thread started soon for other questions (so don't wander far :D).

Thanks!
Brandon

PCINET - Andreas
05-04-06, 09:44 PM
Vic doesn't sleep and crumbles surely food over his keyboard :P

Vic - WolfPaw Computers
05-04-06, 10:16 PM
:eek: I dont let my staff sleep much either.

I'm not really a slave driver!

Brandon MUS
05-04-06, 10:28 PM
One last question before I can abandon this thread:
Is it possible to use OpenTokens to get a GET method variable from the URL string? To avoid using javascript to swap the pictures, I need to be able to flag which picture I'm looking at. I don't see it in the mivascript documenation or the UI tokens.

Vic - WolfPaw Computers
05-04-06, 10:39 PM
In the MIVA Script docs look at MvCALL, in OpenTokens its %CALL%.

Brandon MUS
05-04-06, 10:54 PM
I've used those two functions before, but I thought they were the equivelant of includes? How do I capture the variables for the page I'm on? I read a post on the OUI forum saying that you can capture the results of MvCall, but I don't quite follow it in the script guide. Any chance of a snippet?

Vic - WolfPaw Computers
05-04-06, 11:24 PM
That would be %VAR(s.callvalue)%

Brandon MUS
05-05-06, 12:11 AM
I couldn't seem to get s.Image to work (or s.Product_Code or s.Screen), and looking at the documentation under the server variables, I see a lot of other cool tidbits, but none of them talk about referencing a specific request method.

Vic - WolfPaw Computers
05-05-06, 12:20 AM
Product Code is a database variable = Products.d.code

And screen is a global variable = g.Screen

Brandon MUS
05-05-06, 12:27 AM
Wahoo! g.Image works!

For clarification, my URL was:
/Merchant2/merchant.mv?Screen=PROD&Product_Code=L3-BLACK&Image=1

and I wanted the 1 from the Image. Thanks again for the help -- I learned a ton today!

Bruce - PhosphorMedia
05-05-06, 01:05 AM
Technically Product_code is a global variable, usually passed by the URL. Products.d.code is a database variable. In most cases in Merchant, when you have Product_code, you also have that products database variables handy such as Products.d.code, Products.d.image, etc. However, its not certain. (The most common senerio is when someone hads Category_Code the the calling URL. The category code is available, but none of that categories database variables are available because Merchant as not opened that database and pointed to that record.

(I'm sure Vic knows this, just a tipo...but an importent clarification for someone trying to figure this stuff out).

Vic - WolfPaw Computers
05-05-06, 06:46 AM
It wasnt a typo. g.Product_Code is not always available....as you stated, you have to have accessed the product database and had a value read into it already. Where as Products.d.code is always available since you're pulling it from the db.