Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

E-Commerce Modules /

Discuss about the various e-commerce modules available:
Ecommerce, SS Shop, SilverCart and SwipeStripe
Alternatively, have a look the shared mailinglist.

Moderators: martimiz, Nicolaas, Sean, Ed, frankmullenger, biapar, Willr, Ingo, Jedateach, swaiba

Ecommerc error


Go to End


3 Posts   1878 Views

Avatar
Mogul1914

Community Member, 2 Posts

31 January 2013 at 5:25am

Hi,

After installing payment v.30 and running dev/build?flush=1, I get the following error:

Parse error: syntax error, unexpected T_IF in /home/gemc/public_html/gemc21/cms/ecommerce/code/model/Order.php on line 1978

I need some help resolving this issue.

Thanks!

Avatar
Mogul1914

Community Member, 2 Posts

31 January 2013 at 5:30am

I forgot the line code:

/**
* Returns the country code for the country that applies to the order.
* It only takes into account what has actually been saved.
* @return String (country code)
**/
public function Country() {return $this->getCountry();}
public function getCountry() {
$countryCodes = array(
"Billing" => "",
"Shipping" => ""
);
if($this->BillingAddressID) {
$billingAddress = BillingAddress::get()->byID($this->BillingAddressID)

Line 1978 if($billingAddress) {
if($billingAddress->Country) {
$countryCodes["Billing"] = $billingAddress->Country;
}
}
}
if($this->ShippingAddressID && $this->UseShippingAddress) {
$shippingAddress = BillingAddress::get()->byID($this->ShippingAddressID)
if($shippingAddress) {
if($shippingAddress->ShippingCountry) {
$countryCodes["Shipping"] = $shippingAddress->ShippingCountry;
}
}
}
if(count($countryCodes)) {
if(EcommerceConfig::get("OrderAddress", "use_shipping_address_for_main_region_and_country") && $countryCodes["Shipping"]) {
return $countryCodes["Shipping"];
}
return $countryCodes["Billing"];
}
}

Avatar
frankmullenger

Forum Moderator, 53 Posts

31 January 2013 at 11:32am

Looks like you are missing semicolons at the end of these lines:
$billingAddress = BillingAddress::get()->byID($this->BillingAddressID);
$shippingAddress = BillingAddress::get()->byID($this->ShippingAddressID);

You should try using an editor that will highlight syntax errors for you, I personally use Sublime Text 2 and it's pretty good.