If this is your first visit, check our documentation. To post, register or login.

How to show which discount group?

Locked

Started by ryk on 27 May 2006, 2:27 PM · Views: 5,097

Results 1 to 14 of 14
This thread is locked. New replies are disabled.
27 May 2006, 2:27 PM
#1
ryk avatar

ryk

Totally Zenned

Join Date:
Oct 2004
Location:
Southport, UK
Posts:
3,644
Plugin Contributions:
6

Post #1 by ryk

The client offers a range of trade discounts set up in Group Pricing. He would like his customers to be able to see their trade discount level (i.e. 15%, 20% or 25%) when logged in.

I understand that ```
if (isset($_SESSION['customer_id']))


IF a trade customer (ie in one of the 3 groups) DISPLAY the % allocated to that group.


Can anybody rattle off the syntax for me please?

Development Manager @ JSWeb Ltd - suppliers of Applepay/Googlepay for Zencart
20 years with Zencart !

28 May 2006, 9:18 AM
#2
ryk avatar

ryk

Totally Zenned

Join Date:
Oct 2004
Location:
Southport, UK
Posts:
3,644
Plugin Contributions:
6

Post #2 by ryk

I've made a fair bit of progress using my standard trial and error technique, and I can get the results I want when I enter a known value of 'customer_id' into the SELECT command.

However, can someone please tell me how to SELECT using the variable value of $_SESSION['customer_id']?

if (isset($_SESSION['customer_id'])) {
				
	$show='SELECT * FROM zen_customers WHERE customers_id=[B]WHAT GOES HERE PLEASE[/B];

Development Manager @ JSWeb Ltd - suppliers of Applepay/Googlepay for Zencart
20 years with Zencart !

28 May 2006, 2:50 PM
#3
ajeh avatar

ajeh

Oba-san

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

Post #3 by ajeh

Try using:

$show="SELECT * FROM " . TABLE_CUSTOMERS . " WHERE customers_id='" . $_SESSION['customer_id'] . "'";

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!

28 May 2006, 8:03 PM
#4
ryk avatar

ryk

Totally Zenned

Join Date:
Oct 2004
Location:
Southport, UK
Posts:
3,644
Plugin Contributions:
6

Post #4 by ryk

THANK YOU!! :thumbsup:

Development Manager @ JSWeb Ltd - suppliers of Applepay/Googlepay for Zencart
20 years with Zencart !

21 Jun 2006, 5:10 PM
#5
missterx avatar

missterx

New Zenner

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

Post #5 by missterx

Hi!

I'm not sure if it's the right place to follow up - but if I'm wrong, direct me.

Befor I even found this thread I made this file: it shows the price in a table after
"Product Price block" and before "free ship icon". Sorry for the quick hack...

  1. Add this between <!--eof Product Price block --> <!--bof free ship icon --> in the file includes/templates/my_template/templates/tpl_product_info_display.php - it should be around line #80:
<!-- bof customers dicount info & price --> <?php echo display_group_pricings ((int)$_GET['products_id']); ?> <!-- eof customers dicount info & price -->
  1. Copy attached - and unzipped file - to includes/functions/extra_functions.

P.S.
Mind you, it might be some leftovers from the swedish language. If you do find such a word and do not the meaning of it - PM me and I'll answer back.

Regards

//
// God is real,
// unless declared integer.
//

11 Jul 2006, 9:40 PM
#6
dbrewster avatar

dbrewster

Zen Follower

Join Date:
Jul 2005
Location:
Charlottesville, VA
Posts:
376
Plugin Contributions:
0

Post #6 by dbrewster

MissterX,

I like your suggestion. I'd like to include the group pricing group name in the display. I've been playing around with how to include it in the product info display page, using your product_info_group_pricing_discount.php function, but I am not having success. Have you worked it out?

This did not work:

$content .= $group_discount->fields['group_name'] . ' discount: <strong>' . 
            $group_pricing . '%</strong>.';

I also tried inserting this after
$group_pricing = (int)$q_sql->fields['g_p'];

$sql = 'SELECT group_name g_n FROM '.TABLE_GROUP_PRICING.' 
       WHERE group_id LIKE "'.$q_sql->fields['g_n'].'"';
$q_sql = $db->Execute($sql);
$group_name = $q_sql->fields['g_n'];

and then:

$content .= $group_name . ' discount: <strong>' . 
                 $group_pricing . '%</strong>.';

but that didn't work either. I'm just parroting what I see, I'm not a programmer :no: .

---Diana

14 Jul 2006, 11:26 PM
#7
missterx avatar

missterx

New Zenner

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

Post #7 by missterx

dbrewster:

MissterX,

I like your suggestion. I'd like to include the group pricing group name in the display. I've been playing around with how to include it in the product info display page, using your product_info_group_pricing_discount.php function, but I am not having success. Have you worked it out?

...

Hi D.

I think so.

File: includes/functions/extra_functions/product_info_group_pricing_discount.php
Line no: 8

$sql = 'SELECT group_percentage g_p FROM '.TABLE_GROUP_PRICING.' WHERE group_id LIKE "'.$q_sql->fields['cg_p'].'"';

should be change to:

$sql = 'SELECT group_percentage g_p, group_name g_n FROM '.TABLE_GROUP_PRICING.' WHERE group_id LIKE "'.$q_sql->fields['cg_p'].'"';

Line no: 14
Add after it:

$group_name = $q_sql->fields['g_n'];

Then you can put in the group name ($group_name) where you want.

Regards

//
// God is real,
// unless declared integer.
//

17 Jul 2006, 2:37 PM
#8
dbrewster avatar

dbrewster

Zen Follower

Join Date:
Jul 2005
Location:
Charlottesville, VA
Posts:
376
Plugin Contributions:
0

Post #8 by dbrewster

Thank you MissterX, works like a charm!! :D

This is so good, it should be a part of ZC.

Here's my simplified display implementation, without the fancy tax calculation table:

$content .= '<div style="font-size:small; width:85%; background-color:#e9e9e9; 
padding: 0.5em; margin: 0.5em">';
$content .= $group_name . ' discount: <strong>' . $group_pricing . '%</strong>.';
$content .= '</div>';

---Diana

1 Nov 2006, 1:13 PM
#9
haiopei avatar

haiopei

New Zenner

Join Date:
Nov 2006
Posts:
3
Plugin Contributions:
0

Post #9 by haiopei

Hi@ all, hi MissterX,

this workaround i have long searched for.

It works...but it seems to be not finally ?

I have it putted as you descripted.

All prices are rounded and looks crashed ":-":

Your Discount: 5%.

  Total     -16% MwSt    MwSt

Price 81:- 70:- 11:-
-5% -4:- -4:-
**Your ****77:- **66:- 11:-
**price

** The original price i.e. was here 81,14.

Sorry for my bad english, im a german-user with some broken english in school and no good experience in programming.

CU

1 Nov 2006, 1:34 PM
#10
haiopei avatar

haiopei

New Zenner

Join Date:
Nov 2006
Posts:
3
Plugin Contributions:
0

Post #10 by haiopei

@ all :

i forget some. i need two numbers behind komma :

i.e. 81,14

Who can i fix this ?

CU

1 Nov 2006, 2:08 PM
#11
haiopei avatar

haiopei

New Zenner

Join Date:
Nov 2006
Posts:
3
Plugin Contributions:
0

Post #11 by haiopei

hi,

i fixed the problem.

thx again for the script.

CU

20 Jan 2007, 7:40 PM
#12
ideaguy avatar

ideaguy

New Zenner

Join Date:
Dec 2005
Posts:
6
Plugin Contributions:
0

Post #12 by ideaguy

Is there a way to show and require the user to select a discount group when creating an account?

22 Jan 2007, 8:17 PM
#13
dbrewster avatar

dbrewster

Zen Follower

Join Date:
Jul 2005
Location:
Charlottesville, VA
Posts:
376
Plugin Contributions:
0

Post #13 by dbrewster

ideaguy:

Is there a way to show and require the user to select a discount group when creating an account?

As far as I know, there's nothing built into ZC to do this. You'd have to write some custom code to add a field to the user table, and connect it to the discount groups table.

It's an unusual request. "Oh yes please, I'd like to be a member of the 100% discount group, thanks!" Usually this would be something that the administrator sets for the account after it is created.

---Diana

22 Jan 2007, 9:03 PM
#14
ideaguy avatar

ideaguy

New Zenner

Join Date:
Dec 2005
Posts:
6
Plugin Contributions:
0

Post #14 by ideaguy

Thanks for the reply....

Actually, I just want to use it to seperate users into self -selected groups of buyers, doing as little custom as possible... (for post-sale service) ... so I figured on just adding something that allowed them to select from the available groups entered into admin would be the easiest and cleanest way, basically a pull down that lists the groups to select from as a required field... (all discounts set to 0% and % not shown) ... the idea is to categorize the user for better service and maybe give discounts sometime down the road...

What would happen is the group id they select in the drop down would go into 'zen_customers' with the appropriate ID in 'zen_customers_group' from 'zen_group_pricing' but I am only semi-proficient at PHP and learning Zen as I go...

Anyone done what I've described or able to give me a quick snipit and where to put it? (or even where to start, so it doesn't take me weeks?)