Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

php code in description


splendens

Recommended Posts

After reading http://www.oscommerce.com/forums/index.php?sho...=0entry273852 because I'd like to include complete webpages in my product descriptions, I still need some help.

 

I listed as product description

'. tep_image(DIR_WS_IMAGES . 'LOGOmysite.jpg', 'mysite').'

 

I get the expected result, my logo, but I also get the code printed on the page?

 

Secondly,

 

If I'd like to put an entire webpage as description, what do I need to use for code. I'm a complete newbie in php,

 

Tried some stuff like defining and printing a variable $description=file("url") and to echo or print it. Well, in short, all my efforts failed thusfar.

 

If someone could help me here that would be great,

 

Best

splendens

Link to comment
Share on other sites

Just use HTML anywhere in the description where you want the image to appear:

 

'my description....... <img src="images/ logo.jpg">..more description..'

 

If you want to use an entire webpage for a description, just cut-and-paste everything between the <BODY> and </BODY> tag and paste it into the product description.

I'd rather be flying!

Link to comment
Share on other sites

I have a very similar situation so I'm posting here in this thread.

 

I have installed category descriptions and is working ok other than a little admin side glitch.

 

Anyway, I want to put a link to another php page on my site in the description.

 

Now it is true I can just put in an html link such as:

 

<a href="solution.php">Click Here</a>

 

but that will not forward the session id in progress. I tried placing:

 

<?php echo '<a href="' . tep_href_link(FILENAME_SOLUTION) . '">' . CLICK_HERE . '</a>'; ?>

 

but it doesn't work.

 

Can someone help me out with this solution?

 

Thanks,

 

Tim Fortune

How do you know when you know what you want to do for the rest of your life?

Link to comment
Share on other sites

You normally wouldn't need to include the session ID, if a session cookie is used. But the only way to expand PHP from the descriptions is to wrap an eval() call around the retrieved text, and I am reluctant to do that for security reasons.

Link to comment
Share on other sites

Thanks for your reply.

 

Is there a suggestion as to how to get this to work?

 

I have read about sessions and cookies a thousand times and I still don't understand how they work.

 

I looked in admin and see that I have force cookies-->false

and

recreate session-->false

 

I have never monkeyed with these settings because I don't know what they do or even what to look for if I do change them.

 

It just seems there should be a way to place a link in the cat or prod description that would allow the session to continue. I tried placing the html link in the description and it opens the page just fine but I loose any products that are in my temp cart ( not logged in but I don't see where being logged in would make any difference).

 

It really makes me mad that my mom and dad didn't make me learn this stuff 30 years ago when I was a young pup. (Back then the closest thing they had to a computer in the school was an IBM typewriter. The young folks now a days just don't know how good they've got it. I have to pay to get a programming education or spend countless hours in forums either way it costs)

 

Sorry about the rambling

 

I saw an updated contrib the other day that stated it was upgraded to included php in the db. I don't remember what table they were placing the code in but could it be the type of field in the db that is holding me up here? I did try a couple of different table types but no help. I thought maybe VARCHAR would do it but it has only a 255 character limit, not practicle for a descript. feild.

 

Well anyway, if someone could help me out with a solution I would appreciate it very much.

 

Tim Fortune

How do you know when you know what you want to do for the rest of your life?

Link to comment
Share on other sites

There's also a contribution that adds the possibility to insert php into the description. I haven't tried it myself yet, but perhaps it might help us both.

 

I started to work around my problem by uploading over a 1000 html files :( and adding all the templaty things into the header/footer/boxes.

 

If you found the contrib and installed it, please let me know if it works. I'm still interested, also because I'd like to add a table with data and display this in the description(like plant origin/plant temperatures/annual/perennial,light requirement, height etc.)

 

babbling :rolleyes:

 

Eric

Link to comment
Share on other sites

Hi Eric,

 

I'm going to search for that contrib today but I thought I'd let you know that it is not a problem to place html right into the category and product descriptions. You can even put html into the languge files.

 

I beleive most of the category and product descriptions are inserted between <td> tags so legitimately you could just drop the table right into the description field in admin. Depending on how you want the layout to look you may want to monkey with the code aliitle for placement and maybe even relocate or do away with the line in index.php and product_description.php that places the product/category graphic on the page.

 

I have recently done this to a site in order to make the site look like there oriinal site (they didn't have hardly any product graphics) so the line got the ax.

 

I'l post back here when I come up with an answer on the php thing.

 

Tim Fortune

How do you know when you know what you want to do for the rest of your life?

Link to comment
Share on other sites

I found the contrib to include php in the descriptions.

 

http://www.oscommerce.com/community/contri...ch,php+included

 

Just imagine who would have ever thought to put this in the category descriptions contribution section.

 

Anyway I'll be installing tomorrow. I've been at it since 4:30 this morning and I'm tired. I'll get back and let ya know how it goes.

 

Tim

How do you know when you know what you want to do for the rest of your life?

Link to comment
Share on other sites

Ok I'm back. Took a recovery nap and when I got up I was excited about seeing if this solution worked out.

 

There are two instances in catalog/index.php that need to have the mod code installed. Just follow the directions included in the zip. The mod works great.

 

All I did was place that php snippet I posted above into my category description and like magic it worked. I have not tested it much but I don't see any problems.

 

Looks like a winner. I'm sure with a little fooling around you could use the code just about anywhere.

 

I want to say THANK YOU very much to Garry Childs of http://freedomgroup.co.uk for providing this great mod.

 

Tim Fortune

How do you know when you know what you want to do for the rest of your life?

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...