Fatal error: Call to a member function numRows() on a non-object in

jacobi22

the code say's: the value (for freeshipping) can have only and maximal 7 digits in the sum of the left and the right part from the dezimal point, the script say's also: the value has 2 digits on the right side

the DEFAULT in the install.php-script says:  use 9999999 AND 2 Digits after the point, in the sum 9 digits
for a correct mysql-code the default value is too long or is missing a decimal point (see marmot's posting)

if you have a error in the CREATE code, the script will not install this table - thats the problem

(Nachtrag): if you set a smaller value in the installer, which is in the sum of the total digits smaller then 7 and if you have no decimal point in your default value (only 999), the CREATE function use 0 for the digits after the decimal point, thats way you have 999.00 in your database entry if you use 999 as DEFAULT value

remember: this value for free shipping is a price , so you need the 2 digits after the decimal point

if you change the standard value later in your setting, the bakery script will change a simple 0 to a correct value with 2 digits after the decimal point (the price format)
the author will set a high standard value for the free shipping. if you work with zero as standard and nobody change this in the setting, every thing goes out with free shipping  :roll:

dbs

Don't understand.
0 or 0.00 is a value, right? How can this make trouble?
[url="https://onkel-franky.de"]https://onkel-franky.de[/url]

jacobi22

QuoteThe result of our investigations is what?
Remove 2 digits from the installer?

best solution ( i think)
set the default in the installer to 99999.99  // actual value is 9999999 - no with a decimal point
the exact line 173 in the bakery- install.php
. "`free_shipping` DECIMAL(7,2) NOT NULL DEFAULT '99999.99' ,"

p.s. i test other solutions with a DEFAULT = 0 in the Installer and a Update later in the script, but it gives problems, if somebody need the value 0 in this setting (for free shipping every time)


dbs

funny, in my DB is 999.00 (not 999.99)   :-D

I don't understand the technical crap like "google" or "decimal digits".
The result of our investigations is what?
Remove 2 digits from the installer?
[url="https://onkel-franky.de"]https://onkel-franky.de[/url]

jacobi22

QuoteThere is no comma or point in 9999999
not in the installer, but then in the database after the install :wink:

dbs

[url="https://onkel-franky.de"]https://onkel-franky.de[/url]

jacobi22

in the scool i learning this: a decimal has three parts: 1. integer part 2. decimal point like comma or point, 3. fractional part
in the manual i found this:  A packed "exact" fixed-point number. M is the total number of digits (the precision) and D is the number of digits after the decimal point (the scale).
so i unterstand: M is the precision (for mathematic operations), and D is the output, but not: m is the total sum of all digits on the left and the rights side from the decimal point

i found more informations on the next page in the manual
QuoteFor example, a DECIMAL(18,9) column has nine digits on either side of the decimal point, so the integer part and the fractional part each require 4 bytes. A DECIMAL(20,6) column has fourteen integer digits and six fractional digits. The integer digits require four bytes for nine of the digits and 3 bytes for the remaining five digits. The six fractional digits require 3 bytes.
its exactly this, was marmot write

but i dont unterstand, why it's work for me and not for dbs with the same configuration (same wb-portable with same php- and mysql version)

german translation....
wohl ein "Verständnisproblem" mit mathematischen Bezeichnungen. Ich hatte das noch so gelernt, das vor dem Trenner eine Ganzzahl steht, hinter dem Trenner die Dezimalzahl.

lt Definition MySQL: DECIMAL[(M[,D])] - Gepackte ,,exakte" Festkommazahl. M ist die Gesamtzahl von Dezimalstellen (Genauigkeit), D die Anzahl der Stellen hinter dem Dezimalpunkt.

heißt bei mir, es wird auf 7 Nachkommastellen berechnet, auf 2 gerundet bzw 2 ausgegeben

liest man an anderer Stelle weiter, heißt es aber: Da beispielsweise die Spalte DECIMAL(18,9) auf jeder Seite des Dezimalpunkts 9 Stellen hat, belegen ihr ganzzahliger und ihr Dezimalteil jeweils 4 Byte. Eine DECIMAL(20,10)-Spalte hat dagegen auf jeder Seite des Dezimalpunkts 10 Stellen. Jeder Teil belegt also 4 Byte für die ersten 9 Stellen und 1 Byte für die Reststelle
entspricht also genau dem, was marmot sagte

aber auch in diesem Text, die mal von mir gelernte Trennung von Ganz- und Dezimalzahl vor bzw nach dem Komma

trotzdem verstehe ich nicht, warum es mit der gleichen PHP- und MySQL, und WB- und BakeryVersion (alles auf der gleichen WB-Portable) bei einem der berechtigte Fehler kommt und beim anderem ein Wert von 99999.99 eingetragen wird

marmot

Hi,

Quote from: daydreamer on November 13, 2013, 10:38:07 PM
. "`free_shipping` DECIMAL(7,2) NOT NULL DEFAULT '9999999' ,"
Quote from: dbs on December 13, 2013, 12:36:17 PM
No table mod_bakery_general_settings was created.
After changing in install.php line 173 from '9999999' to '999' and installing again (Add-Ons > Modules > Advanced) it works.
at this point I can use my unique ability to use google and to read a manual. "DECIMAL(7,2)" means 7 digits including decimals, which means the intger part can have 5 digits maximum = 99999. Fine if it works with a 7 digit integer soemtimes but it's not according to the field definition.

regards

jacobi22

bei mir in der selben Konstellation ohne Probleme  :roll:
vielleicht ist es geschickter, diesen Wert (99999,99) erst in der add.php hinzuzufügen(?)

oh, english thread, sorry   :-o

work for me on the same situation (actual wb-portable-version with the sme php- and mysql, and bakery version) without problems
maybe its better, to set the default value not in the installer, set the value "99999.99" as a INSERT in the add.php

dbs

The same problem here.
Fatal error: Call to a member function numRows() on a non-object in .../modules/bakery/modify.php on line 52

New install of Bakery in Portable 2.8.3 (PHP 5.4.)
No table mod_bakery_general_settings was created.
After changing in install.php line 173 from '9999999' to '999' and installing again (Add-Ons > Modules > Advanced) it works.
[url="https://onkel-franky.de"]https://onkel-franky.de[/url]

daydreamer

I have no idea, pleased I found the issue it was driving me crazy

jacobi22

Quote from: daydreamer on November 14, 2013, 11:44:25 AM
I can change to 9999999 from general settings with no issue

crazy  :lol:
(but i dont unterstand, why it makes problems with 99999 or more

daydreamer


jacobi22

please try to change this value in the bakery backend settings...

daydreamer

Found the problem

. "`free_shipping` DECIMAL(7,2) NOT NULL DEFAULT '9999999' ,"

Would not drop mod_bakery_general_settings

Changed to

. "`free_shipping` DECIMAL(7,2) NOT NULL DEFAULT '100' ,"

and all works as normal

Not sure if this is an issue with mysql & Ampps

daydreamer

For some reason when installing bakery the table mod_bakery_general_settings is not installing as it is missing from the database.

Thanks for all the help :)

Luisehahne

Hallo,

There was a missunderstanding. I don't mean the sql Backup.

Seems to be a wrong call for NumRows(). In my point you forgot the object before NumRows()

Is the old way to code.


<?php
$query_general_settings 
$database->query("SELECT shop_name, display_settings FROM ".TABLE_PREFIX."mod_bakery_general_settings"); 
$num $query_general_settings->numRows();


Dietmar

Note: Once the code has been generated, it is easy to debug. It's not a bug, it's a feature!


jacobi22

Quote from: Luisehahne on November 12, 2013, 05:02:43 PM

QuoteFatal error: Call to a member function numRows() on a non-object in /Applications/AMPPS/www/test/baker/modules/bakery/modify.php on line 52

Check the syntax from your sql statement, Most of them solve your issue


its not a syntax error, its a result from a empty select -> see the post from freeSbee
<?php
$query_general_settings 
$database->query("SELECT shop_name, display_settings FROM ".TABLE_PREFIX."mod_bakery_general_settings"); 



daydreamer

Thanks Luisehahne,

I can't find a syntax error this is the bakery sql

--
-- Table structure for table `wb_mod_bakery_attributes`
--

CREATE TABLE IF NOT EXISTS `wb_mod_bakery_attributes` (
  `attribute_id` int(6) NOT NULL AUTO_INCREMENT,
  `option_id` int(6) NOT NULL,
  `attribute_name` varchar(50) NOT NULL,
  PRIMARY KEY (`attribute_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `wb_mod_bakery_customer`
--

CREATE TABLE IF NOT EXISTS `wb_mod_bakery_customer` (
  `order_id` int(6) NOT NULL AUTO_INCREMENT,
  `order_date` int(11) NOT NULL,
  `shipping_fee` decimal(9,2) NOT NULL,
  `sales_tax` decimal(9,2) NOT NULL,
  `submitted` varchar(20) NOT NULL DEFAULT 'no',
  `transaction_id` varchar(50) NOT NULL DEFAULT 'none',
  `transaction_status` varchar(10) NOT NULL DEFAULT 'none',
  `status` varchar(20) NOT NULL DEFAULT 'none',
  `user_id` int(6) NOT NULL,
  `cust_company` varchar(50) NOT NULL,
  `cust_first_name` varchar(50) NOT NULL,
  `cust_last_name` varchar(50) NOT NULL,
  `cust_tax_no` varchar(11) NOT NULL,
  `cust_street` varchar(50) NOT NULL,
  `cust_city` varchar(50) NOT NULL,
  `cust_state` varchar(50) NOT NULL,
  `cust_country` varchar(2) NOT NULL,
  `cust_zip` varchar(10) NOT NULL,
  `cust_email` varchar(50) NOT NULL,
  `cust_phone` varchar(20) NOT NULL,
  `ship_company` varchar(50) NOT NULL,
  `ship_first_name` varchar(50) NOT NULL,
  `ship_last_name` varchar(50) NOT NULL,
  `ship_street` varchar(50) NOT NULL,
  `ship_city` varchar(50) NOT NULL,
  `ship_state` varchar(50) NOT NULL,
  `ship_country` varchar(2) NOT NULL,
  `ship_zip` varchar(10) NOT NULL,
  `invoice_id` int(6) NOT NULL,
  `invoice` text NOT NULL,
  PRIMARY KEY (`order_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `wb_mod_bakery_images`
--

CREATE TABLE IF NOT EXISTS `wb_mod_bakery_images` (
  `img_id` int(11) NOT NULL AUTO_INCREMENT,
  `item_id` int(11) NOT NULL DEFAULT '0',
  `item_attribute_id` int(11) NOT NULL DEFAULT '0',
  `filename` varchar(150) NOT NULL DEFAULT '',
  `active` enum('1','0') NOT NULL DEFAULT '1',
  `position` int(11) NOT NULL DEFAULT '0',
  `alt` varchar(255) NOT NULL DEFAULT '',
  `title` varchar(255) NOT NULL DEFAULT '',
  `caption` text NOT NULL,
  PRIMARY KEY (`img_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `wb_mod_bakery_items`
--

CREATE TABLE IF NOT EXISTS `wb_mod_bakery_items` (
  `item_id` int(11) NOT NULL AUTO_INCREMENT,
  `section_id` int(11) NOT NULL DEFAULT '0',
  `page_id` int(11) NOT NULL DEFAULT '0',
  `group_id` int(11) NOT NULL DEFAULT '0',
  `active` int(11) NOT NULL DEFAULT '0',
  `position` int(11) NOT NULL DEFAULT '0',
  `title` varchar(255) NOT NULL DEFAULT '',
  `sku` varchar(20) NOT NULL DEFAULT '',
  `stock` varchar(20) NOT NULL DEFAULT '',
  `price` decimal(9,2) NOT NULL,
  `shipping` decimal(9,2) NOT NULL,
  `tax_rate` decimal(5,2) NOT NULL,
  `definable_field_0` varchar(150) NOT NULL DEFAULT '',
  `definable_field_1` varchar(150) NOT NULL DEFAULT '',
  `definable_field_2` varchar(150) NOT NULL DEFAULT '',
  `link` text NOT NULL,
  `description` text NOT NULL,
  `full_desc` text NOT NULL,
  `modified_when` int(11) NOT NULL DEFAULT '0',
  `modified_by` int(11) NOT NULL DEFAULT '0',
  `created_when` int(11) NOT NULL DEFAULT '0',
  `created_by` int(11) NOT NULL DEFAULT '0',
  PRIMARY KEY (`item_id`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ;

--
-- Dumping data for table `wb_mod_bakery_items`
--

INSERT INTO `wb_mod_bakery_items` (`item_id`, `section_id`, `page_id`, `group_id`, `active`, `position`, `title`, `sku`, `stock`, `price`, `shipping`, `tax_rate`, `definable_field_0`, `definable_field_1`, `definable_field_2`, `link`, `description`, `full_desc`, `modified_when`, `modified_by`, `created_when`, `created_by`) VALUES
(1, 0, 0, 0, 0, 0, '', '', '', 0.00, 0.00, 0.00, '', '', '', '', '', '', 0, 0, 0, 0);

-- --------------------------------------------------------

--
-- Table structure for table `wb_mod_bakery_item_attributes`
--

CREATE TABLE IF NOT EXISTS `wb_mod_bakery_item_attributes` (
  `assign_id` int(6) NOT NULL AUTO_INCREMENT,
  `item_id` int(6) NOT NULL,
  `option_id` int(6) NOT NULL,
  `attribute_id` int(6) NOT NULL,
  `price` decimal(9,2) NOT NULL,
  `operator` varchar(1) NOT NULL,
  PRIMARY KEY (`assign_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `wb_mod_bakery_options`
--

CREATE TABLE IF NOT EXISTS `wb_mod_bakery_options` (
  `option_id` int(6) NOT NULL AUTO_INCREMENT,
  `option_name` varchar(50) NOT NULL,
  PRIMARY KEY (`option_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `wb_mod_bakery_order`
--

CREATE TABLE IF NOT EXISTS `wb_mod_bakery_order` (
  `order_id` int(6) NOT NULL AUTO_INCREMENT,
  `item_id` int(5) NOT NULL,
  `attributes` varchar(50) NOT NULL,
  `sku` varchar(20) NOT NULL,
  `quantity` int(7) NOT NULL,
  `price` decimal(9,2) NOT NULL,
  `tax_rate` decimal(5,2) NOT NULL,
  PRIMARY KEY (`order_id`,`item_id`,`attributes`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `wb_mod_bakery_page_settings`
--

CREATE TABLE IF NOT EXISTS `wb_mod_bakery_page_settings` (
  `section_id` int(11) NOT NULL DEFAULT '0',
  `page_id` int(11) NOT NULL DEFAULT '0',
  `page_offline` enum('yes','no') NOT NULL DEFAULT 'no',
  `offline_text` tinytext NOT NULL,
  `continue_url` int(11) NOT NULL,
  `header` text NOT NULL,
  `item_loop` text NOT NULL,
  `footer` text NOT NULL,
  `item_header` text NOT NULL,
  `item_footer` text NOT NULL,
  `items_per_page` int(11) NOT NULL DEFAULT '0',
  `num_cols` int(11) NOT NULL DEFAULT '3',
  `resize` int(11) NOT NULL DEFAULT '100',
  `lightbox2` varchar(10) NOT NULL DEFAULT 'detail',
  PRIMARY KEY (`section_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `wb_mod_bakery_page_settings`
--

INSERT INTO `wb_mod_bakery_page_settings` (`section_id`, `page_id`, `page_offline`, `offline_text`, `continue_url`, `header`, `item_loop`, `footer`, `item_header`, `item_footer`, `items_per_page`, `num_cols`, `resize`, `lightbox2`) VALUES
(0, 0, 'no', '', 0, '', '', '', '', '', 0, 3, 100, 'detail'),
(2, 2, 'no', 'The Shop XXX is offline for maintenance until XXX. Please come back later.<br />Sorry for any inconvenience.', 2, '<div class="mod_bakery_main_div_cart_bt_f">\n<form action="[SHOP_URL]" method="post">\n<input type="submit" name="view_cart" class="mod_bakery_bt_cart_f" value="[VIEW_CART]" />\n</form>\n</div>\n<table cellpadding="5" cellspacing="0" border="0" width="98%">\n<tr>\n', '<td class="mod_bakery_main_td_f">\n[THUMB]\n<br />\n<a href="[LINK]"><span class="mod_bakery_main_title_f">[TITLE]</span></a>\n<br />\n[DESCRIPTION]\n<br />\n[TXT_PRICE]: [CURRENCY] [PRICE]\n<br />\n[TXT_STOCK]: [STOCK]\n<br />\n<form action="[SHOP_URL]" method="post">\n[OPTION]\n<br />\n<input type="text" name="item[ITEM_ID]" class="mod_bakery_main_input_f" value="1" size="2" />\n<input type="submit" name="add_to_cart" class="mod_bakery_bt_add_f" value="[ADD_TO_CART]" />\n</form>\n</td>', '</tr>\n</table>\n<table cellpadding="0" cellspacing="0" border="0" width="98%" style="display: [DISPLAY_PREVIOUS_NEXT_LINKS]">\n<tr>\n<td colspan="3" align="left"><hr /></td>\n</tr>\n<tr>\n<td width="35%" align="left">[PREVIOUS_PAGE_LINK]</td>\n<td width="30%" align="center">[TXT_ITEM] [OF] </td>\n<td width="35%" align="right">[NEXT_PAGE_LINK]</td>\n</tr>\n</table>', '<center>', '[IMAGE]\n<form action="[SHOP_URL]" method="post">\n<table border="0" cellspacing="0" cellpadding="5" class="mod_bakery_item_table_f">\n<tr>\n<td colspan="2" align="left" valign="top"><h2 class="mod_bakery_item_title_f">[TITLE]</h2></td>\n</tr>\n<tr>\n<td align="left" valign="top"><span class="mod_bakery_item_sku_f">[TXT_SKU]:</span></td>\n<td align="left" valign="top">[SKU]</td>\n</tr>\n<tr>\n<td align="left" valign="top"><span class="mod_bakery_item_price_f">[TXT_PRICE]:</span></td>\n<td align="left" valign="top">[CURRENCY] [PRICE]</td>\n</tr>\n<tr>\n<td align="left" valign="top"><span class="mod_bakery_item_shipping_f">[TXT_SHIPPING]:</span></td>\n<td align="left" valign="top">[CURRENCY] [SHIPPING] </td>\n</tr>\n<tr>\n<td align="left" valign="top"><span class="mod_bakery_item_stock_f">[TXT_STOCK]:</span></td>\n<td align="left" valign="top">[STOCK]</td>\n</tr>\n<tr>        \n<td align="left" valign="top"><span class="mod_bakery_item_full_desc_f"><p>[TXT_FULL_DESC]:</p></span></td>\n<td align="left" valign="top">[FULL_DESC]</td>\n</tr>\n<tr>        \n<td align="left" valign="top"><span class="mod_bakery_shipping_cost_f">[TXT_SHIPPING_COST]:</span></td>\n<td align="left" valign="top">\n[TXT_DOMESTIC]: [CURRENCY] [SHIPPING_DOMESTIC]<br />\n[TXT_ABROAD]: [CURRENCY] [SHIPPING_ABROAD]</td>\n</tr>\n[OPTION]\n<tr>      \n<td align="left" valign="top"> </td>\n<td align="left" valign="top">\n<input type="text" name="item[ITEM_ID]"  class="mod_bakery_item_input_f" value="1" size="2" />\n<input type="submit" name="add_to_cart" class="mod_bakery_bt_add_f" value="[ADD_TO_CART]" />\n</td>\n</tr>\n</table>\n</form>\n[PREVIOUS] | <a href="[BACK]">[TXT_BACK]</a> | [NEXT]\n</center>\n<br />', 0, 3, 100, 'detail');

-- --------------------------------------------------------

--
-- Table structure for table `wb_mod_bakery_payment_methods`
--

CREATE TABLE IF NOT EXISTS `wb_mod_bakery_payment_methods` (
  `pm_id` int(11) NOT NULL AUTO_INCREMENT,
  `active` int(1) NOT NULL,
  `directory` varchar(50) NOT NULL,
  `name` varchar(50) NOT NULL,
  `version` varchar(6) NOT NULL,
  `author` varchar(50) NOT NULL,
  `requires` varchar(6) NOT NULL,
  `field_1` varchar(150) NOT NULL,
  `value_1` text NOT NULL,
  `field_2` varchar(150) NOT NULL,
  `value_2` text NOT NULL,
  `field_3` varchar(150) NOT NULL,
  `value_3` text NOT NULL,
  `field_4` varchar(150) NOT NULL,
  `value_4` text NOT NULL,
  `field_5` varchar(150) NOT NULL,
  `value_5` text NOT NULL,
  `field_6` varchar(150) NOT NULL,
  `value_6` text NOT NULL,
  `cust_email_subject` text NOT NULL,
  `cust_email_body` text NOT NULL,
  `shop_email_subject` text NOT NULL,
  `shop_email_body` text NOT NULL,
  PRIMARY KEY (`pm_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

Luisehahne


QuoteFatal error: Call to a member function numRows() on a non-object in /Applications/AMPPS/www/test/baker/modules/bakery/modify.php on line 52

Check the syntax from your sql statement, Most of them solve your issue

Dietmar
Note: Once the code has been generated, it is easy to debug. It's not a bug, it's a feature!

daydreamer


daydreamer

Strange mod_bakery_general_ settings not in thae database but all other tables are  :?

freeSbee

Hi daydreamer

Have a look into your database table mod_bakery_general_settings, if the fields shop_name, display_settings are present...

Regards Christoph

daydreamer

I'm running WB on localhost installed bakery and getting this error

Fatal error: Call to a member function numRows() on a non-object in /Applications/AMPPS/www/test/baker/modules/bakery/modify.php on line 52

Anyone had this issue or know what the problem is please?