Jump to content

PHP multiple variables - syntax formatting help


shaunmacie

Recommended Posts

Hi,

 

I have an affiliate system that shows results on what product is purchased. The problem is that the tracker is only listing the first product in the purchase list, so if someone purchases multiple products it only shows the first product in the transaction report. 

 

Here is the code:

 

$module = fetchDbConfig('PostAffiliatePro');

$orderInv = $order->getOrderInv($_GET["cart_order_id"]);

print_r($orderInv);

$affCode = "<!-- Begin PostAffiliatePro Affiliate Tracker -->
<img border='0' src='".$module['URL']."/scripts/sale.php?TotalCost=".sprintf("%.2f", $orderSum['subtotal'])."&OrderID=".$cart_order_id."&ProductID=".$orderInv['0']['productCode']."' width='0' height='0' alt='' />
<!-- End PostAffiliatePro Affiliate Tracker -->";


?>

 

The code I need help with syntax is:

"&ProductID=".$orderInv['0']['productCode']."

The products are split into arrays by number (0,1,2,3). So for example, I would want to show results for .$orderInv['0']['productCode'].  , then .$orderInv['1']['productCode'].  , and so on.

 

I would like the results to be posted with a ; between them, but I don't know the proper syntax to have it report more than just the first array. This seems pretty simple, but I only know the basics of PHP and I've adapted this from found code. 

 

 

Any guidance would be greatly appreciated.  Thanks!

 

 

 

Link to comment
Share on other sites

Thanks, but I only have basic/limited knowledge of php - so I'd have no idea how to make that work without more guidance.  The php of this shopping cart system is spread out across many files, so I wouldn't even know where to begin.

 

I'm basically just looking for the easiest solution that my basic php skills can handle. I'm a graphic designer - I'll leave the complex coding to the php gods.  Otherwise, my brain will explode

Link to comment
Share on other sites

I'm a print designer that does the occasional website.  This one is actually for my wife's business, which has a basic shopping cart and affiliate system that we purchased a few years back. We haven't really done much with the affiliate system until now.

 

I can handle html, javascript, etc fairly well, but thousands of lines of php code is where it starts to get too complicated for my liking.  In this case, I figured out how to get the correct code to show the first product purchased, but if they purchase more than one this code will only report the first. For the most part, customers will only be purchasing one product, but you never know.

 

If someone could just provide code that I can place into that spot to report more than just the first data array, I'd be all set.

"&ProductID=".$orderInv['0']['productCode']."

 

I don't even need to know how or why it would work, it's nothing I hope to have to do beyond making this function.

 

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.