Results 1 to 3 of 3
  1. #1
    Join Date
    Oct 2005
    Location
    UK - London
    Posts
    68
    Plugin Contributions
    4

    link problem creating dynamic links on product description

    Hey all....

    My client has just asked me for a feature which I think should be possible but I need a little help getting started.

    The store sells bodybuilding supplements and health drinks etc.... He has a load of fact sheets on protein, bodyfat etc.....

    Is there anyway I can dynamically replace all instances of the word protein with a link to the relavent doc?

    Or does a hack like this exist already?

    Ta!

  2. #2
    Join Date
    May 2004
    Location
    Hong Kong
    Posts
    1,291
    Plugin Contributions
    1

    Default Re: creating dynamic links on product description

    There is a contribution in the download area, may be a starting point.
    Description_Diagram_ImagePopup
    A New Starter again

  3. #3
    Join Date
    Oct 2005
    Location
    UK - London
    Posts
    68
    Plugin Contributions
    4

    Default Re: creating dynamic links on product description

    ok so i got this far:

    PHP Code:
    <?


    $protein = "yummy protein bars <br /><br />"; 
     echo str_replace_once("protein", array("<a href='http://www.google.com'>protein</a>"), $protein);



    $creatine = "creatine is the blah blah blah blah blah"; 
    echo str_replace_once("creatine", array("<a href='http://www.google.com'>creatine</a>"), $creatine);




    function str_replace_once($search, $replace, $subject, &$offset = 0) {

           if (is_array($replace)) {
               foreach ($replace as $value) $subject = str_replace_once($search, $value, $subject, $offset);
           } else {
               $pos = strpos($subject, $search, $offset);
               if ($pos !== false) {
                   $offset = $pos+strlen($search);
                   $subject = substr($subject, 0, $pos) . $replace . substr($subject, $offset);
               }
           }

      
       return $subject;
    }


    ?>
    Any ideas how I should put it in Zen?

 

 

Similar Threads

  1. Replies: 3
    Last Post: 5 Mar 2014, 03:02 PM
  2. Dynamic Attributes Value In Product Description
    By TesterServers in forum Setting Up Categories, Products, Attributes
    Replies: 0
    Last Post: 1 Nov 2009, 04:50 AM
  3. Creating a DYNAMIC Url and then redirect to EZPAGE
    By jill8026 in forum General Questions
    Replies: 6
    Last Post: 2 Jul 2008, 01:14 PM
  4. Dynamic text in Product Description?
    By gabstero in forum Setting Up Categories, Products, Attributes
    Replies: 5
    Last Post: 1 Apr 2008, 04:26 PM
  5. Links in product description
    By onakat in forum Setting Up Categories, Products, Attributes
    Replies: 2
    Last Post: 8 Oct 2006, 04:03 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