Jump to content
  • Checkout
  • Login
  • Get in touch


The e-commerce.

Quantity Price Breaks / Blocks


Recommended Posts



I am using the Quantity Price Breaks Module (Version 1.1) but am having 1 issue with it.


Basically, the quantity breaks work excellent and I have modified it to work with multiple tiers (wholesale, retail, etc.). Everything works fine except the quantity blocks are not being enforced. Here is the code where I think the issue is:


In PriceFormatter.php, this code works correctly and returns the proper "adjusted" quantity according to the breaks:


  function adjustQty($qty) {
// Force QTY_BLOCKS granularity
$qb = $this->getQtyBlocks();
if ($qty < 1)
 $qty = 1;

if ($qb >= 1)
 if ($qty < $qb)
	 $qty = $qb;

 if (($qty % $qb) != 0)
	 $qty += ($qb - ($qty % $qb));
return $qty;


However, when it is called by the shopping_cart.php class it does not work and returns nothing:


     function add_cart($products_id, $qty = '1', $attributes = '', $notify = true) {
     global $new_products_id_in_cart, $customer_id, $customer_status_for_discount;

     $pf = new PriceFormatter;
     $pf->loadProduct($products_id, $language_id, $customer_status_for_discount);
// problem is here!!
     $qty = $pf->adjustQty($qty);
// ??
     $products_id = tep_get_uprid($products_id, $attributes);
     if ($notify == true) {
       $new_products_id_in_cart = $products_id;

     if ($this->in_cart($products_id)) {
       $this->update_quantity($products_id, $qty, $attributes);
     } else {
       if ($qty == '') $qty = '1'; // if no quantity is supplied, then add '1' to the customers basket


When I echo out the $qty in the last bit of code, it gives me whatever was in the quantity box of the shopping cart form, not the updated qty from the adjustQty function.


Any ideas?




Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...