On the shop goodlivesbeads.nl I allready had installed the contrib Quantity Price per Product. I updated it a couple of days ago. Really a terrible contrib to install when you allready have other contribs like margin report, Ultra pics, Ms2 Html manager, tabedit etc. You have to be careful not to copy all the new code over the old code, and also be careful not to forget some code. So trying to install this on Claudiavandijk.com was a little bit faster, cause now I can use the code of the first site. That’s always better. I installed version 1.3.5 of 7-9-2008 and added the two shopping cart changes of 17-7-2009 after that.
Warning: be careful if you copy any code from the blog. It is possible that WordPress breaks the code and that during copying whitespaces or other hidden caracters occur in your files, so always check if your codes look normal
Installation
1. First copying the sql statements of price_breaks.sql in php admin.
2. Copying all the new files to their folders
3. Changes in catalog/index.php. Because of product descrition and new products Icon, my code looks a little bit different. It looks like this now:
// show the products of a specified manufacturer
// BOF qpbpp
if (isset($HTTP_GET_VARS['manufacturers_id'])) {
if (isset($HTTP_GET_VARS['filter_id']) && tep_not_null($HTTP_GET_VARS['filter_id'])) {
// We are asked to show only a specific category
// p.products_date_added to query for New Product Icon contribution
$listing_sql = “select ” . $select_column_list . ” p.products_id, p.products_date_added, p.manufacturers_id, p.products_price, p.products_qty_blocks, p.products_tax_class_id, 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_PRODUCTS_DESCRIPTION . ” pd, ” . TABLE_MANUFACTURERS . ” m, ” . TABLE_PRODUCTS_TO_CATEGORIES . ” p2c left join ” . TABLE_SPECIALS . ” s on ‘p.products_id = s.products_id’ 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'] . “‘”;
} else {
// We show them all
// p.products_date_added to query for New Product Icon contribution
$listing_sql = “select ” . $select_column_list . ” p.products_id, p.products_date_added, p.manufacturers_id, p.products_price, p.products_qty_blocks, p.products_tax_class_id, 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'] . “‘”;
}
} else {
// show the products in a given categorie
if (isset($HTTP_GET_VARS['filter_id']) && tep_not_null($HTTP_GET_VARS['filter_id'])) {
// We are asked to show only specific catgeory
// p.products_date_added to query for New Product Icon contribution
$listing_sql = “select ” . $select_column_list . ” p.products_id, p.products_date_added, p.manufacturers_id, p.products_price, p.products_qty_blocks, p.products_tax_class_id, 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 . “‘”;
} else {
// We show them all
// p.products_date_added to query for New Product Icon contribution
$listing_sql = “select ” . $select_column_list . ” p.products_id, p.products_date_added, p.manufacturers_id, p.products_price, p.products_qty_blocks, p.products_tax_class_id, 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 . “‘”;
4. catalog/product_info. I only added p.products_qty_blocks, at the first instruction for this file.
The second instruction is the same, but the third is different. I use the no stock no checkout contrib for my website. So I had to add the code like this:
<?php
if ($product_info['products_quantity'] <=0) { ?>
<td align=”right”><?php echo tep_draw_hidden_field(‘products_id’, $product_info['products_id']) . tep_image_button(‘button_in_cart_na.gif’, IMAGE_BUTTON_IN_CART_NA); ?></td>
<?php
} else { ?>
<?php // BOF qpbpp
//<td align=”right”><?php echo tep_draw_hidden_field(‘products_id’, $product_info['products_id']) . tep_image_submit(‘button_in_cart.gif’, IMAGE_BUTTON_IN_CART);
?>
<td align=”right”>
<table border=”0″ align=”right”>
<tr><td align=”center”>
<?php echo TEXT_ENTER_QUANTITY . “:” . tep_draw_input_field(‘cart_quantity’, $pf->adjustQty(1), ’size=”6″‘); ?>
</td></tr>
<tr><td align=”center”>
<?php echo tep_draw_hidden_field(‘products_id’, $product_info['products_id']) . tep_image_submit(‘button_in_cart.gif’, IMAGE_BUTTON_IN_CART); ?>
</td></tr>
</table>
</td>
<?php // EOF qpbpp ?>
5. catalog/admin/categories.php
This file is heavily edited in my shop. So with all the replacements I am very careful with what I add and what not. I try to see what’s new in the replacements and just add that code. There is nothing strange about it, so I don’t copy all the code here.
6. catalog/includes/classed/shopping_cart.php
It’s the same as with the categories.php file, be careful not to delete code from other contribs, just add the new code instead of replace all the new code.
7. The last instruction in catalog/includes/modules/product_listing.php is a little bit difficult. I don’t show prices in this shop for now, so also not in productlisting, but I do have the New products Icon and Products description installed. Why install this contrib then? Well I’m probably going to sell cards or posters of the photos that I make in the future, so I’m preparing the site for this allready. My code looks like this now:
switch ($column_list[$col]) {
case ‘PRODUCT_LIST_MODEL’:
$lc_align = ”;
$lc_text = ‘ ’ . $listing[$x]['products_model'] . ‘ ’;
break;
case ‘PRODUCT_LIST_NAME’:
// added for New Product Icon contribution
// 2592000 = 30 days in the unix timestamp format
if ( ($today_time – strtotime($listing[$x]['products_date_added'])) < 2592000) {
$listing[$x]['products_name'] .= ‘ ’ . tep_image_button(‘icon_newarrival.gif’, TEXT_ICON_NEW_PRODUCT. ‘ : ’ . $listing[$x]['products_name'], ‘align=”middle”‘);
}
// end addition
$lc_align = ”;
if (isset($HTTP_GET_VARS['manufacturers_id'])) {
$lc_text = ‘<a href=”‘ . tep_href_link(FILENAME_PRODUCT_INFO, ‘manufacturers_id=’ . $HTTP_GET_VARS['manufacturers_id'] . ‘&products_id=’ . $listing[$x]['products_id']) . ‘”>’ . $listing[$x]['products_name'] . ‘</a>’;
} else {
$lc_text = ‘ <a href=”‘ . tep_href_link(FILENAME_PRODUCT_INFO, ($cPath ? ‘cPath=’ . $cPath . ‘&’ : ”) . ‘products_id=’ . $listing[$x]['products_id']) . ‘”>’ . $listing[$x]['products_name'] . ‘</a> ’;
}
// Product description
if (PRODUCT_LIST_DESCRIPTION && $listing[$x]['products_description'] && PRODUCT_LIST_DESCRIPTION_MAX_LENGTH)
$lc_text .= ‘<br><table border=”0″ cellpadding=”0″ cellspacing=”0″ width=”100%”><tr><td>’ . tep_flatten_product_description($listing[$x]['products_description'], ‘ <a href=”‘ . tep_href_link(FILENAME_PRODUCT_INFO, ‘products_id=’ . $listing[$x]['products_id']) . ‘”>’ . TEXT_MORE . ‘</a>’) . ‘</td></tr></table>’;
// Product description
break;
case ‘PRODUCT_LIST_MANUFACTURER’:
$lc_align = ”;
// Auto Sort Mod Start ——
if (PRODUCT_LIST_AUTOSORT == ‘True’) {
// Add the Sort criteria to the URL
$sortcol = PRODUCT_LIST_AUTOSORT_COL;
if (PRODUCT_LIST_AUTOSORT_DIR == ‘Ascending’) {
$autosort = $sortcol . “a”;
} else {
$autosort = $sortcol . “d”;
}
$lc_text = ‘ <a href=”‘ . tep_href_link(FILENAME_DEFAULT, ‘manufacturers_id=’ . $listing['manufacturers_id']);
$lc_text .= ‘&page=1&sort=’ . $autosort . ‘”>’ . $listing['manufacturers_name'] . ‘</a> ’;
} else {
$lc_text = ‘ <a href=”‘ . tep_href_link(FILENAME_DEFAULT, ‘manufacturers_id=’ . $listing[$x]['manufacturers_id']) . ‘”>’ . $listing[$x]['manufacturers_name'] . ‘</a> ’;
}
// $categories_string .= tep_href_link(FILENAME_DEFAULT, $cPath_new) . ‘”>’;
// This was replaced: $lc_text = ‘ <a href=”‘ . tep_href_link(FILENAME_DEFAULT, ‘manufacturers_id=’ . $listing['manufacturers_id']) . ‘”>’ . $listing['manufacturers_name'] . ‘</a> ’;
// Auto Sort Mod End ———–
break;
case ‘PRODUCT_LIST_PRICE’:
$lc_align = ‘right’;
if (tep_not_null($listing['specials_new_products_price'])) {
$lc_text = ‘ <span><s>’ . $currencies->display_price($listing['products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . ‘</s></span> <span>’ . $currencies->display_price($listing['specials_new_products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . ‘</span> ’;
} else {
$lc_text = ‘ <span>’ . $currencies->display_price($listing['products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . ‘</span> ’;
}
break;
case ‘PRODUCT_LIST_QUANTITY’:
$lc_align = ‘right’;
// Mod for Not Showing Quantity with No Stock No CheckOut
// $lc_text = ‘ ’ . $listing['products_quantity'] . ‘ ’;
$lc_text = ‘ ’;
break;
case ‘PRODUCT_LIST_WEIGHT’:
$lc_align = ‘right’;
$lc_text = ‘ ’ . $listing[$x]['products_weight'] . ‘ ’;
break;
case ‘PRODUCT_LIST_IMAGE’:
$lc_align = ‘center’;
if (isset($HTTP_GET_VARS['manufacturers_id'])) {
$lc_text = ‘<a href=”‘ . tep_href_link(FILENAME_PRODUCT_INFO, ‘manufacturers_id=’ . $HTTP_GET_VARS['manufacturers_id'] . ‘&products_id=’ . $listing[$x]['products_id']) . ‘”>’ . tep_image(DIR_WS_IMAGES . $listing[$x]['products_image'], $listing[$x]['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . ‘</a>’;
} else {
$lc_text = ‘ <a href=”‘ . tep_href_link(FILENAME_PRODUCT_INFO, ($cPath ? ‘cPath=’ . $cPath . ‘&’ : ”) . ‘products_id=’ . $listing[$x]['products_id']) . ‘”>’ . tep_image(DIR_WS_IMAGES . $listing[$x]['products_image'], $listing[$x]['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . ‘</a> ’;
}
break;
case ‘PRODUCT_LIST_BUY_NOW’:
$lc_align = ‘center’;
// no stock no checkout
if ($listing['products_quantity']<=0) {
$lc_text = tep_image_button(‘button_buy_now_na.gif’, IMAGE_BUTTON_BUY_NOW_NA) . ‘ ’;
} else {
$lc_text = ‘<a href=”‘ . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array(‘action’)) . ‘action=buy_now&products_id=’ . $listing[$x]['products_id']) . ‘”>’ . tep_image_button(‘button_buy_now.gif’, IMAGE_BUTTON_BUY_NOW) . ‘</a> ’;
}
// no stock no checkout
break;
}
// EOF qpbpp
Screenshots (my site)
These screenshots are from both of my sites, because on claudiavandijk.com the prices are not visible, and that won’t show the price breaks then.
Product Information:

File in product listing:

Tabel in Product Info Admin site:

Configuration Price break:
