Zen Cart Logo
If this is your first visit, check our documentation. To post, register or login.
Forums / General Questions / General Questions / always free shipping icon in featured/special on the main page

always free shipping icon in featured/special on the main page

Locked

Started by jerry5763837 on 4 Mar 2009, 12:40 PM · Views: 1,923

Results 1 to 11 of 11
This thread is locked. New replies are disabled.
4 Mar 2009, 12:40 PM
#1
jerry5763837 avatar

jerry5763837

Zen Follower

Join Date:
May 2008
Posts:
261
Plugin Contributions:
0

Post #1 by jerry5763837

hi, everyone,

Does anybody know how to enable free shipping icon for speails/featured/new products/(displays in 3 colunms) on main page?

and how to enable it for side box: featured/spicials/new products/ best sellers?

any suggestion would be appreciated. thank.:smile:

6 Mar 2009, 6:48 AM
#2
jerry5763837 avatar

jerry5763837

Zen Follower

Join Date:
May 2008
Posts:
261
Plugin Contributions:
0

Post #2 by jerry5763837

Anybody know how to solve above problem?:clap:

6 Mar 2009, 7:33 PM
#3
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Post #3 by ajeh

Peeking at the Product Free Shipping template for clues ... there is this code:

<!--bof free ship icon  -->
<?php if(zen_get_product_is_always_free_shipping($products_id_current) && $flag_show_product_info_free_shipping) { ?>
<div id="freeShippingIcon"><?php echo TEXT_PRODUCT_FREE_SHIPPING_ICON; ?></div>
<?php } ?>
<!--eof free ship icon  -->

You could adapt that to know when to display the icon by using the current products_id variable for the IF test (not don't need the $flag_show_product_info_free_shipping in the test) and then echo the image you want ...

TEXT_PRODUCT_FREE_SHIPPING_ICON can then be displayed where you need it ...

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

7 Mar 2009, 6:06 AM
#4
jerry5763837 avatar

jerry5763837

Zen Follower

Join Date:
May 2008
Posts:
261
Plugin Contributions:
0

Post #4 by jerry5763837

hi, Ajeh,

Many thanks for our suggestion.

I tried , but the free shipping icon still not shown in best seller in sidebox.

here is the code. could you please help to check how to modify?
appreciated again.

includes\templates\template_default\sideboxes\tpl_best_sellers.php

<?php
/**
 * Side Box Template
 *
 * @package templateSystem
 * @copyright Copyright 2003-2005 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_best_sellers.php 2982 2006-02-07 07:56:41Z birdbrain $
 * @version $Id: tpl_best_sellers.php 2982 2007-12-15 21:00:00 TRUST IT - www.trustit.ca - [email protected] $
 */
  $content = '';
  $content .= '<div id="' . str_replace('_', '-', $box_id . 'Content') . '" class="sideBoxContent">' . "\n";
  $content .= '<div class="wrapper"><table cellpadding=0 cellspacing=0 border=0>' .  "\n";
  for ($i=1; $i<=sizeof($bestsellers_list); $i++) {
    $imgLink =  DIR_WS_IMAGES . $bestsellers_list[$i]['image'];
	if ($i==2) {$content .= '<tr><td colspan=2><hr></td></tr>';}
    $content .= '<tr><td valign=top><a href="' . zen_href_link(zen_get_info_page($bestsellers_list[$i]['id']), 'products_id=' . $bestsellers_list[$i]['id']) . '">' . 	zen_image($imgLink, zen_trunc_string($bestsellers_list[$i]['name']), SMALL_IMAGE_WIDTH/2, SMALL_IMAGE_HEIGHT/2) . '</a></td><td valign=top><a href="' . zen_href_link(zen_get_info_page($bestsellers_list[$i]['id']), 'products_id=' . $bestsellers_list[$i]['id']) . '">' . zen_trunc_string($bestsellers_list[$i]['name'], BEST_SELLERS_TRUNCATE, BEST_SELLERS_TRUNCATE_MORE) . '</a><BR><div align=right>' . zen_get_products_display_price($bestsellers_list[$i]['id']) . '</div></td></tr>' . 	"\n";
  }
  $content .= '</table></div>' . "\n";
  $content .= '</div>';

?>

and the file includes\modules\sideboxes\best_sellers.php

<?php
/**
 * Side Box Template
 *
 * @package templateSystem
 * @copyright Copyright 2003-2005 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_best_sellers.php 2982 2006-02-07 07:56:41Z birdbrain $
 * @version $Id: tpl_best_sellers.php 2982 2007-12-15 21:00:00 TRUST IT - www.trustit.ca - [email protected] $
*/

// test if box should display
 $show_best_sellers= false;

 if (isset($_GET['products_id'])) {
    if (isset($_SESSION['customer_id'])) {
   $check_query = "select count(*) as count
           from " . TABLE_CUSTOMERS_INFO . "
           where customers_info_id = '" . (int)$_SESSION['customer_id'] . "'
           and global_product_notifications = '1'";

   $check = $db->Execute($check_query);

   if ($check->fields['count'] > 0) {
    $show_best_sellers= true;
   }
  }
 } else {
  $show_best_sellers= true;
 }

 if ($show_best_sellers == true) {
  if (isset($current_category_id) && ($current_category_id > 0)) {
   $best_sellers_query = "select distinct p.products_id, p.products_image, pd.products_name, p.products_price, p.products_ordered
              from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, "
                  . TABLE_PRODUCTS_TO_CATEGORIES . " p2c, " . TABLE_CATEGORIES . " c
              where p.products_status = '1'
              and p.products_ordered > 0
              and p.products_id = pd.products_id
              and pd.language_id = '" . (int)$_SESSION['languages_id'] . "'
              and p.products_id = p2c.products_id
              and p2c.categories_id = c.categories_id
              and '" . (int)$current_category_id . "' in (c.categories_id, c.parent_id)
              order by p.products_ordered desc, pd.products_name
              limit " . MAX_DISPLAY_BESTSELLERS;

   $best_sellers = $db->Execute($best_sellers_query);

  } else {
   $best_sellers_query = "select distinct p.products_id, p.products_image, pd.products_name, p.products_price, p.products_ordered
              from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd
              where p.products_status = '1'
              and p.products_ordered > 0
              and p.products_id = pd.products_id
              and pd.language_id = '" . (int)$_SESSION['languages_id'] . "'
              order by p.products_ordered desc, pd.products_name
              limit " . MAX_DISPLAY_BESTSELLERS;

   $best_sellers = $db->Execute($best_sellers_query);
  }

  if ($best_sellers->RecordCount() >= MIN_DISPLAY_BESTSELLERS) {
   $title = BOX_HEADING_BESTSELLERS;
   $box_id = bestsellers;
   $rows = 0;
   while (!$best_sellers->EOF) {
    $rows++;
    $bestsellers_list[$rows]['id'] = $best_sellers->fields['products_id'];
    $bestsellers_list[$rows]['name'] = $best_sellers->fields['products_name'];
	$bestsellers_list[$rows]['image'] = $best_sellers->fields['products_image'];
    $bestsellers_list[$rows]['price'] = $best_sellers->fields['products_price'];
    $best_sellers->MoveNext();
   }

   $left_corner = false;
   $right_corner = false;
   $right_arrow = false;
   $title_link = false;
   require($template->get_template_dir('tpl_best_sellers.php',DIR_WS_TEMPLATE, $current_page_base,'sideboxes'). '/tpl_best_sellers.php');
   $title = BOX_HEADING_BESTSELLERS;
   require($template->get_template_dir($column_box_default, DIR_WS_TEMPLATE, $current_page_base,'common') . '/' . $column_box_default);
  }
 }
?>
7 Mar 2009, 3:50 PM
#5
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Post #5 by ajeh

I don't see any code in there to display it ... :unsure:

Get the products_id from:
$best_sellers->fields['products_id']

and use it with the function zen_get_product_is_always_free_shipping ...

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

8 Mar 2009, 7:43 AM
#6
jerry5763837 avatar

jerry5763837

Zen Follower

Join Date:
May 2008
Posts:
261
Plugin Contributions:
0

Post #6 by jerry5763837

Ajeh:

I don't see any code in there to display it ... :unsure:

Get the products_id from:
$best_sellers->fields['products_id']

and use it with the function zen_get_product_is_always_free_shipping ...

Hi, Ajeh,

How genious you are!

Howvere i am not very good at PHP code.
could you please clarify how to modidy?

Many thanks again.:yes:

8 Mar 2009, 2:53 PM
#7
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Post #7 by ajeh

<?php if(zen_get_product_is_always_free_shipping($best_sellers->fields['products_id'])) {
  echo 'I see free icon' . TEXT_PRODUCT_FREE_SHIPPING_ICON;
} else {
  echo 'I DO NOT see free icon';
} 
?>

You just need to work that into the code somewhere ...

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

9 Mar 2009, 12:03 PM
#8
jerry5763837 avatar

jerry5763837

Zen Follower

Join Date:
May 2008
Posts:
261
Plugin Contributions:
0

Post #8 by jerry5763837

hi, Ajeh,

anyhow, thanks very much for your help.

I tried to insert your suggested code as follows:
but it does not work, only destroy my whole main page.

Any further suggestion, thanks again

<?php /** * Side Box Template * * @package templateSystem * @copyright Copyright 2003-2005 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_best_sellers.php 2982 2006-02-07 07:56:41Z birdbrain $ * @version $Id: tpl_best_sellers.php 2982 2007-12-15 21:00:00 TRUST IT - <https://www.trustit.ca> - [email protected] $ */ $content = ''; $content .= '<div id="' . str_replace('_', '-', $box_id . 'Content') . '" class="sideBoxContent">' . "\n"; $content .= '<div class="wrapper"><table cellpadding=0 cellspacing=0 border=0>' . "\n"; for ($i=1; $i<=sizeof($bestsellers_list); $i++) { $imgLink = DIR_WS_IMAGES . $bestsellers_list[$i]['image']; if ($i==2) {$content .= '<tr><td colspan=2><hr></td></tr>';} $content .= '<tr><td valign=top><a href="' . zen_href_link(zen_get_info_page($bestsellers_list[$i]['id']), 'products_id=' . $bestsellers_list[$i]['id']) . '">' . zen_image($imgLink, zen_trunc_string($bestsellers_list[$i]['name']), SMALL_IMAGE_WIDTH/2, SMALL_IMAGE_HEIGHT/2) . '</a></td><td valign=top><a href="' . zen_href_link(zen_get_info_page($bestsellers_list[$i]['id']), 'products_id=' . $bestsellers_list[$i]['id']) . '">' . zen_trunc_string($bestsellers_list[$i]['name'], BEST_SELLERS_TRUNCATE, BEST_SELLERS_TRUNCATE_MORE) . '</a><BR><div align=right>' . zen_get_products_display_price($bestsellers_list[$i]['id']) . '</div></td> <?php if(zen_get_product_is_always_free_shipping($best_sellers->fields['products_id'])) { echo 'I see free icon' . TEXT_PRODUCT_FREE_SHIPPING_ICON; } else { echo 'I DO NOT see free icon'; } ?> </tr>' . "\n";

}
$content .= '</table></div>' . "\n";
$content .= '</div>';

?>

9 Mar 2009, 4:36 PM
#9
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Post #9 by ajeh

That is because you stuck in the <?php** and the **?> opening and closing php tags in the middle of php code ... :eek:

Above the line where you put the IF that starts with:
$content .=

Put the code:

if(zen_get_product_is_always_free_shipping($best_sellers->fields['products_id'])) {
  $my_free_shipping_icon = 'I see free icon' . TEXT_PRODUCT_FREE_SHIPPING_ICON;
} else {
  $my_free_shipping_icon = 'I DO NOT see free icon';
} 

Then in the code where you want to display it add the:
$my_free_shipping_icon

For example:

$content .= '<tr><td valign=top><a href="' . zen_href_link(zen_get_info_page($bestsellers_list[$i]['id']), 'products_id=' . $bestsellers_list[$i]['id']) . '">' . zen_image($imgLink, zen_trunc_string($bestsellers_list[$i]['name']), SMALL_IMAGE_WIDTH/2, SMALL_IMAGE_HEIGHT/2) . '</a></td><td valign=top><a href="' . zen_href_link(zen_get_info_page($bestsellers_list[$i]['id']), 'products_id=' . $bestsellers_list[$i]['id']) . '">' . zen_trunc_string($bestsellers_list[$i]['name'], BEST_SELLERS_TRUNCATE, BEST_SELLERS_TRUNCATE_MORE) . '</a><BR><div align=right>' . zen_get_products_display_price($bestsellers_list[$i]['id']) . '<br />' . $my_free_shipping_icon . '</div></td></tr>' . "\n";

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

10 Mar 2009, 1:16 AM
#10
jerry5763837 avatar

jerry5763837

Zen Follower

Join Date:
May 2008
Posts:
261
Plugin Contributions:
0

Post #10 by jerry5763837

Ajeh:

That is because you stuck in the <?php** and the **?> opening and closing php tags in the middle of php code ... :eek:

Above the line where you put the IF that starts with:
$content .=

Put the code:

if(zen_get_product_is_always_free_shipping($best_sellers->fields['products_id'])) {
$my_free_shipping_icon = 'I see free icon' . TEXT_PRODUCT_FREE_SHIPPING_ICON;
} else {
$my_free_shipping_icon = 'I DO NOT see free icon';
}

> 
> Then in the code where you want to display it add the:
>   $my_free_shipping_icon
> 
> For example:
> ```
$content .= '<tr><td valign=top><a href="' . zen_href_link(zen_get_info_page($bestsellers_list[$i]['id']), 'products_id=' . $bestsellers_list[$i]['id']) . '">' . zen_image($imgLink, zen_trunc_string($bestsellers_list[$i]['name']), SMALL_IMAGE_WIDTH/2, SMALL_IMAGE_HEIGHT/2) . '</a></td><td valign=top><a href="' . zen_href_link(zen_get_info_page($bestsellers_list[$i]['id']), 'products_id=' . $bestsellers_list[$i]['id']) . '">' . zen_trunc_string($bestsellers_list[$i]['name'], BEST_SELLERS_TRUNCATE, BEST_SELLERS_TRUNCATE_MORE) . '</a><BR><div align=right>' . zen_get_products_display_price($bestsellers_list[$i]['id']) . '<br />' . $my_free_shipping_icon . '</div></td></tr>' . "\n";

hi, Ajeh,

How Great you are!

It works, but all the items are free shipping. seems that the IF failed to judge which item is free shipping. If just want ship freely those items which i set free shippig by click yes-always free shipping through Admin--catalog--categories/products, how to fix this problem?

Thank agagin for your great help.:lamo:

10 Mar 2009, 4:00 AM
#11
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Post #11 by ajeh

See if this works better in place of the products_id being used in the function:
$bestsellers_list[$i]['id']

This function works with anything ... but you have to have the right variable ...

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!