Forums / General Questions / Gift Certificat function adding to total..

Gift Certificat function adding to total..

Locked

Views: 2,022

Results 1 to 11 of 11
This thread is locked. New replies are disabled.
15 Nov 2006, 4:02 AM
#1
dng avatar

dng

New Zenner

Join Date:
Sep 2005
Posts:
31
Plugin Contributions:
0

Gift Certificat function adding to total..

Hello

I have a customized script of zencart... and my script does the following

$customized_product_total = $currencies->display_price($orders_products->fields['final_price'], 0);

Now my question is ... In my customized product total it does not include gift certificate redemtion amount.. now i want to say
if gift certifcate amount >0 then
$customized_product_total = myprice - gift certificate amoutnt
else
give cerfifcate = 0
$customized_product_total = myprice - gift certificate amoutnt
end if

Thank you for your support..
DNG

16 Nov 2006, 3:27 PM
#2
dng avatar

dng

New Zenner

Join Date:
Sep 2005
Posts:
31
Plugin Contributions:
0

Re: Gift Certificat function adding to total..

dng:

Hello

I have a customized script of zencart... and my script does the following

$customized_product_total = $currencies->display_price($orders_products->fields['final_price'], 0);

Now my question is ... In my customized product total it does not include gift certificate redemtion amount.. now i want to say
if gift certifcate amount >0 then
$customized_product_total = myprice - gift certificate amoutnt
else
give cerfifcate = 0
$customized_product_total = myprice - gift certificate amoutnt
end if

Thank you for your support..
DNG

Did this post get lost... any help will be appricate it!

Thanks

22 Nov 2006, 4:02 AM
#3
dng avatar

dng

New Zenner

Join Date:
Sep 2005
Posts:
31
Plugin Contributions:
0

Re: Gift Certificat function adding to total..

Any help... I guess message do get lost in the forum now a days.... can any 1 take a look at this....

Thanks
DNG

22 Nov 2006, 5:22 AM
#4
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: Gift Certificat function adding to total..

I think your problem is that you have not posed a question that can be answered.

Are you just looking for the right PHP statement to account for the gift certificate? You need to give some more context to allow coders to give useful answers.
Good luck.

27 Nov 2006, 3:39 PM
#5
dng avatar

dng

New Zenner

Join Date:
Sep 2005
Posts:
31
Plugin Contributions:
0

Re: Gift Certificat function adding to total..

gjh42:

I think your problem is that you have not posed a question that can be answered.

Are you just looking for the right PHP statement to account for the gift certificate? You need to give some more context to allow coders to give useful answers.
Good luck.

Sorry if its not understanding... Yes, cause currently it gives me the total but does not give me gift certificate taken out... So if I want my code to take out the gift certificate.. So Yes I'm looking for the right PHP statement to account for the gift certificate.

Thanks
DNG

29 Nov 2006, 4:05 PM
#6
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: Gift Certificat function adding to total..

The statements you have given are not correct PHP syntax, but we would need to know your exact variable names to give a corrected version.
You would say something like

if ($gift_certificate_amount > 0) {
  $customized_product_total = $myprice - $gift_certificate_amount;
}

No "else" is required because if the amount is zero you don't need to do anything.

You could also simply say

$customized_product_total = $myprice - $gift_certificate_amount;

and if the GC is zero, it will leave the total as is. Very simple.

Substitute your actual variable names if they are different, and double check spellings. You had several typos in your posted version - they would be fatal to your code.
Good luck.

29 Nov 2006, 4:24 PM
#7
dng avatar

dng

New Zenner

Join Date:
Sep 2005
Posts:
31
Plugin Contributions:
0

Re: Gift Certificat function adding to total..

gjh42:

The statements you have given are not correct PHP syntax, but we would need to know your exact variable names to give a corrected version.
You would say something like

if ($gift_certificate_amount > 0) {
$customized_product_total = $myprice - $gift_certificate_amount;
}

> No "else" is required because if the amount is zero you don't need to do anything.
> 
> You could also simply say
> ```php
$customized_product_total = $myprice - $gift_certificate_amount;

and if the GC is zero, it will leave the total as is. Very simple.

Substitute your actual variable names if they are different, and double check spellings. You had several typos in your posted version - they would be fatal to your code.
Good luck.

Thank You Appricate that.
Ed

29 Nov 2006, 5:54 PM
#8
dng avatar

dng

New Zenner

Join Date:
Sep 2005
Posts:
31
Plugin Contributions:
0

Re: Gift Certificat function adding to total..

gjh42:

The statements you have given are not correct PHP syntax, but we would need to know your exact variable names to give a corrected version.
You would say something like

if ($gift_certificate_amount > 0) {
$customized_product_total = $myprice - $gift_certificate_amount;
}

> No "else" is required because if the amount is zero you don't need to do anything.
> 
> You could also simply say
> ```php
$customized_product_total = $myprice - $gift_certificate_amount;

and if the GC is zero, it will leave the total as is. Very simple.

Substitute your actual variable names if they are different, and double check spellings. You had several typos in your posted version - they would be fatal to your code.
Good luck.

Here is my edited code

-CODE
$product_total = $currencies->display_price($orders_products->fields['final_price'], 0);
$custom = $product_total - $gift_certificate_amount
$extra_delivery_info . ' ' . ($product_details !='' ? ' Price includes add-on(s) ' : '') . $product_info . $upgrade_info . $product_details . ' Total Order Amount: ' . $custom . "\n";

Here is what it is now

-CODE
$product_total = $currencies->display_price($orders_products->fields['final_price'], 0);
$extra_delivery_info . ' ' . ($product_details !='' ? ' Price includes add-on(s) ' : '') . $product_info . $upgrade_info . $product_details . ' Total Order Amount: ' . $product_total . "\n";

I did go ahead and test it out, it processed okay but the problem it did not show up as my gift certificate. The balance stayed the same... whats the problem?

Thanks
DNG

30 Nov 2006, 6:34 AM
#9
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: Gift Certificat function adding to total..

you are missing the semicolon in the GC line:

$custom = $product_total - $gift_certificate_amount

should be```php
$custom = $product_total - $gift_certificate_amount;

Try that and see what happens.
30 Nov 2006, 4:51 PM
#10
dng avatar

dng

New Zenner

Join Date:
Sep 2005
Posts:
31
Plugin Contributions:
0

Re: Gift Certificat function adding to total..

gjh42:

you are missing the semicolon in the GC line:

$custom = $product_total - $gift_certificate_amount

> should be```php
$custom = $product_total - $gift_certificate_amount;

Try that and see what happens.

Nope, what is does is it gets the product total.. but does not minus the $gift_certificate_amount from the total... Could it be its a different function name? Also whats the coupon function name?

2 Dec 2006, 3:53 PM
#11
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: Gift Certificat function adding to total..

Just for giggles, throw in a line just before the $custom line to print the value of $gift_certificate_amount, and a line after it to show the value of $custom and $product_total.
The line will subtract $gift_certificate_amount from $product_total and assign it to $custom, but you must be sure that you are using the right names.

I can't tell you what the coupon function name would be... haven't used them yet. But if you are using them, the name ought to be shown in your files where pricing is done.

Hey - is $gift_certificate_amount a variable you set up, or is it what you think the gc name ought to be? if it isn't the right name, you're sunk.