Zen Cart Logo
Forums / Setting Up Categories, Products, Attributes / quantity discounts for wholesale customers

quantity discounts for wholesale customers

Locked

Views: 2,660

Results 1 to 4 of 4
This thread is locked. New replies are disabled.
16 Sep 2006, 5:03 PM
#1
duplex avatar

duplex

New Zenner

Join Date:
Sep 2006
Posts:
6
Plugin Contributions:
0

quantity discounts for wholesale customers

I am so close to completing the site I installed Zen Cart on -- the customization is going well, features are great etc....

but... I need some serious help.

For some of the products there are "Quantity Discounts" and it works great. Problem is, I am using the Dual Pricing module -and I need the quantity discounts to apply to wholesale customers only.

Here's the module I'm using - Dual Pricing - Wholesale Pricing - http://www.zen-cart.com/index.php?main_page=product_contrib_info&cPath=40_41&products_id=166

You can see the product here - obviously the quantity discount is currently public (not wholesale) http://66.246.172.217/shop/index.php?main_page=product_info&cPath=7&products_id=30

If anyone out there can help me, it would be greatly appreciated! I really want to avoid completely hacking the site.

Thanks!!!

EDITED: Never, ever post the zen_id or zenAdminID (session id) in a forum, email, newsgroup, newsletter, advertisement, etc. etc. etc. or you will be doomed ... :eek:

16 Sep 2006, 8:42 PM
#2
duplex avatar

duplex

New Zenner

Join Date:
Sep 2006
Posts:
6
Plugin Contributions:
0

Re: quantity discounts for wholesale customers

resolved! :D

4 episodes of project runway later... i figured it out... just a few lines, which i knew it would be but... where? was the question.

it's not a very flexible fix - it makes it so that all quantity discounts are wholesale only as opposed to the ideal of having it be an admin setting.

**restrictions - **
-must be used with the module for Wholesale/Dual Pricing (link in above post)
-no "discount quantity" pricing will be allowed for retail customers. never.

file: includes/functions/functions_prices.php

around line 1473
function zen_get_products_discount_price_qty($product_id, $check_qty, $check_amount=0)

**under the switch ($products_query->fields['products_discount_type']) **
in case '2': (which is the quantity discount option)

**at the very end add in: **

$customers_id = $_SESSION['customer_id'];
$customer_check = $db->Execute("select * from " . TABLE_CUSTOMERS . " where customers_id = '$customers_id'");
if ($customer_check->fields['customers_whole'] != "1")
	$discounted_price = $display_price;

**so the entire case '2' looks like this: **

 // actual price
        case '2':
          if ($products_query->fields['products_discount_type_from'] == '0') {
            $discounted_price = $products_discounts_query->fields['discount_price'];
          } else {
            $discounted_price = $products_discounts_query->fields['discount_price'];
          }
		  $customers_id = $_SESSION['customer_id'];
		  $customer_check = $db->Execute("select * from " . TABLE_CUSTOMERS . " where customers_id = '$customers_id'");
		  if ($customer_check->fields['customers_whole'] != "1")
		  		$discounted_price = $display_price;
          break;
        // amount offprice
        case '3': ....
16 Sep 2006, 9:01 PM
#3
duplex avatar

duplex

New Zenner

Join Date:
Sep 2006
Posts:
6
Plugin Contributions:
0

Re: quantity discounts for wholesale customers

oh and I forgot, to make it so the table of discount pricing doesnt show up on the product info page, you have to add in a check to see if the cutomer is wholesale -- $cusomter_whole =1

the code may be a bit different depending on the template you are using but you are looking for the test for $products_discount_type != 0

**file: **tpl_product_info_display.php
**for me it's located in: **includes/templates/templates_default/templates/

<!--bof Quantity Discounts table -->
<?php
  if (($products_discount_type != 0 ) && ($customer_check->fields['customers_whole'] == "1")) { ?>
<?php
/**
 * display the products quantity discount
 */
 require($template->get_template_dir('/tpl_modules_products_quantity_discounts.php',DIR_WS_TEMPLATE, $current_page_base,'templates'). '/tpl_modules_products_quantity_discounts.php'); ?>
<?php
  }
?>
20 Nov 2006, 9:05 AM
#4
dwicorp avatar

dwicorp

New Zenner

Join Date:
Feb 2006
Posts:
4
Plugin Contributions:
0

Re: quantity discounts for wholesale customers

Actually, I need to do the oposit. I have volume discounts for the retail customers but don't need the volume discounts to show in the whole sale section. I tried the changing the code of
if (($products_discount_type != 0 ) && ($customer_check->fields['customers_whole'] == "1")) { ?>
to
if (($products_discount_type != 0 ) && ($customer_check->fields['customers_whole'] == "0")) { ?>
It worked as in the volume discounts are not showing up for the wholesale customer but it is now not showing in the retail either.

I need the volume discount to show in the retail but not the wholesale. Can someone tell me what to do?