Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

account_history_info


Guest

Recommended Posts

Hi,

 

When the store owner receive the email confirming a purchase by a customer , there is a link that brings you back to the store in the "account_history_ifo.php".

My question is : is it possible to have the images of the products displayed with the Order information ?

 

Regards

Link to comment
Share on other sites

Edit /catalog/account_history_info.php

 

Locate this section of code:

 

  for ($i=0; $i<sizeof($order->products); $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'];

 

Each one draws it's own <tr> so you can add another <td> in there and add the image.

 

Fun things to do to add the image ... :shock:

 

Edit /includes/functions/general.php and add a new function at the bottom, just before the last ?>

 

////

// BOF: WebMakers.com Added: Return a product's image

// TABLES: products

function tep_get_my_products_image($product_id) {



   $product_normal_query = tep_db_query("select products_image from " . TABLE_PRODUCTS . " where products_id = '" . $product_id . "'");

   $product_normal = tep_db_fetch_array($product_normal_query);



   return $product_normal['products_image'];

}

// EOF: WebMakers.com Added: Return a product's image

 

Edit /includes/classes/orders.php ... find:

 

In /includes/classes/orders.php

 

Change:

      $index = 0;

     $orders_products_query = tep_db_query("select orders_products_id, pproducts_name, products_model, products_price, products_tax, products_quantity, final_price from " . TABLE_ORDERS_PRODUCTS . " where orders_id = '" . tep_db_input($order_id) . "'");

     while ($orders_products = tep_db_fetch_array($orders_products_query)) {

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

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

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

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

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

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

 

To:

      $index = 0;

     $orders_products_query = tep_db_query("select orders_products_id, products_id, products_name, products_model, products_price, products_tax, products_quantity, final_price from " . TABLE_ORDERS_PRODUCTS . " where orders_id = '" . tep_db_input($order_id) . "'");

     while ($orders_products = tep_db_fetch_array($orders_products_query)) {

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

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

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

// WebMakers.com Added: Get Products ID for Accounts History

                                       'id' => $orders_products['products_id'],

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

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

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

 

Edit /accounts_history_info.php

 

Find:

 

  for ($i=0; $i<sizeof($order->products); $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'];

 

Change to:

 

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

   echo '          <tr>' . "n" .

// WebMakers.com Added: Include Image

        '            <td> ' . tep_image(DIR_WS_IMAGES . tep_get_my_products_image($order->products[$i]['id']), $order->products[$i]['name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'hspace="5" vspace="5"') . ' </td> ' . "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'];

 

Save all files before upload ...

 

Upload files ...

 

Voila ... pictures! Easy eh? :shock:

Link to comment
Share on other sites

Also to make it display nice, above that is a:

 

                  <tr>

                   <td class="main" colspan="3"><b><?php echo HEADING_PRODUCTS; ?></b></td>

                 </tr>

 

Change to:

 

                  <tr>

                   <td class="main" colspan="4"><b><?php echo HEADING_PRODUCTS; ?></b></td>

                 </tr>

 

And above that is:

                  <tr>

                   <td class="main" colspan="2"><b><?php echo HEADING_PRODUCTS; ?></b></td>

 

Change to:

                  <tr>

<td> </td>

                   <td class="main"><b><?php echo HEADING_PRODUCTS; ?></b></td>

 

Then where the image is added, add a width="75" so the image doesn't take up so much space. It will size that <td> larger as needed.

Link to comment
Share on other sites

Thanks a million Ajeh

 

But now when i try to access the order Information ..i get this

Fatal error: Cannot redeclare tep_get_my_products_image() (previously declared in /home/charme/public_html/catalog/includes/functions/general.php:16) in /home/charme/public_html/catalog/includes/functions/general.php on line 1113

and i cant seem to find that extra space or white spot :cry:

(copy/paste your code)

 

Regards

Link to comment
Share on other sites

Check the /includes/functions/general.php file itself and see if you have extra blank space/lines at the top or bottom.

 

Also make sure you do not have two functions tep_get_my_products_image() do a windows search on your files for:

 

function tep_get_my_products_image

 

and make sure there is only one.

Link to comment
Share on other sites

Well ... compare them and if the same remove one of the functions as you can only have a function loaded twice.

 

Example: If you found function tep_get_my_products_image(blah blah) in general.php twice ... one of these has to be deleted as the code is loading the first one and then erroring out on trying to load the same named funciton again later down in the code.

Link to comment
Share on other sites

Hi,

 

That's exacly what was happening at the top i have

[/code]////

// Return a product's image

// TABLES: products

function tep_get_my_products_image($product_id) {

$product_normal_query = tep_db_query("select products_image from " . TABLE_PRODUCTS . " where products_id = '" . $product_id . "'");

$product_normal = tep_db_fetch_array($product_normal_query);

return $product_normal['products_image'];

So i dont add the other one and i have access to my accounts_history_info.php  but no images  :cry: 

All the rest is ok 



Regards

Link to comment
Share on other sites

Hi,

 

Does it make a difference if that code

//// 

                         // BOF: WebMakers.com Added: Return a product's image 

                         // TABLES: products 

                         function tep_get_my_products_image($product_id) { 



                             $product_normal_query = tep_db_query("select products_image

                         from " . TABLE_PRODUCTS . " where products_id = '" . $product_id

                         . "'"); 

                             $product_normal = tep_db_fetch_array($product_normal_query);





                             return $product_normal['products_image']; 

                         } 

                         // EOF: WebMakers.com Added: Return a product's image

is at the top of the general.php instead of the last one at the bottom ??

 

Regards

Link to comment
Share on other sites

It really should not matter.

 

Just make sure when you go to remove one of the two that they are, in fact, exact duplicates.

 

If not, rename the new one I showed you something a little different and use that to get the product's image or see if the first one can perform the same task.

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...