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

Field 'Amount' doesn't have a default value


Go to End


1884 Views

Avatar
Roelfsche

25 Posts

2 February 2010 at 6:10am

Edited: 02/02/2010 6:12am

Hi,
I've installed version 0.6 of the e-commerce-module together with payments.
First there ist no relation between example product group and products on the website but I already saw a fix in this thread.
The bigger problem is, that if I want to save an order, I get the message:

[User Error] Couldn't run query: INSERT INTO `Payment` SET Created = NOW() Field 'Amount' doesn't have a default value

The method stack looks as follows:
    * Couldn't run query: INSERT INTO `Payment` SET Created = NOW() Field 'Amount' doesn't have a default value
      Line 401 of MySQLDatabase.php
    * MySQLDatabase->databaseError(Couldn't run query: INSERT INTO `Payment` SET Created = NOW() | Field 'Amount' doesn't have a default value,256)
      Line 102 of MySQLDatabase.php
    * MySQLDatabase->query(INSERT INTO `Payment` SET Created = NOW(),256)
      Line 120 of DB.php
    * DB::query(INSERT INTO `Payment` SET Created = NOW())
      Line 836 of DataObject.php
    * DataObject->write()
      Line 187 of OrderForm.php
    * OrderForm->processOrder(Array,OrderForm,HTTPRequest)
      Line 246 of Form.php
    * Form->httpSubmission(HTTPRequest)
      Line 129 of RequestHandler.php
    * RequestHandler->handleRequest(HTTPRequest)
      Line 143 of RequestHandler.php
    * RequestHandler->handleRequest(HTTPRequest)
      Line 119 of Controller.php
    * Controller->handleRequest(HTTPRequest)
      Line 29 of ModelAsController.php
    * ModelAsController->handleRequest(HTTPRequest)
      Line 277 of Director.php
    * Director::handleRequest(HTTPRequest,Session)
      Line 121 of Director.php
    * Director::direct(/checkout/OrderForm)
      Line 118 of main.php

If I debug and print out the object in OrderForm there is an amount value...
my _config.php looks like:
Order::set_modifiers(array(
'SimpleShippingModifier'
));

SimpleShippingModifier::set_default_charge(6);
Order::set_email('test@gmx.net');
Payment::set_site_currency('NZD');

Does anybody know, what's the reason for that? If I look in the DB the 'Amount' value is mandatory.
Thank you,
Roelfsche