Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls

X_cart Variable Array String Debug Tool

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions
 
Thread Tools Search this Thread
  #1  
Old 05-23-2007, 03:49 AM
 
TTS Telecom TTS Telecom is offline
 

Member
  
Join Date: Dec 2003
Location: SW, UK
Posts: 17
 

Cool X_cart Variable Array String Debug Tool

Have no idea if this is of any use to any one here, I wrote this to quickly find the info i wanted in side strings, I use it alot with X-cart.

Function:
Basically if you want to know what values/keys are held in a string, use this, it's a bit like a neat explode()

just include the function in /includes/func.php

or on the page you want to use it on

Really simple to use
Code:
getVariables($string, $email_debug);

$string is the string you wish to debug
$email_debug is the email you want the output sent to

produces an out put like this (emailed to your desired address)

Code:
********************* KEY: products *********************** [products] [0] [itemid] = 1470 [products] [0] [productid] = 16371 [products] [0] [productcode] = TEST [products] [0] [product] = product name test download [products] [0] [provider] = master [products] [0] [distribution] = /c_249.gif [products] [0] [weight] = 0.00 [products] [0][list_price] = 10.00 [products] [0] [descr] = short description text [products] [0] [fulldescr] = detailed description text [products] [0] [avail] = 1000 [products] [0] [rating] = 13 [products] [0] [forsale] = H [products] [0] [add_date] = 1179608145 [products] [0] [image_x] = 0 [products] [0] [image_y] = 0 etc ......................................................

Heres the function

Code:
function getVariables($string, $email_debug) { foreach ($string as $key => $value) { $body .= "\n*********************\nKEY: $key\n***********************"; $current = $key; if (is_array($value)) { foreach ($value as $key => $value) { $current1 = $key; if (is_array($value)) { foreach ($value as $key => $value) { $body .= "\n[$current] [$current1] [$key] = $value"; } } $body .= "\n[$current] [$key] = $value"; } } else { $body .= "\n[$key] = $value"; } } $subject = 'order data on look at order history'; $to = $email_debug; // your email mail($to, $subject, $body); }

All the best


Jethro
__________________
X-cart: 4.0.17
PHP: 4.3.11
Reply With Quote
  #2  
Old 05-23-2007, 04:34 AM
  Zaja's Avatar 
Zaja Zaja is offline
 

X-Adept
  
Join Date: Mar 2004
Location: The Universe is my home
Posts: 420
 

Default Re: X_cart Variable Array String Debug Tool

Nice one Jethro, thx.
__________________
_/ _/ _/ _/ _/ _/ _/ _/ _/

7dana.com
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 03:15 AM.

   

 
X-Cart forums © 2001-2020