Results 1 to 6 of 6
  1. #1
    Join Date
    Apr 2011
    Posts
    19
    Plugin Contributions
    0

    Default Adding button to product description

    Short version:
    How do I get an image or input button to appear in the "intro text" of each product when they're being listed (not just when you're viewing the complete info of a single product)?

    Full version:
    I'm running the latest version of Zencart. I'm very familiar with PHP, HTML, CSS, and I have a ton of experience with Joomla. However, I've walked into a ZenCart project, and feeling a bit lost.

    I've added a small piece of javascript to the head of my template that essentially just opens a small flash player in a div I also added to the template in an absolute position.

    I set it up to play a video from a list in an xml file, and all of it works great when you're viewing the product itself.

    However, in a list of products (like when you're searching or navigating the menu), not only does the "play" button not appear, but the product doesn't truncate after the first paragraph.

    I've tried two approaches:
    Code:
    <input border="0" type="image" onclick="player(1, this);" style="float: right;" src="images/play.png">
    Which doesn't work, because the code is clearly within a <form>, and just submits the form instead.

    The other approach works in the full product, but has the problems mentioned above:
    Code:
    <a href="javascript:player(1, this);">
    <img border="0" style="float:right;" src="images/play.png" />
    </a>
    Sorry I'm so verbose. Thanks in advance!

  2. #2
    Join Date
    Feb 2005
    Location
    Lansing, Michigan USA
    Posts
    20,021
    Plugin Contributions
    3

    Default Re: Adding button to product description

    If I understand the question, Zencart strips HTML from the product listing. You should be able to search the forums for zen_clean_html for instructions on how to remove that restriction.

    Here's an start in post #4:

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

  3. #3
    Join Date
    Apr 2011
    Posts
    19
    Plugin Contributions
    0

    Default Re: Adding button to product description

    Thanks for the tip! One concern: Does commenting out the zen_clean_html function create any security concerns?

    And just for clarity, I assume I'm able to override this in the template, instead of editing the core files?

  4. #4
    Join Date
    Feb 2005
    Location
    Lansing, Michigan USA
    Posts
    20,021
    Plugin Contributions
    3

    Default Re: Adding button to product description

    Yes, that file is overridable. There are no security issues I'm aware of. It's done that way so that if you have, say, 300 characters worth of product description, and you have the number of characters set in admin to show 50 characters in the product listing (with the ...more link to the product info page at the end). If you have HTML there, it may truncate in the middle of an HTML statement, making for a very ugly page. Make sure you set that value high enough so that doesn't happen.

  5. #5
    Join Date
    Apr 2011
    Posts
    19
    Plugin Contributions
    0

    Default Re: Adding button to product description

    Perfect, that makes sense. Thanks again!

  6. #6
    Join Date
    Apr 2011
    Posts
    19
    Plugin Contributions
    0

    Default Re: Adding button to product description

    Just as a quick followup to last month's post for anyone else who may have the problem:

    Removing the html cleanup didn't work. In fact, two of the three instances were already commented out from another customization.

    What I ended up doing was writing a short function in php that automatically put the button into each product description, using the product ID to identify the action of the button.

    If memory serves, the files I edited were:
    includes/templates/[MY THEME]/templates/tpl_product_info_display.php
    includes/modules/[MY THEME]/featured_products.php
    includes/modules/[MY THEME]/product_listing.php

 

 

Similar Threads

  1. Adding Extra Fields to Product Description
    By Nick1973 in forum General Questions
    Replies: 9
    Last Post: 15 Apr 2016, 08:26 AM
  2. Iframe in product description hides admin update button
    By NadiaUSA in forum General Questions
    Replies: 3
    Last Post: 26 Jul 2011, 01:42 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