Page 1 of 1

echo output data

Posted: Mon Sep 19, 2011 4:08 pm
by Supplement
If I'm using this <?php echo $product_qty;?> to echo the output of the products and there is multiple products they are delimited by a comma, is it possible to delimit by a dash or basically anything I want for the ouput?


right now the out put would be this.

product ids"

13, 42, 33, 6


Could i get the output like so?

13 - 42 - 33 - 6

or possibly just get rid of the commas from the output? :)

Re: echo output data

Posted: Mon Sep 19, 2011 4:19 pm
by AbraCadaver

Re: echo output data

Posted: Mon Sep 19, 2011 5:25 pm
by Supplement
What's the syntax look like on that?

<?php echo str_replace('-',$product_qty');?>

Something like this I suppose, I tried it but no bueno.

Re: echo output data

Posted: Mon Sep 19, 2011 6:48 pm
by nowaydown1
Something like this should work for you:

Code: Select all

$product_qty = str_replace(", ", " - ", $product_qty);
echo $product_qty;

Re: echo output data

Posted: Mon Sep 19, 2011 8:21 pm
by Supplement
Still left a comma in between the products ordered.

Re: echo output data

Posted: Tue Sep 20, 2011 2:18 pm
by Supplement
Still looking for a bit of help on this fix, if anybody has ideas. Thanks in advance.

Re: echo output data

Posted: Wed Sep 21, 2011 2:00 pm
by Supplement
If I'm using this tracking pixel on the thank you page after customers check out, I was wondering if I could change the output completely.

This is the pixel on the page before a checkout.

<img src="https://www.site.com/u?CID=1521148&TYPE ... TEM1=<?php echo $product_id;?>&AMT1=<?=$_SESSION[tracker_order_amt]?>&QTY1=<?php echo $product_qty; ?>&DISCOUNT=0" height="1" width="20">


After a checkout has been completed, it's something like this:

<img src="https://www.site.com/u?CID=1521148&TYPE ... 4&ITEM1=15, 24, 36&AMT1=336.00&QTY1=4, 1 , 3&DISCOUNT=0" height="1" width="20">


Below is the output that I'd Ideally want.


&ITEM1=15
&AMT1=112.00
&QTY1=4

&ITEM2=24
&AMT2=112.00
&QTY2=1

&ITEM3=36
&AMT3=112.00
&QTY3=3



Any help would be greatly appreciated.

Re: echo output data

Posted: Thu Sep 22, 2011 12:25 pm
by Supplement
up? :banghead:

Re: echo output data

Posted: Thu Sep 22, 2011 1:39 pm
by malakiahs
Have you tried?

implode('- ' , $product_qty);

Re: echo output data

Posted: Thu Sep 22, 2011 4:49 pm
by Supplement
No, but I'll give that a try.

What about the question mentioned above your post? Ideas?

:D