Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

basket list for protx vsp form


gscreations

Recommended Posts

Benn trying for hours to try to do this, what i need is a list of items in the order in this format:

 

 

quantity_of_items:first_item_name:first_item_price:first_item_tax:----:first_item_totalcost:second_item_name:second_item_price:...and so on

 

but getting them in this format ?! :huh: need some way to loop through each row of results from database and add : to front of each item in that row then join results together

 

this is what ive got so far:

$product_query = tep_db_query("SELECT products_name, products_price, products_tax, final_price, products_quantity From " . TABLE_ORDERS_PRODUCTS . " Where orders_id='" . $oID . "'");
while ($products = tep_db_fetch_array($product_query)) {
   $products_list[] = array('products_name' => $products['products_name'],
                            'products_quantity' => $products['products_quantity'],
             'products_price' => $products['products_price'],
             'products_tax' => $products['products_tax'],
             'final_price' => $products['final_price']);
}

so get quantity is easy just do a row count on the result from database

but now i need this for each row in database:

:name:price:tax:----:final_price

then need to add row1 onto row2 and so on

so we get

:name1:price1:tax1:----:final_price1:name2:price2: and so on

then just add the qty to front of that to get:

qty:name1:price1:tax1:----:final_price1:name2:price2: and so on

 

Any know how to do this ?? Anyone using Protx for credit card processing and is passing the basket to them will have done this

Link to comment
Share on other sites

Solved it :D :thumbsup:

 

If anyone else is using Protx and want to add the basket option they have on their VSP form i did this to display the order in the format they require:

$product_query = tep_db_query("SELECT products_name, products_price, products_tax, final_price, products_quantity From " . TABLE_ORDERS_PRODUCTS . " Where orders_id='" . $oID . "'");
while ($products = tep_db_fetch_array($product_query)) {
   $products_list[] = array('products_name' => ':' . $products['products_name'],
                            'products_quantity' => ':' . $products['products_quantity'],
       'products_price' => ':' . $currencies->format($products['products_price']),
       'products_tax' => ':' . $currencies->format($products['products_tax']),
       'final_price' => ':' . $currencies->format($products['final_price']));
}
$i=0;
$n=sizeof($products_list);
while ($i<$n) {
$list[] = $products_list[$i]['products_name'] . $products_list[$i]['products_quantity'] . $products_list[$i]['products_price'] . $products_list[$i]['products_tax'] . ':----' . $products_list[$i]['final_price'];
$i++;
}
$j=0;
while ($j<$n) {
$lists = $lists . $list[$j];
$j++;
}
$basket = $n . $lists;

Link to comment
Share on other sites

  • 3 months later...
Solved it :D  :thumbsup:

 

If anyone else is using Protx and want to add the basket option they have on their VSP form  i did this to display the order in the format they require:

$product_query = tep_db_query("SELECT products_name, products_price, products_tax, final_price, products_quantity From " . TABLE_ORDERS_PRODUCTS . " Where orders_id='" . $oID . "'");
while ($products = tep_db_fetch_array($product_query)) {
? ?$products_list[] = array('products_name' => ':' . $products['products_name'],
? ? ? ? ? ? ? ? ? ? ? ? ? ? 'products_quantity' => ':' . $products['products_quantity'],
? ? ? ?'products_price' => ':' . $currencies->format($products['products_price']),
? ? ? ?'products_tax' => ':' . $currencies->format($products['products_tax']),
? ? ? ?'final_price' => ':' . $currencies->format($products['final_price']));
}
$i=0;
$n=sizeof($products_list);
while ($i<$n) {
$list[] = $products_list[$i]['products_name'] . $products_list[$i]['products_quantity'] . $products_list[$i]['products_price'] . $products_list[$i]['products_tax'] . ':----' . $products_list[$i]['final_price'];
$i++;
}
$j=0;
while ($j<$n) {
$lists = $lists . $list[$j];
$j++;
}
$basket = $n . $lists;

 

Graham,

 

Where in protx_form.php did you place your code to get it to function? Please provide the full code so that I can see.

 

Thank you and well done on sussing it.

 

Best,

 

Bob

Link to comment
Share on other sites

  • 4 months later...

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...