
I have a function which creates the HTML mark-up to display the store products (JPG, GIF, etc) inside a Flash movie, since I need to allow the product images to 'rotate' (hence the name: FlipScript).
This function works great, but I will need it on every page which displays a product picture.
I could copy-and-paste the function in every .CS code-behind file where a product picture is displayed (small, medium, large and thumbnail), but since this is new, I have a feeling I'm going to need to be modifying the function over time.
Is there a good place to put a "common" function?
Somehow, I doubt it, as I see that the ZNode "CheckForCallForPricing" function is duplicated in about 6 different locations in the .cs files.
Thanks for any pointers or suggestions.
Mark
Replacing the Product Picture
The product pictures in various places in the framework are really all static images that have been pre-scaled into various directories. Since we generally expect these to be images and not HTML I think you may really need to modify the specific controls on each page. This may not be as bad as it seems though. I assume that you will only want to do this in selected places like the product page.
Znode Administrator
email: support@znode.com
url: www.znode.com
Any Global Utils?
Thanks for the reply. I was coming to the same conclusion as I dove into the code.
Just to make sure: There is no 'utils' or 'global' code that is shared among the pages where I could put this function?
If not, I'll have to copy and paste the function into all of the controls for all of the following pages:
* Product Detail
* Product Category
* Shopping Cart (although I will probably leave the thumbnails as the static images - no flip)
* Catalog Search
* Brand Search
* Price Search
I don't mind doing it (but my CTRL-V fingers may get a little tired). I'm just concerned about maintenance and upgradability.
Thanks,
Mark
Global Utils
Yes, to confirm I think you will need to replace these items as needed on the separate pages.
If you are worried about maintenance you can write your own common control (or code) to do this before doing the substations.
Znode Administrator
email: support@znode.com
url: www.znode.com
Worked like a charm
Good call.
I just put the couple of utils I needed into a new class with a couple of static methods, and called those from the individual pages. Worked like a champ. I'm glad I did it that way, too, as I've had to change the main function about a dozen times already today!
Completely unrelated, I wanted to let you know about an inconsistency I found in the controls while spelunking around on the pages that display product images. On most of the pages where a small image is required (Brand.ascx, Specials.ascx, Price.ascx), the data is correctly bound to "SmallImageFilePath", but on ProductList.ascx, the field name is transposed as "ImageSmallFilePath". It does still work, as the code-behind page returns the correct info, but its not consistent with the rest of the pages, or with the rest of the library, and a tricky thing like that can really muck up a global find-and-replace [don't ask me how I know this].
Otherwise, this code is beautiful. Unbelievably well organized. Hats off to your developer team.
- Mark
Code Inconsistancy
Thanks for pointing this out! I will add a ticket to fix this in the next version.
Znode Administrator
email: support@znode.com
url: www.znode.com