Forums / Basic Configuration / How to Hide Qty Discounts Box if Customer Must be Approved to See Prices

How to Hide Qty Discounts Box if Customer Must be Approved to See Prices

Started by stellarweb on 29 Aug 2013, 3:53 PM · Views: 946

Results 1 to 6 of 6
29 Aug 2013, 3:53 PM
#1
stellarweb avatar

stellarweb

Zen Follower

Join Date:
May 2006
Location:
Montana
Posts:
293
Plugin Contributions:
8

How to Hide Qty Discounts Box if Customer Must be Approved to See Prices

I have a customer that has a 1.5.1 store at http://www.czlabs.com

Store Status is set to 0
Customer Shop Status set to 2
Customer Authorization set to 2

What he wants.... NO PRICING whatsoever available for visitors to see - including the Quantity Discount pricing. Once a customer creates an account and is APPROVED, then at that time they should be able to see price of the items as well as the quantity discounts.

We have tried this every which way to Sunday and cannot get the quantity discounts box to disappear so that "normal" unlogged in / un approved visitors cannot see it.

Below is includes/modules/CUSTOM FOLDER NAME HERE/products_quantity_discounts.php file

<?php /** * products_quantity_discounts module * * @package modules * @copyright Copyright 2003-2007 Zen Cart Development Team * @copyright Portions Copyright 2003 osCommerce * @license <http://www.zen-cart.com/license/2_0.txt> GNU Public License V2.0 * @version $Id: products_quantity_discounts.php 6477 2007-06-09 04:38:22Z ajeh $ */ if (!defined('IS_ADMIN_FLAG')) { die('Illegal Access'); } require(DIR_WS_MODULES . zen_get_module_directory('require_languages.php')); // if customer authorization is on do not show discounts $zc_hidden_discounts_on = false; $zc_hidden_discounts_text = ''; switch (true) { case (CUSTOMERS_APPROVAL == '1' and $_SESSION['customer_id'] == ''): // customer must be logged in to browse $zc_hidden_discounts_on = true; $zc_hidden_discounts_text = 'MUST LOGIN'; break; case (STORE_STATUS == 1 || CUSTOMERS_APPROVAL == '2' and $_SESSION['customer_id'] == ''): // customer may browse but no prices $zc_hidden_discounts_on = true; $zc_hidden_discounts_text = TEXT_LOGIN_FOR_PRICE_PRICE; break; case (CUSTOMERS_APPROVAL == '3' and TEXT_LOGIN_FOR_PRICE_PRICE_SHOWROOM != ''): // customer may browse but no prices $zc_hidden_discounts_on = true; $zc_hidden_discounts_text = TEXT_LOGIN_FOR_PRICE_PRICE_SHOWROOM; break; case (CUSTOMERS_APPROVAL_AUTHORIZATION != '0' and $_SESSION['customer_id'] == ''): // customer must be logged in to browse $zc_hidden_discounts_on = true; $zc_hidden_discounts_text = TEXT_AUTHORIZATION_PENDING_PRICE; break; case ((CUSTOMERS_APPROVAL_AUTHORIZATION != '0' and CUSTOMERS_APPROVAL_AUTHORIZATION != '3') and $_SESSION['customers_authorization'] > '0'): // customer must be logged in to browse $zc_hidden_discounts_on = true; $zc_hidden_discounts_text = TEXT_AUTHORIZATION_PENDING_PRICE; break; default: // proceed normally break; } // create products discount output table // find out the minimum quantity for this product $products_min_query = $db->Execute("select products_quantity_order_min from " . TABLE_PRODUCTS . " where products_id='" . (int)$products_id_current . "'"); $products_quantity_order_min = $products_min_query->fields['products_quantity_order_min']; // retrieve the list of discount levels for this product $products_discounts_query = $db->Execute("select * from " . TABLE_PRODUCTS_DISCOUNT_QUANTITY . " where products_id='" . (int)$products_id_current . "' and discount_qty !=0 " . " order by discount_qty"); $discount_col_cnt = DISCOUNT_QUANTITY_PRICES_COLUMN; $display_price = zen_get_products_base_price($products_id_current); $display_specials_price = zen_get_products_special_price($products_id_current, true); // set first price value if ($display_specials_price == false) { $show_price = $display_price; } else { $show_price = $display_specials_price; } switch (true) { case ($products_discounts_query->fields['discount_qty'] <= 2): $show_qty = '1'; break; case ($products_quantity_order_min == ($products_discounts_query->fields['discount_qty']-1) || $products_quantity_order_min == ($products_discounts_query->fields['discount_qty'])): $show_qty = $products_quantity_order_min; break; default: $show_qty = $products_quantity_order_min . '-' . number_format($products_discounts_query->fields['discount_qty']-1); break; } //$discounted_price = $products_discounts_query->fields['discount_price']; // $currencies->display_price($discounted_price, zen_get_tax_rate(1), 1) $display_price = zen_get_products_base_price($products_id_current); $display_specials_price = zen_get_products_special_price($products_id_current, true); $disc_cnt = 1; $quantityDiscounts = array(); $columnCount = 0; while (!$products_discounts_query->EOF) { $disc_cnt++; switch ($products_discount_type) { // none case '0': $quantityDiscounts[$columnCount]['discounted_price'] = 0; break; // percentage discount case '1': if ($products_discount_type_from == '0') { $quantityDiscounts[$columnCount]['discounted_price'] = $display_price - ($display_price * ($products_discounts_query->fields['discount_price']/100)); } else { if (!$display_specials_price) { $quantityDiscounts[$columnCount]['discounted_price'] = $display_price - ($display_price * ($products_discounts_query->fields['discount_price']/100)); } else { $quantityDiscounts[$columnCount]['discounted_price'] = $display_specials_price - ($display_specials_price * ($products_discounts_query->fields['discount_price']/100)); } } break; // actual price case '2': if ($products_discount_type_from == '0') { $quantityDiscounts[$columnCount]['discounted_price'] = $products_discounts_query->fields['discount_price']; } else { $quantityDiscounts[$columnCount]['discounted_price'] = $products_discounts_query->fields['discount_price']; } break; // amount offprice case '3': if ($products_discount_type_from == '0') { $quantityDiscounts[$columnCount]['discounted_price'] = $display_price - $products_discounts_query->fields['discount_price']; } else { if (!$display_specials_price) { $quantityDiscounts[$columnCount]['discounted_price'] = $display_price - $products_discounts_query->fields['discount_price']; } else { $quantityDiscounts[$columnCount]['discounted_price'] = $display_specials_price - $products_discounts_query->fields['discount_price']; } } break; } $quantityDiscounts[$columnCount]['show_qty'] = number_format($products_discounts_query->fields['discount_qty']); $products_discounts_query->MoveNext(); if ($products_discounts_query->EOF) { $quantityDiscounts[$columnCount]['show_qty'] .= '+'; } else { if (($products_discounts_query->fields['discount_qty']-1) != $show_qty) { if ($quantityDiscounts[$columnCount]['show_qty'] < $products_discounts_query->fields['discount_qty']-1) { $quantityDiscounts[$columnCount]['show_qty'] .= '-' . number_format($products_discounts_query->fields['discount_qty']-1); } } } $disc_cnt=0; $columnCount++; } ?>
29 Aug 2013, 4:15 PM
#2
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: How to Hide Qty Discounts Box if Customer Must be Approved to See Prices

In v1.5 and 1.5.1 that I tested, if you have set to 2 in Configuration ... Customers ...

Customer Shop Status - View Shop and Prices
Customer must be approved to shop
0= Not required
1= Must login to browse
2= May browse but no prices unless logged in
3= Showroom Only

The Quantity Discounts do not show ...

You might check you files on the server are all properly upgraded and check the file:
/includes/modules/products_quantity_discounts.php

or if you have a templates and override file in:
/includes/modules/your_templates_dir/products_quantity_discounts.php

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

29 Aug 2013, 4:35 PM
#3
stellarweb avatar

stellarweb

Zen Follower

Join Date:
May 2006
Location:
Montana
Posts:
293
Plugin Contributions:
8

Re: How to Hide Qty Discounts Box if Customer Must be Approved to See Prices

Thanks Linda - I guess I will keep digging because it simply is not working.

The site is upgraded right and the /includes/modules/your_templates_dir/products_quantity_discounts.php is also correct.

Ajeh:

In v1.5 and 1.5.1 that I tested, if you have set to 2 in Configuration ... Customers ...

The Quantity Discounts do not show ...

You might check you files on the server are all properly upgraded and check the file:
/includes/modules/products_quantity_discounts.php

or if you have a templates and override file in:
/includes/modules/your_templates_dir/products_quantity_discounts.php

29 Aug 2013, 4:39 PM
#4
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: How to Hide Qty Discounts Box if Customer Must be Approved to See Prices

Also check the file:
/includes/templates/template_default/templates/tpl_modules_products_quantity_discounts.php

and your templates and overrides file:
/includes/templates/your_template_dir/templates/tpl_modules_products_quantity_discounts.php

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

29 Aug 2013, 4:51 PM
#5
stellarweb avatar

stellarweb

Zen Follower

Join Date:
May 2006
Location:
Montana
Posts:
293
Plugin Contributions:
8

Re: How to Hide Qty Discounts Box if Customer Must be Approved to See Prices

I wish I was 1/2 ... no... 1/8th as smart as you Linda!!

That did the trick! Looks like that file was modified - now I just need to figure out why / what mod, etc.

THANKS!!

29 Aug 2013, 4:52 PM
#6
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: How to Hide Qty Discounts Box if Customer Must be Approved to See Prices

Thanks for the update that this is the file that you need to fix ... :smile:

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!