Jump to content
jpweber

Quantity Price Breaks

Recommended Posts

Hello,

 

I just finished installing this contribution, and when I try to go into Catalog I get a parse error:

Parse error: syntax error, unexpected $end in... /store/admin/categories.php on line 1896

 

I'm confused because line 1896 is just <!-- body_text_eof //-->

 

I'm not sure what to do or how to try to fix this. Can someone help me please?

 

TIA

 

Check the code ending on the line 1895 maybe you miss a ; or code closing tag there.

Share this post


Link to post
Share on other sites
Check the code ending on the line 1895 maybe you miss a ; or code closing tag there.

 

I did that, I don't see anything wrong. This is line 1891 through the last line 1901. It looks ok to me???

 

<!-- body_eof //-->

 

<!-- footer //-->

<?php require(DIR_WS_INCLUDES . 'footer.php'); ?>

<!-- footer_eof //-->

<br>

</body>

</html>

<?php require(DIR_WS_INCLUDES . 'application_bottom.php');

 

?>

Share this post


Link to post
Share on other sites
I did that, I don't see anything wrong. This is line 1891 through the last line 1901. It looks ok to me???

It does, but that doesn't say much. The mistake might be hundreds of lines earlier.

Can't you use the file admin/categories.php from the package or did you already added other contributions to that?

Share this post


Link to post
Share on other sites
It does, but that doesn't say much. The mistake might be hundreds of lines earlier.

Can't you use the file admin/categories.php from the package or did you already added other contributions to that?

 

Yes, I've added quite a few contributions already - I tried using a file compare and still can't find what's wrong.

Share this post


Link to post
Share on other sites

I installed this contribution before going live - it works just fine. However, I've noticed my site does something different from what the stock oscommerce installation does and I think its down to this price break contrib

 

If I have a product in my cart, go back to the product page and click 'add to cart' again, the cart quantity remains unchanged.

 

I've traced it to application_top:

 

//$cart->add_cart($HTTP_POST_VARS['products_id'], $cart->get_quantity(tep_get_uprid($HTTP_POST_VARS['products_id'], $HTTP_POST_VARS['id']))+1, $HTTP_POST_VARS['id']);

 

$cart->add_cart($HTTP_POST_VARS['products_id'], $cart->get_quantity(tep_get_uprid($HTTP_POST_VARS['products_id'], $HTTP_POST_VARS['id'])) + $HTTP_POST_VARS['cart_quantity'], $HTTP_POST_VARS['id']);

 

If i uncomment the first block (original code) and then comment out the second block (code added by the contribution), then the cart quantity does increment correctly.

 

Anyone have any ideas?

Share this post


Link to post
Share on other sites
If i uncomment the first block (original code) and then comment out the second block (code added by the contribution), then the cart quantity does increment correctly.

When I go to your site (looking at your username) I notice that you haven't added the quantity input field on product_info.php. No problem with that but then you should indeed use the "old" code for case: 'add_product' in application_top.php like you tested works correctly.

Share this post


Link to post
Share on other sites
When I go to your site (looking at your username) I notice that you haven't added the quantity input field on product_info.php. No problem with that but then you should indeed use the "old" code for case: 'add_product' in application_top.php like you tested works correctly.

 

Thanks :)

Share this post


Link to post
Share on other sites

I was able to install this update a couple of years ago to a different store without an issue, but I have now tried 2x with a new store I am working on and it doesn't seem to work. I have several issues. I am using v 1.3.5 by Jan on Sep 7, 2008.

 

The price break tables appear in my phpmyadmin. The price break entry form is available where i edit my products. I can enter the price breaks and all, when I click "Preview" I see the table showing me the price breaks. I hit "update" to save it all. I then go to my store to check to see how it looks. I do not see the price break table like I did in the admin screen.

 

I go back in to edit the product, and there is no price break info filled out in any of the boxes. It seems like it isn't saving the information. I am guessing that this is my problem, but don't know why it is happening. I have check to see if there is any data in the tables I created with the .sql file in the install package and there does not seem to be anything in it. I am also not getting an error messages saying that the tables don't exist or anything like that, so I think that means they should be there.

 

Anyone have any ideas? Thanks!

 

After that major issue, I need to work on some of the info it displays. I want to remove the discount % line in the table. I want my customer to see the price breaks, but I do not want them to see the % difference. Also, my products are ordered in larger quantities, 300 minimums, so I am putting my product in in pennies right now. I would prefer to enter than as a "per 100" or "per 1000" price, or at least have them shown correctly. Right now, I put in .392 for the first break and .387 for the second break and they both show as .39.

 

Thanks for the help!

Share this post


Link to post
Share on other sites

Errrr.... I am not sure what the heck happened, but I just had to go back and redo my admin/categories.php because of an error created by another package. I went to test to make sure this was not causing me an error before I tried the other one again, and it appears to actually be working now. I am not sure why or what happened, but it saved my breaks and is displaying them in the store now. :huh:

 

So, now I am just looking for help with the formatting issue and removing the "your savings" line from the price break box.

 

Thanks for the help so far! :lol:

Share this post


Link to post
Share on other sites
After that major issue, I need to work on some of the info it displays. I want to remove the discount % line in the table. I want my customer to see the price breaks, but I do not want them to see the % difference. Also, my products are ordered in larger quantities, 300 minimums, so I am putting my product in in pennies right now. I would prefer to enter than as a "per 100" or "per 1000" price, or at least have them shown correctly. Right now, I put in .392 for the first break and .387 for the second break and they both show as .39.

You could try this function to replace the one in PriceFormatter.php

  function getPriceString($style='productPriceInBox') {
global $currencies;

// If you want to change the format of the price/quantity table
// displayed on the product information page, here is where you do it.
$styling = 'padding-left: 10px;padding-right:10px;';

if (true == $this->hasQuantityPrice) {
  $lc_text = '<table border="0" cellspacing="0" cellpadding="0" class="infoBox" align="right">
		  <tr valign="top">
		  <td>
		  <table border="0" cellspacing="1" cellpadding="4" class="infobox">' . "\n";
  $lc_text .= '<tr valign="top">' . "\n";
  $lc_text .= '<td style="' . $styling . '" class="infoBoxHeading">' . TEXT_ENTER_QUANTITY .'</td>' . "\n";
  if ($this->price_breaks[0]['products_qty'] > $this->products_min_order_qty) {
	$lc_text .= '<td align="center" class="infoBoxHeading">' . $this->products_min_order_qty;
	if (($this->price_breaks[0]['products_qty'] - $this->products_min_order_qty) > 1) {
	  $lc_text .= '+ ';
	}
	$lc_text .= '</td>' . "\n";
  } // end if ($this->price_breaks[0]['products_qty'] > $this->products_min_order_qty)

  foreach($this->price_breaks as $key => $price_break) {
	  $lc_text .= '<td align="center" style="' . $styling . '" class="infoBoxHeading">'
		. $price_break['products_qty'];
		$lc_text .= '+ </td>' . "\n";
  } // end foreach($this->price_breaks as $key => $price_break)
  $lc_text .= '</tr>' . "\n";
  $lc_text .= '<tr valign="top">
  <td style="' . $styling . '" class="infoBoxContents">' . TEXT_PRICE_PER_PIECE . '</td>' . "\n";

  if (true == $this->hasSpecialPrice && ($this->price_breaks[0]['products_qty'] > $this->products_min_order_qty)) {
	$lc_text .= '<td align="center" style="' . $styling . '" class="infoBoxContents">';
	$lc_text .= '<s>'
	. $currencies->display_price(($this->thePrice * 100), tep_get_tax_rate($this->taxClass))
	. '</s>  <span class="productSpecialPrice">'
	. $currencies->display_price(($this->specialPrice * 100), tep_get_tax_rate($this->taxClass))
	. '</span> '
	.'</td>' . "\n";
  } elseif ($this->price_breaks[0]['products_qty'] > $this->products_min_order_qty) {
	$lc_text .= '<td align="center" style="' . $styling . '" class="infoBoxContents">'
	. $currencies->display_price(($this->thePrice * 100), tep_get_tax_rate($this->taxClass))
	. '</td>' . "\n";
  }

  foreach($this->price_breaks as $price_break) {
	  $lc_text .= '<td align="center" style="' . $styling . '" class="infoBoxContents">'
		. $currencies->display_price(($price_break['products_price'] * 100), tep_get_tax_rate($this->taxClass))
		.'</td>' . "\n";
  }
  $lc_text .= '</tr>' . "\n";

  // Begin saving calculation
/*	  $base_price = $this->thePrice;
  // if you have a min order quantity set, this might be the first entry
  // in the price break table so let's check for that
  if ($this->products_min_order_qty > 1 && $this->products_min_order_qty == $this->price_breaks[0]['products_qty']) {
	$base_price = $this->price_breaks[0]['products_price'];
  }
  // in case of a special price the "Savings" are calculated against the normal price
  // apart from the first column which calculates against the special price
  $lc_text .= '<tr valign="top">
  <td style="' . $styling . '" class="infoBoxContents">' . TEXT_SAVINGS . '</td>' . "\n";
  if (true == $this->hasSpecialPrice && ($this->price_breaks[0]['products_qty'] > $this->products_min_order_qty)) {
	$lc_text .= '<td align="center" class="infoBoxContents">'
	. $this->getDiscountSaving($base_price, $this->specialPrice)
	.'</td>' . "\n";
  } elseif ($this->price_breaks[0]['products_qty'] > $this->products_min_order_qty) {
	$lc_text .= '<td align="center" class="infoBoxContents">- </td>' . "\n";
  }

  foreach($this->price_breaks as $price_break) {
	if ($price_break['products_qty'] > $this->qtyBlocks) {
	  $lc_text .= '<td align="center" style="' . $styling . '" class="infoBoxContents">'
	  . $this->getDiscountSaving($base_price, $price_break['products_price'])
	  .'</td>' . "\n";
	} else {
	  $lc_text .= '<td align="center" class="infoBoxContents">- </td>' . "\n";
	}
  } */
  $lc_text .= '</table></td></tr></table>'; // </tr> removed
} else {
  if (true == $this->hasSpecialPrice) {
	$lc_text = ' <s>'
	. $currencies->display_price(($this->thePrice * 100), tep_get_tax_rate($this->taxClass))
	. '</s>  <span class="productSpecialPrice">'
	. $currencies->display_price(($this->specialPrice * 100), tep_get_tax_rate($this->taxClass))
	. '</span> ';
  } else {
	$lc_text = ' '
	. $currencies->display_price(($this->thePrice * 100), tep_get_tax_rate($this->taxClass))
	. ' ';
  }
}
return $lc_text;
 }

Share this post


Link to post
Share on other sites

This would replace all the code currently in my Priceformatter.php file? I'll give it a shot, thank you :)

 

 

 

EDIT: Ahhh, no, I see that this was for a specific function. I have replaced it and will try it out now.

Edited by jfirestone

Share this post


Link to post
Share on other sites

This did almost ALL of what I need, thank you! A couple of issues that I am not sure how to solve... sorry, I am not much for coding. I can find and replace and can sometimes figure out what I am looking at and what it is doing, but I can't write it or figure out how to fix it.

 

My main or new products page it still shows as .39. When I go directly to look at the product details it looks perfect, other than I need to add a "per c" or "/100" or something like that after the price. We are a printing company and all or prices work as per c (per 100) or per m (per 1,000).

 

Moreso, is there any way that it can use the "/c" or "/m" based on the price break? That might be asking too much. Basically, I would want the min and 600 price to be "/c", but my 1,200 - 2,500 - 5,000 price breaks to be "/m".

 

Thanks again, this is really a huge help :)

Share this post


Link to post
Share on other sites

Okay, forget that last one, I figured that one out with the help of some friends that do php coding. Now I am trying to figure out how to change the box text from "Price for Each" to Price per 100"

Edited by jfirestone

Share this post


Link to post
Share on other sites
Now I am trying to figure out how to change the box text from "Price for Each" to Price per 100"

That's as easy as pie. The define for that is found in includes/languages/english/product_info.php:

define('TEXT_PRICE_PER_PIECE', 'Price for each');

(and in admin/includes/languages/english/categories.php on the admin side of course).

Share this post


Link to post
Share on other sites

Uggh.. now something else... the price box has the quantities at the top, which is great. There is a "+" after each break, that I think I might want to remove. Also, my min qty only has a "+" on it, instead of my min quantity for the product. Can I fix those things?

Share this post


Link to post
Share on other sites
can we make discount with % (percent)

No.

and what about discount categories? how it works i cant understand?

Explained in the install file (close to the bottom): install.html#howtouse

Share this post


Link to post
Share on other sites

Hello,

 

I have read this thread deeply, but somehow I did not find the answer to my problem:

 

I have installed the latest version of Quantitiy Price Breaks and I always get this error:

 

 

Fatal error: Call to a member function on a non-object in catalog/product_info.php on line 87

 

This is the line:

 

$pf->loadProduct((int)$_GET['products_id'], (int)$languages_id);

$products_price = $pf->getPriceString();

 

It would be more than gratefull, if somebody could tell me, what has gone wrong and what do I have to fix?

 

THANKS alot :)

Share this post


Link to post
Share on other sites
Fatal error: Call to a member function on a non-object in catalog/product_info.php on line 87

 

This is the line:

 

$pf->loadProduct((int)$_GET['products_id'], (int)$languages_id);

$products_price = $pf->getPriceString();

 

It would be more than gratefull, if somebody could tell me, what has gone wrong and what do I have to fix?

Sounds like the class PriceFormatter.php is not loaded yet. Are you sure you added this (correctly perhaps?) to includes/application_top.php:

After (around line 259):

// include currencies class and create an instance
 require(DIR_WS_CLASSES . 'currencies.php');
 $currencies = new currencies();

Add:

// BOF qpbpp
 // include the price formatter classes for the price breaks contribution
 require(DIR_WS_CLASSES . 'PriceFormatter.php');
 $pf = new PriceFormatter;
 require(DIR_WS_CLASSES . 'PriceFormatterStore.php');
 $pfs = new PriceFormatterStore;
// EOF qpbpp

Share this post


Link to post
Share on other sites

Is there a way to implement this Price break module to the latest Easypopulate (v2.76g).

I tried finding the field name in phpAdmin and came across "products_price_break" and looks like it contains some of the required values (products_price_break_id products_id products_price products_qty) but to no avail on exporting them since it appears they share the same name with the original fields? Any tips appreciated. Thanks.

Share this post


Link to post
Share on other sites

Hi guys,

 

i have installed this but now sure how to update the settings in admin panel and hope you guys can advise.

 

1 - where can i set the percentange for each level ? currently it shows 0% - 75% - 50%.... etc.. which was done defined by me.. where can i change this ?

 

2 - what is the categories name for ? i dun see anywhere to change the setting for each categories.. when i click on it, it just allow me to update the name of the category

 

3 - what is the first textfield for in the product management page ?? i know the second textfield is for number of items right ?

 

please advise how i can update this accordingly.. thank you very much..

Share this post


Link to post
Share on other sites

open catalog/includes/classes/shopping_cart.php

 

find this line( file includes total 3 same line ): $pf = new PriceFormatter;

 

below add this line for each : $pfs = new PriceFormatterStore;

 

-------------------------------

 

this worked for me

Share this post


Link to post
Share on other sites

Hello,

Im having a problem with this module, Everything is installed ok now, but i cannot update or delete a price break.

 

Anyone able to point out where i can look to resolve 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

×