Jump to content
Sign in to follow this  
homewetbar

Simple Price Break Contribution

Recommended Posts

Hello, I've installed this Simple Price Break Module. http://addons.oscommerce.com/info/4658 Everything seems work fine except the shopping_cart.php page.

 

The price break is:

1-19 => Reqular Price

20 and up => 5%Off

 

The discount price is correct on the product_info.php page but is NOT correct on the shopping_cart.php page (the page after you click "Add to Cart" and update the qty more than 21. The unit price and the total price does not reflect the discount price. I'm not sure if you can see this page: http://estore.bcmcom.com/catalog/product_i...?products_id=37 Can you help me please?

 

Thank you.

 

 

Shawn's suggestion worked for me. Thank you Shawn, I'm happy now!!!!!!!!!

Share this post


Link to post
Share on other sites

Hello, i checked all the versions and my result is that the best working version is the homewetbar 1.1b.. All the next versions after this doesn't work, they don't calculate the discount.. Basically the problem on those versions is inside the includes/classes/shopping_cart.php

 

So everyone who like this contribution use version 1.1b.. (and i think that it is better to upload that version as last, because many people they download the latest version, they see that doesn't work and they delete it.. Many ppl doesn't read the forum)

 

Anyway, thanks for good contribution.. I wanted a discount contribution but i wasn't enable to use price break because my site is already too modified!


I am Maintaining :

Product_Short_Description (i added it on specials.php and in shopping_cart.php)

City Shipping Rates With Admin (fixed the error that was giving wrong total shipping charges)

I had Created :

UTF bug fix on standard reviews system (admin & block)

Corrupted character on mysql with utf-8

Share this post


Link to post
Share on other sites

Hi Folks,

 

I have installed the 2.1 version of this contrib to my OSC 2.2 and got the shopping cart total problem fixed thanks to Shawn. Good man B)

 

I have a new problem though, and that is that the individual price summary always shows the basic standard price (no discount subtracted). The shopping cart total is correct.

 

Here is my current shopping_cart.php :

 

<?php

/*

$Id: shopping_cart.php 1739 2007-12-20 00:52:16Z hpdl $

 

osCommerce, Open Source E-Commerce Solutions

http://www.oscommerce.com

 

Copyright © 2003 osCommerce

 

Released under the GNU General Public License

*/

 

class shoppingCart {

var $contents, $total, $weight, $cartID, $content_type;

 

function shoppingCart() {

$this->reset();

}

 

function restore_contents() {

global $customer_id;

 

if (!tep_session_is_registered('customer_id')) return false;

 

// insert current cart contents in database

if (is_array($this->contents)) {

reset($this->contents);

while (list($products_id, ) = each($this->contents)) {

$qty = $this->contents[$products_id]['qty'];

$product_query = tep_db_query("select products_id from " . TABLE_CUSTOMERS_BASKET . " where customers_id = '" . (int)$customer_id . "' and products_id = '" . tep_db_input($products_id) . "'");

if (!tep_db_num_rows($product_query)) {

tep_db_query("insert into " . TABLE_CUSTOMERS_BASKET . " (customers_id, products_id, customers_basket_quantity, customers_basket_date_added) values ('" . (int)$customer_id . "', '" . tep_db_input($products_id) . "', '" . tep_db_input($qty) . "', '" . date('Ymd') . "')");

if (isset($this->contents[$products_id]['attributes'])) {

reset($this->contents[$products_id]['attributes']);

while (list($option, $value) = each($this->contents[$products_id]['attributes'])) {

tep_db_query("insert into " . TABLE_CUSTOMERS_BASKET_ATTRIBUTES . " (customers_id, products_id, products_options_id, products_options_value_id) values ('" . (int)$customer_id . "', '" . tep_db_input($products_id) . "', '" . (int)$option . "', '" . (int)$value . "')");

}

}

} else {

tep_db_query("update " . TABLE_CUSTOMERS_BASKET . " set customers_basket_quantity = '" . tep_db_input($qty) . "' where customers_id = '" . (int)$customer_id . "' and products_id = '" . tep_db_input($products_id) . "'");

}

}

}

 

// reset per-session cart contents, but not the database contents

$this->reset(false);

 

$products_query = tep_db_query("select products_id, customers_basket_quantity from " . TABLE_CUSTOMERS_BASKET . " where customers_id = '" . (int)$customer_id . "'");

while ($products = tep_db_fetch_array($products_query)) {

$this->contents[$products['products_id']] = array('qty' => $products['customers_basket_quantity']);

// attributes

$attributes_query = tep_db_query("select products_options_id, products_options_value_id from " . TABLE_CUSTOMERS_BASKET_ATTRIBUTES . " where customers_id = '" . (int)$customer_id . "' and products_id = '" . tep_db_input($products['products_id']) . "'");

while ($attributes = tep_db_fetch_array($attributes_query)) {

$this->contents[$products['products_id']]['attributes'][$attributes['products_options_id']] = $attributes['products_options_value_id'];

}

}

 

$this->cleanup();

}

 

function reset($reset_database = false) {

global $customer_id;

 

$this->contents = array();

$this->total = 0;

$this->weight = 0;

$this->content_type = false;

 

if (tep_session_is_registered('customer_id') && ($reset_database == true)) {

tep_db_query("delete from " . TABLE_CUSTOMERS_BASKET . " where customers_id = '" . (int)$customer_id . "'");

tep_db_query("delete from " . TABLE_CUSTOMERS_BASKET_ATTRIBUTES . " where customers_id = '" . (int)$customer_id . "'");

}

 

unset($this->cartID);

if (tep_session_is_registered('cartID')) tep_session_unregister('cartID');

}

 

function add_cart($products_id, $qty = '1', $attributes = '', $notify = true) {

global $new_products_id_in_cart, $customer_id;

 

$products_id_string = tep_get_uprid($products_id, $attributes);

$products_id = tep_get_prid($products_id_string);

 

if (defined('MAX_QTY_IN_CART') && (MAX_QTY_IN_CART > 0) && ((int)$qty > MAX_QTY_IN_CART)) {

$qty = MAX_QTY_IN_CART;

}

 

$attributes_pass_check = true;

 

if (is_array($attributes)) {

reset($attributes);

while (list($option, $value) = each($attributes)) {

if (!is_numeric($option) || !is_numeric($value)) {

$attributes_pass_check = false;

break;

}

}

}

 

if (is_numeric($products_id) && is_numeric($qty) && ($attributes_pass_check == true)) {

$check_product_query = tep_db_query("select products_status from " . TABLE_PRODUCTS . " where products_id = '" . (int)$products_id . "'");

$check_product = tep_db_fetch_array($check_product_query);

 

if (($check_product !== false) && ($check_product['products_status'] == '1')) {

if ($notify == true) {

$new_products_id_in_cart = $products_id;

tep_session_register('new_products_id_in_cart');

}

 

if ($this->in_cart($products_id_string)) {

$this->update_quantity($products_id_string, $qty, $attributes);

} else {

$this->contents[$products_id_string] = array('qty' => (int)$qty);

// insert into database

if (tep_session_is_registered('customer_id')) tep_db_query("insert into " . TABLE_CUSTOMERS_BASKET . " (customers_id, products_id, customers_basket_quantity, customers_basket_date_added) values ('" . (int)$customer_id . "', '" . tep_db_input($products_id_string) . "', '" . (int)$qty . "', '" . date('Ymd') . "')");

 

if (is_array($attributes)) {

reset($attributes);

while (list($option, $value) = each($attributes)) {

$this->contents[$products_id_string]['attributes'][$option] = $value;

// insert into database

if (tep_session_is_registered('customer_id')) tep_db_query("insert into " . TABLE_CUSTOMERS_BASKET_ATTRIBUTES . " (customers_id, products_id, products_options_id, products_options_value_id) values ('" . (int)$customer_id . "', '" . tep_db_input($products_id_string) . "', '" . (int)$option . "', '" . (int)$value . "')");

}

}

}

 

$this->cleanup();

 

// assign a temporary unique ID to the order contents to prevent hack attempts during the checkout procedure

$this->cartID = $this->generate_cart_id();

}

}

}

 

function update_quantity($products_id, $quantity = '', $attributes = '') {

global $customer_id;

 

$products_id_string = tep_get_uprid($products_id, $attributes);

$products_id = tep_get_prid($products_id_string);

 

if (defined('MAX_QTY_IN_CART') && (MAX_QTY_IN_CART > 0) && ((int)$quantity > MAX_QTY_IN_CART)) {

$quantity = MAX_QTY_IN_CART;

}

 

$attributes_pass_check = true;

 

if (is_array($attributes)) {

reset($attributes);

while (list($option, $value) = each($attributes)) {

if (!is_numeric($option) || !is_numeric($value)) {

$attributes_pass_check = false;

break;

}

}

}

 

if (is_numeric($products_id) && isset($this->contents[$products_id_string]) && is_numeric($quantity) && ($attributes_pass_check == true)) {

$this->contents[$products_id_string] = array('qty' => (int)$quantity);

// update database

if (tep_session_is_registered('customer_id')) tep_db_query("update " . TABLE_CUSTOMERS_BASKET . " set customers_basket_quantity = '" . (int)$quantity . "' where customers_id = '" . (int)$customer_id . "' and products_id = '" . tep_db_input($products_id_string) . "'");

 

if (is_array($attributes)) {

reset($attributes);

while (list($option, $value) = each($attributes)) {

$this->contents[$products_id_string]['attributes'][$option] = $value;

// update database

if (tep_session_is_registered('customer_id')) tep_db_query("update " . TABLE_CUSTOMERS_BASKET_ATTRIBUTES . " set products_options_value_id = '" . (int)$value . "' where customers_id = '" . (int)$customer_id . "' and products_id = '" . tep_db_input($products_id_string) . "' and products_options_id = '" . (int)$option . "'");

}

}

}

}

 

function cleanup() {

global $customer_id;

 

reset($this->contents);

while (list($key,) = each($this->contents)) {

if ($this->contents[$key]['qty'] < 1) {

unset($this->contents[$key]);

// remove from database

if (tep_session_is_registered('customer_id')) {

tep_db_query("delete from " . TABLE_CUSTOMERS_BASKET . " where customers_id = '" . (int)$customer_id . "' and products_id = '" . tep_db_input($key) . "'");

tep_db_query("delete from " . TABLE_CUSTOMERS_BASKET_ATTRIBUTES . " where customers_id = '" . (int)$customer_id . "' and products_id = '" . tep_db_input($key) . "'");

}

}

}

}

 

function count_contents() { // get total number of items in cart

$total_items = 0;

if (is_array($this->contents)) {

reset($this->contents);

while (list($products_id, ) = each($this->contents)) {

$total_items += $this->get_quantity($products_id);

}

}

 

return $total_items;

}

 

function get_quantity($products_id) {

if (isset($this->contents[$products_id])) {

return $this->contents[$products_id]['qty'];

} else {

return 0;

}

}

 

function in_cart($products_id) {

if (isset($this->contents[$products_id])) {

return true;

} else {

return false;

}

}

 

function remove($products_id) {

global $customer_id;

 

unset($this->contents[$products_id]);

// remove from database

if (tep_session_is_registered('customer_id')) {

tep_db_query("delete from " . TABLE_CUSTOMERS_BASKET . " where customers_id = '" . (int)$customer_id . "' and products_id = '" . tep_db_input($products_id) . "'");

tep_db_query("delete from " . TABLE_CUSTOMERS_BASKET_ATTRIBUTES . " where customers_id = '" . (int)$customer_id . "' and products_id = '" . tep_db_input($products_id) . "'");

}

 

// assign a temporary unique ID to the order contents to prevent hack attempts during the checkout procedure

$this->cartID = $this->generate_cart_id();

}

 

function remove_all() {

$this->reset();

}

 

function get_product_id_list() {

$product_id_list = '';

if (is_array($this->contents)) {

reset($this->contents);

while (list($products_id, ) = each($this->contents)) {

$product_id_list .= ', ' . $products_id;

}

}

 

return substr($product_id_list, 2);

}

 

function calculate() {

global $currencies;

 

$this->total = 0;

$this->weight = 0;

if (!is_array($this->contents)) return 0;

 

reset($this->contents);

while (list($products_id, ) = each($this->contents)) {

$qty = $this->contents[$products_id]['qty'];

 

// products price

$product_query = tep_db_query("select products_id, products_price, products_discount, products_tax_class_id, products_weight from " . TABLE_PRODUCTS . " where products_id = '" . (int)$products_id . "'");

if ($product = tep_db_fetch_array($product_query)) {

$prid = $product['products_id'];

$products_tax = tep_get_tax_rate($product['products_tax_class_id']);

$products_price = $product['products_price'];

 

if( isset($product['products_discount']) && strlen($product['products_discount'])>2 ) {

if( $tranche = explode( ',', $product['products_discount'] ) ) {

$products_price_tmp = $products_price;

foreach( $tranche as $cle => $trn )

if( $qty_px = explode( ':', $trn ) ) {

if( $this->contents[$products_id]['qty'] >= $qty_px[0] ) {

if( strstr($qty_px[1],'%') )

$products_price_tmp = $products_price * (1-($qty_px[1]/100));

else

$products_price_tmp = $qty_px[1];

}

}

$products_price = $products_price_tmp;

}

}

 

$products_weight = $product['products_weight'];

 

$specials_query = tep_db_query("select specials_new_products_price from " . TABLE_SPECIALS . " where products_id = '" . (int)$prid . "' and status = '1'");

if (tep_db_num_rows ($specials_query)) {

$specials = tep_db_fetch_array($specials_query);

$products_price = $specials['specials_new_products_price'];

}

 

$this->total += $currencies->calculate_price($products_price, $products_tax, $qty);

$this->weight += ($qty * $products_weight);

}

 

// attributes price

if (isset($this->contents[$products_id]['attributes'])) {

reset($this->contents[$products_id]['attributes']);

while (list($option, $value) = each($this->contents[$products_id]['attributes'])) {

$attribute_price_query = tep_db_query("select options_values_price, price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " where products_id = '" . (int)$prid . "' and options_id = '" . (int)$option . "' and options_values_id = '" . (int)$value . "'");

$attribute_price = tep_db_fetch_array($attribute_price_query);

if ($attribute_price['price_prefix'] == '+') {

$this->total += $currencies->calculate_price($attribute_price['options_values_price'], $products_tax, $qty);

} else {

$this->total -= $currencies->calculate_price($attribute_price['options_values_price'], $products_tax, $qty);

}

}

}

}

}

 

function attributes_price($products_id) {

$attributes_price = 0;

 

if (isset($this->contents[$products_id]['attributes'])) {

reset($this->contents[$products_id]['attributes']);

while (list($option, $value) = each($this->contents[$products_id]['attributes'])) {

$attribute_price_query = tep_db_query("select options_values_price, price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " where products_id = '" . (int)$products_id . "' and options_id = '" . (int)$option . "' and options_values_id = '" . (int)$value . "'");

$attribute_price = tep_db_fetch_array($attribute_price_query);

if ($attribute_price['price_prefix'] == '+') {

$attributes_price += $attribute_price['options_values_price'];

} else {

$attributes_price -= $attribute_price['options_values_price'];

}

}

}

 

return $attributes_price;

}

 

function get_products() {

global $languages_id;

 

if (!is_array($this->contents)) return false;

 

$products_array = array();

reset($this->contents);

while (list($products_id, ) = each($this->contents)) {

$products_query = tep_db_query("select p.products_id, pd.products_name, p.products_model, p.products_image, p.products_price, p.products_weight, p.products_tax_class_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_id = '" . (int)$products_id . "' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "'");

if ($products = tep_db_fetch_array($products_query)) {

$prid = $products['products_id'];

$products_price = $products['products_price'];

 

 

if( isset($products['products_discount']) && strlen($products['products_discount'])>2 ) {

if( $tranche = explode( ',', $products['products_discount'] ) ) {

$products_price_tmp = $products_price;

foreach( $tranche as $cle => $trn )

if( $qty_px = explode( ':', $trn ) ) {

if( $this->contents[$products_id]['qty'] >= $qty_px[0] ) {

if( strstr($qty_px[1],'%') )

$products_price_tmp = $products_price * (1-($qty_px[1]/100));

else

$products_price_tmp = $qty_px[1];

}

}

$products_price = $products_price_tmp;

}

}

 

 

$specials_query = tep_db_query("select specials_new_products_price from " . TABLE_SPECIALS . " where products_id = '" . (int)$prid . "' and status = '1'");

if (tep_db_num_rows($specials_query)) {

$specials = tep_db_fetch_array($specials_query);

if( $products_price > $specials['specials_new_products_price'] )

if( $products_price > $specials['specials_new_products_price'] )

$products_price = $specials['specials_new_products_price'];

}

 

$products_array[] = array('id' => $products_id,

'name' => $products['products_name'],

'model' => $products['products_model'],

'image' => $products['products_image'],

'price' => $products_price,

'quantity' => $this->contents[$products_id]['qty'],

'weight' => $products['products_weight'],

'final_price' => ($products_price + $this->attributes_price($products_id)),

'tax_class_id' => $products['products_tax_class_id'],

'attributes' => (isset($this->contents[$products_id]['attributes']) ? $this->contents[$products_id]['attributes'] : ''));

}

}

 

return $products_array;

}

 

function show_total() {

$this->calculate();

 

return $this->total;

}

 

function show_weight() {

$this->calculate();

 

return $this->weight;

}

 

function generate_cart_id($length = 5) {

return tep_create_random_value($length, 'digits');

}

 

function get_content_type() {

$this->content_type = false;

 

if ( (DOWNLOAD_ENABLED == 'true') && ($this->count_contents() > 0) ) {

reset($this->contents);

while (list($products_id, ) = each($this->contents)) {

if (isset($this->contents[$products_id]['attributes'])) {

reset($this->contents[$products_id]['attributes']);

while (list(, $value) = each($this->contents[$products_id]['attributes'])) {

$virtual_check_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS_ATTRIBUTES . " pa, " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD . " pad where pa.products_id = '" . (int)$products_id . "' and pa.options_values_id = '" . (int)$value . "' and pa.products_attributes_id = pad.products_attributes_id");

$virtual_check = tep_db_fetch_array($virtual_check_query);

 

if ($virtual_check['total'] > 0) {

switch ($this->content_type) {

case 'physical':

$this->content_type = 'mixed';

 

return $this->content_type;

break;

default:

$this->content_type = 'virtual';

break;

}

} else {

switch ($this->content_type) {

case 'virtual':

$this->content_type = 'mixed';

 

return $this->content_type;

break;

default:

$this->content_type = 'physical';

break;

}

}

}

} else {

switch ($this->content_type) {

case 'virtual':

$this->content_type = 'mixed';

 

return $this->content_type;

break;

default:

$this->content_type = 'physical';

break;

}

}

}

} else {

$this->content_type = 'physical';

}

 

return $this->content_type;

}

 

function unserialize($broken) {

for(reset($broken);$kv=each($broken);) {

$key=$kv['key'];

if (gettype($this->$key)!="user function")

$this->$key=$kv['value'];

}

}

 

}

?>

 

 

I hope someone can find the fault because I'm lost.

 

 

Thanks a lot in advance

 

Thomas

Share this post


Link to post
Share on other sites

Hello, Could someone please tell me if I can use this particular price break scenario with this 'Simple price break contribution' (note the gap I have between the various price breaks):

 

1 to 10 widgets - $5.00

20 to 40 widgets - $4.95

60 to 80 widgets - $4.00

100 to 200 widgets - $3.00

 

If a customer entered a quantity of 45, would the system calculate the price at $4.95?

 

Also, does anyone have a working website where I can see this contribution installed?

Edited by lupis

Share this post


Link to post
Share on other sites

Hi Folks,

 

I've got 1.1b installed and it works fine for me, except when I try to review orders I've made.

 

When I click on My Account and then "View the orders I have made", "View" I get the error:

 

1054 - Unknown column 'products_discount' in 'field list'

select orders_products_id, products_id, products_name, products_model, products_price, products_discount, products_tax, products_quantity, final_price from orders_products where orders_id = '2'

[TEP STOP]

 

I can't seem to locate where this error is at in the code of catalog/account_history_info.php. Can anyone spot it?

 

THANKS

Edited by matta

Share this post


Link to post
Share on other sites

Okay I've read the whole thing but couldn't see anything that can answer my question. I installed this contribution and everything seems to be perfect ( for now ).

I have a question regarding the design as I am a php newbie.

 

I have a screenshot

 

untitled.gif

 

 

and the code in my product_info.php looks something like this:

 

<?php
   }
if (tep_not_null($product_info['products_discount'])) {
  if( isset($product_info['products_discount']) && strlen($product_info['products_discount'])>2 ) {
    $first = true;
	$last = false;
	$tab_aff = array();
	$tab_percent = array();
	echo '<tr><td><table><tr><td>';
	$info_box_contents = array();
   	$info_box_contents[] = array('text' => '<span class="productSpecialPrice">' . TEXT_HEAD_REDUC_QTY . '</span>' );
       if( $tranche = explode( ',', $product_info['products_discount'] ) ) {
	  $index = 0;
      foreach( $tranche as $cle => $trn )
        if( $qty_px = explode( ':', $trn ) ) {
		  $tab_aff[$index][0] = $qty_px[0];
		  $tab_aff[$index][1] = $qty_px[1];
		  $tab_percent[$index]['discount'] = 1;
		  $tab_percent[$index]['percent'] = '';
		  if( strstr($qty_px[1],'%') ) {
		    $tab_percent[$index]['discount'] = (1-($qty_px[1]/100));
		    $tab_percent[$index]['percent'] = '%';
		  }
		  $index++;
        }
	  $new_price = tep_get_products_special_price($product_info['products_id']);
	  for( $i=0; $i<$index; $i++) {
	    if( $tab_percent[$i]['percent'] != '%' ) {
		  if( $new_price > $tab_aff[$i][1] || $new_price==0 ) $products_price = $currencies->display_price($tab_aff[$i][1], tep_get_tax_rate($product_info['products_tax_class_id']));
		  else $products_price = '<s>' . $currencies->display_price($tab_aff[$i][1], tep_get_tax_rate($product_info['products_tax_class_id'])) . '</s> <span class="productSpecialPrice">' . $currencies->display_price($new_price, tep_get_tax_rate($product_info['products_tax_class_id'])) . '</span>';
		}
		else {
		  if( $new_price > ($product_info['products_price']*$tab_percent[$i]['discount']) || $new_price==0 ) $products_price = '-' . $tab_aff[$i][1];
		  else $products_price = '<s>' . '-' . $tab_aff[$i][1] . '</s> <span class="productSpecialPrice">' . $currencies->display_price($new_price, tep_get_tax_rate($product_info['products_tax_class_id'])) . '</span>';
		}

	    if( $i==0 ) {
		  if ( $new_price )	$products_price_1 = '<s>' . $currencies->display_price($product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) . '</s> <span class="productSpecialPrice">' . $currencies->display_price($new_price, tep_get_tax_rate($product_info['products_tax_class_id'])) . '</span>';
                         else $products_price_1 = $currencies->display_price($product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id']));
		  $info_box_contents[] = array('align' => 'center', 'text' => sprintf( TEXT_QTY_PRIX_FIRST, $tab_aff[$i][0]-1 ) . '</td><td class="boxText">' . $products_price_1  );
		  if( isset($tab_aff[$i+1][0]) ) $info_box_contents[] = array('align' => 'center', 'text' => sprintf( TEXT_QTY_PRIX, $tab_aff[$i][0], $tab_aff[$i+1][0]-1 ) . '</td><td class="boxText">' . $products_price );
		  else $info_box_contents[] = array('align' => 'center', 'text' => sprintf( TEXT_QTY_PRIX_LAST, $tab_aff[$i][0] ) . '</td><td class="boxText">' . $products_price );
		}
		elseif ( $i == ($index-1) ) $info_box_contents[] = array('align' => 'center', 'text' => sprintf( TEXT_QTY_PRIX_LAST, $tab_aff[$i][0] ) . '</td><td class="boxText">' . $products_price );
		else $info_box_contents[] = array('align' => 'center', 'text' => sprintf( TEXT_QTY_PRIX, $tab_aff[$i][0], $tab_aff[$i+1][0]-1 ) . '</td><td class="boxText">' . $products_price  );
	  }
    }
	new infoBox($info_box_contents);
	echo '</td></tr></table></td></tr>';
  }
?>

 

 

 

What can I do to arrange the corners or the price to be more to the left so it won't screw up the tables? Thanks in advance

Edited by Amadeuss

Share this post


Link to post
Share on other sites

Hi,

 

I have the exact same problem as post #21 in this thread. Has anyone found a way around this issue? I thought of maybe using Quantity Price Break Per Product instead but the install procedure conflicts with an install of Header Tags SEO particularly with categories.php.

 

I did notice that QPBPP had a work around for this problem *here* but I don't see an easy way to apply that fix to Simple Price Break. Any suggestions?

 

Thanks,

Athena

 

I have installed simple pricde break from contribution section. But the problem is it is not irrespective of attributes. eg. If I set a pricebreak from 2 products and a product 'x' is available in 2 colours say blue and red, if I buy 2 red or 2 blue product x, it shows discount. but if add 1 blue product x and anther product x of color red it does not show the discount. It counts the quantity of products with same attribute. I need the discount of per product's quantity irrespective of attributes.ie if my discount starts from 2 product-quantity, it should show discount even if I buy 1 red and 1 blue.Can somebody tell how to fix this problem

Share this post


Link to post
Share on other sites

Pretty please with sugar on top, rainbow sprinkles, and TWO cherries. Anyone. Anything. Becoming desperate here.

 

Thanks,

Athena

 

Hi,

 

I have the exact same problem as post #21 in this thread. Has anyone found a way around this issue? I thought of maybe using Quantity Price Break Per Product instead but the install procedure conflicts with an install of Header Tags SEO particularly with categories.php.

 

I did notice that QPBPP had a work around for this problem *here* but I don't see an easy way to apply that fix to Simple Price Break. Any suggestions?

 

Thanks,

Athena

Edited by techgoddess

Share this post


Link to post
Share on other sites

All, I have installed this addon and so far it works great functionally. I made a couple adjustments per this thread and all seems to work well.

 

My problem is cosmetic and I am having a heck of a time getting this to blend into my site. I currently only have it on my test server, so can't show a live copy of it but maybe some insight into the whole infoBox call/function for styling. My templated cart has the info boxes styled for the left column, but I am trying to place this in my content area and format it nice and neatly, but could not.

 

Could somebody help me to format this a little better? Is there maybe a way, with some help, for me to copy the default infoBox fucntions to say infoBox4 and modify what I need to (though would need help with this.) (Doesn't have to infoBox, could be contentBox all the same... at least from what I gather?)

 

Any help?

Share this post


Link to post
Share on other sites

Does anyone know how to adjust the layout of the table so that the quantities are on top and the price breaks are on the bottom? I've been trying to figure it out for quite some time now.

 

EXAMPLE:

 

QTY | QTY | QTY

$$$ | $$$ | $$$

 

 

I would love to know this as well!

Share this post


Link to post
Share on other sites

Hi All,

I have got this contrib to work perfectly (discounted prices and checkout amounts are all fine) and have managed to place it in a box on the page with the matching 'header bar' as on the rest of our site boxes.

However, the box title is repeated in the box itself, where the discount schedule is visible.

I have fiddled around with the code and cannot get the text to go. I can get it so the title text is gone from both places, but not from just the box itself.

Frustrating!

Any help would be much appreciated.

 

Incidentally, I used Ver.1.1b as a basis, and some coding from the newer versions (Vanilla newer versions did not work at all, or had several problems on our modded site)

 

All the best,

Rob C.

Share this post


Link to post
Share on other sites

Back again - problem solved for putting the Simple Price Break table into a standard headed box, like those in the left and right columns... Code below for those that wish to do the same.

 

Replacement code for instructions Step 4 in 'catalog/product_info.php' : -

 

// Simple Price Break

if (tep_not_null($product_info['products_discount'])) {

if( isset($product_info['products_discount']) && strlen($product_info['products_discount'])>2 ) {

$first = true;

$last = false;

$tab_aff = array();

echo '<tr><td><table><tr><td>';

 

$info_box_contents = array();

 

$info_box_contents[] = array('text' => BOX_HEADING_DISCOUNT );

 

new infoBoxHeading($info_box_contents, true, true);

 

$info_box_contents = array();

$info_box_contents[] = array();

 

if( $tranche = explode( ',', $product_info['products_discount'] ) ) {

$index = 0;

foreach( $tranche as $cle => $trn )

if( $qty_px = explode( ':', $trn ) ) {

$tab_aff[$index][0] = $qty_px[0];

$tab_aff[$index][1] = $qty_px[1];

$index++;

}

$new_price = tep_get_products_special_price($product_info['products_id']);

for( $i=0; $i<$index; $i++) {

if( $new_price > $tab_aff[$i][1] || $new_price==0 ) $products_price = $currencies->display_price($tab_aff[$i][1], tep_get_tax_rate($product_info['products_tax_class_id']));

else $products_price = '<s>' . $currencies->display_price($tab_aff[$i][1], tep_get_tax_rate($product_info['products_tax_class_id'])) . '</s> <span class="productSpecialPrice">' . $currencies->display_price($new_price, tep_get_tax_rate($product_info['products_tax_class_id'])) . '</span>';

 

if( $i==0 ) {

if ( $new_price ) $products_price_1 = '<s>' . $currencies->display_price($product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) . '</s> <span class="productSpecialPrice">' . $currencies->display_price($new_price, tep_get_tax_rate($product_info['products_tax_class_id'])) . '</span>';

else $products_price_1 = $currencies->display_price($product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id']));

$info_box_contents[] = array('align' => 'left', 'text' => sprintf( TEXT_QTY_PRIX_FIRST, $tab_aff[$i][0]-1 ) . '</td><td class="boxText">' . $products_price_1 );

if( isset($tab_aff[$i+1][0]) ) $info_box_contents[] = array('align' => 'left', 'text' => sprintf( TEXT_QTY_PRIX, $tab_aff[$i][0], $tab_aff[$i+1][0]-1 ) . '</td><td class="boxText">' . $products_price );

else $info_box_contents[] = array('align' => 'left', 'text' => sprintf( TEXT_QTY_PRIX_LAST, $tab_aff[$i][0] ) . '</td><td class="boxText">' . $products_price );

}

elseif ( $i == ($index-1) ) $info_box_contents[] = array('align' => 'left', 'text' => sprintf( TEXT_QTY_PRIX_LAST, $tab_aff[$i][0] ) . '</td><td class="boxText">' . $products_price );

else $info_box_contents[] = array('align' => 'left', 'text' => sprintf( TEXT_QTY_PRIX, $tab_aff[$i][0], $tab_aff[$i+1][0]-1 ) . '</td><td class="boxText">' . $products_price );

}

}

new infoBox($info_box_contents);

echo '</td></tr></table></td></tr>';

}

?>

</td>

</tr>

<tr>

<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>

</tr>

<?php

}

// Simple Price Break

 

Code for Step 6 in "catalog/includes/languages/english/product_info.php" : -

 

Replace

 

define('TEXT_HEAD_REDUC_QTY', 'Prices per Quantity');"

 

with: -

 

define('BOX_HEADING_DISCOUNT', 'Quantity Discounts');

 

where = 'Quantity Discounts' you can use your own wording to suit.

Share this post


Link to post
Share on other sites

Has anyone put this into osC 2.3.1? I gave it a try but did not have such good luck.

I can see it in the admin section when entering a product and the discounts display in the catalog listings.

Problems is, the discount does not show up in the check out process.

 

Two differences were found when installing but they do not look like they should be real problems (I'm no expert):

 

First was in /catalog/includes/classes/shopping_cart.php

find (l178) :

if (tep_not_null($product_info['products_url']))

Could not find the exact line but am able to place the code so the price break displays on the catalog pages.

 

Second problem was in /catalog/admin/categories.php

Could not find this exact line but the differance seems to be concerned with products_date_available. Could this be the reason the add-on is not taking the discount from the shopping cart total?

Add on says - find (l292) :

tep_db_query("insert into " . TABLE_PRODUCTS . " (products_quantity, products_model,products_image, products_price, products_date_added, products_date_available, products_weight, products_status, products_tax_class_id, manufacturers_id) values ('" . tep_db_input($product['products_quantity']) . "', '" . tep_db_input($product['products_model']) . "', '" . tep_db_input($product['products_image']) . "', '" . tep_db_input($product['products_price']) . "', now(), '" . tep_db_input($product['products_date_available']) . "', '" . tep_db_input($product['products_weight']) . "', '0', '" . (int)$product['products_tax_class_id'] . "', '" . (int)$product['manufacturers_id'] . "')");

 

Line as it was found in 2.3.1:

tep_db_query("insert into " . TABLE_PRODUCTS . " (products_quantity, products_model,products_image, products_price, products_date_added, products_date_available, products_weight, products_status, products_tax_class_id, manufacturers_id) values ('" . tep_db_input($product['products_quantity']) . "', '" . tep_db_input($product['products_model']) . "', '" . tep_db_input($product['products_image']) . "', '" . tep_db_input($product['products_price']) . "', now(), " . (empty($product['products_date_available']) ? "null" : "'" . tep_db_input($product['products_date_available']) . "'") . ", '" . tep_db_input($product['products_weight']) . "', '0', '" . (int)$product['products_tax_class_id'] . "', '" . (int)$product['manufacturers_id'] . "')");

 

 

Thank you in advance if you are willing to help me out with this.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×