News:

Looking for documentation? Take a look on our wiki

Main Menu

Small change in configuration..

Started by pashis, July 21, 2009, 02:13:18 AM

Previous topic - Next topic

pashis

I have this piece of code and its working just fine on my website.  I do however require a small change..

This is what appears in Paypal under the Description heading:

Item Name
Item SKU
Quantity - Price

How can i move 'Quantity - Price' next to 'Item Name' ?
So it gets displayed as:

Item Name, Quantity - Price
Item SKU

Does anyone know how to change that? Here's my code.
Thanks


<?php
$order_id 
$db->f("order_id");

$dboi = new ps_DB;
$q_oi "SELECT * FROM #__vm_order_item ";
$q_oi .= "WHERE #__vm_order_item.order_id='$order_id'";
$dboi->query($q_oi);

$row_num $dboi->num_rows();

//New code Getting Cart Items
$auth $_SESSION['auth'];
$cart $_SESSION['cart'];
$t_quantity 0;
$disc_perItem 0;
$i=1;

$dbb = new ps_DB;
$q "SELECT * FROM jos_vm_user_info ";
$q .= "WHERE user_id ='".$my->id."' ";
$dbb->setQuery($q);
$dbb->query();

$url "https://www.paypal.com/cgi-bin/webscr";
$tax_total $db->f("order_tax") + $db->f("order_shipping_tax");
$discount_total $db->f("coupon_discount") + $db->f("order_discount");  //New Code
$discount_totalCP $db->f("coupon_discount") + $db->f("order_discount");

while(
$dboi->next_record()) {
$t_quantity $t_quantity intval($dboi->f("product_quantity"));
}

$dboi null;
$dboi = new ps_DB;
$dboi->query($q_oi);

if(
$t_quantity 0)
{
if($discount_totalCP 0)
{
$disc_perItem round($discount_totalCP $t_quantity2);
}
else
{
$disc_perItem 0;
}
}
else
{
$disc_perItem 0;
}

while(
$dboi->next_record()) {

    
$prod_attrib $dboi->f("product_attribute");
              
    
$supp_var['item_name_' $i] = strip_tags($dboi->f("order_item_name"));
    if(
$prod_attrib ''){
      
$attributes_array explode('<br/>',$prod_attrib);
      
$v 0;
      
$z 1;
      foreach ( 
$attributes_array as $attributes_value){
        
$attrib_name trim(substr($attributes_value0strpos($attributes_value':')), " ");
        
$supp_var['on' $z '_' $i] = $attrib_name;
        
$attrib_sel trim(substr_replace(substr_replace($attributes_value""0strrpos($attributes_value': ')), ""02));
        
$supp_var['os' $z '_' $i] = $attrib_sel;
        
$v++;
        
$z++;
        unset(
$attributes_value);
      }
    }
$supp_var['item_number_' $i] = $dboi->f("order_item_sku");
    
$supp_var['quantity_' $i] = $dboi->f("product_quantity");
    
$supp_var['amount_' $i] = round(($dboi->f("product_item_price") - $disc_perItem),2);
      
    
$i++;
}
//End New Code

//Start New Code - Ship to Address Versus Bill To Address

$dboui = new ps_DB;
$q_oui "SELECT * FROM #__vm_order_user_info ";
$q_oui .= "WHERE #__vm_order_user_info.order_id='$order_id' ORDER BY #__vm_order_user_info.order_info_id DESC";
$dboui->query($q_oui);

$oui_id $dboui->f("order_info_id");

if(
$oui_id == $order_id){
  
$first_name $dbb->f("first_name");
  
$last_name $dbb->f("last_name");
  
$address1 $dbb->f("address_1");
  
$address2 $dbb->f("address_2");
  
$city $dbb->f("city");
  
$state $dbb->f("state");
  
$address_country $dbbt->f("country");
  
$zip $dbb->f("zip");
  
$H_PhoneNumber $dbb->f("phone_1");
}
else
{
  
$first_name $dboui->f("first_name");
  
$last_name $dboui->f("last_name");
  
$address1 $dboui->f("address_1");
  
$address2 $dboui->f("address_2");
  
$city $dboui->f("city");
  
$state $dboui->f("state");
  
$address_country $dboui->f("country");
  
$zip $dboui->f("zip");
  
$H_PhoneNumber $dboui->f("phone_1");
}
//End New Code

$post_variables = Array(
"cmd" => "_cart",
"upload" => "1",
"page_style" => "paypal",
"business" => PAYPAL_EMAIL,
"currency_code" => $_SESSION['vendor_currency'],
"amount" => round$db->f("order_subtotal")+$tax_total-$discount_total2),
"handling_cart" => sprintf("%.2f"$db->f("order_shipping")),
"tax" => $tax_total,
"tax_cart" => $tax_total,
"invoice" => $db->f("order_id"),
"image_url" => $vendor_image_url,
"return" => SECUREURL ."index.php?option=com_virtuemart&page=checkout.result&order_id=".$db->f("order_id"),
"notify_url" => SECUREURL ."administrator/components/com_virtuemart/notify.php",
"cancel_return" => SECUREURL ."index.php",
"no_shipping" => "2",
"no_note" => "1",
//"email" => $dbb->f("user_email"),
"address_override" => "0",
"first_name" => $first_name,
"last_name" => $last_name,
"address1" => $address1,
"address2" => $address2,
"city" => $city,
"state" => $state,
"address_country" => $address_country,
"zip" => $zip,
//"H_PhoneNumber" => $H_PhoneNumber
);

if( 
$page == "checkout.thankyou" ) {
$query_string "?";

foreach( 
$post_variables as $name => $value ) {
$query_string .= $name"=" urlencode($value) ."&";
}
if(
is_array($supp_var) && count($supp_var)) {
foreach($supp_var as $name => $value) {
$query_string .= $name"=" urlencode($value) ."&";
}
}

vmRedirect$url $query_string );
} else {
echo 
'<form action="'.$url.'" method="post" target="_blank">';

foreach( 
$post_variables as $name => $value ) {
echo 
'<input type="hidden" name="'.$name.'" value="'.$value.'" />';
}
if(
is_array($supp_var) && count($supp_var)) {
foreach($supp_var as $name => $value) {
echo '<input type="hidden" name="'.$name.'" value="'.$value.'" />';
}
}
echo 
'<input type="image" name="submit" src="https://www.paypal.com/en_US/i/btn/x-click-but6.gif" border="0" alt="Make payments with PayPal, it is fast, free, and secure!">';
echo 
'</form>';
}
?>


Contendia

Not sure where exactly you are wanting to change the layout.  Is it a PayPal page or a page generated by your site?  If it is a PayPal page, in all likelihood, you cannot change it.

The code you have posted does not control the layout of the invoices.

pashis

Yes its the way products get displayed in Paypal page.. So its not possible then?

pashis

so guys is there something i can do, or is it impossible?