Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Quantity Price Breaks


jpweber

Recommended Posts

That usually mean that you have forgotten to add the define for TABLE_PRODUCTS_PRICE_BREAK into includes/database_tables.php

Link to comment
Share on other sites

  • 3 weeks later...

I am having trouble with this QPBPP , made the changes necessary and all seems to be working, however, when I go to add more price breaks in it loses all the data, name of product etc. help, how can I stop this from happening... :)

Link to comment
Share on other sites

  • 2 months 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.

Thank you very much for your solution. In order to make it round up instead of Down replace this

$qty = ($qty - ($qty % $min_order['min_quant']));

with

$qty = (ceil($qty / $min_order['min_quant'])*$min_order['min_quant']);

Link to comment
Share on other sites

  • 2 months later...

I've added this contribution to my 2.3.3 oscommerce store but have a problem or two. I've got numerous other contributions installed along with this one. The plugin seems to work as expected, followed the install instructions and even compared the files provided to make sure it was right but I just can't seem to get the price break input boxes for the product in admin to appear on the edit product page. Neither can I see the actual price breaks on the product info page. It simply displays the default single price.

 

I've set up new discount categories (not entirely sure what they actually do tbh) and added products to this but when I go to edit the product and set the price blocks, there's no price break option on the product edit page. Can anyone shed any light on this?

 

Is there any other price break contributions that will work with OSC 2.3.3 if this one is not the answer?

 

Hello osCommerce community,

 

I have integrated the extension in my shop (version 2.3.3.4).

Now I have a similar problem as freakystreak

The Admin is missing from the product table to Season prices / discount amount entered.

 

Does anyone have any advice? Must be made for additional changes to the latest version?

 

Sorry for my bad English.

 

Regards, Frank

Link to comment
Share on other sites

for oscommerce 2.3.1 dont use the instructions for the manual installation, there are many errors in this one.

The best way is to compare your files with those givens with the module, you should remplace all lines commented by "BOF qpbpp 2.0" search for it.

 

and finally open the file "discount_categories.php" delete all the code and copy the code bellow and everything should work fine...

 

<?php
/*
$Id: catalog/admin/discount_categories.php v1.0 2007/12/02
for a modification of Quantity Price Breaks Per Product (http://addons.oscommerce.com/info/1242)
parts used of Quick Price Updates (http://addons.oscommerce.com/info/122)

osCommerce, Open Source E-Commerce Solutions
http://www.oscommerce.com

Copyright (c) 2007 osCommerce

Released under the GNU General Public License
*/

require('includes/application_top.php');


if (isset($_GET['row_by_page'])) {
$row_by_page = (int)$_GET['row_by_page'];
}
if (isset($_GET['manufacturer'])) {
$manufacturer = (int)$_GET['manufacturer'];
}
if (isset($_GET['dcID']) && is_numeric($_GET['dcID'])) {
$dcID = (int)$_GET['dcID'];
} elseif (isset($_GET['dcID']) && $_GET['dcID'] == 'all') {
$dcID = 'all';
}
if (isset($_GET['cPath'])) {
$current_category_id = (int)$_GET['cPath'];
} else {
$current_category_id = 0;
}

// Displays the list of manufacturers
function manufacturers_list(){
	global $manufacturer;

	$manufacturers_query = tep_db_query("select m.manufacturers_id, m.manufacturers_name from " . TABLE_MANUFACTURERS . " m order by m.manufacturers_name ASC");
	$return_string = '<select name="manufacturer" onchange="this.form.submit();">';
	$return_string .= '<option value="' . 0 . '">' . TEXT_ALL_MANUFACTURERS . '</option>';
	while($manufacturers = tep_db_fetch_array($manufacturers_query)){
			$return_string .= '<option value="' . $manufacturers['manufacturers_id'] . '"';
			if($manufacturer && $manufacturers['manufacturers_id'] == $manufacturer) $return_string .= ' SELECTED';
			$return_string .= '>' . $manufacturers['manufacturers_name'] . '</option>';
	}
	$return_string .= '</select>';
	return $return_string;
}

function discount_categories_list() {
	global $dcID;

*****************************************************************
*****************************************************************
Complete file in the post above.

*****************************************************************
*****************************************************************

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

 

and THANKS for this module that works fine for me !

 

Thanks for this code!

With this "discount_categories.php" it appears correctly in 2.3.3.4

 

Thank you, Thank you :thumbsup:

Link to comment
Share on other sites

  • 1 month later...

Hello,

OsCommerce 2.3.1

 

I try to install QPBPP and MVS (Multi Vendor Sistem) My problem is in CLASSES\SHOPPING_CART.PHP

 

Originale code:

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

 

For QPBPP I need to replace with :

 

// BOF qpbpp 2.0
  $pf->loadProduct($products_id, $languages_id); // does query if necessary and adds to
  // PriceFormatterStore or gets info from it next
  if ($products = $pfs->getPriceFormatterData($products_id)) {
   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 - $this->contents[$products_id]['qty'];
    } else {
	  $nof_other_items_in_cart_same_cat = 0;
    }
	  $products_price = $pf->computePrice($this->contents[$products_id]['qty'], $nof_other_items_in_cart_same_cat);
// EOF qpbpp 2.0

 

But the code with Multi Vendor is :

 

    $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_length, p.products_width, p.products_height, p.products_ready_to_ship, p.products_tax_class_id, v.vendors_id, v.vendors_name from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_VENDORS . " v where p.products_id = '" . (int)$products_id . "' and pd.products_id = p.products_id and v.vendors_id = p.vendors_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'];


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

 

Someone can help me? I'd like to use QPBPP and MVS together.

Thanks for your help and sorry for my english

Link to comment
Share on other sites

  • 1 month later...

Hello osCommerce community,

 

I have integrated the extension in my shop (version 2.3.3.4).

Now I have a similar problem as freakystreak

The Admin is missing from the product table to Season prices / discount amount entered.

 

Does anyone have any advice? Must be made for additional changes to the latest version?

 

Sorry for my bad English.

 

Regards, Frank

I spent all morning adding this module to OSC 2.3.3.4 - manually editing all the files that needed to be changed according to the instructions, and I also don't see the part to edit the price breaks when editing a product.

 

Anyone solved this issue?

Link to comment
Share on other sites

  • 1 month later...

Would anyone have a 2.3.3.4 version of /includes/modules/product_listing.php that is suited to work with QPBPP_osc2.3.1_v2.0?

The version in the 2.3package is 2.2 era, and the instructions do not include any manual step instructions for that file, so I'm sort of stuck.

 

Thanks for the assistance.

-Dave

Link to comment
Share on other sites

Another question please, in application_top.php

 

My existing code is:

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

 

The instructions say find this :

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

 

and replace with:

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

 

Question is would the below line be a correct merge?? if not please help. Thx!

 

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

-Dave

Link to comment
Share on other sites

  • 2 weeks later...

Hallo users of this osc addon,

 

I'm new to osc so be mild. I am not a programmer so be double mild!

 

The version of osc I am using is 2.3.3.4, php 5.3 and linux hosting. I have SPPC + Hide products and categories working succesfully, thanks to joli1811.

 

Now I would like to find out if this is a addon I want to use. I have been reading like crazy, possibly too much and only have a fuzzy feeling what it is or does.

Can one of you give me some/a link(s) where I can see how this addon is being used/works? I would like to visualize it (better).

 

Can it be used with an addon called QTpro for SPPC also installed, working together or independent? (Some links showing any of this would make me very happy!)

 

I hope that my questions are not sounding stupid. I don't understand the 'inner workings' of osc 2.3.x.y. fully yet. Hopefully with some help from you guys and girls pointing me in the right direction I can create my site (as much as personally possible). The questions may have been covered already, I appreciate it if you can point me towards them

 

Thanks Community!,

 

Tivolimac

Let's build the Metaverse! May the Code be with you!

Link to comment
Share on other sites

  • 5 months later...

I have a question. Forgive me if it has already been answered.  I searched through this thread but found no relative info.   I have this contribution installed and it works very well.  However, I have found that while using discount categories to link duplicate products which have differing attributes it gets buggy.    what happens is this:     I add product A with attribute 1  to the cart,  then I add product A with attribute 2  to the cart.  All of this is done before logging in and it works fine.  The discount is applied to both versions of product A.  However, once I log in  this is no longer true.  in order to make it true I must remove the products from the shopping cart and re add them.

 

Has anyone experienced this problem and is there a fix for it?

 

Thank you in advance.

Link to comment
Share on other sites

  • 2 months later...

Would anyone have a 2.3.3.4 version of /includes/modules/product_listing.php that is suited to work with QPBPP_osc2.3.1_v2.0?

The version in the 2.3package is 2.2 era, and the instructions do not include any manual step instructions for that file, so I'm sort of stuck.

 

Thanks for the assistance.

 

Yes, I have the same issue. I have updated every other file, but this one has no update information in the install instructions, and has very little in common with the destination product_listing.php.

 

Although, everything seems to function, without it.

What does this file do?

Does it change the pricing to the "priced from" pricing and fix the "special" prices?

 

Where do these get called?

define('TEXT_PRICE_BREAKS', 'From');
define('TEXT_ON_SALE', 'On sale');
getPriceStringShort
They don't seem to get used, at all.
Link to comment
Share on other sites

  • 2 weeks later...

Hi, this looks like it is a fine contribution.

 

I have manually changed the files and uploading to Admin.  Everything seems to look fine except the admin catalog page.  All the catagories names have shortened, but the biggest problem is that every single item in my store is listed at the bottom of the category page.  I know the error has to be in the admin/category.php file, but I just cannot find it.  Any help?

Link to comment
Share on other sites

  • 3 weeks later...

Ok, I checked the database and the price breaks are showing there, but why is it not showing in the admin/catagories edit a product.  Also if I click on the admin/catagorie product I see the price break table.  What did I miss?

Link to comment
Share on other sites

Have another look at the steps you needed to take to add it to the admin/catagories.php page....if the table isn't showing up there you missed that particular step or put it in the wrong area.

Link to comment
Share on other sites

@@Dan Cole,

 

The table is showing up to input the price breaks and it is showing in product info on the admin (have not done the catalog side yet).  But when I go back to edit the same product the price breaks are not showing, its all blank like I never put anything in there?

Link to comment
Share on other sites

If the data is being saved then it sounds like the query reading in the data isn't doing so...have a look at the query that reads the info from the database...maybe output the array and see if the data is getting picked up.

Link to comment
Share on other sites

Ok, just about got the admin side working not happy with the placement of the discount table, but can live with it on that side.

 

Problem I am having now is I have no search functionality on the admin side.  When I search for a product it always comes back with nothing found.  I know this has to be in the admin\catagories.php file.  Any help to narrow it down would be greatly appreciated.

Link to comment
Share on other sites

  • 1 year later...

I have some issues with Quantity Price Breaks for Separate Pricing Per Customer.

I cant get the discounted price to be displayed unless I add two pcs of the same product (the total number of items must of course meet the criteria I have set up in the discount table).
But if I go to shopping_cart.php and hit the Update Cart-button then the correct price with the discount is shown.

 

I have set up a price table as follows;
1-4 pcs: $39
5+  pcs: $33
And then assign the products to the same discount category.

 

This scenario work:
Adding: 2 pcs of Product-A, 2 pcs of Product-B and 2 pcs of Product-C.
or
Adding: 3 pcs of Product-A and 2 pcs of Product-B.

 

This scenario don't work:
Adding: 2 pcs of Product-A, 1 pcs of Product-B, 1 pcs of Product-C, 1 pcs of Product-D
or
Adding: 4 pcs of Product-A, 1 pcs of Product-B, 1 pcs of Product-C, 1 pcs of Product-D
or
Adding: 4 pcs of Product-A and 1 pcs of Product-B

 
I have spent some time trying to fix this but havent been able to find a solution.
What could be wrong and where should I looking, does anyone have an idea?

Link to comment
Share on other sites

  • 1 month later...

@@pantarra

 

If you need paid help you should really post in the paid for help section of the forum. More people will see it there and be able to offer you a price.Just make sute that once you have the price that you can upload it to the addons area so others can benefit.

Edited by 14steve14

REMEMBER BACKUP, BACKUP AND BACKUP

Link to comment
Share on other sites

  • 1 year later...

Hi!

i used QPB in my old 2.2RC2 store for more then 10 years.
Now in want to install QPB in the latest 2.3.4.1 oscommerce and have some trouble. ;-(

The Install instructions says:
 

catalog/includes/modules/product_listing.php
Find (around line 109):

 

if (tep_not_null($listing['specials_new_products_price'])) {
              $lc_text = '&nbsp;<s>' .  $currencies->display_price($listing['products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . '</s>&nbsp;&nbsp;<span class="productSpecialPrice">' . $currencies->display_price($listing['specials_new_products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . '</span>&nbsp;';
            } else {
              $lc_text = '&nbsp;' . $currencies->display_price($listing['products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . '&nbsp;';
            }

replace with:

            $pf->parse($listing);
            $lc_text = $pf->getPriceStringShort();

but in the new store is this place is only this:

            if (tep_not_null($listing['specials_new_products_price'])) {
              $prod_list_contents .= '        <td align="right"><del>' .  $currencies->display_price($listing['products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . '</del>&nbsp;&nbsp;<span class="productSpecialPrice">' . $currencies->display_price($listing['specials_new_products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . '</span></td>';
            } else {
              $prod_list_contents .= '        <td align="right">' . $currencies->display_price($listing['products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . '</td>';
            }

It looks not right to replace this 1:1. E.g. the variable lc_text is complete missing.

 

 

And there is a 2nd place whre i stuck:

 

Open: catalog/product_info.php
Find (around line 210):

<td class="main" align="right"><?php echo tep_draw_hidden_field('products_id', $product_info['products_id']) . tep_image_submit('button_in_cart.gif', IMAGE_BUTTON_IN_CART); ?></td>

replace with:

                <td class="main" align="right">
                  <table border="0" align="right">
                    <tr><td align="center">
                      <?php echo TEXT_ENTER_QUANTITY . ":" . tep_draw_input_field('cart_quantity', $pf->adjustQty(1), 'size="6"'); ?>
                    </td></tr>
                    <tr><td align="center">
                      <?php echo tep_draw_hidden_field('products_id', $product_info['products_id']) . tep_image_submit('button_in_cart.gif', IMAGE_BUTTON_IN_CART); ?>
                    </td></tr>
	          </table>
                </td>

but in the new store is this place is only this:

<span class="buttonAction"><?php echo tep_draw_hidden_field('products_id', $product_info['products_id']) . tep_draw_button(IMAGE_BUTTON_IN_CART, 'cart', null, 'primary'); ?></span>

 

I have no skills in php ... only basics in html.

Can anyone help?

 

Thanks!

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