close ad
Databridge V2 with MySQLi support IS Now Available!
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

HELP! - Big Currency Error

Thread began 6/21/2011 7:55 am by hbibizadeh396670 | Last modified 6/24/2011 10:18 am by hbibizadeh396670 | 2648 views | 22 replies |

hbibizadeh396670

HELP! - Big Currency Error

I need to make my carts currency, dynamic.

I tried to do this by editing the eCart_PHP.php file.

I added a recordset to the page and replaced £ with $row_Settings['Currency']. As I am storing the value in my database table.

But I get this error message when I lunch my pages.

Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or `T_NUM_STRING' in C:\wamp\www\Siteezy_eCart2\WA_eCart\eCart_PHP.php on line 337

I must be able to do this as it is an essential element of what I am offering my clients, who are ether based in the USA or UK.

Sign in to reply to this post

hbibizadeh396670

Here is the area of code that I am having issues with

<?php
// eCart Language Pack [En]
$eCart = new eCart_Definition("eCart", 0, "$row_Settings['Currency']", "", true, 2, 0, "oz", true, 2, 1, 0);
$eCart->cartAction = "";
$eCart->redirStr = "";
?>

Sign in to reply to this post

Jason ByrnesWebAssist

this is not valid code.

the line:

php:
$eCart = new eCart_Definition("eCart", 0, "$row_Settings['Currency']", "", true, 2, 0, "oz", true, 2, 1, 0);



should be:

php:
$eCart = new eCart_Definition("eCart", 0, "".$row_Settings['Currency']."", "", true, 2, 0, "oz", true, 2, 1, 0);




but that will still give you an undefined index error unless you have the reocrdset on every page. You should use a set session value behavior to store the curency in a session, then use this code to set the cart object:

php:
$eCart12 = new eCart12_Definition("eCart12", 0, "".((isset($_SESSION["currency"]))?$_SESSION["currency"]:"$")  ."", "", true, 2, 0, "oz", true, 2, 1, 0);
Sign in to reply to this post

hbibizadeh396670

Ok thank you.

That worked for my currency, however I need to make my Tax and Promo Code Dynamic as well.

If I could just deal with my Tax First.

I had hoped I could just apply what I learnt from the currency to make tax dynamic (Which was why I did not say before) however it does not work.

Here is the code.

function WAEC_eCart_SalesTax() {
$totalTax = 0;
if (true && (($this->GetTaxableTotal() > 0))) {
$totalTax += ($this->GetTaxableTotal() * "".$row_Settings['Tax']."");//Result
}
return WA_eCart_FormatNumber($totalTax, $this->ForceDecimalsC, $this->DecimalPlacesC);
}

The bit I changed is "".$row_Settings['Tax'].""

From

0.2

I get an error on the cart page:

Notice: Undefined variable: row_Settings in C:\wamp\www\Siteezy_eCart2\WA_eCart\eCart_PHP2.php on line 149
$48.16

What I want to do is enable the Admin to enter a tax value, which is stored in my database table. I need this in case the VAT % changes in the future. I do not want my clients coming back to me when I built them a website 5 years ago, asking me to change there Tax %.

As you can understand this is why I need to do this.



Hope you can help.

Thank you..

Sign in to reply to this post

Jason ByrnesWebAssist

1) Don't edit the code directly. use the eCart object editor to make these changes.

2) Think about variable scope.

a recordset variable will only be available if the recordset is on every page. like i said in my previous reply:

  but that will still give you an undefined index error unless you have the reocrdset on every page. You should use a set session value behavior to store the currency in a session, then use this code to set the cart object:  



same holds true for the tax. you should be storing the tax rate from the recordset into a session variable.

then in the eCart object, exit the tax rule and add a new trigger:

If Session Variable 'Tax' exists.

in the calculation, use:
Taxable Total 'times' '$_SESSION['tax']'

Sign in to reply to this post

hbibizadeh396670

Ok,

I have an error on my cart page.


Notice: Undefined variable: row_Settings in C:\wamp\www\Siteezy_eCart2\Cart.php on line 59

Line:

<?php
if (!session_id()) session_start();
if("" == "") {
$_SESSION["Tax"] = "".$row_Settings['Tax'] ."";
}
?>

I do not quite understand why this is an issue as I have the record set and have a value in my database table.

Sign in to reply to this post

hbibizadeh396670

Sorry

Yes it works..

I just had the record set to low down in my code.

It was below the session code..

Thanks I will try and apply this to the promo codes now.

Sign in to reply to this post

hbibizadeh396670

Could you tell me how to make my promo code dynamic?

I have followed the tutorial on your site to add the promo code to my cart.

I have used data assist to create dynamic coupon codes.

Each code has a Code and a rate to deduct.

For example.

Code: PromoCode Rate: 0.10

The issue is currently there is only one code defined by the eCart object, I need it to filter the correct code from the database based on the session variable create when entering the promo code on the cart page. And then deduct the amount from the total


I tried to explain this as best I can. If you need more information just ask.

Hope you can help.

Thanks

Sign in to reply to this post

Jason ByrnesWebAssist

see this post for details on database driven promo codes:
showpost.php?p=23007&postcount=2

Sign in to reply to this post

hbibizadeh396670

ok, thanks

I did that but I can not load the cart page as I am now getting an error message.

The strange thing is that I started getting this error when I created the Coupon Code recordset.

and I think it is an error related to a different record set.

The error is:

Parse error: parse error in C:\wamp\www\Siteezy_eCart2\Cart.php on line 69

The code is:

if (isset()) {
$ParamProductID2_WADAsiteezyecproducts = (get_magic_quotes_gpc()) ? : addslashes();

Not sure why this is happening

Sign in to reply to this post
loading

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...