Results 1 to 2 of 2
  1. #1
    Join Date
    Jan 2007
    Posts
    1,483
    Plugin Contributions
    10

    Default Can someone please help me to modify this sanitizer function for Google Base Feeder?

    I've been tinkering around with the code a bit to try to get it to work the way I want but need some advice about the regular expressions.

    The way the Google Base Feeder is now, all & and " gets stripped out of the XML file. I entered the & and " as & and " when I created the product listings. I don't know if ZC changes it to & and ". Anyway, the Feed creator strips them out and I would like to leave them in the title and descriptions.

    Here is the zen_xml_sanitizer function:

    Code:
     function zen_xml_sanitizer ($str) {
      $_strip_search = array("![\t ]+$|^[\t ]+!m",'%[\r\n]+%m'); // remove CRs and newlines
      $_strip_replace = array('',' ');
      $_cleaner_array = array(">" => "> ", "®" => "", "®" => "", "™" => "", "™" => "", "\t" => "", "    " => "");
      $str = html_entity_decode($str);
      $str = strtr($str, $_cleaner_array);
      $str = preg_replace($_strip_search, $_strip_replace, $str);
      $str = strip_tags($str);
      $str = eregi_replace("[^[:alnum:][:space:].,!()'-_/+=?]", "", $str);
      $str = htmlentities($str);
      $str = str_replace('&', '&', $str);
      return $str;
     }
    What needs to be changed to leave " alone, it doesn't affect the XML file, and change the & to &? I'm almost there but not quite!

    Thanks!

    Matt

    Zen Cart and it's community are the best!!

  2. #2
    Join Date
    Jan 2007
    Posts
    1,483
    Plugin Contributions
    10

    Default Re: Can someone please help me to modify this sanitizer function for Google Base Feed

    I've been trying to figure it out but I am still not getting it.

    Can anyone please help me figure out this function? My main problem is that it strips out all double quotes from the titles and leaves & instead of changing it to & in the descriptions

    Please help.......

    Zen Cart and it's community are the best!!

 

 

Similar Threads

  1. Looking for this function: get_products(); so i can modify
    By tcarden in forum General Questions
    Replies: 6
    Last Post: 2 Feb 2013, 11:42 PM
  2. v150 Need someone to volunteer to install Numinix Merchant feed. Google base feeder.
    By coucho in forum All Other Contributions/Addons
    Replies: 0
    Last Post: 29 Jun 2012, 04:18 AM
  3. Can someone pls help to modify this layout? Aberdeen
    By mdivk in forum Addon Templates
    Replies: 20
    Last Post: 13 Nov 2011, 05:50 PM
  4. Can someone please help with this positioning?
    By swelter83 in forum Templates, Stylesheets, Page Layout
    Replies: 1
    Last Post: 2 May 2008, 06:11 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