Jump to:

17452 Posts in 4473 Topics by 1971 members

Archive

SilverStripe Forums » Archive » sprintf() error on eCommerce

Our old forums are still available as a read-only archive.

Moderators: martimiz, Sean, biapar, Willr, Ingo, simon_w

Page: 1
Go to End
Author Topic: 1796 Views
  • Josh
    Avatar
    SilverStripe Developer
    65 Posts

    sprintf() error on eCommerce Link to this post

    Hello,

    One step closer to getting the 0.5.2 rc1 eCommerce up and running - but i've hit a brick wall with this XML Parsing error.

    http://www.affordablefantasy.co.nz/products/

    I have been told to enable i18n, which I have done - set the locale to en_US, db/build?flush=1 and the error still appears. I'm lost!

    Cheers

  • cmswarrior
    Avatar
    Community Member
    13 Posts

    Re: sprintf() error on eCommerce Link to this post

    Am not sure if you have found the answer to your question, but just in case you haven't and for anyone else out there, try this:

    navigate to \sapphire\core\SSViewer.php, locate the following lines:

    // i18n
    ereg('.*[\/](.*)',$template,$path);
    $content = ereg_replace('<' . '% +_t\((\'([^\']*)\'|"([^"]*)")(([^)]|\)[^ ]|\) +[^% ])*)\) +%' . '>', '<?= _t(\''. $path[1] . '.\\2\\3\'\\4) ?>', $content);

    right below that look for:

    // i18n - sprintf => "sprintf(_t(...),$argument)"
    // CAUTION: No spaces allowed between arguments!
    $content = ereg_replace('<' . '% +sprintf\(_t\((\'([^\']*)\'|"([^"]*)")(([^)]|\)[^ ]|\) +[^% ])*)\),\<\?= +([^\?]*) +\?\>) +%' . '>', '<?= sprintf(_t(\''. $path[1] . '.\\2\\3\'\\4),\\6) ?>', $content);

    if you don't find it, then include it (make sure you place it right below).

    OR just use the lastest version of SSviewer.php in trunk.

    Hope this helps somebody out there.

  • Josh
    Avatar
    SilverStripe Developer
    65 Posts

    Re: sprintf() error on eCommerce Link to this post

    Thank you.

    I think it worked!

    1796 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.