"add products" button missing from admin create order page - magento - magento-1.7

We've just upgraded our site from 1.6.X to 1.7.0.2 and encountered this problem, 99% of the site is running fine.
When you go to sales/orders & create new order the "add products" button is missing? ive checked the styles and there is just a blank div where the button should be -
<div class="form-buttons"></div>
I've tried un-installing extensions, re-installing magento 1.7.0.2 from magento connect & i've also manually downloaded / over written the adminhtml folder, none of which have had any effect.
We also installed a fresh copy of magento with a blank database to the same server & the button is present.
Any ideas?

The changes is in the file located here :
/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Items.php around line 55
In previous version the getButtonsHtml() function was :
public function getButtonsHtml()
{
$addButtonData = array(
'label' => Mage::helper('sales')->__('Add Products'),
'onclick' => "order.productGridShow(this)",
'class' => 'add',
);
return $this->getLayout()->createBlock('adminhtml/widget_button')->setData($addButtonData)->toHtml();
}
The new version is :
public function getButtonsHtml()
{
$html = '';
// Make buttons to be rendered in opposite order of addition. This makes "Add products" the last one.
$this->_buttons = array_reverse($this->_buttons);
foreach ($this->_buttons as $buttonData) {
$html .= $this->getLayout()->createBlock('adminhtml/widget_button')->setData($buttonData)->toHtml();
}
return $html;
}
So now you can have more than 1 button, but the first default button doesn't exists anymore.
I'm not sure how to add it without overwritting this block.

Related

TYPO3 extbase, the php based views do not work when migrating from 9 to 10 version

I have developed a custom TYPO3 extbase extension that was perfectly worked on 8 and 9 version of TYPO3.
Recently I upgraded my installation to TYPO3 10 version but the php based views of my TYPO3 extbase extension do not work anymore.
The error that is displayed is:
Sorry, the requested view was not found.
The technical reason is: No template was found. View could not be resolved for action "getIcal" in class "Luc\Lucevents2\Controller\EventController"
I have read the instructions in the page
https://docs.typo3.org/m/typo3/book-extbasefluid/10.4/en-us/8-Fluid/9-using-php-based-views.html, but there is nothing different from what I have already done in my extension.
So, I am very confused because there is no explanation why the code stopped to work, the above link doesn't include any instructions about deprecated code or possible changes after migration!!
Could you give me any help?
Thank you very much!
George
I hit this problem today. The documentation for "php based views" seems to be outdated.Below is a description of my setup and the solution for TYPO3 10
What I had:
My situation was that I had a Controller with a showAction() action method.
In typoscript, I had setup a new format through the type parameter. Something like
rss = PAGE
rss {
typeNum = 58978
10 =< tt_content.list.20.skevents_eventfeeds
}
For this type (parameter type=58978) I had setup a class named View\EventFeeds\ShowRss with a render() method.
TYPO3 automatically resolved this class based on the type (rss) and the action name (show). This does not work any more.
What solves this issue:
in order for TYPO3 to find the correct class with the render method, it is sufficient to set the defaultViewObjectName variable of the Controller to the correct class name for the specific action. This can be done in the controller with the following new method
public function initializeShowAction()
{
$this->defaultViewObjectName = \Skar\Skevents\View\EventFeeds\ShowRss::class;
}
So now, before calling the showAction method, defaultViewObjectName is set to my ShowRss class which produces the output.
Please note that my ShowRss class extends \TYPO3\CMS\Extbase\Mvc\View\AbstractView . According to https://docs.typo3.org/m/typo3/book-extbasefluid/master/en-us/8-Fluid/9-using-php-based-views.html this is deprecated in TYPO3 11 and will have to change for TYPO3 12
the static template is already included and all the other operations of the extension are working very well except the php based views. The ext_localconf.php looks as follows: <?php
defined('TYPO3_MODE') || die('Access denied.');
$boot = function () {
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin(
'Luc.Lucevents2',
'Luceventsdisplay',
[
'Event' => 'list, show, delete, edit, monthview, test, ajax, deleteConfirm, showRss, getIcal, addForm, add, editForm, importeventtoforum',
'Channel' => 'list, show',
'Tag' => 'filter, show'
],
// non-cacheable actions
[
'Event' => 'list, show, delete, edit, monthview, test, ajax, deleteConfirm, showRss, getIcal, addForm, add, editForm, importeventtoforum',
'Channel' => 'list, show',
'Tag' => 'filter, show'
]
);
};
$boot();
unset($boot);
The action is registered in EventController.php and looks as follows:
/**
* action geticalaction
*
* #param \Luc\Lucevents2\Domain\Model\Event $event
* #return void
*/
public function getIcalAction(\Luc\Lucevents2\Domain\Model\Event $event = NULL)
{
$base_url = $this->request->getBaseUri();
$channel=$this->settings['channel_for_simple_users'];
if($this->request->hasArgument('duration'))
{
if ($this->request->getArgument('duration')=='6month') {
$duration=$this->request->getArgument('duration');
}
else
{
$duration='month';
}
$events = $this->eventRepository->get_events_for_rss_and_ical($duration,$channel);
$eventsarray= array();
foreach ($events as $obj){
$this->uriBuilder->setCreateAbsoluteUri(true);
$uri = $this->controllerContext->getUriBuilder()
->setUseCacheHash(false)
->uriFor('show', array("event" => $obj->getUid()));
$eventsarray[] = array($obj->getTitle(), $obj->getDescription(), $obj->getStartdatetime(),$obj->getEnddatetime(), $obj->getBuildingid(), $obj->getRoomid(), $obj->getPlace(), $obj->getCrdate(), $uri, $obj->getUid());
}
$this->view->assign('events', $eventsarray);
$this->view->assign('baseurl', $base_url);
}
else
{
$this->uriBuilder->setCreateAbsoluteUri(true);
$uri = $this->controllerContext->getUriBuilder()
->setUseCacheHash(false)
->uriFor('show', array("event" => $event->getUid()));
$this->view->assign('event', $event);
$this->view->assign('baseurl', $base_url);
$this->view->assign('uri', $uri);
}
}
Thank you very much!

TCA Icon overlay in typo3 backend

I’m working on an extension where I synchronise some data to another database and I wanted to show this in the backend using a TCA icon overlay. Sadly I could not find out how to do this. I thought about using ‘ctrl’=>‘typeicon_classes’ (using the state field of my table to choose an icon), this works for the default (non synchronised element) but I cannot figure out how to set an overlay. Any idea on how to do this?
My TCA configuration looks like this:
'ctrl' => [
...
'typeicon_column' => 'state',
'typeicon_classes' => [
'new' => 'mimetypes-x-content-login',
'synced' => 'mimetypes-x-content-login-overlay-approved',
]
],
The "synced" part does not work as expected. What I would expect is to either add the overlay at the end of the icon or by adding it with a whitespace but both did not work.
Any help is appreciated.
PS: I really just need this in the TYPO3 backend, the obvious solution for frontend is to use fluid or PHP but I don't think this suits the TYPO3 Backend list.
You need to register your icon files.
Given your icon files are named content_login.svg and content_login_overlay_approved.svg located in directory /Resources/Public/Icons/ you can register these in ext_localconf.php as following:
if (TYPO3_MODE === 'BE') {
$icons = [
'mimetypes-x-content-login' => 'content_login.svg',
'mimetypes-x-content-login-overlay-approved' => 'content_login_overlay_approved.svg',
];
$iconRegistry = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\Imaging\IconRegistry::class);
foreach ($icons as $identifier => $path) {
$iconRegistry->registerIcon(
$identifier,
\TYPO3\CMS\Core\Imaging\IconProvider\SvgIconProvider::class,
['source' => 'EXT:YOUREXTENSIONNANME/Resources/Public/Icons/' . $path]
);
}
}
Adapt yourextensionname

How to use TYPO3 Link wizard in extension

In an extension, I would like to be able to modify an existing link. The corresponding field in the database is one which may contain several links (e.g. tt_content.bodytext).
I want to reuse as much already existing functionality as possible. So I would like to use the already existing link wizard.
What I did find was the existing route rteckeditor_wizard_browse_links which uses rte_ckeditor/Classes/Controller/BrowseLinksController.php.
I use this in my view helper:
$parameters = [
'table' => $table,
'fieldName' => $field,
'pid' => $pid,
'uid' => $uid,
'recordType' => $recordType;
];
$urlParameters = [
'contentsLanguage' => 'en',
// 'route'
// 'token*
'P' => $parameters,
'curUrl' => [
'url' => $url
// todo: add anchor text etc. ...
],
'editorId' => 'cke_1'
];
$route = 'rteckeditor_wizard_browse_links';
return (string)$uriBuilder->buildUriFromRoute($route, $urlParameters);
This does opens the link wizard correctly. But it is intertwined with the ckeditor.
When I press "Set link" nothing happens and I get the following JavaScript error (visible if Console is open in Browser):
RteLinkBrowser.js?bust=8d6016d70f0f490d5e7d24262f0ec96230f399d9:77 Uncaught TypeError: Cannot read property 'document' of null
at Object.LinkBrowser.finalizeFunction (RteLinkBrowser.js?bust=8d6016d70f0f490d5e7d24262f0ec96230f399d9:77)
at HTMLFormElement.UrlLinkHandler.link (UrlLinkHandler.js?bust=8d6016d70f0f490d5e7d24262f0ec96230f399d9:40)
at HTMLFormElement.dispatch (jquery.min-16985e7a97b69d2a9c29e484ac3b581a.js:2)
at HTMLFormElement.y.handle (jquery.min-16985e7a97b69d2a9c29e484ac3b581a.js:2)
LinkBrowser.finalizeFunction # RteLinkBrowser.js?bust=8d6016d70f0f490d5e7d24262f0ec96230f399d9:77
UrlLinkHandler.link # UrlLinkHandler.js?bust=8d6016d70f0f490d5e7d24262f0ec96230f399d9:40
dispatch # jquery.min-16985e7a97b69d2a9c29e484ac3b581a.js:2
y.handle # jquery.min-16985e7a97b69d2a9c29e484ac3b581a.js:2
The corresponding line in RteLinkBrowser.js is:
var linkElement = RteLinkBrowser.CKEditor.document.createElement('a');
The Link Wizard expects the ckeditor window to be open and uses things in the DOM that are not there.
Is there some way to directly open the link wizard for a specific link within a text field?
Or alternatively open the text field with ckeditor and have the specific link preselected.
I don't have an answer, but at least here is a work-around / alternative:
Don't open Link wizard directly, open field in editor
As an alternative, consider not using the link wizard but using the route 'record_edit' to open the edit dialog for a specific RTE field. If you double-click on a link in that, the link wizard will open.
The following example was taken from linkvalidator in the core and modified. It opens an editor dialog for the field tt_content.bodytext for the record with uid $uid.
$requestUri = GeneralUtility::getIndpEnv('REQUEST_URI') .
'&id=' . $pageid;
$uriBuilder = GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Routing\UriBuilder::class);
$url = (string)$uriBuilder->buildUriFromRoute('record_edit', [
'edit' => [
'tt_content' => [
$uid => 'edit'
]
],
'columnsOnly' => 'bodytext',
'returnUrl' => $requestUri
]);
Update: For TYPO3 9, a ViewHelper exists for opening the field with FormEngine in the Backend. This has the same result.
https://docs.typo3.org/other/typo3/view-helper-reference/9.5/en-us/typo3/backend/latest/Link/EditRecord.html

SugarCRM Mass removal of custom fields

I have a few hundred custom fields to delete in an older version of SugarCRM. Is very labor intensive to delete through web interface...
Can this be done directly by deleting files in the instalation (vardefs, anything else?)
This is similar to [question asked earlier] (revert the custom fields made by sugarCRM), but was solved by using web interface for a few fields.
I can easily write a script then to remove the fields from the {table_name}_cstm tables...
You can try something like that (should be execute in a SugarCRM environment like an entryPoint and with an admin user)
$fieldsByModule = array(
'Accounts' => array(
'field_1_c',
'field_2_c',
),
'Contacts' => array(
'field_1_c',
'field_2_c',
),
);
require_once('modules/DynamicFields/DynamicField.php');
foreach ($fieldsByModule as $moduleName => $fields) {
foreach($fields as $field){
$dyField = new DynamicField();
$dyField->bean = BeanFactory::getBean($moduleName);;
$dyField->module = $moduleName;
$dyField->deleteField($field);
}
}
Live coding without test the code but the core of the process should be near like that.

SugarCRM- How to get POPUP when click on Save button?

I want when click Save in Edit View of some module (example Contact) to get pop up with some message (later I will get options OK and Cancel on that pop up.).
My function
YAHOO.SUGAR.MessageBox.show({msg: 'Foo'} );
is working when I put it at top of editviewdefs.php (I also must include
cache/include/javascript/sugar_grp_yui_widgets.js) ) file and when opening that view I am getting that pop up. But I want it to popup on Save,not when opening EditView (this was just testing that showed me that YAHOO function is working). So I try to create seperate customJavascript.js file in custom/modules/Contacts:
//<script type="text/javascript"
src="cache/include/javascript/sugar_grp_yui_widgets.js"></script>
function check_custom_data()
{
YAHOO.SUGAR.MessageBox.show({msg: 'Foo'} );
}
I modified custom/modules/Contacts/metadata/editviewdefs.php
<?php
$module_name = 'Contacts';
$viewdefs ['Contacts'] =
array (
'EditView' =>
array (
'templateMeta' =>
array (
'form' =>
array (
'hidden' =>
array (
0 => '<input type="hidden" name="opportunity_id" value="{$smarty.request.opportunity_id}">',
1 => '<input type="hidden" name="case_id" value="{$smarty.request.case_id}">',
2 => '<input type="hidden" name="bug_id" value="{$smarty.request.bug_id}">',
3 => '<input type="hidden" name="email_id" value="{$smarty.request.email_id}">',
4 => '<input type="hidden" name="inbound_email_id" value="{$smarty.request.inbound_email_id}">',
),
),
array(
'buttons' =>
array (
0 =>
array(
'customCode' =>
'<input title="Save [Alt+S]" accessKey="S" onclick="this.form.action.value=\'Save\'; return check_custom_data();" type="submit" name="button" value="'.$GLOBALS['app_strings']['LBL_SAVE_BUTTON_LABEL'].'">',
),
1 =>'Cancel'
)
),
'includes'=> array(
array('file'=>'custom/modules/Contacts/customJavascript.js'),
),
..........
.......
but when I click Save in EditView nothing happens but I want in that moment to get pop up with message (later I will add OK and Cancel options).
What am I doing wrong?
thank you
Updated with code for pop up only with some condition:
....
window.formToCheck = formname;
var contactTypeField = document.getElementById('first_name');
if (contactTypeField.value == 'Tori')
{
if (confirm("This dialog will pop-up whenever the user click on the Save button. "
+ "If you click OK, then you can execute some custom code, and then "
+ "execute the old form check function, which will process and submit "
+ "the form, using SugarCRM's standard behavior.")) {
var customCodeVariable = 5;
customCodeVariable = 55 + (customCodeVariable * 5);
return window.old_check_form(formname);
}
return false;
}
There are a number of ways to do things in SugarCRM, which makes it both very powerful and at times very difficult to customize - as there are so many different options available to you.
To make some kind of pop-up, or any custom log, happen upon clicking the "Save" button, I'd recommend the below solution rather than altering the editviewdefs.
The below solution does not require you modify any core SugarCRM files, so it is upgrade safe and can easily be installed on another instance.
What you will need to do is create a custom installable package, and install it into SugarCRM using the Module Loader.
This is the layout of the directory structure you will ultimately need to end up with:
SugarModuelPopUp
->custom
->include
->customPopUps
->custom_popup_js_include.php
->customPopUpContacts.js
->manifest.php
Create the SugarModuelPopUp folder, which will server as the root of this custom package.
Inside of SugarModuelPopUp, create a new PHP file with the name manifest.php. This file tells SugarCRM how to install the package.
In manifest.php, paste the following code:
<?php
$manifest = array(
array(
'acceptable_sugar_versions' => array()
),
array(
'acceptable_sugar_flavors' => array()
),
'readme' => 'Please consult the operating manual for detailed installation instructions.',
'key' => 'customSugarMod1',
'author' => 'Kyle Lowry',
'description' => 'Adds pop-up dialog on save on Contacts module.',
'icon' => '',
'is_uninstallable' => true,
'name' => 'Pop-Up Dialog On Save',
'published_date' => '2013-03-06 12:00:00',
'type' => 'module',
'version' => 'v1',
'remove_tables' => 'prompt'
);
$installdefs = array(
'id' => 'customSugarMod1',
'copy' => array(
array(
'from' => '<basepath>/custom/',
'to' => 'custom/'
)
),
'logic_hooks' => array(
array(
'module' => 'Contacts',
'hook' => 'after_ui_frame',
'order' => 1,
'description' => 'Creates pop-up dialog on save action.',
'file' => 'custom/include/customPopUps/custom_popup_js_include.php',
'class' => 'CustomPopJs',
'function' => 'getContactJs'
)
)
);
Next, you will want to make the custom folder. Inside of that, create the include folder. Inside of that, create the customPopUps folder.
Next, you will want to create the custom_popup_js_include.php file. This file controls when and where your custom JavaScript gets included on the page. Paste in the below code:
<?php
// prevent people from accessing this file directly
if (! defined('sugarEntry') || ! sugarEntry) {
die('Not a valid entry point.');
}
class CustomPopJs {
function getContactJs($event, $arguments) {
// Prevent this script from being injected anywhere but the EditView.
if ($_REQUEST['action'] != 'EditView') {
// we are not in the EditView, so simply return without injecting
// the Javascript
return;
}
echo '<script type="text/javascript" src="custom/include/customPopUps/customPopUpContacts.js"></script>';
}
}
Next you will need to create the customPopUpContacts.js file, which will create the custom pop-up upon clicking the Save button in the Contacts module EditView. Paste in the below code:
function override_check_form() {
// store a reference to the old form checking function
window.old_check_form = window.check_form;
// set the form checking function equal to something custom
window.check_form = function(formname) {
window.formToCheck = formname;
// you can create the dialog however you wish, but for simplicity I am
// just using standard javascript functions
if (confirm("This dialog will pop-up whenever the user click on the Save button. "
+ "If you click OK, then you can execute some custom code, and then "
+ "execute the old form check function, which will process and submit "
+ "the form, using SugarCRM's standard behavior.")) {
// you have clicked OK, so do some custom code here,
// replace this code with whatever you really want to do.
var customCodeVariable = 5;
customCodeVariable = 55 + (customCodeVariable * 5);
// now that your custom code has executed, you can let
// SugarCRM take control, process the form, and submit
return window.old_check_form(formname);
}
// the user clicked on Cancel, so you can either just return false
// and leave the person on the form, or you can execute some custom
// code or do whatever else you want.
return false;
}
}
// call the override function, which will replace the old form checker
// with something custom
override_check_form();
Once you have created the above directory structure, and the files in the correct folders, you can create a ZIP file of the project. It is important to note that for SugarCRM installable packages, your ZIP file must contain everything in the project directory. That is, you will not be zipping up the SugarModuelPopUp folder, but rather everything inside of it.
Next, you will want to install the custom package using SugarCRM's module loader. You can do this by:
Go to the SugarCRM Admin page.
Click on "Module Loader".
Click on "Browse" and select the ZIP package.
Click on the "Upload" button.
Once the package is uploaded, find its entry in the list of installable packages, and click on "Install"; proceeding with the standard SugarCRM installation process.
With this custom package installed, whenever you click on the "Save" button in the Contacts module EditView, a dialog will pop-up. You can replace the dialog code with anything you want, so as log as you don't modify the code framing it.
Further, you should be able to use this project as a foundation for future function additions to SugarCRM EditViews. Any module which uses the check_form method upon clicking of the "Save" button can have this kind of custom logic executed.
To do so for Accounts, for example, you would do the following:
Add an entry to the logic_hooks array element in manifest.php for Accounts.
'logic_hooks' => array(
array(
'module' => 'Contacts',
'hook' => 'after_ui_frame',
'order' => 1,
'description' => 'Creates pop-up dialog on save action.',
'file' => 'custom/include/customPopUps/custom_popup_js_include.php',
'class' => 'CustomPopJs',
'function' => 'getContactJs'
),
array(
'module' => 'Accounts',
'hook' => 'after_ui_frame',
'order' => 1,
'description' => 'Creates pop-up dialog on save action.',
'file' => 'custom/include/customPopUps/custom_popup_js_include.php',
'class' => 'CustomPopJs',
'function' => 'getAccountJs'
)
)
Add a new method to the CustomPopJs in the custom_popup_js_include.php file for the Accounts JavaScript.
function getAccountJs($event, $arguments) {
// Prevent this script from being injected anywhere but the EditView.
if ($_REQUEST['action'] != 'EditView') {
// we are not in the EditView, so simply return without injecting
// the Javascript
return;
}
echo '<script type="text/javascript" src="custom/include/customPopUps/customPopUpAccounts.js"></script>';
}
Create the customPopUpAccounts.js file, and use the customPopUpContacts.js code as a base for the functionality you want.
There are other ways of accomplishing your goal in SugarCRM, but this is the one I use personally, and it has the benefit of being upgrade safe and easily migratable to other SugarCRM instances.
I have SugarCRM CE 6.5 and this method didn't work to me (I mean creating the new module). However, I modified the logic_hook and put the files directly in custom/include folder and it works!