Results 1 to 7 of 7
  1. #1
    Join Date
    Apr 2006
    Posts
    44
    Plugin Contributions
    0

    Help embedding PHP into a description

    Hi,

    I'm trying to embed the following code into my product descriptions. This code works fine if it is in the tpl_product_info_display.php file, but I want it in the description text area.

    This generates a random quote using phpmyquote on the product page.

    <!--display random testimonial-->
    <table width="100%" border="0" cellspacing="0" cellpadding="0" class="rightbox" id="bannerbox-table">
    <tr class="rightboxheading" id="bannerbox-heading-tr">
    <!-- Sidebox Header -->
    <td colspan="3" width="100%" class="rightboxheading" id="bannerbox-heading-td">What our customers are saying...</td>
    </tr>
    <tr>
    <td colspan="3" class="rightboxcontent" id="bannerbox-content">
    <div id="bannerboxContent" class="sideBoxContent">
    <?
    include("/home/mypath/phpmyquote/quotes.inc.php");
    mysql_connect($GLOBALS['host'],$GLOBALS['username'],$GLOBALS['password']) or die("Could not connect");
    mysql_select_db($GLOBALS['database']);
    echo ShowQuote(1);
    ?>
    </div> </td>
    </tr>
    <tr>
    <!-- Sidebox Footer -->
    <td colspan="3" height="5px" class="rightboxfooter" id="bannerbox-footer">
    </td>
    </tr>
    </table>

    I mange my data offline in a FileMaker Pro database, so I'm inserting the above code into the description field there and then importing into ZC using Easy Populate. The reason I'm doing this is that I have unique customer testimonials for some products, but not all, so this will fill in with a random, generic testimonial, giving the appearance that all the products have at least one testimonial.

    Any ideas? I'm not a programmer or PHP wiz... but I'm thinking that the code isn't being parsed when it in the description area but it is when it is part of a .php template component.

    If this is the case, any way around it?

    Thanks,

    Brad
    --
    Brad Schwartz <baschwar at baschwar dot com>
    http://www.baschwar.com/

  2. #2
    Join Date
    Nov 2004
    Location
    Deal, Kent, UK
    Posts
    332
    Plugin Contributions
    0

    Default Re: Help embedding PHP into a description

    There's a testimonials manager which puts a non product related random quote in the sidebar which might be easier. See this thread:

    http://www.zen-cart.com/forum/showthread.php?t=41636

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

    Default Re: Help embedding PHP into a description

    The description section has too many protections to embed the php in it. You can have it in the description area by putting it in the tpl_product_info inside the html for the description.

  4. #4
    Join Date
    Jan 2004
    Posts
    66,444
    Plugin Contributions
    279

    Default Re: Help embedding PHP into a description

    Notwithstanding the fact that you said you're not a programmer, here is a possible approach you might try to explore, which has worked for someone. The concept may be somewhat re-usable for your application.
    http://www.zen-cart.com/forum/showth...ighlight=embed
    .

    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.

  5. #5
    Join Date
    Apr 2006
    Posts
    44
    Plugin Contributions
    0

    Default Re: Help embedding PHP into a description

    Quote Originally Posted by patski
    There's a testimonials manager which puts a non product related random quote in the sidebar which might be easier. See this thread:

    http://www.zen-cart.com/forum/showthread.php?t=41636
    I know there is a review function, but since I'm maintaining the data outside of ZC and mySQL I'm kind of stuck. I don't really want to export my testimonials and then import them into mySQL all the time. I'd rather output the code that displays the random phpmyquote on the page and be done with it.

    See, I'm exporting testimonials from my FileMaker Pro database and then putting the random testimonials after that. So, I get one or more static testimonials that are about the specific product and then a random testimonial. If the product did not have any static testimonials the user would see one generic, random testimonial and be none the wiser -- voila, all products have at least one testimonial.

    Thanks,

    Brad
    --
    Brad Schwartz <baschwar at baschwar dot com>
    http://www.baschwar.com/

  6. #6
    Join Date
    Apr 2006
    Posts
    44
    Plugin Contributions
    0

    Default Re: Help embedding PHP into a description

    Quote Originally Posted by Kim
    The description section has too many protections to embed the php in it. You can have it in the description area by putting it in the tpl_product_info inside the html for the description.
    That's what I was doing... it was displaying right after the model number and above the next/prev buttons.

    Oh well...

    Thanks,

    Brad
    --
    Brad Schwartz <baschwar at baschwar dot com>
    http://www.baschwar.com/

  7. #7
    Join Date
    Nov 2004
    Location
    Deal, Kent, UK
    Posts
    332
    Plugin Contributions
    0

    Default Re: Help embedding PHP into a description

    The testimonials manager is different from the inbuilt reviews function. Both show random reviews/testimonials in the sidebox on the index page but when on the product page the inbuilt function shows product related reviews and an invitation to write a review if none exists whereas the testimonials manager will show random testimonials across all pages.

    Compare:
    http://www.katiepie.co.uk which uses testimonials
    http://horsesupplementsdirect.co.uk/ which uses the inbuilt function

 

 

Similar Threads

  1. v139h Embedding Ordering Pages into other websites!
    By NWFAP in forum General Questions
    Replies: 0
    Last Post: 4 Feb 2012, 06:17 AM
  2. embedding websites into zen cart
    By gmrm in forum General Questions
    Replies: 13
    Last Post: 23 Nov 2010, 07:13 PM
  3. Input PHP into Product Description
    By todoonada in forum Templates, Stylesheets, Page Layout
    Replies: 5
    Last Post: 23 Jun 2009, 12:08 PM
  4. How to include php code into a product description
    By andy1234 in forum General Questions
    Replies: 10
    Last Post: 5 Jan 2008, 06:32 AM
  5. Embedding a feed in a product description
    By GSIS in forum Setting Up Categories, Products, Attributes
    Replies: 0
    Last Post: 13 Jul 2007, 09:07 AM

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