Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Adding text "free shipping" under price


Guest

Recommended Posts

Posted

I’ve just installed the free shipping per product contribution and it works great. I especially like the way it adds the words “free shipping” under the price on the products info page. However I would also like to add this to the product listing page. I have tried, but the code in product listing is very different to that in product info and I am very much a php dummy.

 

This is the code that is in product info:

 

<?php
if ($product_info['products_free_shipping']) {
 echo ('<tr><td colspan="2" align="right" class="smallText">'.FREE_SHIPPING_FOR_THIS_PRODUCT.'</td></tr>');
}
?>

 

How do I modify this code to suit product listing and where do I insert it in product_listing so the text appears under the price.

 

Thanks.

Posted
Anyone ?

 

 

Look in includes/modules/product_listing.php

Posted

The contribution is supposed to do this when it is installed, but I notice that the listing of files changed during installation does not include catalog/index.php

 

In your catalog/index.php, there are 4 queries which need to have

p.products_free_shipping
added to them at lines 175, 178, 184 and 187(line numbers are approximate):

 

172:		if (isset($HTTP_GET_VARS['manufacturers_id'])) {
173:		  if (isset($HTTP_GET_VARS['filter_id']) && tep_not_null($HTTP_GET_VARS['filter_id'])) {
174:	// We are asked to show only a specific category
175:			$listing_sql = "select " . $select_column_list . " p.products_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, p.products_free_shipping, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_MANUFACTURERS . " m, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_status = '1' and p.manufacturers_id = m.manufacturers_id and m.manufacturers_id = '" . (int)$HTTP_GET_VARS['manufacturers_id'] . "' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . (int)$languages_id . "' and p2c.categories_id = '" . (int)$HTTP_GET_VARS['filter_id'] . "'";
176:		  } else {
177:	// We show them all
178:			$listing_sql = "select " . $select_column_list . " p.products_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, p.products_free_shipping, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_MANUFACTURERS . " m where p.products_status = '1' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "' and p.manufacturers_id = m.manufacturers_id and m.manufacturers_id = '" . (int)$HTTP_GET_VARS['manufacturers_id'] . "'";
179:		  }
180:		} else {
181:	// show the products in a given categorie
182:		  if (isset($HTTP_GET_VARS['filter_id']) && tep_not_null($HTTP_GET_VARS['filter_id'])) {
183:	// We are asked to show only specific catgeory
184:			$listing_sql = "select " . $select_column_list . " p.products_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, p.products_free_shipping, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_MANUFACTURERS . " m, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_status = '1' and p.manufacturers_id = m.manufacturers_id and m.manufacturers_id = '" . (int)$HTTP_GET_VARS['filter_id'] . "' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . (int)$languages_id . "' and p2c.categories_id = '" . (int)$current_category_id . "'";
185:		  } else {
186:	// We show them all
187:			$listing_sql = "select " . $select_column_list . " p.products_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, p.products_free_shipping, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m on p.manufacturers_id = m.manufacturers_id left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_status = '1' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . (int)$languages_id . "' and p2c.categories_id = '" . (int)$current_category_id . "'";
188:		  }
189:		}
190:

If the changes for catalog/includes/modules/product_listing.php and the changes above have been made, then the Free Shipping text from the language defines should show up right under "Buy Now" in the product listings.

... if you want to REALLY see something that doesn't set up right out of the box without some tweaking,

try being a Foster Parent!

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...