Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Adding Product Description to Checkout Confirmation Page


ddesatnik

Recommended Posts

Hi,

 

Does anybody know how to go about adding the product description to the Checkout Confirmation (checkout_confirmation.php?) page? I have figured out how to add the description to the product listing ('product listing multi' actually) but am having a heck of a time doing the same for the checkout confirmation.

 

Any help or tips to to point me in the right direction would be much appreciated!

 

Thank you!

 

Doug

Link to comment
Share on other sites

Hi there,

 

You need need to edit three files

 

1) catalog/includes/classes/shopping_cart.php, around line 282 find the following code;

 

          $products_array[] = array('id' => $products_id,

                                   'name' => $products['products_name'],

                                   'model' => $products['products_model'],

      	 'price' => $products_price,

                                   'quantity' => $this->contents[$products_id]['qty'],

                                   'weight' => $products['products_weight'],

                                   'final_price' => ($products_price + $this->attributes_price($products_id)),

                                   'tax_class_id' => $products['products_tax_class_id'],

                                   'attributes' => $this->contents[$products_id]['attributes']);

       }

 

and change to........

 

          $products_array[] = array('id' => $products_id,

                                   'name' => $products['products_name'],

                                   'model' => $products['products_model'],

      	 'description' => $products['products_description'],

                                   'price' => $products_price,

                                   'quantity' => $this->contents[$products_id]['qty'],

                                   'weight' => $products['products_weight'],

                                   'final_price' => ($products_price + $this->attributes_price($products_id)),

                                   'tax_class_id' => $products['products_tax_class_id'],

                                   'attributes' => $this->contents[$products_id]['attributes']);

       }

 

 

2) catalog/includes/classes/order.php around line 210 fine the following lines;

 

        $this->products[$index] = array('qty' => $products[$i]['quantity'],

                                       'name' => $products[$i]['name'],

                                       'model' => $products[$i]['model'],

     

                                       'tax' => tep_get_tax_rate($products[$i]['tax_class_id'], $shipping_address['entry_country_id'], $shipping_address['entry_zone_id']),

                                       'tax_description' => tep_get_tax_description($products[$i]['tax_class_id'], $shipping_address['entry_country_id'], $shipping_address['entry_zone_id']),

                                       'price' => $products[$i]['price'],

                                       'final_price' => $products[$i]['price'] + $cart->attributes_price($products[$i]['id']),

                                       'weight' => $products[$i]['weight'],

                                       'id' => $products[$i]['id']);

 

and change to........

 

        $this->products[$index] = array('qty' => $products[$i]['quantity'],

                                       'name' => $products[$i]['name'],

                                       'model' => $products[$i]['model'],

         'description' => $products[$i]['description'],

                                       'tax' => tep_get_tax_rate($products[$i]['tax_class_id'], $shipping_address['entry_country_id'], $shipping_address['entry_zone_id']),

                                       'tax_description' => tep_get_tax_description($products[$i]['tax_class_id'], $shipping_address['entry_country_id'], $shipping_address['entry_zone_id']),

                                       'price' => $products[$i]['price'],

                                       'final_price' => $products[$i]['price'] + $cart->attributes_price($products[$i]['id']),

                                       'weight' => $products[$i]['weight'],

                                       'id' => $products[$i]['id']);

 

3) catalog/checkout_confirmation.php around line 174 find the following line;

 

for ($i=0, $n=sizeof($order->products); $i<$n; $i++) {

   echo '          <tr>' . "n" .

        '            <td class="main" align="right" valign="top" width="30">' . $order->products[$i]['qty'] . ' x</td>' . "n" .

        '            <td class="main" valign="top">' . $order->products[$i]['name'];





   if (STOCK_CHECK == 'true') {

     echo tep_check_stock($order->products[$i]['id'], $order->products[$i]['qty']);

   }



   if ( (isset($order->products[$i]['attributes'])) && (sizeof($order->products[$i]['attributes']) > 0) ) {

     for ($j=0, $n2=sizeof($order->products[$i]['attributes']); $j<$n2; $j++) {

       echo '<br><nobr><small> <i> - ' . $order->products[$i]['attributes'][$j]['option'] . ': ' . $order->products[$i]['attributes'][$j]['value'] . '</i></small></nobr>';

     }

   }



   echo '</td>' . "n";



   if (sizeof($order->info['tax_groups']) > 1) echo '            <td class="main" valign="top" align="right">' . tep_display_tax_value($order->products[$i]['tax']) . '%</td>' . "n";



   echo '            <td class="main" align="right" valign="top">' . $currencies->display_price($order->products[$i]['final_price'], $order->products[$i]['tax'], $order->products[$i]['qty']) . '</td>' . "n" .

        '          </tr>' . "n";

 }

 

and change to........

 

for ($i=0, $n=sizeof($order->products); $i<$n; $i++) {

   echo '          <tr>' . "n" .

        '            <td class="main" align="right" valign="top" width="30">' . $order->products[$i]['qty'] . ' x</td>' . "n" .

        '            <td class="main" valign="top">' . $order->products[$i]['name'];





   if (STOCK_CHECK == 'true') {

     echo tep_check_stock($order->products[$i]['id'], $order->products[$i]['qty']);

   }



   if ( (isset($order->products[$i]['attributes'])) && (sizeof($order->products[$i]['attributes']) > 0) ) {

     for ($j=0, $n2=sizeof($order->products[$i]['attributes']); $j<$n2; $j++) {

       echo '<br><nobr><small> <i> - ' . $order->products[$i]['attributes'][$j]['option'] . ': ' . $order->products[$i]['attributes'][$j]['value'] . '</i></small></nobr>';

     }

   }



   echo '</td>' . "n";

echo '<td class="main" valign="top">' . $order->products[$i]['description'] . '</td>' . "n";



   if (sizeof($order->info['tax_groups']) > 1) echo '            <td class="main" valign="top" align="right">' . tep_display_tax_value($order->products[$i]['tax']) . '%</td>' . "n";



   echo '            <td class="main" align="right" valign="top">' . $currencies->display_price($order->products[$i]['final_price'], $order->products[$i]['tax'], $order->products[$i]['qty']) . '</td>' . "n" .

        '          </tr>' . "n";

 }

 

Upload these files and the description should appear in the confirmation screen!

 

Back up these files before you try this!!! Let me know how it goes!

Reddy to Rumble

 

Thank you osCommerce and all who Contribute to her!

Link to comment
Share on other sites

Thank you Rumble for the reply!

 

Actually what you suggested is kind of what I had originally tried, it just seems to make sense by first adding the description to the products array and then simply displaying the field on the screen right?

 

I verified with my code your changes and everything seems to check out ok but still, no descriptions.......

 

 

Here is my shopping_cart.php products array:

$products_array[] = array('id' => $products_id,

                                   'name' => $products['products_name'],

                                   'model' => $products['products_model'],

      	 'description' => $products['products_description'],

      	 'price' => $products_price,

                                   'quantity' => $this->contents[$products_id]['qty'],

                                   'weight' => $products['products_weight'],

                                   'final_price' => ($products_price + $this->attributes_price($products_id)),

                                   'tax_class_id' => $products['products_tax_class_id'],

                                   'attributes' => $this->contents[$products_id]['attributes']);

 

 

 

Here is my order.php products array:

$this->products[$index] = array('qty' => $orders_products['products_quantity'],

                                       'name' => $orders_products['products_name'],

         'description' => $products[$i]['description'],

         'model' => $orders_products['products_model'],

                                       'tax' => $orders_products['products_tax'],

                                       'price' => $orders_products['products_price'],

                                       'final_price' => $orders_products['final_price']);

 

 

Here is my checkout_cinfirmation.php products display:

$osize = sizeof($order->products);

 for ($i=0; $i<$osize; $i++) {

   echo '          <tr>' . "n" .

        '            <td class="main" align="right" valign="top" width="30">' . $order->products[$i]['qty'] . ' x</td>' . "n" .

  '            <td class="main" align="left" valign="top" width="50">' . $order->products[$i]['name'] . ' --</td>';



   if (STOCK_CHECK == 'true') {

     echo tep_check_stock($order->products[$i]['id'], $order->products[$i]['qty']);

   }



   $size = sizeof($order->products[$i]['attributes']);

   if ( (isset($order->products[$i]['attributes'])) && ($size > 0) ) {

     for ($j=0; $j<$size; $j++) {

       echo '<br><nobr><small> <i> - ' . $order->products[$i]['attributes'][$j]['option'] . ': ' . $order->products[$i]['attributes'][$j]['value'] . '</i></small></nobr>';

     }

   }



   echo '</td>' . "n";

echo '<td class="main" valign="top">' . $order->products[$i]['description'] . '</td>' . "n";



     if ($customer_discount_price != 0) {

// changed by Manon 2M1102

     echo '            <td class="main" align="right" valign="top">opd' . $order->products[$i]['discount'] . '</td>' . "n";

     echo '            <td class="main" align="right" valign="top">cdp' . $customer_discount_price . '</td>' . "n";

//

     echo '            <td class="main" align="right" valign="top">pda' . $products[$i]['discount_allowed']. '</td>' . "n";

     }





   if (sizeof($order->info['tax_groups']) > 1) echo '            <td class="smallText" valign="top" align="right">' . tep_display_tax_value($order->products[$i]['tax']) . '%</td>' . "n";



   echo '            <td class="main" align="right" valign="top">' . $currencies->display_price($order->products[$i]['final_price'], $order->products[$i]['tax'], $order->products[$i]['qty']) . '</td>' . "n" .

        '          </tr>' . "n";

 

 

Do you see anything wrong with the 3 code snippets above?

 

Thank you!

 

Doug

Link to comment
Share on other sites

In checkout_confirmation.php, from the code you pasted change the first two lines;

 

$osize = sizeof($order->products); 

 for ($i=0; $i<$osize; $i++) {

 

to........

 

  for ($i=0; $osize = sizeof($order->products); $i<$osize; $i++) {

 

maybe that will work!?

Reddy to Rumble

 

Thank you osCommerce and all who Contribute to her!

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...