Results 1 to 10 of 10
  1. #1
    Join Date
    Mar 2015
    Posts
    165
    Plugin Contributions
    0

    Default Adding html to all product page description section via mysql

    Hi. As you know some sites are required to add the CA PROP 65 LINK and LOGO to their product pages. While adding a link somewhere in the footer is sufficient, I rather not.

    I know you can insert statements and commands in MySQL but I am not well versed in it and tried to do a web search for examples and could not find it.

    I would think the answer to this topic would benefit everyone. So, does any expert here know how to properly do it in one strike? Here is an example I am trying to insert in all product page descriptions.

    So you would have any product page with the text html whatever and after all that I would like to insert AFTER any description is

    <br><br>
    <center><a href="https://www.caprop65.org" target="new"><img src="/images/caprop65.png"></a></center>
    <br><br>

    So when the product page is loaded, at the bottom of the product description centered would be that code above.

    TIA.

  2. #2
    Join Date
    Jan 2004
    Location
    N of San Antonio TX
    Posts
    9,136
    Plugin Contributions
    11

    Default Re: Adding html to all product page description section via mysql

    First off, swallowing a Dodge Ram truck can be harmful to your health. And, you're telling us that Home Depot needs to inform their website customers that the Aloe Vera plant they are looking to buy could cause cancer?

    Second, that site is no longer active. Now https://oehha.ca.gov

    Third, I'm not sure the retailer is as restricted as you think. Recent changes may need to be reevaluated.

    Lastly, whenever adding to existing data in a MySQL field, you would use concat.

  3. #3
    Join Date
    Nov 2005
    Location
    los angeles
    Posts
    2,684
    Plugin Contributions
    9

    Default Re: Adding html to all product page description section via mysql

    Quote Originally Posted by travbacon View Post
    Hi. As you know some sites are required to add the CA PROP 65 LINK and LOGO to their product pages. While adding a link somewhere in the footer is sufficient, I rather not.

    I know you can insert statements and commands in MySQL but I am not well versed in it and tried to do a web search for examples and could not find it.

    I would think the answer to this topic would benefit everyone. So, does any expert here know how to properly do it in one strike? Here is an example I am trying to insert in all product page descriptions.

    So you would have any product page with the text html whatever and after all that I would like to insert AFTER any description is

    <br><br>
    <center><a href="https://www.caprop65.org" target="new"><img src="/images/caprop65.png"></a></center>
    <br><br>

    So when the product page is loaded, at the bottom of the product description centered would be that code above.

    TIA.
    NO! please do not....

    adding the same thing to ALL your product descriptions makes no sense, and IMO, is a bad way to accomplish your goal.

    this can be be accomplished very EASILY in the template. i think you can modify this script:

    /includes/templates/YOUR_TEMPLATE/templates/tpl_product_info_display.php

    and put your html code in there after the product description.

    good luck.
    author of square Webpay.
    mxWorks has premium plugins. donations: venmo or paypal accepted.
    premium consistent excellent support. available for hire.

  4. #4
    Join Date
    Feb 2006
    Location
    Tampa Bay, Florida
    Posts
    9,681
    Plugin Contributions
    123

    Default Re: Adding html to all product page description section via mysql

    An alternate approach would be to use my BOILER PLATE mod on products where it is warranted.

    https://www.thatsoftwareguy.com/zenc...scription.html
    That Software Guy. My Store: Zen Cart Modifications
    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.

  5. #5
    Join Date
    Nov 2005
    Location
    los angeles
    Posts
    2,684
    Plugin Contributions
    9

    Default Re: Adding html to all product page description section via mysql

    ok, i have looked at the @swguy mod. while interesting and no doubt with benefit, the amount of work is greater and it would involve the mysql insert statement that i do not think is a good idea.

    lets look at the parameters of the OP's problem:

    Quote Originally Posted by travbacon View Post
    Here is an example I am trying to insert in ALL product page descriptions.
    when trying to do something for ALL products, it is best to do in the template file where you want it displayed. the quoted mod builds a bit of infrastructure so that one could use a constant to insert a specific statement (or link or image or anything) within the product description. if one wanted to change that insert, one would only need change it in one place as opposed to going into each description in the product. it also provides for using multiple constants.

    his excellent description of his mod also highlights one of my least favorite aspects of ZC; the multitude of templates required to do the same thing, ie new products, featured products, sale products, and category displays. i think there should only be 1 template file to serve up all of those functions, and the sql is the only thing that changes to send the requested products to be displayed by the template.

    a topic for another discussion....

    while the mod would work and provide additional flexibility for future changes, given the parameters of the OP, i think its overkill. just my 2cents.
    author of square Webpay.
    mxWorks has premium plugins. donations: venmo or paypal accepted.
    premium consistent excellent support. available for hire.

  6. #6
    Join Date
    Jul 2012
    Posts
    16,732
    Plugin Contributions
    17

    Default Re: Adding html to all product page description section via mysql

    Whatever is done, whether by the OP or another inquiring mind, would suggest encompassing the added html in some form of html tag that could be referenced by css. In this way, if there ever is a "product" where that text is not desired to be shown, it can be hidden. See the readme in includes/templates/template_default/css.

    Another other thing about adding the same content to every description field now is that will need to remember to add it on every new product as well or build it into your default content of a new product.

    All that said as well, if you use other product types besides the default product type, then whatever is done to the suggested template file may need to be done to the other 4 related template files.
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  7. #7
    Join Date
    Feb 2006
    Location
    Tampa Bay, Florida
    Posts
    9,681
    Plugin Contributions
    123

    Default Re: Adding html to all product page description section via mysql

    Quote Originally Posted by carlwhat View Post
    ok, i have looked at the @swguy mod. while interesting and no doubt with benefit, the amount of work is greater and it would involve the mysql insert statement that i do not think is a good idea.
    Huh? Where do you see a MySQL insert?
    That Software Guy. My Store: Zen Cart Modifications
    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.

  8. #8
    Join Date
    Jul 2012
    Posts
    16,732
    Plugin Contributions
    17

    Default Re: Adding html to all product page description section via mysql

    Quote Originally Posted by swguy View Post
    Huh? Where do you see a MySQL insert?
    If it means anything, overall I like the script too.

    So, step back a moment and think about the current condition. Database is populated, software that adds a feature requiring parsing of database content is incorporated, content (formatted text) needs to be added... and tada (unfortunately?), mysql query (insert/update/whatev's) needs to be executed.
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  9. #9
    Join Date
    Nov 2005
    Location
    los angeles
    Posts
    2,684
    Plugin Contributions
    9

    Default Re: Adding html to all product page description section via mysql

    Quote Originally Posted by swguy View Post
    Huh? Where do you see a MySQL insert?
    sorry, update.... or as you say:

    "...Now to use this logic, all you need to do is type PHP_ONE_WEEK_DELAY in your product description (under Admin - Catalog - Categories and Products), and when you display the product info page, it will be changed. "

    4000 (or whatever number) products to add PHP_ONE_WEEK_DELAY would be easier done with a mysql update statement than editing every product...
    author of square Webpay.
    mxWorks has premium plugins. donations: venmo or paypal accepted.
    premium consistent excellent support. available for hire.

  10. #10
    Join Date
    Mar 2015
    Posts
    165
    Plugin Contributions
    0

    Default Re: Adding html to all product page description section via mysql

    Just a quick update. I went to my templates folder and edited the "product info display" file and just added the coding after the product buttons.

 

 

Similar Threads

  1. Adding html tables to product description adds extra line breaks
    By ndknsrln in forum Templates, Stylesheets, Page Layout
    Replies: 17
    Last Post: 4 Mar 2013, 12:35 AM
  2. Replies: 16
    Last Post: 13 Jan 2013, 06:10 PM
  3. Add product html form code On Product Description page
    By ivogue in forum Setting Up Categories, Products, Attributes
    Replies: 0
    Last Post: 4 Mar 2009, 07:54 PM
  4. Html Form On Product Description page
    By fxpro in forum Setting Up Categories, Products, Attributes
    Replies: 10
    Last Post: 22 Oct 2008, 04:32 PM
  5. Adding Amazon HTML to product description
    By Dan Ballance in forum Setting Up Categories, Products, Attributes
    Replies: 5
    Last Post: 15 Mar 2007, 05:31 PM

Bookmarks

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
Zen-Cart, Internet Selling Services, Klamath Falls, OR