Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Quantity Price Breaks


jpweber

Recommended Posts

I've posted this in General Support as well because I have to find an answer for this one and fast... I sure hope someone can help with this problem. I've just finished installing a new copy of osCommerce ver.2.3.1 with the Add-On "QPBPP for 2.3.1". The install seemed to go flawlessly but whenever something is added to the shopping cart this message appears, despite the stock having been entered as available immediately:

 

"Products marked with *** don't exist in desired quantity in our stock.

You can buy them anyway and check the quantity we have in stock for immediate deliver in the checkout process."

 

Does anyone have any idea what's making this happen. Many thanks in advance for any/all help...

 

Cheers,

Doug

Link to comment
Share on other sites

  • 2 weeks later...

Hi

 

I have a problem with the price break I think there is a bug.

If I change the langauge in the shopping_cart.php it does not change to the right language unless you refresh the page a second time.

 

So I search for the problem and found in PriceFromatter.php this line:

function loadProduct($product_id, $language_id = 1, $listing = NULL, $price_breaks_from_listing = NULL) {
   global $pfs;

 

So I tried this:

function loadProduct($product_id, $language_id = 1, $listing = NULL, $price_breaks_from_listing = NULL) {
   global $pfs;
$language_id=$GLOBALS["languages_id"];

 

But then it seems just to work for the dfault language.

 

So does anybody know how to fix this?

 

Thanks in advance

Link to comment
Share on other sites

Sorry but my site is not yet finished.

 

But I found the problem. Just do the above and in application_top.php you need to iclude the PriceFomratter.php and the PriceFormatterStore.php after the language includes and not after the currencies includes.

Link to comment
Share on other sites

  • 2 weeks later...

Hi

 

I'm editign my files to install this addon, but got to the modification ot the application_top.php

 

At the point the instruction says

Find (around line 343):

 $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']);

 

but mines reads

 

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

 

Has anyone got the work around to this, im using a pretty much unmodified version of osCommerce v2.3.1 only some layout and appearance changes have been made to the code. And a batch admin addon used.

Edited by terlan
Link to comment
Share on other sites

As to the above.

I realised i just have to replace the +1 in the original line of code with + $HTTP_POST_VARS['cart_quantity']

 

 

dont update addons while feeling tired lol bad things happen

Link to comment
Share on other sites

  • 2 weeks later...
  • 3 weeks later...
I've posted this in General Support as well because I have to find an answer for this one and fast... I sure hope someone can help with this problem. I've just finished installing a new copy of osCommerce ver.2.3.1 with the Add-On "QPBPP for 2.3.1". The install seemed to go flawlessly but whenever something is added to the shopping cart this message appears, despite the stock having been entered as available immediately: "Products marked with *** don't exist in desired quantity in our stock. You can buy them anyway and check the quantity we have in stock for immediate deliver in the checkout process." Does anyone have any idea what's making this happen. Many thanks in advance for any/all help... Cheers, Doug
Doug, I'm a little confused. The install.html for "QPBPP for 2.3.1" states: "This document describes updates to files based on the full package dated July 22, 2009 (version 1.3.6 / osC 2.2 RC2a)" Does that mean that "QPBPP for 2.3.1" is not a Full Package or can I just follow the install instructions to install this on osc 2.3.1 with no prior install of QPBPP? Thanks for the help Kevin

Thanks

 

Kevin

Link to comment
Share on other sites

Hi Kevin,

 

QPBPP v2.3.1 is definitely a full package, go ahead and install it as written, it's great. My problems occured because of conflict's with another add-on and some lines of code which had to be merged. QPBPP works great, no problems whatsover for a plain install though. Just back everything up first so in the event of problem you can resolve it quickly without any grief. Hope this helps...

 

Cheers,

Doug

Link to comment
Share on other sites

Hi Kevin,

 

QPBPP v2.3.1 is definitely a full package, go ahead and install it as written, it's great. My problems occured because of conflict's with another add-on and some lines of code which had to be merged. QPBPP works great, no problems whatsover for a plain install though. Just back everything up first so in the event of problem you can resolve it quickly without any grief. Hope this helps...

 

Cheers,

Doug

 

Thanks for the help Doug.

Thanks

 

Kevin

Link to comment
Share on other sites

  • 1 month later...

i installed the version from 5 Jun 2011 (yansfung)

is it the most recent version?

in the install.html is stated that \catalog\includes\modules\product_listing.php should be changed, but this is not explained in the manual installation instructions

comparing the files, there is a lot off difference, also in a lot of parts that are not indicated as changed (not flagged)

in the file of qpbpp is stated that it is from version qpbpp1.3.3, while this should be 2.0 I think

so do i have to treat it?

Edited by univer
Link to comment
Share on other sites

  • 2 weeks later...

Hi everybody,

I have the same thing that UNIVER, for the file \catalog\includes\modules\product_listing.php.

the problem is that all <table> are replaced by <div> and some variables have changed.

Is there anybody that has this file ?

 

I use the french version of oscommerce 2.3.1

In advance thank

Fabien

 

PS: I can't update my profile? why ? I live in Belgium.

A+, Fabien

Link to comment
Share on other sites

G'Day

Is there a way of removing the "Your Savings" line from the box and just have the pricing?

Ray

You can change/remove that text in the language file "product-info.php".

 

Dan

Link to comment
Share on other sites

G'Day Dan

Thank you for your reply

I change the text OK, but how do you remove the complete line so no test or % saving is shown?

Regards

Ray

Edited by GR8M8
Link to comment
Share on other sites

G'Day Dan

Thank you for your reply

I change the text OK, but how do you remove the complete line so no test or % saving is shown?

Regards

Ray

That's a bit more complicated but if you want to play around with it you'll find that code in the PriceFormatter.php file in your includes/classes folder. The code will be towards the bottom of the file...maybe 3/4s of the way down the file and is commented.

 

Dan

Link to comment
Share on other sites

Dan

Thank you

You were correct

In PriceFormatter.php line 256

commented out the following and it worked perfectly

 

// Begin saving calculation

/* $lc_text .= '<tr valign="top"><td width="120" class="infoBoxContents">' . TEXT_SAVINGS . '</td>';

if (true == $this->hasSpecialPrice) {

$lc_text .= '<td align="center" class="infoBoxContents">'

. $this->getDiscountSaving($this->thePrice, $this->specialPrice)

.'</td>';

} else {

$lc_text .= '<td align="center" class="infoBoxContents">- </td>';

}

foreach($this->price_breaks as $price_break) {

$lc_text .= '<td align="center" width="50" class="infoBoxContents">'

. $this->getDiscountSaving($this->thePrice, $price_break['products_price'])

.'</td>';

}

*/

 

Big Thank you again

Ray

Link to comment
Share on other sites

Hello everyone,

 

I´m was searching for a contribution wich gives me following abilitys:

 

Example:

 

I sell pencils

A customer has to buy minimum 500 pencils.

But he can also buy 1000 or 1500 pencils (listed in a dropdown list -> Product attributes)

If he buys 500 pencils, one pencil costs 0,35 Eur

If he buys 1000 0,30Eur

If 1500 0,20Eur

 

Customer can choose in the dropdown list and if he clicks a "Refresh" Button, the whole Price is shown as Product Price -> 175 Eur (500*0,35Eur= 175 Eur.)

In another dropdown list (also defind over Product attributes) he can choose if he wants to have a pencil with his logo printed on it.

If he wants his logo on it, there will be an additional price of 0,12Eur per pencil. If he chooses this, the Price should be : 235 Eur (500+0,12Eur).

 

Is there any contribution providing this abilitys??

 

Thanks in advance

Link to comment
Share on other sites

Hello everyone,

I have a problem to forcing the blocks granularity.

If I set the qty block (e.g. 50) and then I change the quantity value in the product_info page (e.g. 1), when I add che article to the shopping cart the quantity is not forced to 50 but remains equal to 1, then if update the cart (by update cart button) the article quantity is update to 50. This only happens the first time that I add the article to the shopping cart, if I repeat the same operation a second time for the same article (e.g. I change the quantity value in the product_info page from 50 to 2) the quantity is forced to the minimum quantity of 50. Someone can Help me?

In shopping_cart.php and PriceFormatter.php all seems ok.

Thank you

 

FMAX

 

Hello Friends!

Is there any solution for this? I have the same problem :(

 

I have checked the installation 4 times, and everything looks good. No errors or anything!

When adding a product from product_info page the quantity block forcing seems not working, but when the quantity is refreshed at the shopping cart the forcing is OK! Any solution? I am totally down :((

It is so important for me, please help!

Link to comment
Share on other sites

I think at the application_top.php could be the clue, but everything seems ok:

 

 

 

// customer adds a product from the products page

case 'add_product' : if (isset($HTTP_POST_VARS['products_id']) && is_numeric($HTTP_POST_VARS['products_id'])) {

//BOF qpbpp

//$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']);

//EOF qpbpp

 

// denuz text attr

tep_db_query("delete from customers_basket_text_attributes where products_id = " . $HTTP_POST_VARS['products_id'] . " and session_id = '" . $osCsid . "'");

$attr_query = tep_db_query("select * from products_text_attributes_enabled where products_id = " . $HTTP_POST_VARS['products_id']);

while ($attr = tep_db_fetch_array($attr_query)) {

tep_db_query("insert into customers_basket_text_attributes values ('$osCsid', " . $HTTP_POST_VARS['products_id'] . ", " . $attr['products_text_attributes_id'] . ", '" . addslashes($HTTP_POST_VARS['products_text_attributes_' . $attr['products_text_attributes_id']]) . "');");

}

// eof denuz text attr

}

tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters)));

break;

Link to comment
Share on other sites

  • 2 weeks later...

Well. Finally figured it out. For some reason the $qty was not calculated to the nearest products_qty_blocks in the adding to cart. Therefore I rewrote the script slightly. I already know it wasnt working because of another contribution because the contribution worked like a charm on a fresh installation but I have no idea which contribution caused this error.

 

Anyone with the same problems try in includes/classes/shopping_cart.php to change:

 

// BOF qpbpp
	  if ($this->in_cart($products_id_string)) {
		$this->update_quantity($products_id_string, $qty, $attributes, $discount_category);
	  } else {
		$this->contents[$products_id_string] = array('qty' => (int)$qty, 'discount_categories_id' => $discount_category);
// EOF qpbpp

 

into:

 

// BOF qpbpp
	  if ($this->in_cart($products_id_string)) {
		$this->update_quantity($products_id_string, $qty, $attributes, $product_info['discount_categories_id']);
	  } else {
// Berekening van aantal producten gaat niet goed zonder onderstaande code. Deze berekend de dichstbijzijnde minimale bundel afname bij het toevoegen van een product. Er word naar beneden afgerond.
$min_order_query = tep_db_query("select p.products_qty_blocks as min_quant FROM " . TABLE_PRODUCTS . " p where p.products_id = '".$products_id_string."'");
while ($min_order = tep_db_fetch_array($min_order_query))  
{
  if ($qty < $min_order['min_quant'])
  {
	  $qty = $min_order['min_quant'];
  }
  if ($qty > $min_order['min_quant'])
  {	
	  $qty = ($qty - ($qty % $min_order['min_quant']));
  }
}

		$this->contents[$products_id_string] = array('qty' => (int)$qty, 'discount_categories_id' => $product_info['discount_categories_id']);
// EOF qpbpp

 

It will however round the final $qty down to the nearest products_qty_blocks rather then up. Math was not my best subject and I couldnt figure out how to do that.

 

After searching up&down the hole internet and spending days and weeks for find the soulition I did it! Here is! THANK YOU, YOU ARE THE GUY MAN!

Link to comment
Share on other sites

  • 1 month later...

I have installed Quantity Price Breaks Per Product (QPBPP) for osC 2.3.1 and in the admin side i am not able to see the link from where i can add the price breaks for each products.

I did this mannually, it didn't show me any error.

 

I am just able to set the configuration for beaks and discount category and see the products by show products button.

 

what is wrong

can you please guide me

Thanks and regards

Edited by IAnil
Link to comment
Share on other sites

I have installed Quantity Price Breaks Per Product (QPBPP) for osC 2.3.1 and in the admin side i am not able to see the link from where i can add the price breaks for each products.

I did this mannually, it didn't show me any error.

 

I am just able to set the configuration for beaks and discount category and see the products by show products button.

 

what is wrong

can you please guide me

Thanks and regards

Link to comment
Share on other sites

  • 4 weeks later...

Hoping someone here can help me finish off this modification of QPBB

 

I am running 2.3.1 and found the version for 2.3.1 actually uses a very old version of product_listing.php so I set out to get the newer (better looking version) working but have hit a snag and hope someone in here can help

// BOF qpbpp
   $no_of_listings = tep_db_num_rows($listing_query);
   while ($_listing = tep_db_fetch_array($listing_query)) {
 $_listing['discount_categories_id'] = NULL;
   $listing[] = $_listing;
   $list_of_prdct_ids[] = $_listing['products_id'];
  }
  $list_of_prdct_ids = array_unique($list_of_prdct_ids);
   $price_breaks_query = tep_db_query("select products_id, products_special_price_2, products_qty from  " . TABLE_PRODUCTS . " where products_id in (" . implode(',', $list_of_prdct_ids) . ") order by products_id, products_qty");
   while ($price_break = tep_db_fetch_array($price_breaks_query)) {
	  $price_breaks_array[$price_break['products_id']][] = array('products_price' => $price_break['products_special_price_2'], 'products_qty' => $price_break['products_qty']);
   }
   $discount_category_query = tep_db_query("select p.products_id, p.products_quantity, p.products_weight, discount_categories_id from " . TABLE_PRODUCTS ." p left join " . TABLE_PRODUCTS_TO_DISCOUNT_CATEGORIES . " using(products_id) where p.products_id in (" . implode(',', $list_of_prdct_ids) . ")");
  while ($dc_array = tep_db_fetch_array($discount_category_query)) {
 $discount_categories[] = array ('products_id' => $dc_array['products_id'], 'products_quantity' => $dc_array['products_quantity'], 'products_weight' => $dc_array['products_weight'], 'discount_categories_id' => $dc_array['discount_categories_id']);
  }
   for ($x = 0; $x < $no_of_listings; $x++) {
// add discount categories to the listing array
  if(!empty($discount_categories)) {
    for ($i = 0; $i < count($discount_categories); $i++) {
	 if ($listing[$x]['products_id'] == $discount_categories[$i]['products_id'] ) {
	  $listing[$x]['discount_categories_id'] = $discount_categories[$i]['discount_categories_id'];
	  $listing[$x]['products_quantity'] = $discount_categories[$i]['products_quantity'];
	  $listing[$x]['products_weight'] = $discount_categories[$i]['products_weight'];
    }
   }
 } // end if(!empty($discount_categories)
  }
//    while ($listing = tep_db_fetch_array($listing_query)) { (was original code)
for ($x = 0; $x < $no_of_listings; $x++) {
  $rows++;
  $prod_list_contents .= '	  <tr>';
  for ($col=0, $n=sizeof($column_list); $col<$n; $col++) {
    switch ($column_list[$col]) {
	  case 'PRODUCT_LIST_MODEL':
	    $prod_list_contents .= '	    <td>' . $listing[$x]['products_model'] . '</td>';
	    break;
	  case 'PRODUCT_LIST_NAME':
	    if (isset($HTTP_GET_VARS['manufacturers_id']) && tep_not_null($HTTP_GET_VARS['manufacturers_id'])) {
		  $prod_list_contents .= '	    <td><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></td>';
	    } else {
		  $prod_list_contents .= '	    <td align="center"><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $listing[$x]['products_id']) . '">' . $listing[$x]['products_name'] . '</a></td>';
	    }
	    break;
	  case 'PRODUCT_LIST_MANUFACTURER':
	    $prod_list_contents .= '	    <td align="center"><a href="' . tep_href_link(FILENAME_DEFAULT, 'manufacturers_id=' . $listing[$x]['manufacturers_id']) . '">' . $listing[$x]['manufacturers_name'] . '</a></td>';
	    break;
	  case 'PRODUCT_LIST_PRICE':
	    if (tep_not_null($listing[$x]['specials_new_products_price'])) {
		  $prod_list_contents .= '	    <td align="right"><del>' .  $currencies->display_price($listing[$x]['products_id'], tep_get_tax_rate($listing[$x]['products_tax_class_id'])) . '</del>  <span class="productSpecialPrice">' . $currencies->display_price($listing[$x]['specials_new_products_price'], tep_get_tax_rate($listing[$x]['products_tax_class_id'])) . '</span></td>';
	    } else {
		  $prod_list_contents .= '	    <td align="right">' . $currencies->display_price($price_break['products_price'], tep_get_tax_rate($listing[$x]['products_tax_class_id'])) . '</td>';
	    }
	    break;
	  case 'PRODUCT_LIST_QUANTITY':
	    $prod_list_contents .= '	    <td align="right">' . $listing[$x]['products_quantity'] . '</td>';
	    break;
	  case 'PRODUCT_LIST_WEIGHT':
	    $prod_list_contents .= '	    <td align="right">' . $listing[$x]['products_weight'] . '</td>';
	    break;
	  case 'PRODUCT_LIST_IMAGE':
	    if (isset($HTTP_GET_VARS['manufacturers_id'])  && tep_not_null($HTTP_GET_VARS['manufacturers_id'])) {
		  $prod_list_contents .= '	    <td align="left"><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></td>';
	    } else {
		  $prod_list_contents .= '	    <td align="center"><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></td>';
	    }
	    break;
	  case 'PRODUCT_LIST_BUY_NOW':
	    $prod_list_contents .= '	    <td align="center"> ' . tep_draw_input_field('cart_quantity', $listing[$x]['products_qty'], 'size="6"') . tep_draw_hidden_field('products_id', $product_info['products_id']) . tep_draw_button(IMAGE_BUTTON_BUY_NOW, 'cart', tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action', 'products_id')) . 'action=buy_now&products_id=' . $listing[$x]['products_id'])) . '</td>';
	    break;

 

The problem is the array $price_break does not appear to be carrying down to the case: PRODUCT_LIST_PRICE if I use $listing[$x]['product_price'] it shows the normal price?

 

The part in case: PRODUCT_LIST_BUY_NOW ihas been changed to add qty box (but need to get it to action)

 

Anyone wanting to try this changed version must do a seach and replace for TABLE_PRODUCTS change to TABLE_PRODUCTS_PRICE_BREAK and products_special_price_2 change to products_price also change $price_break in case: PRODUCT_LIST_PRICE change to $listing[$x]

 

as I have modified this script to make use of and automated import that has brice breaks built in the feed.

 

 

If anyone can help solve the PRODUCT_LIST_PRICE problem i would be greatful.

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.

Guest
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...