Drupal 7 Feeds Module not working - drupal-7

I have installed the Drupal 7 feeds module and created an Importer.
I can display the Stand-alone form, add a file but the upload / parse page just displays the message "Importing..." It doesn't do much else and does not import into a selected content type. No errors are displayed.
Any ideas?
// Importer below /////////////////////////////////////////////////////////
$feeds_importer = new stdClass();
$feeds_importer->disabled = FALSE;
$feeds_importer->api_version = 1;
$feeds_importer->id = 'shop_ids';
$feeds_importer->config = array(
'name' => 'Shop IDs',
'description' => 'Import a CSV file which feeds into Shop ID node type',
'fetcher' => array(
'plugin_key' => 'FeedsFileFetcher',
'config' => array(
'allowed_extensions' => 'txt csv tsv xml opml',
'direct' => 0,
'directory' => 'public://feeds',
'allowed_schemes' => array(
'public' => 'public',
'private' => 'private',
),
),
),
'parser' => array(
'plugin_key' => 'FeedsCSVParser',
'config' => array(
'delimiter' => ',',
'no_headers' => 1,
),
),
'processor' => array(
'plugin_key' => 'FeedsNodeProcessor',
'config' => array(
'expire' => '-1',
'author' => 0,
'authorize' => 1,
'mappings' => array(
0 => array(
'source' => '\'0\'',
'target' => 'title',
'unique' => 1,
),
1 => array(
'source' => '\'1\'',
'target' => 'body',
'unique' => FALSE,
),
),
'update_existing' => '1',
'input_format' => 'plain_text',
'skip_hash_check' => 0,
'bundle' => 'shop_ids',
),
),
'content_type' => '',
'update' => 0,
'import_period' => '-1',
'expire_period' => 3600,
'import_on_create' => 1,
'process_in_background' => 0,
);

Looks like there was an error with batch.js
JQuery causing function error
fix was to add ; to beginning of code.
;(function ($) {
and add the (jQuery); to the end of the file...
})(jQuery);

Related

TYPO3 Custom Content fields on save database error

I added some content Fields which looks as it follows;
$temporaryColumnHC = array(
'my_type' => array(
'exclude' => 0,
'label' => 'My Type',
'config' => array(
'type' => 'select',
'renderType' => 'selectSingle',
'items' => array(
array('Bar', 'bar'),
array('Pie', 'pie'),
array('Donut', 'donut'),
array('Line', 'line'),
array('Bar 2', 'bar2'),
array('Bar 3', 'bar3'),
array('Bubble', 'bubble'),
)
)
),
'my_suffix' => array(
'exclude' => 0,
'label' => 'My Label Suffix',
'config' => array(
'type' => 'input',
'size' => 10,
'max' => 20
)
),
'my_source_url' => array(
'exclude' => 0,
'label' => 'Source URL',
'config' => array(
'type' => 'input',
'renderType' => 'inputLink'
)
),
'my_source' => array(
'exclude' => 0,
'label' => 'Source Text',
'config' => array(
'type' => 'text',
'cols' => 40,
'rows' => 15
)
),
);
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTCAcolumns(
'tt_content',
$temporaryColumnHC
);
but on save I get the following error
error [1620]: Unknown column 'suffix' in 'field list'
What I have to do that this fields is saved in database
As mentioned already as a comment, TYPO3 complains that the column is missing in the Database.
Your extension should provide an ext_tables.sql which extends the Database Schema. See https://docs.typo3.org/m/typo3/reference-coreapi/10.4/en-us/ExtensionArchitecture/FilesAndLocations/Index.html#ext-tables-sql for further information.
The file always contains CREATE TABLE statements, which will be converted by TYPO3 do update the schema.
Updating the schema can be done through the install tool of TYPO3, or tools like TYPO3 console via command line.

CakePHP 2.x retriving data with i18n in a loop

I'm looping trough Features (belongTo FeatureType) and find() FeatureType.name for each Feature.feature_type_id.
I'm getting first record correct (with i18n translation) but in all the rest the i18n translation is not in place, but given as separate record.
What I am doing wrong?
this is the debug of my result table:
array(
'FeatureType' => array(
'id' => '28',
'name' => 'kolor suwaka',
'comment' => 'kolor suwaka etui notebook',
'locale' => 'pol'
)
)
array(
'FeatureType' => array(
'id' => '7',
'name' => '',
'comment' => '',
'locale' => 'pol'
),
(int) 0 => array(
'FeatureType__i18n_name' => 'kolor materiału',
'FeatureType__i18n_comment' => 'gra w klasy'
)
)
array(
'FeatureType' => array(
'id' => '11',
'name' => '',
'comment' => '',
'locale' => 'pol'
),
(int) 0 => array(
'FeatureType__i18n_name' => 'kolor',
'FeatureType__i18n_comment' => 'kółko i krzyżyk (jasnoszare i ciemnoszare)'
)
)
array(
'FeatureType' => array(
'id' => '27',
'name' => '',
'comment' => '',
'locale' => 'pol'
),
(int) 0 => array(
'FeatureType__i18n_name' => 'obwód głowy',
'FeatureType__i18n_comment' => 'rozmiar kapelusza czarownicy'
)
)
This is the code:
$features_str = "";
if (!empty($product['Features'])) {
foreach ($product['Features'] as $featureIndex => $feature) {
$featureTypeModel = new FeatureType();
$feature_type = $featureTypeModel->find("first", array("conditions" => array("FeatureType.id" => $feature['feature_type_id'])));
if (strlen($features_str) > 0) $features_str .= ", ";
$features_str .= $feature_type['FeatureType']['name'] . ': ' . $feature['name'];
unset($featureTypeModel);
}
}

How do I add publish dates to uploaded files in Typo3?

I am currently maintaining a client's existing Typo3 6.1 site and one of the things they would like to add to their site is the possibility of applying publish and expiration dates on uploaded files, in the same way such dates can be applied on Typo3 pages.
I did some research on the matter to see if something like this had already been done before. I tried looking for existing Typo3 extensions on Google and on the official Typo3 extensions repository that would add this functionality, but nothing like this seems to exist. I also tried to find ways of doing it myself, still without any results.
What would be the best approach to add this functionality to a Typo3 6.1 website?
EDIT
After some investigating, I noticed another extension was already hooked up with the TCEForm of the file editing page: http://i.stack.imgur.com/up7mO.png
In this screenshot, you can see I managed to add the start and end datetime fields as the first two fields in the form ("Date de publication" and "Date d'expiration"). I currently have the following configuration in my ext_table.php:
<?php
if (!defined('TYPO3_MODE')) {
die('Access denied.');
}
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerPlugin(
$_EXTKEY, 'Documents', 'Documents'
);
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addStaticFile($_EXTKEY, 'Configuration/TypoScript', 'Documents');
\TYPO3\CMS\Core\Utility\GeneralUtility::loadTCA('sys_file');
$newFileColumns = array(
'date_publication' => array(
'exclude' => 0,
'label' => 'LLL:EXT:the_extension_key/Resources/Private/Language/locallang_db.xlf:document.date_publication',
'config' => array(
'type' => 'input',
'size' => 13,
'max' => 20,
'eval' => 'datetime',
'checkbox' => 0,
'default' => 0,
'range' => array(
'lower' => mktime(0, 0, 0, date('m'), date('d'), date('Y'))
),
),
),
'date_expiration' => array(
'exclude' => 0,
'label' => 'LLL:EXT:the_extension_key/Resources/Private/Language/locallang_db.xlf:document.date_expiration',
'config' => array(
'type' => 'input',
'size' => 13,
'max' => 20,
'eval' => 'datetime',
'checkbox' => 0,
'default' => 0,
'range' => array(
'lower' => mktime(0, 0, 0, date('m'), date('d'), date('Y'))
),
),
),
'desactive' => array(
'exclude' => 1,
'config' => array(
'type' => 'passthrough'
)
),
'isbn' => array(
'label' => 'LLL:EXT:the_extension_key/Resources/Private/Language/locallang_db.xlf:document.isbn',
'config' => array(
'type' => 'input',
'size' => 50,
'eval' => 'trim'
),
),
'auteurs_internes' => array(
'label' => 'LLL:EXT:the_extension_key/Resources/Private/Language/locallang_db.xlf:document.auteurs_internes',
'config' => array(
'type' => 'select',
'foreign_table' => 'fe_users',
'MM' => 'tx_documents_document_auteur_mm',
'size' => 5,
'maxitems' => 10,
'minitems' => 0,
'wizards' => array(
'suggest' => array(
'type' => 'suggest',
'default' => array(
'searchWholePhrase' => 1
),
),
),
),
),
'auteurs_externes' => array(
'label' => 'LLL:EXT:the_extension_key/Resources/Private/Language/locallang_db.xlf:document.auteurs_externes',
'config' => array(
'type' => 'input',
'size' => 50,
'eval' => 'trim'
),
),
'responsable' => array(
'label' => 'LLL:EXT:the_extension_key/Resources/Private/Language/locallang_db.xlf:document.responsable',
'config' => array(
'type' => 'group',
'internal_type' => 'db',
'allowed' => 'tx_common_domain_model_unitelogique',
'size' => 1,
'maxitems' => 1,
'minitems' => 0,
'wizards' => array(
'suggest' => array(
'type' => 'suggest',
'default' => array(
'searchWholePhrase' => 1
),
),
),
),
),
'type_document' => array(
'label' => 'LLL:EXT:the_extension_key/Resources/Private/Language/locallang_db.xlf:document.type_document',
'config' => array(
'type' => 'select',
'foreign_table' => 'sys_category',
'foreign_table_where' => ' AND sys_category.tx_common_type = "type_document" ORDER BY sys_category.title ASC',
'maxitems' => 1,
'minitems' => 1,
'renderMode' => 'tree',
'treeConfig' => array(
'parentField' => 'parent',
),
),
),
'public_cible' => array(
'label' => 'LLL:EXT:the_extension_key/Resources/Private/Language/locallang_db.xlf:document.public_cible',
'config' => array(
'type' => 'select',
'foreign_table' => 'sys_category',
'MM' => 'tx_documents_document_publiccible_mm',
'foreign_table_where' => ' AND sys_category.tx_common_type = "public_cible_document" ORDER BY sys_category.title ASC',
'maxitems' => 100,
'minitems' => 0,
'renderMode' => 'tree',
'treeConfig' => array(
'parentField' => 'parent',
),
),
),
'important' => array(
'exclude' => 1,
'label' => 'LLL:EXT:the_extension_key/Resources/Private/Language/locallang_db.xlf:document.important',
'config' => array(
'type' => 'check',
),
),
'nouveau' => array(
'label' => 'LLL:EXT:the_extension_key/Resources/Private/Language/locallang_db.xlf:document.nouveau',
'config' => array(
'type' => 'input',
'eval' => 'date'
),
),
'misajour' => array(
'label' => 'LLL:EXT:the_extension_key/Resources/Private/Language/locallang_db.xlf:document.misajour',
'config' => array(
'type' => 'check',
),
),
'no_magistra' => array(
'label' => 'LLL:EXT:the_extension_key/Resources/Private/Language/locallang_db.xlf:document.no_magistra',
'config' => array(
'type' => 'input',
'size' => 50,
'eval' => 'trim'
),
),
'centre_documentation' => array(
'label' => 'LLL:EXT:the_extension_key/Resources/Private/Language/locallang_db.xlf:document.centre_documentation',
'config' => array(
'type' => 'check',
),
),
'image' => array(
'exclude' => 0,
'label' => 'LLL:EXT:the_extension_key/Resources/Private/Language/locallang_db.xlf:document.image',
'config' => array(
'type' => 'group',
'internal_type' => 'file',
'allowed' => $GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext'],
'minitems' => 0,
'maxitems' => 1,
'size' => 1,
'show_thumbs' => 1,
'uploadfolder' => 'uploads/pics',
'disable_controls' => 'list',
),
),
);
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTCAcolumns('sys_file', $newFileColumns);
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addToAllTCAtypes('sys_file', '--div--;LLL:EXT:the_extension_key/Resources/Private/Language/locallang_db.xlf:document.tab, date_publication, date_expiration, isbn, auteurs_internes, auteurs_externes, responsable, type_document, public_cible, important, nouveau, no_magistra, centre_documentation, image');
// Edit of existing fields
\TYPO3\CMS\Core\Utility\GeneralUtility::loadTCA('sys_file');
$TCA['sys_file']['columns']['title']['config']['placeholder'] = '';
$TCA['sys_file']['columns']['title']['config']['eval'] = 'required';
$TCA['sys_file']['columns']['title']['config']['size'] = '50';
$TCA['sys_file']['columns']['description']['config']['wizards'] = array(
'RTE' => array(
'icon' => 'wizard_rte2.gif',
'notNewRecords' => 1,
'RTEonly' => 1,
'script' => 'wizard_rte.php',
'title' => 'LLL:EXT:cms/locallang_ttc.xlf:bodytext.W.RTE',
'type' => 'script'
)
);
$TCA['sys_file']['columns']['description']['defaultExtras'] = 'richtext:rte_transform[flag=rte_enabled|mode=ts]';
// Add category types
\TYPO3\CMS\Core\Utility\GeneralUtility::loadTCA('sys_category');
$TCA['sys_category']['columns']['tx_common_type']['config']['items'][] = array('LLL:EXT:the_extension_key/Resources/Private/Language/locallang_db.xlf:category.type.type_document', 'type_document');
$TCA['sys_category']['columns']['tx_common_type']['config']['items'][] = array('LLL:EXT:the_extension_key/Resources/Private/Language/locallang_db.xlf:category.type.public_cible_document', 'public_cible_document');
?>
However, defining the columns as start and end access dates with
$GLOBALS['TCA']['sys_file']['ctrl']['enablecolumns']['starttime'] = 'tx_myext_starttime';
$GLOBALS['TCA']['sys_file']['ctrl']['enablecolumns']['endtime'] = 'tx_myext_starttime';
as suggested in the answers makes the file list show an error instead of loading a list of files. Instead, I tried using the $TCA variable to define them. The error page shown by Typo3 is not shown anymore using this, but the editing page still can't be rendered successfully.
The $TCA configuration I added:
$TCA['sys_file'] = array(
'ctrl' => array(
'label' => 'title',
'label_alt' => 'name,description,alternative,identifier,uid',
'tstamp' => 'tstamp',
'crdate' => 'crdate',
'cruser_id' => 'cruser_id',
'versioningWS' => 2,
'versioning_followPages' => TRUE,
'origUid' => 't3_origuid',
'enablecolumns' => array(
'disabled' => 'desactive',
'starttime' => 'date_publication',
'endtime' => 'date_expiration',
)
)
);
The following image shows what happens with this $TCA configuration added while trying to edit a file: http://i.stack.imgur.com/8VaCD.png
The TCEForm is simply not rendered and I don't know why. I'm not sure if my configuration in ext_tables.php contains a bad configuration (especially in the $TCA config I added) or if the problem comes from another file in the extension.
What can be causing this error and how can I fix it?
FAL (File Abstraction Layer) does not have a starttime and endtime field.
But since the sys_file related tables (like sys_file_reference) can be extended by your own extension and TCA offers you the starttime/endtime functionality by default my biggest guess will be that this can be accomplished with some modifications in the TCA.
Here a quick kickstart of how you can try to extend sys_file with the starttime and endtime fields.
ext_emconf.php
$EM_CONF[$_EXTKEY] = array (
// more stuff here in between
'constraints' => array (
'depends' => array (
'filelist' => '6.1.0-6.1.99',
),
),
);
ext_tables.sql
#
# Table structure for table 'sys_file'
#
CREATE TABLE sys_file (
tx_myext_starttime int(11) unsigned DEFAULT '0' NOT NULL,
tx_myext_endtime int(11) unsigned DEFAULT '0' NOT NULL,
)
ext_tables.php
<?php
if (!defined ('TYPO3_MODE')) {
die ('Access denied.');
}
$tempColumns = array();
$tempColumns['tx_myext_starttime'] = array(
'exclude' => 1,
'l10n_mode' => 'mergeIfNotBlank',
'label' => 'LLL:EXT:lang/locallang_general.xlf:LGL.starttime',
'config' => array(
'type' => 'input',
'size' => 13,
'max' => 20,
'eval' => 'datetime',
'checkbox' => 0,
'default' => 0,
'range' => array(
'lower' => mktime(0, 0, 0, date('m'), date('d'), date('Y'))
),
),
);
$tempColumns['tx_myext_endtime'] = array(
'exclude' => 1,
'l10n_mode' => 'mergeIfNotBlank',
'label' => 'LLL:EXT:lang/locallang_general.xlf:LGL.endtime',
'config' => array(
'type' => 'input',
'size' => 13,
'max' => 20,
'eval' => 'datetime',
'checkbox' => 0,
'default' => 0,
'range' => array(
'lower' => mktime(0, 0, 0, date('m'), date('d'), date('Y'))
),
),
);
$GLOBALS['TCA']['sys_file']['ctrl']['enablecolumns']['starttime'] = 'tx_myext_starttime';
$GLOBALS['TCA']['sys_file']['ctrl']['enablecolumns']['endtime'] = 'tx_myext_starttime';
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTCAcolumns('sys_file', $tempColumns, 1);
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addToAllTCAtypes('sys_file', '--div--;LLL:EXT:cms/locallang_ttc.xlf:tabs.access, tx_myext_starttime, tx_myext_endtime');
unset($tempColumns);
I don't know if the FAL persistence layer and repositories does support (or better: eat) this configuration and I can't estimate in which kind of problems you're gonna run. But I guess it's a try worth.
Good luck!

TYPO3 FAL: enable Alt text and Link for custom domain field

I have a "Products" extension with a db table "tx_xxxproducts_domain_model_product" having a field "accessories":
'accessories' => array(
'exclude' => 0,
'label' => 'LLL:EXT:xxx_products/Resources/Private/Language/locallang_db.xlf:tx_xxxproducts_domain_model_product.accessories',
'config' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getFileFieldTCAConfig('accessories', array(
'appearance' => array(
'createNewRelationLinkTitle' => 'LLL:EXT:cms/locallang_ttc.xlf:images.addFileReference',
'collapseAll' => TRUE,
),
), $GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext'])
),
This field should have references to images.
It works, but the file references only have the fields Title and Description.
How can I add Link and Alternative Text, as the default Images CType has?
Thank you.
I found the answer in tt_content's TCA:
'accessories' => array(
'exclude' => 0,
'label' => 'LLL:EXT:xxx_products/Resources/Private/Language/locallang_db.xlf:tx_xxxproducts_domain_model_product.accessories',
'config' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getFileFieldTCAConfig('accessories', array(
'appearance' => array(
'createNewRelationLinkTitle' => 'LLL:EXT:cms/locallang_ttc.xlf:images.addFileReference',
'collapseAll' => TRUE,
),
'foreign_types' => array(
'0' => array(
'showitem' => '
--palette--;LLL:EXT:lang/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette,
--palette--;;filePalette'
),
\TYPO3\CMS\Core\Resource\File::FILETYPE_IMAGE => array(
'showitem' => '
--palette--;LLL:EXT:lang/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette,
--palette--;;filePalette'
),
)
), $GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext'])
),
Check the 'foreign_types' key.
TYPO3 v8 Change => https://docs.typo3.org/typo3cms/TCAReference/ColumnsConfig/Type/Inline.html#file-abstraction-layer
'overrideChildTca' => [
'types' => [
Instead of
'foreign_types' => [
add this in your array element 'config', after 'appearance' for example:
'foreign_types' => array(
'0' => array(
'showitem' => '--palette--;LLL:EXT:lang/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette,--palette--;;filePalette'
),
\TYPO3\CMS\Core\Resource\File::FILETYPE_TEXT => array(
'showitem' => '--palette--;LLL:EXT:lang/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette,--palette--;;filePalette'
),
\TYPO3\CMS\Core\Resource\File::FILETYPE_IMAGE => array(
'showitem' => '--palette--;LLL:EXT:lang/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette,--palette--;;filePalette'
),
\TYPO3\CMS\Core\Resource\File::FILETYPE_AUDIO => array(
'showitem' => '--palette--;LLL:EXT:lang/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette,--palette--;;filePalette'
),
\TYPO3\CMS\Core\Resource\File::FILETYPE_VIDEO => array(
'showitem' => '--palette--;LLL:EXT:lang/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette,--palette--;;filePalette'
),
\TYPO3\CMS\Core\Resource\File::FILETYPE_APPLICATION => array(
'showitem' => '--palette--;LLL:EXT:lang/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette,--palette--;;filePalette'
),
),

Drupal 7 programmatically create webform components

I've followed this great document which successfully creates a webform and associated components.
I am trying to adjust the code so it works for existing webforms instead of creating new ones.
My code is as follows:
$nid = 12;
$node = node_load(12);
// Create the webform components.
$components = array(
array(
'name' => 'Gender',
'form_key' => 'gender',
'type' => 'select',
'mandatory' => 1,
'weight' => 0,
'pid' => 0,
'extra' => array(
'title_display' => 'inline',
'private' => 0,
'items' => "Mrs|Mrs\nMiss|Miss\nMr|Mr",
'aslist' => 1,
),
),
);
// Setup notification email.
$emails = array(
array(
'email' => 'somebody#example.tld',
'subject' => 'default',
'from_name' => 'default',
'from_address' => 'default',
'template' => 'default',
'excluded_components' => array(),
),
);
// Attach the webform to the node.
$node->webform = array(
'confirmation' => '',
'confirmation_format' => NULL,
'redirect_url' => '<confirmation>',
'status' => '1',
'block' => '0',
'teaser' => '0',
'allow_draft' => '0',
'auto_save' => '0',
'submit_notice' => '1',
'submit_text' => '',
'submit_limit' => '-1', // User can submit more than once.
'submit_interval' => '-1',
'total_submit_limit' => '-1',
'total_submit_interval' => '-1',
'record_exists' => TRUE,
'roles' => array(
0 => '1', // Anonymous user can submit this webform.
),
'emails' => $emails,
'components' => $components,
);
// Save the node.
node_save($node);
When I attempt to execute my code I get the following error:
Error message SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'nid' cannot be null
First try to print all the available values of $node.
echo "<pre>";
print_r($node);
echo "</pre>"'
exit;
check that you are getting value for $node[nid] or not.

Resources