Zen Cart Logo
If this is your first visit, check our documentation. To post, register or login.
Forums / Upgrading Your Zen Cart / Upgrading to 1.5.x / Can't get product images to display on main page

Can't get product images to display on main page

21 Nov 2015, 3:33 PM
#1
jmsnyder23 avatar

jmsnyder23

Zen Follower

Join Date:
Jan 2010
Location:
Richmond, Virginia, United States
Posts:
122
Plugin Contributions:
0

Post #1 by jmsnyder23

Hi,

I'm upgrading (finally!) from 1.3.9 to 1.5.4 and am having a heck of a time going about it. Currently my issue is the following:

On my main page, I have the New Products listed (they work fine) and, under them, the Upcoming Products in the center column. I want both boxes to be identical -- that is, the products will be displayed with their respective images, like they currently are on my old site.

But for whatever reason, the Upcoming Products all appear with the no_picture.gif image instead of the book cover of the product. The correct images are on my server, and when you click on the products to go to the product page, you see the right image. But I can't for the life of me figure out why they aren't appearing on the front page.

The code I'm using is this:

<?php for($i=0, $row=0; $i < sizeof($expectedItems); $i++, $row++) { $rowClass = (($row / 2) == floor($row / 2)) ? "rowEven" : "rowOdd"; echo ' <div class="centerBoxContentsUpdated centeredContent back">' . "\n"; echo ' <a href="' . zen_href_link(zen_get_info_page($expectedItems[$i]['products_id']), 'cPath=' . $productsInCategory[$expectedItems[$i]['products_id']] . '&products_id=' . $expectedItems[$i]['products_id']) . '"> ' . zen_image(DIR_WS_IMAGES . $expectedItems[$i]['products_image'], $expectedItems[$i]['products_name'], IMAGE_PRODUCT_NEW_WIDTH, IMAGE_PRODUCT_NEW_HEIGHT) . '</a><br clear=all /><strong><a href="' . zen_href_link(zen_get_info_page($expectedItems[$i]['products_id']), 'cPath=' . $productsInCategory[$expectedItems[$i]['products_id']] . '&products_id=' . $expectedItems[$i]['products_id']) . '">' . $expectedItems[$i]['products_name'] . '</a></strong><br clear=all />' . zen_get_products_manufacturers_name($expectedItems[$i]['products_id']) . '<br clear=all />' . "\n"; echo ' ' . zen_date_short($expectedItems[$i]['date_expected']) . '<br clear=all /><br clear=all /></div>' . "\n"; } ?>

Also, as a side note, the Upcoming Products won't list in descending order by release date, but I can figure that out (I hope). This is a more pressing issue.

If anyone can help, I would much appreciate it.

21 Nov 2015, 3:37 PM
#2
kobra avatar

kobra

Black Belt

Join Date:
Aug 2005
Location:
Arizona
Posts:
31,500
Plugin Contributions:
4

Post #2 by kobra

The code I'm using is this:
From or into what file?

Zen-Venom Get Bitten

21 Nov 2015, 3:39 PM
#3
jmsnyder23 avatar

jmsnyder23

Zen Follower

Join Date:
Jan 2010
Location:
Richmond, Virginia, United States
Posts:
122
Plugin Contributions:
0

Post #3 by jmsnyder23

It's from a file called tpl_modules_products_coming_soon.php

21 Nov 2015, 3:49 PM
#4
kobra avatar

kobra

Black Belt

Join Date:
Aug 2005
Location:
Arizona
Posts:
31,500
Plugin Contributions:
4

Post #4 by kobra

What is the purpose of the edit?
Did you also edit the new products file?

What happens if you remove your edited template files for the server(these are copies in your template - right?)
Supplied code does not call out images but they are displayed in stock form

<?php
    for($i=0, $row=0; $i < sizeof($expectedItems); $i++, $row++) {
      $rowClass = (($row / 2) == floor($row / 2)) ? "rowEven" : "rowOdd";
      echo '  <tr class="' . $rowClass . '">' . "\n";
      echo '    <td ><a href="' . zen_href_link(zen_get_info_page($expectedItems[$i]['products_id']), 'cPath=' . $productsInCategory[$expectedItems[$i]['products_id']] . '&products_id=' . $expectedItems[$i]['products_id']) . '">' . $expectedItems[$i]['products_name'] . '</a></td>' . "\n";
      echo '    <td align="right" >' . zen_date_short($expectedItems[$i]['date_expected']) . '</td>' . "\n";
      echo '  </tr>' . "\n";
    }
?>

Zen-Venom Get Bitten

21 Nov 2015, 3:54 PM
#5
jmsnyder23 avatar

jmsnyder23

Zen Follower

Join Date:
Jan 2010
Location:
Richmond, Virginia, United States
Posts:
122
Plugin Contributions:
0

Post #5 by jmsnyder23

When I remove the file from the server, the default is that the products display in a list with the title and release date. That isn't what I want -- I want the cover images displayed.

The purpose of the edit is to display the covers, and not just a list of upcoming titles.

22 Nov 2015, 1:20 AM
#6
carlwhat avatar

carlwhat

zennedOut

Join Date:
Nov 2005
Location:
los angeles
Posts:
2,974
Plugin Contributions:
8

Post #6 by carlwhat

in the future, use the code tags (code with square brackets around it; and /code to end; again with square brackets). it makes easier to read! (it also would help to do some indents!)

<?php

for($i=0, $row=0; $i < sizeof($expectedItems); $i++, $row++) {
$rowClass = (($row / 2) == floor($row / 2)) ? "rowEven" : "rowOdd";
echo ' <div class="centerBoxContentsUpdated centeredContent back">' . "\n";
echo ' <a href="' . zen_href_link(zen_get_info_page($expectedItems[$i]['products_id']), 'cPath=' . $productsInCategory[$expectedItems[$i]['products_id']] . '&products_id=' . $expectedItems[$i]['products_id']) . '"> ' . zen_image(DIR_WS_IMAGES . $expectedItems[$i]['products_image'], $expectedItems[$i]['products_name'], IMAGE_PRODUCT_NEW_WIDTH, IMAGE_PRODUCT_NEW_HEIGHT) . '</a><br clear=all /><strong><a href="' . zen_href_link(zen_get_info_page($expectedItems[$i]['products_id']), 'cPath=' . $productsInCategory[$expectedItems[$i]['products_id']] . '&products_id=' . $expectedItems[$i]['products_id']) . '">' . $expectedItems[$i]['products_name'] . '</a></strong><br clear=all />' . zen_get_products_manufacturers_name($expectedItems[$i]['products_id']) . '<br clear=all />' . "\n";
echo ' ' . zen_date_short($expectedItems[$i]['date_expected']) . '<br clear=all /><br clear=all /></div>' . "\n";
}
?>

can you post the html output by your code? ideally one (or a couple) copies of the <div class="centerBoxContentsUpdated centeredContent back">' would be helpful.

actually, i'm pretty sure your problem is probably where the $expectedItems object is created. if you track down where that SQL statement is constructed, i'm pretty sure the field: products_image is not in that SQL statement. if you add it there, it should work fine.

good luck!

author of square Webpay, now with Apple Pay and Google Pay.
mXworks
donations: venmo or paypal accepted.
premium consistent excellent support. available for hire.

22 Nov 2015, 1:28 AM
#7
carlwhat avatar

carlwhat

zennedOut

Join Date:
Nov 2005
Location:
los angeles
Posts:
2,974
Plugin Contributions:
8

Post #7 by carlwhat

yeah, that's it...

look in modules/upcoming_products.php

there are 2 querys there have begin with

$expected_query

after p.master_categories_id, add p.products_image and i'm pretty sure you should be all good to go.

in addition, you can change your sort order in both of those queries. add an:

order by products_date_available

and you can solve that problem as well.

good luck!

author of square Webpay, now with Apple Pay and Google Pay.
mXworks
donations: venmo or paypal accepted.
premium consistent excellent support. available for hire.