Forum

Thread tagged as: Problem, Configuration

Perch standard with shop - countries missing

Hi,

Am experimenting with Perch Shop using standard Perch. I'm working through the initial setup (no front end pages yet; just playing with admin), but the countries list is empty, probably largely because the countries database table (perch2_shop_countries) is empty. Is this a limitation of using standard Perch, or have I missed something, or ... ?

Thanks for your help :)

Diagnostics:

    Perch: 2.8.29, PHP: 5.4.45, MySQL: mysqlnd 5.0.10 - 20111026 - $Id: c85105d7c6f7d70d609bb4c000257868a40840ab $, with PDO
    Server OS: Linux, apache2handler
    Installed apps: content (2.8.29), assets (2.8.29), categories (2.8.29), perch_shop_orders (1.0.2), perch_shop_products (1.0.2), perch_shop (1.0.2), perch_members (1.5)
    App runtimes: <?php $apps_list = array( 'content', 'categories', 'perch_members', 'perch_shop', );
    PERCH_LOGINPATH: /perch
    PERCH_PATH: /home/n2bspub/public_html/perch
    PERCH_CORE: /home/n2bspub/public_html/perch/core
    PERCH_RESFILEPATH: /home/n2bspub/public_html/perch/resources
    Image manipulation: GD
    PHP limits: Max upload 6M, Max POST 8M, Memory: 96M, Total max file upload: 6M
    F1: 2edba60ed1f613d6dd804feb202456a2
    Resource folder writeable: Yes
    HTTP_HOST: <hidden by me>
    DOCUMENT_ROOT: /home/n2bspub/public_html
    REQUEST_URI: /perch/core/settings/diagnostics/
    SCRIPT_NAME: /perch/core/settings/diagnostics/index.php
Linda Marson

Linda Marson 0 points

  • 5 years ago

Update: Located the database insert in setup. The number of columns in the table doesn't match the number of fields defined in INSERT INTO. I'm guessing the last column shouldn't be there, as PerchShop_Countries.class.php contains the same fields as INSERT INTO. Is it 'safe' to remove this last column, or did something not get updated somewhere which it will need later?

Drew McLellan

Drew McLellan 2638 points
Perch Support

Which column are you talking about?

Hi,

Apologies for not being clearer! In data.sql in the perch_shop app:

INSERT INTO `__PREFIX__shop_countries` (`countryID`, `country`, `iso2`, `iso3`, `isonum`, `eu`)
VALUES
    (1,'Afganistan','AF','AFG',4,0,1),
...

Six fields in INSERT statement, seven fields in the data. db.sql tells it to create seven fields:

CREATE TABLE IF NOT EXISTS `__PREFIX__shop_countries` (
  `countryID` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `country` varchar(255) NOT NULL DEFAULT '',
  `iso2` char(2) NOT NULL DEFAULT '',
  `iso3` char(3) NOT NULL DEFAULT '',
  `isonum` int(10) unsigned NOT NULL DEFAULT '0',
  `eu` tinyint(1) unsigned NOT NULL DEFAULT '0',
  `countryActive` tinyint(1) unsigned NOT NULL DEFAULT '1',
  PRIMARY KEY (`countryID`)
) CHARSET=utf8;

so it throws it when it gets six for the data. PerchShop_Countries.class.php also looks for six fields:

public $static_fields   = array('countryID', 'country', 'iso2', 'iso3', 'isonum', 'eu');

My initial question was whether I can remove the last field (countryActive), but having just looked at db.sql, I'm thinking probably not! Is countryActive being used anywhere at the moment?

Thanks :)

Drew McLellan

Drew McLellan 2638 points
Perch Support

countryActive has a default value, so it doesn't need to be included in the insert.

If I attempt to run the INSERT manually (via phpMyAdmin) I get the error "Column count doesn't match value count at row 1" because there are six columns and seven values. Never mind; I'll sort it out this end.