veszka Posted April 8, 2011 Share Posted April 8, 2011 Hi all, I would like to add the images of products to page chekout confirmation. For this I modified the order.php (catalog\includes\classes) like this: $orders_products_query = tep_db_query("select orders_products_id, products_name, o.products_model, o.products_price, products_tax, o.products_quantity, final_price, products_image from orders_products o , products p where p.products_id = o.products_id and o.orders_id = '" . (int)$order_id . "'"); while ($orders_products = tep_db_fetch_array($orders_products_query)) { $this->products[$index] = array('qty' => $orders_products['products_quantity'], 'id' => $orders_products['products_id'], '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'], 'images' => $orders_products['products_image']); and I would like to print out like this: echo $order->products[$i]['images']; in checkout_confirmation.php. This code could write the name of image of product, but do it nothing. Where I did wrong? Kind regard, Tamas Link to comment Share on other sites More sharing options...
npn2531 Posted April 8, 2011 Share Posted April 8, 2011 I assume you did get the name of the image, as it is stored in the database, to print, if so you have accomplished the hard part. For the image itself to display you need a little more. If for example the name of the image in the database, in the field product_image is 'item_10' then you should be seeing literally 'item_10' echoed on the page. If that is the case you should be able to echo the image with something like this: echo tep_image(DIR_WS_IMAGES . $order->products[$i]['images']; note: this assumes the image is stored in the images folder (which is typical). Oscommerce site: OSC to CSS, http://addons.oscommerce.com/info/7263 -Mail Manager, http://addons.oscommerce.com/info/8120 Link to comment Share on other sites More sharing options...
veszka Posted April 9, 2011 Author Share Posted April 9, 2011 I assume you did get the name of the image, as it is stored in the database, to print, if so you have accomplished the hard part. For the image itself to display you need a little more. If for example the name of the image in the database, in the field product_image is 'item_10' then you should be seeing literally 'item_10' echoed on the page. If that is the case you should be able to echo the image with something like this: echo tep_image(DIR_WS_IMAGES . $order->products[$i]['images']; note: this assumes the image is stored in the images folder (which is typical). Hello, I was not fully clear. Sorry. I know that I have to use any other function to display the images. My real problem is that the expression $order->products[$i]['images'] do nothing. So I don't know what I did wrong. Thank you! Link to comment Share on other sites More sharing options...
colinchar Posted April 10, 2011 Share Posted April 10, 2011 Look at your SQL should be p.products_image since products table is where name of image is stored Link to comment Share on other sites More sharing options...
veszka Posted April 11, 2011 Author Share Posted April 11, 2011 Ok, I did it. The problem was the following. I didn't read attentively the code. In the beginning file order.php there is : if (tep_not_null($order_id)) { $this->query($order_id); } else { $this->cart(); } If it is still no order in this case use the cart function. I corrected the code only for case, when there is order number... So the whole solution is the following. At first I changed the function get_products in file classes\shopping_cart.php. I added the product image for the query and function. Like this: Around line 260: $products_query = tep_db_query("select p.products_id, pd.products_name, p.products_model, p.products_image, p.products_price, p.products_weight, p.products_tax_class_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_id='" . (int)tep_get_prid($products_id) . "' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "'"); I added p.products_image. Around line 274: 'model' => $products['products_model'], 'image' => $products['products_image'], 'price' => $products_price, I added 'image' => $products['products_image']. With this I expanded the get_products functions for cart. In classes\order.php I added the following lines 'image' => $products[$i]['image']: Around line 287: 'model' => $products[$i]['model'], 'image' => $products[$i]['image'], 'tax' => tep_get_tax_rate($products[$i]['tax_class_id'], $tax_address['entry_country_id'], $tax_address['entry_zone_id']) In this case I reach to display the the image in case of there is no order_id. bye, Tamas Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.