If this is your first visit, check our documentation. To post, register or login.
Forums / Customizing the Look of Your Shop / Templates, Stylesheets, Page Layout / The download filename is pushing my page layout to the side

The download filename is pushing my page layout to the side

Locked

Started by happymom on 7 Mar 2009, 8:21 AM · Views: 1,607

Results 1 to 8 of 8
This thread is locked. New replies are disabled.
7 Mar 2009, 8:21 AM
#1
happymom avatar

happymom

New Zenner

Join Date:
May 2006
Posts:
82
Plugin Contributions:
0

Post #1 by happymom

Zen Cart version = 1.3.7

I am currently using the "barebones" template from the free downloads. :D

The problem: the filename in my checkout page for my downloadable products got too long and now, the filename is pushing the layout to the left.

Here is a picture of what I am saying:

http://www.scrapbooksgonedigital.com/TEMP_FILE_TOO_LONG/FileNameTooLong.jpg

I now try to make the product zip files shorther, but I have tons of products whose names are long, plus I need to organize the zip in directories, incase I need to delete products from certain manufacters.

My question: How can I change the filename so that only the filename and not the entire path is displayed? The product download link is already already on the left and also in the button, plus the filename is not even clickable.

Any suggestions, would be greatly appreciated.:D

7 Mar 2009, 2:28 PM
#2
tony_sar avatar

tony_sar

Totally Zenned

Join Date:
Jul 2006
Location:
Montreal, Canada
Posts:
2,276
Plugin Contributions:
0

Post #2 by tony_sar

I have never setup a download product , but as far as i know , the path to the download should not show .

at the root of your store , there is a folder called , download, all download files must be located there and not in any other folder.

move your download file there and fix the path issue in your product page and see if that would help out.

7 Mar 2009, 6:15 PM
#3
happymom avatar

happymom

New Zenner

Join Date:
May 2006
Posts:
82
Plugin Contributions:
0

Post #3 by happymom

Thanks for your suggestion.

I had thought about that, but I have a lot of files, already under the download subdirectories. I rather just modify the file name in the template/page to prevent the work of updating the download attributes file paths links.

I guess, I am wondering what file/variable is the one responsible to add the filepath + file name. Once I can figure this out, I can modify it to just include the filename.

Thanks,

7 Mar 2009, 9:34 PM
#4
barco57 avatar

barco57

Totally Zenned

Join Date:
Apr 2006
Location:
West Salem, IL
Posts:
2,846
Plugin Contributions:
0

Post #4 by barco57

The path is included because you added it when putting the attribute in. Zen Cart was not designed to have downloads in subdirectories, so there is no allowance in the code for not displaying paths to the file. In most cases, downloads in a subdirectory seems to work for a while but then its starts to break randomly, at least that is my experience with it.

Mike
AEIIA - Zen Cart Certified & PCI Compliant Hosting
The Zen Cart Forum...Better than a monitor covered with post-it notes!

8 Mar 2009, 9:52 PM
#5
lissae avatar

lissae

Totally Zenned

Join Date:
Oct 2007
Location:
Australia
Posts:
814
Plugin Contributions:
0

Post #5 by lissae

I had the same problem with my zip names, I got around it by editing includes/templates/template_default/templates/tpl_modules_downloads.php (save to your overrides folder [includes/templates/CUSTOM/templates/tpl_modules_downloads.php])

I commented out the header bar that says Item Name, File Size etc, made it so that the product info and download spanned two lines and put a line in between to better tell the files apart lol

Here is my code of the entire file if you are interested....this is for ZC version 1.3.8a

<?php
/**
 * Module Template
 *
 * @package templateSystem
 * @copyright Copyright 2003-2006 Zen Cart Development Team
 * @copyright Portions Copyright 2003 osCommerce
 * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
 * @version $Id: tpl_modules_downloads.php 4829 2006-10-24 21:39:15Z drbyte $
 */
/**
 * require the downloads module
 */
  require(DIR_WS_MODULES . zen_get_module_directory('downloads.php'));
?>

<?php
// download is available
  if ($downloads->RecordCount() > 0) {
?>

<table border="0" width="100%" cellspacing="0" cellpadding="5" id="downloads">
<caption><h4><?php echo HEADING_DOWNLOAD; ?></h4></caption>
<br class="clearBoth" />
    <!--   <tr class="tableHeading">
 <th scope="col" id="dlFileNameHeading"><?php echo TABLE_HEADING_PRODUCT_NAME; ?></th>
      <th scope="col" id="dlByteSize"><?php echo TABLE_HEADING_BYTE_SIZE; ?></th>
      <th scope="col" id="dlButtonHeading"><?php echo TABLE_HEADING_DOWNLOAD_FILENAME; ?></th>
      <th scope="col" id="dlDateHeading"><?php echo TABLE_HEADING_DOWNLOAD_DATE; ?></th>
      <th scope="col" id="dlCountHeading"><?php echo TABLE_HEADING_DOWNLOAD_COUNT; ?></th>
      <th scope="col" id="dlButtonHeading"> </th>
          </tr> -->
<!-- list of products -->
<?php
    while (!$downloads->EOF) {
// MySQL 3.22 does not have INTERVAL
      list($dt_year, $dt_month, $dt_day) = explode('-', $downloads->fields['date_purchased_day']);
      $download_timestamp = mktime(23, 59, 59, $dt_month, $dt_day + $downloads->fields['download_maxdays'], $dt_year);
      $download_expiry = date('Y-m-d H:i:s', $download_timestamp);
?>
          <tr class="tableRow">
<!-- left box -->
<?php
// The link will appear only if:
// - Download remaining count is > 0, AND
// - The file is present in the DOWNLOAD directory, AND EITHER
// - No expiry date is enforced (maxdays == 0), OR
// - The expiry date is not reached

//      if ( ($downloads->fields['download_count'] > 0) && (file_exists(DIR_FS_DOWNLOAD . $downloads->fields['orders_products_filename'])) && ( ($downloads->fields['download_maxdays'] == 0) || ($download_timestamp > time())) ) {
      if ( (file_exists(DIR_FS_DOWNLOAD . $downloads->fields['orders_products_filename']) && (($downloads->fields['download_count'] > 0 && $download_timestamp > time()) || $downloads->fields['download_maxdays'] == 0)) ) {
        $zv_filesize = filesize (DIR_FS_DOWNLOAD . $downloads->fields['orders_products_filename']);
        if ($zv_filesize >= 1024) {
          $zv_filesize = number_format($zv_filesize/1024/1000,2);
          $zv_filesize_units = TEXT_FILESIZE_MEGS;
        } else {
          $zv_filesize = number_format($zv_filesize);
          $zv_filesize_units = TEXT_FILESIZE_BYTES;
        }
?>
      <td class="" colspan="3"><?php echo '<a href="' . zen_href_link(FILENAME_DOWNLOAD, 'order=' . $last_order . '&id=' . $downloads->fields['orders_products_download_id']) . '">' . $downloads->fields['products_name'] . '</a>'; ?></td>
      <td class=""><?php echo $zv_filesize . $zv_filesize_units; ?></td></tr><tr>
      <td class="" style="border-bottom:1px solid #2d2d31;"><?php echo $downloads->fields['orders_products_filename']; ?></td>
<?php } else { ?>
      <td class="" colspan="3"><?php echo $downloads->fields['products_name']; ?></td>
      <td class=""><?php echo $zv_filesize . $zv_filesize_units; ?></td></tr><tr>
      <td class="" style="border-bottom:1px solid #2d2d31;"><?php echo $downloads->fields['orders_products_filename']; ?></td>
<?php
      }
?>
      <td class="" style="border-bottom:1px solid #2d2d31;"><?php echo ($downloads->fields['download_maxdays'] == 0 ? TEXT_DOWNLOADS_UNLIMITED : zen_date_short($download_expiry)); ?></td>
      <td class="centeredContent" style="border-bottom:1px solid #2d2d31;"><?php echo ($downloads->fields['download_maxdays'] == 0 ? TEXT_DOWNLOADS_UNLIMITED_COUNT : $downloads->fields['download_count']); ?></td>
      <td class="centeredContent" style="border-bottom:1px solid #2d2d31;"><?php echo '<a href="' . zen_href_link(FILENAME_DOWNLOAD, 'order=' . $last_order . '&id=' . $downloads->fields['orders_products_download_id']) . '">' . zen_image_button(BUTTON_IMAGE_DOWNLOAD, BUTTON_DOWNLOAD_ALT) . '</a>'; ?></td>
    </tr>
<?php
    $downloads->MoveNext();
    }
?>
  </table>

<?php
// old way
//    if (!strstr($PHP_SELF, FILENAME_ACCOUNT_HISTORY_INFO)) {
// new way
      if (!($_GET['main_page']==FILENAME_ACCOUNT_HISTORY_INFO)) {
?>
<p><?php printf(FOOTER_DOWNLOAD, '<a href="' . zen_href_link(FILENAME_ACCOUNT, '', 'SSL') . '">' . HEADER_TITLE_MY_ACCOUNT . '</a>'); ?></p>
<?php } else { ?>
<?php
// other pages if needed
      }
?>

<?php
} // $downloads->RecordCount() > 0
?>

<?php
// download is not available yet
if ($downloads_check_query->RecordCount() > 0 and $downloads->RecordCount() < 1) {
?>
 <fieldset><?php echo DOWNLOADS_CONTROLLER_ON_HOLD_MSG ?></fieldset>
<?php
}
?>
```You'll need to change the color to suit where it says style="border-bottom:1px solid #2d2d31;" (at the time I didn't think to put a class in and style it in the stylesheet LOL)

Screenshot attached of the final result lol

HunnyBee Design
"A man's manners are a mirror in which he shows his portrait." ~ Johann Wolfgang von Goethe

9 Mar 2009, 5:39 AM
#6
happymom avatar

happymom

New Zenner

Join Date:
May 2006
Posts:
82
Plugin Contributions:
0

Post #6 by happymom

Thank you for your suggestion. This makes sense!:smile:

I will take a look at your file. I am currently using 1.3.7, so I will diff it to see what else is different.

9 Mar 2009, 10:53 AM
#7
lissae avatar

lissae

Totally Zenned

Join Date:
Oct 2007
Location:
Australia
Posts:
814
Plugin Contributions:
0

Post #7 by lissae

You're welcome :)

I think I was still on 1.3.7 when I modified it, so any changes between version...if any LOL...should be minimal

HunnyBee Design
"A man's manners are a mirror in which he shows his portrait." ~ Johann Wolfgang von Goethe

30 Jun 2009, 9:03 PM
#8
happymom avatar

happymom

New Zenner

Join Date:
May 2006
Posts:
82
Plugin Contributions:
0

Post #8 by happymom

This work good on my 1.3.7 version, but my filename was still a little bit too long. So I decided to remove the path of the file name and only display the filename.

example: Instead of displaying this:

/the/path/to/the/zip/filename.zip

It will now display only this:
filename.zip

Here is the code that I modified, starting on line 64 of YOUR version.

<?php

$path = $downloads->fields['orders_products_filename'];
$sgd_download_file_name = basename($path);

?>

<td class="" style="border-bottom:1px solid #2d2d31;"><?php echo $sgd_download_file_name ?></td> <?php } else { ?> <td class="" colspan="3"><?php echo $downloads->fields['products_name']; ?></td> <td class=""><?php echo $zv_filesize . $zv_filesize_units; ?></td></tr><tr> <td class="" style="border-bottom:1px solid #2d2d31;"><?php echo $sgd_download_file_name ?></td

Thanks, this was a great help!