Page 1 of 2 12 LastLast
Results 1 to 10 of 13
  1. #1
    Join Date
    Oct 2007
    Posts
    241
    Plugin Contributions
    0

    Default How can PHP be inserted into the Products Description area?

    Recently, I tried adding a few lines of PHP to the product description.

    Instead of executing the code, the whole string of PHP commands was outputted to the screen, as though it were just plain text.

    I included the customary

    <?php

    and

    ?>

    at the beginning, and end, of the PHP code I wished to include.

    Is what I was trying to do at all possible? And if not, would someone who knows the answer kindly explain?

    Thank you,
    Donn

  2. #2
    Join Date
    Aug 2005
    Location
    Arizona
    Posts
    27,755
    Plugin Contributions
    9

    Default Re: How can PHP be inserted into the Products Description area?

    Product description area only parses html code as you have noticed

  3. #3
    Join Date
    Oct 2007
    Posts
    241
    Plugin Contributions
    0

    Default Re: How can PHP be inserted into the Products Description area?

    Quote Originally Posted by kobra View Post
    Product description area only parses html code as you have noticed
    Thanks for the answer....

    I was hoping that this wasn't the case...........

    In simple terms, why can't PHP be executed from the products description HTML?


    Is there any way to change this, and permit the PHP to be parsed? Is this a server-side control?


    Would Java work any differently?

  4. #4
    Join Date
    Aug 2005
    Location
    Arizona
    Posts
    27,755
    Plugin Contributions
    9

    Default Re: How can PHP be inserted into the Products Description area?

    In simple terms, why can't PHP be executed cfrom the description?
    I only know that this is how it functions due to how it is coded.
    Is there any way to hange this, and permit the PHP to be parsed?
    I would suspect not with out a huge amount of re-coding

    Maybe a dev will happen by with a better explanation or possible solution

  5. #5
    Join Date
    Oct 2006
    Posts
    5,477
    Plugin Contributions
    11

    Default Re: How can PHP be inserted into the Products Description area?

    You can, it will be probably 1 single line of code change, you will have to eval the description instead of echoing it, and you will have to do something like this

    eval("?>$products_description<?php");

    Remember, anyone has access to your admin now can run whatever php code he wants using the description of the product, either it's worth it or not is up to you.
    I no longer provide installation support on forum for all my modules. However, if there are real bugs with the modules please feel free to contact me

  6. #6
    Join Date
    Feb 2006
    Location
    Tampa Bay, Florida
    Posts
    10,537
    Plugin Contributions
    127

    Default Re: How can PHP be inserted into the Products Description area?

    Donn, if what you're looking to do is display certain messages over and over again, you can use my Boilerplate Tips:

    http://www.thatsoftwareguy.com/zenca...scription.html

    http://www.thatsoftwareguy.com/zenca...ate_files.html

    HTH,
    Scott
    That Software Guy. My Store: Zen Cart Support
    Available for hire - See my ad in Services
    Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
    Do you benefit from Zen Cart? Then please support the project.

  7. #7
    Join Date
    May 2009
    Posts
    20
    Plugin Contributions
    2

    Default Re: How can PHP be inserted into the Products Description area?

    Quote Originally Posted by yellow1912 View Post
    You can, it will be probably 1 single line of code change, you will have to eval the description instead of echoing it, and you will have to do something like this

    eval("?>$products_description<?php");

    Remember, anyone has access to your admin now can run whatever php code he wants using the description of the product, either it's worth it or not is up to you.
    Has someone tried this?
    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

  8. #8
    Join Date
    May 2009
    Posts
    20
    Plugin Contributions
    2

    Default Re: How can PHP be inserted into the Products Description area?

    I have tried replacing

    echo stripslashes($products_description);

    by

    eval("?>$products_description<?php");

    in /includes/templates/cherry_zen/templates/tpl_product_info_display.php

    but it just deletes the whole product description. I imagine that I would have to do something so the code in my product description do not interfere with ZenCart's code. Somehting like stripslashes? However my knowledge of php is null.
    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

  9. #9
    Join Date
    Jun 2003
    Posts
    33,721
    Plugin Contributions
    0

    Default Re: How can PHP be inserted into the Products Description area?

    The real question is *why* do you think you need php in the product description?
    Please do not PM for support issues: a private solution doesn't benefit the community.

    Be careful with unsolicited advice via email or PM - Make sure the person you are talking to is a reliable source.

  10. #10
    Join Date
    May 2009
    Posts
    20
    Plugin Contributions
    2

    Default Re: How can PHP be inserted into the Products Description area?

    Because part of my product description is almost always the same. Therefore I would like to add an include
    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

 

 
Page 1 of 2 12 LastLast

Similar Threads

  1. Can't get into the Admin area.....
    By EiigyPocrOffCom in forum General Questions
    Replies: 1
    Last Post: 21 Jan 2011, 07:22 PM
  2. Replies: 11
    Last Post: 19 Dec 2009, 06:44 PM
  3. How to get into the php admin area?
    By ZuperDave in forum Templates, Stylesheets, Page Layout
    Replies: 8
    Last Post: 7 Feb 2009, 01:30 PM
  4. Please Help - Can't get into my admin's categories/products area
    By paperpopsicles in forum General Questions
    Replies: 0
    Last Post: 7 Mar 2008, 04:56 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg