Results 1 to 7 of 7
  1. #1
    Join Date
    Mar 2007
    Location
    Pepperell, Massachusetts
    Posts
    232
    Plugin Contributions
    1

    Default authorizenet_aim modified description

    I needed attribute information in the authorizenet_aim payment module. I used the opportunity to change the format too.. ..it might be a useful option in the future to include or not include attribuets in the description.

    Code:
     
       // Create a string that contains a listing of products ordered for the description field
        $description = '';
        for ($i=0; $i<sizeof($order->products); $i++) {
          $description .= $order->products[$i]['qty'] . ' x ' . $order->products[$i]['name'];
          if (sizeof($order->products[$i]['attributes']) > 0) {
            for ($j=0; $j<sizeof($order->products[$i]['attributes']); $j++) {
              $description .= ' [' . $order->products[$i]['attributes'][$j]['option'] . ': ' . $order->products[$i]['attributes'][$j]['value'] . ']';
            }
          }
          $description .= ' + ';
        }
        // Remove the last " + " from the string
        $description = substr($description, 0, -3);
    SecurePay has a limit on this string and truncates ~100 characters, does anyone know if Authorize.net has a specific limit? I guess I'll find out.

  2. #2
    Join Date
    Mar 2007
    Location
    Pepperell, Massachusetts
    Posts
    232
    Plugin Contributions
    1

    Default Re: authorizenet_aim modified description

    Has anyone used the "x_line_item" field? Perhaps I should have tried that instead of extending the description.

  3. #3
    Join Date
    Mar 2007
    Location
    Pepperell, Massachusetts
    Posts
    232
    Plugin Contributions
    1

    Default Re: authorizenet_aim modified description

    Quote Originally Posted by dhcernese View Post
    ... does anyone know if Authorize.net has a specific limit? I guess I'll find out.
    Duh. RTFM. 255 characters.

  4. #4
    Join Date
    Jan 2004
    Posts
    66,373
    Blog Entries
    7
    Plugin Contributions
    274

    Default Re: authorizenet_aim modified description

    This snippet from upcoming 2.0 code may help meet the need you're working on ...
    Code:
        // itemized contents
        $itemizedItemsArray = array();
        reset($this->order->products);
        for ($i = 0, $n = sizeof($this->order->products); $i < $n && $i < 30; $i ++)
        {
          $lineItem = $this->order->products[$i]['id'] . '<|>';
          $lineItem .= substr(htmlentities($this->order->products[$i]['name'], ENT_QUOTES, 'UTF-8'), 0, 30) . '<|>';
          if (isset($this->order->products[$i]['attributes']))
          {
            $attribs = ' (';
            for ($j = 0, $m = sizeof($this->order->products[$i]['attributes']); $j < $m; $j ++)
            {
              $attribs .= $this->order->products[$i]['attributes'][$j]['option'] . ' - ' . $this->order->products[$i]['attributes'][$j]['value'] . '; ';
            }
            $attribs .= ')';
          }
          $lineItem .= substr(htmlentities($this->order->products[$i]['description'] . $attribs, ENT_QUOTES, 'UTF-8'), 0, 255) . '<|>';
          $lineItem .= $this->order->products[$i]['qty'] . '<|>';
          $lineItem .= number_format($this->order->products[$i]['final_price'], 2, '.', '') . '<|>';
          $lineItem .= 'Y';
          $itemizedItemsArray[] = $lineItem;
          // track one-time charges
          if ($this->order->products[$i]['onetime_charges'] != 0)
          {
            $itemizedItemsArray[] = 'OTC' . '<|>' . 'One Time Charges' . '<|>' . '(One Time Charges related to ' . substr(htmlentities($this->order->products[$i]['name'], ENT_QUOTES, 'UTF-8'), 0, 200) . ')' . '<|>' . '1' . '<|>' . number_format($this->order->products[$i]['onetime_charges'], 2, '.', '') . '<|>' . 'Y';
          }
        }
        $submit_data['x_line_item'] = $itemizedItemsArray;
    (You'll have to edit the above and change all the $this->order references to just $order or else it won't work in your current version.)
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  5. #5
    Join Date
    Mar 2007
    Location
    Pepperell, Massachusetts
    Posts
    232
    Plugin Contributions
    1

    Default Re: authorizenet_aim modified description


  6. #6
    Join Date
    Mar 2007
    Location
    Pepperell, Massachusetts
    Posts
    232
    Plugin Contributions
    1

    Default Re: authorizenet_aim modified description

    Quote Originally Posted by DrByte View Post
    This snippet from upcoming 2.0 code may help meet the need you're working on ...
    Code:
        <SNIP>
    (You'll have to edit the above and change all the $this->order references to just $order or else it won't work in your current version.)
    We need a nl2br() in there somewhere.

  7. #7
    Join Date
    Mar 2007
    Location
    Pepperell, Massachusetts
    Posts
    232
    Plugin Contributions
    1

    Default Re: authorizenet_aim modified description

    Quote Originally Posted by dhcernese View Post
    We need a nl2br() in there somewhere.
    Code:
    nl2br($order->products[$i]['attributes'][$j]['value'])
    for text entry fields.

 

 

Similar Threads

  1. authorizenet_aim table
    By cshart in forum Addon Payment Modules
    Replies: 4
    Last Post: 11 Oct 2006, 03:23 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