Zen Cart Logo
Forums / Addon Sideboxes / Orders Sidebox

Orders Sidebox

Views: 4,662

Results 1 to 7 of 7
10 Sep 2020, 2:56 AM
#1
jsarwar avatar

jsarwar

Zen Follower

Join Date:
Jul 2012
Posts:
347
Plugin Contributions:
0

Orders Sidebox

Hello,
I have side box which display recent orders in it. Right now it just display items name. How can I add item image to it. Order table does not have field product image. I tried to enter code few different way to pull from products table but it did not work. Can someone help me with the code to display item image in side box?

10 Sep 2020, 10:22 AM
#2
swguy avatar

swguy

Administrator

Join Date:
Feb 2006
Location:
Tampa Bay, Florida
Posts:
10,694
Plugin Contributions:
56

Re: Orders Sidebox

Edit includes/templates/YOUR_TEMPLATE/sideboxes/tpl_order_history.php

Remove the block of code between <li> and </li>

In its place, put

<a href="' . zen_href_link(zen_get_info_page($row['id']), 'products_id=' . $row['id']) . '">' . zen_get_products_image($row['id']) . '</a>

so you have

foreach ($customer_orders as $row) {
$content .= '

<li> <a href="' . zen_href_link(zen_get_info_page($row['id']), 'products_id=' . $row['id']) . '">' . zen_get_products_image($row['id']) . '</a> </li> '; }

That will show the image instead of the name.

10 Sep 2020, 10:28 AM
#3
jsarwar avatar

jsarwar

Zen Follower

Join Date:
Jul 2012
Posts:
347
Plugin Contributions:
0

Re: Orders Sidebox

Its not tpl_order_history.php side box. Its recent/latest orders side box which shows random recent orders from different customers.

10 Sep 2020, 11:23 AM
#4
swguy avatar

swguy

Administrator

Join Date:
Feb 2006
Location:
Tampa Bay, Florida
Posts:
10,694
Plugin Contributions:
56

Re: Orders Sidebox

This must be a plugin then. At any rate, the code block you will want will be similar to what I posted.

10 Sep 2020, 10:13 PM
#5
jsarwar avatar

jsarwar

Zen Follower

Join Date:
Jul 2012
Posts:
347
Plugin Contributions:
0

Re: Orders Sidebox

swguy:

This must be a plugin then. At any rate, the code block you will want will be similar to what I posted.
Yes it is. It shows orders in side box like mentioned at following link
https://www.zen-cart.com/showthread.php?134712-How-to-dispaly-the-latest-orders-on-homepage-in-sidebox

I tried code you provided it did not work. The code I have in that file right now is

$content = '';$content .= '<div id="' . str_replace('_', '-', $box_id . 'Content') . '" class="sideBoxContent">';if(sizeof($latestOrdersArray) > 0) {  $content .= '<ul>';  foreach ($latestOrdersArray as $order) {    $content .= '<li><div class="order-item">';    $content .= '<div class="order-item-details">';        //    $content .= sprintf(LATEST_ORDERS_SIDEBOX_HAS_BOUGHT1, '<strong>' . $order['name1'] . '</strong>', '<strong>' . $order['country1'] . '</strong>');

$content .= '<br/>';



    $first = true;    foreach($order['products'] as $product) {      if($first === false) {        $content .= '<br/> ';      }                  $content .= '<a href="' . zen_href_link('product_info', 'products_id=' . $product['id']) . '">' . $product['name'] .            '</a><br/>';           
            $first = false;    }        
            '</a><hr/>';
10 Sep 2020, 10:32 PM
#6
swguy avatar

swguy

Administrator

Join Date:
Feb 2006
Location:
Tampa Bay, Florida
Posts:
10,694
Plugin Contributions:
56

Re: Orders Sidebox

Did you change $row to $product in each place it was used? Because your for loop uses a different value than the one from the built-in sidebox.

10 Sep 2020, 11:08 PM
#7
jsarwar avatar

jsarwar

Zen Follower

Join Date:
Jul 2012
Posts:
347
Plugin Contributions:
0

Re: Orders Sidebox

swguy:

Did you change $row to $product in each place it was used? Because your for loop uses a different value than the one from the built-in sidebox.
Thank you! It working now but if order has more than one product then those products don't appear nice layout. Its auto scroll vertical one item appear at a time if order has only 1 item but if its more than 1 item they all appear scattered. Any idea how to fix this?