Zen Cart Logo
If this is your first visit, check our documentation. To post, register or login.
Forums / Setting Up Your Zen Cart Products / Setting Up Categories, Products, Attributes / Storing the 'Products Decription' in a seperate file

Storing the 'Products Decription' in a seperate file

Locked

Started by brettb76 on 22 Jul 2010, 11:19 AM · Views: 1,185

Results 1 to 11 of 11
This thread is locked. New replies are disabled.
22 Jul 2010, 11:19 AM
#1
brettb76 avatar

brettb76

New Zenner

Join Date:
Jul 2008
Posts:
14
Plugin Contributions:
0

Post #1 by brettb76

On my website I have a lot of items that have an identical Product Description. At the moment if I want to change something in the description I need to edit each item and that takes a long time.

I would like to be able to save the text into a separate file and have it loaded when the product is viewed.

Can this be done? (easily....lol)

22 Jul 2010, 12:39 PM
#2
stevesh avatar

stevesh

Black Belt

Join Date:
Feb 2005
Location:
Lansing, Michigan USA
Posts:
19,793
Plugin Contributions:
2

Post #2 by stevesh

Not easily, no. You might look at swguys boilerplate mod:

http: //www.thatsoftwareguy.com/zencart_php_in_description.html

23 Jul 2010, 10:29 AM
#3
brettb76 avatar

brettb76

New Zenner

Join Date:
Jul 2008
Posts:
14
Plugin Contributions:
0

Post #3 by brettb76

What about using an IFRAME e.g.

In the Products Description box I can put this ...

<iframe src ="http://www.mysite.com/some_text.htm" frameborder="0" marginheight="0" marginwidth="0" scrolling="no" width="676" height="235">
  <p>Your browser does not support iframes.</p>
</iframe>

and the text will fill the frame. Obviously I need to adjust the height and width to suit.

Are there any problems with using IFrames?

23 Jul 2010, 10:44 AM
#4
stevesh avatar

stevesh

Black Belt

Join Date:
Feb 2005
Location:
Lansing, Michigan USA
Posts:
19,793
Plugin Contributions:
2

Post #4 by stevesh

Far as I know, there's no problem using iframes in Zencart as long as they don't come anywhere near the payment processing.

By default, Zencart strips HTML out of the product listing, but that should work for the product info page. Give it a try and let us know if it works.

23 Jul 2010, 12:31 PM
#5
schoolboy avatar

schoolboy

Totally Zenned

Join Date:
Jun 2005
Location:
Cumbria, UK
Posts:
10,327
Plugin Contributions:
0

Post #5 by schoolboy

I hate IFRAME ... but I do admit to using them in some zencart stores. As Steve says, keep IFRAMES away from all processes requiring user interactivity (sign-up, login, checkout, contact us, etc).

I can see no practical reason why an IFRAME in your product description text will not do what you are after.

Scott Wilson's Boilerplate mod may help... but I think it will apply universally... ie: not product-specific.

20 years a Zencart User

23 Jul 2010, 12:48 PM
#6
brettb76 avatar

brettb76

New Zenner

Join Date:
Jul 2008
Posts:
14
Plugin Contributions:
0

Post #6 by brettb76

It works, however to get consistency in the text I had to set up my external text file like this.

<head>
<style type="text/css">
body {
	margin: 0;
	font-family: verdana, arial, helvetica, sans-serif;
	font-size: 62.5%;
	}
</style>
</head>
<body>
<div style="font-size: 1.32em; line-height: 1.4em; text-align: justify; font-family: verdana,arial,helvetica,sans-serif; color: #363636">
{Insert Text Here]
</div>
</body>

Then in the product description I insert the html code for the Iframe like this ...

<iframe src ="http://www.my-site.com/some_text.htm" frameborder="0" marginheight="0" marginwidth="0" scrolling="no" width="676" height="235">
  <p>Your browser does not support iframes.</p>
</iframe>

The productDescription div will expand to allow for an Iframe of any height (Did not check width) but the height does need to be entered into each Product so if I change the text in the external file then I would need to change the height value in each of the products anyway.

23 Jul 2010, 1:11 PM
#8
brettb76 avatar

brettb76

New Zenner

Join Date:
Jul 2008
Posts:
14
Plugin Contributions:
0

Post #8 by brettb76

I tried to be creative. I searched the web and found this page http://www.codeproject.com/KB/scripting/Adjust_An_iFrame_Height.aspx

I inserted this script into the includes\templates[my template]\jscript\jscrip_main.php

<script type="text/javascript">
	function getElement(aID)
	{
		return (document.getElementById) ? document.getElementById(aID) : document.all[aID];
    }

    function getIFrameDocument(aID){ 
        var rv = null; 
        var frame=getElement(aID);
        // if contentDocument exists, W3C compliant (e.g. Mozilla) 
        if (frame.contentDocument)
            rv = frame.contentDocument;
        else // bad Internet Explorer  ;)
			rv = document.getElementById(aID).document;
        return rv;
    }

    function adjustMyFrameHeight()
    {
        var frame = getElement("myFrame");
        var frameDoc = getIFrameDocument("myFrame");
        frame.height = frameDoc.body.offsetHeight;
    }
</script> 

and modified the Iframe code to ...

<iframe id="myFrame" src ="http://www.my-site.com/some_text.htm" frameborder="0" marginheight="0" marginwidth="0" scrolling="no" width="676" onload="adjustMyFrameHeight()">
  <p>Your browser does not support iframes.</p>
</iframe>

This worked perfectly in Firefox but Internet Explorer does not work properly.

Also leaves me with missing text if a vistor to the site has javascript disabled.

Will go back to changing them one at a time I think.

23 Jul 2010, 1:12 PM
#9
brettb76 avatar

brettb76

New Zenner

Join Date:
Jul 2008
Posts:
14
Plugin Contributions:
0

Post #9 by brettb76

gjh42:

If you know basic PHP you can wrap a test around the boilerplate code to apply it only for specific produsts or categories.

I have the boiler plate link on my list to look into next. Time for bed.

31 Oct 2010, 5:50 PM
#10
etilyeti avatar

etilyeti

New Zenner

Join Date:
May 2009
Posts:
20
Plugin Contributions:
0

Post #10 by etilyeti

brettb76:

On my website I have a lot of items that have an identical Product Description. At the moment if I want to change something in the description I need to edit each item and that takes a long time.

I would like to be able to save the text into a separate file and have it loaded when the product is viewed.

Can this be done? (easily....lol)
I have the same problem. Can I add a php include in the Products Description. And if yes, how?

<?php include 'instructions-adult-en.php'; ?>

v1.3.8a - Cherry Zen - English, French, German, Slovak, Czech -
Admin Login as a customer v2.1, FastAndEasyCheckout 1.7.3, improved_attributes_controller_1-1b2, recover_cart_sales_300B, supertracker_1-0_Fix_20090925, testimonial_manager_v1-5-0

31 Oct 2010, 6:20 PM
#11
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,512
Plugin Contributions:
176

Post #11 by drbyte

etilyeti:

I have the same problem. Can I add a php include in the Products Description. And if yes, how?
Your question was already answered by everyone who replied to the first person's post in this thread, which you quoted.

In short: no. But a workaround exists, and is discussed in detail in the replies already given.

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.