Jump to content
jpweber

Quantity Price Breaks

Recommended Posts

I am getting the following error when I CONFIRM ORDER at checkout ...

 

Fatal error: Call to a member function call_api() on a non-object in /home/dpmatis/public_html/shopcart1/checkout_process.php on line 127

 

it is pointing to the line

 

$checkout_result = $buysafe_module->call_api('SetShoppingCartCheckout', $checkout_params);

 

I don't believe I have the buysafe module installed unless it is part of the original install process but I do see that this same line of code is in the original install also???

 

Has anyone come across this error or know what the cause it and how to correct it?

Share this post


Link to post
Share on other sites
Then when I use the supplied code I get this message in the store:

 

Fatal error: Call to undefined function: calculate_price() in /includes/classes/shopping_cart.php on line 310

That is because in RC1 the tep_add_tax was replaced with the calculate_price() function (new) in the class currencies.

 

You can either use the old code in those places (compare it with a backup of yours) but upgrading that particular issue is not a big deal either. If you download the RC2a version of osC you will find the upgrade instructions from RC1 in the directory extras.

 

The changes for that are only needed in 8 files. Alternatively you can download contribution #6654 for copy and paste instructions in those files but then you need to be careful which parts to copy and paste. Use the upgrade-22rc1.html file to recognize what to copy and paste.

Share this post


Link to post
Share on other sites
I am getting the following error when I CONFIRM ORDER at checkout ...

 

Fatal error: Call to a member function call_api() on a non-object in /home/dpmatis/public_html/shopcart1/checkout_process.php on line 127

 

it is pointing to the line

 

$checkout_result = $buysafe_module->call_api('SetShoppingCartCheckout', $checkout_params);

 

I don't believe I have the buysafe module installed unless it is part of the original install process but I do see that this same line of code is in the original install also???

 

Has anyone come across this error or know what the cause it and how to correct it?

It clearly has to do with the fact that in the $buy_safe_module (whatever file that might be) the function call_api is not present. However, this is not part of the QPBPP code...

Share this post


Link to post
Share on other sites

I need to use getPricingString instead of getPriceStringShort (from PriceFormatter.php) in advanced_search_results.php

 

How do I display pricing in advanced_search_results.php using getPriceString instead of getPriceStringShort ?

 

I know they are both in the PriceFormatter.php and that products_info.php uses getPriceString but I cannot located where advanced_search_results.php is using getPriceStringShort to display pricing when a part is searched.

 

Any help will be appreciated.

 

Thanks ... Dan

Share this post


Link to post
Share on other sites
I need to use getPricingString instead of getPriceStringShort (from PriceFormatter.php) in advanced_search_results.php

 

How do I display pricing in advanced_search_results.php using getPriceString instead of getPriceStringShort ?

 

I know they are both in the PriceFormatter.php and that products_info.php uses getPriceString but I cannot located where advanced_search_results.php is using getPriceStringShort to display pricing when a part is searched.

 

Any help will be appreciated.

 

Thanks ... Dan

 

FOUND IT !!! The pricing is formatted in /includes/modules/product_listing.php

 

You can change the function getPriceStringShort to getPriceString and then your site will display column pricing on the advanced_search_results.php page

Share this post


Link to post
Share on other sites

How do you enforce a minimum quantity the customer can purchase?

 

In some cases the items is to cheap to sell only 1 piece but can be sold in multiples of 1 above the minimum buy.

 

I have created column pricing for all items with the minimum I want to sell as the first column (qty & price).

 

I do not want the customer to be able to purchase less than minimum quantity.

 

Therefore I want customer to be required to take 1st column quantity as minimum.

 

Does QPBPP have something to facilitate this or How can I acheive this behavior?

 

Thanks ... Dan

Share this post


Link to post
Share on other sites

Hi!

 

I love the contrib, it works like a charm!

 

However, is there a way to show the customers that a discount has been given? And to have that message show in the shopping_cart.php? If possible a message stating per product if and how much discount has been given.

 

Thanks in advance!

Share this post


Link to post
Share on other sites
How do you enforce a minimum quantity the customer can purchase?

 

In some cases the items is to cheap to sell only 1 piece but can be sold in multiples of 1 above the minimum buy.

 

I have created column pricing for all items with the minimum I want to sell as the first column (qty & price).

 

I do not want the customer to be able to purchase less than minimum quantity.

 

Therefore I want customer to be required to take 1st column quantity as minimum.

 

Does QPBPP have something to facilitate this or How can I acheive this behavior?

It is not in the regular QPBPP (yet?) but it has been added to the QPBPP for SPPC contribution. Most of the code (apart from on admin/categories.php) for the minimum quantity can be copied from that contribution to use in the the regular QPBPP contribution IMO.

Share this post


Link to post
Share on other sites

Hi there,

 

I've successfully installed this fantastic contribution (version 1.3.5 ) and it works very nicely but i need to install a qty attribute compatible with this contribution. Does anyone know which addon can i use? or which code to add to get Qty attribute?

 

Thank you for your help.

Regards. :)

Share this post


Link to post
Share on other sites

Using the PriceFormatter, I would like to show the percentage discount from the MSRP price instead of the original price for a given quantity in the respective "Your savings" boxes. I have the MSRP module installed and working on the site/product_info.php page and all I need to do (I think) is use the getDiscountSaving function with the products_msrp, $this->thePrice to show the savings for savings on a single item and products_msrp, $price_break['products_price'] for quantity discounts savings off MSRP in the PriceFormatter.

 

The problem is that I can't figure out how to add the products_msrp from the products table to the PriceFormatter so that I can call it in the two places I want to use the getDiscountSaving function to show the total savings off the MSRP.

 

Here is the code I think will work if I can get some help to define the msrp price in the PriceFormatter.

      // Begin saving calculation
     $lc_text .= '<tr valign="top"><td width="120" align="center" class="pricebox">Your savings</td>';
     if (true == $this->hasSpecialPrice) {
       $lc_text .= '<td align="center" class="pricebox">'
       . $this->getDiscountSaving($this->thePrice, $this->specialPrice)
       .'</td>';
     } else {
[b]// figure savings off MSRP for single item order[/b]
       $lc_text .= '<td align="center" class="pricebox">'
       . $this->getDiscountSaving([b]products_msrp[/b], $this->thePrice)
       .'</td>';
     }
[b]// figure savings off MSRP for quantity discounts[/b]
     foreach($this->price_breaks as $price_break) {
       $lc_text .= '<td align="center" width="50" class="pricebox">'
       . $this->getDiscountSaving([b]products_msrp[/b], $price_break['products_price'])
       .'</td>';
     }
     $lc_text .= '</tr></table></td></tr></table>';

Any help with this is greatly appreciated.

Share this post


Link to post
Share on other sites
The problem is that I can't figure out how to add the products_msrp from the products table to the PriceFormatter so that I can call it in the two places I want to use the getDiscountSaving function to show the total savings off the MSRP.

 

I tried one last search to find a solution and found it here --> http://forums.oscommerce.com/index.php?sho...p;#entry1392970

Share this post


Link to post
Share on other sites

I have just installed this mod, i have an error when I trij to ad 1 product.

 

Fatal error: Call to a member function getPriceFormatterData() on a non-object in /home/bajafl01/domains/bajaflightcases.nl/public_html/catalog/admin/includes/classes/PriceFormatter.php on line 40

 

Where should I look for the error?

Share this post


Link to post
Share on other sites
I have just installed this mod, i have an error when I trij to ad 1 product.

 

Fatal error: Call to a member function getPriceFormatterData() on a non-object in /home/bajafl01/domains/bajaflightcases.nl/public_html/catalog/admin/includes/classes/PriceFormatter.php on line 40

 

Where should I look for the error?

 

 

Probleme is solved, there was an upload error.

Share this post


Link to post
Share on other sites
I have just installed this mod, i have an error when I trij to ad 1 product.

 

Fatal error: Call to a member function getPriceFormatterData() on a non-object in /home/bajafl01/domains/bajaflightcases.nl/public_html/catalog/admin/includes/classes/PriceFormatter.php on line 40

 

Where should I look for the error?

 

I still have an error, when I add a product to my cart I get this error:

 

Fatal error: Call to a member function getPriceFormatterData() on a non-object in /home/bajafl01/domains/bajaflightcases.nl/public_html/catalog/includes/classes/shopping_cart.php on line 365

 

line 365:

 

if ($products = $pfs->getPriceFormatterData($products_id)) {

 

I hope someone can help me

Share this post


Link to post
Share on other sites

The adress of the website is: www.bajaflightcases.nl, YOu don't have to make an account to get the error. Just add something to you shopping cart.

Share this post


Link to post
Share on other sites

Hi,

 

I'm experiencing a bit of a problem with adding different quantities adding up to me price break. For example, i have setup a price break at a quantity of 5 where a person will get a 10% discount. If i now go add 2 fishing lures in red and 3 fishing lures in green(same product id, but with an attribute) it doesn't reflect my price discount in my shopping cart. I'm sure this is possible, but for some reason I can't get it to happen.

 

Can someone please help me with this.

 

If you would like to have a look at what I mean, please take a look at my site and go to fishing lures

 

http://www.mcgrafix.com/ibuy

 

Thanks

Edited by badbrad

Share this post


Link to post
Share on other sites
Fatal error: Call to a member function getPriceFormatterData() on a non-object in /home/bajafl01/domains/bajaflightcases.nl/public_html/catalog/includes/classes/shopping_cart.php on line 365

Sounds like something is missing in application_top.php around line 260-269:

// include currencies class and create an instance
 require(DIR_WS_CLASSES . 'currencies.php');
 $currencies = new currencies();
// 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

The object $pfs is instantiated ("loaded") there so if the error says it is a non-object this would be my first place to look for a mistake in the code.

Share this post


Link to post
Share on other sites
I'm experiencing a bit of a problem with adding different quantities adding up to me price break. For example, i have setup a price break at a quantity of 5 where a person will get a 10% discount. If i now go add 2 fishing lures in red and 3 fishing lures in green(same product id, but with an attribute) it doesn't reflect my price discount in my shopping cart. I'm sure this is possible, but for some reason I can't get it to happen.

It is has been a while since I worked on that code but I think that is the normal behaviour of the latest versions. In one of the versions of this contribution the discount_category_id would be set to "p1233" when there was no discount category set up for that product and if it was something like "dc3" for discount category 3. Then when all products with the same discount_category_id would be grouped the products with attributes would have the discount category id p1233 so would be taken together for the price break.

 

That was changed by one of the people who worked on this contribution. Now it uses nothing for a discount category id if there is none for a product and the discount category id for discount category id.

 

I don't think it would be really hard to add the p# and dc# back in the code if you can find the "old" version (more of an addon for this addon) but the simplest solution would be to set up a discount category for this product alone.

Share this post


Link to post
Share on other sites
Sounds like something is missing in application_top.php around line 260-269:

// include currencies class and create an instance
 require(DIR_WS_CLASSES . 'currencies.php');
 $currencies = new currencies();
// 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

The object $pfs is instantiated ("loaded") there so if the error says it is a non-object this would be my first place to look for a mistake in the code.

 

I cheked the file, but those line are include.

 

http://www.bajaflightcases.nl/application_top.zip

 

Maybe, the script is in conflict with my zonesx mod

 

http://addons.oscommerce.com/info/1490

 

But this is just a very simpele mod

Edited by J.S. Coolen

Share this post


Link to post
Share on other sites
I cheked the file, but those line are include.

Indeed.

Maybe, the script is in conflict with my zonesx mod

 

http://addons.oscommerce.com/info/1490

 

But this is just a very simpele mod

As you say, unlikely.

 

Did you add $pfs to the globals in the function calculate() in includes/classes/shopping_cart.php?

	function calculate() {
  global $currencies, $languages_id, $pfs; // for qpbpp added: $languages_id, $pfs

Share this post


Link to post
Share on other sites

My function is complety different:

 

http://www.bajaflightcases.nl/shopping_cart.zip

 

	function calculate() {
  $this->total = 0;
  $this->weight = 0;
  if (!is_array($this->contents)) return 0;
// BOF qpbpp
	$discount_category_quantity = array(); // calculates no of items per discount category in shopping basket
  foreach ($this->contents as $products_id => $contents_array) {
	  if(tep_not_null($contents_array['discount_categories_id'])) {
		if (!isset($discount_category_quantity[$contents_array['discount_categories_id']])) {
			$discount_category_quantity[$contents_array['discount_categories_id']] = $contents_array['qty'];
		} else {
			$discount_category_quantity[$contents_array['discount_categories_id']] += $contents_array['qty'];
		}
	  }
  } // end foreach

  $pf = new PriceFormatter;
// EOF qpbpp

  reset($this->contents);
  while (list($products_id, ) = each($this->contents)) {
	$qty = $this->contents[$products_id]['qty'];
// BOF qpbpp		
  if (tep_not_null($this->contents[$products_id]['discount_categories_id'])) {
	$nof_items_in_cart_same_cat = $discount_category_quantity[$this->contents[$products_id]['discount_categories_id']];
	$nof_other_items_in_cart_same_cat = $nof_items_in_cart_same_cat - $qty;
  } else {
	  $nof_other_items_in_cart_same_cat = 0;
  }
// EOF qpbpp
// products price
// BOF qpbpp
   $pf->loadProduct($products_id, $languages_id);
	if ($product = $pfs->getPriceFormatterData($products_id)) {
	  $prid = $product['products_id'];
	  $products_tax = tep_get_tax_rate($product['products_tax_class_id']);
	  $products_price = $pf->computePrice($qty, $nof_other_items_in_cart_same_cat);
// EOF qpbpp
	  $products_weight = $product['products_weight'];
// BOF qpbpp
	 /* $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'];
	  } */
// EOF qpbpp
	  $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 += $qty * tep_add_tax($attribute_price['options_values_price'], $products_tax);
		} else {
		  $this->total -= $qty * tep_add_tax($attribute_price['options_values_price'], $products_tax);
		}
	  }
	}
  }
}

Share this post


Link to post
Share on other sites
My function is complety different:

So you are working with an old version of osC. Why do you think you shouldn't add those lines in there? You will also need to add that new function in the class currencies ( calculate_price() ) because the QPBPP contribution does use the updated version for osC.

	function calculate() {
  $this->total = 0;
  $this->weight = 0;
	  global $currencies, $languages_id, $pfs; // for qpbpp added: $languages_id, $pfs

Share this post


Link to post
Share on other sites

I downloaded the newste version, from the dutch site. MAy it went wrong with another mod.

 

I have another mod installed, with makes a limited of sending artikels heavyer then 30 kilo's.

 

So where do I have to ad this lines? To Shopping_cart.php?

 

function calculate() {

$this->total = 0;

$this->weight = 0;

global $currencies, $languages_id, $pfs; // for qpbpp added: $languages_id, $pfs

 

to

Share this post


Link to post
Share on other sites
It is has been a while since I worked on that code but I think that is the normal behaviour of the latest versions. In one of the versions of this contribution the discount_category_id would be set to "p1233" when there was no discount category set up for that product and if it was something like "dc3" for discount category 3. Then when all products with the same discount_category_id would be grouped the products with attributes would have the discount category id p1233 so would be taken together for the price break.

 

That was changed by one of the people who worked on this contribution. Now it uses nothing for a discount category id if there is none for a product and the discount category id for discount category id.

 

I don't think it would be really hard to add the p# and dc# back in the code if you can find the "old" version (more of an addon for this addon) but the simplest solution would be to set up a discount category for this product alone.

 

How would I be able to setup a discount category for this product alone? I have already done so in the admin area. No other products are under this price break category?

Share this post


Link to post
Share on other sites
How would I be able to setup a discount category for this product alone? I have already done so in the admin area. No other products are under this price break category?

Add a discount category and only add that product to that particular price break category. With products assigned to a price break categories the attributes issue doesn't exist.

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

×